summaryrefslogtreecommitdiff
path: root/core/settings/security
Side-by-side diff
Diffstat (limited to 'core/settings/security') (more/less context) (show whitespace changes)
-rw-r--r--core/settings/security/security.cpp72
-rw-r--r--core/settings/security/security.h6
-rw-r--r--core/settings/security/securitybase.ui253
3 files changed, 303 insertions, 28 deletions
diff --git a/core/settings/security/security.cpp b/core/settings/security/security.cpp
index 4701506..75a181b 100644
--- a/core/settings/security/security.cpp
+++ b/core/settings/security/security.cpp
@@ -21,2 +21,3 @@
+#include <qpe/qpeapplication.h>
#include <qpe/config.h>
@@ -29,2 +30,5 @@
#include <qmessagebox.h>
+#include <qfile.h>
+#include <qlistview.h>
+#include <qtextstream.h>
@@ -58,4 +62,21 @@ Security::Security( QWidget* parent, const char* name, WFlags fl )
+ QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf";
+ Config loginCfg(configFile,Config::File);
+
+ loginCfg.setGroup("General");
+ autoLoginName=loginCfg.readEntry("AutoLogin","");
+
+ if (autoLoginName.stripWhiteSpace().isEmpty()) {
+ autoLogin=false;
+ } else {
+ autoLogin=true;
+ }
+
+
+ connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool)));
+ connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int)));
connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode()));
connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode()));
+
+ loadUsers();
updateGUI();
@@ -79,2 +100,6 @@ void Security::updateGUI()
clearpasscode->setEnabled( !empty );
+
+ autologinToggle->setChecked(autoLogin);
+ userlist->setEnabled(autoLogin);
+
}
@@ -162,2 +187,32 @@ void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits)
+void Security::loadUsers ( void )
+{
+ QFile passwd("/etc/passwd");
+ if ( passwd.open(IO_ReadOnly) ) {
+ QTextStream t( &passwd );
+ QString s;
+ QStringList account;
+ while ( !t.eof() ) {
+ account = QStringList::split(':',t.readLine());
+
+ // Hide disabled accounts
+ if (*account.at(1)!="*") {
+
+ userlist->insertItem(*account.at(0));
+ // Highlight this item if it is set to autologinToggle
+ if ( *account.at(0) == autoLoginName)
+ userlist->setCurrentItem(userlist->count()-1);
+ }
+ }
+ passwd.close();
+ }
+
+}
+void Security::toggleAutoLogin(bool val)
+{
+ autoLogin=val;
+ userlist->setEnabled(val);
+ if (!autoLogin)
+ autoLoginName=userlist->currentText();
+}
void Security::setSyncNet(const QString& sn)
@@ -191,3 +246,20 @@ void Security::applySecurity()
*/
+
+ QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf";
+ Config loginCfg(configFile,Config::File);
+ loginCfg.setGroup("General");
+
+ if (autoLogin) {
+ loginCfg.writeEntry("AutoLogin",autoLoginName);
+ } else {
+ loginCfg.removeEntry("AutoLogin");
+ }
+
+ }
}
+
+void Security::changeLoginName( int idx )
+{
+ autoLoginName = userlist->text(idx);;
+ updateGUI();
}
diff --git a/core/settings/security/security.h b/core/settings/security/security.h
index efc83a2..2f18f91 100644
--- a/core/settings/security/security.h
+++ b/core/settings/security/security.h
@@ -45,4 +45,8 @@ private slots:
void setSyncNet(const QString&);
+ void changeLoginName(int);
+ void toggleAutoLogin(bool);
+
private:
+ void loadUsers(void);
bool telnetAvailable() const;
@@ -57,2 +61,4 @@ private:
bool valid;
+ bool autoLogin;
+ QString autoLoginName;
diff --git a/core/settings/security/securitybase.ui b/core/settings/security/securitybase.ui
index c2a8953..da25f39 100644
--- a/core/settings/security/securitybase.ui
+++ b/core/settings/security/securitybase.ui
@@ -13,4 +13,4 @@
<y>0</y>
- <width>277</width>
- <height>328</height>
+ <width>329</width>
+ <height>483</height>
</rect>
@@ -27,6 +27,6 @@
</property>
- <grid>
+ <vbox>
<property stdset="1">
<name>margin</name>
- <number>3</number>
+ <number>0</number>
</property>
@@ -34,5 +34,52 @@
<name>spacing</name>
- <number>3</number>
+ <number>0</number>
+ </property>
+ <widget>
+ <class>QTabWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TabWidget2</cstring>
+ </property>
+ <property>
+ <name>layoutMargin</name>
</property>
- <widget row="0" column="0" >
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Passcode</string>
+ </attribute>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>6</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox4</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Passcode</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
<class>QLayoutWidget</class>
@@ -78,3 +125,3 @@
</widget>
- <widget row="1" column="0" >
+ <widget>
<class>QCheckBox</class>
@@ -89,8 +136,137 @@
</widget>
- <widget row="3" column="0" >
- <class>QTabWidget</class>
+ <widget>
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TabWidget2</cstring>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>7</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&lt;P&gt;Pass code protection provides a minimal level of protection from casual access to this device.</string>
+ </property>
+ <property stdset="1">
+ <name>textFormat</name>
+ <enum>RichText</enum>
+ </property>
+ <property stdset="1">
+ <name>alignment</name>
+ <set>AlignTop|AlignLeft</set>
+ </property>
+ <property>
+ <name>vAlign</name>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer3</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Login</string>
+ </attribute>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>6</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox3</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Login</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>autologinToggle</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Login Automatically</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QComboBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>userlist</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer2</cstring>
</property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
<widget>
@@ -108,2 +284,21 @@
<name>margin</name>
+ <number>6</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Sync</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
<number>11</number>
@@ -124,2 +319,6 @@
</property>
+ <property stdset="1">
+ <name>textFormat</name>
+ <enum>RichText</enum>
+ </property>
</widget>
@@ -186,29 +385,27 @@
</widget>
- </widget>
- <widget row="2" column="0" >
- <class>QLabel</class>
- <property stdset="1">
+ <spacer>
+ <property>
<name>name</name>
- <cstring>TextLabel1</cstring>
+ <cstring>Spacer1</cstring>
</property>
<property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>7</vsizetype>
- </sizepolicy>
+ <name>orientation</name>
+ <enum>Vertical</enum>
</property>
<property stdset="1">
- <name>text</name>
- <string>&lt;P&gt;Pass code protection provides a minimal level of protection from casual access to this device.</string>
- </property>
- <property stdset="1">
- <name>alignment</name>
- <set>AlignTop|AlignLeft</set>
+ <name>sizeType</name>
+ <enum>Expanding</enum>
</property>
<property>
- <name>vAlign</name>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
</property>
+ </spacer>
+ </vbox>
</widget>
- </grid>
+ </widget>
+ </vbox>
</widget>