Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/xwindowtasksmodel.cpp
Show First 20 Lines • Show All 1009 Lines • ▼ Show 20 Line(s) | |||||
1010 | } | 1010 | } | ||
1011 | 1011 | | |||
1012 | void XWindowTasksModel::requestNewInstance(const QModelIndex &index) | 1012 | void XWindowTasksModel::requestNewInstance(const QModelIndex &index) | ||
1013 | { | 1013 | { | ||
1014 | if (!index.isValid() || index.model() != this || index.row() < 0 || index.row() >= d->windows.count()) { | 1014 | if (!index.isValid() || index.model() != this || index.row() < 0 || index.row() >= d->windows.count()) { | ||
1015 | return; | 1015 | return; | ||
1016 | } | 1016 | } | ||
1017 | 1017 | | |||
1018 | const AppData &data = d->appData(d->windows.at(index.row())); | 1018 | runApp(d->appData(d->windows.at(index.row()))); | ||
1019 | | ||||
1020 | if (data.url.isValid()) { | | |||
1021 | new KRun(data.url, 0, false, KStartupInfo::createNewStartupIdForTimestamp(QX11Info::appUserTime())); | | |||
1022 | | ||||
1023 | if (!data.id.isEmpty()) { | | |||
1024 | KActivities::ResourceInstance::notifyAccessed(QUrl(QStringLiteral("applications:") + data.id), | | |||
1025 | QStringLiteral("org.kde.libtaskmanager")); | | |||
1026 | } | | |||
1027 | } | | |||
1028 | } | 1019 | } | ||
1029 | 1020 | | |||
1030 | void XWindowTasksModel::requestOpenUrls(const QModelIndex &index, const QList<QUrl> &urls) | 1021 | void XWindowTasksModel::requestOpenUrls(const QModelIndex &index, const QList<QUrl> &urls) | ||
1031 | { | 1022 | { | ||
1032 | if (!index.isValid() || index.model() != this || index.row() < 0 | 1023 | if (!index.isValid() || index.model() != this || index.row() < 0 | ||
1033 | || index.row() >= d->windows.count() | 1024 | || index.row() >= d->windows.count() | ||
1034 | || urls.isEmpty()) { | 1025 | || urls.isEmpty()) { | ||
1035 | return; | 1026 | return; | ||
1036 | } | 1027 | } | ||
1037 | 1028 | | |||
1038 | const QUrl &url = d->appData(d->windows.at(index.row())).url; | 1029 | runApp(d->appData(d->windows.at(index.row())), urls); | ||
1039 | const KService::Ptr service = KService::serviceByDesktopPath(url.toLocalFile()); | | |||
1040 | | ||||
1041 | if (service) { | | |||
1042 | KRun::runApplication(*service, urls, nullptr, 0, {}, KStartupInfo::createNewStartupIdForTimestamp(QX11Info::appUserTime())); | | |||
1043 | | ||||
1044 | KActivities::ResourceInstance::notifyAccessed(QUrl(QStringLiteral("applications:") + service->storageId()), | | |||
1045 | QStringLiteral("org.kde.libtaskmanager")); | | |||
1046 | } | | |||
1047 | } | 1030 | } | ||
1048 | 1031 | | |||
1049 | void XWindowTasksModel::requestClose(const QModelIndex &index) | 1032 | void XWindowTasksModel::requestClose(const QModelIndex &index) | ||
1050 | { | 1033 | { | ||
1051 | if (!index.isValid() || index.model() != this || index.row() < 0 || index.row() >= d->windows.count()) { | 1034 | if (!index.isValid() || index.model() != this || index.row() < 0 || index.row() >= d->windows.count()) { | ||
1052 | return; | 1035 | return; | ||
1053 | } | 1036 | } | ||
1054 | 1037 | | |||
▲ Show 20 Lines • Show All 347 Lines • Show Last 20 Lines |