diff options
Diffstat (limited to 'lumina-fm')
-rw-r--r-- | lumina-fm/MainUI.cpp | 19 | ||||
-rw-r--r-- | lumina-fm/MainUI.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 7f1e5fcc..ce3c4bd2 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -971,6 +971,11 @@ void MainUI::OpenContextMenu(const QPoint &pt){ contextMenu->addSeparator(); contextMenu->addAction(LXDG::findIcon("system-search",""), tr("File Properties"), this, SLOT(ViewPropertiesItem()) )->setEnabled(hasSelection && info.fileName().endsWith(".desktop")); } + if (info.isDir() || CItem.isEmpty()) { + //in case the user click on a directory or click on the background + contextMenu->addSeparator(); + contextMenu->addAction(LXDG::findIcon("system-search",""), tr("Open Terminal here"), this, SLOT(openTerminal())); + } //Now show the menu if(radio_view_details->isChecked()){ contextMenu->popup(ui->tree_dir_view->mapToGlobal(pt)); @@ -1425,6 +1430,20 @@ void MainUI::ViewPropertiesItem(){ } } +void MainUI::openTerminal(){ + QFileInfoList sel = getSelectedItems(); + QString shell; + if (getenv("SHELL")) shell = QString(getenv("SHELL")); + else shell = QString("/bin/sh"); + if(sel.isEmpty()){ + //TODO: replace xterm by the user's choice + QProcess::startDetached("xterm -e \"cd " + getCurrentDir() + " && " + shell + " \" "); + } else { + QProcess::startDetached("xterm -e \"cd " + sel[0].absoluteFilePath() + " && " + shell + " \" "); + } +} + + void MainUI::CutItems(){ //Only let this run if viewing the browser page if(ui->stackedWidget->currentWidget()!=ui->page_browser){ return; } diff --git a/lumina-fm/MainUI.h b/lumina-fm/MainUI.h index b18d25a5..0e3d7eb5 100644 --- a/lumina-fm/MainUI.h +++ b/lumina-fm/MainUI.h @@ -216,6 +216,7 @@ private slots: void FavoriteItem(); // - full selection actions void ViewPropertiesItem(); + void openTerminal(); void CutItems(); void CopyItems(); void PasteItems(); |