~renatofilho/ubuntu-calendar-app/fix-url-arg

« back to all changes in this revision

Viewing changes to EventListModel.qml

Add option to Settings page to set the default calendar

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
        return cals;
76
76
    }
77
77
 
 
78
    function getWritableAndSelectedCollections(){
 
79
        var cals = [];
 
80
        var collections = eventModel.collections;
 
81
        for(var i = 0 ; i < collections.length ; ++i) {
 
82
            var cal = collections[i];
 
83
            if( cal.extendedMetaData("collection-type") === "Calendar" &&
 
84
                    cal.extendedMetaData("collection-selected") === true &&
 
85
                    cal.extendedMetaData("collection-readonly") === false) {
 
86
                cals.push(cal);
 
87
            }
 
88
        }
 
89
        return cals;
 
90
    }
 
91
 
78
92
    function getWritableCollections(){
79
93
        var cals = [];
80
94
        var collections = eventModel.collections;
110
124
        var cals = getCollections();
111
125
         for(var i = 0 ; i < cals.length ; ++i) {
112
126
             var cal = cals[i]
113
 
             cal.setExtendedMetaData("X-CAL-DEFAULT-CALENDAR", false);
114
127
             if( cal.collectionId === collectionId) {
115
 
                cal.setExtendedMetaData("X-CAL-DEFAULT-CALENDAR", true);
 
128
                 cal.setExtendedMetaData("collection-default", true);
 
129
                 eventModel.saveCollection(cal);
 
130
                 return
116
131
             }
117
132
        }
118
133
    }