Move all the enums for push rules into their own header file
This commit is contained in:
@@ -44,7 +44,7 @@ FormCard.FormCardPage {
|
||||
sourceModel: root.pushRuleModel
|
||||
filterRowCallback: function(source_row, source_parent) {
|
||||
let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole)
|
||||
return sectionRole == PushNotificationSection.Room;
|
||||
return sectionRole == PushRuleSection.Room;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ FormCard.FormCardPage {
|
||||
sourceModel: root.pushRuleModel
|
||||
filterRowCallback: function(source_row, source_parent) {
|
||||
let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole)
|
||||
return sectionRole == PushNotificationSection.Mentions;
|
||||
return sectionRole == PushRuleSection.Mentions;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ FormCard.FormCardPage {
|
||||
|
||||
filterRowCallback: function(source_row, source_parent) {
|
||||
let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole)
|
||||
return sectionRole == PushNotificationSection.Keywords;
|
||||
return sectionRole == PushRuleSection.Keywords;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ FormCard.FormCardPage {
|
||||
Layout.fillWidth: true
|
||||
|
||||
placeholderText: i18n("Keyword…")
|
||||
enabled: NotificationsManager.keywordNotificationAction !== PushNotificationAction.Unknown
|
||||
enabled: NotificationsManager.keywordNotificationAction !== PushRuleAction.Unknown
|
||||
|
||||
rightActions: Kirigami.Action {
|
||||
icon.name: "edit-clear"
|
||||
@@ -117,7 +117,7 @@ FormCard.FormCardPage {
|
||||
Accessible.name: text
|
||||
icon.name: "list-add"
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
enabled: NotificationsManager.keywordNotificationAction !== PushNotificationAction.Unknown
|
||||
enabled: NotificationsManager.keywordNotificationAction !== PushRuleAction.Unknown
|
||||
|
||||
onClicked: {
|
||||
root.pushRuleModel.addKeyword(keywordAddField.text)
|
||||
@@ -142,7 +142,7 @@ FormCard.FormCardPage {
|
||||
sourceModel: root.pushRuleModel
|
||||
filterRowCallback: function(source_row, source_parent) {
|
||||
let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole)
|
||||
return sectionRole == PushNotificationSection.Invites;
|
||||
return sectionRole == PushRuleSection.Invites;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ FormCard.FormCardPage {
|
||||
sourceModel: root.pushRuleModel
|
||||
filterRowCallback: function(source_row, source_parent) {
|
||||
let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole)
|
||||
return sectionRole == PushNotificationSection.Unknown;
|
||||
return sectionRole == PushRuleSection.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ FormCard.AbstractFormDelegate {
|
||||
signal actionChanged(int action)
|
||||
signal deleteRule()
|
||||
|
||||
enabled: ruleAction !== PushNotificationAction.Unknown
|
||||
enabled: ruleAction !== PushRuleAction.Unknown
|
||||
|
||||
text: name
|
||||
|
||||
@@ -147,35 +147,35 @@ FormCard.AbstractFormDelegate {
|
||||
function notifcationRuleAction() {
|
||||
if (onButton.checked) {
|
||||
if (noisyButton.checked && highlightButton.checked && root.highlightable) {
|
||||
return PushNotificationAction.NoisyHighlight
|
||||
return PushRuleAction.NoisyHighlight
|
||||
} else if (noisyButton.checked) {
|
||||
return PushNotificationAction.Noisy
|
||||
return PushRuleAction.Noisy
|
||||
} else if (highlightButton.checked && root.highlightable) {
|
||||
return PushNotificationAction.Highlight
|
||||
return PushRuleAction.Highlight
|
||||
} else {
|
||||
return PushNotificationAction.On
|
||||
return PushRuleAction.On
|
||||
}
|
||||
} else {
|
||||
return PushNotificationAction.Off
|
||||
return PushRuleAction.Off
|
||||
}
|
||||
}
|
||||
|
||||
function nextNotificationRuleAction(action) {
|
||||
let finished = false
|
||||
|
||||
if (action == PushNotificationAction.NoisyHighlight) {
|
||||
action = PushNotificationAction.Off
|
||||
if (action == PushRuleAction.NoisyHighlight) {
|
||||
action = PushRuleAction.Off
|
||||
} else {
|
||||
action += 1
|
||||
}
|
||||
|
||||
while (!finished) {
|
||||
if (action == PushNotificationAction.Off && !root.notificationsOnModifiable) {
|
||||
action = PushNotificationAction.On
|
||||
} else if (action == PushNotificationAction.Noisy) {
|
||||
action = PushNotificationAction.Highlight
|
||||
} else if (action == PushNotificationAction.Highlight && !root.highlightable) {
|
||||
action = PushNotificationAction.Off
|
||||
if (action == PushRuleAction.Off && !root.notificationsOnModifiable) {
|
||||
action = PushRuleAction.On
|
||||
} else if (action == PushRuleAction.Noisy) {
|
||||
action = PushRuleAction.Highlight
|
||||
} else if (action == PushRuleAction.Highlight && !root.highlightable) {
|
||||
action = PushRuleAction.Off
|
||||
} else {
|
||||
finished = true
|
||||
}
|
||||
@@ -185,19 +185,19 @@ FormCard.AbstractFormDelegate {
|
||||
}
|
||||
|
||||
function isNotificationRuleOn(action) {
|
||||
return action == PushNotificationAction.On ||
|
||||
action == PushNotificationAction.Noisy ||
|
||||
action == PushNotificationAction.Highlight ||
|
||||
action == PushNotificationAction.NoisyHighlight
|
||||
return action == PushRuleAction.On ||
|
||||
action == PushRuleAction.Noisy ||
|
||||
action == PushRuleAction.Highlight ||
|
||||
action == PushRuleAction.NoisyHighlight
|
||||
}
|
||||
|
||||
function isNotificationRuleNoisy(action) {
|
||||
return action == PushNotificationAction.Noisy ||
|
||||
action == PushNotificationAction.NoisyHighlight
|
||||
return action == PushRuleAction.Noisy ||
|
||||
action == PushRuleAction.NoisyHighlight
|
||||
}
|
||||
|
||||
function isNotificationRuleHighlight(action) {
|
||||
return action == PushNotificationAction.Highlight ||
|
||||
action == PushNotificationAction.NoisyHighlight
|
||||
return action == PushRuleAction.Highlight ||
|
||||
action == PushRuleAction.NoisyHighlight
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ FormCard.FormCardPage {
|
||||
filterRowCallback: function(source_row, source_parent) {
|
||||
let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole)
|
||||
let roomIdRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.RoomIdRole)
|
||||
return sectionRole == PushNotificationSection.RoomKeywords && roomIdRole == root.room.id;
|
||||
return sectionRole == PushRuleSection.RoomKeywords && roomIdRole == root.room.id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ FormCard.FormCardPage {
|
||||
Layout.fillWidth: true
|
||||
|
||||
placeholderText: i18n("Keyword…")
|
||||
enabled: NotificationsManager.keywordNotificationAction !== PushNotificationAction.Unknown
|
||||
enabled: NotificationsManager.keywordNotificationAction !== PushRuleAction.Unknown
|
||||
|
||||
rightActions: Kirigami.Action {
|
||||
icon.name: "edit-clear"
|
||||
@@ -120,7 +120,7 @@ FormCard.FormCardPage {
|
||||
Accessible.name: text
|
||||
icon.name: "list-add"
|
||||
display: QQC2.AbstractButton.IconOnly
|
||||
enabled: NotificationsManager.keywordNotificationAction !== PushNotificationAction.Unknown && keywordAddField.text.length > 0
|
||||
enabled: NotificationsManager.keywordNotificationAction !== PushRuleAction.Unknown && keywordAddField.text.length > 0
|
||||
|
||||
onClicked: {
|
||||
root.pushRuleModel.addKeyword(keywordAddField.text, root.room.id)
|
||||
|
||||
Reference in New Issue
Block a user