Commit 359d397b authored by Yari Polla's avatar Yari Polla
Browse files

libtaskmanager: add a property and relevant handlers to toggle tasks reordering

parent e4864862
Pipeline #169487 passed with stage
in 13 minutes and 41 seconds
......@@ -1366,6 +1366,18 @@ void TasksModel::setGroupingLauncherUrlBlacklist(const QStringList &list)
}
}
bool TasksModel::taskReorderingEnabled() const
{
return dynamicSortFilter();
}
void TasksModel::setTaskReorderingEnabled(bool enabled)
{
enabled ? setDynamicSortFilter(true) : setDynamicSortFilter(false);
Q_EMIT taskReorderingEnabledChanged();
}
QStringList TasksModel::launcherList() const
{
if (d->launcherTasksModel) {
......
......@@ -72,6 +72,7 @@ class TASKMANAGER_EXPORT TasksModel : public QSortFilterProxyModel, public Abstr
Q_PROPERTY(QStringList groupingAppIdBlacklist READ groupingAppIdBlacklist WRITE setGroupingAppIdBlacklist NOTIFY groupingAppIdBlacklistChanged)
Q_PROPERTY(QStringList groupingLauncherUrlBlacklist READ groupingLauncherUrlBlacklist WRITE setGroupingLauncherUrlBlacklist NOTIFY
groupingLauncherUrlBlacklistChanged)
Q_PROPERTY(bool taskReorderingEnabled READ taskReorderingEnabled WRITE setTaskReorderingEnabled NOTIFY taskReorderingEnabledChanged)
Q_PROPERTY(QModelIndex activeTask READ activeTask NOTIFY activeTaskChanged)
public:
......@@ -534,6 +535,20 @@ public:
**/
void setGroupingLauncherUrlBlacklist(const QStringList &list);
/**
* Enables or disables tasks reordering.
*
* @param enabled enables tasks reordering if @c true; disables it otherwise.
*/
void setTaskReorderingEnabled(bool enabled);
/**
* Returns whether tasks reordering is enabled or not.
*
* @returns whether tasks reordering is enabled or not.
*/
bool taskReorderingEnabled() const;
/**
* Finds the first active (AbstractTasksModel::IsActive) task in the model
* and returns its QModelIndex, or a null QModelIndex if no active task is
......@@ -880,6 +895,7 @@ Q_SIGNALS:
void groupingWindowTasksThresholdChanged() const;
void groupingAppIdBlacklistChanged() const;
void groupingLauncherUrlBlacklistChanged() const;
void taskReorderingEnabledChanged() const;
void activeTaskChanged() const;
protected:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment