From 5a7b6a693fa273aa9244ecaa24332ff67f196a38 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 14 Nov 2017 16:17:38 -0500 Subject: Enable the auto-archive functionality in lumina-fm. --- src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp | 17 ++++++++++------- src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h | 6 +++--- 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src-qt5') diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp index 5c6f9ef5..6e69adda 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "../ScrollDialog.h" @@ -245,7 +246,7 @@ void DirWidget::createShortcuts(){ kPaste= new QShortcut(QKeySequence(QKeySequence::Paste),this); kRename= new QShortcut(QKeySequence(Qt::Key_F2),this); kExtract= new QShortcut(QKeySequence(Qt::CTRL+Qt::Key_E), this); - //kArchive= new QShortcut(QKeySequence(Qt::CTRL+Qt::Key_R), this); + kArchive= new QShortcut(QKeySequence(Qt::CTRL+Qt::Key_R), this); kFav= new QShortcut(QKeySequence(Qt::Key_F3),this); kDel= new QShortcut(QKeySequence(QKeySequence::Delete),this); kOpSS= new QShortcut(QKeySequence(Qt::Key_F6),this); @@ -560,7 +561,7 @@ void DirWidget::UpdateContextMenu(){ 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(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") ){ @@ -864,13 +865,15 @@ void DirWidget::autoExtractFiles(){ ExternalProcess::launch("lumina-archiver", QStringList() << "--ax" << files); } -/* - * void DirWidget::autoArchiveFiles(){ + +void DirWidget::autoArchiveFiles(){ QStringList files = currentBrowser()->currentSelection(); - qDebug() << "Starting auto-archival:" << files; - ExternalProcess::launch("lumina-archiver", QStringList() << "--aa" << files); + QString archive = QFileDialog::getSaveFileName(this, tr("Select Archive"), currentBrowser()->currentDirectory()+"/archive-"+QDateTime::currentDateTime().toString("yyyyMMdd_hhmm")+".tar.gz", currentBrowser()->currentDirectory()); + if(archive.isEmpty()){ return; } //cancelled + qDebug() << "Starting auto-archival:" << archive << files; + ExternalProcess::launch("lumina-archiver", QStringList() << "--aa" << archive << files); } -*/ + //==================== // PROTECTED diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h index 4377f92d..a8e535d0 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h @@ -87,7 +87,7 @@ private: //The keyboard shortcuts for context menu items QShortcut *kZoomIn, *kZoomOut, *kNewFile, *kNewDir, *kNewXDG, *kCut, *kCopy, *kPaste, *kRename, \ - *kFav, *kDel, *kOpSS, *kOpMM, *kOpTerm, *kExtract; //, *kArchive; + *kFav, *kDel, *kOpSS, *kOpMM, *kOpTerm, *kExtract, *kArchive; //Functions for internal use void createShortcuts(); //on init only @@ -129,7 +129,7 @@ private slots: void fileCheckSums(); void fileProperties(); void openTerminal(); - void openRootFM(); + void openRootFM(); //Browser Functions @@ -158,7 +158,7 @@ private slots: void runWithFiles(); //void attachToNewEmail(); void autoExtractFiles(); - //void autoArchiveFiles(); + void autoArchiveFiles(); // - Context-specific operations void openInSlideshow(); -- cgit