~dpniel/ubuntu-calendar-app/ScrollView2

« back to all changes in this revision

Viewing changes to calendar.qml

Merge into trunk to resolve conflict

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import Ubuntu.Components 1.1
20
20
import Ubuntu.Components.Popups 1.0
21
21
import QtOrganizer 5.0
 
22
import "OfflineStorage.js" as CalendarStorage
22
23
 
23
24
import "dateExt.js" as DateExt
24
25
 
25
26
MainView {
26
27
    id: mainView
 
28
 
 
29
    property bool isWeekNumberShown: false;
 
30
 
27
31
    useDeprecatedToolbar: false
28
32
 
29
33
    // Work-around until this branch lands:
221
225
            property int starttime: -1;
222
226
            property int endtime: -1;
223
227
 
224
 
            selectedTabIndex: weekTab.index
 
228
            onSelectedTabIndexChanged: {
 
229
                //Workaround: on u-touch, can't get respond from Component.onDestruction,
 
230
                //which is a common way to record last session tab index
 
231
                CalendarStorage.updateSettings("last_session_tabIndex",selectedTabIndex);
 
232
            }
225
233
 
226
234
            function newEvent() {
227
235
                var startDate = new Date();
283
291
            }
284
292
 
285
293
            Component.onCompleted: {
 
294
                var lastSessionTabIndex = CalendarStorage.getSettings("last_session_tabIndex", weekTab.index);
 
295
 
286
296
                // If an url has been set
287
297
                if (args.defaultArgument.at(0)) {
288
298
                    parseArguments(args.defaultArgument.at(0))
308
318
                    else {
309
319
                        // Due to bug #1231558 {if (args.defaultArgument.at(0))} is always true
310
320
                        // After the fix we can delete this else
311
 
                        tabs.selectedTabIndex = weekTab.index;
 
321
                        tabs.selectedTabIndex = lastSessionTabIndex;
312
322
                    }
313
323
                } // End of if about args.values
314
324
                else {
315
 
                    tabs.selectedTabIndex = weekTab.index;
 
325
                     tabs.selectedTabIndex = lastSessionTabIndex;
316
326
                }
317
327
            } // End of Component.onCompleted:
318
328
 
505
515
            }
506
516
        }
507
517
    }
 
518
 
 
519
    Component.onCompleted: {
 
520
        mainView.isWeekNumberShown = CalendarStorage.getSettings("show_week_numbers", false);
 
521
    }
508
522
}