On 07/23/2010 10:38 AM, Ivan Čukić wrote: >> by this score and combine that with the restrictions you list which can >> all be expressed using a single Term. > > Ok > >> kstandardactions) and add the method and the enum to the >> Nepomuk::Query::StandardQueries namespace. > > Yet another Ok :)
please check the attached header and tell me if the API is acceptable. I did not define special standard queries for "fav res of type X" since that ca easily be done via: Query q = standardQuery(MostImportantResourcesQuery); q.setTerm( ResourceTypeTerm(type) && q.term() ); Also I am not quite sure what "for an application" would mean in a query... - only resources that have an event related to the app - only resources of supported mimetype or resource type both do not really seem useful though as IMHO there would be too many false-negatives. Cheers, Sebastian
/* This file is part of the Nepomuk KDE project. Copyright (C) 2010 Sebastian Trueg <tr...@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_STANDARD_QUERIES_H_ #define _NEPOMUK_STANDARD_QUERIES_H_ #include "nepomukquery_export.h" #include <QtCore/QDate> namespace Nepomuk { namespace Query { class Query; /** * A set of predefined queries that can be created vis standardQuery(). * * \since 4.6 */ enum StandardQuery { /** * Creates a query that returns all files sorted by descending modification date. */ LastModifiedFilesQuery, /** * Creates a query that returns all resources sorted by descending score (as calculated * by the DataMaintenanceService) */ MostImportantResourcesQuery, /** * Creates a query that returns all files with a usage count of 0 * sorted by descending modification date. */ NeverOpenedFilesQuery }; /** * Modificators to influence the behaviour of dateRangeQuery(). * * \since 4.6 */ enum DateRangeFlag { /** * Query for the modification date (nie:lastModified) */ ModificationDate = 0x1, /** * Query for the content creation date (nie:contentCreated) */ ContentDate = 0x2, /** * Query for usage events referring to the resource. */ UsageDate = 0x4, /** * Query for all possible dates. */ AllDates = ModificationDate|ContentDate|UsageDate }; Q_DECLARE_FLAGS( DateRangeFlags, DateRangeFlag ) /** * Create a standard query as defined by \p query. * To get a query that only returns files (this is already true for some of the predefined queries) * use something like the following: * * \code * Query::FileQuery query = Query::standardQuery( Query::LastModifiedFilesQuery ); * \endcode * * \since 4.6 */ NEPOMUK_QUERY_EXPORT Query standardQuery( StandardQuery query ); /** * Create a query that returns resources/files that have been modified/accessed in the range * from \p start to \p end. The flags specified in \p dateFlags can be used to influence the * type of dates that are queried. * * \since 4.6 */ NEPOMUK_QUERY_EXPORT Query dateRangeQuery( const QDate& start, const QDate& end, DateRangeFlags dateFlags = AllDates ); } } Q_DECLARE_OPERATOR_FOR_FLAGS( Nepomuk::Query::DateRangeFlags ) #endif
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel