summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/TODO2
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp5
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp11
3 files changed, 9 insertions, 9 deletions
diff --git a/noncore/settings/networksettings/ppp/TODO b/noncore/settings/networksettings/ppp/TODO
index 529d236..5635438 100644
--- a/noncore/settings/networksettings/ppp/TODO
+++ b/noncore/settings/networksettings/ppp/TODO
@@ -1,7 +1,7 @@
- add possibility to input username and password ;)
- impl. PPPData::copyaccount & PPPData::deleteAccount
- update modem attribute inputs when modem has changed
- fix layout of edit account, i.e. get it shown maximised
- popup configure modem with the correct account prselected
not quite shure why it does not work... IMHO it should work
-- remove interfaces
+
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index 517dd8b..23db409 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -1152,144 +1152,147 @@ void PPPData::setScript(QStringList &list) {
// }
// void PPPData::setTotalBytes(int n) {
// writeConfig(cgroup, TOTALBYTES_KEY, n);
// }
QStringList &PPPData::pppdArgument() {
static QStringList arglist;
while(arglist.count() > MAX_PPPD_ARGUMENTS)
arglist.remove(arglist.last());
readListConfig(cgroup, PPPDARG_KEY, arglist);
return arglist;
}
void PPPData::setpppdArgument(QStringList &args) {
writeListConfig(cgroup, PPPDARG_KEY, args);
}
void PPPData::setpppdArgumentDefaults() {
QStringList arg;
setpppdArgument(arg);
}
// // graphing widget
// void PPPData::setGraphingOptions(bool enable,
// QColor bg,
// QColor text,
// QColor in,
// QColor out)
// {
// if(config) {
// config->setGroup(GRAPH_GRP);
// config->writeEntry(GENABLED, enable);
// // config->writeEntry(GCOLOR_BG, bg);
// // config->writeEntry(GCOLOR_TEXT, text);
// // config->writeEntry(GCOLOR_IN, in);
// // config->writeEntry(GCOLOR_OUT, out);
// }
// }
// void PPPData::graphingOptions(bool &enable,
// QColor &bg,
// QColor &text,
// QColor &in,
// QColor &out)
// {
// QColor c;
// if(config) {
// config->setGroup(GRAPH_GRP);
// enable = config->readBoolEntry(GENABLED, true);
// bg = Qt::white;
// //bg = config->readColorEntry(GCOLOR_BG, &c);
// text = Qt::black;
// //text = config->readColorEntry(GCOLOR_TEXT, &c);
// in = Qt::blue;
// //in = config->readColorEntry(GCOLOR_IN, &c);
// out = Qt::red;
// //out = config->readColorEntry(GCOLOR_OUT, &c);
// }
// }
// bool PPPData::graphingEnabled() {
// return (bool) readNumConfig(GRAPH_GRP, GENABLED, true);
// }
//
//functions to change/set the child pppd process info
//
bool PPPData::pppdRunning() const {
return pppdisrunning;
}
void PPPData::setpppdRunning(bool set) {
pppdisrunning = set;
}
int PPPData::pppdError() const {
return pppderror;
}
void PPPData::setpppdError(int err) {
pppderror = err;
}
QString PPPData::modemGroup()
{
- if (modemDeviceGroup<0)qFatal("wrong modem %i",modemDeviceGroup);
+ if (modemDeviceGroup<0){
+ qDebug("wrong modem %i\n using 0",modemDeviceGroup);
+ modemDeviceGroup = 0; //FIXME!
+ }
return QString("%1_%1").arg(MODEM_GRP).arg(modemDeviceGroup);
}
QMap<QString,QString> PPPData::getConfiguredInterfaces()
{
QMap<QString,QString> ifaces;
Config config = PPPData::config();
config.setGroup(ACCLIST_GRP);
int count = config.readNumEntry( ACCOUNTS_COUNT, -1 );
QString accGrp, dev, acc;
for (int i = 0; i < count; i++){
accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i);
config.setGroup(accGrp);
dev = config.readEntry( ACOUNTS_DEV, "error" );
acc = config.readEntry( ACOUNTS_ACC, "error" );
ifaces.insert( dev, acc );
}
return ifaces;
}
void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces )
{
QMap<QString,QString>::Iterator it;
int i = 0;
Config cfg = config();
for( it = ifaces.begin(); it != ifaces.end(); ++it, ++i ){
cfg.setGroup(QString("%1_%1").arg(ACCLIST_GRP).arg(i));
cfg.writeEntry( ACOUNTS_DEV, it.key() );
cfg.writeEntry( ACOUNTS_ACC, it.data() );
}
cfg.setGroup( ACCLIST_GRP );
cfg.writeEntry( ACCOUNTS_COUNT, i );
}
/**
* pppd's getword() function knows about escape characters.
* If we write the username and password to the secrets file
* we'll therefore have to escape back slashes.
*/
QString PPPData::encodeWord(const QString &s) {
QString r = s;
r.replace(QRegExp("\\"), "\\\\");
return r;
}
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index 95df068..8c401a9 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -12,131 +12,128 @@
PPPModule::PPPModule() : Module()
{
QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces();
QMap<QString,QString>::Iterator it;
InterfacePPP *iface;
qDebug("getting interfaces");
for( it = ifaces.begin(); it != ifaces.end(); ++it ){
qDebug("ifaces %s", it.key().latin1());
iface = new InterfacePPP( 0, it.key() );
iface->setHardwareName( it.data() );
list.append( (Interface*)iface );
}
}
/**
* Delete any interfaces that we own.
*/
PPPModule::~PPPModule(){
QMap<QString,QString> ifaces;
Interface *i;
for ( i=list.first(); i != 0; i=list.next() ){
ifaces.insert( i->getInterfaceName(), i->getHardwareName() );
delete i;
}
PPPData::setConfiguredInterfaces( ifaces );
}
/**
* Change the current profile
*/
void PPPModule::setProfile(const QString &newProfile){
profile = newProfile;
}
/**
* get the icon name for this device.
* @param Interface* can be used in determining the icon.
* @return QString the icon name (minus .png, .gif etc)
*/
QString PPPModule::getPixmapName(Interface* ){
return "ppp";
}
/**
* Check to see if the interface i is owned by this module.
* @param Interface* interface to check against
* @return bool true if i is owned by this module, false otherwise.
*/
bool PPPModule::isOwner(Interface *i){
return list.find( i ) != -1;
}
/**
* Create, and return the WLANConfigure Module
* @return QWidget* pointer to this modules configure.
*/
QWidget *PPPModule::configure(Interface *i){
qDebug("return ModemWidget");
PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i,
0, "PPPConfig", false,
Qt::WDestructiveClose );
return pppconfig;
}
/**
* Create, and return the Information Module
* @return QWidget* pointer to this modules info.
*/
QWidget *PPPModule::information(Interface *i){
// We don't have any advanced pppd information widget yet :-D
// TODO ^
qDebug("return PPPModule::information");
// InterfaceInformationImp *information = new InterfaceInformationImp( 0, "InterfaceSetupImp", i);
InterfaceInformationPPP *information = new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i );
return information;
}
/**
* Get all active (up or down) interfaces
* @return QList<Interface> A list of interfaces that exsist that havn't
* been called by isOwner()
*/
QList<Interface> PPPModule::getInterfaces(){
// List all of the files in the peer directory
qDebug("PPPModule::getInterfaces");
return list;
}
/**
* Attempt to add a new interface as defined by name
* @param name the name of the type of interface that should be created given
* by possibleNewInterfaces();
* @return Interface* NULL if it was unable to be created.
*/
Interface *PPPModule::addNewInterface(const QString &newInterface){
- qDebug("try to add iface %s",newInterface.latin1());
-
InterfacePPP *ifaceppp;
Interface *iface;
ifaceppp = new InterfacePPP();
PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true);
imp.showMaximized();
if(imp.exec() == QDialog::Accepted ){
+ iface = (InterfacePPP*) ifaceppp;
iface->setModuleOwner( this );
- iface = ifaceppp;
list.append( iface );
return iface;
}else {
- delete iface;
+ delete ifaceppp;
iface = NULL;
}
return iface;
}
/**
* Attempts to remove the interface, doesn't delete i
* @return bool true if successfull, false otherwise.
*/
-bool PPPModule::remove(Interface*){
- // Can't remove a hardware device, you can stop it though.
- return false;
+bool PPPModule::remove(Interface *i){
+ return list.remove(i);
}
void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces)
{
newIfaces.insert(QObject::tr("PPP") ,
QObject::tr("generic ppp device"));
}