2 This file is part of libkdepim.
4 Copyright (c) 2004 Bram Schoenmakers <bramschoenmakers@kde.nl>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
21 #ifndef KDATEPICKERPOPUP_H
22 #define KDATEPICKERPOPUP_H
27 #include <kdepim_export.h>
28 #include <kdatepicker.h>
31 @short This menu helps the user to select a date quickly.
33 This menu helps the user to select a date quicly. It offers various ways of selecting, e.g. with a KDatePicker or with words like "Tomorrow".
35 The available items are:
37 @li NoDate: A menu-item with "No Date". If chosen, the datepicker will emit a null QDate.
38 @li DatePicker: Show a KDatePicker-widget.
39 @li Words: Show items like "Today", "Tomorrow" or "Next Week".
41 When supplying multiple items, separate each item with a bitwise OR.
43 @author Bram Schoenmakers <bram_s@softhome.net>
45 class KDEPIM_EXPORT KDatePickerPopup
: public QMenu
50 enum ItemFlag
{ NoDate
= 1, DatePicker
= 2, Words
= 4 };
52 Q_DECLARE_FLAGS( Items
, ItemFlag
)
55 A constructor for the KDatePickerPopup.
57 @param items List of all desirable items, separated with a bitwise OR.
58 @param date Initial date of datepicker-widget.
59 @param parent The object's parent.
60 @param name The object's name.
62 KDatePickerPopup( Items items
= DatePicker
, const QDate
&date
= QDate::currentDate(),
63 QWidget
*parent
= 0 );
66 @return A pointer to the private variable mDatePicker, an instance of
69 KDatePicker
*datePicker() const;
71 void setDate( const QDate
&date
);
74 /** Set items which should be shown and rebuilds the menu afterwards. Only if the menu is not visible.
75 @param items List of all desirable items, separated with a bitwise OR.
77 void setItems( int items
= 1 );
79 /** @return Returns the bitwise result of the active items in the popup. */
80 int items() const { return mItems
; }
85 This signal emits the new date (selected with datepicker or other
88 void dateChanged ( const QDate
& );
91 void slotDateChanged ( const QDate
& );
102 KDatePicker
*mDatePicker
;
106 Q_DECLARE_OPERATORS_FOR_FLAGS( KDatePickerPopup::Items
)