Changeset View
Changeset View
Standalone View
Standalone View
src/core/connection.cpp
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Line(s) | 123 | if (serverAddress.isEmpty()) { | |||
---|---|---|---|---|---|
124 | const QString connectionConfigFile = SessionPrivate::connectionFile(); | 124 | const QString connectionConfigFile = SessionPrivate::connectionFile(); | ||
125 | const QFileInfo fileInfo(connectionConfigFile); | 125 | const QFileInfo fileInfo(connectionConfigFile); | ||
126 | if (!fileInfo.exists()) { | 126 | if (!fileInfo.exists()) { | ||
127 | qCDebug(AKONADICORE_LOG) << "Akonadi Client Session: connection config file '" | 127 | qCDebug(AKONADICORE_LOG) << "Akonadi Client Session: connection config file '" | ||
128 | "akonadi/akonadiconnectionrc' can not be found in" | 128 | "akonadi/akonadiconnectionrc' can not be found in" | ||
129 | << XdgBaseDirs::homePath("config") << "nor in any of" | 129 | << XdgBaseDirs::homePath("config") << "nor in any of" | ||
130 | << XdgBaseDirs::systemPathList("config"); | 130 | << XdgBaseDirs::systemPathList("config"); | ||
131 | } | 131 | } | ||
132 | | ||||
133 | // TODO: share socket setup with server | ||||
132 | const QSettings connectionSettings(connectionConfigFile, QSettings::IniFormat); | 134 | const QSettings connectionSettings(connectionConfigFile, QSettings::IniFormat); | ||
135 | #ifdef Q_OS_WIN | ||||
136 | // use the installation prefix as uid | ||||
137 | const QString prefix = QString::fromUtf8(QUrl::toPercentEncoding(qApp->applicationDirPath())); | ||||
138 | if (mConnectionType == CommandConnection) { | ||||
139 | const QString defaultPipe = QStringLiteral("Akonadi-Cmd-") % prefix; | ||||
140 | serverAddress = connectionSettings.value(QStringLiteral("Connection/NamedPipe"), defaultPipe).toString(); | ||||
141 | } else if (mConnectionType == NotificationConnection) { | ||||
142 | const QString defaultPipe = QStringLiteral("Akonadi-Ntf-") % prefix; | ||||
143 | serverAddress = connectionSettings.value(QStringLiteral("Connection/NtfNamedPipe"), defaultPipe).toString(); | ||||
144 | } | ||||
145 | #else | ||||
133 | const QString defaultSocketDir = StandardDirs::saveDir("data"); | 146 | const QString defaultSocketDir = StandardDirs::saveDir("data"); | ||
134 | 147 | | |||
135 | if (mConnectionType == CommandConnection) { | 148 | if (mConnectionType == CommandConnection) { | ||
136 | const QString defaultSocketPath = defaultSocketDir % QStringLiteral("/akonadiserver-cmd.socket"); | 149 | const QString defaultSocketPath = defaultSocketDir % QStringLiteral("/akonadiserver-cmd.socket"); | ||
137 | serverAddress = connectionSettings.value(QStringLiteral("Data/UnixPath"), defaultSocketPath).toString(); | 150 | serverAddress = connectionSettings.value(QStringLiteral("Data/UnixPath"), defaultSocketPath).toString(); | ||
138 | } else if (mConnectionType == NotificationConnection) { | 151 | } else if (mConnectionType == NotificationConnection) { | ||
139 | const QString defaultSocketPath = defaultSocketDir % QStringLiteral("/akonadiserver-ntf.socket"); | 152 | const QString defaultSocketPath = defaultSocketDir % QStringLiteral("/akonadiserver-ntf.socket"); | ||
140 | serverAddress = connectionSettings.value(QStringLiteral("Notifications/UnixPath"), defaultSocketPath).toString(); | 153 | serverAddress = connectionSettings.value(QStringLiteral("Notifications/UnixPath"), defaultSocketPath).toString(); | ||
141 | } | 154 | } | ||
155 | #endif | ||||
142 | } | 156 | } | ||
143 | 157 | | |||
144 | // create sockets if not yet done, note that this does not yet allow changing socket types on the fly | 158 | // create sockets if not yet done, note that this does not yet allow changing socket types on the fly | ||
145 | // but that's probably not something we need to support anyway | 159 | // but that's probably not something we need to support anyway | ||
146 | if (!mSocket) { | 160 | if (!mSocket) { | ||
147 | mSocket = new QLocalSocket(this); | 161 | mSocket = new QLocalSocket(this); | ||
148 | connect(mSocket, static_cast<void(QLocalSocket::*)(QLocalSocket::LocalSocketError)>(&QLocalSocket::error), this, | 162 | connect(mSocket, static_cast<void(QLocalSocket::*)(QLocalSocket::LocalSocketError)>(&QLocalSocket::error), this, | ||
149 | [this](QLocalSocket::LocalSocketError) { | 163 | [this](QLocalSocket::LocalSocketError) { | ||
▲ Show 20 Lines • Show All 168 Lines • Show Last 20 Lines |