Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kalendar
Commits
63c75266
Commit
63c75266
authored
Nov 01, 2021
by
Claudio Cambra
Browse files
Week view now pulls hour labels from C++, solving a littany of bugs and workarounds
parent
b64db3ff
Pipeline
#93049
passed with stage
in 4 minutes and 29 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/contents/ui/WeekView.qml
View file @
63c75266
...
...
@@ -46,21 +46,6 @@ Kirigami.Page {
readonly
property
real
hourLabelWidth
:
Kirigami
.
Units
.
gridUnit
*
3.5
property
var
hourStrings
:
[]
Component.onCompleted
:
{
// Start at 01:00 and add hours up to 23:00
const
date
=
new
Date
(
1
,
1
,
1
,
1
,
0
,
0
,
0
);
let
i
=
Number
(
date
.
toLocaleTimeString
(
Qt
.
locale
(),
"
H
"
)[
0
]);
if
(
i
!==
1
)
{
// Work around Javascript's absolutely stupid, insane and infuriating summertime hour handling
i
-=
i
;
}
for
(
i
;
i
<
24
;
i
++
)
{
date
.
setHours
(
i
,
0
,
0
,
0
);
hourStrings
.
push
(
date
.
toLocaleTimeString
(
Qt
.
locale
(),
Locale
.
NarrowFormat
));
hourStringsChanged
();
}
}
Kirigami.Theme.inherit
:
false
Kirigami.Theme.colorSet
:
Kirigami
.
Theme
.
View
...
...
@@ -571,7 +556,7 @@ Kirigami.Page {
id
:
fontMetrics
}
model
:
root
.
hourString
s
model
:
pathView
.
model
.
weekViewLocalisedHourLabels
// Not a model role but instead one of the model object's propertie
s
delegate
:
QQC2.Label
{
height
:
(
Kirigami
.
Units
.
gridUnit
*
hourlyView
.
periodsPerHour
)
width
:
root
.
hourLabelWidth
...
...
src/incidencewrapper.cpp
View file @
63c75266
...
...
@@ -293,7 +293,6 @@ QDateTime IncidenceWrapper::incidenceEnd() const
void
IncidenceWrapper
::
setIncidenceEnd
(
const
QDateTime
&
incidenceEnd
,
bool
respectTimeZone
)
{
qDebug
()
<<
"setEnd"
;
QDateTime
end
;
if
(
respectTimeZone
)
{
end
=
incidenceEnd
;
...
...
src/infinitecalendarviewmodel.cpp
View file @
63c75266
...
...
@@ -15,6 +15,15 @@ InfiniteCalendarViewModel::InfiniteCalendarViewModel(QObject *parent)
void
InfiniteCalendarViewModel
::
setup
()
{
const
QDate
today
=
QDate
::
currentDate
();
QTime
time
;
if
(
!
m_weekViewLocalisedHourLabels
.
length
())
{
m_weekViewLocalisedHourLabels
.
clear
();
for
(
int
i
=
1
;
i
<
24
;
i
++
)
{
time
.
setHMS
(
i
,
0
,
0
);
m_weekViewLocalisedHourLabels
.
append
(
QLocale
::
system
().
toString
(
time
,
QLocale
::
NarrowFormat
));
}
}
switch
(
m_scale
)
{
case
WeekScale
:
{
...
...
src/infinitecalendarviewmodel.h
View file @
63c75266
...
...
@@ -14,6 +14,7 @@ class InfiniteCalendarViewModel : public QAbstractListModel
// Amount of dates to add each time the model adds more dates
Q_PROPERTY
(
int
datesToAdd
READ
datesToAdd
WRITE
setDatesToAdd
NOTIFY
datesToAddChanged
)
Q_PROPERTY
(
int
scale
READ
scale
WRITE
setScale
NOTIFY
scaleChanged
)
Q_PROPERTY
(
QStringList
weekViewLocalisedHourLabels
MEMBER
m_weekViewLocalisedHourLabels
)
public:
// The decade scale is designed to be used in a 4x3 grid, so shows 12 years at a time
...
...
@@ -55,6 +56,7 @@ Q_SIGNALS:
private:
QVector
<
QDate
>
m_startDates
;
QVector
<
QDate
>
m_firstDayOfMonthDates
;
QStringList
m_weekViewLocalisedHourLabels
;
QLocale
m_locale
;
int
m_datesToAdd
=
10
;
int
m_scale
=
MonthScale
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment