Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/tasktools.cpp
Show First 20 Lines • Show All 210 Lines • ▼ Show 20 Line(s) | 201 | if (type.compare(application, Qt::CaseInsensitive) == 0) { | |||
---|---|---|---|---|---|
211 | break; | 211 | break; | ||
212 | } | 212 | } | ||
213 | } | 213 | } | ||
214 | } | 214 | } | ||
215 | 215 | | |||
216 | return QString(""); | 216 | return QString(""); | ||
217 | } | 217 | } | ||
218 | 218 | | |||
219 | bool launcherUrlsMatch(const QUrl &_a, const QUrl &_b, UrlComparisonMode mode) | 219 | bool launcherUrlsMatch(const QUrl &a, const QUrl &b, UrlComparisonMode mode) | ||
220 | { | 220 | { | ||
221 | if (mode == IgnoreQueryItems) { | 221 | if (mode == IgnoreQueryItems) { | ||
222 | QUrl a(_a); | 222 | return (a.adjusted(QUrl::RemoveQuery) == b.adjusted(QUrl::RemoveQuery)); | ||
223 | a.setQuery(QUrlQuery()); | | |||
224 | | ||||
225 | QUrl b(_b); | | |||
226 | b.setQuery(QUrlQuery()); | | |||
227 | | ||||
228 | return (a == b); | | |||
229 | } | 223 | } | ||
230 | 224 | | |||
231 | return (_a == _b); | 225 | return (a == b); | ||
232 | } | 226 | } | ||
233 | 227 | | |||
234 | bool appsMatch(const QModelIndex &a, const QModelIndex &b) | 228 | bool appsMatch(const QModelIndex &a, const QModelIndex &b) | ||
235 | { | 229 | { | ||
236 | const QString &aAppId = a.data(AbstractTasksModel::AppId).toString(); | 230 | const QString &aAppId = a.data(AbstractTasksModel::AppId).toString(); | ||
237 | const QString &bAppId = b.data(AbstractTasksModel::AppId).toString(); | 231 | const QString &bAppId = b.data(AbstractTasksModel::AppId).toString(); | ||
238 | 232 | | |||
239 | if (!aAppId.isEmpty() && aAppId == bAppId) { | 233 | if (!aAppId.isEmpty() && aAppId == bAppId) { | ||
240 | return true; | 234 | return true; | ||
241 | } | 235 | } | ||
242 | 236 | | |||
243 | const QUrl &aLauncherUrl = a.data(AbstractTasksModel::LauncherUrl).toUrl(); | 237 | const QUrl &aUrl = a.data(AbstractTasksModel::LauncherUrlWithoutIcon).toUrl(); | ||
244 | const QUrl &bLauncherUrl = b.data(AbstractTasksModel::LauncherUrl).toUrl(); | 238 | const QUrl &bUrl = b.data(AbstractTasksModel::LauncherUrlWithoutIcon).toUrl(); | ||
245 | 239 | | |||
246 | if (aLauncherUrl.isValid() && launcherUrlsMatch(aLauncherUrl, bLauncherUrl, | 240 | if (aUrl.isValid() && aUrl == bUrl) { | ||
247 | IgnoreQueryItems)) { | | |||
248 | return true; | 241 | return true; | ||
249 | } | 242 | } | ||
250 | 243 | | |||
251 | return false; | 244 | return false; | ||
252 | } | 245 | } | ||
253 | 246 | | |||
254 | } | 247 | } |