summaryrefslogtreecommitdiffstats
path: root/pictureviewer2.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2013-10-12 17:14:05 +0200
committerArno <am@disconnect.de>2013-10-12 17:14:05 +0200
commit31a6c7e9afc50c6c3426937d411e21a79fec77e7 (patch)
treeb8976b0d0e6a486d947e25447a0bb14c61637b49 /pictureviewer2.cpp
parent89662ce745c1eee152e7bc2200be5f08caee78a8 (diff)
downloadSheMov-31a6c7e9afc50c6c3426937d411e21a79fec77e7.tar.gz
SheMov-31a6c7e9afc50c6c3426937d411e21a79fec77e7.tar.bz2
SheMov-31a6c7e9afc50c6c3426937d411e21a79fec77e7.zip
Use marked files from PictureViewer2
* Call NewPicsDialog with marked files list * some more keyboard navigation: -> Cursor UP and RIGHT - previous -> Cursor DOWN and LEFT - next -> DELETE - delete file
Diffstat (limited to 'pictureviewer2.cpp')
-rw-r--r--pictureviewer2.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/pictureviewer2.cpp b/pictureviewer2.cpp
index cc7357f..dfb4993 100644
--- a/pictureviewer2.cpp
+++ b/pictureviewer2.cpp
@@ -253,6 +253,9 @@ void PictureViewer2::initActions(){
if(a->data().toInt() == MarkAction){
mMarkA = a;
}
+ if(a->data().toInt() == DeleteAction){
+ mDeleteA = a;
+ }
}
}
@@ -274,7 +277,30 @@ void PictureViewer2::copyCurrent(){
}
}
+void PictureViewer2::deleteCurrent(){
+ int retval = QMessageBox::question(this, tr("Delete file"), tr("Are you sure?"), QMessageBox::No | QMessageBox::Yes);
+ if(retval == QMessageBox::Yes){
+ if(mMarkedFiles.contains(mFiles.at(mCurPos))){
+ mMarkedFiles.removeAll(mFiles.at(mCurPos));
+ }
+ QString fullPath = mFiles.at(mCurPos).at(PicFilesModel::FullPath).toString();
+ QFile f(fullPath);
+ if(f.remove()){
+ mFiles.removeAt(mCurPos);
+ }
+ }
+}
+
void PictureViewer2::showNewPicsDialog(){
+ if(mMarkedFiles.isEmpty()){
+ return;
+ }
+ mNewPicsDlg->clearFiles();
+ QStringList fileList;
+ foreach(QVariantList v, mMarkedFiles){
+ fileList << v.at(PicFilesModel::FullPath).toString();;
+ }
+ mNewPicsDlg->addFiles(fileList);
mNewPicsDlg->exec();
}
@@ -326,12 +352,16 @@ void PictureViewer2::keyPressEvent(QKeyEvent *e){
if(e->key() == Qt::Key_M){
markCurrent();
}
- if(e->key() == Qt::Key_N){
+ if((e->key() == Qt::Key_N) || (e->key() == Qt::Key_Down) || (e->key() == Qt::Key_Right)){
next();
}
- if(e->key() == Qt::Key_P){
+ if((e->key() == Qt::Key_P) || (e->key() == Qt::Key_Up) || (e->key() == Qt::Key_Left)){
previous();
}
+ if(e->key() == Qt::Key_Delete){
+ deleteCurrent();
+ next();
+ }
e->accept();
}