changeset 19:d633bf82328b

Added a popup dialog to confirm whether the user wants to always enable automatic mail opening when opening the mailbox.
author Zerotorescue
date Thu, 09 Sep 2010 17:43:17 +0200
parents e25dd56b0deb
children 82df47a7fbf0
files Core.lua
diffstat 1 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Core.lua	Thu Sep 09 16:44:50 2010 +0200
+++ b/Core.lua	Thu Sep 09 17:43:17 2010 +0200
@@ -274,8 +274,29 @@
 	-- We need to know when opening has completed
 	self:RegisterMessage("MO_OPEN_COMPLETE");
 	
-	if self.db.profile.uses == 0 then
-		--TODO:statispopupdialog
+	if self.db.profile.uses == 0 and MailOpener.db.profile.general.defaultStatus ~= "_enabled" then
+		StaticPopupDialogs["MailOpenerFirstUseConfirmBox"] = {
+			text = "You are using |cff15ff00Mail Opener|r for the first time. Do you wish to always |cf00ff000enable|r |cfffed000automatic mail opening when you open the mailbox|r?\n\nYou can always change the standard behaviour in the General options.",
+			button1 = "Yes",
+			button2 = "No",
+			OnAccept = function()
+				MailOpener.db.profile.general.defaultStatus = "_enabled";
+				print("|cff15ff00Mail Opener|r: You can always change the default status in the General config (|cff00ffff/mo c|r).");
+				
+				print("|cff15ff00Mail Opener|r: |cff00ff00Enabling|r automatic opening of mail.");
+				MailOpener.cbOpenAll:SetChecked(true);
+				
+				AutoOpenMail = true;
+				MailOpener:ScheduleOpen(false);
+			end,
+			OnCancel = function (_,reason)
+				print("|cff15ff00Mail Opener|r: You can always change the default status in the General config (|cff00ffff/mo c|r).");
+			end,
+			timeout = 0,
+			whileDead = 1,
+			hideOnEscape = 1,
+		};
+		StaticPopup_Show("MailOpenerFirstUseConfirmBox");
 	end
 	
 	self.db.profile.uses = ( self.db.profile.uses + 1 );
@@ -391,7 +412,7 @@
 	elseif currentMailWithAttachments < tempLastAmount then
 		-- We lost a mail
 		
-		-- TODO: NYI: May need to delay this until the mail is actually deleted
+		--TODO: NYI: May need to delay this until the mail is actually deleted to keep the mail count more realtime
 		
 		self:Debug("MO_MAIL_EMPTIED");