-rw-r--r-- | apps/Applications/multiauth.desktop | 6 | ||||
-rw-r--r-- | core/settings/security/.cvsignore | 4 | ||||
-rw-r--r-- | core/settings/security/config.in | 6 | ||||
-rw-r--r-- | core/settings/security/demo/config.in | 4 | ||||
-rw-r--r-- | core/settings/security/demo/main.cpp | 34 | ||||
-rw-r--r-- | core/settings/security/demo/multiauth.control | 13 | ||||
-rw-r--r-- | core/settings/security/demo/multiauth.pro | 17 | ||||
-rw-r--r-- | core/settings/security/loginbase.ui | 106 | ||||
-rw-r--r-- | core/settings/security/main.cpp | 68 | ||||
-rw-r--r-- | core/settings/security/multiauthconfig.cpp | 665 | ||||
-rw-r--r-- | core/settings/security/multiauthconfig.h | 141 | ||||
-rw-r--r-- | core/settings/security/opie-security.control | 2 | ||||
-rw-r--r-- | core/settings/security/security.pro | 22 | ||||
-rw-r--r-- | core/settings/security/securitybase.ui | 504 | ||||
-rw-r--r-- | core/settings/security/syncbase.ui | 213 | ||||
-rw-r--r-- | libopie2/opiesecurity/multiauthmainwindow.cpp | 2 |
16 files changed, 1263 insertions, 544 deletions
diff --git a/apps/Applications/multiauth.desktop b/apps/Applications/multiauth.desktop new file mode 100644 index 0000000..17a0132 --- a/dev/null +++ b/apps/Applications/multiauth.desktop | |||
@@ -0,0 +1,6 @@ | |||
1 | [Desktop Entry] | ||
2 | Exec=multiauth | ||
3 | Icon=security/multiauth | ||
4 | Type=Application | ||
5 | Name=Multiauth demo | ||
6 | Comment=Multi-authentication demonstration | ||
diff --git a/core/settings/security/.cvsignore b/core/settings/security/.cvsignore index ad7fd3a..c6e8c08 100644 --- a/core/settings/security/.cvsignore +++ b/core/settings/security/.cvsignore | |||
@@ -1,7 +1,7 @@ | |||
1 | *.moc | 1 | *.moc |
2 | Makefile* | 2 | Makefile* |
3 | moc_* | 3 | moc_* |
4 | securitybase.cpp | 4 | loginbase.* |
5 | securitybase.h | 5 | syncbase.* |
6 | .moc | 6 | .moc |
7 | .obj | 7 | .obj |
diff --git a/core/settings/security/config.in b/core/settings/security/config.in index 14876da..c346353 100644 --- a/core/settings/security/config.in +++ b/core/settings/security/config.in | |||
@@ -1,4 +1,6 @@ | |||
1 | config SECURITY | 1 | config SECURITY |
2 | boolean "opie-security (to set a pin for PDA usage protection)" | 2 | boolean "opie-security (to set any kind of PDA usage protection)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI |
5 | |||
6 | source core/settings/security/demo/config.in | ||
diff --git a/core/settings/security/demo/config.in b/core/settings/security/demo/config.in new file mode 100644 index 0000000..d867014 --- a/dev/null +++ b/core/settings/security/demo/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config MULTIAUTH_DEMO | ||
2 | boolean "opie-security multiauth demo (provides several ways to lock and unlock the device)" | ||
3 | default "y" | ||
4 | depends SECURITY | ||
diff --git a/core/settings/security/demo/main.cpp b/core/settings/security/demo/main.cpp new file mode 100644 index 0000000..4ae76e4 --- a/dev/null +++ b/core/settings/security/demo/main.cpp | |||
@@ -0,0 +1,34 @@ | |||
1 | #include <opie2/multiauthmainwindow.h> | ||
2 | #include <opie2/multiauthcommon.h> | ||
3 | |||
4 | #include <opie2/oapplication.h> | ||
5 | |||
6 | /// main() function of the opie-multiauth-standalone demonstration application | ||
7 | /** | ||
8 | * Calls each plugin one after the other, and asks them to perform one authentication. | ||
9 | * It loads the plugins one after another through the MultiauthPluginInterface, | ||
10 | * then calls MultiauthPluginObject::authenticate(). | ||
11 | * \em Note: calls are not parsed by doxygen since they are done via a QInterfacePtr: | ||
12 | * \see http://dudu.dyn.2-h.org/nist/doxydoc/allOpie//classQInterfacePtr.html | ||
13 | */ | ||
14 | int main( int argc, char ** argv ) | ||
15 | { | ||
16 | Opie::Core::OApplication app(argc, argv, "Multi-authentication demo"); | ||
17 | |||
18 | /* Constructs the main window, which displays messages and blocks | ||
19 | * access to the desktop | ||
20 | */ | ||
21 | Opie::Security::MultiauthMainWindow win; | ||
22 | |||
23 | app.showMainWidget(&win); | ||
24 | |||
25 | // resize the QDialog object so it fills all the screen | ||
26 | QRect desk = qApp->desktop()->geometry(); | ||
27 | win.setGeometry( 0, 0, desk.width(), desk.height() ); | ||
28 | |||
29 | // the authentication has already succeeded (without win interactions) | ||
30 | if ( win.isAlreadyDone() ) | ||
31 | return 0; | ||
32 | |||
33 | return app.exec(); | ||
34 | } | ||
diff --git a/core/settings/security/demo/multiauth.control b/core/settings/security/demo/multiauth.control new file mode 100644 index 0000000..9b4d554 --- a/dev/null +++ b/core/settings/security/demo/multiauth.control | |||
@@ -0,0 +1,13 @@ | |||
1 | Package: opie-multiauth | ||
2 | Files: bin/multiauth apps/Applications/multiauth.desktop pics/security/multiauth.png | ||
3 | Priority: optional | ||
4 | Section: opie/settings | ||
5 | Maintainer: Clement Seveillac <clement@nist.gov> | ||
6 | Architecture: arm | ||
7 | Version: 0.0.1.13 | ||
8 | Depends: opie-security | ||
9 | Description: multi-plugin authentication demonstrator for Opie. | ||
10 | This demonstration application allows us to use one or several | ||
11 | ways to lock and unlock our device. | ||
12 | You must install some opie-multiauth-* plugins, and configure | ||
13 | them through opie-security, to really see its possibilities. | ||
diff --git a/core/settings/security/demo/multiauth.pro b/core/settings/security/demo/multiauth.pro new file mode 100644 index 0000000..ef931a5 --- a/dev/null +++ b/core/settings/security/demo/multiauth.pro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG += qt warn_on | ||
3 | |||
4 | HEADERS = | ||
5 | SOURCES = main.cpp | ||
6 | |||
7 | INCLUDEPATH += $(OPIEDIR)/include | ||
8 | DEPENDPATH += | ||
9 | |||
10 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiesecurity2 | ||
11 | |||
12 | DESTDIR = $(OPIEDIR)/bin | ||
13 | TARGET = multiauth | ||
14 | |||
15 | include ( $(OPIEDIR)/include.pro ) | ||
16 | |||
17 | |||
diff --git a/core/settings/security/loginbase.ui b/core/settings/security/loginbase.ui new file mode 100644 index 0000000..03e5149 --- a/dev/null +++ b/core/settings/security/loginbase.ui | |||
@@ -0,0 +1,106 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>LoginBase</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>LoginBase</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>174</width> | ||
15 | <height>126</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>LoginBase</string> | ||
21 | </property> | ||
22 | <vbox> | ||
23 | <property stdset="1"> | ||
24 | <name>margin</name> | ||
25 | <number>11</number> | ||
26 | </property> | ||
27 | <property stdset="1"> | ||
28 | <name>spacing</name> | ||
29 | <number>6</number> | ||
30 | </property> | ||
31 | <widget> | ||
32 | <class>QGroupBox</class> | ||
33 | <property stdset="1"> | ||
34 | <name>name</name> | ||
35 | <cstring>GroupBox3</cstring> | ||
36 | </property> | ||
37 | <property stdset="1"> | ||
38 | <name>title</name> | ||
39 | <string>Login</string> | ||
40 | </property> | ||
41 | <vbox> | ||
42 | <property stdset="1"> | ||
43 | <name>margin</name> | ||
44 | <number>6</number> | ||
45 | </property> | ||
46 | <property stdset="1"> | ||
47 | <name>spacing</name> | ||
48 | <number>6</number> | ||
49 | </property> | ||
50 | <widget> | ||
51 | <class>QCheckBox</class> | ||
52 | <property stdset="1"> | ||
53 | <name>name</name> | ||
54 | <cstring>autologinToggle</cstring> | ||
55 | </property> | ||
56 | <property stdset="1"> | ||
57 | <name>text</name> | ||
58 | <string>Login Automatically</string> | ||
59 | </property> | ||
60 | <property> | ||
61 | <name>whatsThis</name> | ||
62 | <string>If you select this option, opie-login will automagically log you in with the user you have selected in the drop-down list. | ||
63 | |||
64 | For the Zaurus 5x00 this is always the user "root".</string> | ||
65 | </property> | ||
66 | </widget> | ||
67 | <widget> | ||
68 | <class>QComboBox</class> | ||
69 | <property stdset="1"> | ||
70 | <name>name</name> | ||
71 | <cstring>userlist</cstring> | ||
72 | </property> | ||
73 | <property> | ||
74 | <name>whatsThis</name> | ||
75 | <string>This drop-down list allows you to select the user for auto-login | ||
76 | (if enabled above). | ||
77 | |||
78 | You can only select an actually configured user.</string> | ||
79 | </property> | ||
80 | </widget> | ||
81 | </vbox> | ||
82 | </widget> | ||
83 | <spacer> | ||
84 | <property> | ||
85 | <name>name</name> | ||
86 | <cstring>Spacer2</cstring> | ||
87 | </property> | ||
88 | <property stdset="1"> | ||
89 | <name>orientation</name> | ||
90 | <enum>Vertical</enum> | ||
91 | </property> | ||
92 | <property stdset="1"> | ||
93 | <name>sizeType</name> | ||
94 | <enum>Expanding</enum> | ||
95 | </property> | ||
96 | <property> | ||
97 | <name>sizeHint</name> | ||
98 | <size> | ||
99 | <width>20</width> | ||
100 | <height>20</height> | ||
101 | </size> | ||
102 | </property> | ||
103 | </spacer> | ||
104 | </vbox> | ||
105 | </widget> | ||
106 | </UI> | ||
diff --git a/core/settings/security/main.cpp b/core/settings/security/main.cpp index 200a541..f161109 100644 --- a/core/settings/security/main.cpp +++ b/core/settings/security/main.cpp | |||
@@ -1,30 +1,46 @@ | |||
1 | /********************************************************************** | 1 | #include "multiauthconfig.h" |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | #include <opie2/oapplication.h> |
3 | ** | 3 | #include <opie2/odebug.h> |
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | 4 | ||
21 | 5 | ||
22 | #include "security.h" | ||
23 | |||
24 | #include <opie2/oapplicationfactory.h> | ||
25 | |||
26 | using namespace Opie::Core; | ||
27 | OPIE_EXPORT_APP( OApplicationFactory<Security> ) | ||
28 | |||
29 | 6 | ||
7 | int main(int argc, char **argv) { | ||
8 | Opie::Core::OApplication app(argc, argv, "MultiAuthentication Config"); | ||
9 | // protect this dialog if option set | ||
10 | Config* pcfg = new Config("Security"); | ||
11 | pcfg->setGroup( "Misc" ); | ||
12 | bool protectConfigDialog = ! pcfg->readBoolEntry("noProtectConfig", true); | ||
13 | delete pcfg; | ||
14 | bool show = true; | ||
15 | if ( protectConfigDialog ) | ||
16 | { | ||
17 | if (Opie::Security::Internal::runPlugins() != 0) | ||
18 | { | ||
19 | // authentication failed | ||
20 | show = false; | ||
21 | } | ||
22 | } | ||
23 | if ( show == true ) | ||
24 | { | ||
25 | printf("building dialog\n"); | ||
26 | MultiauthConfig dialog; | ||
27 | app.setMainWidget(&dialog); | ||
30 | 28 | ||
29 | if ( dialog.exec() == QDialog::Accepted ) { | ||
30 | // write the general, login and sync config | ||
31 | dialog.writeConfig(); | ||
32 | // call writeConfig() on each plugin config widget | ||
33 | Opie::Security::MultiauthConfigWidget *confWidget; | ||
34 | for ( confWidget = dialog.configWidgetList.first(); confWidget != 0; | ||
35 | confWidget = dialog.configWidgetList.next() ) { | ||
36 | confWidget->writeConfig(); | ||
37 | } | ||
38 | } | ||
39 | dialog.close(); | ||
40 | app.quit(); | ||
41 | return 0; | ||
42 | } else { | ||
43 | owarn << "authentication failed, not showing opie-security" << oendl; | ||
44 | return 1; | ||
45 | } | ||
46 | } | ||
diff --git a/core/settings/security/multiauthconfig.cpp b/core/settings/security/multiauthconfig.cpp new file mode 100644 index 0000000..0ce4542 --- a/dev/null +++ b/core/settings/security/multiauthconfig.cpp | |||
@@ -0,0 +1,665 @@ | |||
1 | #include "multiauthconfig.h" | ||
2 | |||
3 | #include <opie2/odebug.h> | ||
4 | |||
5 | #include <qgroupbox.h> | ||
6 | #include <qpe/resource.h> | ||
7 | #include <qlayout.h> | ||
8 | #include <qlabel.h> | ||
9 | #include <qhbox.h> | ||
10 | #include <qheader.h> | ||
11 | #include <qvbox.h> | ||
12 | #include <qwhatsthis.h> | ||
13 | #include <qtoolbutton.h> | ||
14 | #include <qstringlist.h> | ||
15 | #include <qdir.h> | ||
16 | #include <qpe/qlibrary.h> | ||
17 | #include <qpe/qpeapplication.h> | ||
18 | |||
19 | |||
20 | using Opie::Security::MultiauthPluginInterface; | ||
21 | using Opie::Security::MultiauthPluginObject; | ||
22 | using Opie::Security::MultiauthConfigWidget; | ||
23 | /// keeps information about MultiauthPluginObject plugins | ||
24 | struct MultiauthPlugin { | ||
25 | MultiauthPlugin() : library( 0 ), iface( 0 ), pluginObject( 0 ) {} | ||
26 | /// plugin file | ||
27 | QLibrary *library; | ||
28 | /// the plugin object interface | ||
29 | QInterfacePtr<MultiauthPluginInterface> iface; | ||
30 | /// the plugin object itself | ||
31 | MultiauthPluginObject *pluginObject; | ||
32 | /// name of the plugin file | ||
33 | QString name; | ||
34 | /// should the plugin be launched during authentication or not | ||
35 | bool active; | ||
36 | /// order of the plugin, in the pluginListWidget and during authentication | ||
37 | int pos; | ||
38 | }; | ||
39 | |||
40 | /// list of available MultiauthPlugin objects | ||
41 | static QValueList<MultiauthPlugin> pluginList; | ||
42 | |||
43 | |||
44 | /// extension of QToolButton that adds signals, icons and stuff (taken from todayconfig.cpp) | ||
45 | class ToolButton : public QToolButton { | ||
46 | |||
47 | public: | ||
48 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | ||
49 | : QToolButton( parent, name ) { | ||
50 | setPixmap( Resource::loadPixmap( icon ) ); | ||
51 | setAutoRaise( TRUE ); | ||
52 | setFocusPolicy( QWidget::NoFocus ); | ||
53 | setToggleButton( t ); | ||
54 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | ||
55 | } | ||
56 | }; | ||
57 | |||
58 | MultiauthGeneralConfig::MultiauthGeneralConfig(QWidget * parent, const char * name = "general Opie-multiauthentication config widget") | ||
59 | : QWidget(parent, name), onStart(0), onResume(0), nbSuccessMin(0) | ||
60 | { | ||
61 | QVBoxLayout *vb = new QVBoxLayout(this); | ||
62 | vb->setSpacing(11); | ||
63 | vb->setMargin(11); | ||
64 | vb->setAlignment( Qt::AlignTop ); | ||
65 | |||
66 | QGroupBox *lockBox = new QGroupBox(0, Qt::Vertical, tr("When to lock Opie"), this, "lock box"); | ||
67 | vb->addWidget(lockBox); | ||
68 | QGridLayout *boxLayout = new QGridLayout( lockBox->layout() ); | ||
69 | onStart = new QCheckBox( tr( "on Opie start" ), lockBox, "lock on opie start"); | ||
70 | onResume = new QCheckBox( tr( "on Opie resume" ), lockBox, "lock on opie resume"); | ||
71 | boxLayout->addWidget(onStart, 0, 0); | ||
72 | boxLayout->addWidget(onResume, 0, 1); | ||
73 | |||
74 | QGroupBox *nbBox = new QGroupBox(0, Qt::Vertical, tr("Multiple plugins authentication"), this, "nb box"); | ||
75 | vb->addWidget(nbBox); | ||
76 | QGridLayout *nbBoxLayout = new QGridLayout( nbBox->layout() ); | ||
77 | nbSuccessMin = new QSpinBox(nbBox); | ||
78 | QLabel *lNbSuccessMin = new QLabel( tr( "Required successes" ), nbBox); | ||
79 | nbBoxLayout->addWidget(nbSuccessMin, 0, 0); | ||
80 | nbBoxLayout->addWidget(lNbSuccessMin, 0, 1); | ||
81 | nbSuccessMin->setMinValue(1); // the max value is defined in MultiauthConfig constructor | ||
82 | |||
83 | QGroupBox *devBox = new QGroupBox(0, Qt::Vertical, tr("Debug options"), this, "dev box"); | ||
84 | vb->addWidget(devBox); | ||
85 | QGridLayout *devBoxLayout = new QGridLayout( devBox->layout() ); | ||
86 | noProtectConfig = new QCheckBox( tr("Don't protect this config screen"), devBox, "don't protect config"); | ||
87 | explanScreens = new QCheckBox( tr("Show explanatory screens"), devBox, "Show explan. screens"); | ||
88 | allowBypass = new QCheckBox( tr("Allow to bypass authentication"), devBox, "AllowBypass"); | ||
89 | QLabel *logicNote = new QLabel( "<p>" + tr("Note: the third option implies the second one") + "</p>", devBox ); | ||
90 | devBoxLayout->addWidget(noProtectConfig, 0, 0); | ||
91 | devBoxLayout->addWidget(explanScreens, 1, 0); | ||
92 | devBoxLayout->addWidget(allowBypass, 2, 0); | ||
93 | devBoxLayout->addMultiCellWidget(logicNote, 3, 3, 0, 1); | ||
94 | |||
95 | connect( explanScreens, SIGNAL(toggled(bool)), this, SLOT(checkBypass()) ); | ||
96 | connect( allowBypass, SIGNAL(toggled(bool)), this, SLOT(checkScreens()) ); | ||
97 | } | ||
98 | |||
99 | /// nothing to do | ||
100 | MultiauthGeneralConfig::~MultiauthGeneralConfig() | ||
101 | {} | ||
102 | |||
103 | /// Be sure that explanScreens is checked if allowBypass is | ||
104 | void MultiauthGeneralConfig::checkScreens() | ||
105 | { | ||
106 | if ( (allowBypass->isChecked() == true) && (explanScreens->isChecked() == false) ) | ||
107 | explanScreens->setChecked(true); | ||
108 | } | ||
109 | |||
110 | /// Be sure that allowBypass is not checked if explanScreens is not | ||
111 | void MultiauthGeneralConfig::checkBypass() | ||
112 | { | ||
113 | if ( (allowBypass->isChecked() == true) && (explanScreens->isChecked() == false) ) | ||
114 | allowBypass->setChecked(false); | ||
115 | } | ||
116 | |||
117 | /// Builds and displays the Opie multi-authentication configuration dialog | ||
118 | MultiauthConfig::MultiauthConfig() : QDialog(0, 0, TRUE), | ||
119 | m_mainTW(0), m_pluginListView(0), m_pluginListWidget(0), | ||
120 | m_generalConfig(0), m_loginWidget(0), m_syncWidget(0), | ||
121 | m_nbSuccessReq(0), m_plugins_changed(false) | ||
122 | { | ||
123 | /* Initializes the global configuration window | ||
124 | */ | ||
125 | setCaption( tr( "Security configuration" ) ); | ||
126 | QVBoxLayout *layout = new QVBoxLayout( this ); | ||
127 | m_mainTW = new Opie::Ui::OTabWidget( this ); | ||
128 | layout->addWidget(m_mainTW); | ||
129 | m_pluginListWidget = new QWidget(m_mainTW, "plugin list widget"); | ||
130 | QVBoxLayout * pluginListLayout = new QVBoxLayout(m_pluginListWidget); | ||
131 | pluginListLayout->setSpacing(6); | ||
132 | pluginListLayout->setMargin(11); | ||
133 | QLabel * pluginListTitle = new QLabel( tr( "Load which plugins in what order:" ), m_pluginListWidget ); | ||
134 | pluginListLayout->addWidget(pluginListTitle); | ||
135 | QHBox * pluginListHB = new QHBox(m_pluginListWidget); | ||
136 | pluginListLayout->addWidget(pluginListHB); | ||
137 | |||
138 | m_pluginListView = new QListView(pluginListHB); | ||
139 | m_pluginListView->addColumn("PluginList"); | ||
140 | m_pluginListView->header()->hide(); | ||
141 | m_pluginListView->setSorting(-1); | ||
142 | QWhatsThis::add(m_pluginListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the order they will appear in" )); | ||
143 | |||
144 | QVBox * pluginListVB = new QVBox(pluginListHB); | ||
145 | new ToolButton( pluginListVB, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); | ||
146 | new ToolButton( pluginListVB, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); | ||
147 | m_mainTW->addTab( m_pluginListWidget, "pass", tr( "plugins" ) ); | ||
148 | |||
149 | connect ( m_pluginListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( pluginsChanged ( ) ) ); | ||
150 | |||
151 | // general Opie multi-authentication configuration tab | ||
152 | m_generalConfig = new MultiauthGeneralConfig(m_mainTW); | ||
153 | m_mainTW->addTab(m_generalConfig, "SettingsIcon", tr( "Authentication") ); | ||
154 | |||
155 | // login settings page | ||
156 | m_loginWidget = new LoginBase(m_mainTW, "login config widget"); | ||
157 | m_mainTW->addTab(m_loginWidget, "security/users", tr( "Login") ); | ||
158 | |||
159 | // sync settings page | ||
160 | m_syncWidget = new SyncBase( m_mainTW, "sync config widget" ); | ||
161 | m_mainTW->addTab(m_syncWidget, "security/sync", tr( "Sync") ); | ||
162 | |||
163 | // read the "Security" Config file and update our UI | ||
164 | readConfig(); | ||
165 | |||
166 | /* loads plugins configuration widgets in mainTW tabs and in pluginListView | ||
167 | */ | ||
168 | |||
169 | loadPlugins(); | ||
170 | |||
171 | for ( int i = pluginList.count() - 1; i >= 0; i-- ) { | ||
172 | MultiauthPlugin plugin = pluginList[i]; | ||
173 | |||
174 | // load the config widgets in the tabs | ||
175 | // (configWidget will return 0l if there is no configuration GUI) | ||
176 | MultiauthConfigWidget* widget = plugin.pluginObject->configWidget(m_mainTW); | ||
177 | if ( widget != 0l ) { | ||
178 | odebug << "plugin " << plugin.name << " has a configuration widget" << oendl; | ||
179 | configWidgetList.append(widget); | ||
180 | m_mainTW->addTab( widget, plugin.pluginObject->pixmapNameConfig(), | ||
181 | plugin.pluginObject->pluginName() ); | ||
182 | } | ||
183 | // set the order/activate tab | ||
184 | QPixmap icon = Resource::loadPixmap( plugin.pluginObject->pixmapNameWidget() ); | ||
185 | QCheckListItem * item = new QCheckListItem(m_pluginListView, plugin.pluginObject->pluginName(), QCheckListItem::CheckBox ); | ||
186 | if ( !icon.isNull() ) { | ||
187 | item->setPixmap( 0, icon ); | ||
188 | } | ||
189 | if ( m_excludePlugins.find( plugin.name ) == m_excludePlugins.end() ) { | ||
190 | item->setOn( TRUE ); | ||
191 | } | ||
192 | m_plugins[plugin.name] = item; | ||
193 | } | ||
194 | |||
195 | // set the first tab as default. | ||
196 | m_mainTW->setCurrentTab(m_pluginListWidget); | ||
197 | |||
198 | // put the number of plugins as the max number of req. auth. | ||
199 | m_generalConfig->nbSuccessMin->setMaxValue( pluginList.count() ); | ||
200 | |||
201 | showMaximized(); | ||
202 | } | ||
203 | |||
204 | /// nothing to do | ||
205 | MultiauthConfig::~MultiauthConfig() | ||
206 | { | ||
207 | } | ||
208 | |||
209 | /// moves up the selected plugin | ||
210 | void MultiauthConfig::moveSelectedUp() | ||
211 | { | ||
212 | QListViewItem *item = m_pluginListView->selectedItem(); | ||
213 | if ( item && item->itemAbove() ) { | ||
214 | item->itemAbove()->moveItem( item ); | ||
215 | } | ||
216 | } | ||
217 | |||
218 | /// moves down the selected plugin | ||
219 | void MultiauthConfig::moveSelectedDown() | ||
220 | { | ||
221 | QListViewItem *item = m_pluginListView->selectedItem(); | ||
222 | if ( item && item->itemBelow() ) { | ||
223 | item->moveItem( item->itemBelow() ); | ||
224 | } | ||
225 | } | ||
226 | |||
227 | /// reads the <code>Security.conf</code> Config file, and updates parts of the user interface | ||
228 | void MultiauthConfig::readConfig() | ||
229 | { | ||
230 | // pointer, so we release this Config when we want | ||
231 | Config* pcfg = new Config("Security"); | ||
232 | pcfg->setGroup( "Misc" ); | ||
233 | m_generalConfig->onStart->setChecked( pcfg->readBoolEntry( "onStart", false ) ); | ||
234 | m_generalConfig->onResume->setChecked( pcfg->readBoolEntry( "onResume", false ) ); | ||
235 | m_generalConfig->nbSuccessMin->setValue( pcfg->readNumEntry( "nbSuccessMin", 1 ) ); | ||
236 | m_generalConfig->noProtectConfig->setChecked( pcfg->readBoolEntry( "noProtectConfig", true) ); | ||
237 | m_generalConfig->explanScreens->setChecked( pcfg->readBoolEntry( "explanScreens", true ) ); | ||
238 | m_generalConfig->allowBypass->setChecked( pcfg->readBoolEntry( "allowBypass", false ) ); | ||
239 | |||
240 | pcfg->setGroup( "Plugins" ); | ||
241 | m_excludePlugins = pcfg->readListEntry( "ExcludePlugins", ',' ); | ||
242 | m_allPlugins = pcfg->readListEntry( "AllPlugins", ',' ); | ||
243 | |||
244 | /* Login and Sync stuff */ | ||
245 | pcfg->setGroup("Sync"); | ||
246 | int auth_peer = pcfg->readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 | ||
247 | int auth_peer_bits = pcfg->readNumEntry("auth_peer_bits",24); | ||
248 | |||
249 | pcfg->setGroup("SyncMode"); | ||
250 | int mode = pcfg->readNumEntry("Mode",2); // Default to Sharp | ||
251 | switch( mode ) { | ||
252 | case 0x01: | ||
253 | m_syncWidget->syncModeCombo->setCurrentItem( 0 ); | ||
254 | break; | ||
255 | case 0x02: | ||
256 | default: | ||
257 | m_syncWidget->syncModeCombo->setCurrentItem( 1 ); | ||
258 | break; | ||
259 | case 0x04: | ||
260 | m_syncWidget->syncModeCombo->setCurrentItem( 2 ); | ||
261 | break; | ||
262 | } | ||
263 | /* | ||
264 | cfg.setGroup("Remote"); | ||
265 | if ( telnetAvailable() ) | ||
266 | telnet->setChecked(cfg.readEntry("allow_telnet")); | ||
267 | else | ||
268 | telnet->hide(); | ||
269 | |||
270 | if ( sshAvailable() ) | ||
271 | ssh->setChecked(cfg.readEntry("allow_ssh")); | ||
272 | else | ||
273 | ssh->hide(); | ||
274 | */ | ||
275 | |||
276 | // release the Config handler | ||
277 | delete pcfg; | ||
278 | // indeed, selectNet will open the config file... | ||
279 | selectNet(auth_peer,auth_peer_bits,TRUE); | ||
280 | |||
281 | connect( m_syncWidget->syncnet, SIGNAL(textChanged(const QString&)), | ||
282 | this, SLOT(setSyncNet(const QString&))); | ||
283 | |||
284 | |||
285 | |||
286 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; | ||
287 | Config loginCfg(configFile,Config::File); | ||
288 | |||
289 | loginCfg.setGroup("General"); | ||
290 | autoLoginName=loginCfg.readEntry("AutoLogin",""); | ||
291 | |||
292 | if (autoLoginName.stripWhiteSpace().isEmpty()) { | ||
293 | autoLogin=false; | ||
294 | } else { | ||
295 | autoLogin=true; | ||
296 | } | ||
297 | |||
298 | |||
299 | connect(m_loginWidget->autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); | ||
300 | connect(m_loginWidget->userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); | ||
301 | connect(m_syncWidget->restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults())); | ||
302 | connect(m_syncWidget->deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry())); | ||
303 | |||
304 | loadUsers(); | ||
305 | updateGUI(); | ||
306 | |||
307 | } | ||
308 | |||
309 | void MultiauthConfig::writeConfig() | ||
310 | { | ||
311 | Config* pcfg = new Config("Security"); | ||
312 | pcfg->setGroup( "Plugins" ); | ||
313 | QStringList exclude; | ||
314 | QStringList include; | ||
315 | QStringList allPlugins; | ||
316 | |||
317 | QListViewItemIterator list_it( m_pluginListView ); | ||
318 | |||
319 | // this makes sure the names get saved in the order selected | ||
320 | for ( ; list_it.current(); ++list_it ) { | ||
321 | QMap <QString, QCheckListItem *>::Iterator it; | ||
322 | for ( it = m_plugins.begin(); it != m_plugins. end (); ++it ) { | ||
323 | if ( list_it.current() == (*it) && !(*it)-> isOn () ) { | ||
324 | exclude << it.key(); | ||
325 | } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ | ||
326 | include << it.key(); | ||
327 | } | ||
328 | if ( list_it.current() == (*it) ) { | ||
329 | allPlugins << it.key(); | ||
330 | } | ||
331 | } | ||
332 | } | ||
333 | pcfg->writeEntry( "ExcludePlugins", exclude, ',' ); | ||
334 | pcfg->writeEntry( "IncludePlugins", include, ',' ); | ||
335 | pcfg->writeEntry( "AllPlugins", allPlugins, ',' ); | ||
336 | |||
337 | pcfg->setGroup( "Misc" ); | ||
338 | pcfg->writeEntry( "onStart", m_generalConfig->onStart->isChecked() ); | ||
339 | pcfg->writeEntry( "onResume", m_generalConfig->onResume->isChecked() ); | ||
340 | pcfg->writeEntry( "nbSuccessMin", m_generalConfig->nbSuccessMin->text() ); | ||
341 | pcfg->writeEntry( "noProtectConfig", m_generalConfig->noProtectConfig->isChecked() ); | ||
342 | pcfg->writeEntry( "explanScreens", m_generalConfig->explanScreens->isChecked() ); | ||
343 | pcfg->writeEntry( "allowBypass", m_generalConfig->allowBypass->isChecked() ); | ||
344 | |||
345 | /* Login and Sync stuff */ | ||
346 | |||
347 | pcfg->setGroup("Sync"); | ||
348 | int auth_peer=0; | ||
349 | int auth_peer_bits; | ||
350 | QString sn = m_syncWidget->syncnet->currentText(); | ||
351 | parseNet(sn,auth_peer,auth_peer_bits); | ||
352 | |||
353 | //this is the *selected* (active) net range | ||
354 | pcfg->writeEntry("auth_peer",auth_peer); | ||
355 | pcfg->writeEntry("auth_peer_bits",auth_peer_bits); | ||
356 | |||
357 | //write back all other net ranges in *cleartext* | ||
358 | for (int i=0; i<10; i++) { | ||
359 | QString target; | ||
360 | target.sprintf("net%d", i); | ||
361 | pcfg->writeEntry(target,m_syncWidget->syncnet->text(i)); | ||
362 | } | ||
363 | |||
364 | #ifdef ODP | ||
365 | #error "Use 0,1,2 and use Launcher" | ||
366 | #endif | ||
367 | /* keep the old code so we don't use currentItem directly */ | ||
368 | int value = 0x02; | ||
369 | switch( m_syncWidget->syncModeCombo->currentItem() ) { | ||
370 | case 0: | ||
371 | value = 0x01; | ||
372 | break; | ||
373 | case 1: | ||
374 | value = 0x02; | ||
375 | break; | ||
376 | case 2: | ||
377 | value = 0x04; | ||
378 | break; | ||
379 | } | ||
380 | pcfg->setGroup("SyncMode"); | ||
381 | pcfg->writeEntry( "Mode", value ); | ||
382 | |||
383 | /* | ||
384 | pcfg->setGroup("Remote"); | ||
385 | if ( telnetAvailable() ) | ||
386 | pcfg->writeEntry("allow_telnet",telnet->isChecked()); | ||
387 | if ( sshAvailable() ) | ||
388 | pcfg->writeEntry("allow_ssh",ssh->isChecked()); | ||
389 | // ### write ssh/telnet sys config files | ||
390 | */ | ||
391 | |||
392 | //release the Config handler | ||
393 | delete pcfg; | ||
394 | |||
395 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; | ||
396 | Config loginCfg(configFile,Config::File); | ||
397 | loginCfg.setGroup("General"); | ||
398 | |||
399 | if (autoLogin) { | ||
400 | loginCfg.writeEntry("AutoLogin",autoLoginName); | ||
401 | } else { | ||
402 | loginCfg.removeEntry("AutoLogin"); | ||
403 | } | ||
404 | |||
405 | } | ||
406 | |||
407 | /// slot used to record the fact plugins order has been modified | ||
408 | void MultiauthConfig::pluginsChanged() { | ||
409 | m_plugins_changed = true; | ||
410 | } | ||
411 | |||
412 | /// loads each multiauth plugin | ||
413 | void MultiauthConfig::loadPlugins() { | ||
414 | |||
415 | odebug << "loading plugins..." << oendl; | ||
416 | QString path = QPEApplication::qpeDir() + "/plugins/security"; | ||
417 | QDir dir( path, "lib*.so" ); | ||
418 | |||
419 | QStringList list = dir.entryList(); | ||
420 | QStringList::Iterator it; | ||
421 | |||
422 | // temporary list used to sort plugins | ||
423 | QMap<QString, MultiauthPlugin> sortList; | ||
424 | |||
425 | for ( it = list.begin(); it != list.end(); ++it ) { | ||
426 | QInterfacePtr<MultiauthPluginInterface> iface; | ||
427 | QLibrary *lib = new QLibrary( path + "/" + *it ); | ||
428 | QString libPath(path + "/" + *it); | ||
429 | odebug << "library path: " << libPath << oendl; | ||
430 | |||
431 | odebug << "querying: " << QString( path + "/" + *it ) << oendl; | ||
432 | if ( lib->queryInterface( IID_MultiauthPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | ||
433 | odebug << "accepted: " << QString( path + "/" + *it ) << oendl; | ||
434 | |||
435 | MultiauthPlugin plugin; | ||
436 | plugin.library = lib; | ||
437 | plugin.iface = iface; | ||
438 | plugin.name = QString(*it); | ||
439 | |||
440 | // find out if plugins should be launched | ||
441 | if ( m_excludePlugins.grep( *it ).isEmpty() ) { | ||
442 | plugin.active = true; | ||
443 | } else { | ||
444 | plugin.active = false; | ||
445 | } | ||
446 | |||
447 | plugin.pluginObject = plugin.iface->plugin(); | ||
448 | |||
449 | // "prebuffer" it in one more list, to get the sorting done | ||
450 | sortList.insert( plugin.name, plugin ); | ||
451 | |||
452 | // on first start the list is off course empty | ||
453 | if ( m_allPlugins.isEmpty() ) { | ||
454 | pluginList.append( plugin ); | ||
455 | } | ||
456 | // if plugin is not yet in the list, add it to the layout too | ||
457 | else if ( !m_allPlugins.contains( plugin.name ) ) { | ||
458 | pluginList.append( plugin ); | ||
459 | } | ||
460 | |||
461 | } else { | ||
462 | odebug << "could not recognize " << QString( path + "/" + *it ) << oendl; | ||
463 | delete lib; | ||
464 | } | ||
465 | |||
466 | } // end for | ||
467 | |||
468 | // put m_allPlugins tempPlugin objects into pluginList | ||
469 | if ( !m_allPlugins.isEmpty() ) { | ||
470 | MultiauthPlugin tempPlugin; | ||
471 | QStringList::Iterator stringit; | ||
472 | for( stringit = m_allPlugins.begin(); stringit != m_allPlugins.end(); ++stringit ) { | ||
473 | tempPlugin = ( sortList.find( *stringit ) ).data(); | ||
474 | if ( !( (tempPlugin.name).isEmpty() ) ) { | ||
475 | pluginList.append( tempPlugin ); | ||
476 | } | ||
477 | } | ||
478 | } | ||
479 | |||
480 | } | ||
481 | |||
482 | void MultiauthConfig::deleteListEntry() | ||
483 | { | ||
484 | m_syncWidget->syncnet->removeItem(m_syncWidget->syncnet->currentItem()); | ||
485 | } | ||
486 | |||
487 | void MultiauthConfig::restoreDefaults() | ||
488 | { | ||
489 | QMessageBox unrecbox( | ||
490 | tr("Attention"), | ||
491 | tr( "<p>All user-defined net ranges will be lost."), | ||
492 | QMessageBox::Warning, | ||
493 | QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, | ||
494 | 0, QString::null, TRUE, WStyle_StaysOnTop); | ||
495 | unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel")); | ||
496 | unrecbox.setButtonText(QMessageBox::Yes, tr("Ok")); | ||
497 | |||
498 | if ( unrecbox.exec() == QMessageBox::Yes) | ||
499 | { | ||
500 | m_syncWidget->syncnet->clear(); | ||
501 | insertDefaultRanges(); | ||
502 | } | ||
503 | m_syncWidget->syncModeCombo->setCurrentItem( 2 ); | ||
504 | } | ||
505 | |||
506 | void MultiauthConfig::insertDefaultRanges() | ||
507 | { | ||
508 | m_syncWidget->syncnet->insertItem( tr( "192.168.129.0/24" ) ); | ||
509 | m_syncWidget->syncnet->insertItem( tr( "192.168.1.0/24" ) ); | ||
510 | m_syncWidget->syncnet->insertItem( tr( "192.168.0.0/16" ) ); | ||
511 | m_syncWidget->syncnet->insertItem( tr( "172.16.0.0/12" ) ); | ||
512 | m_syncWidget->syncnet->insertItem( tr( "10.0.0.0/8" ) ); | ||
513 | m_syncWidget->syncnet->insertItem( tr( "1.0.0.0/8" ) ); | ||
514 | m_syncWidget->syncnet->insertItem( tr( "Any" ) ); | ||
515 | m_syncWidget->syncnet->insertItem( tr( "None" ) ); | ||
516 | } | ||
517 | |||
518 | void MultiauthConfig::updateGUI() | ||
519 | { | ||
520 | m_loginWidget->autologinToggle->setChecked(autoLogin); | ||
521 | m_loginWidget->userlist->setEnabled(autoLogin); | ||
522 | } | ||
523 | |||
524 | void MultiauthConfig::selectNet(int auth_peer,int auth_peer_bits, bool update) | ||
525 | { | ||
526 | QString sn; | ||
527 | if ( auth_peer_bits == 0 && auth_peer == 0 ) { | ||
528 | sn = tr("Any"); | ||
529 | } else if ( auth_peer_bits == 32 && auth_peer == 0 ) { | ||
530 | sn = tr("None"); | ||
531 | } else { | ||
532 | sn = | ||
533 | QString::number((auth_peer>>24)&0xff) + "." | ||
534 | + QString::number((auth_peer>>16)&0xff) + "." | ||
535 | + QString::number((auth_peer>>8)&0xff) + "." | ||
536 | + QString::number((auth_peer>>0)&0xff) + "/" | ||
537 | + QString::number(auth_peer_bits); | ||
538 | } | ||
539 | |||
540 | //insert user-defined list of netranges upon start | ||
541 | if (update) { | ||
542 | //User selected/active netrange first | ||
543 | m_syncWidget->syncnet->insertItem( tr(sn) ); | ||
544 | Config cfg("Security"); | ||
545 | cfg.setGroup("Sync"); | ||
546 | |||
547 | //set up defaults if needed, if someone manually deletes net0 he'll get a suprise hehe | ||
548 | QString test = cfg.readEntry("net0",""); | ||
549 | if (test.isEmpty()) { | ||
550 | insertDefaultRanges(); | ||
551 | } else { | ||
552 | // 10 ought to be enough for everybody... :) | ||
553 | // If you need more, don't forget to edit applySecurity() as well | ||
554 | bool already_there=FALSE; | ||
555 | for (int i=0; i<10; i++) { | ||
556 | QString target, netrange; | ||
557 | target.sprintf("net%d", i); | ||
558 | netrange = cfg.readEntry(target,""); | ||
559 | if (! netrange.isEmpty()){ | ||
560 | //make sure we have no "twin" entries | ||
561 | for (int i=0; i<m_syncWidget->syncnet->count(); i++) { | ||
562 | if ( m_syncWidget->syncnet->text(i) == netrange ) { | ||
563 | already_there=TRUE; | ||
564 | } | ||
565 | } | ||
566 | if (! already_there) { | ||
567 | m_syncWidget->syncnet->insertItem( tr( netrange ) ); | ||
568 | } else { | ||
569 | already_there=FALSE; | ||
570 | } | ||
571 | } | ||
572 | } | ||
573 | } | ||
574 | } | ||
575 | |||
576 | for (int i=0; i<m_syncWidget->syncnet->count(); i++) { | ||
577 | if ( m_syncWidget->syncnet->text(i).left(sn.length()) == sn ) { | ||
578 | m_syncWidget->syncnet->setCurrentItem(i); | ||
579 | return; | ||
580 | } | ||
581 | } | ||
582 | odebug << "No match for \"" << sn << "\"" << oendl; | ||
583 | } | ||
584 | |||
585 | void MultiauthConfig::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits) | ||
586 | { | ||
587 | auth_peer=0; | ||
588 | if ( sn == tr("Any") ) { | ||
589 | auth_peer = 0; | ||
590 | auth_peer_bits = 0; | ||
591 | } else if ( sn == tr("None") ) { | ||
592 | auth_peer = 0; | ||
593 | auth_peer_bits = 32; | ||
594 | } else { | ||
595 | int x=0; | ||
596 | for (int i=0; i<4; i++) { | ||
597 | int nx = sn.find(QChar(i==3 ? '/' : '.'),x); | ||
598 | auth_peer = (auth_peer<<8)|sn.mid(x,nx-x).toInt(); | ||
599 | x = nx+1; | ||
600 | } | ||
601 | uint n = (uint)sn.find(' ',x)-x; | ||
602 | auth_peer_bits = sn.mid(x,n).toInt(); | ||
603 | } | ||
604 | } | ||
605 | |||
606 | void MultiauthConfig::loadUsers() | ||
607 | { | ||
608 | QFile passwd("/etc/passwd"); | ||
609 | if ( passwd.open(IO_ReadOnly) ) { | ||
610 | QTextStream t( &passwd ); | ||
611 | QString s; | ||
612 | QStringList account; | ||
613 | while ( !t.eof() ) { | ||
614 | account = QStringList::split(':',t.readLine()); | ||
615 | // Hide disabled accounts and some special accounts | ||
616 | if (*account.at(1)!="*" && *account.at(0)!="ppp" && *account.at(0)!="messagebus") { | ||
617 | |||
618 | m_loginWidget->userlist->insertItem(*account.at(0)); | ||
619 | // Highlight this item if it is set to m_loginWidget->autologinToggle | ||
620 | if ( *account.at(0) == autoLoginName) | ||
621 | m_loginWidget->userlist->setCurrentItem(m_loginWidget->userlist->count()-1); | ||
622 | } | ||
623 | } | ||
624 | passwd.close(); | ||
625 | } | ||
626 | |||
627 | } | ||
628 | |||
629 | void MultiauthConfig::toggleAutoLogin(bool val) | ||
630 | { | ||
631 | autoLogin=val; | ||
632 | m_loginWidget->userlist->setEnabled(val); | ||
633 | // if autoLogin is true, we will set by default the login currently visible in the userlist | ||
634 | if (autoLogin) | ||
635 | autoLoginName=m_loginWidget->userlist->currentText(); | ||
636 | } | ||
637 | |||
638 | |||
639 | |||
640 | |||
641 | void MultiauthConfig::setSyncNet(const QString& sn) | ||
642 | { | ||
643 | int auth_peer,auth_peer_bits; | ||
644 | parseNet(sn,auth_peer,auth_peer_bits); | ||
645 | selectNet(auth_peer,auth_peer_bits,FALSE); | ||
646 | } | ||
647 | |||
648 | void MultiauthConfig::changeLoginName( int idx ) | ||
649 | { | ||
650 | autoLoginName = m_loginWidget->userlist->text(idx);; | ||
651 | updateGUI(); | ||
652 | } | ||
653 | |||
654 | /// \todo do implement that? who? how? | ||
655 | bool MultiauthConfig::telnetAvailable() const | ||
656 | { | ||
657 | return FALSE; | ||
658 | } | ||
659 | |||
660 | /// \todo do implement that? who? how? | ||
661 | bool MultiauthConfig::sshAvailable() const | ||
662 | { | ||
663 | return FALSE; | ||
664 | } | ||
665 | |||
diff --git a/core/settings/security/multiauthconfig.h b/core/settings/security/multiauthconfig.h new file mode 100644 index 0000000..ffe920f --- a/dev/null +++ b/core/settings/security/multiauthconfig.h | |||
@@ -0,0 +1,141 @@ | |||
1 | /** | ||
2 | * \file multiauthconfig.h | ||
3 | * \brief Configuration GUI for Opie multiauth. framework, login and sync | ||
4 | * \author Clément Séveillac (clement . seveillac (at) via . ecp . fr) | ||
5 | */ | ||
6 | /* | ||
7 | =. This file is part of the Opie Project | ||
8 | .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org> | ||
9 | .>+-= | ||
10 | _;:, .> :=|. This library is free software; you can | ||
11 | .> <`_, > . <= redistribute it and/or modify it under | ||
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
13 | .="- .-=="i, .._ License as published by the Free Software | ||
14 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
15 | ._= =} : or (at your option) any later version. | ||
16 | .%`+i> _;_. | ||
17 | .i_,=:_. -<s. This library is distributed in the hope that | ||
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
19 | : .. .:, . . . without even the implied warranty of | ||
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
22 | ..}^=.= = ; Library General Public License for more | ||
23 | ++= -. .` .: details. | ||
24 | : = ...= . :.=- | ||
25 | -. .:....=;==+<; You should have received a copy of the GNU | ||
26 | -_. . . )=. = Library General Public License along with | ||
27 | -- :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
30 | Boston, MA 02111-1307, USA. | ||
31 | |||
32 | */ | ||
33 | |||
34 | #ifndef MULTIAUTHCONFIG_H | ||
35 | #define MULTIAUTHCONFIG_H | ||
36 | |||
37 | #include <opie2/multiauthplugininterface.h> | ||
38 | #include <opie2/multiauthcommon.h> | ||
39 | |||
40 | /* OPIE */ | ||
41 | #include <opie2/otabwidget.h> | ||
42 | |||
43 | /* QT */ | ||
44 | #include <qdialog.h> | ||
45 | #include <qwidget.h> | ||
46 | #include <qcheckbox.h> | ||
47 | #include <qspinbox.h> | ||
48 | #include <qpe/config.h> | ||
49 | #include <qlistview.h> | ||
50 | #include <qmap.h> | ||
51 | #include <qcombobox.h> | ||
52 | #include <qpushbutton.h> | ||
53 | #include <qmessagebox.h> | ||
54 | #include <qtextstream.h> | ||
55 | |||
56 | /* UI */ | ||
57 | #include "syncbase.h" | ||
58 | #include "loginbase.h" | ||
59 | |||
60 | |||
61 | /// the "misc" configuration tab, about general Opie Multiauth settings | ||
62 | class MultiauthGeneralConfig : public QWidget | ||
63 | { | ||
64 | Q_OBJECT | ||
65 | public: | ||
66 | MultiauthGeneralConfig(QWidget * parent, const char * name); | ||
67 | ~MultiauthGeneralConfig(); | ||
68 | protected: | ||
69 | QCheckBox *onStart, *onResume, *noProtectConfig, *explanScreens, *allowBypass; | ||
70 | QSpinBox *nbSuccessMin; | ||
71 | private: | ||
72 | friend class MultiauthConfig; | ||
73 | private slots: | ||
74 | void checkBypass(); | ||
75 | void checkScreens(); | ||
76 | }; | ||
77 | |||
78 | /// the whole configuration dialog | ||
79 | class MultiauthConfig : public QDialog | ||
80 | { | ||
81 | Q_OBJECT | ||
82 | |||
83 | public: | ||
84 | MultiauthConfig(); | ||
85 | virtual ~MultiauthConfig(); | ||
86 | void writeConfig(); | ||
87 | QList<Opie::Security::MultiauthConfigWidget> configWidgetList; | ||
88 | |||
89 | protected slots: | ||
90 | void pluginsChanged(); | ||
91 | void moveSelectedUp(); | ||
92 | void moveSelectedDown(); | ||
93 | |||
94 | private slots: | ||
95 | // Login and Sync stuff | ||
96 | void setSyncNet(const QString&); | ||
97 | void changeLoginName(int); | ||
98 | void toggleAutoLogin(bool); | ||
99 | void restoreDefaults(); | ||
100 | void insertDefaultRanges(); | ||
101 | void deleteListEntry(); | ||
102 | |||
103 | private: | ||
104 | /// the widget holding all the tabs (or pages) | ||
105 | Opie::Ui::OTabWidget *m_mainTW; | ||
106 | /// list of authentication plugins in the "Plugins" page | ||
107 | QListView *m_pluginListView; | ||
108 | QStringList m_allPlugins, m_excludePlugins; | ||
109 | QMap<QString,QCheckListItem*> m_plugins; | ||
110 | /// plugin list page | ||
111 | QWidget *m_pluginListWidget; | ||
112 | /// misc config page | ||
113 | MultiauthGeneralConfig *m_generalConfig; | ||
114 | /// login (root / ...) choice page | ||
115 | LoginBase *m_loginWidget; | ||
116 | /// synchronization settings page | ||
117 | SyncBase *m_syncWidget; | ||
118 | |||
119 | int m_nbSuccessReq; | ||
120 | bool m_plugins_changed; | ||
121 | |||
122 | void readConfig(); | ||
123 | void loadPlugins(); | ||
124 | |||
125 | // Login and Sync stuff | ||
126 | void loadUsers(); | ||
127 | bool telnetAvailable() const; | ||
128 | bool sshAvailable() const; | ||
129 | void updateGUI(); | ||
130 | |||
131 | static void parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits); | ||
132 | void selectNet(int auth_peer,int auth_peer_bits,bool update); | ||
133 | |||
134 | |||
135 | bool autoLogin; | ||
136 | QString autoLoginName; | ||
137 | }; | ||
138 | |||
139 | |||
140 | #endif // MULTIAUTHCONFIG_H | ||
141 | |||
diff --git a/core/settings/security/opie-security.control b/core/settings/security/opie-security.control index a3e0c20..76e98d5 100644 --- a/core/settings/security/opie-security.control +++ b/core/settings/security/opie-security.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Package: opie-security | 1 | Package: opie-security |
2 | Files: plugins/application/libsecurity.so* bin/security apps/Settings/security.desktop pics/security | 2 | Files: bin/security apps/Settings/security.desktop pics/security/sync.png pics/security/users.png pics/security/Security.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: Opie Team <opie@handhelds.org> | 5 | Maintainer: Opie Team <opie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal |
8 | Description: Security settings dialog for the Opie environment. | 8 | Description: Security settings dialog for the Opie environment. |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/core/settings/security/security.pro b/core/settings/security/security.pro index fca37ad..5d2ae08 100644 --- a/core/settings/security/security.pro +++ b/core/settings/security/security.pro | |||
@@ -1,10 +1,16 @@ | |||
1 | CONFIG += qt warn_on quick-app | 1 | CONFIG += qt warn_on |
2 | HEADERS = security.h | 2 | |
3 | SOURCES = security.cpp main.cpp | 3 | HEADERS = multiauthconfig.h |
4 | INTERFACES = securitybase.ui | 4 | |
5 | INCLUDEPATH += $(OPIEDIR)/include | 5 | SOURCES = multiauthconfig.cpp main.cpp |
6 | DEPENDPATH += | 6 | |
7 | LIBS += -lqpe -lopiecore2 | 7 | INTERFACES= loginbase.ui syncbase.ui |
8 | TARGET = security | 8 | |
9 | INCLUDEPATH += $(OPIEDIR)/include | ||
10 | |||
11 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiesecurity2 | ||
12 | |||
13 | DESTDIR = $(OPIEDIR)/bin | ||
14 | TARGET = security | ||
9 | 15 | ||
10 | include ( $(OPIEDIR)/include.pro ) | 16 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/settings/security/securitybase.ui b/core/settings/security/securitybase.ui deleted file mode 100644 index dcf1d6b..0000000 --- a/core/settings/security/securitybase.ui +++ b/dev/null | |||
@@ -1,504 +0,0 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>SecurityBase</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>SecurityBase</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>327</width> | ||
15 | <height>483</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Security Settings</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>0</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>0</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QTabWidget</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>TabWidget2</cstring> | ||
42 | </property> | ||
43 | <property> | ||
44 | <name>layoutMargin</name> | ||
45 | </property> | ||
46 | <widget> | ||
47 | <class>QWidget</class> | ||
48 | <property stdset="1"> | ||
49 | <name>name</name> | ||
50 | <cstring>tab</cstring> | ||
51 | </property> | ||
52 | <attribute> | ||
53 | <name>title</name> | ||
54 | <string>Passcode</string> | ||
55 | </attribute> | ||
56 | <vbox> | ||
57 | <property stdset="1"> | ||
58 | <name>margin</name> | ||
59 | <number>6</number> | ||
60 | </property> | ||
61 | <property stdset="1"> | ||
62 | <name>spacing</name> | ||
63 | <number>6</number> | ||
64 | </property> | ||
65 | <widget> | ||
66 | <class>QGroupBox</class> | ||
67 | <property stdset="1"> | ||
68 | <name>name</name> | ||
69 | <cstring>GroupBox4</cstring> | ||
70 | </property> | ||
71 | <property stdset="1"> | ||
72 | <name>title</name> | ||
73 | <string>Passcode</string> | ||
74 | </property> | ||
75 | <vbox> | ||
76 | <property stdset="1"> | ||
77 | <name>margin</name> | ||
78 | <number>11</number> | ||
79 | </property> | ||
80 | <property stdset="1"> | ||
81 | <name>spacing</name> | ||
82 | <number>6</number> | ||
83 | </property> | ||
84 | <widget> | ||
85 | <class>QLayoutWidget</class> | ||
86 | <property stdset="1"> | ||
87 | <name>name</name> | ||
88 | <cstring>Layout1</cstring> | ||
89 | </property> | ||
90 | <property> | ||
91 | <name>layoutSpacing</name> | ||
92 | </property> | ||
93 | <hbox> | ||
94 | <property stdset="1"> | ||
95 | <name>margin</name> | ||
96 | <number>0</number> | ||
97 | </property> | ||
98 | <property stdset="1"> | ||
99 | <name>spacing</name> | ||
100 | <number>-1</number> | ||
101 | </property> | ||
102 | <widget> | ||
103 | <class>QPushButton</class> | ||
104 | <property stdset="1"> | ||
105 | <name>name</name> | ||
106 | <cstring>changepasscode</cstring> | ||
107 | </property> | ||
108 | <property stdset="1"> | ||
109 | <name>text</name> | ||
110 | <string>Change passcode</string> | ||
111 | </property> | ||
112 | <property> | ||
113 | <name>whatsThis</name> | ||
114 | <string>This button will let you change the security passcode. | ||
115 | |||
116 | Note: This is *not* the sync password.</string> | ||
117 | </property> | ||
118 | </widget> | ||
119 | <widget> | ||
120 | <class>QPushButton</class> | ||
121 | <property stdset="1"> | ||
122 | <name>name</name> | ||
123 | <cstring>clearpasscode</cstring> | ||
124 | </property> | ||
125 | <property stdset="1"> | ||
126 | <name>text</name> | ||
127 | <string>Clear passcode</string> | ||
128 | </property> | ||
129 | <property> | ||
130 | <name>whatsThis</name> | ||
131 | <string>Delete the current passcode. | ||
132 | You can enter a new one at any time.</string> | ||
133 | </property> | ||
134 | </widget> | ||
135 | </hbox> | ||
136 | </widget> | ||
137 | <widget> | ||
138 | <class>QCheckBox</class> | ||
139 | <property stdset="1"> | ||
140 | <name>name</name> | ||
141 | <cstring>passcode_poweron</cstring> | ||
142 | </property> | ||
143 | <property stdset="1"> | ||
144 | <name>text</name> | ||
145 | <string>Require pass code at power-on</string> | ||
146 | </property> | ||
147 | <property> | ||
148 | <name>whatsThis</name> | ||
149 | <string>If you enable this option, a passcode must be entered after every resume event of your Zaurus.</string> | ||
150 | </property> | ||
151 | </widget> | ||
152 | <widget> | ||
153 | <class>QLabel</class> | ||
154 | <property stdset="1"> | ||
155 | <name>name</name> | ||
156 | <cstring>TextLabel1</cstring> | ||
157 | </property> | ||
158 | <property stdset="1"> | ||
159 | <name>sizePolicy</name> | ||
160 | <sizepolicy> | ||
161 | <hsizetype>5</hsizetype> | ||
162 | <vsizetype>7</vsizetype> | ||
163 | </sizepolicy> | ||
164 | </property> | ||
165 | <property stdset="1"> | ||
166 | <name>text</name> | ||
167 | <string><P>Pass code protection provides a minimal level of protection from casual access to this device.</string> | ||
168 | </property> | ||
169 | <property stdset="1"> | ||
170 | <name>textFormat</name> | ||
171 | <enum>RichText</enum> | ||
172 | </property> | ||
173 | <property stdset="1"> | ||
174 | <name>alignment</name> | ||
175 | <set>AlignTop|AlignLeft</set> | ||
176 | </property> | ||
177 | <property> | ||
178 | <name>vAlign</name> | ||
179 | </property> | ||
180 | </widget> | ||
181 | </vbox> | ||
182 | </widget> | ||
183 | <spacer> | ||
184 | <property> | ||
185 | <name>name</name> | ||
186 | <cstring>Spacer3</cstring> | ||
187 | </property> | ||
188 | <property stdset="1"> | ||
189 | <name>orientation</name> | ||
190 | <enum>Vertical</enum> | ||
191 | </property> | ||
192 | <property stdset="1"> | ||
193 | <name>sizeType</name> | ||
194 | <enum>Expanding</enum> | ||
195 | </property> | ||
196 | <property> | ||
197 | <name>sizeHint</name> | ||
198 | <size> | ||
199 | <width>20</width> | ||
200 | <height>20</height> | ||
201 | </size> | ||
202 | </property> | ||
203 | </spacer> | ||
204 | </vbox> | ||
205 | </widget> | ||
206 | <widget> | ||
207 | <class>QWidget</class> | ||
208 | <property stdset="1"> | ||
209 | <name>name</name> | ||
210 | <cstring>tab</cstring> | ||
211 | </property> | ||
212 | <attribute> | ||
213 | <name>title</name> | ||
214 | <string>Login</string> | ||
215 | </attribute> | ||
216 | <vbox> | ||
217 | <property stdset="1"> | ||
218 | <name>margin</name> | ||
219 | <number>6</number> | ||
220 | </property> | ||
221 | <property stdset="1"> | ||
222 | <name>spacing</name> | ||
223 | <number>6</number> | ||
224 | </property> | ||
225 | <widget> | ||
226 | <class>QGroupBox</class> | ||
227 | <property stdset="1"> | ||
228 | <name>name</name> | ||
229 | <cstring>GroupBox3</cstring> | ||
230 | </property> | ||
231 | <property stdset="1"> | ||
232 | <name>title</name> | ||
233 | <string>Login</string> | ||
234 | </property> | ||
235 | <vbox> | ||
236 | <property stdset="1"> | ||
237 | <name>margin</name> | ||
238 | <number>11</number> | ||
239 | </property> | ||
240 | <property stdset="1"> | ||
241 | <name>spacing</name> | ||
242 | <number>6</number> | ||
243 | </property> | ||
244 | <widget> | ||
245 | <class>QCheckBox</class> | ||
246 | <property stdset="1"> | ||
247 | <name>name</name> | ||
248 | <cstring>autologinToggle</cstring> | ||
249 | </property> | ||
250 | <property stdset="1"> | ||
251 | <name>text</name> | ||
252 | <string>Login Automatically</string> | ||
253 | </property> | ||
254 | <property> | ||
255 | <name>whatsThis</name> | ||
256 | <string>If you select this option, opie-login will automagically log you in with the user you have selected in the drop-down list. | ||
257 | |||
258 | For the Zaurus 5x00 this is always the user "root".</string> | ||
259 | </property> | ||
260 | </widget> | ||
261 | <widget> | ||
262 | <class>QComboBox</class> | ||
263 | <property stdset="1"> | ||
264 | <name>name</name> | ||
265 | <cstring>userlist</cstring> | ||
266 | </property> | ||
267 | <property> | ||
268 | <name>whatsThis</name> | ||
269 | <string>This drop-down list allows you to select the user for auto-login | ||
270 | (if enabled above). | ||
271 | |||
272 | You can only select an actually configured user.</string> | ||
273 | </property> | ||
274 | </widget> | ||
275 | </vbox> | ||
276 | </widget> | ||
277 | <spacer> | ||
278 | <property> | ||
279 | <name>name</name> | ||
280 | <cstring>Spacer2</cstring> | ||
281 | </property> | ||
282 | <property stdset="1"> | ||
283 | <name>orientation</name> | ||
284 | <enum>Vertical</enum> | ||
285 | </property> | ||
286 | <property stdset="1"> | ||
287 | <name>sizeType</name> | ||
288 | <enum>Expanding</enum> | ||
289 | </property> | ||
290 | <property> | ||
291 | <name>sizeHint</name> | ||
292 | <size> | ||
293 | <width>20</width> | ||
294 | <height>20</height> | ||
295 | </size> | ||
296 | </property> | ||
297 | </spacer> | ||
298 | </vbox> | ||
299 | </widget> | ||
300 | <widget> | ||
301 | <class>QWidget</class> | ||
302 | <property stdset="1"> | ||
303 | <name>name</name> | ||
304 | <cstring>tab</cstring> | ||
305 | </property> | ||
306 | <attribute> | ||
307 | <name>title</name> | ||
308 | <string>Sync</string> | ||
309 | </attribute> | ||
310 | <grid> | ||
311 | <property stdset="1"> | ||
312 | <name>margin</name> | ||
313 | <number>11</number> | ||
314 | </property> | ||
315 | <property stdset="1"> | ||
316 | <name>spacing</name> | ||
317 | <number>6</number> | ||
318 | </property> | ||
319 | <spacer row="1" column="0" > | ||
320 | <property> | ||
321 | <name>name</name> | ||
322 | <cstring>Spacer1</cstring> | ||
323 | </property> | ||
324 | <property stdset="1"> | ||
325 | <name>orientation</name> | ||
326 | <enum>Vertical</enum> | ||
327 | </property> | ||
328 | <property stdset="1"> | ||
329 | <name>sizeType</name> | ||
330 | <enum>Expanding</enum> | ||
331 | </property> | ||
332 | <property> | ||
333 | <name>sizeHint</name> | ||
334 | <size> | ||
335 | <width>20</width> | ||
336 | <height>20</height> | ||
337 | </size> | ||
338 | </property> | ||
339 | </spacer> | ||
340 | <widget row="0" column="0" > | ||
341 | <class>QGroupBox</class> | ||
342 | <property stdset="1"> | ||
343 | <name>name</name> | ||
344 | <cstring>GroupBox2</cstring> | ||
345 | </property> | ||
346 | <property stdset="1"> | ||
347 | <name>title</name> | ||
348 | <string>Sync</string> | ||
349 | </property> | ||
350 | <vbox> | ||
351 | <property stdset="1"> | ||
352 | <name>margin</name> | ||
353 | <number>11</number> | ||
354 | </property> | ||
355 | <property stdset="1"> | ||
356 | <name>spacing</name> | ||
357 | <number>6</number> | ||
358 | </property> | ||
359 | <widget> | ||
360 | <class>QLabel</class> | ||
361 | <property stdset="1"> | ||
362 | <name>name</name> | ||
363 | <cstring>TextLabel1_2</cstring> | ||
364 | </property> | ||
365 | <property stdset="1"> | ||
366 | <name>text</name> | ||
367 | <string>Accept sync from network:</string> | ||
368 | </property> | ||
369 | <property stdset="1"> | ||
370 | <name>textFormat</name> | ||
371 | <enum>RichText</enum> | ||
372 | </property> | ||
373 | </widget> | ||
374 | <widget> | ||
375 | <class>QComboBox</class> | ||
376 | <property stdset="1"> | ||
377 | <name>name</name> | ||
378 | <cstring>syncnet</cstring> | ||
379 | </property> | ||
380 | <property stdset="1"> | ||
381 | <name>editable</name> | ||
382 | <bool>true</bool> | ||
383 | </property> | ||
384 | <property> | ||
385 | <name>whatsThis</name> | ||
386 | <string>Select a net-range or enter a new one. | ||
387 | |||
388 | This drop-down list lets you select a net range which is allowed to connect to your Zaurus. | ||
389 | |||
390 | For example, a net range of 192.168.1.0/24 will allow any machine with an IP between 192.168.1.1 and 192.168.1.254 to connect to (and sync with) your Zaurus. | ||
391 | |||
392 | The entry "All" will allow *any* IP to connect. | ||
393 | The entry "None" will *deny* any connection. | ||
394 | |||
395 | If unsure, select "Any".</string> | ||
396 | </property> | ||
397 | </widget> | ||
398 | <widget> | ||
399 | <class>QLayoutWidget</class> | ||
400 | <property stdset="1"> | ||
401 | <name>name</name> | ||
402 | <cstring>Layout4</cstring> | ||
403 | </property> | ||
404 | <hbox> | ||
405 | <property stdset="1"> | ||
406 | <name>margin</name> | ||
407 | <number>0</number> | ||
408 | </property> | ||
409 | <property stdset="1"> | ||
410 | <name>spacing</name> | ||
411 | <number>6</number> | ||
412 | </property> | ||
413 | <widget> | ||
414 | <class>QPushButton</class> | ||
415 | <property stdset="1"> | ||
416 | <name>name</name> | ||
417 | <cstring>deleteentry</cstring> | ||
418 | </property> | ||
419 | <property stdset="1"> | ||
420 | <name>text</name> | ||
421 | <string>Delete Entry</string> | ||
422 | </property> | ||
423 | <property> | ||
424 | <name>whatsThis</name> | ||
425 | <string>Delete the selected net range from the list | ||
426 | |||
427 | If you press this button, the currently selected net range will be deleted from the list of net ranges. | ||
428 | |||
429 | If you hit this button in error, the button "Restore Defaults" will restore | ||
430 | the list to the state it has been when you initially booted your Zaurus.</string> | ||
431 | </property> | ||
432 | </widget> | ||
433 | <widget> | ||
434 | <class>QPushButton</class> | ||
435 | <property stdset="1"> | ||
436 | <name>name</name> | ||
437 | <cstring>restoredefaults</cstring> | ||
438 | </property> | ||
439 | <property stdset="1"> | ||
440 | <name>text</name> | ||
441 | <string>Restore Defaults</string> | ||
442 | </property> | ||
443 | <property> | ||
444 | <name>whatsThis</name> | ||
445 | <string>This button will restore the list of net ranges | ||
446 | to the defaults. | ||
447 | |||
448 | Beware that all manually entered net ranges will be lost!</string> | ||
449 | </property> | ||
450 | </widget> | ||
451 | </hbox> | ||
452 | </widget> | ||
453 | <widget> | ||
454 | <class>QLabel</class> | ||
455 | <property stdset="1"> | ||
456 | <name>name</name> | ||
457 | <cstring>TextLabel2</cstring> | ||
458 | </property> | ||
459 | <property stdset="1"> | ||
460 | <name>text</name> | ||
461 | <string>Select your sync software</string> | ||
462 | </property> | ||
463 | </widget> | ||
464 | <widget> | ||
465 | <class>QComboBox</class> | ||
466 | <item> | ||
467 | <property> | ||
468 | <name>text</name> | ||
469 | <string>Qtopia 1.7</string> | ||
470 | </property> | ||
471 | </item> | ||
472 | <item> | ||
473 | <property> | ||
474 | <name>text</name> | ||
475 | <string>Opie 1.0</string> | ||
476 | </property> | ||
477 | </item> | ||
478 | <item> | ||
479 | <property> | ||
480 | <name>text</name> | ||
481 | <string>IntelliSync</string> | ||
482 | </property> | ||
483 | </item> | ||
484 | <property stdset="1"> | ||
485 | <name>name</name> | ||
486 | <cstring>syncModeCombo</cstring> | ||
487 | </property> | ||
488 | <property> | ||
489 | <name>whatsThis</name> | ||
490 | <string>Alter the Sync Protocol to tweak for the different devices. | ||
491 | IntelliSync will disable the password check but you'll be prompted to accept the connection. | ||
492 | Opie1.0 will be compatible with QtopiaDesktop, MultiSync and KitchenSync | ||
493 | Qtopia1.7 will alter the way data is send to the client and will not work with older clients. | ||
494 | </string> | ||
495 | </property> | ||
496 | </widget> | ||
497 | </vbox> | ||
498 | </widget> | ||
499 | </grid> | ||
500 | </widget> | ||
501 | </widget> | ||
502 | </vbox> | ||
503 | </widget> | ||
504 | </UI> | ||
diff --git a/core/settings/security/syncbase.ui b/core/settings/security/syncbase.ui new file mode 100644 index 0000000..194d141 --- a/dev/null +++ b/core/settings/security/syncbase.ui | |||
@@ -0,0 +1,213 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>SyncBase</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>SyncBase</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>303</width> | ||
15 | <height>233</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>SyncBase</string> | ||
21 | </property> | ||
22 | <grid> | ||
23 | <property stdset="1"> | ||
24 | <name>margin</name> | ||
25 | <number>11</number> | ||
26 | </property> | ||
27 | <property stdset="1"> | ||
28 | <name>spacing</name> | ||
29 | <number>6</number> | ||
30 | </property> | ||
31 | <spacer row="1" column="0" > | ||
32 | <property> | ||
33 | <name>name</name> | ||
34 | <cstring>Spacer1</cstring> | ||
35 | </property> | ||
36 | <property stdset="1"> | ||
37 | <name>orientation</name> | ||
38 | <enum>Vertical</enum> | ||
39 | </property> | ||
40 | <property stdset="1"> | ||
41 | <name>sizeType</name> | ||
42 | <enum>Expanding</enum> | ||
43 | </property> | ||
44 | <property> | ||
45 | <name>sizeHint</name> | ||
46 | <size> | ||
47 | <width>20</width> | ||
48 | <height>20</height> | ||
49 | </size> | ||
50 | </property> | ||
51 | </spacer> | ||
52 | <widget row="0" column="0" > | ||
53 | <class>QGroupBox</class> | ||
54 | <property stdset="1"> | ||
55 | <name>name</name> | ||
56 | <cstring>GroupBox2</cstring> | ||
57 | </property> | ||
58 | <property stdset="1"> | ||
59 | <name>title</name> | ||
60 | <string>Sync</string> | ||
61 | </property> | ||
62 | <vbox> | ||
63 | <property stdset="1"> | ||
64 | <name>margin</name> | ||
65 | <number>6</number> | ||
66 | </property> | ||
67 | <property stdset="1"> | ||
68 | <name>spacing</name> | ||
69 | <number>6</number> | ||
70 | </property> | ||
71 | <widget> | ||
72 | <class>QLabel</class> | ||
73 | <property stdset="1"> | ||
74 | <name>name</name> | ||
75 | <cstring>TextLabel1_2</cstring> | ||
76 | </property> | ||
77 | <property stdset="1"> | ||
78 | <name>text</name> | ||
79 | <string>Accept sync from network:</string> | ||
80 | </property> | ||
81 | <property stdset="1"> | ||
82 | <name>textFormat</name> | ||
83 | <enum>RichText</enum> | ||
84 | </property> | ||
85 | </widget> | ||
86 | <widget> | ||
87 | <class>QComboBox</class> | ||
88 | <property stdset="1"> | ||
89 | <name>name</name> | ||
90 | <cstring>syncnet</cstring> | ||
91 | </property> | ||
92 | <property stdset="1"> | ||
93 | <name>editable</name> | ||
94 | <bool>true</bool> | ||
95 | </property> | ||
96 | <property> | ||
97 | <name>whatsThis</name> | ||
98 | <string>Select a net-range or enter a new one. | ||
99 | |||
100 | This drop-down list lets you select a net range which is allowed to connect to your Zaurus. | ||
101 | |||
102 | For example, a net range of 192.168.1.0/24 will allow any machine with an IP between 192.168.1.1 and 192.168.1.254 to connect to (and sync with) your Zaurus. | ||
103 | |||
104 | The entry "All" will allow *any* IP to connect. | ||
105 | The entry "None" will *deny* any connection. | ||
106 | |||
107 | If unsure, select "Any".</string> | ||
108 | </property> | ||
109 | </widget> | ||
110 | <widget> | ||
111 | <class>QLayoutWidget</class> | ||
112 | <property stdset="1"> | ||
113 | <name>name</name> | ||
114 | <cstring>Layout4</cstring> | ||
115 | </property> | ||
116 | <hbox> | ||
117 | <property stdset="1"> | ||
118 | <name>margin</name> | ||
119 | <number>0</number> | ||
120 | </property> | ||
121 | <property stdset="1"> | ||
122 | <name>spacing</name> | ||
123 | <number>6</number> | ||
124 | </property> | ||
125 | <widget> | ||
126 | <class>QPushButton</class> | ||
127 | <property stdset="1"> | ||
128 | <name>name</name> | ||
129 | <cstring>deleteentry</cstring> | ||
130 | </property> | ||
131 | <property stdset="1"> | ||
132 | <name>text</name> | ||
133 | <string>Delete Entry</string> | ||
134 | </property> | ||
135 | <property> | ||
136 | <name>whatsThis</name> | ||
137 | <string>Delete the selected net range from the list | ||
138 | |||
139 | If you press this button, the currently selected net range will be deleted from the list of net ranges. | ||
140 | |||
141 | If you hit this button in error, the button "Restore Defaults" will restore | ||
142 | the list to the state it has been when you initially booted your Zaurus.</string> | ||
143 | </property> | ||
144 | </widget> | ||
145 | <widget> | ||
146 | <class>QPushButton</class> | ||
147 | <property stdset="1"> | ||
148 | <name>name</name> | ||
149 | <cstring>restoredefaults</cstring> | ||
150 | </property> | ||
151 | <property stdset="1"> | ||
152 | <name>text</name> | ||
153 | <string>Restore Defaults</string> | ||
154 | </property> | ||
155 | <property> | ||
156 | <name>whatsThis</name> | ||
157 | <string>This button will restore the list of net ranges | ||
158 | to the defaults. | ||
159 | |||
160 | Beware that all manually entered net ranges will be lost!</string> | ||
161 | </property> | ||
162 | </widget> | ||
163 | </hbox> | ||
164 | </widget> | ||
165 | <widget> | ||
166 | <class>QLabel</class> | ||
167 | <property stdset="1"> | ||
168 | <name>name</name> | ||
169 | <cstring>TextLabel2</cstring> | ||
170 | </property> | ||
171 | <property stdset="1"> | ||
172 | <name>text</name> | ||
173 | <string>Select your sync software</string> | ||
174 | </property> | ||
175 | </widget> | ||
176 | <widget> | ||
177 | <class>QComboBox</class> | ||
178 | <item> | ||
179 | <property> | ||
180 | <name>text</name> | ||
181 | <string>Qtopia 1.7</string> | ||
182 | </property> | ||
183 | </item> | ||
184 | <item> | ||
185 | <property> | ||
186 | <name>text</name> | ||
187 | <string>Opie 1.0</string> | ||
188 | </property> | ||
189 | </item> | ||
190 | <item> | ||
191 | <property> | ||
192 | <name>text</name> | ||
193 | <string>IntelliSync</string> | ||
194 | </property> | ||
195 | </item> | ||
196 | <property stdset="1"> | ||
197 | <name>name</name> | ||
198 | <cstring>syncModeCombo</cstring> | ||
199 | </property> | ||
200 | <property> | ||
201 | <name>whatsThis</name> | ||
202 | <string>Alter the Sync Protocol to tweak for the different devices. | ||
203 | IntelliSync will disable the password check but you'll be prompted to accept the connection. | ||
204 | Opie1.0 will be compatible with QtopiaDesktop, MultiSync and KitchenSync | ||
205 | Qtopia1.7 will alter the way data is send to the client and will not work with older clients. | ||
206 | </string> | ||
207 | </property> | ||
208 | </widget> | ||
209 | </vbox> | ||
210 | </widget> | ||
211 | </grid> | ||
212 | </widget> | ||
213 | </UI> | ||
diff --git a/libopie2/opiesecurity/multiauthmainwindow.cpp b/libopie2/opiesecurity/multiauthmainwindow.cpp index c6229c7..fa247ab 100644 --- a/libopie2/opiesecurity/multiauthmainwindow.cpp +++ b/libopie2/opiesecurity/multiauthmainwindow.cpp | |||
@@ -1,119 +1,119 @@ | |||
1 | #include "multiauthmainwindow.h" | 1 | #include "multiauthmainwindow.h" |
2 | 2 | ||
3 | #include "multiauthcommon.h" | 3 | #include "multiauthcommon.h" |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | 5 | ||
6 | namespace Opie { | 6 | namespace Opie { |
7 | namespace Security { | 7 | namespace Security { |
8 | 8 | ||
9 | /// Initializes widgets according to allowBypass and explanScreens config | 9 | /// Initializes widgets according to allowBypass and explanScreens config |
10 | MultiauthMainWindow::MultiauthMainWindow() | 10 | MultiauthMainWindow::MultiauthMainWindow() |
11 | : QDialog(0, "main Opie multiauth modal dialog", TRUE, | 11 | : QDialog(0, "main Opie multiauth modal dialog", TRUE, |
12 | Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop) | 12 | Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop) |
13 | 13 | ||
14 | { | 14 | { |
15 | alreadyDone = false; | 15 | alreadyDone = false; |
16 | // initializes widget pointers which not always point to an object | 16 | // initializes widget pointers which not always point to an object |
17 | quit = 0; | 17 | quit = 0; |
18 | message2 = 0; | 18 | message2 = 0; |
19 | 19 | ||
20 | Config *pcfg = new Config("Security"); | 20 | Config *pcfg = new Config("Security"); |
21 | pcfg->setGroup("Misc"); | 21 | pcfg->setGroup("Misc"); |
22 | explanScreens = pcfg->readBoolEntry("explanScreens", true); | 22 | explanScreens = pcfg->readBoolEntry("explanScreens", true); |
23 | allowBypass = pcfg->readBoolEntry("allowBypass", true); | 23 | allowBypass = pcfg->readBoolEntry("allowBypass", false); |
24 | delete pcfg; | 24 | delete pcfg; |
25 | 25 | ||
26 | layout = new QVBoxLayout(this); | 26 | layout = new QVBoxLayout(this); |
27 | layout->setSpacing(11); | 27 | layout->setSpacing(11); |
28 | layout->setMargin(11); | 28 | layout->setMargin(11); |
29 | layout->setAlignment( Qt::AlignTop ); | 29 | layout->setAlignment( Qt::AlignTop ); |
30 | 30 | ||
31 | // if explanScreens is false, we don't show any text in the QDialog, | 31 | // if explanScreens is false, we don't show any text in the QDialog, |
32 | // and we proceed directly | 32 | // and we proceed directly |
33 | if ( explanScreens == true ) | 33 | if ( explanScreens == true ) |
34 | { | 34 | { |
35 | title = new QLabel("<center><h1>" + tr("Welcome to Opie Multi-authentication Framework") + "</h1></center>", this); | 35 | title = new QLabel("<center><h1>" + tr("Welcome to Opie Multi-authentication Framework") + "</h1></center>", this); |
36 | message = new QLabel("<center><h3>" + tr("Launching authentication plugins...") + "</h3></center>", this); | 36 | message = new QLabel("<center><h3>" + tr("Launching authentication plugins...") + "</h3></center>", this); |
37 | } else { | 37 | } else { |
38 | title = new QLabel("", this); | 38 | title = new QLabel("", this); |
39 | message = new QLabel("", this); | 39 | message = new QLabel("", this); |
40 | } | 40 | } |
41 | 41 | ||
42 | layout->addWidget(title); | 42 | layout->addWidget(title); |
43 | layout->addWidget(message); | 43 | layout->addWidget(message); |
44 | proceedButton = new QPushButton(tr("Proceed..."), this); | 44 | proceedButton = new QPushButton(tr("Proceed..."), this); |
45 | layout->addWidget(proceedButton, 0, Qt::AlignHCenter); | 45 | layout->addWidget(proceedButton, 0, Qt::AlignHCenter); |
46 | 46 | ||
47 | QObject::connect(proceedButton, SIGNAL(clicked()), this, SLOT(proceed())); | 47 | QObject::connect(proceedButton, SIGNAL(clicked()), this, SLOT(proceed())); |
48 | 48 | ||
49 | if ( explanScreens == true ) | 49 | if ( explanScreens == true ) |
50 | { | 50 | { |
51 | quit = new QPushButton("Exit", this); | 51 | quit = new QPushButton("Exit", this); |
52 | layout->addWidget(quit, 0, Qt::AlignHCenter); | 52 | layout->addWidget(quit, 0, Qt::AlignHCenter); |
53 | if ( allowBypass == true ) | 53 | if ( allowBypass == true ) |
54 | { | 54 | { |
55 | // very important: we can close the widget through the quit button, and bypass authentication, only if allowBypass is set! | 55 | // very important: we can close the widget through the quit button, and bypass authentication, only if allowBypass is set! |
56 | message2 = new QLabel("<center><i>" + tr("Note: the 'exit' button should be removed for real protection, through Security config dialog") + ".</i></center>", this); | 56 | message2 = new QLabel("<center><i>" + tr("Note: the 'exit' button should be removed for real protection, through Security config dialog") + ".</i></center>", this); |
57 | layout->addWidget(message2); | 57 | layout->addWidget(message2); |
58 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); | 58 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); |
59 | } | 59 | } |
60 | else | 60 | else |
61 | { | 61 | { |
62 | quit->hide(); | 62 | quit->hide(); |
63 | } | 63 | } |
64 | 64 | ||
65 | } | 65 | } |
66 | else | 66 | else |
67 | { | 67 | { |
68 | // we will need this button only if runPlugins() fails in proceed() | 68 | // we will need this button only if runPlugins() fails in proceed() |
69 | proceedButton->hide(); | 69 | proceedButton->hide(); |
70 | // let's proceed now | 70 | // let's proceed now |
71 | proceed(); | 71 | proceed(); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | /// nothing to do | 75 | /// nothing to do |
76 | MultiauthMainWindow::~MultiauthMainWindow() { | 76 | MultiauthMainWindow::~MultiauthMainWindow() { |
77 | } | 77 | } |
78 | 78 | ||
79 | /// launch the authentication | 79 | /// launch the authentication |
80 | void MultiauthMainWindow::proceed() { | 80 | void MultiauthMainWindow::proceed() { |
81 | int result = Internal::runPlugins(); | 81 | int result = Internal::runPlugins(); |
82 | 82 | ||
83 | 83 | ||
84 | if ( (result == 0) && !explanScreens ) | 84 | if ( (result == 0) && !explanScreens ) |
85 | { | 85 | { |
86 | // the authentication has succeeded, we can exit directly | 86 | // the authentication has succeeded, we can exit directly |
87 | // this will work if we haven't been called by the constructor of MultiauthMainWindow | 87 | // this will work if we haven't been called by the constructor of MultiauthMainWindow |
88 | close(); | 88 | close(); |
89 | // and if we've been called by this constructor, we use this variable to tell our | 89 | // and if we've been called by this constructor, we use this variable to tell our |
90 | // caller we're already done | 90 | // caller we're already done |
91 | alreadyDone = true; | 91 | alreadyDone = true; |
92 | return; | 92 | return; |
93 | } | 93 | } |
94 | else | 94 | else |
95 | { | 95 | { |
96 | 96 | ||
97 | proceedButton->setText("Another try?"); | 97 | proceedButton->setText("Another try?"); |
98 | QString resultMessage; | 98 | QString resultMessage; |
99 | 99 | ||
100 | if (result == 0) | 100 | if (result == 0) |
101 | { | 101 | { |
102 | // authentication has succeeded, adapt interface then | 102 | // authentication has succeeded, adapt interface then |
103 | message->setText( "<center><h3>" + tr("Congratulations! Your authentication has been successful.") + "</h3></center>" ); | 103 | message->setText( "<center><h3>" + tr("Congratulations! Your authentication has been successful.") + "</h3></center>" ); |
104 | quit->setText("Enter Opie"); | 104 | quit->setText("Enter Opie"); |
105 | if ( quit->isHidden() ) | 105 | if ( quit->isHidden() ) |
106 | { | 106 | { |
107 | // that means we don't allow to bypass, but now we can show and connect this button | 107 | // that means we don't allow to bypass, but now we can show and connect this button |
108 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); | 108 | QObject::connect(quit, SIGNAL(clicked()), this, SLOT(close())); |
109 | quit->show(); | 109 | quit->show(); |
110 | } else { | 110 | } else { |
111 | if ( message2 != 0 ) message2->hide(); | 111 | if ( message2 != 0 ) message2->hide(); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | else | 114 | else |
115 | { | 115 | { |
116 | // authentication has failed, explain that according to allowBypass | 116 | // authentication has failed, explain that according to allowBypass |
117 | message->setText( "<center><h3>" + tr("You have not succeeded enough authentication steps!") + "</h3></center>" ); | 117 | message->setText( "<center><h3>" + tr("You have not succeeded enough authentication steps!") + "</h3></center>" ); |
118 | proceedButton->show(); | 118 | proceedButton->show(); |
119 | if ( allowBypass == true ) | 119 | if ( allowBypass == true ) |