Changeset View
Changeset View
Standalone View
Standalone View
src/service/ksmserver/KSMServer.cpp
Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Line(s) | 136 | { | |||
---|---|---|---|---|---|
147 | 147 | | |||
148 | // Calling process again for the rest of the list | 148 | // Calling process again for the rest of the list | ||
149 | QMetaObject::invokeMethod(this, "process", Qt::QueuedConnection); | 149 | QMetaObject::invokeMethod(this, "process", Qt::QueuedConnection); | ||
150 | } | 150 | } | ||
151 | 151 | | |||
152 | void KSMServer::Private::makeRunning(bool value) | 152 | void KSMServer::Private::makeRunning(bool value) | ||
153 | { | 153 | { | ||
154 | if (!kwin) { | 154 | if (!kwin) { | ||
155 | qDebug() << "Activities KSM: No kwin, marking activity as: " << value; | 155 | qCDebug(KAMD_LOG_ACTIVITIES) << "Activities KSM: No kwin, marking activity as: " << value; | ||
156 | subSessionSendEvent(value ? KSMServer::Started : KSMServer::Stopped); | 156 | subSessionSendEvent(value ? KSMServer::Started : KSMServer::Stopped); | ||
157 | return; | 157 | return; | ||
158 | } | 158 | } | ||
159 | 159 | | |||
160 | const auto call = kwin->asyncCall( | 160 | const auto call = kwin->asyncCall( | ||
161 | value ? QLatin1String("startActivity") : QLatin1String("stopActivity"), | 161 | value ? QLatin1String("startActivity") : QLatin1String("stopActivity"), | ||
162 | processingActivity); | 162 | processingActivity); | ||
163 | 163 | | |||
164 | const auto watcher = new QDBusPendingCallWatcher(call, this); | 164 | const auto watcher = new QDBusPendingCallWatcher(call, this); | ||
165 | 165 | | |||
166 | qDebug() << "Activities KSM: Telling kwin to start/stop activity : " << processingActivity << value; | 166 | qCDebug(KAMD_LOG_ACTIVITIES) << "Activities KSM: Telling kwin to start/stop activity : " << processingActivity << value; | ||
167 | QObject::connect( | 167 | QObject::connect( | ||
168 | watcher, SIGNAL(finished(QDBusPendingCallWatcher *)), | 168 | watcher, SIGNAL(finished(QDBusPendingCallWatcher *)), | ||
169 | this, | 169 | this, | ||
170 | value | 170 | value | ||
171 | ? SLOT(startCallFinished(QDBusPendingCallWatcher *)) | 171 | ? SLOT(startCallFinished(QDBusPendingCallWatcher *)) | ||
172 | : SLOT(stopCallFinished(QDBusPendingCallWatcher *))); | 172 | : SLOT(stopCallFinished(QDBusPendingCallWatcher *))); | ||
173 | } | 173 | } | ||
174 | 174 | | |||
175 | void KSMServer::Private::startCallFinished(QDBusPendingCallWatcher *call) | 175 | void KSMServer::Private::startCallFinished(QDBusPendingCallWatcher *call) | ||
176 | { | 176 | { | ||
177 | qDebug() << "Activities KSM: Start call is finished"; | 177 | qCDebug(KAMD_LOG_ACTIVITIES) << "Activities KSM: Start call is finished"; | ||
178 | QDBusPendingReply<bool> reply = *call; | 178 | QDBusPendingReply<bool> reply = *call; | ||
179 | 179 | | |||
180 | if (reply.isError()) { | 180 | if (reply.isError()) { | ||
181 | qDebug() << "Activities KSM: Error in getting a reply for start, marking as started"; | 181 | qCDebug(KAMD_LOG_ACTIVITIES) << "Activities KSM: Error in getting a reply for start, marking as started"; | ||
182 | subSessionSendEvent(KSMServer::Started); | 182 | subSessionSendEvent(KSMServer::Started); | ||
183 | 183 | | |||
184 | } else { | 184 | } else { | ||
185 | // If we got false, it means something is going on with ksmserver | 185 | // If we got false, it means something is going on with ksmserver | ||
186 | // and it didn't start our activity | 186 | // and it didn't start our activity | ||
187 | const auto retval = reply.argumentAt<0>(); | 187 | const auto retval = reply.argumentAt<0>(); | ||
188 | 188 | | |||
189 | if (!retval) { | 189 | if (!retval) { | ||
190 | qDebug() << "Activities KSM: Error starting, marking as stopped"; | 190 | qCDebug(KAMD_LOG_ACTIVITIES) << "Activities KSM: Error starting, marking as stopped"; | ||
191 | subSessionSendEvent(KSMServer::Stopped); | 191 | subSessionSendEvent(KSMServer::Stopped); | ||
192 | } else { | 192 | } else { | ||
193 | qDebug() << "Activities KSM: All OK starting, marking as starting"; | 193 | qCDebug(KAMD_LOG_ACTIVITIES) << "Activities KSM: All OK starting, marking as starting"; | ||
194 | subSessionSendEvent(KSMServer::Started); | 194 | subSessionSendEvent(KSMServer::Started); | ||
195 | } | 195 | } | ||
196 | } | 196 | } | ||
197 | 197 | | |||
198 | call->deleteLater(); | 198 | call->deleteLater(); | ||
199 | } | 199 | } | ||
200 | 200 | | |||
201 | void KSMServer::Private::stopCallFinished(QDBusPendingCallWatcher *call) | 201 | void KSMServer::Private::stopCallFinished(QDBusPendingCallWatcher *call) | ||
202 | { | 202 | { | ||
203 | qDebug() << "Activities KSM: Stop call is finished"; | 203 | qCDebug(KAMD_LOG_ACTIVITIES) << "Activities KSM: Stop call is finished"; | ||
204 | QDBusPendingReply<bool> reply = *call; | 204 | QDBusPendingReply<bool> reply = *call; | ||
205 | 205 | | |||
206 | if (reply.isError()) { | 206 | if (reply.isError()) { | ||
207 | qDebug() << "Activities KSM: Error in getting a reply for stop, marking as stopped"; | 207 | qCDebug(KAMD_LOG_ACTIVITIES) << "Activities KSM: Error in getting a reply for stop, marking as stopped"; | ||
208 | subSessionSendEvent(KSMServer::Stopped); | 208 | subSessionSendEvent(KSMServer::Stopped); | ||
209 | 209 | | |||
210 | } else { | 210 | } else { | ||
211 | // If we got false, it means something is going on with ksmserver | 211 | // If we got false, it means something is going on with ksmserver | ||
212 | // and it didn't stop our activity | 212 | // and it didn't stop our activity | ||
213 | const auto retval = reply.argumentAt<0>(); | 213 | const auto retval = reply.argumentAt<0>(); | ||
214 | 214 | | |||
215 | if (!retval) { | 215 | if (!retval) { | ||
216 | qDebug() << "Activities KSM: Error stopping, marking as started"; | 216 | qCDebug(KAMD_LOG_ACTIVITIES) << "Activities KSM: Error stopping, marking as started"; | ||
217 | subSessionSendEvent(KSMServer::FailedToStop); | 217 | subSessionSendEvent(KSMServer::FailedToStop); | ||
218 | } else { | 218 | } else { | ||
219 | qDebug() << "Activities KSM: All OK stopping, marking as stopped"; | 219 | qCDebug(KAMD_LOG_ACTIVITIES) << "Activities KSM: All OK stopping, marking as stopped"; | ||
220 | subSessionSendEvent(KSMServer::Stopped); | 220 | subSessionSendEvent(KSMServer::Stopped); | ||
221 | } | 221 | } | ||
222 | } | 222 | } | ||
223 | 223 | | |||
224 | call->deleteLater(); | 224 | call->deleteLater(); | ||
225 | } | 225 | } | ||
226 | 226 | | |||
227 | void KSMServer::Private::subSessionSendEvent(int event) | 227 | void KSMServer::Private::subSessionSendEvent(int event) | ||
Show All 9 Lines |