author | tille <tille> | 2003-05-24 23:34:09 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-24 23:34:09 (UTC) |
commit | d1c32c127b4dabb716064a790da6be7c24975a92 (patch) (side-by-side diff) | |
tree | aa8a7865d4cccbc696c534d8de3ef3b139777c34 | |
parent | 58947769d80d49faaccac1703da0e66c90158957 (diff) | |
download | opie-d1c32c127b4dabb716064a790da6be7c24975a92.zip opie-d1c32c127b4dabb716064a790da6be7c24975a92.tar.gz opie-d1c32c127b4dabb716064a790da6be7c24975a92.tar.bz2 |
pppd stuff
-rw-r--r-- | noncore/settings/networksettings/ppp/modem.cpp | 227 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/modem.h | 6 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.cpp | 134 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.h | 3 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppmodule.cpp | 28 |
5 files changed, 313 insertions, 85 deletions
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp index cd5d21c..5139482 100644 --- a/noncore/settings/networksettings/ppp/modem.cpp +++ b/noncore/settings/networksettings/ppp/modem.cpp @@ -1,181 +1,195 @@ /* * kPPP: A pppd Front End for the KDE project * * $Id$ * * Copyright (C) 1997 Bernd Johannes Wuebben * wuebben@math.cornell.edu * * This file was added by Harri Porten <porten@tu-harburg.de> * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <errno.h> #include <stdlib.h> +#include <unistd.h> #include <fcntl.h> #include <signal.h> #include <sys/ioctl.h> #include <setjmp.h> #include <regex.h> #include <qregexp.h> #include <assert.h> +#include <string.h> +#ifdef HAVE_RESOLV_H +# include <arpa/nameser.h> +# include <resolv.h> +#endif + +#ifndef _PATH_RESCONF +#define _PATH_RESCONF "/etc/resolv.conf" +#endif + +#define strlcpy strcpy #include "auth.h" #include "modem.h" #include "pppdata.h" //#include <klocale.h> #define i18n QObject::tr #define qError qDebug //#include <kdebug.h> //#include <config.h> #define MY_ASSERT(x) if (!(x)) { \ qFatal( "ASSERT: \"%s\" in %s (%d)\n",#x,__FILE__,__LINE__); \ exit(1); } static sigjmp_buf jmp_buffer; Modem *Modem::modem = 0; const char* pppdPath() { // wasting a few bytes static char buffer[sizeof(PPPDSEARCHPATH)+sizeof(PPPDNAME)]; static char *pppdPath = 0L; char *p; if(pppdPath == 0L) { const char *c = PPPDSEARCHPATH; while(*c != '\0') { while(*c == ':') c++; p = buffer; while(*c != '\0' && *c != ':') *p++ = *c++; *p = '\0'; strcat(p, "/"); strcat(p, PPPDNAME); if(access(buffer, F_OK) == 0) return (pppdPath = buffer); } } return pppdPath; } Modem::Modem() { if (Modem::modem != 0) return; //CORRECT? modemfd = -1; + _pppdExitStatus = -1; + pppdPid = -1; sn = 0L; data_mode = false; modem_is_locked = false; lockfile[0] = '\0'; device = "/dev/modem"; modem = this; } Modem::~Modem() { modem = 0; } speed_t Modem::modemspeed() { // convert the string modem speed int the gpppdata object to a t_speed type // to set the modem. The constants here should all be ifdef'd because // other systems may not have them int i = PPPData::data()->speed().toInt()/100; switch(i) { case 24: return B2400; break; case 96: return B9600; break; case 192: return B19200; break; case 384: return B38400; break; #ifdef B57600 case 576: return B57600; break; #endif #ifdef B115200 case 1152: return B115200; break; #endif #ifdef B230400 case 2304: return B230400; break; #endif #ifdef B460800 case 4608: return B460800; break; #endif default: return B38400; break; } } bool Modem::opentty() { // int flags; //begin if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { close(modemfd); device = PPPData::data()->modemDevice(); if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) { qDebug("error opening modem device !"); errmsg = i18n("Unable to open modem."); return false; } //bend if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) { //} #if 0 if(PPPData::data()->UseCDLine()) { if(ioctl(modemfd, TIOCMGET, &flags) == -1) { errmsg = i18n("Unable to detect state of CD line."); ::close(modemfd); modemfd = -1; return false; } if ((flags&TIOCM_CD) == 0) { errmsg = i18n("The modem is not ready."); ::close(modemfd); modemfd = -1; return false; } } #endif tcdrain (modemfd); tcflush (modemfd, TCIOFLUSH); @@ -662,148 +676,347 @@ int Modem::openLockfile( QString lockfile, int flags) return fd; } void alarm_handler(int) { // fprintf(stderr, "alarm_handler(): Received SIGALRM\n"); // jump siglongjmp(jmp_buffer, 1); } const char* Modem::authFile(Auth method, int version) { switch(method|version) { case PAP|Original: return PAP_AUTH_FILE; break; case PAP|New: return PAP_AUTH_FILE".new"; break; case PAP|Old: return PAP_AUTH_FILE".old"; break; case CHAP|Original: return CHAP_AUTH_FILE; break; case CHAP|New: return CHAP_AUTH_FILE".new"; break; case CHAP|Old: return CHAP_AUTH_FILE".old"; break; default: return 0L; } } bool Modem::createAuthFile(Auth method, const char *username, const char *password) { const char *authfile, *oldName, *newName; char line[100]; char regexp[2*MaxStrLen+30]; regex_t preg; if(!(authfile = authFile(method))) return false; if(!(newName = authFile(method, New))) return false; // look for username, "username" or 'username' // if you modify this RE you have to adapt regexp's size above snprintf(regexp, sizeof(regexp), "^[ \t]*%s[ \t]\\|^[ \t]*[\"\']%s[\"\']", username,username); MY_ASSERT(regcomp(&preg, regexp, 0) == 0); // copy to new file pap- or chap-secrets int old_umask = umask(0077); FILE *fout = fopen(newName, "w"); if(fout) { // copy old file FILE *fin = fopen(authfile, "r"); if(fin) { while(fgets(line, sizeof(line), fin)) { if(regexec(&preg, line, 0, 0L, 0) == 0) continue; fputs(line, fout); } fclose(fin); } // append user/pass pair fprintf(fout, "\"%s\"\t*\t\"%s\"\n", username, password); fclose(fout); } // restore umask umask(old_umask); // free memory allocated by regcomp regfree(&preg); if(!(oldName = authFile(method, Old))) return false; // delete old file if any unlink(oldName); rename(authfile, oldName); rename(newName, authfile); return true; } +bool Modem::removeAuthFile(Auth method) { + const char *authfile, *oldName; + + if(!(authfile = authFile(method))) + return false; + if(!(oldName = authFile(method, Old))) + return false; + + if(access(oldName, F_OK) == 0) { + unlink(authfile); + return (rename(oldName, authfile) == 0); + } else + return false; +} + + bool Modem::setSecret(int method, const char* name, const char* password) { Auth auth; if(method == AUTH_PAPCHAP) return setSecret(AUTH_PAP, name, password) && setSecret(AUTH_CHAP, name, password); switch(method) { case AUTH_PAP: auth = Modem::PAP; break; case AUTH_CHAP: auth = Modem::CHAP; break; default: return false; } return createAuthFile(auth, name, password); } -bool Modem::removeSecret(int) +bool Modem::removeSecret(int method) { - return true; + Auth auth; + + switch(method) { + case AUTH_PAP: + auth = Modem::PAP; + break; + case AUTH_CHAP: + auth = Modem::CHAP; + break; + default: + return false; + } + return removeAuthFile( auth ); } -void Modem::killPPPDaemon() +int checkForInterface() { +// I don't know if Linux needs more initialization to get the ioctl to +// work, pppd seems to hint it does. But BSD doesn't, and the following +// code should compile. +#if (defined(HAVE_NET_IF_PPP_H) || defined(HAVE_LINUX_IF_PPP_H)) && !defined(__svr4__) + int s, ok; + struct ifreq ifr; + // extern char *no_ppp_msg; + + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + return 1; /* can't tell */ + + strlcpy(ifr.ifr_name, "ppp0", sizeof (ifr.ifr_name)); + ok = ioctl(s, SIOCGIFFLAGS, (caddr_t) &ifr) >= 0; + close(s); + + if (ok == -1) { +// This is ifdef'd FreeBSD, because FreeBSD is the only BSD that supports +// KLDs, the old LKM interface couldn't handle loading devices +// dynamically, and thus can't load ppp support on the fly +#ifdef __FreeBSD__ + // If we failed to load ppp support and don't have it already. + if (kldload("if_ppp") == -1) { + return -1; } + return 0; +#else + return -1; +#endif + } + return 0; +#else +// We attempt to use the SunOS/SysVr4 method and stat /dev/ppp + struct stat buf; -int Modem::pppdExitStatus() + memset(&buf, 0, sizeof(buf)); + return stat("/dev/ppp", &buf); +#endif +} + +bool Modem::execpppd(const char *arguments) { + char buf[MAX_CMDLEN]; + char *args[MaxArgs]; + pid_t pgrpid; + + if(modemfd<0) + return false; + + _pppdExitStatus = -1; + + switch(pppdPid = fork()) { - return -1; + case -1: + fprintf(stderr,"In parent: fork() failed\n"); + return false; + break; + + case 0: + // let's parse the arguments the user supplied into UNIX suitable form + // that is a list of pointers each pointing to exactly one word + strlcpy(buf, arguments); + parseargs(buf, args); + // become a session leader and let /dev/ttySx + // be the controlling terminal. + pgrpid = setsid(); +#ifdef TIOCSCTTY + if(ioctl(modemfd, TIOCSCTTY, 0)<0) + fprintf(stderr, "ioctl() failed.\n"); +#elif defined (TIOCSPGRP) + if(ioctl(modemfd, TIOCSPGRP, &pgrpid)<0) + fprintf(stderr, "ioctl() failed.\n"); +#endif + if(tcsetpgrp(modemfd, pgrpid)<0) + fprintf(stderr, "tcsetpgrp() failed.\n"); + + dup2(modemfd, 0); + dup2(modemfd, 1); + + switch (checkForInterface()) { + case 1: + fprintf(stderr, "Cannot determine if kernel supports ppp.\n"); + break; + case -1: + fprintf(stderr, "Kernel does not support ppp, oops.\n"); + break; + case 0: + fprintf(stderr, "Kernel supports ppp alright.\n"); + break; + } + + execve(pppdPath(), args, 0L); + _exit(0); + break; + + default: + qDebug("In parent: pppd pid %d\n",pppdPid); + close(modemfd); + modemfd = -1; + return true; + break; + } +} + + +bool Modem::killpppd() { + if(pppdPid > 0) { + qDebug("In killpppd(): Sending SIGTERM to %d\n", pppdPid); + if(kill(pppdPid, SIGTERM) < 0) { + qDebug("Error terminating %d. Sending SIGKILL\n", pppdPid); + if(kill(pppdPid, SIGKILL) < 0) { + qDebug("Error killing %d\n", pppdPid); + return false; + } + } + } + return true; +} + + +void Modem::parseargs(char* buf, char** args) { + int nargs = 0; + int quotes; + + while(nargs < MaxArgs-1 && *buf != '\0') { + + quotes = 0; + + // Strip whitespace. Use nulls, so that the previous argument is + // terminated automatically. + + while ((*buf == ' ' ) || (*buf == '\t' ) || (*buf == '\n' ) ) + *buf++ = '\0'; + + // detect begin of quoted argument + if (*buf == '"' || *buf == '\'') { + quotes = *buf; + *buf++ = '\0'; + } + + // save the argument + if(*buf != '\0') { + *args++ = buf; + nargs++; + } + + if (!quotes) + while ((*buf != '\0') && (*buf != '\n') && + (*buf != '\t') && (*buf != ' ')) + buf++; + else { + while ((*buf != '\0') && (*buf != quotes)) + buf++; + *buf++ = '\0'; + } + } + + *args = 0L; } bool Modem::execPPPDaemon(const QString & arguments) { + if(execpppd(arguments)==0) { + PPPData::data()->setpppdRunning(true); return true; + } else + return false; +} + +void Modem::killPPPDaemon() +{ + PPPData::data()->setpppdRunning(false); + killpppd(); +} + +int Modem::pppdExitStatus() +{ + return _pppdExitStatus; } int Modem::openResolv(int flags) { - return -1; + int fd; + if ((fd = open(_PATH_RESCONF, flags)) == -1) { + qDebug("error opening resolv.conf!"); + fd = open(DEVNULL, O_RDONLY); + } + return fd; } bool Modem::setHostname(const QString & name) { - return true; + return sethostname(name, name.length()) == 0; } diff --git a/noncore/settings/networksettings/ppp/modem.h b/noncore/settings/networksettings/ppp/modem.h index 052be4a..b494977 100644 --- a/noncore/settings/networksettings/ppp/modem.h +++ b/noncore/settings/networksettings/ppp/modem.h @@ -1,113 +1,119 @@ /* * kPPP: A pppd Front End for the KDE project * * $Id$ * * Copyright (C) 1997 Bernd Johannes Wuebben * wuebben@math.cornell.edu * * This file was added by Harri Porten <porten@tu-harburg.de> * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _MODEM_H_ #define _MODEM_H_ #include <qdir.h> #include <sys/types.h> #include <termios.h> #include <unistd.h> #include <qsocketnotifier.h> //#include <config.h> void alarm_handler(int); const char *pppdPath(); class Modem : public QObject { Q_OBJECT public: Modem(); ~Modem(); const QString getDevice() {return device;}; void setDevice(const QString dev) {device = dev;}; bool opentty(); bool closetty(); bool hangup(); bool writeChar(unsigned char); bool writeLine(const char *); bool dataMode() const { return data_mode; } void setDataMode(bool set) { data_mode = set; } const QString modemMessage(); speed_t modemspeed(); static QString parseModemSpeed(const QString &); void notify(const QObject *, const char *); void stop(); void flush(); int lockdevice(); void unlockdevice(); bool setSecret(int,const char*,const char*); bool removeSecret(int); void killPPPDaemon(); int pppdExitStatus(); bool execPPPDaemon(const QString & arguments); int openResolv(int flags); bool setHostname(const QString & name); public: enum Auth { PAP = 1, CHAP }; static Modem *modem; int lastStatus; signals: void charWaiting(unsigned char); private slots: void startNotifier(); void stopNotifier(); void readtty(int); private: enum { MaxPathLen = 30, MaxStrLen = 40, MaxArgs = 100 }; enum { Original=0x100, New=0x200, Old=0x400 } Version; const char* authFile(Auth method, int version = Original ); bool createAuthFile(Auth method,const char *username,const char *password); + bool removeAuthFile(Auth method); + bool execpppd(const char *arguments); + bool killpppd(); + void parseargs(char* buf, char** args); void escape_to_command_mode(); int openLockfile(QString,int); private: QString device; QString lockfile; int modemfd; + int pppdPid; + int _pppdExitStatus; QSocketNotifier *sn; bool data_mode; QString errmsg; struct termios initial_tty; struct termios tty; bool modem_is_locked; }; #endif diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp index 646facd..bb1c8ed 100644 --- a/noncore/settings/networksettings/ppp/pppdata.cpp +++ b/noncore/settings/networksettings/ppp/pppdata.cpp @@ -230,541 +230,541 @@ void PPPData::set_show_clock_on_caption(bool set) { writeConfig(GENERAL_GRP, SHOWCLOCK_KEY, (int) set); } bool PPPData::get_xserver_exit_disconnect() { return (bool) readNumConfig(GENERAL_GRP, DISCONNECT_KEY, true); } void PPPData::setPPPDebug(bool set) { writeConfig(GENERAL_GRP, PPP_DEBUG_OPTION, (int)set); } bool PPPData::getPPPDebug() { return (bool)readNumConfig(GENERAL_GRP, PPP_DEBUG_OPTION, false); } void PPPData::set_xserver_exit_disconnect(bool set) { writeConfig(GENERAL_GRP, DISCONNECT_KEY, (int) set); } bool PPPData::quit_on_disconnect() { return (bool) readNumConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, false); } void PPPData::set_quit_on_disconnect(bool set) { writeConfig(GENERAL_GRP, QUITONDISCONNECT_KEY, (int) set); } bool PPPData::get_show_log_window() { return (bool) readNumConfig (GENERAL_GRP, SHOWLOGWIN_KEY, false); } void PPPData::set_show_log_window(bool set) { writeConfig(GENERAL_GRP, SHOWLOGWIN_KEY, (int) set); } bool PPPData::automatic_redial() { return (bool) readNumConfig(GENERAL_GRP, AUTOREDIAL_KEY, FALSE); } void PPPData::set_automatic_redial(bool set) { writeConfig(GENERAL_GRP, AUTOREDIAL_KEY, (int) set); } bool PPPData::get_iconify_on_connect() { return (bool) readNumConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, TRUE); } void PPPData::set_iconify_on_connect(bool set) { writeConfig(GENERAL_GRP, ICONIFY_ON_CONNECT_KEY, (int) set); } bool PPPData::get_dock_into_panel() { return (bool) readNumConfig(GENERAL_GRP, DOCKING_KEY, false); } void PPPData::set_dock_into_panel(bool set) { writeConfig(GENERAL_GRP, DOCKING_KEY, (int) set); } QString PPPData::pppdVersion() { return QString("%1.%2.%3").arg(pppdVer).arg(pppdMod).arg(pppdPatch); } bool PPPData::pppdVersionMin(int ver, int mod, int patch) { // check if pppd version fulfills minimum requirement return (pppdVer > ver || (pppdVer == ver && pppdMod > mod) || (pppdVer == ver && pppdMod == mod && pppdPatch >= patch)); } int PPPData::pppdTimeout() { return readNumConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, PPPD_TIMEOUT); } void PPPData::setpppdTimeout(int n) { writeConfig(GENERAL_GRP, PPPDTIMEOUT_KEY, n); } const QString PPPData::modemDevice() { - return readConfig (MODEM_GRP, MODEMDEV_KEY, devices[DEV_DEFAULT]); + return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]); } void PPPData::setModemDevice(const QString &n) { - writeConfig(MODEM_GRP, MODEMDEV_KEY, n); + writeConfig(modemGroup(), MODEMDEV_KEY, n); } const QString PPPData::flowcontrol() { - return readConfig(MODEM_GRP, FLOWCONTROL_KEY, "CRTSCTS"); + return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS"); } void PPPData::setFlowcontrol(const QString &n) { - writeConfig(MODEM_GRP, FLOWCONTROL_KEY, n); + writeConfig(modemGroup(), FLOWCONTROL_KEY, n); } const QString PPPData::speed() { - QString s = readConfig(MODEM_GRP, SPEED_KEY, "57600"); + QString s = readConfig(modemGroup(), SPEED_KEY, "57600"); // undo the damage of a bug in former versions. It left an empty Speed= // entry in kppprc. kppp did set the serial port to 57600 as default but // pppd wouldn't receive the speed via the command line. if(s.toUInt() == 0) s = "57600"; return s; } void PPPData::setSpeed(const QString &n) { - writeConfig(MODEM_GRP, SPEED_KEY, n); + writeConfig(modemGroup(), SPEED_KEY, n); } #if 0 void PPPData::setUseCDLine(const int n) { - writeConfig(MODEM_GRP,USECDLINE_KEY,n); + writeConfig(modemGroup(),USECDLINE_KEY,n); } int PPPData::UseCDLine() { - return readNumConfig(MODEM_GRP,USECDLINE_KEY,0); + return readNumConfig(modemGroup(),USECDLINE_KEY,0); } #endif const QString PPPData::modemEscapeStr() { - return readConfig(MODEM_GRP,ESCAPESTR_KEY,"+++"); + return readConfig(modemGroup(),ESCAPESTR_KEY,"+++"); } void PPPData::setModemEscapeStr(const QString &n) { - writeConfig(MODEM_GRP,ESCAPESTR_KEY,n); + writeConfig(modemGroup(),ESCAPESTR_KEY,n); } const QString PPPData::modemEscapeResp() { - return readConfig(MODEM_GRP,ESCAPERESP_KEY,"OK"); + return readConfig(modemGroup(),ESCAPERESP_KEY,"OK"); } void PPPData::setModemEscapeResp(const QString &n) { - writeConfig(MODEM_GRP,ESCAPERESP_KEY,n); + writeConfig(modemGroup(),ESCAPERESP_KEY,n); } int PPPData::modemEscapeGuardTime() { - return readNumConfig(MODEM_GRP,ESCAPEGUARDTIME_KEY,50); + return readNumConfig(modemGroup(),ESCAPEGUARDTIME_KEY,50); } void PPPData::setModemEscapeGuardTime(int n) { - writeConfig(MODEM_GRP,ESCAPEGUARDTIME_KEY,n); + writeConfig(modemGroup(),ESCAPEGUARDTIME_KEY,n); } bool PPPData::modemLockFile() { - return readNumConfig(MODEM_GRP, LOCKFILE_KEY, 1); + return readNumConfig(modemGroup(), LOCKFILE_KEY, 1); } void PPPData::setModemLockFile(bool set) { - writeConfig(MODEM_GRP, LOCKFILE_KEY, set); + writeConfig(modemGroup(), LOCKFILE_KEY, set); } int PPPData::modemTimeout() { - return readNumConfig(MODEM_GRP, TIMEOUT_KEY, MODEM_TIMEOUT); + return readNumConfig(modemGroup(), TIMEOUT_KEY, MODEM_TIMEOUT); } void PPPData::setModemTimeout(int n) { - writeConfig(MODEM_GRP, TIMEOUT_KEY, n); + writeConfig(modemGroup(), TIMEOUT_KEY, n); } int PPPData::modemToneDuration() { - return readNumConfig(MODEM_GRP, TONEDURATION_KEY,MODEM_TONEDURATION); + return readNumConfig(modemGroup(), TONEDURATION_KEY,MODEM_TONEDURATION); } void PPPData::setModemToneDuration(int n) { - writeConfig(MODEM_GRP, TONEDURATION_KEY, n); + writeConfig(modemGroup(), TONEDURATION_KEY, n); } int PPPData::busyWait() { - return readNumConfig(MODEM_GRP, BUSYWAIT_KEY, BUSY_WAIT); + return readNumConfig(modemGroup(), BUSYWAIT_KEY, BUSY_WAIT); } void PPPData::setbusyWait(int n) { - writeConfig(MODEM_GRP, BUSYWAIT_KEY, n); + writeConfig(modemGroup(), BUSYWAIT_KEY, n); } // //Advanced "Modem" dialog // // defaults: InitString=ATZ, InitString1="" etc. const QString PPPData::modemInitStr(int i) { assert(i >= 0 && i < NumInitStrings); if(i == 0) - return readConfig(MODEM_GRP, INITSTR_KEY, "ATZ"); + return readConfig(modemGroup(), INITSTR_KEY, "ATZ"); else - return readConfig(MODEM_GRP, INITSTR_KEY + QString::number(i), ""); + return readConfig(modemGroup(), INITSTR_KEY + QString::number(i), ""); } void PPPData::setModemInitStr(int i, const QString &n) { assert(i >= 0 && i < NumInitStrings); QString k = INITSTR_KEY + (i > 0 ? QString::number(i) : ""); - writeConfig(MODEM_GRP, k, n); + writeConfig(modemGroup(), k, n); } const QString PPPData::modemInitResp() { - return readConfig(MODEM_GRP, INITRESP_KEY, "OK"); + return readConfig(modemGroup(), INITRESP_KEY, "OK"); } void PPPData::setModemInitResp(const QString &n) { - writeConfig(MODEM_GRP, INITRESP_KEY, n); + writeConfig(modemGroup(), INITRESP_KEY, n); } int PPPData::modemPreInitDelay() { - return readNumConfig(MODEM_GRP, PREINITDELAY_KEY, 50); + return readNumConfig(modemGroup(), PREINITDELAY_KEY, 50); } void PPPData::setModemPreInitDelay(int n) { - writeConfig(MODEM_GRP, PREINITDELAY_KEY, n); + writeConfig(modemGroup(), PREINITDELAY_KEY, n); } int PPPData::modemInitDelay() { - return readNumConfig(MODEM_GRP, INITDELAY_KEY, 50); + return readNumConfig(modemGroup(), INITDELAY_KEY, 50); } void PPPData::setModemInitDelay(int n) { - writeConfig(MODEM_GRP, INITDELAY_KEY, n); + writeConfig(modemGroup(), INITDELAY_KEY, n); } QString PPPData::modemNoDialToneDetectionStr() { - return readConfig(MODEM_GRP, NODTDETECT_KEY, "ATX3"); + return readConfig(modemGroup(), NODTDETECT_KEY, "ATX3"); } void PPPData::setModemNoDialToneDetectionStr(const QString &n) { - writeConfig(MODEM_GRP, NODTDETECT_KEY, n); + writeConfig(modemGroup(), NODTDETECT_KEY, n); } const QString PPPData::modemDialStr() { - return readConfig(MODEM_GRP, DIALSTR_KEY, "ATDT"); + return readConfig(modemGroup(), DIALSTR_KEY, "ATDT"); } void PPPData::setModemDialStr(const QString &n) { - writeConfig(MODEM_GRP, DIALSTR_KEY, n); + writeConfig(modemGroup(), DIALSTR_KEY, n); } const QString PPPData::modemConnectResp() { - return readConfig(MODEM_GRP, CONNECTRESP_KEY, "CONNECT"); + return readConfig(modemGroup(), CONNECTRESP_KEY, "CONNECT"); } void PPPData::setModemConnectResp(const QString &n) { - writeConfig(MODEM_GRP, CONNECTRESP_KEY, n); + writeConfig(modemGroup(), CONNECTRESP_KEY, n); } const QString PPPData::modemBusyResp() { - return readConfig(MODEM_GRP, BUSYRESP_KEY, "BUSY"); + return readConfig(modemGroup(), BUSYRESP_KEY, "BUSY"); } void PPPData::setModemBusyResp(const QString &n) { - writeConfig(MODEM_GRP, BUSYRESP_KEY, n); + writeConfig(modemGroup(), BUSYRESP_KEY, n); } const QString PPPData::modemNoCarrierResp() { - return readConfig(MODEM_GRP, NOCARRIERRESP_KEY, "NO CARRIER"); + return readConfig(modemGroup(), NOCARRIERRESP_KEY, "NO CARRIER"); } void PPPData::setModemNoCarrierResp(const QString &n) { - writeConfig(MODEM_GRP, NOCARRIERRESP_KEY, n); + writeConfig(modemGroup(), NOCARRIERRESP_KEY, n); } const QString PPPData::modemNoDialtoneResp() { - return readConfig(MODEM_GRP, NODIALTONERESP_KEY, "NO DIALTONE"); + return readConfig(modemGroup(), NODIALTONERESP_KEY, "NO DIALTONE"); } void PPPData::setModemNoDialtoneResp(const QString &n) { - writeConfig(MODEM_GRP, NODIALTONERESP_KEY, n); + writeConfig(modemGroup(), NODIALTONERESP_KEY, n); } const QString PPPData::modemHangupStr() { - return readConfig(MODEM_GRP, HANGUPSTR_KEY, "+++ATH"); + return readConfig(modemGroup(), HANGUPSTR_KEY, "+++ATH"); } void PPPData::setModemHangupStr(const QString &n) { - writeConfig(MODEM_GRP, HANGUPSTR_KEY, n); + writeConfig(modemGroup(), HANGUPSTR_KEY, n); } const QString PPPData::modemHangupResp() { - return readConfig(MODEM_GRP, HANGUPRESP_KEY, "OK"); + return readConfig(modemGroup(), HANGUPRESP_KEY, "OK"); } void PPPData::setModemHangupResp(const QString &n) { - writeConfig(MODEM_GRP, HANGUPRESP_KEY, n); + writeConfig(modemGroup(), HANGUPRESP_KEY, n); } const QString PPPData::modemAnswerStr() { - return readConfig(MODEM_GRP, ANSWERSTR_KEY, "ATA"); + return readConfig(modemGroup(), ANSWERSTR_KEY, "ATA"); } QString PPPData::volumeOff() { - return readConfig(MODEM_GRP, VOLUME_OFF, "M0L0"); + return readConfig(modemGroup(), VOLUME_OFF, "M0L0"); } void PPPData::setVolumeOff(const QString &s) { - writeConfig(MODEM_GRP, VOLUME_OFF, s); + writeConfig(modemGroup(), VOLUME_OFF, s); } QString PPPData::volumeMedium() { - return readConfig(MODEM_GRP, VOLUME_MEDIUM, "M1L1"); + return readConfig(modemGroup(), VOLUME_MEDIUM, "M1L1"); } void PPPData::setVolumeMedium(const QString &s) { - writeConfig(MODEM_GRP, VOLUME_MEDIUM, s); + writeConfig(modemGroup(), VOLUME_MEDIUM, s); } QString PPPData::volumeHigh() { - QString tmp = readConfig(MODEM_GRP, VOLUME_HIGH, "M1L3"); + QString tmp = readConfig(modemGroup(), VOLUME_HIGH, "M1L3"); if(tmp == "M1L4") tmp = "M1L3"; return tmp; } void PPPData::setVolumeHigh(const QString &s) { - writeConfig(MODEM_GRP, VOLUME_HIGH, s); + writeConfig(modemGroup(), VOLUME_HIGH, s); } QString PPPData::volumeInitString() { QString s; switch(volume()) { case 0: s = volumeOff(); break; case 1: s = volumeMedium(); break; case 2: s = volumeHigh(); break; default: s = volumeMedium(); } return s; } int PPPData::volume() { - return readNumConfig(MODEM_GRP, VOLUME_KEY, 1); + return readNumConfig(modemGroup(), VOLUME_KEY, 1); } void PPPData::setVolume(int i) { - writeConfig(MODEM_GRP, VOLUME_KEY, i); + writeConfig(modemGroup(), VOLUME_KEY, i); } int PPPData::waitForDialTone() { - return readNumConfig(MODEM_GRP, DIALTONEWAIT_KEY, 1); + return readNumConfig(modemGroup(), DIALTONEWAIT_KEY, 1); } void PPPData::setWaitForDialTone(int i) { - writeConfig(MODEM_GRP, DIALTONEWAIT_KEY, i); + writeConfig(modemGroup(), DIALTONEWAIT_KEY, i); } void PPPData::setModemAnswerStr(const QString &n) { - writeConfig(MODEM_GRP, ANSWERSTR_KEY, n); + writeConfig(modemGroup(), ANSWERSTR_KEY, n); } const QString PPPData::modemRingResp() { - return readConfig(MODEM_GRP, RINGRESP_KEY, "RING"); + return readConfig(modemGroup(), RINGRESP_KEY, "RING"); } void PPPData::setModemRingResp(const QString &n) { - writeConfig(MODEM_GRP, RINGRESP_KEY, n); + writeConfig(modemGroup(), RINGRESP_KEY, n); } const QString PPPData::modemAnswerResp() { - return readConfig(MODEM_GRP, ANSWERRESP_KEY, "CONNECT"); + return readConfig(modemGroup(), ANSWERRESP_KEY, "CONNECT"); } void PPPData::setModemAnswerResp(const QString &n) { - writeConfig(MODEM_GRP, ANSWERRESP_KEY, n); + writeConfig(modemGroup(), ANSWERRESP_KEY, n); } const QString PPPData::enter() { - return readConfig(MODEM_GRP, ENTER_KEY, "CR"); + return readConfig(modemGroup(), ENTER_KEY, "CR"); } void PPPData::setEnter(const QString &n) { - writeConfig(MODEM_GRP, ENTER_KEY, n); + writeConfig(modemGroup(), ENTER_KEY, n); } // // functions to set/return account information // //returns number of accounts int PPPData::count() const { return highcount + 1; } bool PPPData::setAccount(const QString &aname) { for(int i = 0; i <= highcount; i++) { setAccountbyIndex(i); if(accname() == aname) { caccount = i; return true; } } return false; } bool PPPData::setAccountbyIndex(int i) { if(i >= 0 && i <= highcount) { caccount = i; cgroup.sprintf("%s%i", ACCOUNT_GRP, i); return true; } return false; } bool PPPData::isUniqueAccname(const QString &n) { int current = caccount; for(int i=0; i <= highcount; i++) { setAccountbyIndex(i); if(accname() == n && i != current) { setAccountbyIndex(current); return false; } } setAccountbyIndex(current); return true; } bool PPPData::deleteAccount() { //FIXME: // if(caccount < 0) return false; // QMap <QString, QString> map; // QMap <QString, QString>::Iterator it; // // set all entries of the current account to "" // map = config->entryMap(cgroup); // it = map.begin(); // while (it != map.end()) { // config->writeEntry(it.key(), ""); // it++; // } // // shift the succeeding accounts // for(int i = caccount+1; i <= highcount; i++) { // setAccountbyIndex(i); // map = config->entryMap(cgroup); // it = map.begin(); // setAccountbyIndex(i-1); // config->setGroup(cgroup); // while (it != map.end()) { // config->writeEntry(it.key(), *it); // it++; // } // } // // make sure the top account is cleared // setAccountbyIndex(highcount); // map = config->entryMap(cgroup); // it = map.begin(); // config->setGroup(cgroup); // while (it.key() != QString::null) { // config->writeEntry(it.key(), ""); // it++; // } // highcount--; // if(caccount > highcount) // caccount = highcount; // setAccountbyIndex(caccount); // return true; } @@ -1116,119 +1116,123 @@ void PPPData::setTotalCosts(const QString &n) { int PPPData::totalBytes() { return readNumConfig(cgroup, TOTALBYTES_KEY, 0); } 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() +{ + return MODEM_GRP; +} // // // // window position // // // void PPPData::winPosConWin(int& p_x, int& p_y) { // p_x = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_X, QApplication::desktop()->width()/2-160); // p_y = readNumConfig(WINPOS_GRP, WINPOS_CONWIN_Y, QApplication::desktop()->height()/2-55); // } // void PPPData::setWinPosConWin(int p_x, int p_y) { // writeConfig(WINPOS_GRP, WINPOS_CONWIN_X, p_x); // writeConfig(WINPOS_GRP, WINPOS_CONWIN_Y, p_y); // } // void PPPData::winPosStatWin(int& p_x, int& p_y) { // p_x = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_X, QApplication::desktop()->width()/2-160); // p_y = readNumConfig(WINPOS_GRP, WINPOS_STATWIN_Y, QApplication::desktop()->height()/2-55); // } // void PPPData::setWinPosStatWin(int p_x, int p_y) { // writeConfig(WINPOS_GRP, WINPOS_STATWIN_X, p_x); // writeConfig(WINPOS_GRP, WINPOS_STATWIN_Y, p_y); // } diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h index 57ce2fd..c4d7bc3 100644 --- a/noncore/settings/networksettings/ppp/pppdata.h +++ b/noncore/settings/networksettings/ppp/pppdata.h @@ -76,206 +76,207 @@ class Config; // modem #define MODEMDEV_KEY "Device" #define LOCKFILE_KEY "UseLockFile" #define FLOWCONTROL_KEY "FlowControl" #define SPEED_KEY "Speed" #define TIMEOUT_KEY "Timeout" #define TONEDURATION_KEY "ToneDuration" #define BUSYWAIT_KEY "BusyWait" #define INITSTR_KEY "InitString" #define INITRESP_KEY "InitResponse" #define PREINITDELAY_KEY "PreInitDelay" #define INITDELAY_KEY "InitDelay" #define NODTDETECT_KEY "NoDialToneDetection" #define DIALTONEWAIT_KEY "WaitForDialTone" #define DIALSTR_KEY "DialString" #define CONNECTRESP_KEY "ConnectResponse" #define BUSYRESP_KEY "BusyResponse" #define NOCARRIERRESP_KEY "NoCarrierResponse" #define NODIALTONERESP_KEY "NoDialToneResp" #define HANGUPSTR_KEY "HangupString" #define HANGUPRESP_KEY "HangUpResponse" #define ANSWERSTR_KEY "AnswerString" #define RINGRESP_KEY "RingResponse" #define ANSWERRESP_KEY "AnswerResponse" #define ENTER_KEY "Enter" #define ESCAPESTR_KEY "EscapeString" #define ESCAPERESP_KEY "EscapeResponse" #define ESCAPEGUARDTIME_KEY "EscapeGuardTime" #define USECDLINE_KEY "UseCDLine" #define VOLUME_HIGH "VolumeHigh" #define VOLUME_MEDIUM "VolumeMedium" #define VOLUME_OFF "VolumeOff" #define VOLUME_KEY "Volume" // account #define NAME_KEY "Name" #define PHONENUMBER_KEY "Phonenumber" #define DIAL_PREFIX_KEY "DialPrefix" #define AUTH_KEY "Authentication" #define STORED_PASSWORD_KEY "Password" #define STORED_USERNAME_KEY "Username" #define STORE_PASSWORD_KEY "StorePassword" #define BEFORE_CONNECT_KEY "BeforeConnect" #define COMMAND_KEY "Command" #define DISCONNECT_COMMAND_KEY "DisconnectCommand" #define BEFORE_DISCONNECT_KEY "BeforeDisconnect" #define IPADDR_KEY "IPAddr" #define SUBNETMASK_KEY "SubnetMask" #define ACCTENABLED_KEY "AccountingEnabled" #define VOLACCTENABLED_KEY "VolumeAccountingEnabled" #define ACCTFILE_KEY "AccountingFile" #define AUTONAME_KEY "AutoName" #define GATEWAY_KEY "Gateway" #define DEFAULTROUTE_KEY "DefaultRoute" #define DOMAIN_KEY "Domain" #define DNS_KEY "DNS" #define AUTODNS_KEY "AutoDNS" #define EXDNSDISABLED_KEY "ExDNSDisabled" #define SCRIPTCOM_KEY "ScriptCommands" #define SCRIPTARG_KEY "ScriptArguments" #define PPPDARG_KEY "pppdArguments" #define PPP_DEBUG_OPTION "PPPDebug" #define ICONIFY_ON_CONNECT_KEY "iconifyOnConnect" #define DOCKING_KEY "DockIntoPanel" #define TOTALCOSTS_KEY "TotalCosts" #define TOTALBYTES_KEY "TotalBytes" // graph colors #define GENABLED "Enabled" #define GCOLOR_BG "Background" #define GCOLOR_TEXT "Text" #define GCOLOR_IN "InBytes" #define GCOLOR_OUT "OutBytes" // pppd errors #define E_IF_TIMEOUT 1 #define E_PPPD_DIED 2 // window position #define WINPOS_CONWIN_X "WindowPositionConWinX" #define WINPOS_CONWIN_Y "WindowPositionConWinY" #define WINPOS_STATWIN_X "WindowPositionStatWinX" #define WINPOS_STATWIN_Y "WindowPositionStatWinY" class PPPData { public: PPPData(); ~PPPData() {}; static PPPData* data(); enum { NumInitStrings = 2 }; // general functions bool open(); void save(); void cancel(); -// int access() const; // read/write access + // function to read/write date to configuration file QString readConfig(const QString &, const QString &, const QString &); int readNumConfig(const QString &, const QString &, int); bool readListConfig(const QString &, const QString &, QStringList &, char sep = ','); void writeConfig(const QString &, const QString &, const QString &); void writeConfig(const QString &, const QString &, int); void writeListConfig(const QString &, const QString &, QStringList &, char sep = ','); // return the current account group QString currentGroup() { return cgroup; } + QString modemGroup(); // functions to set/get general kppp info QString password() const; void setPassword(const QString &); const QString defaultAccount(); void setDefaultAccount(const QString &); void set_xserver_exit_disconnect(bool set); bool get_xserver_exit_disconnect(); void setPPPDebug(bool set); bool getPPPDebug(); void set_quit_on_disconnect(bool); bool quit_on_disconnect(); void set_show_clock_on_caption(bool set); bool get_show_clock_on_caption(); void set_show_log_window(bool set); bool get_show_log_window(); void set_automatic_redial(bool set); bool automatic_redial(); void set_iconify_on_connect(bool set); bool get_iconify_on_connect(); void set_dock_into_panel(bool set); bool get_dock_into_panel(); const QString enter(); void setEnter(const QString &); QString pppdVersion(); bool pppdVersionMin(int ver, int mod, int patch); int pppdTimeout(); void setpppdTimeout(int); int busyWait(); void setbusyWait(int); bool modemLockFile(); void setModemLockFile(bool set); int modemEscapeGuardTime(); void setModemEscapeGuardTime(int i); void setModemEscapeStr(const QString &); const QString modemEscapeStr(); void setModemEscapeResp(const QString &); const QString modemEscapeResp(); const QString modemDevice(); void setModemDevice(const QString &); const QString flowcontrol(); void setFlowcontrol(const QString &); int modemTimeout(); void setModemTimeout(int); int modemToneDuration(); void setModemToneDuration(int); QString volumeInitString(); int volume(); void setVolume(int); int waitForDialTone(); void setWaitForDialTone(int i); // modem command strings/responses const QString modemInitStr(int i); void setModemInitStr(int i, const QString &); const QString modemInitResp(); void setModemInitResp(const QString &); int modemPreInitDelay(); void setModemPreInitDelay(int); int modemInitDelay(); void setModemInitDelay(int); QString modemNoDialToneDetectionStr(); void setModemNoDialToneDetectionStr(const QString &); const QString modemDialStr(); void setModemDialStr(const QString &); const QString modemConnectResp(); void setModemConnectResp(const QString &); diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp index da17e26..e13f8c8 100644 --- a/noncore/settings/networksettings/ppp/pppmodule.cpp +++ b/noncore/settings/networksettings/ppp/pppmodule.cpp @@ -1,121 +1,125 @@ #include "pppconfig.h" #include "pppmodule.h" #include "pppdata.h" #include "kpppwidget.h" #include "interfaceinformationimp.h" //#include "devices.h" /** * Constructor, find all of the possible interfaces */ -PPPModule::PPPModule() : Module() { +PPPModule::PPPModule() : Module() +{ + Interface *iface; + iface = new Interface( 0, "device" ); + iface->setHardwareName( "account" ); + list.append( iface ); } /** * Delete any interfaces that we own. */ PPPModule::~PPPModule(){ Interface *i; for ( i=list.first(); i != 0; i=list.next() ) delete i; } /** * 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){ - if(!i->getInterfaceName().upper().contains("PPP")) - return false; - - i->setHardwareName("PPP"); - list.append(i); - return true; + 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( 0, "PPPConfig", false, Qt::WDestructiveClose ); -// pppconfig->setProfile(profile); + PPPConfigWidget *pppconfig = new PPPConfigWidget( 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); 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 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()); PPPConfigWidget imp(0, "PPPConfigImp", true); imp.showMaximized(); if(imp.exec() == QDialog::Accepted ){ qDebug("ACCEPTED"); - return new Interface( 0, newInterface ); PPPData::data()->save(); + Interface *iface; + iface = new Interface( 0, PPPData::data()->modemDevice() ); + iface->setHardwareName( PPPData::data()->accname() ); + list.append( iface ); + return iface; } return NULL; } /** * 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; } void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces) { - qDebug("here"); - newIfaces.insert(QObject::tr("PPP") ,QObject::tr("generic ppp device")); + newIfaces.insert(QObject::tr("PPP") , + QObject::tr("generic ppp device")); } |