diff --git a/CMakeLists.txt b/CMakeLists.txt index 99721f6aa..52403e6fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.10.1) +cmake_minimum_required(VERSION 2.8.11) project(plasma) @@ -58,7 +58,8 @@ find_package(kdeqt5staging REQUIRED NO_MODULE) find_package(KF5 MODULE REQUIRED COMPONENTS CMake Compiler InstallDirs XmlGui KIdleTime ItemModels KWidgetsAddons KWindowSystem KCodecs KArchive KCoreAddons Solid ThreadWeaver KConfig KAuth kjs KWallet KDBusAddons - ki18n kguiaddons kservice kwidgets ItemViews KNotifications KIconThemes KCompletion KJobWidgets KConfigWidgets Sonnet) + ki18n kguiaddons kservice kwidgets ItemViews KNotifications KIconThemes KCompletion KJobWidgets KConfigWidgets Sonnet) + #find_package(KF5Transitional REQUIRED) # those are not "done" yet: diff --git a/src/plasma/applet.cpp b/src/plasma/applet.cpp index f880ad4bf..1ad261b00 100644 --- a/src/plasma/applet.cpp +++ b/src/plasma/applet.cpp @@ -32,17 +32,16 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include #include -#include #include #if !PLASMA_NO_KUTILS @@ -172,7 +171,7 @@ void Applet::restore(KConfigGroup &group) KConfigGroup shortcutConfig(&group, "Shortcuts"); QString shortcutText = shortcutConfig.readEntryUntranslated("global", QString()); if (!shortcutText.isEmpty()) { - setGlobalShortcut(KShortcut(shortcutText)); + setGlobalShortcut(QKeySequence(shortcutText)); /* #ifndef NDEBUG kDebug() << "got global shortcut for" << name() << "of" << QKeySequence(shortcutText); @@ -569,34 +568,33 @@ Containment *Applet::containment() const return c; } -void Applet::setGlobalShortcut(const KShortcut &shortcut) +void Applet::setGlobalShortcut(const QKeySequence &shortcut) { if (!d->activationAction) { - d->activationAction = new KAction(this); + d->activationAction = new QAction(this); d->activationAction->setText(i18n("Activate %1 Widget", title())); d->activationAction->setObjectName(QString("activate widget %1").arg(id())); // NO I18N connect(d->activationAction, SIGNAL(triggered()), this, SIGNAL(activate())); connect(d->activationAction, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChanged())); - } else if (d->activationAction->globalShortcut() == shortcut) { + } else if (d->activationAction->shortcut() == shortcut) { return; } - //kDebug() << "before" << shortcut.primary() << d->activationAction->globalShortcut().primary(); - d->activationAction->setGlobalShortcut( - shortcut, - KAction::ShortcutTypes(KAction::ActiveShortcut | KAction::DefaultShortcut), - KAction::NoAutoloading); + d->globalShortcutEnabled = true; + QList seqs; + seqs << shortcut; + KGlobalAccel::self()->setDefaultShortcut(d->activationAction, seqs, KGlobalAccel::NoAutoloading); d->globalShortcutChanged(); } -KShortcut Applet::globalShortcut() const +QKeySequence Applet::globalShortcut() const { if (d->activationAction) { - return d->activationAction->globalShortcut(); + return d->activationAction->shortcut(); } - return KShortcut(); + return QKeySequence(); } Types::Location Applet::location() const diff --git a/src/plasma/applet.h b/src/plasma/applet.h index f0f2dcd01..5272474f7 100644 --- a/src/plasma/applet.h +++ b/src/plasma/applet.h @@ -24,11 +24,11 @@ #include #include +#include #include #include #include -#include #include #include @@ -296,13 +296,13 @@ class PLASMA_EXPORT Applet : public QObject /** * Sets the global shortcut to associate with this widget. */ - void setGlobalShortcut(const KShortcut &shortcut); + void setGlobalShortcut(const QKeySequence &shortcut); /** * @return the global shortcut associated with this wiget, or * an empty shortcut if no global shortcut is associated. */ - KShortcut globalShortcut() const; + QKeySequence globalShortcut() const; // ASSOCIATED APPLICATION /** diff --git a/src/plasma/containment.cpp b/src/plasma/containment.cpp index 8f0e90d38..2d21a41e2 100644 --- a/src/plasma/containment.cpp +++ b/src/plasma/containment.cpp @@ -36,7 +36,6 @@ #include #include -#include #include #include #include diff --git a/src/plasma/corona.cpp b/src/plasma/corona.cpp index 47338730d..6b10b826e 100644 --- a/src/plasma/corona.cpp +++ b/src/plasma/corona.cpp @@ -31,7 +31,6 @@ #include -#include #include #include #include @@ -312,13 +311,13 @@ void CoronaPrivate::init() //some common actions actions.setConfigGroup("Shortcuts"); - KAction *lockAction = actions.add("lock widgets"); + QAction *lockAction = actions.add("lock widgets"); QObject::connect(lockAction, SIGNAL(triggered(bool)), q, SLOT(toggleImmutability())); lockAction->setText(i18n("Lock Widgets")); lockAction->setAutoRepeat(true); lockAction->setIcon(QIcon::fromTheme("object-locked")); lockAction->setData(Plasma::Types::ControlAction); - lockAction->setShortcut(KShortcut("alt+d, l")); + lockAction->setShortcut(QKeySequence("alt+d, l")); lockAction->setShortcutContext(Qt::ApplicationShortcut); //fake containment/applet actions diff --git a/src/plasma/corona.h b/src/plasma/corona.h index a1235e274..07625d6ca 100644 --- a/src/plasma/corona.h +++ b/src/plasma/corona.h @@ -28,8 +28,6 @@ class QAction; -class KAction; - namespace Plasma { diff --git a/src/plasma/pluginloader.cpp b/src/plasma/pluginloader.cpp index 671140a8c..df719b065 100644 --- a/src/plasma/pluginloader.cpp +++ b/src/plasma/pluginloader.cpp @@ -19,10 +19,11 @@ #include "pluginloader.h" +#include + #include #include #include -#include #include #include @@ -818,7 +819,9 @@ KPluginInfo::List PluginLoader::internalContainmentActionsInfo() const static KPluginInfo::List standardInternalInfo(const QString &type, const QString &category = QString()) { - QStringList files = KGlobal::dirs()->findAllResources("appdata", "plasma/internal/" + type + "/*.desktop", KStandardDirs::NoDuplicates); + QStringList files = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, + "plasma/internal/" + type + "/*.desktop", + QStandardPaths::LocateFile); KPluginInfo::List allInfo = KPluginInfo::fromFiles(files); diff --git a/src/plasma/private/applet_p.cpp b/src/plasma/private/applet_p.cpp index 62f7c663d..62cc94792 100644 --- a/src/plasma/private/applet_p.cpp +++ b/src/plasma/private/applet_p.cpp @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -36,6 +35,7 @@ #include #include #include +#include #include "containment.h" #include "corona.h" @@ -66,7 +66,8 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int failed(false), transient(false), needsConfig(false), - started(false) + started(false), + globalShortcutEnabled(false) { if (appletId == 0) { appletId = ++s_maxAppletId; @@ -79,9 +80,9 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int AppletPrivate::~AppletPrivate() { - if (activationAction && activationAction->isGlobalShortcutEnabled()) { - //kDebug() << "reseting global action for" << q->title() << activationAction->objectName(); - activationAction->forgetGlobalShortcut(); + if (activationAction && globalShortcutEnabled) { + //kDebug() << "resetting global action for" << q->title() << activationAction->objectName(); + KGlobalAccel::self()->removeAllShortcuts(activationAction); } delete script; @@ -187,7 +188,7 @@ void AppletPrivate::globalShortcutChanged() } KConfigGroup shortcutConfig(mainConfigGroup(), "Shortcuts"); - shortcutConfig.writeEntry("global", activationAction->globalShortcut().toString()); + shortcutConfig.writeEntry("global", activationAction->shortcut().toString()); scheduleModificationNotification(); //kDebug() << "after" << shortcut.primary() << d->activationAction->globalShortcut().primary(); } @@ -249,7 +250,7 @@ void AppletPrivate::updateShortcuts() for (int i = 0; i < names.size(); ++i) { QAction *a = qactions.at(i); if (a) { - actions->add(names.at(i), a); + actions->add(names.at(i), a); } } } else { diff --git a/src/plasma/private/applet_p.h b/src/plasma/private/applet_p.h index 455fc3493..ab3cf1795 100644 --- a/src/plasma/private/applet_p.h +++ b/src/plasma/private/applet_p.h @@ -22,9 +22,9 @@ #ifndef PLASMA_APPLET_P_H #define PLASMA_APPLET_P_H +#include #include -#include #include #include #include @@ -98,7 +98,7 @@ public: // actions stuff; put activationAction into actions? KActionCollection *actions; - KAction *activationAction; + QAction *activationAction; Types::ItemStatus itemStatus; @@ -113,6 +113,7 @@ public: bool transient : 1; bool needsConfig : 1; bool started : 1; + bool globalShortcutEnabled : 1; }; } // Plasma namespace diff --git a/src/plasma/private/containment_p.cpp b/src/plasma/private/containment_p.cpp index 207782692..47a8a4f1c 100644 --- a/src/plasma/private/containment_p.cpp +++ b/src/plasma/private/containment_p.cpp @@ -23,7 +23,6 @@ #include "private/containment_p.h" -#include #include #include #include @@ -49,26 +48,26 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme actions->setConfigGroup("Shortcuts-Containment"); //adjust applet actions - KAction *appAction = qobject_cast(actions->action("remove")); - appAction->setShortcut(KShortcut("alt+d, alt+r")); + QAction *appAction = qobject_cast(actions->action("remove")); + appAction->setShortcut(QKeySequence("alt+d, alt+r")); if (c && c->d->isPanelContainment()) { appAction->setText(i18n("Remove this Panel")); } else { appAction->setText(i18n("Remove this Activity")); } - appAction = qobject_cast(actions->action("configure")); + appAction = qobject_cast(actions->action("configure")); if (appAction) { - appAction->setShortcut(KShortcut("alt+d, alt+s")); + appAction->setShortcut(QKeySequence("alt+d, alt+s")); appAction->setText(i18n("Activity Settings")); } //add our own actions - KAction *appletBrowserAction = actions->add("add widgets"); + QAction *appletBrowserAction = actions->add("add widgets"); appletBrowserAction->setAutoRepeat(false); appletBrowserAction->setText(i18n("Add Widgets...")); appletBrowserAction->setIcon(QIcon::fromTheme("list-add")); - appletBrowserAction->setShortcut(KShortcut("alt+d, a")); + appletBrowserAction->setShortcut(QKeySequence("alt+d, a")); appletBrowserAction->setData(Plasma::Types::AddAction); } diff --git a/src/plasma/private/containment_p.h b/src/plasma/private/containment_p.h index 059c92091..2a56c155e 100644 --- a/src/plasma/private/containment_p.h +++ b/src/plasma/private/containment_p.h @@ -22,7 +22,6 @@ #define CONTAINMENT_P_H #include -#include #include "plasma.h" #include "applet.h" diff --git a/src/shell/scripting/widget.cpp b/src/shell/scripting/widget.cpp index d4f93f2be..7d93929fd 100644 --- a/src/shell/scripting/widget.cpp +++ b/src/shell/scripting/widget.cpp @@ -82,7 +82,7 @@ void Widget::remove() void Widget::setGlobalShortcut(const QString &shortcut) { if (d->applet) { - d->applet.data()->setGlobalShortcut(KShortcut(shortcut)); + d->applet.data()->setGlobalShortcut(QKeySequence(shortcut)); } } diff --git a/src/shell/widgetexplorer/plasmaappletitemmodel.cpp b/src/shell/widgetexplorer/plasmaappletitemmodel.cpp index 92258182b..b55260001 100644 --- a/src/shell/widgetexplorer/plasmaappletitemmodel.cpp +++ b/src/shell/widgetexplorer/plasmaappletitemmodel.cpp @@ -19,8 +19,10 @@ #include "plasmaappletitemmodel_p.h" +#include +#include + #include -#include #include #include @@ -36,8 +38,11 @@ PlasmaAppletItem::PlasmaAppletItem(PlasmaAppletItemModel *model, { const QString api(m_info.property("X-Plasma-API").toString()); if (!api.isEmpty()) { - QDir dir(KStandardDirs::locateLocal("data", "plasma/plasmoids/" + info.pluginName() + '/', false)); - m_local = dir.exists(); + const QString _f = "plasma/plasmoids/" + info.pluginName() + '/'; + QFileInfo dir(QStandardPaths::locate(QStandardPaths::QStandardPaths::GenericDataLocation, + _f, + QStandardPaths::LocateDirectory)); + m_local = dir.exists() && dir.isWritable(); } //attrs.insert("recommended", flags & Recommended ? true : false);