comparison Core.lua @ 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 fb952805d8b7
children d52e64bd048f
comparison
equal deleted inserted replaced
18:e25dd56b0deb 19:d633bf82328b
272 self:RegisterEvent("MAIL_INBOX_UPDATE"); 272 self:RegisterEvent("MAIL_INBOX_UPDATE");
273 273
274 -- We need to know when opening has completed 274 -- We need to know when opening has completed
275 self:RegisterMessage("MO_OPEN_COMPLETE"); 275 self:RegisterMessage("MO_OPEN_COMPLETE");
276 276
277 if self.db.profile.uses == 0 then 277 if self.db.profile.uses == 0 and MailOpener.db.profile.general.defaultStatus ~= "_enabled" then
278 --TODO:statispopupdialog 278 StaticPopupDialogs["MailOpenerFirstUseConfirmBox"] = {
279 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.",
280 button1 = "Yes",
281 button2 = "No",
282 OnAccept = function()
283 MailOpener.db.profile.general.defaultStatus = "_enabled";
284 print("|cff15ff00Mail Opener|r: You can always change the default status in the General config (|cff00ffff/mo c|r).");
285
286 print("|cff15ff00Mail Opener|r: |cff00ff00Enabling|r automatic opening of mail.");
287 MailOpener.cbOpenAll:SetChecked(true);
288
289 AutoOpenMail = true;
290 MailOpener:ScheduleOpen(false);
291 end,
292 OnCancel = function (_,reason)
293 print("|cff15ff00Mail Opener|r: You can always change the default status in the General config (|cff00ffff/mo c|r).");
294 end,
295 timeout = 0,
296 whileDead = 1,
297 hideOnEscape = 1,
298 };
299 StaticPopup_Show("MailOpenerFirstUseConfirmBox");
279 end 300 end
280 301
281 self.db.profile.uses = ( self.db.profile.uses + 1 ); 302 self.db.profile.uses = ( self.db.profile.uses + 1 );
282 303
283 self:Debug("defaultStatus:" .. self.db.profile.general.defaultStatus); 304 self:Debug("defaultStatus:" .. self.db.profile.general.defaultStatus);
389 self:ScheduleOpen(false); 410 self:ScheduleOpen(false);
390 end 411 end
391 elseif currentMailWithAttachments < tempLastAmount then 412 elseif currentMailWithAttachments < tempLastAmount then
392 -- We lost a mail 413 -- We lost a mail
393 414
394 -- TODO: NYI: May need to delay this until the mail is actually deleted 415 --TODO: NYI: May need to delay this until the mail is actually deleted to keep the mail count more realtime
395 416
396 self:Debug("MO_MAIL_EMPTIED"); 417 self:Debug("MO_MAIL_EMPTIED");
397 418
398 -- Yell that we successfully opened/removed a mail 419 -- Yell that we successfully opened/removed a mail
399 self:SendMessage("MO_MAIL_EMPTIED"); 420 self:SendMessage("MO_MAIL_EMPTIED");