[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: [nepomuk-widgets] /: Remove all Facet related code
From:       Sebastian TrĂ¼g <sebastian () trueg ! de>
Date:       2013-04-16 11:57:06
Message-ID: 516D3C92.70505 () trueg ! de
[Download RAW message or body]

Hi Vishesh,

all in all it is the right move to remove that code at this point. 
However, I think there is some pretty good code and concepts in there 
that might be worth recycling for a new facet system...

On 04/16/2013 12:38 PM, Vishesh Handa wrote:
> Git commit 69224f8d5d509fd7fa2c3e7dfe0d9466579f7f2a by Vishesh Handa.
> Committed on 16/04/2013 at 12:31.
> Pushed by vhanda into branch 'master'.
> 
> Remove all Facet related code
> 
> It isn't being compiled / shipped or used anywhere. Plus, some of the
> tests are failing. If someone really needs this code, then this commit
> can be reverted.
> 
> M  +0    -26   CMakeLists.txt
> M  +0    -47   test/CMakeLists.txt
> D  +0    -417  test/dynamicresourcefacettest.cpp
> D  +0    -68   test/dynamicresourcefacettest.h
> D  +0    -215  test/facetmodeltest.cpp
> D  +0    -37   test/facetmodeltest.h
> D  +0    -152  test/proxyfacettest.cpp
> D  +0    -38   test/proxyfacettest.h
> D  +0    -282  test/simplefacettest.cpp
> D  +0    -39   test/simplefacettest.h
> D  +0    -105  test/typefacettest.cpp
> D  +0    -39   test/typefacettest.h
> D  +0    -420  utils/datefacet.cpp
> D  +0    -228  utils/datefacet.h
> D  +0    -264  utils/daterange.cpp
> D  +0    -214  utils/daterange.h
> D  +0    -337  utils/daterangeselectionwidget.cpp
> D  +0    -91   utils/daterangeselectionwidget.h
> D  +0    -123  utils/daterangeselectionwidget.ui
> D  +0    -421  utils/dynamicresourcefacet.cpp
> D  +0    -271  utils/dynamicresourcefacet.h
> D  +0    -92   utils/dynamicresourcefacet_p.h
> D  +0    -200  utils/facet.cpp
> D  +0    -318  utils/facet.h
> D  +0    -85   utils/facetdelegate.cpp
> D  +0    -47   utils/facetdelegate.h
> D  +0    -45   utils/facetfiltermodel.cpp
> D  +0    -56   utils/facetfiltermodel.h
> D  +0    -413  utils/facetmodel.cpp
> D  +0    -232  utils/facetmodel.h
> D  +0    -131  utils/facetwidget.cpp
> D  +0    -136  utils/facetwidget.h
> D  +0    -214  utils/proxyfacet.cpp
> D  +0    -160  utils/proxyfacet.h
> D  +0    -156  utils/searchlineedit.cpp
> D  +0    -97   utils/searchlineedit.h
> D  +0    -317  utils/searchwidget.cpp
> D  +0    -214  utils/searchwidget.h
> D  +0    -82   utils/searchwidget_p.h
> D  +0    -267  utils/simplefacet.cpp
> D  +0    -152  utils/simplefacet.h
> D  +0    -419  utils/typefacet.cpp
> D  +0    -56   utils/typefacet.h
> 
> http://commits.kde.org/nepomuk-widgets/69224f8d5d509fd7fa2c3e7dfe0d9466579f7f2a
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 222e0c0..0281d38 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -68,28 +68,9 @@ set(nepomuk_ui_SRCS
> )
> 
> set(nepomukutils_SRCS
> -  utils/typefacet.cpp
> -
> -  utils/facetdelegate.cpp
> -  utils/facetwidget.cpp
> -  utils/facetmodel.cpp
> -  utils/facetfiltermodel.cpp
> -  utils/facet.cpp
> -  utils/simplefacet.cpp
> -  utils/dynamicresourcefacet.cpp
> -  utils/datefacet.cpp
> -  utils/proxyfacet.cpp
> -
> -  utils/daterange.cpp
> -  utils/daterangeselectionwidget.cpp
> -
> utils/resourcemodel.cpp
> -  utils/searchlineedit.cpp
> -  utils/searchwidget.cpp
> )
> 
> -kde4_add_ui_files(nepomukutils_SRCS utils/daterangeselectionwidget.ui)
> -
> set(nepomukwidgets_SRCS ${nepomuk_ui_SRCS} ${nepomukutils_SRCS})
> 
> kde4_add_library(nepomukwidgets SHARED ${LIBRARY_TYPE} ${nepomukwidgets_SRCS})
> @@ -125,13 +106,6 @@ install(FILES
> ui/filemetadatawidget.h
> utils/resourcemodel.h
> 
> -#  utils/facet.h
> -#  utils/simplefacet.h
> -#  utils/dynamicresourcefacet.h
> -#  utils/proxyfacet.h
> -#  utils/facetwidget.h
> -#  utils/searchwidget.h
> -
> DESTINATION ${INCLUDE_INSTALL_DIR}/nepomuk2 COMPONENT Devel
> )
> 
> diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
> index b91e31c..af36e68 100644
> --- a/test/CMakeLists.txt
> +++ b/test/CMakeLists.txt
> @@ -24,50 +24,3 @@ target_link_libraries(metadatawidgetapp
> nepomukwidgets
> )
> 
> -# Facet tests
> -# -----------------------------------
> -kde4_add_unit_test(simplefacettest TESTNAME nepomuk-simplefacettest \
>                 simplefacettest.cpp)
> -target_link_libraries(simplefacettest
> -  ${QT_QTTEST_LIBRARY}
> -  ${SOPRANO_LIBRARIES}
> -  ${KDE4_KDECORE_LIBS}
> -  ${NEPOMUK_CORE_LIBRARY}
> -  nepomukwidgets
> -)
> -
> -kde4_add_unit_test(dynamicresourcefacettest TESTNAME \
>                 nepomuk-dynamicresourcefacettest dynamicresourcefacettest.cpp)
> -target_link_libraries(dynamicresourcefacettest
> -  ${QT_QTTEST_LIBRARY}
> -  ${SOPRANO_LIBRARIES}
> -  ${KDE4_KDECORE_LIBS}
> -  ${NEPOMUK_CORE_LIBRARY}
> -  nepomukwidgets
> -)
> -
> -kde4_add_unit_test(proxyfacettest TESTNAME nepomuk-proxyfacettest \
>                 proxyfacettest.cpp)
> -target_link_libraries(proxyfacettest
> -  ${QT_QTTEST_LIBRARY}
> -  ${SOPRANO_LIBRARIES}
> -  ${KDE4_KDECORE_LIBS}
> -  ${NEPOMUK_CORE_LIBRARY}
> -  nepomukwidgets
> -)
> -
> -kde4_add_unit_test(facetmodeltest TESTNAME nepomuk-facetmodeltest \
>                 facetmodeltest.cpp)
> -target_link_libraries(facetmodeltest
> -  ${QT_QTTEST_LIBRARY}
> -  ${SOPRANO_LIBRARIES}
> -  ${KDE4_KDECORE_LIBS}
> -  ${NEPOMUK_CORE_LIBRARY}
> -  nepomukwidgets
> -)
> -
> -kde4_add_unit_test(typefacettest TESTNAME nepomuk-typefacettest typefacettest.cpp)
> -target_link_libraries(typefacettest
> -  ${QT_QTTEST_LIBRARY}
> -  ${SOPRANO_LIBRARIES}
> -  ${KDE4_KDECORE_LIBS}
> -  ${NEPOMUK_CORE_LIBRARY}
> -  nepomukwidgets
> -)
> -
> diff --git a/test/dynamicresourcefacettest.cpp b/test/dynamicresourcefacettest.cpp
> deleted file mode 100644
> index 5204326..0000000
> --- a/test/dynamicresourcefacettest.cpp
> +++ /dev/null
> @@ -1,417 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "dynamicresourcefacettest.h"
> -#include "qtest_querytostring.h"
> -
> -#include "dynamicresourcefacet.h"
> -#include "dynamicresourcefacet_p.h"
> -
> -#include <Nepomuk2/Query/ComparisonTerm>
> -#include <Nepomuk2/Query/ResourceTerm>
> -#include <Nepomuk2/Query/ResourceTypeTerm>
> -#include <Nepomuk2/Query/AndTerm>
> -#include <Nepomuk2/Query/OrTerm>
> -
> -#include <Nepomuk2/ResourceManager>
> -#include <Nepomuk2/Tag>
> -
> -#include <Soprano/LiteralValue>
> -#include <Soprano/Node>
> -#include <Soprano/QueryResultIterator>
> -#include <Soprano/StorageModel>
> -#include <Soprano/Backend>
> -#include <Soprano/PluginManager>
> -#include <Soprano/Vocabulary/NAO>
> -#include <Soprano/Vocabulary/NRL>
> -#include <Soprano/Vocabulary/RDF>
> -#include <Soprano/Vocabulary/RDFS>
> -#include <Soprano/Vocabulary/XMLSchema>
> -
> -#include <QtCore/QEventLoop>
> -#include <QtCore/QTimer>
> -#include <QSignalSpy>
> -
> -#include <QtTest>
> -#include <qtest_kde.h>
> -#include <kdebug.h>
> -
> -using namespace Nepomuk2;
> -using namespace Nepomuk2::Utils;
> -using namespace Nepomuk2::Query;
> -using namespace Nepomuk2::Types;
> -
> -
> -class DynamicResourceTestFacet::TestPrivate : public DynamicResourceFacet::Private
> -{
> -public:
> -    void startQuery( const Nepomuk2::Query::Query& query ) {
> -        // we cannot use the query service since that would ignore our custom \
>                 model
> -        // thus, we perform a sync query and call _k_newEntries async from there
> -        Nepomuk2::Query::Query ourQuery(query);
> -        // disable result restrictions since we do not support those in our custom \
>                 model
> -        ourQuery.setQueryFlags(Nepomuk2::Query::Query::NoResultRestrictions);
> -        Soprano::QueryResultIterator it = \
> ResourceManager::instance()->mainModel()->executeQuery( ourQuery.toSparqlQuery(), \
>                 Soprano::Query::QueryLanguageSparql );
> -        QList<Nepomuk2::Query::Result> results;
> -        while( it.next() ) {
> -            results << Result( it[0].uri() );
> -        }
> -        QMetaObject::invokeMethod( q, "_k_newEntries", Qt::QueuedConnection, \
>                 Q_ARG(QList<Nepomuk2::Query::Result>, results) );
> -    }
> -};
> -
> -
> -DynamicResourceTestFacet::DynamicResourceTestFacet()
> -    : DynamicResourceFacet() {
> -    // replace the private thingi with our own implementation
> -    delete d;
> -    d = new TestPrivate;
> -    d->q = this;
> -}
> -
> -
> -namespace {
> -
> -    void waitForSignal( QObject* object, const char* signal, int timeout = 500 )
> -    {
> -        QEventLoop loop;
> -        loop.connect(object, signal, SLOT(quit()));
> -        QTimer::singleShot(timeout, &loop, SLOT(quit()));
> -        loop.exec();
> -    }
> -
> -    Term buildTagTerm( const Tag& tag ) {
> -        return Soprano::Vocabulary::NAO::hasTag() == ResourceTerm(tag);
> -    }
> -
> -    Term buildTagTermAll( const QList<Tag>& tags ) {
> -        AndTerm t;
> -        foreach( const Tag& tag, tags )
> -            t.addSubTerm( buildTagTerm(tag) );
> -        return t.optimized();
> -    }
> -
> -    Term buildTagTermAny( const QList<Tag>& tags ) {
> -        OrTerm t;
> -        foreach( const Tag& tag, tags )
> -            t.addSubTerm( buildTagTerm(tag) );
> -        return t.optimized();
> -    }
> -}
> -
> -
> -void DynamicResourceFacetTest::initTestCase()
> -{
> -    // We create a dummy model with some simple test data in it
> -    const Soprano::Backend* backend = \
>                 Soprano::PluginManager::instance()->discoverBackendByName( \
>                 "virtuosobackend" );
> -    QVERIFY( backend );
> -    m_storageDir = new KTempDir();
> -    m_model = backend->createModel( Soprano::BackendSettings() << \
>                 Soprano::BackendSetting(Soprano::BackendOptionStorageDir, \
>                 m_storageDir->name()) );
> -    QVERIFY( m_model );
> -
> -    Nepomuk2::ResourceManager::instance()->setOverrideMainModel( m_model );
> -
> -    // We need basic ontology knowledge for the ResourceTypeTerm queries to work \
>                 properly
> -    const QUrl graph = \
>                 Nepomuk2::ResourceManager::instance()->generateUniqueUri(QString());
>                 
> -    m_model->addStatement(graph, Soprano::Vocabulary::RDF::type(), \
>                 Soprano::Vocabulary::NRL::Ontology(), graph);
> -    m_model->addStatement(graph, Soprano::Vocabulary::RDF::type(), \
>                 Soprano::Vocabulary::NRL::InstanceBase(), graph);
> -    m_model->addStatement(Soprano::Vocabulary::NAO::Tag(), \
>                 Soprano::Vocabulary::RDFS::subClassOf(), \
>                 Soprano::Vocabulary::NAO::Tag(), graph);
> -    m_model->addStatement(Soprano::Vocabulary::NAO::hasTag(), \
>                 Soprano::Vocabulary::RDF::type(), \
>                 Soprano::Vocabulary::RDF::Property(), graph);
> -    m_model->addStatement(Soprano::Vocabulary::NAO::hasTag(), \
>                 Soprano::Vocabulary::RDFS::range(), \
>                 Soprano::Vocabulary::NAO::Tag(), graph);
> -
> -    // now some tags which will be our test resources
> -    tag1 = Nepomuk2::Tag( QLatin1String("Tag 1") );
> -    tag1.setLabel( QLatin1String("Tag 1") );
> -    kDebug() << tag1.uri() << tag1.label();
> -    tag2 = Nepomuk2::Tag( QLatin1String("Tag 2") );
> -    tag2.setLabel( QLatin1String("Tag 2") );
> -    kDebug() << tag2.uri() << tag2.label();
> -    tag3 = Nepomuk2::Tag( QLatin1String("Tag 3") );
> -    tag3.setLabel( QLatin1String("Tag 3") );
> -    kDebug() << tag3.uri() << tag3.label();
> -    tag4 = Nepomuk2::Tag( QLatin1String("Tag 4") );
> -    tag4.setLabel( QLatin1String("Tag 4") );
> -    kDebug() << tag4.uri() << tag4.label();
> -
> -    // and some random resources that we will use for testing setClientQuery
> -    Resource res1;
> -    res1.addTag(tag1);
> -    res1.addTag(tag2);
> -    res1.addTag(tag3);
> -
> -    Resource res2;
> -    res2.addTag(tag2);
> -    res2.addTag(tag3);
> -
> -    Resource res3;
> -    res3.addTag(tag4);
> -
> -    // nothing is tagged with tag4
> -}
> -
> -
> -void DynamicResourceFacetTest::cleanupTestCase()
> -{
> -    Nepomuk2::ResourceManager::instance()->setOverrideMainModel( 0 );
> -    delete m_model;
> -    delete m_storageDir;
> -}
> -
> -
> -void DynamicResourceFacetTest::testEmptyFacet()
> -{
> -    DynamicResourceFacet f;
> -    QCOMPARE(f.count(), 0);
> -    QCOMPARE(f.queryTerm(), Term());
> -}
> -
> -
> -void DynamicResourceFacetTest::testSetRelation()
> -{
> -    DynamicResourceFacet f;
> -    f.setRelation(Soprano::Vocabulary::NAO::hasTag());
> -    QCOMPARE(f.resourceType(), \
>                 Nepomuk2::Types::Class(Soprano::Vocabulary::NAO::Tag()));
> -}
> -
> -
> -void DynamicResourceFacetTest::testMatchOne()
> -{
> -    DynamicResourceTestFacet f;
> -    f.setRelation(Soprano::Vocabulary::NAO::hasTag());
> -    f.setSelectionMode(Facet::MatchOne);
> -
> -    // wait for the facet to be populated. Since this is happening async
> -    // and there might be any number of layoutChanged() signals between 1 and 4
> -    // we can only wait for the number of choices to become 4
> -    int i = 4;
> -    while( f.count() < 4 && i-- > 0 ) {
> -        waitForSignal(&f, SIGNAL(layoutChanged(Nepomuk2::Utils::Facet*)));
> -    }
> -    QCOMPARE(f.count(), 4);
> -
> -    // now the facet is initially populated
> -    // test the matchone selection
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QVERIFY(!f.isSelected(2));
> -    QVERIFY(!f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 1);
> -    QCOMPARE(f.selectedResources().first(), f.resourceAt(0));
> -    QCOMPARE(f.queryTerm(), buildTagTerm(f.resourceAt(0)));
> -
> -    f.setSelected(2);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QVERIFY(f.isSelected(2));
> -    QVERIFY(!f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 1);
> -    QCOMPARE(f.selectedResources().first(), f.resourceAt(2));
> -    QCOMPARE(f.queryTerm(), buildTagTerm(f.resourceAt(2)));
> -
> -    f.setSelected(2, false);
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QVERIFY(!f.isSelected(2));
> -    QVERIFY(!f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 1);
> -    QCOMPARE(f.selectedResources().first(), f.resourceAt(0));
> -    QCOMPARE(f.queryTerm(), buildTagTerm(f.resourceAt(0)));
> -
> -    f.setSelected(1);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QVERIFY(!f.isSelected(2));
> -    QVERIFY(!f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 1);
> -    QCOMPARE(f.selectedResources().first(), f.resourceAt(1));
> -    QCOMPARE(f.queryTerm(), buildTagTerm(f.resourceAt(1)));
> -
> -    f.setSelected(3);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QVERIFY(!f.isSelected(2));
> -    QVERIFY(f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 1);
> -    QCOMPARE(f.selectedResources().first(), f.resourceAt(3));
> -    QCOMPARE(f.queryTerm(), buildTagTerm(f.resourceAt(3)));
> -
> -    f.clearSelection();
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QVERIFY(!f.isSelected(2));
> -    QVERIFY(!f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 1);
> -    QCOMPARE(f.selectedResources().first(), f.resourceAt(0));
> -    QCOMPARE(f.queryTerm(), buildTagTerm(f.resourceAt(0)));
> -}
> -
> -
> -void DynamicResourceFacetTest::testMatchAll()
> -{
> -    DynamicResourceTestFacet f;
> -    f.setRelation(Soprano::Vocabulary::NAO::hasTag());
> -    f.setSelectionMode(Facet::MatchAll);
> -
> -    // wait for the facet to be populated. Since this is happening async
> -    // and there might be any number of layoutChanged() signals between 1 and 4
> -    // we can only wait for the number of choices to become 4
> -    int i = 4;
> -    while( f.count() < 4 && i-- > 0 ) {
> -        waitForSignal(&f, SIGNAL(layoutChanged(Nepomuk2::Utils::Facet*)));
> -    }
> -    QCOMPARE(f.count(), 4);
> -
> -    // now the facet is initially populated
> -    // test the matchall selection
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QVERIFY(!f.isSelected(2));
> -    QVERIFY(!f.isSelected(3));
> -    QCOMPARE(f.queryTerm(), Term());
> -    QCOMPARE(f.selectedResources().count(), 0);
> -
> -    f.setSelected(2);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QVERIFY(f.isSelected(2));
> -    QVERIFY(!f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 1);
> -    QCOMPARE(f.selectedResources().first(), f.resourceAt(2));
> -    QCOMPARE(f.queryTerm(), buildTagTerm(f.resourceAt(2)));
> -
> -    f.setSelected(1);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QVERIFY(f.isSelected(2));
> -    QVERIFY(!f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 2);
> -    QCOMPARE(f.queryTerm(), buildTagTermAll(QList<Tag>() << f.resourceAt(1) << \
>                 f.resourceAt(2)));
> -
> -    f.setSelected(3);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QVERIFY(f.isSelected(2));
> -    QVERIFY(f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 3);
> -    QCOMPARE(f.queryTerm(), buildTagTermAll(QList<Tag>() << f.resourceAt(1) << \
>                 f.resourceAt(2) << f.resourceAt(3)));
> -
> -    f.setSelected(2, false);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QVERIFY(!f.isSelected(2));
> -    QVERIFY(f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 2);
> -    QCOMPARE(f.queryTerm(), buildTagTermAll(QList<Tag>() << f.resourceAt(1) << \
>                 f.resourceAt(3)));
> -
> -    f.clearSelection();
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QVERIFY(!f.isSelected(2));
> -    QVERIFY(!f.isSelected(3));
> -    QCOMPARE(f.queryTerm(), Term());
> -    QCOMPARE(f.selectedResources().count(), 0);
> -}
> -
> -
> -void DynamicResourceFacetTest::testMatchAny()
> -{
> -    DynamicResourceTestFacet f;
> -    f.setRelation(Soprano::Vocabulary::NAO::hasTag());
> -    f.setSelectionMode(Facet::MatchAny);
> -
> -    // wait for the facet to be populated. Since this is happening async
> -    // and there might be any number of layoutChanged() signals between 1 and 4
> -    // we can only wait for the number of choices to become 4
> -    int i = 4;
> -    while( f.count() < 4 && i-- > 0 ) {
> -        waitForSignal(&f, SIGNAL(layoutChanged(Nepomuk2::Utils::Facet*)));
> -    }
> -    QCOMPARE(f.count(), 4);
> -
> -    // now the facet is initially populated
> -    // test the matchall selection
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QVERIFY(!f.isSelected(2));
> -    QVERIFY(!f.isSelected(3));
> -    QCOMPARE(f.queryTerm(), Term());
> -    QCOMPARE(f.selectedResources().count(), 0);
> -
> -    f.setSelected(2);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QVERIFY(f.isSelected(2));
> -    QVERIFY(!f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 1);
> -    QCOMPARE(f.selectedResources().first(), f.resourceAt(2));
> -    QCOMPARE(f.queryTerm(), buildTagTerm(f.resourceAt(2)));
> -
> -    f.setSelected(1);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QVERIFY(f.isSelected(2));
> -    QVERIFY(!f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 2);
> -    QCOMPARE(f.queryTerm(), buildTagTermAny(QList<Tag>() << f.resourceAt(1) << \
>                 f.resourceAt(2)));
> -
> -    f.setSelected(3);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QVERIFY(f.isSelected(2));
> -    QVERIFY(f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 3);
> -    QCOMPARE(f.queryTerm(), buildTagTermAny(QList<Tag>() << f.resourceAt(1) << \
>                 f.resourceAt(2) << f.resourceAt(3)));
> -
> -    f.setSelected(2, false);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QVERIFY(!f.isSelected(2));
> -    QVERIFY(f.isSelected(3));
> -    QCOMPARE(f.selectedResources().count(), 2);
> -    QCOMPARE(f.queryTerm(), buildTagTermAny(QList<Tag>() << f.resourceAt(1) << \
>                 f.resourceAt(3)));
> -
> -    f.clearSelection();
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QVERIFY(!f.isSelected(2));
> -    QVERIFY(!f.isSelected(3));
> -    QCOMPARE(f.queryTerm(), Term());
> -    QCOMPARE(f.selectedResources().count(), 0);
> -}
> -
> -
> -void DynamicResourceFacetTest::testSetClientQuery()
> -{
> -//    DynamicResourceTestFacet f;
> -//    f.setRelation(Soprano::Vocabulary::NAO::hasTag());
> -//    f.setSelectionMode(Facet::MatchAny);
> -
> -//    // wait for the facet to be populated. Since this is happening async
> -//    // and there might be any number of layoutChanged() signals between 1 and 4
> -//    // we can only wait for the number of choices to become 4
> -//    int i = 4;
> -//    while( f.count() < 4 && i-- > 0 ) {
> -//        waitForSignal(&f, SIGNAL(layoutChanged(Nepomuk2::Utils::Facet*)));
> -//    }
> -//    QCOMPARE(f.count(), 4);
> -}
> -
> -QTEST_KDEMAIN_CORE(DynamicResourceFacetTest)
> diff --git a/test/dynamicresourcefacettest.h b/test/dynamicresourcefacettest.h
> deleted file mode 100644
> index 31ec328..0000000
> --- a/test/dynamicresourcefacettest.h
> +++ /dev/null
> @@ -1,68 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef DYNAMICRESOURCEFACETTEST_H
> -#define DYNAMICRESOURCEFACETTEST_H
> -
> -#include <QObject>
> -#include <KTempDir>
> -#include <Nepomuk2/Tag>
> -#include "dynamicresourcefacet.h"
> -
> -#include <Soprano/Model>
> -
> -/**
> - * The only point of deriving from DynamicResourceFacet is to not use the query \
>                 service
> - * which would ignore our custom model. This is done by touching the public API as \
>                 little
> - * as possible. The only change necessary is a friend class declaration in the \
>                 dynamicresourcefacet.h
> - * header.
> - */
> -class DynamicResourceTestFacet : public Nepomuk2::Utils::DynamicResourceFacet
> -{
> -public:
> -    DynamicResourceTestFacet();
> -
> -private:
> -    class TestPrivate;
> -};
> -
> -
> -class DynamicResourceFacetTest : public QObject
> -{
> -    Q_OBJECT
> -
> -private slots:
> -    void initTestCase();
> -    void cleanupTestCase();
> -    void testEmptyFacet();
> -    void testSetRelation();
> -    void testMatchOne();
> -    void testMatchAll();
> -    void testMatchAny();
> -    void testSetClientQuery();
> -
> -private:
> -    KTempDir* m_storageDir;
> -    Soprano::Model* m_model;
> -    Nepomuk2::Tag tag1, tag2, tag3, tag4;
> -};
> -
> -#endif // DYNAMICRESOURCEFACETTEST_H
> diff --git a/test/facetmodeltest.cpp b/test/facetmodeltest.cpp
> deleted file mode 100644
> index 0b7f635..0000000
> --- a/test/facetmodeltest.cpp
> +++ /dev/null
> @@ -1,215 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "facetmodeltest.h"
> -#include "qtest_kde.h"
> -#include "qtest_querytostring.h"
> -
> -#include "facetmodel.h"
> -#include "simplefacet.h"
> -#include "proxyfacet.h"
> -
> -#include <Nepomuk2/Query/ComparisonTerm>
> -#include <Nepomuk2/Query/ResourceTypeTerm>
> -#include <Nepomuk2/Query/LiteralTerm>
> -#include <Nepomuk2/Vocabulary/NFO>
> -
> -#include <Soprano/Vocabulary/NAO>
> -
> -using namespace Nepomuk2::Utils;
> -using namespace Nepomuk2::Query;
> -
> -
> -void FacetModelTest::testExtractFacetsFromTermWithVaryingSelectionMode()
> -{
> -    const Term term1 = ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag());
> -    const Term term2 = ResourceTypeTerm(Soprano::Vocabulary::NAO::Party());
> -
> -    SimpleFacet* f = new SimpleFacet;
> -    f->addTerm( QLatin1String("t1"), term1 );
> -    f->addTerm( QLatin1String("t2"), term2 );
> -
> -    FacetModel model;
> -    model.addFacet(f);
> -
> -    // Test AND combination of terms for each selection mode
> -    // =====================================================
> -
> -    // in MatchOne mode only one term should be extracted
> -    f->setSelectionMode(Facet::MatchOne);
> -    QCOMPARE( model.extractFacetsFromQuery(Query(term1 && term2)), Query(term2) );
> -    QCOMPARE( model.queryTerm(), term1 );
> -
> -    // in MatchAll mode both terms should be extracted
> -    f->setSelectionMode(Facet::MatchAll);
> -    QCOMPARE( model.extractFacetsFromQuery(Query(term1 && term2)), Query() );
> -    QCOMPARE( model.queryTerm(), term1 && term2 );
> -
> -    // in MatchAny mode no term should be extracted
> -    f->setSelectionMode(Facet::MatchAny);
> -    QCOMPARE( model.extractFacetsFromQuery(Query(term1 && term2)), Query(term2) );
> -    QCOMPARE( model.queryTerm(), term1 );
> -
> -
> -    // Test OR combination of terms for each selection mode
> -    // =====================================================
> -
> -    // in MatchOne mode no term should be selected
> -    f->setSelectionMode(Facet::MatchOne);
> -    QCOMPARE( model.extractFacetsFromQuery(Query(term1 || term2)), Query(term1 || \
>                 term2) );
> -    QCOMPARE( model.queryTerm(), term1 );
> -
> -    // in MatchAll mode no term should be extracted
> -    f->setSelectionMode(Facet::MatchAll);
> -    QCOMPARE( model.extractFacetsFromQuery(Query(term1 || term2)), Query(term1 || \
>                 term2) );
> -    QCOMPARE( model.queryTerm(), Term() );
> -
> -    // in MatchAny mode both terms should be extracted
> -    f->setSelectionMode(Facet::MatchAny);
> -    QCOMPARE( model.extractFacetsFromQuery(Query(term1 || term2)), Query() );
> -    QCOMPARE( model.queryTerm(), term1 || term2 );
> -}
> -
> -
> -void FacetModelTest::testExtractFacetsFromTermWithMultipleFacets()
> -{
> -    FacetModel model;
> -
> -    SimpleFacet* f1 = new SimpleFacet;
> -    f1->setSelectionMode(Facet::MatchOne);
> -    f1->addTerm( QLatin1String("t1"), Term() );
> -    f1->addTerm( QLatin1String("t2"), \
>                 ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag()) );
> -    f1->addTerm( QLatin1String("t3"), \
>                 ResourceTypeTerm(Soprano::Vocabulary::NAO::Party()) );
> -    f1->addTerm( QLatin1String("t4"), \
>                 ResourceTypeTerm(Soprano::Vocabulary::NAO::Symbol()) );
> -    model.addFacet(f1);
> -
> -    SimpleFacet* f2 = new SimpleFacet;
> -    f2->setSelectionMode(Facet::MatchAll);
> -    f2->addTerm( QLatin1String("t2"), Soprano::Vocabulary::NAO::numericRating() == \
>                 LiteralTerm(2) );
> -    f2->addTerm( QLatin1String("t3"), Soprano::Vocabulary::NAO::numericRating() == \
>                 LiteralTerm(3) );
> -    f2->addTerm( QLatin1String("t4"), Soprano::Vocabulary::NAO::numericRating() == \
>                 LiteralTerm(4) );
> -    model.addFacet(f2);
> -
> -    SimpleFacet* f3 = new SimpleFacet;
> -    f3->setSelectionMode(Facet::MatchAny);
> -    f3->addTerm( QLatin1String("t2"), Soprano::Vocabulary::NAO::prefLabel() == \
>                 LiteralTerm(QLatin1String("l1")) );
> -    f3->addTerm( QLatin1String("t3"), Soprano::Vocabulary::NAO::prefLabel() == \
>                 LiteralTerm(QLatin1String("l2")) );
> -    f3->addTerm( QLatin1String("t4"), Soprano::Vocabulary::NAO::prefLabel() == \
>                 LiteralTerm(QLatin1String("l3")) );
> -    model.addFacet(f3);
> -
> -    // now we test all kinds of combinations of the above terms to see if they are \
>                 extracted correctly
> -
> -    model.clearSelection();
> -    Term testTerm = f1->termAt(1) && f2->termAt(0) && f3->termAt(0);
> -    Term restTerm;
> -    Term queryTerm = testTerm;
> -    QCOMPARE( model.extractFacetsFromQuery(Query(testTerm)), Query(restTerm) );
> -    QCOMPARE( model.queryTerm(), queryTerm );
> -    QCOMPARE( model.queryTerm() && restTerm, testTerm );
> -
> -    model.clearSelection();
> -    testTerm = f2->termAt(0) && f2->termAt(1) && f3->termAt(0);
> -    restTerm = Term();
> -    queryTerm = testTerm;
> -    QCOMPARE( model.extractFacetsFromQuery(Query(testTerm)), Query(restTerm) );
> -    QCOMPARE( model.queryTerm(), queryTerm );
> -    QCOMPARE( model.queryTerm() && restTerm, testTerm );
> -
> -    model.clearSelection();
> -    testTerm = f1->termAt(1) && f2->termAt(0) && f3->termAt(0) && f3->termAt(1);
> -    restTerm = f3->termAt(1);
> -    queryTerm = f1->termAt(1) && f2->termAt(0) && f3->termAt(0);
> -    QCOMPARE( model.extractFacetsFromQuery(Query(testTerm)), Query(restTerm) );
> -    QCOMPARE( model.queryTerm(), queryTerm );
> -    QCOMPARE( model.queryTerm() && restTerm, testTerm );
> -
> -    model.clearSelection();
> -    testTerm = f1->termAt(1) && f2->termAt(0) && ( f3->termAt(0) || f3->termAt(1) \
>                 );
> -    restTerm = Term();
> -    queryTerm = testTerm;
> -    QCOMPARE( model.extractFacetsFromQuery(Query(testTerm)), Query(restTerm) );
> -    QCOMPARE( model.queryTerm(), queryTerm );
> -    QCOMPARE( model.queryTerm() && restTerm, testTerm );
> -
> -    model.clearSelection();
> -    testTerm = f3->termAt(0) || f3->termAt(1) || f3->termAt(2);
> -    restTerm = Term();
> -    queryTerm = testTerm;
> -    QCOMPARE( model.extractFacetsFromQuery(Query(testTerm)), Query(restTerm) );
> -    QCOMPARE( model.queryTerm(), queryTerm );
> -    QCOMPARE( model.queryTerm() && restTerm, testTerm );
> -
> -    model.clearSelection();
> -    testTerm = f3->termAt(0) || f3->termAt(1) || f3->termAt(2) || f1->termAt(1);
> -    restTerm = testTerm;
> -    queryTerm = Term();
> -    QCOMPARE( model.extractFacetsFromQuery(Query(testTerm)), Query(restTerm) );
> -    QCOMPARE( model.queryTerm(), queryTerm );
> -    QCOMPARE( model.queryTerm() && restTerm, testTerm );
> -
> -    model.clearSelection();
> -    testTerm = f3->termAt(0) && f3->termAt(1);
> -    restTerm = f3->termAt(1);
> -    queryTerm = f3->termAt(0);
> -    QCOMPARE( model.extractFacetsFromQuery(Query(testTerm)), Query(restTerm) );
> -    QCOMPARE( model.queryTerm(), queryTerm );
> -    QCOMPARE( model.queryTerm() && restTerm, testTerm );
> -}
> -
> -
> -void FacetModelTest::testExtractFacetsFromTermWithProxyFacet()
> -{
> -    FacetModel model;
> -
> -    SimpleFacet* f1 = new SimpleFacet;
> -    f1->setSelectionMode(Facet::MatchAny);
> -    f1->addTerm( QLatin1String("t1"), \
>                 ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag()) );
> -    f1->addTerm( QLatin1String("t2"), \
>                 ResourceTypeTerm(Nepomuk2::Vocabulary::NFO::FileDataObject()) );
> -    model.addFacet(f1);
> -
> -    SimpleFacet* f2 = new SimpleFacet;
> -    f2->setSelectionMode(Facet::MatchAny);
> -    f2->addTerm( QLatin1String("t1"), \
>                 ResourceTypeTerm(Nepomuk2::Vocabulary::NFO::Image()) );
> -    f2->addTerm( QLatin1String("t2"), \
>                 ResourceTypeTerm(Nepomuk2::Vocabulary::NFO::Document()) );
> -
> -    ProxyFacet* f2p = new ProxyFacet;
> -    f2p->setSourceFacet(f2);
> -    f2p->setFacetCondition(f1->termAt(1));
> -    model.addFacet(f2p);
> -
> -    model.clearSelection();
> -    Term testTerm = f1->termAt(0) && f2->termAt(0);
> -    Term restTerm = f2->termAt(0);
> -    Term queryTerm = f1->termAt(0);
> -    QCOMPARE( model.extractFacetsFromQuery(Query(testTerm)), Query(restTerm) );
> -    QCOMPARE( model.queryTerm(), queryTerm );
> -    QCOMPARE( model.queryTerm() && restTerm, testTerm );
> -
> -    model.clearSelection();
> -    testTerm = f1->termAt(1) && f2->termAt(0);
> -    restTerm = Term();
> -    queryTerm = testTerm;
> -    QCOMPARE( model.extractFacetsFromQuery(Query(testTerm)), Query(restTerm) );
> -    QCOMPARE( model.queryTerm(), queryTerm );
> -    QCOMPARE( model.queryTerm() && restTerm, testTerm );
> -}
> -
> -QTEST_KDEMAIN_CORE(FacetModelTest)
> diff --git a/test/facetmodeltest.h b/test/facetmodeltest.h
> deleted file mode 100644
> index 42544b4..0000000
> --- a/test/facetmodeltest.h
> +++ /dev/null
> @@ -1,37 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef FACETMODELTEST_H
> -#define FACETMODELTEST_H
> -
> -#include <QObject>
> -
> -class FacetModelTest : public QObject
> -{
> -    Q_OBJECT
> -
> -private slots:
> -    void testExtractFacetsFromTermWithVaryingSelectionMode();
> -    void testExtractFacetsFromTermWithMultipleFacets();
> -    void testExtractFacetsFromTermWithProxyFacet();
> -};
> -
> -#endif // FACETMODELTEST_H
> diff --git a/test/proxyfacettest.cpp b/test/proxyfacettest.cpp
> deleted file mode 100644
> index 0f2ba0b..0000000
> --- a/test/proxyfacettest.cpp
> +++ /dev/null
> @@ -1,152 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "proxyfacettest.h"
> -#include "qtest_querytostring.h"
> -
> -#include "simplefacet.h"
> -#include "proxyfacet.h"
> -
> -#include <Nepomuk2/Query/Query>
> -#include <Nepomuk2/Query/ComparisonTerm>
> -#include <Nepomuk2/Query/ResourceTypeTerm>
> -
> -#include <Soprano/Vocabulary/NAO>
> -
> -#include <QtTest>
> -#include "qtest_kde.h"
> -
> -using namespace Nepomuk2::Utils;
> -using namespace Nepomuk2::Query;
> -
> -Q_DECLARE_METATYPE(Nepomuk2::Utils::Facet*)
> -
> -void ProxyFacetTest::initTestCase()
> -{
> -    qRegisterMetaType<Nepomuk2::Utils::Facet*>();
> -}
> -
> -void ProxyFacetTest::testForward()
> -{
> -    SimpleFacet f;
> -    f.setSelectionMode(Facet::MatchOne);
> -
> -    QString label1 = QLatin1String("Label 1");
> -    Term term1;
> -    QString label2 = QLatin1String("Label 2");
> -    Term term2 = ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag());
> -
> -    f.addTerm(label1, term1);
> -    f.addTerm(label2, term2);
> -
> -    ProxyFacet pf;
> -    pf.setSourceFacet(&f);
> -
> -    QCOMPARE(f.count(), pf.count());
> -
> -    QCOMPARE(f.text(0), pf.text(0));
> -    QCOMPARE(f.text(1), pf.text(1));
> -
> -    QCOMPARE(f.queryTerm(), pf.queryTerm());
> -
> -    f.setSelected(1);
> -    QCOMPARE(f.isSelected(0), pf.isSelected(0));
> -    QCOMPARE(f.isSelected(1), pf.isSelected(1));
> -    QCOMPARE(f.queryTerm(), pf.queryTerm());
> -}
> -
> -void ProxyFacetTest::testSignals()
> -{
> -    SimpleFacet f;
> -    f.setSelectionMode(Facet::MatchOne);
> -
> -    QString label1 = QLatin1String("Label 1");
> -    Term term1;
> -    QString label2 = QLatin1String("Label 2");
> -    Term term2 = ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag());
> -
> -    f.addTerm(label1, term1);
> -    f.addTerm(label2, term2);
> -
> -    ProxyFacet pf;
> -    pf.setSourceFacet(&f);
> -
> -    QSignalSpy selectionSpy(&pf, \
>                 SIGNAL(selectionChanged(Nepomuk2::Utils::Facet*)));
> -    QSignalSpy termChangedSpy(&pf, \
>                 SIGNAL(queryTermChanged(Nepomuk2::Utils::Facet*,Nepomuk2::Query::Term)));
>                 
> -
> -    pf.setSelected(1);
> -    QCOMPARE(selectionSpy.count(), 1);
> -    selectionSpy.takeFirst();
> -    QCOMPARE(termChangedSpy.count(), 1);
> -    termChangedSpy.takeFirst();
> -
> -    pf.clearSelection();
> -    QCOMPARE(selectionSpy.count(), 1);
> -    selectionSpy.takeFirst();
> -    QCOMPARE(termChangedSpy.count(), 1);
> -    termChangedSpy.takeFirst();
> -
> -    QSignalSpy laySpy(&pf, SIGNAL(layoutChanged(Nepomuk2::Utils::Facet*)));
> -    f.addTerm(QLatin1String("Hello World"), Term());
> -    QCOMPARE(laySpy.count(), 1);
> -    laySpy.takeFirst();
> -}
> -
> -void ProxyFacetTest::testFacetCondition()
> -{
> -    SimpleFacet f;
> -    f.setSelectionMode(Facet::MatchOne);
> -
> -    QString label1 = QLatin1String("Label 1");
> -    Term term1;
> -    QString label2 = QLatin1String("Label 2");
> -    Term term2 = ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag());
> -
> -    f.addTerm(label1, term1);
> -    f.addTerm(label2, term2);
> -
> -    ProxyFacet pf;
> -    pf.setSourceFacet(&f);
> -
> -    QSignalSpy laySpy(&pf, SIGNAL(layoutChanged(Nepomuk2::Utils::Facet*)));
> -
> -    pf.setFacetCondition(ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag()));
> -
> -    QCOMPARE(laySpy.count(), 1);
> -    laySpy.takeFirst();
> -
> -    QCOMPARE(pf.count(), 0);
> -    QCOMPARE(pf.queryTerm(), Term());
> -
> -    pf.setClientQuery(Query(ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag())));
> -
> -    QCOMPARE(laySpy.count(), 1);
> -    laySpy.takeFirst();
> -
> -    QCOMPARE(f.count(), pf.count());
> -
> -    QCOMPARE(f.text(0), pf.text(0));
> -    QCOMPARE(f.text(1), pf.text(1));
> -
> -    QCOMPARE(f.queryTerm(), pf.queryTerm());
> -}
> -
> -QTEST_KDEMAIN_CORE(ProxyFacetTest)
> diff --git a/test/proxyfacettest.h b/test/proxyfacettest.h
> deleted file mode 100644
> index 9075dd2..0000000
> --- a/test/proxyfacettest.h
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef PROXYFACETTEST_H
> -#define PROXYFACETTEST_H
> -
> -#include <QObject>
> -
> -class ProxyFacetTest : public QObject
> -{
> -    Q_OBJECT
> -
> -private slots:
> -    void initTestCase();
> -    void testForward();
> -    void testSignals();
> -    void testFacetCondition();
> -};
> -
> -#endif // PROXYFACETTEST_H
> diff --git a/test/simplefacettest.cpp b/test/simplefacettest.cpp
> deleted file mode 100644
> index 891f2bc..0000000
> --- a/test/simplefacettest.cpp
> +++ /dev/null
> @@ -1,282 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "simplefacettest.h"
> -#include "qtest_querytostring.h"
> -
> -#include "simplefacet.h"
> -
> -#include <Nepomuk2/Query/ComparisonTerm>
> -#include <Nepomuk2/Query/ResourceTypeTerm>
> -
> -#include <Soprano/Vocabulary/NAO>
> -
> -#include <QtTest>
> -#include "qtest_kde.h"
> -
> -
> -using namespace Nepomuk2::Utils;
> -using namespace Nepomuk2::Query;
> -
> -void SimpleFacetTest::testAddTerm()
> -{
> -    SimpleFacet f;
> -
> -    QCOMPARE(f.count(), 0);
> -
> -    QString label1 = QLatin1String("Label 1");
> -    Term term1;
> -    QString label2 = QLatin1String("Label 2");
> -    Term term2 = ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag());
> -
> -    f.addTerm(label1, term1);
> -    QCOMPARE(f.count(), 1);
> -
> -    f.addTerm(label2, term2);
> -    QCOMPARE(f.count(), 2);
> -
> -    QCOMPARE(f.text(0), label1);
> -    QCOMPARE(f.text(1), label2);
> -
> -    QCOMPARE(f.termAt(0), term1);
> -    QCOMPARE(f.termAt(1), term2);
> -}
> -
> -void SimpleFacetTest::testMatchOne()
> -{
> -    SimpleFacet f;
> -    f.setSelectionMode(Facet::MatchOne);
> -
> -    QString label1 = QLatin1String("Label 1");
> -    Term term1;
> -    QString label2 = QLatin1String("Label 2");
> -    Term term2 = ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag());
> -
> -    f.addTerm(label1, term1);
> -    f.addTerm(label2, term2);
> -
> -    // by default the first entry needs to be selected
> -    QVERIFY(f.isSelected(0));
> -    QCOMPARE(f.queryTerm(), term1);
> -
> -    // re-selecting it should not change anything
> -    f.setSelected(0, true);
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1);
> -
> -    // de-selecting the first entry should also revert to it being selected
> -    f.setSelected(0, false);
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1);
> -
> -    // selecting the second
> -    f.setSelected(1, true);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term2);
> -
> -    // clearing the selection should result in the first being selected
> -    f.clearSelection();
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1);
> -}
> -
> -void SimpleFacetTest::testMatchAll()
> -{
> -    SimpleFacet f;
> -    f.setSelectionMode(Facet::MatchAll);
> -
> -    QString label1 = QLatin1String("Label 1");
> -    Term term1 = ResourceTypeTerm(Soprano::Vocabulary::NAO::Party());
> -    QString label2 = QLatin1String("Label 2");
> -    Term term2 = ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag());
> -
> -    f.addTerm(label1, term1);
> -    f.addTerm(label2, term2);
> -
> -    // by default nothing should be selected
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), Term());
> -
> -    // selecting the first
> -    f.setSelected(0, true);
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1);
> -
> -    // de-selecting the first entry should revert to no selection
> -    f.setSelected(0, false);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), Term());
> -
> -    // selecting the second
> -    f.setSelected(1, true);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term2);
> -
> -    // selecting the first and the second
> -    f.setSelected(0, true);
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1 && term2);
> -
> -    // clearing the selection should result in nothing being selected
> -    f.clearSelection();
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), Term());
> -}
> -
> -void SimpleFacetTest::testMatchAny()
> -{
> -    SimpleFacet f;
> -    f.setSelectionMode(Facet::MatchAny);
> -
> -    QString label1 = QLatin1String("Label 1");
> -    Term term1 = ResourceTypeTerm(Soprano::Vocabulary::NAO::Party());
> -    QString label2 = QLatin1String("Label 2");
> -    Term term2 = ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag());
> -
> -    f.addTerm(label1, term1);
> -    f.addTerm(label2, term2);
> -
> -    // by default nothing should be selected
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), Term());
> -
> -    // selecting the first
> -    f.setSelected(0, true);
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1);
> -
> -    // de-selecting the first entry should revert to no selection
> -    f.setSelected(0, false);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), Term());
> -
> -    // selecting the second
> -    f.setSelected(1, true);
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term2);
> -
> -    // selecting the first and the second
> -    f.setSelected(0, true);
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1 || term2);
> -}
> -
> -void SimpleFacetTest::testSelectFromTerm()
> -{
> -    SimpleFacet f;
> -    f.setSelectionMode(Facet::MatchOne);
> -
> -    QString label1 = QLatin1String("Label 1");
> -    Term term1 = ResourceTypeTerm(Soprano::Vocabulary::NAO::Party());
> -    QString label2 = QLatin1String("Label 2");
> -    Term term2 = ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag());
> -
> -    f.addTerm(label1, term1);
> -    f.addTerm(label2, term2);
> -
> -
> -    // in MatchOne mode we should be able to select term1 and term2 but no \
>                 combination
> -    QVERIFY(f.selectFromTerm(term1));
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1);
> -
> -    QVERIFY(f.selectFromTerm(term2));
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term2);
> -
> -    QVERIFY(!f.selectFromTerm(term1 && term2));
> -    QVERIFY(!f.selectFromTerm(term1 || term2));
> -
> -
> -    // in MatchAll mode we should be able to select term1, term2, and an AndTerm \
>                 combination of both
> -    f.setSelectionMode(Facet::MatchAll);
> -
> -    QVERIFY(f.selectFromTerm(term1));
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1);
> -
> -    QVERIFY(f.selectFromTerm(term2));
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1 && term2);
> -
> -    f.clearSelection();
> -
> -    QVERIFY(f.selectFromTerm(term1 && term2));
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1 && term2);
> -
> -    QVERIFY(!f.selectFromTerm(term1 || term2));
> -    // the selection should not have changed
> -    QCOMPARE(f.queryTerm(), term1 && term2);
> -
> -
> -    // in MatchAny more we should be able to select term1, term2, and an OrTerm \
>                 combination of both
> -    f.setSelectionMode(Facet::MatchAny);
> -
> -    QVERIFY(f.selectFromTerm(term1));
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1);
> -
> -    QVERIFY(f.selectFromTerm(term2));
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1 || term2);
> -
> -    f.clearSelection();
> -
> -    QVERIFY(f.selectFromTerm(term1 || term2));
> -    QVERIFY(f.isSelected(0));
> -    QVERIFY(f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), term1 || term2);
> -
> -    QVERIFY(!f.selectFromTerm(term1 && term2));
> -    // the selection should not have changed
> -    QCOMPARE(f.queryTerm(), term1 || term2);
> -
> -    // clearing the selection should result in nothing being selected
> -    f.clearSelection();
> -    QVERIFY(!f.isSelected(0));
> -    QVERIFY(!f.isSelected(1));
> -    QCOMPARE(f.queryTerm(), Term());
> -}
> -
> -QTEST_KDEMAIN_CORE(SimpleFacetTest)
> diff --git a/test/simplefacettest.h b/test/simplefacettest.h
> deleted file mode 100644
> index f22156b..0000000
> --- a/test/simplefacettest.h
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef SIMPLEFACETTEST_H
> -#define SIMPLEFACETTEST_H
> -
> -#include <QObject>
> -
> -class SimpleFacetTest : public QObject
> -{
> -    Q_OBJECT
> -
> -private slots:
> -    void testAddTerm();
> -    void testMatchOne();
> -    void testMatchAll();
> -    void testMatchAny();
> -    void testSelectFromTerm();
> -};
> -
> -#endif // SIMPLEFACETTEST_H
> diff --git a/test/typefacettest.cpp b/test/typefacettest.cpp
> deleted file mode 100644
> index 68924ad..0000000
> --- a/test/typefacettest.cpp
> +++ /dev/null
> @@ -1,105 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "typefacettest.h"
> -#include "qtest_querytostring.h"
> -
> -#include "typefacet.h"
> -
> -#include <Nepomuk2/Query/ResourceTypeTerm>
> -#include <Nepomuk2/Query/NegationTerm>
> -
> -#include <Nepomuk2/Vocabulary/NFO>
> -#include <Nepomuk2/Types/Class>
> -
> -#include <Soprano/Vocabulary/NAO>
> -
> -#include <QtTest>
> -#include <QScopedPointer>
> -#include "qtest_kde.h"
> -
> -
> -using namespace Nepomuk2::Utils;
> -using namespace Nepomuk2::Query;
> -using namespace Nepomuk2::Vocabulary;
> -using namespace Nepomuk2::Types;
> -
> -void TypeFacetTest::testBasicLayout()
> -{
> -    QScopedPointer<Facet> f( Facet::createTypeFacet() );
> -    QCOMPARE(f->count(), 2);
> -    QCOMPARE(f->queryTerm(), Term());
> -}
> -
> -void TypeFacetTest::testFileRootSelection()
> -{
> -    QScopedPointer<Facet> f( Facet::createTypeFacet() );
> -    f->setSelected(0);
> -    QCOMPARE(f->count(), 5); // The checked file and the file choices
> -    QCOMPARE(f->queryTerm(), Term(ResourceTypeTerm(NFO::FileDataObject())));
> -    f->setSelected(0, false);
> -    QCOMPARE(f->count(), 2);
> -    QCOMPARE(f->queryTerm(), Term());
> -}
> -
> -void TypeFacetTest::testOtherRootSelection()
> -{
> -    QScopedPointer<Facet> f( Facet::createTypeFacet() );
> -    f->setSelected(1);
> -    QCOMPARE(f->count(), 5);
> -    QCOMPARE(f->queryTerm(), \
>                 Term(NegationTerm::negateTerm(ResourceTypeTerm(NFO::FileDataObject()))));
>                 
> -    f->setSelected(0, false);
> -    QCOMPARE(f->count(), 2);
> -    QCOMPARE(f->queryTerm(), Term());
> -}
> -
> -void TypeFacetTest::testCustomTypes()
> -{
> -    QScopedPointer<Facet> f( Facet::createTypeFacet() );
> -    f->selectFromTerm(ResourceTypeTerm(NFO::Application()));
> -    QCOMPARE(f->count(), 6);
> -    QVERIFY(f->isSelected(0));
> -    QCOMPARE(f->text(5), Class(NFO::Application()).label());
> -    QVERIFY(f->isSelected(5));
> -    QCOMPARE(f->queryTerm(), Term(ResourceTypeTerm(NFO::Application())));
> -}
> -
> -void TypeFacetTest::testSelectFromTerm()
> -{
> -    QScopedPointer<Facet> f( Facet::createTypeFacet() );
> -
> -    // test nfo:FileDataObject which should only select the file thing
> -    f->selectFromTerm(ResourceTypeTerm(NFO::FileDataObject()));
> -    QCOMPARE(f->count(), 5);
> -    QVERIFY(f->isSelected(0));
> -    QVERIFY(!f->isSelected(1));
> -    QVERIFY(!f->isSelected(2));
> -    QVERIFY(!f->isSelected(3));
> -    QVERIFY(!f->isSelected(4));
> -    QCOMPARE(f->queryTerm(), Term(ResourceTypeTerm(NFO::FileDataObject())));
> -
> -    // in file mode non-file types should not be selectable
> -    QVERIFY(!f->selectFromTerm(ResourceTypeTerm(NFO::Application())));
> -}
> -
> -QTEST_KDEMAIN_CORE(TypeFacetTest)
> -
> -#include "typefacettest.moc"
> diff --git a/test/typefacettest.h b/test/typefacettest.h
> deleted file mode 100644
> index 5d6d1ab..0000000
> --- a/test/typefacettest.h
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef TYPEFACETTEST_H
> -#define TYPEFACETTEST_H
> -
> -#include <QObject>
> -
> -class TypeFacetTest : public QObject
> -{
> -    Q_OBJECT
> -
> -private Q_SLOTS:
> -    void testBasicLayout();
> -    void testFileRootSelection();
> -    void testOtherRootSelection();
> -    void testCustomTypes();
> -    void testSelectFromTerm();
> -};
> -
> -#endif // TYPEFACETTEST_H
> diff --git a/utils/datefacet.cpp b/utils/datefacet.cpp
> deleted file mode 100644
> index 566b681..0000000
> --- a/utils/datefacet.cpp
> +++ /dev/null
> @@ -1,420 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "datefacet.h"
> -#include "daterange.h"
> -#include "daterangeselectionwidget.h"
> -
> -#include <Nepomuk2/Query/ComparisonTerm>
> -#include <Nepomuk2/Query/OrTerm>
> -#include <Nepomuk2/Query/AndTerm>
> -#include <Nepomuk2/Query/LiteralTerm>
> -#include <Nepomuk2/Query/StandardQuery>
> -#include <Nepomuk2/Query/Query>
> -
> -#include <Nepomuk2/Vocabulary/NIE>
> -#include <Nepomuk2/Vocabulary/NUAO>
> -
> -#include <QtCore/QDate>
> -#include <QtCore/QPair>
> -#include <QtGui/QMenu>
> -#include <QtGui/QWidgetAction>
> -
> -#include <KGlobal>
> -#include <KLocale>
> -#include <KCalendarSystem>
> -#include <KGuiItem>
> -#include <KDialog>
> -#include <KDebug>
> -
> -
> -class Nepomuk2::Utils::DateFacet::Private
> -{
> -public:
> -    Private()
> -        : m_currentRange( NoDateRange ) {
> -    }
> -
> -    /// only used for code simplification
> -    QList<DateRangeCandidate> m_rangeCandidates;
> -
> -    DateRangeCandidates m_enabledRanges;
> -    QList<DateRangeCandidate> m_ranges;
> -
> -    DateRangeCandidate m_currentRange;
> -    DateRange m_customRange;
> -
> -    void rebuild();
> -
> -    bool setCurrentRange( const DateRange& range );
> -
> -    QString titleForDateRangeCandidate( DateRangeCandidate range ) const;
> -    DateRange dateRangeCandidateToDateRange( DateRangeCandidate range ) const;
> -
> -    DateFacet* q;
> -};
> -
> -
> -void Nepomuk2::Utils::DateFacet::Private::rebuild()
> -{
> -    m_ranges.clear();
> -    Q_FOREACH( DateRangeCandidate r, m_rangeCandidates ) {
> -        if ( m_enabledRanges&r ) {
> -            m_ranges << r;
> -        }
> -    }
> -    if ( !m_ranges.contains( m_currentRange ) ) {
> -        q->clearSelection();
> -    }
> -    q->setLayoutChanged();
> -}
> -
> -
> -bool Nepomuk2::Utils::DateFacet::Private::setCurrentRange( const DateRange& range \
>                 )
> -{
> -    kDebug() << range;
> -    Q_FOREACH( DateRangeCandidate dr, m_ranges ) {
> -        if ( dateRangeCandidateToDateRange( dr ) == range ) {
> -            kDebug() << range << "is" << dr;
> -            m_currentRange = dr;
> -            q->setSelectionChanged();
> -            return true;
> -        }
> -    }
> -    // not one of the candicates -> use it as custom one
> -    if ( m_ranges.contains( CustomDateRange ) ) {
> -        m_currentRange = CustomDateRange;
> -        m_customRange = range;
> -        q->setSelectionChanged();
> -        return true;
> -    }
> -    else {
> -        return false;
> -    }
> -}
> -
> -
> -QString Nepomuk2::Utils::DateFacet::Private::titleForDateRangeCandidate( \
>                 DateRangeCandidate range ) const
> -{
> -    switch( range ) {
> -    case Anytime:
> -        return i18nc( "referring to a filter on the modification and usage date of \
>                 files/resources", "Anytime" );
> -    case Today:
> -        return i18nc( "referring to a filter on the modification and usage date of \
>                 files/resources", "Today" );
> -    case Yesterday:
> -        return i18nc( "referring to a filter on the modification and usage date of \
>                 files/resources", "Yesterday" );
> -    case ThisWeek:
> -        return i18nc( "referring to a filter on the modification and usage date of \
>                 files/resources", "This Week" );
> -    case LastWeek:
> -        return i18nc( "referring to a filter on the modification and usage date of \
>                 files/resources", "Last Week" );
> -    case ThisMonth:
> -        return i18nc( "referring to a filter on the modification and usage date of \
>                 files/resources", "This Month" );
> -    case LastMonth:
> -        return i18nc( "referring to a filter on the modification and usage date of \
>                 files/resources", "Last Month" );
> -    case ThisYear:
> -        return i18nc( "referring to a filter on the modification and usage date of \
>                 files/resources", "This Year" );
> -    case LastYear:
> -        return i18nc( "referring to a filter on the modification and usage date of \
>                 files/resources", "Last Year" );
> -    case CustomDateRange:
> -        return i18nc( "referring to a filter on the modification and usage date of \
>                 files/resources that will open a dialog to choose a date range", \
>                 "Custom..." );
> -    default:
> -        return QString();
> -    }
> -
> -    // shut up gcc
> -    return QString();
> -}
> -
> -
> -DateRange Nepomuk2::Utils::DateFacet::Private::dateRangeCandidateToDateRange( \
>                 DateRangeCandidate range ) const
> -{
> -    const QDate today = QDate::currentDate();
> -
> -    switch( range ) {
> -    case Today:
> -        return DateRange::today();
> -
> -    case Yesterday:
> -        return DateRange(today.addDays(-1), today.addDays(-1));
> -
> -    case ThisWeek: {
> -        return DateRange::thisWeek( DateRange::NoDateRangeFlags );
> -    }
> -
> -    case LastWeek: {
> -        return DateRange::weekOf(today.addDays( \
>                 -KGlobal::locale()->calendar()->daysInWeek( today ) ));
> -    }
> -
> -    case ThisMonth: {
> -        return DateRange::thisMonth( DateRange::NoDateRangeFlags );
> -    }
> -
> -    case LastMonth: {
> -        return DateRange::monthOf(today.addDays( \
>                 -KGlobal::locale()->calendar()->daysInMonth( today ) ));
> -    }
> -
> -    case ThisYear: {
> -        return DateRange::thisYear();
> -    }
> -
> -    case LastYear: {
> -        return DateRange::yearOf( QDate( today.year()-1, 1, 1 ) );
> -    }
> -
> -    case CustomDateRange:
> -        return m_customRange;
> -
> -    default:
> -        return DateRange();
> -    }
> -
> -    // shut up gcc
> -    return DateRange();
> -}
> -
> -
> -Nepomuk2::Utils::DateFacet::DateFacet( QObject* parent )
> -    : Facet( parent ),
> -      d( new Private() )
> -{
> -    d->q = this;
> -    d->m_rangeCandidates << Anytime
> -                         << Today
> -                         << Yesterday
> -                         << ThisWeek
> -                         << LastWeek
> -                         << ThisMonth
> -                         << LastMonth
> -                         << ThisYear
> -                         << LastYear
> -                         << CustomDateRange;
> -    setDateRangeCandidates( DefaultRanges );
> -}
> -
> -
> -Nepomuk2::Utils::DateFacet::~DateFacet()
> -{
> -    delete d;
> -}
> -
> -
> -Nepomuk2::Query::Term Nepomuk2::Utils::DateFacet::queryTerm() const
> -{
> -    return createDateRangeTerm( d->dateRangeCandidateToDateRange( \
>                 d->m_currentRange ) );
> -}
> -
> -
> -Nepomuk2::Utils::DateFacet::SelectionMode \
>                 Nepomuk2::Utils::DateFacet::selectionMode() const
> -{
> -    return MatchOne;
> -}
> -
> -
> -int Nepomuk2::Utils::DateFacet::count() const
> -{
> -    return d->m_ranges.count();
> -}
> -
> -
> -KGuiItem Nepomuk2::Utils::DateFacet::guiItem( int index ) const
> -{
> -    if ( index < d->m_ranges.count() )
> -        return KGuiItem( d->titleForDateRangeCandidate( d->m_ranges[index] ) );
> -    else
> -        return KGuiItem();
> -}
> -
> -
> -bool Nepomuk2::Utils::DateFacet::isSelected( int index ) const
> -{
> -    return d->m_ranges.indexOf( d->m_currentRange ) == index;
> -}
> -
> -
> -void Nepomuk2::Utils::DateFacet::setDateRangeCandidates( DateRangeCandidates \
>                 ranges )
> -{
> -    d->m_enabledRanges = ranges;
> -    d->rebuild();
> -}
> -
> -
> -Nepomuk2::Utils::DateFacet::DateRangeCandidates \
>                 Nepomuk2::Utils::DateFacet::dateRangeCandidates() const
> -{
> -    return d->m_enabledRanges;
> -}
> -
> -
> -void Nepomuk2::Utils::DateFacet::clearSelection()
> -{
> -    d->m_currentRange = d->m_ranges.isEmpty() ? NoDateRange : d->m_ranges.first();
> -    setQueryTermChanged();
> -    setSelectionChanged();
> -}
> -
> -
> -void Nepomuk2::Utils::DateFacet::setSelected( int index, bool selected )
> -{
> -    if ( index == d->m_ranges.indexOf( CustomDateRange ) ) {
> -        bool ok = false;
> -        DateRange newRange = getCustomRange( &ok );
> -        if( ok ) {
> -            d->setCurrentRange( newRange );
> -        }
> -    }
> -
> -    else if ( selected &&
> -             index < d->m_ranges.count() ) {
> -        kDebug() << d->m_ranges[index] << \
>                 d->dateRangeCandidateToDateRange(d->m_ranges[index]);
> -        d->m_currentRange = d->m_ranges[index];
> -        setQueryTermChanged();
> -        setSelectionChanged();
> -    }
> -
> -    else {
> -        clearSelection();
> -    }
> -}
> -
> -
> -bool Nepomuk2::Utils::DateFacet::selectFromTerm( const Nepomuk2::Query::Term& term \
>                 )
> -{
> -    DateRange range = extractDateRange( term );
> -    return range.isValid() ? d->setCurrentRange( range ) : false;
> -}
> -
> -
> -Nepomuk2::Query::Term Nepomuk2::Utils::DateFacet::createDateRangeTerm( const \
>                 DateRange& range ) const
> -{
> -    return Nepomuk2::Query::dateRangeQuery( range.start(), range.end() ).term();
> -}
> -
> -
> -namespace {
> -    bool isDateComparisonTerm( const Nepomuk2::Query::Term& term ) {
> -        return( term.isComparisonTerm() &&
> -                term.toComparisonTerm().subTerm().isLiteralTerm() &&
> -                term.toComparisonTerm().subTerm().toLiteralTerm().value().isDateTime() \
>                 &&
> -                ( term.toComparisonTerm().comparator() == \
>                 Nepomuk2::Query::ComparisonTerm::Greater ||
> -                  term.toComparisonTerm().comparator() == \
>                 Nepomuk2::Query::ComparisonTerm::Smaller ) );
> -    }
> -
> -    Nepomuk2::Types::Property isDateTerm( const Nepomuk2::Query::Term& term, \
>                 QDate& start, QDate& end ) {
> -        if( term.isAndTerm() ) {
> -            if( term.toAndTerm().subTerms().count() != 2 ||
> -                !isDateComparisonTerm( term.toAndTerm().subTerms()[0] ) ||
> -                !isDateComparisonTerm( term.toAndTerm().subTerms()[1] ) ||
> -                term.toAndTerm().subTerms()[0].toComparisonTerm().property() != \
>                 term.toAndTerm().subTerms()[1].toComparisonTerm().property() ||
> -                term.toAndTerm().subTerms()[0].toComparisonTerm().comparator() == \
>                 term.toAndTerm().subTerms()[1].toComparisonTerm().comparator() ) {
> -                return Nepomuk2::Types::Property();
> -            }
> -            // at this point we have two ComparisonTerms with QDate subterms and \
>                 similar properties and different comparators
> -            if( term.toAndTerm().subTerms()[0].toComparisonTerm().comparator() == \
>                 Nepomuk2::Query::ComparisonTerm::Greater ) {
> -                start = \
> term.toAndTerm().subTerms()[0].toComparisonTerm().subTerm().toLiteralTerm().value().toDateTime().toLocalTime().date();
>                 
> -                end = \
> term.toAndTerm().subTerms()[1].toComparisonTerm().subTerm().toLiteralTerm().value().toDateTime().toLocalTime().date();
>                 
> -            }
> -            else {
> -                start = \
> term.toAndTerm().subTerms()[1].toComparisonTerm().subTerm().toLiteralTerm().value().toDateTime().toLocalTime().date();
>                 
> -                end = \
> term.toAndTerm().subTerms()[0].toComparisonTerm().subTerm().toLiteralTerm().value().toDateTime().toLocalTime().date();
>                 
> -            }
> -            return term.toAndTerm().subTerms()[0].toComparisonTerm().property();
> -        }
> -        else if( isDateComparisonTerm( term ) ) {
> -            if( term.toComparisonTerm().comparator() == \
>                 Nepomuk2::Query::ComparisonTerm::Greater ) {
> -                start = \
> term.toComparisonTerm().subTerm().toLiteralTerm().value().toDateTime().toLocalTime().date();
>                 
> -            }
> -            else {
> -                end = \
> term.toComparisonTerm().subTerm().toLiteralTerm().value().toDateTime().toLocalTime().date();
>                 
> -            }
> -            return term.toComparisonTerm().property();
> -        }
> -        else {
> -            return Nepomuk2::Types::Property();
> -        }
> -    }
> -}
> -
> -DateRange Nepomuk2::Utils::DateFacet::extractDateRange( const Query::Term& term ) \
>                 const
> -{
> -    // this is ugly since creating the query is done in standardqueries.cpp
> -    // thus, if that impl is changed this code wont work anymore. :(
> -    if( !term.isOrTerm() ) {
> -        return DateRange();
> -    }
> -    Nepomuk2::Query::OrTerm orTerm = term.toOrTerm();
> -    if( orTerm.subTerms().count() != 3 ) {
> -        return DateRange();
> -    }
> -    QDate start, end;
> -    bool mtime = false;
> -    bool created = false;
> -    bool nuao = false;
> -    Q_FOREACH( const Nepomuk2::Query::Term& t, orTerm.subTerms() ) {
> -        Nepomuk2::Types::Property p = isDateTerm( t, start, end );
> -        if( p == Nepomuk2::Vocabulary::NIE::lastModified() ) {
> -            mtime = true;
> -        }
> -        else if( p == Nepomuk2::Vocabulary::NIE::contentCreated() ) {
> -            created = true;
> -        }
> -        else {
> -            // check if it is the nuao term
> -            if( !t.isComparisonTerm() ||
> -                !t.toComparisonTerm().isInverted() ||
> -                t.toComparisonTerm().property() != \
>                 Nepomuk2::Vocabulary::NUAO::involves() ) {
> -                return DateRange();
> -            }
> -            Nepomuk2::Types::Property p = \
>                 isDateTerm(t.toComparisonTerm().subTerm(), start, end);
> -            if( p == Nepomuk2::Vocabulary::NUAO::start() )
> -                nuao = true;
> -            else
> -                return DateRange();
> -        }
> -    }
> -    if( mtime && created && nuao ) {
> -        return DateRange(start, end);
> -    }
> -    else {
> -        return DateRange();
> -    }
> -}
> -
> -
> -DateRange Nepomuk2::Utils::DateFacet::getCustomRange( bool* ok ) const
> -{
> -    DateRangeSelectionWidget* drw = new DateRangeSelectionWidget();
> -    drw->setRange( d->dateRangeCandidateToDateRange(d->m_currentRange) );
> -
> -    // we use QMenu for the look only
> -    QMenu menu;
> -    QWidgetAction* wa = new QWidgetAction( &menu );
> -    wa->setDefaultWidget(drw);
> -    menu.addAction(wa);
> -
> -    connect( drw, SIGNAL(rangeChanged(DateRange)), &menu, SLOT(close()));
> -
> -    menu.exec(QCursor::pos());
> -
> -    if( ok )
> -        *ok = true;
> -    return drw->range();
> -}
> -
> -#include "datefacet.moc"
> diff --git a/utils/datefacet.h b/utils/datefacet.h
> deleted file mode 100644
> index 85aa611..0000000
> --- a/utils/datefacet.h
> +++ /dev/null
> @@ -1,228 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef _NEPOMUK_QUERY_DATE_FACET_H_
> -#define _NEPOMUK_QUERY_DATE_FACET_H_
> -
> -#include "facet.h"
> -
> -class DateRange;
> -
> -namespace Nepomuk2 {
> -    namespace Utils {
> -        /**
> -         * \class DateFacet datefacet.h Nepomuk/Utils/DateFacet
> -         *
> -         * \ingroup nepomuk_facets
> -         *
> -         * \brief A Facet that provides a set of date ranges.
> -         *
> -         * Filtering search results on a date is a very typical problem. This \
>                 could be
> -         * handled by adding fixed Terms to a SimpleFacet. The big problem with \
>                 that
> -         * solution, however, is that these fixed terms would become inaccurate \
>                 over time.
> -         * Say, one wants to filter files that have been modified today. This is a \
>                 very
> -         * simple filter involving the nie:lastModified property and \
>                 QDate::currentDate().
> -         * But as soon as the application runs while the current date is changing \
>                 this
> -         * fixed term becomes invalid since it is now referencing yesterday \
>                 instead of today.
> -         *
> -         * The DateFacet works around this problem by using the enumeration \
>                 DateRangeCandidate
> -         * instead of fixed terms and creating the terms on the fly based on the \
>                 enum value.
> -         *
> -         * By default it creates date terms via Nepomuk2::Utils::dateRangeQuery() \
>                 which
> -         * includes the file modification time but also access times and content \
>                 creation times
> -         * (the latter includes the date a photo was taken). This can, however, be \
>                 modified by
> -         * reimplementing createDateRangeTerm() and its counterpart \
>                 extractDateRange().
> -         *
> -         * \author Sebastian Trueg <trueg@kde.org>
> -         *
> -         * \since 4.6
> -         */
> -        class DateFacet : public Facet
> -        {
> -            Q_OBJECT
> -
> -        public:
> -            /**
> -             * Creates a new date facet which contains the DefaultRanges
> -             * date range candidates as choices.
> -             */
> -            DateFacet( QObject* parent = 0 );
> -
> -            /**
> -             * Destructor
> -             */
> -            virtual ~DateFacet();
> -
> -            /**
> -             * Creates a query term for the currently selected date range.
> -             * This method makes use of createDateRangeTerm().
> -             */
> -            Query::Term queryTerm() const;
> -
> -            /**
> -             * The selection mode in the date facet is fixed to MatchOne, ie.
> -             * it is an exclusive facet where a single date range must be
> -             * selected at all time.
> -             */
> -            SelectionMode selectionMode() const;
> -
> -            /**
> -             * \return The number of date range candidates set via \
>                 setDateRangeCandidates().
> -             */
> -            int count() const;
> -
> -            KGuiItem guiItem( int index ) const;
> -            bool isSelected( int index ) const;
> -
> -            /**
> -             * Using fixed QDate values would result in
> -             * invalid queries as soon as an application runs
> -             * over the span of two days. Thus, DateFacet uses
> -             * DateRangeCandidates to specify the list of
> -             * choices and generates the QDate instances on the
> -             * fly.
> -             */
> -            enum DateRangeCandidate {
> -                /// no date range
> -                NoDateRange = 0x0,
> -
> -                /// no restriction on the date
> -                Anytime = 0x1,
> -
> -                /// a date range which uses QDate::today() for start and end
> -                Today = 0x2,
> -
> -                /// a date range which uses QDate::today().addDays(-1) for start \
>                 and end
> -                Yesterday = 0x4,
> -
> -                /// a date range that includes all days from the current week up \
>                 to today
> -                ThisWeek = 0x8,
> -
> -                /// a date range that includes all days from the last week, ie. \
>                 that before the current one
> -                LastWeek = 0x10,
> -
> -                /// a date range that includes all days from the current month up \
>                 to today
> -                ThisMonth = 0x20,
> -
> -                /// a date range that includes all days from the last month, ie. \
>                 that before the current one
> -                LastMonth = 0x40,
> -
> -                /// a date range that includes all days from the current year up \
>                 to today
> -                ThisYear = 0x80,
> -
> -                /// a date range that includes all days from the last year, ie. \
>                 that before the current one
> -                LastYear = 0x100,
> -
> -                /// a custom range - this will enable a special item that if \
>                 selection will open a dialog
> -                /// allowing the user to choose a custom date range
> -                CustomDateRange = 0x10000,
> -
> -                /// the defaults this facet starts with
> -                DefaultRanges = \
>                 Anytime|Today|ThisWeek|ThisMonth|ThisYear|CustomDateRange
> -            };
> -            Q_DECLARE_FLAGS( DateRangeCandidates, DateRangeCandidate )
> -
> -            /**
> -             * Set the date ranges this facet should provide. By default all
> -             * date ranges from DefaultRanges are enabled.
> -             */
> -            void setDateRangeCandidates( DateRangeCandidates ranges );
> -
> -            /**
> -             * \return The date ranges configured via setDateRangeCandidates()
> -             * \sa DateRangeCandidate
> -             */
> -            DateRangeCandidates dateRangeCandidates() const;
> -
> -        public Q_SLOTS:
> -            /**
> -             * Resets the current range to the default value which is the first in \
>                 the
> -             * list of candidates. If Anytime is part of the configured candidates \
>                 it will
> -             * be selected.
> -             */
> -            void clearSelection();
> -
> -            /**
> -             * Change the currently selected date range. This method is typically \
>                 triggered
> -             * by user interaction.
> -             */
> -            void setSelected( int index, bool selected = true );
> -
> -            /**
> -             * Select the current date range based on \p term. This method relies \
>                 on
> -             * extractDateRange() to determine if \p term can be used or not.
> -             *
> -             * \return \p true if \p term could be handled and the current range
> -             * has been changed accordingly, \p false otherwise.
> -             */
> -            bool selectFromTerm( const Nepomuk2::Query::Term& queryTerm );
> -
> -        protected:
> -            /**
> -             * Create the query Term that reflects the dates specified in \p \
>                 range.
> -             * The default implementation uses Nepomuk2::Utils::dateRangeQuery().
> -             *
> -             * Subclasses may reimplement this method to create custom date \
>                 ranges.
> -             *
> -             * If this method is reimplemented extractDateRange() also needs to be
> -             * implemented in order for selectFromTerm() to work properly.
> -             */
> -            virtual Query::Term createDateRangeTerm( const DateRange& range ) \
>                 const;
> -
> -            /**
> -             * This is the counterpart method to createDateRangeTerm(). It should \
>                 only
> -             * extract valid date ranges from terms that have been created by \
>                 createDateRangeTerm()
> -             * or have the same structure.
> -             *
> -             * A working implementation is required in order for selectFromTerm() \
>                 to
> -             * work properly.
> -             *
> -             * The default implementation can handle query terms created via
> -             * Nepomuk2::Utils::dateRangeQuery().
> -             */
> -            virtual DateRange extractDateRange( const Query::Term& queryTerm ) \
>                 const;
> -
> -            /**
> -             * Retrieve a custom date range typically from the user. The default \
>                 implementation
> -             * opens a popup at the current cursor position allowing the user to \
>                 choose the range
> -             * via appropriate GUI elements.
> -             *
> -             * This method is called internally by DateFacet to handle the \
>                 CustomRange date range
> -             * candidate.
> -             *
> -             * Reimplementing this method allows to provide a customized way to \
>                 get a range
> -             * for the CustomRange date range candidate.
> -             *
> -             * \param ok The method should set this boolean according to the user \
>                 feedback. This is
> -             * necessary since returning an invalid DateRange is ambiguous.
> -             *
> -             * \return The date range chosen by the user.
> -             */
> -            virtual DateRange getCustomRange( bool* ok = 0 ) const;
> -
> -        private:
> -            class Private;
> -            Private* const d;
> -        };
> -    }
> -}
> -
> -#endif
> diff --git a/utils/daterange.cpp b/utils/daterange.cpp
> deleted file mode 100644
> index 543942a..0000000
> --- a/utils/daterange.cpp
> +++ /dev/null
> @@ -1,264 +0,0 @@
> -/*
> -   Copyright (c) 2009-2010 Sebastian Trueg <trueg@kde.org>
> -
> -   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, see <http://www.gnu.org/licenses/>.
> -
> -*/
> -
> -#include "daterange.h"
> -
> -#include <KGlobal>
> -#include <KLocale>
> -#include <KCalendarSystem>
> -
> -#include <QtCore/QSharedData>
> -#include <QtCore/QDebug>
> -
> -
> -class DateRange::Private : public QSharedData
> -{
> -public:
> -    QDate m_start;
> -    QDate m_end;
> -};
> -
> -
> -DateRange::DateRange( const QDate& s,
> -                      const QDate& e )
> -    : d(new Private())
> -{
> -    d->m_start = s;
> -    d->m_end = e;
> -}
> -
> -
> -DateRange::DateRange( const DateRange& other )
> -{
> -    d = other.d;
> -}
> -
> -
> -DateRange::~DateRange()
> -{
> -}
> -
> -
> -DateRange& DateRange::operator=( const DateRange& other )
> -{
> -    d = other.d;
> -    return *this;
> -}
> -
> -
> -QDate DateRange::start() const
> -{
> -    return d->m_start;
> -}
> -
> -
> -QDate DateRange::end() const
> -{
> -    return d->m_end;
> -}
> -
> -
> -bool DateRange::isValid() const
> -{
> -    return KGlobal::locale()->calendar()->isValid(d->m_start) && \
>                 KGlobal::locale()->calendar()->isValid(d->m_end) && d->m_start <= \
>                 d->m_end;
> -}
> -
> -
> -void DateRange::setStart( const QDate& date )
> -{
> -    d->m_start = date;
> -}
> -
> -
> -void DateRange::setEnd( const QDate& date )
> -{
> -    d->m_end = date;
> -}
> -
> -
> -// static
> -DateRange DateRange::today()
> -{
> -    const QDate today = QDate::currentDate();
> -    return DateRange( today, today );
> -}
> -
> -
> -namespace {
> -    /**
> -     * Put \p day into the week range 1...weekDays
> -     */
> -    int dateModulo( int day, int weekDays ) {
> -        day = day%weekDays;
> -        if ( day == 0 )
> -            return weekDays;
> -        else
> -            return day;
> -    }
> -}
> -
> -// static
> -DateRange DateRange::thisWeek( DateRangeFlags flags )
> -{
> -    return weekOf( QDate::currentDate(), flags );
> -}
> -
> -
> -// static
> -DateRange DateRange::weekOf( const QDate& date, DateRangeFlags flags )
> -{
> -    const int daysInWeek = KGlobal::locale()->calendar()->daysInWeek( date );
> -    const int weekStartDay = KGlobal::locale()->weekStartDay();
> -    const int weekEndDay = dateModulo( weekStartDay+daysInWeek-1, daysInWeek );
> -    const int dayOfWeek = KGlobal::locale()->calendar()->dayOfWeek( date );
> -
> -    DateRange range;
> -
> -    if ( weekStartDay > dayOfWeek )
> -        range.d->m_start = date.addDays( - (dayOfWeek + daysInWeek - weekStartDay) \
>                 );
> -    else
> -        range.d->m_start = date.addDays( - (dayOfWeek - weekStartDay) );
> -
> -    if ( weekEndDay < dayOfWeek )
> -        range.d->m_end = date.addDays( weekEndDay + daysInWeek - dayOfWeek );
> -    else
> -        range.d->m_end = date.addDays( weekEndDay - dayOfWeek);
> -
> -    if( flags & ExcludeFutureDays ) {
> -        const QDate today = QDate::currentDate();
> -        if( range.start() <= today && range.end() >= today )
> -            range.setEnd( today );
> -    }
> -
> -    return range;
> -}
> -
> -
> -// static
> -DateRange DateRange::thisMonth( DateRangeFlags flags )
> -{
> -    return monthOf( QDate::currentDate(), flags );
> -}
> -
> -
> -// static
> -DateRange DateRange::monthOf( const QDate& date, DateRangeFlags flags )
> -{
> -    DateRange range( KGlobal::locale()->calendar()->firstDayOfMonth( date ),
> -                     KGlobal::locale()->calendar()->lastDayOfMonth( date ) );
> -    if( flags & ExcludeFutureDays ) {
> -        const QDate today = QDate::currentDate();
> -        if( range.start() <= today && range.end() >= today )
> -            range.setEnd( today );
> -    }
> -    return range;
> -}
> -
> -
> -
> -// static
> -DateRange DateRange::thisYear( DateRangeFlags flags )
> -{
> -    return yearOf( QDate::currentDate(), flags );
> -}
> -
> -
> -// static
> -DateRange DateRange::yearOf( const QDate& date, DateRangeFlags flags )
> -{
> -    DateRange range( KGlobal::locale()->calendar()->firstDayOfYear( date ),
> -                     KGlobal::locale()->calendar()->lastDayOfYear( date ) );
> -    if( flags & ExcludeFutureDays ) {
> -        const QDate today = QDate::currentDate();
> -        if( date.year() == today.year() )
> -            range.setEnd( today );
> -    }
> -    return range;
> -}
> -
> -
> -// static
> -DateRange DateRange::lastNDays( int n )
> -{
> -    DateRange range = today();
> -    range.setStart( range.start().addDays( -n ) );
> -    return range;
> -}
> -
> -
> -// static
> -DateRange DateRange::lastNWeeks( int n )
> -{
> -    // This week is the first week
> -    DateRange range = thisWeek( DateRange::NoDateRangeFlags );
> -
> -    // go into the previous week
> -    range.setStart( range.start().addDays( -1 ) );
> -
> -    // from that on we go back n-1 weeks, for each of those we call daysInWeek
> -    for( int i = 1; i < n; ++i ) {
> -        QDate weekDay = range.start();
> -        weekDay.addDays( -KGlobal::locale()->calendar()->daysInWeek( weekDay ) );
> -        range.setStart( weekDay );
> -    }
> -
> -    // go back to the start of the next week, thus, reverting the -1 we did above
> -    range.setStart( range.start().addDays( 1 ) );
> -
> -    return range;
> -}
> -
> -
> -// static
> -DateRange DateRange::lastNMonths( int n )
> -{
> -    // This month is the first month
> -    DateRange range = thisMonth( DateRange::NoDateRangeFlags );
> -
> -    // move the start n-1 months back
> -    range.setStart( KGlobal::locale()->calendar()->addMonths(range.start(), n-1 ) \
>                 );
> -
> -    return range;
> -}
> -
> -
> -bool operator==( const DateRange& r1, const DateRange& r2 )
> -{
> -    return r1.start() == r2.start() && r1.end() == r2.end();
> -}
> -
> -
> -bool operator!=( const DateRange& r1, const DateRange& r2 )
> -{
> -    return r1.start() != r2.start() || r1.end() != r2.end();
> -}
> -
> -
> -uint qHash( const DateRange& range )
> -{
> -    return qHash( range.start() ) ^ qHash( range.end() );
> -}
> -
> -QDebug operator<<( QDebug dbg, const DateRange& range )
> -{
> -    dbg.nospace() << "DateRange(" << range.start() << range.end() << ")";
> -    return dbg;
> -}
> diff --git a/utils/daterange.h b/utils/daterange.h
> deleted file mode 100644
> index 0d793d5..0000000
> --- a/utils/daterange.h
> +++ /dev/null
> @@ -1,214 +0,0 @@
> -/*
> -   Copyright (c) 2009-2010 Sebastian Trueg <trueg@kde.org>
> -
> -   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, see <http://www.gnu.org/licenses/>.
> -
> -*/
> -
> -#ifndef _DATE_RANGE_H_
> -#define _DATE_RANGE_H_
> -
> -#include <QtCore/QDate>
> -#include <QtCore/QSharedDataPointer>
> -
> -class QDebug;
> -
> -/**
> - * \class DateRange daterange.h DateRange
> - *
> - * \brief A simple data structure storing a start and an end date.
> - *
> - * %DateRange is a very simple data structure storing a start and an end date.
> - * The really interesting parts are the static factory methods which take the
> - * current calendar system into account and, thus, create accurate values.
> - *
> - * \author Sebastian Trueg <trueg@kde.org>
> - */
> -class DateRange
> -{
> -public:
> -    /**
> -     * Create a new range
> -     */
> -    DateRange( const QDate& s = QDate(),
> -               const QDate& e = QDate() );
> -
> -    /**
> -     * Copy constructor
> -     */
> -    DateRange( const DateRange& other );
> -
> -    /**
> -     * Destructor
> -     */
> -    ~DateRange();
> -
> -    /**
> -     * Make this range a copy of \p other
> -     */
> -    DateRange& operator=( const DateRange& other );
> -
> -    /**
> -     * Start date of the range.
> -     */
> -    QDate start() const;
> -
> -    /**
> -     * End date of the range.
> -     */
> -    QDate end() const;
> -
> -    /**
> -     * Checks if both start and end are valid dates
> -     * and if end is after start.
> -     */
> -    bool isValid() const;
> -
> -    /**
> -     * Set the start to \p date.
> -     */
> -    void setStart( const QDate& date );
> -
> -    /**
> -     * Set the end to \p date.
> -     */
> -    void setEnd( const QDate& date );
> -
> -    /**
> -     * \returns a DateRange with both start and end
> -     * dates set to QDate::currentDate()
> -     */
> -    static DateRange today();
> -
> -    /**
> -     * The flags allow to change the result returned by several of the
> -     * static factory methods provided by DateRange such as thisWeek()
> -     * or thisMonth().
> -     */
> -    enum DateRangeFlag {
> -        /**
> -         * No flags.
> -         */
> -        NoDateRangeFlags = 0x0,
> -
> -        /**
> -         * Exclude days that are in the future. thisWeek() for example
> -         * will not include the days in the week that come after the current
> -         * day.
> -         */
> -        ExcludeFutureDays = 0x1
> -    };
> -    Q_DECLARE_FLAGS( DateRangeFlags, DateRangeFlag )
> -
> -    /**
> -     * Takes KLocale::weekStartDay() into account.
> -     * \sa DateRangeFlag
> -     */
> -    static DateRange thisWeek( DateRangeFlags flags = NoDateRangeFlags );
> -
> -    /**
> -     * Takes KLocale::weekStartDay() into account.
> -     * \param flags ExcludeFutureDays does only makes sense for a date in the \
>                 current week. For
> -     * future weeks it is ignored.
> -     * \sa DateRangeFlag
> -     */
> -    static DateRange weekOf( const QDate& date, DateRangeFlags flags = \
>                 NoDateRangeFlags );
> -
> -    /**
> -     * \return A DateRange which includes all days of the current month.
> -     *
> -     * \sa DateRangeFlag
> -     */
> -    static DateRange thisMonth( DateRangeFlags flags = NoDateRangeFlags );
> -
> -    /**
> -     * \param flags ExcludeFutureDays does only makes sense for a date in the \
>                 current month. For
> -     * future months it is ignored.
> -     * \return A DateRange which includes all days of the month in which
> -     * \p date falls.
> -     * \sa DateRangeFlag
> -     */
> -    static DateRange monthOf( const QDate& date, DateRangeFlags flags = \
>                 NoDateRangeFlags );
> -
> -    /**
> -     * \return A DateRange which includes all days of the current year.
> -     * \sa DateRangeFlag
> -     */
> -    static DateRange thisYear( DateRangeFlags flags = NoDateRangeFlags );
> -
> -    /**
> -     * \param flags ExcludeFutureDays does only makes sense for a date in the \
>                 current year. For
> -     * future years it is ignored.
> -     * \return A DateRange which includes all days of the year in which
> -     * \p date falls.
> -     * \sa DateRangeFlags
> -     */
> -    static DateRange yearOf( const QDate& date, DateRangeFlags flags = \
>                 NoDateRangeFlags );
> -
> -    /**
> -     * \return A DateRange which spans the last \p n days.
> -     */
> -    static DateRange lastNDays( int n );
> -
> -    /**
> -     * \return A DateRange which spans the last \p n weeks,
> -     * including the already passed days in the current week.
> -     */
> -    static DateRange lastNWeeks( int n );
> -
> -    /**
> -     * \return A DateRange which spans the last \p n months,
> -     * including the already passed days in the current month.
> -     */
> -    static DateRange lastNMonths( int n );
> -
> -private:
> -    class Private;
> -    QSharedDataPointer<Private> d;
> -};
> -
> -/**
> - * Comparison operator
> - *
> - * \related DateRange
> - */
> -bool operator==( const DateRange& r1, const DateRange& r2 );
> -
> -/**
> - * Comparison operator
> - *
> - * \related DateRange
> - */
> -bool operator!=( const DateRange& r1, const DateRange& r2 );
> -
> -/**
> - * Allows using DateRange in hashed structures such as QHash or QMap.
> - *
> - * \related DateRange
> - */
> -uint qHash( const DateRange& range );
> -
> -/**
> - * Debug streaming operator
> - *
> - * \relates DateRange
> - */
> -QDebug operator<<( QDebug dbg, const DateRange& range );
> -
> -Q_DECLARE_OPERATORS_FOR_FLAGS( DateRange::DateRangeFlags )
> -
> -#endif
> diff --git a/utils/daterangeselectionwidget.cpp \
> b/utils/daterangeselectionwidget.cpp deleted file mode 100644
> index fd397e8..0000000
> --- a/utils/daterangeselectionwidget.cpp
> +++ /dev/null
> @@ -1,337 +0,0 @@
> -/*
> -   Copyright (c) 2009 Sebastian Trueg <trueg@kde.org>
> -
> -   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, see <http://www.gnu.org/licenses/>.
> -
> -*/
> -
> -#include "daterangeselectionwidget.h"
> -#include "ui_daterangeselectionwidget.h"
> -#include "daterange.h"
> -
> -#include <QtGui/QToolButton>
> -#include <QtGui/QCalendarWidget>
> -#include <QtGui/QButtonGroup>
> -#include <QtGui/QDateEdit>
> -#include <QtGui/QTextCharFormat>
> -#include <QtGui/QPalette>
> -#include <QtGui/QAction>
> -#include <QtGui/QMenu>
> -#include <QtCore/QHash>
> -
> -
> -class DateRangeSelectionWidget::Private : public Ui::DateRangeSelectionWidgetBase
> -{
> -public:
> -    void _k_anytimeClicked();
> -    void _k_beforeClicked();
> -    void _k_afterClicked();
> -    void _k_rangeClicked();
> -    void _k_rangeClicked( QAction* );
> -    void _k_rangeStartEdited( const QDate& date );
> -    void _k_rangeEndEdited( const QDate& date );
> -    void _k_calendarDateClicked( const QDate& date );
> -
> -    void checkButton( QAbstractButton* button );
> -    void setupPopupMenus();
> -
> -    void updateCalendar( const DateRange& range );
> -    void updateEditBoxes( const DateRange& range );
> -
> -    void setRange( const DateRange& range );
> -
> -    QAction* findRangeAction( const DateRange& range );
> -
> -    DateRange m_range;
> -
> -    QAction* m_currentRangeAction;
> -    QHash<QAction*, DateRange> m_rangeActionMap;
> -
> -    DateRangeSelectionWidget* q;
> -};
> -
> -
> -void DateRangeSelectionWidget::Private::_k_anytimeClicked()
> -{
> -    checkButton( m_anytimeButton );
> -    setRange( DateRange() );
> -
> -    emit q->rangeChanged( m_range );
> -}
> -
> -
> -void DateRangeSelectionWidget::Private::_k_beforeClicked()
> -{
> -    if ( m_range.end().isValid() )
> -        setRange( DateRange( QDate(), m_range.end() ) );
> -    else if ( m_range.start().isValid() )
> -        setRange( DateRange( QDate(), m_range.start() ) );
> -    else
> -        setRange( DateRange( QDate(), QDate::currentDate() ) );
> -
> -    emit q->rangeChanged( m_range );
> -}
> -
> -
> -void DateRangeSelectionWidget::Private::_k_afterClicked()
> -{
> -    if ( m_range.start().isValid() )
> -        setRange( DateRange( m_range.start(), QDate() ) );
> -    else if ( m_range.end().isValid() )
> -        setRange( DateRange( m_range.end(), QDate() ) );
> -    else
> -        setRange( DateRange( QDate::currentDate(), QDate() ) );
> -
> -    emit q->rangeChanged( m_range );
> -}
> -
> -
> -void DateRangeSelectionWidget::Private::_k_rangeClicked()
> -{
> -    _k_rangeClicked( m_currentRangeAction );
> -}
> -
> -
> -void DateRangeSelectionWidget::Private::_k_rangeClicked( QAction* action )
> -{
> -    m_currentRangeAction = action;
> -    m_rangesButton->setText( action->text() );
> -    setRange( m_rangeActionMap[action] );
> -
> -    emit q->rangeChanged( m_range );
> -}
> -
> -
> -void DateRangeSelectionWidget::Private::_k_rangeStartEdited( const QDate& date )
> -{
> -    if ( date > m_range.end() )
> -        setRange( DateRange( date, date ) );
> -    else
> -        setRange( DateRange( date, m_range.end() ) );
> -
> -    emit q->rangeChanged( m_range );
> -}
> -
> -
> -void DateRangeSelectionWidget::Private::_k_rangeEndEdited( const QDate& date )
> -{
> -    if ( date < m_range.start() )
> -        setRange( DateRange( date, date ) );
> -    else
> -        setRange( DateRange( m_range.start(), date ) );
> -
> -    emit q->rangeChanged( m_range );
> -}
> -
> -
> -void DateRangeSelectionWidget::Private::_k_calendarDateClicked( const QDate& date \
>                 )
> -{
> -    if ( QApplication::keyboardModifiers() & Qt::ShiftModifier ) {
> -        if ( m_range.start().isValid() &&
> -             date < m_range.start() ) {
> -            setRange( DateRange( date, m_range.end().isValid() ? m_range.end() : \
>                 m_range.start() ) );
> -            emit q->rangeChanged( m_range );
> -        }
> -        else if ( m_range.end().isValid() &&
> -                  date < m_range.end() ) {
> -            setRange( DateRange( date, m_range.end() ) );
> -            emit q->rangeChanged( m_range );
> -        }
> -        else if ( m_range.end().isValid() &&
> -                  date > m_range.end() ) {
> -            setRange( DateRange( m_range.start().isValid() ? m_range.start() : \
>                 m_range.end(), date ) );
> -            emit q->rangeChanged( m_range );
> -        }
> -        else if ( m_range.start().isValid() &&
> -                  date > m_range.start() ) {
> -            setRange( DateRange( m_range.start(), date ) );
> -            emit q->rangeChanged( m_range );
> -        }
> -    }
> -    else if ( m_beforeButton->isChecked() ) {
> -        setRange( DateRange( QDate(), date ) );
> -        emit q->rangeChanged( m_range );
> -    }
> -    else if ( m_afterButton->isChecked() ) {
> -        setRange( DateRange( date, QDate() ) );
> -        emit q->rangeChanged( m_range );
> -    }
> -    else {
> -        setRange( DateRange( date, date ) );
> -        emit q->rangeChanged( m_range );
> -    }
> -}
> -
> -
> -void DateRangeSelectionWidget::Private::checkButton( QAbstractButton* button )
> -{
> -    foreach( QAbstractButton* b, m_buttonGroup->buttons() ) {
> -        b->setChecked( b == button );
> -    }
> -}
> -
> -
> -void DateRangeSelectionWidget::Private::setupPopupMenus()
> -{
> -    QMenu* menu = new QMenu(m_rangesButton);
> -
> -    QAction* a = new QAction( menu );
> -    a->setText( i18n( "Today" ) );
> -    m_rangeActionMap.insert( a, DateRange::today() );
> -    menu->addAction( a );
> -
> -    // today is the default
> -    m_currentRangeAction = a;
> -
> -    a = new QAction( menu );
> -    a->setText( i18n( "This Week" ) );
> -    m_rangeActionMap.insert( a, DateRange::thisWeek() );
> -    menu->addAction( a );
> -
> -    a = new QAction( menu );
> -    a->setText( i18n( "This Month" ) );
> -    m_rangeActionMap.insert( a, DateRange::thisMonth() );
> -    menu->addAction( a );
> -
> -    m_rangesButton->setMenu( menu );
> -}
> -
> -
> -void DateRangeSelectionWidget::Private::updateCalendar( const DateRange& range )
> -{
> -    m_calendar->setDateTextFormat( QDate(), QTextCharFormat() );
> -    if ( range.start().isValid() )
> -        m_calendar->setSelectedDate( range.start() );
> -    else if ( range.end().isValid() )
> -        m_calendar->setSelectedDate( range.end() );
> -    else
> -        m_calendar->setSelectedDate( QDate::currentDate() );
> -    if ( range.isValid() ) {
> -        QTextCharFormat selectedFormat;
> -        selectedFormat.setBackground( q->palette().color( QPalette::Highlight ) );
> -        selectedFormat.setForeground( q->palette().color( \
>                 QPalette::HighlightedText ) );
> -        for ( QDate date = range.start(); date <= range.end(); date = \
>                 date.addDays( 1 ) ) {
> -            m_calendar->setDateTextFormat( date, selectedFormat );
> -        }
> -    }
> -}
> -
> -
> -void DateRangeSelectionWidget::Private::updateEditBoxes( const DateRange& range )
> -{
> -    m_rangeStartEdit->blockSignals( true );
> -    m_rangeEndEdit->blockSignals( true );
> -
> -    m_rangeStartEdit->setDate( range.start() );
> -    m_rangeEndEdit->setDate( range.end() );
> -    m_rangeStartEdit->setEnabled( range.start().isValid() );
> -    m_rangeEndEdit->setEnabled( range.end().isValid() );
> -
> -    m_rangeStartEdit->blockSignals( false );
> -    m_rangeEndEdit->blockSignals( false );
> -}
> -
> -
> -void DateRangeSelectionWidget::Private::setRange( const DateRange& range )
> -{
> -    m_range = range;
> -
> -    if ( range.isValid() ) {
> -        if ( QAction* a = findRangeAction( range ) ) {
> -            m_currentRangeAction = a;
> -            m_rangesButton->setText( a->text() );
> -            checkButton( m_rangesButton );
> -        }
> -        else {
> -            checkButton( 0 );
> -        }
> -    }
> -    else if ( range.start().isValid() ) {
> -        checkButton( m_afterButton );
> -    }
> -    else if ( range.end().isValid() ) {
> -        checkButton( m_beforeButton );
> -    }
> -    else {
> -        checkButton( m_anytimeButton );
> -    }
> -
> -    updateCalendar( range );
> -    updateEditBoxes( range );
> -}
> -
> -
> -QAction* DateRangeSelectionWidget::Private::findRangeAction( const DateRange& \
>                 range )
> -{
> -    // We have only 3 elements in here, thus, looping over them is ok
> -    for ( QHash<QAction*, DateRange>::const_iterator it = \
>                 m_rangeActionMap.constBegin();
> -          it != m_rangeActionMap.constEnd(); ++it ) {
> -        if ( it.value() == range )
> -            return it.key();
> -    }
> -    return 0;
> -}
> -
> -
> -DateRangeSelectionWidget::DateRangeSelectionWidget( QWidget* parent )
> -    : QWidget( parent ),
> -      d( new Private() )
> -{
> -    d->q = this;
> -    d->setupUi( this );
> -    d->setupPopupMenus();
> -
> -    d->m_calendar->setFirstDayOfWeek( Qt::DayOfWeek( \
>                 KGlobal::locale()->weekStartDay() ) );
> -    connect( d->m_anytimeButton, SIGNAL(clicked()),
> -             this, SLOT(_k_anytimeClicked()) );
> -    connect( d->m_beforeButton, SIGNAL(clicked()),
> -             this, SLOT(_k_beforeClicked()) );
> -    connect( d->m_afterButton, SIGNAL(clicked()),
> -             this, SLOT(_k_afterClicked()) );
> -    connect( d->m_rangesButton, SIGNAL(clicked()),
> -             this, SLOT(_k_rangeClicked()) );
> -    connect( d->m_rangesButton, SIGNAL(triggered(QAction*)),
> -             this, SLOT(_k_rangeClicked(QAction*)) );
> -    connect( d->m_rangeStartEdit, SIGNAL(dateChanged(QDate)),
> -             this, SLOT(_k_rangeStartEdited(QDate)) );
> -    connect( d->m_rangeEndEdit, SIGNAL(dateChanged(QDate)),
> -             this, SLOT(_k_rangeEndEdited(QDate)) );
> -    connect( d->m_calendar, SIGNAL(clicked(QDate)),
> -             this, SLOT(_k_calendarDateClicked(QDate)) );
> -
> -    setRange( DateRange() );
> -}
> -
> -
> -DateRangeSelectionWidget::~DateRangeSelectionWidget()
> -{
> -    delete d;
> -}
> -
> -
> -DateRange DateRangeSelectionWidget::range() const
> -{
> -    return d->m_range;
> -}
> -
> -
> -void DateRangeSelectionWidget::setRange( const DateRange& range )
> -{
> -    d->setRange( range );
> -}
> -
> -#include "daterangeselectionwidget.moc"
> diff --git a/utils/daterangeselectionwidget.h b/utils/daterangeselectionwidget.h
> deleted file mode 100644
> index 16a6dfb..0000000
> --- a/utils/daterangeselectionwidget.h
> +++ /dev/null
> @@ -1,91 +0,0 @@
> -/*
> -   Copyright (c) 2009-2010 Sebastian Trueg <trueg@kde.org>
> -
> -   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, see <http://www.gnu.org/licenses/>.
> -
> -*/
> -
> -#ifndef _DATE_RANGE_SELECTION_WIDGET_H_
> -#define _DATE_RANGE_SELECTION_WIDGET_H_
> -
> -#include <QtGui/QWidget>
> -
> -class DateRange;
> -class QAction;
> -class QDate;
> -
> -/**
> - * \class DataRangeSelectionWidget daterangeselectionwidget.h \
>                 DateRangeSelectionWidget
> - *
> - * \brief A widget that allows to select a range of dates.
> - *
> - * \sa DateRange
> - *
> - * \author Sebastian Trueg <trueg@kde.org>
> - */
> -class DateRangeSelectionWidget : public QWidget
> -{
> -    Q_OBJECT
> -
> -public:
> -    /**
> -     * Create a new DateRange selection widget with an
> -     * invalid DateRange set which corresponds to "anytime".
> -     */
> -    DateRangeSelectionWidget( QWidget* parent = 0 );
> -
> -    /**
> -     * Destructor
> -     */
> -    ~DateRangeSelectionWidget();
> -
> -    /**
> -     * One of:
> -     * \li a range between two valid dates
> -     * \li only a valid end date: all dates before that date
> -     * \li only a valid start date: all dates after that date
> -     * \li invalid range: anytime
> -     */
> -    DateRange range() const;
> -
> -public Q_SLOTS:
> -    /**
> -     * Set the date range.
> -     */
> -    void setRange( const DateRange& range );
> -
> -Q_SIGNALS:
> -    /**
> -     * Emitted when the date range changes.
> -     */
> -    void rangeChanged( const DateRange& range );
> -
> -private:
> -    class Private;
> -    Private* const d;
> -
> -    Q_PRIVATE_SLOT( d, void _k_anytimeClicked() )
> -    Q_PRIVATE_SLOT( d, void _k_beforeClicked() )
> -    Q_PRIVATE_SLOT( d, void _k_afterClicked() )
> -    Q_PRIVATE_SLOT( d, void _k_rangeClicked() )
> -    Q_PRIVATE_SLOT( d, void _k_rangeClicked( QAction* ) )
> -    Q_PRIVATE_SLOT( d, void _k_rangeStartEdited( const QDate& date ) )
> -    Q_PRIVATE_SLOT( d, void _k_rangeEndEdited( const QDate& date ) )
> -    Q_PRIVATE_SLOT( d, void _k_calendarDateClicked( const QDate& date ) )
> -};
> -
> -#endif
> diff --git a/utils/daterangeselectionwidget.ui b/utils/daterangeselectionwidget.ui
> deleted file mode 100644
> index 30a3b62..0000000
> --- a/utils/daterangeselectionwidget.ui
> +++ /dev/null
> @@ -1,123 +0,0 @@
> -<?xml version="1.0" encoding="UTF-8"?>
> -<ui version="4.0">
> - <author>Sebastian Trueg &lt;trueg@kde.org&gt;</author>
> - <class>DateRangeSelectionWidgetBase</class>
> - <widget class="QWidget" name="DateRangeSelectionWidgetBase">
> -  <property name="geometry">
> -   <rect>
> -    <x>0</x>
> -    <y>0</y>
> -    <width>364</width>
> -    <height>240</height>
> -   </rect>
> -  </property>
> -  <layout class="QVBoxLayout" name="verticalLayout">
> -   <item>
> -    <layout class="QHBoxLayout" name="horizontalLayout">
> -     <item>
> -      <spacer name="horizontalSpacer">
> -       <property name="orientation">
> -        <enum>Qt::Horizontal</enum>
> -       </property>
> -       <property name="sizeHint" stdset="0">
> -        <size>
> -         <width>0</width>
> -         <height>20</height>
> -        </size>
> -       </property>
> -      </spacer>
> -     </item>
> -     <item>
> -      <widget class="QToolButton" name="m_anytimeButton">
> -       <property name="text">
> -        <string>Anytime</string>
> -       </property>
> -       <property name="checkable">
> -        <bool>true</bool>
> -       </property>
> -       <property name="autoRaise">
> -        <bool>true</bool>
> -       </property>
> -       <attribute name="buttonGroup">
> -        <string>m_buttonGroup</string>
> -       </attribute>
> -      </widget>
> -     </item>
> -     <item>
> -      <widget class="QToolButton" name="m_beforeButton">
> -       <property name="text">
> -        <string>Before</string>
> -       </property>
> -       <property name="checkable">
> -        <bool>true</bool>
> -       </property>
> -       <property name="autoRaise">
> -        <bool>true</bool>
> -       </property>
> -       <attribute name="buttonGroup">
> -        <string>m_buttonGroup</string>
> -       </attribute>
> -      </widget>
> -     </item>
> -     <item>
> -      <widget class="QToolButton" name="m_afterButton">
> -       <property name="text">
> -        <string>After</string>
> -       </property>
> -       <property name="checkable">
> -        <bool>true</bool>
> -       </property>
> -       <property name="autoRaise">
> -        <bool>true</bool>
> -       </property>
> -       <attribute name="buttonGroup">
> -        <string>m_buttonGroup</string>
> -       </attribute>
> -      </widget>
> -     </item>
> -     <item>
> -      <widget class="QToolButton" name="m_rangesButton">
> -       <property name="text">
> -        <string>Today</string>
> -       </property>
> -       <property name="checkable">
> -        <bool>true</bool>
> -       </property>
> -       <property name="popupMode">
> -        <enum>QToolButton::MenuButtonPopup</enum>
> -       </property>
> -       <property name="autoRaise">
> -        <bool>true</bool>
> -       </property>
> -       <attribute name="buttonGroup">
> -        <string>m_buttonGroup</string>
> -       </attribute>
> -      </widget>
> -     </item>
> -    </layout>
> -   </item>
> -   <item>
> -    <widget class="QCalendarWidget" name="m_calendar"/>
> -   </item>
> -   <item>
> -    <layout class="QHBoxLayout" name="horizontalLayout_2">
> -     <item>
> -      <widget class="QDateEdit" name="m_rangeStartEdit"/>
> -     </item>
> -     <item>
> -      <widget class="QDateEdit" name="m_rangeEndEdit"/>
> -     </item>
> -    </layout>
> -   </item>
> -  </layout>
> - </widget>
> - <resources/>
> - <connections/>
> - <buttongroups>
> -  <buttongroup name="m_buttonGroup">
> -   <property name="exclusive">
> -    <bool>false</bool>
> -   </property>
> -  </buttongroup>
> - </buttongroups>
> -</ui>
> diff --git a/utils/dynamicresourcefacet.cpp b/utils/dynamicresourcefacet.cpp
> deleted file mode 100644
> index ad5f381..0000000
> --- a/utils/dynamicresourcefacet.cpp
> +++ /dev/null
> @@ -1,421 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "dynamicresourcefacet.h"
> -#include "dynamicresourcefacet_p.h"
> -#include "searchwidget.h"
> -
> -#include <Nepomuk2/Query/AndTerm>
> -#include <Nepomuk2/Query/OrTerm>
> -#include <Nepomuk2/Query/ResourceTerm>
> -#include <Nepomuk2/Query/ResourceTypeTerm>
> -#include <Nepomuk2/Query/ComparisonTerm>
> -#include <Nepomuk2/Query/Result>
> -#include <Nepomuk2/Query/Query>
> -#include <Nepomuk2/Query/QueryServiceClient>
> -
> -#include <Nepomuk2/Types/Property>
> -#include <Nepomuk2/Types/Class>
> -#include <Nepomuk2/Resource>
> -#include <Nepomuk2/ResourceManager>
> -
> -#include <KGuiItem>
> -#include <KDebug>
> -
> -#include <QtCore/QSet>
> -
> -
> -void Nepomuk2::Utils::DynamicResourceFacet::Private::rebuild( bool clearSelection \
>                 )
> -{
> -    kDebug() << clearSelection;
> -    m_haveMore = false;
> -    m_resources.clear();
> -    if( clearSelection )
> -        m_selectedResources.clear();
> -    q->setLayoutChanged();
> -
> -    Query::Query query = q->resourceQuery( m_currentQuery );
> -    query.setLimit( m_maxRows+1 );
> -    startQuery( query );
> -}
> -
> -
> -void Nepomuk2::Utils::DynamicResourceFacet::Private::startQuery( const \
>                 Query::Query& query )
> -{
> -    kDebug() << query;
> -    m_queryClient.query( query );
> -}
> -
> -
> -void Nepomuk2::Utils::DynamicResourceFacet::Private::addResource( const \
>                 Nepomuk2::Resource& res )
> -{
> -    if ( !m_resources.contains( res ) ) {
> -        m_resources.append( res );
> -        q->setLayoutChanged();
> -    }
> -}
> -
> -
> -void Nepomuk2::Utils::DynamicResourceFacet::Private::_k_newEntries( const \
>                 QList<Nepomuk2::Query::Result>& entries )
> -{
> -    kDebug();
> -    bool selectionChanged = false;
> -    Q_FOREACH( const Query::Result& result, entries ) {
> -        if( m_resources.count() == m_maxRows ) {
> -            // add the more... button
> -            m_haveMore = true;
> -        }
> -        else if( !m_resources.contains(result.resource()) ){
> -            m_resources.append( result.resource() );
> -            if( m_selectionMode == Facet::MatchOne &&
> -                m_selectedResources.isEmpty() ) {
> -                m_selectedResources << m_resources.first();
> -                selectionChanged = true;
> -            }
> -            else if( m_selectedResources.contains(result.resource()) ) {
> -                // in case we remember a selection from before
> -                selectionChanged = true;
> -            }
> -        }
> -    }
> -    q->setLayoutChanged();
> -}
> -
> -
> -void Nepomuk2::Utils::DynamicResourceFacet::Private::_k_populateFinished()
> -{
> -    kDebug() << m_resources.count();
> -    m_queryClient.close();
> -
> -    // clean up selection in case rebuild was called without clearing it
> -    // FIXME: shouldn't we rather add all the selected ones that are not in the \
>                 list yet?
> -    QSet<Resource>::iterator it = m_selectedResources.begin();
> -    while( it != m_selectedResources.end() ) {
> -        if( m_resources.contains( *it ) )
> -            ++it;
> -        else
> -            it = m_selectedResources.erase(it);
> -    }
> -}
> -
> -
> -Nepomuk2::Utils::DynamicResourceFacet::DynamicResourceFacet( QObject* parent )
> -    : Facet(parent),
> -      d(new Private())
> -{
> -    d->q = this;
> -    connect( &d->m_queryClient, \
>                 SIGNAL(newEntries(QList<Nepomuk2::Query::Result>)),
> -             this, SLOT(_k_newEntries(QList<Nepomuk2::Query::Result>)) );
> -    connect( &d->m_queryClient, SIGNAL(finishedListing()),
> -             this, SLOT(_k_populateFinished()) );
> -}
> -
> -
> -Nepomuk2::Utils::DynamicResourceFacet::~DynamicResourceFacet()
> -{
> -    delete d;
> -}
> -
> -
> -void Nepomuk2::Utils::DynamicResourceFacet::setSelectionMode( SelectionMode mode )
> -{
> -    d->m_selectionMode = mode;
> -    clearSelection();
> -}
> -
> -
> -Nepomuk2::Utils::Facet::SelectionMode \
>                 Nepomuk2::Utils::DynamicResourceFacet::selectionMode() const
> -{
> -    return d->m_selectionMode;
> -}
> -
> -
> -Nepomuk2::Query::Term Nepomuk2::Utils::DynamicResourceFacet::queryTerm() const
> -{
> -    if( d->m_resources.isEmpty() ||
> -        d->m_selectedResources.isEmpty() ) {
> -        return Query::Term();
> -    }
> -    else {
> -        switch( d->m_selectionMode ) {
> -        case MatchAll: {
> -            Query::AndTerm andTerm;
> -            Q_FOREACH( const Resource& res, d->m_selectedResources ) {
> -                andTerm.addSubTerm( termForResource( res ) );
> -            }
> -            return andTerm.optimized();
> -        }
> -        case MatchAny: {
> -            Query::OrTerm orTerm;
> -            Q_FOREACH( const Resource& res, d->m_selectedResources ) {
> -                orTerm.addSubTerm( termForResource(res) );
> -            }
> -            return orTerm.optimized();
> -        }
> -        case MatchOne:
> -            return termForResource( *d->m_selectedResources.begin() );
> -        }
> -    }
> -
> -    // make gcc shut up
> -    return Query::Term();
> -}
> -
> -
> -int Nepomuk2::Utils::DynamicResourceFacet::count() const
> -{
> -    int c = d->m_resources.count();
> -    if ( d->m_haveMore )
> -        ++c;
> -    return c;
> -}
> -
> -
> -bool Nepomuk2::Utils::DynamicResourceFacet::isSelected( int index ) const
> -{
> -    if( index < d->m_resources.count() )
> -        return d->m_selectedResources.contains( d->m_resources[index] );
> -    else
> -        return false;
> -}
> -
> -
> -void Nepomuk2::Utils::DynamicResourceFacet::setRelation( const Types::Property& \
>                 prop )
> -{
> -    d->m_property = prop;
> -    d->rebuild();
> -}
> -
> -
> -void Nepomuk2::Utils::DynamicResourceFacet::setResourceType( const Types::Class& \
>                 type )
> -{
> -    d->m_resourceType = type;
> -    d->rebuild();
> -}
> -
> -
> -void Nepomuk2::Utils::DynamicResourceFacet::setMaxRows( int max )
> -{
> -    d->m_maxRows = max;
> -    d->rebuild();
> -}
> -
> -
> -Nepomuk2::Types::Property Nepomuk2::Utils::DynamicResourceFacet::relation() const
> -{
> -    return d->m_property;
> -}
> -
> -
> -Nepomuk2::Types::Class Nepomuk2::Utils::DynamicResourceFacet::resourceType() const
> -{
> -    return d->resourceType();
> -}
> -
> -
> -QList<Nepomuk2::Resource> \
>                 Nepomuk2::Utils::DynamicResourceFacet::selectedResources() const
> -{
> -    return d->m_selectedResources.toList();
> -}
> -
> -
> -int Nepomuk2::Utils::DynamicResourceFacet::maxRows() const
> -{
> -    return d->m_maxRows;
> -}
> -
> -
> -KGuiItem Nepomuk2::Utils::DynamicResourceFacet::guiItem( int index ) const
> -{
> -    KGuiItem item;
> -
> -    if ( index < d->m_resources.count() ) {
> -        item.setText( d->m_resources[index].genericLabel() );
> -        return item;
> -    }
> -    else if ( d->m_haveMore && index == count()-1 ) {
> -        item.setText( i18nc( "@option:check An item in a list of resources that \
>                 allows to query for more resources to put in the list", "More..." ) \
>                 );
> -    }
> -
> -    return item;
> -}
> -
> -
> -void Nepomuk2::Utils::DynamicResourceFacet::setSelected( const Resource& res, bool \
>                 selected )
> -{
> -    kDebug() << res.uri() << selected;
> -    if( res.hasType( d->resourceType() ) ) {
> -        if( selected ) {
> -            d->addResource(res);
> -        }
> -        if ( d->m_resources.contains( res ) ) {
> -            setSelected( d->m_resources.indexOf( res ), selected );
> -        }
> -    }
> -}
> -
> -
> -void Nepomuk2::Utils::DynamicResourceFacet::setSelected( int index, bool selected \
>                 )
> -{
> -    kDebug() << index << selected;
> -    if ( d->m_haveMore && index == count()-1 && selected ) {
> -        const QList<Resource> rl = getMoreResources();
> -        Q_FOREACH( const Resource& res, rl ) {
> -            // FIXME: try to honor d->m_maxRows
> -            if ( !d->m_resources.contains( res ) ) {
> -                d->m_resources.append( res );
> -                setLayoutChanged();
> -            }
> -
> -            // select the new item
> -            setSelected( d->m_resources.indexOf(res) );
> -        }
> -
> -        // unselect the more item
> -        setSelected( d->m_resources.count(), false );
> -    }
> -    else if( index < d->m_resources.count() ) {
> -        Resource res = d->m_resources[index];
> -        if ( selectionMode() == MatchOne ) {
> -            if ( d->m_selectedResources.contains( res ) && !selected ) {
> -                clearSelection();
> -            }
> -            else if ( selected ) {
> -                d->m_selectedResources.clear();
> -                d->m_selectedResources.insert( res );
> -            }
> -        }
> -        else if ( selected ) {
> -            d->m_selectedResources.insert( res );
> -        }
> -        else {
> -            d->m_selectedResources.remove( res );
> -        }
> -    }
> -    setSelectionChanged();
> -    setQueryTermChanged();
> -}
> -
> -
> -void Nepomuk2::Utils::DynamicResourceFacet::clearSelection()
> -{
> -    kDebug();
> -    d->m_selectedResources.clear();
> -    if( selectionMode() == MatchOne && !d->m_resources.isEmpty() )
> -        d->m_selectedResources.insert(d->m_resources.first());
> -    setSelectionChanged();
> -    setQueryTermChanged();
> -}
> -
> -
> -bool Nepomuk2::Utils::DynamicResourceFacet::selectFromTerm( const \
>                 Nepomuk2::Query::Term& term )
> -{
> -    kDebug() << term;
> -    Resource res = resourceForTerm(term);
> -    if( res.isValid() ) {
> -        setSelected( res );
> -        return true;
> -    }
> -    else if( ( term.isAndTerm() && selectionMode() == MatchAll ) ||
> -             ( term.isOrTerm() && selectionMode() == MatchAny ) ) {
> -        QList<Resource> resources;
> -
> -        // first check if all of the terms are usable
> -        const QList<Query::Term> subTerms = term.isAndTerm() ? \
>                 term.toAndTerm().subTerms() : term.toOrTerm().subTerms();
> -        Q_FOREACH( const Query::Term& subTerm, subTerms ) {
> -            Resource res = resourceForTerm(subTerm);
> -            if( res.isValid() )
> -                resources << res;
> -            else
> -                return false;
> -        }
> -
> -        // all terms are in facet usable
> -        Q_FOREACH( const Resource& res, resources ) {
> -            setSelected( res );
> -        }
> -        return true;
> -    }
> -    else {
> -        return false;
> -    }
> -}
> -
> -
> -void Nepomuk2::Utils::DynamicResourceFacet::handleClientQueryChange()
> -{
> -    kDebug();
> -    d->rebuild( false );
> -}
> -
> -
> -Nepomuk2::Query::Query Nepomuk2::Utils::DynamicResourceFacet::resourceQuery( const \
>                 Query::Query& clientQuery ) const
> -{
> -    // we only select resources that make sense with the current query, ie. those \
>                 that would actually
> -    // change the current result set
> -    Query::ComparisonTerm clientQueryRestrictionTerm( d->m_property, \
>                 clientQuery.term() );
> -    clientQueryRestrictionTerm.setInverted(true);
> -
> -    // we sort the resources by usage
> -    Nepomuk2::Query::ComparisonTerm term( d->m_property, Nepomuk2::Query::Term() \
>                 );
> -    term.setSortWeight( 1, Qt::DescendingOrder );
> -    term.setAggregateFunction( Nepomuk2::Query::ComparisonTerm::Count );
> -    term.setInverted(true);
> -
> -    return Query::Query( Query::ResourceTypeTerm( resourceType() ) && \
>                 clientQueryRestrictionTerm && term );
> -}
> -
> -
> -Nepomuk2::Query::Term Nepomuk2::Utils::DynamicResourceFacet::termForResource( \
>                 const Resource& res ) const
> -{
> -    return d->m_property == Query::ResourceTerm( res );
> -}
> -
> -
> -Nepomuk2::Resource Nepomuk2::Utils::DynamicResourceFacet::resourceForTerm( const \
>                 Nepomuk2::Query::Term& term ) const
> -{
> -    if( term.isComparisonTerm() &&
> -        term.toComparisonTerm().property() == d->m_property &&
> -        term.toComparisonTerm().subTerm().isResourceTerm() &&
> -        term.toComparisonTerm().subTerm().toResourceTerm().resource().hasType( \
>                 d->resourceType() ) ) {
> -        return term.toComparisonTerm().subTerm().toResourceTerm().resource();
> -    }
> -    else {
> -        return Resource();
> -    }
> -}
> -
> -
> -QList<Nepomuk2::Resource> \
>                 Nepomuk2::Utils::DynamicResourceFacet::getMoreResources() const
> -{
> -    return SearchWidget::searchResources( 0, resourceQuery( d->m_currentQuery ), \
>                 SearchWidget::NoConfigFlags );
> -}
> -
> -
> -Nepomuk2::Resource Nepomuk2::Utils::DynamicResourceFacet::resourceAt(int i) const
> -{
> -    if( i < d->m_resources.count() )
> -        return d->m_resources[i];
> -    else
> -        return Resource();
> -}
> -
> -#include "dynamicresourcefacet.moc"
> diff --git a/utils/dynamicresourcefacet.h b/utils/dynamicresourcefacet.h
> deleted file mode 100644
> index 3c4d3f3..0000000
> --- a/utils/dynamicresourcefacet.h
> +++ /dev/null
> @@ -1,271 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef _NEPOMUK_QUERY_DYNAMIC_RESOURCE_FACET_H_
> -#define _NEPOMUK_QUERY_DYNAMIC_RESOURCE_FACET_H_
> -
> -#include "facet.h"
> -#include "nepomukwidgets_export.h"
> -
> -#include <QtCore/QList>
> -
> -namespace Nepomuk2 {
> -    class Resource;
> -    namespace Types {
> -        class Property;
> -        class Class;
> -    }
> -    namespace Query {
> -        class Result;
> -    }
> -
> -    namespace Utils {
> -        /**
> -         * \class DynamicResourceFacet dynamicresourcefacet.h \
>                 Nepomuk/Utils/DynamicResourceFacet
> -         *
> -         * \ingroup nepomuk_facets
> -         *
> -         * \brief A facet that presents a dynamic lists of resources with the \
>                 possibility
> -         * to search for more.
> -         *
> -         * The %DynamicResourceFacet provides a way for the user to choose one or \
>                 more resources
> -         * which in combination with a property are used to construct \
>                 Query::ComparisonTerm instances
> -         * that make up the facet's term.
> -         *
> -         * A typical use case would be the relation to a project or a person or a \
>                 tag. The latter,
> -         * however, is already provided via Facet::createTagFacet().
> -         *
> -         * Usage is simple: set the property to use via setRelation() and \
>                 optionally a resource type
> -         * via setResourceType().
> -         *
> -         * For customized query terms and resource listing DynamicResourceFacet \
>                 might also be used
> -         * as a base class for a new facet by reimplementing methods like \
>                 resourceTerm() or
> -         * getMoreResources().
> -         *
> -         * \warning DynamicResourceFacet will create a local event loop in order \
>                 to show a dialog when
> -         * the user wants to search for more resource candidates.
> -         *
> -         * \author Sebastian Trueg <trueg@kde.org>
> -         *
> -         * \since 4.6
> -         */
> -        class NEPOMUKWIDGETS_EXPORT DynamicResourceFacet : public Facet
> -        {
> -            Q_OBJECT
> -
> -        public:
> -            /**
> -             * Create a new empty facet.
> -             */
> -            DynamicResourceFacet( QObject* parent = 0 );
> -
> -            /**
> -             * Destructor
> -             */
> -            virtual ~DynamicResourceFacet();
> -
> -            /**
> -             * \return The currently selected Term. Depending on the
> -             * selectionMode() this is either a single Term, a combination
> -             * through Query::AndTerm, or a combination through Query::OrTerm.
> -             */
> -            Query::Term queryTerm() const;
> -
> -            /**
> -             * Set the selection mode to use in this facet. The default is \
>                 MatchAny.
> -             */
> -            void setSelectionMode( SelectionMode mode );
> -
> -            /**
> -             * The selection mode set via setSelectionMode()
> -             */
> -            SelectionMode selectionMode() const;
> -
> -            /**
> -             * \return The number of choices in the facet.
> -             */
> -            int count() const;
> -
> -            /**
> -             * The parameters used to render the choice at \p index.
> -             */
> -            KGuiItem guiItem( int index ) const;
> -
> -            /**
> -             * \return \p true if the choice at \p index is selected, \p false \
>                 otherwise.
> -             */
> -            bool isSelected( int index ) const;
> -
> -            /**
> -             * Set the property to use in the facet.
> -             */
> -            void setRelation( const Types::Property& prop );
> -
> -            /**
> -             * This is optional and defaults to the property's
> -             * range if not set.
> -             */
> -            void setResourceType( const Types::Class& type );
> -
> -            /**
> -             * Set the maximum rows to show by default. Further resources
> -             * are accessible through a search dialog.
> -             * By default the number of max rows is 5.
> -             */
> -            void setMaxRows( int max );
> -
> -            /**
> -             * \return The property set via setRelation()
> -             */
> -            Types::Property relation() const;
> -
> -            /**
> -             * \return The resource type set via setResourceType() or the range
> -             * of relation() in case no specific resource type was set.
> -             */
> -            Types::Class resourceType() const;
> -
> -            /**
> -             * \return The number of maximum rows set via setMaxRows().
> -             */
> -            int maxRows() const;
> -
> -            /**
> -             * \return The resource that is represented by the choice at index
> -             * \p i or an invalid Resource in case \i is out of bounds or points
> -             * to the "more" action.
> -             */
> -            Nepomuk2::Resource resourceAt( int i ) const;
> -
> -            /**
> -             * \return The currently selected resources.
> -             */
> -            QList<Resource> selectedResources() const;
> -
> -        public Q_SLOTS:
> -            /**
> -             * Clear the selection. If selectionMode() is MatchOne the first
> -             * choice will be selected.
> -             */
> -            void clearSelection();
> -
> -            /**
> -             * Select or deselect the resource at \p index.
> -             */
> -            void setSelected( int index, bool selected = true );
> -
> -            /**
> -             * Select or deselect \p res. If \p res is not of the correct type
> -             * nothing happens.
> -             */
> -            void setSelected( const Nepomuk2::Resource& res, bool selected = true \
>                 );
> -
> -            /**
> -             * The \p term is analyzed depending on the selectionMode().
> -             *
> -             * \sa Facet::selectFromTerm()
> -             */
> -            bool selectFromTerm( const Nepomuk2::Query::Term& queryTerm );
> -
> -        protected:
> -            /**
> -             * Construct the query that will be used to determine the resources \
>                 that
> -             * are presented as choices in the facet.
> -             *
> -             * The default implementation uses resourceType() in combination with \
>                 \p clientQuery
> -             * to determine the resources that can actually change the final query \
>                 results.
> -             *
> -             * \param clientQuery The query set via setClientQuery(). \
>                 Reimplementations should
> -             * use this to restrict the query to resources that actually change \
>                 the final
> -             * query results.
> -             *
> -             * Reimplementations might also call the default implementation to \
>                 simply add
> -             * additional restrictions to the query like so:
> -             *
> -             * \code
> -             * Query::Query query = DynamicResourceFacet::resourceQuery( \
>                 clientQuery );
> -             * query.setTerm( query.term() && myFancyQueryTerm );
> -             * \endcode
> -             *
> -             * \return The query that is used to fetch resources to be provided as \
>                 choices
> -             * in this facet.
> -             */
> -            virtual Query::Query resourceQuery( const Query::Query& clientQuery ) \
>                 const;
> -
> -            /**
> -             * Used by term() to construct the final query term this facet \
>                 provides.
> -             * Reimplementing this method allows to customize the way the term is \
>                 built.
> -             *
> -             * The default implementation uses relation() in a \
>                 Query::ComparisonTerm.
> -             *
> -             * When reimplementing this method resourceForTerm() also needs to be \
>                 reimplemented.
> -             */
> -            virtual Nepomuk2::Query::Term termForResource( const Resource& res ) \
>                 const;
> -
> -            /**
> -             * Used by selectFromTerm() to convert terms into resources.
> -             * This is the counterpart to termForResource(). The default \
>                 implementation checks
> -             * if \p term is a Query::ComparisonTerm which uses relation().
> -             *
> -             * When reimplementing this method termForResource() also needs to be \
>                 reimplemented.
> -             *
> -             * \return The resource that is represented by \p term if the latter \
>                 has the form
> -             * as terms generated by termForResource(), an invalid Resource \
>                 otherwise.
> -             */
> -            virtual Nepomuk2::Resource resourceForTerm( const \
>                 Nepomuk2::Query::Term& queryTerm ) const;
> -
> -            /**
> -             * Used to query additional resources if maxRows() is too small to fit \
>                 all
> -             * candidates.
> -             *
> -             * The default implementation simply uses SearchWidget to let the user \
>                 query
> -             * additional resources.
> -             *
> -             * \warning The default implementation opens a dialog which will start \
>                 a local
> -             * event loop.
> -             *
> -             * Reimplementations may use clientQuery() to optimize the resource \
>                 selection.
> -             *
> -             * \return The list of resources that should be selected in addition \
>                 to the
> -             * already selected ones.
> -             */
> -            virtual QList<Resource> getMoreResources() const;
> -
> -            /**
> -             * Reimplemented to properly update the resource list on client query \
>                 change.
> -             */
> -            void handleClientQueryChange();
> -
> -#ifdef BUILDING_NEPOMUK_TESTS
> -        protected:
> -#else
> -        private:
> -#endif
> -            class Private;
> -            Private* d;
> -
> -            Q_PRIVATE_SLOT( d, void _k_newEntries( const \
>                 QList<Nepomuk2::Query::Result>& ) )
> -            Q_PRIVATE_SLOT( d, void _k_populateFinished() )
> -        };
> -    }
> -}
> -
> -#endif
> diff --git a/utils/dynamicresourcefacet_p.h b/utils/dynamicresourcefacet_p.h
> deleted file mode 100644
> index fb66ff0..0000000
> --- a/utils/dynamicresourcefacet_p.h
> +++ /dev/null
> @@ -1,92 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef _NEPOMUK_QUERY_DYNAMIC_RESOURCE_FACET_P_H_
> -#define _NEPOMUK_QUERY_DYNAMIC_RESOURCE_FACET_P_H_
> -
> -#include "dynamicresourcefacet.h"
> -
> -#include <Nepomuk2/Resource>
> -#include <Nepomuk2/Query/Result>
> -#include <Nepomuk2/Query/Query>
> -#include <Nepomuk2/Query/QueryServiceClient>
> -#include <Nepomuk2/Types/Property>
> -#include <Nepomuk2/Types/Class>
> -
> -#include <QtCore/QSet>
> -
> -#ifdef Q_OS_WIN
> -#include "nepomukwidgets_export.h"
> -
> -class NEPOMUKWIDGETS_EXPORT Nepomuk2::Utils::DynamicResourceFacet::Private
> -#else
> -class Nepomuk2::Utils::DynamicResourceFacet::Private
> -#endif
> -{
> -public:
> -    Private()
> -        : m_selectionMode(Facet::MatchAny),
> -          m_maxRows( 5 ),
> -          m_haveMore( false ) {
> -    }
> -    virtual ~Private() {
> -    }
> -
> -    Types::Class resourceType() const {
> -        if ( m_resourceType.isValid() )
> -            return m_resourceType;
> -        else
> -            return m_property.range();
> -    }
> -
> -    /// rebuild the choices from the query, optionally clearing the selection
> -    void rebuild( bool clearSelection = true );
> -
> -    /// actually run the query in rebuild - this is virtual only for the unit test
> -    virtual void startQuery( const Query::Query& query );
> -
> -    /// add a resource to the list of choices if it is not already in
> -    void addResource( const Nepomuk2::Resource& res );
> -
> -    void _k_newEntries( const QList<Nepomuk2::Query::Result>& );
> -    void _k_populateFinished();
> -
> -    Query::QueryServiceClient m_queryClient;
> -
> -    Facet::SelectionMode m_selectionMode;
> -    Types::Property m_property;
> -    Types::Class m_resourceType;
> -    int m_maxRows;
> -    bool m_haveMore;
> -
> -    /// The query which the client is currently using and which we use
> -    /// to select a subset of resources that make sense
> -    Query::Query m_currentQuery;
> -
> -    // list of resources built by rebuild()
> -    QList<Resource> m_resources;
> -
> -    QSet<Resource> m_selectedResources;
> -
> -    DynamicResourceFacet* q;
> -};
> -
> -#endif
> diff --git a/utils/facet.cpp b/utils/facet.cpp
> deleted file mode 100644
> index b3e25d6..0000000
> --- a/utils/facet.cpp
> +++ /dev/null
> @@ -1,200 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "facet.h"
> -#include "simplefacet.h"
> -#include "dynamicresourcefacet.h"
> -#include "datefacet.h"
> -#include "typefacet.h"
> -
> -#include <Soprano/Vocabulary/NAO>
> -
> -#include <Nepomuk2/Query/StandardQuery>
> -#include <Nepomuk2/Query/AndTerm>
> -#include <Nepomuk2/Query/OrTerm>
> -#include <Nepomuk2/Query/ComparisonTerm>
> -#include <Nepomuk2/Query/LiteralTerm>
> -#include <Nepomuk2/Query/ResourceTerm>
> -#include <Nepomuk2/Query/ResourceTypeTerm>
> -#include <Nepomuk2/Query/Query>
> -
> -
> -#include <Nepomuk2/Tag>
> -#include <Nepomuk2/Types/Property>
> -
> -#include <Nepomuk2/Vocabulary/TMO>
> -#include <Nepomuk2/Vocabulary/NMO>
> -#include <Nepomuk2/Vocabulary/NCO>
> -#include <Nepomuk2/Vocabulary/NFO>
> -#include <Nepomuk2/Vocabulary/NIE>
> -
> -#include <KGuiItem>
> -#include <KDebug>
> -
> -using namespace Nepomuk2::Query;
> -
> -
> -class Nepomuk2::Utils::Facet::FacetPrivate
> -{
> -public:
> -    Query::Query m_clientQuery;
> -};
> -
> -
> -Nepomuk2::Utils::Facet::Facet( QObject* parent )
> -    : QObject( parent ),
> -      d(new FacetPrivate())
> -{
> -}
> -
> -
> -Nepomuk2::Utils::Facet::~Facet()
> -{
> -    delete d;
> -}
> -
> -
> -QString Nepomuk2::Utils::Facet::text( int index ) const
> -{
> -    return guiItem( index ).text();
> -}
> -
> -
> -KGuiItem Nepomuk2::Utils::Facet::guiItem( int index ) const
> -{
> -    Q_UNUSED(index);
> -    return KGuiItem();
> -}
> -
> -
> -void Nepomuk2::Utils::Facet::setQueryTermChanged()
> -{
> -    emit queryTermChanged( this, queryTerm() );
> -}
> -
> -
> -void Nepomuk2::Utils::Facet::setLayoutChanged()
> -{
> -    emit layoutChanged( this );
> -}
> -
> -
> -void Nepomuk2::Utils::Facet::setSelectionChanged()
> -{
> -    emit selectionChanged( this );
> -}
> -
> -
> -void Nepomuk2::Utils::Facet::setClientQuery( const Nepomuk2::Query::Query& query )
> -{
> -    kDebug() << query;
> -    if( query != d->m_clientQuery ) {
> -        d->m_clientQuery = query;
> -        handleClientQueryChange();
> -    }
> -}
> -
> -
> -Nepomuk2::Query::Query Nepomuk2::Utils::Facet::clientQuery() const
> -{
> -    return d->m_clientQuery;
> -}
> -
> -
> -void Nepomuk2::Utils::Facet::handleClientQueryChange()
> -{
> -    // do nothing
> -}
> -
> -
> -// static
> -Nepomuk2::Utils::Facet* Nepomuk2::Utils::Facet::createFileTypeFacet( QObject* \
>                 parent )
> -{
> -    SimpleFacet* facetTypes = new SimpleFacet( parent );
> -    facetTypes->setSelectionMode( Facet::MatchAny );
> -    facetTypes->addTerm( i18nc("@option:check A filter on file type", \
>                 "Documents"),
> -                         ResourceTypeTerm(Nepomuk2::Vocabulary::NFO::Document()) \
>                 );
> -
> -    // need to check the mimetype as well since strigi is still not perfect
> -    facetTypes->addTerm( i18nc("@option:check A filter on file type - audio \
>                 files", "Audio"),
> -                         ComparisonTerm(Nepomuk2::Vocabulary::NIE::mimeType(), \
>                 LiteralTerm(QLatin1String("audio"))) );
> -    facetTypes->addTerm( i18nc("@option:check A filter on file type - media \
>                 video", "Video"),
> -                         ComparisonTerm(Nepomuk2::Vocabulary::NIE::mimeType(), \
>                 LiteralTerm(QLatin1String("video"))) );
> -
> -    facetTypes->addTerm( i18nc("@option:check A filter on file type", "Images"),
> -                         ResourceTypeTerm(Nepomuk2::Vocabulary::NFO::Image()) );
> -    return facetTypes;
> -}
> -
> -
> -// static
> -Nepomuk2::Utils::Facet* Nepomuk2::Utils::Facet::createTypeFacet( QObject* parent )
> -{
> -    return new TypeFacet( parent );
> -}
> -
> -
> -// static
> -Nepomuk2::Utils::Facet* Nepomuk2::Utils::Facet::createDateFacet( QObject* parent )
> -{
> -    return new DateFacet( parent );
> -}
> -
> -
> -// static
> -Nepomuk2::Utils::Facet* Nepomuk2::Utils::Facet::createTagFacet( QObject* parent )
> -{
> -    DynamicResourceFacet* facetTags = new DynamicResourceFacet( parent );
> -    facetTags->setSelectionMode( Facet::MatchAll );
> -    facetTags->setRelation( Soprano::Vocabulary::NAO::hasTag() );
> -    facetTags->setResourceType( Soprano::Vocabulary::NAO::Tag() );
> -    return facetTags;
> -}
> -
> -
> -// static
> -Nepomuk2::Utils::Facet* Nepomuk2::Utils::Facet::createPriorityFacet( QObject* \
>                 parent )
> -{
> -    SimpleFacet* priorityFacet = new SimpleFacet( parent );
> -    priorityFacet->setSelectionMode(Facet::MatchOne);
> -    priorityFacet->addTerm( i18nc("@option:radio A filter on prioritizing/sorting \
>                 a selection of resources", "No priority"), Term() );
> -    priorityFacet->addTerm( i18nc("@option:radio A filter on prioritizing/sorting \
> a selection of resources", "Last modified"), standardQuery( LastModifiedFilesQuery \
>                 ).term() );
> -    priorityFacet->addTerm( i18nc("@option:radio A filter on prioritizing/sorting \
> a selection of resources", "Most important"), standardQuery( \
>                 MostImportantResourcesQuery ).term() );
> -    priorityFacet->addTerm( i18nc("@option:radio A filter on prioritizing/sorting \
> a selection of resources", "Never opened"), standardQuery( NeverOpenedFilesQuery \
>                 ).term() );
> -    return priorityFacet;
> -}
> -
> -
> -// static
> -Nepomuk2::Utils::Facet* Nepomuk2::Utils::Facet::createRatingFacet( QObject* parent \
>                 )
> -{
> -    SimpleFacet* facet = new SimpleFacet(parent);
> -    facet->setSelectionMode(Facet::MatchOne);
> -    facet->addTerm( i18nc("@option:radio A filter on the rating of a resource", \
>                 "Any Rating"), Term() );
> -    facet->addTerm( i18nc("@option:radio A filter on the rating of a resource", "1 \
>                 or more"), Soprano::Vocabulary::NAO::numericRating() >= \
>                 LiteralTerm( 1.5 ) );
> -    facet->addTerm( i18nc("@option:radio A filter on the rating of a resource", "2 \
>                 or more"), Soprano::Vocabulary::NAO::numericRating() >= \
>                 LiteralTerm( 3.5 ) );
> -    facet->addTerm( i18nc("@option:radio A filter on the rating of a resource", "3 \
>                 or more"), Soprano::Vocabulary::NAO::numericRating() >= \
>                 LiteralTerm( 5.5 ) );
> -    facet->addTerm( i18nc("@option:radio A filter on the rating of a resource", "4 \
>                 or more"), Soprano::Vocabulary::NAO::numericRating() >= \
>                 LiteralTerm( 7.5 ) );
> -    facet->addTerm( i18nc("@option:radio A filter on the rating of a resource", \
>                 "Max Rating"), Soprano::Vocabulary::NAO::numericRating() >= \
>                 LiteralTerm( 9.5 ) );
> -    return facet;
> -}
> -
> -#include "facet.moc"
> diff --git a/utils/facet.h b/utils/facet.h
> deleted file mode 100644
> index 320fa7f..0000000
> --- a/utils/facet.h
> +++ /dev/null
> @@ -1,318 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef _NEPOMUK_QUERY_FACET_H_
> -#define _NEPOMUK_QUERY_FACET_H_
> -
> -#include <QtCore/QObject>
> -
> -#include "nepomukwidgets_export.h"
> -
> -class KGuiItem;
> -
> -namespace Nepomuk2 {
> -    namespace Query {
> -        class Term;
> -        class Query;
> -    }
> -
> -    namespace Utils {
> -        /**
> -         * \class Facet facet.h Nepomuk/Utils/Facet
> -         *
> -         * \ingroup nepomuk_facets
> -         *
> -         * \brief The base class for all facets used to create query filters.
> -         *
> -         * A Facet represents one aspect of a query like the resource type or
> -         * the modification date. By providing a list of facets to the user they
> -         * can interactively construct a query by restricting the result set step
> -         * by step.
> -         *
> -         * A Facet can be seen as a list of choices presented to the user. \
>                 Depending
> -         * on the selection (which is typically triggered by user interaction) the
> -         * Facet produces a resulting term() which is then used in the final \
>                 query.
> -         *
> -         * Each facet needs to implement a set of methods describing the choices:
> -         * count(), guiItem(), isSelected(), setSelected(), and clearSelection().
> -         * In addition the term() method constructs the term this facet represents
> -         * with its current selection.
> -         *
> -         * Methods selectFromTerm() and setClientQuery() are optional but allow \
>                 for a
> -         * more advanced usage and a better user experience. See the method \
>                 documentation
> -         * for details.
> -         *
> -         * Before implementing your own Facet subclass make sure that SimpleFacet \
>                 or
> -         * DynamicResourceFacet do not suit your needs.
> -         *
> -         * Facet also provides a set of static factory methods like \
>                 createTagFacet() or
> -         * createFileTypeFacet() to create standard facets that are useful in most
> -         * query UI situations.
> -         *
> -         * \author Sebastian Trueg <trueg@kde.org>
> -         *
> -         * \since 4.6
> -         */
> -        class NEPOMUKWIDGETS_EXPORT Facet : public QObject
> -        {
> -            Q_OBJECT
> -
> -        public:
> -            /**
> -             * Constructor
> -             */
> -            Facet( QObject* parent = 0 );
> -
> -            /**
> -             * Destructor
> -             */
> -            virtual ~Facet();
> -
> -            /**
> -             * A Facet can have one of three selection modes which is provided
> -             * by selectionMode().
> -             */
> -            enum SelectionMode {
> -                /**
> -                 * All of the choices need to be matched. This typically
> -                 * means that all choices' terms are combined using an
> -                 * AndTerm.
> -                 */
> -                MatchAll,
> -
> -                /**
> -                 * At least one of the choices needs to be matched. This typically
> -                 * means that all choices' terms are combined using an
> -                 * OrTerm.
> -                 */
> -                MatchAny,
> -
> -                /**
> -                 * Exactly one of the choices needs to match. This means
> -                 * that the Facet is exclusive, ie. only one choice
> -                 * can be selected at all times.
> -                 */
> -                MatchOne
> -            };
> -
> -            /**
> -             * The selection mode used by this facet. The GUI client
> -             * can make use of this value to adjust the GUI accordingly.
> -             * A typical example would be using radio buttons for
> -             * MatchOne facets.
> -             */
> -            virtual SelectionMode selectionMode() const = 0;
> -
> -            /**
> -             * The term currently produced by this facet. This is dependant
> -             * on the subclass implementation and the selectionMode(). The \
>                 SimpleFacet for example
> -             * uses an AndTerm or an OrTerm to combine all its terms in MatchAll \
>                 or MatchAny
> -             * mode while it returns the one selected term in MatchOne mode.
> -             */
> -            virtual Query::Term queryTerm() const = 0;
> -
> -            /**
> -             * The number of choices this facet provides.
> -             */
> -            virtual int count() const = 0;
> -
> -            /**
> -             * The text to be displayed at \p index. The default implementation \
>                 makes
> -             * use of guiItem(). Normally subclasses would implement guItem() \
>                 instead
> -             * of this method.
> -             */
> -            virtual QString text( int index ) const;
> -
> -            /**
> -             * The parameters used to render the choice at \p index.
> -             */
> -            virtual KGuiItem guiItem( int index ) const;
> -
> -            /**
> -             * \return \p true if the choice at \p index is selected, \p false \
>                 otherwise.
> -             */
> -            virtual bool isSelected( int index ) const = 0;
> -
> -            /**
> -             * The client query set via setClientQuery(). See the documentation of \
>                 setClientQuery()
> -             * for details.
> -             */
> -            Query::Query clientQuery() const;
> -
> -            /**
> -             * Creates a new Facet that allows to filter on the file type. \
>                 Normally
> -             * this facet would be used in combination with a FileQuery.
> -             * \sa createTypeFacet()
> -             */
> -            static Facet* createFileTypeFacet( QObject* parent = 0 );
> -
> -            /**
> -             * Creates a new Facet that allows to filter on the resource type \
>                 without
> -             * a restriction to files.
> -             * \sa createFileTypeFacet()
> -             */
> -            static Facet* createTypeFacet( QObject* parent = 0 );
> -
> -            /**
> -             * Creates a new Facet that allows to filter on the date. This \
>                 includes
> -             * the modification, creation, and access dates.
> -             * \sa Query::dateRangeQuery()
> -             */
> -            static Facet* createDateFacet( QObject* parent = 0 );
> -
> -            /**
> -             * Creates a new Facet that allows to filter on tags, i.e. search for
> -             * resources that are tagged with the selected tags. The list of tags
> -             * is dynamic. This means it has a default selection of the most often
> -             * used ones and provides a means to access all tags through a dialog.
> -             */
> -            static Facet* createTagFacet( QObject* parent = 0 );
> -
> -            /**
> -             * Creates a new Facet that allows to sort the results by one of \
>                 several
> -             * criteria like last modification date or a score calculated by the
> -             * %Nepomuk system.
> -             * Using this facet does only make sense when displaying sorted \
>                 results
> -             * or when using a limit on the number of results.
> -             */
> -            static Facet* createPriorityFacet( QObject* parent = 0 );
> -
> -            /**
> -             * Creates a new Facet that allows to filter on the rating of \
>                 resources.
> -             */
> -            static Facet* createRatingFacet( QObject* parent = 0 );
> -
> -        public Q_SLOTS:
> -            /**
> -             * Clear the selection. If selectionMode() is MatchOne the first
> -             * choice should be selected.
> -             */
> -            virtual void clearSelection() = 0;
> -
> -            /**
> -             * Called by client code to change the selection.
> -             *
> -             * \param index The index of the choice for which the selection should
> -             * be changed.
> -             * \param selected If \p true the item should be selected, otherwise
> -             * it should be deselected.
> -             */
> -            virtual void setSelected( int index, bool selected = true ) = 0;
> -
> -            /**
> -             * If a client application provides several ways to construct a query
> -             * (one could think of a query editor which allows to insert certain
> -             * constraints or simply another application providing a base query)
> -             * the user expects to be able to modify that query using the \
>                 available
> -             * facets. Thus, a Facet should be able to extract parts from a query.
> -             *
> -             * Implement this method to create a selection based on the contents \
>                 of
> -             * \p term. The selection of the facet must only change if all of \p \
>                 term
> -             * can be used. This means that if \p term is for example an OrTerm \
>                 and
> -             * the Facet can only handle one of the sub terms it needs to ignore \
>                 the
> -             * whole term. FacetModel::setQuery() internally calls \
>                 selectFromTerm()
> -             * on all its facets.
> -             *
> -             * A simple example is SimpleFacet which compares all its terms which \
>                 have been
> -             * added via SimpleFacet::addTerm() to \p term. Depending on the \
>                 selectionMode()
> -             * it also checks for AndTerm or OrTerm.
> -             *
> -             * \warning Implementations of this method should \em never reset the \
>                 selection
> -             * before handling \p term. Instead the method should work similar to \
>                 setSelected(),
> -             * ie. in MatchAll or MatchAny facets calling it multiple times should \
>                 select
> -             * multiple choices.
> -             *
> -             * \return \p true if all of \p term could be used to select choices \
>                 in
> -             * this term, \p false otherwise.
> -             */
> -            virtual bool selectFromTerm( const Nepomuk2::Query::Term& queryTerm ) \
>                 = 0;
> -
> -            /**
> -             * The FacetModel will set this to the final query that has been \
>                 constructed
> -             * from the facets and any other query part set by the client via \
>                 FacetModel::setClientQuery().
> -             * The facet may use this information to filter the presented choices. \
>                 A typical example
> -             * is to only show terms that would actually change the result set. \
>                 The latter is what
> -             * DynamicResourceFacet does.
> -             */
> -            void setClientQuery( const Nepomuk2::Query::Query& query );
> -
> -        Q_SIGNALS:
> -            /**
> -             * Emitted when the term of the facet changed, ie. when the value \
>                 returned by term()
> -             * has changed.
> -             *
> -             * Subclasses should call setTermChanged() instead of emitting this \
>                 signal manually.
> -             *
> -             * Be aware that in most situations queryTermChanged() and \
>                 selectionChanged() will
> -             * have to be emitted at the same time.
> -             */
> -            void queryTermChanged( Nepomuk2::Utils::Facet* facet, const \
>                 Nepomuk2::Query::Term& queryTerm );
> -
> -            /**
> -             * Emitted when the layout of the facet changed, ie. one of count(), \
>                 guitItem(), or
> -             * text() return different values.
> -             *
> -             * Subclasses should call setLayoutChanged() instead of emitting this \
>                 signal manually.
> -             */
> -            void layoutChanged( Nepomuk2::Utils::Facet* facet );
> -
> -            /**
> -             * Emitted when the selection changed - normally triggered by a call \
>                 to setSelected().
> -             *
> -             * Subclasses should call setSelectionChanged() instead of emitting \
>                 this signal manually.
> -             *
> -             * Be aware that in most situations queryTermChanged() and \
>                 selectionChanged() will
> -             * have to be emitted at the same time.
> -             */
> -            void selectionChanged( Nepomuk2::Utils::Facet* facet );
> -
> -        protected Q_SLOTS:
> -            /**
> -             * Subclasses should call this method instead of emitting \
>                 termChanged() manually.
> -             */
> -            void setQueryTermChanged();
> -
> -            /**
> -             * Subclasses should call this method instead of emitting \
>                 layoutChanged() manually.
> -             */
> -            void setLayoutChanged();
> -
> -            /**
> -             * Subclasses should call this method instead of emitting \
>                 selectionChanged() manually.
> -             */
> -            void setSelectionChanged();
> -
> -        protected:
> -            /**
> -             * This method is called from setClientQuery() and can be \
>                 reimplemented by subclasses.
> -             *
> -             * The default implementation does nothing.
> -             */
> -            virtual void handleClientQueryChange();
> -
> -        private:
> -            class FacetPrivate;
> -            FacetPrivate* const d;
> -        };
> -    }
> -}
> -
> -#endif
> diff --git a/utils/facetdelegate.cpp b/utils/facetdelegate.cpp
> deleted file mode 100644
> index 01c1f45..0000000
> --- a/utils/facetdelegate.cpp
> +++ /dev/null
> @@ -1,85 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -
> -#include "facetdelegate.h"
> -#include "facet.h"
> -#include "facetmodel.h"
> -
> -#include <QtGui/QAbstractProxyModel>
> -#include <QtGui/QApplication>
> -#include <QtGui/QWidget>
> -
> -Nepomuk2::Utils::FacetDelegate::FacetDelegate( QObject* parent )
> -    : QItemDelegate( parent ),
> -      m_isExclusive( false )
> -{
> -}
> -
> -Nepomuk2::Utils::FacetDelegate::~FacetDelegate()
> -{
> -}
> -
> -void Nepomuk2::Utils::FacetDelegate::paint( QPainter* painter, const \
>                 QStyleOptionViewItem& option, const QModelIndex& index ) const
> -{
> -    // hacky way to not paint anything on title items which we use as spacers for \
>                 now
> -    if( index.data(Qt::DisplayRole).toString().isEmpty() ) {
> -        return;
> -    }
> -
> -    const QAbstractProxyModel* proxyModel = qobject_cast<const \
>                 QAbstractProxyModel*>(index.model());
> -    const Facet* facet = proxyModel->data( index, FacetModel::FacetRole \
>                 ).value<Facet*>();
> -    if( facet ) {
> -        m_isExclusive = ( facet->selectionMode() == Facet::MatchOne );
> -    }
> -
> -    QItemDelegate::paint( painter, option, index );
> -}
> -
> -void Nepomuk2::Utils::FacetDelegate::drawCheck( QPainter* painter, const \
>                 QStyleOptionViewItem& option, const QRect& rect, Qt::CheckState \
>                 state ) const
> -{
> -    if( m_isExclusive ) {
> -        const QStyleOptionViewItemV3 *v3 = qstyleoption_cast<const \
>                 QStyleOptionViewItemV3 *>( &option );
> -        const QWidget* widget = v3 ? v3->widget : 0;
> -
> -        QStyleOptionViewItem opt(option);
> -        opt.rect = rect;
> -        opt.state = opt.state & ~QStyle::State_HasFocus;
> -
> -        switch( state ) {
> -        case Qt::Unchecked:
> -            opt.state |= QStyle::State_Off;
> -            break;
> -        case Qt::PartiallyChecked:
> -            opt.state |= QStyle::State_NoChange;
> -            break;
> -        case Qt::Checked:
> -            opt.state |= QStyle::State_On;
> -            break;
> -        }
> -
> -        QStyle *style = widget ? widget->style() : QApplication::style();
> -        style->drawPrimitive( QStyle::PE_IndicatorRadioButton, &opt, painter, \
>                 widget );
> -    }
> -    else {
> -        QItemDelegate::drawCheck( painter, option, rect, state );
> -    }
> -}
> diff --git a/utils/facetdelegate.h b/utils/facetdelegate.h
> deleted file mode 100644
> index 5a7569c..0000000
> --- a/utils/facetdelegate.h
> +++ /dev/null
> @@ -1,47 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -
> -#ifndef NEPOMUK_QUERY_FACETDELEGATE_H
> -#define NEPOMUK_QUERY_FACETDELEGATE_H
> -
> -#include <qitemdelegate.h>
> -
> -
> -namespace Nepomuk2 {
> -    namespace Utils {
> -        class FacetDelegate : public QItemDelegate
> -        {
> -        public:
> -            explicit FacetDelegate( QObject* parent = 0 );
> -            virtual void paint( QPainter* painter, const QStyleOptionViewItem& \
>                 option, const QModelIndex& index ) const;
> -            virtual ~FacetDelegate();
> -
> -        protected:
> -            virtual void drawCheck( QPainter* painter, const QStyleOptionViewItem& \
>                 option, const QRect& rect, Qt::CheckState state ) const;
> -
> -        private:
> -            mutable bool m_isExclusive;
> -        };
> -    }
> -}
> -
> -#endif // NEPOMUK_QUERY_FACETDELEGATE_H
> diff --git a/utils/facetfiltermodel.cpp b/utils/facetfiltermodel.cpp
> deleted file mode 100644
> index 27e711f..0000000
> --- a/utils/facetfiltermodel.cpp
> +++ /dev/null
> @@ -1,45 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "facetfiltermodel.h"
> -#include "facet.h"
> -#include "facetmodel.h"
> -
> -Nepomuk2::Utils::FacetFilterModel::FacetFilterModel(QObject *parent)
> -    : QSortFilterProxyModel(parent),
> -      d(0)
> -{
> -}
> -
> -
> -Nepomuk2::Utils::FacetFilterModel::~FacetFilterModel()
> -{
> -    //delete d;
> -}
> -
> -
> -bool Nepomuk2::Utils::FacetFilterModel::filterAcceptsRow(int source_row, const \
>                 QModelIndex &source_parent) const
> -{
> -    QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
> -    return index.isValid() && \
>                 index.data(FacetModel::FacetRole).value<Facet*>()->count() > 0;
> -}
> -
> -#include "facetfiltermodel.moc"
> diff --git a/utils/facetfiltermodel.h b/utils/facetfiltermodel.h
> deleted file mode 100644
> index e6e1546..0000000
> --- a/utils/facetfiltermodel.h
> +++ /dev/null
> @@ -1,56 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef FACETFILTERMODEL_H
> -#define FACETFILTERMODEL_H
> -
> -#include <QtGui/QSortFilterProxyModel>
> -
> -namespace Nepomuk2 {
> -    namespace Utils {
> -        /**
> -         * \class FacetFilterModel facetfiltermodel.h \
>                 Nepomuk/Utils/FacetFilterModel
> -         *
> -         * \ingroup nepomuk_facets
> -         *
> -         * \brief Filter model that hides irrelevant Facets from a FacetModel.
> -         *
> -         * \author Sebastian Trueg <trueg@kde.org>
> -         */
> -        class FacetFilterModel : public QSortFilterProxyModel
> -        {
> -            Q_OBJECT
> -
> -        public:
> -            FacetFilterModel(QObject *parent = 0);
> -            ~FacetFilterModel();
> -
> -        protected:
> -            bool filterAcceptsRow( int source_row, const QModelIndex& \
>                 source_parent ) const;
> -
> -        private:
> -            class Private;
> -            Private* const d;
> -        };
> -    }
> -}
> -
> -#endif // FACETFILTERMODEL_H
> diff --git a/utils/facetmodel.cpp b/utils/facetmodel.cpp
> deleted file mode 100644
> index d9c669b..0000000
> --- a/utils/facetmodel.cpp
> +++ /dev/null
> @@ -1,413 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "facetmodel.h"
> -#include "simplefacet.h"
> -#include "dynamicresourcefacet.h"
> -#include "datefacet.h"
> -#include "facet.h"
> -
> -#include <QtCore/QDate>
> -
> -#include <Soprano/Vocabulary/NAO>
> -
> -#include <Nepomuk2/Query/StandardQuery>
> -#include <Nepomuk2/Query/AndTerm>
> -#include <Nepomuk2/Query/OrTerm>
> -#include <Nepomuk2/Query/ComparisonTerm>
> -#include <Nepomuk2/Query/LiteralTerm>
> -#include <Nepomuk2/Query/ResourceTerm>
> -#include <Nepomuk2/Query/ResourceTypeTerm>
> -#include <Nepomuk2/Query/Query>
> -
> -#include <Nepomuk2/Tag>
> -
> -#include <Nepomuk2/Vocabulary/TMO>
> -#include <Nepomuk2/Vocabulary/NMO>
> -#include <Nepomuk2/Vocabulary/NCO>
> -#include <Nepomuk2/Vocabulary/NFO>
> -#include <Nepomuk2/Vocabulary/NIE>
> -
> -#include <KGuiItem>
> -#include <KDebug>
> -
> -#include <KGlobal>
> -#include <KLocale>
> -#include <KCalendarSystem>
> -#include <KGuiItem>
> -#include <KDebug>
> -
> -using namespace Nepomuk2::Query;
> -
> -
> -class Nepomuk2::Utils::FacetModel::Private
> -{
> -public:
> -    QList<Facet*> m_facets;
> -
> -    bool m_blockQueryTermChangedSignal;
> -
> -    void addFacet( Facet* facet );
> -    QModelIndex parentIndexForFacet( Facet* facet ) const;
> -
> -    void handleFacetsChanged();
> -
> -    void _k_queryTermChanged();
> -    void _k_facetSelectionChanged( Nepomuk2::Utils::Facet* facet );
> -    void _k_facetLayoutChanged( Nepomuk2::Utils::Facet* );
> -
> -    FacetModel* q;
> -};
> -
> -
> -void Nepomuk2::Utils::FacetModel::Private::addFacet( Facet* facet )
> -{
> -    q->connect(facet, \
>                 SIGNAL(queryTermChanged(Nepomuk2::Utils::Facet*,Nepomuk2::Query::Term)),
>                 
> -               SLOT(_k_queryTermChanged()) );
> -    q->connect(facet, SIGNAL(selectionChanged(Nepomuk2::Utils::Facet*)),
> -               SLOT(_k_facetSelectionChanged(Nepomuk2::Utils::Facet*)) );
> -    q->connect(facet, SIGNAL(layoutChanged(Nepomuk2::Utils::Facet*)),
> -               SLOT(_k_facetLayoutChanged(Nepomuk2::Utils::Facet*)) );
> -    m_facets.append(facet);
> -}
> -
> -
> -QModelIndex Nepomuk2::Utils::FacetModel::Private::parentIndexForFacet( Facet* \
>                 facet ) const
> -{
> -    const int i = m_facets.indexOf( facet );
> -    return q->index( i, 0, QModelIndex() );
> -}
> -
> -
> -void Nepomuk2::Utils::FacetModel::Private::handleFacetsChanged()
> -{
> -    if( !m_blockQueryTermChangedSignal )
> -        emit q->queryTermChanged( q->queryTerm() );
> -}
> -
> -
> -void Nepomuk2::Utils::FacetModel::Private::_k_queryTermChanged()
> -{
> -    handleFacetsChanged();
> -}
> -
> -
> -void Nepomuk2::Utils::FacetModel::Private::_k_facetSelectionChanged( \
>                 Nepomuk2::Utils::Facet* facet )
> -{
> -    kDebug();
> -    QModelIndex parent = parentIndexForFacet( facet );
> -    if( facet->count() )
> -        emit q->dataChanged( q->index( 0, 0, parent ), q->index( \
>                 q->rowCount(parent)-1, 0, parent ) );
> -}
> -
> -
> -void Nepomuk2::Utils::FacetModel::Private::_k_facetLayoutChanged( \
>                 Nepomuk2::Utils::Facet* )
> -{
> -    // sadly we do not know the differences
> -    q->reset();
> -}
> -
> -
> -Nepomuk2::Utils::FacetModel::FacetModel( QObject* parent )
> -    : QAbstractItemModel( parent ),
> -      d(new Private() )
> -{
> -    d->q = this;
> -    d->m_blockQueryTermChangedSignal = false;
> -}
> -
> -
> -Nepomuk2::Utils::FacetModel::~FacetModel()
> -{
> -    qDeleteAll( d->m_facets );
> -    delete d;
> -}
> -
> -
> -int Nepomuk2::Utils::FacetModel::columnCount( const QModelIndex& ) const
> -{
> -    return 1;
> -}
> -
> -
> -QVariant Nepomuk2::Utils::FacetModel::data( const QModelIndex& index, int role ) \
>                 const
> -{
> -    if( index.isValid() ) {
> -        if( index.internalPointer() ) {
> -            Facet* facet = static_cast<Facet*>( index.internalPointer() );
> -
> -            if ( role == FacetRole )
> -                return QVariant::fromValue( facet );
> -
> -            switch( role ) {
> -            case Qt::DisplayRole: {
> -                QString title = facet->text(index.row());
> -                return title;
> -            }
> -            case Qt::CheckStateRole:
> -                return( facet->isSelected(index.row()) ? Qt::Checked : \
>                 Qt::Unchecked );
> -            }
> -        }
> -        else {
> -            switch( role ) {
> -            case FacetRole:
> -                return QVariant::fromValue( d->m_facets[index.row()] );
> -
> -//             case Qt::DisplayRole:
> -//                 return d->m_facets[index.row()]->facet().title();
> -            }
> -        }
> -    }
> -
> -    return QVariant();
> -}
> -
> -
> -bool Nepomuk2::Utils::FacetModel::setData( const QModelIndex& index, const \
>                 QVariant& value, int role )
> -{
> -    if( role == Qt::CheckStateRole && index.internalPointer() ) {
> -        Facet* facet = static_cast<Facet*>( index.internalPointer() );
> -        facet->setSelected( index.row(), value.toBool() );
> -        return true;
> -    }
> -    else {
> -        return false;
> -    }
> -}
> -
> -
> -bool Nepomuk2::Utils::FacetModel::hasChildren( const QModelIndex& parent ) const
> -{
> -    // facet terms don't have children
> -    if( parent.internalPointer() ) {
> -        return false;
> -    }
> -    else {
> -        return rowCount(parent) > 0;
> -    }
> -}
> -
> -
> -QModelIndex Nepomuk2::Utils::FacetModel::parent( const QModelIndex& index ) const
> -{
> -    if( index.internalPointer() ) {
> -        return d->parentIndexForFacet( static_cast<Facet*>( \
>                 index.internalPointer() ) );
> -    }
> -    else {
> -        return QModelIndex();
> -    }
> -}
> -
> -
> -int Nepomuk2::Utils::FacetModel::rowCount( const QModelIndex& parent ) const
> -{
> -    if( !parent.isValid() ) {
> -        return d->m_facets.count();
> -    }
> -    else if( parent.row() < d->m_facets.count() ) {
> -        return d->m_facets[parent.row()]->count();
> -    }
> -    else {
> -        return 0;
> -    }
> -}
> -
> -
> -QModelIndex Nepomuk2::Utils::FacetModel::index( int row, int column, const \
>                 QModelIndex& parent ) const
> -{
> -    if(row < 0 || row >= rowCount(parent) || column < 0 || column >= \
>                 columnCount(parent)) {
> -        return QModelIndex();
> -    }
> -    if( parent.isValid() ) {
> -        return createIndex( row, column, d->m_facets[parent.row()] );
> -    }
> -    else {
> -        return createIndex( row, column );
> -    }
> -}
> -
> -
> -Qt::ItemFlags Nepomuk2::Utils::FacetModel::flags( const QModelIndex& index ) const
> -{
> -    if(!index.isValid()) {
> -        return Qt::NoItemFlags;
> -    }
> -    // we do not even allow selection since that does not make much sense for our \
>                 use case
> -    Qt::ItemFlags flags = Qt::ItemIsEnabled;
> -    if( index.internalPointer() ) {
> -        flags |= Qt::ItemIsUserCheckable;
> -    }
> -    return flags;
> -}
> -
> -
> -void Nepomuk2::Utils::FacetModel::addFacet( Facet* facet )
> -{
> -    d->addFacet( facet );
> -    reset();
> -    d->handleFacetsChanged();
> -    // TODO: do not use reset but the fancy begin/end methods
> -}
> -
> -
> -void Nepomuk2::Utils::FacetModel::setFacets( const QList<Facet*>& facets )
> -{
> -    clear();
> -    Q_FOREACH( Facet* facet, facets ) {
> -        d->addFacet( facet );
> -    }
> -    reset();
> -    d->handleFacetsChanged();
> -}
> -
> -
> -void Nepomuk2::Utils::FacetModel::clearSelection()
> -{
> -    d->m_blockQueryTermChangedSignal = true;
> -    Q_FOREACH( Facet* facet, d->m_facets ) {
> -        facet->clearSelection();
> -    }
> -    d->m_blockQueryTermChangedSignal = false;
> -    d->handleFacetsChanged();
> -}
> -
> -
> -void Nepomuk2::Utils::FacetModel::clear()
> -{
> -    qDeleteAll(d->m_facets);
> -    d->m_facets.clear();
> -    reset();
> -}
> -
> -
> -QList<Nepomuk2::Utils::Facet*> Nepomuk2::Utils::FacetModel::facets() const
> -{
> -    return d->m_facets;
> -}
> -
> -
> -Nepomuk2::Query::Term Nepomuk2::Utils::FacetModel::queryTerm() const
> -{
> -    AndTerm term;
> -    Q_FOREACH( Facet* facet, d->m_facets ) {
> -        term.addSubTerm( facet->queryTerm() );
> -    }
> -    return term.optimized();
> -}
> -
> -
> -Nepomuk2::Query::Query Nepomuk2::Utils::FacetModel::extractFacetsFromQuery( const \
>                 Nepomuk2::Query::Query& query )
> -{
> -    // safety net to prevent endless loops
> -    // ===============================
> -    if ( query.term() == queryTerm() ) {
> -        Query::Query rest(query);
> -        rest.setTerm(Query::Term());
> -        return rest;
> -    }
> -
> -    // we do not want to emit any queryTermChanged() signal during this method
> -    // as it would confuse client code
> -    // ================================
> -    d->m_blockQueryTermChangedSignal = true;
> -
> -    // reset all facets in the model
> -    // ================================
> -    Q_FOREACH( Facet* f, d->m_facets ) {
> -        f->clearSelection();
> -    }
> -
> -    // we extract all facets we can find and leave the rest in the query
> -    // ================================
> -    Query::Query restQuery = query.optimized();
> -    Term restTerm = restQuery.term();
> -
> -    // Step one is to use the term in question as the client query for all facets
> -    // this is necessary since otherwise facets like ProxyFacet will ignore all
> -    // calls to selectFromTerm(). The client query can later be reset by the \
>                 client.
> -    // it is not wrong but may be only part of the actual client query.
> -    setClientQuery( restQuery );
> -
> -    // first we check if the main term is already a facet term
> -    // (this way we can also handle facets that use AndTerms)
> -    // ================================
> -
> -    // if any of the facets contains the term, set it to selected
> -    Q_FOREACH( Facet* f, d->m_facets ) {
> -        if( f->selectFromTerm( restTerm ) ) {
> -            restTerm = Term();
> -            break;
> -        }
> -    }
> -
> -    // now go into an AndTerm and check each sub term for facet
> -    // ================================
> -    if( restTerm.isAndTerm() ) {
> -        // we need to cache the facets since we cannot use MatchOne facets more \
>                 than once
> -        QList<Facet*> facets = d->m_facets;
> -
> -        AndTerm restAndTerm;
> -        foreach( const Term& term, restTerm.toAndTerm().subTerms() ) {
> -            bool termFound = false;
> -
> -            Q_FOREACH( Facet* f, facets ) {
> -                if( f->selectFromTerm( term ) ) {
> -                    termFound = true;
> -                    // we can only use MatchAll facets more than once
> -                    // Example: we have an exclusive facet that can handle both \
>                 term A and B
> -                    //          we now call selectFromTerm(A) and \
>                 selectFromTerm(B)
> -                    //          both return true but only the latter is the one \
>                 that sticks.
> -                    //          thus, we implicitely drop A from the query!
> -                    // None-exclusive facets are not a problem as they simply add \
>                 to their
> -                    // existing selection.
> -                    if( f->selectionMode() != Facet::MatchAll )
> -                        facets.removeAll(f);
> -                    break;
> -                }
> -            }
> -
> -            // we did not find a matching facet
> -            if( !termFound )
> -                restAndTerm.addSubTerm( term );
> -        }
> -
> -        restTerm = restAndTerm;
> -    }
> -
> -    // done with the facet selection
> -    // ================================
> -    d->m_blockQueryTermChangedSignal = false;
> -
> -    d->handleFacetsChanged();
> -
> -    restQuery.setTerm(restTerm);
> -    return restQuery.optimized();
> -}
> -
> -
> -void Nepomuk2::Utils::FacetModel::setClientQuery( const Nepomuk2::Query::Query& \
>                 query )
> -{
> -    Q_FOREACH( Facet* facet, d->m_facets ) {
> -        facet->setClientQuery( query );
> -    }
> -}
> -
> -#include "facetmodel.moc"
> diff --git a/utils/facetmodel.h b/utils/facetmodel.h
> deleted file mode 100644
> index 456da98..0000000
> --- a/utils/facetmodel.h
> +++ /dev/null
> @@ -1,232 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef _NEPOMUK_QUERY_FACET_MODEL_H_
> -#define _NEPOMUK_QUERY_FACET_MODEL_H_
> -
> -#include "nepomukwidgets_export.h"
> -
> -#include <Nepomuk2/Query/Term>
> -#include <Nepomuk2/Query/Query>
> -
> -#include <QtCore/QAbstractItemModel>
> -#include <QtCore/QList>
> -
> -namespace Nepomuk2 {
> -    namespace Utils {
> -        class Facet;
> -
> -        /**
> -         * \class FacetModel facetmodel.h Nepomuk/Utils/FacetModel
> -         *
> -         * \ingroup nepomuk_facets
> -         *
> -         * \brief A FacetModel contains a list of facets that are provided in a \
>                 tree structure.
> -         *
> -         * The FacetModel manages a list of Facet instances that are layed out
> -         * in a tree structure in which the leafs are checkable. This allows to
> -         * easily configure the facets by clicking the tree.
> -         *
> -         * Facets are added via setFacets() and addFacet().
> -         *
> -         * The FacetModel can be used to create and augment queries using the \
>                 queryTerm()
> -         * method and connecting to the queryTermChanged() signal. In addition \
>                 %FacetModel
> -         * provides the extractFacetsFromTerm() method which \em converts a query \
>                 into
> -         * facet selections. This is very convinient if the query comes from \
>                 another source
> -         * like a query bookmark or another application.
> -         *
> -         * An improved user experience can be created by setting the final query \
>                 used to
> -         * list the results via setClientQuery(). This allows the %FacetModel to \
>                 filter
> -         * the available choices, hiding those that do not make sense with the \
>                 current
> -         * result set or even showing facets that did not make sense before \
>                 (compare the
> -         * ProxyFacet example in \ref nepomuk_facet_examples).
> -         *
> -         * Typically one would use FacetWidget instead of creating ones own \
>                 FacetModel.
> -         *
> -         * \author Sebastian Trueg <trueg@kde.org>
> -         *
> -         * \since 4.6
> -         */
> -        class NEPOMUKWIDGETS_EXPORT FacetModel : public QAbstractItemModel
> -        {
> -            Q_OBJECT
> -
> -        public:
> -            /**
> -             * Creates an empty facet model
> -             */
> -            FacetModel( QObject* parent = 0 );
> -
> -            /**
> -             * Destructor
> -             */
> -            ~FacetModel();
> -
> -            /**
> -             * Special roles FacetModel provides through data() in
> -             * addition to the standard Qt roles.
> -             *
> -             * \sa Qt::ItemDataRole
> -             */
> -            enum CustomRoles {
> -                /**
> -                 * Provides a pointer to the Facet instance itself.
> -                 * Used internally.
> -                 */
> -                FacetRole = 235265643
> -            };
> -
> -            /**
> -             * Reimplemented to provide facet data to Qt's model/view framework.
> -             */
> -            int columnCount( const QModelIndex& parent = QModelIndex() ) const;
> -
> -            /**
> -             * Reimplemented to provide facet data to Qt's model/view framework.
> -             */
> -            QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) \
>                 const;
> -
> -            /**
> -             * Reimplemented to provide facet data to Qt's model/view framework.
> -             */
> -            bool setData( const QModelIndex& index, const QVariant& value, int \
>                 role );
> -
> -            /**
> -             * Reimplemented to provide facet data to Qt's model/view framework.
> -             */
> -            bool hasChildren(const QModelIndex &parent) const;
> -
> -            /**
> -             * Reimplemented to provide facet data to Qt's model/view framework.
> -             */
> -            QModelIndex parent( const QModelIndex& index ) const;
> -
> -            /**
> -             * Reimplemented to provide facet data to Qt's model/view framework.
> -             */
> -            int rowCount( const QModelIndex& parent = QModelIndex() ) const;
> -
> -            /**
> -             * Reimplemented to provide facet data to Qt's model/view framework.
> -             */
> -            QModelIndex index( int row, int column, const QModelIndex& parent = \
>                 QModelIndex() ) const;
> -
> -            /**
> -             * Reimplemented to provide facet data to Qt's model/view framework.
> -             */
> -            Qt::ItemFlags flags( const QModelIndex& index ) const;
> -
> -            /**
> -             * \return All Facet instances added via addFacet() and setFacets().
> -             */
> -            QList<Facet*> facets() const;
> -
> -            /**
> -             * Construct a query term from the selected facets in this model.
> -             *
> -             * \return A new query which combines the facets in this model.
> -             */
> -            Query::Term queryTerm() const;
> -
> -        public Q_SLOTS:
> -            /**
> -             * Extract as many facets from a query as possible. This method is not \
>                 able to handle all
> -             * kinds of queries but works well on queries created via queryTerm().
> -             *
> -             * Facets supported by this model will be extracted from \p query and \
>                 configured
> -             * accordingly in the model.
> -             *
> -             * Be aware that this method is not related to setClientQuery(). It is \
>                 intended to
> -             * split up a query in order to represent it graphically. It will, \
>                 however change the
> -             * client query in order to achieve the best possible term extraction. \
>                 Thus, one would typically
> -             * call setClientQuery after calling this method if \p query does not \
>                 already contain
> -             * the full client query.
> -             *
> -             * Typically a client would call this method and then try to handle \
>                 the returned
> -             * rest query in another way like converting it into a desktop user \
>                 query string
> -             * that can be shown in a search line edit. Another idea would be to \
>                 use custom
> -             * filters or a simple warning for the user that additional conditions \
>                 are in place
> -             * that could not be "translated" into facets.
> -             *
> -             * \return The rest query after facets have been extracted.
> -             */
> -            Nepomuk2::Query::Query extractFacetsFromQuery( const \
>                 Nepomuk2::Query::Query& query );
> -
> -            /**
> -             * Can be used to set the full query the client is using (this \
>                 includes facets
> -             * created through this model). It allows the facet system to disable \
>                 certain
> -             * choices that would not change the result set or do not make sense \
>                 otherwise.
> -             *
> -             * Be aware that this method is not related to \
>                 extractFacetsFromTerm(). It is merely
> -             * intended to improve the overall user experienceby filtering the \
>                 facet choices
> -             * depending on the current query.
> -             *
> -             * Typically a client would call both extractFacetsFromTerm() and \
>                 setClientQuery()
> -             * seperately. However, they will often be called with the same \
>                 query/term.
> -             *
> -             * \sa Facet::setClientQuery()
> -             */
> -            void setClientQuery( const Nepomuk2::Query::Query& query );
> -
> -            /**
> -             * Add \p facet to the model. Used to populate the model with facets.
> -             * Ownership of \p facet is transferred to the model.
> -             */
> -            void addFacet( Nepomuk2::Utils::Facet* facet );
> -
> -            /**
> -             * Set \p facets as the list of facets used in this model. Used to \
>                 populate the model with facets.
> -             * Ownership of the facets is transferred to the model.
> -             */
> -            void setFacets( const QList<Nepomuk2::Utils::Facet*>& facets );
> -
> -            /**
> -             * Convenience method that clears the selection on all facets.
> -             * \sa Facet::clearSelection()
> -             */
> -            void clearSelection();
> -
> -            /**
> -             * Remove all facets from the model.
> -             */
> -            void clear();
> -
> -        Q_SIGNALS:
> -            /**
> -             * Emitted whenever the facets change, i.e. when the user changes the \
>                 selection
> -             * or it is changed programmatically via extractFacetsFromQuery()
> -             */
> -            void queryTermChanged( const Nepomuk2::Query::Term& term );
> -
> -        private:
> -            class Private;
> -            Private* const d;
> -
> -            Q_PRIVATE_SLOT( d, void _k_queryTermChanged() )
> -            Q_PRIVATE_SLOT( d, void _k_facetSelectionChanged( \
>                 Nepomuk2::Utils::Facet* ) )
> -            Q_PRIVATE_SLOT( d, void _k_facetLayoutChanged( Nepomuk2::Utils::Facet* \
>                 ) )
> -        };
> -    }
> -}
> -
> -Q_DECLARE_METATYPE( Nepomuk2::Utils::Facet* )
> -
> -#endif
> diff --git a/utils/facetwidget.cpp b/utils/facetwidget.cpp
> deleted file mode 100644
> index bd79ebe..0000000
> --- a/utils/facetwidget.cpp
> +++ /dev/null
> @@ -1,131 +0,0 @@
> -/*
> -   Copyright (c) 2010 Oszkar Ambrus <aoszkar@gmail.com>
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "facetwidget.h"
> -#include "facetmodel.h"
> -#include "facet.h"
> -#include "facetdelegate.h"
> -#include "facetfiltermodel.h"
> -
> -#include <QVBoxLayout>
> -#include <QHBoxLayout>
> -#include <QLabel>
> -#include <QTreeView>
> -#include <QUrl>
> -#include <QtGui/QListView>
> -
> -#include <Nepomuk2/Query/Result>
> -#include <Nepomuk2/Query/Query>
> -#include <Nepomuk2/Query/QueryParser>
> -#include <Nepomuk2/Query/ComparisonTerm>
> -#include <Nepomuk2/Query/ResourceTerm>
> -#include <Nepomuk2/Query/ResourceTypeTerm>
> -#include <Nepomuk2/Resource>
> -
> -#include <Soprano/Vocabulary/NAO>
> -
> -#include <KDebug>
> -#include <kdescendantsproxymodel.h>
> -
> -
> -class Nepomuk2::Utils::FacetWidget::Private
> -{
> -public:
> -    Nepomuk2::Utils::FacetModel *m_facetModel;
> -    QListView *m_facetView;
> -};
> -
> -
> -Nepomuk2::Utils::FacetWidget::FacetWidget( QWidget *parent )
> -    : QWidget( parent ),
> -      d( new Private() )
> -{
> -    d->m_facetModel = new Nepomuk2::Utils::FacetModel( this );
> -    connect( d->m_facetModel, SIGNAL(queryTermChanged(Nepomuk2::Query::Term)),
> -             this, SIGNAL(queryTermChanged(Nepomuk2::Query::Term)) );
> -
> -    d->m_facetView = new QListView( this );
> -    d->m_facetView->setItemDelegate( new FacetDelegate( d->m_facetView ) );
> -    d->m_facetView->setBackgroundRole(QPalette::NoRole);
> -    d->m_facetView->viewport()->setBackgroundRole(QPalette::NoRole);
> -    d->m_facetView->setFrameStyle(QFrame::NoFrame);
> -
> -    FacetFilterModel* facetFilterModel = new FacetFilterModel( this );
> -    facetFilterModel->setSourceModel( d->m_facetModel );
> -    connect( d->m_facetModel, SIGNAL(queryTermChanged(Nepomuk2::Query::Term)), \
>                 facetFilterModel, SLOT(invalidate()));
> -    connect( d->m_facetModel, SIGNAL(modelReset()), facetFilterModel, \
>                 SLOT(invalidate()));
> -
> -    KDescendantsProxyModel* proxy = new KDescendantsProxyModel( this );
> -    proxy->setSourceModel( facetFilterModel );
> -    d->m_facetView->setModel( proxy );
> -
> -    new QVBoxLayout( this );
> -    layout()->addWidget( d->m_facetView );
> -}
> -
> -Nepomuk2::Utils::FacetWidget::~FacetWidget()
> -{
> -    delete d;
> -}
> -
> -
> -QList<Nepomuk2::Utils::Facet*> Nepomuk2::Utils::FacetWidget::facets() const
> -{
> -    return d->m_facetModel->facets();
> -}
> -
> -
> -Nepomuk2::Query::Query Nepomuk2::Utils::FacetWidget::extractFacetsFromQuery( const \
>                 Nepomuk2::Query::Query& query )
> -{
> -    return d->m_facetModel->extractFacetsFromQuery( query );
> -}
> -
> -
> -Nepomuk2::Query::Term Nepomuk2::Utils::FacetWidget::queryTerm() const
> -{
> -    return d->m_facetModel->queryTerm();
> -}
> -
> -
> -void Nepomuk2::Utils::FacetWidget::setClientQuery(const Nepomuk2::Query::Query& \
>                 query)
> -{
> -    d->m_facetModel->setClientQuery(query);
> -}
> -
> -
> -void Nepomuk2::Utils::FacetWidget::addFacet( Nepomuk2::Utils::Facet* facet )
> -{
> -    d->m_facetModel->addFacet(facet);
> -}
> -
> -
> -void Nepomuk2::Utils::FacetWidget::setFacets( const \
>                 QList<Nepomuk2::Utils::Facet*>& facets )
> -{
> -    d->m_facetModel->setFacets(facets);
> -}
> -
> -
> -void Nepomuk2::Utils::FacetWidget::clear()
> -{
> -    d->m_facetModel->clear();
> -}
> -
> -#include "facetwidget.moc"
> diff --git a/utils/facetwidget.h b/utils/facetwidget.h
> deleted file mode 100644
> index c021cca..0000000
> --- a/utils/facetwidget.h
> +++ /dev/null
> @@ -1,136 +0,0 @@
> -/*
> -   Copyright (c) 2010 Oszkar Ambrus <aoszkar@gmail.com>
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef FACETSWIDGET_H
> -#define FACETSWIDGET_H
> -
> -#include <QtGui/QWidget>
> -#include <QtCore/QList>
> -
> -#include "facet.h"
> -#include "nepomukwidgets_export.h"
> -
> -namespace Nepomuk2 {
> -    namespace Query {
> -        class Query;
> -        class Term;
> -    }
> -
> -    namespace Utils {
> -        /**
> -         * \class FacetWidget facetwidget.h Nepomuk/Utils/FacetWidget
> -         *
> -         * \ingroup nepomuk_facets
> -         *
> -         * \brief A widget providing a list of facets to add filters to a query.
> -         *
> -         * The basic usage of FacetWidget is rather simple: create a new instance,
> -         * add facets to it through the addFacet() method, connect to the \
>                 queryTermChanged()
> -         * signal, and wait for the user to change the filters.
> -         *
> -         * More sophisticated usage involves extractFacetsFromTerm() or \
>                 setClientQuery().
> -         * For more details see the documentation of FacetModel which provides a \
>                 similar
> -         * API since FacetWidget is using it internally.
> -         *
> -         * \author Oszkar Ambrus <aoszkar@gmail.com>, Sebastian Trueg \
>                 <trueg@kde.org>
> -         *
> -         * \since 4.6
> -         */
> -        class NEPOMUKWIDGETS_EXPORT FacetWidget : public QWidget
> -        {
> -            Q_OBJECT
> -
> -        public:
> -            /**
> -             * Create a new empty FacetWidget.
> -             */
> -            FacetWidget( QWidget *parent = 0 );
> -
> -            /**
> -             * Destructor
> -             */
> -            ~FacetWidget();
> -
> -            /**
> -             * \return All Facet instances added via addFacet() and setFacets().
> -             */
> -            QList<Facet*> facets() const;
> -
> -            /**
> -             * Extract as many facets from a query as possible. This method is not \
>                 able to handle all
> -             * kinds of queries but works well on queries created via queryTerm().
> -             *
> -             * Facets supported by this widget will be extracted from \p term and \
>                 configured
> -             * accordingly.
> -             *
> -             * \sa FacetModel::extractFacetsFromTerm()
> -             *
> -             * \return The rest term after facets have been extracted.
> -             */
> -            Nepomuk2::Query::Query extractFacetsFromQuery( const \
>                 Nepomuk2::Query::Query& query );
> -
> -            /**
> -             * @returns the query term composed by the facets
> -             */
> -            Nepomuk2::Query::Term queryTerm() const;
> -
> -            /**
> -             * Can be used to set the full query the client is using (this \
>                 includes facets
> -             * created through this widget). It allows the facet system to disable \
>                 certain
> -             * choices that would not change the result set or do not make sense \
>                 otherwise.
> -             *
> -             * \sa FacetModel::setClientQuery()
> -             */
> -            void setClientQuery( const Nepomuk2::Query::Query& query );
> -
> -        public Q_SLOTS:
> -            /**
> -             * Add \p facet to the widget. Used to populate the widget with \
>                 facets.
> -             * Ownership of \p facet is transferred to the widget.
> -             */
> -            void addFacet( Nepomuk2::Utils::Facet* facet );
> -
> -            /**
> -             * Set \p facets as the list of facets used in this widget. Used to \
>                 populate the widget with facets.
> -             * Ownership of the facets is transferred to the widget.
> -             */
> -            void setFacets( const QList<Nepomuk2::Utils::Facet*>& facets );
> -
> -            /**
> -             * Remove all facets from the widget.
> -             */
> -            void clear();
> -
> -        Q_SIGNALS:
> -            /**
> -             * Emitted whenever the facets change, i.e. when the user changes the \
>                 selection
> -             * or it is changed programmatically via extractFacetsFromQuery()
> -             */
> -            void queryTermChanged( const Nepomuk2::Query::Term& term );
> -
> -        private:
> -            class Private;
> -            Private * const d;
> -        };
> -    }
> -}
> -
> -#endif // FACETSWIDGET_H
> diff --git a/utils/proxyfacet.cpp b/utils/proxyfacet.cpp
> deleted file mode 100644
> index 63c7abd..0000000
> --- a/utils/proxyfacet.cpp
> +++ /dev/null
> @@ -1,214 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "proxyfacet.h"
> -
> -#include <Nepomuk2/Query/AndTerm>
> -#include <Nepomuk2/Query/Query>
> -
> -#include <KGuiItem>
> -#include <KDebug>
> -
> -class Nepomuk2::Utils::ProxyFacet::Private
> -{
> -public:
> -    Private()
> -        : m_sourceFacet(0),
> -          m_facetConditionMet(true) {
> -    }
> -
> -    void updateConditionStatus();
> -
> -    Facet* m_sourceFacet;
> -
> -    Query::Term m_facetCondition;
> -    bool m_facetConditionMet;
> -
> -    ProxyFacet* q;
> -};
> -
> -
> -namespace {
> -    /**
> -     * Checks if a query contains a certain term in a non-optional manner. \
>                 Basically this means
> -     * that either the query's term is the term in question or the query term is \
>                 an AndTerm which
> -     * contains the requested term. All other situations result in an optional \
>                 usage of \p term
> -     * or are too complex to handle here.
> -     */
> -    bool containsTerm( const Nepomuk2::Query::Query& query, const \
>                 Nepomuk2::Query::Term& term ) {
> -        Nepomuk2::Query::Term queryTerm = query.term().optimized();
> -        if( queryTerm == term ) {
> -            return true;
> -        }
> -        else if( queryTerm.isAndTerm() ) {
> -            Q_FOREACH( const Nepomuk2::Query::Term& subTerm, \
>                 queryTerm.toAndTerm().subTerms() ) {
> -                if( subTerm == term ) {
> -                    return true;
> -                }
> -            }
> -        }
> -
> -        // fallback
> -        return false;
> -    }
> -}
> -
> -void Nepomuk2::Utils::ProxyFacet::Private::updateConditionStatus()
> -{
> -    bool newFacetConditionMet = true;
> -    if( m_facetCondition.isValid() ) {
> -        newFacetConditionMet = containsTerm( q->clientQuery(), m_facetCondition );
> -        kDebug() << m_facetConditionMet << newFacetConditionMet;
> -    }
> -
> -    if( newFacetConditionMet != m_facetConditionMet ) {
> -        m_facetConditionMet = newFacetConditionMet;
> -        q->setLayoutChanged();
> -        q->setQueryTermChanged();
> -    }
> -
> -    if( !m_facetConditionMet ) {
> -        q->clearSelection();
> -    }
> -}
> -
> -
> -Nepomuk2::Utils::ProxyFacet::ProxyFacet( QObject* parent )
> -    : Facet(parent),
> -      d(new Private())
> -{
> -    d->q = this;
> -}
> -
> -
> -Nepomuk2::Utils::ProxyFacet::~ProxyFacet()
> -{
> -    delete d;
> -}
> -
> -
> -void Nepomuk2::Utils::ProxyFacet::setSourceFacet( Facet* source )
> -{
> -    if( d->m_sourceFacet ) {
> -        d->m_sourceFacet->disconnect(this);
> -    }
> -
> -    d->m_sourceFacet = source;
> -    if( d->m_sourceFacet ) {
> -        connect(d->m_sourceFacet, \
>                 SIGNAL(queryTermChanged(Nepomuk2::Utils::Facet*,Nepomuk2::Query::Term)),
>                 
> -                this, \
>                 SIGNAL(queryTermChanged(Nepomuk2::Utils::Facet*,Nepomuk2::Query::Term)));
>                 
> -        connect(d->m_sourceFacet, \
>                 SIGNAL(selectionChanged(Nepomuk2::Utils::Facet*)),
> -                this, SIGNAL(selectionChanged(Nepomuk2::Utils::Facet*)));
> -        connect(d->m_sourceFacet, SIGNAL(layoutChanged(Nepomuk2::Utils::Facet*)),
> -                this, SIGNAL(layoutChanged(Nepomuk2::Utils::Facet*)));
> -    }
> -
> -    setLayoutChanged();
> -    setQueryTermChanged();
> -    setSelectionChanged();
> -}
> -
> -
> -Nepomuk2::Utils::Facet* Nepomuk2::Utils::ProxyFacet::sourceFacet() const
> -{
> -    return d->m_sourceFacet;
> -}
> -
> -
> -Nepomuk2::Utils::Facet::SelectionMode Nepomuk2::Utils::ProxyFacet::selectionMode() \
>                 const
> -{
> -    return d->m_sourceFacet ? d->m_sourceFacet->selectionMode() : MatchOne;
> -}
> -
> -
> -Nepomuk2::Query::Term Nepomuk2::Utils::ProxyFacet::queryTerm() const
> -{
> -    return facetConditionMet() && d->m_sourceFacet ? d->m_sourceFacet->queryTerm() \
>                 : Query::Term();
> -}
> -
> -
> -int Nepomuk2::Utils::ProxyFacet::count() const
> -{
> -    return d->m_sourceFacet && facetConditionMet() ? d->m_sourceFacet->count() : \
>                 0;
> -}
> -
> -
> -bool Nepomuk2::Utils::ProxyFacet::isSelected( int index ) const
> -{
> -    return d->m_sourceFacet ? d->m_sourceFacet->isSelected(index) : false;
> -}
> -
> -
> -KGuiItem Nepomuk2::Utils::ProxyFacet::guiItem( int index ) const
> -{
> -    return d->m_sourceFacet ? d->m_sourceFacet->guiItem(index) : KGuiItem();
> -}
> -
> -
> -void Nepomuk2::Utils::ProxyFacet::setSelected( int index, bool selected )
> -{
> -    if( d->m_sourceFacet && facetConditionMet() ) {
> -        d->m_sourceFacet->setSelected( index, selected );
> -    }
> -}
> -
> -
> -void Nepomuk2::Utils::ProxyFacet::clearSelection()
> -{
> -    if( d->m_sourceFacet ) {
> -        d->m_sourceFacet->clearSelection();
> -    }
> -}
> -
> -
> -bool Nepomuk2::Utils::ProxyFacet::selectFromTerm( const Nepomuk2::Query::Term& \
>                 term )
> -{
> -    if( d->m_sourceFacet && facetConditionMet() ) {
> -        return d->m_sourceFacet->selectFromTerm( term );
> -    }
> -    else {
> -        return false;
> -    }
> -}
> -
> -
> -void Nepomuk2::Utils::ProxyFacet::handleClientQueryChange()
> -{
> -    d->updateConditionStatus();
> -    if( d->m_sourceFacet ) {
> -        d->m_sourceFacet->setClientQuery( clientQuery() );
> -    }
> -}
> -
> -
> -void Nepomuk2::Utils::ProxyFacet::setFacetCondition( const Nepomuk2::Query::Term& \
>                 term )
> -{
> -    d->m_facetCondition = term;
> -    d->updateConditionStatus();
> -}
> -
> -
> -bool Nepomuk2::Utils::ProxyFacet::facetConditionMet() const
> -{
> -    return d->m_facetConditionMet;
> -}
> -
> -#include "proxyfacet.moc"
> diff --git a/utils/proxyfacet.h b/utils/proxyfacet.h
> deleted file mode 100644
> index 61c3a2d..0000000
> --- a/utils/proxyfacet.h
> +++ /dev/null
> @@ -1,160 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef _NEPOMUK_QUERY_PROXY_FACET_H_
> -#define _NEPOMUK_QUERY_PROXY_FACET_H_
> -
> -#include "facet.h"
> -#include "nepomukwidgets_export.h"
> -
> -namespace Nepomuk2 {
> -    namespace Utils {
> -        /**
> -         * \class ProxyFacet proxyfacet.h Nepomuk/Utils/ProxyFacet
> -         *
> -         * \ingroup nepomuk_facets
> -         *
> -         * \brief A facet forwarding the filtered choices from another facet.
> -         *
> -         * The ProxyFacet allows to perform filter operations on another facet.
> -         * Most noticable one can set a general condition which needs to be \
>                 fulfilled
> -         * in the client query in order for the facet to show any choices.
> -         *
> -         * \sa \ref nepomuk_facet_examples
> -         *
> -         * \author Sebastian Trueg <trueg@kde.org>
> -         *
> -         * \since 4.6
> -         */
> -        class NEPOMUKWIDGETS_EXPORT ProxyFacet : public Facet
> -        {
> -            Q_OBJECT
> -
> -        public:
> -            /**
> -             * Create a new proxy facet without a source.
> -             */
> -            ProxyFacet( QObject* parent = 0 );
> -
> -            /**
> -             * Destructor.
> -             */
> -            virtual ~ProxyFacet();
> -
> -            /**
> -             * Set the source facet. The proxy will forward all calls to
> -             * \p source.
> -             */
> -            void setSourceFacet( Facet* source );
> -
> -            /**
> -             * The source facet which this proxy facet is forwarding.
> -             * \sa setSourceFacet()
> -             */
> -            Facet* sourceFacet() const;
> -
> -            /**
> -             * The selection mode forwarded from the sourceFacet().
> -             */
> -            SelectionMode selectionMode() const;
> -
> -            /**
> -             * The query term forwarded and optionally filtered from the \
>                 sourceModel().
> -             */
> -            virtual Nepomuk2::Query::Term queryTerm() const;
> -
> -            /**
> -             * \return The number of terms forwarded from the sourceFacet().
> -             */
> -            int count() const;
> -
> -            /**
> -             * The gui item forwarded from the sourceFacet().
> -             */
> -            KGuiItem guiItem( int index ) const;
> -
> -            /**
> -             * \return \p true if the term at \p index has been selected via
> -             * setSelected().
> -             */
> -            bool isSelected( int index ) const;
> -
> -            /**
> -             * The facet condition set via setFacetCondition()
> -             */
> -            Nepomuk2::Query::Term facetCondition() const;
> -
> -        public Q_SLOTS:
> -            /**
> -             * Allows to set a condition for the entire facet. Unless it is not \
>                 met in the
> -             * client query set via setClientQuery() the facet does not provide \
>                 any choices.
> -             *
> -             * \param term The condition term. If valid this facet will only show \
>                 any choices
> -             * if the client query contains \p term in a non-optional way.
> -             *
> -             * A typical example is a facet which filters images by size. In that \
>                 case the
> -             * condition would be
> -             * \code
> -             * Query::ResourceTypeTerm( Vocabulary::NFO::RasterImage() );
> -             * \endcode
> -             * since filtering by image size does only make sense if only images \
>                 are selected.
> -             */
> -            void setFacetCondition( const Nepomuk2::Query::Term& queryTerm );
> -
> -            /**
> -             * Clear the selection. If selectionMode() is MatchOne the first
> -             * choice should be selected.
> -             */
> -            void clearSelection();
> -
> -            /**
> -             * Selects or deselects the term at \p index. Depending on the \
>                 selectionMode()
> -             * this will also affect the selection of other terms.
> -             */
> -            void setSelected( int index, bool selected = true );
> -
> -            /**
> -             * The \p term is analyzed depending on the selectionMode().
> -             *
> -             * \sa Facet::selectFromTerm()
> -             */
> -            bool selectFromTerm( const Nepomuk2::Query::Term& queryTerm );
> -
> -        protected:
> -            /**
> -             * Used internally to determine if the facet condition is met. Can be
> -             * reimplemented for customized filtering.
> -             *
> -             * \return \p true if the facet condition is met and all choices from \
>                 the
> -             * source facet should be forwarded.
> -             */
> -            virtual bool facetConditionMet() const;
> -
> -            void handleClientQueryChange();
> -
> -        private:
> -            class Private;
> -            Private* const d;
> -        };
> -    }
> -}
> -
> -#endif
> diff --git a/utils/searchlineedit.cpp b/utils/searchlineedit.cpp
> deleted file mode 100644
> index c0847dd..0000000
> --- a/utils/searchlineedit.cpp
> +++ /dev/null
> @@ -1,156 +0,0 @@
> -/*
> -  Copyright (c) 2010 Oszkar Ambrus <aoszkar@gmail.com>
> -  Copyright (c) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -  This library is free software; you can redistribute it and/or
> -  modify it under the terms of the GNU Lesser General Public
> -  License as published by the Free Software Foundation; either
> -  version 2.1 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 6 of version 3 of the license.
> -
> -  This library 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
> -  Lesser General Public License for more details.
> -
> -  You should have received a copy of the GNU Lesser General Public
> -  License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "searchlineedit.h"
> -
> -#include <KLineEdit>
> -#include <QtGui/QHBoxLayout>
> -
> -#include <Nepomuk2/Query/QueryParser>
> -#include <Nepomuk2/Query/AndTerm>
> -#include <Nepomuk2/Query/OrTerm>
> -#include <Nepomuk2/Query/LiteralTerm>
> -
> -using namespace Nepomuk2::Query;
> -
> -
> -class Nepomuk2::Utils::SearchLineEdit::Private {
> -public:
> -    KLineEdit* m_lineEdit;
> -    bool searchWhileTyping;
> -
> -    QString m_currentQueryString;
> -    Query::Query m_currentQuery;
> -
> -    void updateCurrentQuery();
> -    void _k_queryStringChanged(const QString&);
> -
> -    SearchLineEdit* q;
> -};
> -
> -void Nepomuk2::Utils::SearchLineEdit::Private::updateCurrentQuery()
> -{
> -    // cache the current query for performance reasons
> -    if( m_currentQueryString != m_lineEdit->text() ) {
> -        m_currentQueryString = m_lineEdit->text();
> -        m_currentQuery = Nepomuk2::Query::QueryParser::parseQuery( \
>                 m_currentQueryString );
> -    }
> -}
> -
> -
> -void Nepomuk2::Utils::SearchLineEdit::Private::_k_queryStringChanged( const \
>                 QString& /*queryString*/ )
> -{
> -    emit q->queryChanged( q->query() );
> -}
> -
> -
> -Nepomuk2::Utils::SearchLineEdit::SearchLineEdit(QWidget *parent)
> -    : QWidget(parent),
> -      d(new Private)
> -{
> -    d->q = this;
> -
> -    d->m_lineEdit = new KLineEdit( this );
> -    d->m_lineEdit->setClearButtonShown(true);
> -    d->m_lineEdit->setClickMessage(i18n("Enter Search Terms..."));
> -    QHBoxLayout* lay = new QHBoxLayout( this );
> -    lay->setMargin(0);
> -    lay->addWidget( d->m_lineEdit );
> -
> -    setFocusProxy( d->m_lineEdit );
> -
> -    setSearchWhileTypingEnabled(false);
> -}
> -
> -Nepomuk2::Utils::SearchLineEdit::~SearchLineEdit()
> -{
> -    delete d;
> -}
> -
> -void Nepomuk2::Utils::SearchLineEdit::setSearchWhileTypingEnabled(bool enable)
> -{
> -    d->searchWhileTyping = enable;
> -    disconnect( d->m_lineEdit, 0, this, SLOT(_k_queryStringChanged(QString)) );
> -
> -    if(d->searchWhileTyping == true) {
> -        connect( d->m_lineEdit, SIGNAL(textChanged(QString)), this, \
>                 SLOT(_k_queryStringChanged(QString)) );
> -    }
> -    else {
> -        connect( d->m_lineEdit, SIGNAL(returnPressed(QString)), this, \
>                 SLOT(_k_queryStringChanged(QString)) );
> -    }
> -}
> -
> -Nepomuk2::Query::Term Nepomuk2::Utils::SearchLineEdit::extractUsableTerms( const \
>                 Nepomuk2::Query::Term& term )
> -{
> -    Term restTerm( term );
> -    QString queryString;
> -
> -    // now extract as much as possible to put in the literal search line
> -    if(restTerm.isLiteralTerm()) {
> -        queryString = restTerm.toLiteralTerm().value().toString();
> -        restTerm = Term();
> -    }
> -
> -    // from an AndTerm we can extract as many literal values as we like
> -    else if ( restTerm.isAndTerm() ) {
> -        QStringList searchTerms;
> -        foreach( const Nepomuk2::Query::Term& subTerm, \
>                 restTerm.toAndTerm().subTerms() ) {
> -            if(subTerm.isLiteralTerm()) {
> -                searchTerms << subTerm.toLiteralTerm().value().toString();
> -            }
> -            else {
> -                restTerm = restTerm && subTerm;
> -            }
> -        }
> -        queryString =  searchTerms.join( QLatin1String( " " ) );
> -    }
> -
> -    // from an OrTerm we can only extract if all the sub terms are literals since
> -    // otherwise the final query would be different as all the parts are combined
> -    // via an AndTerm.
> -    else if ( restTerm.isOrTerm() ) {
> -        QStringList searchTerms;
> -        OrTerm restOrTerm;
> -        foreach( const Nepomuk2::Query::Term& subTerm, \
>                 restTerm.toAndTerm().subTerms() ) {
> -            if(subTerm.isLiteralTerm()) {
> -                searchTerms << subTerm.toLiteralTerm().value().toString();
> -            }
> -            else {
> -                restOrTerm.addSubTerm(subTerm);
> -            }
> -        }
> -        if ( restOrTerm.subTerms().isEmpty() ) {
> -            restTerm = restOrTerm.optimized();
> -            queryString = searchTerms.join( QLatin1String( " OR " ) );
> -        }
> -    }
> -
> -    d->m_lineEdit->setText(queryString);
> -    return restTerm;
> -}
> -
> -Nepomuk2::Query::Query Nepomuk2::Utils::SearchLineEdit::query() const
> -{
> -    d->updateCurrentQuery();
> -    return d->m_currentQuery;
> -}
> -
> -#include "searchlineedit.moc"
> diff --git a/utils/searchlineedit.h b/utils/searchlineedit.h
> deleted file mode 100644
> index 6d797bf..0000000
> --- a/utils/searchlineedit.h
> +++ /dev/null
> @@ -1,97 +0,0 @@
> -/*
> -  Copyright (c) 2010 Oszkar Ambrus <aoszkar@gmail.com>
> -  Copyright (c) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -  This library is free software; you can redistribute it and/or
> -  modify it under the terms of the GNU Lesser General Public
> -  License as published by the Free Software Foundation; either
> -  version 2.1 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 6 of version 3 of the license.
> -
> -  This library 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
> -  Lesser General Public License for more details.
> -
> -  You should have received a copy of the GNU Lesser General Public
> -  License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef SEARCHLINEEDIT_H
> -#define SEARCHLINEEDIT_H
> -
> -#include <QtGui/QWidget>
> -
> -#include <Nepomuk2/Query/Query>
> -
> -namespace Nepomuk2 {
> -    namespace Utils {
> -        /**
> -         * \class SearchLineEdit searchlineedit.h Nepomuk/Utils/SearchLineEdit
> -         *
> -         * \brief A line edit which allows to enter user queries.
> -         *
> -         * In the future this class will provide some fancy autocompletion.
> -         *
> -         * \author Oszkar Ambrus <aoszkar@gmail.com>, Sebastian Trueg \
>                 <trueg@kde.org>
> -         */
> -        class SearchLineEdit : public QWidget
> -        {
> -            Q_OBJECT
> -
> -        public:
> -            /**
> -             * Creates a new query edit line with an empty query.
> -             */
> -            SearchLineEdit(QWidget *parent = 0);
> -
> -            /**
> -             * Destructor
> -             */
> -            ~SearchLineEdit();
> -
> -            /**
> -             * Sets search while typing option to @p enable.
> -             * If search while typing is enabled, the queryChanged signal will be \
>                 emitted when the text is changed,
> -             * if it is disabled, the signal will be emitted when the user \
>                 activates it (e.g. presses Enter)
> -             */
> -            void setSearchWhileTypingEnabled(bool enable);
> -
> -            /**
> -             * @returns true if search while typing is enabled, false otherwise
> -             */
> -            bool searchWhileTypingEnabled();
> -
> -            /**
> -             * @returns the current query
> -             */
> -            Nepomuk2::Query::Query query() const;
> -
> -        public Q_SLOTS:
> -            /**
> -             * Extracts parts from \p term which can be converted into a query \
>                 using the
> -             * simple desktop query language that is supported by this widget \
>                 through
> -             * Nepomuk2::Query::QueryParser.
> -             *
> -             * \return The rest term that could not be converted into a query \
>                 string.
> -             */
> -            Nepomuk2::Query::Term extractUsableTerms( const Nepomuk2::Query::Term& \
>                 term );
> -
> -        Q_SIGNALS:
> -            /**
> -             * Acivated when the query is changed (while typing or when finished)
> -             */
> -            void queryChanged( const Nepomuk2::Query::Query& query );
> -
> -        private:
> -            class Private;
> -            Private * const d;
> -
> -            Q_PRIVATE_SLOT( d, void _k_queryStringChanged(const QString&) )
> -        };
> -    }
> -}
> -
> -#endif // SEARCHLINEEDIT_H
> diff --git a/utils/searchwidget.cpp b/utils/searchwidget.cpp
> deleted file mode 100644
> index dec54f3..0000000
> --- a/utils/searchwidget.cpp
> +++ /dev/null
> @@ -1,317 +0,0 @@
> -/*
> -   Copyright (c) 2010 Oszkar Ambrus <aoszkar@gmail.com>
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "searchwidget.h"
> -#include "searchwidget_p.h"
> -
> -#include "searchlineedit.h"
> -#include "facetwidget.h"
> -#include "resourcemodel.h"
> -#include "proxyfacet.h"
> -#include "simplefacet.h"
> -
> -#include <QtGui/QVBoxLayout>
> -#include <QtGui/QHBoxLayout>
> -#include <QtGui/QListView>
> -#include <QtGui/QSplitter>
> -#include <QtCore/QList>
> -
> -#include <KDebug>
> -#include <KPushButton>
> -#include <KDialog>
> -
> -#include <Nepomuk2/Query/Query>
> -#include <Nepomuk2/Query/QueryParser>
> -#include <Nepomuk2/Query/Result>
> -#include <Nepomuk2/Query/AndTerm>
> -#include <Nepomuk2/Query/OrTerm>
> -#include <Nepomuk2/Query/LiteralTerm>
> -#include <Nepomuk2/Query/ComparisonTerm>
> -#include <Nepomuk2/Query/ResourceTerm>
> -#include <Nepomuk2/Query/ResourceTypeTerm>
> -#include <Nepomuk2/Query/QueryServiceClient>
> -#include <Nepomuk2/Query/FileQuery>
> -#include <Nepomuk2/Query/NegationTerm>
> -
> -#include <Nepomuk2/Resource>
> -#include <Nepomuk2/Variant>
> -#include <Nepomuk2/Vocabulary/NFO>
> -
> -#include <Soprano/LiteralValue>
> -#include <Soprano/Vocabulary/NAO>
> -
> -void Nepomuk2::Utils::SearchWidget::SearchWidgetPrivate::setupFacetWidget()
> -{
> -    m_facetWidget->clear();
> -    m_facetWidget->addFacet(Facet::createTypeFacet(m_facetWidget));
> -    m_facetWidget->addFacet(Facet::createDateFacet(m_facetWidget));
> -    m_facetWidget->addFacet(Facet::createPriorityFacet(m_facetWidget));
> -    m_facetWidget->addFacet(Facet::createTagFacet(m_facetWidget));
> -}
> -
> -
> -void Nepomuk2::Utils::SearchWidget::SearchWidgetPrivate::_k_queryComponentChanged()
>                 
> -{
> -    if ( !m_inQueryComponentChanged ) {
> -        m_inQueryComponentChanged = true;
> -        const Query::Query query = currentQuery();
> -        if( query != m_currentQuery ) {
> -            m_resourceModel->clear();
> -            // TODO: show busy indicator
> -            kDebug() << query;
> -            m_queryClient.close();
> -            if( query.isValid() ) {
> -                m_queryClient.query(query);
> -            }
> -            m_facetWidget->setClientQuery(query);
> -            m_currentQuery = query;
> -        }
> -        m_inQueryComponentChanged = false;
> -    }
> -    else {
> -        // we need to handle all component changes since one may trigger another
> -        QMetaObject::invokeMethod(q, "_k_queryComponentChanged", \
>                 Qt::QueuedConnection);
> -    }
> -}
> -
> -
> -void Nepomuk2::Utils::SearchWidget::SearchWidgetPrivate::_k_listingFinished()
> -{
> -    // TODO: disable busy indicator
> -}
> -
> -void Nepomuk2::Utils::SearchWidget::SearchWidgetPrivate::_k_forwardCurrentChanged(
> -        const QModelIndex & previous, const QModelIndex & current )
> -{
> -    Resource prevRes;
> -    Resource currRes;
> -    if ( previous.isValid() ) {
> -        prevRes = \
>                 previous.data(Utils::ResourceModel::ResourceRole).value<Resource>();
>                 
> -    }
> -    if ( current.isValid() ) {
> -        currRes = \
>                 current.data(Utils::ResourceModel::ResourceRole).value<Resource>();
> -    }
> -
> -    emit q->currentResourceChanged(prevRes,currRes);
> -}
> -
> -Nepomuk2::Query::Query \
> Nepomuk2::Utils::SearchWidget::SearchWidgetPrivate::currentQuery( bool \
>                 withBaseQuery ) const
> -{
> -    Query::Query query;
> -    if( withBaseQuery ) {
> -        kDebug() << "************ baseQuery:  " << m_baseQuery;
> -        query = m_baseQuery;
> -    }
> -
> -    Query::Term facetTerm = m_facetWidget->queryTerm();
> -    Query::Term userQueryTerm = m_queryEdit->query().term();
> -
> -    kDebug() << "************ userQuery:  " << userQueryTerm;
> -    kDebug() << "************ facetQuery: " << facetTerm;
> -
> -    return query && facetTerm && userQueryTerm;
> -}
> -
> -
> -Nepomuk2::Utils::SearchWidget::SearchWidget(QWidget *parent)
> -    : QWidget(parent),
> -      d_ptr(new SearchWidgetPrivate())
> -{
> -    Q_D(SearchWidget);
> -    d->q = this;
> -
> -    //query editor widget
> -    d->m_queryEdit = new SearchLineEdit(this);
> -    d->m_queryButton = new KPushButton(i18n("Search"), this);
> -    connect(d->m_queryEdit, SIGNAL(queryChanged(Nepomuk2::Query::Query)), this, \
>                 SLOT(_k_queryComponentChanged()));
> -    connect(d->m_queryButton, SIGNAL(clicked()), this, \
>                 SLOT(_k_queryComponentChanged()));
> -
> -    //item widget
> -    d->m_itemWidget = new QListView(this);
> -    d->m_resourceModel = new Utils::ResourceModel(this);
> -    d->m_itemWidget->setModel(d->m_resourceModel);
> -    connect(d->m_itemWidget->selectionModel(), \
> SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, \
>                 SIGNAL(selectionChanged()));
> -    connect(d->m_itemWidget->selectionModel(), \
>                 SIGNAL(currentChanged(QModelIndex,QModelIndex)),
> -            this, SLOT(_k_forwardCurrentChanged(QModelIndex,QModelIndex)));
> -
> -    //facets widget
> -    d->m_facetWidget = new Nepomuk2::Utils::FacetWidget(this);
> -    d->setupFacetWidget();
> -    connect(d->m_facetWidget, SIGNAL(queryTermChanged(Nepomuk2::Query::Term)), \
>                 this, SLOT(_k_queryComponentChanged()));
> -
> -    //layout and config
> -    QSplitter* facetSplitter = new QSplitter(this);
> -    facetSplitter->addWidget(d->m_itemWidget);
> -    facetSplitter->addWidget(d->m_facetWidget);
> -
> -    QGridLayout* layout = new QGridLayout( this );
> -    layout->setMargin(0);
> -    layout->addWidget( d->m_queryEdit, 0, 0 );
> -    layout->addWidget( d->m_queryButton, 0, 1 );
> -    layout->addWidget( facetSplitter, 1, 0, 1, 2 );
> -    layout->setRowStretch(1,1);
> -
> -    // query client setup
> -    connect( &d->m_queryClient, \
>                 SIGNAL(newEntries(QList<Nepomuk2::Query::Result>)),
> -            d->m_resourceModel, SLOT(addResults(QList<Nepomuk2::Query::Result>)) \
>                 );
> -    connect( &d->m_queryClient, SIGNAL(finishedListing()),
> -            this, SLOT(_k_listingFinished()));
> -
> -    setSelectionMode(QListView::ExtendedSelection);
> -    setConfigFlags( DefaultConfigFlags );
> -}
> -
> -Nepomuk2::Utils::SearchWidget::~SearchWidget()
> -{
> -    delete d_ptr;
> -}
> -
> -void Nepomuk2::Utils::SearchWidget::setConfigFlags( ConfigFlags flags )
> -{
> -    Q_D(SearchWidget);
> -    d->m_configFlags = flags;
> -    d->m_facetWidget->setShown( flags&ShowFacets );
> -    d->m_queryButton->setShown( !( flags&SearchWhileYouType ) );
> -    d->m_queryEdit->setSearchWhileTypingEnabled( flags&SearchWhileYouType );
> -}
> -
> -Nepomuk2::Utils::SearchWidget::ConfigFlags \
>                 Nepomuk2::Utils::SearchWidget::configFlags() const
> -{
> -    Q_D(const SearchWidget);
> -    return d->m_configFlags;
> -}
> -
> -void Nepomuk2::Utils::SearchWidget::setSelectionMode ( \
>                 QAbstractItemView::SelectionMode mode )
> -{
> -    Q_D(SearchWidget);
> -
> -    d->m_itemWidget->setSelectionMode(mode);
> -}
> -
> -QAbstractItemView::SelectionMode Nepomuk2::Utils::SearchWidget::selectionMode () \
>                 const
> -{
> -    Q_D(const SearchWidget);
> -
> -    return d->m_itemWidget->selectionMode();
> -}
> -
> -Nepomuk2::Query::Query Nepomuk2::Utils::SearchWidget::setQuery( const \
>                 Nepomuk2::Query::Query &query )
> -{
> -    Q_D(SearchWidget);
> -
> -    // try to extract as much as possible from the query as facets
> -    Query::Query restQuery = d->m_facetWidget->extractFacetsFromQuery( query );
> -
> -    // try to get the rest into the line edit
> -    restQuery.setTerm( d->m_queryEdit->extractUsableTerms( restQuery.term() ) );
> -
> -    return restQuery;
> -}
> -
> -void Nepomuk2::Utils::SearchWidget::setBaseQuery( const Query::Query& query )
> -{
> -    Q_D(SearchWidget);
> -    d->m_baseQuery = query;
> -    d->_k_queryComponentChanged();
> -}
> -
> -Nepomuk2::Query::Query Nepomuk2::Utils::SearchWidget::baseQuery() const
> -{
> -    Q_D(const SearchWidget);
> -    return d->m_baseQuery;
> -}
> -
> -Nepomuk2::Query::Query Nepomuk2::Utils::SearchWidget::query() const
> -{
> -    Q_D(const SearchWidget);
> -    return d->currentQuery();
> -}
> -
> -Nepomuk2::Resource Nepomuk2::Utils::SearchWidget::currentResource() const
> -{
> -    Q_D(const SearchWidget);
> -    return d->m_itemWidget->currentIndex().data(Utils::ResourceModel::ResourceRole).value<Resource>();
>                 
> -}
> -
> -QList<Nepomuk2::Resource> Nepomuk2::Utils::SearchWidget::selectedResources() const
> -{
> -    Q_D(const SearchWidget);
> -    QList<Nepomuk2::Resource> resourceList;
> -    foreach(const QModelIndex& index, \
>                 d->m_itemWidget->selectionModel()->selectedIndexes()) {
> -        resourceList << \
>                 index.data(Utils::ResourceModel::ResourceRole).value<Resource>();
> -    }
> -    return resourceList;
> -}
> -
> -
> -Nepomuk2::Utils::FacetWidget* Nepomuk2::Utils::SearchWidget::facetWidget() const
> -{
> -    Q_D(const SearchWidget);
> -    return d->m_facetWidget;
> -}
> -
> -
> -// static
> -Nepomuk2::Resource Nepomuk2::Utils::SearchWidget::searchResource( QWidget* parent,
> -                                                               const \
>                 Nepomuk2::Query::Query& baseQuery,
> -                                                               \
>                 SearchWidget::ConfigFlags flags )
> -{
> -    KDialog dlg( parent );
> -    dlg.setButtons(KDialog::Ok | KDialog::Cancel);
> -    SearchWidget* searchWidget = new SearchWidget(&dlg);
> -    dlg.setMainWidget(searchWidget);
> -
> -    searchWidget->setBaseQuery( baseQuery );
> -    searchWidget->setConfigFlags( flags );
> -    searchWidget->setSelectionMode( QAbstractItemView::SingleSelection );
> -
> -    if( dlg.exec() == QDialog::Accepted ) {
> -        return searchWidget->currentResource();
> -    }
> -    else {
> -        return Nepomuk2::Resource();
> -    }
> -}
> -
> -
> -// static
> -QList<Nepomuk2::Resource> Nepomuk2::Utils::SearchWidget::searchResources( QWidget* \
>                 parent,
> -                                                                       const \
>                 Nepomuk2::Query::Query& baseQuery,
> -                                                                       \
>                 SearchWidget::ConfigFlags flags )
> -{
> -    KDialog dlg( parent );
> -    dlg.setButtons(KDialog::Ok | KDialog::Cancel);
> -    SearchWidget* searchWidget = new SearchWidget(&dlg);
> -    dlg.setMainWidget(searchWidget);
> -
> -    searchWidget->setBaseQuery( baseQuery );
> -    searchWidget->setConfigFlags( flags );
> -    searchWidget->setSelectionMode( QAbstractItemView::ExtendedSelection );
> -
> -    if( dlg.exec() == QDialog::Accepted ) {
> -        return searchWidget->selectedResources();
> -    }
> -    else {
> -        return QList<Nepomuk2::Resource>();
> -    }
> -}
> -
> -#include "searchwidget.moc"
> diff --git a/utils/searchwidget.h b/utils/searchwidget.h
> deleted file mode 100644
> index 33efa8d..0000000
> --- a/utils/searchwidget.h
> +++ /dev/null
> @@ -1,214 +0,0 @@
> -/*
> -  Copyright (c) 2010 Oszkar Ambrus <aoszkar@gmail.com>
> -  Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -  This library is free software; you can redistribute it and/or
> -  modify it under the terms of the GNU Lesser General Public
> -  License as published by the Free Software Foundation; either
> -  version 2.1 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 6 of version 3 of the license.
> -
> -  This library 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
> -  Lesser General Public License for more details.
> -
> -  You should have received a copy of the GNU Lesser General Public
> -  License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef RESOURCESEARCHWIDGET_H
> -#define RESOURCESEARCHWIDGET_H
> -
> -#include <QWidget>
> -#include <QAbstractItemView>
> -
> -#include "nepomukwidgets_export.h"
> -#include <Nepomuk2/Query/Query>
> -
> -namespace Nepomuk2 {
> -    class Resource;
> -
> -    namespace Utils {
> -        class FacetWidget;
> -
> -        /**
> -         * \class SearchWidget searchwidget.h Nepomuk/Utils/SearchWidget
> -         *
> -         * \brief Provides a GUI for searching files or resources of any type.
> -         *
> -         * The SearchWidget combines the different search GUI elements provided in
> -         * Nepomuk in one widget: a line edit which allows to type in a query and
> -         * the facet widget.
> -         *
> -         * The SearchWidget allows to specify a base query which is fixed and \
>                 cannot
> -         * be changed by the user. This allows to restrict the set of resources \
>                 searched
> -         * by the user.
> -         *
> -         * \author Oszkar Ambrus <aoszkar@gmail.com>, Sebastian Trueg \
>                 <trueg@kde.org>
> -         *
> -         * \since 4.6
> -         */
> -        class NEPOMUKWIDGETS_EXPORT SearchWidget : public QWidget
> -        {
> -            Q_OBJECT
> -
> -        public:
> -            /**
> -             * Constructor.
> -             */
> -            SearchWidget(QWidget *parent = 0);
> -
> -            /**
> -             * Destructor
> -             */
> -            ~SearchWidget();
> -
> -            /**
> -             * The config flags can be used to configure
> -             * the search widget to fit the needs of the application.
> -             */
> -            enum ConfigFlag {
> -                /// no flags, a plain search widget
> -                NoConfigFlags = 0x0,
> -
> -                /// show the facets allowing the user to modify the query
> -                ShowFacets = 0x1,
> -
> -                /// enable auto searching while the user is typing in the query \
>                 (live query)
> -                SearchWhileYouType = 0x2,
> -
> -                /// the default: show facets and disable live query
> -                DefaultConfigFlags = ShowFacets
> -            };
> -            Q_DECLARE_FLAGS( ConfigFlags, ConfigFlag )
> -
> -            /**
> -             * Set the config flags to be used. Defaults to DefaultConfigFlags.
> -             *
> -             * \sa configFlags()
> -             */
> -            void setConfigFlags( ConfigFlags flags );
> -
> -            /**
> -             * The config flags set via setConfigFlags().
> -             */
> -            ConfigFlags configFlags() const;
> -
> -            /**
> -             * Sets the selection mode of the view to @p mode
> -             */
> -            void setSelectionMode(QAbstractItemView::SelectionMode mode);
> -
> -            /**
> -             * @returns the selection mode of the view
> -             */
> -            QAbstractItemView::SelectionMode selectionMode () const;
> -
> -            /**
> -             * @returns the base query set via setBaseQuery().
> -             */
> -            Query::Query baseQuery() const;
> -
> -            /**
> -             * Construct the query currently used by this widget including
> -             * the baseQuery(), all facets, and the user desktop query.
> -             */
> -            Query::Query query() const;
> -
> -            /**
> -             * @returns the current resource if any, an invalid resource if none \
>                 is selected
> -             */
> -            Resource currentResource() const;
> -
> -            /**
> -             * @returns a list of all selected resources.
> -             */
> -            QList<Resource> selectedResources() const;
> -
> -            /**
> -             * The facet widget that is used internally. By default a predefined \
>                 set of facets
> -             * is used. This method can be used to access the FacetWidget in order \
>                 to change its
> -             * configuration.
> -             */
> -            FacetWidget* facetWidget() const;
> -
> -            /**
> -             * Creates a dialog embedding a SearchWidget that allows the user to \
>                 select one resource from the
> -             * result set.
> -             *
> -             * \return The Resource the user selected or an invalid one in case \
>                 there was no result to choose
> -             * or the user canceled the search.
> -             */
> -            static Nepomuk2::Resource searchResource( QWidget* parent = 0,
> -                                                     const Nepomuk2::Query::Query& \
>                 baseQuery = Nepomuk2::Query::Query(),
> -                                                     SearchWidget::ConfigFlags \
>                 flags = SearchWidget::DefaultConfigFlags );
> -
> -            /**
> -             * Creates a dialog embedding a SearchWidget that allows the user to \
>                 select resources from the
> -             * result set.
> -             *
> -             * \return The resources the user selected or an empty list in case \
>                 there was no result to choose
> -             * or the user canceled the search.
> -             */
> -            static QList<Nepomuk2::Resource> searchResources( QWidget* parent = 0,
> -                                                             const \
>                 Nepomuk2::Query::Query& baseQuery = Nepomuk2::Query::Query(),
> -                                                             \
>                 SearchWidget::ConfigFlags flags = SearchWidget::DefaultConfigFlags \
>                 );
> -
> -        public Q_SLOTS:
> -            /**
> -             * Set the query currently configured in the widget. Parts that cannot \
>                 be converted into
> -             * facets or a user desktop query string are returned.
> -             *
> -             * \param query The query that the widget should represent after the \
>                 call.
> -             *
> -             * \return The rest query which could not be converted into facets and \
>                 a desktop query.
> -             */
> -            Nepomuk2::Query::Query setQuery( const Nepomuk2::Query::Query& query \
>                 );
> -
> -            /**
> -             * Set the base query. The base query is the fixed part of the query
> -             * which cannot be changed by the user. It allows to restrict the
> -             * searched set of resources.
> -             *
> -             * Be default the base query is empty, ie. an invalid Query.
> -             *
> -             * \param query The new base query.
> -             *
> -             * Be aware that setting the base query will reset widget's query \
>                 components.
> -             */
> -            void setBaseQuery( const Nepomuk2::Query::Query& query );
> -
> -        Q_SIGNALS:
> -            /**
> -             * Emitted when the selection is changed, ie. the values returned by \
>                 currentResource() and
> -             * selectedResources() have changed.
> -             */
> -            void selectionChanged();
> -
> -            /**
> -             * \brief Emited when current resource is changed
> -             */
> -            void currentResourceChanged(const Nepomuk2::Resource & previous, const \
>                 Nepomuk2::Resource & current );
> -
> -
> -        private:
> -            class SearchWidgetPrivate;
> -            SearchWidgetPrivate * const d_ptr;
> -
> -            Q_DECLARE_PRIVATE(SearchWidget)
> -
> -            /*! \brief Convert QModelIndex to Nepomuk2::Resource and emit \
>                 currentResourceChanged signal
> -             */
> -            Q_PRIVATE_SLOT( d_ptr, void _k_forwardCurrentChanged( const \
>                 QModelIndex &, const QModelIndex &));
> -            Q_PRIVATE_SLOT( d_ptr, void _k_queryComponentChanged() )
> -            Q_PRIVATE_SLOT( d_ptr, void _k_listingFinished() )
> -        };
> -    }
> -}
> -
> -Q_DECLARE_OPERATORS_FOR_FLAGS( Nepomuk2::Utils::SearchWidget::ConfigFlags )
> -
> -#endif // RESOURCESEARCHWIDGET_H
> diff --git a/utils/searchwidget_p.h b/utils/searchwidget_p.h
> deleted file mode 100644
> index 8607dbb..0000000
> --- a/utils/searchwidget_p.h
> +++ /dev/null
> @@ -1,82 +0,0 @@
> -/*
> -   Copyright (c) 2010 Oszkar Ambrus <aoszkar@gmail.com>
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef RESOURCESEARCHWIDGET_P_H
> -#define RESOURCESEARCHWIDGET_P_H
> -
> -#include "searchwidget.h"
> -
> -#include <Nepomuk2/Query/Query>
> -#include <Nepomuk2/Query/QueryServiceClient>
> -
> -class QListView;
> -namespace Nepomuk2 {
> -    namespace Utils {
> -        class ResourceModel;
> -        class FacetWidget;
> -        class SearchLineEdit;
> -    }
> -}
> -class KPushButton;
> -
> -/**
> -  * WARNING: This class is just an implementation detail.
> -  */
> -class Nepomuk2::Utils::SearchWidget::SearchWidgetPrivate
> -{
> -public:
> -    SearchWidgetPrivate()
> -        : m_inQueryComponentChanged( false ) {
> -    }
> -
> -    /// creates the default set of facets
> -    void setupFacetWidget();
> -
> -    /**
> -     * Get the current query.
> -     * \param withBaseQuery If \p true the base query is included, otherwise it is \
>                 not included.
> -     * \return The currently selected query.
> -     */
> -    Query::Query currentQuery( bool withBaseQuery = true ) const;
> -
> -    void _k_queryComponentChanged();
> -    void _k_listingFinished();
> -    void _k_forwardCurrentChanged( const QModelIndex &, const QModelIndex &);
> -
> -    SearchLineEdit *m_queryEdit;
> -    KPushButton *m_queryButton;
> -    QListView *m_itemWidget;
> -    Utils::ResourceModel* m_resourceModel;
> -    Nepomuk2::Utils::FacetWidget *m_facetWidget;
> -
> -    Nepomuk2::Query::QueryServiceClient m_queryClient;
> -    Nepomuk2::Query::Query m_currentQuery;
> -
> -    Nepomuk2::Query::Query m_baseQuery;
> -
> -    SearchWidget::ConfigFlags m_configFlags;
> -
> -    bool m_inQueryComponentChanged;
> -
> -    SearchWidget* q;
> -};
> -
> -#endif // RESOURCESEARCHWIDGET_P_H
> diff --git a/utils/simplefacet.cpp b/utils/simplefacet.cpp
> deleted file mode 100644
> index 312e460..0000000
> --- a/utils/simplefacet.cpp
> +++ /dev/null
> @@ -1,267 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "simplefacet.h"
> -
> -#include <Nepomuk2/Query/AndTerm>
> -#include <Nepomuk2/Query/OrTerm>
> -#include <Nepomuk2/Query/Query>
> -
> -#include <KGuiItem>
> -#include <KDebug>
> -
> -#include <QtCore/QSet>
> -
> -using namespace Nepomuk2::Query;
> -
> -
> -class Nepomuk2::Utils::SimpleFacet::Private
> -{
> -public:
> -    Private()
> -        : m_selectionMode(Facet::MatchOne) {
> -    }
> -
> -    int indexOf( const Term& term ) const;
> -
> -    Facet::SelectionMode m_selectionMode;
> -
> -    QList<Nepomuk2::Query::Term> m_terms;
> -    QList<KGuiItem> m_titles;
> -
> -    QSet<int> m_selectedFacets;
> -
> -    SimpleFacet* q;
> -};
> -
> -
> -int Nepomuk2::Utils::SimpleFacet::Private::indexOf( const Term& term ) const
> -{
> -    return m_terms.indexOf( term );
> -}
> -
> -
> -Nepomuk2::Utils::SimpleFacet::SimpleFacet( QObject* parent )
> -    : Facet(parent),
> -      d(new Private())
> -{
> -    d->q = this;
> -}
> -
> -
> -Nepomuk2::Utils::SimpleFacet::~SimpleFacet()
> -{
> -    delete d;
> -}
> -
> -
> -void Nepomuk2::Utils::SimpleFacet::setSelectionMode( SelectionMode mode )
> -{
> -    d->m_selectionMode = mode;
> -    clearSelection();
> -}
> -
> -
> -Nepomuk2::Utils::Facet::SelectionMode \
>                 Nepomuk2::Utils::SimpleFacet::selectionMode() const
> -{
> -    return d->m_selectionMode;
> -}
> -
> -
> -Nepomuk2::Query::Term Nepomuk2::Utils::SimpleFacet::queryTerm() const
> -{
> -    if( d->m_terms.isEmpty() ||
> -        d->m_selectedFacets.isEmpty() ) {
> -        return Term();
> -    }
> -    else {
> -        switch( d->m_selectionMode ) {
> -        case MatchAll: {
> -            AndTerm andTerm;
> -            Q_FOREACH( int i, d->m_selectedFacets ) {
> -                andTerm.addSubTerm( termAt(i) );
> -            }
> -            return andTerm.optimized();
> -        }
> -        case MatchAny: {
> -            OrTerm orTerm;
> -            Q_FOREACH( int i, d->m_selectedFacets ) {
> -                orTerm.addSubTerm( termAt(i) );
> -            }
> -            return orTerm.optimized();
> -        }
> -        case MatchOne:
> -            return termAt( *d->m_selectedFacets.constBegin() );
> -        }
> -    }
> -
> -    // make gcc shut up
> -    return Term();
> -}
> -
> -
> -int Nepomuk2::Utils::SimpleFacet::count() const
> -{
> -    return d->m_terms.count();
> -}
> -
> -
> -Nepomuk2::Query::Term Nepomuk2::Utils::SimpleFacet::termAt( int index ) const
> -{
> -    return d->m_terms[index];
> -}
> -
> -
> -bool Nepomuk2::Utils::SimpleFacet::isSelected( int index ) const
> -{
> -    return d->m_selectedFacets.contains( index );
> -}
> -
> -
> -KGuiItem Nepomuk2::Utils::SimpleFacet::guiItem( int index ) const
> -{
> -    return d->m_titles[index];
> -}
> -
> -
> -void Nepomuk2::Utils::SimpleFacet::clear()
> -{
> -    d->m_terms.clear();
> -    d->m_titles.clear();
> -    d->m_selectedFacets.clear();
> -    setQueryTermChanged();
> -}
> -
> -
> -void Nepomuk2::Utils::SimpleFacet::addTerm( const QString& text, const \
>                 Nepomuk2::Query::Term& term )
> -{
> -    addTerm( KGuiItem(text), term );
> -}
> -
> -
> -void Nepomuk2::Utils::SimpleFacet::addTerm( const KGuiItem& title, const \
>                 Nepomuk2::Query::Term& term )
> -{
> -    d->m_titles.append( title );
> -    d->m_terms.append( term );
> -    clearSelection();
> -    setLayoutChanged();
> -}
> -
> -
> -void Nepomuk2::Utils::SimpleFacet::setSelected( int index, bool selected )
> -{
> -    if( selectionMode() == MatchOne ) {
> -        if( d->m_selectedFacets.contains(index) && !selected ) {
> -            clearSelection();
> -        }
> -        else if( selected ) {
> -            d->m_selectedFacets.clear();
> -            d->m_selectedFacets.insert(index);
> -        }
> -    }
> -    else if( selected ) {
> -        d->m_selectedFacets.insert(index);
> -    }
> -    else {
> -        d->m_selectedFacets.remove(index);
> -    }
> -    setSelectionChanged();
> -    setQueryTermChanged();
> -}
> -
> -
> -void Nepomuk2::Utils::SimpleFacet::clearSelection()
> -{
> -    d->m_selectedFacets.clear();
> -    if( selectionMode() == MatchOne )
> -        d->m_selectedFacets.insert(0);
> -    setSelectionChanged();
> -    setQueryTermChanged();
> -}
> -
> -
> -bool Nepomuk2::Utils::SimpleFacet::selectFromTerm( const Nepomuk2::Query::Term& \
>                 term )
> -{
> -    // 1. check if term is in our list of terms
> -    const int i = d->indexOf( term );
> -    if( i >= 0 ) {
> -        kDebug() << "Found term at" << i << term;
> -        setSelected( i, true );
> -        return true;
> -    }
> -
> -    // 2. an OrTerm may be a set of terms in a MatchOne facet
> -    // 3. an AndTerm may be a set of terms in a MatchAll facet
> -    if( ( term.isOrTerm() &&
> -          selectionMode() == MatchAny ) ||
> -        ( term.isAndTerm() &&
> -          selectionMode() == MatchAll ) ) {
> -
> -        QSet<int> selectedTerms;
> -
> -        // since single terms could consist of OrTerms or AndTerms as well
> -        // and thus, could be "merged" into the surrounding term, we check
> -        // every sensible combination of terms instead of only single ones
> -
> -        QList<Term> subTerms;
> -        if( term.isAndTerm() )
> -            subTerms = term.toAndTerm().subTerms();
> -        else
> -            subTerms = term.toOrTerm().subTerms();
> -
> -        while( !subTerms.isEmpty() ) {
> -            bool found = false;
> -            for( int len = 1; len <= subTerms.count(); ++len ) {
> -                const QList<Term> excerpt = subTerms.mid( 0, len );
> -                Term subTerm;
> -                if( term.isAndTerm() )
> -                    subTerm = AndTerm(excerpt).optimized();
> -                else
> -                    subTerm = OrTerm(excerpt).optimized();
> -                const int i = d->indexOf( subTerm );
> -                if( i >= 0 ) {
> -                    kDebug() << "Found term at" << i << subTerm;
> -                    selectedTerms << i;
> -                    subTerms = subTerms.mid(len);
> -                    found = true;
> -                    break;
> -                }
> -            }
> -            if( !found ) {
> -                kDebug() << "Term not found (not even as subterm):" << subTerms;
> -                return false;
> -            }
> -        }
> -
> -        d->m_selectedFacets = selectedTerms;
> -        setSelectionChanged();
> -        setQueryTermChanged();
> -
> -        return true;
> -    }
> -
> -    else {
> -        kDebug() << "Term not found" << term;
> -        return false;
> -    }
> -}
> -
> -#include "simplefacet.moc"
> diff --git a/utils/simplefacet.h b/utils/simplefacet.h
> deleted file mode 100644
> index 643a87f..0000000
> --- a/utils/simplefacet.h
> +++ /dev/null
> @@ -1,152 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef _NEPOMUK_QUERY_SIMPLE_FACET_H_
> -#define _NEPOMUK_QUERY_SIMPLE_FACET_H_
> -
> -#include "facet.h"
> -#include "nepomukwidgets_export.h"
> -
> -namespace Nepomuk2 {
> -    namespace Utils {
> -        /**
> -         * \class SimpleFacet simplefacet.h Nepomuk/Utils/SimpleFacet
> -         *
> -         * \ingroup nepomuk_facets
> -         *
> -         * \brief A simple facet using a list of terms.
> -         *
> -         * The %SimpleFacet maintains a list of Query::Term objects combined
> -         * with a label (or a full KGuiItem if required). The usage is very
> -         * simple: Create a new instance of SimpleFacet, add terms via the \
>                 addTerm()
> -         * methods, choose a selection mode via setSelectionMode(), and let
> -         * SimpleFacet do the rest.
> -         *
> -         * %SimpleFacet even implements the selectFromTerm() method which
> -         * provides enhanced user experience by converting queries into facets.
> -         *
> -         * \author Sebastian Trueg <trueg@kde.org>
> -         *
> -         * \since 4.6
> -         */
> -        class NEPOMUKWIDGETS_EXPORT SimpleFacet : public Facet
> -        {
> -            Q_OBJECT
> -
> -        public:
> -            /**
> -             * Create a new empty facet.
> -             */
> -            SimpleFacet( QObject* parent = 0 );
> -
> -            /**
> -             * Destructor
> -             */
> -            ~SimpleFacet();
> -
> -            /**
> -             * \return The currently selected Term. Depending on the
> -             * selectionMode() this is either a single Term, a combination
> -             * through Query::AndTerm, or a combination through Query::OrTerm.
> -             */
> -            Query::Term queryTerm() const;
> -
> -            /**
> -             * Set the selection mode to use in this facet. The default is \
>                 MatchOne.
> -             */
> -            void setSelectionMode( SelectionMode mode );
> -
> -            /**
> -             * The selection mode set via setSelectionMode()
> -             */
> -            SelectionMode selectionMode() const;
> -
> -            /**
> -             * \return The number of terms added via addTerm().
> -             */
> -            int count() const;
> -
> -            /**
> -             * \return The gui item set via addTerm() for the Term at \p index
> -             * or an empty KGuiItem if \p index is out of range.
> -             */
> -            KGuiItem guiItem( int index ) const;
> -
> -            /**
> -             * \return The term set via addTerm() for \p index
> -             * or an invalid Query::Term if \p index is out of range.
> -             */
> -            Query::Term termAt( int index ) const;
> -
> -            /**
> -             * \return \p true if the term at \p index has been selected via
> -             * setSelected().
> -             */
> -            bool isSelected( int index ) const;
> -
> -        public Q_SLOTS:
> -            /**
> -             * Clear the list of terms.
> -             */
> -            void clear();
> -
> -            /**
> -             * Add a new term. This is equivalent to calling
> -             * \code
> -             * addTerm(KGuiItem(text), term);
> -             * \endcode
> -             */
> -            void addTerm( const QString& text, const Nepomuk2::Query::Term& \
>                 queryTerm );
> -
> -            /**
> -             * Add a new term.
> -             * \param item The gui item used to present the choice to the user.
> -             * \param term The query term which represents this choice.
> -             */
> -            void addTerm( const KGuiItem& item, const Nepomuk2::Query::Term& \
>                 queryTerm );
> -
> -            /**
> -             * Clear the selection. If selectionMode() is MatchOne the first
> -             * choice should be selected.
> -             */
> -            void clearSelection();
> -
> -            /**
> -             * Selects or deselects the term at \p index. Depending on the \
>                 selectionMode()
> -             * this will also affect the selection of other terms.
> -             */
> -            void setSelected( int index, bool selected = true );
> -
> -            /**
> -             * The \p term is analyzed depending on the selectionMode().
> -             *
> -             * \sa Facet::selectFromTerm()
> -             */
> -            bool selectFromTerm( const Nepomuk2::Query::Term& queryTerm );
> -
> -        private:
> -            class Private;
> -            Private* d;
> -        };
> -    }
> -}
> -
> -#endif
> diff --git a/utils/typefacet.cpp b/utils/typefacet.cpp
> deleted file mode 100644
> index cd80836..0000000
> --- a/utils/typefacet.cpp
> +++ /dev/null
> @@ -1,419 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#include "typefacet.h"
> -
> -#include <Nepomuk2/Query/Term>
> -#include <Nepomuk2/Query/FileQuery>
> -#include <Nepomuk2/Query/AndTerm>
> -#include <Nepomuk2/Query/OrTerm>
> -#include <Nepomuk2/Query/ResourceTypeTerm>
> -#include <Nepomuk2/Query/NegationTerm>
> -#include <Nepomuk2/Query/LiteralTerm>
> -#include <Nepomuk2/Query/ComparisonTerm>
> -
> -#include <Nepomuk2/Types/Class>
> -#include <Nepomuk2/Vocabulary/NIE>
> -#include <Nepomuk2/Vocabulary/NFO>
> -#include <Nepomuk2/Vocabulary/TMO>
> -#include <Nepomuk2/Vocabulary/NCO>
> -#include <Nepomuk2/Vocabulary/NMO>
> -
> -#include <KGuiItem>
> -#include <KDebug>
> -
> -#include <QtCore/QMap>
> -#include <QtCore/QSet>
> -
> -#include <Soprano/Vocabulary/NAO>
> -
> -
> -namespace {
> -enum RootSelection {
> -    None,
> -    File,
> -    Other
> -};
> -}
> -
> -class Nepomuk2::Utils::TypeFacet::Private
> -{
> -public:
> -    Private()
> -        : m_rootSelection(None),
> -          m_usedTypes(0) {
> -        //
> -        // Default file types
> -        //
> -        m_fileTypes.append( qMakePair<QString, Query::Term>(i18nc("@option:check A \
>                 filter on file type", "Documents"),
> -                           \
>                 Query::ResourceTypeTerm(Nepomuk2::Vocabulary::NFO::Document())) );
> -
> -        // need to check the mimetype as well since strigi is still not perfect
> -        m_fileTypes.append( qMakePair<QString, Query::Term>(i18nc("@option:check A \
>                 filter on file type - audio files", "Audio"),
> -                           \
> Query::ComparisonTerm(Nepomuk2::Vocabulary::NIE::mimeType(), \
>                 Query::LiteralTerm(QLatin1String("audio")))) );
> -        m_fileTypes.append( qMakePair<QString, Query::Term>(i18nc("@option:check A \
>                 filter on file type - media video", "Video"),
> -                           \
> Query::ComparisonTerm(Nepomuk2::Vocabulary::NIE::mimeType(), \
>                 Query::LiteralTerm(QLatin1String("video")))) );
> -
> -        m_fileTypes.append( qMakePair<QString, Query::Term>(i18nc("@option:check A \
>                 filter on file type", "Images"),
> -                           \
>                 Query::ResourceTypeTerm(Nepomuk2::Vocabulary::NFO::Image())) );
> -
> -
> -        //
> -        // Default other types
> -        //
> -        m_otherTypes.append(qMakePair<QString, Query::Term>(i18nc("@option:check A \
>                 filter on resource type", "Contacts"),
> -                            \
>                 Query::ResourceTypeTerm(Nepomuk2::Vocabulary::NCO::Contact())));
> -        m_otherTypes.append(qMakePair<QString, Query::Term>(i18nc("@option:check A \
>                 filter on resource type", "Emails"),
> -                            \
>                 Query::ResourceTypeTerm(Nepomuk2::Vocabulary::NMO::Email())));
> -        m_otherTypes.append(qMakePair<QString, Query::Term>(i18nc("@option:check A \
>                 filter on resource type", "Tasks"),
> -                            \
>                 Query::ResourceTypeTerm(Nepomuk2::Vocabulary::TMO::Task())));
> -        m_otherTypes.append(qMakePair<QString, Query::Term>(i18nc("@option:check A \
>                 filter on resource type", "Tags"),
> -                            \
>                 Query::ResourceTypeTerm(Soprano::Vocabulary::NAO::Tag())));
> -    }
> -
> -    bool findTerm( const Query::Term& term, int* index, RootSelection* \
>                 rootSelection ) const;
> -    void setRootSelection( RootSelection selection );
> -
> -    RootSelection m_rootSelection;
> -    QList<QPair<QString, Query::Term> > m_fileTypes;
> -    QList<QPair<QString, Query::Term> > m_otherTypes;
> -
> -    /// points to m_fileTypes or m_otherTypes based on m_rootSelection
> -    QList<QPair<QString, Query::Term> >* m_usedTypes;
> -
> -    /// a list of custom types which is filled by selectFromTerm()
> -    QList<Types::Class> m_customTypes;
> -
> -    /// indexes into m_fileTypes or m_otherTypes depending on the value of \
>                 m_rootSelection
> -    /// only used to avoid code duplication
> -    QSet<int> m_selectedTypes;
> -
> -    /// indexes into m_customTypes
> -    QSet<int> m_selectedCustomTypes;
> -};
> -
> -
> -bool Nepomuk2::Utils::TypeFacet::Private::findTerm( const Query::Term& term, int* \
>                 index, RootSelection* rootSelection ) const
> -{
> -    for( int i = 0; i < m_fileTypes.count(); ++i ) {
> -        if( term == m_fileTypes[i].second ) {
> -            *index = i;
> -            *rootSelection = File;
> -            return true;
> -        }
> -    }
> -    for( int i = 0; i < m_otherTypes.count(); ++i ) {
> -        if( term == m_otherTypes[i].second ) {
> -            *index = i;
> -            *rootSelection = Other;
> -            return true;
> -        }
> -    }
> -    return false;
> -}
> -
> -
> -void Nepomuk2::Utils::TypeFacet::Private::setRootSelection( RootSelection \
>                 selection )
> -{
> -    m_rootSelection = selection;
> -    if( m_rootSelection == File )
> -        m_usedTypes = &m_fileTypes;
> -    else if( m_rootSelection == Other )
> -        m_usedTypes = &m_otherTypes;
> -    else
> -        m_usedTypes = 0;
> -}
> -
> -Nepomuk2::Utils::TypeFacet::TypeFacet(QObject *parent)
> -    : Nepomuk2::Utils::Facet(parent),
> -      d(new Private())
> -{
> -}
> -
> -
> -Nepomuk2::Utils::TypeFacet::~TypeFacet()
> -{
> -    delete d;
> -}
> -
> -Nepomuk2::Utils::Facet::SelectionMode Nepomuk2::Utils::TypeFacet::selectionMode() \
>                 const
> -{
> -    return MatchAny;
> -}
> -
> -// while we do return file/other query terms even if there is no sub-selection we \
>                 do not notify this change since
> -// to the user it should just be a preselection
> -Nepomuk2::Query::Term Nepomuk2::Utils::TypeFacet::queryTerm() const
> -{
> -    switch(d->m_rootSelection) {
> -    case None:
> -        return Query::Term();
> -
> -    case File:
> -        if( d->m_selectedTypes.isEmpty() && d->m_selectedCustomTypes.isEmpty() ) {
> -            return \
>                 Query::ResourceTypeTerm(Nepomuk2::Vocabulary::NFO::FileDataObject());
>                 
> -        }
> -        else {
> -            Query::OrTerm term;
> -            Q_FOREACH( int i, d->m_selectedTypes ) {
> -                term.addSubTerm( d->m_fileTypes[i].second );
> -            }
> -            Q_FOREACH( int i, d->m_selectedCustomTypes ) {
> -                term.addSubTerm( Query::ResourceTypeTerm( d->m_customTypes[i] ) );
> -            }
> -            return term.optimized();
> -        }
> -
> -    case Other:
> -        if( d->m_selectedTypes.isEmpty() && d->m_selectedCustomTypes.isEmpty() ) {
> -            return \
> Query::NegationTerm::negateTerm(Query::ResourceTypeTerm(Nepomuk2::Vocabulary::NFO::FileDataObject()));
>                 
> -        }
> -        else {
> -            Query::OrTerm term;
> -            Q_FOREACH( int i, d->m_selectedTypes ) {
> -                term.addSubTerm( d->m_otherTypes[i].second );
> -            }
> -            Q_FOREACH( int i, d->m_selectedCustomTypes ) {
> -                term.addSubTerm( Query::ResourceTypeTerm( d->m_customTypes[i] ) );
> -            }
> -            return term.optimized();
> -        }
> -    }
> -
> -    // make gcc shut up
> -    return Query::Term();
> -}
> -
> -int Nepomuk2::Utils::TypeFacet::count() const
> -{
> -    if( d->m_rootSelection == None ) {
> -        // File and Other
> -        return 2;
> -    }
> -    else {
> -        // File/Other selection + fixed types + custom types
> -        return 1 + d->m_usedTypes->count() + d->m_customTypes.count();
> -    }
> -}
> -
> -KGuiItem Nepomuk2::Utils::TypeFacet::guiItem(int index) const
> -{
> -    if( d->m_rootSelection == None ) {
> -        switch( index ) {
> -        case 0:
> -            return KGuiItem(i18nc("@option:check Do filter on type - show only \
>                 files", "Files"));
> -        case 1:
> -            return KGuiItem(i18nc("@option:check Do filter on type - show \
>                 everything but files", "Other"));
> -        break;
> -        }
> -    }
> -    else {
> -        if( index == 0 ) {
> -            if( d->m_rootSelection == File )
> -                return KGuiItem(i18nc("@option:check Do filter on type - show only \
>                 files", "Files"));
> -            else
> -                return KGuiItem(i18nc("@option:check Do filter on type - show \
>                 everything but files", "Other"));
> -        }
> -        else {
> -            --index;
> -        }
> -        if( index < d->m_usedTypes->count() ) {
> -            return KGuiItem(d->m_usedTypes->at(index).first);
> -        }
> -        else if( index - d->m_usedTypes->count() < d->m_customTypes.count() ) {
> -            return KGuiItem(d->m_customTypes[index - \
>                 d->m_usedTypes->count()].label());
> -        }
> -    }
> -
> -    return KGuiItem();
> -}
> -
> -bool Nepomuk2::Utils::TypeFacet::isSelected(int index) const
> -{
> -    if( d->m_rootSelection == None ) {
> -        return false;
> -    }
> -    else if( index == 0 ) {
> -        return true;
> -    }
> -    else {
> -        --index;
> -        if( index < d->m_usedTypes->count() ) {
> -            return d->m_selectedTypes.contains(index);
> -        }
> -        else {
> -            index -= d->m_usedTypes->count();
> -            return d->m_selectedCustomTypes.contains(index);
> -        }
> -    }
> -}
> -
> -void Nepomuk2::Utils::TypeFacet::clearSelection()
> -{
> -    kDebug();
> -    d->m_selectedTypes.clear();
> -    d->m_selectedCustomTypes.clear();
> -    d->m_customTypes.clear();
> -    d->setRootSelection(None);
> -    setLayoutChanged();
> -    setSelectionChanged();
> -    setQueryTermChanged();
> -}
> -
> -void Nepomuk2::Utils::TypeFacet::setSelected(int index, bool selected)
> -{
> -    kDebug() << index << selected;
> -    if( d->m_rootSelection == None ) {
> -        if( selected ) {
> -            if( index == 0 ) {
> -                d->setRootSelection(File);
> -                setLayoutChanged();
> -                setSelectionChanged();
> -            }
> -            else if( index == 1 ) {
> -                d->setRootSelection(Other);
> -                setLayoutChanged();
> -                setSelectionChanged();
> -            }
> -        }
> -    }
> -    else {
> -        if( selected ) {
> -            if( index > 0 ) {
> -                --index;
> -                if( index < d->m_usedTypes->count() ) {
> -                    kDebug() << "Checking fixed type" << index;
> -                    if( !d->m_selectedTypes.contains(index) ) {
> -                        d->m_selectedTypes.insert(index);
> -                        setSelectionChanged();
> -                        setQueryTermChanged();
> -                    }
> -                }
> -                else {
> -                    index -= d->m_usedTypes->count();
> -                    kDebug() << "Checking custom type" << index;
> -                    if( index < d->m_customTypes.count() ) {
> -                        if( !d->m_selectedCustomTypes.contains(index) ) {
> -                            d->m_selectedCustomTypes.insert(index);
> -                            setSelectionChanged();
> -                            setQueryTermChanged();
> -                        }
> -                    }
> -                }
> -            }
> -        }
> -        else {
> -            if( index == 0 ) {
> -                clearSelection();
> -            }
> -            else {
> -                --index;
> -                if( index < d->m_usedTypes->count() ) {
> -                    if( d->m_selectedTypes.contains(index) ) {
> -                        d->m_selectedTypes.remove(index);
> -                        setSelectionChanged();
> -                        setQueryTermChanged();
> -                    }
> -                }
> -                else {
> -                    index -= d->m_usedTypes->count();
> -                    if( index < d->m_customTypes.count() ) {
> -                        if( d->m_selectedCustomTypes.contains(index) ) {
> -                            d->m_selectedCustomTypes.remove(index);
> -                            setSelectionChanged();
> -                            setQueryTermChanged();
> -                        }
> -                    }
> -                }
> -            }
> -        }
> -    }
> -}
> -
> -bool Nepomuk2::Utils::TypeFacet::selectFromTerm(const Nepomuk2::Query::Term \
>                 &queryTerm)
> -{
> -    // 1. compare to all the terms in d->m_fileTypes and d->m_otherTypes
> -    // 2. check if it is a ResourceTypeTerm
> -    // 3. check if it is a negation of the file term
> -    // 4. check if it is an OrTerm and do the above with all terms in it
> -    // 5. do not add nfo:FileDataObject as a custom type!
> -
> -    int index = -1;
> -    RootSelection rootSel = None;
> -    if( d->findTerm( queryTerm, &index, &rootSel ) ) {
> -        if( d->m_rootSelection == None ||
> -                d->m_rootSelection == rootSel ) {
> -            d->m_selectedTypes.insert(index);
> -            setSelectionChanged();
> -            return true;
> -        }
> -    }
> -    else if( queryTerm.isResourceTypeTerm() ) {
> -        const Types::Class type = queryTerm.toResourceTypeTerm().type();
> -        if( type == Nepomuk2::Vocabulary::NFO::FileDataObject() ) {
> -            if( d->m_rootSelection == None ) {
> -                setSelected(0);
> -                return true;
> -            }
> -            else {
> -                return d->m_rootSelection == File;
> -            }
> -        }
> -        else {
> -            const RootSelection reqSel = \
>                 type.isSubClassOf(Nepomuk2::Vocabulary::NFO::FileDataObject()) ? \
>                 File : Other;
> -            if( d->m_rootSelection == None ) {
> -                d->setRootSelection(reqSel);
> -                d->m_customTypes.append(type);
> -                d->m_selectedCustomTypes.insert(d->m_customTypes.count()-1);
> -                setLayoutChanged();
> -                setSelectionChanged();
> -                setQueryTermChanged();
> -                return true;
> -            }
> -            else if( d->m_rootSelection == reqSel ) {
> -                if( !d->m_customTypes.contains(type) ) {
> -                    d->m_customTypes.append(type);
> -                    setLayoutChanged();
> -                }
> -                d->m_selectedCustomTypes.insert(d->m_customTypes.indexOf(type));
> -                setSelectionChanged();
> -                setQueryTermChanged();
> -                return true;
> -            }
> -        }
> -    }
> -    else if( queryTerm.isNegationTerm() &&
> -            queryTerm.toNegationTerm().subTerm().isResourceTypeTerm() &&
> -            queryTerm.toNegationTerm().subTerm().toResourceTypeTerm().type() == \
>                 Nepomuk2::Vocabulary::NFO::FileDataObject() ) {
> -        if( d->m_rootSelection == None ) {
> -            setSelected(1);
> -            return true;
> -        }
> -        else {
> -            return d->m_rootSelection == Other;
> -        }
> -    }
> -
> -    // fallback
> -    return false;
> -}
> -
> -#include "typefacet.moc"
> diff --git a/utils/typefacet.h b/utils/typefacet.h
> deleted file mode 100644
> index 3843db5..0000000
> --- a/utils/typefacet.h
> +++ /dev/null
> @@ -1,56 +0,0 @@
> -/*
> -   This file is part of the Nepomuk KDE project.
> -   Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 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 6 of version 3 of the license.
> -
> -   This library 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
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
> -*/
> -
> -#ifndef _NEPOMUK_TYPEFACET_H_
> -#define _NEPOMUK_TYPEFACET_H_
> -
> -#include "facet.h"
> -
> -namespace Nepomuk2 {
> -    namespace Utils {
> -
> -        class TypeFacet : public Nepomuk2::Utils::Facet
> -        {
> -            Q_OBJECT
> -
> -        public:
> -            TypeFacet( QObject *parent = 0 );
> -            ~TypeFacet();
> -
> -            SelectionMode selectionMode() const;
> -            Query::Term queryTerm() const;
> -            int count() const;
> -            KGuiItem guiItem( int index ) const;
> -            bool isSelected( int index ) const;
> -
> -        public Q_SLOTS:
> -            void clearSelection();
> -            void setSelected( int index, bool selected = true );
> -            bool selectFromTerm( const Nepomuk2::Query::Term& queryTerm );
> -
> -        private:
> -            class Private;
> -            Private* const d;
> -        };
> -    }
> -}
> -
> -#endif
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic