diff options
author | Ken Moore <ken@pcbsd.org> | 2015-04-23 10:17:20 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-04-23 10:17:20 -0400 |
commit | af44cb451c2f570c009cac3e1ae5a63be8e0a911 (patch) | |
tree | 5c5d17d47c0ff0da3f2f84c26bb54322bf5909e7 /lumina-fm/MainUI.cpp | |
parent | Don't disable the save button on the "defaults" page any more. The autostart ... (diff) | |
download | lumina-af44cb451c2f570c009cac3e1ae5a63be8e0a911.tar.gz lumina-af44cb451c2f570c009cac3e1ae5a63be8e0a911.tar.bz2 lumina-af44cb451c2f570c009cac3e1ae5a63be8e0a911.zip |
Make the open/openwith functionality in lumina-fm multi-selection aware. Also so the same for the "properties" option (although it only operates on *.desktop files at the moment).
Diffstat (limited to 'lumina-fm/MainUI.cpp')
-rw-r--r-- | lumina-fm/MainUI.cpp | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index d7e3b290..7f1e5fcc 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -953,12 +953,9 @@ void MainUI::OpenContextMenu(const QPoint &pt){ //Create the context menu contextMenu->clear(); if(!CItem.isEmpty()){ - if(info.isDir()){ - contextMenu->addAction(LXDG::findIcon("tab-new-background",""), tr("Open in new tab"), this, SLOT(OpenDir()) ); - }else{ - contextMenu->addAction(LXDG::findIcon("run-build-file",""), tr("Open"), this, SLOT(OpenItem()) ); - contextMenu->addAction(LXDG::findIcon("run-build-configure",""), tr("Open With..."), this, SLOT(OpenItemWith()) ); - } + contextMenu->addAction(LXDG::findIcon("run-build-file",""), tr("Open"), this, SLOT(OpenItem()) ); + contextMenu->addAction(LXDG::findIcon("run-build-configure",""), tr("Open With..."), this, SLOT(OpenItemWith()) ); + contextMenu->addAction(LXDG::findIcon("edit-rename",""), tr("Rename"), this, SLOT(RenameItem()) )->setEnabled(info.isWritable()); contextMenu->addAction(LXDG::findIcon("document-encrypted",""), tr("View Checksums"), this, SLOT(ChecksumItems()) ); contextMenu->addSeparator(); @@ -990,8 +987,8 @@ void MainUI::ItemSelectionChanged(){ if(sel.size()>0){ emit Si_AdaptStatusBar(sel, "", tr("Selected Folders"), tr("Files"));} else{ emit Si_AdaptStatusBar(fsmod->rootDirectory().entryInfoList(), getCurrentDir(), tr("Folders"), tr("Files")); } - ui->tool_act_run->setEnabled(sel.length()==1); - ui->tool_act_runwith->setEnabled(sel.length()==1); + ui->tool_act_run->setEnabled(!sel.isEmpty()); + ui->tool_act_runwith->setEnabled(!sel.isEmpty()); ui->tool_act_rm->setEnabled(!sel.isEmpty() && isUserWritable); ui->tool_act_rename->setEnabled(sel.length()==1 && isUserWritable); ui->tool_act_cut->setEnabled(!sel.isEmpty() && isUserWritable); @@ -1293,30 +1290,32 @@ void MainUI::playerFileChanged(){ // Context Menu Actions //---------------------------------- void MainUI::OpenItem(){ - if(CItem.isEmpty()){ - QFileInfoList sel = getSelectedItems(); - if(sel.isEmpty()){ return; } - else{ CItem = sel[0].absoluteFilePath(); } - if(sel[0].isDir()){ OpenDir(); return; } //just in case - open it in a new tab + QFileInfoList sel = getSelectedItems(); + if(sel.isEmpty()){ return; } + + QStringList dirs; + for(int i=0; i<sel.length(); i++){ + if(sel[i].isDir()){ dirs << sel[i].absoluteFilePath(); } + else{ + qDebug() << "Opening File:" << sel[i].absoluteFilePath(); + QProcess::startDetached("lumina-open \""+sel[i].absoluteFilePath()+"\""); + } } - qDebug() << "Opening File:" << CItem; - QProcess::startDetached("lumina-open \""+CItem+"\""); + if(!dirs.isEmpty()){ OpenDirs(dirs); } CItem.clear(); } void MainUI::OpenItemWith(){ - if(CItem.isEmpty()){ - QFileInfoList sel = getSelectedItems(); - if(sel.isEmpty()){ return; } - else{ CItem = sel[0].absoluteFilePath(); } - if(sel[0].isDir()){ OpenDir(); return; } //just in case - open it in a new tab + QFileInfoList sel = getSelectedItems(); + if(sel.isEmpty()){ return; } + for(int i=0; i<sel.length(); i++){ + qDebug() << "Opening File With:" << sel[i].absoluteFilePath(); + QProcess::startDetached("lumina-open -select \""+sel[i].absoluteFilePath()+"\""); } - qDebug() << "Opening File:" << CItem; - QProcess::startDetached("lumina-open -select \""+CItem+"\""); CItem.clear(); } -void MainUI::OpenDir(){ +/*void MainUI::OpenDir(){ if(CItem.isEmpty()){ QFileInfoList sel = getSelectedItems(); if(sel.isEmpty()){ return; } @@ -1324,7 +1323,7 @@ void MainUI::OpenDir(){ } OpenDirs(QStringList() << CItem); CItem.clear(); -} +}*/ void MainUI::RemoveItem(){ //Only let this run if viewing the browser page @@ -1417,13 +1416,13 @@ void MainUI::FavoriteItem(){ } void MainUI::ViewPropertiesItem(){ - if(CItem.isEmpty()){ - QFileInfoList sel = getSelectedItems(); - if(sel.isEmpty()){ return; } - else{ CItem = sel[0].absoluteFilePath(); } + QFileInfoList sel = getSelectedItems(); + if(sel.isEmpty()){ return; } + for(int i=0; i<sel.length(); i++){ + if(sel[i].absoluteFilePath().endsWith(".desktop")){ + QProcess::startDetached("lumina-fileinfo \""+sel[i].absoluteFilePath()+"\""); + } } - QString file = CItem; - QProcess::startDetached("lumina-fileinfo \""+file+"\""); } void MainUI::CutItems(){ |