From fa2d6b0258b99c2d8ed721873601bd6258c386d1 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Sat, 11 Apr 2015 00:50:14 +0200 Subject: [PATCH] get rid of favoritesmodel --- qmlcomponents/CMakeLists.txt | 1 - qmlcomponents/applicationlistmodel.cpp | 9 ---- qmlcomponents/applicationlistmodel.h | 5 --- qmlcomponents/favoritesmodel.cpp | 43 ------------------ qmlcomponents/favoritesmodel.h | 49 --------------------- qmlcomponents/satellitecomponentsplugin.cpp | 2 - 6 files changed, 109 deletions(-) delete mode 100644 qmlcomponents/favoritesmodel.cpp delete mode 100644 qmlcomponents/favoritesmodel.h diff --git a/qmlcomponents/CMakeLists.txt b/qmlcomponents/CMakeLists.txt index e4a4b561..b25c4777 100644 --- a/qmlcomponents/CMakeLists.txt +++ b/qmlcomponents/CMakeLists.txt @@ -3,7 +3,6 @@ project(satellitecomponents) set(satellitecomponents_SRCS satellitecomponentsplugin.cpp applicationlistmodel.cpp - favoritesmodel.cpp ) add_library(satellitecomponentsplugin SHARED ${satellitecomponents_SRCS}) diff --git a/qmlcomponents/applicationlistmodel.cpp b/qmlcomponents/applicationlistmodel.cpp index c7373448..77f54e0d 100644 --- a/qmlcomponents/applicationlistmodel.cpp +++ b/qmlcomponents/applicationlistmodel.cpp @@ -19,7 +19,6 @@ // Self #include "applicationlistmodel.h" -#include "favoritesmodel.h" // Qt #include @@ -38,9 +37,6 @@ ApplicationListModel::ApplicationListModel(QObject *parent) : QAbstractListModel(parent) { - m_favoritesModel = new FavoritesModel(this); - m_favoritesModel->setSourceModel(this); - //can't use the new syntax as this signal is overloaded connect(KSycoca::self(), SIGNAL(databaseChanged(const QStringList &)), this, SLOT(sycocaDbChanged(const QStringList &))); @@ -50,11 +46,6 @@ ApplicationListModel::~ApplicationListModel() { } -FavoritesModel *ApplicationListModel::favoritesModel() -{ - return m_favoritesModel; -} - QHash ApplicationListModel::roleNames() const { QHash roleNames; diff --git a/qmlcomponents/applicationlistmodel.h b/qmlcomponents/applicationlistmodel.h index 95b0b45e..15cc5272 100644 --- a/qmlcomponents/applicationlistmodel.h +++ b/qmlcomponents/applicationlistmodel.h @@ -27,8 +27,6 @@ class QString; -class FavoritesModel; - struct ApplicationData { QString name; QString icon; @@ -41,13 +39,11 @@ class ApplicationListModel : public QAbstractListModel { Q_PROPERTY(int count READ count NOTIFY countChanged) Q_PROPERTY(QStringList appOrder READ appOrder WRITE setAppOrder NOTIFY appOrderChanged) - Q_PROPERTY(FavoritesModel *favoritesModel READ favoritesModel CONSTANT) public: ApplicationListModel(QObject *parent = 0); virtual ~ApplicationListModel(); - FavoritesModel *favoritesModel(); int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; int count() { return m_applicationList.count(); } @@ -85,7 +81,6 @@ private: QStringList m_appOrder; QHash m_appPositions; - FavoritesModel *m_favoritesModel; }; #endif // APPLICATIONLISTMODEL_H diff --git a/qmlcomponents/favoritesmodel.cpp b/qmlcomponents/favoritesmodel.cpp deleted file mode 100644 index d37fb2a0..00000000 --- a/qmlcomponents/favoritesmodel.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2015 by Marco Martin - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "favoritesmodel.h" - -#include - -FavoritesModel::FavoritesModel(QObject *parent) - : QIdentityProxyModel(parent) -{ -} - -FavoritesModel::~FavoritesModel() -{ -} - -QHash FavoritesModel::roleNames() const -{ - return sourceModel()->roleNames(); -} - -int FavoritesModel::rowCount(const QModelIndex &parent) const -{return QIdentityProxyModel::rowCount(parent); - return qMin(QIdentityProxyModel::rowCount(parent), 4); -} - -#include "moc_favoritesmodel.cpp" diff --git a/qmlcomponents/favoritesmodel.h b/qmlcomponents/favoritesmodel.h deleted file mode 100644 index 68125b68..00000000 --- a/qmlcomponents/favoritesmodel.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2015 by Marco MArtin - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef FAVORITESMODEL_H -#define FAVORITESMODEL_H - -#include - - -class QTimer; - - -class FavoritesModel : public QIdentityProxyModel -{ - Q_OBJECT - -public: - FavoritesModel(QObject *parent = 0); - ~FavoritesModel(); - - QHash roleNames() const Q_DECL_OVERRIDE; - int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - - int count() const - { - return rowCount(); - } - -private: - -}; - -#endif diff --git a/qmlcomponents/satellitecomponentsplugin.cpp b/qmlcomponents/satellitecomponentsplugin.cpp index 8ca7311c..df97eab3 100644 --- a/qmlcomponents/satellitecomponentsplugin.cpp +++ b/qmlcomponents/satellitecomponentsplugin.cpp @@ -28,7 +28,6 @@ #include #include "applicationlistmodel.h" -#include "favoritesmodel.h" void SatelliteComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) { @@ -46,7 +45,6 @@ void SatelliteComponentsPlugin::registerTypes(const char *uri) Q_ASSERT(uri == QLatin1String("org.kde.satellite.components")); qmlRegisterType(uri, 0, 1, "ApplicationListModel"); - qmlRegisterType(); }