summaryrefslogtreecommitdiff
authortille <tille>2003-05-25 14:25:23 (UTC)
committer tille <tille>2003-05-25 14:25:23 (UTC)
commit61c6231cdcde59f8a3ecff31b9fab37f7e9d8852 (patch) (side-by-side diff)
tree4724031209e2263c872ad6160ea61a793f09ed1e
parentefa6dfa3428746451dd5a9b5e1ba57806ae96dba (diff)
downloadopie-61c6231cdcde59f8a3ecff31b9fab37f7e9d8852.zip
opie-61c6231cdcde59f8a3ecff31b9fab37f7e9d8852.tar.gz
opie-61c6231cdcde59f8a3ecff31b9fab37f7e9d8852.tar.bz2
save device specific settings
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/conwindow.cpp110
-rw-r--r--noncore/settings/networksettings/ppp/ppp.pro4
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.cpp27
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.h4
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp54
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.h16
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp24
7 files changed, 130 insertions, 109 deletions
diff --git a/noncore/settings/networksettings/ppp/conwindow.cpp b/noncore/settings/networksettings/ppp/conwindow.cpp
index ad89005..20d705d 100644
--- a/noncore/settings/networksettings/ppp/conwindow.cpp
+++ b/noncore/settings/networksettings/ppp/conwindow.cpp
@@ -264,57 +264,57 @@ void ConWindow::stopClock() {
void ConWindow::timeclick() {
- QString tooltip = i18n("Connection: %1\n"
- "Connected at: %2\n"
- "Time connected: %3")
- .arg(PPPData::data()->accname()).arg(info2->text())
- .arg(time_string2);
-
- if(accountingEnabled)
- tooltip += i18n("\nSession Bill: %1\nTotal Bill: %2")
- .arg(session_bill->text()).arg(total_bill->text());
- // volume accounting
- if(volumeAccountingEnabled) {
-
- volinfo->setEnabled(TRUE);
- int bytes = PPPData::data()->totalBytes();
- volinfo->setText(prettyPrintVolume(bytes));
- }
-
- seconds++;
-
- if(seconds >= 60 ) {
- minutes ++;
- seconds = 0;
- }
-
- if (minutes >= 60){
- minutes = 0;
- hours ++;
- }
-
- if( hours >= 24){
- days ++;
- hours = 0;
- }
-
- time_string.sprintf("%02d:%02d",hours,minutes);
- time_string2 = "";
- if (days)
- time_string2.sprintf("%d d %02d:%02d:%02d",
- days,hours,minutes,seconds);
-
- else
- time_string2.sprintf("%02d:%02d:%02d",hours,minutes,seconds);
-
- caption_string = PPPData::data()->accname();
- caption_string += " ";
- caption_string += time_string;
-
-
- timelabel2->setText(time_string2);
-
- if(PPPData::data()->get_show_clock_on_caption() && (seconds == 1)){
- // we update the Caption only once per minute not every second
- // otherwise I get a flickering icon
- this->setCaption(caption_string);
- }
+// QString tooltip = i18n("Connection: %1\n"
+// "Connected at: %2\n"
+// "Time connected: %3")
+// .arg(PPPData::data()->accname()).arg(info2->text())
+// .arg(time_string2);
+
+// if(accountingEnabled)
+// tooltip += i18n("\nSession Bill: %1\nTotal Bill: %2")
+// .arg(session_bill->text()).arg(total_bill->text());
+// // volume accounting
+// if(volumeAccountingEnabled) {
+
+// volinfo->setEnabled(TRUE);
+// int bytes = PPPData::data()->totalBytes();
+// volinfo->setText(prettyPrintVolume(bytes));
+// }
+
+// seconds++;
+
+// if(seconds >= 60 ) {
+// minutes ++;
+// seconds = 0;
+// }
+
+// if (minutes >= 60){
+// minutes = 0;
+// hours ++;
+// }
+
+// if( hours >= 24){
+// days ++;
+// hours = 0;
+// }
+
+// time_string.sprintf("%02d:%02d",hours,minutes);
+// time_string2 = "";
+// if (days)
+// time_string2.sprintf("%d d %02d:%02d:%02d",
+// days,hours,minutes,seconds);
+
+// else
+// time_string2.sprintf("%02d:%02d:%02d",hours,minutes,seconds);
+
+// caption_string = PPPData::data()->accname();
+// caption_string += " ";
+// caption_string += time_string;
+
+
+// timelabel2->setText(time_string2);
+
+// if(PPPData::data()->get_show_clock_on_caption() && (seconds == 1)){
+// // we update the Caption only once per minute not every second
+// // otherwise I get a flickering icon
+// this->setCaption(caption_string);
+// }
diff --git a/noncore/settings/networksettings/ppp/ppp.pro b/noncore/settings/networksettings/ppp/ppp.pro
index e3c58d6..ac438dd 100644
--- a/noncore/settings/networksettings/ppp/ppp.pro
+++ b/noncore/settings/networksettings/ppp/ppp.pro
@@ -7,5 +7,5 @@ DESTDIR = $(OPIEDIR)/plugins/networksettings
HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h kpppwidget.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h
-# knuminput.h knumvalidator.h
+#
SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp kpppwidget.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp
-#knuminput.cpp knumvalidator.cpp
+#
INCLUDEPATH += $(OPIEDIR)/include ../ ../interfaces/
diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp
index c0f1fef..e2521a6 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.cpp
+++ b/noncore/settings/networksettings/ppp/pppconfig.cpp
@@ -7,2 +7,4 @@
#include "general.h"
+#include "interface.h"
+#include "modem.h"
#include "pppconfig.h"
@@ -10,5 +12,5 @@
#include "runtests.h"
-#include "modem.h"
-PPPConfigWidget::PPPConfigWidget( QWidget *parent, const char *name,
+PPPConfigWidget::PPPConfigWidget( Interface* iface, QWidget *parent,
+ const char *name,
bool modal, WFlags fl )
@@ -17,11 +19,14 @@ PPPConfigWidget::PPPConfigWidget( QWidget *parent, const char *name,
setCaption(tr("Configure Modem"));
- int result = runTests();
- if(result == TEST_CRITICAL){
- QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") );
- return;
- }
-
-// setFixedSize(sizeHint());
+ int result = runTests();
+ if(result == TEST_CRITICAL){
+ QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") );
+ return;
+ }
- (void)new Modem;
+ interface = iface;
+ if (!PPPData::data()->setModemDevice( interface->getInterfaceName() ))
+ PPPData::data()->setModemDevice("/dev/modem");
+ if (!PPPData::data()->setAccount( interface->getHardwareName() ))
+ PPPData::data()->setAccount( 0 );
+ (void)new Modem;
@@ -52,2 +57,4 @@ void PPPConfigWidget::accept()
{
+ interface->setInterfaceName( PPPData::data()->modemDevice() );
+ interface->setHardwareName( PPPData::data()->accname() );
PPPData::data()->save();
diff --git a/noncore/settings/networksettings/ppp/pppconfig.h b/noncore/settings/networksettings/ppp/pppconfig.h
index ec64878..b324b6d 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.h
+++ b/noncore/settings/networksettings/ppp/pppconfig.h
@@ -6,2 +6,3 @@
class QTabWidget;
+class Interface;
class AccountWidget;
@@ -15,3 +16,3 @@ public:
- PPPConfigWidget( QWidget *parent=0, const char *name=0,
+ PPPConfigWidget( Interface*, QWidget *parent=0, const char *name=0,
bool modal = false, WFlags fl = 0 );
@@ -25,2 +26,3 @@ protected slots:
private:
+ Interface *interface;
QTabWidget *tabWindow;
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index bb1c8ed..109e3b7 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -62,3 +62,4 @@ PPPData::PPPData()
pppdisrunning(false),
- pppderror(0)
+ pppderror(0),
+ modemDeviceGroup(-1)
{
@@ -329,4 +330,12 @@ const QString PPPData::modemDevice() {
-void PPPData::setModemDevice(const QString &n) {
- writeConfig(modemGroup(), MODEMDEV_KEY, n);
+bool PPPData::setModemDevice(const QString &n) {
+ //FIXME: change modem group
+ bool ret = false;
+ for (int i = 0; devices[i]; i++)
+ if (devices[i] == n){
+ modemDeviceGroup = i;
+ writeConfig(modemGroup(), MODEMDEV_KEY, n);
+ ret = true;
+ }
+ return ret;
}
@@ -1095,29 +1104,29 @@ void PPPData::setScript(QStringList &list) {
-const QString PPPData::accountingFile() {
- return readConfig(cgroup, ACCTFILE_KEY);
-}
+// const QString PPPData::accountingFile() {
+// return readConfig(cgroup, ACCTFILE_KEY);
+// }
-void PPPData::setAccountingFile(const QString &n) {
- writeConfig(cgroup, ACCTFILE_KEY, n);
-}
+// void PPPData::setAccountingFile(const QString &n) {
+// writeConfig(cgroup, ACCTFILE_KEY, n);
+// }
-const QString PPPData::totalCosts() {
- return readConfig(cgroup, TOTALCOSTS_KEY);
-}
+// const QString PPPData::totalCosts() {
+// return readConfig(cgroup, TOTALCOSTS_KEY);
+// }
-void PPPData::setTotalCosts(const QString &n) {
- writeConfig(cgroup, TOTALCOSTS_KEY, n);
-}
+// void PPPData::setTotalCosts(const QString &n) {
+// writeConfig(cgroup, TOTALCOSTS_KEY, n);
+// }
-int PPPData::totalBytes() {
- return readNumConfig(cgroup, TOTALBYTES_KEY, 0);
-}
+// int PPPData::totalBytes() {
+// return readNumConfig(cgroup, TOTALBYTES_KEY, 0);
+// }
-void PPPData::setTotalBytes(int n) {
- writeConfig(cgroup, TOTALBYTES_KEY, n);
-}
+// void PPPData::setTotalBytes(int n) {
+// writeConfig(cgroup, TOTALBYTES_KEY, n);
+// }
@@ -1213,3 +1222,4 @@ QString PPPData::modemGroup()
{
- return MODEM_GRP;
+ if (modemDeviceGroup<0)qFatal("wrong modem %i",modemDeviceGroup);
+ return QString("MODEM_GRP_%1").arg(modemDeviceGroup);
}
diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h
index c4d7bc3..41dfbd8 100644
--- a/noncore/settings/networksettings/ppp/pppdata.h
+++ b/noncore/settings/networksettings/ppp/pppdata.h
@@ -243,3 +243,3 @@ public:
const QString modemDevice();
- void setModemDevice(const QString &);
+ bool setModemDevice(const QString &);
@@ -421,10 +421,10 @@ public:
// functions to set/query the accounting info
- const QString accountingFile();
- void setAccountingFile(const QString &);
+// const QString accountingFile();
+// void setAccountingFile(const QString &);
- const QString totalCosts();
- void setTotalCosts(const QString &);
+// const QString totalCosts();
+// void setTotalCosts(const QString &);
- int totalBytes();
- void setTotalBytes(int);
+// int totalBytes();
+// void setTotalBytes(int);
@@ -452,3 +452,3 @@ private:
static PPPData *_data;
-
+ int modemDeviceGroup;
QString passwd;
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index fb2f3e5..3a97535 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -58,3 +58,4 @@ QWidget *PPPModule::configure(Interface *i){
qDebug("return ModemWidget");
- PPPConfigWidget *pppconfig = new PPPConfigWidget( 0, "PPPConfig", false,
+ PPPConfigWidget *pppconfig = new PPPConfigWidget( i, 0, "PPPConfig",
+ false,
Qt::WDestructiveClose );
@@ -71,3 +72,3 @@ QWidget *PPPModule::information(Interface *i){
qDebug("return PPPModule::information");
- InterfaceInformationImp *information = new InterfaceInformationImp(0, "InterfaceSetupImp", i);
+ InterfaceInformationImp *information = new InterfaceInformationImp( 0, "InterfaceSetupImp", i);
return information;
@@ -96,14 +97,15 @@ Interface *PPPModule::addNewInterface(const QString &newInterface){
- PPPConfigWidget imp(0, "PPPConfigImp", true);
+ Interface *iface;
+ iface = new Interface();
+ PPPConfigWidget imp(iface, 0, "PPPConfigImp", true);
imp.showMaximized();
if(imp.exec() == QDialog::Accepted ){
- qDebug("ACCEPTED");
- PPPData::data()->save();
- Interface *iface;
- iface = new Interface( 0, PPPData::data()->modemDevice() );
- iface->setHardwareName( PPPData::data()->accname() );
- list.append( iface );
- return iface;
+ iface->setModuleOwner( this );
+ list.append( iface );
+ return iface;
+ }else {
+ delete iface;
+ iface = NULL;
}
- return NULL;
+ return iface;
}