| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2018 The Qt Company Ltd and/or its subsidiary(-ies). |
| 4 | ** Contact: http://www.qt-project.org/legal |
| 5 | ** |
| 6 | ** This file is part of the QtSystems module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #include "qserviceclientcredentials_p.h" |
| 41 | #include "qremoteserviceregister_p.h" |
| 42 | #include "instancemanager_p.h" |
| 43 | |
| 44 | #include <QCoreApplication> |
| 45 | |
| 46 | QT_BEGIN_NAMESPACE |
| 47 | |
| 48 | QRemoteServiceRegisterPrivate::QRemoteServiceRegisterPrivate(QObject* parent) |
| 49 | : QObject(parent), iFilter(0), |
| 50 | securityOptions(QRemoteServiceRegister::NoOptions), |
| 51 | userIdentifier(0), userIdentifierSet(false), |
| 52 | groupIdentifier(0), groupIdentifierSet(false) |
| 53 | { |
| 54 | setQuitOnLastInstanceClosed(true); |
| 55 | } |
| 56 | |
| 57 | QRemoteServiceRegisterPrivate::~QRemoteServiceRegisterPrivate() |
| 58 | { |
| 59 | } |
| 60 | |
| 61 | //void QRemoteServiceRegisterPrivate::publishServices( const QString& ident) |
| 62 | //{ |
| 63 | // qWarning("QRemoteServiceregisterPrivate::publishServices has not been reimplemented"); |
| 64 | //} |
| 65 | // |
| 66 | //void QRemoteServiceRegisterPrivate::processIncoming() |
| 67 | //{ |
| 68 | // qWarning("QRemoteServiceRegisterPrivate::processIncoming has not been reimplemented"); |
| 69 | //} |
| 70 | |
| 71 | bool QRemoteServiceRegisterPrivate::quitOnLastInstanceClosed() const |
| 72 | { |
| 73 | return m_quit; |
| 74 | } |
| 75 | |
| 76 | void QRemoteServiceRegisterPrivate::setQuitOnLastInstanceClosed(bool quit) |
| 77 | { |
| 78 | m_quit = quit; |
| 79 | if (m_quit) { |
| 80 | connect(InstanceManager::instance(), SIGNAL(allInstancesClosed()), QCoreApplication::instance(), SLOT(quit())); |
| 81 | } |
| 82 | else { |
| 83 | disconnect(InstanceManager::instance(), SIGNAL(allInstancesClosed()), QCoreApplication::instance(), SLOT(quit())); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | QRemoteServiceRegister::SecurityFilter QRemoteServiceRegisterPrivate::setSecurityFilter(QRemoteServiceRegister::SecurityFilter filter) |
| 88 | { |
| 89 | QRemoteServiceRegister::SecurityFilter f; |
| 90 | f = filter; |
| 91 | iFilter = filter; |
| 92 | return f; |
| 93 | } |
| 94 | |
| 95 | void QRemoteServiceRegisterPrivate::setSecurityOptions(QRemoteServiceRegister::SecurityAccessOptions options) |
| 96 | { |
| 97 | securityOptions = options; |
| 98 | } |
| 99 | |
| 100 | QRemoteServiceRegister::SecurityFilter QRemoteServiceRegisterPrivate::getSecurityFilter() |
| 101 | { |
| 102 | return iFilter; |
| 103 | } |
| 104 | |
| 105 | QRemoteServiceRegister::SecurityAccessOptions QRemoteServiceRegisterPrivate::getSecurityOptions() const |
| 106 | { |
| 107 | return securityOptions; |
| 108 | } |
| 109 | |
| 110 | void QRemoteServiceRegisterPrivate::setBaseUserIdentifier(qintptr uid) |
| 111 | { |
| 112 | userIdentifier = uid; |
| 113 | userIdentifierSet = true; |
| 114 | } |
| 115 | |
| 116 | qintptr QRemoteServiceRegisterPrivate::getBaseUserIdentifier() const |
| 117 | { |
| 118 | return userIdentifier; |
| 119 | } |
| 120 | |
| 121 | bool QRemoteServiceRegisterPrivate::isBaseUserIdentifierSet() const |
| 122 | { |
| 123 | return userIdentifierSet; |
| 124 | } |
| 125 | |
| 126 | void QRemoteServiceRegisterPrivate::setBaseGroupIdentifier(qintptr gid) |
| 127 | { |
| 128 | groupIdentifier = gid; |
| 129 | groupIdentifierSet = true; |
| 130 | } |
| 131 | |
| 132 | qintptr QRemoteServiceRegisterPrivate::getBaseGroupIdentifier() const |
| 133 | { |
| 134 | return groupIdentifier; |
| 135 | } |
| 136 | |
| 137 | bool QRemoteServiceRegisterPrivate::isBaseGroupIdentifierSet() const |
| 138 | { |
| 139 | return groupIdentifierSet; |
| 140 | } |
| 141 | |
| 142 | QRemoteServiceRegisterPrivate *QRemoteServiceRegisterPrivate::constructPrivateObject(QService::Type serviceType, QObject *parent) |
| 143 | { |
| 144 | QRemoteServiceRegisterPrivate *d = 0; |
| 145 | switch (serviceType) { |
| 146 | case QService::InterProcess: |
| 147 | d = QRemoteServiceRegisterPrivate::constructPrivateObject(parent); |
| 148 | break; |
| 149 | default: |
| 150 | qFatal("Cannot create a QRemoteServiceRegister with unknown service type %d", serviceType); |
| 151 | } |
| 152 | return d; |
| 153 | } |
| 154 | |
| 155 | #include "moc_qremoteserviceregister_p.cpp" |
| 156 | QT_END_NAMESPACE |