diff options
Diffstat (limited to 'src-qt5/desktop-utils/lumina-archiver')
-rw-r--r-- | src-qt5/desktop-utils/lumina-archiver/MainUI.cpp | 17 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-archiver/MainUI.h | 3 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp | 14 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-archiver/TarBackend.h | 1 |
4 files changed, 21 insertions, 14 deletions
diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp index d812d924..43020309 100644 --- a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp @@ -20,6 +20,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->setupUi(this); + auto_extract_close = false; QString title = tr("Archive Manager"); if( getuid()==0){ title.append(" ("+tr("Admin Mode")+")"); } this->setWindowTitle(title); @@ -102,11 +103,13 @@ void MainUI::LoadArguments(QStringList args){ }*/ if(QFile::exists(args[i])){ ui->label_progress->setText(tr("Opening Archive...")); - if(autoExtract){ connect(BACKEND, SIGNAL(fileLoaded()), this, SLOT(autoextractFiles()) ); } + if(autoExtract){ + connect(BACKEND, SIGNAL(FileLoaded()), this, SLOT(autoextractFiles()) ); + connect(BACKEND, SIGNAL(ExtractSuccessful()), this, SLOT(close()) ); + } BACKEND->loadFile(args[i]); ui->actionUSB_Image->setEnabled(args[i].simplified().endsWith(".img")); if(burnIMG){ BurnImgToUSB(); } //Go ahead and launch the burn dialog right away - //else if(autoExtract){ QTimer::singleShot(2000, this, SLOT(autoextractFiles())); } break; } } @@ -375,6 +378,11 @@ void MainUI::ProcStarting(){ } void MainUI::ProcFinished(bool success, QString msg){ + if(ui->label_archive->text()!=BACKEND->currentFile()){ + ui->label_archive->setText(BACKEND->currentFile()); + this->setWindowTitle(BACKEND->currentFile().section("/",-1)); + ui->tree_contents->clear(); + } UpdateTree(); ui->progressBar->setRange(0,0); ui->progressBar->setValue(0); @@ -384,11 +392,6 @@ void MainUI::ProcFinished(bool success, QString msg){ ui->label_progress_icon->setVisible(!msg.isEmpty()); if(success){ ui->label_progress_icon->setPixmap( LXDG::findIcon("task-complete","").pixmap(32,32) );} else{ ui->label_progress_icon->setPixmap( LXDG::findIcon("task-attention","").pixmap(32,32) );} - if(ui->label_archive->text()!=BACKEND->currentFile()){ - ui->label_archive->setText(BACKEND->currentFile()); - this->setWindowTitle(BACKEND->currentFile().section("/",-1)); - ui->tree_contents->clear(); - } QFileInfo info(BACKEND->currentFile()); bool canmodify = info.isWritable(); if(!info.exists()){ canmodify = QFileInfo(BACKEND->currentFile().section("/",0,-2)).isWritable(); } diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.h b/src-qt5/desktop-utils/lumina-archiver/MainUI.h index e37ae1cb..61475fb2 100644 --- a/src-qt5/desktop-utils/lumina-archiver/MainUI.h +++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.h @@ -25,11 +25,12 @@ public: void LoadArguments(QStringList); void loadIcons(); - //QString newdir, dir; + private: Ui::MainUI *ui; Backend *BACKEND; + bool auto_extract_close; QTreeWidgetItem* findItem(QString path, QTreeWidgetItem *start = 0); bool cleanItems(QStringList list, QTreeWidgetItem *start = 0); //returns true if anything gets cleaned diff --git a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp index ad88c8bf..226da9f1 100644 --- a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp +++ b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp @@ -30,14 +30,14 @@ void Backend::loadFile(QString 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; + //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(); qDebug () << "BACKEND LOAD startList has started";} else{ contents.clear(); emit ProcessFinished(true, ""); } - qDebug () << "BACKEND LOAD COMPLETE"; + //qDebug () << "BACKEND LOAD COMPLETE"; } bool Backend::canModify(){ @@ -140,9 +140,9 @@ void Backend::startExtract(QString path, bool overwrite, QString file){ } void Backend::startExtract(QString path, bool overwrite, QStringList files){ - QStringList args; + QStringList args; //this is a new/empty list - no need for the check below (KPM) //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);}} + //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; @@ -225,6 +225,7 @@ void Backend::procFinished(int retcode, QProcess::ExitStatus){ result = tr("Could not read archive"); }else if(result.isEmpty()){ result = tr("Archive Loaded"); + emit FileLoaded(); } emit ProcessFinished((retcode==0), result); result.clear(); @@ -242,6 +243,7 @@ void Backend::procFinished(int retcode, QProcess::ExitStatus){ //Multi-file extract - open the dir instead QProcess::startDetached("xdg-open \""+ args.last()+"\""); //just extracted to a dir - open it now } + }else if(args.contains("-c") && QFile::exists(tmpfilepath)){ if(retcode==0){ QFile::remove(filepath); @@ -250,7 +252,7 @@ void Backend::procFinished(int retcode, QProcess::ExitStatus){ QFile::remove(tmpfilepath); } } - if(args.contains("-x")){ result = tr("Extraction Finished"); } + if(args.contains("-x")){ result = tr("Extraction Finished"); emit ExtractSuccessful(); } else if(args.contains("-c")){ result = tr("Modification Finished"); } 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 ac2cb61f..271efa42 100644 --- a/src-qt5/desktop-utils/lumina-archiver/TarBackend.h +++ b/src-qt5/desktop-utils/lumina-archiver/TarBackend.h @@ -60,6 +60,7 @@ private slots: signals: void FileLoaded(); + void ExtractSuccessful(); void ProcessStarting(); void ProgressUpdate(int, QString); //percentage, text void ProcessFinished(bool, QString); //success, text |