summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/interfaceppp.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp
index 85ddbee..9ec30bc 100644
--- a/noncore/settings/networksettings/ppp/interfaceppp.cpp
+++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp
@@ -1,141 +1,142 @@
1 1
2#include <qmessagebox.h> 2#include <qmessagebox.h>
3#define i18n QObject::tr 3#define i18n QObject::tr
4 4
5#include "auth.h" 5#include "auth.h"
6#include "interfaceppp.h" 6#include "interfaceppp.h"
7#include "modem.h" 7#include "modem.h"
8#include "pppdata.h" 8#include "pppdata.h"
9 9
10InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status) 10InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status)
11 : Interface(parent, name, status), 11 : Interface(parent, name, status),
12 _modemPtr(0), 12 _modemPtr(0),
13 _dataPtr(0) 13 _dataPtr(0)
14{ 14{
15 qDebug("InterfacePPP::InterfacePPP("); 15 qDebug("InterfacePPP::InterfacePPP(");
16} 16}
17 17
18PPPData* InterfacePPP::data() 18PPPData* InterfacePPP::data()
19{ 19{
20 if (!_dataPtr){ 20 if (!_dataPtr){
21 qDebug("creating new Data obj"); 21 qDebug("creating new Data obj");
22 _dataPtr = new PPPData(); 22 _dataPtr = new PPPData();
23 _dataPtr->setModemDevice( getInterfaceName() ); 23 _dataPtr->setModemDevice( getInterfaceName() );
24 _dataPtr->setAccount( getHardwareName() ); 24 _dataPtr->setAccount( getHardwareName() );
25 } 25 }
26 return _dataPtr; 26 return _dataPtr;
27} 27}
28 28
29Modem* InterfacePPP::modem() 29Modem* InterfacePPP::modem()
30{ 30{
31 if (!_modemPtr){ 31 if (!_modemPtr){
32 qDebug("creating new modem obj"); 32 qDebug("creating new modem obj");
33 _modemPtr = new Modem( data() ); 33 _modemPtr = new Modem( data() );
34 } 34 }
35 return _modemPtr; 35 return _modemPtr;
36} 36}
37 37
38bool InterfacePPP::refresh() 38bool InterfacePPP::refresh()
39{ 39{
40 qDebug("InterfacePPP::refresh()"); 40 qDebug("InterfacePPP::refresh()");
41 updateInterface(this);
41 QMessageBox::information(0,"Not Implemented","This feature is not yet implemneted... ;-("); 42 QMessageBox::information(0,"Not Implemented","This feature is not yet implemneted... ;-(");
42 return false; 43 return false;
43} 44}
44 45
45void InterfacePPP::start() 46void InterfacePPP::start()
46{ 47{
47 qDebug("InterfacePPP::start"); 48 qDebug("InterfacePPP::start");
48// should work... 49// should work...
49// if (data()->password().isEmpty() ){ 50// if (data()->password().isEmpty() ){
50// //FIXME: ask for password 51// //FIXME: ask for password
51// qDebug("using dummy password"); 52// qDebug("using dummy password");
52// QMessageBox::critical( 0, "no password", "you should be prompted for a password, but you are not! ;-)"); 53// QMessageBox::critical( 0, "no password", "you should be prompted for a password, but you are not! ;-)");
53// } 54// }
54 55
55 56
56 QFileInfo info(pppdPath()); 57 QFileInfo info(pppdPath());
57 58
58 if(!info.exists()){ 59 if(!info.exists()){
59 QMessageBox::warning(0, tr("Error"), 60 QMessageBox::warning(0, tr("Error"),
60 i18n("<qt>Cannot find the PPP daemon!<br>" 61 i18n("<qt>Cannot find the PPP daemon!<br>"
61 "Make sure that pppd is installed and " 62 "Make sure that pppd is installed and "
62 "that you have entered the correct path.</qt>")); 63 "that you have entered the correct path.</qt>"));
63 return; 64 return;
64 } 65 }
65//#if 0 66//#if 0
66 if(!info.isExecutable()){ 67 if(!info.isExecutable()){
67 68
68 QString string; 69 QString string;
69 string = i18n( "<qt>Cannot execute:<br> %1<br>" 70 string = i18n( "<qt>Cannot execute:<br> %1<br>"
70 "Please make sure that you have given " 71 "Please make sure that you have given "
71 "setuid permission and that " 72 "setuid permission and that "
72 "pppd is executable.<br>").arg(pppdPath()); 73 "pppd is executable.<br>").arg(pppdPath());
73 QMessageBox::warning(0, tr("Error"), string); 74 QMessageBox::warning(0, tr("Error"), string);
74 return; 75 return;
75 76
76 } 77 }
77//#endif 78//#endif
78 79
79 QFileInfo info2(data()->modemDevice()); 80 QFileInfo info2(data()->modemDevice());
80 81
81 if(!info2.exists()){ 82 if(!info2.exists()){
82 QString string; 83 QString string;
83 string = i18n( "<qt>Cannot find:<br> %1<br>" 84 string = i18n( "<qt>Cannot find:<br> %1<br>"
84 "Please make sure you have setup " 85 "Please make sure you have setup "
85 "your modem device properly " 86 "your modem device properly "
86 "and/or adjust the location of the modem device on " 87 "and/or adjust the location of the modem device on "
87 "the modem tab of " 88 "the modem tab of "
88 "the setup dialog.</qt>").arg(data()->modemDevice()); 89 "the setup dialog.</qt>").arg(data()->modemDevice());
89 QMessageBox::warning(0, tr("Error"), string); 90 QMessageBox::warning(0, tr("Error"), string);
90 return; 91 return;
91 } 92 }
92 93
93 // if this is a PAP or CHAP account, ensure that username is 94 // if this is a PAP or CHAP account, ensure that username is
94 // supplied 95 // supplied
95 if(data()->authMethod() == AUTH_PAP || 96 if(data()->authMethod() == AUTH_PAP ||
96 data()->authMethod() == AUTH_CHAP || 97 data()->authMethod() == AUTH_CHAP ||
97 data()->authMethod() == AUTH_PAPCHAP ) { 98 data()->authMethod() == AUTH_PAPCHAP ) {
98 if(false){ //FIXME: ID_Edit->text().isEmpty()) { 99 if(false){ //FIXME: ID_Edit->text().isEmpty()) {
99 QMessageBox::warning(0,tr("Error"), 100 QMessageBox::warning(0,tr("Error"),
100 i18n("<qt>You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!</qt>")); 101 i18n("<qt>You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!</qt>"));
101// FIXME: return; 102// FIXME: return;
102 } else { 103 } else {
103 if(!modem()->setSecret(data()->authMethod(), 104 if(!modem()->setSecret(data()->authMethod(),
104 PPPData::encodeWord(data()->storedUsername()), 105 PPPData::encodeWord(data()->storedUsername()),
105 PPPData::encodeWord(data()->password())) 106 PPPData::encodeWord(data()->password()))
106 ) { 107 ) {
107 QString s; 108 QString s;
108 s = i18n("<qt>Cannot create PAP/CHAP authentication<br>" 109 s = i18n("<qt>Cannot create PAP/CHAP authentication<br>"
109 "file \"%1\"</qt>").arg(PAP_AUTH_FILE); 110 "file \"%1\"</qt>").arg(PAP_AUTH_FILE);
110 QMessageBox::warning(0, tr("Error"), s); 111 QMessageBox::warning(0, tr("Error"), s);
111 return; 112 return;
112 } 113 }
113 } 114 }
114 } 115 }
115 116
116 if (data()->phonenumber().isEmpty()) { 117 if (data()->phonenumber().isEmpty()) {
117 QString s = i18n("You must specify a telephone number!"); 118 QString s = i18n("You must specify a telephone number!");
118 QMessageBox::warning(0, tr("Error"), s); 119 QMessageBox::warning(0, tr("Error"), s);
119 return; 120 return;
120 } 121 }
121 122
122 // SEGFAULTS: 123 // SEGFAULTS:
123// setStatus( true ); 124// setStatus( true );
124// emit updateInterface((Interface*) this); 125// emit updateInterface((Interface*) this);
125 126
126 emit begin_connect(); 127 emit begin_connect();
127 128
128 qDebug("InterfacePPP::start END"); 129 qDebug("InterfacePPP::start END");
129} 130}
130 131
131void InterfacePPP::stop() 132void InterfacePPP::stop()
132{ 133{
133 qDebug("InterfacePPP::stop"); 134 qDebug("InterfacePPP::stop");
134 135
135} 136}
136 137
137void InterfacePPP::save() 138void InterfacePPP::save()
138{ 139{
139 data()->save(); 140 data()->save();
140 emit updateInterface((Interface*) this); 141 emit updateInterface((Interface*) this);
141} 142}