diff options
Diffstat (limited to 'lumina-fm')
-rw-r--r-- | lumina-fm/MainUI.cpp | 25 | ||||
-rw-r--r-- | lumina-fm/MainUI.h | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 4c41ffda..3cc66d97 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -976,6 +976,11 @@ void MainUI::OpenContextMenu(const QPoint &pt){ contextMenu->addSeparator(); contextMenu->addAction(LXDG::findIcon("edit-find-replace",""), tr("File Properties"), this, SLOT(ViewPropertiesItem()) )->setEnabled(hasSelection); } + 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)); @@ -1423,6 +1428,26 @@ void MainUI::ViewPropertiesItem(){ } } +void MainUI::openTerminal(){ + QFileInfoList sel = getSelectedItems(); + QString shell; + //we get the shell has defined in the environment + if (getenv("SHELL")) shell = QString(getenv("SHELL")); + else shell = QString("/bin/sh"); + //we use the application defined as thate default terminal + QSettings *sessionsettings = new QSettings( QSettings::UserScope, "LuminaDE","sessionsettings", this); + //xterm remains the default + QString defTerminal = sessionsettings->value("default-terminal", "xterm").toString(); + if(sel.isEmpty()){ + //-e is the parameter for most of the terminal appliction to execute an external command. + //In your case we start a shell in the selected directory + QProcess::startDetached(defTerminal + " -e \"cd " + getCurrentDir() + " && " + shell + " \" "); + } else { + QProcess::startDetached(defTerminal + " -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 345e2dd4..be8bb11f 100644 --- a/lumina-fm/MainUI.h +++ b/lumina-fm/MainUI.h @@ -217,6 +217,7 @@ private slots: void FavoriteItem(); // - full selection actions void ViewPropertiesItem(); + void openTerminal(); void CutItems(); void CopyItems(); void PasteItems(); |