Nepomuk
datefacet.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the Nepomuk KDE project. 00003 Copyright (C) 2010 Sebastian Trueg <trueg@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) version 3, or any 00009 later version accepted by the membership of KDE e.V. (or its 00010 successor approved by the membership of KDE e.V.), which shall 00011 act as a proxy defined in Section 6 of version 3 of the license. 00012 00013 This library is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 #ifndef _NEPOMUK_QUERY_DATE_FACET_H_ 00023 #define _NEPOMUK_QUERY_DATE_FACET_H_ 00024 00025 #include "facet.h" 00026 00027 class DateRange; 00028 00029 namespace Nepomuk { 00030 namespace Utils { 00058 class DateFacet : public Facet 00059 { 00060 Q_OBJECT 00061 00062 public: 00067 DateFacet( QObject* parent = 0 ); 00068 00072 virtual ~DateFacet(); 00073 00078 Query::Term queryTerm() const; 00079 00085 SelectionMode selectionMode() const; 00086 00090 int count() const; 00091 00092 KGuiItem guiItem( int index ) const; 00093 bool isSelected( int index ) const; 00094 00103 enum DateRangeCandidate { 00105 NoDateRange = 0x0, 00106 00108 Anytime = 0x1, 00109 00111 Today = 0x2, 00112 00114 Yesterday = 0x4, 00115 00117 ThisWeek = 0x8, 00118 00120 LastWeek = 0x10, 00121 00123 ThisMonth = 0x20, 00124 00126 LastMonth = 0x40, 00127 00129 ThisYear = 0x80, 00130 00132 LastYear = 0x100, 00133 00136 CustomDateRange = 0x10000, 00137 00139 DefaultRanges = Anytime|Today|ThisWeek|ThisMonth|ThisYear|CustomDateRange 00140 }; 00141 Q_DECLARE_FLAGS( DateRangeCandidates, DateRangeCandidate ) 00142 00143 00147 void setDateRangeCandidates( DateRangeCandidates ranges ); 00148 00153 DateRangeCandidates dateRangeCandidates() const; 00154 00155 public Q_SLOTS: 00161 void clearSelection(); 00162 00167 void setSelected( int index, bool selected = true ); 00168 00176 bool selectFromTerm( const Nepomuk::Query::Term& queryTerm ); 00177 00178 protected: 00188 virtual Query::Term createDateRangeTerm( const DateRange& range ) const; 00189 00201 virtual DateRange extractDateRange( const Query::Term& queryTerm ) const; 00202 00219 virtual DateRange getCustomRange( bool* ok = 0 ) const; 00220 00221 private: 00222 class Private; 00223 Private* const d; 00224 }; 00225 } 00226 } 00227 00228 #endif
KDE 4.6 API Reference