Commit b3eb69d8 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make compile against deprecated methods

parent e8f4409d
Pipeline #171345 passed with stage
in 2 minutes and 49 seconds
......@@ -57,7 +57,7 @@ ecm_setup_version(PROJECT VARIABLE_PREFIX GRANTLEETHEME
########### Targets ###########
ecm_set_disabled_deprecation_versions(QT 5.14.0 KF 5.93.0)
ecm_set_disabled_deprecation_versions(QT 5.14.0 KF 5.94.0)
......
......@@ -43,6 +43,7 @@ target_link_libraries(KF5GrantleeTheme
PRIVATE
KF5::NewStuff
KF5::I18n
KF5::NewStuffWidgets
)
set_target_properties(KF5GrantleeTheme PROPERTIES
VERSION ${GRANTLEETHEME_VERSION}
......
......@@ -13,7 +13,12 @@
#include <KConfigGroup>
#include <KDirWatch>
#include <KLocalizedString>
#include <knewstuffcore_version.h>
#if KNEWSTUFFCORE_VERSION < QT_VERSION_CHECK(5, 94, 0)
#include <KNS3/QtQuickDialogWrapper>
#else
#include <KNSWidgets/Action>
#endif
#include <KSharedConfig>
#include <KToggleAction>
#include <QAction>
......@@ -39,16 +44,21 @@ public:
watch = new KDirWatch(q);
initThemesDirectories(relativePath);
if (KAuthorized::authorize(QStringLiteral("ghns"))) {
#if KNEWSTUFFCORE_VERSION < QT_VERSION_CHECK(5, 94, 0)
downloadThemesAction = new QAction(i18n("Download New Themes..."), q);
downloadThemesAction->setIcon(QIcon::fromTheme(QStringLiteral("get-hot-new-stuff")));
q->connect(downloadThemesAction, &QAction::triggered, q, [this]() {
slotDownloadHeaderThemes();
});
if (actionCollection) {
actionCollection->addAction(QStringLiteral("download_header_themes"), downloadThemesAction);
}
#else
downloadThemesAction = new KNSWidgets::Action(i18n("Download new Templates..."), QString(), q);
menu->addAction(downloadThemesAction);
#endif
separatorAction = new QAction(q);
separatorAction->setSeparator(true);
q->connect(downloadThemesAction, &QAction::triggered, q, [this]() {
slotDownloadHeaderThemes();
});
}
q->connect(watch, &KDirWatch::dirty, q, [this]() {
......@@ -79,7 +89,9 @@ public:
void slotDownloadHeaderThemes()
{
#if KNEWSTUFFCORE_VERSION < QT_VERSION_CHECK(5, 94, 0)
KNS3::QtQuickDialogWrapper(downloadConfigFileName).exec();
#endif
}
void directoryChanged()
......@@ -251,7 +263,9 @@ public:
QString applicationType;
QString defaultDesktopFileName;
#if KNEWSTUFFCORE_VERSION < QT_VERSION_CHECK(5, 94, 0)
QString downloadConfigFileName;
#endif
QStringList themesDirectories;
QMap<QString, GrantleeTheme::Theme> themes;
QVector<KToggleAction *> themesActionList;
......@@ -260,8 +274,11 @@ public:
KActionMenu *menu = nullptr;
KActionCollection *const actionCollection;
QAction *separatorAction = nullptr;
#if KNEWSTUFFCORE_VERSION < QT_VERSION_CHECK(5, 94, 0)
QAction *downloadThemesAction = nullptr;
#else
KNSWidgets::Action *downloadThemesAction = nullptr;
#endif
ThemeManager *const q;
};
}
......@@ -326,7 +343,11 @@ GrantleeTheme::Theme ThemeManager::theme(const QString &themeName)
void ThemeManager::setDownloadNewStuffConfigFile(const QString &configFileName)
{
#if KNEWSTUFFCORE_VERSION < QT_VERSION_CHECK(5, 94, 0)
d->downloadConfigFileName = configFileName;
#else
d->downloadThemesAction->setConfigFile(configFileName);
#endif
}
QString ThemeManager::pathFromThemes(const QString &themesRelativePath, const QString &themeName, const QString &defaultDesktopFileName)
......
Supports Markdown
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