mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
parent
8ace3ab7f2
commit
6e2de1cd79
@ -19,6 +19,7 @@
|
||||
#include "ui_EditWidgetIcons.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QImageReader>
|
||||
|
||||
#include "core/Group.h"
|
||||
#include "core/Metadata.h"
|
||||
@ -129,7 +130,8 @@ void EditWidgetIcons::addCustomIcon()
|
||||
QString filename = QFileDialog::getOpenFileName(
|
||||
this, tr("Select Image"), "", filter);
|
||||
if (!filename.isEmpty()) {
|
||||
QImage image(filename);
|
||||
QImageReader imageReader(filename);
|
||||
QImage image = imageReader.read();
|
||||
if (!image.isNull()) {
|
||||
Uuid uuid = Uuid::random();
|
||||
m_database->metadata()->addCustomIconScaled(uuid, image);
|
||||
@ -139,7 +141,8 @@ void EditWidgetIcons::addCustomIcon()
|
||||
m_ui->customIconsView->setCurrentIndex(index);
|
||||
}
|
||||
else {
|
||||
// TODO: show error
|
||||
MessageBox::critical(this, tr("Error"),
|
||||
tr("Can't read icon:").append("\n").append(imageReader.errorString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user