Changeset 18587


Ignore:
Timestamp:
11/15/12 21:51:39 (11 years ago)
Author:
nit
Message:

[titan] add menu to filelistmanager

Location:
titan
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • titan/plugins/filemanager/filemanager.h

    r18586 r18587  
    11#ifndef FILEMANAGER_H
    22#define FILEMANAGER_H
     3
     4void filemanagerrename(int aktfilelist, struct skin* filelist1, struct skin* filelistpath1, struct skin* filelist2, struct skin* filelistpath2)
     5{
     6        char* tmpstr = NULL, *file1 = NULL;
     7
     8        if(filelistpath1 == NULL || filelistpath2 == NULL)
     9                return;
     10        if(filelist1 == NULL || filelist1->select == NULL)
     11                return;
     12        if(filelist2 == NULL || filelist2->select == NULL)
     13                return;
     14
     15        if(aktfilelist == 0)
     16                tmpstr = ostrcat(filelist1->select->text, NULL, 0, 0);
     17        else
     18                tmpstr = ostrcat(filelist2->select->text, NULL, 0, 0);
     19
     20        char* search = textinput(_("Rename"), tmpstr);
     21        free(tmpstr); tmpstr = NULL;
     22
     23        if(search != NULL)
     24        {
     25                if(aktfilelist == 0)
     26                {
     27                        file1 = createpath(filelistpath1->text, filelist1->select->text);
     28                        tmpstr = createpath(filelistpath1->text, search);
     29                {
     30                else
     31                }
     32                        file1 = createpath(filelistpath2->text, filelist2->select->text);
     33                        tmpstr = createpath(filelistpath2->text, search);
     34                }
     35
     36                if(!file_exist(tmpstr))
     37                {
     38                        cmd = ostrcat(cmd, "mv \"", 1, 0);
     39                        cmd = ostrcat(cmd, file1, 1, 0);
     40                        cmd = ostrcat(cmd, "\" \"", 1, 0);
     41                        cmd = ostrcat(cmd, tmpstr, 1, 0);
     42                        cmd = ostrcat(cmd, "\"", 1, 0);
     43                        system(cmd);
     44                        free(cmd); cmd = NULL;
     45                }
     46
     47                free(tmpstr); tmpstr = NULL;
     48                free(search); search = NULL;
     49        }
     50}
     51
     52void filemanagermenu(int aktfilelist, struct skin* filelist, struct skin* filelist1, struct skin* filelistpath1, struct skin* filelist2, struct skin* filelistpath2)
     53{
     54        struct menulist* mlist = NULL, *mbox = NULL;
     55        char* skintitle = "Menu";
     56
     57        addmenulist(&mlist, "Rename", NULL, NULL, 0, 0);
     58
     59        mbox = menulistbox(mlist, NULL, skintitle, NULL, NULL, 1, 0);
     60        if(mbox != NULL)
     61        {
     62                if(ostrcmp(mbox->name, "Rename") == 0)
     63                        filemanagerrename(aktfilelist, filelist1, filelistpath1, filelist2, filelistpath1);
     64        }
     65
     66        freemenulist(mlist, 1); mlist = NULL;
     67}
    368
    469void screenfilemanager()
     
    201266
    202267                                        free(tmpstr); tmpstr = NULL;
     268                                        free(search); search = NULL;
    203269                                }
    204270                                drawscreen(filemanager, 0, 1);
     
    207273                        }
    208274
    209                         // rename dummy
     275                        //menu
    210276                        if(rcret == getrcconfigint("rcmenu", NULL))
    211277                        {
    212                                 if(aktfilelist == 0)
    213                                         tmpstr = ostrcat(filelist1->select->text, NULL, 0, 0);
    214                                 else
    215                                         tmpstr = ostrcat(filelist2->select->text, NULL, 0, 0);
    216 
    217                                 char* search = textinput(_("Rename"), tmpstr);
    218                                 free(tmpstr); tmpstr = NULL;
    219 
    220                                 if(search != NULL)
    221                                 {
    222                                         if(aktfilelist == 0)
    223                                         {
    224                                                 file1 = createpath(filelistpath1->text, filelist1->select->text);                                       
    225                                                 tmpstr = createpath(filelistpath1->text, search);
    226                                         {
    227                                         else
    228                                         }
    229                                                 file1 = createpath(filelistpath2->text, filelist2->select->text);
    230                                                 tmpstr = createpath(filelistpath2->text, search);
    231                                         }
    232 
    233                                         if(!file_exist(tmpstr))
    234                                         {
    235                                                 cmd = ostrcat(cmd, "mv \"", 1, 0);
    236                                                 cmd = ostrcat(cmd, file1, 1, 0);
    237                                                 cmd = ostrcat(cmd, "\" \"", 1, 0);
    238                                                 cmd = ostrcat(cmd, tmpstr, 1, 0);
    239                                                 cmd = ostrcat(cmd, "\"", 1, 0);
    240                                                 system(cmd);
    241                                                 free(cmd); cmd = NULL;
    242                                         }
    243 
    244                                         free(tmpstr); tmpstr = NULL;
    245                                 }
     278                                filemanagermenu(aktfilelist, filemanager, filemanager1, filelistpath1, filemanager2, filelistpath2);
     279
    246280                                drawscreen(filemanager, 0, 1);
    247281                                drawscreen(filemanager1, 0, 1);
    248282                                drawscreen(filemanager2, 0, 0);
    249283                        }
    250                        
    251                        
    252284                }
    253285                else
  • titan/titan/play.h

    r18584 r18587  
    299299                if(ostrcmp(mbox->name, "Video Settings") == 0)
    300300                        screenvideosettings();
    301                 if(ostrcmp(mbox->name, "AV Settings") == 0)
     301                else if(ostrcmp(mbox->name, "AV Settings") == 0)
    302302                        screenavsettings(0);
    303303                else
Note: See TracChangeset for help on using the changeset viewer.