changeset 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 91fe61693247
children 6426c0245657
files Modules/OpenAll.lua
diffstat 1 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Modules/OpenAll.lua	Fri Oct 01 23:39:44 2010 +0200
+++ b/Modules/OpenAll.lua	Fri Oct 01 23:41:04 2010 +0200
@@ -46,9 +46,16 @@
 		button:SetHeight(26);
 		button:SetWidth(120);
 		button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165);
-		button:RegisterForClicks("LeftButtonUp", "RightButtonUp");
+		button:RegisterForClicks("LeftButtonUp", "RightButtonUp", "MiddleButtonUp");
 		button:SetScript("OnClick", function(self, mouseButton)
+			local action = "open";
 			if mouseButton == "RightButton" then
+				action = "menu";
+			elseif mouseButton == "MiddleButton" or (mouseButton == "LeftButton" and IsAltKeyDown()) then
+				action = "stop";
+			end
+			
+			if action == "menu" then
 				-- Hide the gametooltip
 				GameTooltip:Hide();
 				
@@ -118,7 +125,7 @@
 							info.checked = mod.db.profile.filter.normalMoney;
 							UIDropDownMenu_AddButton(info, level);
 							
-							-- Make Other mail with gold
+							-- Close link
 							info.text = CLOSE;
 							info.func = function() CloseDropDownMenus(); end;
 							info.checked = nil;
@@ -133,12 +140,16 @@
 				end
 				
 				ToggleDropDownMenu(1, nil, mod.ddmFilters, self:GetName(), 0, 0);
+			elseif action == "stop" then
+				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."]);
+				
+				mod:StopOpening(true);
 			else
 				mod:Open(true, IsShiftKeyDown());
 			end
 		end);
 		button.tooltipTitle = L["Open all"];
-		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."];
+		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."];
 		button:SetScript("OnEnter", function(self)
 			if MailOpener.db.profile.general.showHelpTooltips then
 				GameTooltip:SetOwner(self, "ANCHOR_NONE")
@@ -271,6 +282,7 @@
 	self:RegisterMessage("MO_OPEN_MAIL", "Open");
 	self:RegisterMessage("MO_SERVER_SYNCED");
 	self:RegisterMessage("MO_MAIL_EMPTIED");
+	self:RegisterMessage("MO_STOP_MAIL_OPENING");
 	
 	self:CancelTimer(self.tmrTimeRemaining, true);
 	self.tmrTimeRemaining = self:ScheduleRepeatingTimer("UpdateTimer", 1);
@@ -292,6 +304,7 @@
 	self:UnregisterMessage("MO_OPEN_MAIL");
 	self:UnregisterMessage("MO_SERVER_SYNCED");
 	self:UnregisterMessage("MO_MAIL_EMPTIED");
+	self:UnregisterMessage("MO_STOP_MAIL_OPENING");
     
 	self:CancelTimer(self.tmrMailOpener, true);
 	self:CancelTimer(self.tmrTimeRemaining, true);
@@ -320,6 +333,10 @@
 	self:UpdateTimer();
 end
 
+function mod:MO_STOP_MAIL_OPENING()
+	self:StopOpening(true);
+end
+
 function mod:UpdateMailCount()
 	local numItems, totalItems = GetInboxNumItems();