signon  8.40
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  *
00006  * Contact: Alberto Mardegan <alberto.mardegan@canonical.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 #include "signonui_interface.h"
00024 #include "signond-common.h"
00025 
00026 #include "SignOn/uisessiondata_priv.h"
00027 
00028 /*
00029  * Implementation of interface class SignonUiAdaptor
00030  */
00031 SignonUiAdaptor::SignonUiAdaptor(const QString &service,
00032                                  const QString &path,
00033                                  const QDBusConnection &connection,
00034                                  QObject *parent):
00035     QDBusAbstractInterface(service, path, staticInterfaceName(),
00036                            connection, parent)
00037 {
00038 }
00039 
00040 SignonUiAdaptor::~SignonUiAdaptor()
00041 {
00042 }
00043 
00044 /*
00045  * Open a new dialog
00046  * */
00047 
00048 QDBusPendingCall SignonUiAdaptor::queryDialog(const QVariantMap &parameters)
00049 {
00050     QList<QVariant> argumentList;
00051     argumentList << parameters;
00052     return callWithArgumentListAndBigTimeout(QLatin1String("queryDialog"),
00053                                              argumentList);
00054 }
00055 
00056 
00057 /*
00058  * update the existing dialog
00059  * */
00060 QDBusPendingCall SignonUiAdaptor::refreshDialog(const QVariantMap &parameters)
00061 {
00062     QList<QVariant> argumentList;
00063     argumentList << parameters;
00064     return callWithArgumentListAndBigTimeout(QLatin1String("refreshDialog"),
00065                                              argumentList);
00066 }
00067 
00068 
00069 /*
00070  * cancel dialog request
00071  * */
00072 void SignonUiAdaptor::cancelUiRequest(const QString &requestId)
00073 {
00074     QList<QVariant> argumentList;
00075     argumentList << requestId;
00076     callWithArgumentList(QDBus::NoBlock, QLatin1String("cancelUiRequest"),
00077                          argumentList);
00078 }
00079 
00080 QDBusPendingCall
00081 SignonUiAdaptor::callWithArgumentListAndBigTimeout(const QString &method,
00082                                                    const QList<QVariant> &args)
00083 {
00084     QDBusMessage msg = QDBusMessage::createMethodCall(service(),
00085                                                       path(),
00086                                                       interface(),
00087                                                       method);
00088     if (!args.isEmpty())
00089         msg.setArguments(args);
00090     return connection().asyncCall(msg, SIGNOND_MAX_TIMEOUT);
00091 }