summaryrefslogtreecommitdiff
path: root/core/settings/security/main.cpp
blob: f161109d9565e11b65395ad7c7d47df4cc645e66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "multiauthconfig.h"
#include <opie2/oapplication.h>
#include <opie2/odebug.h>



int main(int argc, char **argv) {
    Opie::Core::OApplication app(argc, argv, "MultiAuthentication Config");
    // protect this dialog if option set
    Config* pcfg = new Config("Security");
    pcfg->setGroup( "Misc" );
    bool protectConfigDialog = ! pcfg->readBoolEntry("noProtectConfig", true);
    delete pcfg;
    bool show = true;
    if ( protectConfigDialog )
    {
        if (Opie::Security::Internal::runPlugins() != 0)
        {
            // authentication failed
            show = false;
        }
    }
    if ( show == true )
    {
    printf("building dialog\n");
        MultiauthConfig dialog;
        app.setMainWidget(&dialog);

        if ( dialog.exec() == QDialog::Accepted ) {
            // write the general, login and sync config
            dialog.writeConfig();
            // call writeConfig() on each plugin config widget
            Opie::Security::MultiauthConfigWidget *confWidget;
            for ( confWidget = dialog.configWidgetList.first(); confWidget != 0;
                  confWidget = dialog.configWidgetList.next() ) {
                confWidget->writeConfig();
            }
        }
        dialog.close();
        app.quit();
        return 0;
    } else {
        owarn << "authentication failed, not showing opie-security" << oendl;
        return 1;
    }
}