changeset 50:8e2138877ebf

Added neat(er) tooltips for both the mail opener status toggler as the config button. Added an option below the filters to disable the shift click functionality of the open all button.
author Zerotorescue
date Sun, 12 Sep 2010 21:06:05 +0200
parents b2b98cc0c544
children fcc7112cc365
files Core.lua Modules/OpenAll.lua
diffstat 2 files changed, 51 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/Core.lua	Sun Sep 12 20:35:37 2010 +0200
+++ b/Core.lua	Sun Sep 12 21:06:05 2010 +0200
@@ -160,9 +160,10 @@
 	-- ADDON / MAIL OPENING STATUS TOGGLER
 	
 	-- Make the open all checkbox
-	local check = CreateFrame("CheckButton", "cbMailOpenerEnable", MailFrame, "ChatConfigCheckButtonTemplate");
+	local check = CreateFrame("CheckButton", "cbMailOpenerEnable", MailFrame, "OptionsCheckButtonTemplate");
 	check:SetHeight(26);
 	check:SetWidth(26);
+	check:SetPoint("TOPLEFT", MailFrame, "TOPLEFT", 68, -13);
 	check:SetChecked(true);
 	check:SetHitRectInsets(0, -80, 0, 0);
 	check:SetScript("OnClick", function(self)
@@ -200,14 +201,26 @@
 			end
 		end
 	end);
-	check.tooltip = "Toggle automatic mail opening on or off (you can force this by holding shift when opening the mailbox.\n\nHold the |cffffffffSHIFT|r key to disable the entire addon.";
-	check:SetPoint("TOPLEFT", MailFrame, "TOPLEFT", 68, -13);
+	check.tooltipTitle = "Mail Opener status";
+	check.tooltip = "Toggle automatic mail opening |cff00ff00on|r or |cffff0000off|r (you can also enforce this by holding shift when opening the mailbox).\n\nYou can also hold the |cfffed000shift|r key while clicking this checkbox to disable the entire addon instead.";
+	check:SetScript("OnEnter", function(self)
+		GameTooltip:SetOwner(self, "ANCHOR_BOTTOM")
+		GameTooltip:SetPoint("BOTTOM", self, "BOTTOM")
+		GameTooltip:SetText(self.tooltipTitle, 1, .82, 0, 1)
+		
+		if type(self.tooltip) == "string" then
+			GameTooltip:AddLine(self.tooltip, 1, 1, 1, 1);
+		end
+		
+		GameTooltip:Show();
+	end);
+	button:SetScript("OnLeave", function(self)
+		GameTooltip:Hide();
+	end);
 	
 	-- Get reference to the text field
 	local checkboxText = _G[check:GetName() .. "Text"];
 	checkboxText:SetText("Mail Opener");
-	-- We like this color more
-	checkboxText:SetTextColor(1, 0.8, 0, 1);
 	
 	self.cbOpenAll = check;
 	
@@ -231,6 +244,22 @@
 		--BETA:	MailOpener:ShowBetaPopup();
 		--BETA:end
 	end);
+	button.tooltipTitle = "Mail Opener Config";
+	button.tooltip = "Click to open the configuration window for Mail Opener.";
+	button:SetScript("OnEnter", function(self)
+		GameTooltip:SetOwner(self, "ANCHOR_BOTTOM")
+		GameTooltip:SetPoint("BOTTOM", self, "TOP")
+		GameTooltip:SetText(self.tooltipTitle, 1, .82, 0, 1)
+		
+		if type(self.tooltip) == "string" then
+			GameTooltip:AddLine(self.tooltip, 1, 1, 1, 1);
+		end
+		
+		GameTooltip:Show();
+	end);
+	button:SetScript("OnLeave", function(self)
+		GameTooltip:Hide();
+	end);
 	
 	self.btnConfig = button;
 	
--- a/Modules/OpenAll.lua	Sun Sep 12 20:35:37 2010 +0200
+++ b/Modules/OpenAll.lua	Sun Sep 12 21:06:05 2010 +0200
@@ -26,6 +26,7 @@
 				},
 				normalAttachments = false,
 				normalMoney = true,
+				allowShiftClick = true,
 			},
 		},
 	};
@@ -40,8 +41,7 @@
 	if not self.btnOpenAll then
 		-- Open all button
 		local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate");
-		button.originalText = "Open all"; -- we will use this in the tooltip and to set this text back after opening
-		button:SetText(button.originalText);
+		button:SetText("Open all");
 		button:SetHeight(26);
 		button:SetWidth(120);
 		button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165);
@@ -136,14 +136,15 @@
 				mod:Open(true, IsShiftKeyDown());
 			end
 		end);
+		button.tooltipTitle = "Open all";
 		button.tooltip = "Hold |cfffed000shift|r while clicking this button to temporarily override your filters and loot every single mail contain attachments and gold.\n\n|cfffed000Right|r click this button to quickly adjust mail opening filters for this profile.";
 		button:SetScript("OnEnter", function(self)
 			GameTooltip:SetOwner(self, "ANCHOR_NONE")
 			GameTooltip:SetPoint("BOTTOM", self, "TOP")
-			GameTooltip:SetText(self.originalText, 1, .82, 0, 1)
+			GameTooltip:SetText(self.tooltipTitle, 1, .82, 0, 1)
 			
-			if type(button.tooltip) == "string" then
-				GameTooltip:AddLine(button.tooltip, 1, 1, 1, 1);
+			if type(self.tooltip) == "string" then
+				GameTooltip:AddLine(self.tooltip, 1, 1, 1, 1);
 			end
 			
 			GameTooltip:Show();
@@ -374,7 +375,7 @@
 			-- Update the caret
 			MAIL_ITEM_INDEX = newMailItemIndex;
 			-- Do we want to override filters and open every single mail?
-			if everything then
+			if everything and self.db.profile.filter.allowShiftClick then
 				MAIL_OPEN_EVERYTHING = true;
 				
 				print("|cff15ff00Mail Opener|r: Shift key was held while pressing the open all button. Temporarily overriding filters; going to open every mail with attachments.");
@@ -738,7 +739,7 @@
 	if openingStatus then
 		self.btnOpenAll:SetText("Opening...");
 	else
-		self.btnOpenAll:SetText(self.btnOpenAll.originalText);
+		self.btnOpenAll:SetText("Open all");
 	end
 end
 
@@ -833,6 +834,15 @@
 						get = function() return self.db.profile.filter.normalMoney; end,
 						width = "double",
 					},
+					allowShiftClick = {
+						order = 60,
+						type = "toggle",
+						name = "Allow shift-clicking of the |cfffed000Open All|r button to autoloot |cfffed000everything|r, regardless of the above filters.",
+						desc = "Allow shift-clicking of the |cfffed000Open All|r button to autoloot |cfffed000everything|r with attachments, temporarily overriding all filters.",
+						set = function(i, v) self.db.profile.filter.allowShiftClick = v; end,
+						get = function() return self.db.profile.filter.allowShiftClick; end,
+						width = "full",
+					},
 				},
 			},
 			-- Continuous opening config inline group