@@ -2,7 +2,8 @@ local _, MySlot = ...
2
2
3
3
local L = MySlot .L
4
4
local RegEvent = MySlot .regevent
5
- local MAX_PROFILES_COUNT = 50
5
+ local MAX_PROFILES_COUNT = 100
6
+ local IMPORT_BACKUP_COUNT = 1
6
7
7
8
8
9
local f = CreateFrame (" Frame" , nil , UIParent , BackdropTemplateMixin and " BackdropTemplate" or nil )
393
394
StaticPopupDialogs [" MYSLOT_MSGBOX" ].OnAccept = function ()
394
395
StaticPopup_Hide (" MYSLOT_MSGBOX" )
395
396
397
+ MySlot :Print (L [" Starting backup..." ])
398
+ local backup = MySlot :Export (actionOpt )
399
+ table.insert (MyslotExports [" backups" ], backup )
400
+ while # MyslotExports [" backups" ] > IMPORT_BACKUP_COUNT do
401
+ table.remove (MyslotExports [" backups" ], 1 )
402
+ end
403
+
396
404
MySlot :Clear (" MACRO" , clearOpt .ignoreMacros )
397
405
MySlot :Clear (" ACTION" , clearOpt .ignoreActionBars )
398
406
if clearOpt .ignoreBinding then
@@ -586,7 +594,11 @@ RegEvent("ADDON_LOADED", function()
586
594
if not MyslotExports [" exports" ] then
587
595
MyslotExports [" exports" ] = {}
588
596
end
597
+ if not MyslotExports [" backups" ] then
598
+ MyslotExports [" backups" ] = {}
599
+ end
589
600
local exports = MyslotExports [" exports" ]
601
+ local backups = MyslotExports [" backups" ]
590
602
591
603
local onclick = function (self )
592
604
local idx = self .value
@@ -600,8 +612,9 @@ RegEvent("ADDON_LOADED", function()
600
612
end
601
613
602
614
local create = function (name )
603
- while # exports > MAX_PROFILES_COUNT do
604
- table.remove (exports , 1 )
615
+ if # exports > MAX_PROFILES_COUNT then
616
+ MySlot :Print (L [" Too many profiles, please delete before create new one." ])
617
+ return
605
618
end
606
619
607
620
local txt = {
@@ -640,12 +653,26 @@ RegEvent("ADDON_LOADED", function()
640
653
-- exportEditbox:SetScript("OnTextChanged", function() save(false) end)
641
654
642
655
UIDropDownMenu_Initialize (t , function ()
656
+ local info = UIDropDownMenu_CreateInfo ()
657
+ info .text = L [" Before Last Import" ]
658
+ info .customCheckIconTexture = " Interface\\ Icons\\ inv_scroll_04"
659
+ info .func = function ()
660
+ local b = backups [1 ] -- only 1 backup now, will support more later
661
+ if b then
662
+ exportEditbox :SetText (b )
663
+ infolabel :SetText (" " )
664
+ UIDropDownMenu_SetText (t , " " )
665
+ end
666
+ end
667
+ UIDropDownMenu_AddButton (info )
668
+
643
669
for i , txt in pairs (exports ) do
644
670
-- print(txt.name)
645
671
local info = UIDropDownMenu_CreateInfo ()
646
672
info .text = txt .name
647
673
info .value = i
648
674
info .func = onclick
675
+ info .customCheckIconTexture = " Interface\\ Icons\\ inv_scroll_03"
649
676
UIDropDownMenu_AddButton (info )
650
677
end
651
678
end )
0 commit comments