From f187db1e86b84b76c5f83d36e2bd153893178d16 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 22 Nov 2013 13:03:29 +0100 Subject: [PATCH] Remove KDE4Support dependency from plasma-frameworks (almost) Stop using classes from kde4support: - KComponentData is deprecated, it will be using QCoreApplication:: applicationName() and QCoreApplication::applicationVersion(). Of course, this means that the existing shells will have to be ported. I have no problem with doing that port myself, if I'm told where to look into. - Drop usage of KLocale, ported to QLocale - Drop usage of KStandardDirs, ported to QStandardPaths - Drop usage of KIcon, ported to QIcon Furthermore, there's a module in src/declarativeimports/locale that IIUC exposes KLocale bindings to QML. A specific plan to port it should happen as well. REVIEW: 113920 --- CMakeLists.txt | 10 +--------- src/declarativeimports/core/tests/CMakeLists.txt | 1 - .../core/tests/sortfiltermodeltest.cpp | 2 +- src/declarativeimports/locale/CMakeLists.txt | 8 +------- .../qtextracomponents/tests/CMakeLists.txt | 1 - src/plasma/CMakeLists.txt | 1 - src/plasma/private/dataenginemanager.cpp | 2 +- src/shell/CMakeLists.txt | 1 - src/shell/activity.cpp | 5 ++--- src/shell/scripting/appinterface.cpp | 2 +- src/shell/scripting/scriptengine.cpp | 2 +- src/shell/shellcorona.cpp | 2 +- 12 files changed, 9 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9da457a6..34390a868 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,15 +45,7 @@ find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Quick X11Extras Sql UiTools Qml W find_package(KF5 CONFIG REQUIRED KIdleTime ItemModels KWidgetsAddons KWindowSystem KCodecs KArchive KCoreAddons Solid ThreadWeaver KConfig KAuth KJS KWallet KDBusAddons KI18n KGuiAddons KConfigWidgets KService ItemViews KNotifications KIconThemes KCompletion KJobWidgets KConfigWidgets Sonnet KTextWidgets XmlGui KCrash - KBookmarks KDeclarative KUnitConversion Kross KParts) - -# those are not "done" yet: -find_package(KIO REQUIRED NO_MODULE) - -find_package(KDE4Support REQUIRED NO_MODULE) - -#the shell needs kactivities -find_package(KActivities REQUIRED NO_MODULE) + KBookmarks KDeclarative KUnitConversion Kross KParts KIO KActivities) #optional features find_package(X11 MODULE) diff --git a/src/declarativeimports/core/tests/CMakeLists.txt b/src/declarativeimports/core/tests/CMakeLists.txt index da0dbc55e..0a90003eb 100644 --- a/src/declarativeimports/core/tests/CMakeLists.txt +++ b/src/declarativeimports/core/tests/CMakeLists.txt @@ -15,7 +15,6 @@ target_link_libraries(sortfiltermodeltest Plasma Qt5::Gui Qt5::Test - KF5::KDE4Support KF5::KI18n Qt5::Qml ) diff --git a/src/declarativeimports/core/tests/sortfiltermodeltest.cpp b/src/declarativeimports/core/tests/sortfiltermodeltest.cpp index 93ffba4d3..f59da38b5 100644 --- a/src/declarativeimports/core/tests/sortfiltermodeltest.cpp +++ b/src/declarativeimports/core/tests/sortfiltermodeltest.cpp @@ -30,7 +30,7 @@ using namespace Plasma; -QTEST_KDEMAIN(SortFilterModelTest, GUI) +QTEST_MAIN(SortFilterModelTest) void SortFilterModelTest::setModel() { diff --git a/src/declarativeimports/locale/CMakeLists.txt b/src/declarativeimports/locale/CMakeLists.txt index 6aecb841d..bd4c195a8 100644 --- a/src/declarativeimports/locale/CMakeLists.txt +++ b/src/declarativeimports/locale/CMakeLists.txt @@ -1,18 +1,12 @@ project(localebindings) -# include(KDE4Defaults) -# set(localebindings_SRCS locale.cpp localebindingsplugin.cpp calendarsystem.cpp ) -# INCLUDE_DIRECTORIES( -# ${CMAKE_SOURCE_DIR} -# ${CMAKE_BINARY_DIR} -# ${KDE4_INCLUDES} -# ) +find_package(KDE4Support REQUIRED) add_library(localebindingsplugin SHARED ${localebindings_SRCS}) target_link_libraries(localebindingsplugin diff --git a/src/declarativeimports/qtextracomponents/tests/CMakeLists.txt b/src/declarativeimports/qtextracomponents/tests/CMakeLists.txt index 2c64b7f88..8411ecf3e 100644 --- a/src/declarativeimports/qtextracomponents/tests/CMakeLists.txt +++ b/src/declarativeimports/qtextracomponents/tests/CMakeLists.txt @@ -7,7 +7,6 @@ target_link_libraries(fullmodelaccesstest Qt5::Gui Qt5::Test KF5::KCoreAddons - KF5::KDE4Support KF5::KI18n ) diff --git a/src/plasma/CMakeLists.txt b/src/plasma/CMakeLists.txt index c227a157a..619ce64cf 100644 --- a/src/plasma/CMakeLists.txt +++ b/src/plasma/CMakeLists.txt @@ -135,7 +135,6 @@ target_link_libraries(Plasma KF5::KDeclarative KF5::XmlGui KF5::KConfigWidgets - KF5::KDE4Support ${PLASMA_EXTRA_LIBS} ) diff --git a/src/plasma/private/dataenginemanager.cpp b/src/plasma/private/dataenginemanager.cpp index 1c235e094..1cf789a7c 100644 --- a/src/plasma/private/dataenginemanager.cpp +++ b/src/plasma/private/dataenginemanager.cpp @@ -170,7 +170,7 @@ void DataEngineManager::timerEvent(QTimerEvent *) QTextStream out(&f); QHashIterator it(d->engines); - out << "================================== " << KLocale::global()->formatDateTime(QDateTime::currentDateTime()) << endl; + out << "================================== " << QLocale().toString(QDateTime::currentDateTime()) << endl; while (it.hasNext()) { it.next(); DataEngine *engine = it.value(); diff --git a/src/shell/CMakeLists.txt b/src/shell/CMakeLists.txt index c19dbd25f..5c15ef48f 100644 --- a/src/shell/CMakeLists.txt +++ b/src/shell/CMakeLists.txt @@ -67,7 +67,6 @@ target_link_libraries(plasma-shell Plasma PlasmaQuick Qt5::Script - KF5::KDE4Support KF5::Solid KF5::KDeclarative KF5::KI18n diff --git a/src/shell/activity.cpp b/src/shell/activity.cpp index 2523397d8..4e722e6cc 100644 --- a/src/shell/activity.cpp +++ b/src/shell/activity.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include @@ -103,7 +102,7 @@ QString Activity::name() QPixmap Activity::pixmap(const QSize &size) { if (m_info->isValid() && !m_info->icon().isEmpty()) { - return KIcon(m_info->icon()).pixmap(size); + return QIcon::fromTheme(m_info->icon()).pixmap(size); } else { return KIdenticonGenerator::self()->generatePixmap(size.width(), m_id); } @@ -145,7 +144,7 @@ void Activity::removed() } const QString name = "activities/" + m_id; - QFile::remove(KStandardDirs::locateLocal("appdata", name)); + QFile::remove(QStandardPaths::writableLocation(QStandardPaths::DataLocation)+QChar('/')+name); } Plasma::Containment* Activity::containmentForScreen(int screen) diff --git a/src/shell/scripting/appinterface.cpp b/src/shell/scripting/appinterface.cpp index 63196f950..79e36d531 100644 --- a/src/shell/scripting/appinterface.cpp +++ b/src/shell/scripting/appinterface.cpp @@ -98,7 +98,7 @@ QList AppInterface::panelIds() const QString AppInterface::applicationVersion() const { - return KComponentData::mainComponent().aboutData()->version(); + return qApp->applicationVersion(); } QString AppInterface::platformVersion() const diff --git a/src/shell/scripting/scriptengine.cpp b/src/shell/scripting/scriptengine.cpp index 1250c20d7..7671b1d91 100644 --- a/src/shell/scripting/scriptengine.cpp +++ b/src/shell/scripting/scriptengine.cpp @@ -264,7 +264,7 @@ QScriptValue ScriptEngine::loadTemplate(QScriptContext *context, QScriptEngine * } const QString constraint = QString("[X-Plasma-Shell] == '%1' and [X-KDE-PluginInfo-Name] == '%2'") - .arg(KComponentData::mainComponent().componentName(),layout); + .arg(qApp->applicationName(),layout); KService::List offers = KServiceTypeTrader::self()->query("Plasma/LayoutTemplate", constraint); if (offers.isEmpty()) { diff --git a/src/shell/shellcorona.cpp b/src/shell/shellcorona.cpp index 2519e2933..ef6fbe204 100644 --- a/src/shell/shellcorona.cpp +++ b/src/shell/shellcorona.cpp @@ -596,7 +596,7 @@ void ShellCorona::checkAddPanelAction(const QStringList &sycocaChanges) KPluginInfo::List panelContainmentPlugins = Plasma::PluginLoader::listContainmentsOfType("Panel"); const QString constraint = QString("[X-Plasma-Shell] == '%1' and 'panel' ~in [X-Plasma-ContainmentCategories]") - .arg(KComponentData::mainComponent().componentName()); + .arg(qApp->applicationName()); KService::List templates = KServiceTypeTrader::self()->query("Plasma/LayoutTemplate", constraint); if (panelContainmentPlugins.count() + templates.count() == 1) {