Commit c6f81eb5 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Port away from KIconThemes

Summary:
IconSize is deprecated.

Using the "Desktop" icon size was somewhat arbitrary. There is no QStyle pixelmetric that offers the same size and fits semantically.

Test Plan: Side panel, properties dialog and extraction dialog look the same

Reviewers: #ark, davidedmundson

Reviewed By: davidedmundson

Subscribers: kde-utils-devel

Tags: #ark

Maniphest Tasks: T11637

Differential Revision: https://phabricator.kde.org/D26370
parent 8e436fad
......@@ -42,7 +42,6 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Archive
DBusAddons
DocTools
I18n
IconThemes
ItemModels
KIO
Service
......
......@@ -57,7 +57,6 @@ endif()
target_link_libraries(kerfuffle
PUBLIC
KF5::IconThemes
KF5::Pty
KF5::I18n
KF5::WidgetsAddons
......
......@@ -31,7 +31,6 @@
#include <KDirOperator>
#include <KLocalizedString>
#include <KIconLoader>
#include <KMessageBox>
#include <KUrlComboBox>
#include <KWindowConfig>
......@@ -83,7 +82,7 @@ ExtractionDialog::ExtractionDialog(QWidget *parent)
m_ui = new ExtractionDialogUI(this);
hlayout->addWidget(m_ui);
m_ui->iconLabel->setPixmap(QIcon::fromTheme(QStringLiteral("archive-extract")).pixmap(IconSize(KIconLoader::Desktop), IconSize(KIconLoader::Desktop)));
m_ui->iconLabel->setPixmap(QIcon::fromTheme(QStringLiteral("archive-extract")).pixmap(48));
m_ui->filesToExtractGroupBox->hide();
m_ui->allFilesButton->setChecked(true);
......
......@@ -37,7 +37,6 @@
#include <QFutureWatcher>
#include <QIcon>
#include <KIconLoader>
#include <KIO/Global>
namespace Kerfuffle
......@@ -102,7 +101,7 @@ PropertiesDialog::PropertiesDialog(QWidget *parent, Archive *archive, qulonglong
// Show an icon representing the mimetype of the archive.
QIcon icon = QIcon::fromTheme(archive->mimeType().iconName());
m_ui->lblIcon->setPixmap(icon.pixmap(IconSize(KIconLoader::Desktop), IconSize(KIconLoader::Desktop)));
m_ui->lblIcon->setPixmap(icon.pixmap(48));
m_ui->lblMD5->setText(i18n("Calculating..."));
m_ui->lblSHA1->setText(i18n("Calculating..."));
......
......@@ -24,7 +24,6 @@
#include <KLocalizedString>
#include <KMimeTypeTrader>
#include <KIconLoader>
#include <KMessageBox>
#include <KParts/ReadOnlyPart>
#include <KParts/OpenUrlArguments>
......@@ -35,6 +34,7 @@
#include <QMimeDatabase>
#include <QProgressDialog>
#include <QPushButton>
#include <QStyle>
#include <algorithm>
......@@ -172,7 +172,7 @@ bool ArkViewer::viewInInternalViewer(const QString& fileName, const QMimeType &m
setWindowFilePath(fileName);
// Set icon and comment for the mimetype.
m_iconLabel->setPixmap(QIcon::fromTheme(mimeType.iconName()).pixmap(IconSize(KIconLoader::Small), IconSize(KIconLoader::Small)));
m_iconLabel->setPixmap(QIcon::fromTheme(mimeType.iconName()).pixmap(style()->pixelMetric(QStyle::PixelMetric::PM_SmallIconSize)));
m_commentLabel->setText(mimeType.comment());
// Create the ReadOnlyPart instance.
......
......@@ -24,7 +24,6 @@
#include <KIO/Global>
#include <KLocalizedString>
#include <KIconLoader>
#include <QFileInfo>
#include <QIcon>
......@@ -32,9 +31,9 @@
using namespace Kerfuffle;
static QPixmap getDesktopIconForName(const QString& name)
QPixmap InfoPanel::getPixmap(const QString& name)
{
return QIcon::fromTheme(name).pixmap(IconSize(KIconLoader::Desktop), IconSize(KIconLoader::Desktop));
return QIcon::fromTheme(name).pixmap(48);
}
InfoPanel::InfoPanel(ArchiveModel *model, QWidget *parent)
......@@ -60,7 +59,7 @@ InfoPanel::~InfoPanel()
void InfoPanel::updateWithDefaults()
{
iconLabel->setPixmap(getDesktopIconForName(QStringLiteral("utilities-file-archiver")));
iconLabel->setPixmap(getPixmap(QStringLiteral("utilities-file-archiver")));
const QString currentFileName = prettyFileName();
......@@ -109,7 +108,7 @@ void InfoPanel::setIndex(const QModelIndex& index)
mimeType = db.mimeTypeForFile(entry->fullPath(), QMimeDatabase::MatchExtension);
}
iconLabel->setPixmap(getDesktopIconForName(mimeType.iconName()));
iconLabel->setPixmap(getPixmap(mimeType.iconName()));
if (entry->isDir()) {
uint dirs;
uint files;
......@@ -141,7 +140,7 @@ void InfoPanel::setIndexes(const QModelIndexList &list)
} else if (list.size() == 1) {
setIndex(list[ 0 ]);
} else {
iconLabel->setPixmap(getDesktopIconForName(QStringLiteral("utilities-file-archiver")));
iconLabel->setPixmap(getPixmap(QStringLiteral("utilities-file-archiver")));
fileName->setText(i18np("One file selected", "%1 files selected", list.size()));
quint64 totalSize = 0;
for (const QModelIndex& index : list) {
......
......@@ -65,6 +65,8 @@ private:
void showMetaDataFor(const QModelIndex &index);
QPixmap getPixmap(const QString& name);
ArchiveModel *m_model;
QString m_prettyFileName;
};
......
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