provider-plugin-proxy-priv.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  */
00022 
00023 #ifndef ACCOUNTSETUP_PROVIDER_PLUGIN_PROXY_PRIV_H
00024 #define ACCOUNTSETUP_PROVIDER_PLUGIN_PROXY_PRIV_H
00025 
00026 //libAccountSetup
00027 #include "provider-plugin-proxy.h"
00028 
00029 //Qt
00030 #include <QDebug>
00031 #include <QDir>
00032 #include <QFileInfo>
00033 #include <QLocalServer>
00034 #include <QPointer>
00035 #include <QProcess>
00036 #include <QWidget>
00037 
00038 using namespace Accounts;
00039 using namespace AccountSetup;
00040 
00041 namespace AccountSetup {
00042 
00043 class ProviderPluginProxyPrivate: public QObject
00044 {
00045     Q_OBJECT
00046     Q_DECLARE_PUBLIC(ProviderPluginProxy)
00047 
00048 public:
00049     ProviderPluginProxyPrivate(ProviderPluginProxy *parent):
00050         q_ptr(parent),
00051         pluginName(),
00052         process(0),
00053         socketName(QString()),
00054         createdAccountId(0),
00055         error(ProviderPluginProxy::NoError),
00056         setupType(Unset),
00057         providerName(),
00058         exitData()
00059     {
00060         pluginDirs << QString::fromLatin1("/usr/lib/AccountSetup");
00061     }
00062     ~ProviderPluginProxyPrivate();
00063 
00064     void startProcess(Provider *provider, AccountId accountId,
00065                       const QString &serviceType);
00066     bool findPlugin(Provider *provider, QString &pluginPath,
00067                     QString &pluginFileName);
00068 
00069 private Q_SLOTS:
00070     void onReadStandardError();
00071     void onError(QProcess::ProcessError);
00072     void onFinished(int exitCode, QProcess::ExitStatus exitStatus);
00073     void onNewConnection();
00074     void setCommunicationChannel();
00075 
00076 private:
00077     mutable ProviderPluginProxy *q_ptr;
00078     QString pluginName;
00079     QProcess *process;
00080     QString socketName;
00081     AccountId createdAccountId;
00082     QStringList pluginDirs;
00083     ProviderPluginProxy::Error error;
00084     QPointer<QWidget> parentWidget;
00085     QStringList additionalParameters;
00086     QByteArray pluginOutput;
00087     SetupType setupType;
00088     QString providerName;
00089     QVariant exitData;
00090 };
00091 
00092 }; // namespace
00093 
00094 #endif // ACCOUNTSETUP_PROVIDER_PLUGIN_PROXY_PRIV_H
00095