provider-plugin-proxy.h

00001 /*
00002  * This file is part of accounts-ui
00003  *
00004  * Copyright (C) 2011 Nokia Corporation.
00005  *
00006  * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public License
00010  * version 2.1 as published by the Free Software Foundation.
00011  *
00012  * This library is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00020  * 02110-1301 USA
00021  */
00027 #ifndef ACCOUNTSETUP_PROVIDER_PLUGIN_PROXY_H
00028 #define ACCOUNTSETUP_PROVIDER_PLUGIN_PROXY_H
00029 
00030 // libAccountSetup
00031 #include <AccountSetup/common.h>
00032 #include <AccountSetup/types.h>
00033 
00034 // Accounts
00035 #include <Accounts/Account>
00036 #include <Accounts/Provider>
00037 
00038 // Qt
00039 #include <QObject>
00040 #include <QStringList>
00041 
00042 class QWidget;
00043 
00044 namespace AccountSetup {
00045 
00046 class ProviderPluginProxyPrivate;
00047 
00060 class ACCOUNTSETUP_EXPORT ProviderPluginProxy: public QObject
00061 {
00062     Q_OBJECT
00063 
00064 public:
00069     enum Error {
00070         NoError = 0,
00071         AccountNotFound,
00072         PluginNotFound,
00073         PluginCrashed,
00074     };
00075 
00079     ProviderPluginProxy(QObject *parent = 0);
00080     virtual ~ProviderPluginProxy();
00081 
00089     void createAccount(Accounts::Provider *provider,
00090                        const QString &serviceType);
00091 
00099     void editAccount(Accounts::Account *account, const QString &serviceType);
00100 
00106     void setParentWidget(QWidget *parent);
00107 
00113     void setPluginDirectories(const QStringList &pluginDirs);
00114 
00119     QStringList pluginDirectories() const;
00120 
00128     bool accountCreated() const;
00129 
00135     Error error() const;
00136 
00143     Accounts::AccountId createdAccountId() const;
00144 
00150     bool isPluginRunning();
00151 
00158     SetupType setupType() const;
00159 
00164     QString pluginName();
00165 
00169     QString providerName();
00170 
00174     QVariant exitData();
00175 
00176 Q_SIGNALS:
00181     void finished();
00182 
00183 protected:
00192     void setAdditionalParameters(const QStringList &parameters);
00193 
00197     QStringList additionalParameters() const;
00198 
00205     bool killRunningPlugin();
00206 
00207 private:
00208     ProviderPluginProxyPrivate *d_ptr;
00209     Q_DECLARE_PRIVATE(ProviderPluginProxy)
00210 };
00211 
00212 } // namespace
00213 
00214 #endif // ACCOUNTSETUP_PROVIDER_PLUGIN_PROXY_H
00215