Partially disable KAction handling
Needs proper porting.
This commit is contained in:
parent
f198126e0d
commit
348ff1941c
3 changed files with 13 additions and 6 deletions
|
@ -115,9 +115,11 @@ QScriptValue globalShortcut(QScriptContext *context, QScriptEngine *engine)
|
||||||
return engine->undefinedValue();
|
return engine->undefinedValue();
|
||||||
}
|
}
|
||||||
KActionCollection* actionCollection = new KActionCollection(script);
|
KActionCollection* actionCollection = new KActionCollection(script);
|
||||||
KAction* a = (KAction*)actionCollection->addAction(context->argument(0).toString());
|
QAction* a = actionCollection->addAction(context->argument(0).toString());
|
||||||
a->setText(context->argument(1).toString());
|
a->setText(context->argument(1).toString());
|
||||||
|
#if KWIN_QT5_PORTING
|
||||||
a->setGlobalShortcut(KShortcut(context->argument(2).toString()));
|
a->setGlobalShortcut(KShortcut(context->argument(2).toString()));
|
||||||
|
#endif
|
||||||
script->registerShortcut(a, context->argument(3));
|
script->registerShortcut(a, context->argument(3));
|
||||||
return engine->newVariant(true);
|
return engine->newVariant(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -492,7 +492,7 @@ void TabBox::handlerReady()
|
||||||
|
|
||||||
void TabBox::initShortcuts(KActionCollection* keys)
|
void TabBox::initShortcuts(KActionCollection* keys)
|
||||||
{
|
{
|
||||||
KAction *a = NULL;
|
QAction *a = NULL;
|
||||||
|
|
||||||
// The setGlobalShortcut(shortcut); shortcut = a->globalShortcut()
|
// The setGlobalShortcut(shortcut); shortcut = a->globalShortcut()
|
||||||
// sequence is necessary in the case where the user has defined a
|
// sequence is necessary in the case where the user has defined a
|
||||||
|
@ -502,7 +502,7 @@ void TabBox::initShortcuts(KActionCollection* keys)
|
||||||
a->setText( i18n(name) ); \
|
a->setText( i18n(name) ); \
|
||||||
shortcut = KShortcut(key); \
|
shortcut = KShortcut(key); \
|
||||||
qobject_cast<KAction*>( a )->setGlobalShortcut(shortcut); \
|
qobject_cast<KAction*>( a )->setGlobalShortcut(shortcut); \
|
||||||
shortcut = a->globalShortcut(); \
|
shortcut = qobject_cast<KAction*>( a )->globalShortcut(); \
|
||||||
connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot)); \
|
connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot)); \
|
||||||
connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), SLOT(shortcutSlot));
|
connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), SLOT(shortcutSlot));
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <KDE/KActionCollection>
|
#include <KDE/KActionCollection>
|
||||||
#include <KDE/KConfigGroup>
|
#include <KDE/KConfigGroup>
|
||||||
#include <KDE/KLocalizedString>
|
#include <KDE/KLocalizedString>
|
||||||
|
#include <KDE/KShortcut>
|
||||||
#include <KDE/NETRootInfo>
|
#include <KDE/NETRootInfo>
|
||||||
|
|
||||||
namespace KWin {
|
namespace KWin {
|
||||||
|
@ -420,7 +421,7 @@ void VirtualDesktopManager::setNETDesktopLayout(Qt::Orientation orientation, uin
|
||||||
|
|
||||||
void VirtualDesktopManager::initShortcuts(KActionCollection *keys)
|
void VirtualDesktopManager::initShortcuts(KActionCollection *keys)
|
||||||
{
|
{
|
||||||
KAction *a = keys->addAction(QStringLiteral("Group:Desktop Switching"));
|
QAction *a = keys->addAction(QStringLiteral("Group:Desktop Switching"));
|
||||||
a->setText(i18n("Desktop Switching"));
|
a->setText(i18n("Desktop Switching"));
|
||||||
initSwitchToShortcuts(keys);
|
initSwitchToShortcuts(keys);
|
||||||
|
|
||||||
|
@ -448,16 +449,20 @@ void VirtualDesktopManager::initSwitchToShortcuts(KActionCollection *keys)
|
||||||
|
|
||||||
void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &name, const KLocalizedString &label, uint value, const KShortcut &key, const char *slot)
|
void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &name, const KLocalizedString &label, uint value, const KShortcut &key, const char *slot)
|
||||||
{
|
{
|
||||||
KAction *a = keys->addAction(name.arg(value), this, slot);
|
QAction *a = keys->addAction(name.arg(value), this, slot);
|
||||||
a->setText(label.subs(value).toString());
|
a->setText(label.subs(value).toString());
|
||||||
|
#if KWIN_QT5_PORTING
|
||||||
a->setGlobalShortcut(key);
|
a->setGlobalShortcut(key);
|
||||||
|
#endif
|
||||||
a->setData(value);
|
a->setData(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &name, const QString &label, const char *slot)
|
void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &name, const QString &label, const char *slot)
|
||||||
{
|
{
|
||||||
KAction *a = keys->addAction(name, this, slot);
|
QAction *a = keys->addAction(name, this, slot);
|
||||||
|
#if KWIN_QT5_PORTING
|
||||||
a->setGlobalShortcut(KShortcut());
|
a->setGlobalShortcut(KShortcut());
|
||||||
|
#endif
|
||||||
a->setText(label);
|
a->setText(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue