Expose globalShortcut in AppletInterface so it can be set from the config
This commit is contained in:
parent
7e7fe6f972
commit
fb7451051e
@ -616,16 +616,20 @@ void Applet::setGlobalShortcut(const QKeySequence &shortcut)
|
||||
d->globalShortcutEnabled = true;
|
||||
QList<QKeySequence> seqs;
|
||||
seqs << shortcut;
|
||||
KGlobalAccel::self()->setDefaultShortcut(d->activationAction, seqs, KGlobalAccel::NoAutoloading);
|
||||
KGlobalAccel::self()->setShortcut(d->activationAction, seqs, KGlobalAccel::NoAutoloading);
|
||||
d->globalShortcutChanged();
|
||||
}
|
||||
|
||||
QKeySequence Applet::globalShortcut() const
|
||||
{
|
||||
if (d->activationAction) {
|
||||
return d->activationAction->shortcut();
|
||||
QList<QKeySequence> shortcuts = KGlobalAccel::self()->shortcut(d->activationAction);
|
||||
if (!shortcuts.isEmpty()) {
|
||||
return shortcuts.first();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return QKeySequence();
|
||||
}
|
||||
|
||||
|
@ -429,6 +429,15 @@ bool AppletInterface::hideOnWindowDeactivate() const
|
||||
return m_hideOnDeactivate;
|
||||
}
|
||||
|
||||
QKeySequence AppletInterface::globalShortcut() const
|
||||
{
|
||||
return applet()->globalShortcut();
|
||||
}
|
||||
|
||||
void AppletInterface::setGlobalShortcut(const QKeySequence& sequence)
|
||||
{
|
||||
applet()->setGlobalShortcut(sequence);
|
||||
}
|
||||
|
||||
QString AppletInterface::downloadPath(const QString &file)
|
||||
{
|
||||
|
@ -153,6 +153,13 @@ class AppletInterface : public PlasmaQuick::AppletQuickItem
|
||||
**/
|
||||
Q_PROPERTY(bool hideOnWindowDeactivate READ hideOnWindowDeactivate WRITE setHideOnWindowDeactivate NOTIFY hideOnWindowDeactivateChanged)
|
||||
|
||||
/**
|
||||
* The global shortcut to activate the plasmoid
|
||||
*
|
||||
* This is typically only used by the default configuration module
|
||||
*
|
||||
*/
|
||||
Q_PROPERTY(QKeySequence globalShortcut READ globalShortcut WRITE setGlobalShortcut NOTIFY globalShortcutChanged)
|
||||
|
||||
public:
|
||||
AppletInterface(DeclarativeAppletScript *script, QQuickItem *parent = 0);
|
||||
@ -259,6 +266,9 @@ public:
|
||||
bool hideOnWindowDeactivate() const;
|
||||
void setHideOnWindowDeactivate(bool hide);
|
||||
|
||||
QKeySequence globalShortcut() const;
|
||||
void setGlobalShortcut(const QKeySequence &keySequence);
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* somebody else, usually the containment sent some data to the applet
|
||||
@ -269,6 +279,7 @@ Q_SIGNALS:
|
||||
|
||||
void configNeedsSaving();
|
||||
|
||||
|
||||
//PROPERTY change notifiers--------------
|
||||
void iconChanged();
|
||||
void titleChanged();
|
||||
@ -285,6 +296,7 @@ Q_SIGNALS:
|
||||
void hideOnWindowDeactivateChanged();
|
||||
|
||||
void userConfiguringChanged();
|
||||
void globalShortcutChanged();
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void init();
|
||||
|
Loading…
Reference in New Issue
Block a user