author | mickeyl <mickeyl> | 2004-04-09 15:00:06 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-09 15:00:06 (UTC) |
commit | fb2f09533c7476a266a877c351007c2706b2da0d (patch) (unidiff) | |
tree | 9742d4cb8fd07fd5530c3c29b5f049dcecd46ef4 | |
parent | 39547839995c9f72ca9216ba5c2127246428ece8 (diff) | |
download | opie-fb2f09533c7476a266a877c351007c2706b2da0d.zip opie-fb2f09533c7476a266a877c351007c2706b2da0d.tar.gz opie-fb2f09533c7476a266a877c351007c2706b2da0d.tar.bz2 |
- eliminate cylic dependency
- complete using opie debugging framework
- sanitize #include order
21 files changed, 96 insertions, 55 deletions
diff --git a/noncore/settings/networksettings/interfaces/config.in b/noncore/settings/networksettings/interfaces/config.in index d84cd24..2175800 100644 --- a/noncore/settings/networksettings/interfaces/config.in +++ b/noncore/settings/networksettings/interfaces/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config INTERFACES | 1 | config INTERFACES |
2 | boolean | 2 | boolean "Build interfaces for networksettings" |
3 | default "y" if NETWORKSETUP | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE |
diff --git a/noncore/settings/networksettings/networksettings.pro b/noncore/settings/networksettings/networksettings.pro index 55d2291..9ad9be4 100644 --- a/noncore/settings/networksettings/networksettings.pro +++ b/noncore/settings/networksettings/networksettings.pro | |||
@@ -1,12 +1,11 @@ | |||
1 | CONFIG = qt warn_on quick-app | 1 | CONFIG = qt warn_on quick-app |
2 | HEADERS = mainwindowimp.h addconnectionimp.h defaultmodule.h module.h | 2 | HEADERS = mainwindowimp.h addconnectionimp.h defaultmodule.h module.h |
3 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp | 3 | SOURCES = main.cpp mainwindowimp.cpp addconnectionimp.cpp |
4 | INCLUDEPATH += $(OPIEDIR)/include interfaces/ . | 4 | INCLUDEPATH += $(OPIEDIR)/include interfaces/ . |
5 | DEPENDPATH += $(OPIEDIR)/include interfaces/ wlan/ ppp/ | 5 | DEPENDPATH += $(OPIEDIR)/include interfaces/ wlan/ ppp/ |
6 | LIBS += -lqpe -L$(OPIEDIR)/plugins/networksettings -Linterfaces/ -linterfaces -lopiecore2 -lopieui2 | 6 | LIBS += -lqpe -L$(OPIEDIR)/plugins/networksettings -Linterfaces/ -linterfaces -lopiecore2 -lopieui2 |
7 | INTERFACES = mainwindow.ui addconnection.ui | 7 | INTERFACES = mainwindow.ui addconnection.ui |
8 | TARGET = networksettings | 8 | TARGET = networksettings |
9 | 9 | ||
10 | 10 | ||
11 | |||
12 | include ( $(OPIEDIR)/include.pro ) | 11 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp index aedc0b9..f05e7ac 100644 --- a/noncore/settings/networksettings/ppp/accounts.cpp +++ b/noncore/settings/networksettings/ppp/accounts.cpp | |||
@@ -1,97 +1,99 @@ | |||
1 | /* | 1 | /* |
2 | * kPPP: A pppd front end for the KDE project | 2 | * kPPP: A pppd front end for the KDE project |
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | * | 5 | * |
6 | * Copyright (C) 1997 Bernd Johannes Wuebben | 6 | * Copyright (C) 1997 Bernd Johannes Wuebben |
7 | * wuebben@math.cornell.edu | 7 | * wuebben@math.cornell.edu |
8 | * | 8 | * |
9 | * based on EzPPP: | 9 | * based on EzPPP: |
10 | * Copyright (C) 1997 Jay Painter | 10 | * Copyright (C) 1997 Jay Painter |
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 | #include "accounts.h" | 27 | #include "accounts.h" |
28 | #include "authwidget.h" | 28 | #include "authwidget.h" |
29 | #include "pppdata.h" | 29 | #include "pppdata.h" |
30 | #include "edit.h" | 30 | #include "edit.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/odebug.h> | ||
33 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
35 | using namespace Opie::Core; | ||
34 | 36 | ||
35 | /* QT */ | 37 | /* QT */ |
36 | #include <qdir.h> | 38 | #include <qdir.h> |
37 | #include <qlayout.h> | 39 | #include <qlayout.h> |
38 | #include <qtabwidget.h> | 40 | #include <qtabwidget.h> |
39 | #include <qtabdialog.h> | 41 | #include <qtabdialog.h> |
40 | #include <qwhatsthis.h> | 42 | #include <qwhatsthis.h> |
41 | #include <qmessagebox.h> | 43 | #include <qmessagebox.h> |
42 | #include <qapplication.h> | 44 | #include <qapplication.h> |
43 | #include <qbuttongroup.h> | 45 | #include <qbuttongroup.h> |
44 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
45 | #include <qvgroupbox.h> | 47 | #include <qvgroupbox.h> |
46 | 48 | ||
47 | /* STD */ | 49 | /* STD */ |
48 | #include <stdlib.h> | 50 | #include <stdlib.h> |
49 | 51 | ||
50 | void parseargs(char* buf, char** args); | 52 | void parseargs(char* buf, char** args); |
51 | 53 | ||
52 | 54 | ||
53 | AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WFlags f ) | 55 | AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WFlags f ) |
54 | : ChooserWidget( pd, parent, name, f ) | 56 | : ChooserWidget( pd, parent, name, f ) |
55 | { | 57 | { |
56 | 58 | ||
57 | QWhatsThis::add(edit_b, tr("Allows you to modify the selected account")); | 59 | QWhatsThis::add(edit_b, tr("Allows you to modify the selected account")); |
58 | QWhatsThis::add(new_b, tr("Create a new dialup connection\n" | 60 | QWhatsThis::add(new_b, tr("Create a new dialup connection\n" |
59 | "to the Internet")); | 61 | "to the Internet")); |
60 | QWhatsThis::add(copy_b, | 62 | QWhatsThis::add(copy_b, |
61 | tr("Makes a copy of the selected account. All\n" | 63 | tr("Makes a copy of the selected account. All\n" |
62 | "settings of the selected account are copied\n" | 64 | "settings of the selected account are copied\n" |
63 | "to a new account, that you can modify to fit your\n" | 65 | "to a new account, that you can modify to fit your\n" |
64 | "needs")); | 66 | "needs")); |
65 | QWhatsThis::add(delete_b, | 67 | QWhatsThis::add(delete_b, |
66 | tr("<p>Deletes the selected account\n\n" | 68 | tr("<p>Deletes the selected account\n\n" |
67 | "<font color=\"red\"><b>Use with care!</b></font>")); | 69 | "<font color=\"red\"><b>Use with care!</b></font>")); |
68 | 70 | ||
69 | 71 | ||
70 | 72 | ||
71 | copy_b->setEnabled( false ); //FIXME | 73 | copy_b->setEnabled( false ); //FIXME |
72 | // delete_b->setEnabled( false ); //FIXME | 74 | // delete_b->setEnabled( false ); //FIXME |
73 | 75 | ||
74 | listListbox->insertStringList(_pppdata->getAccountList()); | 76 | listListbox->insertStringList(_pppdata->getAccountList()); |
75 | 77 | ||
76 | for (uint i = 0; i < listListbox->count(); i++) | 78 | for (uint i = 0; i < listListbox->count(); i++) |
77 | { | 79 | { |
78 | if ( listListbox->text(i) == _pppdata->accname() ) | 80 | if ( listListbox->text(i) == _pppdata->accname() ) |
79 | listListbox->setCurrentItem( i ); | 81 | listListbox->setCurrentItem( i ); |
80 | } | 82 | } |
81 | } | 83 | } |
82 | 84 | ||
83 | 85 | ||
84 | 86 | ||
85 | void AccountWidget::slotListBoxSelect(int idx) | 87 | void AccountWidget::slotListBoxSelect(int idx) |
86 | { | 88 | { |
87 | bool ok = _pppdata->setAccount( listListbox->text(idx) ); | 89 | bool ok = _pppdata->setAccount( listListbox->text(idx) ); |
88 | ok = (bool)(idx != -1); | 90 | ok = (bool)(idx != -1); |
89 | delete_b->setEnabled(ok); | 91 | delete_b->setEnabled(ok); |
90 | edit_b->setEnabled(ok); | 92 | edit_b->setEnabled(ok); |
91 | //FIXME copy_b->setEnabled(ok); | 93 | //FIXME copy_b->setEnabled(ok); |
92 | } | 94 | } |
93 | 95 | ||
94 | void AccountWidget::edit() | 96 | void AccountWidget::edit() |
95 | { | 97 | { |
96 | _pppdata->setAccount(listListbox->text(listListbox->currentItem())); | 98 | _pppdata->setAccount(listListbox->text(listListbox->currentItem())); |
97 | 99 | ||
diff --git a/noncore/settings/networksettings/ppp/authwidget.cpp b/noncore/settings/networksettings/ppp/authwidget.cpp index f3d842f..c94c3bc 100644 --- a/noncore/settings/networksettings/ppp/authwidget.cpp +++ b/noncore/settings/networksettings/ppp/authwidget.cpp | |||
@@ -1,76 +1,80 @@ | |||
1 | |||
2 | #include <qlayout.h> | ||
3 | #include <qmessagebox.h> | ||
4 | #include <qtoolbutton.h> | ||
5 | #include <qwhatsthis.h> | ||
6 | |||
7 | #include "auth.h" | 1 | #include "auth.h" |
8 | #include "authwidget.h" | 2 | #include "authwidget.h" |
9 | #include "edit.h" | 3 | #include "edit.h" |
10 | #include "pppdata.h" | 4 | #include "pppdata.h" |
11 | 5 | ||
6 | /* OPIE */ | ||
7 | #include <opie2/odebug.h> | ||
8 | using namespace Opie::Core; | ||
9 | |||
10 | /* QT */ | ||
11 | #include <qlayout.h> | ||
12 | #include <qmessagebox.h> | ||
13 | #include <qtoolbutton.h> | ||
14 | #include <qwhatsthis.h> | ||
12 | 15 | ||
16 | /* XPM */ | ||
13 | static const char* const image0_data[] = { | 17 | static const char* const image0_data[] = { |
14 | "16 16 2 1", | 18 | "16 16 2 1", |
15 | ". c None", | 19 | ". c None", |
16 | "# c #000000", | 20 | "# c #000000", |
17 | "................", | 21 | "................", |
18 | "...#...###...##.", | 22 | "...#...###...##.", |
19 | "..#.#..#..#.##..", | 23 | "..#.#..#..#.##..", |
20 | "..###..###.##...", | 24 | "..###..###.##...", |
21 | ".#...#.#..##....", | 25 | ".#...#.#..##....", |
22 | ".#...#.#.##.....", | 26 | ".#...#.#.##.....", |
23 | "........##.#..#.", | 27 | "........##.#..#.", |
24 | "..##...##...##..", | 28 | "..##...##...##..", |
25 | ".#..#.###...##..", | 29 | ".#..#.###...##..", |
26 | ".#...##..#.#..#.", | 30 | ".#...##..#.#..#.", |
27 | ".#..##..........", | 31 | ".#..##..........", |
28 | ".#.##.#..#.#..#.", | 32 | ".#.##.#..#.#..#.", |
29 | "..##...##...##..", | 33 | "..##...##...##..", |
30 | ".##....##...##..", | 34 | ".##....##...##..", |
31 | ".#....#..#.#..#.", | 35 | ".#....#..#.#..#.", |
32 | "................"}; | 36 | "................"}; |
33 | 37 | ||
34 | 38 | ||
35 | AuthWidget::AuthWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) | 39 | AuthWidget::AuthWidget(PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) |
36 | : QWidget( parent, name), | 40 | : QWidget( parent, name), |
37 | scriptWidget(0), | 41 | scriptWidget(0), |
38 | _pppdata(pd), | 42 | _pppdata(pd), |
39 | isNewAccount(isnewaccount) | 43 | isNewAccount(isnewaccount) |
40 | { | 44 | { |
41 | layout = new QGridLayout(this); | 45 | layout = new QGridLayout(this); |
42 | 46 | ||
43 | auth_l = new QLabel(tr("Authentication: "), this); | 47 | auth_l = new QLabel(tr("Authentication: "), this); |
44 | layout->addWidget(auth_l, 0, 0); | 48 | layout->addWidget(auth_l, 0, 0); |
45 | 49 | ||
46 | auth = new QComboBox(this); | 50 | auth = new QComboBox(this); |
47 | auth->insertItem(tr("Script-based")); | 51 | auth->insertItem(tr("Script-based")); |
48 | auth->insertItem(tr("PAP")); | 52 | auth->insertItem(tr("PAP")); |
49 | auth->insertItem(tr("Terminal-based")); | 53 | auth->insertItem(tr("Terminal-based")); |
50 | auth->insertItem(tr("CHAP")); | 54 | auth->insertItem(tr("CHAP")); |
51 | auth->insertItem(tr("PAP/CHAP")); | 55 | auth->insertItem(tr("PAP/CHAP")); |
52 | layout->addWidget(auth, 0, 1); | 56 | layout->addWidget(auth, 0, 1); |
53 | 57 | ||
54 | connect( auth, SIGNAL(activated(const QString&)), | 58 | connect( auth, SIGNAL(activated(const QString&)), |
55 | SLOT(authChanged(const QString&))); | 59 | SLOT(authChanged(const QString&))); |
56 | 60 | ||
57 | QString tmp = tr("<p>Specifies the method used to identify yourself to\n" | 61 | QString tmp = tr("<p>Specifies the method used to identify yourself to\n" |
58 | "the PPP server. Most universities still use\n" | 62 | "the PPP server. Most universities still use\n" |
59 | "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" | 63 | "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" |
60 | "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" | 64 | "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" |
61 | "unsure, contact your ISP.\n" | 65 | "unsure, contact your ISP.\n" |
62 | "\n" | 66 | "\n" |
63 | "If you can choose between PAP and CHAP,\n" | 67 | "If you can choose between PAP and CHAP,\n" |
64 | "choose CHAP, because it's much safer. If you don't know\n" | 68 | "choose CHAP, because it's much safer. If you don't know\n" |
65 | "whether PAP or CHAP is right, choose PAP/CHAP."); | 69 | "whether PAP or CHAP is right, choose PAP/CHAP."); |
66 | 70 | ||
67 | QWhatsThis::add(auth_l,tmp); | 71 | QWhatsThis::add(auth_l,tmp); |
68 | QWhatsThis::add(auth,tmp); | 72 | QWhatsThis::add(auth,tmp); |
69 | 73 | ||
70 | user_l = new QLabel( tr("Username: "), this); | 74 | user_l = new QLabel( tr("Username: "), this); |
71 | layout->addWidget( user_l, 1, 0 ); | 75 | layout->addWidget( user_l, 1, 0 ); |
72 | userName = new QLineEdit( this, "usernameEdit" ); | 76 | userName = new QLineEdit( this, "usernameEdit" ); |
73 | layout->addWidget( userName, 1, 1 ); | 77 | layout->addWidget( userName, 1, 1 ); |
74 | tmp = tr("Enter your username here..."); | 78 | tmp = tr("Enter your username here..."); |
75 | QWhatsThis::add( user_l, tmp ); | 79 | QWhatsThis::add( user_l, tmp ); |
76 | QWhatsThis::add( userName, tmp ); | 80 | QWhatsThis::add( userName, tmp ); |
diff --git a/noncore/settings/networksettings/ppp/config.in b/noncore/settings/networksettings/ppp/config.in index 0b71434..570ebfe 100644 --- a/noncore/settings/networksettings/ppp/config.in +++ b/noncore/settings/networksettings/ppp/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config PPP | 1 | config PPP |
2 | boolean "opie-networksettingsplugin-kppp (PPP module)" | 2 | boolean "opie-networksettingsplugin-kppp (PPP module)" |
3 | default "n" if NETWORKSETUP | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && NETWORKSETUP && NETWORKSETUP-CORE && INTERFACES | 4 | depends ( LIBQPE || LIBQPE-X11 ) && NETWORKSETUP && NETWORKSETUP-CORE && INTERFACES |
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp index b75410c..24d33f4 100644 --- a/noncore/settings/networksettings/ppp/connect.cpp +++ b/noncore/settings/networksettings/ppp/connect.cpp | |||
@@ -1,101 +1,102 @@ | |||
1 | /* | 1 | /* |
2 | * kPPP: A pppd front end for the KDE project | 2 | * kPPP: A pppd front end for the KDE project |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Copyright (C) 1997 Bernd Johannes Wuebben | 5 | * Copyright (C) 1997 Bernd Johannes Wuebben |
6 | * wuebben@math.cornell.edu | 6 | * wuebben@math.cornell.edu |
7 | * Copyright (C) 1998-2001 Harri Porten <porten@kde.org> | 7 | * Copyright (C) 1998-2001 Harri Porten <porten@kde.org> |
8 | * | 8 | * |
9 | * based on EzPPP: | 9 | * based on EzPPP: |
10 | * Copyright (C) 1997 Jay Painter | 10 | * Copyright (C) 1997 Jay Painter |
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 | //#include <config.h> | 27 | /* OPIE */ |
28 | #include <opie2/odebug.h> | ||
29 | using namespace Opie::Core; | ||
28 | 30 | ||
31 | /* QT */ | ||
29 | #include <qlayout.h> | 32 | #include <qlayout.h> |
30 | #include <qregexp.h> | 33 | #include <qregexp.h> |
31 | |||
32 | #include <qapplication.h> | 34 | #include <qapplication.h> |
33 | //#include <kdebug.h> | ||
34 | //#include <klocale.h> | ||
35 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
36 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
37 | 37 | ||
38 | /* STD */ | ||
38 | #include <unistd.h> | 39 | #include <unistd.h> |
39 | #include <stdlib.h> | 40 | #include <stdlib.h> |
40 | #include <string.h> | 41 | #include <string.h> |
41 | #include <fcntl.h> | 42 | #include <fcntl.h> |
42 | #include <netdb.h> | 43 | #include <netdb.h> |
43 | #include <sys/types.h> | 44 | #include <sys/types.h> |
44 | #include <sys/socket.h> | 45 | #include <sys/socket.h> |
45 | #include <arpa/inet.h> | 46 | #include <arpa/inet.h> |
46 | #include <netinet/in.h> | 47 | #include <netinet/in.h> |
47 | #include <sys/ioctl.h> | 48 | #include <sys/ioctl.h> |
48 | #include <assert.h> | 49 | #include <assert.h> |
49 | 50 | ||
50 | #ifdef _XPG4_2 | 51 | #ifdef _XPG4_2 |
51 | #define __xnet_connectconnect | 52 | #define __xnet_connectconnect |
52 | #endif | 53 | #endif |
53 | 54 | ||
54 | #include <errno.h> | 55 | #include <errno.h> |
55 | 56 | ||
56 | #ifdef HAVE_SYS_PARAM_H | 57 | #ifdef HAVE_SYS_PARAM_H |
57 | #include <sys/param.h> | 58 | #include <sys/param.h> |
58 | #endif | 59 | #endif |
59 | 60 | ||
60 | #ifdef __linux__ | 61 | #ifdef __linux__ |
61 | #include "runtests.h" | 62 | #include "runtests.h" |
62 | #endif | 63 | #endif |
63 | 64 | ||
64 | #include "auth.h" | 65 | #include "auth.h" |
65 | #include "connect.h" | 66 | #include "connect.h" |
66 | //#include "docking.h" | 67 | //#include "docking.h" |
67 | #include "interfaceppp.h" | 68 | #include "interfaceppp.h" |
68 | #include "modem.h" | 69 | #include "modem.h" |
69 | #include "kpppconfig.h" | 70 | #include "kpppconfig.h" |
70 | #include "pppdata.h" | 71 | #include "pppdata.h" |
71 | #include "kpppwidget.h" | 72 | #include "kpppwidget.h" |
72 | //#include "requester.h" | 73 | //#include "requester.h" |
73 | //#include "utils.h" | 74 | //#include "utils.h" |
74 | #define execute_command system | 75 | #define execute_command system |
75 | 76 | ||
76 | QString old_hostname; | 77 | QString old_hostname; |
77 | bool modified_hostname; | 78 | bool modified_hostname; |
78 | 79 | ||
79 | 80 | ||
80 | ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *name) | 81 | ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *name) |
81 | : QWidget(parent, name), | 82 | : QWidget(parent, name), |
82 | myreadbuffer(""), | 83 | myreadbuffer(""), |
83 | main_timer_ID(0), | 84 | main_timer_ID(0), |
84 | vmain(0), | 85 | vmain(0), |
85 | substate(-1), | 86 | substate(-1), |
86 | scriptindex(0), | 87 | scriptindex(0), |
87 | loopnest(0), | 88 | loopnest(0), |
88 | loopend(false), | 89 | loopend(false), |
89 | semaphore(false), | 90 | semaphore(false), |
90 | expecting(false), | 91 | expecting(false), |
91 | readbuffer(""), | 92 | readbuffer(""), |
92 | scanvar(""), | 93 | scanvar(""), |
93 | scanning(false), | 94 | scanning(false), |
94 | pausing(false), | 95 | pausing(false), |
95 | dialnumber(0), | 96 | dialnumber(0), |
96 | _ifaceppp(ifp) | 97 | _ifaceppp(ifp) |
97 | { | 98 | { |
98 | modified_hostname = false; | 99 | modified_hostname = false; |
99 | 100 | ||
100 | QVBoxLayout *tl = new QVBoxLayout(this, 8, 10); | 101 | QVBoxLayout *tl = new QVBoxLayout(this, 8, 10); |
101 | QString tit = QObject::tr("Connecting to: "); | 102 | QString tit = QObject::tr("Connecting to: "); |
diff --git a/noncore/settings/networksettings/ppp/devices.cpp b/noncore/settings/networksettings/ppp/devices.cpp index 350ff32..42de44c 100644 --- a/noncore/settings/networksettings/ppp/devices.cpp +++ b/noncore/settings/networksettings/ppp/devices.cpp | |||
@@ -1,99 +1,101 @@ | |||
1 | /* | 1 | /* |
2 | * kPPP: A pppd front end for the KDE project | 2 | * kPPP: A pppd front end for the KDE project |
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | * | 5 | * |
6 | * Copyright (C) 1997 Bernd Johannes Wuebben | 6 | * Copyright (C) 1997 Bernd Johannes Wuebben |
7 | * wuebben@math.cornell.edu | 7 | * wuebben@math.cornell.edu |
8 | * | 8 | * |
9 | * based on EzPPP: | 9 | * based on EzPPP: |
10 | * Copyright (C) 1997 Jay Painter | 10 | * Copyright (C) 1997 Jay Painter |
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 | #include "interfaceppp.h" | 27 | #include "interfaceppp.h" |
28 | #include "devices.h" | 28 | #include "devices.h" |
29 | #include "authwidget.h" | 29 | #include "authwidget.h" |
30 | #include "pppdata.h" | 30 | #include "pppdata.h" |
31 | #include "edit.h" | 31 | #include "edit.h" |
32 | #include "general.h" | 32 | #include "general.h" |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <opie2/odebug.h> | ||
35 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
37 | using namespace Opie::Core; | ||
36 | 38 | ||
37 | /* QT */ | 39 | /* QT */ |
38 | #include <qdir.h> | 40 | #include <qdir.h> |
39 | #include <qlayout.h> | 41 | #include <qlayout.h> |
40 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
41 | #include <qtabdialog.h> | 43 | #include <qtabdialog.h> |
42 | #include <qwhatsthis.h> | 44 | #include <qwhatsthis.h> |
43 | #include <qmessagebox.h> | 45 | #include <qmessagebox.h> |
44 | #include <qapplication.h> | 46 | #include <qapplication.h> |
45 | #include <qbuttongroup.h> | 47 | #include <qbuttongroup.h> |
46 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
47 | #include <qvgroupbox.h> | 49 | #include <qvgroupbox.h> |
48 | 50 | ||
49 | /* STD */ | 51 | /* STD */ |
50 | #include <stdlib.h> | 52 | #include <stdlib.h> |
51 | 53 | ||
52 | 54 | ||
53 | void parseargs(char* buf, char** args); | 55 | void parseargs(char* buf, char** args); |
54 | 56 | ||
55 | DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *name, WFlags f ) | 57 | DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *name, WFlags f ) |
56 | : ChooserWidget(ip->data(), parent, name, f) | 58 | : ChooserWidget(ip->data(), parent, name, f) |
57 | { | 59 | { |
58 | _ifaceppp = ip; | 60 | _ifaceppp = ip; |
59 | QWhatsThis::add(edit_b, tr("Allows you to modify the selected device")); | 61 | QWhatsThis::add(edit_b, tr("Allows you to modify the selected device")); |
60 | QWhatsThis::add(new_b, tr("Create a new device") ); | 62 | QWhatsThis::add(new_b, tr("Create a new device") ); |
61 | 63 | ||
62 | QWhatsThis::add(copy_b, | 64 | QWhatsThis::add(copy_b, |
63 | tr("Makes a copy of the selected device. All\n" | 65 | tr("Makes a copy of the selected device. All\n" |
64 | "settings of the selected device are copied\n" | 66 | "settings of the selected device are copied\n" |
65 | "to a new device, that you can modify to fit your\n" | 67 | "to a new device, that you can modify to fit your\n" |
66 | "needs")); | 68 | "needs")); |
67 | QWhatsThis::add(delete_b, | 69 | QWhatsThis::add(delete_b, |
68 | tr("<p>Deletes the selected device\n\n" | 70 | tr("<p>Deletes the selected device\n\n" |
69 | "<font color=\"red\"><b>Use with care!</b></font>")); | 71 | "<font color=\"red\"><b>Use with care!</b></font>")); |
70 | 72 | ||
71 | copy_b->setEnabled( false ); //FIXME | 73 | copy_b->setEnabled( false ); //FIXME |
72 | // delete_b->setEnabled( false ); //FIXME | 74 | // delete_b->setEnabled( false ); //FIXME |
73 | 75 | ||
74 | QStringList tmp = _pppdata->getDevicesNamesList(); | 76 | QStringList tmp = _pppdata->getDevicesNamesList(); |
75 | odebug << "DevicesWidget::DevicesWidget got devices " << tmp.join("--").latin1() << "" << oendl; | 77 | odebug << "DevicesWidget::DevicesWidget got devices " << tmp.join("--").latin1() << "" << oendl; |
76 | listListbox->insertStringList(tmp); | 78 | listListbox->insertStringList(tmp); |
77 | 79 | ||
78 | for (uint i = 0; i < listListbox->count(); i++){ | 80 | for (uint i = 0; i < listListbox->count(); i++){ |
79 | odebug << "listListbox->text(i) " << listListbox->text(i).latin1() << " == _pppdata->devname() " << _pppdata->devname().latin1() << "" << oendl; | 81 | odebug << "listListbox->text(i) " << listListbox->text(i).latin1() << " == _pppdata->devname() " << _pppdata->devname().latin1() << "" << oendl; |
80 | if ( listListbox->text(i) == _pppdata->devname() ) | 82 | if ( listListbox->text(i) == _pppdata->devname() ) |
81 | listListbox->setCurrentItem( i ); | 83 | listListbox->setCurrentItem( i ); |
82 | } | 84 | } |
83 | } | 85 | } |
84 | 86 | ||
85 | 87 | ||
86 | 88 | ||
87 | void DevicesWidget::slotListBoxSelect(int idx) { | 89 | void DevicesWidget::slotListBoxSelect(int idx) { |
88 | bool ok = _pppdata->setDevice( listListbox->text(idx) ); | 90 | bool ok = _pppdata->setDevice( listListbox->text(idx) ); |
89 | delete_b->setEnabled((bool)(idx != -1)); | 91 | delete_b->setEnabled((bool)(idx != -1)); |
90 | edit_b->setEnabled((bool)(idx != -1)); | 92 | edit_b->setEnabled((bool)(idx != -1)); |
91 | //FIXME copy_b->setEnabled((bool)(idx != -1)); | 93 | //FIXME copy_b->setEnabled((bool)(idx != -1)); |
92 | } | 94 | } |
93 | 95 | ||
94 | void DevicesWidget::edit() { | 96 | void DevicesWidget::edit() { |
95 | _pppdata->setDevice(listListbox->text(listListbox->currentItem())); | 97 | _pppdata->setDevice(listListbox->text(listListbox->currentItem())); |
96 | 98 | ||
97 | int result = doTab(); | 99 | int result = doTab(); |
98 | 100 | ||
99 | if(result == QDialog::Accepted) { | 101 | if(result == QDialog::Accepted) { |
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp index 69bb682..40ba19b 100644 --- a/noncore/settings/networksettings/ppp/general.cpp +++ b/noncore/settings/networksettings/ppp/general.cpp | |||
@@ -1,99 +1,101 @@ | |||
1 | /* | 1 | /* |
2 | * kPPP: A pppd front end for the KDE project | 2 | * kPPP: A pppd front end for the KDE project |
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | * | 5 | * |
6 | * Copyright (C) 1997 Bernd Johannes Wuebben | 6 | * Copyright (C) 1997 Bernd Johannes Wuebben |
7 | * wuebben@math.cornell.edu | 7 | * wuebben@math.cornell.edu |
8 | * | 8 | * |
9 | * based on EzPPP: | 9 | * based on EzPPP: |
10 | * Copyright (C) 1997 Jay Painter | 10 | * Copyright (C) 1997 Jay Painter |
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 | #include "general.h" | 27 | #include "general.h" |
28 | #include "interfaceppp.h" | 28 | #include "interfaceppp.h" |
29 | #include "modeminfo.h" | 29 | #include "modeminfo.h" |
30 | #include "modemcmds.h" | 30 | #include "modemcmds.h" |
31 | #include "pppdata.h" | 31 | #include "pppdata.h" |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odebug.h> | ||
34 | #include <qpe/config.h> | 35 | #include <qpe/config.h> |
35 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
37 | using namespace Opie::Core; | ||
36 | 38 | ||
37 | /* QT */ | 39 | /* QT */ |
38 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
39 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
40 | #include <qlabel.h> | 42 | #include <qlabel.h> |
41 | #include <qlayout.h> | 43 | #include <qlayout.h> |
42 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
43 | #include <qslider.h> | 45 | #include <qslider.h> |
44 | #include <qspinbox.h> | 46 | #include <qspinbox.h> |
45 | #include <qwhatsthis.h> | 47 | #include <qwhatsthis.h> |
46 | 48 | ||
47 | /* STD */ | 49 | /* STD */ |
48 | #include <termios.h> | 50 | #include <termios.h> |
49 | #include <string.h> | 51 | #include <string.h> |
50 | 52 | ||
51 | 53 | ||
52 | ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) | 54 | ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) |
53 | : QWidget(parent, name), _pppdata(pd) | 55 | : QWidget(parent, name), _pppdata(pd) |
54 | { | 56 | { |
55 | int k; | 57 | int k; |
56 | 58 | ||
57 | QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint()); | 59 | QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint()); |
58 | 60 | ||
59 | QLabel *label1; | 61 | QLabel *label1; |
60 | 62 | ||
61 | label1 = new QLabel(tr("Modem &name:"), this); | 63 | label1 = new QLabel(tr("Modem &name:"), this); |
62 | tl->addWidget(label1, 0, 0); | 64 | tl->addWidget(label1, 0, 0); |
63 | 65 | ||
64 | modemname = new QLineEdit(this, "modemName"); | 66 | modemname = new QLineEdit(this, "modemName"); |
65 | modemname->setText( _pppdata->devname() ); | 67 | modemname->setText( _pppdata->devname() ); |
66 | label1->setBuddy(modemname); | 68 | label1->setBuddy(modemname); |
67 | tl->addWidget(modemname, 0, 1); | 69 | tl->addWidget(modemname, 0, 1); |
68 | 70 | ||
69 | label1 = new QLabel(tr("Modem de&vice:"), this); | 71 | label1 = new QLabel(tr("Modem de&vice:"), this); |
70 | tl->addWidget(label1, 1, 0); | 72 | tl->addWidget(label1, 1, 0); |
71 | 73 | ||
72 | modemdevice = new QComboBox(false, this); | 74 | modemdevice = new QComboBox(false, this); |
73 | modemdevice->setEditable( true ); | 75 | modemdevice->setEditable( true ); |
74 | modemdevice->setDuplicatesEnabled ( false ); | 76 | modemdevice->setDuplicatesEnabled ( false ); |
75 | modemdevice->setInsertionPolicy( QComboBox::AtTop ); | 77 | modemdevice->setInsertionPolicy( QComboBox::AtTop ); |
76 | label1->setBuddy(modemdevice); | 78 | label1->setBuddy(modemdevice); |
77 | 79 | ||
78 | Config cfg("NetworkSetupPPP"); | 80 | Config cfg("NetworkSetupPPP"); |
79 | cfg.setGroup("Devices_General"); | 81 | cfg.setGroup("Devices_General"); |
80 | QStringList devs = cfg.readListEntry("devices",','); | 82 | QStringList devs = cfg.readListEntry("devices",','); |
81 | if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0"; | 83 | if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0"; |
82 | modemdevice->insertStringList( devs ); | 84 | modemdevice->insertStringList( devs ); |
83 | tl->addWidget(modemdevice, 1, 1); | 85 | tl->addWidget(modemdevice, 1, 1); |
84 | 86 | ||
85 | // connect(modemdevice, SIGNAL(activated(int)), | 87 | // connect(modemdevice, SIGNAL(activated(int)), |
86 | // SLOT(setmodemdc(int))); | 88 | // SLOT(setmodemdc(int))); |
87 | // connect(modemdevice, SIGNAL(textChanged(const QString&) ), | 89 | // connect(modemdevice, SIGNAL(textChanged(const QString&) ), |
88 | // SLOT( setmodemdc(const QString&) ) ); | 90 | // SLOT( setmodemdc(const QString&) ) ); |
89 | 91 | ||
90 | QString tmp = tr("This specifies the serial port your modem is attached \n" | 92 | QString tmp = tr("This specifies the serial port your modem is attached \n" |
91 | "to. On Linux/x86, typically this is either /dev/ttyS0 \n" | 93 | "to. On Linux/x86, typically this is either /dev/ttyS0 \n" |
92 | "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n" | 94 | "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n" |
93 | "\n" | 95 | "\n" |
94 | "If you have an internal ISDN card with AT command\n" | 96 | "If you have an internal ISDN card with AT command\n" |
95 | "emulation (most cards under Linux support this), you\n" | 97 | "emulation (most cards under Linux support this), you\n" |
96 | "should select one of the /dev/ttyIx devices."); | 98 | "should select one of the /dev/ttyIx devices."); |
97 | 99 | ||
98 | QWhatsThis::add(label1,tmp); | 100 | QWhatsThis::add(label1,tmp); |
99 | QWhatsThis::add(modemdevice,tmp); | 101 | QWhatsThis::add(modemdevice,tmp); |
diff --git a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp index 5a76293..4755aed 100644 --- a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp +++ b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp | |||
@@ -1,41 +1,45 @@ | |||
1 | #include "interfaceinformationppp.h" | 1 | #include "interfaceinformationppp.h" |
2 | #include "connect.h" | ||
3 | #include "conwindow.h" | ||
4 | |||
5 | /* OPIE */ | ||
6 | #include <opie2/odebug.h> | ||
7 | using namespace Opie::Core; | ||
2 | 8 | ||
9 | /* QT */ | ||
3 | #include <qpushbutton.h> | 10 | #include <qpushbutton.h> |
4 | #include <qlabel.h> | 11 | #include <qlabel.h> |
5 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
6 | #include <qabstractlayout.h> | 13 | #include <qabstractlayout.h> |
7 | 14 | ||
8 | #include "connect.h" | ||
9 | #include "conwindow.h" | ||
10 | |||
11 | #ifdef QWS | 15 | #ifdef QWS |
12 | #else | 16 | #else |
13 | #define showMaximized show | 17 | #define showMaximized show |
14 | #endif | 18 | #endif |
15 | 19 | ||
16 | /** | 20 | /** |
17 | * Constructor for the InterfaceInformationImp class. This class pretty much | 21 | * Constructor for the InterfaceInformationImp class. This class pretty much |
18 | * just display's information about the interface that is passed to it. | 22 | * just display's information about the interface that is passed to it. |
19 | */ | 23 | */ |
20 | InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f) | 24 | InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f) |
21 | :InterfaceInformationImp(parent, name, i, Qt::WStyle_ContextHelp) | 25 | :InterfaceInformationImp(parent, name, i, Qt::WStyle_ContextHelp) |
22 | { | 26 | { |
23 | odebug << "InterfaceInformationPPP::InterfaceInformationPPP " << name << "" << oendl; | 27 | odebug << "InterfaceInformationPPP::InterfaceInformationPPP " << name << "" << oendl; |
24 | con = new ConnectWidget( (InterfacePPP*)i, this, "con" ); | 28 | con = new ConnectWidget( (InterfacePPP*)i, this, "con" ); |
25 | con->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, | 29 | con->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, |
26 | QSizePolicy::Fixed) ); | 30 | QSizePolicy::Fixed) ); |
27 | 31 | ||
28 | macAddressLabel->hide(); | 32 | macAddressLabel->hide(); |
29 | subnetMaskLabel->hide(); | 33 | subnetMaskLabel->hide(); |
30 | broadcastLabel->hide(); | 34 | broadcastLabel->hide(); |
31 | TextLabel23->hide(); | 35 | TextLabel23->hide(); |
32 | TextLabel21->hide(); | 36 | TextLabel21->hide(); |
33 | TextLabel24->hide(); | 37 | TextLabel24->hide(); |
34 | 38 | ||
35 | InterfaceInformationLayout->addWidget( con, 1, 0 ); | 39 | InterfaceInformationLayout->addWidget( con, 1, 0 ); |
36 | connect(i, SIGNAL(begin_connect()),con, SLOT(preinit())); | 40 | connect(i, SIGNAL(begin_connect()),con, SLOT(preinit())); |
37 | connect(i, SIGNAL(hangup_now() ), con, SLOT(cancelbutton() ) ); | 41 | connect(i, SIGNAL(hangup_now() ), con, SLOT(cancelbutton() ) ); |
38 | } | 42 | } |
39 | 43 | ||
40 | 44 | ||
41 | 45 | ||
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp index 5cc6f70..7d52f66 100644 --- a/noncore/settings/networksettings/ppp/interfaceppp.cpp +++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp | |||
@@ -1,75 +1,79 @@ | |||
1 | #include "auth.h" | ||
2 | #include "interfaceppp.h" | ||
3 | #include "modem.h" | ||
4 | #include "pppdata.h" | ||
5 | |||
6 | /* OPIE */ | ||
7 | #include <opie2/odebug.h> | ||
8 | using namespace Opie::Core; | ||
1 | 9 | ||
10 | /* QT */ | ||
2 | #include <qmessagebox.h> | 11 | #include <qmessagebox.h> |
3 | #include <qlayout.h> | 12 | #include <qlayout.h> |
4 | #include <qlineedit.h> | 13 | #include <qlineedit.h> |
5 | #include <qlabel.h> | 14 | #include <qlabel.h> |
6 | 15 | ||
7 | #include "auth.h" | ||
8 | #include "interfaceppp.h" | ||
9 | #include "modem.h" | ||
10 | #include "pppdata.h" | ||
11 | |||
12 | InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status) | 16 | InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status) |
13 | : Interface(parent, name, status), | 17 | : Interface(parent, name, status), |
14 | _modemPtr(0), | 18 | _modemPtr(0), |
15 | _dataPtr(0) | 19 | _dataPtr(0) |
16 | { | 20 | { |
17 | odebug << "InterfacePPP::InterfacePPP(" << oendl; | 21 | odebug << "InterfacePPP::InterfacePPP(" << oendl; |
18 | } | 22 | } |
19 | 23 | ||
20 | PPPData* InterfacePPP::data()const | 24 | PPPData* InterfacePPP::data()const |
21 | { | 25 | { |
22 | if (!_dataPtr){ | 26 | if (!_dataPtr){ |
23 | odebug << "creating new Data obj" << oendl; | 27 | odebug << "creating new Data obj" << oendl; |
24 | _dataPtr = new PPPData(); | 28 | _dataPtr = new PPPData(); |
25 | _dataPtr->setDevice( getInterfaceName() ); | 29 | _dataPtr->setDevice( getInterfaceName() ); |
26 | _dataPtr->setAccount( getHardwareName() ); | 30 | _dataPtr->setAccount( getHardwareName() ); |
27 | } | 31 | } |
28 | return _dataPtr; | 32 | return _dataPtr; |
29 | } | 33 | } |
30 | 34 | ||
31 | Modem* InterfacePPP::modem()const | 35 | Modem* InterfacePPP::modem()const |
32 | { | 36 | { |
33 | if (!_modemPtr){ | 37 | if (!_modemPtr){ |
34 | odebug << "creating new modem obj" << oendl; | 38 | odebug << "creating new modem obj" << oendl; |
35 | _modemPtr = new Modem( data() ); | 39 | _modemPtr = new Modem( data() ); |
36 | } | 40 | } |
37 | return _modemPtr; | 41 | return _modemPtr; |
38 | } | 42 | } |
39 | 43 | ||
40 | bool InterfacePPP::refresh() | 44 | bool InterfacePPP::refresh() |
41 | { | 45 | { |
42 | odebug << "InterfacePPP::refresh()" << oendl; | 46 | odebug << "InterfacePPP::refresh()" << oendl; |
43 | QString old = getInterfaceName(); | 47 | QString old = getInterfaceName(); |
44 | setInterfaceName( modem()->pppDevice() ); | 48 | setInterfaceName( modem()->pppDevice() ); |
45 | 49 | ||
46 | (void)Interface::refresh(); | 50 | (void)Interface::refresh(); |
47 | 51 | ||
48 | setInterfaceName( old ); | 52 | setInterfaceName( old ); |
49 | emit updateInterface(this); | 53 | emit updateInterface(this); |
50 | 54 | ||
51 | return true; | 55 | return true; |
52 | } | 56 | } |
53 | 57 | ||
54 | void InterfacePPP::start() | 58 | void InterfacePPP::start() |
55 | { | 59 | { |
56 | odebug << "InterfacePPP::start" << oendl; | 60 | odebug << "InterfacePPP::start" << oendl; |
57 | 61 | ||
58 | if (data()->password().isEmpty() && !data()->storedUsername().isEmpty() ) { | 62 | if (data()->password().isEmpty() && !data()->storedUsername().isEmpty() ) { |
59 | 63 | ||
60 | QDialog mb( 0, "Dialog", true ); | 64 | QDialog mb( 0, "Dialog", true ); |
61 | mb.setCaption( tr( "No password" ) ); | 65 | mb.setCaption( tr( "No password" ) ); |
62 | QVBoxLayout layout( &mb ); | 66 | QVBoxLayout layout( &mb ); |
63 | QLabel text ( &mb ); | 67 | QLabel text ( &mb ); |
64 | text.setText( tr("Username defined but no password\n Please enter a password") ); | 68 | text.setText( tr("Username defined but no password\n Please enter a password") ); |
65 | QLineEdit lineedit( &mb ); | 69 | QLineEdit lineedit( &mb ); |
66 | lineedit.setEchoMode( QLineEdit::Password ); | 70 | lineedit.setEchoMode( QLineEdit::Password ); |
67 | layout.addWidget( &text ); | 71 | layout.addWidget( &text ); |
68 | layout.addWidget( &lineedit ); | 72 | layout.addWidget( &lineedit ); |
69 | if ( mb.exec() == QDialog::Accepted ) { | 73 | if ( mb.exec() == QDialog::Accepted ) { |
70 | data()->setPassword( lineedit.text() ); | 74 | data()->setPassword( lineedit.text() ); |
71 | } | 75 | } |
72 | } | 76 | } |
73 | 77 | ||
74 | QFileInfo info(pppdPath()); | 78 | QFileInfo info(pppdPath()); |
75 | 79 | ||
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp index f3f2639..5913a22 100644 --- a/noncore/settings/networksettings/ppp/modem.cpp +++ b/noncore/settings/networksettings/ppp/modem.cpp | |||
@@ -1,90 +1,95 @@ | |||
1 | /* | 1 | /* |
2 | * kPPP: A pppd Front End for the KDE project | 2 | * kPPP: A pppd Front End for the KDE project |
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | * | 5 | * |
6 | * Copyright (C) 1997 Bernd Johannes Wuebben | 6 | * Copyright (C) 1997 Bernd Johannes Wuebben |
7 | * wuebben@math.cornell.edu | 7 | * wuebben@math.cornell.edu |
8 | * | 8 | * |
9 | * This file was added by Harri Porten <porten@tu-harburg.de> | 9 | * This file was added by Harri Porten <porten@tu-harburg.de> |
10 | * | 10 | * |
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 | /* OPIE */ | ||
28 | #include <opie2/odebug.h> | ||
29 | using namespace Opie::Core; | ||
30 | |||
31 | /* STD */ | ||
27 | #include <errno.h> | 32 | #include <errno.h> |
28 | #include <stdlib.h> | 33 | #include <stdlib.h> |
29 | #include <unistd.h> | 34 | #include <unistd.h> |
30 | #include <fcntl.h> | 35 | #include <fcntl.h> |
31 | #include <signal.h> | 36 | #include <signal.h> |
32 | #include <sys/ioctl.h> | 37 | #include <sys/ioctl.h> |
33 | #include <sys/types.h> | 38 | #include <sys/types.h> |
34 | #include <sys/stat.h> | 39 | #include <sys/stat.h> |
35 | #include <setjmp.h> | 40 | #include <setjmp.h> |
36 | #include <regex.h> | 41 | #include <regex.h> |
37 | #include <qregexp.h> | 42 | #include <qregexp.h> |
38 | #include <assert.h> | 43 | #include <assert.h> |
39 | #include <string.h> | 44 | #include <string.h> |
40 | 45 | ||
41 | #ifdef HAVE_RESOLV_H | 46 | #ifdef HAVE_RESOLV_H |
42 | # include <arpa/nameser.h> | 47 | # include <arpa/nameser.h> |
43 | # include <resolv.h> | 48 | # include <resolv.h> |
44 | #endif | 49 | #endif |
45 | 50 | ||
46 | #ifndef _PATH_RESCONF | 51 | #ifndef _PATH_RESCONF |
47 | #define _PATH_RESCONF "/etc/resolv.conf" | 52 | #define _PATH_RESCONF "/etc/resolv.conf" |
48 | #endif | 53 | #endif |
49 | 54 | ||
50 | #define strlcpy strcpy | 55 | #define strlcpy strcpy |
51 | #include "auth.h" | 56 | #include "auth.h" |
52 | #include "modem.h" | 57 | #include "modem.h" |
53 | #include "pppdata.h" | 58 | #include "pppdata.h" |
54 | #define qError qDebug | 59 | #define qError qDebug |
55 | 60 | ||
56 | 61 | ||
57 | #define MY_ASSERT(x) if (!(x)) { \ | 62 | #define MY_ASSERT(x) if (!(x)) { \ |
58 | ofatal << "ASSERT: \"" << #x << "\" in " << __FILE__ << " (" << __LINE__ << ")\n" << oendl; \ | 63 | ofatal << "ASSERT: \"" << #x << "\" in " << __FILE__ << " (" << __LINE__ << ")\n" << oendl; \ |
59 | exit(1); } | 64 | exit(1); } |
60 | 65 | ||
61 | 66 | ||
62 | static sigjmp_buf jmp_buffer; | 67 | static sigjmp_buf jmp_buffer; |
63 | 68 | ||
64 | //Modem *Modem::modem = 0; | 69 | //Modem *Modem::modem = 0; |
65 | 70 | ||
66 | 71 | ||
67 | const char* pppdPath() { | 72 | const char* pppdPath() { |
68 | // wasting a few bytes | 73 | // wasting a few bytes |
69 | static char buffer[sizeof(PPPDSEARCHPATH)+sizeof(PPPDNAME)]; | 74 | static char buffer[sizeof(PPPDSEARCHPATH)+sizeof(PPPDNAME)]; |
70 | static char *pppdPath = 0L; | 75 | static char *pppdPath = 0L; |
71 | char *p; | 76 | char *p; |
72 | 77 | ||
73 | if(pppdPath == 0L) { | 78 | if(pppdPath == 0L) { |
74 | const char *c = PPPDSEARCHPATH; | 79 | const char *c = PPPDSEARCHPATH; |
75 | while(*c != '\0') { | 80 | while(*c != '\0') { |
76 | while(*c == ':') | 81 | while(*c == ':') |
77 | c++; | 82 | c++; |
78 | p = buffer; | 83 | p = buffer; |
79 | while(*c != '\0' && *c != ':') | 84 | while(*c != '\0' && *c != ':') |
80 | *p++ = *c++; | 85 | *p++ = *c++; |
81 | *p = '\0'; | 86 | *p = '\0'; |
82 | strcat(p, "/"); | 87 | strcat(p, "/"); |
83 | strcat(p, PPPDNAME); | 88 | strcat(p, PPPDNAME); |
84 | if(access(buffer, F_OK) == 0) | 89 | if(access(buffer, F_OK) == 0) |
85 | return (pppdPath = buffer); | 90 | return (pppdPath = buffer); |
86 | } | 91 | } |
87 | } | 92 | } |
88 | 93 | ||
89 | return pppdPath; | 94 | return pppdPath; |
90 | } | 95 | } |
diff --git a/noncore/settings/networksettings/ppp/ppp.pro b/noncore/settings/networksettings/ppp/ppp.pro index 62ca2b5..45fa0ee 100644 --- a/noncore/settings/networksettings/ppp/ppp.pro +++ b/noncore/settings/networksettings/ppp/ppp.pro | |||
@@ -1,17 +1,14 @@ | |||
1 | #TEMPLATE = app | ||
2 | # | ||
3 | TEMPLATE = lib | 1 | TEMPLATE = lib |
4 | #CONFIG += qt plugin warn_on | ||
5 | CONFIG += qt plugin warn_on | 2 | CONFIG += qt plugin warn_on |
6 | DESTDIR = $(OPIEDIR)/plugins/networksettings | 3 | DESTDIR = $(OPIEDIR)/plugins/networksettings |
7 | HEADERS = pppmodule.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h interfaceinformationppp.h interfaceppp.h authwidget.h chooserwidget.h devices.h | 4 | HEADERS = pppmodule.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h interfaceinformationppp.h interfaceppp.h authwidget.h chooserwidget.h devices.h |
8 | SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp interfaceinformationppp.cpp interfaceppp.cpp authwidget.cpp chooserwidget.cpp devices.cpp | 5 | SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp interfaceinformationppp.cpp interfaceppp.cpp authwidget.cpp chooserwidget.cpp devices.cpp |
9 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ | 6 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ |
10 | DEPENDPATH+= $(OPIEDIR)/include | 7 | DEPENDPATH+= $(OPIEDIR)/include |
11 | LIBS += -lqpe -L../interfaces/ -linterfaces | 8 | LIBS += -lqpe -L../interfaces/ -linterfaces |
12 | TARGET = kppp | 9 | TARGET = kppp |
13 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
14 | 11 | ||
15 | 12 | ||
16 | 13 | ||
17 | include ( $(OPIEDIR)/include.pro ) | 14 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp index a8c99fd..d2a1490 100644 --- a/noncore/settings/networksettings/ppp/pppconfig.cpp +++ b/noncore/settings/networksettings/ppp/pppconfig.cpp | |||
@@ -1,75 +1,79 @@ | |||
1 | |||
2 | #include <qlayout.h> | ||
3 | #include <qmessagebox.h> | ||
4 | #include <qtabwidget.h> | ||
5 | |||
6 | #include "accounts.h" | 1 | #include "accounts.h" |
7 | #include "devices.h" | 2 | #include "devices.h" |
8 | #include "general.h" | 3 | #include "general.h" |
9 | #include "interfaceppp.h" | 4 | #include "interfaceppp.h" |
10 | #include "modem.h" | 5 | #include "modem.h" |
11 | #include "pppconfig.h" | 6 | #include "pppconfig.h" |
12 | #include "pppdata.h" | 7 | #include "pppdata.h" |
13 | #include "runtests.h" | 8 | #include "runtests.h" |
14 | 9 | ||
10 | /* OPIE */ | ||
11 | #include <opie2/odebug.h> | ||
12 | using namespace Opie::Core; | ||
13 | |||
14 | /* QT */ | ||
15 | #include <qlayout.h> | ||
16 | #include <qmessagebox.h> | ||
17 | #include <qtabwidget.h> | ||
18 | |||
15 | PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent, | 19 | PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent, |
16 | const char *name, | 20 | const char *name, |
17 | bool modal, WFlags fl ) | 21 | bool modal, WFlags fl ) |
18 | : QDialog(parent, name, modal, fl) | 22 | : QDialog(parent, name, modal, fl) |
19 | { | 23 | { |
20 | setCaption(tr("Configure Modem")); | 24 | setCaption(tr("Configure Modem")); |
21 | int result = runTests(); | 25 | int result = runTests(); |
22 | if(result == TEST_CRITICAL){ | 26 | if(result == TEST_CRITICAL){ |
23 | QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") ); | 27 | QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") ); |
24 | return; | 28 | return; |
25 | } | 29 | } |
26 | 30 | ||
27 | interface = iface; | 31 | interface = iface; |
28 | odebug << "PPPConfigWidget::PPPConfigWidget" << oendl; | 32 | odebug << "PPPConfigWidget::PPPConfigWidget" << oendl; |
29 | odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl; | 33 | odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl; |
30 | 34 | ||
31 | odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl; | 35 | odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl; |
32 | 36 | ||
33 | 37 | ||
34 | QVBoxLayout *layout = new QVBoxLayout( this ); | 38 | QVBoxLayout *layout = new QVBoxLayout( this ); |
35 | layout->setSpacing( 0 ); | 39 | layout->setSpacing( 0 ); |
36 | layout->setMargin( 1 ); | 40 | layout->setMargin( 1 ); |
37 | tabWindow = new QTabWidget( this, "tabWidget" ); | 41 | tabWindow = new QTabWidget( this, "tabWidget" ); |
38 | layout->addWidget( tabWindow ); | 42 | layout->addWidget( tabWindow ); |
39 | 43 | ||
40 | accounts = new AccountWidget( interface->data(), tabWindow, "accounts", Qt::WStyle_ContextHelp ); | 44 | accounts = new AccountWidget( interface->data(), tabWindow, "accounts", Qt::WStyle_ContextHelp ); |
41 | tabWindow->addTab( accounts, tr("&Accounts") ); | 45 | tabWindow->addTab( accounts, tr("&Accounts") ); |
42 | devices = new DevicesWidget( interface, tabWindow, "devices", Qt::WStyle_ContextHelp ); | 46 | devices = new DevicesWidget( interface, tabWindow, "devices", Qt::WStyle_ContextHelp ); |
43 | tabWindow->addTab( devices, tr("&Devices") ); | 47 | tabWindow->addTab( devices, tr("&Devices") ); |
44 | 48 | ||
45 | //OLD: | 49 | //OLD: |
46 | // modem1 = new ModemWidget( interface, tabWindow, "modem1" ); | 50 | // modem1 = new ModemWidget( interface, tabWindow, "modem1" ); |
47 | // tabWindow->addTab( modem1, tr("&Device") ); | 51 | // tabWindow->addTab( modem1, tr("&Device") ); |
48 | // modem2 = new ModemWidget2( interface, tabWindow, "modem2" ); | 52 | // modem2 = new ModemWidget2( interface, tabWindow, "modem2" ); |
49 | // tabWindow->addTab( modem2, tr("&Modem") ); | 53 | // tabWindow->addTab( modem2, tr("&Modem") ); |
50 | 54 | ||
51 | } | 55 | } |
52 | 56 | ||
53 | 57 | ||
54 | PPPConfigWidget::~PPPConfigWidget() | 58 | PPPConfigWidget::~PPPConfigWidget() |
55 | { | 59 | { |
56 | 60 | ||
57 | } | 61 | } |
58 | 62 | ||
59 | void PPPConfigWidget::accept() | 63 | void PPPConfigWidget::accept() |
60 | { | 64 | { |
61 | odebug << "PPPConfigWidget::accept" << oendl; | 65 | odebug << "PPPConfigWidget::accept" << oendl; |
62 | odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl; | 66 | odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl; |
63 | odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl; | 67 | odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl; |
64 | interface->setInterfaceName( interface->data()->devname() ); | 68 | interface->setInterfaceName( interface->data()->devname() ); |
65 | interface->setHardwareName( interface->data()->accname() ); | 69 | interface->setHardwareName( interface->data()->accname() ); |
66 | interface->save(); | 70 | interface->save(); |
67 | QDialog::accept(); | 71 | QDialog::accept(); |
68 | } | 72 | } |
69 | 73 | ||
70 | 74 | ||
71 | void PPPConfigWidget::reject() | 75 | void PPPConfigWidget::reject() |
72 | { | 76 | { |
73 | interface->data()->cancel(); | 77 | interface->data()->cancel(); |
74 | QDialog::reject(); | 78 | QDialog::reject(); |
75 | } | 79 | } |
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp index 567ccf8..eb03ef4 100644 --- a/noncore/settings/networksettings/ppp/pppdata.cpp +++ b/noncore/settings/networksettings/ppp/pppdata.cpp | |||
@@ -1,101 +1,103 @@ | |||
1 | /* | 1 | /* |
2 | * kPPP: A pppd front end for the KDE project | 2 | * kPPP: A pppd front end for the KDE project |
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | * | 5 | * |
6 | * Copyright (C) 1997 Bernd Johannes Wuebben | 6 | * Copyright (C) 1997 Bernd Johannes Wuebben |
7 | * wuebben@math.cornell.edu | 7 | * wuebben@math.cornell.edu |
8 | * | 8 | * |
9 | * based on EzPPP: | 9 | * based on EzPPP: |
10 | * Copyright (C) 1997 Jay Painter | 10 | * Copyright (C) 1997 Jay Painter |
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 | #include "pppdata.h" | 27 | #include "pppdata.h" |
28 | #include "runtests.h" | 28 | #include "runtests.h" |
29 | //#include "devices.h" | 29 | |
30 | //#include <klocale.h> | 30 | /* OPIE */ |
31 | #include <opie2/odebug.h> | ||
31 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
33 | using namespace Opie::Core; | ||
34 | |||
35 | /* QT */ | ||
32 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
33 | #include <qapplication.h> | 37 | #include <qapplication.h> |
34 | // #include <klocale.h> | 38 | |
35 | // #include <kconfig.h> | 39 | /* STD */ |
36 | // #include <kmessagebox.h> | ||
37 | // #include <kapplication.h> | ||
38 | #include <assert.h> | 40 | #include <assert.h> |
39 | 41 | ||
40 | #define SEPARATOR -sseepp- | 42 | #define SEPARATOR -sseepp- |
41 | #define SEP QString("%1SEPARATOR%1") | 43 | #define SEP QString("%1SEPARATOR%1") |
42 | 44 | ||
43 | PPPData::PPPData() | 45 | PPPData::PPPData() |
44 | : passwd(""), | 46 | : passwd(""), |
45 | _modemName(""), | 47 | _modemName(""), |
46 | highcount(-1), // start out with no entries | 48 | highcount(-1), // start out with no entries |
47 | highcountdev(-1), // start out with no entries | 49 | highcountdev(-1), // start out with no entries |
48 | // caccount(-1), // set the current account index also | 50 | // caccount(-1), // set the current account index also |
49 | suidprocessid(-1), // process ID of setuid child | 51 | suidprocessid(-1), // process ID of setuid child |
50 | pppdisrunning(false), | 52 | pppdisrunning(false), |
51 | pppderror(0) | 53 | pppderror(0) |
52 | { | 54 | { |
53 | highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; | 55 | highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1; |
54 | highcountdev = readNumConfig(GENERAL_GRP, NUMDEVICES_KEY, 0) - 1; | 56 | highcountdev = readNumConfig(GENERAL_GRP, NUMDEVICES_KEY, 0) - 1; |
55 | Config cfg = config(); | 57 | Config cfg = config(); |
56 | cfg.setGroup(GENERAL_GRP); | 58 | cfg.setGroup(GENERAL_GRP); |
57 | accountList = cfg.readListEntry(ACCOUNT_LIST, ',' ); | 59 | accountList = cfg.readListEntry(ACCOUNT_LIST, ',' ); |
58 | deviceList = cfg.readListEntry(DEVICESNAMES_LIST, ',' ); | 60 | deviceList = cfg.readListEntry(DEVICESNAMES_LIST, ',' ); |
59 | odebug << "PPPData::PPPData has a accountList " << accountList.join("---").latin1() << "" << oendl; | 61 | odebug << "PPPData::PPPData has a accountList " << accountList.join("---").latin1() << "" << oendl; |
60 | odebug << "PPPData::PPPData has a deviceList " << deviceList.join("---").latin1() << "" << oendl; | 62 | odebug << "PPPData::PPPData has a deviceList " << deviceList.join("---").latin1() << "" << oendl; |
61 | 63 | ||
62 | // if (highcount > MAX_ACCOUNTS) | 64 | // if (highcount > MAX_ACCOUNTS) |
63 | // highcount = MAX_ACCOUNTS; | 65 | // highcount = MAX_ACCOUNTS; |
64 | 66 | ||
65 | // if(highcount >= 0 && defaultAccount().isEmpty()) { | 67 | // if(highcount >= 0 && defaultAccount().isEmpty()) { |
66 | // setAccountbyIndex(0); | 68 | // setAccountbyIndex(0); |
67 | // setDefaultAccount(accname()); | 69 | // setDefaultAccount(accname()); |
68 | // } else if(!setAccount(defaultAccount())) | 70 | // } else if(!setAccount(defaultAccount())) |
69 | setDefaultAccount(accname()); | 71 | setDefaultAccount(accname()); |
70 | 72 | ||
71 | // start out with internal debugging disabled | 73 | // start out with internal debugging disabled |
72 | // the user is still free to specify `debug' on his own | 74 | // the user is still free to specify `debug' on his own |
73 | setPPPDebug(false); | 75 | setPPPDebug(false); |
74 | 76 | ||
75 | ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch); | 77 | ::pppdVersion(&pppdVer, &pppdMod, &pppdPatch); |
76 | 78 | ||
77 | } | 79 | } |
78 | 80 | ||
79 | Config PPPData::config() | 81 | Config PPPData::config() |
80 | { | 82 | { |
81 | return Config("NetworkSetupPPP"); | 83 | return Config("NetworkSetupPPP"); |
82 | } | 84 | } |
83 | 85 | ||
84 | // | 86 | // |
85 | // save configuration | 87 | // save configuration |
86 | // | 88 | // |
87 | void PPPData::save() | 89 | void PPPData::save() |
88 | { | 90 | { |
89 | odebug << "PPPData saving data" << oendl; | 91 | odebug << "PPPData saving data" << oendl; |
90 | writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); | 92 | writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count()); |
91 | writeConfig(GENERAL_GRP, NUMDEVICES_KEY, highcountdev + 1); | 93 | writeConfig(GENERAL_GRP, NUMDEVICES_KEY, highcountdev + 1); |
92 | QString key; | 94 | QString key; |
93 | QStringList keys; | 95 | QStringList keys; |
94 | Config cfg = config(); | 96 | Config cfg = config(); |
95 | cfg.setGroup(GENERAL_GRP); | 97 | cfg.setGroup(GENERAL_GRP); |
96 | cfg.writeEntry(ACCOUNT_LIST, accountList, ',' ); | 98 | cfg.writeEntry(ACCOUNT_LIST, accountList, ',' ); |
97 | cfg.writeEntry(DEVICESNAMES_LIST, deviceList, ',' ); | 99 | cfg.writeEntry(DEVICESNAMES_LIST, deviceList, ',' ); |
98 | 100 | ||
99 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); | 101 | for( QMap<QString,QString>::Iterator it = stringEntries.begin(); |
100 | it != stringEntries.end(); ++it ){ | 102 | it != stringEntries.end(); ++it ){ |
101 | QString val = it.data(); | 103 | QString val = it.data(); |
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp index 2291e8a..b102a10 100644 --- a/noncore/settings/networksettings/ppp/pppmodule.cpp +++ b/noncore/settings/networksettings/ppp/pppmodule.cpp | |||
@@ -1,75 +1,77 @@ | |||
1 | 1 | ||
2 | #include "modem.h" | 2 | #include "modem.h" |
3 | #include "pppconfig.h" | 3 | #include "pppconfig.h" |
4 | #include "pppmodule.h" | 4 | #include "pppmodule.h" |
5 | #include "pppdata.h" | 5 | #include "pppdata.h" |
6 | #include "interfaceinformationppp.h" | 6 | #include "interfaceinformationppp.h" |
7 | #include "interfaceppp.h" | 7 | #include "interfaceppp.h" |
8 | 8 | ||
9 | /* OPIE */ | 9 | /* OPIE */ |
10 | #include <opie2/odebug.h> | ||
10 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
11 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
13 | using namespace Opie::Core; | ||
12 | 14 | ||
13 | /* QT */ | 15 | /* QT */ |
14 | 16 | ||
15 | /* STD */ | 17 | /* STD */ |
16 | #include <errno.h> | 18 | #include <errno.h> |
17 | #include <signal.h> | 19 | #include <signal.h> |
18 | 20 | ||
19 | // don't polute global namespace | 21 | // don't polute global namespace |
20 | namespace | 22 | namespace |
21 | { | 23 | { |
22 | /* | 24 | /* |
23 | * If network settings is qutting and we've ppp | 25 | * If network settings is qutting and we've ppp |
24 | * devices open we need to save the pid_t the PPData | 26 | * devices open we need to save the pid_t the PPData |
25 | * and the interface number | 27 | * and the interface number |
26 | */ | 28 | */ |
27 | struct Connection | 29 | struct Connection |
28 | { | 30 | { |
29 | pid_t pid; | 31 | pid_t pid; |
30 | QString device; | 32 | QString device; |
31 | QString name; | 33 | QString name; |
32 | }; | 34 | }; |
33 | class InterfaceKeeper | 35 | class InterfaceKeeper |
34 | { | 36 | { |
35 | public: | 37 | public: |
36 | InterfaceKeeper(); | 38 | InterfaceKeeper(); |
37 | ~InterfaceKeeper(); | 39 | ~InterfaceKeeper(); |
38 | 40 | ||
39 | void addInterface( pid_t, const QString& pppDev, const QString& name ); | 41 | void addInterface( pid_t, const QString& pppDev, const QString& name ); |
40 | QMap<QString, Connection> interfaces()const; // will check if still available | 42 | QMap<QString, Connection> interfaces()const; // will check if still available |
41 | private: | 43 | private: |
42 | bool isAvailable( pid_t )const; | 44 | bool isAvailable( pid_t )const; |
43 | QMap<QString, Connection> m_interfaces; | 45 | QMap<QString, Connection> m_interfaces; |
44 | }; | 46 | }; |
45 | } | 47 | } |
46 | 48 | ||
47 | 49 | ||
48 | /** | 50 | /** |
49 | * Constructor, find all of the possible interfaces | 51 | * Constructor, find all of the possible interfaces |
50 | * We also need to restore the state.. it could be that | 52 | * We also need to restore the state.. it could be that |
51 | * an interface was up while closing the application | 53 | * an interface was up while closing the application |
52 | * we need to be able to shut it down... | 54 | * we need to be able to shut it down... |
53 | */ | 55 | */ |
54 | PPPModule::PPPModule() : Module() | 56 | PPPModule::PPPModule() : Module() |
55 | { | 57 | { |
56 | InterfaceKeeper inFace; | 58 | InterfaceKeeper inFace; |
57 | QMap<QString,Connection> running = inFace.interfaces(); | 59 | QMap<QString,Connection> running = inFace.interfaces(); |
58 | QStringList handledInterfaceNames; | 60 | QStringList handledInterfaceNames; |
59 | 61 | ||
60 | QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces(); | 62 | QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces(); |
61 | QMap<QString,QString>::Iterator it; | 63 | QMap<QString,QString>::Iterator it; |
62 | InterfacePPP *iface; | 64 | InterfacePPP *iface; |
63 | odebug << "getting interfaces" << oendl; | 65 | odebug << "getting interfaces" << oendl; |
64 | for( it = ifaces.begin(); it != ifaces.end(); ++it ) | 66 | for( it = ifaces.begin(); it != ifaces.end(); ++it ) |
65 | { | 67 | { |
66 | odebug << "ifaces " << it.key().latin1() << " " << it.data().latin1() << "" << oendl; | 68 | odebug << "ifaces " << it.key().latin1() << " " << it.data().latin1() << "" << oendl; |
67 | iface = new InterfacePPP( 0, it.key() ); | 69 | iface = new InterfacePPP( 0, it.key() ); |
68 | iface->setHardwareName( it.data() ); | 70 | iface->setHardwareName( it.data() ); |
69 | list.append( (Interface*)iface ); | 71 | list.append( (Interface*)iface ); |
70 | 72 | ||
71 | // check if (*it) is one of the running ifaces | 73 | // check if (*it) is one of the running ifaces |
72 | if ( running.contains( it.data() ) ) | 74 | if ( running.contains( it.data() ) ) |
73 | { | 75 | { |
74 | odebug << "iface is running " << it.key().latin1() << "" << oendl; | 76 | odebug << "iface is running " << it.key().latin1() << "" << oendl; |
75 | handledInterfaceNames << running[it.data()].device; | 77 | handledInterfaceNames << running[it.data()].device; |
diff --git a/noncore/settings/networksettings/wlan/config.in b/noncore/settings/networksettings/wlan/config.in index d4661cb..233764e 100644 --- a/noncore/settings/networksettings/wlan/config.in +++ b/noncore/settings/networksettings/wlan/config.in | |||
@@ -1,6 +1,6 @@ | |||
1 | config WLAN | 1 | config WLAN |
2 | boolean "opie-networksettingsplugin-wlan (wireless LAN module)" | 2 | boolean "opie-networksettingsplugin-wlan (wireless LAN module)" |
3 | default "n" if NETWORKSETUP | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && NETWORKSETUP && NETWORKSETUP-CORE && INTERFACES && LIBOPIE2NET | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && NETWORKSETUP && NETWORKSETUP-CORE && INTERFACES && LIBOPIE2NET |
5 | #comment "opie-networksettingsplugin-wlan needs libopie2ui, libopie2net and networksetup" | 5 | #comment "opie-networksettingsplugin-wlan needs libopie2ui, libopie2net and networksetup" |
6 | #depends !( LIBOPIE2NET && NETWORKSETUP) \ No newline at end of file | 6 | #depends !( LIBOPIE2NET && NETWORKSETUP) |
diff --git a/noncore/settings/networksettings/wlan/infoimp.cpp b/noncore/settings/networksettings/wlan/infoimp.cpp index c558f5e..273bed8 100644 --- a/noncore/settings/networksettings/wlan/infoimp.cpp +++ b/noncore/settings/networksettings/wlan/infoimp.cpp | |||
@@ -1,56 +1,61 @@ | |||
1 | #include "infoimp.h" | 1 | #include "infoimp.h" |
2 | #include "wextensions.h" | 2 | #include "wextensions.h" |
3 | 3 | ||
4 | /* OPIE */ | ||
5 | #include <opie2/odebug.h> | ||
6 | using namespace Opie::Core; | ||
7 | |||
8 | /* QT */ | ||
4 | #include <qtimer.h> | 9 | #include <qtimer.h> |
5 | #include <qprogressbar.h> | 10 | #include <qprogressbar.h> |
6 | #include <qlabel.h> | 11 | #include <qlabel.h> |
7 | 12 | ||
8 | /** | 13 | /** |
9 | * Constructor. If wireless extensions are enabled on device name then | 14 | * Constructor. If wireless extensions are enabled on device name then |
10 | * start a timer that every second will update the information. | 15 | * start a timer that every second will update the information. |
11 | */ | 16 | */ |
12 | WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){ | 17 | WlanInfoImp::WlanInfoImp( QWidget* parent, const char* name, WFlags fl): WlanInfo(parent, name, fl){ |
13 | WExtensions *wExtensions = new WExtensions(name); | 18 | WExtensions *wExtensions = new WExtensions(name); |
14 | if(!wExtensions->doesHaveWirelessExtensions()){ | 19 | if(!wExtensions->doesHaveWirelessExtensions()){ |
15 | delete wExtensions; | 20 | delete wExtensions; |
16 | odebug << "WlanInfoImp::No wireless extension" << oendl; | 21 | odebug << "WlanInfoImp::No wireless extension" << oendl; |
17 | return; | 22 | return; |
18 | } | 23 | } |
19 | delete wExtensions; | 24 | delete wExtensions; |
20 | timer = new QTimer( this ); | 25 | timer = new QTimer( this ); |
21 | connect( timer, SIGNAL(timeout()), this, SLOT(update())); | 26 | connect( timer, SIGNAL(timeout()), this, SLOT(update())); |
22 | timer->start( 1000, false ); | 27 | timer->start( 1000, false ); |
23 | } | 28 | } |
24 | 29 | ||
25 | /** | 30 | /** |
26 | * Updates the information about the wireless device. | 31 | * Updates the information about the wireless device. |
27 | */ | 32 | */ |
28 | void WlanInfoImp::update(){ | 33 | void WlanInfoImp::update(){ |
29 | WExtensions *wExtensions = new WExtensions(this->name()); | 34 | WExtensions *wExtensions = new WExtensions(this->name()); |
30 | if(!wExtensions->doesHaveWirelessExtensions()){ | 35 | if(!wExtensions->doesHaveWirelessExtensions()){ |
31 | odebug << "No extension" << oendl; | 36 | odebug << "No extension" << oendl; |
32 | delete wExtensions; | 37 | delete wExtensions; |
33 | timer->stop(); | 38 | timer->stop(); |
34 | return; | 39 | return; |
35 | } | 40 | } |
36 | essidLabel->setText(wExtensions->essid()); | 41 | essidLabel->setText(wExtensions->essid()); |
37 | apLabel->setText(wExtensions->ap()); | 42 | apLabel->setText(wExtensions->ap()); |
38 | stationLabel->setText(wExtensions->station()); | 43 | stationLabel->setText(wExtensions->station()); |
39 | modeLabel->setText(wExtensions->mode()); | 44 | modeLabel->setText(wExtensions->mode()); |
40 | channelLabel->setText(QString("%1").arg(wExtensions->channel())); | 45 | channelLabel->setText(QString("%1").arg(wExtensions->channel())); |
41 | int signal = 0; | 46 | int signal = 0; |
42 | int noise = 0; | 47 | int noise = 0; |
43 | int quality = 0; | 48 | int quality = 0; |
44 | wExtensions->stats(signal, noise, quality); | 49 | wExtensions->stats(signal, noise, quality); |
45 | if(signalProgressBar->progress() != signal) | 50 | if(signalProgressBar->progress() != signal) |
46 | signalProgressBar->setProgress(signal); | 51 | signalProgressBar->setProgress(signal); |
47 | if(noiseProgressBar->progress() != noise) | 52 | if(noiseProgressBar->progress() != noise) |
48 | noiseProgressBar->setProgress(noise); | 53 | noiseProgressBar->setProgress(noise); |
49 | if(qualityProgressBar->progress() != quality) | 54 | if(qualityProgressBar->progress() != quality) |
50 | qualityProgressBar->setProgress(quality); | 55 | qualityProgressBar->setProgress(quality); |
51 | rateLabel->setText(QString("%1 Mb/s").arg(wExtensions->rate())); | 56 | rateLabel->setText(QString("%1 Mb/s").arg(wExtensions->rate())); |
52 | delete wExtensions; | 57 | delete wExtensions; |
53 | } | 58 | } |
54 | 59 | ||
55 | // infoimp.cpp | 60 | // infoimp.cpp |
56 | 61 | ||
diff --git a/noncore/settings/networksettings/wlan/wextensions.cpp b/noncore/settings/networksettings/wlan/wextensions.cpp index 9c64323..fe21f02 100644 --- a/noncore/settings/networksettings/wlan/wextensions.cpp +++ b/noncore/settings/networksettings/wlan/wextensions.cpp | |||
@@ -1,79 +1,86 @@ | |||
1 | #include "wextensions.h" | 1 | #include "wextensions.h" |
2 | 2 | ||
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
5 | using namespace Opie::Core; | ||
6 | |||
7 | /* QT */ | ||
3 | #include <qfile.h> | 8 | #include <qfile.h> |
4 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
5 | 10 | ||
11 | /* STD */ | ||
6 | #include <arpa/inet.h> | 12 | #include <arpa/inet.h> |
7 | #include <sys/socket.h> | 13 | #include <sys/socket.h> |
8 | #include <sys/ioctl.h> | 14 | #include <sys/ioctl.h> |
9 | |||
10 | #include <math.h> | 15 | #include <math.h> |
11 | 16 | ||
12 | #define PROCNETWIRELESS "/proc/net/wireless" | 17 | #define PROCNETWIRELESS "/proc/net/wireless" |
13 | #define IW_LOWER 0 | 18 | #define IW_LOWER 0 |
14 | #define IW_UPPER 256 | 19 | #define IW_UPPER 256 |
15 | 20 | ||
21 | #warning This is duplicated code. Use libopienet2! | ||
22 | |||
16 | /** | 23 | /** |
17 | * Constructor. Sets hasWirelessExtensions | 24 | * Constructor. Sets hasWirelessExtensions |
18 | */ | 25 | */ |
19 | WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) { | 26 | WExtensions::WExtensions(QString interfaceName): hasWirelessExtensions(false), interface(interfaceName) { |
20 | fd = socket( AF_INET, SOCK_DGRAM, 0 ); | 27 | fd = socket( AF_INET, SOCK_DGRAM, 0 ); |
21 | if(fd == -1) | 28 | if(fd == -1) |
22 | return; | 29 | return; |
23 | 30 | ||
24 | const char* buffer[200]; | 31 | const char* buffer[200]; |
25 | memset( &iwr, 0, sizeof( iwr ) ); | 32 | memset( &iwr, 0, sizeof( iwr ) ); |
26 | iwr.u.essid.pointer = (caddr_t) buffer; | 33 | iwr.u.essid.pointer = (caddr_t) buffer; |
27 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; | 34 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; |
28 | iwr.u.essid.flags = 0; | 35 | iwr.u.essid.flags = 0; |
29 | 36 | ||
30 | // check if it is an IEEE 802.11 standard conform | 37 | // check if it is an IEEE 802.11 standard conform |
31 | // wireless device by sending SIOCGIWESSID | 38 | // wireless device by sending SIOCGIWESSID |
32 | // which also gives back the Extended Service Set ID | 39 | // which also gives back the Extended Service Set ID |
33 | // (see IEEE 802.11 for more information) | 40 | // (see IEEE 802.11 for more information) |
34 | 41 | ||
35 | const char* iname = interface.latin1(); | 42 | const char* iname = interface.latin1(); |
36 | strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); | 43 | strcpy( iwr.ifr_ifrn.ifrn_name, (const char *)iname ); |
37 | if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) ) | 44 | if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr ) ) |
38 | hasWirelessExtensions = true; | 45 | hasWirelessExtensions = true; |
39 | } | 46 | } |
40 | 47 | ||
41 | /** | 48 | /** |
42 | * @return QString the station name of the access point. | 49 | * @return QString the station name of the access point. |
43 | */ | 50 | */ |
44 | QString WExtensions::station(){ | 51 | QString WExtensions::station(){ |
45 | if(!hasWirelessExtensions) | 52 | if(!hasWirelessExtensions) |
46 | return QString(); | 53 | return QString(); |
47 | const char* buffer[200]; | 54 | const char* buffer[200]; |
48 | iwr.u.data.pointer = (caddr_t) buffer; | 55 | iwr.u.data.pointer = (caddr_t) buffer; |
49 | iwr.u.data.length = IW_ESSID_MAX_SIZE; | 56 | iwr.u.data.length = IW_ESSID_MAX_SIZE; |
50 | iwr.u.data.flags = 0; | 57 | iwr.u.data.flags = 0; |
51 | if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){ | 58 | if ( 0 == ioctl( fd, SIOCGIWNICKN, &iwr )){ |
52 | iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0'; | 59 | iwr.u.data.pointer[(unsigned int) iwr.u.data.length-1] = '\0'; |
53 | return QString(iwr.u.data.pointer); | 60 | return QString(iwr.u.data.pointer); |
54 | } | 61 | } |
55 | return QString(); | 62 | return QString(); |
56 | } | 63 | } |
57 | 64 | ||
58 | /** | 65 | /** |
59 | * @return QString the essid of the host 802.11 access point. | 66 | * @return QString the essid of the host 802.11 access point. |
60 | */ | 67 | */ |
61 | QString WExtensions::essid(){ | 68 | QString WExtensions::essid(){ |
62 | if(!hasWirelessExtensions) | 69 | if(!hasWirelessExtensions) |
63 | return QString(); | 70 | return QString(); |
64 | if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){ | 71 | if ( 0 == ioctl( fd, SIOCGIWESSID, &iwr )){ |
65 | iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length] = '\0'; | 72 | iwr.u.essid.pointer[(unsigned int) iwr.u.essid.length] = '\0'; |
66 | return QString(iwr.u.essid.pointer); | 73 | return QString(iwr.u.essid.pointer); |
67 | } | 74 | } |
68 | return QString(); | 75 | return QString(); |
69 | } | 76 | } |
70 | 77 | ||
71 | /** | 78 | /** |
72 | * @return QString the mode of interface | 79 | * @return QString the mode of interface |
73 | */ | 80 | */ |
74 | QString WExtensions::mode(){ | 81 | QString WExtensions::mode(){ |
75 | if(!hasWirelessExtensions) | 82 | if(!hasWirelessExtensions) |
76 | return QString(); | 83 | return QString(); |
77 | if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) ) | 84 | if ( 0 == ioctl( fd, SIOCGIWMODE, &iwr ) ) |
78 | return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed"); | 85 | return QString("%1").arg(iwr.u.mode == IW_MODE_ADHOC ? "Ad-Hoc" : "Managed"); |
79 | return QString(); | 86 | return QString(); |
diff --git a/noncore/settings/networksettings/wlan/wlan.pro b/noncore/settings/networksettings/wlan/wlan.pro index 89867ae..c94dc0e 100644 --- a/noncore/settings/networksettings/wlan/wlan.pro +++ b/noncore/settings/networksettings/wlan/wlan.pro | |||
@@ -1,28 +1,25 @@ | |||
1 | # | ||
2 | TEMPLATE = lib | 1 | TEMPLATE = lib |
3 | #TEMPLATE = app | ||
4 | CONFIG += qt plugin warn_on | 2 | CONFIG += qt plugin warn_on |
5 | #CONFIG += qt plugin warn_on | ||
6 | DESTDIR = $(OPIEDIR)/plugins/networksettings | 3 | DESTDIR = $(OPIEDIR)/plugins/networksettings |
7 | HEADERS = infoimp.h wlanmodule.h wextensions.h keyedit.h | 4 | HEADERS = infoimp.h wlanmodule.h wextensions.h keyedit.h |
8 | SOURCES = infoimp.cpp wlanmodule.cpp wextensions.cpp keyedit.cpp | 5 | SOURCES = infoimp.cpp wlanmodule.cpp wextensions.cpp keyedit.cpp |
9 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ | 6 | INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ |
10 | DEPENDPATH+= $(OPIEDIR)/include | 7 | DEPENDPATH+= $(OPIEDIR)/include |
11 | LIBS += -lqpe -L../interfaces/ -linterfaces -lopiecore2 -lopienet2 | 8 | LIBS += -lqpe -L../interfaces/ -linterfaces -lopiecore2 -lopienet2 |
12 | INTERFACES= wlan.ui info.ui | 9 | INTERFACES= wlan.ui info.ui |
13 | TARGET = wlan | 10 | TARGET = wlan |
14 | VERSION = 1.0.0 | 11 | VERSION = 1.0.0 |
15 | 12 | ||
16 | #CONFIG += wirelessopts | 13 | #CONFIG += wirelessopts |
17 | 14 | ||
18 | wirelessopts { | 15 | wirelessopts { |
19 | HEADERS+= wlanimp.h | 16 | HEADERS+= wlanimp.h |
20 | SOURCES+= wlanimp.cpp | 17 | SOURCES+= wlanimp.cpp |
21 | } | 18 | } |
22 | 19 | ||
23 | ! wirelessopts { | 20 | ! wirelessopts { |
24 | HEADERS+= wlanimp2.h | 21 | HEADERS+= wlanimp2.h |
25 | SOURCES += wlanimp2.cpp | 22 | SOURCES += wlanimp2.cpp |
26 | } | 23 | } |
27 | 24 | ||
28 | include ( $(OPIEDIR)/include.pro ) | 25 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp index e4aa2f9..4294b12 100644 --- a/noncore/settings/networksettings/wlan/wlanimp2.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp | |||
@@ -1,110 +1,112 @@ | |||
1 | #include "wlanimp2.h" | 1 | #include "wlanimp2.h" |
2 | #include "keyedit.h" | 2 | #include "keyedit.h" |
3 | #include "interfacesetupimp.h" | 3 | #include "interfacesetupimp.h" |
4 | |||
5 | #include "../interfaces/interface.h" | 4 | #include "../interfaces/interface.h" |
6 | 5 | ||
7 | #include <assert.h> | 6 | #include <assert.h> |
8 | #include <errno.h> | 7 | #include <errno.h> |
9 | #include <string.h> | 8 | #include <string.h> |
10 | 9 | ||
10 | /* OPIE */ | ||
11 | #include <opie2/odebug.h> | ||
12 | #include <opie2/oprocess.h> | ||
13 | #include <opie2/onetwork.h> | ||
14 | #include <opie2/opcap.h> | ||
15 | #include <qpe/resource.h> | ||
16 | using namespace Opie::Core; | ||
17 | using namespace Opie::Net; | ||
18 | |||
19 | /* QT */ | ||
11 | #include <qapplication.h> | 20 | #include <qapplication.h> |
12 | #include <qfile.h> | 21 | #include <qfile.h> |
13 | #include <qdir.h> | 22 | #include <qdir.h> |
14 | #include <qdialog.h> | 23 | #include <qdialog.h> |
15 | #include <qtextstream.h> | 24 | #include <qtextstream.h> |
16 | #include <qmessagebox.h> | 25 | #include <qmessagebox.h> |
17 | #include <qlineedit.h> | 26 | #include <qlineedit.h> |
18 | #include <qlabel.h> | 27 | #include <qlabel.h> |
19 | #include <qspinbox.h> | 28 | #include <qspinbox.h> |
20 | #include <qradiobutton.h> | 29 | #include <qradiobutton.h> |
21 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
22 | #include <qcheckbox.h> | 31 | #include <qcheckbox.h> |
23 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
24 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
25 | #include <qlistview.h> | 34 | #include <qlistview.h> |
26 | #include <qvbox.h> | 35 | #include <qvbox.h> |
27 | #include <qprogressbar.h> | 36 | #include <qprogressbar.h> |
28 | 37 | ||
29 | #ifdef QWS | 38 | /* STD */ |
30 | #include <qpe/resource.h> | 39 | #include <assert.h> |
31 | #include <opie2/oprocess.h> | 40 | #include <errno.h> |
32 | #include <opie2/onetwork.h> | 41 | #include <string.h> |
33 | #include <opie2/opcap.h> | ||
34 | #else | ||
35 | #define OProcess KProcess | ||
36 | #include <kprocess.h> | ||
37 | #endif | ||
38 | 42 | ||
39 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" | 43 | #define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" |
40 | #define PREUP "/etc/network/if-pre-up.d/wireless-tools" | 44 | #define PREUP "/etc/network/if-pre-up.d/wireless-tools" |
41 | 45 | ||
42 | /** | 46 | /** |
43 | * Constructor, read in the wireless.opts file for parsing later. | 47 | * Constructor, read in the wireless.opts file for parsing later. |
44 | */ | 48 | */ |
45 | using namespace Opie::Net; | ||
46 | using namespace Opie::Core; | ||
47 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") { | 49 | WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") { |
48 | interfaces = new Interfaces(); | 50 | interfaces = new Interfaces(); |
49 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); | 51 | interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); |
50 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); | 52 | tabWidget->insertTab(interfaceSetup, "TCP/IP"); |
51 | 53 | ||
52 | // Check sanity - the existance of the wireless-tools if-pre-up script | 54 | // Check sanity - the existance of the wireless-tools if-pre-up script |
53 | QFile file(QString(PREUP)); | 55 | QFile file(QString(PREUP)); |
54 | if (file.exists()) { | 56 | if (file.exists()) { |
55 | owarn << QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools") << oendl; | 57 | owarn << QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools") << oendl; |
56 | } | 58 | } |
57 | 59 | ||
58 | connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); | 60 | connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); |
59 | connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) ); | 61 | connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) ); |
60 | netView->setColumnAlignment( col_chn, AlignCenter ); | 62 | netView->setColumnAlignment( col_chn, AlignCenter ); |
61 | netView->setItemMargin( 3 ); | 63 | netView->setItemMargin( 3 ); |
62 | netView->setAllColumnsShowFocus( true ); | 64 | netView->setAllColumnsShowFocus( true ); |
63 | 65 | ||
64 | } | 66 | } |
65 | 67 | ||
66 | WLANImp::~WLANImp() { | 68 | WLANImp::~WLANImp() { |
67 | //FIXME: delete interfaces; | 69 | //FIXME: delete interfaces; |
68 | } | 70 | } |
69 | 71 | ||
70 | /** | 72 | /** |
71 | * Change the profile for both wireless settings and network settings. | 73 | * Change the profile for both wireless settings and network settings. |
72 | */ | 74 | */ |
73 | void WLANImp::setProfile(const QString &profile){ | 75 | void WLANImp::setProfile(const QString &profile){ |
74 | interfaceSetup->setProfile(profile); | 76 | interfaceSetup->setProfile(profile); |
75 | parseOpts(); | 77 | parseOpts(); |
76 | } | 78 | } |
77 | 79 | ||
78 | void WLANImp::parseOpts() { | 80 | void WLANImp::parseOpts() { |
79 | bool error; | 81 | bool error; |
80 | QString opt; | 82 | QString opt; |
81 | 83 | ||
82 | if (! interfaces->isInterfaceSet()) | 84 | if (! interfaces->isInterfaceSet()) |
83 | return; | 85 | return; |
84 | 86 | ||
85 | 87 | ||
86 | opt = interfaces->getInterfaceOption("wireless_essid", error); | 88 | opt = interfaces->getInterfaceOption("wireless_essid", error); |
87 | if(opt == "any" || opt == "off" || opt.isNull()){ | 89 | if(opt == "any" || opt == "off" || opt.isNull()){ |
88 | essid->setEditText("any"); | 90 | essid->setEditText("any"); |
89 | } else { | 91 | } else { |
90 | essid->setEditText(opt); | 92 | essid->setEditText(opt); |
91 | } | 93 | } |
92 | 94 | ||
93 | opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace(); | 95 | opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace(); |
94 | 96 | ||
95 | for ( int i = 0; i < mode->count(); i++) | 97 | for ( int i = 0; i < mode->count(); i++) |
96 | if ( mode->text( i ) == opt ) mode->setCurrentItem( i ); | 98 | if ( mode->text( i ) == opt ) mode->setCurrentItem( i ); |
97 | 99 | ||
98 | opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace(); | 100 | opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace(); |
99 | if (! opt.isNull()) { | 101 | if (! opt.isNull()) { |
100 | specifyAp->setChecked(true); | 102 | specifyAp->setChecked(true); |
101 | macEdit->setText(opt); | 103 | macEdit->setText(opt); |
102 | } | 104 | } |
103 | 105 | ||
104 | opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace(); | 106 | opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace(); |
105 | if (! opt.isNull()) { | 107 | if (! opt.isNull()) { |
106 | specifyChan->setChecked(true); | 108 | specifyChan->setChecked(true); |
107 | networkChannel->setValue(opt.toInt()); | 109 | networkChannel->setValue(opt.toInt()); |
108 | } | 110 | } |
109 | 111 | ||
110 | opt = interfaces->getInterfaceOption("wireless_key", error).simplifyWhiteSpace(); | 112 | opt = interfaces->getInterfaceOption("wireless_key", error).simplifyWhiteSpace(); |
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index 886af10..ba89fa4 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp | |||
@@ -1,73 +1,75 @@ | |||
1 | 1 | ||
2 | #include "wlanmodule.h" | 2 | #include "wlanmodule.h" |
3 | #include "wlanimp2.h" | 3 | #include "wlanimp2.h" |
4 | #include "infoimp.h" | 4 | #include "infoimp.h" |
5 | #include "wextensions.h" | 5 | #include "wextensions.h" |
6 | #include "interfaceinformationimp.h" | 6 | #include "interfaceinformationimp.h" |
7 | 7 | ||
8 | /* OPIE */ | 8 | /* OPIE */ |
9 | #include <opie2/odebug.h> | ||
9 | #include <qpe/qpeapplication.h> | 10 | #include <qpe/qpeapplication.h> |
11 | using namespace Opie::Core; | ||
10 | 12 | ||
11 | /* QT */ | 13 | /* QT */ |
12 | #include <qcheckbox.h> | 14 | #include <qcheckbox.h> |
13 | #include <qcombobox.h> | 15 | #include <qcombobox.h> |
14 | #include <qlabel.h> | 16 | #include <qlabel.h> |
15 | #include <qlineedit.h> | 17 | #include <qlineedit.h> |
16 | #include <qprogressbar.h> | 18 | #include <qprogressbar.h> |
17 | #include <qspinbox.h> | 19 | #include <qspinbox.h> |
18 | #include <qtabwidget.h> | 20 | #include <qtabwidget.h> |
19 | 21 | ||
20 | 22 | ||
21 | /** | 23 | /** |
22 | * Constructor, find all of the possible interfaces | 24 | * Constructor, find all of the possible interfaces |
23 | */ | 25 | */ |
24 | WLANModule::WLANModule() | 26 | WLANModule::WLANModule() |
25 | : Module(), | 27 | : Module(), |
26 | wlanconfigWiget(0) | 28 | wlanconfigWiget(0) |
27 | { | 29 | { |
28 | } | 30 | } |
29 | 31 | ||
30 | /** | 32 | /** |
31 | * Delete any interfaces that we own. | 33 | * Delete any interfaces that we own. |
32 | */ | 34 | */ |
33 | WLANModule::~WLANModule(){ | 35 | WLANModule::~WLANModule(){ |
34 | Interface *i; | 36 | Interface *i; |
35 | for ( i=list.first(); i != 0; i=list.next() ) | 37 | for ( i=list.first(); i != 0; i=list.next() ) |
36 | delete i; | 38 | delete i; |
37 | 39 | ||
38 | } | 40 | } |
39 | 41 | ||
40 | /** | 42 | /** |
41 | * Change the current profile | 43 | * Change the current profile |
42 | */ | 44 | */ |
43 | void WLANModule::setProfile(const QString &newProfile){ | 45 | void WLANModule::setProfile(const QString &newProfile){ |
44 | profile = newProfile; | 46 | profile = newProfile; |
45 | } | 47 | } |
46 | 48 | ||
47 | /** | 49 | /** |
48 | * get the icon name for this device. | 50 | * get the icon name for this device. |
49 | * @param Interface* can be used in determining the icon. | 51 | * @param Interface* can be used in determining the icon. |
50 | * @return QString the icon name (minus .png, .gif etc) | 52 | * @return QString the icon name (minus .png, .gif etc) |
51 | */ | 53 | */ |
52 | QString WLANModule::getPixmapName(Interface* ){ | 54 | QString WLANModule::getPixmapName(Interface* ){ |
53 | return "wlan"; | 55 | return "wlan"; |
54 | } | 56 | } |
55 | 57 | ||
56 | /** | 58 | /** |
57 | * Check to see if the interface i is owned by this module. | 59 | * Check to see if the interface i is owned by this module. |
58 | * @param Interface* interface to check against | 60 | * @param Interface* interface to check against |
59 | * @return bool true if i is owned by this module, false otherwise. | 61 | * @return bool true if i is owned by this module, false otherwise. |
60 | */ | 62 | */ |
61 | bool WLANModule::isOwner(Interface *i){ | 63 | bool WLANModule::isOwner(Interface *i){ |
62 | WExtensions we(i->getInterfaceName()); | 64 | WExtensions we(i->getInterfaceName()); |
63 | if(!we.doesHaveWirelessExtensions()) | 65 | if(!we.doesHaveWirelessExtensions()) |
64 | return false; | 66 | return false; |
65 | 67 | ||
66 | i->setHardwareName("802.11b"); | 68 | i->setHardwareName("802.11b"); |
67 | list.append(i); | 69 | list.append(i); |
68 | return true; | 70 | return true; |
69 | } | 71 | } |
70 | 72 | ||
71 | /** | 73 | /** |
72 | * Create, and return the WLANConfigure Module | 74 | * Create, and return the WLANConfigure Module |
73 | * @return QWidget* pointer to this modules configure. | 75 | * @return QWidget* pointer to this modules configure. |