source: titan/titan/restoredefault.h @ 35859

Last change on this file since 35859 was 35859, checked in by Stephan, 7 years ago

revert

File size: 2.6 KB
Line 
1#ifndef RESTOREDEFAULT_H
2#define RESTOREDEFAULT_H
3
4void screenrestoredefault()
5{
6        int ret = 0;
7        char* tmpstr = NULL;
8        struct skin* load = getscreen("loading");
9
10        ret = textbox(_("Message"), _("Really restore default settings ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
11
12        if(ret == 1)
13        {
14                drawscreen(load, 0, 0);
15                tmpstr = getconfig("restorecmd", NULL);
16                if(tmpstr != NULL)
17                {
18                        system(tmpstr);
19                        textbox(_("Message"), _("Receiver reboots now !!!"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 7, 0);
20                        oshutdown(2, 2);;
21                }
22                else
23                        textbox(_("Message"), _("Can't restore settings"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 7, 0);
24        }
25        clearscreen(load);
26}
27
28void screeneraseswap()
29{
30        struct skin* load = getscreen("loading");
31
32        if(textbox(_("Message"), _("Do you really want to erase all data and backups from Swap?\nThe Box will reboot and the erase will be started!"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1)
33        {
34                debug(40, "Erase-Mtd");
35                drawscreen(load, 0, 0);
36                system("touch /var/etc/.erasemtd");
37                sleep(4);
38                clearscreen(load);
39                oshutdown(2, 2);
40        }
41}
42
43void screenbackuperaseswap()
44{
45        struct skin* load = getscreen("loading");
46
47        if(textbox(_("Message"), _("Do you really want to erase Swap (Settings are preserve)?\nThe Box will reboot and the erase will be started!"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 1000, 200, 0, 0) == 1)
48        {
49                debug(40, "Erase-Mtd with settings restore");
50                drawscreen(load, 0, 0);
51                system("touch /var/etc/.erasemtd");
52                system("touch /var/etc/.backupmtd");
53                sleep(4);
54                clearscreen(load);
55                oshutdown(2, 2);
56        }
57}
58
59void screenrestoredefaultchoice()
60{
61        struct menulist* mlist = NULL, *mbox = NULL;
62
63        addmenulist(&mlist, "Restore default settings", _("Restore default settings"), NULL, 0, 0);
64        addmenulist(&mlist, "Format MNT with Backup/Restore", _("Format MNT with Backup/Restore"), NULL, 0, 0);
65        addmenulist(&mlist, "Format MNT (all)", _("Format MNT (all)"), NULL, 0, 0);
66
67        mbox = menulistbox(mlist, NULL, _("Restore default settings"), _("Choose your Restore Mode from the following list."), NULL, NULL, 1, 0);
68
69        if(mbox != NULL)
70        {
71                if(ostrcmp(mbox->name, "Restore default settings") == 0)
72                {
73                        screenrestoredefault();
74                }
75                else if(ostrcmp(mbox->name, "Format MNT with Backup/Restore") == 0)
76                {
77                        screenbackuperaseswap();
78                }
79                else if(ostrcmp(mbox->name, "Format MNT (all)") == 0)
80                {
81                        screeneraseswap();
82                }
83        }
84
85        freemenulist(mlist, 1); mlist = NULL;
86}
87
88#endif
Note: See TracBrowser for help on using the repository browser.