-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselectnthcontactaction.cpp
47 lines (37 loc) · 1.61 KB
/
selectnthcontactaction.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <QVariantList>
#include <klocalizedstring.h>
#include "globalsearchhotkeyplugin.h"
#include "selectnthcontactaction.h"
SelectNthContactAction::SelectNthContactAction(int n)
: KAction(GlobalHotkeySearchboxPlugin::self())
, n(n)
{
setText( i18n( "Open chat with contact #%1", n ) );
setWhatsThis( i18n( "Open chat with contact #%d", n ) );
setDefaultShortcut( KShortcut(Qt::ALT + (Qt::Key_0 + n)) );
connect( this, SIGNAL(triggered()), SLOT(slotTriggered()) );
}
void SelectNthContactAction::setShortcut(const KShortcut& shortcut, ShortcutTypes type) {
KAction::setShortcut(shortcut, type);
GlobalHotkeySearchboxPlugin::self()->updateActionShortcutInConfig(n);
}
SelectNthContactAction::~SelectNthContactAction() {
GlobalHotkeySearchboxPlugin::self()->updateActionShortcutInConfig(n);
}
void SelectNthContactAction::setShortcut(const QKeySequence& shortcut, ShortcutTypes type) {
KAction::setShortcut(shortcut, type);
GlobalHotkeySearchboxPlugin::self()->updateActionShortcutInConfig(n);
}
void SelectNthContactAction::setShortcuts(const QList<QKeySequence> &shortcuts, ShortcutTypes type) {
KAction::setShortcuts(shortcuts, type);
GlobalHotkeySearchboxPlugin::self()->updateActionShortcutInConfig(n);
}
void SelectNthContactAction::slotTriggered() {
GlobalHotkeySearchboxPlugin::self()->selectResult(n);
}
void SelectNthContactAction::setDefaultShortcut(const KShortcut& shortcut) {
KAction::setShortcut(shortcut, DefaultShortcut);
}
void SelectNthContactAction::setShortcutFromConfig(const KShortcut& shortcut) {
KAction::setShortcut(shortcut, ActiveShortcut);
}