• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk
  • utils
datefacet.h
Go to the documentation of this file.
1 /*
2  This file is part of the Nepomuk KDE project.
3  Copyright (C) 2010 Sebastian Trueg <trueg@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) version 3, or any
9  later version accepted by the membership of KDE e.V. (or its
10  successor approved by the membership of KDE e.V.), which shall
11  act as a proxy defined in Section 6 of version 3 of the license.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef _NEPOMUK_QUERY_DATE_FACET_H_
23 #define _NEPOMUK_QUERY_DATE_FACET_H_
24 
25 #include "facet.h"
26 
27 class DateRange;
28 
29 namespace Nepomuk {
30  namespace Utils {
58  class DateFacet : public Facet
59  {
60  Q_OBJECT
61 
62  public:
67  DateFacet( QObject* parent = 0 );
68 
72  virtual ~DateFacet();
73 
78  Query::Term queryTerm() const;
79 
85  SelectionMode selectionMode() const;
86 
90  int count() const;
91 
92  KGuiItem guiItem( int index ) const;
93  bool isSelected( int index ) const;
94 
103  enum DateRangeCandidate {
105  NoDateRange = 0x0,
106 
108  Anytime = 0x1,
109 
111  Today = 0x2,
112 
114  Yesterday = 0x4,
115 
117  ThisWeek = 0x8,
118 
120  LastWeek = 0x10,
121 
123  ThisMonth = 0x20,
124 
126  LastMonth = 0x40,
127 
129  ThisYear = 0x80,
130 
132  LastYear = 0x100,
133 
136  CustomDateRange = 0x10000,
137 
139  DefaultRanges = Anytime|Today|ThisWeek|ThisMonth|ThisYear|CustomDateRange
140  };
141  Q_DECLARE_FLAGS( DateRangeCandidates, DateRangeCandidate )
142 
143 
147  void setDateRangeCandidates( DateRangeCandidates ranges );
148 
153  DateRangeCandidates dateRangeCandidates() const;
154 
155  public Q_SLOTS:
161  void clearSelection();
162 
167  void setSelected( int index, bool selected = true );
168 
176  bool selectFromTerm( const Nepomuk::Query::Term& queryTerm );
177 
178  protected:
188  virtual Query::Term createDateRangeTerm( const DateRange& range ) const;
189 
201  virtual DateRange extractDateRange( const Query::Term& queryTerm ) const;
202 
219  virtual DateRange getCustomRange( bool* ok = 0 ) const;
220 
221  private:
222  class Private;
223  Private* const d;
224  };
225  }
226 }
227 
228 #endif
Nepomuk::Utils::DateFacet::LastWeek
a date range that includes all days from the last week, ie. that before the current one ...
Definition: datefacet.h:120
DateRange
A simple data structure storing a start and an end date.
Definition: daterange.h:41
Nepomuk::Utils::DateFacet::ThisWeek
a date range that includes all days from the current week up to today
Definition: datefacet.h:117
Nepomuk::Utils::DateFacet::DateRangeCandidate
DateRangeCandidate
Using fixed QDate values would result in invalid queries as soon as an application runs over the span...
Definition: datefacet.h:103
Nepomuk::Utils::DateFacet::LastMonth
a date range that includes all days from the last month, ie. that before the current one ...
Definition: datefacet.h:126
Nepomuk::Utils::DateFacet::setDateRangeCandidates
void setDateRangeCandidates(DateRangeCandidates ranges)
Set the date ranges this facet should provide.
Nepomuk::Utils::DateFacet::selectFromTerm
bool selectFromTerm(const Nepomuk::Query::Term &queryTerm)
Select the current date range based on term.
Nepomuk::Utils::DateFacet::createDateRangeTerm
virtual Query::Term createDateRangeTerm(const DateRange &range) const
Create the query Term that reflects the dates specified in range.
Nepomuk::Utils::DateFacet::NoDateRange
no date range
Definition: datefacet.h:105
Nepomuk::Utils::DateFacet::CustomDateRange
a custom range - this will enable a special item that if selection will open a dialog allowing the us...
Definition: datefacet.h:136
Nepomuk::Utils::DateFacet::Anytime
no restriction on the date
Definition: datefacet.h:108
QObject
Nepomuk::Utils::DateFacet::clearSelection
void clearSelection()
Resets the current range to the default value which is the first in the list of candidates.
Nepomuk::Utils::DateFacet::DateFacet
DateFacet(QObject *parent=0)
Creates a new date facet which contains the DefaultRanges date range candidates as choices...
Nepomuk::Utils::DateFacet::isSelected
bool isSelected(int index) const
Nepomuk::Utils::Facet::SelectionMode
SelectionMode
A Facet can have one of three selection modes which is provided by selectionMode().
Definition: facet.h:93
Nepomuk::Utils::DateFacet::Yesterday
a date range which uses QDate::today().addDays(-1) for start and end
Definition: datefacet.h:114
Nepomuk::Utils::DateFacet
A Facet that provides a set of date ranges.
Definition: datefacet.h:58
Nepomuk::Utils::Facet
The base class for all facets used to create query filters.
Definition: facet.h:74
Nepomuk::Utils::DateFacet::getCustomRange
virtual DateRange getCustomRange(bool *ok=0) const
Retrieve a custom date range typically from the user.
Nepomuk::Query::Term
The base class for all term types.
Definition: term.h:64
Nepomuk::Utils::DateFacet::Today
a date range which uses QDate::today() for start and end
Definition: datefacet.h:111
Nepomuk::Utils::DateFacet::ThisYear
a date range that includes all days from the current year up to today
Definition: datefacet.h:129
facet.h
Nepomuk::Utils::DateFacet::extractDateRange
virtual DateRange extractDateRange(const Query::Term &queryTerm) const
This is the counterpart method to createDateRangeTerm().
Nepomuk::Utils::DateFacet::~DateFacet
virtual ~DateFacet()
Destructor.
Nepomuk::Utils::DateFacet::setSelected
void setSelected(int index, bool selected=true)
Change the currently selected date range.
Nepomuk::Utils::DateFacet::DefaultRanges
the defaults this facet starts with
Definition: datefacet.h:139
Nepomuk::Utils::DateFacet::ThisMonth
a date range that includes all days from the current month up to today
Definition: datefacet.h:123
Nepomuk::Utils::DateFacet::LastYear
a date range that includes all days from the last year, ie. that before the current one ...
Definition: datefacet.h:132
Nepomuk::Utils::DateFacet::guiItem
KGuiItem guiItem(int index) const
The parameters used to render the choice at index.
Nepomuk::Utils::DateFacet::selectionMode
SelectionMode selectionMode() const
The selection mode in the date facet is fixed to MatchOne, ie.
Nepomuk::Utils::DateFacet::queryTerm
Query::Term queryTerm() const
Creates a query term for the currently selected date range.
Nepomuk::Utils::DateFacet::count
int count() const
Nepomuk::Utils::DateFacet::dateRangeCandidates
DateRangeCandidates dateRangeCandidates() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk

Skip menu "Nepomuk"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal