signon  8.58
signonsessioncoretools.cpp
Go to the documentation of this file.
00001 /*
00002  * This file is part of signon
00003  *
00004  * Copyright (C) 2009-2011 Nokia Corporation.
00005  *
00006  * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
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 "signonsessioncoretools.h"
00025 
00026 #include <QDebug>
00027 #include "signond-common.h"
00028 
00029 using namespace SignonDaemonNS;
00030 
00031 QVariantMap SignonDaemonNS::mergeVariantMaps(const QVariantMap &map1,
00032                                              const QVariantMap &map2)
00033 {
00034     if (map1.isEmpty()) return map2;
00035     if (map2.isEmpty()) return map1;
00036 
00037     QVariantMap map = map1;
00038     //map2 values will overwrite map1 values for the same keys.
00039     QMapIterator<QString, QVariant> it(map2);
00040     while (it.hasNext()) {
00041         it.next();
00042         if (map.contains(it.key()))
00043             map.remove(it.key());
00044     }
00045     return map.unite(map2);
00046 }
00047 
00048 /* --------------------- StoreOperation ---------------------- */
00049 
00050 StoreOperation::StoreOperation(const StoreType type):
00051     m_storeType(type)
00052 {
00053 }
00054 
00055 StoreOperation::StoreOperation(const StoreOperation &src):
00056     m_storeType(src.m_storeType),
00057     m_info(src.m_info),
00058     m_authMethod(src.m_authMethod),
00059     m_blobData(src.m_blobData)
00060 {
00061 }
00062 
00063 StoreOperation::~StoreOperation()
00064 {
00065 }
00066 
00067 /* --------------------- RequestData ---------------------- */
00068 
00069 RequestData::RequestData(const QDBusConnection &conn,
00070                          const QDBusMessage &msg,
00071                          const QVariantMap &params,
00072                          const QString &mechanism,
00073                          const QString &cancelKey):
00074     m_conn(conn),
00075     m_msg(msg),
00076     m_params(params),
00077     m_mechanism(mechanism),
00078     m_cancelKey(cancelKey)
00079 {
00080 }
00081 
00082 RequestData::RequestData(const RequestData &other):
00083     m_conn(other.m_conn),
00084     m_msg(other.m_msg),
00085     m_params(other.m_params),
00086     m_mechanism(other.m_mechanism),
00087     m_cancelKey(other.m_cancelKey)
00088 {
00089 }
00090 
00091 RequestData::~RequestData()
00092 {
00093 }