Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/concatenatetasksproxymodel.cpp
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 52 | { | |||
---|---|---|---|---|---|
59 | 59 | | |||
60 | if (m) { | 60 | if (m) { | ||
61 | // NOTE: KConcatenateRowsProxyModel offers no way to get a non-const pointer | 61 | // NOTE: KConcatenateRowsProxyModel offers no way to get a non-const pointer | ||
62 | // to one of the source models, so we have to go through a mapped index. | 62 | // to one of the source models, so we have to go through a mapped index. | ||
63 | const_cast<AbstractTasksModelIface *>(m)->requestNewInstance(sourceIndex); | 63 | const_cast<AbstractTasksModelIface *>(m)->requestNewInstance(sourceIndex); | ||
64 | } | 64 | } | ||
65 | } | 65 | } | ||
66 | 66 | | |||
67 | void ConcatenateTasksProxyModel::requestOpenUrls(const QModelIndex &index, const QList<QUrl> &urls) | ||||
68 | { | ||||
69 | if (!index.isValid() || index.model() != this) { | ||||
70 | return; | ||||
71 | } | ||||
72 | | ||||
73 | const QModelIndex &sourceIndex = mapToSource(index); | ||||
74 | const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model()); | ||||
75 | | ||||
76 | if (m) { | ||||
77 | // NOTE: KConcatenateRowsProxyModel offers no way to get a non-const pointer | ||||
78 | // to one of the source models, so we have to go through a mapped index. | ||||
79 | const_cast<AbstractTasksModelIface *>(m)->requestOpenUrls(sourceIndex, urls); | ||||
80 | } | ||||
81 | } | ||||
82 | | ||||
67 | void ConcatenateTasksProxyModel::requestClose(const QModelIndex &index) | 83 | void ConcatenateTasksProxyModel::requestClose(const QModelIndex &index) | ||
68 | { | 84 | { | ||
69 | if (!index.isValid() || index.model() != this) { | 85 | if (!index.isValid() || index.model() != this) { | ||
70 | return; | 86 | return; | ||
71 | } | 87 | } | ||
72 | 88 | | |||
73 | const QModelIndex &sourceIndex = mapToSource(index); | 89 | const QModelIndex &sourceIndex = mapToSource(index); | ||
74 | const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model()); | 90 | const AbstractTasksModelIface *m = dynamic_cast<const AbstractTasksModelIface *>(sourceIndex.model()); | ||
▲ Show 20 Lines • Show All 185 Lines • Show Last 20 Lines |