Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit fdfb4878 authored by Cyril Rossi's avatar Cyril Rossi

Merge branch 'Plasma/5.18'

parents 24e4e15b 9bbd2645
......@@ -18,16 +18,17 @@
#include "iconsizecategorymodel.h"
#include <KLocalizedString>
#include <KIconLoader>
IconSizeCategoryModel::IconSizeCategoryModel(QObject *parent)
: QAbstractListModel(parent)
, m_data({
{QStringLiteral("desktopSize"), I18N_NOOP("Desktop"), QStringLiteral("Desktop")},
{QStringLiteral("toolbarSize"), I18N_NOOP("Toolbar"), QStringLiteral("Toolbar")},
{QStringLiteral("mainToolbarSize"), I18N_NOOP("Main Toolbar"), QStringLiteral("MainToolbar")},
{QStringLiteral("smallSize"), I18N_NOOP("Small Icons"), QStringLiteral("Small")},
{QStringLiteral("panelSize"), I18N_NOOP("Panel"), QStringLiteral("Panel")},
{QStringLiteral("dialogSize"), I18N_NOOP("Dialogs"), QStringLiteral("Dialog")}
{QStringLiteral("desktopSize"), I18N_NOOP("Desktop"), QStringLiteral("Desktop"), KIconLoader::Desktop},
{QStringLiteral("toolbarSize"), I18N_NOOP("Toolbar"), QStringLiteral("Toolbar"), KIconLoader::Toolbar},
{QStringLiteral("mainToolbarSize"), I18N_NOOP("Main Toolbar"), QStringLiteral("MainToolbar"), KIconLoader::MainToolbar},
{QStringLiteral("smallSize"), I18N_NOOP("Small Icons"), QStringLiteral("Small"), KIconLoader::Small},
{QStringLiteral("panelSize"), I18N_NOOP("Panel"), QStringLiteral("Panel"), KIconLoader::Panel},
{QStringLiteral("dialogSize"), I18N_NOOP("Dialogs"), QStringLiteral("Dialog"), KIconLoader::Dialog}
})
{
}
......@@ -58,6 +59,8 @@ QVariant IconSizeCategoryModel::data(const QModelIndex &index, int role) const
return item.configKey;
case ConfigSectionRole:
return item.configSection;
case KIconLoaderGroupRole:
return item.kIconloaderGroup;
}
return QVariant();
......@@ -68,5 +71,6 @@ QHash<int, QByteArray> IconSizeCategoryModel::roleNames() const
QHash<int, QByteArray> roleNames = QAbstractListModel::roleNames();
roleNames[ConfigKeyRole] = QByteArrayLiteral("configKey");
roleNames[ConfigSectionRole] = QByteArrayLiteral("configSectionRole");
roleNames[KIconLoaderGroupRole] = QByteArrayLiteral("KIconLoaderGroup");
return roleNames;
}
......@@ -27,6 +27,7 @@ struct IconSizeCategoryModelData
QString configKey;
QString display;
QString configSection;
int kIconloaderGroup;
};
Q_DECLARE_TYPEINFO(IconSizeCategoryModelData, Q_MOVABLE_TYPE);
......@@ -41,7 +42,8 @@ public:
enum Roles {
ConfigKeyRole = Qt::UserRole + 1,
ConfigSectionRole
ConfigSectionRole,
KIconLoaderGroupRole,
};
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
......
......@@ -140,6 +140,16 @@ void IconModule::save()
{
bool needToExportToKDE4 = m_settings->isSaveNeeded();
// keep track of Group of icons size that has changed
QList<int> notifyList;
for (int i = 0; i < m_iconSizeCategoryModel->rowCount(); ++i) {
const QModelIndex index = m_iconSizeCategoryModel->index(i, 0);
const QString key = index.data(IconSizeCategoryModel::ConfigKeyRole).toString();
if (m_settings->findItem(key)->isSaveNeeded()) {
notifyList << index.data(IconSizeCategoryModel::KIconLoaderGroupRole).toInt();
}
}
ManagedConfigModule::save();
if (needToExportToKDE4) {
......@@ -148,7 +158,10 @@ void IconModule::save()
processPendingDeletions();
KIconLoader::global()->newIconLoader();
// Notify the group(s) where icon sizes have changed
for (auto group : qAsConst(notifyList)) {
KIconLoader::emitChange(KIconLoader::Group(group));
}
}
bool IconModule::isSaveNeeded() const
......@@ -286,10 +299,8 @@ void IconModule::exportToKDE4()
QFile::remove(path);
}
//message kde4 apps that icon theme is changed
//message kde4 apps that icon theme has changed
for (int i = 0; i < KIconLoader::LastGroup; i++) {
KIconLoader::emitChange(KIconLoader::Group(i));
QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KGlobalSettings"),
QStringLiteral("org.kde.KGlobalSettings"),
QStringLiteral("notifyChange"));
......
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