Merge branch 'master' into sebas/kplugins

Conflicts:
	CMakeLists.txt
This commit is contained in:
Sebastian Kügler 2013-07-10 03:48:15 +02:00
commit 20e67f4db6
13 changed files with 51 additions and 48 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.8.10.1) cmake_minimum_required(VERSION 2.8.11)
project(plasma) project(plasma)
@ -59,6 +59,7 @@ find_package(KF5 MODULE REQUIRED COMPONENTS CMake Compiler InstallDirs
XmlGui KIdleTime ItemModels KWidgetsAddons KWindowSystem KCodecs KArchive KCoreAddons Solid ThreadWeaver XmlGui KIdleTime ItemModels KWidgetsAddons KWindowSystem KCodecs KArchive KCoreAddons Solid ThreadWeaver
KConfig KAuth kjs KWallet KDBusAddons 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) #find_package(KF5Transitional REQUIRED)
# those are not "done" yet: # those are not "done" yet:

View File

@ -32,17 +32,16 @@
#include <QList> #include <QList>
#include <QUiLoader> #include <QUiLoader>
#include <kaction.h>
#include <kactioncollection.h> #include <kactioncollection.h>
#include <kcoreauthorized.h> #include <kcoreauthorized.h>
#include <kcolorscheme.h> #include <kcolorscheme.h>
#include <kdesktopfile.h> #include <kdesktopfile.h>
#include <kdebug.h> #include <kdebug.h>
#include <kglobalaccel.h>
#include <kplugininfo.h> #include <kplugininfo.h>
#include <klocalizedstring.h> #include <klocalizedstring.h>
#include <kservice.h> #include <kservice.h>
#include <kservicetypetrader.h> #include <kservicetypetrader.h>
#include <kshortcut.h>
#include <kwindowsystem.h> #include <kwindowsystem.h>
#if !PLASMA_NO_KUTILS #if !PLASMA_NO_KUTILS
@ -172,7 +171,7 @@ void Applet::restore(KConfigGroup &group)
KConfigGroup shortcutConfig(&group, "Shortcuts"); KConfigGroup shortcutConfig(&group, "Shortcuts");
QString shortcutText = shortcutConfig.readEntryUntranslated("global", QString()); QString shortcutText = shortcutConfig.readEntryUntranslated("global", QString());
if (!shortcutText.isEmpty()) { if (!shortcutText.isEmpty()) {
setGlobalShortcut(KShortcut(shortcutText)); setGlobalShortcut(QKeySequence(shortcutText));
/* /*
#ifndef NDEBUG #ifndef NDEBUG
kDebug() << "got global shortcut for" << name() << "of" << QKeySequence(shortcutText); kDebug() << "got global shortcut for" << name() << "of" << QKeySequence(shortcutText);
@ -569,34 +568,33 @@ Containment *Applet::containment() const
return c; return c;
} }
void Applet::setGlobalShortcut(const KShortcut &shortcut) void Applet::setGlobalShortcut(const QKeySequence &shortcut)
{ {
if (!d->activationAction) { if (!d->activationAction) {
d->activationAction = new KAction(this); d->activationAction = new QAction(this);
d->activationAction->setText(i18n("Activate %1 Widget", title())); d->activationAction->setText(i18n("Activate %1 Widget", title()));
d->activationAction->setObjectName(QString("activate widget %1").arg(id())); // NO I18N d->activationAction->setObjectName(QString("activate widget %1").arg(id())); // NO I18N
connect(d->activationAction, SIGNAL(triggered()), this, SIGNAL(activate())); connect(d->activationAction, SIGNAL(triggered()), this, SIGNAL(activate()));
connect(d->activationAction, SIGNAL(globalShortcutChanged(QKeySequence)), connect(d->activationAction, SIGNAL(globalShortcutChanged(QKeySequence)),
this, SLOT(globalShortcutChanged())); this, SLOT(globalShortcutChanged()));
} else if (d->activationAction->globalShortcut() == shortcut) { } else if (d->activationAction->shortcut() == shortcut) {
return; return;
} }
//kDebug() << "before" << shortcut.primary() << d->activationAction->globalShortcut().primary(); d->globalShortcutEnabled = true;
d->activationAction->setGlobalShortcut( QList<QKeySequence> seqs;
shortcut, seqs << shortcut;
KAction::ShortcutTypes(KAction::ActiveShortcut | KAction::DefaultShortcut), KGlobalAccel::self()->setDefaultShortcut(d->activationAction, seqs, KGlobalAccel::NoAutoloading);
KAction::NoAutoloading);
d->globalShortcutChanged(); d->globalShortcutChanged();
} }
KShortcut Applet::globalShortcut() const QKeySequence Applet::globalShortcut() const
{ {
if (d->activationAction) { if (d->activationAction) {
return d->activationAction->globalShortcut(); return d->activationAction->shortcut();
} }
return KShortcut(); return QKeySequence();
} }
Types::Location Applet::location() const Types::Location Applet::location() const

View File

@ -24,11 +24,11 @@
#include <QObject> #include <QObject>
#include <QIcon> #include <QIcon>
#include <QKeySequence>
#include <QUrl> #include <QUrl>
#include <kconfiggroup.h> #include <kconfiggroup.h>
#include <kplugininfo.h> #include <kplugininfo.h>
#include <kshortcut.h>
#include <plasma/configloader.h> #include <plasma/configloader.h>
#include <plasma/plasma.h> #include <plasma/plasma.h>
@ -296,13 +296,13 @@ class PLASMA_EXPORT Applet : public QObject
/** /**
* Sets the global shortcut to associate with this widget. * 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 * @return the global shortcut associated with this wiget, or
* an empty shortcut if no global shortcut is associated. * an empty shortcut if no global shortcut is associated.
*/ */
KShortcut globalShortcut() const; QKeySequence globalShortcut() const;
// ASSOCIATED APPLICATION // ASSOCIATED APPLICATION
/** /**

View File

@ -36,7 +36,6 @@
#include <qtemporaryfile.h> #include <qtemporaryfile.h>
#include <qmimedatabase.h> #include <qmimedatabase.h>
#include <kaction.h>
#include <kdebug.h> #include <kdebug.h>
#include <kcoreauthorized.h> #include <kcoreauthorized.h>
#include <klocalizedstring.h> #include <klocalizedstring.h>

View File

@ -31,7 +31,6 @@
#include <cmath> #include <cmath>
#include <kaction.h>
#include <kdebug.h> #include <kdebug.h>
#include <kiconloader.h> #include <kiconloader.h>
#include <klocalizedstring.h> #include <klocalizedstring.h>
@ -312,13 +311,13 @@ void CoronaPrivate::init()
//some common actions //some common actions
actions.setConfigGroup("Shortcuts"); actions.setConfigGroup("Shortcuts");
KAction *lockAction = actions.add<KAction>("lock widgets"); QAction *lockAction = actions.add<QAction>("lock widgets");
QObject::connect(lockAction, SIGNAL(triggered(bool)), q, SLOT(toggleImmutability())); QObject::connect(lockAction, SIGNAL(triggered(bool)), q, SLOT(toggleImmutability()));
lockAction->setText(i18n("Lock Widgets")); lockAction->setText(i18n("Lock Widgets"));
lockAction->setAutoRepeat(true); lockAction->setAutoRepeat(true);
lockAction->setIcon(QIcon::fromTheme("object-locked")); lockAction->setIcon(QIcon::fromTheme("object-locked"));
lockAction->setData(Plasma::Types::ControlAction); lockAction->setData(Plasma::Types::ControlAction);
lockAction->setShortcut(KShortcut("alt+d, l")); lockAction->setShortcut(QKeySequence("alt+d, l"));
lockAction->setShortcutContext(Qt::ApplicationShortcut); lockAction->setShortcutContext(Qt::ApplicationShortcut);
//fake containment/applet actions //fake containment/applet actions

View File

@ -28,8 +28,6 @@
class QAction; class QAction;
class KAction;
namespace Plasma namespace Plasma
{ {

View File

@ -19,10 +19,11 @@
#include "pluginloader.h" #include "pluginloader.h"
#include <QStandardPaths>
#include <kdebug.h> #include <kdebug.h>
#include <kservice.h> #include <kservice.h>
#include <kservicetypetrader.h> #include <kservicetypetrader.h>
#include <kstandarddirs.h>
#include <kglobal.h> #include <kglobal.h>
#include <kplugininfo.h> #include <kplugininfo.h>
@ -818,7 +819,9 @@ KPluginInfo::List PluginLoader::internalContainmentActionsInfo() const
static KPluginInfo::List standardInternalInfo(const QString &type, const QString &category = QString()) 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); KPluginInfo::List allInfo = KPluginInfo::fromFiles(files);

View File

@ -28,7 +28,6 @@
#include <QFile> #include <QFile>
#include <qstandardpaths.h> #include <qstandardpaths.h>
#include <kaction.h>
#include <kdebug.h> #include <kdebug.h>
#include <kiconloader.h> #include <kiconloader.h>
#include <klocale.h> #include <klocale.h>
@ -36,6 +35,7 @@
#include <kkeysequencewidget.h> #include <kkeysequencewidget.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
#include <kglobal.h> #include <kglobal.h>
#include <kglobalaccel.h>
#include "containment.h" #include "containment.h"
#include "corona.h" #include "corona.h"
@ -66,7 +66,8 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int
failed(false), failed(false),
transient(false), transient(false),
needsConfig(false), needsConfig(false),
started(false) started(false),
globalShortcutEnabled(false)
{ {
if (appletId == 0) { if (appletId == 0) {
appletId = ++s_maxAppletId; appletId = ++s_maxAppletId;
@ -79,9 +80,9 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int
AppletPrivate::~AppletPrivate() AppletPrivate::~AppletPrivate()
{ {
if (activationAction && activationAction->isGlobalShortcutEnabled()) { if (activationAction && globalShortcutEnabled) {
//kDebug() << "reseting global action for" << q->title() << activationAction->objectName(); //kDebug() << "resetting global action for" << q->title() << activationAction->objectName();
activationAction->forgetGlobalShortcut(); KGlobalAccel::self()->removeAllShortcuts(activationAction);
} }
delete script; delete script;
@ -187,7 +188,7 @@ void AppletPrivate::globalShortcutChanged()
} }
KConfigGroup shortcutConfig(mainConfigGroup(), "Shortcuts"); KConfigGroup shortcutConfig(mainConfigGroup(), "Shortcuts");
shortcutConfig.writeEntry("global", activationAction->globalShortcut().toString()); shortcutConfig.writeEntry("global", activationAction->shortcut().toString());
scheduleModificationNotification(); scheduleModificationNotification();
//kDebug() << "after" << shortcut.primary() << d->activationAction->globalShortcut().primary(); //kDebug() << "after" << shortcut.primary() << d->activationAction->globalShortcut().primary();
} }
@ -249,7 +250,7 @@ void AppletPrivate::updateShortcuts()
for (int i = 0; i < names.size(); ++i) { for (int i = 0; i < names.size(); ++i) {
QAction *a = qactions.at(i); QAction *a = qactions.at(i);
if (a) { if (a) {
actions->add<KAction>(names.at(i), a); actions->add<QAction>(names.at(i), a);
} }
} }
} else { } else {

View File

@ -22,9 +22,9 @@
#ifndef PLASMA_APPLET_P_H #ifndef PLASMA_APPLET_P_H
#define PLASMA_APPLET_P_H #define PLASMA_APPLET_P_H
#include <QAction>
#include <QBasicTimer> #include <QBasicTimer>
#include <KAction>
#include <kactioncollection.h> #include <kactioncollection.h>
#include <kconfigskeleton.h> #include <kconfigskeleton.h>
#include <kservice.h> #include <kservice.h>
@ -98,7 +98,7 @@ public:
// actions stuff; put activationAction into actions? // actions stuff; put activationAction into actions?
KActionCollection *actions; KActionCollection *actions;
KAction *activationAction; QAction *activationAction;
Types::ItemStatus itemStatus; Types::ItemStatus itemStatus;
@ -113,6 +113,7 @@ public:
bool transient : 1; bool transient : 1;
bool needsConfig : 1; bool needsConfig : 1;
bool started : 1; bool started : 1;
bool globalShortcutEnabled : 1;
}; };
} // Plasma namespace } // Plasma namespace

View File

@ -23,7 +23,6 @@
#include "private/containment_p.h" #include "private/containment_p.h"
#include <kaction.h>
#include <kactioncollection.h> #include <kactioncollection.h>
#include <kdebug.h> #include <kdebug.h>
#include <kiconloader.h> #include <kiconloader.h>
@ -49,26 +48,26 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme
actions->setConfigGroup("Shortcuts-Containment"); actions->setConfigGroup("Shortcuts-Containment");
//adjust applet actions //adjust applet actions
KAction *appAction = qobject_cast<KAction*>(actions->action("remove")); QAction *appAction = qobject_cast<QAction*>(actions->action("remove"));
appAction->setShortcut(KShortcut("alt+d, alt+r")); appAction->setShortcut(QKeySequence("alt+d, alt+r"));
if (c && c->d->isPanelContainment()) { if (c && c->d->isPanelContainment()) {
appAction->setText(i18n("Remove this Panel")); appAction->setText(i18n("Remove this Panel"));
} else { } else {
appAction->setText(i18n("Remove this Activity")); appAction->setText(i18n("Remove this Activity"));
} }
appAction = qobject_cast<KAction*>(actions->action("configure")); appAction = qobject_cast<QAction*>(actions->action("configure"));
if (appAction) { if (appAction) {
appAction->setShortcut(KShortcut("alt+d, alt+s")); appAction->setShortcut(QKeySequence("alt+d, alt+s"));
appAction->setText(i18n("Activity Settings")); appAction->setText(i18n("Activity Settings"));
} }
//add our own actions //add our own actions
KAction *appletBrowserAction = actions->add<KAction>("add widgets"); QAction *appletBrowserAction = actions->add<QAction>("add widgets");
appletBrowserAction->setAutoRepeat(false); appletBrowserAction->setAutoRepeat(false);
appletBrowserAction->setText(i18n("Add Widgets...")); appletBrowserAction->setText(i18n("Add Widgets..."));
appletBrowserAction->setIcon(QIcon::fromTheme("list-add")); appletBrowserAction->setIcon(QIcon::fromTheme("list-add"));
appletBrowserAction->setShortcut(KShortcut("alt+d, a")); appletBrowserAction->setShortcut(QKeySequence("alt+d, a"));
appletBrowserAction->setData(Plasma::Types::AddAction); appletBrowserAction->setData(Plasma::Types::AddAction);
} }

View File

@ -22,7 +22,6 @@
#define CONTAINMENT_P_H #define CONTAINMENT_P_H
#include <kactioncollection.h> #include <kactioncollection.h>
#include <kmenu.h>
#include "plasma.h" #include "plasma.h"
#include "applet.h" #include "applet.h"

View File

@ -82,7 +82,7 @@ void Widget::remove()
void Widget::setGlobalShortcut(const QString &shortcut) void Widget::setGlobalShortcut(const QString &shortcut)
{ {
if (d->applet) { if (d->applet) {
d->applet.data()->setGlobalShortcut(KShortcut(shortcut)); d->applet.data()->setGlobalShortcut(QKeySequence(shortcut));
} }
} }

View File

@ -19,8 +19,10 @@
#include "plasmaappletitemmodel_p.h" #include "plasmaappletitemmodel_p.h"
#include <QStandardPaths>
#include <QFileInfo>
#include <KLocalizedString> #include <KLocalizedString>
#include <KStandardDirs>
#include <KServiceTypeTrader> #include <KServiceTypeTrader>
#include <KSycoca> #include <KSycoca>
@ -36,8 +38,11 @@ PlasmaAppletItem::PlasmaAppletItem(PlasmaAppletItemModel *model,
{ {
const QString api(m_info.property("X-Plasma-API").toString()); const QString api(m_info.property("X-Plasma-API").toString());
if (!api.isEmpty()) { if (!api.isEmpty()) {
QDir dir(KStandardDirs::locateLocal("data", "plasma/plasmoids/" + info.pluginName() + '/', false)); const QString _f = "plasma/plasmoids/" + info.pluginName() + '/';
m_local = dir.exists(); QFileInfo dir(QStandardPaths::locate(QStandardPaths::QStandardPaths::GenericDataLocation,
_f,
QStandardPaths::LocateDirectory));
m_local = dir.exists() && dir.isWritable();
} }
//attrs.insert("recommended", flags & Recommended ? true : false); //attrs.insert("recommended", flags & Recommended ? true : false);