Commit 7345a7ad authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Use QIcon over QPixmap and port away from KIconThemes

KIconThemes is half-deprecated and using QIcon instead of QPixmap has benefits since it doesn't make assumptions about what size is needed and moves that responsibility to the view
parent 631c0755
......@@ -40,7 +40,6 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED
Crash
DBusAddons
I18n
IconThemes
JobWidgets
KIO
Notifications
......@@ -253,7 +252,6 @@ target_link_libraries(kgpg_lib
KF5::Crash
KF5::DBusAddons
KF5::I18n
KF5::IconThemes
KF5::JobWidgets
KF5::KIOCore
KF5::KIOFileWidgets
......
......@@ -22,7 +22,6 @@
#include "images.h"
#include <QIcon>
#include <KIconLoader>
namespace KgpgCore
{
......@@ -30,75 +29,75 @@ namespace KgpgCore
namespace Images
{
QPixmap single()
QIcon single()
{
static QPixmap single;
static QIcon single;
if (single.isNull())
single = QIcon::fromTheme(QStringLiteral("key-single")).pixmap(IconSize(KIconLoader::Small));
single = QIcon::fromTheme(QStringLiteral("key-single"));
return single;
}
QPixmap pair()
QIcon pair()
{
static QPixmap pair;
static QIcon pair;
if (pair.isNull())
pair = QIcon::fromTheme(QStringLiteral("key-pair")).pixmap(IconSize(KIconLoader::Small));
pair = QIcon::fromTheme(QStringLiteral("key-pair"));
return pair;
}
QPixmap group()
QIcon group()
{
static QPixmap group;
static QIcon group;
if (group.isNull())
group = QIcon::fromTheme(QStringLiteral("key-group")).pixmap(IconSize(KIconLoader::Small));
group = QIcon::fromTheme(QStringLiteral("key-group"));
return group;
}
QPixmap orphan()
QIcon orphan()
{
static QPixmap oprpan;
static QIcon oprpan;
if (oprpan.isNull())
oprpan = QIcon::fromTheme(QStringLiteral("key-orphan")).pixmap(IconSize(KIconLoader::Small));
oprpan = QIcon::fromTheme(QStringLiteral("key-orphan"));
return oprpan;
}
QPixmap signature()
QIcon signature()
{
static QPixmap signature;
static QIcon signature;
if (signature.isNull())
signature = QIcon::fromTheme(QStringLiteral("application-pgp-signature")).pixmap(IconSize(KIconLoader::Small));
signature = QIcon::fromTheme(QStringLiteral("application-pgp-signature"));
return signature;
}
QPixmap userId()
QIcon userId()
{
static QPixmap userid;
static QIcon userid;
if (userid.isNull())
userid = QIcon::fromTheme(QStringLiteral("x-office-contact")).pixmap(IconSize(KIconLoader::Small));
userid = QIcon::fromTheme(QStringLiteral("x-office-contact"));
return userid;
}
QPixmap photo()
QIcon photo()
{
static QPixmap photo;
static QIcon photo;
if (photo.isNull())
photo = QIcon::fromTheme(QStringLiteral("image-x-generic")).pixmap(IconSize(KIconLoader::Small));
photo = QIcon::fromTheme(QStringLiteral("image-x-generic"));
return photo;
}
QPixmap revoke()
QIcon revoke()
{
static QPixmap revoke;
static QIcon revoke;
if (revoke.isNull())
revoke = QIcon::fromTheme(QStringLiteral("dialog-error")).pixmap(IconSize(KIconLoader::Small));
revoke = QIcon::fromTheme(QStringLiteral("dialog-error"));
return revoke;
}
QPixmap kgpg()
QIcon kgpg()
{
static QPixmap kgpg;
static QIcon kgpg;
if (kgpg.isNull())
kgpg = QIcon::fromTheme(QStringLiteral("kgpg")).pixmap(IconSize(KIconLoader::Desktop));
kgpg = QIcon::fromTheme(QStringLiteral("kgpg"));
return kgpg;
}
......
......@@ -22,24 +22,24 @@
#ifndef IMAGES_H
#define IMAGES_H
#include <QPixmap>
#include <QIcon>
namespace KgpgCore
{
namespace Images
{
QPixmap single();
QPixmap pair();
QPixmap group();
QPixmap orphan();
QPixmap signature();
QPixmap userId();
QPixmap photo();
QPixmap revoke();
QIcon single();
QIcon pair();
QIcon group();
QIcon orphan();
QIcon signature();
QIcon userId();
QIcon photo();
QIcon revoke();
/* Desktop image */
QPixmap kgpg();
QIcon kgpg();
}
} // namespace KgpgCore
......
......@@ -109,8 +109,6 @@ kgpgOptions::kgpgOptions(QWidget *parent, KGpgItemModel *model)
m_page3->kcfg_EmailSorting->addItem(i18n("Right to left, FQDN first")); ///< KGpgSettings::EnumEmailSorting::FQDNFirst
m_emailSortingIndex = KGpgSettings::emailSorting();
pixkeySingle = Images::single();
pixkeyDouble = Images::pair();
addPage(m_page1, i18n("Encryption"), QLatin1String( "document-encrypt" ));
addPage(m_page2, i18n("Decryption"), QLatin1String( "document-decrypt") );
addPage(m_page3, i18n("Appearance"), QLatin1String( "preferences-desktop-theme" ));
......
......@@ -139,8 +139,6 @@ private:
QString defaultConfigPath;
QString defaultHomePath;
QString defaultBinPath;
QPixmap pixkeySingle;
QPixmap pixkeyDouble;
QColor keyUltimate;
QColor keyGood;
QColor keyExpired;
......
......@@ -33,7 +33,6 @@
#include <KActionCollection>
#include <KConfigGroup>
#include <KIconLoader>
#include <KLocalizedString>
using namespace KgpgCore;
......@@ -57,7 +56,7 @@ KgpgSelectPublicKeyDlg::KgpgSelectPublicKeyDlg(QWidget *parent, KGpgItemModel *m
m_okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
m_detailsButton = new QPushButton(this);
m_detailsButton->setText(i18n("&Options") + QStringLiteral(" >>"));
m_detailsButton->setIcon(QIcon::fromTheme(QStringLiteral("help-about")).pixmap(IconSize(KIconLoader::Toolbar)));
m_detailsButton->setIcon(QIcon::fromTheme(QStringLiteral("help-about")));
connect(m_detailsButton, &QPushButton::clicked, this, &KgpgSelectPublicKeyDlg::toggleDetails);
buttonBox->addButton(m_detailsButton, QDialogButtonBox::ActionRole);
connect(buttonBox, &QDialogButtonBox::accepted, this, &KgpgSelectPublicKeyDlg::accept);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment