source: titan/titan/restoredefault.h @ 39037

Last change on this file since 39037 was 38910, checked in by obi, 8 years ago

fix translate

File size: 3.7 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 ?"), _("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 default"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 7, 0);
24        }
25        clearscreen(load);
26}
27
28void screenrestoredefault_without_channelsettings()
29{
30        int ret = 0;
31        char* tmpstr = NULL;
32        struct skin* load = getscreen("loading");
33
34        ret = textbox(_("Message"), _("Really restore default without Channelsettings ?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 600, 200, 0, 0);
35
36        if(ret == 1)
37        {
38                drawscreen(load, 0, 0);
39                tmpstr = getconfig("restorecmd", NULL);
40                if(tmpstr != NULL)
41                {
42                        tmpstr = ostrcat(tmpstr, " without_channelsettings", 1, 0);
43                        printf("cmd: %s\n", tmpstr);
44                        system(tmpstr);
45                        textbox(_("Message"), _("Receiver reboots now !!!"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 7, 0);
46                        oshutdown(2, 2);;
47                }
48                else
49                        textbox(_("Message"), _("Can't restore default"), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 600, 200, 7, 0);
50        }
51        clearscreen(load);
52}
53
54void screeneraseswap()
55{
56        struct skin* load = getscreen("loading");
57
58        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)
59        {
60                debug(40, "Erase-Mtd");
61                drawscreen(load, 0, 0);
62                system("touch /var/etc/.erasemtd");
63                sleep(4);
64                clearscreen(load);
65                oshutdown(2, 2);
66        }
67}
68
69void screenbackuperaseswap()
70{
71        struct skin* load = getscreen("loading");
72
73        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)
74        {
75                debug(40, "Erase-Mtd with settings restore");
76                drawscreen(load, 0, 0);
77                system("touch /var/etc/.erasemtd");
78                system("touch /var/etc/.backupmtd");
79                sleep(4);
80                clearscreen(load);
81                oshutdown(2, 2);
82        }
83}
84
85void screenrestoredefaultchoice()
86{
87        struct menulist* mlist = NULL, *mbox = NULL;
88
89        addmenulist(&mlist, "Restore default", _("Restore default"), NULL, 0, 0);
90        addmenulist(&mlist, "Restore default without Channelsettings", _("Restore default without Channelsettings"), NULL, 0, 0);
91        addmenulist(&mlist, "Format MNT with Backup/Restore", _("Format MNT with Backup/Restore"), NULL, 0, 0);
92        addmenulist(&mlist, "Format MNT (all)", _("Format MNT (all)"), NULL, 0, 0);
93
94        mbox = menulistbox(mlist, NULL, _("Restore default settings"), _("Choose your Restore Mode from the following list."), NULL, NULL, 1, 0);
95
96        if(mbox != NULL)
97        {
98                if(ostrcmp(mbox->name, "Restore default") == 0)
99                {
100                        screenrestoredefault();
101                }
102                else if(ostrcmp(mbox->name, "Restore default without Channelsettings") == 0)
103                {
104                        screenrestoredefault_without_channelsettings();
105                }
106                else if(ostrcmp(mbox->name, "Format MNT with Backup/Restore") == 0)
107                {
108                        screenbackuperaseswap();
109                }
110                else if(ostrcmp(mbox->name, "Format MNT (all)") == 0)
111                {
112                        screeneraseswap();
113                }
114        }
115
116        freemenulist(mlist, 1); mlist = NULL;
117}
118
119#endif
Note: See TracBrowser for help on using the repository browser.