aboutsummaryrefslogtreecommitdiff
path: root/lumina-fm/MainUI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lumina-fm/MainUI.cpp')
-rw-r--r--lumina-fm/MainUI.cpp25
1 files changed, 25 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; }
bgstack15