KDatePicker improvements

Jakob Petsovits jpetso at gmx.at
Thu Nov 22 10:05:53 GMT 2007

Hi list,

originally, I just wanted to get rid of the arrow-{left,right}[-double] icons 
in KDatePicker, but as it's hard to take stuff away from something that's 
already good, I could not only remove icons but needed to provide a 
replacement that works better than the current solution.

So, the following KDatePicker improvements are the result of a bunch of
UI peer reviews on the usability list, and should thus hopefully make for a 
better user experience.

Current: http://jakob.petsovits.at/files-jakob/image/kdatepicker-current.png
Modified: http://jakob.petsovits.at/files-jakob/image/kdatepicker-new.png

The main change is that the next/previous arrows are directly positioned next 
to each of the year and month displays, as the discoverability of the two 
different kinds of arrows is not quite ideal. So the year and month are now 
positioned vertically (the horizontal direction is needed for the arrows), 
which makes some other layout changes necessary, or better, possible :)

The whole year/month/week/go-to-today navigation is now concentrated in one 
place (at the top of the widget) instead of being split up between top and 
bottom. The direct date line has been identified by Aaron as source to copy 
from, and lacking that much space I made the "copy to clipboard" 
functionality into a button (which invokes a context menu with short or long 
date format to be copied).

While working on this, I also came up with some other fixes:

* Fix a grave bug where the week selector selects other weeks than it should,
  for example for 2007 (try selecting "week 46"). After the treatment, it not
  only works now but even remembers the current day of week, which it did not
  ever do before.

* Embed the year line edit into the date picker instead of putting it into a
  popup. It's much more natural now, you can edit the years directly in place.

* Fix the calculation of the minimum size for the month toolbutton.
  On my system, it missed out on about 12 pixels of additional margin
  which caused the next/previous month icons to hop around.

* Fix focus issues. That makes it possible for KFind's KDateCombo not to
  install an event filter that catches Enter key presses; instead, KFind can
  now rely on dateSelected() being emitted in any case.

* Replace calendar()->setYMD() by calendar()->setDate(), as the former
  is deprecated.

* ...and as you would have suspected, I fixed the icon names properly.

Now this patch is binary compatible, but it comes with three slight drawbacks:

- In order to keep BC, I abused lineEnterPressed() and changed its
  behaviour - which wasn't documented before, either. Before, it handled
  the full-date line edit (which is now gone), whereas now it handles the
  year line edit which has moved out of the popup and into the widget.
  lineEnterPressed() is protected, but not actively used in all of the
  SVN repository, so I hope I can get away with that =)
  Alternatively, I could break BC and call it yearLineChanged() instead.

- As the full-date line edit is gone, the dateEntered() signal is not emitted
  anymore. This is more logical since dateSelected() covers its purpose
  anyways (which is signaling the final selection of the desired date),
  and should not be harmful as the apidox did recommend to connect to
  both dateSelected() and dateEntered(). I guess we could just mark
  dateEntered as deprecated. (How is this done with signals?)

- There's two new i18n strings, "Copy date to clipboard" (as tooltip)
  and "Copy to clipboard" (as context menu title). If it is decided that
  I must not introduce those, I can fall back to "Copy" for the tooltip
  and leave out the context menu title, but I'd like to keep them
  (and ask the translators list once the patch has gotten through k-c-d).

* is the patch ok from a technical point of view?
* ok to apply? if yes, instantly or on Monday?
* if no, what do I need to leave out?

Thanks for your patience,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdatepicker-usability-attempt-try3.diff
Type: text/x-diff
Size: 30840 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071122/c8979d25/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kfind-fix-datecombo.diff
Type: text/x-diff
Size: 915 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071122/c8979d25/attachment-0001.diff>
-------------- next part --------------
kde-usability mailing list
kde-usability at kde.org

More information about the kde-core-devel mailing list