signon  8.58
signonsessioncoretools.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of signon
3  *
4  * Copyright (C) 2009-2011 Nokia Corporation.
5  *
6  * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
7  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * version 2.1 as published by the Free Software Foundation.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  */
23 
24 #include "signonsessioncoretools.h"
25 
26 #include <QDebug>
27 #include "signond-common.h"
28 
29 using namespace SignonDaemonNS;
30 
31 QVariantMap SignonDaemonNS::mergeVariantMaps(const QVariantMap &map1,
32  const QVariantMap &map2)
33 {
34  if (map1.isEmpty()) return map2;
35  if (map2.isEmpty()) return map1;
36 
37  QVariantMap map = map1;
38  //map2 values will overwrite map1 values for the same keys.
39  QMapIterator<QString, QVariant> it(map2);
40  while (it.hasNext()) {
41  it.next();
42  if (map.contains(it.key()))
43  map.remove(it.key());
44  }
45  return map.unite(map2);
46 }
47 
48 /* --------------------- StoreOperation ---------------------- */
49 
51  m_storeType(type)
52 {
53 }
54 
57  m_info(src.m_info),
60 {
61 }
62 
64 {
65 }
66 
67 /* --------------------- RequestData ---------------------- */
68 
69 RequestData::RequestData(const QDBusConnection &conn,
70  const QDBusMessage &msg,
71  const QVariantMap &params,
72  const QString &mechanism,
73  const QString &cancelKey):
74  m_conn(conn),
75  m_msg(msg),
76  m_params(params),
77  m_mechanism(mechanism),
78  m_cancelKey(cancelKey)
79 {
80 }
81 
83  m_conn(other.m_conn),
84  m_msg(other.m_msg),
85  m_params(other.m_params),
86  m_mechanism(other.m_mechanism),
88 {
89 }
90 
92 {
93 }
RequestData(const QDBusConnection &conn, const QDBusMessage &msg, const QVariantMap &params, const QString &mechanism, const QString &cancelKey)
Describes a credentials store operatation.
QVariantMap mergeVariantMaps(const QVariantMap &map1, const QVariantMap &map2)
Helper method which unites two variant maps.