File indexing completed on 2024-03-24 15:43:27

0001 /***************************************************************************
0002                           cshortcutlist.cpp  -  macro key list
0003                              -------------------
0004     begin                : St máj 28 2003
0005     copyright            : (C) 2003-2008 by Tomas Mecir
0006     email                : kmuddy@kmuddy.com
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #include "cshortcutlist.h"
0019 
0020 #include "cshortcut.h"
0021 #include "cshortcuteditor.h"
0022 
0023 cShortcutList::cShortcutList ():
0024     cList ("macrokeys")
0025 {
0026   addStringProperty ("command", "Command");
0027   addIntProperty ("key", "Key");
0028   addIntProperty ("modifiers", "Keyboard modifiers");
0029   addBoolProperty ("send", "Send the command", true);
0030   addBoolProperty ("overwrite", "Overwrite existing text on the input line", false);
0031   // script
0032   addStringProperty ("script", "Script to execute");
0033 }
0034 
0035 cShortcutList::~cShortcutList ()
0036 {
0037 }
0038 
0039 cListObject *cShortcutList::newObject ()
0040 {
0041   return new cShortcut (this);
0042 }
0043 
0044 cListEditor *cShortcutList::editor (QWidget *parent)
0045 {
0046   return new cShortcutEditor (parent);
0047 }
0048 
0049 bool cShortcutList::handleKey (int key, Qt::KeyboardModifiers state)
0050 {
0051   matched = false;
0052   currentKey = key;
0053   currentModifiers = state & (Qt::KeyboardModifierMask | Qt::KeypadModifier);
0054 
0055   traverse (SHORTCUT_MATCH);
0056 
0057   return matched;
0058 }
0059