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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
/***************************************************************************
begin : 2003-07-01 17:33:00 CEST 2003
copyright : (C) 2003 by Jeroen Wijnhout
email : Jeroen.Wijnhout@kdemail.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KILEACTIONS_H
#define KILEACTIONS_H
#include <tqdict.h>
#include <tdeaction.h>
#include <kdialogbase.h>
#include <klineedit.h>
class TQCheckBox;
class TQLineEdit;
class KileInfo;
namespace KileAction
{
enum { KeepHistory=1, ShowAlternative=2, ShowBrowseButton=4, FromLabelList=8, FromBibItemList=16, ShowLabel=32, AddProjectFile=64};
/*
TagData
*/
class TagData
{
public:
TagData(const TQString &t, const TQString &tB = TQString(), const TQString &tE = TQString(), int x = 0, int y = 0, const TQString &desc = TQString())
: text(t), tagBegin(tB), tagEnd(tE), dx(x), dy(y), description(desc) {}
TagData() : text(TQString()), tagBegin(TQString()), tagEnd(TQString()), dx(0), dy(0), description(TQString()) {}
TQString text;
TQString tagBegin, tagEnd;
int dx,dy;
TQString description;
};
class Tag : public TDEAction
{
Q_OBJECT
public:
//constructors
Tag(const TQString &text, const TDEShortcut &cut, const TQObject *receiver, const char *slot, TDEActionCollection *parent, const char *name
, const TQString &tagBegin, const TQString &tagEnd = TQString(), int dx=0, int dy=0, const TQString &description = TQString());
Tag(const TQString &text, const TQString& pix, const TDEShortcut &cut, const TQObject *receiver, const char *slot, TDEActionCollection *parent, const char *name
, const TQString &tagBegin, const TQString &tagEnd = TQString(), int dx=0, int dy=0, const TQString &description = TQString());
Tag(const TQString &text, const TDEShortcut &cut, const TQObject *receiver, const char *slot, TDEActionCollection *parent, const char *name
, const TagData& data);
Tag(const TQString &text, const TQString& pix, const TDEShortcut &cut, const TQObject *receiver, const char *slot, TDEActionCollection *parent, const char *name
, const TagData& data);
~Tag();
private:
void init(const TQObject *receiver = 0, const char *slot = 0);
signals:
//sends along tagdata so that receiver knows what to insert
void activated(const KileAction::TagData&);
private slots:
//emits the activated(TagData) signal
virtual void emitData();
protected:
TagData m_data;
};
/*
InputTag: adds a history list and options for a input dialog to TagData
*/
class InputTag : public Tag
{
Q_OBJECT
public:
//constructors
InputTag(KileInfo* ki, const TQString &text, const TDEShortcut &cut, const TQObject *receiver, const char *slot, TDEActionCollection *parent, const char *name, TQWidget *wparent,uint options
, const TQString &tagBegin, const TQString &tagEnd = TQString(), int dx=0, int dy=0, const TQString &description = TQString(), const TQString &hint = TQString(), const TQString &alter = TQString());
InputTag(KileInfo* ki, const TQString &text, const TQString& pix, const TDEShortcut &cut, const TQObject *receiver, const char *slot, TDEActionCollection *parent, const char *name, TQWidget *wparent,uint options
, const TQString &tagBegin, const TQString &tagEnd = TQString(), int dx=0, int dy=0, const TQString &description = TQString(), const TQString &hint = TQString(), const TQString &alter = TQString());
InputTag(KileInfo* ki, const TQString &text, const TDEShortcut &cut, const TQObject *receiver, const char *slot, TDEActionCollection *parent, const char *name, TQWidget *wparent,uint options
, const TagData& data, const TQString &hint = TQString(), const TQString &alter = TQString());
InputTag(KileInfo* ki, const TQString &text, const TQString& pix, const TDEShortcut &cut, const TQObject *receiver, const char *slot, TDEActionCollection *parent, const char *name, TQWidget *wparent,uint options
, const TagData& data, const TQString &hint = TQString(), const TQString &alter = TQString());
~InputTag();
bool hasHistory() {return (m_options & KeepHistory); }
bool hasAlternative() { return (m_options & ShowAlternative); }
bool hasBrowseButton() { return (m_options & ShowBrowseButton); }
void addToHistory(const TQString& str) { if ( m_history.first() != str ) m_history.prepend(str); }
private:
void init();
private slots:
//emits the activated(TagData) signal
virtual void emitData();
private:
KileInfo *m_ki;
TQStringList m_history;
TQWidget *m_parent;
uint m_options;
TQString m_hint;
TQString m_alter;
};
/*
InputDialog
*/
class InputDialog : public KDialogBase
{
Q_OBJECT
public:
InputDialog(const TQString &caption, uint options, const TQStringList& history, const TQString &hint, const TQString &alter, KileInfo *ki, TQWidget *parent=0, const char *name=0);
~InputDialog();
bool useAlternative() {return m_useAlternative;}
bool useLabel() {return m_useLabel;}
bool useAddProjectFile() {return m_useAddProjectFile;}
public slots:
void slotBrowse();
void slotAltClicked();
void setTag(const TQString&);
signals:
void setInput(const TQString&);
public:
TQString tag() { return m_tag; }
TQString label();
bool usedSelection() { return m_usedSelection; }
KLineEdit *m_edLabel;
private:
TQString m_tag;
TQString m_labelprefix;
bool m_useAlternative,m_useLabel,m_usedSelection,m_useAddProjectFile;
KileInfo *m_ki;
};
class Select : public TDESelectAction
{
Q_OBJECT
public:
//constructors
Select(const TQString &text, const TDEShortcut &cut, TDEActionCollection *parent, const char *name);
private:
void init();
signals:
void activated(const TDEAction&);
public slots:
void setItems(TQPtrList<TDEAction> &);
private slots:
void emitData(const TQString&);
private:
TQDict<TDEAction> m_dict;
};
}
#endif
|