Codebase list ktp-contact-runner / 87fdbd7
Port to KTp::Actions REVIEW: 107403 Dan Vrátil 11 years ago
1 changed file(s) with 8 addition(s) and 42 deletion(s). Raw diff Collapse all Expand all
4242 #include <KTp/Models/contact-model-item.h>
4343 #include <KTp/presence.h>
4444 #include <KTp/global-presence.h>
45 #include <KTp/actions.h>
4546
4647 struct MatchInfo {
4748 Tp::AccountPtr account;
225226 Tp::AccountPtr account = data.account;
226227 Tp::ContactPtr contact = data.contact;
227228
228 Tp::ChannelRequestHints hints;
229 hints.setHint(QLatin1String("org.freedesktop.Telepathy.ChannelRequest"),
230 QLatin1String("DelegateToPreferredHandler"),
231 QVariant(true));
232
233229 if (match.selectedAction() == action(QLatin1String("start-text-chat"))) {
234
235 account->ensureTextChat(contact,
236 QDateTime::currentDateTime(),
237 QLatin1String("org.freedesktop.Telepathy.Client.KTp.TextUi"),
238 hints);
239
230 KTp::Actions::startChat(account, contact);
240231 } else if (match.selectedAction() == action(QLatin1String("start-audio-call"))) {
241
242 account->ensureAudioCall(contact,
243 QLatin1String("audio"),
244 QDateTime::currentDateTime(),
245 QLatin1String("org.freedesktop.Telepathy.Client.KTp.CallUi"));
246
232 KTp::Actions::startAudioCall(account, contact);
247233 } else if (match.selectedAction() == action("start-video-call")) {
248
249 account->ensureAudioVideoCall(contact,
250 QLatin1String("audio"), QLatin1String("video"),
251 QDateTime::currentDateTime(),
252 QLatin1String("org.freedesktop.Telepathy.Client.KTp.CallUi"));
253
234 KTp::Actions::startAudioVideoCall(account, contact);
254235 } else if (match.selectedAction() == action("start-file-transfer")) {
255236
256 QStringList filenames = KFileDialog::getOpenFileNames(
237 QStringList filenames = KFileDialog::getOpenFileNames(
257238 KUrl("kfiledialog:///FileTransferLastDirectory"),
258239 QString(),
259240 0,
264245 }
265246
266247 Q_FOREACH (const QString &filename, filenames) {
267 Tp::FileTransferChannelCreationProperties properties(
268 filename, KMimeType::findByFileContent(filename)->name());
269
270 account->createFileTransfer(contact,
271 properties,
272 QDateTime::currentDateTime(),
273 QLatin1String("org.freedesktop.Telepathy.Client.KTp.FileTransfer"));
248 KTp::Actions::startFileTransfer(account, contact, filename);
274249 }
275250
276251 } else if (match.selectedAction() == action("start-desktop-sharing")) {
277
278 account->createStreamTube(contact,
279 QLatin1String("rfb"),
280 QDateTime::currentDateTime(),
281 QLatin1String("org.freedesktop.Telepathy.Client.krfb_rfb_handler"));
282
252 KTp::Actions::startDesktopSharing(account, contact);
283253 } else if (match.selectedAction() == action(QLatin1String("show-log-viewer"))) {
284
285 /* Use "--" so that KCmdLineArgs does not try to parse UIDs starting with "-" as arguments */
286 KToolInvocation::kdeinitExec(QLatin1String("ktp-log-viewer"),
287 QStringList() << QLatin1String("--") << account->uniqueIdentifier() << contact->id());
288
254 KTp::Actions::openLogViewer(account, contact);
289255 }
290256 }
291257