2
This file is part of libkdepim.
4
Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
5
Copyright (c) 2002 David Jarvie <software@astrojar.org.uk>
6
Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Library General Public
10
License as published by the Free Software Foundation; either
11
version 2 of the License, or (at your option) any later version.
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
Library General Public License for more details.
18
You should have received a copy of the GNU Library General Public License
19
along with this library; see the file COPYING.LIB. If not, write to
20
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
Boston, MA 02110-1301, USA.
27
#include "kdatepickerpopup.h"
33
#include <QMouseEvent>
38
A date editing widget that consists of an editable combo box.
39
The combo box contains the date in text form, and clicking the combo
40
box arrow will display a 'popup' style date picker.
42
This widget also supports advanced features like allowing the user
43
to type in the day name to get the date. The following keywords
44
are supported (in the native language): tomorrow, yesterday, today,
45
monday, tuesday, wednesday, thursday, friday, saturday, sunday.
47
@image html kdateedit.png "This is how it looks"
49
@author Cornelius Schumacher <schumacher@kde.org>
50
@author Mike Pilone <mpilone@slac.com>
51
@author David Jarvie <software@astrojar.org.uk>
52
@author Tobias Koenig <tokoe@kde.org>
54
class KDateEdit : public QComboBox
59
explicit KDateEdit( QWidget *parent = 0, const char *name = 0 );
63
@return The date entered. This date could be invalid,
64
you have to check validity yourself.
69
Sets whether the widget is read-only for the user. If read-only, the
70
date pop-up is inactive, and the displayed date cannot be edited.
72
@param readOnly True to set the widget read-only, false to set it read-write.
74
void setReadOnly( bool readOnly );
77
@return True if the widget is read-only, false if read-write.
79
bool isReadOnly() const;
81
virtual void showPopup();
85
This signal is emitted whenever the user has entered a new date.
86
When the user changes the date by editing the line edit field,
87
the signal is not emitted until focus leaves the line edit field.
88
The passed date can be invalid.
90
void dateEntered( const QDate &date );
93
This signal is emitted whenever the user modifies the date.
94
The passed date can be invalid.
96
void dateChanged( const QDate &date );
102
@param date The new date to display. This date must be valid or
105
void setDate( const QDate &date );
108
void lineEnterPressed();
109
void slotTextChanged( const QString & );
110
void dateSelected( const QDate & );
113
virtual bool eventFilter( QObject *, QEvent * );
114
virtual void mousePressEvent( QMouseEvent * );
115
virtual void focusOutEvent( QFocusEvent * );
116
virtual void keyPressEvent( QKeyEvent * );
119
Sets the date, without altering the display.
120
This method is used internally to set the widget's date value.
121
As a virtual method, it allows derived classes to perform additional
122
validation on the date value before it is set. Derived classes should
123
return true if QDate::isValid(@p date) returns false.
125
@param date The new date to set.
126
@return True if the date was set, false if it was considered invalid and
129
virtual bool assignDate( const QDate &date );
132
Fills the keyword map. Reimplement it if you want additional keywords.
134
void setupKeywords();
137
QDate parseDate( bool *replaced = 0 ) const;
140
KDatePickerPopup *mPopup;
145
bool mDiscardNextMousePress;
147
QMap<QString, int> mKeywordMap;