Merge lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1476501 into lp:ubuntu-calendar-app

Proposed by Arthur Mello
Status: Merged
Approved by: Renato Araujo Oliveira Filho
Approved revision: 792
Merged at revision: 792
Proposed branch: lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1476501
Merge into: lp:ubuntu-calendar-app
Diff against target: 38 lines (+22/-1)
1 file modified
CalendarChoicePopup.qml (+22/-1)
To merge this branch: bzr merge lp:~artmello/ubuntu-calendar-app/ubuntu-calendar-app-fix_1476501
Reviewer Review Type Date Requested Status
Renato Araujo Oliveira Filho (community) Approve
Review via email: mp+289785@code.launchpad.net

Commit message

Add dialog popup warning user that one writable calendar must be always selected

Description of the change

Add dialog popup warning user that one writable calendar must be always selected

To post a comment you must log in.
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CalendarChoicePopup.qml'
2--- CalendarChoicePopup.qml 2016-03-02 19:55:52 +0000
3+++ CalendarChoicePopup.qml 2016-03-22 12:31:26 +0000
4@@ -106,6 +106,15 @@
5 checked: modelData.extendedMetaData("collection-selected")
6 enabled: !calendarChoicePage.isInEditMode
7 onCheckedChanged: {
8+ if (!checkBox.checked && modelData.extendedMetaData("collection-readonly") === false) {
9+ var collections = calendarChoicePage.model.getWritableAndSelectedCollections();
10+ if (collections.length == 1) {
11+ PopupUtils.open(singleWritableDialogComponent);
12+ checkBox.checked = true;
13+ return;
14+ }
15+ }
16+
17 modelData.setExtendedMetaData("collection-selected",checkBox.checked)
18 var collection = calendarChoicePage.model.collection(modelData.collectionId);
19 calendarChoicePage.model.saveCollection(collection);
20@@ -149,5 +158,17 @@
21 asynchronous: true
22 source: sourceFile
23 }
24+
25+ Component {
26+ id: singleWritableDialogComponent
27+ Dialog {
28+ id: singleWritableDialog
29+ title: i18n.tr("Unable to deselect")
30+ text: i18n.tr("In order to create new events you must have at least one writable calendar selected")
31+ Button {
32+ text: i18n.tr("Ok")
33+ onClicked: PopupUtils.close(singleWritableDialog)
34+ }
35+ }
36+ }
37 }
38-

Subscribers

People subscribed via source and target branches

to status/vote changes: