Partially disable KAction handling

Needs proper porting.
This commit is contained in:
Martin Gräßlin 2013-07-23 07:09:51 +02:00
parent f198126e0d
commit 348ff1941c
3 changed files with 13 additions and 6 deletions

View file

@ -115,9 +115,11 @@ QScriptValue globalShortcut(QScriptContext *context, QScriptEngine *engine)
return engine->undefinedValue();
}
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());
#if KWIN_QT5_PORTING
a->setGlobalShortcut(KShortcut(context->argument(2).toString()));
#endif
script->registerShortcut(a, context->argument(3));
return engine->newVariant(true);
}

View file

@ -492,7 +492,7 @@ void TabBox::handlerReady()
void TabBox::initShortcuts(KActionCollection* keys)
{
KAction *a = NULL;
QAction *a = NULL;
// The setGlobalShortcut(shortcut); shortcut = a->globalShortcut()
// 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) ); \
shortcut = KShortcut(key); \
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(globalShortcutChanged(QKeySequence)), SLOT(shortcutSlot));

View file

@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KDE/KActionCollection>
#include <KDE/KConfigGroup>
#include <KDE/KLocalizedString>
#include <KDE/KShortcut>
#include <KDE/NETRootInfo>
namespace KWin {
@ -420,7 +421,7 @@ void VirtualDesktopManager::setNETDesktopLayout(Qt::Orientation orientation, uin
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"));
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)
{
KAction *a = keys->addAction(name.arg(value), this, slot);
QAction *a = keys->addAction(name.arg(value), this, slot);
a->setText(label.subs(value).toString());
#if KWIN_QT5_PORTING
a->setGlobalShortcut(key);
#endif
a->setData(value);
}
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());
#endif
a->setText(label);
}