Added function to return activities for a specified launcher

wilder-5.14
Ivan Čukić 10 years ago
parent a8cb25a779
commit b08dea47c7
  1. 9
      libtaskmanager/launchertasksmodel.cpp
  2. 11
      libtaskmanager/launchertasksmodel.h
  3. 9
      libtaskmanager/tasksmodel.cpp
  4. 11
      libtaskmanager/tasksmodel.h

@ -455,6 +455,15 @@ bool LauncherTasksModel::requestRemoveLauncherFromActivity(const QUrl &url)
return d->requestRemoveLauncherFromActivities(url, { d->activities.currentActivity() });
}
QStringList LauncherTasksModel::launcherActivities(const QUrl &url) const
{
const auto position = launcherPosition(url);
const auto url = d->launchersOrder.at(position);
return d->activitiesForLauncher.contains(url) ? d->activitiesForLauncher[url]
: QStringList { NULL_UUID };
}
int LauncherTasksModel::launcherPosition(const QUrl &url) const
{
for (int i = 0; i < d->launchersOrder.count(); ++i) {

@ -133,6 +133,17 @@ public:
*/
bool requestRemoveLauncherFromActivity(const QUrl &url);
/**
* Return the list of activities the launcher belongs to.
* If there is no launcher with that url, the list will be empty,
* while if the launcher is on all activities, it will contain a
* null uuid.
*
* URLs are compared for equality after removing the query string used
* to hold metadata.
*/
QStringList launcherActivities(const QUrl &url) const;
/**
* Return the position of the launcher with the given URL.
*

@ -1190,6 +1190,15 @@ bool TasksModel::requestRemoveLauncherFromActivity(const QUrl &url)
return false;
}
QStringList TasksModel::launcherActivities(const QUrl &url)
{
if (d->launcherTasksModel) {
return d->launcherTasksModel->launcherActivities(url);
}
return {};
}
int TasksModel::launcherPosition(const QUrl &url) const
{
if (d->launcherTasksModel) {

@ -573,6 +573,17 @@ public:
*/
Q_INVOKABLE bool requestRemoveLauncherFromActivity(const QUrl &url);
/**
* Return the list of activities the launcher belongs to.
* If there is no launcher with that url, the list will be empty,
* while if the launcher is on all activities, it will contain a
* null uuid.
*
* URLs are compared for equality after removing the query string used
* to hold metadata.
*/
Q_INVOKABLE QStringList launcherActivities(const QUrl &url);
/**
* Return the position of the launcher with the given URL.
*

Loading…
Cancel
Save