From kde-devel Thu Aug 14 15:31:33 2003 From: Martin Koller Date: Thu, 14 Aug 2003 15:31:33 +0000 To: kde-devel Subject: Re: [Patch] #48264: added a Today button in kdatepicker X-MARC-Message: https://marc.info/?l=kde-devel&m=106087537118359 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_Vt6O/Ur4TU449lS" --Boundary-00=_Vt6O/Ur4TU449lS Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Description: clearsigned data Content-Disposition: inline =2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi guys, > The other occurences of KDatePicker, where a today makes sense, are (than= ks > to lxr.kde.org): > -) kfind (there you don't have any other possibility to get to today) > -) kpilot's (not yet finished) calendar editor > -) kstars (added its own "Now" button to get around the missing button) > -) even in kcontrol's clock module it would make sense to have the today > button. Otherwise you'll have to switch to a different module, and then > enter the root password again. > > -) kgpg's key expiration dialog > -) knodes "subscribe" dialog (search for new groups) And don't forget the main point why I have added it: korganizer. Try to reschedule an overdue TODO item, when it has a due date already a fe= w=20 month ago ... And I'm pretty sure, that even in the kicker the today button makes sense: If you just want to quickly look for a certain date (e.g. what's the day of= =20 the week for the 8.December - holiday this year ?, etc.), its also nice to= =20 have the today button to go back and look for other dates quickly. Regarding the confusing User Interface Layout "Today Week 33", I provide wi= th=20 this patch an alternative solution: I have moved the "Today" Button to the= =20 left side of the Input field. Have a look at http://members.aon.at/m.koller/kdatepicker.png P.S: I have found another bug in kdatepicker: Try to enter 14.08.2003555 ... =2D --=20 Best regards/Sch=F6ne Gr=FC=DFe Martin Public key at: http://blackhole.pca.dfn.de:11371/pks/lookup?op=3Dget&search=3D0x8DFB0F86 =2D----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE/O6tVHmdPoI37D4YRAjEMAKDHljeyNFi6wozM30zdmjRreqFL+wCfeORL 92BdcLEPQYLrSEH5H716uWw=3D =3Dz7ke =2D----END PGP SIGNATURE----- --Boundary-00=_Vt6O/Ur4TU449lS Content-Type: application/octet-stream; name="patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch" Index: kdatepicker.cpp =================================================================== RCS file: /home/kde/kdelibs/kdeui/kdatepicker.cpp,v retrieving revision 1.60 diff -u -3 -p -r1.60 kdatepicker.cpp --- kdatepicker.cpp 17 Jul 2003 21:02:04 -0000 1.60 +++ kdatepicker.cpp 14 Aug 2003 15:31:00 -0000 @@ -45,11 +45,12 @@ class KDatePicker::KDatePickerPrivate { public: - KDatePickerPrivate() : closeButton(0L), selectWeek(0L), navigationLayout(0) {} + KDatePickerPrivate() : closeButton(0L), selectWeek(0L), todayButton(0), navigationLayout(0) {} KToolBar *tb; QToolButton *closeButton; QToolButton *selectWeek; + QToolButton *todayButton; QBoxLayout *navigationLayout; }; @@ -95,6 +96,9 @@ void KDatePicker::init( const QDate &dt d->selectWeek = new QToolButton( this ); d->selectWeek->setAutoRaise(true); + d->todayButton = new QToolButton(this); + d->todayButton->setAutoRaise(true); + d->todayButton->setText(i18n("Today")); QToolTip::add(yearForward, i18n("Next year")); QToolTip::add(yearBackward, i18n("Previous year")); @@ -103,6 +107,7 @@ void KDatePicker::init( const QDate &dt QToolTip::add(d->selectWeek, i18n("Select a week")); QToolTip::add(selectMonth, i18n("Select a month")); QToolTip::add(selectYear, i18n("Select a year")); + QToolTip::add(d->todayButton, i18n("Select the current day")); // ----- setFontSize(fontsize); @@ -120,6 +125,7 @@ void KDatePicker::init( const QDate &dt connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); connect(d->selectWeek, SIGNAL(clicked()), SLOT(selectWeekClicked())); + connect(d->todayButton, SIGNAL(clicked()), SLOT(todayButtonClicked())); connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); @@ -133,6 +139,7 @@ void KDatePicker::init( const QDate &dt topLayout->addWidget(table); QBoxLayout * bottomLayout = new QHBoxLayout(topLayout); + bottomLayout->addWidget(d->todayButton); bottomLayout->addWidget(line); bottomLayout->addWidget(d->selectWeek); } @@ -395,6 +402,12 @@ KDatePicker::lineEnterPressed() KNotifyClient::beep(); kdDebug(298) << "KDatePicker::lineEnterPressed: invalid date entered." << endl; } +} + +void +KDatePicker::todayButtonClicked() +{ + setDate(QDate::currentDate()); } QSize Index: kdatepicker.h =================================================================== RCS file: /home/kde/kdelibs/kdeui/kdatepicker.h,v retrieving revision 1.34 diff -u -3 -p -r1.34 kdatepicker.h --- kdatepicker.h 15 Feb 2003 03:14:01 -0000 1.34 +++ kdatepicker.h 14 Aug 2003 15:31:00 -0000 @@ -188,6 +188,8 @@ protected slots: void selectMonthClicked(); void selectYearClicked(); void lineEnterPressed(); + /// @since 3.2 + void todayButtonClicked(); signals: /** This signal is emitted each time the selected date is changed. * Usually, this does not mean that the date has been entered, --Boundary-00=_Vt6O/Ur4TU449lS Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --Boundary-00=_Vt6O/Ur4TU449lS--