fix(ScreenshotsPage): disable "Copy Image" when selecting multiple screenshots

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2026-04-13 23:13:28 +05:00
parent 7a1d2e41a1
commit 08de904e21
No known key found for this signature in database
GPG key ID: B77C34313AEE1FFF

View file

@ -360,12 +360,14 @@ void ScreenshotsPage::onItemActivated(QModelIndex index) const
DesktopServices::openPath(info); DesktopServices::openPath(info);
} }
void ScreenshotsPage::onCurrentSelectionChanged(const QItemSelection& selected) const void ScreenshotsPage::onCurrentSelectionChanged(const QItemSelection& /*selected*/) const
{ {
const auto selected = ui->listView->selectionModel()->selectedIndexes();
bool allReadable = !selected.isEmpty(); bool allReadable = !selected.isEmpty();
bool allWritable = !selected.isEmpty(); bool allWritable = !selected.isEmpty();
for (auto index : selected.indexes()) { for (auto index : selected) {
if (!index.isValid()) { if (!index.isValid()) {
break; break;
} }
@ -379,7 +381,7 @@ void ScreenshotsPage::onCurrentSelectionChanged(const QItemSelection& selected)
} }
ui->actionUpload->setEnabled(allReadable); ui->actionUpload->setEnabled(allReadable);
ui->actionCopy_Image->setEnabled(allReadable); ui->actionCopy_Image->setEnabled(allReadable && selected.size() == 1);
ui->actionCopy_File_s->setEnabled(allReadable); ui->actionCopy_File_s->setEnabled(allReadable);
ui->actionDelete->setEnabled(allWritable); ui->actionDelete->setEnabled(allWritable);
ui->actionRename->setEnabled(allWritable); ui->actionRename->setEnabled(allWritable);