Mercurial > wow > mailopener
comparison Core.lua @ 123:b21c39ea338c
Removed all ?QuickAuctions? checks and replaced them with ZeroAuctions checks instead.
Fixed the copy dialog window.
| author | Zerotorescue |
|---|---|
| date | Sat, 16 Oct 2010 14:46:04 +0200 |
| parents | 13243f627bf4 |
| children | 31f58e9c16e6 |
comparison
equal
deleted
inserted
replaced
| 122:6a51405c7733 | 123:b21c39ea338c |
|---|---|
| 287 if AddonLoader and AddonLoader.LoadAddOn and not Postal then | 287 if AddonLoader and AddonLoader.LoadAddOn and not Postal then |
| 288 AddonLoader:LoadAddOn("Postal"); | 288 AddonLoader:LoadAddOn("Postal"); |
| 289 end | 289 end |
| 290 end | 290 end |
| 291 | 291 |
| 292 if select(6, GetAddOnInfo("QuickAuctions")) == nil then | |
| 293 self.QuickAuctionsEnabled = true; -- Set this as an object variable so we can use it in our modules | |
| 294 | |
| 295 -- Ensure this addon is loaded if AddonLoader is installed | |
| 296 if AddonLoader and AddonLoader.LoadAddOn then | |
| 297 AddonLoader:LoadAddOn("QuickAuctions"); | |
| 298 end | |
| 299 end | |
| 300 if select(6, GetAddOnInfo("ZeroAuctions")) == nil then | 292 if select(6, GetAddOnInfo("ZeroAuctions")) == nil then |
| 301 self.ZeroAuctionsEnabled = true; -- Set this as an object variable so we can use it in our modules | 293 self.ZeroAuctionsEnabled = true; -- Set this as an object variable so we can use it in our modules |
| 302 | 294 |
| 303 -- Ensure this addon is loaded if AddonLoader is installed | 295 -- Ensure this addon is loaded if AddonLoader is installed |
| 304 if AddonLoader and AddonLoader.LoadAddOn then | 296 if AddonLoader and AddonLoader.LoadAddOn then |
| 310 | 302 |
| 311 | 303 |
| 312 | 304 |
| 313 -- ADJUST POSITIONS | 305 -- ADJUST POSITIONS |
| 314 | 306 |
| 315 if self.QuickAuctionsEnabled or self.ZeroAuctionsEnabled then | 307 if self.ZeroAuctionsEnabled then |
| 316 -- QA is enabled so move the checkbox further to the right | 308 -- QA is enabled so move the checkbox further to the right |
| 317 | 309 |
| 318 self.cbOpenAll:SetPoint("TOPLEFT", MailFrame, "TOPLEFT", 155, -13); | 310 self.cbOpenAll:SetPoint("TOPLEFT", MailFrame, "TOPLEFT", 155, -13); |
| 319 end | 311 end |
| 320 | 312 |
| 436 | 428 |
| 437 -- Hide the InboxTooMuchMail warning to allow room for our mail remaining info line | 429 -- Hide the InboxTooMuchMail warning to allow room for our mail remaining info line |
| 438 InboxTooMuchMail:Hide() | 430 InboxTooMuchMail:Hide() |
| 439 InboxTooMuchMail.Show = function() end | 431 InboxTooMuchMail.Show = function() end |
| 440 | 432 |
| 441 if self.QuickAuctionsEnabled then | |
| 442 local QAMail = LibStub("AceAddon-3.0"):GetAddon("QuickAuctions", true):GetModule("Mail", true) | |
| 443 | |
| 444 if QAMail then | |
| 445 -- Hide the open all button | |
| 446 QAMail.massOpening:Hide(); | |
| 447 -- Hide the x mail remaining text | |
| 448 QAMail.totalMail:Hide(); | |
| 449 end | |
| 450 end | |
| 451 | |
| 452 if self.ZeroAuctionsEnabled then | 433 if self.ZeroAuctionsEnabled then |
| 453 local QAMail = LibStub("AceAddon-3.0"):GetAddon("ZeroAuctions", true):GetModule("Mail", true) | 434 local QAMail = LibStub("AceAddon-3.0"):GetAddon("ZeroAuctions", true):GetModule("Mail", true) |
| 454 | 435 |
| 455 if QAMail then | 436 if QAMail then |
| 456 -- Hide the open all button | 437 -- Hide the open all button |
| 571 if not MailAddonBusy then | 552 if not MailAddonBusy then |
| 572 -- No other addon is currently active | 553 -- No other addon is currently active |
| 573 | 554 |
| 574 self:CancelTimer(self.tmrTryAgain, true); -- Insurance | 555 self:CancelTimer(self.tmrTryAgain, true); -- Insurance |
| 575 | 556 |
| 576 if self.QuickAuctionsEnabled and QuickAuctionsAutoMail then | |
| 577 -- Remember the last known quick auctions status | |
| 578 lastQuickAuctionsStatus = QuickAuctionsAutoMail:GetChecked(); | |
| 579 end | |
| 580 if self.ZeroAuctionsEnabled and ZeroAuctionsAutoMail then | 557 if self.ZeroAuctionsEnabled and ZeroAuctionsAutoMail then |
| 581 -- Remember the last known quick auctions status | 558 -- Remember the last known quick auctions status |
| 582 lastQuickAuctionsStatus = ZeroAuctionsAutoMail:GetChecked(); | 559 lastQuickAuctionsStatus = ZeroAuctionsAutoMail:GetChecked(); |
| 583 end | |
| 584 if self.db.profile.general.autoDisableQAAutoMail and self.QuickAuctionsEnabled and QuickAuctionsAutoMail and QuickAuctionsAutoMail:GetChecked() then | |
| 585 -- If auto disable "QA Auto mail" is enabled and QA's auto mail is currently toggled on, turn it off | |
| 586 -- We need to do this with a :click to trigger the right events | |
| 587 | |
| 588 self:Debug("Turning automail |cffff0000off|r."); | |
| 589 | |
| 590 QuickAuctionsAutoMail:Click(); | |
| 591 end | 560 end |
| 592 if self.db.profile.general.autoDisableQAAutoMail and self.ZeroAuctionsEnabled and ZeroAuctionsAutoMail and ZeroAuctionsAutoMail:GetChecked() then | 561 if self.db.profile.general.autoDisableQAAutoMail and self.ZeroAuctionsEnabled and ZeroAuctionsAutoMail and ZeroAuctionsAutoMail:GetChecked() then |
| 593 -- If auto disable "QA Auto mail" is enabled and QA's auto mail is currently toggled on, turn it off | 562 -- If auto disable "QA Auto mail" is enabled and QA's auto mail is currently toggled on, turn it off |
| 594 -- We need to do this with a :click to trigger the right events | 563 -- We need to do this with a :click to trigger the right events |
| 595 | 564 |
| 636 mailboxEmptySoundPlayed = true; | 605 mailboxEmptySoundPlayed = true; |
| 637 mailboxEmptySoundPlayedThisVisit = true; | 606 mailboxEmptySoundPlayedThisVisit = true; |
| 638 end | 607 end |
| 639 end | 608 end |
| 640 | 609 |
| 641 if self.QuickAuctionsEnabled then | 610 if self.ZeroAuctionsEnabled then |
| 642 -- Quick Auctions enabled? | 611 -- Zero Auctions enabled? |
| 643 -- Toggle automailing as per settings | 612 -- Toggle automailing as per settings |
| 644 | 613 |
| 645 if self.db.profile.general.autoReenableQAAutoMail and QuickAuctionsAutoMail and not QuickAuctionsAutoMail:GetChecked() then | 614 if self.db.profile.general.autoReenableQAAutoMail and ZeroAuctionsAutoMail and not ZeroAuctionsAutoMail:GetChecked() then |
| 646 -- If auto re-enable "QA Auto mail" is enabled and QA's auto mail is currently toggled OFF, turn it on | 615 -- If auto re-enable "QA Auto mail" is enabled and QA's auto mail is currently toggled OFF, turn it on |
| 647 -- We need to do this with a :click to trigger the right events | 616 -- We need to do this with a :click to trigger the right events |
| 648 | 617 |
| 649 self:Debug("Turning automail |cff00ff00on|r."); | 618 self:Debug("Turning automail |cff00ff00on|r."); |
| 650 | 619 |
| 651 QuickAuctionsAutoMail:Click(); | 620 ZeroAuctionsAutoMail:Click(); |
| 652 elseif self.db.profile.general.autoSetBackQAAutoMail and QuickAuctionsAutoMail and lastQuickAuctionsStatus ~= QuickAuctionsAutoMail:GetChecked() then | 621 elseif self.db.profile.general.autoSetBackQAAutoMail and ZeroAuctionsAutoMail and lastQuickAuctionsStatus ~= ZeroAuctionsAutoMail:GetChecked() then |
| 653 -- If auto set back "QA Auto mail" is enabled and QA's auto mail is currently not the same as it was before starting, toggle it | 622 -- If auto set back "QA Auto mail" is enabled and QA's auto mail is currently not the same as it was before starting, toggle it |
| 654 -- We need to do this with a :click to trigger the right events | 623 -- We need to do this with a :click to trigger the right events |
| 655 | 624 |
| 656 if lastQuickAuctionsStatus then | 625 if lastQuickAuctionsStatus then |
| 657 self:Debug("Turning automail |cff00ff00on|r."); | 626 self:Debug("Turning automail |cff00ff00on|r."); |
| 658 else | 627 else |
| 659 self:Debug("Turning automail |cffff0000off|r."); | 628 self:Debug("Turning automail |cffff0000off|r."); |
| 660 end | 629 end |
| 661 | 630 |
| 662 QuickAuctionsAutoMail:Click(); | |
| 663 end | |
| 664 end | |
| 665 | |
| 666 if self.ZeroAuctionsEnabled then | |
| 667 -- Zero Auctions enabled? | |
| 668 -- Toggle automailing as per settings | |
| 669 | |
| 670 if self.db.profile.general.autoReenableQAAutoMail and ZeroAuctionsAutoMail and not ZeroAuctionsAutoMail:GetChecked() then | |
| 671 -- If auto re-enable "QA Auto mail" is enabled and QA's auto mail is currently toggled OFF, turn it on | |
| 672 -- We need to do this with a :click to trigger the right events | |
| 673 | |
| 674 self:Debug("Turning automail |cff00ff00on|r."); | |
| 675 | |
| 676 ZeroAuctionsAutoMail:Click(); | |
| 677 elseif self.db.profile.general.autoSetBackQAAutoMail and ZeroAuctionsAutoMail and lastQuickAuctionsStatus ~= ZeroAuctionsAutoMail:GetChecked() then | |
| 678 -- If auto set back "QA Auto mail" is enabled and QA's auto mail is currently not the same as it was before starting, toggle it | |
| 679 -- We need to do this with a :click to trigger the right events | |
| 680 | |
| 681 if lastQuickAuctionsStatus then | |
| 682 self:Debug("Turning automail |cff00ff00on|r."); | |
| 683 else | |
| 684 self:Debug("Turning automail |cffff0000off|r."); | |
| 685 end | |
| 686 | |
| 687 ZeroAuctionsAutoMail:Click(); | 631 ZeroAuctionsAutoMail:Click(); |
| 688 end | 632 end |
| 689 end | 633 end |
| 690 | 634 |
| 691 if self.db.profile.general.continueOpening then | 635 if self.db.profile.general.continueOpening then |
| 792 | 736 |
| 793 -- Change Quick Auction's auto mail status based on our prefered settings | 737 -- Change Quick Auction's auto mail status based on our prefered settings |
| 794 function MailOpener:ToggleQAStatus() | 738 function MailOpener:ToggleQAStatus() |
| 795 self:Debug("defaultQAStatus:" .. self.db.profile.general.defaultQAStatus); | 739 self:Debug("defaultQAStatus:" .. self.db.profile.general.defaultQAStatus); |
| 796 | 740 |
| 797 if self.QuickAuctionsEnabled and self.db.profile.general.defaultQAStatus ~= "__remember" and QuickAuctionsAutoMail then | |
| 798 if self.db.profile.general.defaultQAStatus == "_enabled" and not QuickAuctionsAutoMail:GetChecked() then | |
| 799 self:Debug("Turning automail |cff00ff00on|r."); | |
| 800 | |
| 801 QuickAuctionsAutoMail:Click(); | |
| 802 elseif self.db.profile.general.defaultQAStatus == "disabled" and QuickAuctionsAutoMail:GetChecked() then | |
| 803 self:Debug("Turning automail |cffff0000off|r."); | |
| 804 | |
| 805 QuickAuctionsAutoMail:Click(); | |
| 806 end | |
| 807 end | |
| 808 if self.ZeroAuctionsEnabled and self.db.profile.general.defaultQAStatus ~= "__remember" and ZeroAuctionsAutoMail then | 741 if self.ZeroAuctionsEnabled and self.db.profile.general.defaultQAStatus ~= "__remember" and ZeroAuctionsAutoMail then |
| 809 if self.db.profile.general.defaultQAStatus == "_enabled" and not ZeroAuctionsAutoMail:GetChecked() then | 742 if self.db.profile.general.defaultQAStatus == "_enabled" and not ZeroAuctionsAutoMail:GetChecked() then |
| 810 self:Debug("Turning automail |cff00ff00on|r."); | 743 self:Debug("Turning automail |cff00ff00on|r."); |
| 811 | 744 |
| 812 ZeroAuctionsAutoMail:Click(); | 745 ZeroAuctionsAutoMail:Click(); |
| 835 -- General copy window for multiple things (clickable URLs, the time remaining, and such) | 768 -- General copy window for multiple things (clickable URLs, the time remaining, and such) |
| 836 StaticPopupDialogs["MailOpenerCopyWindow"] = { | 769 StaticPopupDialogs["MailOpenerCopyWindow"] = { |
| 837 text = L["Press CTRL-C to copy."], | 770 text = L["Press CTRL-C to copy."], |
| 838 button2 = CLOSE, | 771 button2 = CLOSE, |
| 839 hasEditBox = 1, | 772 hasEditBox = 1, |
| 840 hasWideEditBox = 1, | 773 editBoxWidth = 360, |
| 841 OnShow = function() | 774 OnShow = function(self) |
| 842 local editBox = _G[this:GetName().."WideEditBox"]; | 775 if self.editBox and MailOpener.currentPopupContents then |
| 843 if editBox and MailOpener.currentPopupContents then | 776 self.editBox:SetText(MailOpener.currentPopupContents); |
| 844 editBox:SetText(MailOpener.currentPopupContents); | 777 self.editBox:SetFocus(); |
| 845 editBox:SetFocus(); | 778 self.editBox:HighlightText(0); |
| 846 editBox:HighlightText(0); | |
| 847 end | 779 end |
| 848 | 780 |
| 849 -- Position the close button in the middle | 781 -- Position the close button in the middle |
| 850 local button = _G[this:GetName().."Button2"]; | 782 if self.button2 then |
| 851 if button then | |
| 852 -- Remove previous know position | 783 -- Remove previous know position |
| 853 button:ClearAllPoints(); | 784 self.button2:ClearAllPoints(); |
| 854 button:SetWidth(200); | 785 self.button2:SetWidth(200); |
| 855 -- Reposition in the center | 786 -- Reposition in the center |
| 856 button:SetPoint("CENTER", editBox, "CENTER", 0, -30); | 787 self.button2:SetPoint("CENTER", self.editBox, "CENTER", 0, -30); |
| 857 end | 788 end |
| 858 end, | 789 end, |
| 859 EditBoxOnEscapePressed = function(self) | 790 EditBoxOnEscapePressed = function(self) |
| 860 self:GetParent():Hide(); | 791 self:GetParent():Hide(); |
| 861 end, | 792 end, |
