From 6e596a0c4bdbb41962816f96c00cf7c95b6d0cac Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 16 Oct 2016 01:04:18 +0200 Subject: Add Delete to NewPicsDialog Also fix handling of next picture. --- newpicsdialog.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'newpicsdialog.cpp') 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(); } -- cgit v1.2.3-70-g09d2