Port away from deprecated QConcatenateTablesProxyModel

wilder-5.24
Alexander Lohnau 4 years ago
parent 0dbec4febf
commit 25f4cce3bf
  1. 4
      applets/kicker/plugin/computermodel.cpp
  2. 4
      applets/kicker/plugin/computermodel.h
  3. 12
      libnotificationmanager/notifications.cpp
  4. 7
      libnotificationmanager/utils.cpp
  5. 2
      libtaskmanager/concatenatetasksproxymodel.cpp
  6. 6
      libtaskmanager/concatenatetasksproxymodel.h

@ -12,10 +12,10 @@
#include <QIcon> #include <QIcon>
#include <KAuthorized> #include <KAuthorized>
#include <KConcatenateRowsProxyModel>
#include <KFilePlacesModel> #include <KFilePlacesModel>
#include <KIO/OpenUrlJob> #include <KIO/OpenUrlJob>
#include <KLocalizedString> #include <KLocalizedString>
#include <QConcatenateTablesProxyModel>
#include <Solid/Device> #include <Solid/Device>
#include "krunner_interface.h" #include "krunner_interface.h"
@ -123,7 +123,7 @@ Q_INVOKABLE bool RunCommandModel::trigger(int row, const QString &actionId, cons
ComputerModel::ComputerModel(QObject *parent) ComputerModel::ComputerModel(QObject *parent)
: ForwardingModel(parent) : ForwardingModel(parent)
, m_concatProxy(new KConcatenateRowsProxyModel(this)) , m_concatProxy(new QConcatenateTablesProxyModel(this))
, m_runCommandModel(new RunCommandModel(this)) , m_runCommandModel(new RunCommandModel(this))
, m_systemAppsModel(new SimpleFavoritesModel(this)) , m_systemAppsModel(new SimpleFavoritesModel(this))
, m_filteredPlacesModel(new FilteredPlacesModel(this)) , m_filteredPlacesModel(new FilteredPlacesModel(this))

@ -14,7 +14,7 @@
class SimpleFavoritesModel; class SimpleFavoritesModel;
class KConcatenateRowsProxyModel; class QConcatenateTablesProxyModel;
class KFilePlacesModel; class KFilePlacesModel;
namespace Solid namespace Solid
@ -95,7 +95,7 @@ private Q_SLOTS:
void onSetupDone(Solid::ErrorType error, QVariant errorData, const QString &udi); void onSetupDone(Solid::ErrorType error, QVariant errorData, const QString &udi);
private: private:
KConcatenateRowsProxyModel *m_concatProxy; QConcatenateTablesProxyModel *m_concatProxy;
RunCommandModel *m_runCommandModel; RunCommandModel *m_runCommandModel;
SimpleFavoritesModel *m_systemAppsModel; SimpleFavoritesModel *m_systemAppsModel;
FilteredPlacesModel *m_filteredPlacesModel; FilteredPlacesModel *m_filteredPlacesModel;

@ -6,11 +6,11 @@
#include "notifications.h" #include "notifications.h"
#include <QConcatenateTablesProxyModel>
#include <QDebug> #include <QDebug>
#include <QMetaEnum> #include <QMetaEnum>
#include <QSharedPointer> #include <QSharedPointer>
#include <KConcatenateRowsProxyModel>
#include <KDescendantsProxyModel> #include <KDescendantsProxyModel>
#include "limitedrowcountproxymodel_p.h" #include "limitedrowcountproxymodel_p.h"
@ -67,7 +67,7 @@ public:
JobsModel::Ptr jobsModel; JobsModel::Ptr jobsModel;
QSharedPointer<Settings> settings() const; QSharedPointer<Settings> settings() const;
KConcatenateRowsProxyModel *notificationsAndJobsModel = nullptr; QConcatenateTablesProxyModel *notificationsAndJobsModel = nullptr;
NotificationFilterProxyModel *filterModel = nullptr; NotificationFilterProxyModel *filterModel = nullptr;
NotificationSortProxyModel *sortModel = nullptr; NotificationSortProxyModel *sortModel = nullptr;
@ -125,7 +125,7 @@ void Notifications::Private::initProxyModels()
* NotificationsModel JobsModel * NotificationsModel JobsModel
* \\ / * \\ /
* \\ / * \\ /
* KConcatenateRowsProxyModel * QConcatenateTablesProxyModel
* ||| * |||
* ||| * |||
* NotificationFilterProxyModel * NotificationFilterProxyModel
@ -158,7 +158,7 @@ void Notifications::Private::initProxyModels()
*/ */
if (!notificationsAndJobsModel) { if (!notificationsAndJobsModel) {
notificationsAndJobsModel = new KConcatenateRowsProxyModel(q); notificationsAndJobsModel = new QConcatenateTablesProxyModel(q);
} }
if (!filterModel) { if (!filterModel) {
@ -344,8 +344,8 @@ QModelIndex Notifications::Private::mapFromModel(const QModelIndex &idx) const
found = true; found = true;
break; break;
} }
} else if (auto *concatenateModel = qobject_cast<KConcatenateRowsProxyModel *>(model)) { } else if (auto *concatenateModel = qobject_cast<QConcatenateTablesProxyModel *>(model)) {
// There's no "sourceModels()" on KConcatenateRowsProxyModel // There's no "sourceModels()" on QConcatenateTablesProxyModel
if (idxModel == notificationsModel.data() || idxModel == jobsModel.data()) { if (idxModel == notificationsModel.data() || idxModel == jobsModel.data()) {
resolvedIdx = concatenateModel->mapFromSource(resolvedIdx); resolvedIdx = concatenateModel->mapFromSource(resolvedIdx);
found = true; found = true;

@ -10,6 +10,7 @@
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QAbstractProxyModel> #include <QAbstractProxyModel>
#include <QConcatenateTablesProxyModel>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDBusConnection> #include <QDBusConnection>
#include <QDBusConnectionInterface> #include <QDBusConnectionInterface>
@ -19,8 +20,6 @@
#include <QSettings> #include <QSettings>
#include <QTextStream> #include <QTextStream>
#include <KConcatenateRowsProxyModel>
#include <KProcessList> #include <KProcessList>
using namespace NotificationManager; using namespace NotificationManager;
@ -109,8 +108,8 @@ QModelIndex Utils::mapToModel(const QModelIndex &idx, const QAbstractItemModel *
while (resolvedIdx.isValid() && resolvedIdx.model() != sourceModel) { while (resolvedIdx.isValid() && resolvedIdx.model() != sourceModel) {
if (auto *proxyModel = qobject_cast<const QAbstractProxyModel *>(resolvedIdx.model())) { if (auto *proxyModel = qobject_cast<const QAbstractProxyModel *>(resolvedIdx.model())) {
resolvedIdx = proxyModel->mapToSource(resolvedIdx); resolvedIdx = proxyModel->mapToSource(resolvedIdx);
// KConcatenateRowsProxyModel isn't a "real" proxy model, so we need to special case for it :( // QConcatenateTablesProxyModel isn't a "real" proxy model, so we need to special case for it :(
} else if (auto *concatenateModel = qobject_cast<const KConcatenateRowsProxyModel *>(resolvedIdx.model())) { } else if (auto *concatenateModel = qobject_cast<const QConcatenateTablesProxyModel *>(resolvedIdx.model())) {
resolvedIdx = concatenateModel->mapToSource(resolvedIdx); resolvedIdx = concatenateModel->mapToSource(resolvedIdx);
} else { } else {
if (resolvedIdx.model() != sourceModel) { if (resolvedIdx.model() != sourceModel) {

@ -9,7 +9,7 @@
namespace TaskManager namespace TaskManager
{ {
ConcatenateTasksProxyModel::ConcatenateTasksProxyModel(QObject *parent) ConcatenateTasksProxyModel::ConcatenateTasksProxyModel(QObject *parent)
: KConcatenateRowsProxyModel(parent) : QConcatenateTablesProxyModel(parent)
{ {
} }

@ -8,7 +8,7 @@
#include "abstracttasksproxymodeliface.h" #include "abstracttasksproxymodeliface.h"
#include <KConcatenateRowsProxyModel> #include <QConcatenateTablesProxyModel>
#include "taskmanager_export.h" #include "taskmanager_export.h"
@ -17,13 +17,13 @@ namespace TaskManager
/** /**
* @short A proxy tasks model for concatenating multiple source tasks models. * @short A proxy tasks model for concatenating multiple source tasks models.
* *
* This proxy model is a subclass of KConcatenateRowsProxyModel implementing * This proxy model is a subclass of QConcatenateTablesProxyModel implementing
* AbstractTasksModelIface, forwarding calls to the correct source model. * AbstractTasksModelIface, forwarding calls to the correct source model.
* *
* @author Eike Hein <hein@kde.org> * @author Eike Hein <hein@kde.org>
**/ **/
class TASKMANAGER_EXPORT ConcatenateTasksProxyModel : public KConcatenateRowsProxyModel, public AbstractTasksProxyModelIface class TASKMANAGER_EXPORT ConcatenateTasksProxyModel : public QConcatenateTablesProxyModel, public AbstractTasksProxyModelIface
{ {
Q_OBJECT Q_OBJECT

Loading…
Cancel
Save