• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

kdedglobalaccel_adaptor.h

Go to the documentation of this file.
00001 /*
00002     This file is part of the KDE libraries
00003 
00004     Copyright (C) 2007 Andreas Hartmetz <ahartmetz@gmail.com>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef KDEDGLOBALACCEL_ADAPTOR_H
00023 #define KDEDGLOBALACCEL_ADAPTOR_H
00024 
00025 #include <QtDBus/QDBusInterface>
00026 #include <QtDBus/QDBusMetaType>
00027 #include <QtDBus/QDBusAbstractAdaptor>
00028 #include <QtDBus/QDBusArgument>
00029 
00030 Q_DECLARE_METATYPE(QList<int>)
00031 Q_DECLARE_METATYPE(QList<QStringList>)
00032 
00033 class KdedGlobalAccelAdaptor: public QDBusAbstractAdaptor
00034 {
00035     Q_OBJECT
00036     Q_CLASSINFO("D-Bus Interface", "org.kde.KdedGlobalAccel")
00037 
00038 public:
00039     KdedGlobalAccelAdaptor(KdedGlobalAccel *parent)
00040      : QDBusAbstractAdaptor(parent)
00041     {
00042         Q_ASSERT(parent);
00043         qDBusRegisterMetaType<QList<int> >();
00044         qDBusRegisterMetaType<QList<QStringList> >();
00045         connect(parent, SIGNAL(invokeAction(const QStringList &, qlonglong)),
00046                 SIGNAL(invokeAction(const QStringList &, qlonglong)));
00047         connect(parent, SIGNAL(yourShortcutGotChanged(const QStringList &, const QList<int> &)),
00048                 SIGNAL(yourShortcutGotChanged(const QStringList &, const QList<int> &)));
00049     }
00050 
00051 private:
00052     inline KdedGlobalAccel *p()
00053         { return static_cast<KdedGlobalAccel *>(parent()); }
00054 public Q_SLOTS:
00055     inline QList<QStringList> allMainComponents()
00056         { return p()->allComponents(); }
00057     inline QList<QStringList> allActionsForComponent(const QStringList &actionId)
00058         { return p()->allActionsForComponent(actionId); }
00059     //get all registered keys (mainly for debugging)
00060     inline QList<int> allKeys()
00061         { return p()->allKeys(); }
00062     //get all registered keys as strings (mainly for debugging)
00063     inline QStringList allKeysAsString()
00064         { return p()->allKeysAsString(); }
00065     //get the action that has key registered for it
00066     inline QStringList action(int key)
00067         { return p()->actionId(key); }
00068     //get the keys registered to  action
00069     inline QList<int> shortcut(const QStringList &actionId)
00070         { return p()->shortcut(actionId); }
00071     //get the default keys registered to action
00072     inline QList<int> defaultShortcut(const QStringList &actionId)
00073         { return p()->defaultShortcut(actionId); }
00074     //to be called by main components owning the action
00075     inline QList<int> setShortcut(const QStringList &actionId, const QList<int> &keys, uint flags)
00076         { return p()->setShortcut(actionId, keys, flags); }
00077     //this is used if application A wants to change shortcuts of application B
00078     inline Q_NOREPLY void setForeignShortcut(const QStringList &actionId, const QList<int> &keys)
00079         { return p()->setForeignShortcut(actionId, keys); }
00080     //to be called when a KAction is destroyed or setGlobalShortcutAllowed(false) is called.
00081     //The shortcut stays in our data structures for conflict resolution but won't trigger
00082     //until woken up again by calling setShortcut().
00083     inline Q_NOREPLY void setInactive(const QStringList &actionId)
00084         { return p()->setInactive(actionId); }
00085     inline Q_NOREPLY void doRegister(const QStringList &actionId)
00086         { return p()->doRegister(actionId); }
00087     inline Q_NOREPLY void unRegister(const QStringList &actionId)
00088         { return p()->unRegister(actionId); }
00089 
00090 Q_SIGNALS:
00091     void invokeAction(const QStringList &actionId, qlonglong timestamp);
00092     void yourShortcutGotChanged(const QStringList &action, const QList<int> &newShortcut);
00093 };
00094 
00095 #endif //KDEDGLOBALACCEL_ADAPTOR_H

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal