diff options
author | Ken Moore <ken@ixsystems.com> | 2017-11-17 07:28:08 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-11-17 07:28:08 -0500 |
commit | 5312b9161aa82ec8139c73b5f7dddd269120f15d (patch) | |
tree | 18e8b8de2e7dd6ebc8a300784629900fef0ffe0b | |
parent | Minor cleanup. Get icons working on the context menu. (diff) | |
download | lumina-5312b9161aa82ec8139c73b5f7dddd269120f15d.tar.gz lumina-5312b9161aa82ec8139c73b5f7dddd269120f15d.tar.bz2 lumina-5312b9161aa82ec8139c73b5f7dddd269120f15d.zip |
Fix up the visibility of the archive options in lumina-fm.
Also fix the OpenWith launching of applications.
-rw-r--r-- | src-qt5/core/libLumina/LuminaXDG.cpp | 8 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/lumina-fm.pro | 2 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp | 22 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h | 2 |
4 files changed, 26 insertions, 8 deletions
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index 1991a82d..b4954a26 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -237,8 +237,9 @@ QString XDGDesktop::generateExec(QStringList inputfiles, QString ActionID){ //Does the app need the input files in URL or File syntax? bool URLsyntax = (exec.contains("%u") || exec.contains("%U")); //Adjust the input file formats as needed + //qDebug() << "Got inputfiles:" << inputfiles << URLsyntax; for(int i=0; i<inputfiles.length(); i++){ - bool url = inputfiles[i].contains("://") || inputfiles[i].startsWith("www") || QUrl(inputfiles[i]).isValid(); + bool url = inputfiles[i].startsWith("www") || inputfiles[i].contains("://"); //Run it through the QUrl class to catch/fix any URL syntax issues if(URLsyntax){ if(inputfiles[i].startsWith("mailto:") ){} //don't touch this syntax - already formatted @@ -246,11 +247,14 @@ QString XDGDesktop::generateExec(QStringList inputfiles, QString ActionID){ else{ inputfiles[i] = QUrl::fromLocalFile(inputfiles[i]).url(); } }else{ //if(inputfiles[i].startsWith("mailto:") ){} //don't touch this syntax - already formatted + //qDebug() << "Need local format:" << inputfiles[i] << url; if(url){ inputfiles[i] = QUrl(inputfiles[i]).toLocalFile(); } - else{ inputfiles[i] = QUrl::fromLocalFile(inputfiles[i]).toLocalFile(); } + else{ inputfiles[i] = inputfiles[i]; } //QUrl::fromLocalFile(inputfiles[i]).toLocalFile(); } } } + inputfiles.removeAll(""); //just in case any empty ones get through //Now to the exec replacements as needed + //qDebug() << "Generate Exec:" << exec << inputfiles; if(exec.contains("%f")){ if(inputfiles.isEmpty()){ exec.replace("%f",""); } else{ exec.replace("%f", "\""+inputfiles.first()+"\""); } //Note: can only take one input diff --git a/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro b/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro index e27dad25..349f84c5 100644 --- a/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro +++ b/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro @@ -15,7 +15,7 @@ include(../../core/libLumina/LuminaXDG.pri) include(../../core/libLumina/LuminaSingleApplication.pri) include(../../core/libLumina/LuminaThemes.pri) include(../../core/libLumina/ExternalProcess.pri) -#include(../../core/libLumina/LVideoSurface.pri) +include(../../core/libLumina/XDGMime.pri) include(../../core/libLumina/LVideoLabel.pri) SOURCES += main.cpp \ diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp index 6f384cfa..66c4c237 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp @@ -26,6 +26,7 @@ #include <QFileDialog> #include "../ScrollDialog.h" +#include <XDGMime.h> #define DEBUG 0 extern bool rootmode; @@ -86,7 +87,7 @@ DirWidget::DirWidget(QString objID, QSettings *settings, QWidget *parent) : QWid //Now update the rest of the UI canmodify = false; //initial value contextMenu = new QMenu(this); - cNewMenu = cOpenMenu = cFModMenu = cFViewMenu = cOpenWithMenu = 0; //not created yet + cNewMenu = cOpenMenu = cFModMenu = cFViewMenu = cOpenWithMenu = cArchiveMenu =0; //not created yet connect(contextMenu, SIGNAL(aboutToShow()), this, SLOT(UpdateContextMenu()) ); connect(ui->splitter, SIGNAL(splitterMoved(int,int)), this, SLOT(splitterMoved()) ); @@ -289,6 +290,11 @@ void DirWidget::createMenus(){ cOpenMenu->addAction(LXDG::findIcon("media-slideshow",""), tr("SlideShow"), this, SLOT(openInSlideshow()), kOpSS->key()); cOpenMenu->addAction(LXDG::findIcon("media-playback-start-circled","media-playback-start"), tr("Multimedia Player"), this, SLOT(openMultimedia()), kOpMM->key()); if(LUtils::isValidBinary("qsudo")){ cOpenMenu->addAction(LXDG::findIcon("", ""), tr("Open Current Dir as Root"), this, SLOT(openRootFM())); + + if(cArchiveMenu==0){ cArchiveMenu = new QMenu(this); } + cArchiveMenu->setTitle(tr("Archive Options")); + cArchiveMenu->setIcon( LXDG::findIcon("utilities-file-archiver","application-x-compressed-tar") ); + /* if(cFModMenu==0){ cFModMenu = new QMenu(this); } else{ cFModMenu->clear(); } @@ -560,9 +566,6 @@ void DirWidget::UpdateContextMenu(){ contextMenu->addAction(LXDG::findIcon("edit-rename",""), tr("Rename..."), this, SLOT(renameFiles()), kRename->key() )->setEnabled(canmodify); contextMenu->addAction(LXDG::findIcon("edit-cut",""), tr("Cut Selection"), this, SLOT(cutFiles()), kCut->key() )->setEnabled(canmodify); contextMenu->addAction(LXDG::findIcon("edit-copy",""), tr("Copy Selection"), this, SLOT(copyFiles()), kCopy->key() )->setEnabled(canmodify); - if(LUtils::isValidBinary("lumina-archiver") && sel.length() ==1){ contextMenu->addAction(LXDG::findIcon("archive",""), tr("Auto-Extract"), this, SLOT(autoExtractFiles()), kExtract->key() )->setEnabled(canmodify); } - if(LUtils::isValidBinary("lumina-archiver") && sel.length() >=1){ contextMenu->addAction(LXDG::findIcon("archive",""), tr("Auto-Archive"), this, SLOT(autoArchiveFiles()), kArchive->key() )->setEnabled(canmodify); } - } if( QApplication::clipboard()->mimeData()->hasFormat("x-special/lumina-copied-files") ){ contextMenu->addAction(LXDG::findIcon("edit-paste",""), tr("Paste"), this, SLOT(pasteFiles()), QKeySequence(Qt::CTRL+Qt::Key_V) )->setEnabled(canmodify); @@ -572,6 +575,15 @@ void DirWidget::UpdateContextMenu(){ contextMenu->addAction(LXDG::findIcon("edit-delete",""), tr("Delete Selection"), this, SLOT(removeFiles()), kDel->key() )->setEnabled(canmodify); contextMenu->addSeparator(); } + if(LUtils::isValidBinary("lumina-archiver") && sel.length() >=1 && canmodify){ + cArchiveMenu->clear(); + if(sel.length()==1 && XDGMime::fromFileName(sel[0]).endsWith("-tar") ){ + cArchiveMenu->addAction(LXDG::findIcon("archive",""), tr("Extract Here"), this, SLOT(autoExtractFiles()), kExtract->key() ); + }else{ + cArchiveMenu->addAction(LXDG::findIcon("archive",""), tr("Archive Selection"), this, SLOT(autoArchiveFiles()), kArchive->key() ); + } + contextMenu->addMenu(cArchiveMenu); + } contextMenu->addMenu(cFViewMenu); cFViewMenu->setEnabled(!sel.isEmpty()); @@ -862,6 +874,8 @@ void DirWidget::OpenWithApp(QAction* act){ //Now we need to open the app file, and create the process XDGDesktop desk(act->whatsThis()); QString exec = desk.generateExec(sel); + //qDebug() << "Launch App with selection:" << act->whatsThis() << sel; + //qDebug() << "Generating exec:" << exec; ExternalProcess::launch(exec); } diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h index 5c39d262..a99c64c7 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h @@ -83,7 +83,7 @@ private: QLineEdit *line_dir; //The context menu and associated items - QMenu *contextMenu, *cNewMenu, *cOpenMenu, *cFModMenu, *cFViewMenu, *cOpenWithMenu; + QMenu *contextMenu, *cNewMenu, *cOpenMenu, *cFModMenu, *cFViewMenu, *cOpenWithMenu, *cArchiveMenu; //The keyboard shortcuts for context menu items QShortcut *kZoomIn, *kZoomOut, *kNewFile, *kNewDir, *kNewXDG, *kCut, *kCopy, *kPaste, *kRename, \ |