[graphics/kphotoalbum/import_requires_an_image] ImportExport: Refactor.
Randall Rude <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 7d55040b2424b852928a312995870fcbd6ee2138 by Randall Rude.
Committed on 17/08/2026 at 02:37.
Pushed by rsquared into branch 'import_requires_an_image'.
Refactor.
M +10 -14 ImportExport/ImportDialog.cpp
M +8 -3 ImportExport/ImportDialog.h
https://invent.kde.org/graphics/kphotoalbum/-/commit/7d55040b2424b852928a312995870fcbd6ee2138
diff --git a/ImportExport/ImportDialog.cpp b/ImportExport/ImportDialog.cpp
index 5760ede34..6de272bf7 100644
--- a/ImportExport/ImportDialog.cpp
+++ b/ImportExport/ImportDialog.cpp
@@ -158,8 +158,12 @@ void ImportDialog::createImagesPage()
QPushButton *selectNone = new QPushButton(i18n("Deselect All"), container);
lay2->addWidget(selectNone);
lay2->addStretch(1);
- connect(selectAll, &QPushButton::clicked, this, &ImportDialog::slotSelectAll);
- connect(selectNone, &QPushButton::clicked, this, &ImportDialog::slotSelectNone);
+ connect(selectAll, &QPushButton::clicked, this, [=, this]() {
+ selectAllImages(true);
+ });
+ connect(selectNone, &QPushButton::clicked, this, [=, this]() {
+ selectAllImages(false);
+ });
QGridLayout *lay3 = new QGridLayout;
lay1->addLayout(lay3);
@@ -345,23 +349,15 @@ void ImportDialog::next()
KAssistantDialog::next();
}
-void ImportDialog::slotSelectAll()
-{
- selectImages(true);
- setValid(m_selectImagesPage, true);
-}
-
-void ImportDialog::slotSelectNone()
+void ImportDialog::selectAllImages(bool on)
{
- selectImages(false);
- setValid(m_selectImagesPage, false);
-}
+ Q_ASSERT (currentPage() == m_selectImagesPage);
-void ImportDialog::selectImages(bool on)
-{
for (ImageRow *row : std::as_const(m_imagesSelect)) {
row->m_checkbox->setChecked(on);
}
+
+ setValid(m_selectImagesPage, on);
}
DB::ImageInfoList ImportDialog::selectedImages() const
diff --git a/ImportExport/ImportDialog.h b/ImportExport/ImportDialog.h
index fc90abdaf..00ea743ed 100644
--- a/ImportExport/ImportDialog.h
+++ b/ImportExport/ImportDialog.h
@@ -52,7 +52,6 @@ protected:
void createDestination();
void createCategoryPages();
ImportMatcher *createCategoryPage(const QString &myCategory, const QString &otherCategory);
- void selectImages(bool on);
DB::ImageInfoList selectedImages() const;
void possiblyAddMD5CheckPage();
@@ -60,14 +59,20 @@ protected Q_SLOTS:
void slotEditDestination();
void updateNextButtonState();
void next() override;
- void slotSelectAll();
- void slotSelectNone();
void slotHelp();
Q_SIGNALS:
void failedToCopy(QStringList files);
private:
+ /**
+ * Selects or unselects all image selectors on the image selection page,
+ * and disables the Next button if no images are selected.
+ *
+ * @param on means select all images if true and unselect all images if false
+ */
+ void selectAllImages(bool on);
+
DB::ImageInfoList m_images;
QLineEdit *m_destinationEdit = nullptr;
KPageWidgetItem *m_destinationPage = nullptr;