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
202
|
/*
kopeteawaydialog.h - Kopete Away Dialog
Copyright (c) 2002 by Hendrik vom Lehn <hvl@linux-4-ever.de>
Copyright (c) 2003 by Martijn Klingens <klingens@kde.org>
Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
*************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
*************************************************************************
*/
#ifndef KOPETEAWAYDIALOG_H
#define KOPETEAWAYDIALOG_H
#include <kdialogbase.h>
#include "kopete_export.h"
namespace Kopete
{
class Away;
}
class KopeteAwayDialogPrivate;
/**
* KopeteAwayDialog is a base class used for implementing
* Away Message selection dialogs in Kopete. It presents
* the user with a list of pre-written away messages and
* a line edit for them to type a "single shot" away message,
* one that is not saved and will be lost the next time
* they restart the application.
*
* Individual protocols should subclass this class for protocol
* specific Away Message choosers (in the case that the user
* wants to set only one protocol away). There are methods for
* getting the message that the user selected, as well as a
* virtual method that should be implemented that is called
* when the user selects "OK", and should be used to do
* protocol specific actions needed to set the user as
* "Away" (or whatever the protocol calls it).
*
* @author Hendrik vom Lehn <hvl@linux-4-ever.de>
* @author Christopher TenHarmsel <tenharmsel@users.sourceforge.net>
*/
class KOPETE_EXPORT KopeteAwayDialog : public KDialogBase
{
Q_OBJECT
TQ_OBJECT
public:
/**
* Constructor for the Away Dialog
* @param tqparent The object that owns this
* @param name Name for this object
*/
KopeteAwayDialog( TQWidget *tqparent = 0, const char *name = 0 );
/**
* Destructor
*/
virtual ~KopeteAwayDialog();
protected:
/**
* Do not delete this, this instance will
* deleted when the application closes
*/
Kopete::Away *awayInstance;
/**
* \brief Gets the last selected away message
* @return An away message
*/
TQString getSelectedAwayMessage();
/**
* \brief Sets the user away
*
* This method is called when the user clicks
* OK in the GUI, signalling that they wish
* to set the away message that they have chosen.
* Please reimplement this method to do protocol
* specific things, and use getSelectedAwayMessage()
* to get the text of the message that the user
* selected.
*
* @param awayType This is the away type specified
* if show was called with a parameter. If show() was called
* instead, this parameter will be the empty string. You
* will need to compare it to an enum that you declare
* in your subclass.
*/
virtual void setAway( int awayType ) = 0;
/**
* \brief Called when "Cancel" is clicked
*
* This method is called when the user clicks
* Cancel in the GUI, signalling that they
* canceled their request to mark themselves as
* away. If your implementation finds this
* information useful, implement this method
* to handle this info. By default it does nothing
*
* @param awayType This is the away type specified
* if show was called with a parameter, if show() was called
* instead, this parameter will be the empty string.
*/
virtual void cancelAway( int awayType );
public slots:
/**
* \brief Shows the dialog
*/
virtual void show();
/**
* \brief Shows the dialog
*
* Shows the away dialog, but maintains a "state"
* so you can specify if you're setting away,
* do not disturb, gone, etc for protocols that
* support this like ICQ and MSN.
*
* This string does not have any special internal
* meaning, but rather will get passed to setAway()
* when it is called so that you can decide what
* kind of "away" you really want to do.
*
* @param awayType The type of "away" you want to set.
*/
void show( int awayType );
protected slots:
/**
* This slot is called when the user click on "OK"
* it will call setAway(), which is pure virtual and
* should be implemented for specific needs
*/
virtual void slotOk();
/**
* This slot is called when the user clicks on
* "Cancel". It calls cancelAway(), which is
* pure virtual and should be implemented to
* fit your specific needs if the user selects
* "Cancel". This method will close the
* dialog, but if you require any specific actions
* please implement them in cancelAway().
*/
virtual void slotCancel();
private slots:
/**
* \brief An entry was selected from the combo box
*/
void slotComboBoxSelection( int index );
private:
/**
* Initializes the GUI elements every time the
* dialog is show. Basically used for remembering
* the singleshot message that the user may have
* typed in.
*/
void init();
/**
* The last user-entered away text
* or the title of the last selected
* saved away message, whichever was
* last chosen
*/
TQString mLastUserAwayMessage;
/**
* The last message that the user typed in the
* line edit
*/
TQString mLastUserTypedMessage;
/**
* This is used to store the type of away that we're
* going to go.
*/
int mExtendedAwayType;
KopeteAwayDialogPrivate *d;
};
#endif
// vim: set noet ts=4 sts=4 sw=4:
|