Mercurial > hg > octave-lojdl
changeset 16515:87b78e75a2b9
gui: undo disabling menu entries in context menu of file browser
* files-dock-widget.cc(contextmenu_requested): icon for setting file browser
directory to octave dir, undo disabling menu entries that are not applicable
instead of hiding them
author | Torsten <ttl@justmail.de> |
---|---|
date | Sun, 14 Apr 2013 08:48:03 +0200 |
parents | db045633405c |
children | 7af39cc90982 |
files | libgui/src/files-dock-widget.cc |
diffstat | 1 files changed, 21 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/files-dock-widget.cc +++ b/libgui/src/files-dock-widget.cc @@ -285,37 +285,37 @@ { QFileInfo info = _file_system_model->fileInfo(index); - menu.addAction(QIcon(":/actions/icons/fileopen.png"), tr("Open"), + menu.addAction (QIcon (":/actions/icons/fileopen.png"), tr("Open"), this, SLOT(contextmenu_open(bool))); - QAction *run_action = menu.addAction( - QIcon(":/actions/icons/artsbuilderexecute.png"), tr("Run"), - this, SLOT(contextmenu_run(bool))); - run_action->setEnabled (info.isFile () && info.suffix () == "m"); - QAction *load_action = menu.addAction(tr("Load Data"), - this, SLOT(contextmenu_load(bool))); - load_action->setEnabled (info.isFile ()); + if (info.isFile () && info.suffix () == "m") + menu.addAction (QIcon (":/actions/icons/artsbuilderexecute.png"), + tr("Run"), this, SLOT(contextmenu_run(bool))); + if (info.isFile ()) + menu.addAction (tr("Load Data"), this, SLOT(contextmenu_load(bool))); if (info.isDir ()) { menu.addSeparator (); - menu.addAction (tr ("Set Current Directory"), + menu.addAction (QIcon (":/actions/icons/ok.png"), + tr ("Set Current Directory"), this, SLOT (contextmenu_setcurrentdir (bool))); } menu.addSeparator(); - menu.addAction(tr("Rename"), this, SLOT(contextmenu_rename(bool))); - menu.addAction(QIcon(":/actions/icons/editdelete.png"), tr("Delete"), - this, SLOT(contextmenu_delete(bool))); + menu.addAction (tr ("Rename"), this, SLOT(contextmenu_rename(bool))); + menu.addAction (QIcon(":/actions/icons/editdelete.png"), tr("Delete"), + this, SLOT(contextmenu_delete(bool))); - menu.addSeparator(); - QAction *new_file_action = menu.addAction( - QIcon(":/actions/icons/filenew.png"), - tr("New File"), this, SLOT(contextmenu_newfile(bool))); - new_file_action->setEnabled (info.isDir()); - QAction *new_dir_action = menu.addAction( - QIcon(":/actions/icons/folder_new.png"), - tr("New Directory"), this, SLOT(contextmenu_newdir(bool))); - new_dir_action->setEnabled (info.isDir()); + if (info.isDir()) + { + menu.addSeparator(); + menu.addAction (QIcon (":/actions/icons/filenew.png"), + tr ("New File"), + this, SLOT(contextmenu_newfile(bool))); + menu.addAction (QIcon (":/actions/icons/folder_new.png"), + tr("New Directory"), + this, SLOT(contextmenu_newdir(bool))); + } menu.exec(_file_tree_view->mapToGlobal(mpos));