"Fossies" - the Fresh Open Source Software Archive

Member "xfe-1.43.2/src/XFileExplorer.cpp" (4 Feb 2019, 166672 Bytes) of package /linux/privat/xfe-1.43.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "XFileExplorer.cpp" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.43.1_vs_1.43.2.

    1 #include "config.h"
    2 #include "i18n.h"
    3 
    4 #include <stdio.h>
    5 #include <stdlib.h>
    6 #include <signal.h>
    7 #include <sys/types.h>
    8 #include <sys/wait.h>
    9 #include <unistd.h>
   10 
   11 #include <fx.h>
   12 #include <fxkeys.h>
   13 #include <FXPNGIcon.h>
   14 
   15 #include "xfedefs.h"
   16 #include "icons.h"
   17 #include "xfeutils.h"
   18 #include "startupnotification.h"
   19 #include "File.h"
   20 #include "FileList.h"
   21 #include "FileDict.h"
   22 #include "Preferences.h"
   23 #include "FilePanel.h"
   24 #include "InputDialog.h"
   25 #include "HistInputDialog.h"
   26 #include "DirPanel.h"
   27 #include "MessageBox.h"
   28 #include "TextWindow.h"
   29 #include "CommandWindow.h"
   30 #include "Bookmarks.h"
   31 #include "FileDialog.h"
   32 #include "help.h"
   33 #include "DirHistBox.h"
   34 #include "SearchWindow.h"
   35 #include "XFileExplorer.h"
   36 
   37 // Size of the location bar
   38 #define LOCATION_BAR_LENGTH    60
   39 #define LOCATION_BAR_HEIGHT    6
   40 
   41 
   42 // Global variables
   43 FXString clipboard = "";
   44 char     OpenHistory[OPEN_HIST_SIZE][MAX_COMMAND_SIZE];
   45 int      OpenNum;
   46 char     FilterHistory[FILTER_HIST_SIZE][MAX_PATTERN_SIZE];
   47 int      FilterNum;
   48 
   49 FXbool allowPopupScroll = false;
   50 FXuint single_click;
   51 FXbool file_tooltips;
   52 FXbool relative_resize;
   53 
   54 // External global variables
   55 extern char**   args;
   56 extern int      panel_mode;
   57 extern FXString homedir;
   58 extern FXString xdgdatahome;
   59 extern FXString xdgconfighome;
   60 
   61 // Global options
   62 #if defined(linux)
   63 extern FXStringDict* fsdevices;
   64 extern FXStringDict* updevices;
   65 #endif
   66 
   67 
   68 
   69 // Helper function to draw a toolbar separator
   70 static void toolbarSeparator(FXToolBar* tb)
   71 {
   72 #define SEP_SPACE    1
   73     new FXFrame(tb, LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, 0, 0, SEP_SPACE);
   74     new FXVerticalSeparator(tb, LAYOUT_SIDE_TOP|LAYOUT_CENTER_Y|SEPARATOR_GROOVE|LAYOUT_FILL_Y);
   75     new FXFrame(tb, LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, 0, 0, SEP_SPACE);
   76 }
   77 
   78 
   79 // Map
   80 FXDEFMAP(XFileExplorer) XFileExplorerMap[] =
   81 {
   82     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_TOGGLE_STATUS, XFileExplorer::onCmdToggleStatus),
   83     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_RUN, XFileExplorer::onCmdRun),
   84     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_SU, XFileExplorer::onCmdSu),
   85     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_COPY, XFileExplorer::onCmdFileCopyClp),
   86     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_CUT, XFileExplorer::onCmdFileCutClp),
   87     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_ADDCOPY, XFileExplorer::onCmdFileAddCopyClp),
   88     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_ADDCUT, XFileExplorer::onCmdFileAddCutClp),
   89     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_PASTE, XFileExplorer::onCmdFilePasteClp),
   90     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_RENAME, XFileExplorer::onCmdFileRename),
   91     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_COPYTO, XFileExplorer::onCmdFileCopyto),
   92     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_MOVETO, XFileExplorer::onCmdFileMoveto),
   93     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_SYMLINK, XFileExplorer::onCmdFileSymlink),
   94     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_PROPERTIES, XFileExplorer::onCmdFileProperties),
   95     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_DELETE, XFileExplorer::onCmdFileDelete),
   96     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_TRASH, XFileExplorer::onCmdFileTrash),
   97     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_RESTORE, XFileExplorer::onCmdFileRestore),
   98     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_QUIT, XFileExplorer::onQuit),
   99     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_HELP, XFileExplorer::onCmdHelp),
  100     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_ABOUT, XFileExplorer::onCmdAbout),
  101     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_ASSOC, XFileExplorer::onCmdFileAssoc),
  102     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_REFRESH, XFileExplorer::onCmdRefresh),
  103     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_EMPTY_TRASH, XFileExplorer::onCmdEmptyTrash),
  104     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_TRASH_SIZE, XFileExplorer::onCmdTrashSize),
  105     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_XTERM, XFileExplorer::onCmdXTerm),
  106     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_CLEAR_LOCATION, XFileExplorer::onCmdClearLocation),
  107     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_GOTO_LOCATION, XFileExplorer::onCmdGotoLocation),
  108     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_PREFS, XFileExplorer::onCmdPrefs),
  109     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_HORZ_PANELS, XFileExplorer::onCmdHorzVertPanels),
  110     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_VERT_PANELS, XFileExplorer::onCmdHorzVertPanels),
  111     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_SHOW_ONE_PANEL, XFileExplorer::onCmdShowPanels),
  112     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_SHOW_TWO_PANELS, XFileExplorer::onCmdShowPanels),
  113     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_SHOW_TREE_PANEL, XFileExplorer::onCmdShowPanels),
  114     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_SHOW_TREE_TWO_PANELS, XFileExplorer::onCmdShowPanels),
  115     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_SYNCHRONIZE_PANELS, XFileExplorer::onCmdSynchronizePanels),
  116     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_SWITCH_PANELS, XFileExplorer::onCmdSwitchPanels),
  117     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_RESTART, XFileExplorer::onCmdRestart),
  118     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_NEW_WIN, XFileExplorer::onCmdNewWindow),
  119     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_BOOKMARK, XFileExplorer::onCmdBookmark),
  120     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_DIR_UP, XFileExplorer::onCmdDirUp),
  121     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_ADD_BOOKMARK, XFileExplorer::onCmdBookmark),
  122     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_DIR_BACK, XFileExplorer::onCmdDirBack),
  123     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_DIR_FORWARD, XFileExplorer::onCmdDirForward),
  124     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_DIR_BACK_HIST, XFileExplorer::onCmdDirBackHist),
  125     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_DIR_FORWARD_HIST, XFileExplorer::onCmdDirForwardHist),
  126     FXMAPFUNC(SEL_KEYPRESS, 0, XFileExplorer::onKeyPress),
  127     FXMAPFUNC(SEL_KEYRELEASE, 0, XFileExplorer::onKeyRelease),
  128     FXMAPFUNC(SEL_SIGNAL, XFileExplorer::ID_HARVEST, XFileExplorer::onSigHarvest),
  129     FXMAPFUNC(SEL_SIGNAL, XFileExplorer::ID_QUIT, XFileExplorer::onQuit),
  130     FXMAPFUNC(SEL_CLOSE, 0, XFileExplorer::onQuit),
  131     FXMAPFUNC(SEL_COMMAND, XFileExplorer::ID_FILE_SEARCH, XFileExplorer::onCmdFileSearch),
  132     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_DIR_FORWARD_HIST, XFileExplorer::onUpdDirForwardHist),
  133     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_DIR_BACK_HIST, XFileExplorer::onUpdDirBackHist),
  134     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_DIR_BACK, XFileExplorer::onUpdDirBack),
  135     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_DIR_FORWARD, XFileExplorer::onUpdDirForward),
  136     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_TOGGLE_STATUS, XFileExplorer::onUpdToggleStatus),
  137     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_HORZ_PANELS, XFileExplorer::onUpdHorzVertPanels),
  138     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_VERT_PANELS, XFileExplorer::onUpdHorzVertPanels),
  139     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_SHOW_ONE_PANEL, XFileExplorer::onUpdShowPanels),
  140     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_SHOW_TWO_PANELS, XFileExplorer::onUpdShowPanels),
  141     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_SHOW_TREE_PANEL, XFileExplorer::onUpdShowPanels),
  142     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_SHOW_TREE_TWO_PANELS, XFileExplorer::onUpdShowPanels),
  143     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_GOTO_LOCATION, XFileExplorer::onUpdFileLocation),
  144     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_EMPTY_TRASH, XFileExplorer::onUpdEmptyTrash),
  145     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_EMPTY_TRASH, XFileExplorer::onUpdTrashSize),
  146     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_FILE_DELETE, XFileExplorer::onUpdFileDelete),
  147     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_FILE_TRASH, XFileExplorer::onUpdFileTrash),
  148     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_FILE_RESTORE, XFileExplorer::onUpdFileRestore),
  149     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_FILE_RENAME, XFileExplorer::onUpdFileRename),
  150     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_FILE_PROPERTIES, XFileExplorer::onUpdFileMan),
  151     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_FILE_COPYTO, XFileExplorer::onUpdFileMan),
  152     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_FILE_MOVETO, XFileExplorer::onUpdFileMan),
  153     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_FILE_SYMLINK, XFileExplorer::onUpdFileMan),
  154     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_FILE_COPY, XFileExplorer::onUpdFileMan),
  155     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_FILE_CUT, XFileExplorer::onUpdFileMan),
  156     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_FILE_PASTE, XFileExplorer::onUpdFilePaste),
  157     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_SYNCHRONIZE_PANELS, XFileExplorer::onUpdSynchronizePanels),
  158     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_SWITCH_PANELS, XFileExplorer::onUpdSwitchPanels),
  159     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_SU, XFileExplorer::onUpdSu),
  160     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_QUIT, XFileExplorer::onUpdQuit),
  161     FXMAPFUNC(SEL_UPDATE, XFileExplorer::ID_FILE_SEARCH, XFileExplorer::onUpdFileSearch),
  162 };
  163 
  164 
  165 // Object implementation
  166 FXIMPLEMENT(XFileExplorer, FXMainWindow, XFileExplorerMap, ARRAYNUMBER(XFileExplorerMap))
  167 
  168 
  169 
  170 // Make some windows
  171 XFileExplorer::XFileExplorer(FXApp* app, vector_FXString URIs, const FXbool iconic, const FXbool maximized, const char* title, FXIcon* bigicon, FXIcon* miniicon) :
  172     FXMainWindow(app, title, bigicon, miniicon, DECOR_ALL)
  173 {
  174     bookmarks = new Bookmarks("bookmarks", this, ID_BOOKMARK);
  175 
  176     // Menu bar
  177     menubar = new FXMenuBar(this, LAYOUT_SIDE_TOP|LAYOUT_FILL_X|FRAME_RAISED);
  178 
  179     // Site where to dock (for toolbars)
  180     FXDockSite* topdock = new FXDockSite(this, LAYOUT_SIDE_TOP|LAYOUT_FILL_X);
  181 
  182     // General toolbar
  183     FXToolBarShell* dragshell1 = new FXToolBarShell(this, FRAME_RAISED);
  184     generaltoolbar = new FXToolBar(topdock, dragshell1, LAYOUT_DOCK_NEXT|LAYOUT_SIDE_TOP|FRAME_RAISED|LAYOUT_FILL_Y);
  185     new FXToolBarGrip(generaltoolbar, generaltoolbar, FXToolBar::ID_TOOLBARGRIP, TOOLBARGRIP_DOUBLE);
  186 
  187     // Tools toolbar
  188     FXToolBarShell* dragshell2 = new FXToolBarShell(this, FRAME_RAISED);
  189     toolstoolbar = new FXToolBar(topdock, dragshell2, LAYOUT_DOCK_SAME|LAYOUT_SIDE_TOP|FRAME_RAISED|LAYOUT_FILL_Y);
  190     new FXToolBarGrip(toolstoolbar, toolstoolbar, FXToolBar::ID_TOOLBARGRIP, TOOLBARGRIP_DOUBLE);
  191 
  192     // Panel toolbar
  193     FXToolBarShell* dragshell3 = new FXToolBarShell(this, FRAME_RAISED);
  194     paneltoolbar = new FXToolBar(topdock, dragshell3, LAYOUT_DOCK_SAME|LAYOUT_SIDE_TOP|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y);
  195     new FXToolBarGrip(paneltoolbar, paneltoolbar, FXToolBar::ID_TOOLBARGRIP, TOOLBARGRIP_DOUBLE);
  196 
  197     // Location bar
  198     FXToolBarShell* dragshell4 = new FXToolBarShell(this, FRAME_RAISED);
  199     locationbar = new FXToolBar(topdock, dragshell4, LAYOUT_DOCK_NEXT|LAYOUT_SIDE_TOP|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_FILL_Y);
  200     new FXToolBarGrip(locationbar, locationbar, FXToolBar::ID_TOOLBARGRIP, TOOLBARGRIP_DOUBLE);
  201 
  202     // Main splitter
  203     FXHorizontalFrame* hframe = new FXHorizontalFrame(this, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  204     FXSplitter*        mainsplit = new FXSplitter(hframe, LAYOUT_SIDE_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_TRACKING|FRAME_NONE);
  205 
  206     // File list background, foreground, highlight, progress bar and attention colors
  207     listbackcolor = getApp()->reg().readColorEntry("SETTINGS", "listbackcolor", FXRGB(255, 255, 255));
  208     listforecolor = getApp()->reg().readColorEntry("SETTINGS", "listforecolor", FXRGB(0, 0, 0));
  209     highlightcolor = getApp()->reg().readColorEntry("SETTINGS", "highlightcolor", FXRGB(238, 238, 238));
  210     pbarcolor = getApp()->reg().readColorEntry("SETTINGS", "pbarcolor", FXRGB(0, 0, 255));
  211     attentioncolor = getApp()->reg().readColorEntry("SETTINGS", "attentioncolor", FXRGB(255, 0, 0));
  212     scrollbarcolor = getApp()->reg().readColorEntry("SETTINGS", "scrollbarcolor", FXRGB(237, 233, 227));
  213 
  214     // Smooth scrolling
  215     smoothscroll = getApp()->reg().readUnsignedEntry("SETTINGS", "smooth_scroll", true);
  216 
  217     // Directory panel on the left (with minimum size)
  218     dirpanel = new DirPanel(this, mainsplit, listbackcolor, listforecolor, smoothscroll, LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, 0, 0, 0, 0);
  219 
  220     // Splitter containing the two panels
  221     panelsplit = new FXSplitter(mainsplit, LAYOUT_SIDE_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_TRACKING|FRAME_NONE);
  222 
  223     // Stack file panels horizontally or vertically (directory panel is always vertical)
  224     vertpanels = getApp()->reg().readUnsignedEntry("OPTIONS", "vert_panels", true);
  225     if (vertpanels)
  226     {
  227         panelsplit->setSplitterStyle(panelsplit->getSplitterStyle()&~SPLITTER_VERTICAL);
  228     }
  229     else
  230     {
  231         panelsplit->setSplitterStyle(panelsplit->getSplitterStyle()|SPLITTER_VERTICAL);
  232     }
  233 
  234     // File panels on the right : remembers size of each field
  235     lpanel = new FilePanel(this, "LEFT PANEL", panelsplit, dirpanel,
  236                            getApp()->reg().readUnsignedEntry("LEFT PANEL", "name_size", 200),
  237                            getApp()->reg().readUnsignedEntry("LEFT PANEL", "size_size", 60),
  238                            getApp()->reg().readUnsignedEntry("LEFT PANEL", "type_size", 100),
  239                            getApp()->reg().readUnsignedEntry("LEFT PANEL", "ext_size", 100),
  240                            getApp()->reg().readUnsignedEntry("LEFT PANEL", "modd_size", 150),
  241                            getApp()->reg().readUnsignedEntry("LEFT PANEL", "user_size", 50),
  242                            getApp()->reg().readUnsignedEntry("LEFT PANEL", "grou_size", 50),
  243                            getApp()->reg().readUnsignedEntry("LEFT PANEL", "attr_size", 100),
  244                            getApp()->reg().readUnsignedEntry("LEFT PANEL", "deldate_size", 150),
  245                            getApp()->reg().readUnsignedEntry("LEFT PANEL", "origpath_size", 200),
  246                            getApp()->reg().readUnsignedEntry("LEFT PANEL", "showthumbnails", 0),
  247                            listbackcolor, listforecolor, attentioncolor, smoothscroll,
  248                            LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, 0, 0, 0, 0);
  249 
  250     rpanel = new FilePanel(this, "RIGHT PANEL", panelsplit, dirpanel,
  251                            getApp()->reg().readUnsignedEntry("RIGHT PANEL", "name_size", 200),
  252                            getApp()->reg().readUnsignedEntry("RIGHT PANEL", "size_size", 60),
  253                            getApp()->reg().readUnsignedEntry("RIGHT PANEL", "type_size", 100),
  254                            getApp()->reg().readUnsignedEntry("RIGHT PANEL", "ext_size", 100),
  255                            getApp()->reg().readUnsignedEntry("RIGHT PANEL", "modd_size", 150),
  256                            getApp()->reg().readUnsignedEntry("RIGHT PANEL", "user_size", 50),
  257                            getApp()->reg().readUnsignedEntry("RIGHT PANEL", "grou_size", 50),
  258                            getApp()->reg().readUnsignedEntry("RIGHT PANEL", "attr_size", 100),
  259                            getApp()->reg().readUnsignedEntry("RIGHT PANEL", "deldate_size", 150),
  260                            getApp()->reg().readUnsignedEntry("RIGHT PANEL", "origpath_size", 200),
  261                            getApp()->reg().readUnsignedEntry("RIGHT PANEL", "showthumbnails", 0),
  262                            listbackcolor, listforecolor, attentioncolor, smoothscroll,
  263                            LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_NONE, 0, 0, 0, 0);
  264 
  265     lpanel->Next(rpanel);
  266     rpanel->Next(lpanel);
  267     lpanel->setActive();
  268 
  269     FXString sort_func;
  270 
  271     // Dir panel options
  272     sort_func = getApp()->reg().readStringEntry("DIR PANEL", "sort_func", "ascendingCase");
  273     if (sort_func == "ascendingCase")
  274     {
  275         dirpanel->setSortFunc(DirList::ascendingCase);
  276     }
  277     else if (sort_func == "descendingCase")
  278     {
  279         dirpanel->setSortFunc(DirList::descendingCase);
  280     }
  281     else if (sort_func == "ascending")
  282     {
  283         dirpanel->setSortFunc(DirList::ascending);
  284     }
  285     else if (sort_func == "descending")
  286     {
  287         dirpanel->setSortFunc(DirList::descending);
  288     }
  289 
  290     // Left panel options
  291     sort_func = getApp()->reg().readStringEntry("LEFT PANEL", "sort_func", "ascendingCase");
  292     if (sort_func == "ascendingCase")
  293     {
  294         lpanel->setSortFunc(FileList::ascendingCase);
  295     }
  296     else if (sort_func == "ascendingCaseMix")
  297     {
  298         lpanel->setSortFunc(FileList::ascendingCaseMix);
  299     }
  300     else if (sort_func == "descendingCase")
  301     {
  302         lpanel->setSortFunc(FileList::descendingCase);
  303     }
  304     else if (sort_func == "descendingCaseMix")
  305     {
  306         lpanel->setSortFunc(FileList::descendingCaseMix);
  307     }
  308     else if (sort_func == "ascending")
  309     {
  310         lpanel->setSortFunc(FileList::ascending);
  311     }
  312     else if (sort_func == "ascendingMix")
  313     {
  314         lpanel->setSortFunc(FileList::ascendingMix);
  315     }
  316     else if (sort_func == "descending")
  317     {
  318         lpanel->setSortFunc(FileList::descending);
  319     }
  320     else if (sort_func == "descendingMix")
  321     {
  322         lpanel->setSortFunc(FileList::descendingMix);
  323     }
  324     else if (sort_func == "ascendingSize")
  325     {
  326         lpanel->setSortFunc(FileList::ascendingSize);
  327     }
  328     else if (sort_func == "ascendingSizeMix")
  329     {
  330         lpanel->setSortFunc(FileList::ascendingSizeMix);
  331     }
  332     else if (sort_func == "descendingSize")
  333     {
  334         lpanel->setSortFunc(FileList::descendingSize);
  335     }
  336     else if (sort_func == "descendingSizeMix")
  337     {
  338         lpanel->setSortFunc(FileList::descendingSizeMix);
  339     }
  340     else if (sort_func == "ascendingType")
  341     {
  342         lpanel->setSortFunc(FileList::ascendingType);
  343     }
  344     else if (sort_func == "ascendingTypeMix")
  345     {
  346         lpanel->setSortFunc(FileList::ascendingTypeMix);
  347     }
  348     else if (sort_func == "descendingType")
  349     {
  350         lpanel->setSortFunc(FileList::descendingType);
  351     }
  352     else if (sort_func == "descendingTypeMix")
  353     {
  354         lpanel->setSortFunc(FileList::descendingTypeMix);
  355     }
  356     else if (sort_func == "ascendingExt")
  357     {
  358         lpanel->setSortFunc(FileList::ascendingExt);
  359     }
  360     else if (sort_func == "ascendingExtMix")
  361     {
  362         lpanel->setSortFunc(FileList::ascendingExtMix);
  363     }
  364     else if (sort_func == "descendingExt")
  365     {
  366         lpanel->setSortFunc(FileList::descendingExt);
  367     }
  368     else if (sort_func == "descendingExtMix")
  369     {
  370         lpanel->setSortFunc(FileList::descendingExtMix);
  371     }
  372     else if (sort_func == "ascendingTime")
  373     {
  374         lpanel->setSortFunc(FileList::ascendingTime);
  375     }
  376     else if (sort_func == "ascendingTimeMix")
  377     {
  378         lpanel->setSortFunc(FileList::ascendingTimeMix);
  379     }
  380     else if (sort_func == "descendingTime")
  381     {
  382         lpanel->setSortFunc(FileList::descendingTime);
  383     }
  384     else if (sort_func == "descendingTimeMix")
  385     {
  386         lpanel->setSortFunc(FileList::descendingTimeMix);
  387     }
  388     else if (sort_func == "ascendingUser")
  389     {
  390         lpanel->setSortFunc(FileList::ascendingUser);
  391     }
  392     else if (sort_func == "ascendingUserMix")
  393     {
  394         lpanel->setSortFunc(FileList::ascendingUserMix);
  395     }
  396     else if (sort_func == "descendingUser")
  397     {
  398         lpanel->setSortFunc(FileList::descendingUser);
  399     }
  400     else if (sort_func == "descendingUserMix")
  401     {
  402         lpanel->setSortFunc(FileList::descendingUserMix);
  403     }
  404     else if (sort_func == "ascendingGroup")
  405     {
  406         lpanel->setSortFunc(FileList::ascendingGroup);
  407     }
  408     else if (sort_func == "ascendingGroupMix")
  409     {
  410         lpanel->setSortFunc(FileList::ascendingGroupMix);
  411     }
  412     else if (sort_func == "descendingGroup")
  413     {
  414         lpanel->setSortFunc(FileList::descendingGroup);
  415     }
  416     else if (sort_func == "descendingGroupMix")
  417     {
  418         lpanel->setSortFunc(FileList::descendingGroupMix);
  419     }
  420     else if (sort_func == "ascendingPerm")
  421     {
  422         lpanel->setSortFunc(FileList::ascendingPerm);
  423     }
  424     else if (sort_func == "ascendingPermMix")
  425     {
  426         lpanel->setSortFunc(FileList::ascendingPermMix);
  427     }
  428     else if (sort_func == "descendingPerm")
  429     {
  430         lpanel->setSortFunc(FileList::descendingPerm);
  431     }
  432     else if (sort_func == "descendingPermMix")
  433     {
  434         lpanel->setSortFunc(FileList::descendingPermMix);
  435     }
  436     FXuint ignore_case = getApp()->reg().readUnsignedEntry("LEFT PANEL", "ignore_case", 1);
  437     lpanel->setIgnoreCase(ignore_case);
  438     FXuint dirs_first = getApp()->reg().readUnsignedEntry("LEFT PANEL", "dirs_first", 1);
  439     lpanel->setDirsFirst(dirs_first);
  440 
  441     // Right panel options
  442     sort_func = getApp()->reg().readStringEntry("RIGHT PANEL", "sort_func", "ascendingCase");
  443     if (sort_func == "ascendingCase")
  444     {
  445         rpanel->setSortFunc(FileList::ascendingCase);
  446     }
  447     else if (sort_func == "ascendingCaseMix")
  448     {
  449         rpanel->setSortFunc(FileList::ascendingCaseMix);
  450     }
  451     else if (sort_func == "descendingCase")
  452     {
  453         rpanel->setSortFunc(FileList::descendingCase);
  454     }
  455     else if (sort_func == "descendingCaseMix")
  456     {
  457         rpanel->setSortFunc(FileList::descendingCaseMix);
  458     }
  459     else if (sort_func == "ascending")
  460     {
  461         rpanel->setSortFunc(FileList::ascending);
  462     }
  463     else if (sort_func == "ascendingMix")
  464     {
  465         rpanel->setSortFunc(FileList::ascendingMix);
  466     }
  467     else if (sort_func == "descending")
  468     {
  469         rpanel->setSortFunc(FileList::descending);
  470     }
  471     else if (sort_func == "descendingMix")
  472     {
  473         rpanel->setSortFunc(FileList::descendingMix);
  474     }
  475     else if (sort_func == "ascendingSize")
  476     {
  477         rpanel->setSortFunc(FileList::ascendingSize);
  478     }
  479     else if (sort_func == "ascendingSizeMix")
  480     {
  481         rpanel->setSortFunc(FileList::ascendingSizeMix);
  482     }
  483     else if (sort_func == "descendingSize")
  484     {
  485         rpanel->setSortFunc(FileList::descendingSize);
  486     }
  487     else if (sort_func == "descendingSizeMix")
  488     {
  489         rpanel->setSortFunc(FileList::descendingSizeMix);
  490     }
  491     else if (sort_func == "ascendingType")
  492     {
  493         rpanel->setSortFunc(FileList::ascendingType);
  494     }
  495     else if (sort_func == "ascendingTypeMix")
  496     {
  497         rpanel->setSortFunc(FileList::ascendingTypeMix);
  498     }
  499     else if (sort_func == "descendingType")
  500     {
  501         rpanel->setSortFunc(FileList::descendingType);
  502     }
  503     else if (sort_func == "descendingTypeMix")
  504     {
  505         rpanel->setSortFunc(FileList::descendingTypeMix);
  506     }
  507     else if (sort_func == "ascendingExt")
  508     {
  509         rpanel->setSortFunc(FileList::ascendingExt);
  510     }
  511     else if (sort_func == "ascendingExtMix")
  512     {
  513         rpanel->setSortFunc(FileList::ascendingExtMix);
  514     }
  515     else if (sort_func == "descendingExt")
  516     {
  517         rpanel->setSortFunc(FileList::descendingExt);
  518     }
  519     else if (sort_func == "descendingExtMix")
  520     {
  521         rpanel->setSortFunc(FileList::descendingExtMix);
  522     }
  523     else if (sort_func == "ascendingTime")
  524     {
  525         rpanel->setSortFunc(FileList::ascendingTime);
  526     }
  527     else if (sort_func == "ascendingTimeMix")
  528     {
  529         rpanel->setSortFunc(FileList::ascendingTimeMix);
  530     }
  531     else if (sort_func == "descendingTime")
  532     {
  533         rpanel->setSortFunc(FileList::descendingTime);
  534     }
  535     else if (sort_func == "descendingTimeMix")
  536     {
  537         rpanel->setSortFunc(FileList::descendingTimeMix);
  538     }
  539     else if (sort_func == "ascendingUser")
  540     {
  541         rpanel->setSortFunc(FileList::ascendingUser);
  542     }
  543     else if (sort_func == "ascendingUserMix")
  544     {
  545         rpanel->setSortFunc(FileList::ascendingUserMix);
  546     }
  547     else if (sort_func == "descendingUser")
  548     {
  549         rpanel->setSortFunc(FileList::descendingUser);
  550     }
  551     else if (sort_func == "descendingUserMix")
  552     {
  553         rpanel->setSortFunc(FileList::descendingUserMix);
  554     }
  555     else if (sort_func == "ascendingGroup")
  556     {
  557         rpanel->setSortFunc(FileList::ascendingGroup);
  558     }
  559     else if (sort_func == "ascendingGroupMix")
  560     {
  561         rpanel->setSortFunc(FileList::ascendingGroupMix);
  562     }
  563     else if (sort_func == "descendingGroup")
  564     {
  565         rpanel->setSortFunc(FileList::descendingGroup);
  566     }
  567     else if (sort_func == "descendingGroupMix")
  568     {
  569         rpanel->setSortFunc(FileList::descendingGroupMix);
  570     }
  571     else if (sort_func == "ascendingPerm")
  572     {
  573         rpanel->setSortFunc(FileList::ascendingPerm);
  574     }
  575     else if (sort_func == "ascendingPermMix")
  576     {
  577         rpanel->setSortFunc(FileList::ascendingPermMix);
  578     }
  579     else if (sort_func == "descendingPerm")
  580     {
  581         rpanel->setSortFunc(FileList::descendingPerm);
  582     }
  583     else if (sort_func == "descendingPermMix")
  584     {
  585         rpanel->setSortFunc(FileList::descendingPermMix);
  586     }
  587     ignore_case = getApp()->reg().readUnsignedEntry("RIGHT PANEL", "ignore_case", 1);
  588     rpanel->setIgnoreCase(ignore_case);
  589     dirs_first = getApp()->reg().readUnsignedEntry("RIGHT PANEL", "dirs_first", 1);
  590     rpanel->setDirsFirst(dirs_first);
  591 
  592     FXButton* btn = NULL;
  593     FXHotKey  hotkey;
  594     FXString  key;
  595 
  596     // General toolbar
  597     key = getApp()->reg().readStringEntry("KEYBINDINGS", "go_back", "Ctrl-Backspace");
  598     btn = new FXButton(generaltoolbar, TAB+_("Go to previous folder")+PARS(key), dirbackicon, this, XFileExplorer::ID_DIR_BACK, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  599     hotkey = _parseAccel(key);
  600     btn->addHotKey(hotkey);
  601 
  602     btnbackhist = new FXArrowButton(generaltoolbar, this, XFileExplorer::ID_DIR_BACK_HIST, LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_DOWN|ARROW_TOOLBAR);
  603 
  604     key = getApp()->reg().readStringEntry("KEYBINDINGS", "go_forward", "Shift-Backspace");
  605     btn = new FXButton(generaltoolbar, TAB+_("Go to next folder")+PARS(key), dirforwardicon, this, XFileExplorer::ID_DIR_FORWARD, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  606     hotkey = _parseAccel(key);
  607     btn->addHotKey(hotkey);
  608 
  609     btnforwardhist = new FXArrowButton(generaltoolbar, this, XFileExplorer::ID_DIR_FORWARD_HIST, LAYOUT_FILL_Y|FRAME_RAISED|FRAME_THICK|ARROW_DOWN|ARROW_TOOLBAR);
  610 
  611     key = getApp()->reg().readStringEntry("KEYBINDINGS", "go_up", "Backspace");
  612     btn = new FXButton(generaltoolbar, TAB+_("Go to parent folder")+PARS(key), dirupicon, this, XFileExplorer::ID_DIR_UP, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  613     hotkey = _parseAccel(key);
  614     btn->addHotKey(hotkey);
  615 
  616     toolbarSeparator(generaltoolbar);
  617 
  618     key = getApp()->reg().readStringEntry("KEYBINDINGS", "go_home", "Ctrl-H");
  619     new FXButton(generaltoolbar, TAB+_("Go to home folder")+PARS(key), homeicon, lpanel, FilePanel::ID_GO_HOME, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  620 
  621     key = getApp()->reg().readStringEntry("KEYBINDINGS", "refresh", "Ctrl-R");
  622     new FXButton(generaltoolbar, TAB+_("Refresh panels")+PARS(key), reloadicon, this, XFileExplorer::ID_REFRESH, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  623 
  624     toolbarSeparator(generaltoolbar);
  625 
  626     key = getApp()->reg().readStringEntry("KEYBINDINGS", "new_file", "Ctrl-N");
  627     new FXButton(generaltoolbar, TAB+_("Create new file")+PARS(key), newfileicon, lpanel, FilePanel::ID_NEW_FILE, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  628 
  629     key = getApp()->reg().readStringEntry("KEYBINDINGS", "new_folder", "F7");
  630     new FXButton(generaltoolbar, TAB+_("Create new folder")+PARS(key), newfoldericon, lpanel, FilePanel::ID_NEW_DIR, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  631 
  632     key = getApp()->reg().readStringEntry("KEYBINDINGS", "new_symlink", "Ctrl-J");
  633     new FXButton(generaltoolbar, TAB+_("Create new symlink")+PARS(key), newlinkicon, lpanel, FilePanel::ID_NEW_SYMLINK, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  634 
  635     toolbarSeparator(generaltoolbar);
  636 
  637     key = getApp()->reg().readStringEntry("KEYBINDINGS", "copy", "Ctrl-C");
  638     new FXButton(generaltoolbar, TAB+_("Copy selected files to clipboard")+PARS(key), copy_clpicon, this, XFileExplorer::ID_FILE_COPY, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT);
  639 
  640     // Shift + copy key binding can be used to add files to the copy clipboard
  641     // but this feature is disabled if the key binding already uses the Shift key
  642     if (key.lower().find("shift") < 0)
  643     {
  644         key = "Shift-" + key;
  645         hotkey = _parseAccel(key);
  646         getAccelTable()->addAccel(hotkey, this, FXSEL(SEL_COMMAND, XFileExplorer::ID_FILE_ADDCOPY));
  647     }
  648 
  649     // Shift + cut key binding can be used to add files to the cut clipboard
  650     // but this feature is disabled if the key binding already uses the Shift key
  651     key = getApp()->reg().readStringEntry("KEYBINDINGS", "cut", "Ctrl-X");
  652     new FXButton(generaltoolbar, TAB+_("Cut selected files to clipboard")+PARS(key), cut_clpicon, this, XFileExplorer::ID_FILE_CUT, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT);
  653 
  654     if (key.lower().find("shift") < 0)
  655     {
  656         key = "Shift-" + key;
  657         hotkey = _parseAccel(key);
  658         getAccelTable()->addAccel(hotkey, this, FXSEL(SEL_COMMAND, XFileExplorer::ID_FILE_ADDCUT));
  659     }
  660 
  661     key = getApp()->reg().readStringEntry("KEYBINDINGS", "paste", "Ctrl-V");
  662     new FXButton(generaltoolbar, TAB+_("Paste from clipboard")+PARS(key), paste_clpicon, this, XFileExplorer::ID_FILE_PASTE, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT);
  663 
  664     key = getApp()->reg().readStringEntry("KEYBINDINGS", "properties", "F9");
  665     new FXButton(generaltoolbar, TAB+_("Show properties of selected files")+PARS(key), attribicon, this, XFileExplorer::ID_FILE_PROPERTIES, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT);
  666 
  667     toolbarSeparator(generaltoolbar);
  668 
  669     key = getApp()->reg().readStringEntry("KEYBINDINGS", "move_to_trash", "Del");
  670     new FXButton(generaltoolbar, TAB+_("Move selected files to trash can")+PARS(key), filedeleteicon, this, XFileExplorer::ID_FILE_TRASH, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT);
  671 
  672     key = getApp()->reg().readStringEntry("KEYBINDINGS", "restore_from_trash", "Alt-Del");
  673     new FXButton(generaltoolbar, TAB+_("Restore selected files from trash can")+PARS(key), filerestoreicon, this, XFileExplorer::ID_FILE_RESTORE, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT);
  674 
  675     key = getApp()->reg().readStringEntry("KEYBINDINGS", "delete", "Shift-Del");
  676     new FXButton(generaltoolbar, TAB+_("Delete selected files")+PARS(key), filedelete_permicon, this, XFileExplorer::ID_FILE_DELETE, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT);
  677 
  678     key = getApp()->reg().readStringEntry("KEYBINDINGS", "new_window", "F3");
  679     new FXButton(toolstoolbar, TAB+_("Launch Xfe")+PARS(key), minixfeicon, this, XFileExplorer::ID_NEW_WIN, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  680 
  681     key = getApp()->reg().readStringEntry("KEYBINDINGS", "new_root_window", "Shift-F3");
  682     new FXButton(toolstoolbar, TAB+_("Launch Xfe as root")+PARS(key), minixferooticon, this, XFileExplorer::ID_SU, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  683 
  684     key = getApp()->reg().readStringEntry("KEYBINDINGS", "execute_command", "Ctrl-E");
  685     new FXButton(toolstoolbar, TAB+_("Execute command")+PARS(key), runicon, this, XFileExplorer::ID_RUN, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  686 
  687     key = getApp()->reg().readStringEntry("KEYBINDINGS", "terminal", "Ctrl-T");
  688     new FXButton(toolstoolbar, TAB+_("Launch terminal")+PARS(key), shellicon, this, XFileExplorer::ID_XTERM, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  689 
  690     key = getApp()->reg().readStringEntry("KEYBINDINGS", "search", "Ctrl-F");
  691     new FXButton(toolstoolbar, _("Search")+TAB+_("Search files and folders...")+PARS(key), searchicon, this, XFileExplorer::ID_FILE_SEARCH, BUTTON_TOOLBAR|ICON_BEFORE_TEXT|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  692 
  693 #if defined(linux)
  694     toolbarSeparator(toolstoolbar);
  695 
  696     // Mount and unmount buttons
  697     key = getApp()->reg().readStringEntry("KEYBINDINGS", "mount", "Ctrl-M");
  698     btn = new FXButton(toolstoolbar, TAB+_("Mount (Linux only)")+PARS(key), maphosticon, lpanel, FilePanel::ID_MOUNT, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  699     hotkey = _parseAccel(key);
  700     btn->addHotKey(hotkey);
  701 
  702     key = getApp()->reg().readStringEntry("KEYBINDINGS", "unmount", "Ctrl-U");
  703     btn = new FXButton(toolstoolbar, TAB+_("Unmount (Linux only)")+PARS(key), unmaphosticon, lpanel, FilePanel::ID_UMOUNT, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
  704     hotkey = _parseAccel(key);
  705     btn->addHotKey(hotkey);
  706 #endif
  707 
  708     // Panel toolbar
  709 
  710     // Show one panel
  711     key = getApp()->reg().readStringEntry("KEYBINDINGS", "one_panel", "Ctrl-F1");
  712     btn = new FXButton(paneltoolbar, TAB+_("Show one panel")+PARS(key), onepanelicon, this, XFileExplorer::ID_SHOW_ONE_PANEL, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT);
  713     hotkey = _parseAccel(key);
  714     btn->addHotKey(hotkey);
  715 
  716     // Show tree and panel
  717     key = getApp()->reg().readStringEntry("KEYBINDINGS", "tree_panel", "Ctrl-F2");
  718     btn = new FXButton(paneltoolbar, TAB+_("Show tree and panel")+PARS(key), treeonepanelicon, this, XFileExplorer::ID_SHOW_TREE_PANEL, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT);
  719     hotkey = _parseAccel(key);
  720     btn->addHotKey(hotkey);
  721 
  722     // Show two panels
  723     key = getApp()->reg().readStringEntry("KEYBINDINGS", "two_panels", "Ctrl-F3");
  724     btn = new FXButton(paneltoolbar, TAB+_("Show two panels")+PARS(key), twopanelsicon, this, XFileExplorer::ID_SHOW_TWO_PANELS, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT);
  725     hotkey = _parseAccel(key);
  726     btn->addHotKey(hotkey);
  727 
  728     // Show tree and two panels
  729     key = getApp()->reg().readStringEntry("KEYBINDINGS", "tree_two_panels", "Ctrl-F4");
  730     btn = new FXButton(paneltoolbar, TAB+_("Show tree and two panels")+PARS(key), treetwopanelsicon, this, XFileExplorer::ID_SHOW_TREE_TWO_PANELS, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT);
  731     hotkey = _parseAccel(key);
  732     btn->addHotKey(hotkey);
  733 
  734     toolbarSeparator(paneltoolbar);
  735 
  736     // Vertical panels
  737     key = getApp()->reg().readStringEntry("KEYBINDINGS", "vert_panels", "Ctrl-Shift-F1");
  738     btn = new FXButton(paneltoolbar, TAB+_("Vertical panels")+PARS(key), vertpanelsicon, this, XFileExplorer::ID_VERT_PANELS, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT);
  739     hotkey = _parseAccel(key);
  740     btn->addHotKey(hotkey);
  741 
  742     // Horizontal panels
  743     key = getApp()->reg().readStringEntry("KEYBINDINGS", "horz_panels", "Ctrl-Shift-F2");
  744     btn = new FXButton(paneltoolbar, TAB+_("Horizontal panels")+PARS(key), horzpanelsicon, this, XFileExplorer::ID_HORZ_PANELS, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT);
  745     hotkey = _parseAccel(key);
  746     btn->addHotKey(hotkey);
  747 
  748     toolbarSeparator(paneltoolbar);
  749 
  750     // Switch display modes
  751     key = getApp()->reg().readStringEntry("KEYBINDINGS", "big_icons", "F10");
  752     btn = new FXButton(paneltoolbar, TAB+_("Big icon list")+PARS(key), bigiconsicon, lpanel, FilePanel::ID_SHOW_BIG_ICONS, BUTTON_TOOLBAR|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT|FRAME_RAISED);
  753     hotkey = _parseAccel(key);
  754     btn->addHotKey(hotkey);
  755 
  756     key = getApp()->reg().readStringEntry("KEYBINDINGS", "small_icons", "F11");
  757     btn = new FXButton(paneltoolbar, TAB+_("Small icon list")+PARS(key), smalliconsicon, lpanel, FilePanel::ID_SHOW_MINI_ICONS, BUTTON_TOOLBAR|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT|FRAME_RAISED);
  758     hotkey = _parseAccel(key);
  759     btn->addHotKey(hotkey);
  760 
  761     key = getApp()->reg().readStringEntry("KEYBINDINGS", "detailed_file_list", "F12");
  762     btn = new FXButton(paneltoolbar, TAB+_("Detailed file list")+PARS(key), detailsicon, lpanel, FilePanel::ID_SHOW_DETAILS, BUTTON_TOOLBAR|LAYOUT_TOP|LAYOUT_LEFT|ICON_BEFORE_TEXT|FRAME_RAISED);
  763     hotkey = _parseAccel(key);
  764     btn->addHotKey(hotkey);
  765 
  766     // Location bar
  767     new FXLabel(locationbar, _("Location:"));
  768     key = getApp()->reg().readStringEntry("KEYBINDINGS", "clear_location", "Ctrl-L");
  769     btn = new FXButton(locationbar, TAB+_("Clear location")+PARS(key), locationicon, this, ID_CLEAR_LOCATION, BUTTON_TOOLBAR|LAYOUT_CENTER_Y|LAYOUT_LEFT|ICON_BEFORE_TEXT|FRAME_RAISED);
  770     hotkey = _parseAccel(key);
  771     btn->addHotKey(hotkey);
  772     address = new ComboBox(locationbar, LOCATION_BAR_LENGTH, this, ID_GOTO_LOCATION, COMBOBOX_INSERT_LAST|JUSTIFY_LEFT|LAYOUT_CENTER_Y);
  773     address->setNumVisible(5);
  774     new FXButton(locationbar, TAB+_("Go to location"), entericon, this, ID_GOTO_LOCATION, BUTTON_TOOLBAR|LAYOUT_CENTER_Y|LAYOUT_LEFT|ICON_BEFORE_TEXT|FRAME_RAISED);
  775 
  776     // Menus
  777 
  778     // File menu
  779     filemenu = new FXMenuPane(this);
  780     FXMenuCommand* mc = NULL;
  781 
  782     mc = new FXMenuCommand(filemenu, _("New &file..."), newfileicon, lpanel, FilePanel::ID_NEW_FILE);
  783     key = getApp()->reg().readStringEntry("KEYBINDINGS", "new_file", "Ctrl-N");
  784     mc->setAccelText(key);
  785     hotkey = _parseAccel(key);
  786     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  787 
  788     mc = new FXMenuCommand(filemenu, _("New fo&lder..."), newfoldericon, lpanel, FilePanel::ID_NEW_DIR);
  789     key = getApp()->reg().readStringEntry("KEYBINDINGS", "new_folder", "F7");
  790     mc->setAccelText(key);
  791     hotkey = _parseAccel(key);
  792     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  793 
  794     mc = new FXMenuCommand(filemenu, _("New s&ymlink..."), newlinkicon, lpanel, FilePanel::ID_NEW_SYMLINK);
  795     key = getApp()->reg().readStringEntry("KEYBINDINGS", "new_symlink", "Ctrl-J");
  796     mc->setAccelText(key);
  797     hotkey = _parseAccel(key);
  798     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  799 
  800     mc = new FXMenuCommand(filemenu, _("Go &home"), homeicon, lpanel, FilePanel::ID_GO_HOME);
  801     key = getApp()->reg().readStringEntry("KEYBINDINGS", "go_home", "Ctrl-H");
  802     mc->setAccelText(key);
  803     hotkey = _parseAccel(key);
  804     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  805 
  806     mc = new FXMenuCommand(filemenu, _("&Refresh"), reloadicon, this, XFileExplorer::ID_REFRESH);
  807     key = getApp()->reg().readStringEntry("KEYBINDINGS", "refresh", "Ctrl-R");
  808     mc->setAccelText(key);
  809     hotkey = _parseAccel(key);
  810     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  811 
  812     new FXMenuSeparator(filemenu);
  813 
  814     mc = new FXMenuCommand(filemenu, _("&Open"), fileopenicon, lpanel, FilePanel::ID_OPEN);
  815     key = getApp()->reg().readStringEntry("KEYBINDINGS", "open", "Ctrl-O");
  816     mc->setAccelText(key);
  817     hotkey = _parseAccel(key);
  818     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  819 
  820     mc = new FXMenuCommand(filemenu, _("Re&name..."), renameiticon, this, XFileExplorer::ID_FILE_RENAME);
  821     key = getApp()->reg().readStringEntry("KEYBINDINGS", "rename", "F2");
  822     mc->setAccelText(key);
  823     hotkey = _parseAccel(key);
  824     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  825 
  826     mc = new FXMenuCommand(filemenu, _("&Copy to..."), copy_clpicon, this, XFileExplorer::ID_FILE_COPYTO);
  827     key = getApp()->reg().readStringEntry("KEYBINDINGS", "copy_to", "F5");
  828     mc->setAccelText(key);
  829     hotkey = _parseAccel(key);
  830     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  831 
  832     mc = new FXMenuCommand(filemenu, _("&Move to..."), moveiticon, this, XFileExplorer::ID_FILE_MOVETO);
  833     key = getApp()->reg().readStringEntry("KEYBINDINGS", "move_to", "F6");
  834     mc->setAccelText(key);
  835     hotkey = _parseAccel(key);
  836     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  837 
  838     mc = new FXMenuCommand(filemenu, _("&Symlink to..."), minilinkicon, this, XFileExplorer::ID_FILE_SYMLINK);
  839     key = getApp()->reg().readStringEntry("KEYBINDINGS", "symlink_to", "Ctrl-S");
  840     mc->setAccelText(key);
  841     hotkey = _parseAccel(key);
  842     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  843 
  844     mc = new FXMenuCommand(filemenu, _("Mo&ve to trash"), filedeleteicon, this, XFileExplorer::ID_FILE_TRASH);
  845     key = getApp()->reg().readStringEntry("KEYBINDINGS", "move_to_trash", "Del");
  846     mc->setAccelText(key);
  847     hotkey = _parseAccel(key);
  848     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  849 
  850     mc = new FXMenuCommand(filemenu, _("R&estore from trash"), filerestoreicon, this, XFileExplorer::ID_FILE_RESTORE);
  851     key = getApp()->reg().readStringEntry("KEYBINDINGS", "restore_from_trash", "Alt-Del");
  852     mc->setAccelText(key);
  853     hotkey = _parseAccel(key);
  854     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  855 
  856     mc = new FXMenuCommand(filemenu, _("&Delete"), filedelete_permicon, this, XFileExplorer::ID_FILE_DELETE);
  857     key = getApp()->reg().readStringEntry("KEYBINDINGS", "delete", "Shift-Del");
  858     mc->setAccelText(key);
  859     hotkey = _parseAccel(key);
  860     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  861 
  862     mc = new FXMenuCommand(filemenu, _("&Properties"), attribicon, this, XFileExplorer::ID_FILE_PROPERTIES);
  863     key = getApp()->reg().readStringEntry("KEYBINDINGS", "properties", "F9");
  864     mc->setAccelText(key);
  865     hotkey = _parseAccel(key);
  866     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  867 
  868     new FXMenuSeparator(filemenu);
  869 
  870     mc = new FXMenuCommand(filemenu, _("&Quit"), quiticon, this, XFileExplorer::ID_QUIT);
  871     key = getApp()->reg().readStringEntry("KEYBINDINGS", "quit", "Ctrl-Q");
  872     mc->setAccelText(key);
  873     hotkey = _parseAccel(key);
  874     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  875 
  876     filemenutitle = new FXMenuTitle(menubar, _("&File"), NULL, filemenu);
  877 
  878     // Edit menu
  879     editmenu = new FXMenuPane(this);
  880 
  881     mc = new FXMenuCommand(editmenu, _("&Copy"), copy_clpicon, this, XFileExplorer::ID_FILE_COPY);
  882     key = getApp()->reg().readStringEntry("KEYBINDINGS", "copy", "Ctrl-C");
  883     mc->setAccelText(key);
  884     hotkey = _parseAccel(key);
  885     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  886 
  887     mc = new FXMenuCommand(editmenu, _("C&ut"), cut_clpicon, this, XFileExplorer::ID_FILE_CUT);
  888     key = getApp()->reg().readStringEntry("KEYBINDINGS", "cut", "Ctrl-X");
  889     mc->setAccelText(key);
  890     hotkey = _parseAccel(key);
  891     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  892 
  893     mc = new FXMenuCommand(editmenu, _("&Paste"), paste_clpicon, this, XFileExplorer::ID_FILE_PASTE);
  894     key = getApp()->reg().readStringEntry("KEYBINDINGS", "paste", "Ctrl-V");
  895     mc->setAccelText(key);
  896     hotkey = _parseAccel(key);
  897     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  898 
  899     new FXMenuSeparator(editmenu);
  900 
  901     mc = new FXMenuCommand(editmenu, _("&Select all"), selallicon, lpanel, FilePanel::ID_SELECT_ALL);
  902     key = getApp()->reg().readStringEntry("KEYBINDINGS", "select_all", "Ctrl-A");
  903     mc->setAccelText(key);
  904     hotkey = _parseAccel(key);
  905     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  906 
  907     mc = new FXMenuCommand(editmenu, _("&Deselect all"), deselicon, lpanel, FilePanel::ID_DESELECT_ALL);
  908     key = getApp()->reg().readStringEntry("KEYBINDINGS", "deselect_all", "Ctrl-Z");
  909     mc->setAccelText(key);
  910     hotkey = _parseAccel(key);
  911     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  912 
  913     mc = new FXMenuCommand(editmenu, _("&Invert selection"), invselicon, lpanel, FilePanel::ID_SELECT_INVERSE);
  914     key = getApp()->reg().readStringEntry("KEYBINDINGS", "invert_selection", "Ctrl-I");
  915     mc->setAccelText(key);
  916     hotkey = _parseAccel(key);
  917     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  918 
  919     new FXMenuSeparator(editmenu);
  920     new FXMenuCommand(editmenu, _("P&references"), prefsicon, this, XFileExplorer::ID_PREFS);
  921 
  922     editmenutitle = new FXMenuTitle(menubar, _("&Edit"), NULL, editmenu);
  923 
  924     // View menu
  925     viewmenu = new FXMenuPane(this);
  926     new FXMenuCheck(viewmenu, _("&General toolbar"), generaltoolbar, FXWindow::ID_TOGGLESHOWN);
  927     new FXMenuCheck(viewmenu, _("&Tools toolbar"), toolstoolbar, FXWindow::ID_TOGGLESHOWN);
  928     new FXMenuCheck(viewmenu, _("&Panel toolbar"), paneltoolbar, FXWindow::ID_TOGGLESHOWN);
  929     new FXMenuCheck(viewmenu, _("&Location bar"), locationbar, FXWindow::ID_TOGGLESHOWN);
  930     new FXMenuCheck(viewmenu, _("&Status bar"), this, XFileExplorer::ID_TOGGLE_STATUS);
  931 
  932     new FXMenuSeparator(viewmenu);
  933 
  934     mc = new FXMenuRadio(viewmenu, _("&One panel"), this, XFileExplorer::ID_SHOW_ONE_PANEL);
  935     key = getApp()->reg().readStringEntry("KEYBINDINGS", "one_panel", "Ctrl-F1");
  936     mc->setAccelText(key);
  937 
  938     mc = new FXMenuRadio(viewmenu, _("T&ree and panel"), this, XFileExplorer::ID_SHOW_TREE_PANEL);
  939     key = getApp()->reg().readStringEntry("KEYBINDINGS", "tree_panel", "Ctrl-F2");
  940     mc->setAccelText(key);
  941 
  942     mc = new FXMenuRadio(viewmenu, _("Two &panels"), this, XFileExplorer::ID_SHOW_TWO_PANELS);
  943     key = getApp()->reg().readStringEntry("KEYBINDINGS", "two_panels", "Ctrl-F3");
  944     mc->setAccelText(key);
  945 
  946     mc = new FXMenuRadio(viewmenu, _("Tr&ee and two panels"), this, XFileExplorer::ID_SHOW_TREE_TWO_PANELS);
  947     key = getApp()->reg().readStringEntry("KEYBINDINGS", "tree_two_panels", "Ctrl-F4");
  948     mc->setAccelText(key);
  949 
  950     new FXMenuSeparator(viewmenu);
  951 
  952     mc = new FXMenuRadio(viewmenu, _("&Vertical panels"), this, XFileExplorer::ID_VERT_PANELS);
  953     key = getApp()->reg().readStringEntry("KEYBINDINGS", "vert_panels", "Ctrl-Shift-F1");
  954     mc->setAccelText(key);
  955 
  956     mc = new FXMenuRadio(viewmenu, _("&Horizontal panels"), this, XFileExplorer::ID_HORZ_PANELS);
  957     key = getApp()->reg().readStringEntry("KEYBINDINGS", "horz_panels", "Ctrl-Shift-F2");
  958     mc->setAccelText(key);
  959 
  960     viewmenutitle = new FXMenuTitle(menubar, _("&View"), NULL, viewmenu);
  961 
  962     // Bookmarks menu
  963     bookmarksmenu = new FXMenuPane(this);
  964     mc = new FXMenuCommand(bookmarksmenu, _("&Add bookmark"), setbookicon, this, ID_ADD_BOOKMARK);
  965     key = getApp()->reg().readStringEntry("KEYBINDINGS", "add_bookmark", "Ctrl-B");
  966     mc->setAccelText(key);
  967     hotkey = _parseAccel(key);
  968     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
  969 
  970     new FXMenuSeparator(bookmarksmenu);
  971     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_1);
  972     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_2);
  973     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_3);
  974     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_4);
  975     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_5);
  976     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_6);
  977     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_7);
  978     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_8);
  979     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_9);
  980     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_10);
  981     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_11);
  982     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_12);
  983     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_13);
  984     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_14);
  985     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_15);
  986     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_16);
  987     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_17);
  988     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_18);
  989     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_19);
  990     new FXMenuCommand(bookmarksmenu, FXString::null, NULL, bookmarks, Bookmarks::ID_BOOKMARK_20);
  991     new FXMenuSeparator(bookmarksmenu);
  992     new FXMenuCommand(bookmarksmenu, _("&Clear bookmarks"), clrbookicon, bookmarks, Bookmarks::ID_CLEAR);
  993 
  994     bookmarksmenutitle = new FXMenuTitle(menubar, _("&Bookmarks"), NULL, bookmarksmenu);
  995 
  996     // Left Panel Menu
  997     lpanelmenu = new FXMenuPane(this);
  998     new FXMenuCommand(lpanelmenu, _("&Filter..."), filtericon, lpanel, FilePanel::ID_FILTER);
  999     new FXMenuCheck(lpanelmenu, _("&Hidden files"), lpanel->getList(), FileList::ID_TOGGLE_HIDDEN);
 1000     new FXMenuCheck(lpanelmenu, _("&Thumbnails"), lpanel->getList(), FileList::ID_TOGGLE_THUMBNAILS);
 1001     new FXMenuSeparator(lpanelmenu);
 1002     new FXMenuRadio(lpanelmenu, _("&Big icons"), lpanel->getList(), IconList::ID_SHOW_BIG_ICONS);
 1003     new FXMenuRadio(lpanelmenu, _("&Small icons"), lpanel->getList(), IconList::ID_SHOW_MINI_ICONS);
 1004     new FXMenuRadio(lpanelmenu, _("F&ull file list"), lpanel->getList(), IconList::ID_SHOW_DETAILS);
 1005     new FXMenuSeparator(lpanelmenu);
 1006     new FXMenuRadio(lpanelmenu, _("&Rows"), lpanel->getList(), FileList::ID_ARRANGE_BY_ROWS);
 1007     new FXMenuRadio(lpanelmenu, _("&Columns"), lpanel->getList(), FileList::ID_ARRANGE_BY_COLUMNS);
 1008     new FXMenuCheck(lpanelmenu, _("Autosize"), lpanel->getList(), FileList::ID_AUTOSIZE);
 1009     new FXMenuSeparator(lpanelmenu);
 1010     new FXMenuRadio(lpanelmenu, _("&Name"), lpanel->getList(), FileList::ID_SORT_BY_NAME);
 1011     new FXMenuRadio(lpanelmenu, _("Si&ze"), lpanel->getList(), FileList::ID_SORT_BY_SIZE);
 1012     new FXMenuRadio(lpanelmenu, _("T&ype"), lpanel->getList(), FileList::ID_SORT_BY_TYPE);
 1013     new FXMenuRadio(lpanelmenu, _("E&xtension"), lpanel->getList(), FileList::ID_SORT_BY_EXT);
 1014     new FXMenuRadio(lpanelmenu, _("D&ate"), lpanel->getList(), FileList::ID_SORT_BY_TIME);
 1015     new FXMenuRadio(lpanelmenu, _("Us&er"), lpanel->getList(), FileList::ID_SORT_BY_USER);
 1016     new FXMenuRadio(lpanelmenu, _("Gr&oup"), lpanel->getList(), FileList::ID_SORT_BY_GROUP);
 1017     new FXMenuRadio(lpanelmenu, _("&Permissions"), lpanel->getList(), FileList::ID_SORT_BY_PERM);
 1018     new FXMenuRadio(lpanelmenu, _("Deletion date"), lpanel->getList(), FileList::ID_SORT_BY_DELTIME);
 1019     new FXMenuRadio(lpanelmenu, _("Original path"), lpanel->getList(), FileList::ID_SORT_BY_ORIGPATH);
 1020     new FXMenuSeparator(lpanelmenu);
 1021     new FXMenuCheck(lpanelmenu, _("I&gnore case"), lpanel->getList(), FileList::ID_SORT_CASE);
 1022     new FXMenuCheck(lpanelmenu, _("Fol&ders first"), lpanel->getList(), FileList::ID_DIRS_FIRST);
 1023     new FXMenuCheck(lpanelmenu, _("Re&verse order"), lpanel->getList(), FileList::ID_SORT_REVERSE);
 1024     lpanelmenutitle = new FXMenuTitle(menubar, _("&Left panel"), NULL, lpanelmenu);
 1025 
 1026     // Right Panel Menu
 1027     rpanelmenu = new FXMenuPane(this);
 1028     new FXMenuCommand(rpanelmenu, _("&Filter"), filtericon, rpanel, FilePanel::ID_FILTER);
 1029     new FXMenuCheck(rpanelmenu, _("&Hidden files"), rpanel->getList(), FileList::ID_TOGGLE_HIDDEN);
 1030     new FXMenuCheck(rpanelmenu, _("&Thumbnails"), rpanel->getList(), FileList::ID_TOGGLE_THUMBNAILS);
 1031     new FXMenuSeparator(rpanelmenu);
 1032     new FXMenuRadio(rpanelmenu, _("&Big icons"), rpanel->getList(), IconList::ID_SHOW_BIG_ICONS);
 1033     new FXMenuRadio(rpanelmenu, _("&Small icons"), rpanel->getList(), IconList::ID_SHOW_MINI_ICONS);
 1034     new FXMenuRadio(rpanelmenu, _("F&ull file list"), rpanel->getList(), IconList::ID_SHOW_DETAILS);
 1035     new FXMenuSeparator(rpanelmenu);
 1036     new FXMenuRadio(rpanelmenu, _("&Rows"), rpanel->getList(), FileList::ID_ARRANGE_BY_ROWS);
 1037     new FXMenuRadio(rpanelmenu, _("&Columns"), rpanel->getList(), FileList::ID_ARRANGE_BY_COLUMNS);
 1038     new FXMenuCheck(rpanelmenu, _("Autosize"), rpanel->getList(), FileList::ID_AUTOSIZE);
 1039     new FXMenuSeparator(rpanelmenu);
 1040     new FXMenuRadio(rpanelmenu, _("&Name"), rpanel->getList(), FileList::ID_SORT_BY_NAME);
 1041     new FXMenuRadio(rpanelmenu, _("Si&ze"), rpanel->getList(), FileList::ID_SORT_BY_SIZE);
 1042     new FXMenuRadio(rpanelmenu, _("T&ype"), rpanel->getList(), FileList::ID_SORT_BY_TYPE);
 1043     new FXMenuRadio(rpanelmenu, _("E&xtension"), rpanel->getList(), FileList::ID_SORT_BY_EXT);
 1044     new FXMenuRadio(rpanelmenu, _("D&ate"), rpanel->getList(), FileList::ID_SORT_BY_TIME);
 1045     new FXMenuRadio(rpanelmenu, _("Us&er"), rpanel->getList(), FileList::ID_SORT_BY_USER);
 1046     new FXMenuRadio(rpanelmenu, _("Gr&oup"), rpanel->getList(), FileList::ID_SORT_BY_GROUP);
 1047     new FXMenuRadio(rpanelmenu, _("&Permissions"), rpanel->getList(), FileList::ID_SORT_BY_PERM);
 1048     new FXMenuRadio(rpanelmenu, _("Deletion date"), rpanel->getList(), FileList::ID_SORT_BY_DELTIME);
 1049     new FXMenuRadio(rpanelmenu, _("Original path"), rpanel->getList(), FileList::ID_SORT_BY_ORIGPATH);
 1050     new FXMenuSeparator(rpanelmenu);
 1051     new FXMenuCheck(rpanelmenu, _("I&gnore case"), rpanel->getList(), FileList::ID_SORT_CASE);
 1052     new FXMenuCheck(rpanelmenu, _("&Folders first"), rpanel->getList(), FileList::ID_DIRS_FIRST);
 1053     new FXMenuCheck(rpanelmenu, _("Re&verse order"), rpanel->getList(), FileList::ID_SORT_REVERSE);
 1054     rpanelmenutitle = new FXMenuTitle(menubar, _("&Right panel"), NULL, rpanelmenu);
 1055 
 1056     // Tools menu
 1057     toolsmenu = new FXMenuPane(this);
 1058 
 1059     mc = new FXMenuCommand(toolsmenu, _("New &window"), minixfeicon, this, XFileExplorer::ID_NEW_WIN);
 1060     key = getApp()->reg().readStringEntry("KEYBINDINGS", "new_window", "F3");
 1061     mc->setAccelText(key);
 1062     hotkey = _parseAccel(key);
 1063     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
 1064 
 1065     mc = new FXMenuCommand(toolsmenu, _("New &root window"), minixferooticon, this, XFileExplorer::ID_SU);
 1066     key = getApp()->reg().readStringEntry("KEYBINDINGS", "new_root_window", "Shift-F3");
 1067     mc->setAccelText(key);
 1068     hotkey = _parseAccel(key);
 1069     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
 1070 
 1071     new FXMenuSeparator(toolsmenu);
 1072 
 1073     mc = new FXMenuCommand(toolsmenu, _("E&xecute command..."), runicon, this, ID_RUN);
 1074     key = getApp()->reg().readStringEntry("KEYBINDINGS", "execute_command", "Ctrl-E");
 1075     mc->setAccelText(key);
 1076     hotkey = _parseAccel(key);
 1077     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
 1078 
 1079     mc = new FXMenuCommand(toolsmenu, _("&Terminal"), minishellicon, this, XFileExplorer::ID_XTERM);
 1080     key = getApp()->reg().readStringEntry("KEYBINDINGS", "terminal", "Ctrl-T");
 1081     mc->setAccelText(key);
 1082     hotkey = _parseAccel(key);
 1083     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
 1084 
 1085     mc = new FXMenuCommand(toolsmenu, _("&Synchronize panels"), syncpanelsicon, this, XFileExplorer::ID_SYNCHRONIZE_PANELS);
 1086     key = getApp()->reg().readStringEntry("KEYBINDINGS", "synchronize_panels", "Ctrl-Y");
 1087     mc->setAccelText(key);
 1088     hotkey = _parseAccel(key);
 1089     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
 1090 
 1091     mc = new FXMenuCommand(toolsmenu, _("Sw&itch panels"), switchpanelsicon, this, XFileExplorer::ID_SWITCH_PANELS);
 1092     key = getApp()->reg().readStringEntry("KEYBINDINGS", "switch_panels", "Ctrl-K");
 1093     mc->setAccelText(key);
 1094     hotkey = _parseAccel(key);
 1095     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
 1096 
 1097     mc = new FXMenuCommand(toolsmenu, _("Go to script folder"), gotodiricon, lpanel, FilePanel::ID_GO_SCRIPTDIR);
 1098 
 1099     mc = new FXMenuCommand(toolsmenu, _("&Search files..."), searchicon, this, XFileExplorer::ID_FILE_SEARCH);
 1100     key = getApp()->reg().readStringEntry("KEYBINDINGS", "search", "Ctrl-F");
 1101     mc->setAccelText(key);
 1102     hotkey = _parseAccel(key);
 1103     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
 1104 
 1105 #if defined(linux)
 1106     new FXMenuSeparator(toolsmenu);
 1107 
 1108     mc = new FXMenuCommand(toolsmenu, _("&Mount"), maphosticon, lpanel, FilePanel::ID_MOUNT);
 1109     key = getApp()->reg().readStringEntry("KEYBINDINGS", "mount", "Ctrl-M");
 1110     mc->setAccelText(key);
 1111 
 1112     mc = new FXMenuCommand(toolsmenu, _("&Unmount"), unmaphosticon, lpanel, FilePanel::ID_UMOUNT);
 1113     key = getApp()->reg().readStringEntry("KEYBINDINGS", "unmount", "Ctrl-U");
 1114     mc->setAccelText(key);
 1115 #endif
 1116     toolsmenutitle = new FXMenuTitle(menubar, _("&Tools"), NULL, toolsmenu);
 1117 
 1118     // Trash menu
 1119     trashmenu = new FXMenuPane(this);
 1120 
 1121     mc = new FXMenuCommand(trashmenu, _("&Go to trash"), totrashicon, lpanel, FilePanel::ID_GO_TRASH);
 1122     key = getApp()->reg().readStringEntry("KEYBINDINGS", "go_to_trash", "Ctrl-F8");
 1123     mc->setAccelText(key);
 1124     hotkey = _parseAccel(key);
 1125     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
 1126 
 1127     mc = new FXMenuCommand(trashmenu, _("&Trash size"), filedeleteicon, this, XFileExplorer::ID_TRASH_SIZE);
 1128 
 1129     mc = new FXMenuCommand(trashmenu, _("&Empty trash can"), trash_fullicon, this, XFileExplorer::ID_EMPTY_TRASH);
 1130     key = getApp()->reg().readStringEntry("KEYBINDINGS", "empty_trash_can", "Ctrl-Del");
 1131     mc->setAccelText(key);
 1132     hotkey = _parseAccel(key);
 1133     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
 1134 
 1135 
 1136     trashmenutitle = new FXMenuTitle(menubar, _("T&rash"), NULL, trashmenu);
 1137 
 1138     // Help menu
 1139     helpmenu = new FXMenuPane(this);
 1140 
 1141     mc = new FXMenuCommand(helpmenu, _("&Help"), helpicon, this, ID_HELP);
 1142     key = getApp()->reg().readStringEntry("KEYBINDINGS", "help", "F1");
 1143     mc->setAccelText(key);
 1144     hotkey = _parseAccel(key);
 1145     getAccelTable()->addAccel(hotkey, mc, FXSEL(SEL_COMMAND, FXMenuCommand::ID_ACCEL));
 1146 
 1147     new FXMenuCommand(helpmenu, _("&About X File Explorer"), NULL, this, ID_ABOUT);
 1148     helpmenutitle = new FXMenuTitle(menubar, _("&Help"), NULL, helpmenu);
 1149 
 1150     // Other accelerators
 1151 
 1152     key = getApp()->reg().readStringEntry("KEYBINDINGS", "edit", "F4");
 1153     hotkey = _parseAccel(key);
 1154     getAccelTable()->addAccel(hotkey, lpanel, FXSEL(SEL_COMMAND, FilePanel::ID_EDIT));
 1155 
 1156     key = getApp()->reg().readStringEntry("KEYBINDINGS", "view", "Shift-F4");
 1157     hotkey = _parseAccel(key);
 1158     getAccelTable()->addAccel(hotkey, lpanel, FXSEL(SEL_COMMAND, FilePanel::ID_VIEW));
 1159 
 1160     key = getApp()->reg().readStringEntry("KEYBINDINGS", "compare", "F8");
 1161     hotkey = _parseAccel(key);
 1162     getAccelTable()->addAccel(hotkey, lpanel, FXSEL(SEL_COMMAND, FilePanel::ID_COMPARE));
 1163 
 1164     key = getApp()->reg().readStringEntry("KEYBINDINGS", "hidden_dirs", "Ctrl-F5");
 1165     hotkey = _parseAccel(key);
 1166     getAccelTable()->addAccel(hotkey, dirpanel, FXSEL(SEL_COMMAND, DirPanel::ID_TOGGLE_HIDDEN));
 1167 
 1168     key = getApp()->reg().readStringEntry("KEYBINDINGS", "filter", "Ctrl-D");
 1169     hotkey = _parseAccel(key);
 1170     getAccelTable()->addAccel(hotkey, lpanel, FXSEL(SEL_COMMAND, FilePanel::ID_FILTER_CURRENT));
 1171 
 1172     key = getApp()->reg().readStringEntry("KEYBINDINGS", "hidden_files", "Ctrl-F6");
 1173     hotkey = _parseAccel(key);
 1174     getAccelTable()->addAccel(hotkey, lpanel, FXSEL(SEL_COMMAND, FilePanel::ID_TOGGLE_HIDDEN));
 1175 
 1176     key = getApp()->reg().readStringEntry("KEYBINDINGS", "thumbnails", "Ctrl-F7");
 1177     hotkey = _parseAccel(key);
 1178     getAccelTable()->addAccel(hotkey, lpanel, FXSEL(SEL_COMMAND, FilePanel::ID_TOGGLE_THUMBNAILS));
 1179 
 1180     key = getApp()->reg().readStringEntry("KEYBINDINGS", "close", "Ctrl-W");
 1181     hotkey = _parseAccel(key);
 1182     getAccelTable()->addAccel(hotkey, this, FXSEL(SEL_COMMAND, XFileExplorer::ID_QUIT));
 1183 
 1184     // Escape key
 1185     getAccelTable()->addAccel(KEY_Escape, lpanel, FXSEL(SEL_COMMAND, FilePanel::ID_DESELECT_ALL));
 1186 
 1187     // Make a tool tip
 1188     new FXToolTip(app, 0);
 1189 
 1190     // File operations dialog
 1191     rundialog = NULL;
 1192     prefsdialog = NULL;
 1193     helpwindow = NULL;
 1194     searchwindow = NULL;
 1195 
 1196     // Initial focus is on (left) file panel
 1197     panelfocus = FILEPANEL_FOCUS;
 1198 
 1199     // Trahscan locations
 1200     trashfileslocation = xdgdatahome + PATHSEPSTRING TRASHFILESPATH;
 1201     trashinfolocation = xdgdatahome + PATHSEPSTRING TRASHINFOPATH;
 1202 
 1203     // Start location (we return to the start location after each chdir)
 1204     startlocation = FXSystem::getCurrentDirectory();
 1205 
 1206     // Other initializations
 1207     starticonic = iconic;
 1208     startmaximized = maximized;
 1209     startdir1 = "";
 1210     startdir2 = "";
 1211     startURIs = URIs;
 1212     nbstartfiles = 0;
 1213     stop = false;
 1214 
 1215     // Class variables initializations
 1216     panel_view = 0;
 1217     RunHistSize = 0;
 1218     liststyle = 0;
 1219     twopanels_lpanel_pct = 0.0;
 1220     treepanel_tree_pct = 0.0;
 1221     treetwopanels_tree_pct = 0.0;
 1222     treetwopanels_lpanel_pct = 0.0;
 1223     search_xpos = 0;
 1224     search_ypos = 0;
 1225     search_width = 0;
 1226     search_height = 0;
 1227     winshow = true;
 1228 
 1229     // Read URIs to open on startup
 1230     // Find if startdir1 and startdir2 are specified
 1231     // Get the number of files to open, if any
 1232     for (FXuint n = 0; n < startURIs.size(); n++)
 1233     {
 1234         if (::isDirectory(startURIs[n]))
 1235         {
 1236             if (startdir1 == "")
 1237             {
 1238                 startdir1 = startURIs[n];
 1239                 continue;
 1240             }
 1241             if (startdir2 == "")
 1242             {
 1243                 startdir2 = startURIs[n];
 1244                 continue;
 1245             }
 1246         }
 1247         if (::isFile(startURIs[n]))
 1248         {
 1249             nbstartfiles++;
 1250         }
 1251     }
 1252 
 1253     prevdir = FXString::null;
 1254     prev_width = getWidth();
 1255 }
 1256 
 1257 
 1258 // Save configuration when quitting
 1259 void XFileExplorer::saveConfig()
 1260 {
 1261     // Get autosave flag
 1262     FXbool auto_save_layout = getApp()->reg().readUnsignedEntry("OPTIONS", "auto_save_layout", true);
 1263 
 1264     if (auto_save_layout == true)
 1265     {
 1266         FXString sort_func;
 1267 
 1268         // Dir panel options
 1269         if (dirpanel->getSortFunc() == DirList::ascendingCase)
 1270         {
 1271             sort_func = "ascendingCase";
 1272         }
 1273         else if (dirpanel->getSortFunc() == DirList::descendingCase)
 1274         {
 1275             sort_func = "descendingCase";
 1276         }
 1277         else if (dirpanel->getSortFunc() == DirList::ascending)
 1278         {
 1279             sort_func = "ascending";
 1280         }
 1281         else if (dirpanel->getSortFunc() == DirList::descending)
 1282         {
 1283             sort_func = "descending";
 1284         }
 1285         else
 1286         {
 1287             sort_func = "ascendingCase";
 1288         }
 1289         getApp()->reg().writeStringEntry("DIR PANEL", "sort_func", sort_func.text());
 1290         getApp()->reg().writeUnsignedEntry("DIR PANEL", "hidden_dir", dirpanel->shownHiddenFiles());
 1291 
 1292         // Search panel options
 1293         if (searchwindow)
 1294         {
 1295             // Search dialog properties
 1296             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "search_xpos", (FXuint)searchwindow->getX());
 1297             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "search_ypos", (FXuint)searchwindow->getY());
 1298             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "search_width", (FXuint)searchwindow->getWidth());
 1299             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "search_height", (FXuint)searchwindow->getHeight());
 1300             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "name_size", (FXuint)searchwindow->getHeaderSize(0));
 1301             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "dir_size", (FXuint)searchwindow->getHeaderSize(1));
 1302             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "size_size", (FXuint)searchwindow->getHeaderSize(2));
 1303             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "type_size", (FXuint)searchwindow->getHeaderSize(3));
 1304             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "ext_size", (FXuint)searchwindow->getHeaderSize(4));
 1305             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "modd_size", (FXuint)searchwindow->getHeaderSize(5));
 1306             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "user_size", (FXuint)searchwindow->getHeaderSize(6));
 1307             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "grou_size", (FXuint)searchwindow->getHeaderSize(7));
 1308             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "attr_size", (FXuint)searchwindow->getHeaderSize(8));
 1309             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "showthumbnails", (FXuint)searchwindow->shownThumbnails());
 1310             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "find_ignorecase", (FXuint)searchwindow->getFindIgnoreCase());
 1311             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "find_hidden", (FXuint)searchwindow->getFindHidden());
 1312             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "grep_ignorecase", (FXuint)searchwindow->getGrepIgnoreCase());
 1313             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "moreoptions", (FXuint)searchwindow->shownMoreOptions());
 1314             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "liststyle", (FXuint)searchwindow->getListStyle());
 1315             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "dirs_first", (FXuint)searchwindow->getDirsFirst());
 1316             getApp()->reg().writeUnsignedEntry("SEARCH PANEL", "ignore_case", (FXuint)searchwindow->getIgnoreCase());
 1317 
 1318             // Get and write sort function for search window
 1319             if (searchwindow->getSortFunc() == FileList::ascendingCase)
 1320             {
 1321                 sort_func = "ascendingCase";
 1322             }
 1323             else if (searchwindow->getSortFunc() == FileList::ascendingCaseMix)
 1324             {
 1325                 sort_func = "ascendingCaseMix";
 1326             }
 1327             else if (searchwindow->getSortFunc() == FileList::descendingCase)
 1328             {
 1329                 sort_func = "descendingCase";
 1330             }
 1331             else if (searchwindow->getSortFunc() == FileList::descendingCaseMix)
 1332             {
 1333                 sort_func = "descendingCaseMix";
 1334             }
 1335             else if (searchwindow->getSortFunc() == FileList::ascending)
 1336             {
 1337                 sort_func = "ascending";
 1338             }
 1339             else if (searchwindow->getSortFunc() == FileList::ascendingMix)
 1340             {
 1341                 sort_func = "ascendingMix";
 1342             }
 1343             else if (searchwindow->getSortFunc() == FileList::descending)
 1344             {
 1345                 sort_func = "descending";
 1346             }
 1347             else if (searchwindow->getSortFunc() == FileList::descendingMix)
 1348             {
 1349                 sort_func = "descendingMix";
 1350             }
 1351             else if (searchwindow->getSortFunc() == FileList::ascendingDirCase)
 1352             {
 1353                 sort_func = "ascendingDirCase";
 1354             }
 1355             else if (searchwindow->getSortFunc() == FileList::ascendingDirCaseMix)
 1356             {
 1357                 sort_func = "ascendingDirCaseMix";
 1358             }
 1359             else if (searchwindow->getSortFunc() == FileList::descendingDirCase)
 1360             {
 1361                 sort_func = "descendingDirCase";
 1362             }
 1363             else if (searchwindow->getSortFunc() == FileList::descendingDirCaseMix)
 1364             {
 1365                 sort_func = "descendingDirCaseMix";
 1366             }
 1367             else if (searchwindow->getSortFunc() == FileList::ascendingDir)
 1368             {
 1369                 sort_func = "ascendingDir";
 1370             }
 1371             else if (searchwindow->getSortFunc() == FileList::ascendingDirMix)
 1372             {
 1373                 sort_func = "ascendingDirMix";
 1374             }
 1375             else if (searchwindow->getSortFunc() == FileList::descendingDir)
 1376             {
 1377                 sort_func = "descendingDir";
 1378             }
 1379             else if (searchwindow->getSortFunc() == FileList::descendingDirMix)
 1380             {
 1381                 sort_func = "descendingDirMix";
 1382             }
 1383             else if (searchwindow->getSortFunc() == FileList::ascendingSize)
 1384             {
 1385                 sort_func = "ascendingSize";
 1386             }
 1387             else if (searchwindow->getSortFunc() == FileList::ascendingSizeMix)
 1388             {
 1389                 sort_func = "ascendingSizeMix";
 1390             }
 1391             else if (searchwindow->getSortFunc() == FileList::descendingSize)
 1392             {
 1393                 sort_func = "descendingSize";
 1394             }
 1395             else if (searchwindow->getSortFunc() == FileList::descendingSizeMix)
 1396             {
 1397                 sort_func = "descendingSizeMix";
 1398             }
 1399             else if (searchwindow->getSortFunc() == FileList::ascendingType)
 1400             {
 1401                 sort_func = "ascendingType";
 1402             }
 1403             else if (searchwindow->getSortFunc() == FileList::ascendingTypeMix)
 1404             {
 1405                 sort_func = "ascendingTypeMix";
 1406             }
 1407             else if (searchwindow->getSortFunc() == FileList::descendingType)
 1408             {
 1409                 sort_func = "descendingType";
 1410             }
 1411             else if (searchwindow->getSortFunc() == FileList::descendingTypeMix)
 1412             {
 1413                 sort_func = "descendingTypeMix";
 1414             }
 1415             else if (searchwindow->getSortFunc() == FileList::ascendingExt)
 1416             {
 1417                 sort_func = "ascendingExt";
 1418             }
 1419             else if (searchwindow->getSortFunc() == FileList::ascendingExtMix)
 1420             {
 1421                 sort_func = "ascendingExtMix";
 1422             }
 1423             else if (searchwindow->getSortFunc() == FileList::descendingExt)
 1424             {
 1425                 sort_func = "descendingExt";
 1426             }
 1427             else if (searchwindow->getSortFunc() == FileList::descendingExtMix)
 1428             {
 1429                 sort_func = "descendingExtMix";
 1430             }
 1431             else if (searchwindow->getSortFunc() == FileList::ascendingTime)
 1432             {
 1433                 sort_func = "ascendingTime";
 1434             }
 1435             else if (searchwindow->getSortFunc() == FileList::ascendingTimeMix)
 1436             {
 1437                 sort_func = "ascendingTimeMix";
 1438             }
 1439             else if (searchwindow->getSortFunc() == FileList::descendingTime)
 1440             {
 1441                 sort_func = "descendingTime";
 1442             }
 1443             else if (searchwindow->getSortFunc() == FileList::descendingTimeMix)
 1444             {
 1445                 sort_func = "descendingTimeMix";
 1446             }
 1447             else if (searchwindow->getSortFunc() == FileList::ascendingUser)
 1448             {
 1449                 sort_func = "ascendingUser";
 1450             }
 1451             else if (searchwindow->getSortFunc() == FileList::ascendingUserMix)
 1452             {
 1453                 sort_func = "ascendingUserMix";
 1454             }
 1455             else if (searchwindow->getSortFunc() == FileList::descendingUser)
 1456             {
 1457                 sort_func = "descendingUser";
 1458             }
 1459             else if (searchwindow->getSortFunc() == FileList::descendingUserMix)
 1460             {
 1461                 sort_func = "descendingUserMix";
 1462             }
 1463             else if (searchwindow->getSortFunc() == FileList::ascendingGroup)
 1464             {
 1465                 sort_func = "ascendingGroup";
 1466             }
 1467             else if (searchwindow->getSortFunc() == FileList::ascendingGroupMix)
 1468             {
 1469                 sort_func = "ascendingGroupMix";
 1470             }
 1471             else if (searchwindow->getSortFunc() == FileList::descendingGroup)
 1472             {
 1473                 sort_func = "descendingGroup";
 1474             }
 1475             else if (searchwindow->getSortFunc() == FileList::descendingGroupMix)
 1476             {
 1477                 sort_func = "descendingGroupMix";
 1478             }
 1479             else if (searchwindow->getSortFunc() == FileList::ascendingPerm)
 1480             {
 1481                 sort_func = "ascendingPerm";
 1482             }
 1483             else if (searchwindow->getSortFunc() == FileList::ascendingPermMix)
 1484             {
 1485                 sort_func = "ascendingPermMix";
 1486             }
 1487             else if (searchwindow->getSortFunc() == FileList::descendingPerm)
 1488             {
 1489                 sort_func = "descendingPerm";
 1490             }
 1491             else if (searchwindow->getSortFunc() == FileList::descendingPermMix)
 1492             {
 1493                 sort_func = "descendingPermMix";
 1494             }
 1495             else
 1496             {
 1497                 sort_func = "ascendingCase";
 1498             }
 1499             getApp()->reg().writeStringEntry("SEARCH PANEL", "sort_func", sort_func.text());
 1500         }
 1501 
 1502         // Left panel options
 1503         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "name_size", lpanel->getHeaderSize(0));
 1504         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "size_size", lpanel->getHeaderSize(1));
 1505         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "type_size", lpanel->getHeaderSize(2));
 1506         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "ext_size", lpanel->getHeaderSize(3));
 1507         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "modd_size", lpanel->getHeaderSize(4));
 1508         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "user_size", lpanel->getHeaderSize(5));
 1509         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "grou_size", lpanel->getHeaderSize(6));
 1510         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "attr_size", lpanel->getHeaderSize(7));
 1511         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "deldate_size", lpanel->getHeaderSize(8));
 1512         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "origpath_size", lpanel->getHeaderSize(9));
 1513         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "liststyle", lpanel->getListStyle());
 1514         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "hiddenfiles", lpanel->shownHiddenFiles());
 1515         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "showthumbnails", lpanel->shownThumbnails());
 1516 
 1517         // Get and write sort function for left panel
 1518         if (lpanel->getSortFunc() == FileList::ascendingCase)
 1519         {
 1520             sort_func = "ascendingCase";
 1521         }
 1522         else if (lpanel->getSortFunc() == FileList::ascendingCaseMix)
 1523         {
 1524             sort_func = "ascendingCaseMix";
 1525         }
 1526         else if (lpanel->getSortFunc() == FileList::descendingCase)
 1527         {
 1528             sort_func = "descendingCase";
 1529         }
 1530         else if (lpanel->getSortFunc() == FileList::descendingCaseMix)
 1531         {
 1532             sort_func = "descendingCaseMix";
 1533         }
 1534         else if (lpanel->getSortFunc() == FileList::ascending)
 1535         {
 1536             sort_func = "ascending";
 1537         }
 1538         else if (lpanel->getSortFunc() == FileList::ascendingMix)
 1539         {
 1540             sort_func = "ascendingMix";
 1541         }
 1542         else if (lpanel->getSortFunc() == FileList::descending)
 1543         {
 1544             sort_func = "descending";
 1545         }
 1546         else if (lpanel->getSortFunc() == FileList::descendingMix)
 1547         {
 1548             sort_func = "descendingMix";
 1549         }
 1550         else if (lpanel->getSortFunc() == FileList::ascendingSize)
 1551         {
 1552             sort_func = "ascendingSize";
 1553         }
 1554         else if (lpanel->getSortFunc() == FileList::ascendingSizeMix)
 1555         {
 1556             sort_func = "ascendingSizeMix";
 1557         }
 1558         else if (lpanel->getSortFunc() == FileList::descendingSize)
 1559         {
 1560             sort_func = "descendingSize";
 1561         }
 1562         else if (lpanel->getSortFunc() == FileList::descendingSizeMix)
 1563         {
 1564             sort_func = "descendingSizeMix";
 1565         }
 1566         else if (lpanel->getSortFunc() == FileList::ascendingType)
 1567         {
 1568             sort_func = "ascendingType";
 1569         }
 1570         else if (lpanel->getSortFunc() == FileList::ascendingTypeMix)
 1571         {
 1572             sort_func = "ascendingTypeMix";
 1573         }
 1574         else if (lpanel->getSortFunc() == FileList::descendingType)
 1575         {
 1576             sort_func = "descendingType";
 1577         }
 1578         else if (lpanel->getSortFunc() == FileList::descendingTypeMix)
 1579         {
 1580             sort_func = "descendingTypeMix";
 1581         }
 1582         else if (lpanel->getSortFunc() == FileList::ascendingExt)
 1583         {
 1584             sort_func = "ascendingExt";
 1585         }
 1586         else if (lpanel->getSortFunc() == FileList::ascendingExtMix)
 1587         {
 1588             sort_func = "ascendingExtMix";
 1589         }
 1590         else if (lpanel->getSortFunc() == FileList::descendingExt)
 1591         {
 1592             sort_func = "descendingExt";
 1593         }
 1594         else if (lpanel->getSortFunc() == FileList::descendingExtMix)
 1595         {
 1596             sort_func = "descendingExtMix";
 1597         }
 1598         else if (lpanel->getSortFunc() == FileList::ascendingTime)
 1599         {
 1600             sort_func = "ascendingTime";
 1601         }
 1602         else if (lpanel->getSortFunc() == FileList::ascendingTimeMix)
 1603         {
 1604             sort_func = "ascendingTimeMix";
 1605         }
 1606         else if (lpanel->getSortFunc() == FileList::descendingTime)
 1607         {
 1608             sort_func = "descendingTime";
 1609         }
 1610         else if (lpanel->getSortFunc() == FileList::descendingTimeMix)
 1611         {
 1612             sort_func = "descendingTimeMix";
 1613         }
 1614         else if (lpanel->getSortFunc() == FileList::ascendingUser)
 1615         {
 1616             sort_func = "ascendingUser";
 1617         }
 1618         else if (lpanel->getSortFunc() == FileList::ascendingUserMix)
 1619         {
 1620             sort_func = "ascendingUserMix";
 1621         }
 1622         else if (lpanel->getSortFunc() == FileList::descendingUser)
 1623         {
 1624             sort_func = "descendingUser";
 1625         }
 1626         else if (lpanel->getSortFunc() == FileList::descendingUserMix)
 1627         {
 1628             sort_func = "descendingUserMix";
 1629         }
 1630         else if (lpanel->getSortFunc() == FileList::ascendingGroup)
 1631         {
 1632             sort_func = "ascendingGroup";
 1633         }
 1634         else if (lpanel->getSortFunc() == FileList::ascendingGroupMix)
 1635         {
 1636             sort_func = "ascendingGroupMix";
 1637         }
 1638         else if (lpanel->getSortFunc() == FileList::descendingGroup)
 1639         {
 1640             sort_func = "descendingGroup";
 1641         }
 1642         else if (lpanel->getSortFunc() == FileList::descendingGroupMix)
 1643         {
 1644             sort_func = "descendingGroupMix";
 1645         }
 1646         else if (lpanel->getSortFunc() == FileList::ascendingPerm)
 1647         {
 1648             sort_func = "ascendingPerm";
 1649         }
 1650         else if (lpanel->getSortFunc() == FileList::ascendingPermMix)
 1651         {
 1652             sort_func = "ascendingPermMix";
 1653         }
 1654         else if (lpanel->getSortFunc() == FileList::descendingPerm)
 1655         {
 1656             sort_func = "descendingPerm";
 1657         }
 1658         else if (lpanel->getSortFunc() == FileList::descendingPermMix)
 1659         {
 1660             sort_func = "descendingPermMix";
 1661         }
 1662         else
 1663         {
 1664             sort_func = "ascendingCase";
 1665         }
 1666         getApp()->reg().writeStringEntry("LEFT PANEL", "sort_func", sort_func.text());
 1667         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "ignore_case", lpanel->getIgnoreCase());
 1668         getApp()->reg().writeUnsignedEntry("LEFT PANEL", "dirs_first", lpanel->getDirsFirst());
 1669 
 1670         // Right panel options
 1671         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "name_size", rpanel->getHeaderSize(0));
 1672         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "size_size", rpanel->getHeaderSize(1));
 1673         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "type_size", rpanel->getHeaderSize(2));
 1674         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "ext_size", rpanel->getHeaderSize(3));
 1675         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "modd_size", rpanel->getHeaderSize(4));
 1676         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "user_size", rpanel->getHeaderSize(5));
 1677         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "grou_size", rpanel->getHeaderSize(6));
 1678         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "attr_size", rpanel->getHeaderSize(7));
 1679         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "deldate_size", rpanel->getHeaderSize(8));
 1680         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "origpath_size", rpanel->getHeaderSize(9));
 1681         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "liststyle", rpanel->getListStyle());
 1682         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "hiddenfiles", rpanel->shownHiddenFiles());
 1683         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "showthumbnails", rpanel->shownThumbnails());
 1684 
 1685         // Get and write sort function for right panel
 1686         if (rpanel->getSortFunc() == FileList::ascendingCase)
 1687         {
 1688             sort_func = "ascendingCase";
 1689         }
 1690         else if (rpanel->getSortFunc() == FileList::ascendingCaseMix)
 1691         {
 1692             sort_func = "ascendingCaseMix";
 1693         }
 1694         else if (rpanel->getSortFunc() == FileList::descendingCase)
 1695         {
 1696             sort_func = "descendingCase";
 1697         }
 1698         else if (rpanel->getSortFunc() == FileList::descendingCaseMix)
 1699         {
 1700             sort_func = "descendingCaseMix";
 1701         }
 1702         else if (rpanel->getSortFunc() == FileList::ascending)
 1703         {
 1704             sort_func = "ascending";
 1705         }
 1706         else if (rpanel->getSortFunc() == FileList::ascendingMix)
 1707         {
 1708             sort_func = "ascendingMix";
 1709         }
 1710         else if (rpanel->getSortFunc() == FileList::descending)
 1711         {
 1712             sort_func = "descending";
 1713         }
 1714         else if (rpanel->getSortFunc() == FileList::descendingMix)
 1715         {
 1716             sort_func = "descendingMix";
 1717         }
 1718         else if (rpanel->getSortFunc() == FileList::ascendingSize)
 1719         {
 1720             sort_func = "ascendingSize";
 1721         }
 1722         else if (rpanel->getSortFunc() == FileList::ascendingSizeMix)
 1723         {
 1724             sort_func = "ascendingSizeMix";
 1725         }
 1726         else if (rpanel->getSortFunc() == FileList::descendingSize)
 1727         {
 1728             sort_func = "descendingSize";
 1729         }
 1730         else if (rpanel->getSortFunc() == FileList::descendingSizeMix)
 1731         {
 1732             sort_func = "descendingSizeMix";
 1733         }
 1734         else if (rpanel->getSortFunc() == FileList::ascendingType)
 1735         {
 1736             sort_func = "ascendingType";
 1737         }
 1738         else if (rpanel->getSortFunc() == FileList::ascendingTypeMix)
 1739         {
 1740             sort_func = "ascendingTypeMix";
 1741         }
 1742         else if (rpanel->getSortFunc() == FileList::descendingType)
 1743         {
 1744             sort_func = "descendingType";
 1745         }
 1746         else if (rpanel->getSortFunc() == FileList::descendingTypeMix)
 1747         {
 1748             sort_func = "descendingTypeMix";
 1749         }
 1750         else if (rpanel->getSortFunc() == FileList::ascendingExt)
 1751         {
 1752             sort_func = "ascendingExt";
 1753         }
 1754         else if (rpanel->getSortFunc() == FileList::ascendingExtMix)
 1755         {
 1756             sort_func = "ascendingExtMix";
 1757         }
 1758         else if (rpanel->getSortFunc() == FileList::descendingExt)
 1759         {
 1760             sort_func = "descendingExt";
 1761         }
 1762         else if (rpanel->getSortFunc() == FileList::descendingExtMix)
 1763         {
 1764             sort_func = "descendingExtMix";
 1765         }
 1766         else if (rpanel->getSortFunc() == FileList::ascendingTime)
 1767         {
 1768             sort_func = "ascendingTime";
 1769         }
 1770         else if (rpanel->getSortFunc() == FileList::ascendingTimeMix)
 1771         {
 1772             sort_func = "ascendingTimeMix";
 1773         }
 1774         else if (rpanel->getSortFunc() == FileList::descendingTime)
 1775         {
 1776             sort_func = "descendingTime";
 1777         }
 1778         else if (rpanel->getSortFunc() == FileList::descendingTimeMix)
 1779         {
 1780             sort_func = "descendingTimeMix";
 1781         }
 1782         else if (rpanel->getSortFunc() == FileList::ascendingUser)
 1783         {
 1784             sort_func = "ascendingUser";
 1785         }
 1786         else if (rpanel->getSortFunc() == FileList::ascendingUserMix)
 1787         {
 1788             sort_func = "ascendingUserMix";
 1789         }
 1790         else if (rpanel->getSortFunc() == FileList::descendingUser)
 1791         {
 1792             sort_func = "descendingUser";
 1793         }
 1794         else if (rpanel->getSortFunc() == FileList::descendingUserMix)
 1795         {
 1796             sort_func = "descendingUserMix";
 1797         }
 1798         else if (rpanel->getSortFunc() == FileList::ascendingGroup)
 1799         {
 1800             sort_func = "ascendingGroup";
 1801         }
 1802         else if (rpanel->getSortFunc() == FileList::ascendingGroupMix)
 1803         {
 1804             sort_func = "ascendingGroupMix";
 1805         }
 1806         else if (rpanel->getSortFunc() == FileList::descendingGroup)
 1807         {
 1808             sort_func = "descendingGroup";
 1809         }
 1810         else if (rpanel->getSortFunc() == FileList::descendingGroupMix)
 1811         {
 1812             sort_func = "descendingGroupMix";
 1813         }
 1814         else if (rpanel->getSortFunc() == FileList::ascendingPerm)
 1815         {
 1816             sort_func = "ascendingPerm";
 1817         }
 1818         else if (rpanel->getSortFunc() == FileList::ascendingPermMix)
 1819         {
 1820             sort_func = "ascendingPermMix";
 1821         }
 1822         else if (rpanel->getSortFunc() == FileList::descendingPerm)
 1823         {
 1824             sort_func = "descendingPerm";
 1825         }
 1826         else if (rpanel->getSortFunc() == FileList::descendingPermMix)
 1827         {
 1828             sort_func = "descendingPermMix";
 1829         }
 1830         else
 1831         {
 1832             sort_func = "ascendingCase";
 1833         }
 1834         getApp()->reg().writeStringEntry("RIGHT PANEL", "sort_func", sort_func.text());
 1835         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "ignore_case", rpanel->getIgnoreCase());
 1836         getApp()->reg().writeUnsignedEntry("RIGHT PANEL", "dirs_first", rpanel->getDirsFirst());
 1837 
 1838         // Global options
 1839         getApp()->reg().writeUnsignedEntry("OPTIONS", "width", (FXuint)getWidth());
 1840         getApp()->reg().writeUnsignedEntry("OPTIONS", "height", (FXuint)getHeight());
 1841 
 1842         // Get value of window position flag and position the window
 1843         FXbool save_win_pos = getApp()->reg().readUnsignedEntry("SETTINGS", "save_win_pos", false);
 1844         if (save_win_pos)
 1845         {
 1846             // Account for the Window Manager border size
 1847             XWindowAttributes xwattr;
 1848             if (XGetWindowAttributes((Display*)getApp()->getDisplay(), this->id(), &xwattr))
 1849             {
 1850                 getApp()->reg().writeIntEntry("OPTIONS", "xpos", getX()-xwattr.x);
 1851                 getApp()->reg().writeIntEntry("OPTIONS", "ypos", getY()-xwattr.y);
 1852             }
 1853             else
 1854             {
 1855                 getApp()->reg().writeIntEntry("OPTIONS", "xpos", getX());
 1856                 getApp()->reg().writeIntEntry("OPTIONS", "ypos", getY());
 1857             }
 1858         }
 1859         getApp()->reg().writeUnsignedEntry("OPTIONS", "generaltoolbar", (FXuint)generaltoolbar->shown());
 1860         getApp()->reg().writeUnsignedEntry("OPTIONS", "toolstoolbar", (FXuint)toolstoolbar->shown());
 1861         getApp()->reg().writeUnsignedEntry("OPTIONS", "paneltoolbar", (FXuint)paneltoolbar->shown());
 1862         getApp()->reg().writeUnsignedEntry("OPTIONS", "locationbar", (FXuint)locationbar->shown());
 1863         getApp()->reg().writeUnsignedEntry("OPTIONS", "status", (FXuint)lpanel->statusbarShown());
 1864         getApp()->reg().writeUnsignedEntry("SETTINGS", "file_tooltips", (FXuint)file_tooltips);
 1865         getApp()->reg().writeUnsignedEntry("SETTINGS", "relative_resize", (FXuint)relative_resize);
 1866         getApp()->reg().writeRealEntry("OPTIONS", "treepanel_tree_pct", (int)(treepanel_tree_pct*1000)/1000.0);
 1867         getApp()->reg().writeRealEntry("OPTIONS", "twopanels_lpanel_pct", (int)(twopanels_lpanel_pct*1000)/1000.0);
 1868         getApp()->reg().writeRealEntry("OPTIONS", "treetwopanels_tree_pct", (int)(treetwopanels_tree_pct*1000)/1000.0);
 1869         getApp()->reg().writeRealEntry("OPTIONS", "treetwopanels_lpanel_pct", (int)(treetwopanels_lpanel_pct*1000)/1000.0);
 1870 
 1871         // Panel stacking
 1872         getApp()->reg().writeUnsignedEntry("OPTIONS", "vert_panels", vertpanels);
 1873 
 1874         // Save panel view only if not given from command line
 1875         if (panel_mode == -1)
 1876         {
 1877             getApp()->reg().writeUnsignedEntry("OPTIONS", "panel_view", (FXuint)panel_view);
 1878         }
 1879 
 1880         getApp()->reg().writeUnsignedEntry("SETTINGS", "single_click", single_click);
 1881 
 1882         FXString history = "";
 1883         for (int i = 0; i < RunHistSize; i++)
 1884         {
 1885             history += RunHistory[i];
 1886             history += ":";
 1887         }
 1888         if (RunHistSize)
 1889         {
 1890             getApp()->reg().writeStringEntry("HISTORY", "run", history.text());
 1891         }
 1892 
 1893         history = "";
 1894         for (int i = 0; i < OpenNum; i++)
 1895         {
 1896             history += OpenHistory[i];
 1897             history += ":";
 1898         }
 1899         if (OpenNum)
 1900         {
 1901             getApp()->reg().writeStringEntry("HISTORY", "open", history.text());
 1902         }
 1903 
 1904         history = "";
 1905         for (int i = 0; i < FilterNum; i++)
 1906         {
 1907             history += FilterHistory[i];
 1908             history += ":";
 1909         }
 1910         if (FilterNum)
 1911         {
 1912             getApp()->reg().writeStringEntry("HISTORY", "filter", history.text());
 1913         }
 1914     }
 1915 
 1916     // Last visited directories
 1917     getApp()->reg().writeStringEntry("LEFT PANEL", "lastdir", lpanel->getDirectory().text());
 1918     getApp()->reg().writeStringEntry("RIGHT PANEL", "lastdir", rpanel->getDirectory().text());
 1919 
 1920     getApp()->reg().write();
 1921 }
 1922 
 1923 
 1924 // Make application
 1925 void XFileExplorer::create()
 1926 {
 1927     // Switch to two panels mode if startdir2 was specified
 1928     // and no particular panel mode was selected
 1929     if ((startdir2 != "") && (panel_mode == -1))
 1930     {
 1931         panel_mode = 2;
 1932     }
 1933 
 1934     // Eventually select panel mode from the command line option
 1935     // or revert to last saved panel view
 1936     switch (panel_mode)
 1937     {
 1938     case 0:
 1939         panel_view = TREE_PANEL;
 1940         break;
 1941 
 1942     case 1:
 1943         panel_view = ONE_PANEL;
 1944         break;
 1945 
 1946     case 2:
 1947         panel_view = TWO_PANELS;
 1948         break;
 1949 
 1950     case 3:
 1951         panel_view = TREE_TWO_PANELS;
 1952         break;
 1953 
 1954     default:
 1955         panel_view = getApp()->reg().readUnsignedEntry("OPTIONS", "panel_view", TREE_PANEL);
 1956     }
 1957 
 1958     int width = getApp()->reg().readUnsignedEntry("OPTIONS", "width", DEFAULT_WINDOW_WIDTH);
 1959     int height = getApp()->reg().readUnsignedEntry("OPTIONS", "height", DEFAULT_WINDOW_HEIGHT);
 1960     int save_win_pos = getApp()->reg().readUnsignedEntry("SETTINGS", "save_win_pos", false);
 1961     if (save_win_pos)
 1962     {
 1963         int xpos = getApp()->reg().readIntEntry("OPTIONS", "xpos", DEFAULT_WINDOW_XPOS);
 1964         int ypos = getApp()->reg().readIntEntry("OPTIONS", "ypos", DEFAULT_WINDOW_YPOS);
 1965         position(xpos, ypos, width, height);
 1966     }
 1967     else
 1968     {
 1969         position(getX(), getY(), width, height);
 1970     }
 1971 
 1972     // Search dialog geometry
 1973     search_xpos = getApp()->reg().readUnsignedEntry("SEARCH PANEL", "search_xpos", 200);
 1974     search_ypos = getApp()->reg().readUnsignedEntry("SEARCH PANEL", "search_ypos", 200);
 1975     search_width = getApp()->reg().readUnsignedEntry("SEARCH PANEL", "search_width", 650);
 1976     search_height = getApp()->reg().readUnsignedEntry("SEARCH PANEL", "search_height", 480);
 1977 
 1978     FXMainWindow::create();
 1979 
 1980     twopanels_lpanel_pct = getApp()->reg().readRealEntry("OPTIONS", "twopanels_lpanel_pct", 0.50);
 1981     treepanel_tree_pct = getApp()->reg().readRealEntry("OPTIONS", "treepanel_tree_pct", 0.20);
 1982     treetwopanels_tree_pct = getApp()->reg().readRealEntry("OPTIONS", "treetwopanels_tree_pct", 0.20);
 1983     treetwopanels_lpanel_pct = getApp()->reg().readRealEntry("OPTIONS", "treetwopanels_lpanel_pct", 0.40);
 1984 
 1985     int window_width = getWidth();
 1986     int window_height = getHeight();
 1987 
 1988     switch (panel_view)
 1989     {
 1990     case ONE_PANEL:
 1991         rpanel->hide();
 1992         dirpanel->hide();
 1993         // Handle drag corner
 1994         rpanel->showCorner(false);
 1995         lpanel->showCorner(true);
 1996         // Handle active icon
 1997         lpanel->showActiveIcon(false);
 1998         lpanel->setWidth((int)round(1.0*window_width));
 1999         break;
 2000 
 2001     case TWO_PANELS:
 2002         dirpanel->hide();
 2003         if (vertpanels)
 2004         {
 2005             lpanel->setWidth((int)round(twopanels_lpanel_pct*window_width));
 2006         }
 2007         else
 2008         {
 2009             lpanel->setHeight((int)round(twopanels_lpanel_pct*window_height));
 2010         }
 2011         // Handle drag corner
 2012         rpanel->showCorner(true);
 2013         lpanel->showCorner(false);
 2014         // Handle active icon
 2015         lpanel->showActiveIcon(true);
 2016         break;
 2017 
 2018     case TREE_PANEL:
 2019         rpanel->hide();
 2020         dirpanel->setWidth((int)round(treepanel_tree_pct*window_width));
 2021         lpanel->setWidth((int)round((1.0-treepanel_tree_pct)*window_width));
 2022         // Handle drag corner
 2023         rpanel->showCorner(false);
 2024         lpanel->showCorner(true);
 2025         // Handle active icon
 2026         lpanel->showActiveIcon(true);
 2027         break;
 2028 
 2029     case TREE_TWO_PANELS:
 2030         dirpanel->setWidth((int)round(treetwopanels_tree_pct*window_width));
 2031         if (vertpanels)
 2032         {
 2033             lpanel->setWidth((int)round(treetwopanels_lpanel_pct*window_width));
 2034         }
 2035         else
 2036         {
 2037             lpanel->setHeight((int)round(treetwopanels_lpanel_pct*window_height));
 2038         }
 2039         // Handle drag corner
 2040         rpanel->showCorner(true);
 2041         lpanel->showCorner(false);
 2042         // Handle active icon
 2043         lpanel->showActiveIcon(true);
 2044         break;
 2045     }
 2046 
 2047     if (!getApp()->reg().readUnsignedEntry("OPTIONS", "generaltoolbar", true))
 2048     {
 2049         generaltoolbar->handle(this, FXSEL(SEL_COMMAND, FXWindow::ID_TOGGLESHOWN), NULL);
 2050     }
 2051     if (!getApp()->reg().readUnsignedEntry("OPTIONS", "toolstoolbar", true))
 2052     {
 2053         toolstoolbar->handle(this, FXSEL(SEL_COMMAND, FXWindow::ID_TOGGLESHOWN), NULL);
 2054     }
 2055     if (!getApp()->reg().readUnsignedEntry("OPTIONS", "paneltoolbar", true))
 2056     {
 2057         paneltoolbar->handle(this, FXSEL(SEL_COMMAND, FXWindow::ID_TOGGLESHOWN), NULL);
 2058     }
 2059     if (!getApp()->reg().readUnsignedEntry("OPTIONS", "locationbar", true))
 2060     {
 2061         locationbar->handle(this, FXSEL(SEL_COMMAND, FXWindow::ID_TOGGLESHOWN), NULL);
 2062     }
 2063     if (!getApp()->reg().readUnsignedEntry("OPTIONS", "status", true))
 2064     {
 2065         handle(this, FXSEL(SEL_COMMAND, XFileExplorer::ID_TOGGLE_STATUS), NULL);
 2066     }
 2067     file_tooltips = getApp()->reg().readUnsignedEntry("SETTINGS", "file_tooltips", 1);
 2068     relative_resize = getApp()->reg().readUnsignedEntry("SETTINGS", "relative_resize", 1);
 2069 
 2070     // Wheel scrolling
 2071     int wheellines = getApp()->reg().readUnsignedEntry("SETTINGS", "wheellines", 5);
 2072     getApp()->setWheelLines(wheellines);
 2073 
 2074     // Scrollbar size
 2075     int barsize = getApp()->reg().readUnsignedEntry("SETTINGS", "scrollbarsize", 15);
 2076     getApp()->setScrollBarSize(barsize);
 2077 
 2078     // If there are only files to open, tell Xfe not to show its window
 2079     winshow = true;
 2080     if ((startdir1 == "") && (startdir2 == "") && (nbstartfiles > 0))
 2081     {
 2082         winshow = false;
 2083     }
 2084 
 2085     // Read start directory mode
 2086     int startdirmode = getApp()->reg().readUnsignedEntry("OPTIONS", "startdir_mode", START_HOMEDIR);
 2087 
 2088     // Open left and right panels in starting directories (if specified) or in home / current or last directory
 2089     if (startdir1 == "")
 2090     {
 2091         switch (startdirmode)
 2092         {
 2093         case START_HOMEDIR:
 2094             startdir1 = FXSystem::getHomeDirectory();
 2095             break;
 2096 
 2097         case START_CURRENTDIR:
 2098             startdir1 = FXSystem::getCurrentDirectory();
 2099             break;
 2100 
 2101         case START_LASTDIR:
 2102             startdir1 = getApp()->reg().readStringEntry("LEFT PANEL", "lastdir", ROOTDIR);
 2103             break;
 2104         }
 2105     }
 2106     if (startdir2 == "")
 2107     {
 2108         switch (startdirmode)
 2109         {
 2110         case START_HOMEDIR:
 2111             startdir2 = FXSystem::getHomeDirectory();
 2112             break;
 2113 
 2114         case START_CURRENTDIR:
 2115             startdir2 = FXSystem::getCurrentDirectory();
 2116             break;
 2117 
 2118         case START_LASTDIR:
 2119             startdir2 = getApp()->reg().readStringEntry("RIGHT PANEL", "lastdir", ROOTDIR);
 2120             break;
 2121         }
 2122     }
 2123 
 2124     lpanel->setDirectory(startdir1, true);
 2125     lpanel->setPathLink(startdir1);
 2126     lpanel->setPathText(startdir1);
 2127     rpanel->setDirectory(startdir2, true);
 2128     rpanel->setPathLink(startdir2);
 2129     rpanel->setPathText(startdir2);
 2130     dirpanel->setDirectory(startdir1, true);
 2131 
 2132     // Open file on startup, if any
 2133     if (nbstartfiles > 0)
 2134     {
 2135         openFiles(startURIs);
 2136     }
 2137 
 2138     // Show window
 2139     if (winshow)
 2140     {
 2141         show();
 2142     }
 2143 
 2144     // Set file panels list style
 2145     liststyle = getApp()->reg().readUnsignedEntry("LEFT PANEL", "liststyle", _ICONLIST_DETAILED );
 2146     lpanel->setListStyle(liststyle);
 2147     liststyle = getApp()->reg().readUnsignedEntry("RIGHT PANEL", "liststyle", _ICONLIST_DETAILED );
 2148     rpanel->setListStyle(liststyle);
 2149 
 2150     // Show or hide hidden files listed in panels
 2151     FXbool hiddenfiles = getApp()->reg().readUnsignedEntry("LEFT PANEL", "hiddenfiles", 0);
 2152     lpanel->showHiddenFiles(hiddenfiles);
 2153     hiddenfiles = getApp()->reg().readUnsignedEntry("RIGHT PANEL", "hiddenfiles", 0);
 2154     rpanel->showHiddenFiles(hiddenfiles);
 2155 
 2156     // Show or hide hidden directories listed in dirpanel
 2157     FXbool hidden_dir = getApp()->reg().readUnsignedEntry("DIR PANEL", "hidden_dir", 0);
 2158     dirpanel->showHiddenFiles(hidden_dir);
 2159 
 2160     // History
 2161     FXString history = getApp()->reg().readStringEntry("HISTORY", "run", "");
 2162     int      i;
 2163     FXString histent;
 2164     RunHistSize = 0;
 2165     if (history != "")
 2166     {
 2167         for (i = 0; ; i++)
 2168         {
 2169             histent = history.section(':', i);
 2170             if (streq(histent.text(), ""))
 2171             {
 2172                 break;
 2173             }
 2174             strlcpy(RunHistory[i], histent.text(), histent.length()+1);
 2175         }
 2176         RunHistSize = i;
 2177     }
 2178 
 2179     history = getApp()->reg().readStringEntry("HISTORY", "open", "");
 2180     histent = "";
 2181     OpenNum = 0;
 2182     if (history != "")
 2183     {
 2184         for (i = 0; ; i++)
 2185         {
 2186             histent = history.section(':', i);
 2187             if (streq(histent.text(), ""))
 2188             {
 2189                 break;
 2190             }
 2191             strlcpy(OpenHistory[i], histent.text(), histent.length()+1);
 2192         }
 2193         OpenNum = i;
 2194     }
 2195 
 2196     history = getApp()->reg().readStringEntry("HISTORY", "filter", "");
 2197     histent = "";
 2198     FilterNum = 0;
 2199     if (history != "")
 2200     {
 2201         for (i = 0; ; i++)
 2202         {
 2203             histent = history.section(':', i);
 2204             if (streq(histent.text(), ""))
 2205             {
 2206                 break;
 2207             }
 2208             strlcpy(FilterHistory[i], histent.text(), histent.length()+1);
 2209         }
 2210         FilterNum = i;
 2211     }
 2212 
 2213     getApp()->forceRefresh();
 2214 
 2215     // Running as root?
 2216     FXbool root_warn = getApp()->reg().readUnsignedEntry("OPTIONS", "root_warn", true);
 2217     if ((getuid() == 0) && root_warn)
 2218     {
 2219         MessageBox::information(this, BOX_OK, _("Warning"), _("Running Xfe as root!"));
 2220     }
 2221 
 2222     // Initial focus is always on the left panel
 2223     lpanel->setFocusOnList();
 2224 
 2225 #if defined(linux)
 2226     // Warning message if a mount point is down
 2227     FXbool mount_warn = getApp()->reg().readUnsignedEntry("OPTIONS", "mount_warn", true);
 2228     if (mount_warn)
 2229     {
 2230         int d;
 2231         for (d = updevices->first(); d < updevices->size(); d = updevices->next(d))
 2232         {
 2233             if (streq(updevices->data(d), "down"))
 2234             {
 2235                 MessageBox::warning(this, BOX_OK, _("Warning"), _("Mount point %s is not responding..."), updevices->key(d));
 2236             }
 2237         }
 2238     }
 2239 #endif
 2240 
 2241     // If no Xfe local configuration exists (i.e. at first call or after a purge of the configuration files),
 2242     // copy the global xferc file to the local configuration directory, and read / write the registry
 2243     int      mask;
 2244     FXString configlocation = xdgconfighome + PATHSEPSTRING XFECONFIGPATH;
 2245     FXString configpath = configlocation + PATHSEPSTRING XFECONFIGNAME;
 2246     if (!::exists(configpath))
 2247     {
 2248         // If old configuration path (i.e. ~/.xfe) exists then warn the user about the new configuration scheme
 2249         FXString oldconfigpath = homedir + PATHSEPSTRING ".xfe";
 2250         if (::exists(oldconfigpath))
 2251         {
 2252             // Display warning message
 2253             FXString message;
 2254             message.format(_("Starting from Xfe 1.32, the location of the configuration files has changed to '%s'.\nNote you can manually edit the new configuration files to import your old customizations..."), configlocation.text());
 2255             MessageBox::warning(this, BOX_OK, _("Warning"), "%s", message.text());
 2256         }
 2257 
 2258         // Create ~/.config/xfe directory if it doesn't exist
 2259         if (!::exists(configlocation))
 2260         {
 2261             // Create the ~/.config/xfe directory according to the umask
 2262             mask = umask(0);
 2263             umask(mask);
 2264             errno = 0;
 2265             int ret = mkpath(configlocation.text(), 511 & ~mask);
 2266             int errcode = errno;
 2267             if (ret == -1)
 2268             {
 2269                 if (errcode)
 2270                 {
 2271                     MessageBox::error(this, BOX_OK, _("Error"), _("Can't create Xfe config folder %s: %s"), configlocation.text(), strerror(errcode));
 2272                 }
 2273                 else
 2274                 {
 2275                     MessageBox::error(this, BOX_OK, _("Error"), _("Can't create Xfe config folder %s"), configlocation.text());
 2276                 }
 2277             }
 2278         }
 2279 
 2280         // Copy the global xfrec file (three possible locations) to the local configuration file
 2281         if (::exists("/usr/share/xfe/xferc"))
 2282         {
 2283             FXFile::copy("/usr/share/xfe/xferc", configpath, false);
 2284         }
 2285         else if (::exists("/usr/local/share/xfe/xferc"))
 2286         {
 2287             FXFile::copy("/usr/local/share/xfe/xferc", configpath, false);
 2288         }
 2289         else if (::exists("/opt/local/share/xfe/xferc"))
 2290         {
 2291             FXFile::copy("/opt/local/share/xfe/xferc", configpath, false);
 2292         }
 2293 
 2294         // If nothing is found, display a file dialog to let the user choose the right place
 2295         else
 2296         {
 2297             FileDialog browse(this, _("No global xferc file found! Please select a configuration file..."));
 2298 
 2299             const char* patterns[] =
 2300             {
 2301                 _("XFE configuration file"), "*xferc*", NULL
 2302             };
 2303             browse.setFilename(ROOTDIR);
 2304             browse.setPatternList(patterns);
 2305             if (browse.execute())
 2306             {
 2307                 FXString path = browse.getFilename();
 2308                 FXFile::copy(path, configpath, false);
 2309             }
 2310         }
 2311 
 2312         // Read and write the registry
 2313         getApp()->reg().read();
 2314         getApp()->reg().write();
 2315     }
 2316 
 2317     // Create trash can files directory if it doesn't exist
 2318     if (!::exists(trashfileslocation))
 2319     {
 2320         // Create the trash can files directory according to the umask
 2321         mask = umask(0);
 2322         umask(mask);
 2323         errno = 0;
 2324         int ret = mkpath(trashfileslocation.text(), 511 & ~mask);
 2325         int errcode = errno;
 2326         if (ret == -1)
 2327         {
 2328             if (errcode)
 2329             {
 2330                 MessageBox::error(this, BOX_OK, _("Error"), _("Can't create trash can 'files' folder %s: %s"), trashfileslocation.text(), strerror(errcode));
 2331             }
 2332             else
 2333             {
 2334                 MessageBox::error(this, BOX_OK, _("Error"), _("Can't create trash can 'files' folder %s"), trashfileslocation.text());
 2335             }
 2336         }
 2337     }
 2338 
 2339     // Create trash can info directory if it doesn't exist
 2340     if (!::exists(trashinfolocation))
 2341     {
 2342         // Create the trash can info directory according to the umask
 2343         mask = umask(0);
 2344         umask(mask);
 2345         errno = 0;
 2346         int ret = mkpath(trashinfolocation.text(), 511 & ~mask);
 2347         int errcode = errno;
 2348         if (ret == -1)
 2349         {
 2350             if (errcode)
 2351             {
 2352                 MessageBox::error(this, BOX_OK, _("Error"), _("Can't create trash can 'info' folder %s: %s"), trashinfolocation.text(), strerror(errcode));
 2353             }
 2354             else
 2355             {
 2356                 MessageBox::error(this, BOX_OK, _("Error"), _("Can't create trash can 'info' folder %s"), trashinfolocation.text());
 2357             }
 2358         }
 2359     }
 2360 
 2361     // If necessary, replace the old default view command "xfv" with the new one
 2362     if (getApp()->reg().readUnsignedEntry("OPTIONS", "xfv_replaced", false) == false)
 2363     {
 2364         FXStringDict* strdict = getApp()->reg().find("FILETYPES");
 2365         FileDict*     assoc = new FileDict(getApp());
 2366 
 2367         FXString key, value, newvalue;
 2368         FXString strtmp, open, view, edit, command;
 2369         for (int i = strdict->first(); i < strdict->size(); i = strdict->next(i))
 2370         {
 2371             // Read key and value of each filetype
 2372             key = strdict->key(i);
 2373             value = strdict->data(i);
 2374 
 2375             // Replace the old txtviewer string with the new one
 2376             if (value.contains("xfv"))
 2377             {
 2378                 // Obtain the open, view, edit and command strings
 2379                 strtmp = value.before(';', 1);
 2380                 command = value.after(';', 1);
 2381                 open = strtmp.section(',', 0);
 2382                 view = strtmp.section(',', 1);
 2383                 edit = strtmp.section(',', 2);
 2384 
 2385                 // Replace the view command with the new value
 2386                 value = open + "," + DEFAULT_TXTVIEWER + "," + edit + ";" + command;
 2387                 assoc->replace(key.text(), value.text());
 2388             }
 2389         }
 2390 
 2391         // Wrire registry
 2392         getApp()->reg().write();
 2393         getApp()->reg().writeUnsignedEntry("OPTIONS", "xfv_replaced", true);
 2394     }
 2395 
 2396     // Eventually start iconic or maximized
 2397     if (starticonic)
 2398     {
 2399         minimize();
 2400     }
 2401     if (startmaximized)
 2402     {
 2403         maximize();
 2404     }
 2405 
 2406 #ifdef STARTUP_NOTIFICATION
 2407     startup_completed();
 2408 #endif
 2409 
 2410     // Tell Xfe to stop, if we didn't show its window
 2411     if (!winshow)
 2412     {
 2413         stop = true;
 2414     }
 2415 }
 2416 
 2417 
 2418 // Destructor
 2419 XFileExplorer::~XFileExplorer()
 2420 {
 2421     delete menubar;
 2422     delete locationbar;
 2423     delete address;
 2424     delete filemenu;
 2425     delete toolsmenu;
 2426     delete trashmenu;
 2427     delete editmenu;
 2428     delete bookmarksmenu;
 2429     delete viewmenu;
 2430     delete lpanelmenu;
 2431     delete rpanelmenu;
 2432     delete helpmenu;
 2433     delete filemenutitle;
 2434     delete trashmenutitle;
 2435     delete editmenutitle;
 2436     delete bookmarksmenutitle;
 2437     delete viewmenutitle;
 2438     delete lpanelmenutitle;
 2439     delete rpanelmenutitle;
 2440     delete helpmenutitle;
 2441     delete generaltoolbar;
 2442     delete paneltoolbar;
 2443     delete toolstoolbar;
 2444     delete dirpanel;
 2445     delete lpanel;
 2446     delete rpanel;
 2447     delete bookmarks;
 2448     delete btnbackhist;
 2449     delete btnforwardhist;
 2450     delete rundialog;
 2451     delete prefsdialog;
 2452     delete helpwindow;
 2453     delete searchwindow;
 2454 }
 2455 
 2456 
 2457 // If Tab pressed, cycle through the panels
 2458 long XFileExplorer::onKeyPress(FXObject* sender, FXSelector sel, void* ptr)
 2459 {
 2460     FXEvent* event = (FXEvent*)ptr;
 2461     int      current;
 2462 
 2463     // Tab was pressed : cycle through the panels from left to right
 2464     if (event->code == KEY_Tab)
 2465     {
 2466         if (dirpanel->shown())
 2467         {
 2468             if (dirpanel->isActive())
 2469             {
 2470                 lpanel->setFocusOnList();
 2471                 current = lpanel->getCurrentItem();
 2472                 if (current < 0)
 2473                 {
 2474                     current = 0;
 2475                 }
 2476                 lpanel->setCurrentItem(current);
 2477                 lpanel->selectItem(current);
 2478             }
 2479             else if ((rpanel->shown()) && (lpanel->isActive()))
 2480             {
 2481                 rpanel->setFocusOnList();
 2482                 current = rpanel->getCurrentItem();
 2483                 if (current < 0)
 2484                 {
 2485                     current = 0;
 2486                 }
 2487                 rpanel->setCurrentItem(current);
 2488                 rpanel->selectItem(current);
 2489             }
 2490             else
 2491             {
 2492                 dirpanel->setFocusOnList();
 2493                 current = lpanel->getCurrentItem();
 2494                 if (current < 0)
 2495                 {
 2496                     current = 0;
 2497                 }
 2498                 lpanel->deselectItem(current);
 2499             }
 2500         }
 2501         else if (rpanel->shown())
 2502         {
 2503             if (lpanel->getCurrent() == rpanel)
 2504             {
 2505                 lpanel->setActive();
 2506                 current = lpanel->getCurrentItem();
 2507                 if (current < 0)
 2508                 {
 2509                     current = 0;
 2510                 }
 2511                 lpanel->setCurrentItem(current);
 2512                 lpanel->selectItem(current);
 2513             }
 2514             else
 2515             {
 2516                 rpanel->setActive();
 2517                 current = rpanel->getCurrentItem();
 2518                 if (current < 0)
 2519                 {
 2520                     current = 0;
 2521                 }
 2522                 rpanel->setCurrentItem(current);
 2523                 rpanel->selectItem(current);
 2524             }
 2525         }
 2526         return(1);
 2527     }
 2528 
 2529     // Shift-Tab was pressed : cycle through the panels from right to left
 2530     else if (((event->state&SHIFTMASK) && (event->code == KEY_Tab)) ||
 2531              ((event->state&SHIFTMASK) && (event->code == KEY_ISO_Left_Tab)))
 2532     {
 2533         if (rpanel->shown())
 2534         {
 2535             if (rpanel->isActive())
 2536             {
 2537                 lpanel->setFocusOnList();
 2538                 current = lpanel->getCurrentItem();
 2539                 if (current < 0)
 2540                 {
 2541                     current = 0;
 2542                 }
 2543                 lpanel->setCurrentItem(current);
 2544                 lpanel->selectItem(current);
 2545             }
 2546             else if (dirpanel->shown() && dirpanel->isActive())
 2547             {
 2548                 rpanel->setFocusOnList();
 2549                 current = rpanel->getCurrentItem();
 2550                 if (current < 0)
 2551                 {
 2552                     current = 0;
 2553                 }
 2554                 rpanel->setCurrentItem(current);
 2555                 rpanel->selectItem(current);
 2556             }
 2557             else if (lpanel->isActive())
 2558             {
 2559                 if (dirpanel->shown())
 2560                 {
 2561                     dirpanel->setFocusOnList();
 2562                     current = lpanel->getCurrentItem();
 2563                     if (current < 0)
 2564                     {
 2565                         current = 0;
 2566                     }
 2567                     lpanel->deselectItem(current);
 2568                 }
 2569                 else
 2570                 {
 2571                     rpanel->setFocusOnList();
 2572                     current = rpanel->getCurrentItem();
 2573                     if (current < 0)
 2574                     {
 2575                         current = 0;
 2576                     }
 2577                     rpanel->setCurrentItem(current);
 2578                     rpanel->selectItem(current);
 2579                 }
 2580             }
 2581         }
 2582         else
 2583         {
 2584             if (dirpanel->isActive() && dirpanel->shown())
 2585             {
 2586                 lpanel->setFocusOnList();
 2587                 current = lpanel->getCurrentItem();
 2588                 if (current < 0)
 2589                 {
 2590                     current = 0;
 2591                 }
 2592                 lpanel->setCurrentItem(current);
 2593                 lpanel->selectItem(current);
 2594             }
 2595             else if (dirpanel->shown())
 2596             {
 2597                 dirpanel->setFocusOnList();
 2598                 current = lpanel->getCurrentItem();
 2599                 if (current < 0)
 2600                 {
 2601                     current = 0;
 2602                 }
 2603                 lpanel->deselectItem(current);
 2604             }
 2605         }
 2606 
 2607         return(1);
 2608     }
 2609 
 2610     // Shift-F10 or Menu was pressed : open popup menu
 2611     else if ((event->state&SHIFTMASK && event->code == KEY_F10) || event->code == KEY_Menu)
 2612     {
 2613         lpanel->getCurrent()->handle(sender, FXSEL(SEL_COMMAND, FilePanel::ID_POPUP_MENU), ptr);
 2614         return(1);
 2615     }
 2616 
 2617     // Any other key was pressed : handle the pressed key in the usual way
 2618     else
 2619     {
 2620         if (FXTopWindow::onKeyPress(sender, sel, ptr))
 2621         {
 2622             return(1);
 2623         }
 2624     }
 2625 
 2626     return(0);
 2627 }
 2628 
 2629 
 2630 long XFileExplorer::onKeyRelease(FXObject* sender, FXSelector sel, void* ptr)
 2631 {
 2632     if (FXTopWindow::onKeyRelease(sender, sel, ptr))
 2633     {
 2634         return(1);
 2635     }
 2636 
 2637     return(0);
 2638 }
 2639 
 2640 
 2641 // Harvest the zombies
 2642 long XFileExplorer::onSigHarvest(FXObject*, FXSelector, void*)
 2643 {
 2644     while (waitpid(-1, NULL, WNOHANG) > 0)
 2645     {
 2646     }
 2647     return(1);
 2648 }
 2649 
 2650 
 2651 // Handle quitting
 2652 long XFileExplorer::onQuit(FXObject*, FXSelector, void*)
 2653 {
 2654     saveConfig();
 2655 
 2656     getApp()->exit(EXIT_SUCCESS);
 2657     return(1);
 2658 }
 2659 
 2660 
 2661 // Directory up
 2662 long XFileExplorer::onCmdDirUp(FXObject* sender, FXSelector, void*)
 2663 {
 2664     lpanel->getCurrent()->handle(sender, FXSEL(SEL_COMMAND, FilePanel::ID_DIRECTORY_UP), NULL);
 2665 
 2666     // Set focus on dirpanel or filepanel
 2667     if (panelfocus == DIRPANEL_FOCUS)
 2668     {
 2669         dirpanel->setFocusOnList();
 2670     }
 2671     else
 2672     {
 2673         lpanel->getCurrent()->setFocusOnList();
 2674     }
 2675 
 2676     return(1);
 2677 }
 2678 
 2679 
 2680 // Directory back
 2681 long XFileExplorer::onCmdDirBack(FXObject*, FXSelector, void*)
 2682 {
 2683     StringItem* item;
 2684     FXString    pathname;
 2685     FilePanel*  filepanel = lpanel->getCurrent();
 2686 
 2687     // Get the previous directory
 2688     item = filepanel->backhistGetFirst();
 2689     if (item)
 2690     {
 2691         pathname = filepanel->backhistGetString(item);
 2692     }
 2693 
 2694     // Update the history
 2695     filepanel->backhistRemoveFirstItem();
 2696     filepanel->forwardhistInsertFirstItem(filepanel->getDirectory());
 2697 
 2698     // Go to the previous directory
 2699     filepanel->setDirectory(pathname, false);
 2700     filepanel->updatePath();
 2701     dirpanel->setDirectory(pathname, false);
 2702 
 2703     // Set focus on dirpanel or filepanel
 2704     if (panelfocus == DIRPANEL_FOCUS)
 2705     {
 2706         dirpanel->setFocusOnList();
 2707     }
 2708     else
 2709     {
 2710         filepanel->setFocusOnList();
 2711     }
 2712 
 2713     return(1);
 2714 }
 2715 
 2716 
 2717 // Update directory back
 2718 long XFileExplorer::onUpdDirBack(FXObject* sender, FXSelector, void* ptr)
 2719 {
 2720     FXString   pathname;
 2721     FilePanel* filepanel = lpanel->getCurrent();
 2722 
 2723     // Gray out the button if no item in history
 2724     if (filepanel->backhistGetNumItems() == 0)
 2725     {
 2726         sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
 2727     }
 2728     else
 2729     {
 2730         sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
 2731     }
 2732 
 2733     return(1);
 2734 }
 2735 
 2736 
 2737 // Directory forward
 2738 long XFileExplorer::onCmdDirForward(FXObject*, FXSelector, void*)
 2739 {
 2740     StringItem* item;
 2741     FXString    pathname;
 2742     FilePanel*  filepanel = lpanel->getCurrent();
 2743 
 2744     // Get the next directory
 2745     item = filepanel->forwardhistGetFirst();
 2746     if (item)
 2747     {
 2748         pathname = filepanel->forwardhistGetString(item);
 2749     }
 2750 
 2751     // Update the history
 2752     filepanel->forwardhistRemoveFirstItem();
 2753     filepanel->backhistInsertFirstItem(lpanel->getCurrent()->getDirectory());
 2754 
 2755     // Go to the next directory
 2756     filepanel->setDirectory(pathname, false);
 2757     filepanel->updatePath();
 2758     dirpanel->setDirectory(pathname, true);
 2759 
 2760     // Set focus on dirpanel or filepanel
 2761     if (panelfocus == DIRPANEL_FOCUS)
 2762     {
 2763         dirpanel->setFocusOnList();
 2764     }
 2765     else
 2766     {
 2767         filepanel->setFocusOnList();
 2768     }
 2769 
 2770     return(1);
 2771 }
 2772 
 2773 
 2774 // Update directory forward
 2775 long XFileExplorer::onUpdDirForward(FXObject* sender, FXSelector sel, void* ptr)
 2776 {
 2777     FXString   pathname;
 2778     FilePanel* filepanel = lpanel->getCurrent();
 2779 
 2780     // Gray out the button if no item in history
 2781     if (filepanel->forwardhistGetNumItems() == 0)
 2782     {
 2783         sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
 2784     }
 2785     else
 2786     {
 2787         sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
 2788     }
 2789 
 2790     return(1);
 2791 }
 2792 
 2793 
 2794 // Directory back history
 2795 long XFileExplorer::onCmdDirBackHist(FXObject* sender, FXSelector sel, void* ptr)
 2796 {
 2797     StringItem* item;
 2798     FXString    pathname;
 2799     FilePanel*  filepanel = lpanel->getCurrent();
 2800 
 2801     // Get all string items and display them in a list box
 2802     int num = filepanel->backhistGetNumItems();
 2803 
 2804     if (num > 0)
 2805     {
 2806         FXString* dirs = new FXString[num];
 2807         FXString  strlist = "";
 2808 
 2809         // Get string items
 2810         item = filepanel->backhistGetFirst();
 2811         int nb = 0;
 2812         for (int i = 0; i <= num-1; i++)
 2813         {
 2814             if (item)
 2815             {
 2816                 FXString str = filepanel->backhistGetString(item);
 2817                 FXbool   flag = true;
 2818                 for (int j = 0; j <= nb-1; j++)
 2819                 {
 2820                     if (str == dirs[j])
 2821                     {
 2822                         flag = false;
 2823                         break;
 2824                     }
 2825                 }
 2826                 if (flag)
 2827                 {
 2828                     dirs[nb] = str;
 2829                     strlist = strlist+str+"\n";
 2830                     nb++;
 2831                 }
 2832                 item = filepanel->backhistGetNext(item);
 2833             }
 2834         }
 2835 
 2836         // Display list box
 2837         int pos = DirHistBox::box(btnbackhist, DECOR_NONE, strlist, getX()+40, getY()+60);
 2838 
 2839         // If an item was selected
 2840         if (pos != -1)
 2841         {
 2842             // Update back history
 2843             if (pos == num-1)
 2844             {
 2845                 filepanel->backhistRemoveAllItems();
 2846             }
 2847             else
 2848             {
 2849                 item = filepanel->backhistGetItemAtPos(pos+1);
 2850                 filepanel->backhistRemoveAllItemsBefore(item);
 2851             }
 2852 
 2853             // Update forward history
 2854             filepanel->forwardhistInsertFirstItem(filepanel->getDirectory());
 2855             if (pos > 0)
 2856             {
 2857                 for (int i = 0; i <= pos-1; i++)
 2858                 {
 2859                     filepanel->forwardhistInsertFirstItem(dirs[i]);
 2860                 }
 2861             }
 2862 
 2863             // Go to to the selected directory
 2864             pathname = dirs[pos];
 2865             filepanel->setDirectory(pathname, false);
 2866             filepanel->updatePath();
 2867             dirpanel->setDirectory(pathname, true);
 2868         }
 2869         delete[]dirs;
 2870     }
 2871 
 2872     return(1);
 2873 }
 2874 
 2875 
 2876 // Update directory back
 2877 long XFileExplorer::onUpdDirBackHist(FXObject* sender, FXSelector sel, void* ptr)
 2878 {
 2879     FXString   pathname;
 2880     FilePanel* filepanel = lpanel->getCurrent();
 2881 
 2882     // Gray out the button if no item in history
 2883     if (filepanel->backhistGetNumItems() == 0)
 2884     {
 2885         sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
 2886     }
 2887     else
 2888     {
 2889         sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
 2890     }
 2891 
 2892     return(1);
 2893 }
 2894 
 2895 
 2896 // Directory forward history
 2897 long XFileExplorer::onCmdDirForwardHist(FXObject* sender, FXSelector sel, void* ptr)
 2898 {
 2899     StringItem* item;
 2900     FXString    pathname;
 2901     FilePanel*  filepanel = lpanel->getCurrent();
 2902 
 2903     // Get all string items and display them in a list box
 2904     int num = filepanel->forwardhistGetNumItems();
 2905 
 2906     if (num > 0)
 2907     {
 2908         FXString* dirs = new FXString[num];
 2909         FXString  strlist = "";
 2910 
 2911         // Get string items
 2912         item = filepanel->forwardhistGetFirst();
 2913         int nb = 0;
 2914         for (int i = 0; i <= num-1; i++)
 2915         {
 2916             if (item)
 2917             {
 2918                 FXString str = filepanel->forwardhistGetString(item);
 2919                 FXbool   flag = true;
 2920                 for (int j = 0; j <= nb-1; j++)
 2921                 {
 2922                     if (str == dirs[j])
 2923                     {
 2924                         flag = false;
 2925                         break;
 2926                     }
 2927                 }
 2928                 if (flag)
 2929                 {
 2930                     dirs[nb] = str;
 2931                     strlist = strlist+str+"\n";
 2932                     nb++;
 2933                 }
 2934                 item = filepanel->forwardhistGetNext(item);
 2935             }
 2936         }
 2937 
 2938         // Display list box
 2939         int pos = DirHistBox::box(btnforwardhist, DECOR_NONE, strlist, getX()+85, getY()+60);
 2940 
 2941         // If an item was selected
 2942         if (pos != -1)
 2943         {
 2944             // Update forward history
 2945             if (pos == num-1)
 2946             {
 2947                 filepanel->forwardhistRemoveAllItems();
 2948             }
 2949             else
 2950             {
 2951                 item = filepanel->forwardhistGetItemAtPos(pos+1);
 2952                 filepanel->forwardhistRemoveAllItemsBefore(item);
 2953             }
 2954 
 2955             // Update back history
 2956             filepanel->backhistInsertFirstItem(filepanel->getDirectory());
 2957             if (pos > 0)
 2958             {
 2959                 for (int i = 0; i <= pos-1; i++)
 2960                 {
 2961                     filepanel->backhistInsertFirstItem(dirs[i]);
 2962                 }
 2963             }
 2964 
 2965             // Go to to the selected directory
 2966             pathname = dirs[pos];
 2967             filepanel->setDirectory(pathname, false);
 2968             filepanel->updatePath();
 2969             dirpanel->setDirectory(pathname, true);
 2970         }
 2971         delete[]dirs;
 2972     }
 2973 
 2974     return(1);
 2975 }
 2976 
 2977 
 2978 // Update directory forward
 2979 long XFileExplorer::onUpdDirForwardHist(FXObject* sender, FXSelector sel, void* ptr)
 2980 {
 2981     FXString   pathname;
 2982     FilePanel* filepanel = lpanel->getCurrent();
 2983 
 2984     // Gray out the button if no item in history
 2985     if (filepanel->forwardhistGetNumItems() == 0)
 2986     {
 2987         sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
 2988     }
 2989     else
 2990     {
 2991         sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
 2992     }
 2993 
 2994     return(1);
 2995 }
 2996 
 2997 
 2998 // Handle bookmarks
 2999 long XFileExplorer::onCmdBookmark(FXObject*, FXSelector s, void* p)
 3000 {
 3001     if (FXSELID(s) == ID_ADD_BOOKMARK)
 3002     {
 3003         bookmarks->appendBookmark(lpanel->getCurrent()->getDirectory());
 3004         saveConfig();
 3005     }
 3006 
 3007     // Handle location address fields
 3008     else if (FXSELID(s) == ID_BOOKMARK)
 3009     {
 3010         lpanel->getCurrent()->setDirectory((char*)p);
 3011         lpanel->getCurrent()->updatePath();
 3012         dirpanel->setDirectory((char*)p, true);
 3013         FXString item;
 3014         int      i = 0;
 3015         int      count = address->getNumItems();
 3016         if (!count)
 3017         {
 3018             count++;
 3019             address->insertItem(0, address->getText());
 3020         }
 3021         while (i < count)
 3022         {
 3023             item = address->getItem(i++);
 3024             if (streq((char*)p, (const char*)&item[0]))
 3025             {
 3026                 i--;
 3027                 break;
 3028             }
 3029         }
 3030         if (i == count)
 3031         {
 3032             address->insertItem(0, (char*)p);
 3033         }
 3034 
 3035         // Set focus to the active panel
 3036         lpanel->getCurrent()->setFocusOnList();
 3037     }
 3038     return(1);
 3039 }
 3040 
 3041 
 3042 // Goto location entered into the text field;
 3043 long XFileExplorer::onCmdGotoLocation(FXObject*, FXSelector, void*)
 3044 {
 3045     // Location where we want to go
 3046     FXString location = address->getText();
 3047 
 3048     // In case location is given in URI form, convert it
 3049     location = ::fileFromURI(location);
 3050 
 3051     // Get complete path
 3052     FXString path = FXPath::absolute(lpanel->getCurrent()->getDirectory(), location);
 3053     FXString dir = path;
 3054 
 3055     // Go up to the lowest directory which still exists
 3056     while (!FXPath::isTopDirectory(dir) && !::isDirectory(dir))
 3057     {
 3058         dir = FXPath::upLevel(dir);
 3059     }
 3060 
 3061     // Move to this existing directory
 3062     lpanel->getCurrent()->setDirectory(dir);
 3063     lpanel->getCurrent()->updatePath();
 3064     dirpanel->setDirectory(dir, true);
 3065     address->setText(dir);
 3066 
 3067     return(1);
 3068 }
 3069 
 3070 
 3071 // Clear location bar
 3072 long XFileExplorer::onCmdClearLocation(FXObject*, FXSelector, void*)
 3073 {
 3074     address->setText(FXString::null);
 3075     address->CursorEnd();
 3076     return(1);
 3077 }
 3078 
 3079 
 3080 // Restart the application when required
 3081 long XFileExplorer::onCmdRestart(FXObject*, FXSelector, void*)
 3082 {
 3083     saveConfig();
 3084 
 3085     if (fork() == 0) // Child
 3086     {
 3087         execvp("xfe", args);
 3088     }
 3089     else // Parent
 3090     {
 3091         exit(EXIT_SUCCESS);
 3092     }
 3093     return(1);
 3094 }
 3095 
 3096 
 3097 // Start a new Xfe session
 3098 long XFileExplorer::onCmdNewWindow(FXObject*, FXSelector, void*)
 3099 {
 3100     FXString cmd = "xfe " + homedir + " &";
 3101 
 3102     int ret = system(cmd.text());
 3103 
 3104     if (ret < 0)
 3105     {
 3106         MessageBox::error(this, BOX_OK, _("Error"), _("Can't execute command %s"), cmd.text());
 3107         return(0);
 3108     }
 3109 
 3110     return(1);
 3111 }
 3112 
 3113 
 3114 // Run Terminal
 3115 long XFileExplorer::onCmdXTerm(FXObject*, FXSelector, void*)
 3116 {
 3117     int ret;
 3118 
 3119     getApp()->beginWaitCursor();
 3120     FXString xterm = getApp()->reg().readStringEntry("PROGS", "xterm", "xterm -sb");
 3121 
 3122     ret = chdir(lpanel->getCurrent()->getDirectory().text());
 3123     if (ret < 0)
 3124     {
 3125         int errcode = errno;
 3126         if (errcode)
 3127         {
 3128             MessageBox::error(this, BOX_OK, _("Error"), _("Can't enter folder %s: %s"), lpanel->getCurrent()->getDirectory().text(), strerror(errcode));
 3129         }
 3130         else
 3131         {
 3132             MessageBox::error(this, BOX_OK, _("Error"), _("Can't enter folder %s"), lpanel->getCurrent()->getDirectory().text());
 3133         }
 3134 
 3135         return(0);
 3136     }
 3137 
 3138     FXString cmd = xterm;
 3139     cmd += " &";
 3140 
 3141     ret = system(cmd.text());
 3142     if (ret < 0)
 3143     {
 3144         MessageBox::error(this, BOX_OK, _("Error"), _("Can't execute command %s"), cmd.text());
 3145         return(0);
 3146     }
 3147 
 3148     lpanel->getCurrent()->setFocusOnList();
 3149     ret = chdir(startlocation.text());
 3150     if (ret < 0)
 3151     {
 3152         int errcode = errno;
 3153         if (errcode)
 3154         {
 3155             MessageBox::error(this, BOX_OK, _("Error"), _("Can't enter folder %s: %s"), startlocation.text(), strerror(errcode));
 3156         }
 3157         else
 3158         {
 3159             MessageBox::error(this, BOX_OK, _("Error"), _("Can't enter folder %s"), startlocation.text());
 3160         }
 3161 
 3162         return(0);
 3163     }
 3164 
 3165     getApp()->endWaitCursor();
 3166     return(1);
 3167 }
 3168 
 3169 
 3170 // Help menu
 3171 long XFileExplorer::onCmdHelp(FXObject*, FXSelector, void*)
 3172 {
 3173     // Display help window
 3174     if (helpwindow == NULL)
 3175     {
 3176         helpwindow = new TextWindow(getApp(), _("Help"), 40, 120);
 3177     }
 3178     helpwindow->setIcon(helpicon);
 3179 
 3180     // Set text font
 3181     FXString fontspec;
 3182     fontspec = getApp()->reg().readStringEntry("SETTINGS", "textfont", DEFAULT_TEXT_FONT);
 3183     if (!fontspec.empty())
 3184     {
 3185         FXFont* font = new FXFont(getApp(), fontspec);
 3186         font->create();
 3187         helpwindow->setFont(font);
 3188     }
 3189 
 3190     // NB: The HELP_TEXT macro is defined in help.h
 3191     FXString str = (FXString)"                         "+COPYRIGHT+HELP_TEXT;
 3192     helpwindow->setText(str.text());
 3193     // Non modal window
 3194     helpwindow->create();
 3195     helpwindow->show(PLACEMENT_OWNER);
 3196     lpanel->getCurrent()->setFocusOnList();
 3197     return(1);
 3198 }
 3199 
 3200 
 3201 // About menu
 3202 long XFileExplorer::onCmdAbout(FXObject*, FXSelector, void*)
 3203 {
 3204     FXString msg;
 3205 
 3206     msg.format(_("X File Explorer Version %s"), VERSION);
 3207     FXString copyright = (FXString)"\n\n" + COPYRIGHT + "\n\n" + _("Based on X WinCommander by Maxim Baranov\n");
 3208     FXString translators =
 3209         _ ("\nTranslators\n\
 3210 -------------\n\
 3211 Argentinian Spanish: Bruno Gilberto Luciani\n\
 3212 Brazilian Portuguese: Eduardo R.B.S., Jose Carlos Medeiros,\n\
 3213 Phantom X, Tomas Acauan Schertel\n\
 3214 Bosnian: Samir Ribi, Bajrami Emran, Balagija Jasmina,\n\
 3215 Bilalovi, Omar Cogo Emir\n\
 3216 Catalan: muzzol\n\
 3217 Chinese: Xin Li\n\
 3218 Chinese (Taïwan): Wei-Lun Chao\n\
 3219 Colombian Spanish: Vladimir Támara (Pasos de Jesús)\n\
 3220 Czech: David Vachulka\n\
 3221 Danish: Jonas Bardino, Vidar Jon Bauge\n\
 3222 Dutch: Hans Strijards\n\
 3223 Finnish: Kimmo Siira\n\
 3224 French: Claude Leo Mercier, Roland Baudin\n\
 3225 German: Bastian Kleineidam, Joachim Wiedorn, Tim Benke, Jens Körner\n\
 3226 Greek: Nikos Papadopoulos\n\
 3227 Hungarian: Attila Szervac, Sandor Sipos\n\
 3228 Italian: Claudio Fontana, Giorgio Moscardi\n\
 3229 Japanese: Karl Skewes\n\
 3230 Norwegian: Vidar Jon Bauge\n\
 3231 Polish: Jacek Dziura, Franciszek Janowski\n\
 3232 Portuguese: Miguel Santinho\n\
 3233 Russian: Dimitri Sertolov, Vad Vad\n\
 3234 Spanish: Felix Medrano Sanz, Lucas 'Basurero' Vieites,\n\
 3235 Martin Carr\n\
 3236 Swedish: Anders F. Bjorklund\n\
 3237 Turkish: erkaN\n\
 3238 ");
 3239 
 3240     msg = msg + copyright + translators;
 3241     MessageBox about(this,_("About X File Explorer"),msg.text(),xfeicon,BOX_OK|DECOR_TITLE|DECOR_BORDER,
 3242                      JUSTIFY_CENTER_X|ICON_BEFORE_TEXT|LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_Y);
 3243     about.execute(PLACEMENT_OWNER);
 3244     lpanel->getCurrent()->setFocusOnList();
 3245     return 1;
 3246 }
 3247 
 3248 
 3249 // Handle file association (called by Properties.cpp and FilePanel.cpp)
 3250 long XFileExplorer::onCmdFileAssoc(FXObject*,FXSelector s,void* p)
 3251 {
 3252     char** str=(char**)p;
 3253     char* ext=str[0];
 3254     char* cmd=str[1];
 3255 
 3256     // ext=extension, cmd=associated command
 3257     // replace : to allow immediate association in Xfe
 3258     FileDict* associations=lpanel->getAssociations();
 3259     associations->replace(ext,cmd);
 3260     associations=rpanel->getAssociations();
 3261     associations->replace(ext,cmd);
 3262 
 3263     saveConfig();
 3264 
 3265     return 1;
 3266 }
 3267 
 3268 
 3269 // FilePanel and DirPanel refresh
 3270 long XFileExplorer::onCmdRefresh(FXObject*,FXSelector,void*)
 3271 {
 3272     getApp()->beginWaitCursor();
 3273 
 3274 #if defined(linux)
 3275     dirpanel->forceDevicesRefresh();
 3276 #endif
 3277 
 3278     lpanel->onCmdRefresh(0,0,0);
 3279     rpanel->onCmdRefresh(0,0,0);
 3280     dirpanel->forceRefresh();
 3281     getApp()->endWaitCursor();
 3282     
 3283     return 1;
 3284 }
 3285 
 3286 
 3287 // Update file location
 3288 long XFileExplorer::onUpdFileLocation(FXObject* sender,FXSelector,void*)
 3289 {
 3290     FXString currentdir=lpanel->getCurrent()->getDirectory();
 3291     if (currentdir != prevdir)
 3292     {
 3293         address->setText(::cleanPath(currentdir));
 3294         prevdir=currentdir;
 3295     }
 3296     
 3297     return 1;
 3298 }
 3299 
 3300 
 3301 // Switch between vertical and horizontal panels
 3302 long XFileExplorer::onCmdHorzVertPanels(FXObject* sender,FXSelector sel,void* ptr)
 3303 {
 3304     switch(FXSELID(sel))
 3305     {
 3306     case ID_VERT_PANELS:
 3307         panelsplit->setSplitterStyle(panelsplit->getSplitterStyle()&~SPLITTER_VERTICAL);
 3308         vertpanels=true;
 3309         break;
 3310 
 3311     case ID_HORZ_PANELS:
 3312         panelsplit->setSplitterStyle(panelsplit->getSplitterStyle()|SPLITTER_VERTICAL);
 3313         vertpanels=false;
 3314         break;
 3315     }
 3316 
 3317     return 1;
 3318 }
 3319 
 3320 
 3321 // Switch between the four possible panel views
 3322 long XFileExplorer::onCmdShowPanels(FXObject* sender,FXSelector sel,void* ptr)
 3323 {
 3324     // Get window width and height
 3325     int window_width=getWidth();
 3326     int window_height=getHeight();
 3327 
 3328     switch(FXSELID(sel))
 3329     {
 3330     case ID_SHOW_ONE_PANEL:
 3331         panel_view=ONE_PANEL;
 3332         if (dirpanel->shown())
 3333             dirpanel->handle(sender,FXSEL(SEL_COMMAND,DirPanel::ID_TOGGLE_TREE),ptr);
 3334         if (rpanel->shown())
 3335             rpanel->handle(sender,FXSEL(SEL_COMMAND,FXWindow::ID_TOGGLESHOWN),ptr);
 3336         // Handle drag corner
 3337         rpanel->showCorner(false);
 3338         lpanel->showCorner(true);
 3339         // Handle active icon
 3340         lpanel->showActiveIcon(false);
 3341 
 3342         break;
 3343 
 3344     case ID_SHOW_TWO_PANELS:
 3345         panel_view=TWO_PANELS;
 3346         if (vertpanels)
 3347             lpanel->setWidth((int)round(twopanels_lpanel_pct*window_width));
 3348         else
 3349             lpanel->setHeight((int)round(twopanels_lpanel_pct*window_height));
 3350         if (dirpanel->shown())
 3351             dirpanel->handle(sender,FXSEL(SEL_COMMAND,DirPanel::ID_TOGGLE_TREE),ptr);
 3352         if (!rpanel->shown())
 3353             rpanel->handle(sender,FXSEL(SEL_COMMAND,FXWindow::ID_TOGGLESHOWN),ptr);
 3354         // Handle drag corner
 3355         rpanel->showCorner(true);
 3356         lpanel->showCorner(false);
 3357         // Handle active icon
 3358         lpanel->showActiveIcon(true);
 3359         break;
 3360 
 3361     case ID_SHOW_TREE_PANEL:
 3362         panel_view=TREE_PANEL;
 3363         dirpanel->setWidth((int)round(treepanel_tree_pct*window_width) );
 3364         if (!dirpanel->shown())
 3365             dirpanel->handle(sender,FXSEL(SEL_COMMAND,DirPanel::ID_TOGGLE_TREE),ptr);
 3366         if (rpanel->shown())
 3367             rpanel->handle(sender,FXSEL(SEL_COMMAND,FXWindow::ID_TOGGLESHOWN),ptr);
 3368         // Handle drag corner
 3369         rpanel->showCorner(false);
 3370         lpanel->showCorner(true);
 3371         // Handle active icon
 3372         lpanel->showActiveIcon(true);
 3373         break;
 3374 
 3375     case ID_SHOW_TREE_TWO_PANELS:
 3376         panel_view=TREE_TWO_PANELS;
 3377         dirpanel->setWidth((int)round(treetwopanels_tree_pct*window_width) );
 3378         if (vertpanels)
 3379             lpanel->setWidth((int)round(treetwopanels_lpanel_pct*window_width));
 3380         else
 3381             lpanel->setHeight((int)round(treetwopanels_lpanel_pct*window_height));
 3382         if (!dirpanel->shown())
 3383             dirpanel->handle(sender,FXSEL(SEL_COMMAND,DirPanel::ID_TOGGLE_TREE),ptr);
 3384         if (!rpanel->shown())
 3385             rpanel->handle(sender,FXSEL(SEL_COMMAND,FXWindow::ID_TOGGLESHOWN),ptr);
 3386         // Handle drag corner
 3387         lpanel->showCorner(false);
 3388         rpanel->showCorner(true);
 3389         // Handle active icon
 3390         lpanel->showActiveIcon(true);
 3391         break;
 3392     }
 3393 
 3394     // Set focus on current panel
 3395     lpanel->getCurrent()->setFocusOnList();
 3396 
 3397     return 1;
 3398 }
 3399 
 3400 
 3401 // Update the horizontal / vertical panel radio menus
 3402 long XFileExplorer::onUpdHorzVertPanels(FXObject* sender,FXSelector sel,void* ptr)
 3403 {
 3404     if (rpanel->shown())
 3405     {
 3406         sender->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_ENABLE),ptr);
 3407 
 3408         if (vertpanels)
 3409         {
 3410             lpanel->hidePanelSeparator();
 3411             rpanel->hidePanelSeparator();
 3412 
 3413             if ( FXSELID(sel) == ID_HORZ_PANELS )
 3414                 sender->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_UNCHECK),ptr);
 3415             else
 3416                 sender->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_CHECK),ptr);
 3417         }
 3418         else
 3419         {
 3420             lpanel->showPanelSeparator();
 3421             rpanel->hidePanelSeparator();
 3422 
 3423             if ( FXSELID(sel) == ID_VERT_PANELS )
 3424                 sender->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_UNCHECK),ptr);
 3425             else
 3426                 sender->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_CHECK),ptr);
 3427         }
 3428     }
 3429     else
 3430     {
 3431         lpanel->hidePanelSeparator();
 3432         rpanel->hidePanelSeparator();
 3433 
 3434         sender->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_DISABLE),ptr);
 3435     }
 3436 
 3437     return 1;
 3438 }
 3439 
 3440 
 3441 // Update the panels
 3442 long XFileExplorer::onUpdShowPanels(FXObject* sender,FXSelector sel,void* ptr)
 3443 {
 3444     // Keep the panel sizes relative to the window width or height (if option enabled)
 3445 
 3446     register int width;
 3447     register int height;
 3448 
 3449     // Get the current window width and height
 3450     width=getWidth();
 3451     height=getHeight();
 3452 
 3453     // If width has changed and relative resizing option is enabled
 3454     if (relative_resize && prev_width!=width)
 3455     {
 3456         // One panel mode not relevant
 3457 
 3458         // Two panels mode
 3459         if (!dirpanel->shown() && rpanel->shown())
 3460         {
 3461             // Set left panel width / height to the new value
 3462             if (vertpanels)
 3463                 lpanel->setWidth((int)round(twopanels_lpanel_pct*width));
 3464             else
 3465                 lpanel->setHeight((int)round(twopanels_lpanel_pct*height));
 3466         }
 3467 
 3468         // Tree panel mode
 3469         else if (dirpanel->shown() && !rpanel->shown())
 3470         {
 3471             // Set dirpanel width to the new value
 3472             dirpanel->setWidth((int)round(treepanel_tree_pct * width) );
 3473         }
 3474 
 3475         // Tree and two panels mode
 3476         else if (dirpanel->shown() && rpanel->shown())
 3477         {
 3478             // Set dirpanel width to the new value
 3479             dirpanel->setWidth((int)round(treetwopanels_tree_pct * width) );
 3480 
 3481             // Set left panel width / height to the new value
 3482             if (vertpanels)
 3483                 lpanel->setWidth((int)round(treetwopanels_lpanel_pct*width));
 3484             else
 3485                 lpanel->setHeight((int)round(treetwopanels_lpanel_pct*height));
 3486         }
 3487     }
 3488 
 3489     // Update previous window width
 3490     prev_width=width;
 3491 
 3492     // Update the panel menus and the panel display
 3493     FXuint msg=FXWindow::ID_UNCHECK;
 3494     switch(FXSELID(sel))
 3495     {
 3496     case ID_SHOW_ONE_PANEL:
 3497         if (!dirpanel->shown() && !rpanel->shown())
 3498         {
 3499             msg = FXWindow::ID_CHECK;
 3500             if (rpanelmenutitle->shown())
 3501             {
 3502                 rpanelmenutitle->hide();
 3503                 rpanelmenutitle->disable();
 3504                 lpanelmenutitle->setText(_("&Panel"));
 3505                 lpanel->show();
 3506                 //lpanel->repaint();
 3507                 lpanel->setActive();
 3508             }
 3509         }
 3510         break;
 3511 
 3512     case ID_SHOW_TWO_PANELS:
 3513         if (!dirpanel->shown() && rpanel->shown())
 3514         {
 3515             // Update the left panel relative size (only if the window size is sufficient)
 3516             if (vertpanels)
 3517             {
 3518                 if (getWidth()>10)
 3519                     twopanels_lpanel_pct=(double)(lpanel->getWidth())/(double)(getWidth());
 3520             }
 3521             else
 3522             {
 3523                 if (getHeight()>10)
 3524                     twopanels_lpanel_pct=(double)(lpanel->getHeight())/(double)(getHeight());
 3525             }
 3526 
 3527             msg=FXWindow::ID_CHECK;
 3528             if (!rpanelmenutitle->shown())
 3529             {
 3530                 rpanelmenutitle->enable();
 3531                 rpanelmenutitle->show();
 3532                 rpanelmenutitle->setText(_("&Right panel"));
 3533                 lpanelmenutitle->setText(_("&Left panel"));
 3534                 //lpanel->repaint();
 3535                 lpanel->setActive();
 3536             }
 3537         }
 3538         break;
 3539 
 3540     case ID_SHOW_TREE_PANEL:
 3541         if (dirpanel->shown() && !rpanel->shown())
 3542         {
 3543             // Update the tree panel relative size (only if the window size is sufficient)
 3544             if (getWidth()>10)
 3545                 treepanel_tree_pct=(double)(dirpanel->getWidth())/(double)(getWidth());
 3546 
 3547             msg=FXWindow::ID_CHECK;
 3548             if (rpanelmenutitle->shown())
 3549             {
 3550                 rpanelmenutitle->hide();
 3551                 rpanelmenutitle->disable();
 3552                 lpanelmenutitle->setText(_("&Panel"));
 3553                 //lpanel->repaint();
 3554                 lpanel->setActive();
 3555             }
 3556         }
 3557         break;
 3558 
 3559     case ID_SHOW_TREE_TWO_PANELS:
 3560         if (dirpanel->shown() && rpanel->shown())
 3561         {
 3562             // Update the tree panel relative size (only if the window size is sufficient)
 3563             if (getWidth()>10)
 3564                 treetwopanels_tree_pct=(double)(dirpanel->getWidth())/(double)(getWidth());
 3565 
 3566             // Update the left panel relative size (only if the window size is sufficient)
 3567             if (vertpanels)
 3568             {
 3569                 if (getWidth()>10)
 3570                     treetwopanels_lpanel_pct=(double)(lpanel->getWidth())/(double)(getWidth());
 3571             }
 3572             else
 3573             {
 3574                 if (getHeight()>10)
 3575                     treetwopanels_lpanel_pct=(double)(lpanel->getHeight())/(double)(getHeight());
 3576             }
 3577 
 3578             msg = FXWindow::ID_CHECK;
 3579             if (!rpanelmenutitle->shown())
 3580             {
 3581                 rpanelmenutitle->enable();
 3582                 rpanelmenutitle->show();
 3583                 rpanelmenutitle->setText(_("&Right panel"));
 3584                 lpanelmenutitle->setText(_("&Left panel"));
 3585                 //lpanel->repaint();
 3586                 lpanel->setActive();
 3587             }
 3588         }
 3589         break;
 3590     }
 3591     sender->handle(this,FXSEL(SEL_COMMAND,msg),ptr);
 3592 
 3593     return 1;
 3594 }
 3595 
 3596 
 3597 // Synchronize the panels to the same directory
 3598 long XFileExplorer::onCmdSynchronizePanels(FXObject* sender,FXSelector sel,void*)
 3599 {
 3600     FXString dir;
 3601 
 3602     // Left panel is active
 3603     if (lpanel->getCurrent() == lpanel)
 3604     {
 3605         dir=lpanel->getDirectory();
 3606         rpanel->setDirectory(dir);
 3607         rpanel->updatePath();
 3608     }
 3609 
 3610     // Right panel is active
 3611     else
 3612     {
 3613         dir=rpanel->getDirectory();
 3614         lpanel->setDirectory(dir);
 3615         lpanel->updatePath();
 3616 
 3617     }
 3618     return 1;
 3619 }
 3620 
 3621 
 3622 // Update the synchronize panels menu item
 3623 long XFileExplorer::onUpdSynchronizePanels(FXObject* o,FXSelector,void*)
 3624 {
 3625     if (rpanel->shown())
 3626         o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_ENABLE),NULL);
 3627     else
 3628         o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_DISABLE),NULL);
 3629 
 3630     return 1;
 3631 }
 3632 
 3633 
 3634 // Switch the panels
 3635 long XFileExplorer::onCmdSwitchPanels(FXObject* sender,FXSelector sel,void*)
 3636 {
 3637     FXString leftdir, rightdir;
 3638 
 3639     leftdir=lpanel->getDirectory();
 3640     rightdir=rpanel->getDirectory();
 3641     lpanel->setDirectory(rightdir);
 3642     lpanel->updatePath();
 3643     rpanel->setDirectory(leftdir);
 3644     rpanel->updatePath();
 3645 
 3646     return 1;
 3647 }
 3648 
 3649 
 3650 // Update the switch panels menu item
 3651 long XFileExplorer::onUpdSwitchPanels(FXObject* o,FXSelector,void*)
 3652 {
 3653     if (rpanel->shown())
 3654         o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_ENABLE),NULL);
 3655     else
 3656         o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_DISABLE),NULL);
 3657 
 3658     return 1;
 3659 }
 3660 
 3661 
 3662 // Preferences
 3663 long XFileExplorer::onCmdPrefs(FXObject*,FXSelector s,void* p)
 3664 {
 3665     if (prefsdialog==NULL)
 3666         prefsdialog=new PreferencesBox(this,listbackcolor,listforecolor,highlightcolor,pbarcolor,attentioncolor,scrollbarcolor);
 3667     prefsdialog->execute(PLACEMENT_OWNER);
 3668     lpanel->getCurrent()->setFocusOnList();
 3669     return 1;
 3670 }
 3671 
 3672 
 3673 // Toggle status bar
 3674 long XFileExplorer::onCmdToggleStatus(FXObject*,FXSelector s,void* p)
 3675 {
 3676     dirpanel->toggleStatusbar();
 3677     lpanel->toggleStatusbar();
 3678     rpanel->toggleStatusbar();
 3679     return 1;
 3680 }
 3681 
 3682 
 3683 long XFileExplorer::onUpdToggleStatus(FXObject* o,FXSelector s,void* p)
 3684 {
 3685     FXMenuCheck* cmd =(FXMenuCheck*)o;
 3686     if (lpanel->statusbarShown())
 3687         cmd->setCheck(true);
 3688     else
 3689         cmd->setCheck(false);
 3690     return 1;
 3691 }
 3692 
 3693 
 3694 // Run shell command or X program
 3695 long XFileExplorer::onCmdRun(FXObject*,FXSelector,void*)
 3696 {
 3697     int ret;
 3698 
 3699     ret=chdir(lpanel->getCurrent()->getDirectory().text());
 3700     if (ret < 0)
 3701     {
 3702         int errcode=errno;
 3703         if (errcode)
 3704             MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s: %s"),lpanel->getCurrent()->getDirectory().text(),strerror(errcode));
 3705         else
 3706             MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s"),lpanel->getCurrent()->getDirectory().text());
 3707 
 3708         return 0;
 3709     }
 3710 
 3711     FXString command=" ";
 3712     if (rundialog==NULL)
 3713         rundialog=new HistInputDialog(this,"",_("Execute the command:"),_("Execute command"),"", bigexecicon,HIST_INPUT_EXECUTABLE_FILE,true,_("Console mode"));
 3714     rundialog->create();
 3715     rundialog->setText(command);
 3716     rundialog->CursorEnd();
 3717     rundialog->selectAll();
 3718     rundialog->clearItems();
 3719     for (int i=0; i<RunHistSize; i++)
 3720         rundialog->appendItem(RunHistory[i]);
 3721     rundialog->sortItems();
 3722 
 3723     rundialog->setDirectory(ROOTDIR);
 3724     if (rundialog->execute())
 3725     {
 3726         command=rundialog->getText();
 3727         if (command != " ")
 3728         {
 3729             // Execute command in command window
 3730             if (rundialog->getOption())
 3731             {
 3732                 // Make and show command window
 3733                 CommandWindow* cmdwin=new CommandWindow(getApp(),_("Command log"),command,30,80);
 3734                 cmdwin->create();
 3735                 cmdwin->setIcon(runicon);
 3736 
 3737                 // The CommandWindow object will delete itself when closed!
 3738             }
 3739 
 3740             // Execute silently in background
 3741             else
 3742             {
 3743                 command+=" &";
 3744                 ret=system(command.text());
 3745                 if (ret < 0)
 3746                 {
 3747                     MessageBox::error(this,BOX_OK,_("Error"),_("Can't execute command %s"),command.text());
 3748                     return 0;
 3749                 }
 3750             }
 3751         }
 3752         // Update history list
 3753         RunHistSize=rundialog->getHistorySize();
 3754         command=rundialog->getText();
 3755 
 3756         // Check if cmd is a new string, i.e. is not already in history
 3757         FXbool newstr=true;
 3758         for (int i=0; i<RunHistSize-1; i++)
 3759         {
 3760             if (streq(RunHistory[i],command.text()))
 3761             {
 3762                 newstr=false;
 3763                 break;
 3764             }
 3765         }
 3766 
 3767         // No new string or history limit reached
 3768         if (!newstr || RunHistSize>RUN_HIST_SIZE)
 3769             RunHistSize--;
 3770 
 3771         // Restore original history order
 3772         rundialog->clearItems();
 3773         for (int i = 0; i < RunHistSize; i++)
 3774         {
 3775             rundialog->appendItem(RunHistory[i]);
 3776         }
 3777 
 3778         // New string
 3779         if (newstr)
 3780         {
 3781             // FIFO
 3782             strlcpy(RunHistory[0],command.text(),command.length()+1);
 3783             for (int i=1; i<RunHistSize; i++)
 3784                 strlcpy(RunHistory[i],rundialog->getHistoryItem(i-1).text(),rundialog->getHistoryItem(i-1).length()+1);
 3785         }
 3786     }
 3787     ret=chdir(startlocation.text());
 3788     if (ret < 0)
 3789     {
 3790         int errcode=errno;
 3791         if (errcode)
 3792             MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s: %s"),startlocation.text(),strerror(errcode));
 3793         else
 3794             MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s"),startlocation.text());
 3795 
 3796         return 0;
 3797     }
 3798 
 3799     lpanel->getCurrent()->setFocusOnList();
 3800     return 1;
 3801 }
 3802 
 3803 
 3804 // Run an Xfe as root
 3805 long XFileExplorer::onCmdSu(FXObject*,FXSelector,void*)
 3806 {
 3807     int ret;
 3808 
 3809     // Wait cursor
 3810     getApp()->beginWaitCursor();
 3811 
 3812     // Obtain preferred root mode
 3813     FXbool use_sudo=getApp()->reg().readUnsignedEntry("OPTIONS","use_sudo",false);
 3814 
 3815     // Select sudo or su to launch xfe as root
 3816     ret=chdir(lpanel->getCurrent()->getDirectory().text());
 3817     if (ret < 0)
 3818     {
 3819         int errcode=errno;
 3820         if (errcode)
 3821             MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s: %s"),lpanel->getCurrent()->getDirectory().text(),strerror(errcode));
 3822         else
 3823             MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s"),lpanel->getCurrent()->getDirectory().text());
 3824 
 3825         return 0;
 3826     }
 3827 
 3828     FXString title, sucmd, command;
 3829     if (use_sudo)
 3830     {
 3831         title = _("Enter the user password:");
 3832         sucmd = SUDOCMD;
 3833     }
 3834     else
 3835     {
 3836         title = _("Enter the root password:");
 3837         sucmd = SUCMD;
 3838     }
 3839 
 3840     // Get text font
 3841     FXString fontspec = getApp()->reg().readStringEntry("SETTINGS", "textfont", DEFAULT_TEXT_FONT);
 3842     if (fontspec.empty())
 3843     {
 3844         command = "st -t " + ::quote(title) + sucmd;
 3845     }
 3846     else
 3847     {
 3848         FXchar fontsize[32];
 3849         FXFont* font = new FXFont(getApp(), fontspec);
 3850         font->create();
 3851         snprintf(fontsize, sizeof(fontsize), "%d",(int)(font->getSize()/10)); // Size is in deci-points, thus divide by 10
 3852         command = "st -t " + ::quote(title) + " -f '" + (font->getFamily()).text() + ":pixelsize=" + fontsize + "'" + sucmd;
 3853     }
 3854 
 3855     // Execute su or sudo command in an internal st terminal
 3856     int status = runst(command);
 3857 
 3858     // If error
 3859     ret=chdir(startlocation.text());
 3860     if (ret < 0)
 3861     {
 3862         int errcode=errno;
 3863         if (errcode)
 3864             MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s: %s"),startlocation.text(),strerror(errcode));
 3865         else
 3866             MessageBox::error(this,BOX_OK,_("Error"),_("Can't enter folder %s"),startlocation.text());
 3867 
 3868         return 0;
 3869     }
 3870 
 3871     if (status<0)
 3872     {
 3873         MessageBox::error(getApp(),BOX_OK,_("Error"),_("An error has occurred!"));
 3874         getApp()->endWaitCursor();
 3875         return 0;
 3876     }
 3877 
 3878     // Wait cursor
 3879     getApp()->endWaitCursor();
 3880     return 1;
 3881 }
 3882 
 3883 
 3884 // File search dialog
 3885 long XFileExplorer::onCmdFileSearch(FXObject* o,FXSelector sel,void*)
 3886 {
 3887     // Display search box
 3888     if (searchwindow==NULL)
 3889         searchwindow=new SearchWindow(getApp(),_("Search files and folders"),
 3890                                       DECOR_ALL,search_xpos,search_ypos,search_width,search_height,0,0,0,0,0,0);
 3891 
 3892     // Non modal window
 3893     searchwindow->create();
 3894     searchwindow->show(PLACEMENT_DEFAULT);
 3895 
 3896     // Set search path in search window
 3897     searchwindow->setSearchPath(lpanel->getCurrent()->getDirectory());
 3898 
 3899     return 1;
 3900 }
 3901 
 3902 
 3903 // Update file search button
 3904 long XFileExplorer::onUpdFileSearch(FXObject* o,FXSelector,void*)
 3905 {
 3906 
 3907     if (searchwindow != NULL && searchwindow->shown())
 3908         o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_DISABLE),NULL);
 3909     else
 3910         o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_ENABLE),NULL);
 3911 
 3912     return 1;
 3913 }
 3914 
 3915 
 3916 // Empty trash can
 3917 long XFileExplorer::onCmdEmptyTrash(FXObject*,FXSelector sel,void* ptr)
 3918 {
 3919     // Wait cursor
 3920     getApp()->beginWaitCursor();
 3921 
 3922     // Compute trash directory size
 3923     char buf[MAXPATHLEN+1];
 3924     char size[64];
 3925     FXString hsize;
 3926     FXulong dirsize;
 3927     FXuint nbfiles=0, nbsubfolders=0;
 3928     FXulong totalsize=0;
 3929 
 3930     FXString dirpath=trashfileslocation;
 3931     strlcpy(buf,dirpath.text(),dirpath.length()+1);
 3932     dirsize=pathsize(buf,&nbfiles,&nbsubfolders,&totalsize);
 3933 
 3934 #if __WORDSIZE == 64
 3935     snprintf(size,sizeof(size)-1,"%lu",dirsize);
 3936 #else
 3937     snprintf(size,sizeof(size)-1,"%llu",dirsize);
 3938 #endif
 3939     hsize=::hSize(size);
 3940 #if __WORDSIZE == 64
 3941     snprintf(size,sizeof(size)-1,_("%s (%lu bytes)"),hsize.text(),dirsize);
 3942 #else
 3943     snprintf(size,sizeof(size)-1,_("%s (%llu bytes)"),hsize.text(),dirsize);
 3944 #endif
 3945     snprintf(size,sizeof(size)-1,_("%u files, %u subfolders"),nbfiles-nbsubfolders,nbsubfolders-1);
 3946 
 3947     // Wait cursor
 3948     getApp()->endWaitCursor();
 3949 
 3950     // Confirmation message
 3951     FXString message=_("Do you really want to empty the trash can?") + FXString(" (") + hsize + _(" in ") + FXString(size) + FXString(")")
 3952                      + _("\n\nAll items will be definitively lost!");
 3953 
 3954     MessageBox box(this,_("Empty trash can"),message,trash_full_bigicon,BOX_OK_CANCEL|DECOR_TITLE|DECOR_BORDER);
 3955     if (box.execute(PLACEMENT_CURSOR) != BOX_CLICKED_OK)
 3956         return 0;
 3957 
 3958     // Wait cursor
 3959     getApp()->beginWaitCursor();
 3960 
 3961     // Delete trash can files folder
 3962     File* f;
 3963     f=new File(this,_("File delete"),DELETE);
 3964     f->create();
 3965     f->remove(trashfileslocation);
 3966     delete f;
 3967 
 3968     // Delete trash can info folder
 3969     f=new File(this,_("File delete"),DELETE);
 3970     f->create();
 3971     f->remove(trashinfolocation);
 3972     delete f;
 3973 
 3974     // Re-create the trash can files directory
 3975     if (!::exists(trashfileslocation))
 3976     {
 3977         errno=0;
 3978         int ret=mkpath(trashfileslocation.text(),0755);
 3979         int errcode=errno;
 3980         if (ret==-1)
 3981         {
 3982             if (errcode)
 3983                 MessageBox::error(this,BOX_OK,_("Error"),_("Can't create trash can 'files' folder %s: %s"),trashfileslocation.text(),strerror(errcode));
 3984             else
 3985                 MessageBox::error(this,BOX_OK,_("Error"),_("Can't create trash can 'files' folder %s"),trashfileslocation.text());
 3986         }
 3987     }
 3988 
 3989     // Re-create the trash can info directory
 3990     if (!::exists(trashinfolocation))
 3991     {
 3992         errno=0;
 3993         int ret=mkpath(trashinfolocation.text(),0755);
 3994         int errcode=errno;
 3995         if (ret==-1)
 3996         {
 3997             if (errcode)
 3998                 MessageBox::error(this,BOX_OK,_("Error"),_("Can't create trash can 'info' folder %s: %s"),trashinfolocation.text(),strerror(errcode));
 3999             else
 4000                 MessageBox::error(this,BOX_OK,_("Error"),_("Can't create trash can 'info' folder %s"),trashinfolocation.text());
 4001         }
 4002     }
 4003 
 4004     // Wait cursor
 4005     getApp()->endWaitCursor();
 4006 
 4007     onCmdRefresh(0,0,0);
 4008 
 4009     return 1;
 4010 }
 4011 
 4012 
 4013 // Display trash size
 4014 long XFileExplorer::onCmdTrashSize(FXObject*,FXSelector sel,void*)
 4015 {
 4016     struct stat linfo;
 4017     FXString trashsize, trashmtime, trashnbfiles, trashnbfolders;
 4018     if (lstatrep(trashfileslocation.text(),&linfo)==0)
 4019     {
 4020         // Read time format
 4021         FXString timeformat=getApp()->reg().readStringEntry("SETTINGS","time_format",DEFAULT_TIME_FORMAT);
 4022 
 4023         // Trash files size
 4024         trashmtime=FXSystem::time(timeformat.text(),linfo.st_mtime);
 4025         char buf[MAXPATHLEN];
 4026         FXulong dirsize=0;
 4027         FXuint nbfiles=0, nbsubfolders=0;
 4028         FXulong totalsize=0;
 4029         strlcpy(buf,trashfileslocation.text(),trashfileslocation.length()+1);
 4030         dirsize=pathsize(buf,&nbfiles,&nbsubfolders,&totalsize);
 4031 #if __WORDSIZE == 64
 4032         snprintf(buf,sizeof(buf),"%lu",dirsize);
 4033 #else
 4034         snprintf(buf,sizeof(buf),"%llu",dirsize);
 4035 #endif
 4036         trashsize=::hSize(buf);
 4037         trashnbfiles=FXStringVal(nbfiles-nbsubfolders);
 4038         trashnbfolders=FXStringVal(nbsubfolders-1);
 4039 
 4040         // Dialog box
 4041         FXString msg;
 4042         msg.format(_("Trash size: %s (%s files, %s subfolders)\n\nModified date: %s"),
 4043                    trashsize.text(),trashnbfiles.text(),trashnbfolders.text(),trashmtime.text());
 4044         MessageBox dialog(this,_("Trash size"),msg.text(),delete_bigicon,BOX_OK|DECOR_TITLE|DECOR_BORDER,
 4045                           JUSTIFY_LEFT|ICON_BEFORE_TEXT|LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_Y);
 4046         dialog.execute(PLACEMENT_CURSOR);
 4047     }
 4048     else
 4049     {
 4050         // Error
 4051         MessageBox::error(this,BOX_OK,_("Error"),_("Trash can 'files' folder %s is not readable!"),trashfileslocation.text());
 4052         return 0;
 4053     }
 4054 
 4055     return 1;
 4056 }
 4057 
 4058 
 4059 // File copy to clipboard
 4060 long XFileExplorer::onCmdFileCopyClp(FXObject* o, FXSelector sel, void*)
 4061 {
 4062     if (dirpanel->isActive())
 4063         dirpanel->handle(o,FXSEL(SEL_COMMAND,DirPanel::ID_COPY_CLIPBOARD),NULL);
 4064 
 4065     else
 4066         lpanel->getCurrent()->handle(o,FXSEL(SEL_COMMAND,FilePanel::ID_COPY_CLIPBOARD),NULL);
 4067 
 4068     return 1;
 4069 }
 4070 
 4071 
 4072 // File cut to clipboard
 4073 long XFileExplorer::onCmdFileCutClp(FXObject* o, FXSelector sel, void*)
 4074 {
 4075     if (dirpanel->isActive())
 4076         dirpanel->handle(o,FXSEL(SEL_COMMAND,DirPanel::ID_CUT_CLIPBOARD),NULL);
 4077 
 4078     else
 4079         lpanel->getCurrent()->handle(o,FXSEL(SEL_COMMAND,FilePanel::ID_CUT_CLIPBOARD),NULL);
 4080 
 4081     return 1;
 4082 }
 4083 
 4084 
 4085 // File add copy to clipboard
 4086 long XFileExplorer::onCmdFileAddCopyClp(FXObject* o, FXSelector sel, void*)
 4087 {
 4088     if (dirpanel->isActive())
 4089         dirpanel->handle(o,FXSEL(SEL_COMMAND,DirPanel::ID_ADDCOPY_CLIPBOARD),NULL);
 4090 
 4091     else
 4092         lpanel->getCurrent()->handle(o,FXSEL(SEL_COMMAND,FilePanel::ID_ADDCOPY_CLIPBOARD),NULL);
 4093 
 4094     return 1;
 4095 }
 4096 
 4097 
 4098 // File add cut to clipboard
 4099 long XFileExplorer::onCmdFileAddCutClp(FXObject* o, FXSelector sel, void*)
 4100 {
 4101     if (dirpanel->isActive())
 4102         dirpanel->handle(o,FXSEL(SEL_COMMAND,DirPanel::ID_ADDCUT_CLIPBOARD),NULL);
 4103 
 4104     else
 4105         lpanel->getCurrent()->handle(o,FXSEL(SEL_COMMAND,FilePanel::ID_ADDCUT_CLIPBOARD),NULL);
 4106 
 4107     return 1;
 4108 }
 4109 
 4110 
 4111 // File paste from clipboard
 4112 long XFileExplorer::onCmdFilePasteClp(FXObject* o, FXSelector sel, void*)
 4113 {
 4114     if (dirpanel->isActive())
 4115         dirpanel->handle(o,FXSEL(SEL_COMMAND,DirPanel::ID_PASTE_CLIPBOARD),NULL);
 4116 
 4117     else
 4118         lpanel->getCurrent()->handle(o,FXSEL(SEL_COMMAND,FilePanel::ID_PASTE_CLIPBOARD),NULL);
 4119     return 1;
 4120 }
 4121 
 4122 
 4123 // File rename
 4124 long XFileExplorer::onCmdFileRename(FXObject* o, FXSelector sel, void*)
 4125 {
 4126     lpanel->getCurrent()->handle(o,FXSEL(SEL_COMMAND,FilePanel::ID_FILE_RENAME),NULL);
 4127     return 1;
 4128 }
 4129 
 4130 
 4131 // File move
 4132 long XFileExplorer::onCmdFileMoveto(FXObject* o, FXSelector sel, void* ptr)
 4133 {
 4134     if (dirpanel->isActive())
 4135         dirpanel->handle(o,FXSEL(SEL_COMMAND,DirPanel::ID_DIR_MOVETO),ptr);
 4136 
 4137     else
 4138         lpanel->getCurrent()->handle(o,FXSEL(SEL_COMMAND,FilePanel::ID_FILE_MOVETO),NULL);
 4139     return 1;
 4140 }
 4141 
 4142 
 4143 // File copy to
 4144 long XFileExplorer::onCmdFileCopyto(FXObject* o, FXSelector sel, void* ptr)
 4145 {
 4146     if (dirpanel->isActive())
 4147         dirpanel->handle(o,FXSEL(SEL_COMMAND,DirPanel::ID_DIR_COPYTO),ptr);
 4148 
 4149     else
 4150         lpanel->getCurrent()->handle(o,FXSEL(SEL_COMMAND,FilePanel::ID_FILE_COPYTO),NULL);
 4151 
 4152     return 1;
 4153 }
 4154 
 4155 
 4156 // File symlink
 4157 long XFileExplorer::onCmdFileSymlink(FXObject* o, FXSelector sel, void* ptr)
 4158 {
 4159     if (dirpanel->isActive())
 4160         dirpanel->handle(o,FXSEL(SEL_COMMAND,DirPanel::ID_DIR_SYMLINK),ptr);
 4161 
 4162     else
 4163         lpanel->getCurrent()->handle(o,FXSEL(SEL_COMMAND,FilePanel::ID_FILE_SYMLINK),NULL);
 4164 
 4165     return 1;
 4166 }
 4167 
 4168 
 4169 // File trash
 4170 long XFileExplorer::onCmdFileTrash(FXObject* o, FXSelector sel, void* ptr)
 4171 {
 4172     if (dirpanel->isActive())
 4173         dirpanel->handle(o,FXSEL(SEL_COMMAND,DirPanel::ID_DIR_TRASH),ptr);
 4174 
 4175     else
 4176         lpanel->getCurrent()->handle(o,FXSEL(SEL_COMMAND,FilePanel::ID_FILE_TRASH),ptr);
 4177 
 4178     return 1;
 4179 }
 4180 
 4181 
 4182 // File restore
 4183 long XFileExplorer::onCmdFileRestore(FXObject* o,FXSelector sel,void* ptr)
 4184 {
 4185     if (dirpanel->isActive())
 4186         dirpanel->handle(o,FXSEL(SEL_COMMAND,DirPanel::ID_DIR_RESTORE),ptr);
 4187 
 4188     else
 4189         lpanel->getCurrent()->handle(o,FXSEL(SEL_COMMAND,FilePanel::ID_FILE_RESTORE),ptr);
 4190 
 4191     return 1;
 4192 }
 4193 
 4194 
 4195 // File delete
 4196 long XFileExplorer::onCmdFileDelete(FXObject* o,FXSelector sel,void* ptr)
 4197 {
 4198     if (dirpanel->isActive())
 4199         dirpanel->handle(o,FXSEL(SEL_COMMAND,DirPanel::ID_DIR_DELETE),ptr);
 4200 
 4201     else
 4202         lpanel->getCurrent()->handle(o,FXSEL(SEL_COMMAND,FilePanel::ID_FILE_DELETE),ptr);
 4203 
 4204     return 1;
 4205 }
 4206 
 4207 
 4208 // File properties
 4209 long XFileExplorer::onCmdFileProperties(FXObject* o,FXSelector sel,void*)
 4210 {
 4211     if (dirpanel->isActive())
 4212         dirpanel->handle(o,FXSEL(SEL_COMMAND,DirPanel::ID_PROPERTIES),NULL);
 4213 
 4214     else
 4215         lpanel->getCurrent()->handle(o,FXSEL(SEL_COMMAND,FilePanel::ID_PROPERTIES),NULL);
 4216 
 4217     return 1;
 4218 }
 4219 
 4220 
 4221 // Update the empty trash can and trash menus
 4222 long XFileExplorer::onUpdEmptyTrash(FXObject* o,FXSelector,void* ptr)
 4223 {
 4224 
 4225     FXbool use_trash_can=getApp()->reg().readUnsignedEntry("OPTIONS","use_trash_can",true);
 4226     if (use_trash_can)
 4227     {
 4228         // Update the empty trash can menu
 4229         o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_ENABLE),NULL);
 4230 
 4231         // Update the trash menu title
 4232         helpmenutitle->setText("");
 4233         trashmenutitle->setText(_("T&rash"));
 4234         trashmenutitle->enable();
 4235         trashmenutitle->show();
 4236         helpmenutitle->setText(_("&Help"));
 4237     }
 4238     else
 4239     {
 4240         // Update the empty trash can menu
 4241         o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_DISABLE),NULL);
 4242 
 4243         // Update the trash menu title
 4244         trashmenutitle->hide();
 4245         trashmenutitle->disable();
 4246         helpmenutitle->setText("");
 4247         helpmenutitle->setText(_("&Help"));
 4248     }
 4249 
 4250     return 1;
 4251 }
 4252 
 4253 
 4254 // Update the trash size menu
 4255 long XFileExplorer::onUpdTrashSize(FXObject* o,FXSelector,void*)
 4256 {
 4257     FXbool use_trash_can=getApp()->reg().readUnsignedEntry("OPTIONS","use_trash_can",true);
 4258     if (use_trash_can)
 4259         o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_ENABLE),NULL);
 4260     else
 4261         o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_DISABLE),NULL);
 4262 
 4263     return 1;
 4264 }
 4265 
 4266 
 4267 // Update the file delete menu item
 4268 long XFileExplorer::onUpdFileDelete(FXObject* o,FXSelector,void* ptr)
 4269 {
 4270     if (dirpanel->isActive())
 4271         dirpanel->handle(o,FXSEL(SEL_UPDATE,DirPanel::ID_DIR_DELETE),ptr);
 4272 
 4273     else
 4274         lpanel->getCurrent()->handle(o,FXSEL(SEL_UPDATE,FilePanel::ID_FILE_DELETE),ptr);
 4275 
 4276     return 1;
 4277 }
 4278 
 4279 
 4280 // Update the move to trash menu item
 4281 long XFileExplorer::onUpdFileTrash(FXObject* o,FXSelector,void* ptr)
 4282 {
 4283     if (dirpanel->isActive())
 4284         dirpanel->handle(o,FXSEL(SEL_UPDATE,DirPanel::ID_DIR_TRASH),ptr);
 4285 
 4286     else
 4287         lpanel->getCurrent()->handle(o,FXSEL(SEL_UPDATE,FilePanel::ID_FILE_TRASH),ptr);
 4288 
 4289     return 1;
 4290 }
 4291 
 4292 
 4293 // Update the restore from trash menu item
 4294 long XFileExplorer::onUpdFileRestore(FXObject* o,FXSelector,void* ptr)
 4295 {
 4296     if (dirpanel->isActive())
 4297         dirpanel->handle(o,FXSEL(SEL_UPDATE,