| 1 | /**************************************************************************** | 
| 2 | ** | 
| 3 | ** Copyright (C) 2015 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:LGPL21$ | 
| 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 http://www.qt.io/terms-conditions. For further | 
| 15 | ** information use the contact form at http://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 2.1 or version 3 as published by the Free | 
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | 
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | 
| 22 | ** following information to ensure the GNU Lesser General Public License | 
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | 
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | 
| 25 | ** | 
| 26 | ** As a special exception, The Qt Company gives you certain additional | 
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | 
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | 
| 29 | ** | 
| 30 | ** $QT_END_LICENSE$ | 
| 31 | ** | 
| 32 | ****************************************************************************/ | 
| 33 |  | 
| 34 | #include "qserviceclientcredentials_p.h" | 
| 35 | #include "qremoteserviceregister_p.h" | 
| 36 | #include "instancemanager_p.h" | 
| 37 |  | 
| 38 | #include <QCoreApplication> | 
| 39 |  | 
| 40 | QT_BEGIN_NAMESPACE | 
| 41 |  | 
| 42 | QRemoteServiceRegisterPrivate::QRemoteServiceRegisterPrivate(QObject* parent) | 
| 43 |     : QObject(parent), iFilter(0), | 
| 44 |       securityOptions(QRemoteServiceRegister::NoOptions), | 
| 45 |       userIdentifier(0), userIdentifierSet(false), | 
| 46 |       groupIdentifier(0), groupIdentifierSet(false) | 
| 47 | { | 
| 48 |     setQuitOnLastInstanceClosed(true); | 
| 49 | } | 
| 50 |  | 
| 51 | QRemoteServiceRegisterPrivate::~QRemoteServiceRegisterPrivate() | 
| 52 | { | 
| 53 | } | 
| 54 |  | 
| 55 | //void QRemoteServiceRegisterPrivate::publishServices( const QString& ident) | 
| 56 | //{ | 
| 57 | //  qWarning("QRemoteServiceregisterPrivate::publishServices has not been reimplemented"); | 
| 58 | //} | 
| 59 | // | 
| 60 | //void QRemoteServiceRegisterPrivate::processIncoming() | 
| 61 | //{ | 
| 62 | //  qWarning("QRemoteServiceRegisterPrivate::processIncoming has not been reimplemented"); | 
| 63 | //} | 
| 64 |  | 
| 65 | bool QRemoteServiceRegisterPrivate::quitOnLastInstanceClosed() const | 
| 66 | { | 
| 67 |     return m_quit; | 
| 68 | } | 
| 69 |  | 
| 70 | void QRemoteServiceRegisterPrivate::setQuitOnLastInstanceClosed(bool quit) | 
| 71 | { | 
| 72 |     m_quit = quit; | 
| 73 |     if (m_quit) { | 
| 74 |         connect(sender: InstanceManager::instance(), SIGNAL(allInstancesClosed()), receiver: QCoreApplication::instance(), SLOT(quit())); | 
| 75 |     } | 
| 76 |     else { | 
| 77 |         disconnect(sender: InstanceManager::instance(), SIGNAL(allInstancesClosed()), receiver: QCoreApplication::instance(), SLOT(quit())); | 
| 78 |     } | 
| 79 | } | 
| 80 |  | 
| 81 | QRemoteServiceRegister::SecurityFilter QRemoteServiceRegisterPrivate::setSecurityFilter(QRemoteServiceRegister::SecurityFilter filter) | 
| 82 | { | 
| 83 |     QRemoteServiceRegister::SecurityFilter f; | 
| 84 |     f = filter; | 
| 85 |     iFilter = filter; | 
| 86 |     return f; | 
| 87 | } | 
| 88 |  | 
| 89 | void QRemoteServiceRegisterPrivate::setSecurityOptions(QRemoteServiceRegister::SecurityAccessOptions options) | 
| 90 | { | 
| 91 |     securityOptions = options; | 
| 92 | } | 
| 93 |  | 
| 94 | QRemoteServiceRegister::SecurityFilter QRemoteServiceRegisterPrivate::getSecurityFilter() | 
| 95 | { | 
| 96 |     return iFilter; | 
| 97 | } | 
| 98 |  | 
| 99 | QRemoteServiceRegister::SecurityAccessOptions QRemoteServiceRegisterPrivate::getSecurityOptions() const | 
| 100 | { | 
| 101 |     return securityOptions; | 
| 102 | } | 
| 103 |  | 
| 104 | void QRemoteServiceRegisterPrivate::setBaseUserIdentifier(qintptr uid) | 
| 105 | { | 
| 106 |     userIdentifier = uid; | 
| 107 |     userIdentifierSet = true; | 
| 108 | } | 
| 109 |  | 
| 110 | qintptr QRemoteServiceRegisterPrivate::getBaseUserIdentifier() const | 
| 111 | { | 
| 112 |     return userIdentifier; | 
| 113 | } | 
| 114 |  | 
| 115 | bool QRemoteServiceRegisterPrivate::isBaseUserIdentifierSet() const | 
| 116 | { | 
| 117 |     return userIdentifierSet; | 
| 118 | } | 
| 119 |  | 
| 120 | void QRemoteServiceRegisterPrivate::setBaseGroupIdentifier(qintptr gid) | 
| 121 | { | 
| 122 |     groupIdentifier = gid; | 
| 123 |     groupIdentifierSet = true; | 
| 124 | } | 
| 125 |  | 
| 126 | qintptr QRemoteServiceRegisterPrivate::getBaseGroupIdentifier() const | 
| 127 | { | 
| 128 |     return groupIdentifier; | 
| 129 | } | 
| 130 |  | 
| 131 | bool QRemoteServiceRegisterPrivate::isBaseGroupIdentifierSet() const | 
| 132 | { | 
| 133 |     return groupIdentifierSet; | 
| 134 | } | 
| 135 |  | 
| 136 | QRemoteServiceRegisterPrivate *QRemoteServiceRegisterPrivate::constructPrivateObject(QService::Type serviceType, QObject *parent) | 
| 137 | { | 
| 138 |     QRemoteServiceRegisterPrivate *d = 0; | 
| 139 |     switch (serviceType) { | 
| 140 |     case QService::InterProcess: | 
| 141 |         d = QRemoteServiceRegisterPrivate::constructPrivateObject(parent); | 
| 142 |         break; | 
| 143 |     default: | 
| 144 |         qFatal(msg: "Cannot create a QRemoteServiceRegister with unknown service type %d" , serviceType); | 
| 145 |     } | 
| 146 |     return d; | 
| 147 | } | 
| 148 |  | 
| 149 | #include "moc_qremoteserviceregister_p.cpp" | 
| 150 | QT_END_NAMESPACE | 
| 151 |  |