Debian Codegraph @

online-accounts-service/src/mir-helper-stub.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2014 Canonical Ltd.
3 *
4 * Contact: Alberto Mardegan <[email protected]>
5 *
6 * This file is part of lomiri-online-accounts-service
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 3, as published
10 * by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranties of
14 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include <online-accounts-common/debug.h>
22 #include "mir-helper.h"
23
24 using namespace OnlineAccountsUi;
25
26 namespace OnlineAccountsUi {
27
28 static MirHelper *m_instance = 0;
29
30 } // namespace
31
32 PromptSession::PromptSession(PromptSessionPrivate *priv):
33 d_ptr(priv)
34 {
35 }
36
37 PromptSession::~PromptSession()
38 {
39 }
40
41 QString PromptSession::requestSocket()
42 {
43 #ifdef BUILDING_TESTS
44 return QString::fromUtf8(qgetenv("TEST_MIR_HELPER_SOCKET"));
45 #else
46 return QString();
47 #endif
48 }
49
50 MirHelper::MirHelper(QObject *parent):
51 QObject(parent),
52 d_ptr(0)
53 {
54 }
55
56 MirHelper::~MirHelper()
57 {
58 m_instance = 0;
59 }
60
61 MirHelper *MirHelper::instance()
62 {
63 if (!m_instance) {
64 m_instance = new MirHelper;
65 }
66 return m_instance;
67 }
68
69 PromptSessionP MirHelper::createPromptSession(pid_t initiatorPid)
70 {
71 Q_UNUSED(initiatorPid);
72 #ifdef BUILDING_TESTS
73 return qgetenv("TEST_MIR_HELPER_FAIL_CREATE").isEmpty() ?
74 PromptSessionP(new PromptSession(0)) : PromptSessionP();
75 #else
76 return PromptSessionP();
77 #endif
78 }