Commit 7c75f15a authored by Martin Tobias Holmedahl Sandsmark's avatar Martin Tobias Holmedahl Sandsmark
Browse files

port away from KShortcut

parent 675ab36a
......@@ -191,7 +191,7 @@ QString KHotKeysModule::register_menuentry_shortcut(
menuentries,
wantedService->name(),
storageId,
KShortcut(sequence),
QKeySequence(sequence),
storageId);
newAction->enable();
......
......@@ -309,7 +309,7 @@ void HotkeysTreeViewContextMenu::newGlobalShortcutActionAction( int actionType )
KHotKeys::SimpleActionData *data =
new KHotKeys::SimpleActionData( 0, i18n("New Action"), i18n("Comment"));
data->set_trigger( new KHotKeys::ShortcutTrigger( data, KShortcut() ) );
data->set_trigger( new KHotKeys::ShortcutTrigger( data, QKeySequence() ) );
data->enable();
createActionFromType(actionType, data);
......
......@@ -33,7 +33,7 @@ MenuEntryShortcutActionData::MenuEntryShortcutActionData(
ActionDataGroup* parent,
const QString& name,
const QString& comment,
const KShortcut& shortcut,
const QKeySequence& shortcut,
const QString& menuentry)
: base(parent, name, comment)
{
......
......@@ -42,7 +42,7 @@ class Q_DECL_EXPORT MenuEntryShortcutActionData
ActionDataGroup* parent,
const QString& name,
const QString& comment,
const KShortcut& shortcut,
const QKeySequence& shortcut,
const QString& command_url);
/**
......
......@@ -172,7 +172,7 @@ void Settings::reinitialize()
daemon_disabled = false;
// Currently unused
voice_shortcut = KShortcut();
voice_shortcut = QKeySequence();
already_imported = QStringList();
}
......@@ -213,7 +213,7 @@ void Settings::setGestureTimeOut(int timeout)
}
void Settings::setVoiceShortcut( const KShortcut &shortcut )
void Settings::setVoiceShortcut( const QKeySequence &shortcut )
{
voice_shortcut = shortcut;
}
......@@ -227,7 +227,7 @@ ActionDataGroup *Settings::takeActions()
}
KShortcut Settings::voiceShortcut() const
QKeySequence Settings::voiceShortcut() const
{
return voice_shortcut;
}
......@@ -463,7 +463,7 @@ bool Settings::reread_settings(bool include_disabled)
// ### Voice
KConfigGroup voiceConfig( &config, "Voice" );
voice_shortcut=KShortcut( voiceConfig.readEntry("Shortcut" , "") );
voice_shortcut=QKeySequence( voiceConfig.readEntry("Shortcut" , "") );
bool rc = read_settings(m_actions, config, include_disabled, Retain);
// Ensure the system groups exist
......
......@@ -172,8 +172,8 @@ public:
* @name Voice Commands
*/
//@{
void setVoiceShortcut( const KShortcut &shortcut );
KShortcut voiceShortcut() const;
void setVoiceShortcut( const QKeySequence &shortcut );
QKeySequence voiceShortcut() const;
//@}
/**
......@@ -247,7 +247,7 @@ private:
/**
* The shortcut that triggers a voice command
*/
KShortcut voice_shortcut;
QKeySequence voice_shortcut;
/**
* List of id's for all imported files.
......
......@@ -306,7 +306,7 @@ KHotKeys::Trigger_list *SettingsReaderV2::readTriggerList(
uuid = QUuid::createUuid();
if (type == "SHORTCUT" || type == "SINGLE_SHORTCUT")
trigger = new KHotKeys::ShortcutTrigger(parent, KShortcut(), uuid);
trigger = new KHotKeys::ShortcutTrigger(parent, QKeySequence(), uuid);
else if (type == "WINDOW")
trigger = new KHotKeys::WindowTrigger(parent);
else if (type == "GESTURE")
......
......@@ -32,7 +32,7 @@
#include <QDebug>
#include <KGlobalAccel>
#include <KShortcut>
#include <QKeySequence>
#include <QAction>
#include <QUuid>
......@@ -60,7 +60,7 @@ ShortcutsHandler::~ShortcutsHandler()
QAction *ShortcutsHandler::addAction(
const QString &id,
const QString &text,
const KShortcut &shortcut )
const QKeySequence &shortcut )
{
#ifdef KHOTKEYS_TRACE
qDebug() << id << text << shortcut;
......@@ -89,7 +89,7 @@ QAction *ShortcutsHandler::addAction(
newAction->setProperty("isConfigurationAction", QVariant(true));
}
newAction->setText(text);
KGlobalAccel::self()->setShortcut(newAction, QList<QKeySequence>() << shortcut.primary());
KGlobalAccel::self()->setShortcut(newAction, QList<QKeySequence>() << shortcut);
// Enable global shortcut. If that fails there is no sense in proceeding
if (!KGlobalAccel::self()->hasShortcut(newAction))
{
......
......@@ -27,7 +27,7 @@
class KAction;
class KShortcut;
class QKeySequence;
namespace KHotKeys {
......@@ -73,7 +73,7 @@ public:
QAction *addAction(
const QString &id,
const QString &text,
const KShortcut &shortcut );
const QKeySequence &shortcut );
/**
* Remove a action from the collection.
......
......@@ -37,7 +37,7 @@ ShortcutTriggerVisitor::~ShortcutTriggerVisitor()
ShortcutTrigger::ShortcutTrigger(
ActionData* data_P,
const KShortcut& shortcut,
const QKeySequence& shortcut,
const QUuid &uuid )
: Trigger( data_P ),
_uuid(uuid),
......@@ -110,9 +110,9 @@ void ShortcutTrigger::activate( bool newState )
// In case the shortcut was changed from the kcm.
auto shortcuts = KGlobalAccel::self()->shortcut(action);
if (!shortcuts.isEmpty()) {
_shortcut = KShortcut(shortcuts.first());
_shortcut = QKeySequence(shortcuts.first());
} else {
_shortcut = KShortcut();
_shortcut = QKeySequence();
}
keyboard_handler->removeAction(_uuid.toString());
}
......@@ -143,7 +143,7 @@ void ShortcutTrigger::cfg_write( KConfigGroup& cfg_P ) const
ShortcutTrigger* ShortcutTrigger::copy( ActionData* data_P ) const
{
return new ShortcutTrigger( data_P ? data_P : data, shortcut(), QUuid::createUuid());
return new ShortcutTrigger( data_P ? data_P : data, shortcut().first(), QUuid::createUuid());
}
......@@ -164,9 +164,9 @@ void ShortcutTrigger::disable()
// In case the shortcut was changed from the kcm.
auto shortcuts = KGlobalAccel::self()->shortcut(action);
if (!shortcuts.isEmpty()) {
_shortcut = KShortcut(shortcuts.first());
_shortcut = QKeySequence(shortcuts.first());
} else {
_shortcut = KShortcut();
_shortcut = QKeySequence();
}
......@@ -193,7 +193,7 @@ void ShortcutTrigger::set_key_sequence( const QKeySequence &seq )
QAction *action = keyboard_handler->getAction( _uuid.toString() );
if (!action)
{
_shortcut.setPrimary(seq);
_shortcut = seq;
}
else
{
......@@ -211,7 +211,7 @@ QList<QKeySequence> ShortcutTrigger::shortcut() const
if (!action)
{
// Not active!
return _shortcut;
return {_shortcut};
}
return KGlobalAccel::self()->shortcut(action);
......
......@@ -24,7 +24,7 @@
#include <QMap>
#include <QUuid>
#include <KShortcut>
#include <QKeySequence>
#include "khotkeysglobal.h"
#include "voicesignature.h"
......@@ -152,7 +152,7 @@ class Q_DECL_EXPORT ShortcutTrigger
public:
ShortcutTrigger(
ActionData* data,
const KShortcut& shortcut = KShortcut(),
const QKeySequence& shortcut = QKeySequence(),
const QUuid &uuid = QUuid::createUuid() );
virtual ~ShortcutTrigger();
......@@ -204,7 +204,7 @@ class Q_DECL_EXPORT ShortcutTrigger
* ourselves. Beware of synchronizing saved state, global shortcuts
* registry state and state of this var :-) .
*/
KShortcut _shortcut;
QKeySequence _shortcut;
......
......@@ -188,7 +188,7 @@ void Voice::slot_sound_recorded(const Sound &sound_P)
*/
void Voice::set_shortcut( const KShortcut &shortcut)
void Voice::set_shortcut( const QKeySequence &shortcut)
{
_shortcut = shortcut;
if( !_enabled )
......
......@@ -40,7 +40,7 @@ class Q_DECL_EXPORT Voice : public QObject
void unregister_handler( Voice_trigger* );
// bool x11Event( XEvent* e );
void set_shortcut( const KShortcut &k);
void set_shortcut( const QKeySequence &k);
/**
* return QString() is a new signature is far enough from others signature
......@@ -69,7 +69,7 @@ class Q_DECL_EXPORT Voice : public QObject
QList<Voice_trigger *> _references;
SoundRecorder *_recorder;
KShortcut _shortcut;
QKeySequence _shortcut;
KAction *_kga;
QTimer *_timer;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment