Diffstat (limited to 'noncore/settings/networksettings/ppp/interfaceppp.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/interfaceppp.cpp | 70 |
1 files changed, 51 insertions, 19 deletions
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp index 9ec30bc..f443f3c 100644 --- a/noncore/settings/networksettings/ppp/interfaceppp.cpp +++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp | |||
@@ -2,3 +2,5 @@ | |||
2 | #include <qmessagebox.h> | 2 | #include <qmessagebox.h> |
3 | #define i18n QObject::tr | 3 | #include <qlayout.h> |
4 | #include <qlineedit.h> | ||
5 | #include <qlabel.h> | ||
4 | 6 | ||
@@ -17,3 +19,3 @@ InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status) | |||
17 | 19 | ||
18 | PPPData* InterfacePPP::data() | 20 | PPPData* InterfacePPP::data()const |
19 | { | 21 | { |
@@ -22,3 +24,3 @@ PPPData* InterfacePPP::data() | |||
22 | _dataPtr = new PPPData(); | 24 | _dataPtr = new PPPData(); |
23 | _dataPtr->setModemDevice( getInterfaceName() ); | 25 | _dataPtr->setDevice( getInterfaceName() ); |
24 | _dataPtr->setAccount( getHardwareName() ); | 26 | _dataPtr->setAccount( getHardwareName() ); |
@@ -28,3 +30,3 @@ PPPData* InterfacePPP::data() | |||
28 | 30 | ||
29 | Modem* InterfacePPP::modem() | 31 | Modem* InterfacePPP::modem()const |
30 | { | 32 | { |
@@ -40,5 +42,11 @@ bool InterfacePPP::refresh() | |||
40 | qDebug("InterfacePPP::refresh()"); | 42 | qDebug("InterfacePPP::refresh()"); |
41 | updateInterface(this); | 43 | QString old = getInterfaceName(); |
42 | QMessageBox::information(0,"Not Implemented","This feature is not yet implemneted... ;-("); | 44 | setInterfaceName( modem()->pppDevice() ); |
43 | return false; | 45 | |
46 | (void)Interface::refresh(); | ||
47 | |||
48 | setInterfaceName( old ); | ||
49 | emit updateInterface(this); | ||
50 | |||
51 | return true; | ||
44 | } | 52 | } |
@@ -48,9 +56,18 @@ void InterfacePPP::start() | |||
48 | qDebug("InterfacePPP::start"); | 56 | qDebug("InterfacePPP::start"); |
49 | // should work... | ||
50 | // if (data()->password().isEmpty() ){ | ||
51 | // //FIXME: ask for password | ||
52 | // qDebug("using dummy password"); | ||
53 | // QMessageBox::critical( 0, "no password", "you should be prompted for a password, but you are not! ;-)"); | ||
54 | // } | ||
55 | 57 | ||
58 | if (data()->password().isEmpty() && !data()->storedUsername().isEmpty() ) { | ||
59 | |||
60 | QDialog mb( 0, "Dialog", true ); | ||
61 | mb.setCaption( tr( "No password" ) ); | ||
62 | QVBoxLayout layout( &mb ); | ||
63 | QLabel text ( &mb ); | ||
64 | text.setText( tr("Username defined but no password\n Please enter a password") ); | ||
65 | QLineEdit lineedit( &mb ); | ||
66 | lineedit.setEchoMode( QLineEdit::Password ); | ||
67 | layout.addWidget( &text ); | ||
68 | layout.addWidget( &lineedit ); | ||
69 | if ( mb.exec() == QDialog::Accepted ) { | ||
70 | data()->setPassword( lineedit.text() ); | ||
71 | } | ||
72 | } | ||
56 | 73 | ||
@@ -60,3 +77,3 @@ void InterfacePPP::start() | |||
60 | QMessageBox::warning(0, tr("Error"), | 77 | QMessageBox::warning(0, tr("Error"), |
61 | i18n("<qt>Cannot find the PPP daemon!<br>" | 78 | QObject::tr("<qt>Cannot find the PPP daemon!<br>" |
62 | "Make sure that pppd is installed and " | 79 | "Make sure that pppd is installed and " |
@@ -69,3 +86,3 @@ void InterfacePPP::start() | |||
69 | QString string; | 86 | QString string; |
70 | string = i18n( "<qt>Cannot execute:<br> %1<br>" | 87 | string = QObject::tr( "<qt>Cannot execute:<br> %1<br>" |
71 | "Please make sure that you have given " | 88 | "Please make sure that you have given " |
@@ -83,3 +100,3 @@ void InterfacePPP::start() | |||
83 | QString string; | 100 | QString string; |
84 | string = i18n( "<qt>Cannot find:<br> %1<br>" | 101 | string = QObject::tr( "<qt>Cannot find:<br> %1<br>" |
85 | "Please make sure you have setup " | 102 | "Please make sure you have setup " |
@@ -100,3 +117,3 @@ void InterfacePPP::start() | |||
100 | QMessageBox::warning(0,tr("Error"), | 117 | QMessageBox::warning(0,tr("Error"), |
101 | i18n("<qt>You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!</qt>")); | 118 | QObject::tr("<qt>You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!</qt>")); |
102 | // FIXME: return; | 119 | // FIXME: return; |
@@ -108,3 +125,3 @@ void InterfacePPP::start() | |||
108 | QString s; | 125 | QString s; |
109 | s = i18n("<qt>Cannot create PAP/CHAP authentication<br>" | 126 | s = QObject::tr("<qt>Cannot create PAP/CHAP authentication<br>" |
110 | "file \"%1\"</qt>").arg(PAP_AUTH_FILE); | 127 | "file \"%1\"</qt>").arg(PAP_AUTH_FILE); |
@@ -117,3 +134,3 @@ void InterfacePPP::start() | |||
117 | if (data()->phonenumber().isEmpty()) { | 134 | if (data()->phonenumber().isEmpty()) { |
118 | QString s = i18n("You must specify a telephone number!"); | 135 | QString s = QObject::tr("You must specify a telephone number!"); |
119 | QMessageBox::warning(0, tr("Error"), s); | 136 | QMessageBox::warning(0, tr("Error"), s); |
@@ -134,2 +151,7 @@ void InterfacePPP::stop() | |||
134 | qDebug("InterfacePPP::stop"); | 151 | qDebug("InterfacePPP::stop"); |
152 | // emit hangup_now(); | ||
153 | status = false; // not connected | ||
154 | setStatus( false ); | ||
155 | emit hangup_now(); | ||
156 | refresh(); | ||
135 | 157 | ||
@@ -142 +164,11 @@ void InterfacePPP::save() | |||
142 | } | 164 | } |
165 | QString InterfacePPP::pppDev()const { | ||
166 | return modem()->pppDevice(); | ||
167 | } | ||
168 | pid_t InterfacePPP::pppPID()const{ | ||
169 | return modem()->pppPID(); | ||
170 | } | ||
171 | void InterfacePPP::setPPPDpid( pid_t pid) { | ||
172 | setStatus( true ); | ||
173 | modem()->setPPPDPid( pid ); | ||
174 | } | ||