Fix crash on logout
[kdenetwork.git] / ksirc / servercontroller.h
blobb6c2d890b111f1912bc0144ad5731f9947af98d0
1 //Added by qt3to4:
2 #include <QHideEvent>
3 #include <QCloseEvent>
4 #include <Q3Frame>
5 #include <QLabel>
6 #include <QShowEvent>
7 #include <QResizeEvent>
8 #include <Q3PopupMenu>
9 /**********************************************************************
11 --- Qt Architect generated file ---
13 File: servercontroller.h
14 Last generated: Sat Nov 29 08:50:19 1997
16 Now Under CVS control.
18 $$Id$$
20 *********************************************************************/
22 #ifndef servercontroller_included
23 #define servercontroller_included
25 class servercontroller;
26 class dockServerController;
27 class ServMessage;
28 class ProcCommand;
30 #include <q3dict.h>
31 #include <qpixmap.h>
32 #include <q3header.h>
33 #include <qtimer.h>
35 #include <k3listview.h>
36 #include <kmainwindow.h>
38 #include "ksircprocess.h"
39 #include "ksircchannel.h"
41 //#include "puke/controller.h"
42 class QLabel;
43 class KMenuBar;
44 class KSircServer;
45 class KGlobalAccel;
46 class nickColourMaker;
47 class dockServerController;
49 class ProcCommand // ServerController message
51 public:
52 static enum {
53 addTopLevel,
54 deleteTopLevel,
55 procClose,
56 newChannel,
57 changeChannel,
58 nickOnline,
59 nickOffline,
60 turnOffAutoCreate,
61 turnOnAutoCreate
62 } command;
66 class ServCommand // ServerController message
68 public:
69 static enum {
70 updateFilters,
71 updatePrefs
72 } command;
75 class scInside : Q3Frame
77 Q_OBJECT
78 friend class servercontroller;
79 public:
80 scInside ( QWidget *parent = 0L, const char * name = 0, Qt::WFlags f=0 );
81 ~scInside();
83 protected:
84 virtual void resizeEvent ( QResizeEvent * );
86 private:
87 K3ListView *ConnectionTree;
88 QLabel *ASConn;
92 class servercontroller : public KMainWindow
94 Q_OBJECT
95 friend class dockServerController;
96 public:
98 servercontroller ( QWidget* parent = 0L, const char* name = NULL );
99 virtual ~servercontroller();
101 const Q3Dict<KSircProcess> &processes() const { return proc_list; }
103 static servercontroller *self() { return s_self; }
106 * Someone is talking to the user (blue icon), notify him (using the docked icon).
108 void increaseNotificationCount(const QString& reason = QString::null, const QString& text = QString::null);
111 * The channel in which the user was talked to, has been read.
112 * -> decrease count of blue icons.
114 void decreaseNotificationCount(QString reason = QString::null);
117 * This resets all notificaiton counts and allows new ones
118 * this is used if we don't want to give the window
119 * focus to reset focus
121 void resetNotification();
123 void checkDocking();
125 //KGlobalAccel *getGlobalAccel(){ return m_kga; }
127 signals:
129 * Filter rules have changed, need to re-read and update.
131 void filters_update();
133 void ServMessage(QString server, int command, QString args);
135 public slots:
136 // All slots are described in servercontroll.cpp file
138 * Does auto-joins on start up
140 virtual void do_autoconnect();
142 * Creates popup asking for new connection
144 virtual void new_connection();
146 * Args:
147 * QString: new server name or IP to connect to.
148 * Action:
149 * Creates a new sirc process and window !default connected to the
150 * server. Does nothing if a server connection already exists.
152 // virtual void new_ksircprocess(QString);
153 virtual void new_ksircprocess(KSircServer &);
155 * Creates popup asking for new channel name
157 virtual void new_channel();
159 * Args:
160 * str: name of the new channel to be created
161 * server: name of the server channel is created on
162 * Action:
163 * opens a new toplevel on the requested channel and server
165 virtual void new_toplevel(const KSircChannel &channel);
166 virtual void new_toplevel(const KSircChannel &channel, bool safe);
168 * Action:
169 * Notify all ksircprocess' to update filters
171 virtual void slot_filters_update();
172 virtual void ToggleAutoCreate();
175 * Action: Popup a general preferences window which allows various
176 * settings, etc.
178 virtual void general_prefs();
180 * Opens the dialog that lets the user configure system notifications
182 virtual void notification_prefs();
183 virtual void font_update(const QFont&);
184 virtual void filter_rule_editor();
185 virtual void configChange();
187 virtual void ProcMessage(QString server, int command, QString args);
189 * On quit we sync the config to disk and exit
191 virtual void endksirc();
193 * Start auto-connect
195 void start_autoconnect();
197 * Start auto-connect with check
199 void start_autoconnect_check();
202 Q3ListViewItem * findChild( Q3ListViewItem *parent, const QString& text );
204 protected slots:
205 void WindowSelected(Q3ListViewItem *);
207 void dump_obj();
208 void server_debug();
210 protected:
212 virtual void showEvent( QShowEvent *e );
213 virtual void hideEvent( QHideEvent *e );
214 virtual void closeEvent( QCloseEvent * );
215 void saveDockingStatus();
217 void saveGlobalProperties(KConfig *);
218 void readGlobalProperties(KConfig *);
220 private:
221 void saveSessionConfig();
223 // La raison d'etre. We don't run ConnectionTree ourselves, but
224 // we get it from our helper class scInside.
225 K3ListView *ConnectionTree;
227 scInside *sci;
229 // Menubar for the top.
230 KMenuBar *MenuBar;
232 // Hold a list of all KSircProcess's for access latter. Index by server
233 // name
234 Q3Dict<KSircProcess> proc_list;
235 Q3PopupMenu *options, *connections;
236 int join_id, server_id;
238 //KGlobalAccel *m_kga;
240 int open_toplevels;
242 QPixmap pic_icon;
243 QPixmap pic_server;
244 QPixmap pic_gf;
245 QPixmap pic_run;
246 QPixmap pic_ppl;
248 // PukeController *PukeC;
250 // Holds dockable widget
251 dockServerController *dockWidget;
252 bool we_are_exiting;
254 // Docked icon notification
255 int m_notificationCount;
256 struct ChannelSessionInfo
258 ChannelSessionInfo()
259 : desktop( -1 ) {}
260 QString name;
261 QString port;
262 int desktop;
264 typedef QList<ChannelSessionInfo> ChannelSessionInfoList;
266 typedef QMap<QString, ChannelSessionInfoList> SessionConfigMap;
267 SessionConfigMap m_sessionConfig;
269 static servercontroller *s_self;
271 QTimer *at;
273 nickColourMaker *m_ncm;
275 #endif // servercontroller_included