author | tille <tille> | 2003-05-25 00:47:30 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-25 00:47:30 (UTC) |
commit | 672a9a2ecd1132aadcf1043946e27339693145a4 (patch) (unidiff) | |
tree | 9393acea880576582306679081dc0d7fb16aac6c | |
parent | d1c32c127b4dabb716064a790da6be7c24975a92 (diff) | |
download | opie-672a9a2ecd1132aadcf1043946e27339693145a4.zip opie-672a9a2ecd1132aadcf1043946e27339693145a4.tar.gz opie-672a9a2ecd1132aadcf1043946e27339693145a4.tar.bz2 |
debug window gone
-rw-r--r-- | noncore/settings/networksettings/ppp/debug.cpp | 141 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/debug.h | 70 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/kpppwidget.cpp | 26 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/kpppwidget.h | 43 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/ppp.pro | 4 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppmodule.cpp | 1 |
6 files changed, 3 insertions, 282 deletions
diff --git a/noncore/settings/networksettings/ppp/debug.cpp b/noncore/settings/networksettings/ppp/debug.cpp deleted file mode 100644 index 447ccf2..0000000 --- a/noncore/settings/networksettings/ppp/debug.cpp +++ b/dev/null | |||
@@ -1,141 +0,0 @@ | |||
1 | /* | ||
2 | * kPPP: A pppd front end for the KDE project | ||
3 | * | ||
4 | * $Id$ | ||
5 | * Copyright (C) 1997 Bernd Wuebben | ||
6 | * wuebben@math.cornel.edu | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU Library General Public | ||
10 | * License as published by the Free Software Foundation; either | ||
11 | * version 2 of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * Library General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU Library General Public | ||
19 | * License along with this program; if not, write to the Free | ||
20 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | |||
23 | #include "debug.h" | ||
24 | //#include "main.h" | ||
25 | #include "pppdata.h" | ||
26 | //#include <klocale.h> | ||
27 | #define i18n QObject::tr | ||
28 | #include "kpppwidget.h" | ||
29 | #include <assert.h> | ||
30 | |||
31 | extern KPPPWidget *p_kppp; | ||
32 | |||
33 | myMultiEdit::myMultiEdit(QWidget *parent, const char *name) | ||
34 | : QMultiLineEdit(parent, name) | ||
35 | { | ||
36 | setReadOnly(true); | ||
37 | } | ||
38 | |||
39 | void myMultiEdit::insertChar(unsigned char c) { | ||
40 | QMultiLineEdit::insert(QChar(c)); | ||
41 | } | ||
42 | |||
43 | |||
44 | void myMultiEdit::newLine() { | ||
45 | QMultiLineEdit::newLine(); | ||
46 | } | ||
47 | |||
48 | |||
49 | DebugWidget::DebugWidget(QWidget *parent, const char *name) | ||
50 | : QDialog(parent, name, FALSE) | ||
51 | { | ||
52 | setCaption(i18n("Login Script Debug Window")); | ||
53 | |||
54 | text_window = new myMultiEdit(this,"debugwindow"); | ||
55 | text_window->setGeometry(2,5,400, 300); | ||
56 | // text_window->setReadOnly(FALSE); | ||
57 | |||
58 | statuslabel = new QLabel("", this, "statuslabel"); | ||
59 | |||
60 | statuslabel->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | ||
61 | statuslabel->setAlignment( AlignLeft|AlignVCenter ); | ||
62 | statuslabel->setGeometry(2, 307, 400, 20); | ||
63 | //statusPageLabel->setFont( QFont("helvetica",12,QFont::Normal) ); | ||
64 | |||
65 | dismiss = new QPushButton(this); | ||
66 | dismiss->setGeometry(330,340,70,30); | ||
67 | dismiss->setText(i18n("Close")); | ||
68 | dismiss->setFocus(); | ||
69 | connect(dismiss, SIGNAL(clicked()), SLOT(hide())); | ||
70 | |||
71 | |||
72 | /* fline = new QFrame(this,"line"); | ||
73 | fline->setFrameStyle(QFrame::HLine |QFrame::Sunken); | ||
74 | fline->setGeometry(2,332,398,5);*/ | ||
75 | adjustSize(); | ||
76 | setMinimumSize(width(),height()); | ||
77 | |||
78 | } | ||
79 | |||
80 | void DebugWidget::hideEvent(QHideEvent *) | ||
81 | { | ||
82 | assert(p_kppp); | ||
83 | // p_kppp->con->debug->setOn(false); | ||
84 | } | ||
85 | |||
86 | void DebugWidget::clear() { | ||
87 | text_window->clear(); | ||
88 | } | ||
89 | |||
90 | |||
91 | void DebugWidget::addChar(unsigned char c) { | ||
92 | QString stuff; | ||
93 | |||
94 | if(c == '\r' || c == '\n') { | ||
95 | if(c == '\n') | ||
96 | text_window->newLine(); | ||
97 | } else | ||
98 | text_window->insertChar(c); | ||
99 | } | ||
100 | |||
101 | |||
102 | void DebugWidget::statusLabel(const QString &s) { | ||
103 | statuslabel->setText(s); | ||
104 | } | ||
105 | |||
106 | |||
107 | /* | ||
108 | void DebugWidget::keyPressEvent(QKeyEvent *k) { | ||
109 | } | ||
110 | |||
111 | */ | ||
112 | void DebugWidget::resizeEvent(QResizeEvent *e){ | ||
113 | int w = width() ; | ||
114 | int h = height(); | ||
115 | e = e; | ||
116 | |||
117 | text_window->setGeometry(2,5,w - 2 ,h - 63); | ||
118 | statuslabel->setGeometry(2, h - 56 , w -2 , 20); | ||
119 | dismiss->setGeometry(w - 72 , h - 32, 70, 30); | ||
120 | // fline->setGeometry(2,h -70 ,w - 4,5); | ||
121 | } | ||
122 | |||
123 | |||
124 | void DebugWidget::enter() { | ||
125 | text_window->append("\r\n"); | ||
126 | } | ||
127 | |||
128 | |||
129 | void DebugWidget::toggleVisibility() { | ||
130 | if(isVisible()) | ||
131 | hide(); | ||
132 | else | ||
133 | show(); | ||
134 | |||
135 | bool showlog = isVisible(); | ||
136 | PPPData::data()->set_show_log_window(showlog); | ||
137 | } | ||
138 | |||
139 | |||
140 | |||
141 | |||
diff --git a/noncore/settings/networksettings/ppp/debug.h b/noncore/settings/networksettings/ppp/debug.h deleted file mode 100644 index 3565cec..0000000 --- a/noncore/settings/networksettings/ppp/debug.h +++ b/dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* | ||
2 | * kPPP: A pppd front end for the KDE project | ||
3 | * | ||
4 | * $Id$ | ||
5 | * Copyright (C) 1997 Bernd Wuebben | ||
6 | * wuebben@math.cornel.edu | ||
7 | * | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU Library General Public | ||
11 | * License as published by the Free Software Foundation; either | ||
12 | * version 2 of the License, or (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * Library General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU Library General Public | ||
20 | * License along with this program; if not, write to the Free | ||
21 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | ||
23 | |||
24 | #ifndef _DEBUGWIDGET_ | ||
25 | #define _DEBUGWIDGET_ | ||
26 | |||
27 | #include <qdialog.h> | ||
28 | #include <qstring.h> | ||
29 | #include <qlabel.h> | ||
30 | #include <qmultilineedit.h> | ||
31 | #include <qpushbutton.h> | ||
32 | |||
33 | |||
34 | class myMultiEdit : public QMultiLineEdit { | ||
35 | public: | ||
36 | |||
37 | myMultiEdit(QWidget *parent=0, const char *name=0); | ||
38 | |||
39 | void newLine(); | ||
40 | void insertChar(unsigned char c); | ||
41 | }; | ||
42 | |||
43 | |||
44 | class DebugWidget : public QDialog { | ||
45 | Q_OBJECT | ||
46 | public: | ||
47 | DebugWidget(QWidget *parent=0, const char *name=0); | ||
48 | |||
49 | void clear(); | ||
50 | |||
51 | public slots: | ||
52 | void statusLabel(const QString &); | ||
53 | void toggleVisibility(); | ||
54 | void addChar(unsigned char); | ||
55 | |||
56 | protected: | ||
57 | virtual void hideEvent(QHideEvent *); | ||
58 | virtual void resizeEvent(QResizeEvent *e); | ||
59 | |||
60 | private: | ||
61 | void enter(); | ||
62 | QFrame *fline; | ||
63 | QPushButton *dismiss; | ||
64 | myMultiEdit *text_window; | ||
65 | |||
66 | QLabel *statuslabel; | ||
67 | }; | ||
68 | |||
69 | #endif | ||
70 | |||
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp index 8d70cd4..f8a8dc3 100644 --- a/noncore/settings/networksettings/ppp/kpppwidget.cpp +++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp | |||
@@ -52,787 +52,761 @@ | |||
52 | // #include <kstandarddirs.h> | 52 | // #include <kstandarddirs.h> |
53 | // #include <kwin.h> | 53 | // #include <kwin.h> |
54 | // #include <khelpmenu.h> | 54 | // #include <khelpmenu.h> |
55 | #include <qpushbutton.h> | 55 | #include <qpushbutton.h> |
56 | //#include <kguiitem.h> | 56 | //#include <kguiitem.h> |
57 | 57 | ||
58 | #include <stdlib.h> | 58 | #include <stdlib.h> |
59 | #include <errno.h> | 59 | #include <errno.h> |
60 | #include <signal.h> | 60 | #include <signal.h> |
61 | 61 | ||
62 | #include "runtests.h" | 62 | #include "runtests.h" |
63 | 63 | ||
64 | //#include "main.h" | 64 | //#include "main.h" |
65 | #include "auth.h" | 65 | #include "auth.h" |
66 | #include "modem.h" | 66 | #include "modem.h" |
67 | //#include "ppplog.h" | 67 | //#include "ppplog.h" |
68 | //#include "opener.h" | 68 | //#include "opener.h" |
69 | //#include "requester.h" | 69 | //#include "requester.h" |
70 | //#include "pppstats.h" | 70 | //#include "pppstats.h" |
71 | #include "pppdata.h" | 71 | #include "pppdata.h" |
72 | #include "general.h" | 72 | #include "general.h" |
73 | 73 | ||
74 | #define execute_command system | 74 | #define execute_command system |
75 | 75 | ||
76 | KPPPWidget *p_kppp = 0; | 76 | KPPPWidget *p_kppp = 0; |
77 | 77 | ||
78 | KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl ) | 78 | KPPPWidget::KPPPWidget( QWidget *parent, const char *name, bool modal, WFlags fl ) |
79 | : QDialog(parent, name, modal, fl) | 79 | : QDialog(parent, name, modal, fl) |
80 | // , acct(0) | 80 | // , acct(0) |
81 | // , m_bCmdlAccount (false) | 81 | // , m_bCmdlAccount (false) |
82 | { | 82 | { |
83 | // tabWindow = 0; | 83 | // tabWindow = 0; |
84 | p_kppp = this; | 84 | p_kppp = this; |
85 | // before doing anything else, run a few tests | 85 | // before doing anything else, run a few tests |
86 | 86 | ||
87 | int result = runTests(); | 87 | int result = runTests(); |
88 | if(result == TEST_CRITICAL) | 88 | if(result == TEST_CRITICAL) |
89 | exit(4); | 89 | exit(4); |
90 | 90 | ||
91 | // installEventFilter(this); | 91 | // installEventFilter(this); |
92 | 92 | ||
93 | // QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); | 93 | // QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); |
94 | 94 | ||
95 | // QGridLayout *l1 = new QGridLayout(3, 4); | 95 | // QGridLayout *l1 = new QGridLayout(3, 4); |
96 | // tl->addLayout(l1); | 96 | // tl->addLayout(l1); |
97 | // l1->addColSpacing(0, 10); | 97 | // l1->addColSpacing(0, 10); |
98 | // l1->addColSpacing(3, 10); | 98 | // l1->addColSpacing(3, 10); |
99 | // l1->setColStretch(1, 3); | 99 | // l1->setColStretch(1, 3); |
100 | // l1->setColStretch(2, 4); | 100 | // l1->setColStretch(2, 4); |
101 | 101 | ||
102 | // label1 = new QLabel(i18n("C&onnect to: "), this); | 102 | // label1 = new QLabel(i18n("C&onnect to: "), this); |
103 | // l1->addWidget(label1, 0, 1); | 103 | // l1->addWidget(label1, 0, 1); |
104 | 104 | ||
105 | // connectto_c = new QComboBox(false, this); | 105 | // connectto_c = new QComboBox(false, this); |
106 | // label1->setBuddy(connectto_c); | 106 | // label1->setBuddy(connectto_c); |
107 | 107 | ||
108 | // connect(connectto_c, SIGNAL(activated(int)), | 108 | // connect(connectto_c, SIGNAL(activated(int)), |
109 | // SLOT(newdefaultaccount(int))); | 109 | // SLOT(newdefaultaccount(int))); |
110 | // l1->addWidget(connectto_c, 0, 2); | 110 | // l1->addWidget(connectto_c, 0, 2); |
111 | 111 | ||
112 | // ID_Label = new QLabel(i18n("&Login ID:"), this); | 112 | // ID_Label = new QLabel(i18n("&Login ID:"), this); |
113 | // l1->addWidget(ID_Label, 1, 1); | 113 | // l1->addWidget(ID_Label, 1, 1); |
114 | 114 | ||
115 | // // the entry line for usernames | 115 | // // the entry line for usernames |
116 | // ID_Edit = new QLineEdit(this); | 116 | // ID_Edit = new QLineEdit(this); |
117 | // ID_Label->setBuddy(ID_Edit); | 117 | // ID_Label->setBuddy(ID_Edit); |
118 | // l1->addWidget(ID_Edit, 1, 2); | 118 | // l1->addWidget(ID_Edit, 1, 2); |
119 | // connect(ID_Edit, SIGNAL(returnPressed()), | 119 | // connect(ID_Edit, SIGNAL(returnPressed()), |
120 | // this, SLOT(enterPressedInID())); | 120 | // this, SLOT(enterPressedInID())); |
121 | // QString tmp = i18n("<p>Type in the username that you got from your\n" | 121 | // QString tmp = i18n("<p>Type in the username that you got from your\n" |
122 | // "ISP. This is especially important for PAP\n" | 122 | // "ISP. This is especially important for PAP\n" |
123 | // "and CHAP. You may omit this when you use\n" | 123 | // "and CHAP. You may omit this when you use\n" |
124 | // "terminal-based or script-based authentication.\n" | 124 | // "terminal-based or script-based authentication.\n" |
125 | // "\n" | 125 | // "\n" |
126 | // "<b>Important</b>: case is important here:\n" | 126 | // "<b>Important</b>: case is important here:\n" |
127 | // "<i>myusername</i> is not the same as <i>MyUserName</i>!"); | 127 | // "<i>myusername</i> is not the same as <i>MyUserName</i>!"); |
128 | 128 | ||
129 | // QWhatsThis::add(ID_Label,tmp); | 129 | // QWhatsThis::add(ID_Label,tmp); |
130 | // QWhatsThis::add(ID_Edit,tmp); | 130 | // QWhatsThis::add(ID_Edit,tmp); |
131 | 131 | ||
132 | // PW_Label = new QLabel(i18n("&Password:"), this); | 132 | // PW_Label = new QLabel(i18n("&Password:"), this); |
133 | // l1->addWidget(PW_Label, 2, 1); | 133 | // l1->addWidget(PW_Label, 2, 1); |
134 | 134 | ||
135 | // PW_Edit= new QLineEdit(this); | 135 | // PW_Edit= new QLineEdit(this); |
136 | // PW_Label->setBuddy(PW_Edit); | 136 | // PW_Label->setBuddy(PW_Edit); |
137 | // PW_Edit->setEchoMode(QLineEdit::Password); | 137 | // PW_Edit->setEchoMode(QLineEdit::Password); |
138 | // l1->addWidget(PW_Edit, 2, 2); | 138 | // l1->addWidget(PW_Edit, 2, 2); |
139 | // connect(PW_Edit, SIGNAL(returnPressed()), | 139 | // connect(PW_Edit, SIGNAL(returnPressed()), |
140 | // this, SLOT(enterPressedInPW())); | 140 | // this, SLOT(enterPressedInPW())); |
141 | 141 | ||
142 | // tmp = i18n("<p>Type in the password that you got from your\n" | 142 | // tmp = i18n("<p>Type in the password that you got from your\n" |
143 | // "ISP. This is especially important for PAP\n" | 143 | // "ISP. This is especially important for PAP\n" |
144 | // "and CHAP. You may omit this when you use\n" | 144 | // "and CHAP. You may omit this when you use\n" |
145 | // "terminal-based or script-based authentication.\n" | 145 | // "terminal-based or script-based authentication.\n" |
146 | // "\n" | 146 | // "\n" |
147 | // "<b>Important</b>: case is important here:\n" | 147 | // "<b>Important</b>: case is important here:\n" |
148 | // "<i>mypassword</i> is not the same as <i>MyPassword</i>!"); | 148 | // "<i>mypassword</i> is not the same as <i>MyPassword</i>!"); |
149 | 149 | ||
150 | // QWhatsThis::add(PW_Label,tmp); | 150 | // QWhatsThis::add(PW_Label,tmp); |
151 | // QWhatsThis::add(PW_Edit,tmp); | 151 | // QWhatsThis::add(PW_Edit,tmp); |
152 | 152 | ||
153 | // QHBoxLayout *l3 = new QHBoxLayout; | 153 | // QHBoxLayout *l3 = new QHBoxLayout; |
154 | // tl->addSpacing(5); | 154 | // tl->addSpacing(5); |
155 | // tl->addLayout(l3); | 155 | // tl->addLayout(l3); |
156 | // tl->addSpacing(5); | 156 | // tl->addSpacing(5); |
157 | // l3->addSpacing(10); | 157 | // l3->addSpacing(10); |
158 | // log = new QCheckBox(i18n("Show lo&g window"), this); | 158 | // log = new QCheckBox(i18n("Show lo&g window"), this); |
159 | // connect(log, SIGNAL(toggled(bool)), | 159 | // connect(log, SIGNAL(toggled(bool)), |
160 | // this, SLOT(log_window_toggled(bool))); | 160 | // this, SLOT(log_window_toggled(bool))); |
161 | // log->setChecked(PPPData::data()->get_show_log_window()); | 161 | // log->setChecked(PPPData::data()->get_show_log_window()); |
162 | // l3->addWidget(log); | 162 | // l3->addWidget(log); |
163 | 163 | ||
164 | // QWhatsThis::add(log, | 164 | // QWhatsThis::add(log, |
165 | // i18n("<p>This controls whether a log window is shown.\n" | 165 | // i18n("<p>This controls whether a log window is shown.\n" |
166 | // "A log window shows the communication between\n" | 166 | // "A log window shows the communication between\n" |
167 | // "<i>kppp</i> and your modem. This will help you\n" | 167 | // "<i>kppp</i> and your modem. This will help you\n" |
168 | // "in tracking down problems.\n" | 168 | // "in tracking down problems.\n" |
169 | // "\n" | 169 | // "\n" |
170 | // "Turn it off if <i>kppp</i> routinely connects without\n" | 170 | // "Turn it off if <i>kppp</i> routinely connects without\n" |
171 | // "problems")); | 171 | // "problems")); |
172 | 172 | ||
173 | // // fline = new QSeparator( KSeparator::HLine, this); | 173 | // // fline = new QSeparator( KSeparator::HLine, this); |
174 | // // tl->addWidget(fline); | 174 | // // tl->addWidget(fline); |
175 | 175 | ||
176 | // QHBoxLayout *l2 = new QHBoxLayout(this); | 176 | // QHBoxLayout *l2 = new QHBoxLayout(this); |
177 | // tl->addLayout(l2); | 177 | // tl->addLayout(l2); |
178 | 178 | ||
179 | // int minw = 0; | 179 | // int minw = 0; |
180 | // quit_b = new QPushButton(i18n("&Quit"), this); | 180 | // quit_b = new QPushButton(i18n("&Quit"), this); |
181 | // // quit_b-> setGuiItem (KGuiItem(i18n("&Quit"), "exit" ) ); | 181 | // // quit_b-> setGuiItem (KGuiItem(i18n("&Quit"), "exit" ) ); |
182 | // connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton())); | 182 | // connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton())); |
183 | // if(quit_b->sizeHint().width() > minw) | 183 | // if(quit_b->sizeHint().width() > minw) |
184 | // minw = quit_b->sizeHint().width(); | 184 | // minw = quit_b->sizeHint().width(); |
185 | 185 | ||
186 | // setup_b = new QPushButton(i18n("&Setup..."), this); | 186 | // setup_b = new QPushButton(i18n("&Setup..."), this); |
187 | // // setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) ); | 187 | // // setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) ); |
188 | // connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton())); | 188 | // connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton())); |
189 | // if(setup_b->sizeHint().width() > minw) | 189 | // if(setup_b->sizeHint().width() > minw) |
190 | // minw = setup_b->sizeHint().width(); | 190 | // minw = setup_b->sizeHint().width(); |
191 | 191 | ||
192 | 192 | ||
193 | 193 | ||
194 | // if(PPPData::data()->access() != KConfig::ReadWrite) | 194 | // if(PPPData::data()->access() != KConfig::ReadWrite) |
195 | // setup_b->setEnabled(false); | 195 | // setup_b->setEnabled(false); |
196 | 196 | ||
197 | // help_b = new QPushButton(i18n("&Help"), this); | 197 | // help_b = new QPushButton(i18n("&Help"), this); |
198 | // connect( help_b, SIGNAL(clicked()), SLOT(helpbutton())); | 198 | // connect( help_b, SIGNAL(clicked()), SLOT(helpbutton())); |
199 | 199 | ||
200 | // KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true); | 200 | // KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true); |
201 | // help_b->setPopup((QPopupMenu*)helpMenu->menu()); | 201 | // help_b->setPopup((QPopupMenu*)helpMenu->menu()); |
202 | // help_b->setGuiItem (KGuiItem(i18n("&Help"), "help" ) ); | 202 | // help_b->setGuiItem (KGuiItem(i18n("&Help"), "help" ) ); |
203 | 203 | ||
204 | // if(help_b->sizeHint().width() > minw) | 204 | // if(help_b->sizeHint().width() > minw) |
205 | // minw = help_b->sizeHint().width(); | 205 | // minw = help_b->sizeHint().width(); |
206 | 206 | ||
207 | // connect_b = new QPushButton(i18n("&Connect"), this); | 207 | // connect_b = new QPushButton(i18n("&Connect"), this); |
208 | // connect_b->setDefault(true); | 208 | // connect_b->setDefault(true); |
209 | // connect_b->setFocus(); | 209 | // connect_b->setFocus(); |
210 | // connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect())); | 210 | // connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect())); |
211 | // if(connect_b->sizeHint().width() > minw) | 211 | // if(connect_b->sizeHint().width() > minw) |
212 | // minw = connect_b->sizeHint().width(); | 212 | // minw = connect_b->sizeHint().width(); |
213 | 213 | ||
214 | // quit_b->setFixedWidth(minw); | 214 | // quit_b->setFixedWidth(minw); |
215 | // setup_b->setFixedWidth(minw); | 215 | // setup_b->setFixedWidth(minw); |
216 | // // help_b->setFixedWidth(help_b->sizeHint().width()); | 216 | // // help_b->setFixedWidth(help_b->sizeHint().width()); |
217 | // connect_b->setFixedWidth(minw); | 217 | // connect_b->setFixedWidth(minw); |
218 | 218 | ||
219 | // l2->addWidget(quit_b); | 219 | // l2->addWidget(quit_b); |
220 | // l2->addWidget(setup_b); | 220 | // l2->addWidget(setup_b); |
221 | // // l2->addWidget(help_b); | 221 | // // l2->addWidget(help_b); |
222 | // l2->addSpacing(20); | 222 | // l2->addSpacing(20); |
223 | // l2->addWidget(connect_b); | 223 | // l2->addWidget(connect_b); |
224 | 224 | ||
225 | setFixedSize(sizeHint()); | 225 | setFixedSize(sizeHint()); |
226 | 226 | ||
227 | (void)new Modem; | 227 | (void)new Modem; |
228 | 228 | ||
229 | // we also connect cmld_start to the beginConnect so that I can run | 229 | // we also connect cmld_start to the beginConnect so that I can run |
230 | // the dialer through a command line argument | 230 | // the dialer through a command line argument |
231 | connect(this,SIGNAL(cmdl_start()),this,SLOT(beginConnect())); | 231 | connect(this,SIGNAL(cmdl_start()),this,SLOT(beginConnect())); |
232 | 232 | ||
233 | // stats = new PPPStats; | 233 | // stats = new PPPStats; |
234 | 234 | ||
235 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); | 235 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); |
236 | 236 | ||
237 | // constructor of con_win reads position from config file | 237 | // constructor of con_win reads position from config file |
238 | // con_win = new ConWindow(0, "conw", this); | 238 | // con_win = new ConWindow(0, "conw", this); |
239 | // KWin::setIcons(con_win->winId(), kapp->icon(), kapp->miniIcon()); | 239 | // KWin::setIcons(con_win->winId(), kapp->icon(), kapp->miniIcon()); |
240 | 240 | ||
241 | // statdlg = new PPPStatsDlg(0, "stats", this, stats); | 241 | // statdlg = new PPPStatsDlg(0, "stats", this, stats); |
242 | // statdlg->hide(); | 242 | // statdlg->hide(); |
243 | 243 | ||
244 | debugwindow = new DebugWidget(0,"debugwindow"); | ||
245 | // KWin::setIcons(debugwindow->winId(), kapp->icon(), kapp->miniIcon()); | ||
246 | debugwindow->hide(); | ||
247 | |||
248 | // load up the accounts combo box | 244 | // load up the accounts combo box |
249 | 245 | ||
250 | // resetaccounts(); | 246 | // resetaccounts(); |
251 | // con = new ConnectWidget(0, "con"); | 247 | // con = new ConnectWidget(0, "con"); |
252 | //KWin::setIcons(con->winId(), kapp->icon(), kapp->miniIcon() ); | 248 | //KWin::setIcons(con->winId(), kapp->icon(), kapp->miniIcon() ); |
253 | // connect(this, SIGNAL(begin_connect()),con, SLOT(preinit())); | 249 | // connect(this, SIGNAL(begin_connect()),con, SLOT(preinit())); |
254 | // Is this the best we can do here? it's not right. | 250 | // Is this the best we can do here? it's not right. |
255 | // QRect desk = QApplication::desktop()->screenGeometry( | 251 | // QRect desk = QApplication::desktop()->screenGeometry( |
256 | // QApplication::desktop()->screenNumber(topLevelWidget())); | 252 | // QApplication::desktop()->screenNumber(topLevelWidget())); |
257 | // con->setGeometry(desk.center().x()-175, desk.center().y()-55, 350,110); | 253 | // con->setGeometry(desk.center().x()-175, desk.center().y()-55, 350,110); |
258 | 254 | ||
259 | // connect the ConnectWidgets various signals | 255 | // connect the ConnectWidgets various signals |
260 | // connect(con, SIGNAL(closeDebugWindow()), | ||
261 | // debugwindow, SLOT(hide())); | ||
262 | // connect(con, SIGNAL(debugMessage(const QString &)), | ||
263 | // debugwindow, SLOT(statusLabel(const QString &))); | ||
264 | // connect(con, SIGNAL(toggleDebugWindow()), | ||
265 | // debugwindow, SLOT(toggleVisibility())); | ||
266 | // connect(con, SIGNAL(debugPutChar(unsigned char)), | ||
267 | // debugwindow, SLOT(addChar(unsigned char))); | ||
268 | // // connect(con, SIGNAL(startAccounting()), | 256 | // // connect(con, SIGNAL(startAccounting()), |
269 | // // this, SLOT(startAccounting())); | 257 | // // this, SLOT(startAccounting())); |
270 | // // connect(con, SIGNAL(stopAccounting()), | 258 | // // connect(con, SIGNAL(stopAccounting()), |
271 | // // this, SLOT(stopAccounting())); | 259 | // // this, SLOT(stopAccounting())); |
272 | // connect(qApp, SIGNAL(saveYourself()), | 260 | // connect(qApp, SIGNAL(saveYourself()), |
273 | // this, SLOT(saveMyself())); | 261 | // this, SLOT(saveMyself())); |
274 | // connect(qApp, SIGNAL(shutDown()), | 262 | // connect(qApp, SIGNAL(shutDown()), |
275 | // this, SLOT(shutDown())); | 263 | // this, SLOT(shutDown())); |
276 | 264 | ||
277 | // debugwindow->setGeometry(desk.center().x()+190, desk.center().y()-55, | ||
278 | // debugwindow->width(),debugwindow->height()); | ||
279 | |||
280 | // move(desk.center().x()-width()/2, desk.center().y()-height()/2); | ||
281 | |||
282 | 265 | ||
283 | // KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 266 | // KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
284 | 267 | ||
285 | // m_strCmdlAccount = args->getOption("c"); | 268 | // m_strCmdlAccount = args->getOption("c"); |
286 | // m_bQuitOnDisconnect = args->isSet("q"); | 269 | // m_bQuitOnDisconnect = args->isSet("q"); |
287 | 270 | ||
288 | // if(!m_strCmdlAccount.isEmpty()) { | 271 | // if(!m_strCmdlAccount.isEmpty()) { |
289 | // m_bCmdlAccount = true; | 272 | // m_bCmdlAccount = true; |
290 | // kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl; | 273 | // kdDebug(5002) << "cmdl_account: " << m_bCmdlAccount << endl; |
291 | // } | 274 | // } |
292 | 275 | ||
293 | // if(m_bCmdlAccount){ | 276 | // if(m_bCmdlAccount){ |
294 | // bool result = PPPData::data()->setAccount(m_strCmdlAccount); | 277 | // bool result = PPPData::data()->setAccount(m_strCmdlAccount); |
295 | // if (!result){ | 278 | // if (!result){ |
296 | // QString string; | 279 | // QString string; |
297 | // string = i18n("No such Account:\n%1").arg(m_strCmdlAccount); | 280 | // string = i18n("No such Account:\n%1").arg(m_strCmdlAccount); |
298 | // KMessageBox::error(this, string); | 281 | // KMessageBox::error(this, string); |
299 | // m_bCmdlAccount = false; | 282 | // m_bCmdlAccount = false; |
300 | // this->show(); | 283 | // this->show(); |
301 | // } else { | 284 | // } else { |
302 | // beginConnect(); | 285 | // beginConnect(); |
303 | // } | 286 | // } |
304 | // } else | 287 | // } else |
305 | // expandbutton(); | 288 | // expandbutton(); |
306 | // show(); | 289 | // show(); |
307 | 290 | ||
308 | 291 | ||
309 | //#define KPPP_SHOW_NEWS | 292 | //#define KPPP_SHOW_NEWS |
310 | #ifdef KPPP_SHOW_NEWS | 293 | #ifdef KPPP_SHOW_NEWS |
311 | // keep user informed about recent changes | 294 | // keep user informed about recent changes |
312 | if(!m_bCmdlAccount) | 295 | if(!m_bCmdlAccount) |
313 | showNews(); | 296 | showNews(); |
314 | #endif | 297 | #endif |
315 | } | 298 | } |
316 | 299 | ||
317 | KPPPWidget::~KPPPWidget() | 300 | KPPPWidget::~KPPPWidget() |
318 | { | 301 | { |
319 | p_kppp = 0; | 302 | p_kppp = 0; |
320 | // delete stats; | 303 | // delete stats; |
321 | } | 304 | } |
322 | 305 | ||
323 | // bool KPPPWidget::eventFilter(QObject *o, QEvent *e) { | 306 | // bool KPPPWidget::eventFilter(QObject *o, QEvent *e) { |
324 | // if(e->type() == QEvent::User) { | 307 | // if(e->type() == QEvent::User) { |
325 | // switch(((SignalEvent*)e)->sigType()) { | 308 | // switch(((SignalEvent*)e)->sigType()) { |
326 | // case SIGINT: | 309 | // case SIGINT: |
327 | // qDebug( "Received a SIGINT" ); | 310 | // qDebug( "Received a SIGINT" ); |
328 | // interruptConnection(); | 311 | // interruptConnection(); |
329 | // break; | 312 | // break; |
330 | // case SIGCHLD: | 313 | // case SIGCHLD: |
331 | // sigChld(); | 314 | // sigChld(); |
332 | // break; | 315 | // break; |
333 | // case SIGUSR1: | 316 | // case SIGUSR1: |
334 | // sigPPPDDied(); | 317 | // sigPPPDDied(); |
335 | // break; | 318 | // break; |
336 | // } | 319 | // } |
337 | // return true; | 320 | // return true; |
338 | // } | 321 | // } |
339 | 322 | ||
340 | // if(o == connect_b) { | 323 | // if(o == connect_b) { |
341 | // if(e->type() == QEvent::KeyPress) { | 324 | // if(e->type() == QEvent::KeyPress) { |
342 | // if(connect_b->hasFocus() && ((QKeyEvent *)e)->key() == Qt::Key_Return) { | 325 | // if(connect_b->hasFocus() && ((QKeyEvent *)e)->key() == Qt::Key_Return) { |
343 | // beginConnect(); | 326 | // beginConnect(); |
344 | // return true; | 327 | // return true; |
345 | // } | 328 | // } |
346 | // } | 329 | // } |
347 | // } | 330 | // } |
348 | 331 | ||
349 | // return false; | 332 | // return false; |
350 | // } | 333 | // } |
351 | 334 | ||
352 | 335 | ||
353 | 336 | ||
354 | 337 | ||
355 | void KPPPWidget::enterPressedInID() { | 338 | void KPPPWidget::enterPressedInID() { |
356 | PW_Edit->setFocus(); | 339 | PW_Edit->setFocus(); |
357 | } | 340 | } |
358 | 341 | ||
359 | 342 | ||
360 | void KPPPWidget::enterPressedInPW() { | 343 | void KPPPWidget::enterPressedInPW() { |
361 | connect_b->setFocus(); | 344 | connect_b->setFocus(); |
362 | } | 345 | } |
363 | 346 | ||
364 | // triggered by the session manager | 347 | // triggered by the session manager |
365 | void KPPPWidget::saveMyself() { | 348 | void KPPPWidget::saveMyself() { |
366 | PPPData::data()->save(); | 349 | PPPData::data()->save(); |
367 | } | 350 | } |
368 | 351 | ||
369 | void KPPPWidget::shutDown() { | 352 | void KPPPWidget::shutDown() { |
370 | interruptConnection(); | 353 | interruptConnection(); |
371 | saveMyself(); | 354 | saveMyself(); |
372 | } | 355 | } |
373 | 356 | ||
374 | void KPPPWidget::log_window_toggled(bool on) { | 357 | void KPPPWidget::log_window_toggled(bool on) { |
375 | PPPData::data()->set_show_log_window(on); | 358 | PPPData::data()->set_show_log_window(on); |
376 | } | 359 | } |
377 | 360 | ||
378 | 361 | ||
379 | 362 | ||
380 | 363 | ||
381 | // void KPPPWidget::resetaccounts() { | 364 | // void KPPPWidget::resetaccounts() { |
382 | // connectto_c->clear(); | 365 | // connectto_c->clear(); |
383 | 366 | ||
384 | // int count = PPPData::data()->count(); | 367 | // int count = PPPData::data()->count(); |
385 | 368 | ||
386 | // // enable/disable controls | 369 | // // enable/disable controls |
387 | // connectto_c->setEnabled(count > 0); | 370 | // connectto_c->setEnabled(count > 0); |
388 | // connect_b->setEnabled(count > 0); | 371 | // connect_b->setEnabled(count > 0); |
389 | // log->setEnabled(count > 0); | 372 | // log->setEnabled(count > 0); |
390 | // ID_Edit->setEnabled(count > 0); | 373 | // ID_Edit->setEnabled(count > 0); |
391 | // PW_Edit->setEnabled(count > 0); | 374 | // PW_Edit->setEnabled(count > 0); |
392 | 375 | ||
393 | // //load the accounts | 376 | // //load the accounts |
394 | // for(int i=0; i < count; i++) { | 377 | // for(int i=0; i < count; i++) { |
395 | // PPPData::data()->setAccountbyIndex(i); | 378 | // PPPData::data()->setAccountbyIndex(i); |
396 | // connectto_c->insertItem(PPPData::data()->accname()); | 379 | // connectto_c->insertItem(PPPData::data()->accname()); |
397 | // } | 380 | // } |
398 | 381 | ||
399 | // //set the default account | 382 | // //set the default account |
400 | // if(!PPPData::data()->defaultAccount().isEmpty()) { | 383 | // if(!PPPData::data()->defaultAccount().isEmpty()) { |
401 | // for(int i=0; i < count; i++) | 384 | // for(int i=0; i < count; i++) |
402 | // if(PPPData::data()->defaultAccount() == connectto_c->text(i)) { | 385 | // if(PPPData::data()->defaultAccount() == connectto_c->text(i)) { |
403 | // connectto_c->setCurrentItem(i); | 386 | // connectto_c->setCurrentItem(i); |
404 | // PPPData::data()->setAccountbyIndex(i); | 387 | // PPPData::data()->setAccountbyIndex(i); |
405 | 388 | ||
406 | // ID_Edit->setText(PPPData::data()->storedUsername()); | 389 | // ID_Edit->setText(PPPData::data()->storedUsername()); |
407 | // PW_Edit->setText(PPPData::data()->storedPassword()); | 390 | // PW_Edit->setText(PPPData::data()->storedPassword()); |
408 | // } | 391 | // } |
409 | // } | 392 | // } |
410 | // else | 393 | // else |
411 | // if(count > 0) { | 394 | // if(count > 0) { |
412 | // PPPData::data()->setDefaultAccount(connectto_c->text(0)); | 395 | // PPPData::data()->setDefaultAccount(connectto_c->text(0)); |
413 | // PPPData::data()->save(); | 396 | // PPPData::data()->save(); |
414 | // ID_Edit->setText(PPPData::data()->storedUsername()); | 397 | // ID_Edit->setText(PPPData::data()->storedUsername()); |
415 | // PW_Edit->setText(PPPData::data()->storedPassword()); | 398 | // PW_Edit->setText(PPPData::data()->storedPassword()); |
416 | // } | 399 | // } |
417 | 400 | ||
418 | // connect(ID_Edit, SIGNAL(textChanged(const QString &)), | 401 | // connect(ID_Edit, SIGNAL(textChanged(const QString &)), |
419 | // this, SLOT(usernameChanged(const QString &))); | 402 | // this, SLOT(usernameChanged(const QString &))); |
420 | 403 | ||
421 | // connect(PW_Edit, SIGNAL(textChanged(const QString &)), | 404 | // connect(PW_Edit, SIGNAL(textChanged(const QString &)), |
422 | // this, SLOT(passwordChanged(const QString &))); | 405 | // this, SLOT(passwordChanged(const QString &))); |
423 | 406 | ||
424 | // if (ID_Edit->text().isEmpty()) | 407 | // if (ID_Edit->text().isEmpty()) |
425 | // ID_Edit->setFocus(); | 408 | // ID_Edit->setFocus(); |
426 | // else if (PW_Edit->text().isEmpty()) | 409 | // else if (PW_Edit->text().isEmpty()) |
427 | // PW_Edit->setFocus(); | 410 | // PW_Edit->setFocus(); |
428 | // } | 411 | // } |
429 | 412 | ||
430 | 413 | ||
431 | void KPPPWidget::interruptConnection() { | 414 | void KPPPWidget::interruptConnection() { |
432 | // interrupt dial up | 415 | // interrupt dial up |
433 | // if (con->isVisible()) | 416 | // if (con->isVisible()) |
434 | // emit con->cancelbutton(); | 417 | // emit con->cancelbutton(); |
435 | 418 | ||
436 | // disconnect if online | 419 | // disconnect if online |
437 | if (PPPData::data()->pppdRunning()) | 420 | if (PPPData::data()->pppdRunning()) |
438 | emit disconnect(); | 421 | emit disconnect(); |
439 | } | 422 | } |
440 | 423 | ||
441 | 424 | ||
442 | void KPPPWidget::sigPPPDDied() { | 425 | void KPPPWidget::sigPPPDDied() { |
443 | qDebug( "Received a SIGUSR1" ); | 426 | qDebug( "Received a SIGUSR1" ); |
444 | 427 | ||
445 | // if we are not connected pppdpid is -1 so have have to check for that | 428 | // if we are not connected pppdpid is -1 so have have to check for that |
446 | // in the followin line to make sure that we don't raise a false alarm | 429 | // in the followin line to make sure that we don't raise a false alarm |
447 | // such as would be the case when the log file viewer exits. | 430 | // such as would be the case when the log file viewer exits. |
448 | if(PPPData::data()->pppdRunning() || PPPData::data()->pppdError()) { | 431 | if(PPPData::data()->pppdRunning() || PPPData::data()->pppdError()) { |
449 | qDebug( "It was pppd that died" ); | 432 | qDebug( "It was pppd that died" ); |
450 | 433 | ||
451 | // when we killpppd() on Cancel in ConnectWidget | 434 | // when we killpppd() on Cancel in ConnectWidget |
452 | // we set pppid to -1 so we won't | 435 | // we set pppid to -1 so we won't |
453 | // enter this block | 436 | // enter this block |
454 | 437 | ||
455 | // just to be sure | 438 | // just to be sure |
456 | 439 | ||
457 | Modem::modem->removeSecret(AUTH_PAP); | 440 | Modem::modem->removeSecret(AUTH_PAP); |
458 | Modem::modem->removeSecret(AUTH_CHAP); | 441 | Modem::modem->removeSecret(AUTH_CHAP); |
459 | 442 | ||
460 | PPPData::data()->setpppdRunning(false); | 443 | PPPData::data()->setpppdRunning(false); |
461 | 444 | ||
462 | qDebug( "Executing command on disconnect since pppd has died." ); | 445 | qDebug( "Executing command on disconnect since pppd has died." ); |
463 | QApplication::flushX(); | 446 | QApplication::flushX(); |
464 | execute_command(PPPData::data()->command_on_disconnect()); | 447 | execute_command(PPPData::data()->command_on_disconnect()); |
465 | 448 | ||
466 | // stopAccounting(); | 449 | // stopAccounting(); |
467 | 450 | ||
468 | // con_win->stopClock(); | 451 | // con_win->stopClock(); |
469 | // DockWidget::dock_widget->stop_stats(); | 452 | // DockWidget::dock_widget->stop_stats(); |
470 | // DockWidget::dock_widget->hide(); | 453 | // DockWidget::dock_widget->hide(); |
471 | 454 | ||
472 | if(!PPPData::data()->pppdError()) | 455 | if(!PPPData::data()->pppdError()) |
473 | PPPData::data()->setpppdError(E_PPPD_DIED); | 456 | PPPData::data()->setpppdError(E_PPPD_DIED); |
474 | removedns(); | 457 | removedns(); |
475 | Modem::modem->unlockdevice(); | 458 | Modem::modem->unlockdevice(); |
476 | // con->pppdDied(); | 459 | // con->pppdDied(); |
477 | 460 | ||
478 | if(!PPPData::data()->automatic_redial()) { | 461 | if(!PPPData::data()->automatic_redial()) { |
479 | quit_b->setFocus(); | 462 | quit_b->setFocus(); |
480 | show(); | 463 | show(); |
481 | // con_win->stopClock(); | 464 | // con_win->stopClock(); |
482 | //stopAccounting(); | 465 | //stopAccounting(); |
483 | // con_win->hide(); | 466 | // con_win->hide(); |
484 | // con->hide(); | 467 | // con->hide(); |
485 | 468 | ||
486 | PPPData::data()->setpppdRunning(false); | 469 | PPPData::data()->setpppdRunning(false); |
487 | // // not in a signal handler !!! KNotifyClient::beep(); | 470 | // // not in a signal handler !!! KNotifyClient::beep(); |
488 | QString msg; | 471 | QString msg; |
489 | if (PPPData::data()->pppdError() == E_IF_TIMEOUT) | 472 | if (PPPData::data()->pppdError() == E_IF_TIMEOUT) |
490 | msg = i18n("Timeout expired while waiting for the PPP interface " | 473 | msg = i18n("Timeout expired while waiting for the PPP interface " |
491 | "to come up!"); | 474 | "to come up!"); |
492 | else { | 475 | else { |
493 | msg = i18n("<p>The pppd daemon died unexpectedly!</p>"); | 476 | msg = i18n("<p>The pppd daemon died unexpectedly!</p>"); |
494 | Modem::modem->pppdExitStatus(); | 477 | Modem::modem->pppdExitStatus(); |
495 | if (Modem::modem->lastStatus != 99) {// more recent pppds only | 478 | if (Modem::modem->lastStatus != 99) {// more recent pppds only |
496 | msg += i18n("<p>Exit status: %1").arg(Modem::modem->lastStatus); | 479 | msg += i18n("<p>Exit status: %1").arg(Modem::modem->lastStatus); |
497 | msg += i18n("</p><p>See 'man pppd' for an explanation of the error " | 480 | msg += i18n("</p><p>See 'man pppd' for an explanation of the error " |
498 | "codes or take a look at the kppp FAQ on " | 481 | "codes or take a look at the kppp FAQ on " |
499 | " <a href=http://devel-home.kde.org/~kppp/index.html>" | 482 | " <a href=http://devel-home.kde.org/~kppp/index.html>" |
500 | "http://devel-home.kde.org/~kppp/index.html</a></p>"); | 483 | "http://devel-home.kde.org/~kppp/index.html</a></p>"); |
501 | } | 484 | } |
502 | } | 485 | } |
503 | 486 | ||
504 | // if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No) | 487 | // if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No) |
505 | // // PPPL_ShowLog(); | 488 | // // PPPL_ShowLog(); |
506 | // } else { /* reconnect on disconnect */ | 489 | // } else { /* reconnect on disconnect */ |
507 | if (false){ | 490 | if (false){ |
508 | qDebug( "Trying to reconnect... " ); | 491 | qDebug( "Trying to reconnect... " ); |
509 | 492 | ||
510 | if(PPPData::data()->authMethod() == AUTH_PAP || | 493 | if(PPPData::data()->authMethod() == AUTH_PAP || |
511 | PPPData::data()->authMethod() == AUTH_CHAP || | 494 | PPPData::data()->authMethod() == AUTH_CHAP || |
512 | PPPData::data()->authMethod() == AUTH_PAPCHAP) | 495 | PPPData::data()->authMethod() == AUTH_PAPCHAP) |
513 | Modem::modem->setSecret(PPPData::data()->authMethod(), | 496 | Modem::modem->setSecret(PPPData::data()->authMethod(), |
514 | encodeWord(PPPData::data()->storedUsername()), | 497 | encodeWord(PPPData::data()->storedUsername()), |
515 | encodeWord(PPPData::data()->password())); | 498 | encodeWord(PPPData::data()->password())); |
516 | 499 | ||
517 | // con_win->hide(); | 500 | // con_win->hide(); |
518 | // con_win->stopClock(); | 501 | // con_win->stopClock(); |
519 | //stopAccounting(); | 502 | //stopAccounting(); |
520 | PPPData::data()->setpppdRunning(false); | 503 | PPPData::data()->setpppdRunning(false); |
521 | // not in a signal handler !!!KNotifyClient::beep(); | 504 | // not in a signal handler !!!KNotifyClient::beep(); |
522 | emit cmdl_start(); | 505 | emit cmdl_start(); |
523 | } | 506 | } |
524 | } | 507 | } |
525 | PPPData::data()->setpppdError(0); | 508 | PPPData::data()->setpppdError(0); |
526 | } | 509 | } |
527 | } | 510 | } |
528 | 511 | ||
529 | // void KPPPWidget::sigChld() { | 512 | // void KPPPWidget::sigChld() { |
530 | // qDebug( "sigchld()" ); | 513 | // qDebug( "sigchld()" ); |
531 | // // pid_t id = wait(0L); | 514 | // // pid_t id = wait(0L); |
532 | // // if(id == helperPid && helperPid != -1) { | 515 | // // if(id == helperPid && helperPid != -1) { |
533 | // // kdDebug(5002) << "It was the setuid child that died" << endl; | 516 | // // kdDebug(5002) << "It was the setuid child that died" << endl; |
534 | // // helperPid = -1; | 517 | // // helperPid = -1; |
535 | // QString msg = i18n("kppp's helper process just died.\n" | 518 | // QString msg = i18n("kppp's helper process just died.\n" |
536 | // "Since a further execution would be pointless, " | 519 | // "Since a further execution would be pointless, " |
537 | // "kppp will shut down now."); | 520 | // "kppp will shut down now."); |
538 | // QMessageBox::warning(0L,"error", msg); | 521 | // QMessageBox::warning(0L,"error", msg); |
539 | // //remove_pidfile(); | 522 | // //remove_pidfile(); |
540 | // exit(1); | 523 | // exit(1); |
541 | // // } | 524 | // // } |
542 | // } | 525 | // } |
543 | 526 | ||
544 | 527 | ||
545 | void KPPPWidget::newdefaultaccount(int i) { | 528 | void KPPPWidget::newdefaultaccount(int i) { |
546 | PPPData::data()->setDefaultAccount(connectto_c->text(i)); | 529 | PPPData::data()->setDefaultAccount(connectto_c->text(i)); |
547 | PPPData::data()->save(); | 530 | PPPData::data()->save(); |
548 | ID_Edit->setText(PPPData::data()->storedUsername()); | 531 | ID_Edit->setText(PPPData::data()->storedUsername()); |
549 | PW_Edit->setText(PPPData::data()->storedPassword()); | 532 | PW_Edit->setText(PPPData::data()->storedPassword()); |
550 | } | 533 | } |
551 | 534 | ||
552 | 535 | ||
553 | 536 | ||
554 | 537 | ||
555 | void KPPPWidget::beginConnect() { | 538 | void KPPPWidget::beginConnect() { |
556 | // make sure to connect to the account that is selected in the combo box | 539 | // make sure to connect to the account that is selected in the combo box |
557 | // (exeption: an account given by a command line argument) | 540 | // (exeption: an account given by a command line argument) |
558 | // if(!m_bCmdlAccount) { | 541 | // if(!m_bCmdlAccount) { |
559 | // PPPData::data()->setAccount(connectto_c->currentText()); | 542 | // PPPData::data()->setAccount(connectto_c->currentText()); |
560 | // PPPData::data()->setPassword(PW_Edit->text()); | 543 | // PPPData::data()->setPassword(PW_Edit->text()); |
561 | // } else { | 544 | // } else { |
562 | PPPData::data()->setPassword(PPPData::data()->storedPassword()); | 545 | PPPData::data()->setPassword(PPPData::data()->storedPassword()); |
563 | // } | 546 | // } |
564 | 547 | ||
565 | QFileInfo info(pppdPath()); | 548 | QFileInfo info(pppdPath()); |
566 | 549 | ||
567 | if(!info.exists()){ | 550 | if(!info.exists()){ |
568 | QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n" | 551 | QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n" |
569 | "Make sure that pppd is installed and " | 552 | "Make sure that pppd is installed and " |
570 | "that you have entered the correct path.")); | 553 | "that you have entered the correct path.")); |
571 | return; | 554 | return; |
572 | } | 555 | } |
573 | #if 0 | 556 | #if 0 |
574 | if(!info.isExecutable()){ | 557 | if(!info.isExecutable()){ |
575 | 558 | ||
576 | QString string; | 559 | QString string; |
577 | string = i18n("kppp cannot execute:\n %1\n" | 560 | string = i18n("kppp cannot execute:\n %1\n" |
578 | "Please make sure that you have given kppp " | 561 | "Please make sure that you have given kppp " |
579 | "setuid permission and that " | 562 | "setuid permission and that " |
580 | "pppd is executable.").arg(PPPData::data()->pppdPath()); | 563 | "pppd is executable.").arg(PPPData::data()->pppdPath()); |
581 | KMessageBox::error(this, string); | 564 | KMessageBox::error(this, string); |
582 | return; | 565 | return; |
583 | 566 | ||
584 | } | 567 | } |
585 | #endif | 568 | #endif |
586 | 569 | ||
587 | QFileInfo info2(PPPData::data()->modemDevice()); | 570 | QFileInfo info2(PPPData::data()->modemDevice()); |
588 | 571 | ||
589 | if(!info2.exists()){ | 572 | if(!info2.exists()){ |
590 | QString string; | 573 | QString string; |
591 | string = i18n("kppp can not find:\n %1\nPlease make sure you have setup " | 574 | string = i18n("kppp can not find:\n %1\nPlease make sure you have setup " |
592 | "your modem device properly " | 575 | "your modem device properly " |
593 | "and/or adjust the location of the modem device on " | 576 | "and/or adjust the location of the modem device on " |
594 | "the modem tab of " | 577 | "the modem tab of " |
595 | "the setup dialog.").arg(PPPData::data()->modemDevice()); | 578 | "the setup dialog.").arg(PPPData::data()->modemDevice()); |
596 | QMessageBox::warning(this, "error", string); | 579 | QMessageBox::warning(this, "error", string); |
597 | return; | 580 | return; |
598 | } | 581 | } |
599 | 582 | ||
600 | // if this is a PAP or CHAP account, ensure that username is | 583 | // if this is a PAP or CHAP account, ensure that username is |
601 | // supplied | 584 | // supplied |
602 | if(PPPData::data()->authMethod() == AUTH_PAP || | 585 | if(PPPData::data()->authMethod() == AUTH_PAP || |
603 | PPPData::data()->authMethod() == AUTH_CHAP || | 586 | PPPData::data()->authMethod() == AUTH_CHAP || |
604 | PPPData::data()->authMethod() == AUTH_PAPCHAP ) { | 587 | PPPData::data()->authMethod() == AUTH_PAPCHAP ) { |
605 | if(ID_Edit->text().isEmpty()) { | 588 | if(ID_Edit->text().isEmpty()) { |
606 | QMessageBox::warning(this,"error", | 589 | QMessageBox::warning(this,"error", |
607 | i18n( | 590 | i18n( |
608 | "You have selected the authentication " | 591 | "You have selected the authentication " |
609 | "method PAP or CHAP. This requires that you " | 592 | "method PAP or CHAP. This requires that you " |
610 | "supply a username and a password!")); | 593 | "supply a username and a password!")); |
611 | return; | 594 | return; |
612 | } else { | 595 | } else { |
613 | if(!Modem::modem->setSecret(PPPData::data()->authMethod(), | 596 | if(!Modem::modem->setSecret(PPPData::data()->authMethod(), |
614 | encodeWord(PPPData::data()->storedUsername()), | 597 | encodeWord(PPPData::data()->storedUsername()), |
615 | encodeWord(PPPData::data()->password()))) { | 598 | encodeWord(PPPData::data()->password()))) { |
616 | QString s; | 599 | QString s; |
617 | s = i18n("Cannot create PAP/CHAP authentication\n" | 600 | s = i18n("Cannot create PAP/CHAP authentication\n" |
618 | "file \"%1\"").arg(PAP_AUTH_FILE); | 601 | "file \"%1\"").arg(PAP_AUTH_FILE); |
619 | QMessageBox::warning(this, "error", s); | 602 | QMessageBox::warning(this, "error", s); |
620 | return; | 603 | return; |
621 | } | 604 | } |
622 | } | 605 | } |
623 | } | 606 | } |
624 | 607 | ||
625 | if (PPPData::data()->phonenumber().isEmpty()) { | 608 | if (PPPData::data()->phonenumber().isEmpty()) { |
626 | QString s = i18n("You must specify a telephone number!"); | 609 | QString s = i18n("You must specify a telephone number!"); |
627 | QMessageBox::warning(this, "error", s); | 610 | QMessageBox::warning(this, "error", s); |
628 | return; | 611 | return; |
629 | } | 612 | } |
630 | 613 | ||
631 | this->hide(); | 614 | this->hide(); |
632 | 615 | ||
633 | QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname()); | 616 | QString tit = i18n("Connecting to: %1").arg(PPPData::data()->accname()); |
634 | // con->setCaption(tit); | 617 | // con->setCaption(tit); |
635 | 618 | ||
636 | // con->show(); | 619 | // con->show(); |
637 | 620 | ||
638 | bool show_debug = PPPData::data()->get_show_log_window(); | ||
639 | // con->debug->setOn(show_debug);// toggle button | ||
640 | debugwindow->clear(); | ||
641 | if (!show_debug) | ||
642 | debugwindow->hide(); | ||
643 | else { | ||
644 | debugwindow->show(); | ||
645 | // con->raise(); | ||
646 | } | ||
647 | 621 | ||
648 | emit begin_connect(); | 622 | emit begin_connect(); |
649 | } | 623 | } |
650 | 624 | ||
651 | 625 | ||
652 | void KPPPWidget::disconnect() { | 626 | void KPPPWidget::disconnect() { |
653 | if (!PPPData::data()->command_before_disconnect().isEmpty()) { | 627 | if (!PPPData::data()->command_before_disconnect().isEmpty()) { |
654 | // con_win->hide(); | 628 | // con_win->hide(); |
655 | // con->show(); | 629 | // con->show(); |
656 | // con->setCaption(i18n("Disconnecting...")); | 630 | // con->setCaption(i18n("Disconnecting...")); |
657 | // con->setMsg(i18n("Executing command before disconnection.")); | 631 | // con->setMsg(i18n("Executing command before disconnection.")); |
658 | 632 | ||
659 | qApp->processEvents(); | 633 | qApp->processEvents(); |
660 | QApplication::flushX(); | 634 | QApplication::flushX(); |
661 | // pid_t id = | 635 | // pid_t id = |
662 | execute_command(PPPData::data()->command_before_disconnect()); | 636 | execute_command(PPPData::data()->command_before_disconnect()); |
663 | // int i, status; | 637 | // int i, status; |
664 | 638 | ||
665 | // do { | 639 | // do { |
666 | // kapp->processEvents(); | 640 | // kapp->processEvents(); |
667 | // i = waitpid(id, &status, WNOHANG); | 641 | // i = waitpid(id, &status, WNOHANG); |
668 | // usleep(500000); | 642 | // usleep(500000); |
669 | // } while (i == 0 && errno == 0); | 643 | // } while (i == 0 && errno == 0); |
670 | 644 | ||
671 | // con->hide(); | 645 | // con->hide(); |
672 | } | 646 | } |
673 | 647 | ||
674 | qApp->processEvents(); | 648 | qApp->processEvents(); |
675 | 649 | ||
676 | // statdlg->stop_stats(); | 650 | // statdlg->stop_stats(); |
677 | Modem::modem->killPPPDaemon(); | 651 | Modem::modem->killPPPDaemon(); |
678 | 652 | ||
679 | QApplication::flushX(); | 653 | QApplication::flushX(); |
680 | execute_command(PPPData::data()->command_on_disconnect()); | 654 | execute_command(PPPData::data()->command_on_disconnect()); |
681 | 655 | ||
682 | Modem::modem->removeSecret(AUTH_PAP); | 656 | Modem::modem->removeSecret(AUTH_PAP); |
683 | Modem::modem->removeSecret(AUTH_CHAP); | 657 | Modem::modem->removeSecret(AUTH_CHAP); |
684 | 658 | ||
685 | removedns(); | 659 | removedns(); |
686 | Modem::modem->unlockdevice(); | 660 | Modem::modem->unlockdevice(); |
687 | 661 | ||
688 | // con_win->stopClock(); | 662 | // con_win->stopClock(); |
689 | // p_kppp->stopAccounting(); | 663 | // p_kppp->stopAccounting(); |
690 | // con_win->hide(); | 664 | // con_win->hide(); |
691 | 665 | ||
692 | // DockWidget::dock_widget->stop_stats(); | 666 | // DockWidget::dock_widget->stop_stats(); |
693 | // DockWidget::dock_widget->hide(); | 667 | // DockWidget::dock_widget->hide(); |
694 | 668 | ||
695 | // if(m_bQuitOnDisconnect) | 669 | // if(m_bQuitOnDisconnect) |
696 | // kapp->exit(0); | 670 | // kapp->exit(0); |
697 | // else { | 671 | // else { |
698 | this->quit_b->setFocus(); | 672 | this->quit_b->setFocus(); |
699 | this->show(); | 673 | this->show(); |
700 | // } | 674 | // } |
701 | } | 675 | } |
702 | 676 | ||
703 | 677 | ||
704 | // void KPPPWidget::helpbutton() { | 678 | // void KPPPWidget::helpbutton() { |
705 | // kapp->invokeHelp(); | 679 | // kapp->invokeHelp(); |
706 | // } | 680 | // } |
707 | 681 | ||
708 | 682 | ||
709 | void KPPPWidget::quitbutton() { | 683 | void KPPPWidget::quitbutton() { |
710 | if(PPPData::data()->pppdRunning()) { | 684 | if(PPPData::data()->pppdRunning()) { |
711 | int ok = QMessageBox::warning(this, | 685 | int ok = QMessageBox::warning(this, |
712 | i18n("Exiting kPPP will close your PPP Session."), | 686 | i18n("Exiting kPPP will close your PPP Session."), |
713 | i18n("Quit kPPP?")); | 687 | i18n("Quit kPPP?")); |
714 | if(ok == QMessageBox::Yes) { | 688 | if(ok == QMessageBox::Yes) { |
715 | Modem::modem->killPPPDaemon(); | 689 | Modem::modem->killPPPDaemon(); |
716 | QApplication::flushX(); | 690 | QApplication::flushX(); |
717 | execute_command(PPPData::data()->command_on_disconnect()); | 691 | execute_command(PPPData::data()->command_on_disconnect()); |
718 | removedns(); | 692 | removedns(); |
719 | Modem::modem->unlockdevice(); | 693 | Modem::modem->unlockdevice(); |
720 | } | 694 | } |
721 | } else { | 695 | } else { |
722 | if (!PPPData::data()->accname().isEmpty() && !PPPData::data()->storePassword()) | 696 | if (!PPPData::data()->accname().isEmpty() && !PPPData::data()->storePassword()) |
723 | PPPData::data()->setStoredPassword(""); | 697 | PPPData::data()->setStoredPassword(""); |
724 | } | 698 | } |
725 | PPPData::data()->save(); | 699 | PPPData::data()->save(); |
726 | qApp->quit(); | 700 | qApp->quit(); |
727 | } | 701 | } |
728 | 702 | ||
729 | 703 | ||
730 | // void KPPPWidget::rulesetLoadError() { | 704 | // void KPPPWidget::rulesetLoadError() { |
731 | // QMessageBox::warning(this,"error", ruleset_load_errmsg); | 705 | // QMessageBox::warning(this,"error", ruleset_load_errmsg); |
732 | // } | 706 | // } |
733 | 707 | ||
734 | 708 | ||
735 | // void KPPPWidget::startAccounting() { | 709 | // void KPPPWidget::startAccounting() { |
736 | // // volume accounting | 710 | // // volume accounting |
737 | // stats->totalbytes = 0; | 711 | // stats->totalbytes = 0; |
738 | 712 | ||
739 | // kdDebug() << "AcctEnabled: " << PPPData::data()->AcctEnabled() << endl; | 713 | // kdDebug() << "AcctEnabled: " << PPPData::data()->AcctEnabled() << endl; |
740 | 714 | ||
741 | // // load the ruleset | 715 | // // load the ruleset |
742 | // if(!PPPData::data()->AcctEnabled()) | 716 | // if(!PPPData::data()->AcctEnabled()) |
743 | // return; | 717 | // return; |
744 | 718 | ||
745 | // QString d = AccountingBase::getAccountingFile(PPPData::data()->accountingFile()); | 719 | // QString d = AccountingBase::getAccountingFile(PPPData::data()->accountingFile()); |
746 | // // if(::access(d.data(), X_OK) != 0) | 720 | // // if(::access(d.data(), X_OK) != 0) |
747 | // acct = new Accounting(this, stats); | 721 | // acct = new Accounting(this, stats); |
748 | // // else | 722 | // // else |
749 | // // acct = new ExecutableAccounting(this); | 723 | // // acct = new ExecutableAccounting(this); |
750 | 724 | ||
751 | // // connect to the accounting object | 725 | // // connect to the accounting object |
752 | // connect(acct, SIGNAL(changed(QString, QString)), | 726 | // connect(acct, SIGNAL(changed(QString, QString)), |
753 | // con_win, SLOT(slotAccounting(QString, QString))); | 727 | // con_win, SLOT(slotAccounting(QString, QString))); |
754 | 728 | ||
755 | // // if(!acct->loadRuleSet(PPPData::data()->accountingFile())) { | 729 | // // if(!acct->loadRuleSet(PPPData::data()->accountingFile())) { |
756 | // // QString s= i18n("Can not load the accounting " | 730 | // // QString s= i18n("Can not load the accounting " |
757 | // // "ruleset \"%1\"!").arg(PPPData::data()->accountingFile()); | 731 | // // "ruleset \"%1\"!").arg(PPPData::data()->accountingFile()); |
758 | 732 | ||
759 | // // starting the messagebox with a timer will prevent us | 733 | // // starting the messagebox with a timer will prevent us |
760 | // // from blocking the calling function ConnectWidget::timerEvent | 734 | // // from blocking the calling function ConnectWidget::timerEvent |
761 | // ruleset_load_errmsg = s; | 735 | // ruleset_load_errmsg = s; |
762 | // QTimer::singleShot(0, this, SLOT(rulesetLoadError())); | 736 | // QTimer::singleShot(0, this, SLOT(rulesetLoadError())); |
763 | // return; | 737 | // return; |
764 | // } | 738 | // } |
765 | // //else | 739 | // //else |
766 | // // acct->slotStart(); | 740 | // // acct->slotStart(); |
767 | // } | 741 | // } |
768 | 742 | ||
769 | // void KPPPWidget::stopAccounting() { | 743 | // void KPPPWidget::stopAccounting() { |
770 | // // store volume accounting | 744 | // // store volume accounting |
771 | // // if(stats->totalbytes != 0) | 745 | // // if(stats->totalbytes != 0) |
772 | // // PPPData::data()->setTotalBytes(stats->totalbytes); | 746 | // // PPPData::data()->setTotalBytes(stats->totalbytes); |
773 | 747 | ||
774 | // if(!PPPData::data()->AcctEnabled()) | 748 | // if(!PPPData::data()->AcctEnabled()) |
775 | // return; | 749 | // return; |
776 | 750 | ||
777 | // // if(acct != 0) { | 751 | // // if(acct != 0) { |
778 | // // acct->slotStop(); | 752 | // // acct->slotStop(); |
779 | // // delete acct; | 753 | // // delete acct; |
780 | // // acct = 0; | 754 | // // acct = 0; |
781 | // // } | 755 | // // } |
782 | // } | 756 | // } |
783 | 757 | ||
784 | 758 | ||
785 | // void KPPPWidget::showStats() { | 759 | // void KPPPWidget::showStats() { |
786 | // if(statdlg) { | 760 | // if(statdlg) { |
787 | // statdlg->show(); | 761 | // statdlg->show(); |
788 | // statdlg->raise(); | 762 | // statdlg->raise(); |
789 | // } | 763 | // } |
790 | // } | 764 | // } |
791 | 765 | ||
792 | 766 | ||
793 | void KPPPWidget::usernameChanged(const QString &) { | 767 | void KPPPWidget::usernameChanged(const QString &) { |
794 | // store username for later use | 768 | // store username for later use |
795 | PPPData::data()->setStoredUsername(ID_Edit->text()); | 769 | PPPData::data()->setStoredUsername(ID_Edit->text()); |
796 | } | 770 | } |
797 | 771 | ||
798 | 772 | ||
799 | void KPPPWidget::passwordChanged(const QString &) { | 773 | void KPPPWidget::passwordChanged(const QString &) { |
800 | // store the password if so requested | 774 | // store the password if so requested |
801 | if(PPPData::data()->storePassword()) | 775 | if(PPPData::data()->storePassword()) |
802 | PPPData::data()->setStoredPassword(PW_Edit->text()); | 776 | PPPData::data()->setStoredPassword(PW_Edit->text()); |
803 | else | 777 | else |
804 | PPPData::data()->setStoredPassword(""); | 778 | PPPData::data()->setStoredPassword(""); |
805 | } | 779 | } |
806 | 780 | ||
807 | 781 | ||
808 | void KPPPWidget::setPW_Edit(const QString &pw) { | 782 | void KPPPWidget::setPW_Edit(const QString &pw) { |
809 | PW_Edit->setText(pw); | 783 | PW_Edit->setText(pw); |
810 | } | 784 | } |
811 | 785 | ||
812 | 786 | ||
813 | // void KPPPWidget::resetCosts(const QString &s) { | 787 | // void KPPPWidget::resetCosts(const QString &s) { |
814 | // AccountingBase::resetCosts(s); | 788 | // AccountingBase::resetCosts(s); |
815 | // } | 789 | // } |
816 | 790 | ||
817 | 791 | ||
818 | // void KPPPWidget::resetVolume(const QString &s) { | 792 | // void KPPPWidget::resetVolume(const QString &s) { |
819 | // AccountingBase::resetVolume(s); | 793 | // AccountingBase::resetVolume(s); |
820 | // } | 794 | // } |
821 | 795 | ||
822 | /** | 796 | /** |
823 | * pppd's getword() function knows about escape characters. | 797 | * pppd's getword() function knows about escape characters. |
824 | * If we write the username and password to the secrets file | 798 | * If we write the username and password to the secrets file |
825 | * we'll therefore have to escape back slashes. | 799 | * we'll therefore have to escape back slashes. |
826 | */ | 800 | */ |
827 | QString KPPPWidget::encodeWord(const QString &s) { | 801 | QString KPPPWidget::encodeWord(const QString &s) { |
828 | QString r = s; | 802 | QString r = s; |
829 | r.replace(QRegExp("\\"), "\\\\"); | 803 | r.replace(QRegExp("\\"), "\\\\"); |
830 | return r; | 804 | return r; |
831 | } | 805 | } |
832 | 806 | ||
833 | // void KPPPWidget::setQuitOnDisconnect (bool b) | 807 | // void KPPPWidget::setQuitOnDisconnect (bool b) |
834 | // { | 808 | // { |
835 | // m_bQuitOnDisconnect = b; | 809 | // m_bQuitOnDisconnect = b; |
836 | // } | 810 | // } |
837 | 811 | ||
838 | void KPPPWidget::showNews() { | 812 | void KPPPWidget::showNews() { |
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.h b/noncore/settings/networksettings/ppp/kpppwidget.h index 266d829..d7e74af 100644 --- a/noncore/settings/networksettings/ppp/kpppwidget.h +++ b/noncore/settings/networksettings/ppp/kpppwidget.h | |||
@@ -1,157 +1,114 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * kPPP: A pppd front end for the KDE project | 3 | * kPPP: A pppd front end for the KDE project |
4 | * | 4 | * |
5 | * $Id$ | 5 | * $Id$ |
6 | * | 6 | * |
7 | * Copyright (C) 1997 Bernd Johannes Wuebben | 7 | * Copyright (C) 1997 Bernd Johannes Wuebben |
8 | * wuebben@math.cornell.edu | 8 | * wuebben@math.cornell.edu |
9 | * | 9 | * |
10 | * Copyright (C) 1998-2002 Harri Porten <porten@kde.org> | 10 | * Copyright (C) 1998-2002 Harri Porten <porten@kde.org> |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU Library General Public | 13 | * modify it under the terms of the GNU Library General Public |
14 | * License as published by the Free Software Foundation; either | 14 | * License as published by the Free Software Foundation; either |
15 | * version 2 of the License, or (at your option) any later version. | 15 | * version 2 of the License, or (at your option) any later version. |
16 | * | 16 | * |
17 | * This program is distributed in the hope that it will be useful, | 17 | * This program is distributed in the hope that it will be useful, |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
20 | * Library General Public License for more details. | 20 | * Library General Public License for more details. |
21 | * | 21 | * |
22 | * You should have received a copy of the GNU Library General Public | 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 | 23 | * License along with this program; if not, write to the Free |
24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 24 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef __KPPPWIDGET_H__ | 27 | #ifndef __KPPPWIDGET_H__ |
28 | #define __KPPPWIDGET_H__ | 28 | #define __KPPPWIDGET_H__ |
29 | 29 | ||
30 | #include <qstring.h> | 30 | #include <qstring.h> |
31 | 31 | ||
32 | //#include "accounting.h" | ||
33 | #include "conwindow.h" | 32 | #include "conwindow.h" |
34 | #include "accounts.h" | 33 | #include "accounts.h" |
35 | #include "connect.h" | 34 | #include "connect.h" |
36 | #include "debug.h" | ||
37 | //#include "pppstatdlg.h" | ||
38 | 35 | ||
39 | //class GraphSetup; | ||
40 | //class AboutWidget; | ||
41 | //class PPPStats; | ||
42 | class QDialog; | ||
43 | class QPushButton; | 36 | class QPushButton; |
44 | 37 | ||
45 | /* class SignalEvent : public QEvent { */ | ||
46 | /* public: */ | ||
47 | /* SignalEvent(int s) : QEvent(User), sig(s) { } */ | ||
48 | /* int sigType() const { return sig; } */ | ||
49 | /* private: */ | ||
50 | /* int sig; */ | ||
51 | /* }; */ | ||
52 | |||
53 | 38 | ||
54 | class KPPPWidget : public QDialog { | 39 | class KPPPWidget : public QDialog { |
55 | Q_OBJECT | 40 | Q_OBJECT |
56 | public: | 41 | public: |
57 | 42 | ||
58 | KPPPWidget( QWidget *parent=0, const char *name=0, bool modal = false, WFlags fl = 0 ); | 43 | KPPPWidget( QWidget *parent=0, const char *name=0, bool modal = false, WFlags fl = 0 ); |
59 | ~KPPPWidget(); | 44 | ~KPPPWidget(); |
60 | 45 | ||
61 | void setPW_Edit(const QString &); | 46 | void setPW_Edit(const QString &); |
62 | // virtual bool eventFilter(QObject *, QEvent *); | ||
63 | 47 | ||
64 | void setQuitOnDisconnect (bool b); | ||
65 | // bool quitOnDisconnect () {return m_bQuitOnDisconnect;}; | ||
66 | 48 | ||
67 | private slots: | 49 | private slots: |
68 | void newdefaultaccount(int); | 50 | void newdefaultaccount(int); |
69 | // void expandbutton(); | ||
70 | void beginConnect(); | 51 | void beginConnect(); |
71 | void quitbutton(); | 52 | void quitbutton(); |
72 | // void helpbutton(); | ||
73 | // void setup(); | ||
74 | // void rulesetLoadError(); | ||
75 | void usernameChanged(const QString &); | 53 | void usernameChanged(const QString &); |
76 | void passwordChanged(const QString &); | 54 | void passwordChanged(const QString &); |
77 | void enterPressedInID(); | 55 | void enterPressedInID(); |
78 | void enterPressedInPW(); | 56 | void enterPressedInPW(); |
79 | void saveMyself(); | 57 | void saveMyself(); |
80 | void shutDown(); | 58 | void shutDown(); |
81 | 59 | ||
82 | /* protected slots: */ | ||
83 | /* virtual void accept(); */ | ||
84 | /* virtual void reject(); */ | ||
85 | 60 | ||
86 | public slots: | 61 | public slots: |
87 | // void resetaccounts(); | ||
88 | /* void resetCosts(const QString &); */ | ||
89 | /* void resetVolume(const QString &); */ | ||
90 | void disconnect(); | 62 | void disconnect(); |
91 | void log_window_toggled(bool on); | 63 | void log_window_toggled(bool on); |
92 | /* void startAccounting(); */ | ||
93 | /* void stopAccounting(); */ | ||
94 | /* void showStats(); */ | ||
95 | 64 | ||
96 | signals: | 65 | signals: |
97 | void begin_connect(); | 66 | void begin_connect(); |
98 | void cmdl_start(); | 67 | void cmdl_start(); |
99 | 68 | ||
100 | public: | 69 | public: |
101 | QCheckBox *log; | 70 | QCheckBox *log; |
102 | bool connected; | 71 | bool connected; |
103 | DebugWidget *debugwindow; | ||
104 | QString con_speed; | 72 | QString con_speed; |
105 | // ConnectWidget *con; | 73 | // ConnectWidget *con; |
106 | // ConWindow *con_win; | 74 | // ConWindow *con_win; |
107 | // PPPStatsDlg *statdlg; | 75 | // PPPStatsDlg *statdlg; |
108 | // AccountingBase *acct; | 76 | // AccountingBase *acct; |
109 | QPushButton *quit_b; | 77 | QPushButton *quit_b; |
110 | //PPPStats *stats; | 78 | //PPPStats *stats; |
111 | 79 | ||
112 | private: | 80 | private: |
113 | // void prepareSetupDialog(); | 81 | // void prepareSetupDialog(); |
114 | void interruptConnection(); | 82 | void interruptConnection(); |
115 | void sigChld(); | 83 | void sigChld(); |
116 | void sigPPPDDied(); | 84 | void sigPPPDDied(); |
117 | QString encodeWord(const QString &s); | 85 | QString encodeWord(const QString &s); |
118 | void showNews (); | 86 | void showNews (); |
119 | 87 | ||
120 | QString ruleset_load_errmsg; | 88 | QString ruleset_load_errmsg; |
121 | 89 | ||
122 | // QPushButton *help_b; | ||
123 | QPushButton *setup_b; | 90 | QPushButton *setup_b; |
124 | QFrame *fline; | 91 | QFrame *fline; |
125 | QFrame *fline1; | 92 | QFrame *fline1; |
126 | QPushButton *connect_b; | 93 | QPushButton *connect_b; |
127 | QComboBox *connectto_c; | 94 | QComboBox *connectto_c; |
128 | QLabel *ID_Label; | 95 | QLabel *ID_Label; |
129 | QLabel *PW_Label; | 96 | QLabel *PW_Label; |
130 | QLineEdit *ID_Edit; | 97 | QLineEdit *ID_Edit; |
131 | QLineEdit *PW_Edit; | 98 | QLineEdit *PW_Edit; |
132 | QLabel *label1; | 99 | QLabel *label1; |
133 | QLabel *label2; | 100 | QLabel *label2; |
134 | QLabel *label3; | 101 | QLabel *label3; |
135 | QLabel *label4; | 102 | QLabel *label4; |
136 | QLabel *label5; | 103 | QLabel *label5; |
137 | QLabel *label6; | 104 | QLabel *label6; |
138 | QLabel *radio_label; | 105 | QLabel *radio_label; |
139 | 106 | ||
140 | |||
141 | // QTabWidget *tabWindow; | ||
142 | // AccountWidget *accounts; | ||
143 | // GeneralWidget *general; | ||
144 | // ModemWidget *modem1; | ||
145 | // ModemWidget2 *modem2; | ||
146 | // GraphSetup *graph; | ||
147 | // AboutWidget *about; | ||
148 | |||
149 | |||
150 | /* QString m_strCmdlAccount; */ | 107 | /* QString m_strCmdlAccount; */ |
151 | /* bool m_bQuitOnDisconnect; */ | 108 | /* bool m_bQuitOnDisconnect; */ |
152 | /* bool m_bCmdlAccount; */ | 109 | /* bool m_bCmdlAccount; */ |
153 | }; | 110 | }; |
154 | 111 | ||
155 | 112 | ||
156 | #endif | 113 | #endif |
157 | 114 | ||
diff --git a/noncore/settings/networksettings/ppp/ppp.pro b/noncore/settings/networksettings/ppp/ppp.pro index ebfc713..a2e0118 100644 --- a/noncore/settings/networksettings/ppp/ppp.pro +++ b/noncore/settings/networksettings/ppp/ppp.pro | |||
@@ -1,18 +1,18 @@ | |||
1 | #TEMPLATE = app | 1 | #TEMPLATE = app |
2 | # | 2 | # |
3 | TEMPLATE = lib | 3 | TEMPLATE = lib |
4 | #CONFIG += qt warn_on release | 4 | #CONFIG += qt warn_on release |
5 | CONFIG += qt warn_on debug | 5 | CONFIG += qt warn_on debug |
6 | DESTDIR = $(OPIEDIR)/plugins/networksettings | 6 | DESTDIR = $(OPIEDIR)/plugins/networksettings |
7 | HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h knuminput.h knumvalidator.h kpppwidget.h conwindow.h debug.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h | 7 | HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h knuminput.h knumvalidator.h kpppwidget.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h |
8 | SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp knuminput.cpp knumvalidator.cpp kpppwidget.cpp conwindow.cpp debug.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp | 8 | SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp knuminput.cpp knumvalidator.cpp kpppwidget.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp |
9 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ | 9 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ |
10 | DEPENDPATH+= $(OPIEDIR)/include | 10 | DEPENDPATH+= $(OPIEDIR)/include |
11 | LIBS += -lqpe -L../interfaces/ -linterfaces | 11 | LIBS += -lqpe -L../interfaces/ -linterfaces |
12 | INTERFACES= | 12 | INTERFACES= |
13 | TARGET = pppplugin | 13 | TARGET = pppplugin |
14 | VERSION = 1.0.0 | 14 | VERSION = 1.0.0 |
15 | 15 | ||
16 | 16 | ||
17 | 17 | ||
18 | include ( $(OPIEDIR)/include.pro ) | 18 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp index e13f8c8..fb2f3e5 100644 --- a/noncore/settings/networksettings/ppp/pppmodule.cpp +++ b/noncore/settings/networksettings/ppp/pppmodule.cpp | |||
@@ -1,125 +1,126 @@ | |||
1 | #include "pppconfig.h" | 1 | #include "pppconfig.h" |
2 | #include "pppmodule.h" | 2 | #include "pppmodule.h" |
3 | #include "pppdata.h" | 3 | #include "pppdata.h" |
4 | #include "kpppwidget.h" | 4 | #include "kpppwidget.h" |
5 | #include "interfaceinformationimp.h" | 5 | #include "interfaceinformationimp.h" |
6 | //#include "devices.h" | 6 | //#include "devices.h" |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * Constructor, find all of the possible interfaces | 9 | * Constructor, find all of the possible interfaces |
10 | */ | 10 | */ |
11 | PPPModule::PPPModule() : Module() | 11 | PPPModule::PPPModule() : Module() |
12 | { | 12 | { |
13 | Interface *iface; | 13 | Interface *iface; |
14 | iface = new Interface( 0, "device" ); | 14 | iface = new Interface( 0, "device" ); |
15 | iface->setHardwareName( "account" ); | 15 | iface->setHardwareName( "account" ); |
16 | list.append( iface ); | 16 | list.append( iface ); |
17 | } | 17 | } |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Delete any interfaces that we own. | 20 | * Delete any interfaces that we own. |
21 | */ | 21 | */ |
22 | PPPModule::~PPPModule(){ | 22 | PPPModule::~PPPModule(){ |
23 | Interface *i; | 23 | Interface *i; |
24 | for ( i=list.first(); i != 0; i=list.next() ) | 24 | for ( i=list.first(); i != 0; i=list.next() ) |
25 | delete i; | 25 | delete i; |
26 | } | 26 | } |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Change the current profile | 29 | * Change the current profile |
30 | */ | 30 | */ |
31 | void PPPModule::setProfile(const QString &newProfile){ | 31 | void PPPModule::setProfile(const QString &newProfile){ |
32 | profile = newProfile; | 32 | profile = newProfile; |
33 | } | 33 | } |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * get the icon name for this device. | 36 | * get the icon name for this device. |
37 | * @param Interface* can be used in determining the icon. | 37 | * @param Interface* can be used in determining the icon. |
38 | * @return QString the icon name (minus .png, .gif etc) | 38 | * @return QString the icon name (minus .png, .gif etc) |
39 | */ | 39 | */ |
40 | QString PPPModule::getPixmapName(Interface* ){ | 40 | QString PPPModule::getPixmapName(Interface* ){ |
41 | return "ppp"; | 41 | return "ppp"; |
42 | } | 42 | } |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Check to see if the interface i is owned by this module. | 45 | * Check to see if the interface i is owned by this module. |
46 | * @param Interface* interface to check against | 46 | * @param Interface* interface to check against |
47 | * @return bool true if i is owned by this module, false otherwise. | 47 | * @return bool true if i is owned by this module, false otherwise. |
48 | */ | 48 | */ |
49 | bool PPPModule::isOwner(Interface *i){ | 49 | bool PPPModule::isOwner(Interface *i){ |
50 | return list.find( i ) != -1; | 50 | return list.find( i ) != -1; |
51 | } | 51 | } |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Create, and return the WLANConfigure Module | 54 | * Create, and return the WLANConfigure Module |
55 | * @return QWidget* pointer to this modules configure. | 55 | * @return QWidget* pointer to this modules configure. |
56 | */ | 56 | */ |
57 | QWidget *PPPModule::configure(Interface *i){ | 57 | QWidget *PPPModule::configure(Interface *i){ |
58 | qDebug("return ModemWidget"); | 58 | qDebug("return ModemWidget"); |
59 | PPPConfigWidget *pppconfig = new PPPConfigWidget( 0, "PPPConfig", false, | 59 | PPPConfigWidget *pppconfig = new PPPConfigWidget( 0, "PPPConfig", false, |
60 | Qt::WDestructiveClose ); | 60 | Qt::WDestructiveClose ); |
61 | return pppconfig; | 61 | return pppconfig; |
62 | } | 62 | } |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Create, and return the Information Module | 65 | * Create, and return the Information Module |
66 | * @return QWidget* pointer to this modules info. | 66 | * @return QWidget* pointer to this modules info. |
67 | */ | 67 | */ |
68 | QWidget *PPPModule::information(Interface *i){ | 68 | QWidget *PPPModule::information(Interface *i){ |
69 | // We don't have any advanced pppd information widget yet :-D | 69 | // We don't have any advanced pppd information widget yet :-D |
70 | // TODO ^ | 70 | // TODO ^ |
71 | qDebug("return PPPModule::information"); | 71 | qDebug("return PPPModule::information"); |
72 | InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i); | 72 | InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i); |
73 | return information; | 73 | return information; |
74 | } | 74 | } |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Get all active (up or down) interfaces | 77 | * Get all active (up or down) interfaces |
78 | * @return QList<Interface> A list of interfaces that exsist that havn't | 78 | * @return QList<Interface> A list of interfaces that exsist that havn't |
79 | * been called by isOwner() | 79 | * been called by isOwner() |
80 | */ | 80 | */ |
81 | QList<Interface> PPPModule::getInterfaces(){ | 81 | QList<Interface> PPPModule::getInterfaces(){ |
82 | // List all of the files in the peer directory | 82 | // List all of the files in the peer directory |
83 | qDebug("PPPModule::getInterfaces"); | ||
83 | return list; | 84 | return list; |
84 | } | 85 | } |
85 | 86 | ||
86 | /** | 87 | /** |
87 | * Attempt to add a new interface as defined by name | 88 | * Attempt to add a new interface as defined by name |
88 | * @param name the name of the type of interface that should be created given | 89 | * @param name the name of the type of interface that should be created given |
89 | * by possibleNewInterfaces(); | 90 | * by possibleNewInterfaces(); |
90 | * @return Interface* NULL if it was unable to be created. | 91 | * @return Interface* NULL if it was unable to be created. |
91 | */ | 92 | */ |
92 | Interface *PPPModule::addNewInterface(const QString &newInterface){ | 93 | Interface *PPPModule::addNewInterface(const QString &newInterface){ |
93 | 94 | ||
94 | qDebug("try to add iface %s",newInterface.latin1()); | 95 | qDebug("try to add iface %s",newInterface.latin1()); |
95 | 96 | ||
96 | PPPConfigWidget imp(0, "PPPConfigImp", true); | 97 | PPPConfigWidget imp(0, "PPPConfigImp", true); |
97 | imp.showMaximized(); | 98 | imp.showMaximized(); |
98 | if(imp.exec() == QDialog::Accepted ){ | 99 | if(imp.exec() == QDialog::Accepted ){ |
99 | qDebug("ACCEPTED"); | 100 | qDebug("ACCEPTED"); |
100 | PPPData::data()->save(); | 101 | PPPData::data()->save(); |
101 | Interface *iface; | 102 | Interface *iface; |
102 | iface = new Interface( 0, PPPData::data()->modemDevice() ); | 103 | iface = new Interface( 0, PPPData::data()->modemDevice() ); |
103 | iface->setHardwareName( PPPData::data()->accname() ); | 104 | iface->setHardwareName( PPPData::data()->accname() ); |
104 | list.append( iface ); | 105 | list.append( iface ); |
105 | return iface; | 106 | return iface; |
106 | } | 107 | } |
107 | return NULL; | 108 | return NULL; |
108 | } | 109 | } |
109 | 110 | ||
110 | /** | 111 | /** |
111 | * Attempts to remove the interface, doesn't delete i | 112 | * Attempts to remove the interface, doesn't delete i |
112 | * @return bool true if successfull, false otherwise. | 113 | * @return bool true if successfull, false otherwise. |
113 | */ | 114 | */ |
114 | bool PPPModule::remove(Interface*){ | 115 | bool PPPModule::remove(Interface*){ |
115 | // Can't remove a hardware device, you can stop it though. | 116 | // Can't remove a hardware device, you can stop it though. |
116 | return false; | 117 | return false; |
117 | } | 118 | } |
118 | 119 | ||
119 | void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces) | 120 | void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces) |
120 | { | 121 | { |
121 | newIfaces.insert(QObject::tr("PPP") , | 122 | newIfaces.insert(QObject::tr("PPP") , |
122 | QObject::tr("generic ppp device")); | 123 | QObject::tr("generic ppp device")); |
123 | } | 124 | } |
124 | 125 | ||
125 | 126 | ||