signon  8.58
signonui_interface.cpp
Go to the documentation of this file.
00001 /*
00002  * This file is part of signon
00003  *
00004  * Copyright (C) 2009-2010 Nokia Corporation.
00005  * Copyright (C) 2013 Canonical Ltd.
00006  *
00007  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public License
00011  * version 2.1 as published by the Free Software Foundation.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021  * 02110-1301 USA
00022  */
00023 
00024 #include "signonui_interface.h"
00025 #include "signond-common.h"
00026 
00027 #include "SignOn/uisessiondata_priv.h"
00028 
00029 /*
00030  * Implementation of interface class SignonUiAdaptor
00031  */
00032 SignonUiAdaptor::SignonUiAdaptor(const QString &service,
00033                                  const QString &path,
00034                                  const QDBusConnection &connection,
00035                                  QObject *parent):
00036     QDBusAbstractInterface(service, path, staticInterfaceName(),
00037                            connection, parent)
00038 {
00039 }
00040 
00041 SignonUiAdaptor::~SignonUiAdaptor()
00042 {
00043 }
00044 
00045 /*
00046  * Open a new dialog
00047  * */
00048 
00049 QDBusPendingCall SignonUiAdaptor::queryDialog(const QVariantMap &parameters)
00050 {
00051     QList<QVariant> argumentList;
00052     argumentList << parameters;
00053     return callWithArgumentListAndBigTimeout(QLatin1String("queryDialog"),
00054                                              argumentList);
00055 }
00056 
00057 
00058 /*
00059  * update the existing dialog
00060  * */
00061 QDBusPendingCall SignonUiAdaptor::refreshDialog(const QVariantMap &parameters)
00062 {
00063     QList<QVariant> argumentList;
00064     argumentList << parameters;
00065     return callWithArgumentListAndBigTimeout(QLatin1String("refreshDialog"),
00066                                              argumentList);
00067 }
00068 
00069 
00070 /*
00071  * cancel dialog request
00072  * */
00073 void SignonUiAdaptor::cancelUiRequest(const QString &requestId)
00074 {
00075     QList<QVariant> argumentList;
00076     argumentList << requestId;
00077     callWithArgumentList(QDBus::NoBlock, QLatin1String("cancelUiRequest"),
00078                          argumentList);
00079 }
00080 
00081 /*
00082  * Remove any data associated with the given identity.
00083  * */
00084 QDBusPendingCall SignonUiAdaptor::removeIdentityData(quint32 id)
00085 {
00086     QList<QVariant> argumentList;
00087     argumentList << id;
00088     return asyncCallWithArgumentList(QLatin1String("removeIdentityData"),
00089                                      argumentList);
00090 }
00091 
00092 QDBusPendingCall
00093 SignonUiAdaptor::callWithArgumentListAndBigTimeout(const QString &method,
00094                                                    const QList<QVariant> &args)
00095 {
00096     QDBusMessage msg = QDBusMessage::createMethodCall(service(),
00097                                                       path(),
00098                                                       interface(),
00099                                                       method);
00100     if (!args.isEmpty())
00101         msg.setArguments(args);
00102     return connection().asyncCall(msg, SIGNOND_MAX_TIMEOUT);
00103 }