Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Workspace
Commits
c3dab9af
Commit
c3dab9af
authored
Oct 10, 2020
by
Alexander Lohnau
💬
Browse files
Clazy fixes in libtaskmanager
parent
84b54791
Changes
6
Hide whitespace changes
Inline
Side-by-side
libtaskmanager/abstractwindowtasksmodel.cpp
View file @
c3dab9af
...
...
@@ -41,7 +41,7 @@ AbstractWindowTasksModel::AbstractWindowTasksModel(QObject *parent)
auto
screenAdded
=
[
this
](
const
QScreen
*
screen
)
{
connect
(
screen
,
&
QScreen
::
geometryChanged
,
this
,
[
this
]()
{
dataChanged
(
index
(
0
,
0
),
index
(
rowCount
()
-
1
,
0
),
QVector
<
int
>
{
ScreenGeometry
});
Q_EMIT
dataChanged
(
index
(
0
,
0
),
index
(
rowCount
()
-
1
,
0
),
QVector
<
int
>
{
ScreenGeometry
});
}
);
};
...
...
libtaskmanager/launchertasksmodel.cpp
View file @
c3dab9af
...
...
@@ -108,11 +108,11 @@ void LauncherTasksModel::Private::init()
appDataCache
.
clear
();
// Emit changes of all roles satisfied from app data cache.
q
->
dataChanged
(
q
->
index
(
0
,
0
),
q
->
index
(
launchersOrder
.
count
()
-
1
,
0
),
QVector
<
int
>
{
Qt
::
DisplayRole
,
Qt
::
DecorationRole
,
AbstractTasksModel
::
AppId
,
AbstractTasksModel
::
AppName
,
AbstractTasksModel
::
GenericName
,
AbstractTasksModel
::
LauncherUrl
,
AbstractTasksModel
::
LauncherUrlWithoutIcon
});
Q_EMIT
q
->
dataChanged
(
q
->
index
(
0
,
0
),
q
->
index
(
launchersOrder
.
count
()
-
1
,
0
),
QVector
<
int
>
{
Qt
::
DisplayRole
,
Qt
::
DecorationRole
,
AbstractTasksModel
::
AppId
,
AbstractTasksModel
::
AppName
,
AbstractTasksModel
::
GenericName
,
AbstractTasksModel
::
LauncherUrl
,
AbstractTasksModel
::
LauncherUrlWithoutIcon
});
}
);
...
...
@@ -252,7 +252,8 @@ bool LauncherTasksModel::Private::requestRemoveLauncherFromActivities(const QUrl
remove
=
true
;
}
else
{
for
(
const
auto
&
activity
:
activitiesConsumer
.
activities
())
{
const
auto
_activities
=
activitiesConsumer
.
activities
();
for
(
const
auto
&
activity
:
_activities
)
{
if
(
!
activities
.
contains
(
activity
))
{
newActivities
<<
activity
;
}
else
{
...
...
@@ -372,7 +373,7 @@ QStringList LauncherTasksModel::launcherList() const
// Serializing the launchers
QStringList
result
;
for
(
const
auto
&
launcher
:
d
->
launchersOrder
)
{
for
(
const
auto
&
launcher
:
qAsConst
(
d
->
launchersOrder
)
)
{
const
auto
&
activities
=
d
->
activitiesForLauncher
[
launcher
];
QString
serializedLauncher
;
...
...
@@ -398,7 +399,6 @@ void LauncherTasksModel::setLauncherList(const QStringList &serializedLaunchers)
QHash
<
QUrl
,
ActivitiesSet
>
newActivitiesForLauncher
;
// Loading the activity to launchers map
QHash
<
QString
,
QList
<
QUrl
>>
launchersForActivitiesCandidates
;
for
(
const
auto
&
serializedLauncher
:
serializedLaunchers
)
{
QStringList
_activities
;
QUrl
url
;
...
...
@@ -422,7 +422,7 @@ void LauncherTasksModel::setLauncherList(const QStringList &serializedLaunchers)
// Filter out invalid activities
const
auto
allActivities
=
d
->
activitiesConsumer
.
activities
();
ActivitiesSet
validActivities
;
for
(
const
auto
&
activity
:
activities
)
{
for
(
const
auto
&
activity
:
qAsConst
(
activities
)
)
{
if
(
allActivities
.
contains
(
activity
))
{
validActivities
<<
activity
;
}
...
...
libtaskmanager/taskgroupingproxymodel.cpp
View file @
c3dab9af
...
...
@@ -170,7 +170,7 @@ void TaskGroupingProxyModel::Private::sourceRowsAboutToBeRemoved(const QModelInd
q
->
endRemoveRows
();
// We're no longer a group parent.
q
->
dataChanged
(
parent
,
parent
);
Q_EMIT
q
->
dataChanged
(
parent
,
parent
);
// Remove group member.
}
else
{
const
QModelIndex
parent
=
q
->
index
(
j
,
0
);
...
...
@@ -180,7 +180,7 @@ void TaskGroupingProxyModel::Private::sourceRowsAboutToBeRemoved(const QModelInd
// Various roles of the parent evaluate child data, and the
// child list has changed.
q
->
dataChanged
(
parent
,
parent
);
Q_EMIT
q
->
dataChanged
(
parent
,
parent
);
}
break
;
...
...
@@ -230,7 +230,7 @@ void TaskGroupingProxyModel::Private::sourceDataChanged(QModelIndex topLeft, QMo
// TODO: Some roles do not need to bubble up as they fall through to the first
// child in data(); it _might_ be worth adding constraints here later.
if
(
parent
.
isValid
())
{
q
->
dataChanged
(
parent
,
parent
,
roles
);
Q_EMIT
q
->
dataChanged
(
parent
,
parent
,
roles
);
}
// When Private::groupDemandingAttention is false, tryToGroup() exempts tasks
...
...
@@ -245,10 +245,10 @@ void TaskGroupingProxyModel::Private::sourceDataChanged(QModelIndex topLeft, QMo
delete
rowMap
.
takeAt
(
proxyIndex
.
row
());
q
->
endRemoveRows
();
}
else
{
q
->
dataChanged
(
proxyIndex
,
proxyIndex
,
roles
);
Q_EMIT
q
->
dataChanged
(
proxyIndex
,
proxyIndex
,
roles
);
}
}
else
{
q
->
dataChanged
(
proxyIndex
,
proxyIndex
,
roles
);
Q_EMIT
q
->
dataChanged
(
proxyIndex
,
proxyIndex
,
roles
);
}
}
}
...
...
@@ -412,7 +412,7 @@ bool TaskGroupingProxyModel::Private::tryToGroup(const QModelIndex &sourceIndex,
if
(
!
silent
)
{
q
->
endInsertRows
();
q
->
dataChanged
(
parent
,
parent
);
Q_EMIT
q
->
dataChanged
(
parent
,
parent
);
}
return
true
;
...
...
@@ -474,7 +474,7 @@ void TaskGroupingProxyModel::Private::breakGroupFor(const QModelIndex &index, bo
q
->
endRemoveRows
();
// We're no longer a group parent.
q
->
dataChanged
(
index
,
index
);
Q_EMIT
q
->
dataChanged
(
index
,
index
);
q
->
beginInsertRows
(
QModelIndex
(),
rowMap
.
count
(),
rowMap
.
count
()
+
(
extraChildren
.
count
()
-
1
));
...
...
@@ -1028,7 +1028,7 @@ void TaskGroupingProxyModel::requestToggleMaximized(const QModelIndex &index)
}
);
for
(
const
QModelIndex
&
sourceChild
:
inStackingOrder
)
{
for
(
const
QModelIndex
&
sourceChild
:
qAsConst
(
inStackingOrder
)
)
{
d
->
abstractTasksSourceModel
->
requestToggleMaximized
(
sourceChild
);
}
}
...
...
@@ -1242,7 +1242,7 @@ void TaskGroupingProxyModel::requestToggleGrouping(const QModelIndex &index)
if
(
idx
.
data
(
AbstractTasksModel
::
AppId
).
toString
()
==
appId
||
launcherUrlsMatch
(
idx
.
data
(
AbstractTasksModel
::
LauncherUrlWithoutIcon
).
toUrl
(),
launcherUrl
,
IgnoreQueryItems
))
{
dataChanged
(
idx
,
idx
,
QVector
<
int
>
{
AbstractTasksModel
::
IsGroupable
});
Q_EMIT
dataChanged
(
idx
,
idx
,
QVector
<
int
>
{
AbstractTasksModel
::
IsGroupable
});
}
}
}
...
...
libtaskmanager/tasksmodel.cpp
View file @
c3dab9af
...
...
@@ -376,7 +376,7 @@ void TasksModel::Private::initModels()
}
if
(
appsMatch
(
sourceIndex
,
filterIndex
))
{
filterProxyModel
->
dataChanged
(
filterIndex
,
filterIndex
);
Q_EMIT
filterProxyModel
->
dataChanged
(
filterIndex
,
filterIndex
);
}
}
}
...
...
@@ -432,7 +432,7 @@ void TasksModel::Private::initModels()
const
QModelIndex
&
idx
=
filterProxyModel
->
index
(
i
,
0
);
if
(
idx
.
data
(
AbstractTasksModel
::
IsLauncher
).
toBool
())
{
filterProxyModel
->
dataChanged
(
idx
,
idx
);
Q_EMIT
filterProxyModel
->
dataChanged
(
idx
,
idx
);
}
}
...
...
@@ -477,7 +477,7 @@ void TasksModel::Private::initModels()
}
if
(
appsMatch
(
sourceIndex
,
filterIndex
))
{
filterProxyModel
->
dataChanged
(
filterIndex
,
filterIndex
);
Q_EMIT
filterProxyModel
->
dataChanged
(
filterIndex
,
filterIndex
);
}
}
}
...
...
@@ -528,8 +528,8 @@ void TasksModel::Private::initLauncherTasksModel()
// to-be-removed launcherTasksModel rows using TaskTools::appsMatch().
QObject
::
connect
(
launcherTasksModel
,
&
LauncherTasksModel
::
launcherListChanged
,
q
,
[
this
]()
{
q
->
dataChanged
(
q
->
index
(
0
,
0
),
q
->
index
(
q
->
rowCount
()
-
1
,
0
),
QVector
<
int
>
{
AbstractTasksModel
::
HasLauncher
});
Q_EMIT
q
->
dataChanged
(
q
->
index
(
0
,
0
),
q
->
index
(
q
->
rowCount
()
-
1
,
0
),
QVector
<
int
>
{
AbstractTasksModel
::
HasLauncher
});
}
);
...
...
@@ -542,7 +542,7 @@ void TasksModel::Private::initLauncherTasksModel()
const
QModelIndex
&
index
=
q
->
index
(
i
,
0
);
if
(
!
index
.
data
(
AbstractTasksModel
::
IsLauncher
).
toBool
())
{
q
->
dataChanged
(
index
,
index
,
QVector
<
int
>
{
AbstractTasksModel
::
HasLauncher
});
Q_EMIT
q
->
dataChanged
(
index
,
index
,
QVector
<
int
>
{
AbstractTasksModel
::
HasLauncher
});
}
}
}
...
...
libtaskmanager/tasktools.cpp
View file @
c3dab9af
...
...
@@ -244,7 +244,7 @@ QUrl windowUrlFromMetadata(const QString &appId, quint32 pid,
return
;
}
for
(
const
auto
service
:
services
)
{
for
(
const
auto
&
service
:
services
)
{
if
(
service
->
menuId
().
startsWith
(
key
,
Qt
::
CaseInsensitive
))
{
services
.
prepend
(
service
);
return
;
...
...
libtaskmanager/xwindowtasksmodel.cpp
View file @
c3dab9af
...
...
@@ -114,12 +114,12 @@ void XWindowTasksModel::Private::init()
appDataCache
.
clear
();
// Emit changes of all roles satisfied from app data cache.
q
->
dataChanged
(
q
->
index
(
0
,
0
),
q
->
index
(
windows
.
count
()
-
1
,
0
),
QVector
<
int
>
{
Qt
::
DecorationRole
,
AbstractTasksModel
::
AppId
,
AbstractTasksModel
::
AppName
,
AbstractTasksModel
::
GenericName
,
AbstractTasksModel
::
LauncherUrl
,
AbstractTasksModel
::
LauncherUrlWithoutIcon
,
AbstractTasksModel
::
SkipTaskbar
});
Q_EMIT
q
->
dataChanged
(
q
->
index
(
0
,
0
),
q
->
index
(
windows
.
count
()
-
1
,
0
),
QVector
<
int
>
{
Qt
::
DecorationRole
,
AbstractTasksModel
::
AppId
,
AbstractTasksModel
::
AppName
,
AbstractTasksModel
::
GenericName
,
AbstractTasksModel
::
LauncherUrl
,
AbstractTasksModel
::
LauncherUrlWithoutIcon
,
AbstractTasksModel
::
SkipTaskbar
});
};
cachedStackingOrder
=
KWindowSystem
::
stackingOrder
();
...
...
@@ -200,8 +200,8 @@ void XWindowTasksModel::Private::init()
QObject
::
connect
(
KWindowSystem
::
self
(),
&
KWindowSystem
::
stackingOrderChanged
,
q
,
[
this
]()
{
cachedStackingOrder
=
KWindowSystem
::
stackingOrder
();
q
->
dataChanged
(
q
->
index
(
0
,
0
),
q
->
index
(
q
->
rowCount
()
-
1
,
0
),
QVector
<
int
>
{
StackingOrder
});
Q_EMIT
q
->
dataChanged
(
q
->
index
(
0
,
0
),
q
->
index
(
q
->
rowCount
()
-
1
,
0
),
QVector
<
int
>
{
StackingOrder
});
}
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment