1/*
2 Copyright (c) 2009 Volker Krause <vkrause@kde.org>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef SETUPMANAGER_H
21#define SETUPMANAGER_H
22
23#include <QtCore/QObject>
24
25namespace KWallet {
26 class Wallet;
27}
28
29class SetupObject;
30class SetupPage;
31
32class SetupManager : public QObject
33{
34 Q_OBJECT
35 public:
36 explicit SetupManager( QWidget *parent );
37 ~SetupManager();
38 void setSetupPage( SetupPage* page );
39
40 void setName( const QString& );
41 void setEmail( const QString& );
42 void setPassword( const QString& );
43 void setPersonalDataAvailable( bool available );
44
45 public slots:
46 Q_SCRIPTABLE bool personalDataAvailable();
47 Q_SCRIPTABLE QString name();
48 Q_SCRIPTABLE QString email();
49 Q_SCRIPTABLE QString password();
50 Q_SCRIPTABLE QString country();
51 /** Ensures the wallet is open for subsequent sync wallet access in the resources. */
52 Q_SCRIPTABLE void openWallet();
53 Q_SCRIPTABLE QObject* createResource( const QString &type );
54 Q_SCRIPTABLE QObject* createTransport( const QString &type );
55 Q_SCRIPTABLE QObject* createConfigFile( const QString &configName );
56 Q_SCRIPTABLE QObject* createLdap();
57 Q_SCRIPTABLE QObject* createIdentity();
58 Q_SCRIPTABLE void execute();
59
60 void requestRollback();
61
62 signals:
63 void rollbackComplete();
64
65 private:
66 void setupNext();
67 void rollback();
68 SetupObject* connectObject( SetupObject* obj );
69
70 private slots:
71 void setupSucceeded( const QString &msg );
72 void setupFailed( const QString &msg );
73 void setupInfo( const QString &msg );
74
75 private:
76 QString m_name, m_email, m_password;
77 QList<SetupObject*> m_objectToSetup;
78 QList<SetupObject*> m_setupObjects;
79 SetupObject* m_currentSetupObject;
80 SetupPage* m_page;
81 KWallet::Wallet *m_wallet;
82 bool m_personalDataAvailable;
83 bool m_rollbackRequested;
84};
85
86#endif
87