summaryrefslogtreecommitdiff
path: root/noncore/settings
authortille <tille>2003-05-25 18:19:04 (UTC)
committer tille <tille>2003-05-25 18:19:04 (UTC)
commit2ec401058a04c15d2725c94d38226d0ac4505496 (patch) (side-by-side diff)
treebbe34da6b452cb01f31e5a08acf114c8c9641c32 /noncore/settings
parent7e1dce1560e45ef7fad91a8da2d0d96c1b166df9 (diff)
downloadopie-2ec401058a04c15d2725c94d38226d0ac4505496.zip
opie-2ec401058a04c15d2725c94d38226d0ac4505496.tar.gz
opie-2ec401058a04c15d2725c94d38226d0ac4505496.tar.bz2
saves configured interfaces now
Diffstat (limited to 'noncore/settings') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/TODO6
-rw-r--r--noncore/settings/networksettings/ppp/accounts.cpp42
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.cpp8
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp54
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.h23
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp23
6 files changed, 78 insertions, 78 deletions
diff --git a/noncore/settings/networksettings/ppp/TODO b/noncore/settings/networksettings/ppp/TODO
new file mode 100644
index 0000000..2410880
--- a/dev/null
+++ b/noncore/settings/networksettings/ppp/TODO
@@ -0,0 +1,6 @@
+- impl. PPPData::copyaccount & PPPData::deleteAccount
+- update modem attribute inputs when modem has changed
+- fix layout of edit account
+- save pppd arguments in edit account
+- popup configure modem with the correct account prselected
+ not quite shure why it does not work... IMHO it should work
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp
index 19db9ef..11d4739 100644
--- a/noncore/settings/networksettings/ppp/accounts.cpp
+++ b/noncore/settings/networksettings/ppp/accounts.cpp
@@ -55,11 +55,5 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name )
{
-// int min = 0;
QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10);
-
- // add a hbox
-// QHBoxLayout *l11 = new QHBoxLayout;
-// l1->addLayout(l11);
-
accountlist_l = new QListBox(this);
-// accountlist_l->setMinimumSize(160, 128);
+
connect(accountlist_l, SIGNAL(highlighted(int)),
@@ -70,4 +64,2 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name )
-// QVBoxLayout *l111 = new QVBoxLayout(this);
-// l11->addLayout(l111, 1);
edit_b = new QPushButton(i18n("&Edit..."), this);
@@ -75,7 +67,2 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name )
QWhatsThis::add(edit_b, i18n("Allows you to modify the selected account"));
-
-// min = edit_b->sizeHint().width();
-// min = QMAX(70,min);
-// edit_b->setMinimumWidth(min);
-
l1->addWidget(edit_b);
@@ -174,3 +161,6 @@ AccountWidget::AccountWidget( QWidget *parent, const char *name )
- slotListBoxSelect(accountlist_l->currentItem());
+// slotListBoxSelect(accountlist_l->currentItem());
+ qDebug("setting listview index to %i",PPPData::data()->currentAccountID() );
+ accountlist_l->setCurrentItem( PPPData::data()->currentAccountID() );
+// slotListBoxSelect( PPPData::data()->currentAccountID());
@@ -186,23 +176,7 @@ void AccountWidget::slotListBoxSelect(int idx) {
if(idx!=-1) {
+ qDebug("setting account to %i", idx);
QString account = PPPData::data()->accname();
PPPData::data()->setAccountbyIndex(accountlist_l->currentItem());
-// reset->setEnabled(TRUE);
-// costlabel->setEnabled(TRUE);
-// costedit->setEnabled(TRUE);
-// costedit->setText(AccountingBase::getCosts(accountlist_l->text(accountlist_l->currentItem())));
-
-// vollabel->setEnabled(TRUE);
-// voledit->setEnabled(TRUE);
-// int bytes = PPPData::data()->totalBytes();
-// voledit->setText(prettyPrintVolume(bytes));
- PPPData::data()->setAccount(account);
- } else{
- // reset->setEnabled(FALSE);
-// costlabel->setEnabled(FALSE);
-// costedit->setText("");
-// costedit->setEnabled(FALSE);
-// vollabel->setEnabled(FALSE);
-// voledit->setText("");
-// voledit->setEnabled(FALSE);
- }
+ // PPPData::data()->setAccount(account);
+ }
}
diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp
index e2521a6..4c5f7aa 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.cpp
+++ b/noncore/settings/networksettings/ppp/pppconfig.cpp
@@ -28,4 +28,9 @@ PPPConfigWidget::PPPConfigWidget( Interface* iface, QWidget *parent,
PPPData::data()->setModemDevice("/dev/modem");
+ qDebug("PPPConfigWidget::PPPConfigWidget");
+ qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1());
if (!PPPData::data()->setAccount( interface->getHardwareName() ))
PPPData::data()->setAccount( 0 );
+
+ qDebug(" PPPData::data()->accname >%s<",PPPData::data()->accname().latin1());
+ qDebug(" PPPData::data()->currentAccountID() >%i<",PPPData::data()->currentAccountID());
(void)new Modem;
@@ -57,2 +62,5 @@ void PPPConfigWidget::accept()
{
+ qDebug("PPPConfigWidget::accept");
+ qDebug(" PPPData::data()->accname >%s<",PPPData::data()->accname().latin1());
+ qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1());
interface->setInterfaceName( PPPData::data()->modemDevice() );
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index 109e3b7..3f1675c 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -57,3 +57,3 @@ PPPData* PPPData::data()
PPPData::PPPData()
- : //config(0L),
+ : modemDeviceGroup(-1),
highcount(-1), // start out with no entries
@@ -62,4 +62,3 @@ PPPData::PPPData()
pppdisrunning(false),
- pppderror(0),
- modemDeviceGroup(-1)
+ pppderror(0)
{
@@ -331,3 +330,2 @@ const QString PPPData::modemDevice() {
bool PPPData::setModemDevice(const QString &n) {
- //FIXME: change modem group
bool ret = false;
@@ -806,3 +804,3 @@ int PPPData::newaccount() {
int PPPData::copyaccount(int i) {
-
+// FIXME
// if(highcount >= MAX_ACCOUNTS)
@@ -1223,26 +1221,32 @@ QString PPPData::modemGroup()
if (modemDeviceGroup<0)qFatal("wrong modem %i",modemDeviceGroup);
- return QString("MODEM_GRP_%1").arg(modemDeviceGroup);
+ return QString("%1_%1").arg(MODEM_GRP).arg(modemDeviceGroup);
}
-// //
-// // 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);
-// }
+QMap<QString,QString> PPPData::getConfiguredInterfaces()
+{
+ QMap<QString,QString> ifaces;
+ int count = readNumConfig( ACCLIST_GRP, ACCOUNTS_COUNT, -1 );
+ QString accGrp;
+ for (int i = 0; i < count; i++){
+ accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i);
+ ifaces.insert( readConfig( accGrp, ACOUNTS_DEV, "error" ),
+ readConfig( accGrp, ACOUNTS_ACC, "error" ) );
+ }
-// 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);
-// }
+ return ifaces;
+}
-// 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);
-// }
+void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces )
+{
+ QMap<QString,QString>::Iterator it;
+ QString accGrp;
+ int i = 0;
+ for( it = ifaces.begin(); it != ifaces.end(); ++it, ++i ){
+ accGrp = QString("%1_%1").arg(ACCLIST_GRP).arg(i);
+ writeConfig( accGrp, ACOUNTS_DEV, it.key() );
+ writeConfig( accGrp, ACOUNTS_ACC, it.data() );
+ }
+ writeConfig( ACCLIST_GRP, ACCOUNTS_COUNT, i );
+
+}
diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h
index 41dfbd8..c1c7e69 100644
--- a/noncore/settings/networksettings/ppp/pppdata.h
+++ b/noncore/settings/networksettings/ppp/pppdata.h
@@ -33,5 +33,6 @@
+#include <qcolor.h>
+#include <qmap.h>
#include <qstring.h>
#include <qstringlist.h>
-#include <qcolor.h>
@@ -60,2 +61,3 @@ class Config;
#define ACCOUNT_GRP "PPP_Account"
+#define ACCLIST_GRP "PPP_Accounts_List"
//#define GRAPH_GRP "Graph"
@@ -142,9 +144,2 @@ class Config;
-// graph colors
-#define GENABLED "Enabled"
-#define GCOLOR_BG "Background"
-#define GCOLOR_TEXT "Text"
-#define GCOLOR_IN "InBytes"
-#define GCOLOR_OUT "OutBytes"
-
// pppd errors
@@ -153,7 +148,6 @@ class Config;
-// window position
-#define WINPOS_CONWIN_X "WindowPositionConWinX"
-#define WINPOS_CONWIN_Y "WindowPositionConWinY"
-#define WINPOS_STATWIN_X "WindowPositionStatWinX"
-#define WINPOS_STATWIN_Y "WindowPositionStatWinY"
+// account list
+#define ACCOUNTS_COUNT "Accounts_Count"
+#define ACOUNTS_DEV "Accounts_Modem"
+#define ACOUNTS_ACC "Accounts_Account"
@@ -172,2 +166,4 @@ public:
+ QMap<QString,QString> getConfiguredInterfaces();
+ void setConfiguredInterfaces( QMap<QString,QString> );
@@ -191,2 +187,3 @@ public:
+ int currentAccountID() { return caccount; };
const QString defaultAccount();
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index 3a97535..7cbccc2 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -12,6 +12,12 @@ PPPModule::PPPModule() : Module()
{
+ QMap<QString,QString> ifaces = PPPData::data()->getConfiguredInterfaces();
+ QMap<QString,QString>::Iterator it;
Interface *iface;
- iface = new Interface( 0, "device" );
- iface->setHardwareName( "account" );
- list.append( iface );
+ qDebug("getting interfaces");
+ for( it = ifaces.begin(); it != ifaces.end(); ++it ){
+ qDebug("ifaces %s", it.key().latin1());
+ iface = new Interface( 0, it.key() );
+ iface->setHardwareName( it.data() );
+ list.append( iface );
+ }
}
@@ -22,5 +28,10 @@ PPPModule::PPPModule() : Module()
PPPModule::~PPPModule(){
- Interface *i;
- for ( i=list.first(); i != 0; i=list.next() )
- delete i;
+ QMap<QString,QString> ifaces;
+ Interface *i;
+ for ( i=list.first(); i != 0; i=list.next() ){
+ ifaces.insert( i->getInterfaceName(), i->getHardwareName() );
+ delete i;
+ }
+ PPPData::data()->setConfiguredInterfaces( ifaces );
+ PPPData::data()->save();
}