aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-qt5/desktop-utils/lumina-archiver/MainUI.cpp43
-rw-r--r--src-qt5/desktop-utils/lumina-archiver/MainUI.h6
-rw-r--r--src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp15
3 files changed, 55 insertions, 9 deletions
diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp
index ab2b4651..e365ef54 100644
--- a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp
@@ -16,6 +16,8 @@
#include <unistd.h>
+#include <QDebug>
+
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
ui->setupUi(this);
QString title = tr("Archive Manager");
@@ -68,17 +70,35 @@ MainUI::~MainUI(){
void MainUI::LoadArguments(QStringList args){
bool burnIMG = false;
+ bool autoExtract = false;
for(int i=0; i<args.length(); i++){
if(args[i]=="--burn-img"){ burnIMG = true; continue; }
-/*
- if(args[i]=="--ax"){i++; QString archivefile = args[i];
+ if(args[i]=="--ax"){ autoExtract = true; i++;
QFileInfo filename(args[i]);
QDir filedir = filename.canonicalPath();
QString newdir = filename.completeBaseName();
filedir.mkpath(newdir);
- BACKEND->startExtract(newdir, true, archivefile);
- qApp->exit();}
-*/
+ dir = newdir;
+ qDebug() << "MAINUI - archivefile = " << args[i];
+ qDebug() << "MAINUI - filedir = " << filedir;
+ qDebug() << "MAINUI - newdir = " << newdir;
+ qDebug() << "MAINUI - dir = " << dir;
+ BACKEND->loadFile(args[i]);
+ qDebug () << "MAINUI - File should have loaded";
+ //add in a delay in case i'm hitting a race condition
+ QTime waitTime= QTime::currentTime().addSecs(2);
+ while (QTime::currentTime() < waitTime)
+ QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
+ //things should have settled, now trigger extraction
+ if(autoExtract){
+ ui->label_progress->setText(tr("Extracting..."));
+ autoextractFiles();
+ qDebug () << "MAINUI - Extraction should have started";
+ }
+ //now quit
+ QCoreApplication::quit();
+ return;
+ }
if(QFile::exists(args[i])){
ui->label_progress->setText(tr("Opening Archive..."));
BACKEND->loadFile(args[i]);
@@ -245,6 +265,19 @@ void MainUI::extractFiles(){
BACKEND->startExtract(dir, true);
}
+void MainUI::autoextractFiles(){
+// QString dir = QFileDialog::getExistingDirectory(this, tr("Extract Into Directory"), QDir::homePath() );
+// if(dir.isEmpty()){ return; }
+ //add in a delay in case i'm hitting a race condition
+ qDebug() << "void MainUI::autoextractFiles() has started";
+ QTime waitTime= QTime::currentTime().addSecs(2);
+ while (QTime::currentTime() < waitTime)
+ QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
+ ui->label_progress->setText(tr("Extracting..."));
+ BACKEND->startExtract(dir, true);
+// QApplication::quit();
+ }
+
void MainUI::extractSelection(){
if(ui->tree_contents->currentItem()==0){ return; } //nothing selected
QList<QTreeWidgetItem*> sel = ui->tree_contents->selectedItems();
diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.h b/src-qt5/desktop-utils/lumina-archiver/MainUI.h
index 273078ea..78e5d499 100644
--- a/src-qt5/desktop-utils/lumina-archiver/MainUI.h
+++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.h
@@ -24,7 +24,8 @@ public:
~MainUI();
void LoadArguments(QStringList);
- void loadIcons();
+ void loadIcons();
+ QString newdir, dir;
private:
Ui::MainUI *ui;
@@ -43,7 +44,8 @@ private slots:
void addFiles();
void addDirs();
void remFiles();
- void extractFiles();
+ void extractFiles();
+ void autoextractFiles();
void extractSelection();
void ViewFile(QTreeWidgetItem *it);
void UpdateTree();
diff --git a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp
index 0659f8b1..ad88c8bf 100644
--- a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp
+++ b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp
@@ -27,13 +27,17 @@ Backend::~Backend(){
// PUBLIC
//===============
void Backend::loadFile(QString path){
- //qDebug() << "Loading Archive:" << path;
+ qDebug() << "void Backend::loadFile(QString path) has started";
+ qDebug() << "Loading Archive:" << path;
filepath = path;
+ qDebug () << "BACKEND LOAD- " << "path = " << path;
+ qDebug () << "BACKEND LOAD- " << "filepath = " << filepath;
tmpfilepath = filepath.section("/",0,-2)+"/"+".tmp_larchiver_"+filepath.section("/",-1);
flags.clear();
flags << "-f" << filepath; //add the actual archive path
- if(QFile::exists(path)){ startList(); }
+ if(QFile::exists(path)){ startList(); qDebug () << "BACKEND LOAD startList has started";}
else{ contents.clear(); emit ProcessFinished(true, ""); }
+ qDebug () << "BACKEND LOAD COMPLETE";
}
bool Backend::canModify(){
@@ -127,11 +131,18 @@ void Backend::startRemove(QStringList paths){
}
void Backend::startExtract(QString path, bool overwrite, QString file){
+ qDebug () << "BACKEND startExtract -" << "void Backend::startExtract(QString path, bool overwrite, QString file) has started";
+ qDebug () << "BACKEND startExtract -" << "path = " << path;
+ qDebug () << "BACKEND startExtract -" << "overwrite =" << overwrite ;
+ qDebug () << "BACKEND startExtract -" << "file =" << file;
startExtract(path, overwrite, QStringList() << file); //overload for multi-file function
+
}
void Backend::startExtract(QString path, bool overwrite, QStringList files){
QStringList args;
+ //remove --ax arg if its still lingering so its not passed to external process
+ for(int i=0; i<args.length(); i++){ if(args[i]=="--ax"){ args.removeAt(i);}}
args << "-x" << "--no-same-owner";
if(!overwrite){ args << "-k"; }
args << flags;
bgstack15