File indexing completed on 2024-04-28 15:35:27

0001 /***************************************************************************
0002                           cshortcut.h  -  macro key/shortcut
0003                              -------------------
0004     begin                : St máj 28 2003
0005     copyright            : (C) 2003 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 #ifndef CSHORTCUT_H
0019 #define CSHORTCUT_H
0020 
0021 #include "csaveablefield.h"
0022 
0023 /**
0024 Represents one macro key/shortcut.
0025   *@author Tomas Mecir
0026   */
0027 
0028 class cShortcut : public cSaveableField  {
0029 public: 
0030   cShortcut (int _sess);
0031   ~cShortcut () override;
0032 
0033   /** creates a new instance of the class */
0034   cSaveableField *newInstance () override;
0035 
0036   /** load data from a config file */
0037   void load (KConfig *config, const QString &group) override;
0038 
0039   /** returns type of item (light-weight RTTI) */
0040   int itemType () override { return TYPE_SHORTCUT; };
0041 
0042   int key () { return _key; };
0043   void setKey (int what) { _key = what; };
0044   int state () { return _state; };
0045   void setState (int what) { _state = what; };
0046   bool sendIt () { return sendit; };
0047   void setSendIt (bool what) { sendit = what; };
0048   bool overwriteInput () { return overwriteinput; };
0049   void setOverwriteInput (bool what) { overwriteinput = what; };
0050   
0051 protected:
0052   int sess;
0053   
0054   int _key, _state;
0055   /** true = send, false = put to inputline */
0056   bool sendit;
0057   /**should existing text in inputline be overwritten?; only valid if
0058   sendit==false */
0059   bool overwriteinput;
0060   //command stored in getText/setText from cSaveableField
0061 };
0062 
0063 #endif