Removed the whole shift business. Was causing conflicts with the hotkeys and generally being a mess.

Wobin [05-13-14 - 15:01]
Removed the whole shift business. Was causing conflicts with the hotkeys and generally being a mess.
Filename
AddonClearer.lua
AddonClearer.xml
diff --git a/AddonClearer.lua b/AddonClearer.lua
index 719864c..95327a6 100644
--- a/AddonClearer.lua
+++ b/AddonClearer.lua
@@ -3,17 +3,33 @@ AddonClearer = {}
 function AddonClearer:SetAddons(toDo)
 	table.sort(ZO_AddOnsList.data, function(a,b) return a.data.addOnName == "AddonClearer" end) -- In place sorting. oh dear
 	local thisAddonIndex = ZO_AddOnsList.data[1].data.index
+
+	local notEmpty = false

 	if not toDo then -- Save current setup
 		AddonClearer.settings.savedSetup = {}
 		for i,v in ipairs(ZO_AddOnsList.data) do AddonClearer.settings.savedSetup[v.data.index] = v.data.addOnEnabled end
 	end

+	if not toDo then
+		local fullHouse = true
+		local emptyHouse = true
+		for i,v in ipairs(AddonClearer.settings.savedSetup) do
+			if i ~= thisAddonIndex and not v then fullHouse = false end
+			if i ~= thisAddonIndex and v then emptyHouse = false end
+		end
+		if not fullHouse and not emptyHouse then
+			SelectAddonButton:SetText("Select Saved")
+		else
+			SelectAddonButton:SetText("Select All")
+		end
+	end
+
 	local AddOnManager = GetAddOnManager()
 	local numAddons = AddOnManager:GetNumAddOns()
 	for i = 1, numAddons do
 		if i ~= thisAddonIndex then -- ignore this addon
-			if IsShiftKeyDown() then -- Are we restoring from save?
+			if SelectAddonButton.nameLabel:GetText() == "Select Saved" and toDo then -- Are we restoring from save?
 				AddOnManager:SetAddOnEnabled(i, AddonClearer.settings.savedSetup[i])
 			else -- Otherwise continue as normal
 				AddOnManager:SetAddOnEnabled(i, toDo)
@@ -25,9 +41,17 @@ function AddonClearer:SetAddons(toDo)
 	SCENE_MANAGER:AddFragment(ADDONS_FRAGMENT)
 end

+function AddonClearer:ShowPanel(...)
+	local a,b = ...
+	if not (a == 14 and b == 5) then return end
+
+end
+
 function AddonClearer:Loaded(eventCode, addonName)
 	if(addonName ~= "AddonClearer") then return end
 	AddonClearer.settings  = ZO_SavedVars:NewAccountWide("AddonClearerSV", 1, nil, {savedSetup = {}})
+
+	EVENT_MANAGER:RegisterForEvent("AddonShowing", EVENT_ACTION_LAYER_PUSHED, function(...) AddonClearer:ShowPanel(...) end)
 end

 EVENT_MANAGER:RegisterForEvent("AddonClearerLoaded", EVENT_ADD_ON_LOADED, function(...) AddonClearer:Loaded(...) end)
\ No newline at end of file
diff --git a/AddonClearer.xml b/AddonClearer.xml
index 3e258d4..370ee90 100644
--- a/AddonClearer.xml
+++ b/AddonClearer.xml
@@ -9,29 +9,12 @@
 			            ZO_KeybindButtonTemplate_Setup(self, "ADDONS_CLEAR_ALL", function() AddonClearer:SetAddons(false) end, "Unselect All")
 			        </OnInitialized>
 			    </Control>
-			    <Control name="SelectAddonButton" inherits="ZO_DialogButton" keyboardEnabled="true">
+			    <Control name="SelectAddonButton" inherits="ZO_DialogButton">
 			        <Anchor point="LEFT" relativeTo="ZO_AddOnsReloadUIButton" relativePoint="RIGHT" offsetX="35" />
 			        <OnInitialized>
 			        	self:SetParent(ZO_AddOns)
 			            ZO_KeybindButtonTemplate_Setup(self, "ADDONS_SELECT_ALL", function() AddonClearer:SetAddons(true) end, "Select All")
 			        </OnInitialized>
-			        <OnMouseDown>
-			        	AddonClearer:SetAddons(true)
-			        </OnMouseDown>
-			        <OnKeyDown>
-		        		if shift then
-		        			self:SetText("Select Saved")
-		        		end
-						if key == 37 then
-		        			AddonClearer:SetAddons(true)
-		        		end
-		        		if key == 12 then
-		        			SCENE_MANAGER:Hide("gameMenuInGame")
-		        		end
-		    		</OnKeyDown>
-		    		<OnKeyUp>
-		    			if shift then self:SetText("Select All") end
-		    		</OnKeyUp>
 			    </Control>
 			</Controls>
 		</TopLevelControl>