aboutsummaryrefslogtreecommitdiff
path: root/lumina-fm/MainUI.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-05-01 13:12:42 -0400
committerKen Moore <moorekou@gmail.com>2015-05-01 13:12:42 -0400
commit203b715594d7cf344d9565bba07aa84133c033a3 (patch)
treecf6c0f8df9b4f14e2a4e643dbda5fb5e95dfc7d9 /lumina-fm/MainUI.cpp
parentUpdate the documentation on the ROADMAP and the plugins available in the comm... (diff)
parentMerge remote-tracking branch 'upstream/master' into fm-term (diff)
downloadlumina-203b715594d7cf344d9565bba07aa84133c033a3.tar.gz
lumina-203b715594d7cf344d9565bba07aa84133c033a3.tar.bz2
lumina-203b715594d7cf344d9565bba07aa84133c033a3.zip
Merge pull request #108 from william-os4y/fm-term
this change propose to have the "Open Terminal here" menu in lumina-fm
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