author | zecke <zecke> | 2004-07-19 21:48:29 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-19 21:48:29 (UTC) |
commit | 595d3211a7982471f68bb116fb47cf4c6218d7c1 (patch) (unidiff) | |
tree | 1ed2caebe113c43979f0361c172b6232a46fd823 | |
parent | d2dfe297f99684ad361240ab4f63dfb1ff8850dd (diff) | |
download | opie-595d3211a7982471f68bb116fb47cf4c6218d7c1.zip opie-595d3211a7982471f68bb116fb47cf4c6218d7c1.tar.gz opie-595d3211a7982471f68bb116fb47cf4c6218d7c1.tar.bz2 |
Make it quicklaunchable again
-Do the check if allowed to run in the c'tor of MultiauthConfig
and exit(-1) on failure
-Adopt the .pro to contain CONFIG quick-app again
-main only contains the call to the factory
-rw-r--r-- | core/settings/security/main.cpp | 43 | ||||
-rw-r--r-- | core/settings/security/multiauthconfig.cpp | 50 | ||||
-rw-r--r-- | core/settings/security/multiauthconfig.h | 5 | ||||
-rw-r--r-- | core/settings/security/security.pro | 8 |
4 files changed, 53 insertions, 53 deletions
diff --git a/core/settings/security/main.cpp b/core/settings/security/main.cpp index 7f24490..5ba9869 100644 --- a/core/settings/security/main.cpp +++ b/core/settings/security/main.cpp | |||
@@ -1,44 +1,5 @@ | |||
1 | #include "multiauthconfig.h" | 1 | #include "multiauthconfig.h" |
2 | #include <opie2/oapplication.h> | ||
3 | #include <opie2/odebug.h> | ||
4 | 2 | ||
3 | #include <opie2/oapplicationfactory.h> | ||
5 | 4 | ||
6 | 5 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<MultiauthConfig> ); | |
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 | MultiauthConfig dialog; | ||
25 | app.setMainWidget(&dialog); | ||
26 | |||
27 | if ( dialog.exec() == QDialog::Accepted ) { | ||
28 | // write the general, login and sync config | ||
29 | dialog.writeConfig(); | ||
30 | // call writeConfig() on each plugin config widget | ||
31 | Opie::Security::MultiauthConfigWidget *confWidget; | ||
32 | for ( confWidget = dialog.configWidgetList.first(); confWidget != 0; | ||
33 | confWidget = dialog.configWidgetList.next() ) { | ||
34 | confWidget->writeConfig(); | ||
35 | } | ||
36 | } | ||
37 | dialog.close(); | ||
38 | app.quit(); | ||
39 | return 0; | ||
40 | } else { | ||
41 | owarn << "authentication failed, not showing opie-security" << oendl; | ||
42 | return 1; | ||
43 | } | ||
44 | } | ||
diff --git a/core/settings/security/multiauthconfig.cpp b/core/settings/security/multiauthconfig.cpp index 93e73c3..535352a 100644 --- a/core/settings/security/multiauthconfig.cpp +++ b/core/settings/security/multiauthconfig.cpp | |||
@@ -113,16 +113,42 @@ void MultiauthGeneralConfig::checkBypass() | |||
113 | if ( (allowBypass->isChecked() == true) && (explanScreens->isChecked() == false) ) | 113 | if ( (allowBypass->isChecked() == true) && (explanScreens->isChecked() == false) ) |
114 | allowBypass->setChecked(false); | 114 | allowBypass->setChecked(false); |
115 | } | 115 | } |
116 | 116 | ||
117 | |||
118 | |||
119 | |||
120 | |||
121 | |||
122 | |||
123 | |||
124 | |||
125 | |||
126 | |||
117 | /// Builds and displays the Opie multi-authentication configuration dialog | 127 | /// Builds and displays the Opie multi-authentication configuration dialog |
118 | MultiauthConfig::MultiauthConfig() : QDialog(0, 0, TRUE), | 128 | static void test_and_start() { |
119 | m_mainTW(0), m_pluginListView(0), m_pluginListWidget(0), | 129 | Config pcfg("Security"); |
120 | m_generalConfig(0), m_loginWidget(0), m_syncWidget(0), | 130 | pcfg.setGroup( "Misc" ); |
121 | m_nbSuccessReq(0), m_plugins_changed(false) | 131 | bool protectConfigDialog = ! pcfg.readBoolEntry("noProtectConfig", true); |
132 | |||
133 | if (protectConfigDialog && Opie::Security::Internal::runPlugins() != 0) { | ||
134 | owarn << "authentication failed, not showing opie-security" << oendl; | ||
135 | exit( -1 ); | ||
136 | } | ||
137 | } | ||
138 | |||
139 | |||
140 | |||
141 | MultiauthConfig::MultiauthConfig(QWidget* par, const char* w, WFlags f) | ||
142 | : QDialog(par, w, TRUE, f), | ||
143 | m_mainTW(0), m_pluginListView(0), m_pluginListWidget(0), | ||
144 | m_generalConfig(0), m_loginWidget(0), m_syncWidget(0), | ||
145 | m_nbSuccessReq(0), m_plugins_changed(false) | ||
122 | { | 146 | { |
123 | /* Initializes the global configuration window | 147 | /* Initializes the global configuration window |
124 | */ | 148 | */ |
149 | test_and_start(); | ||
150 | |||
125 | setCaption( tr( "Security configuration" ) ); | 151 | setCaption( tr( "Security configuration" ) ); |
126 | QVBoxLayout *layout = new QVBoxLayout( this ); | 152 | QVBoxLayout *layout = new QVBoxLayout( this ); |
127 | m_mainTW = new Opie::Ui::OTabWidget( this ); | 153 | m_mainTW = new Opie::Ui::OTabWidget( this ); |
128 | layout->addWidget(m_mainTW); | 154 | layout->addWidget(m_mainTW); |
@@ -205,8 +231,24 @@ MultiauthConfig::MultiauthConfig() : QDialog(0, 0, TRUE), | |||
205 | MultiauthConfig::~MultiauthConfig() | 231 | MultiauthConfig::~MultiauthConfig() |
206 | { | 232 | { |
207 | } | 233 | } |
208 | 234 | ||
235 | void MultiauthConfig::accept() { | ||
236 | writeConfig(); | ||
237 | |||
238 | MultiauthConfigWidget* confWidget = 0; | ||
239 | for ( confWidget = configWidgetList.first(); confWidget != 0; | ||
240 | confWidget = configWidgetList.next() ) | ||
241 | confWidget->writeConfig(); | ||
242 | |||
243 | QDialog::accept(); | ||
244 | } | ||
245 | |||
246 | void MultiauthConfig::done( int r ) { | ||
247 | QDialog::done( r ); | ||
248 | close(); | ||
249 | } | ||
250 | |||
209 | /// moves up the selected plugin | 251 | /// moves up the selected plugin |
210 | void MultiauthConfig::moveSelectedUp() | 252 | void MultiauthConfig::moveSelectedUp() |
211 | { | 253 | { |
212 | QListViewItem *item = m_pluginListView->selectedItem(); | 254 | QListViewItem *item = m_pluginListView->selectedItem(); |
diff --git a/core/settings/security/multiauthconfig.h b/core/settings/security/multiauthconfig.h index ffe920f..649815d 100644 --- a/core/settings/security/multiauthconfig.h +++ b/core/settings/security/multiauthconfig.h | |||
@@ -80,14 +80,17 @@ class MultiauthConfig : public QDialog | |||
80 | { | 80 | { |
81 | Q_OBJECT | 81 | Q_OBJECT |
82 | 82 | ||
83 | public: | 83 | public: |
84 | MultiauthConfig(); | 84 | static QString appName() { return QString::fromLatin1("security"); } |
85 | MultiauthConfig(QWidget *parent, const char* name, WFlags fl); | ||
85 | virtual ~MultiauthConfig(); | 86 | virtual ~MultiauthConfig(); |
86 | void writeConfig(); | 87 | void writeConfig(); |
87 | QList<Opie::Security::MultiauthConfigWidget> configWidgetList; | 88 | QList<Opie::Security::MultiauthConfigWidget> configWidgetList; |
88 | 89 | ||
89 | protected slots: | 90 | protected slots: |
91 | void accept(); | ||
92 | void done(int r); | ||
90 | void pluginsChanged(); | 93 | void pluginsChanged(); |
91 | void moveSelectedUp(); | 94 | void moveSelectedUp(); |
92 | void moveSelectedDown(); | 95 | void moveSelectedDown(); |
93 | 96 | ||
diff --git a/core/settings/security/security.pro b/core/settings/security/security.pro index 5d2ae08..e9f4061 100644 --- a/core/settings/security/security.pro +++ b/core/settings/security/security.pro | |||
@@ -1,16 +1,10 @@ | |||
1 | CONFIG += qt warn_on | 1 | CONFIG += qt warn_on quick-app |
2 | |||
3 | HEADERS = multiauthconfig.h | 2 | HEADERS = multiauthconfig.h |
4 | |||
5 | SOURCES = multiauthconfig.cpp main.cpp | 3 | SOURCES = multiauthconfig.cpp main.cpp |
6 | |||
7 | INTERFACES= loginbase.ui syncbase.ui | 4 | INTERFACES= loginbase.ui syncbase.ui |
8 | 5 | ||
9 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
10 | |||
11 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiesecurity2 | 7 | LIBS += -lqpe -lopiecore2 -lopieui2 -lopiesecurity2 |
12 | |||
13 | DESTDIR = $(OPIEDIR)/bin | ||
14 | TARGET = security | 8 | TARGET = security |
15 | 9 | ||
16 | include ( $(OPIEDIR)/include.pro ) | 10 | include ( $(OPIEDIR)/include.pro ) |