Allow multiple image selections when adding favicons

This commit is contained in:
Jonathan White 2018-05-30 22:23:39 -04:00
parent 959acb7988
commit b07d4efe5f
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01

View File

@ -325,13 +325,15 @@ void EditWidgetIcons::addCustomIconFromFile()
if (m_database) { if (m_database) {
QString filter = QString("%1 (%2);;%3 (*)").arg(tr("Images"), Tools::imageReaderFilter(), tr("All files")); QString filter = QString("%1 (%2);;%3 (*)").arg(tr("Images"), Tools::imageReaderFilter(), tr("All files"));
QString filename = QFileDialog::getOpenFileName(this, tr("Select Image"), "", filter); auto filenames = QFileDialog::getOpenFileNames(this, tr("Select Image(s)"), "", filter);
if (!filename.isEmpty()) { for (const auto& filename : filenames) {
auto icon = QImage(filename); if (!filename.isEmpty()) {
if (!icon.isNull()) { auto icon = QImage(filename);
addCustomIcon(QImage(filename)); if (!icon.isNull()) {
} else { addCustomIcon(QImage(filename));
emit messageEditEntry(tr("Can't read icon"), MessageWidget::Error); } else {
emit messageEditEntry(tr("Can't read icon"), MessageWidget::Error);
}
} }
} }
} }