mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-03 04:45:19 -05:00
Merge branch '2.0'
This commit is contained in:
commit
c78822f6e6
12 changed files with 120 additions and 14 deletions
|
|
@ -19,6 +19,7 @@
|
|||
#include "ui_EditWidgetIcons.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QImageReader>
|
||||
|
||||
#include "core/Group.h"
|
||||
#include "core/Metadata.h"
|
||||
|
|
@ -129,7 +130,10 @@ void EditWidgetIcons::addCustomIcon()
|
|||
QString filename = QFileDialog::getOpenFileName(
|
||||
this, tr("Select Image"), "", filter);
|
||||
if (!filename.isEmpty()) {
|
||||
QImage image(filename);
|
||||
QImageReader imageReader(filename);
|
||||
// detect from content, otherwise reading fails if file extension is wrong
|
||||
imageReader.setDecideFormatFromContent(true);
|
||||
QImage image = imageReader.read();
|
||||
if (!image.isNull()) {
|
||||
Uuid uuid = Uuid::random();
|
||||
m_database->metadata()->addCustomIconScaled(uuid, image);
|
||||
|
|
@ -139,7 +143,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…
Add table
Add a link
Reference in a new issue