comparison Core.lua @ 85:c15dbeb84ddc

Fixed an error when toggling auto mail on or off.
author Zerotorescue
date Fri, 17 Sep 2010 11:44:08 +0200
parents eadff31e61e8
children 0a8e4a93316d
comparison
equal deleted inserted replaced
84:3179c5f90a48 85:c15dbeb84ddc
174 check:SetScript("OnClick", function(self) 174 check:SetScript("OnClick", function(self)
175 if IsShiftKeyDown() then 175 if IsShiftKeyDown() then
176 -- Shift key = toggle addon on or off, since addon is already on there's only one option 176 -- Shift key = toggle addon on or off, since addon is already on there's only one option
177 177
178 if not MailOpener:IsEnabled() then 178 if not MailOpener:IsEnabled() then
179 self:Print(L["Shift key was held down, so |cff00ff00enabling|r the entire addon as well as automatic opening of mail."]); 179 MailOpener:Print(L["Shift key was held down, so |cff00ff00enabling|r the entire addon as well as automatic opening of mail."]);
180 180
181 MailOpener:Enable(); 181 MailOpener:Enable();
182 182
183 -- The above calls MAIL_SHOW which changes AutoOpenMail, so we can't remember the old setting 183 -- The above calls MAIL_SHOW which changes AutoOpenMail, so we can't remember the old setting
184 AutoOpenMail = true; 184 AutoOpenMail = true;
185 185
186 self:SetChecked(true); 186 self:SetChecked(true);
187 else 187 else
188 self:Print(L["Shift key was held down, so |cffff0000disabling|r the entire addon."]); 188 MailOpener:Print(L["Shift key was held down, so |cffff0000disabling|r the entire addon."]);
189 189
190 MailOpener:Disable(); 190 MailOpener:Disable();
191 191
192 self:SetChecked(false); 192 self:SetChecked(false);
193 end 193 end
194 else 194 else
195 -- Normal click 195 -- Normal click
196 196
197 if self:GetChecked() then 197 if self:GetChecked() then
198 self:Print(L["|cff00ff00Enabling|r automatic opening of mail."]); 198 MailOpener:Print(L["|cff00ff00Enabling|r automatic opening of mail."]);
199 199
200 AutoOpenMail = true; 200 AutoOpenMail = true;
201 MailOpener:ScheduleOpen(false); 201 MailOpener:ScheduleOpen(false);
202 else 202 else
203 self:Print(L["|cffff0000Disabling|r automatic opening of mail."]); 203 MailOpener:Print(L["|cffff0000Disabling|r automatic opening of mail."]);
204 204
205 AutoOpenMail = false; 205 AutoOpenMail = false;
206 end 206 end
207 end 207 end
208 end); 208 end);
367 text = L["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 behavior in the General options."], 367 text = L["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 behavior in the General options."],
368 button1 = L["Yes"], 368 button1 = L["Yes"],
369 button2 = L["No"], 369 button2 = L["No"],
370 OnAccept = function() 370 OnAccept = function()
371 MailOpener.db.profile.general.defaultStatus = "_enabled"; 371 MailOpener.db.profile.general.defaultStatus = "_enabled";
372 self:Print(L["You can always change the default status in the General config (|cff00ffff/mo c|r)."]); 372 MailOpener:Print(L["You can always change the default status in the General config (|cff00ffff/mo c|r)."]);
373 373
374 self:Print(L["|cff00ff00Enabling|r automatic opening of mail."]); 374 MailOpener:Print(L["|cff00ff00Enabling|r automatic opening of mail."]);
375 MailOpener.cbOpenAll:SetChecked(true); 375 MailOpener.cbOpenAll:SetChecked(true);
376 376
377 AutoOpenMail = true; 377 AutoOpenMail = true;
378 MailOpener:ScheduleOpen(false); 378 MailOpener:ScheduleOpen(false);
379 end, 379 end,
380 OnCancel = function (_,reason) 380 OnCancel = function (_,reason)
381 self:Print(L["You can always change the default status in the General config (|cff00ffff/mo c|r)."]); 381 MailOpener:Print(L["You can always change the default status in the General config (|cff00ffff/mo c|r)."]);
382 end, 382 end,
383 timeout = 0, 383 timeout = 0,
384 whileDead = 1, 384 whileDead = 1,
385 hideOnEscape = 1, 385 hideOnEscape = 1,
386 }; 386 };