Changeset View
Changeset View
Standalone View
Standalone View
src/kdeinit/ktoolinvocation.cpp
Show First 20 Lines • Show All 128 Lines • ▼ Show 20 Line(s) | 128 | if (pid) { | |||
---|---|---|---|---|---|
129 | *pid = reply.arguments().at(3).toInt(); | 129 | *pid = reply.arguments().at(3).toInt(); | ||
130 | } | 130 | } | ||
131 | return reply.arguments().at(0).toInt(); | 131 | return reply.arguments().at(0).toInt(); | ||
132 | #else | 132 | #else | ||
133 | return ENOTSUP; | 133 | return ENOTSUP; | ||
134 | #endif | 134 | #endif | ||
135 | } | 135 | } | ||
136 | 136 | | |||
137 | #ifndef KSERVICE_NO_DEPRECATED | 137 | #if KSERVICE_BUILD_DEPRECATED_SINCE(5, 0) | ||
138 | int | 138 | int | ||
139 | KToolInvocation::startServiceByName(const QString &_name, const QString &URL, | 139 | KToolInvocation::startServiceByName(const QString &_name, const QString &URL, | ||
140 | QString *error, QString *serviceName, int *pid, | 140 | QString *error, QString *serviceName, int *pid, | ||
141 | const QByteArray &startup_id, bool noWait) | 141 | const QByteArray &startup_id, bool noWait) | ||
142 | { | 142 | { | ||
143 | if (!isMainThreadActive(error)) { | 143 | if (!isMainThreadActive(error)) { | ||
144 | return EINVAL; | 144 | return EINVAL; | ||
145 | } | 145 | } | ||
146 | 146 | | |||
147 | QStringList URLs; | 147 | QStringList URLs; | ||
148 | if (!URL.isEmpty()) { | 148 | if (!URL.isEmpty()) { | ||
149 | URLs.append(URL); | 149 | URLs.append(URL); | ||
150 | } | 150 | } | ||
151 | return self()->startServiceInternal("start_service_by_name", | 151 | return self()->startServiceInternal("start_service_by_name", | ||
152 | _name, URLs, error, serviceName, pid, startup_id, noWait); | 152 | _name, URLs, error, serviceName, pid, startup_id, noWait); | ||
153 | } | 153 | } | ||
154 | #endif | 154 | #endif | ||
155 | 155 | | |||
156 | #ifndef KSERVICE_NO_DEPRECATED | 156 | #if KSERVICE_BUILD_DEPRECATED_SINCE(5, 0) | ||
157 | int | 157 | int | ||
158 | KToolInvocation::startServiceByName(const QString &_name, const QStringList &URLs, | 158 | KToolInvocation::startServiceByName(const QString &_name, const QStringList &URLs, | ||
159 | QString *error, QString *serviceName, int *pid, | 159 | QString *error, QString *serviceName, int *pid, | ||
160 | const QByteArray &startup_id, bool noWait) | 160 | const QByteArray &startup_id, bool noWait) | ||
161 | { | 161 | { | ||
162 | if (!isMainThreadActive(error)) { | 162 | if (!isMainThreadActive(error)) { | ||
163 | return EINVAL; | 163 | return EINVAL; | ||
164 | } | 164 | } | ||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | 246 | { | |||
247 | if (!isMainThreadActive(error)) { | 247 | if (!isMainThreadActive(error)) { | ||
248 | return EINVAL; | 248 | return EINVAL; | ||
249 | } | 249 | } | ||
250 | 250 | | |||
251 | return self()->startServiceInternal("kdeinit_exec_wait", | 251 | return self()->startServiceInternal("kdeinit_exec_wait", | ||
252 | name, args, error, nullptr, pid, startup_id, false); | 252 | name, args, error, nullptr, pid, startup_id, false); | ||
253 | } | 253 | } | ||
254 | 254 | | |||
255 | #if KSERVICE_BUILD_DEPRECATED_SINCE(5, 0) | ||||
255 | void KToolInvocation::invokeMailer(const QString &address, const QString &subject, const QByteArray &startup_id) | 256 | void KToolInvocation::invokeMailer(const QString &address, const QString &subject, const QByteArray &startup_id) | ||
256 | { | 257 | { | ||
257 | if (!isMainThreadActive()) { | 258 | if (!isMainThreadActive()) { | ||
258 | return; | 259 | return; | ||
259 | } | 260 | } | ||
260 | 261 | | |||
261 | invokeMailer(address, QString(), QString(), subject, QString(), QString(), | 262 | invokeMailer(address, QString(), QString(), subject, QString(), QString(), | ||
262 | QStringList(), startup_id); | 263 | QStringList(), startup_id); | ||
Show All 31 Lines | 294 | } else if (allowAttachments && q == QLatin1String("attachment")) { | |||
294 | attachURLs.push_back(value); | 295 | attachURLs.push_back(value); | ||
295 | } else if (q == QLatin1String("to")) { | 296 | } else if (q == QLatin1String("to")) { | ||
296 | address = address.isEmpty() ? value : address + comma + value; | 297 | address = address.isEmpty() ? value : address + comma + value; | ||
297 | } | 298 | } | ||
298 | } | 299 | } | ||
299 | 300 | | |||
300 | invokeMailer(address, cc, bcc, subject, body, QString(), attachURLs, startup_id); | 301 | invokeMailer(address, cc, bcc, subject, body, QString(), attachURLs, startup_id); | ||
301 | } | 302 | } | ||
303 | #endif | ||||
302 | 304 | | |||
303 | void KToolInvocation::ensureKdeinitRunning() | 305 | void KToolInvocation::ensureKdeinitRunning() | ||
304 | { | 306 | { | ||
305 | #ifdef QT_DBUS_LIB | 307 | #ifdef QT_DBUS_LIB | ||
306 | KDEInitInterface::ensureKdeinitRunning(); | 308 | KDEInitInterface::ensureKdeinitRunning(); | ||
307 | #endif | 309 | #endif | ||
308 | } | 310 | } | ||
309 | 311 | |