File indexing completed on 2024-02-25 04:08:34

0001 /***************************************************************************
0002                           caction.cpp  -  action toolbar item
0003     This file is a part of KMuddy distribution.
0004                              -------------------
0005     begin                : Ne nov 3 2002
0006     copyright            : (C) 2002 by Tomas Mecir
0007     email                : kmuddy@kmuddy.com
0008  ***************************************************************************/
0009 
0010 /***************************************************************************
0011  *                                                                         *
0012  *   This program is free software; you can redistribute it and/or modify  *
0013  *   it under the terms of the GNU General Public License as published by  *
0014  *   the Free Software Foundation; either version 2 of the License, or     *
0015  *   (at your option) any later version.                                   *
0016  *                                                                         *
0017  ***************************************************************************/
0018 
0019 #include "caction.h"
0020 
0021 #include <kconfig.h>
0022 #include <kconfiggroup.h>
0023 
0024 cAction::cAction (int _sess) : sess(_sess)
0025 {
0026   caption = "";
0027   command = "";
0028   iconname = "";
0029   command2 = "";
0030   pushdown = false;
0031 }
0032 
0033 cAction::~cAction ()
0034 {
0035 }
0036 
0037 cSaveableField *cAction::newInstance ()
0038 {
0039   return new cAction (sess);
0040 }
0041 
0042 void cAction::load (KConfig *config, const QString &group)
0043 {
0044   KConfigGroup g = config->group (group);
0045   caption = g.readEntry ("Caption", "cmd_placeholder");
0046   command = g.readEntry ("Command", "");
0047   iconname = g.readEntry ("Icon name", "unknown");
0048   pushdown = g.readEntry ("Pushdown", false);
0049   command2 = g.readEntry ("Command2", "");
0050   
0051 }
0052 
0053 void cAction::setCaption (const QString &s)
0054 {
0055   caption = s;
0056 }
0057 
0058 QString cAction::getCaption ()
0059 {
0060   return caption;
0061 }
0062 
0063 void cAction::setCommand (const QString &s)
0064 {
0065   command = s;
0066 }
0067 
0068 void cAction::setCommand2 (const QString &s)
0069 {
0070   command2 = s;
0071 }
0072 
0073 void cAction::setPushDown (bool how)
0074 {
0075   pushdown = how;
0076 }
0077 
0078 bool cAction::isPushDown ()
0079 {
0080   return pushdown;
0081 }
0082 
0083 QString cAction::getCommand ()
0084 {
0085   return command;
0086 }
0087 
0088 QString cAction::getCommand2 ()
0089 {
0090   return command2;
0091 }
0092 
0093 void cAction::setIconName (const QString &s)
0094 {
0095   iconname = s;
0096 }
0097 
0098 QString cAction::getIconName ()
0099 {
0100   return iconname;
0101 }
0102