This is a common snippet of code in applets. It prevents applet from
re-expanding again when user clicks on the compact representation when
the applet is already expanded and located on a desktop containment.
See also: 79bcefdd35
FIXED-IN: 5.24.7 5.25.4 5.26
dateTimeChanged is called every second. This in turn checks if the date
has changed. If so we call setupLabels which updates the clock.
The date label used to use main.currentTime which is a value set in the
binding of the timeLabel's text property. The order of this being
updated vs running this code is undefined.
Bug 1: We compare an ever so slightly different date source to the one
used in the date text label.
Bug 2: We are not necessarily updating the date label with the most
updated time.
Overall we can't mix declarative and imperative design patterns. This
patch commits to being imperative and introduces a function to get the
current time so that the date label and time label will always get the
most up to date value even if they update from different trigers.
BUG: 452554
FIXED-IN: 5.24.5
Unlike when the clock is in a panel, there is plenty of space when it is
on the desktop. This means that we can safely let the date string word
wrap rather than shrink.
BUG: 450632
FIXED-IN: 5.24.3
cd68df165a
added a setting to force the date to be at the same line as the time.
Add another option to that setting to force the date to be below the
time.
This warning happens because the Digital Clock is using PC2 labels,
which set the pointSize internally. However in this usage of them, we
don't use the pointSize and instead set the pixelSize to make the label
always match the height of a size helper item. This results in both
pointSize and pixelSize being defined. This is an ambiguous situation,
so Qt helpfully ignores pointSize in favor of pixelSize and prints a
warning for us.
Because what we're doing here is intentional, let's explicitly unset
pointSize ourselves so we don't make Qt do it for us. This removes the
noisy warning message that is printed at every plasmashell startup.
Ultimately we need to port these labels to PC3, but that is quite
challenging due to the complicated text sizing logic.
We ported units to use the PlasmaCore.Units singleton earlier; now it's
time to do the same thing for PlasmaCore.Theme.
There are no UI changes or regressions detected.
The context property version is slower to access and won't be supported
in Qt6. Let's port away from it and use the singleton version instead.
Here was my full process for making this change:
1. Made the change with `find . -name '*.qml' | xargs perl -pi -e 's/units\./PlasmaCore\.Units\./g'`
2. Verified no more occurrences with `grep -r " units."`
3. Made sure this didn't change any comments in a silly way by inspecting the output of `git diff | grep "+ " | grep "//"`
4. Manually inspected the full git diff to make sure there were no other unintentional or silly changes (there were none)
5. verified that all changed files have the PlasmaCore import with the correct name with `for FILE in `git status | grep modified | cut -d ":" -f 3`; do grep -q "as PlasmaCore" $FILE || echo "$FILE needs the PlasmaCore import"; done`
After the rest of the UI changes made to the applet and the time zone
config page, I don't think users will be confused by the differences
between the timezone displayed in the clock, and the systemwide local
timezone anymore. Therefore, it should be safe enough to bring back the
wheely time feature.
BUG: 431977
the Text.Fit sizing policy will size the font in order to fit given a fixed
size of the label, but it can't really cause the other way around which we need:
cause a vertical resize in order to accomodate a larger font.
In order to fake that, we fix the date label to an arbitrary tall height
(will overflow outside the applet) and then size the applet based on the label contentheight instead,
leaving the invisible part of the label outside.
In order to avoid the huge text it used to have, limit the maximum size to an arbitrarly
small value, in this case
Math.min(0.7 * timeLabel.height, theme.defaultFont.pixelSize * 1.4)
BUG:417852
FIXED-IN: 5.21
Right now we have a usability problem: the Digital Clock applet has two
ways to let you change the timezone displayed in the applet itself, but
has no easy link to the correct way to change the timezone systemwide. As
a result, users change the timezone in the clock and wonder why times are
wrong everywhere else throughout the OS.
This commit removes the feature of changing the timezone in just the
clock, and replaces it with an overhauled Time Zones page in the config
dialog and a new button in the popup that links you to the Date & Time
KCM where you can change the systemwide time zone in the correct way.
I anticipate that this may cause some grumbling from people who currently
use the "mouse wheel to cycle through timezones" behavior, but now that
all the timezones and their times are displayed prominently in the popup,
you can just click on the applet to show the popup instead of rolling the
mouse wheel over it to cycle through times; it's different, but no worse.
BUG: 428096
FIXED-IN: 5.21
This begins the process of porting plasma-workspace to PlasmaComponents3. At
this point, only the relatively easy work is done. Every file not ported
now has been given the reason for still using PC2 in a comment on the import
line so you can see at a glance what the blocker is by running
`grep -r "org.kde.plasma.components 2.0"` in the repo.
Everything is tested and there are no breakages or functional regressions. In
the process, a few unused imports are removed.
Here are the remaining PC3 omissions blocking what's left from getting easily
ported:
- No Highlight
- No ListItem
- No PageStack
- No ContextMenu
- No QueryDialog
- No ModelContextMenu
- TabBar has no left and right tab states
- ToolButton has no built-in method to show a menu when clicked
Summary:
This patch fixes several errors in the code:
- The property is named `font.minimumPixelSize`, not `minimumPixelSize`
- The calculation in `minimumPixelSize` did not make sense
- Setting the height to `dateLabel.paintedHeight` is nonsensical
BUG: 417852
FIXED-IN: 5.18.4
Test Plan: {F8186873}
Reviewers: #vdg, #plasma, cblack, davidedmundson
Reviewed By: #vdg, #plasma, cblack, davidedmundson
Subscribers: davidedmundson, cblack, muesli, plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D28172
Summary: The clock was too close to the panel right edge when displaying hours beginning with 10, 11 and 12. Weirdly enough, the right margin was different based on the clock current time. This patch makes the margin constantly equal to the one that there was before when displaying 10,11,12 plus units.smallSpacing.
Reviewers: #vdg, #plasma, davidedmundson, ngraham
Reviewed By: #vdg, #plasma, davidedmundson, ngraham
Subscribers: gvgeo, davidedmundson, ngraham, plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D27737
Summary:
BUG: 381551
FIXED-IN: 5.18.0
Test Plan:
Before: {F7851382, size=full}
After: {F7851383, size=full}
Texted extensively because this code is so brittle. No regressions with long date in a
thick or normal-sized horizontal panel or short date in a thick or normal-sized
horizontal or vertical panel.
The one issue I could find is that sometimes switching between short and long date
formats in a double-thickness vertical panel causes the long date to be truncated again
until plasmashell is restarted. I was unable to determine why. Assistance would be
appreciated if this is a blocker.
Reviewers: #plasma, #vdg, ndavis
Reviewed By: #vdg, ndavis
Subscribers: ndavis, plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D26312
Summary:
Changes the height of the date string to match that of the
time string so the date is readable with a vertical panel
BUG: 404611
Reviewers: #vdg, #plasma, davidedmundson, Zren, ngraham, rooty
Reviewed By: #vdg, ngraham, rooty
Subscribers: rooty, cfeck, mart, ngraham, davidedmundson, Zren, abetts, anthonyfieroni, plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D19194
Adds a new customDateFormat config key which is used when the dateFormat "StringEnum" is set to custom.
Shows a link to the Qt time formatting documentation next to the text field.
Qt doc link and text field are hidden when not set to custom date format.
CCBUG: 340982
Differential Revision: https://phabricator.kde.org/D18019
This patch makes the digital clock use a smaller font when used in a
horizontal form factor.
BUG:375969
Test Plan: Play with the widget settings in different panels/desktop
Reviewers: #plasma, #vdg, romangg
Reviewed By: #plasma, romangg
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D6764
Summary:
- Fixed timezone size and alignment in vertical mode
- Instead of `Flow` use `Grid` for labels as it's simpler and gives better
control over alignment
- Seperator in small horizontal mode centered between date and time and in
height now dependent on label size
- Less empty space around time in small horizontal mode
- Binding loop and initlializting anchor errors fixed
- Elements now size completely down and have always the same ratio to each other
with the time label being the largest
- Round functions removed since they disrupted the resizing for small sizes
- Introduce max font size values for text elements in panel mode
BUG: 367585
BUG: 360059
BUG: 373396
Reviewers: #plasma, mart
Subscribers: mart, plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D3630
Summary:
The clock in the vertical panel can't fit, it won't word wrap as the
clock is only one word long - so it needs to have a horizontalFit size
mode (without a minimum size) so that the text always fits without being
clipped.
This brings the vertical state in line with the horizontalSmall state
which also sets a minimumPointSize of 0.
Reviewers: #plasma
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D2644
Summary:
Digital Clock sets fontSizeMode, this scales the font to fit between a
tiny size and a the given size.
In older Qt this used to be between 0 and pixel size - but because
Plasma.Components.Label already set the pointSize we had to set both.
In Qt 5.6 it seems to handle either type of font size being set, so we can
keep with just one.
Test Plan:
Clock still scales to fill space
Clock still switches into compact mode if needed
Reviewers: #plasma, sebas
Reviewed By: #plasma, sebas
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D1974
Currently, "Show seconds" has no effect with certain locales (C e.g.)
that already contain the seconds in the ShortFormat.
The reason is that the seconds are only added to the format string
that's used to display the time if they are not part of timeFormatString
already (which is not used at all for the display).
This patch fixes that check and adds them only depending on the
showSeconds config option.
REVIEW: 127623
In kde4 times, the layout of clock's tooltip was nicely arranged using a
table. Now it's a bit of a mess so this brings back some nice layout.
Also simplifies the timeForZone function which is used only for the
tooltip.
BUG: 357005
BUG: 351472
CCBUG: 357004
FIXED-IN: 5.6.0
REVIEW: 124047
When the user selects another timezone and deselects the current one,
the clock timezone should change immediately.
REVIEW: 125709
BUG: 353996
BUG: 348612
Otherwise the text eliding works really weird (eg. at some point date is
not elided and when you make the panel wider it gets elided).
BUG: 351768
FIXED-IN: 5.4.3
REVIEW: 125625
property tooSmall depends on height
If it's tool small it changes what text is shown on top of each other
Whether text is shown changes the height; super complex binding loop
that because it throws in a visibility change and goes via layouts isn't
being caught.
From what I can tell of other code when vertical we always want to show
both bits of text.
BUG: 351479
REVIEW: 124874
In my opinion this is just a temporary workaround and not a very good
one (generally, code-wise it's awesome :P). There should really be a
global config option for that but as we now rely on QLocale and QLocale
is...bad at this, here's at least this small help, which will at least
change the clock format on the panel.
Imo we could really really use something like KLocale again.
REVIEW: 124453
BUG: 345378
FIXED-IN: 5.4.0
One of the most reported bugs wrt digital clock is that the second line
text (date or timezone) is unreadable on small panels so this adds new
state to the clock applet that lays things horizontally when the panel
is too small to show text with the "small" font (set in system
settings).
When there is a date displayed, a delimiter is put in between to allow
easier and faster spotting the time (as on a first glance there is just
a bunch of numbers, so quickly orienteering is super important). I used
the dot symbol first but then went for pipe which I think looks more
clean.
REVIEW: 124449
CCBUG: 348072