1 #ifndef _KVI_KVS_USERACTION_H_
2 #define _KVI_KVS_USERACTION_H_
3 //=============================================================================
4 //
5 //   File : KviKvsUserAction.h
6 //   Creation date : Tue 07 Dec 2004 02:00:24 by Szymon Stefanek
7 //
8 //   This file is part of the KVIrc IRC client distribution
9 //   Copyright (C) 2004-2010 Szymon Stefanek <pragma at kvirc dot net>
10 //
11 //   This program is FREE software. You can redistribute it and/or
12 //   modify it under the terms of the GNU General Public License
13 //   as published by the Free Software Foundation; either version 2
14 //   of the License, or (at your option) any later version.
15 //
16 //   This program is distributed in the HOPE that it will be USEFUL,
17 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 //   See the GNU General Public License for more details.
20 //
21 //   You should have received a copy of the GNU General Public License
22 //   along with this program. If not, write to the Free Software Foundation,
23 //   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //=============================================================================
26 
27 #include "kvi_settings.h"
28 #include "KviKvsAction.h"
29 
30 class KviConfigurationFile;
31 class KviKvsScript;
32 
33 class KVIRC_API KviKvsUserAction : public KviKvsAction
34 {
35 	friend class KviActionManager;
36 	Q_OBJECT
37 public:
38 	KviKvsUserAction(
39 	    QObject * pParent,
40 	    const QString & szName,
41 	    const QString & szScriptCode,
42 	    const QString & szVisibleNameCode,
43 	    const QString & szDescriptionCode,
44 	    const QString & szCategory,
45 	    const QString & szBigIconId,
46 	    const QString & szSmallIconId,
47 	    unsigned int uFlags,
48 	    const QString & szKeySequence = QString());
49 	KviKvsUserAction(QObject * pParent);
50 	~KviKvsUserAction();
51 
52 	// Static allocator function.
53 	// This MUST be used by the modules to allocate action structures
54 	// instead of the new operator.
55 	// See KviHeapObject.cpp for an explanation.
56 	static KviKvsUserAction * createInstance(
57 	    QObject * pParent,
58 	    const QString & szName,
59 	    const QString & szScriptCode,
60 	    const QString & szVisibleNameCode,
61 	    const QString & szDescriptionCode,
62 	    const QString & szCategory,
63 	    const QString & szBigIconId,
64 	    const QString & szSmallIcon,
65 	    unsigned int uFlags,
66 	    const QString & szKeySequence = QString());
suicide()67 	void suicide() { delete this; };
68 protected:
69 	QString m_szCategory;
70 	KviKvsScript * m_pDescriptionScript;
71 	KviKvsScript * m_pVisibleNameScript;
72 
73 protected:
74 	virtual bool isKviUserActionNeverOverrideThis();
75 	bool load(KviConfigurationFile * pCfg);
76 	void save(KviConfigurationFile * pCfg);
77 
78 public:
79 	virtual const QString & visibleName();
80 	virtual const QString & description();
81 	const QString & visibleNameCode();
82 	const QString & descriptionCode();
category()83 	const QString & category() { return m_szCategory; };
84 	static void exportToKvs(
85 	    QString & szBuffer,
86 	    const QString & szName,
87 	    const QString & szScriptCode,
88 	    const QString & szVisibleName,
89 	    const QString & szDescription,
90 	    const QString & szCategory,
91 	    const QString & szBigIcon,
92 	    const QString & szSmallIcon,
93 	    unsigned int uFlags,
94 	    const QString & szKeySequence);
95 	void exportToKvs(QString & szBuffer);
96 };
97 
98 #endif // _KVI_KVS_USERACTION_H_
99