diff --git a/src/presentation/CMakeLists.txt b/src/presentation/CMakeLists.txt --- a/src/presentation/CMakeLists.txt +++ b/src/presentation/CMakeLists.txt @@ -8,7 +8,6 @@ availabletaskpagesmodel.cpp availablesourcesmodel.cpp contextpagemodel.cpp - datasourcelistmodel.cpp errorhandler.cpp errorhandlingmodelbase.cpp metatypes.cpp diff --git a/src/presentation/datasourcelistmodel.h b/src/presentation/datasourcelistmodel.h deleted file mode 100644 --- a/src/presentation/datasourcelistmodel.h +++ /dev/null @@ -1,44 +0,0 @@ -/* This file is part of Zanshin - - Copyright 2014 Kevin Ottens - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License or (at your option) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - 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 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 PRESENTATION_DATASOURCELISTMODEL_H -#define PRESENTATION_DATASOURCELISTMODEL_H - -#include "domain/datasource.h" -#include "presentation/querytreemodel.h" - -namespace Presentation { - -class DataSourceListModel : public QueryTreeModel -{ - Q_OBJECT -public: - typedef std::function::Ptr()> Query; - - explicit DataSourceListModel(const Query &query, QObject *parent = Q_NULLPTR); -}; - -} - -#endif // PRESENTATION_DATASOURCELISTMODEL_H diff --git a/src/presentation/datasourcelistmodel.cpp b/src/presentation/datasourcelistmodel.cpp deleted file mode 100644 --- a/src/presentation/datasourcelistmodel.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* This file is part of Zanshin - - Copyright 2014 Kevin Ottens - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License or (at your option) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - 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 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 "datasourcelistmodel.h" - -#include - -using namespace Presentation; - -DataSourceListModel::DataSourceListModel(const Query &query, QObject *parent) - : QueryTreeModel( - [query] (const Domain::DataSource::Ptr &source) { - if (source) - return Domain::QueryResultInterface::Ptr(); - else - return query(); - }, - - // flags - [] (const Domain::DataSource::Ptr &) { - return Qt::ItemIsSelectable | Qt::ItemIsEnabled; - }, - - // data - [] (const Domain::DataSource::Ptr &source, int role) -> QVariant { - switch (role) { - case Qt::DisplayRole: - return source->name(); - case Qt::DecorationRole: - return QIcon::fromTheme(source->iconName().isEmpty() ? "folder" : source->iconName()); - case IconNameRole: - return source->iconName().isEmpty() ? "folder" : source->iconName(); - default: - return QVariant(); - } - }, - - // setData - [] (const Domain::DataSource::Ptr &, const QVariant &, int) { - return false; - }, - - parent - ) -{ -} diff --git a/tests/units/presentation/applicationmodeltest.cpp b/tests/units/presentation/applicationmodeltest.cpp --- a/tests/units/presentation/applicationmodeltest.cpp +++ b/tests/units/presentation/applicationmodeltest.cpp @@ -30,7 +30,6 @@ #include "presentation/artifacteditormodel.h" #include "presentation/availablepagesmodelinterface.h" #include "presentation/availablesourcesmodel.h" -#include "presentation/datasourcelistmodel.h" #include "presentation/errorhandler.h" #include "testlib/fakejob.h"