Unverified Commit 8eb6fb54 authored by Carl Schwan's avatar Carl Schwan 🚴
Browse files

Fix regression caused by creating a KalendarApplication::Mode per view



Check for condition using the bit flags instead of exact matches

Signed-off-by: Carl Schwan's avatarCarl Schwan <carl@carlschwan.eu>
parent a93a9eb2
Pipeline #227183 passed with stage
in 2 minutes and 4 seconds
......@@ -100,7 +100,7 @@ Kirigami.OverlayDrawer {
id: searchField
Layout.fillWidth: true
visible: mainDrawer.mode !== KalendarApplication.Event
visible: mainDrawer.mode & (KalendarApplication.Todo | KalendarApplication.Mail | KalendarApplication.Contact)
opacity: mainDrawer.collapsed ? 0 : 1
Behavior on opacity {
OpacityAnimator {
......@@ -449,12 +449,10 @@ Kirigami.OverlayDrawer {
isMask: true
color: calendarHeadingItem.labelItem.color
}
text: switch (mode) {
case KalendarApplication.Event:
case KalendarApplication.Todo:
return i18n("Calendars");
case KalendarApplication.Contact:
return i18n("Contacts");
text: if (mode === KalendarApplication.Contact) {
return i18n("Contacts");
} else {
return i18n("Calendars");
}
highlighted: visualFocus
labelItem.color: visualFocus ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor
......@@ -479,12 +477,10 @@ Kirigami.OverlayDrawer {
model: switch(mainDrawer.mode) {
case KalendarApplication.Todo:
return CalendarManager.todoCollections;
case KalendarApplication.Event:
return CalendarManager.viewCollections;
case KalendarApplication.Contact:
return ContactManager.contactCollections;
default:
console.log('Should not happen', mainDrawer.mode)
return CalendarManager.viewCollections;
}
}
......
......@@ -36,7 +36,7 @@ QtObject {
}
}
if (appMain.pageStack.currentItem.mode === KalendarApplication.Event) {
if (appMain.pageStack.currentItem.mode & KalendarApplication.Event) {
appMain.pageStack.currentItem.setToDate(appMain.selectedDate, true);
}
}
......
......@@ -132,22 +132,22 @@ Labs.MenuBar {
NativeMenuItemFromAction {
kalendarAction: "move_view_backwards"
enabled: mode === KalendarApplication.Event
enabled: mode & KalendarApplication.Event
}
NativeMenuItemFromAction {
kalendarAction: "move_view_forwards"
enabled: mode === KalendarApplication.Event
enabled: mode & KalendarApplication.Event
}
Labs.MenuSeparator {}
NativeMenuItemFromAction {
kalendarAction: "move_view_to_today"
enabled: mode === KalendarApplication.Event
enabled: mode & KalendarApplication.Event
}
NativeMenuItemFromAction {
kalendarAction: "open_date_changer"
enabled: mode === KalendarApplication.Event
enabled: mode & KalendarApplication.Event
}
}
......
......@@ -203,22 +203,22 @@ QQC2.MenuBar {
KActionFromAction {
kalendarAction: "move_view_backwards"
enabled: mode === KalendarApplication.Event
enabled: mode & KalendarApplication.Event
}
KActionFromAction {
kalendarAction: "move_view_forwards"
enabled: mode === KalendarApplication.Event
enabled: mode & KalendarApplication.Event
}
QQC2.MenuSeparator {}
KActionFromAction {
kalendarAction: "move_view_to_today"
enabled: mode === KalendarApplication.Event
enabled: mode & KalendarApplication.Event
}
KActionFromAction {
kalendarAction: "open_date_changer"
enabled: mode === KalendarApplication.Event
enabled: mode & KalendarApplication.Event
}
}
......
......@@ -380,7 +380,7 @@ Kirigami.ApplicationWindow {
function onOpenIncidence(incidenceData, occurrenceDate) {
// Switch to an event view if the current view is not compatible with the current incidence type
if((pageStack.currentItem.mode !== KalendarApplication.Todo && pageStack.currentItem.mode !== KalendarApplication.Event) ||
if((pageStack.currentItem.mode & (KalendarApplication.Todo | KalendarApplication.Event) ||
(pageStack.currentItem.mode === KalendarApplication.Todo && incidenceData.incidenceType !== IncidenceWrapper.TypeTodo)) {
Kirigami.Settings.isMobile ? dayViewAction.trigger() : weekViewAction.trigger();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment