diff options
author | Arno <arno@disconnect.de> | 2018-03-30 11:04:10 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2018-03-30 11:04:10 +0200 |
commit | e932aafaa203f70c9be29879fc17bde9d2ac53c2 (patch) | |
tree | df9c410cbe048545a880da2db91a3923b2203e90 /filesystemwidget.cpp | |
parent | 5df1e778010b5529e9ea37d901c2ce6063abccb3 (diff) | |
download | SheMov-e932aafaa203f70c9be29879fc17bde9d2ac53c2.tar.gz SheMov-e932aafaa203f70c9be29879fc17bde9d2ac53c2.tar.bz2 SheMov-e932aafaa203f70c9be29879fc17bde9d2ac53c2.zip |
Add untar action
tries to tar xf selected files. If tar was successful, the archive is
deleted. Should make archiving pics a bit easier.
Diffstat (limited to 'filesystemwidget.cpp')
-rw-r--r-- | filesystemwidget.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp index 5141c01..94455f3 100644 --- a/filesystemwidget.cpp +++ b/filesystemwidget.cpp @@ -613,6 +613,20 @@ void FilesystemWidget::unpack(){ mUnpackDlg->doIt(); } +void FilesystemWidget::untar(){ + QModelIndexList selectedIdxs = mFileView->selectionModel()->selectedRows(); + for(const QModelIndex &idx : selectedIdxs){ + QFileInfo fi(idx.data(SmDirModel::FullPathRole).toString()); + QString cmdStr = QString("/usr/bin/tar -C %1 -xf %2").arg(fi.absolutePath()).arg(idx.data(SmDirModel::FullPathRole).toString()); + int retval = QProcess::execute(cmdStr); + if(retval == 0){ + QFile::remove(idx.data(SmDirModel::FullPathRole).toString()); + } + QString msg = QString(tr("Executed %1: %2")).arg(cmdStr).arg(QString::number(retval)); + emit statusbarMessage(msg); + } +} + void FilesystemWidget::selectUnpackDir(){ QSettings s; QString unpackDir = s.value("paths/unpackpath").toString(); |