aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils
diff options
context:
space:
mode:
authorWeblate <noreply@weblate.org>2017-08-17 18:50:43 +0000
committerWeblate <noreply@weblate.org>2017-08-17 18:50:43 +0000
commit26fb7116282b20497201802220652b3907acbf3f (patch)
tree0558aeef32e7df82b426459af47b3ece56b69061 /src-qt5/desktop-utils
parentTranslated using Weblate (Catalan) (diff)
parentMerge remote-tracking branch 'origin/master' (diff)
downloadlumina-26fb7116282b20497201802220652b3907acbf3f.tar.gz
lumina-26fb7116282b20497201802220652b3907acbf3f.tar.bz2
lumina-26fb7116282b20497201802220652b3907acbf3f.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src-qt5/desktop-utils')
-rw-r--r--src-qt5/desktop-utils/lumina-archiver/MainUI.cpp10
-rw-r--r--src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp27
-rw-r--r--src-qt5/desktop-utils/lumina-archiver/TarBackend.h2
3 files changed, 28 insertions, 11 deletions
diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp
index 2dae90a4..afead9af 100644
--- a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp
@@ -196,8 +196,8 @@ QString MainUI::OpenFileTypes(){
void MainUI::NewArchive(){
QString file = QFileDialog::getSaveFileName(this, tr("Create Archive"), QDir::homePath(), CreateFileTypes() );
if(file.isEmpty()){ return; }
- if(QFile::exists(file)){
- if( !QFile::remove(file) ){ QMessageBox::warning(this, tr("Error"), QString(tr("Could not overwrite file:"))+"\n"+file); }
+ if(QFile::exists(file)){
+ if( !QFile::remove(file) ){ QMessageBox::warning(this, tr("Error"), QString(tr("Could not overwrite file:"))+"\n"+file); }
}
ui->label_progress->setText(""); //just clear it (this action is instant)
BACKEND->loadFile(file);
@@ -267,6 +267,12 @@ void MainUI::extractSelection(){
void MainUI::ViewFile(QTreeWidgetItem *it){
if(it->childCount()>0){ return; } //directory - not viewable
+ /*QString newfile = QDir::tempPath()+"/"+it->whatsThis(0).section("/",-1);
+ if(QFile::exists(newfile)){
+ if(QMessageBox::Yes != QMessageBox::question(this, tr("File exists"), tr("A temporary file with the same name already exists, do you want to overwrite it?")+"\n\n"+newfile, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
+ return; //cancelled
+ }
+ }*/
ui->label_progress->setText(tr("Extracting..."));
BACKEND->startViewFile(it->whatsThis(0));
}
diff --git a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp
index c0d3b03e..9fe735a3 100644
--- a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp
+++ b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp
@@ -8,6 +8,8 @@
#include <QFile>
#include <QDir>
#include <QDebug>
+#include <QDateTime>
+#include <QCoreApplication>
Backend::Backend(QObject *parent) : QObject(parent){
//Setup the backend process
@@ -38,8 +40,8 @@ void Backend::loadFile(QString path){
}
bool Backend::canModify(){
- static QStringList validEXT;
- if( validEXT.isEmpty() ){
+ static QStringList validEXT;
+ if( validEXT.isEmpty() ){
validEXT << ".zip" << ".tar.gz" << ".tgz" << ".tar.xz" << ".txz" << ".tar.bz" << ".tbz" << ".tar.bz2" << ".tbz2" << ".tar" \
<< ".tar.lzma" << ".tlz" << ".cpio" << ".pax" << ".ar" << ".shar" << ".7z";
}
@@ -95,16 +97,16 @@ void Backend::startAdd(QStringList paths){
QStringList args;
args << "-c" << "-a";
args << flags;
- //Now setup the parent dir
+ //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);
+ 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); }
}
args << "-C" << parent;
args << paths;
if(QFile::exists(filepath)){ //append to existing
- args.replaceInStrings(filepath, tmpfilepath);
+ args.replaceInStrings(filepath, tmpfilepath);
args<< "@"+filepath;
}
STARTING=true;
@@ -151,11 +153,20 @@ void Backend::startExtract(QString path, bool overwrite, QStringList files){
void Backend::startViewFile(QString path){
QStringList args;
+ QString newfilename = QDateTime::currentDateTime().toString("yyyyMMddhhmmss")+"-"+path.section("/",-1);
args << "-x";
- args << flags <<"--include" << path <<"--strip-components" << QString::number(path.count("/")) << "-C" << QDir::tempPath();
+ //args << flags <<"--include" << path <<"--strip-components" << QString::number(path.count("/")) << "-C" << QDir::tempPath();
+ args << flags <<"--include" << path <<"--to-stdout";
STARTING=true;
//qDebug() << "Starting command:" << "tar" << args;
- PROC.start("tar", args);
+ emit ProcessStarting();
+ QProcess tmpProc;
+ tmpProc.setStandardOutputFile(newfilename);
+ tmpProc.start("tar",args);
+ while(!tmpProc.waitForFinished(500)){ QCoreApplication::processEvents(); }
+ emit ProcessFinished(tmpProc.exitCode()==0, "");
+ QProcess::startDetached("xdg-open", QStringList() << newfilename);
+ //PROC.start("tar", args);
}
//===============
diff --git a/src-qt5/desktop-utils/lumina-archiver/TarBackend.h b/src-qt5/desktop-utils/lumina-archiver/TarBackend.h
index 3eb4eb53..dd08361c 100644
--- a/src-qt5/desktop-utils/lumina-archiver/TarBackend.h
+++ b/src-qt5/desktop-utils/lumina-archiver/TarBackend.h
@@ -22,7 +22,7 @@ public:
//Listing routines
QString currentFile();
- bool isWorking(); //is this currently still making changes?
+ bool isWorking(); //is this currently still making changes?
//Contents listing
QStringList heirarchy(); //returns all the file paths within the archive
bgstack15