Mercurial > wow > mailopener
comparison Modules/OpenAll.lua @ 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 | f630d882d008 |
| children | fcc7112cc365 |
comparison
equal
deleted
inserted
replaced
| 49:b2b98cc0c544 | 50:8e2138877ebf |
|---|---|
| 24 success = true, | 24 success = true, |
| 25 won = true, | 25 won = true, |
| 26 }, | 26 }, |
| 27 normalAttachments = false, | 27 normalAttachments = false, |
| 28 normalMoney = true, | 28 normalMoney = true, |
| 29 allowShiftClick = true, | |
| 29 }, | 30 }, |
| 30 }, | 31 }, |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 -- Register our saved variables NameSpace | 34 -- Register our saved variables NameSpace |
| 38 self:RegisterEvent("MAIL_SHOW"); | 39 self:RegisterEvent("MAIL_SHOW"); |
| 39 | 40 |
| 40 if not self.btnOpenAll then | 41 if not self.btnOpenAll then |
| 41 -- Open all button | 42 -- Open all button |
| 42 local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate"); | 43 local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate"); |
| 43 button.originalText = "Open all"; -- we will use this in the tooltip and to set this text back after opening | 44 button:SetText("Open all"); |
| 44 button:SetText(button.originalText); | |
| 45 button:SetHeight(26); | 45 button:SetHeight(26); |
| 46 button:SetWidth(120); | 46 button:SetWidth(120); |
| 47 button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165); | 47 button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165); |
| 48 button:RegisterForClicks("LeftButtonUp", "RightButtonUp"); | 48 button:RegisterForClicks("LeftButtonUp", "RightButtonUp"); |
| 49 button:SetScript("OnClick", function(self, mouseButton) | 49 button:SetScript("OnClick", function(self, mouseButton) |
| 134 ToggleDropDownMenu(1, nil, mod.ddmFilters, self:GetName(), 0, 0); | 134 ToggleDropDownMenu(1, nil, mod.ddmFilters, self:GetName(), 0, 0); |
| 135 else | 135 else |
| 136 mod:Open(true, IsShiftKeyDown()); | 136 mod:Open(true, IsShiftKeyDown()); |
| 137 end | 137 end |
| 138 end); | 138 end); |
| 139 button.tooltipTitle = "Open all"; | |
| 139 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."; | 140 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."; |
| 140 button:SetScript("OnEnter", function(self) | 141 button:SetScript("OnEnter", function(self) |
| 141 GameTooltip:SetOwner(self, "ANCHOR_NONE") | 142 GameTooltip:SetOwner(self, "ANCHOR_NONE") |
| 142 GameTooltip:SetPoint("BOTTOM", self, "TOP") | 143 GameTooltip:SetPoint("BOTTOM", self, "TOP") |
| 143 GameTooltip:SetText(self.originalText, 1, .82, 0, 1) | 144 GameTooltip:SetText(self.tooltipTitle, 1, .82, 0, 1) |
| 144 | 145 |
| 145 if type(button.tooltip) == "string" then | 146 if type(self.tooltip) == "string" then |
| 146 GameTooltip:AddLine(button.tooltip, 1, 1, 1, 1); | 147 GameTooltip:AddLine(self.tooltip, 1, 1, 1, 1); |
| 147 end | 148 end |
| 148 | 149 |
| 149 GameTooltip:Show(); | 150 GameTooltip:Show(); |
| 150 end); | 151 end); |
| 151 button:SetScript("OnLeave", function(self) | 152 button:SetScript("OnLeave", function(self) |
| 372 end | 373 end |
| 373 | 374 |
| 374 -- Update the caret | 375 -- Update the caret |
| 375 MAIL_ITEM_INDEX = newMailItemIndex; | 376 MAIL_ITEM_INDEX = newMailItemIndex; |
| 376 -- Do we want to override filters and open every single mail? | 377 -- Do we want to override filters and open every single mail? |
| 377 if everything then | 378 if everything and self.db.profile.filter.allowShiftClick then |
| 378 MAIL_OPEN_EVERYTHING = true; | 379 MAIL_OPEN_EVERYTHING = true; |
| 379 | 380 |
| 380 print("|cff15ff00Mail Opener|r: Shift key was held while pressing the open all button. Temporarily overriding filters; going to open every mail with attachments."); | 381 print("|cff15ff00Mail Opener|r: Shift key was held while pressing the open all button. Temporarily overriding filters; going to open every mail with attachments."); |
| 381 else | 382 else |
| 382 MAIL_OPEN_EVERYTHING = nil; | 383 MAIL_OPEN_EVERYTHING = nil; |
| 736 opening = openingStatus; | 737 opening = openingStatus; |
| 737 | 738 |
| 738 if openingStatus then | 739 if openingStatus then |
| 739 self.btnOpenAll:SetText("Opening..."); | 740 self.btnOpenAll:SetText("Opening..."); |
| 740 else | 741 else |
| 741 self.btnOpenAll:SetText(self.btnOpenAll.originalText); | 742 self.btnOpenAll:SetText("Open all"); |
| 742 end | 743 end |
| 743 end | 744 end |
| 744 | 745 |
| 745 function mod:GetOptionsGroup() | 746 function mod:GetOptionsGroup() |
| 746 local configGroup = { | 747 local configGroup = { |
| 831 desc = "Automatically loot all mails with gold not sent by any of the above sources.", | 832 desc = "Automatically loot all mails with gold not sent by any of the above sources.", |
| 832 set = function(i, v) self.db.profile.filter.normalMoney = v; end, | 833 set = function(i, v) self.db.profile.filter.normalMoney = v; end, |
| 833 get = function() return self.db.profile.filter.normalMoney; end, | 834 get = function() return self.db.profile.filter.normalMoney; end, |
| 834 width = "double", | 835 width = "double", |
| 835 }, | 836 }, |
| 837 allowShiftClick = { | |
| 838 order = 60, | |
| 839 type = "toggle", | |
| 840 name = "Allow shift-clicking of the |cfffed000Open All|r button to autoloot |cfffed000everything|r, regardless of the above filters.", | |
| 841 desc = "Allow shift-clicking of the |cfffed000Open All|r button to autoloot |cfffed000everything|r with attachments, temporarily overriding all filters.", | |
| 842 set = function(i, v) self.db.profile.filter.allowShiftClick = v; end, | |
| 843 get = function() return self.db.profile.filter.allowShiftClick; end, | |
| 844 width = "full", | |
| 845 }, | |
| 836 }, | 846 }, |
| 837 }, | 847 }, |
| 838 -- Continuous opening config inline group | 848 -- Continuous opening config inline group |
| 839 continuousOpening = { | 849 continuousOpening = { |
| 840 order = 20, | 850 order = 20, |
