Fix two issues reported by Christoph Bartoschek ('Suspicious code in revision 867140...
[kdenetwork.git] / kppp / connect.h
blob2a8be5e41c4db510fa92757fddc28c999926394e
1 /* -*- C++ -*-
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 * based on EzPPP:
11 * Copyright (C) 1997 Jay Painter
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Library General Public
16 * License as published by the Free Software Foundation; either
17 * version 2 of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with this program; if not, write to the Free
26 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 #ifndef _CONNECT_H_
30 #define _CONNECT_H_
32 #include <qtimer.h>
33 //Added by qt3to4:
34 #include <QTimerEvent>
35 #include <QCloseEvent>
36 #include <kpushbutton.h>
37 #include <qlabel.h>
38 #include <qevent.h>
40 #include "kpppconfig.h"
41 #include "pwentry.h"
42 #include "docking.h"
43 #include "loginterm.h"
45 #define MAXLOOPNEST (MAX_SCRIPT_ENTRIES/2)
47 class PPPStats;
49 class ConnectWidget : public QWidget {
50 Q_OBJECT
51 public:
52 ConnectWidget(QWidget *parent, const char *name, PPPStats *st);
53 ~ConnectWidget();
55 public:
56 void set_con_speed_string();
57 void setMsg(const QString &);
58 void pppdDied();
60 // these are only necessary to prevent the user from clicking in the cancel
61 // button during the disconnect delay in KPPPWidget
62 void disableButtons();
63 void enableButtons();
65 signals:
66 void connected();
67 void aboutToConnect();
70 protected:
71 void timerEvent(QTimerEvent *);
72 void closeEvent( QCloseEvent *e );
74 private slots:
75 void readChar(unsigned char);
76 void pause();
77 void if_waiting_slot();
79 public slots:
80 void init();
81 void preinit();
82 void script_timed_out();
83 void if_waiting_timed_out();
84 void cancelbutton();
86 signals:
87 void if_waiting_signal();
88 void debugMessage(const QString &);
89 void toggleDebugWindow();
90 void closeDebugWindow();
91 void debugPutChar(unsigned char);
92 void startAccounting();
93 void stopAccounting();
95 public:
96 QString myreadbuffer; // we want to keep every thing in order to fish for the
98 // connection speed later on
99 QPushButton *debug;
100 int main_timer_ID;
102 private:
103 int vmain;
104 int substate;
105 int scriptindex;
106 QString scriptCommand, scriptArgument;
107 QStringList *comlist, *arglist;
109 // static const int maxloopnest=(MAX_SCRIPT_ENTRIES/2);
110 int loopnest;
111 int loopstartindex[MAXLOOPNEST];
112 bool loopend;
113 QString loopstr[MAXLOOPNEST];
115 bool semaphore;
116 QTimer *inittimer;
118 QTimer *timeout_timer;
119 bool execppp();
120 void writeline(const QString &);
121 void checkBuffers();
123 void setExpect(const QString &);
124 bool expecting;
125 QString expectstr;
127 QString readbuffer;
129 void setScan(const QString &);
130 QString scanvar;
131 QString scanstr;
132 QString scanbuffer;
133 bool scanning;
135 bool pausing;
136 PWEntry *prompt;
137 LoginTerm *termwindow;
139 int scriptTimeout;
140 QTimer *pausetimer;
141 QTimer *if_timer;
142 QTimer *if_timeout_timer;
144 QLabel *messg;
145 KPushButton *cancel;
147 bool firstrunID;
148 bool firstrunPW;
150 int dialnumber; // the current number to dial
152 PPPStats *stats;
156 // non-member function to kill&wait on the pppd child process
157 extern void killppp();
158 void adddns();
159 void addpeerdns();
160 void removedns();
161 void add_domain(const QString & newdomain);
162 void auto_hostname();
164 #endif