diff options
-rw-r--r-- | src-qt5/desktop-utils/lumina-archiver/MainUI.cpp | 5 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp | 20 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-archiver/TarBackend.h | 3 |
3 files changed, 23 insertions, 5 deletions
diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp index 79c023dc..47c6bfe1 100644 --- a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp @@ -95,8 +95,9 @@ void MainUI::LoadArguments(QStringList args){ connect(BACKEND, SIGNAL(FileLoaded()), this, SLOT(autoextractFiles()) ); connect(BACKEND, SIGNAL(ExtractSuccessful()), delayClose, SLOT(start()) ); }else if(action==2){ - aaFileList.clear(); - for(int j=1; j<files.length(); j++){ aaFileList << files[j]; } + aaFileList = files; + aaFileList.removeFirst(); + //for(int j=1; j<files.length(); j++){ aaFileList << files[j]; } qDebug() << "AA Files:" << aaFileList; connect(BACKEND, SIGNAL(FileLoaded()), this, SLOT(autoArchiveFiles()) ); connect(BACKEND, SIGNAL(ArchivalSuccessful()), delayClose, SLOT(start()) ); diff --git a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp index f110624b..5338efec 100644 --- a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp +++ b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp @@ -10,6 +10,7 @@ #include <QDebug> #include <QDateTime> #include <QCoreApplication> +#include <QTimer> Backend::Backend(QObject *parent) : QObject(parent){ //Setup the backend process @@ -91,14 +92,23 @@ QString Backend::linkTo(QString file){ //Modification routines void Backend::startAdd(QStringList paths){ - //NOTE: All the "paths" have to have the same parent directory + //if(paths.isEmpty() && !insertQueue.isEmpty()){ paths = insertQueue; } //load the queue if(paths.contains(filepath)){ paths.removeAll(filepath); } if(paths.isEmpty()){ return; } + //NOTE: All the "paths" have to have the same parent directory + //Go through and find all the files that contain the same parent dir, and put the rest into the insertQueue + QString parent = paths[0].section("/",0,-2); + insertQueue.clear(); + for(int i=1; i<paths.length(); i++){ + if(paths[i].section("/",0,-2)!=parent){ + insertQueue << paths.takeAt(i); i--; //push this back a bit for later + } + } + //qDebug() << "Start Archive Insert:" << paths << "Queued:" << insertQueue; QStringList args; args << "-c" << "-a"; args << flags; //Now setup the parent dir - QString parent = paths[0].section("/",0,-2); for(int i=0; i<paths.length(); i++){ paths[i] = paths[i].section(parent,1,-1); if(paths[i].startsWith("/")){ paths[i].remove(0,1); } @@ -262,7 +272,11 @@ void Backend::procFinished(int retcode, QProcess::ExitStatus){ } } if(args.contains("-x")){ result = tr("Extraction Finished"); emit ExtractSuccessful(); } - else if(args.contains("-c")){ result = tr("Modification Finished"); emit ArchivalSuccessful(); } + else if(args.contains("-c")){ + result = tr("Modification Finished"); + if(insertQueue.isEmpty()){ emit ArchivalSuccessful(); } + else{ needupdate = false; QTimer::singleShot(0, this, SLOT(startInsertFromQueue())); } + } if(needupdate){ startList(); } else{ emit ProcessFinished(retcode==0, result); result.clear(); } } diff --git a/src-qt5/desktop-utils/lumina-archiver/TarBackend.h b/src-qt5/desktop-utils/lumina-archiver/TarBackend.h index 183cb610..56a7dcfe 100644 --- a/src-qt5/desktop-utils/lumina-archiver/TarBackend.h +++ b/src-qt5/desktop-utils/lumina-archiver/TarBackend.h @@ -50,10 +50,13 @@ private: QStringList flags; QHash<QString, QStringList> contents; //<filepath, [attributes, size, compressed size] + QStringList insertQueue; + bool LIST, STARTING; void parseLines(QStringList lines); private slots: + void startInsertFromQueue(){ startAdd(insertQueue); } void startList(); void procFinished(int retcode, QProcess::ExitStatus); void processData(); |