summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2016-10-16 01:04:18 +0200
committerArno <arno@disconnect.de>2016-10-16 01:04:18 +0200
commit6e596a0c4bdbb41962816f96c00cf7c95b6d0cac (patch)
tree200a330ae5b30ca8f002ceb193ac382d7ac0f1f2
parent4bbcd75f1ff29c8dbd9befcbe8913587d35a3ed0 (diff)
downloadSheMov-6e596a0c4bdbb41962816f96c00cf7c95b6d0cac.tar.gz
SheMov-6e596a0c4bdbb41962816f96c00cf7c95b6d0cac.tar.bz2
SheMov-6e596a0c4bdbb41962816f96c00cf7c95b6d0cac.zip
Add Delete to NewPicsDialog
Also fix handling of next picture.
-rw-r--r--newpicsdialog.cpp14
-rw-r--r--newpicsdialog.h2
2 files changed, 15 insertions, 1 deletions
diff --git a/newpicsdialog.cpp b/newpicsdialog.cpp
index a161d8d..d904142 100644
--- a/newpicsdialog.cpp
+++ b/newpicsdialog.cpp
@@ -72,10 +72,13 @@ void NewPicsDialog::setupDlg(){
connect(mCancel, SIGNAL(clicked()), this, SLOT(reject()));
mNext = new QPushButton(tr("Next >"));
connect(mNext, SIGNAL(clicked()), this, SLOT(next()));
+ mDelete = new QPushButton(tr("Delete"));
+ connect(mDelete, SIGNAL(clicked()), this, SLOT(deleteCurrent()));
QHBoxLayout *dlgButtonLayout = new QHBoxLayout;
dlgButtonLayout->addStretch();
dlgButtonLayout->addWidget(mCancel);
dlgButtonLayout->addWidget(mNext);
+ dlgButtonLayout->addWidget(mDelete);
dlgButtonLayout->addWidget(mOk);
//put it together
@@ -163,7 +166,6 @@ void NewPicsDialog::setNextPic(){
QString fp = mFiles.at(mFilesCtr);
setFile(fp);
SmGlobals::instance()->pictureViewer()->setFile(fp);
- ++mFilesCtr;
}
}
@@ -235,8 +237,18 @@ void NewPicsDialog::archive(){
}
}
+void NewPicsDialog::deleteCurrent(){
+ if(mFilesCtr < mFiles.count()){
+ QString fp = mFiles.at(mFilesCtr);
+ QFile::remove(fp);
+ ++mFilesCtr;
+ setNextPic();
+ }
+}
+
void NewPicsDialog::next(){
archive();
+ ++mFilesCtr;
setNextPic();
}
diff --git a/newpicsdialog.h b/newpicsdialog.h
index 79a6acb..5033c79 100644
--- a/newpicsdialog.h
+++ b/newpicsdialog.h
@@ -45,6 +45,7 @@ class NewPicsDialog : public QDialog {
private slots:
void archive();
+ void deleteCurrent();
void writeSettings();
void readSettings();
@@ -61,6 +62,7 @@ class NewPicsDialog : public QDialog {
QPushButton *mOk;
QPushButton *mCancel;
QPushButton *mNext;
+ QPushButton *mDelete;
QSqlDatabase mDb;
QPoint mPos;
QStringList mFiles;