From kde-commits Thu Jan 29 09:21:24 2009 From: Will Stephenson Date: Thu, 29 Jan 2009 09:21:24 +0000 To: kde-commits Subject: playground/base/plasma/applets/networkmanager Message-Id: <1233220884.439301.24898.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=123322090003461 SVN commit 918106 by wstephens: Save/restore GSM settings M +22 -15 libs/ui/gsm.ui M +29 -1 libs/ui/gsmwidget.cpp M +3 -0 libs/ui/gsmwidget.h M +2 -4 settings/service/connectionsecretsjob.cpp --- trunk/playground/base/plasma/applets/networkmanager/libs/ui/gsm.ui #918105:918106 @@ -6,7 +6,7 @@ 0 0 317 - 394 + 454 @@ -25,12 +25,12 @@ &Number - kcfg_number + number - + *99# @@ -42,12 +42,12 @@ &Username - kcfg_username + username - + @@ -55,12 +55,12 @@ &Password - kcfg_password + password - + @@ -77,12 +77,12 @@ &APN - kcfg_apn + apn - + @@ -142,12 +142,12 @@ &Band - kcfg_band + band - + -1 @@ -162,12 +162,12 @@ &PIN - kcfg_pin + pin - + @@ -175,17 +175,24 @@ PU&K - kcfg_puk + puk - + + + + &Show secrets + + + + Qt::Vertical --- trunk/playground/base/plasma/applets/networkmanager/libs/ui/gsmwidget.cpp #918105:918106 @@ -45,16 +45,44 @@ void GsmWidget::readConfig() { + d->ui.number->setText(d->setting->number()); + d->ui.username->setText(d->setting->username()); + d->ui.apn->setText(d->setting->apn()); + d->ui.network->setText(d->setting->networkid()); + d->ui.band->setValue(d->setting->band()); + connect(d->ui.chkShowPass, SIGNAL(stateChanged(int)), this, SLOT(chkShowPassToggled())); + d->ui.password->setEchoMode(QLineEdit::Password); + d->ui.pin->setEchoMode(QLineEdit::Password); + d->ui.puk->setEchoMode(QLineEdit::Password); } +void GsmWidget::chkShowPassToggled() +{ + bool on = d->ui.chkShowPass->isChecked(); + d->ui.password->setEchoMode(on ? QLineEdit::Normal : QLineEdit::Password); + d->ui.pin->setEchoMode(on ? QLineEdit::Normal : QLineEdit::Password); + d->ui.puk->setEchoMode(on ? QLineEdit::Normal : QLineEdit::Password); +} + + void GsmWidget::writeConfig() { - + d->setting->setNumber(d->ui.number->text()); + d->setting->setUsername(d->ui.username->text()); + d->setting->setPassword(d->ui.password->text()); + d->setting->setApn(d->ui.apn->text()); + d->setting->setNetworkid(d->ui.network->text()); + d->setting->setBand(d->ui.band->value()); + d->setting->setPin(d->ui.pin->text()); + d->setting->setPuk(d->ui.puk->text()); } void GsmWidget::readSecrets() { + d->ui.password->setText(d->setting->password()); + d->ui.pin->setText(d->setting->pin()); + d->ui.puk->setText(d->setting->puk()); } --- trunk/playground/base/plasma/applets/networkmanager/libs/ui/gsmwidget.h #918105:918106 @@ -32,6 +32,7 @@ class KNM_EXPORT GsmWidget : public SettingWidget { +Q_OBJECT public: GsmWidget(Knm::Connection *, QWidget * parent = 0 ); virtual ~GsmWidget(); @@ -39,6 +40,8 @@ void readConfig(); void writeConfig(); void readSecrets(); +protected Q_SLOTS: + void chkShowPassToggled(); private: class Private; Private * d; --- trunk/playground/base/plasma/applets/networkmanager/settings/service/connectionsecretsjob.cpp #918105:918106 @@ -114,11 +114,9 @@ if ( mSettingName == QLatin1String(NM_SETTING_802_1X_SETTING_NAME)) { //m_settingWidget = Wired8021xSecurityWidget(m_connection, 0); } else if ( mSettingName == QLatin1String(NM_SETTING_CDMA_SETTING_NAME)) { -#warning CdmaWidget not ported! - //m_settingWidget = new CdmaWidget(m_connection, 0); + m_settingWidget = new CdmaWidget(m_connection, 0); } else if ( mSettingName == QLatin1String(NM_SETTING_GSM_SETTING_NAME)) { -#warning GsmWidget not ported! - //m_settingWidget = new GsmWidget(m_connection, 0); + m_settingWidget = new GsmWidget(m_connection, 0); } else if ( mSettingName == QLatin1String(NM_SETTING_IP4_CONFIG_SETTING_NAME)) { m_settingWidget = new IpV4Widget(m_connection, 0); //} else if ( mSettingName == QLatin1String(NM_SETTING_IP6_CONFIG_SETTING_NAME)) {