Mercurial > wow > mailopener
comparison Modules/OpenAll.lua @ 112:981c6ac45a3f
Mail opening will now be interrupted when middle or alt-clicking the open all button.
| author | Zerotorescue |
|---|---|
| date | Fri, 01 Oct 2010 23:41:04 +0200 |
| parents | 5c06ce56297a |
| children | f662ee4d9c05 |
comparison
equal
deleted
inserted
replaced
| 111:91fe61693247 | 112:981c6ac45a3f |
|---|---|
| 44 local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate"); | 44 local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate"); |
| 45 button:SetText(L["Open all"]); | 45 button:SetText(L["Open all"]); |
| 46 button:SetHeight(26); | 46 button:SetHeight(26); |
| 47 button:SetWidth(120); | 47 button:SetWidth(120); |
| 48 button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165); | 48 button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165); |
| 49 button:RegisterForClicks("LeftButtonUp", "RightButtonUp"); | 49 button:RegisterForClicks("LeftButtonUp", "RightButtonUp", "MiddleButtonUp"); |
| 50 button:SetScript("OnClick", function(self, mouseButton) | 50 button:SetScript("OnClick", function(self, mouseButton) |
| 51 local action = "open"; | |
| 51 if mouseButton == "RightButton" then | 52 if mouseButton == "RightButton" then |
| 53 action = "menu"; | |
| 54 elseif mouseButton == "MiddleButton" or (mouseButton == "LeftButton" and IsAltKeyDown()) then | |
| 55 action = "stop"; | |
| 56 end | |
| 57 | |
| 58 if action == "menu" then | |
| 52 -- Hide the gametooltip | 59 -- Hide the gametooltip |
| 53 GameTooltip:Hide(); | 60 GameTooltip:Hide(); |
| 54 | 61 |
| 55 if not mod.ddmFilters then | 62 if not mod.ddmFilters then |
| 56 -- Build the drop down menu | 63 -- Build the drop down menu |
| 116 info.text = L["Other mail with gold"]; | 123 info.text = L["Other mail with gold"]; |
| 117 info.func = function(this) mod.db.profile.filter.normalMoney = this.checked; end; | 124 info.func = function(this) mod.db.profile.filter.normalMoney = this.checked; end; |
| 118 info.checked = mod.db.profile.filter.normalMoney; | 125 info.checked = mod.db.profile.filter.normalMoney; |
| 119 UIDropDownMenu_AddButton(info, level); | 126 UIDropDownMenu_AddButton(info, level); |
| 120 | 127 |
| 121 -- Make Other mail with gold | 128 -- Close link |
| 122 info.text = CLOSE; | 129 info.text = CLOSE; |
| 123 info.func = function() CloseDropDownMenus(); end; | 130 info.func = function() CloseDropDownMenus(); end; |
| 124 info.checked = nil; | 131 info.checked = nil; |
| 125 info.notCheckable = true; | 132 info.notCheckable = true; |
| 126 UIDropDownMenu_AddButton(info, level); | 133 UIDropDownMenu_AddButton(info, level); |
| 131 | 138 |
| 132 mod.ddmFilters = dropDownMenu; | 139 mod.ddmFilters = dropDownMenu; |
| 133 end | 140 end |
| 134 | 141 |
| 135 ToggleDropDownMenu(1, nil, mod.ddmFilters, self:GetName(), 0, 0); | 142 ToggleDropDownMenu(1, nil, mod.ddmFilters, self:GetName(), 0, 0); |
| 143 elseif action == "stop" then | |
| 144 MailOpener:Print(L["Interrupting mail opening as the alt key was held down while clicking the open all button or the middle mouse-button was used on it."]); | |
| 145 | |
| 146 mod:StopOpening(true); | |
| 136 else | 147 else |
| 137 mod:Open(true, IsShiftKeyDown()); | 148 mod:Open(true, IsShiftKeyDown()); |
| 138 end | 149 end |
| 139 end); | 150 end); |
| 140 button.tooltipTitle = L["Open all"]; | 151 button.tooltipTitle = L["Open all"]; |
| 141 button.tooltip = L["Hold |cfffed000shift|r while clicking this button to temporarily override your filters and loot every single mail containing attachments and/or gold.\n\n|cfffed000Right|r click this button to quickly adjust mail opening filters for this profile."]; | 152 button.tooltip = L["Hold |cfffed000shift|r while clicking this button to temporarily override your filters and loot every single mail containing attachments and/or gold.\n\n|cfffed000Right|r click this button to quickly adjust mail opening filters for this profile.\n\n|cfffed000Middle|r click or hold |cfffed000alt|r while clicking this button to interrupt mail opening."]; |
| 142 button:SetScript("OnEnter", function(self) | 153 button:SetScript("OnEnter", function(self) |
| 143 if MailOpener.db.profile.general.showHelpTooltips then | 154 if MailOpener.db.profile.general.showHelpTooltips then |
| 144 GameTooltip:SetOwner(self, "ANCHOR_NONE") | 155 GameTooltip:SetOwner(self, "ANCHOR_NONE") |
| 145 GameTooltip:SetPoint("BOTTOM", self, "TOP") | 156 GameTooltip:SetPoint("BOTTOM", self, "TOP") |
| 146 GameTooltip:SetText(self.tooltipTitle, 1, .82, 0, 1) | 157 GameTooltip:SetText(self.tooltipTitle, 1, .82, 0, 1) |
| 269 | 280 |
| 270 -- We need to know when to start opening | 281 -- We need to know when to start opening |
| 271 self:RegisterMessage("MO_OPEN_MAIL", "Open"); | 282 self:RegisterMessage("MO_OPEN_MAIL", "Open"); |
| 272 self:RegisterMessage("MO_SERVER_SYNCED"); | 283 self:RegisterMessage("MO_SERVER_SYNCED"); |
| 273 self:RegisterMessage("MO_MAIL_EMPTIED"); | 284 self:RegisterMessage("MO_MAIL_EMPTIED"); |
| 285 self:RegisterMessage("MO_STOP_MAIL_OPENING"); | |
| 274 | 286 |
| 275 self:CancelTimer(self.tmrTimeRemaining, true); | 287 self:CancelTimer(self.tmrTimeRemaining, true); |
| 276 self.tmrTimeRemaining = self:ScheduleRepeatingTimer("UpdateTimer", 1); | 288 self.tmrTimeRemaining = self:ScheduleRepeatingTimer("UpdateTimer", 1); |
| 277 self:UpdateTimer(); | 289 self:UpdateTimer(); |
| 278 end | 290 end |
| 290 | 302 |
| 291 -- We no longer care | 303 -- We no longer care |
| 292 self:UnregisterMessage("MO_OPEN_MAIL"); | 304 self:UnregisterMessage("MO_OPEN_MAIL"); |
| 293 self:UnregisterMessage("MO_SERVER_SYNCED"); | 305 self:UnregisterMessage("MO_SERVER_SYNCED"); |
| 294 self:UnregisterMessage("MO_MAIL_EMPTIED"); | 306 self:UnregisterMessage("MO_MAIL_EMPTIED"); |
| 307 self:UnregisterMessage("MO_STOP_MAIL_OPENING"); | |
| 295 | 308 |
| 296 self:CancelTimer(self.tmrMailOpener, true); | 309 self:CancelTimer(self.tmrMailOpener, true); |
| 297 self:CancelTimer(self.tmrTimeRemaining, true); | 310 self:CancelTimer(self.tmrTimeRemaining, true); |
| 298 | 311 |
| 299 self:SetOpeningStatus(false); | 312 self:SetOpeningStatus(false); |
| 316 function mod:MO_MAIL_EMPTIED() | 329 function mod:MO_MAIL_EMPTIED() |
| 317 -- A mail has been processed so we can process the next | 330 -- A mail has been processed so we can process the next |
| 318 continue = true; | 331 continue = true; |
| 319 | 332 |
| 320 self:UpdateTimer(); | 333 self:UpdateTimer(); |
| 334 end | |
| 335 | |
| 336 function mod:MO_STOP_MAIL_OPENING() | |
| 337 self:StopOpening(true); | |
| 321 end | 338 end |
| 322 | 339 |
| 323 function mod:UpdateMailCount() | 340 function mod:UpdateMailCount() |
| 324 local numItems, totalItems = GetInboxNumItems(); | 341 local numItems, totalItems = GetInboxNumItems(); |
| 325 | 342 |
