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)
@ -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:

View File

@ -32,17 +32,16 @@
#include <QList>
#include <QUiLoader>
#include <kaction.h>
#include <kactioncollection.h>
#include <kcoreauthorized.h>
#include <kcolorscheme.h>
#include <kdesktopfile.h>
#include <kdebug.h>
#include <kglobalaccel.h>
#include <kplugininfo.h>
#include <klocalizedstring.h>
#include <kservice.h>
#include <kservicetypetrader.h>
#include <kshortcut.h>
#include <kwindowsystem.h>
#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<QKeySequence> 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

View File

@ -24,11 +24,11 @@
#include <QObject>
#include <QIcon>
#include <QKeySequence>
#include <QUrl>
#include <kconfiggroup.h>
#include <kplugininfo.h>
#include <kshortcut.h>
#include <plasma/configloader.h>
#include <plasma/plasma.h>
@ -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
/**

View File

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

View File

@ -31,7 +31,6 @@
#include <cmath>
#include <kaction.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <klocalizedstring.h>
@ -312,13 +311,13 @@ void CoronaPrivate::init()
//some common actions
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()));
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

View File

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

View File

@ -19,10 +19,11 @@
#include "pluginloader.h"
#include <QStandardPaths>
#include <kdebug.h>
#include <kservice.h>
#include <kservicetypetrader.h>
#include <kstandarddirs.h>
#include <kglobal.h>
#include <kplugininfo.h>
@ -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);

View File

@ -28,7 +28,6 @@
#include <QFile>
#include <qstandardpaths.h>
#include <kaction.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <klocale.h>
@ -36,6 +35,7 @@
#include <kkeysequencewidget.h>
#include <kstandarddirs.h>
#include <kglobal.h>
#include <kglobalaccel.h>
#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<KAction>(names.at(i), a);
actions->add<QAction>(names.at(i), a);
}
}
} else {

View File

@ -22,9 +22,9 @@
#ifndef PLASMA_APPLET_P_H
#define PLASMA_APPLET_P_H
#include <QAction>
#include <QBasicTimer>
#include <KAction>
#include <kactioncollection.h>
#include <kconfigskeleton.h>
#include <kservice.h>
@ -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

View File

@ -23,7 +23,6 @@
#include "private/containment_p.h"
#include <kaction.h>
#include <kactioncollection.h>
#include <kdebug.h>
#include <kiconloader.h>
@ -49,26 +48,26 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme
actions->setConfigGroup("Shortcuts-Containment");
//adjust applet actions
KAction *appAction = qobject_cast<KAction*>(actions->action("remove"));
appAction->setShortcut(KShortcut("alt+d, alt+r"));
QAction *appAction = qobject_cast<QAction*>(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<KAction*>(actions->action("configure"));
appAction = qobject_cast<QAction*>(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<KAction>("add widgets");
QAction *appletBrowserAction = actions->add<QAction>("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);
}

View File

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

View File

@ -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));
}
}

View File

@ -19,8 +19,10 @@
#include "plasmaappletitemmodel_p.h"
#include <QStandardPaths>
#include <QFileInfo>
#include <KLocalizedString>
#include <KStandardDirs>
#include <KServiceTypeTrader>
#include <KSycoca>
@ -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);