Contact cannot be a null ptr, and it is accessed before anyway. Disscussed with kedge.
[kdenetwork.git] / kppp / kpppwidget.h
blobdec03338855894205335ec9aafc13d2a864c4040
1 /*
3 * kPPP: A pppd front end for the KDE project
5 * $Id$
7 * Copyright (C) 1997 Bernd Johannes Wuebben
8 * wuebben@math.cornell.edu
10 * Copyright (C) 1998-2002 Harri Porten <porten@kde.org>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with this program; if not, write to the Free
24 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #ifndef __KPPPWIDGET_H__
28 #define __KPPPWIDGET_H__
30 #include <qstring.h>
31 //Added by qt3to4:
32 #include <QLabel>
33 #include <QFrame>
34 #include <QGridLayout>
35 #include <QEvent>
38 #include "accounting.h"
39 #include "conwindow.h"
40 #include "accounts.h"
41 #include "connect.h"
42 #include "debug.h"
43 #include "pppstatdlg.h"
46 class GeneralWidget;
47 class ModemsWidget;
48 class ModemWidget;
49 class GraphSetup;
50 class AboutWidget;
51 class PPPStats;
52 class KPageDialog;
53 class KPushButton;
55 class SignalEvent : public QEvent {
56 public:
57 SignalEvent(int s) : QEvent(User), sig(s) { }
58 int sigType() const { return sig; }
59 private:
60 int sig;
64 class KPPPWidget : public QWidget {
65 Q_OBJECT
66 public:
68 explicit KPPPWidget( QWidget *parent=0, const char *name=0 );
69 ~KPPPWidget();
71 void setPW_Edit(const QString &);
72 virtual bool eventFilter(QObject *, QEvent *);
74 void setQuitOnDisconnect (bool b);
75 bool quitOnDisconnect () {return m_bQuitOnDisconnect;}
77 private slots:
78 void newdefaultaccount(int);
79 void newdefaultmodem(int);
80 void expandbutton();
81 void quitbutton();
82 void helpbutton();
83 void setup();
84 void rulesetLoadError();
85 void usernameChanged(const QString &);
86 void passwordChanged(const QString &);
87 void enterPressedInID();
88 void enterPressedInPW();
89 void saveMyself();
90 void shutDown();
92 void delayedDisconnect();
94 public slots:
95 void beginConnect();
96 void resetaccounts();
97 void resetmodems();
98 void resetCosts(const QString &);
99 void resetVolume(const QString &);
100 void disconnect();
101 void log_window_toggled(bool on);
102 void startAccounting();
103 void stopAccounting();
104 void showStats();
105 bool isConnected() const {return connected;}
106 signals:
107 void begin_connect();
108 void cmdl_start();
110 signals: //dbus signal
111 void sig_aboutToConnect();
112 void sig_aboutToDisconnect();
113 void sig_connected();
114 void sig_disconnected();
116 public:
117 QCheckBox *log;
118 bool connected;
119 DebugWidget *debugwindow;
120 QString con_speed;
121 ConnectWidget *con;
122 ConWindow *con_win;
123 PPPStatsDlg *statdlg;
124 AccountingBase *acct;
125 KPushButton *quit_b;
126 PPPStats *stats;
128 private:
129 void prepareSetupDialog();
130 void interruptConnection();
131 void sigChld();
132 void sigPPPDDied();
133 QString encodeWord(const QString &s);
134 void showNews ();
135 void setButtons();
137 QString ruleset_load_errmsg;
139 QGridLayout *l1;
140 KPushButton *help_b;
141 KPushButton *setup_b;
142 QFrame *fline;
143 QFrame *fline1;
144 QPushButton *connect_b;
145 QComboBox *connectto_c;
146 QComboBox *modem_c;
147 QLabel *ID_Label;
148 QLabel *PW_Label;
149 QLineEdit *ID_Edit;
150 QLineEdit *PW_Edit;
151 QLabel *label1;
152 QLabel *label2;
153 QLabel *label3;
154 QLabel *label4;
155 QLabel *label5;
156 QLabel *label6;
157 QLabel *label7;
158 QLabel *radio_label;
161 KPageDialog *tabWindow;
162 AccountWidget *accounts;
163 GeneralWidget *general;
164 ModemsWidget *modems;
165 GraphSetup *graph;
166 AboutWidget *about;
169 QString m_strCmdlAccount;
170 QString m_strCmdlModem;
171 bool m_bQuitOnDisconnect;
172 bool m_bCmdlAccount;
173 bool m_bCmdlModem;
174 bool m_bModemCShown;
176 QTimer *disconnectTimer;
180 #endif