22 #include <tqdatetime.h>
23 #include <tqpopupmenu.h>
25 #include <tdelocale.h>
27 #include "kdatepickerpopup.h"
31 : TQPopupMenu( parent, name )
35 mDatePicker =
new KDatePicker(
this );
36 mDatePicker->setCloseButton(
false );
38 connect( mDatePicker, TQ_SIGNAL( dateEntered( TQDate ) ),
39 TQ_SLOT( slotDateChanged( TQDate ) ) );
40 connect( mDatePicker, TQ_SIGNAL( dateSelected( TQDate ) ),
41 TQ_SLOT( slotDateChanged( TQDate ) ) );
43 mDatePicker->setDate( date );
48 void KDatePickerPopup::buildMenu()
50 if ( isVisible() )
return;
53 if ( mItems & DatePicker ) {
54 insertItem( mDatePicker );
56 if ( ( mItems & NoDate ) || ( mItems & Words ) )
60 if ( mItems & Words ) {
61 insertItem( i18n(
"&Today"),
this, TQ_SLOT( slotToday() ) );
62 insertItem( i18n(
"To&morrow"),
this, TQ_SLOT( slotTomorrow() ) );
63 insertItem( i18n(
"Next &Week"),
this, TQ_SLOT( slotNextWeek() ) );
64 insertItem( i18n(
"Next M&onth"),
this, TQ_SLOT( slotNextMonth() ) );
66 if ( mItems & NoDate )
70 if ( mItems & NoDate )
71 insertItem( i18n(
"No Date"),
this, TQ_SLOT( slotNoDate() ) );
79 void KDatePickerPopup::setDate(
const TQDate &date )
81 mDatePicker->setDate( date );
85 void KDatePickerPopup::setItems(
int items )
92 void KDatePickerPopup::slotDateChanged( TQDate date )
98 void KDatePickerPopup::slotToday()
103 void KDatePickerPopup::slotTomorrow()
105 emit
dateChanged( TQDate::currentDate().addDays( 1 ) );
108 void KDatePickerPopup::slotNoDate()
113 void KDatePickerPopup::slotNextWeek()
115 emit
dateChanged( TQDate::currentDate().addDays( 7 ) );
118 void KDatePickerPopup::slotNextMonth()
120 emit
dateChanged( TQDate::currentDate().addMonths( 1 ) );
123 #include "kdatepickerpopup.moc"