~pkunal-parmar/ubuntu-calendar-app/ICalImport

412.5.1 by Mihir Soni
Moved reminder to different page
1
/*
2
 * Copyright (C) 2014 Canonical Ltd
3
 *
4
 * This file is part of Ubuntu Calendar App
5
 *
6
 * Ubuntu Calendar App is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License version 3 as
8
 * published by the Free Software Foundation.
9
 *
10
 * Ubuntu Calendar App is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
import QtQuick 2.3
20
import Ubuntu.Components 1.1
21
import Ubuntu.Components.ListItems 1.0 as ListItem
22
23
Page{
24
    id:root
25
    objectName: "eventReminder"
26
450.1.2 by Nekhelesh Ramananthan
Refreshed Reminders Page design
27
    property var visualReminder: null
28
    property var audibleReminder: null
29
    property var reminderModel: null
412.5.1 by Mihir Soni
Moved reminder to different page
30
    property var eventTitle: null
450.1.2 by Nekhelesh Ramananthan
Refreshed Reminders Page design
31
    property var reminderTime: visualReminder.secondsBeforeStart
412.5.1 by Mihir Soni
Moved reminder to different page
32
33
    visible: false
450.1.2 by Nekhelesh Ramananthan
Refreshed Reminders Page design
34
    flickable: null
412.5.1 by Mihir Soni
Moved reminder to different page
35
    title: i18n.tr("Reminder")
36
37
    head.backAction: Action{
38
        iconName:"back"
39
        onTriggered:{
479.1.7 by Mihir Soni
Added new reminder issues & addressed all review comments
40
            visualReminder.repetitionCount = 3;
41
            visualReminder.repetitionDelay = 120;
42
            visualReminder.message = eventTitle
43
            visualReminder.secondsBeforeStart = reminderTime;
44
45
            audibleReminder.repetitionCount = 3;
46
            audibleReminder.repetitionDelay = 120;
47
            audibleReminder.secondsBeforeStart = reminderTime;
48
412.5.1 by Mihir Soni
Moved reminder to different page
49
            pop();
50
        }
51
    }
526.4.4 by Mihir Soni
Removed column , also added scrollbar
52
    Scrollbar{
53
        id:scrollList
54
        flickableItem: _pageFlickable
55
        anchors.fill :parent
56
    }
450.1.2 by Nekhelesh Ramananthan
Refreshed Reminders Page design
57
    Flickable {
58
        id: _pageFlickable
59
526.4.4 by Mihir Soni
Removed column , also added scrollbar
60
450.1.2 by Nekhelesh Ramananthan
Refreshed Reminders Page design
61
        clip: true
412.5.1 by Mihir Soni
Moved reminder to different page
62
        anchors.fill: parent
526.4.2 by Mihir Soni
Fixed height issue
63
        contentHeight: _reminders.itemHeight * reminderModel.count + units.gu(2)
526.4.4 by Mihir Soni
Removed column , also added scrollbar
64
        ListItem.ItemSelector {
65
            id: _reminders
66
            expanded: true
67
            model: reminderModel
68
            delegate: selectorDelegate
69
            selectedIndex: reminderModel.get
70
            onSelectedIndexChanged: {
71
                root.reminderTime = reminderModel.get(selectedIndex).value
450.1.2 by Nekhelesh Ramananthan
Refreshed Reminders Page design
72
            }
73
526.4.4 by Mihir Soni
Removed column , also added scrollbar
74
            Component.onCompleted: {
75
                for(var i=0; i<reminderModel.count; i++) {
76
                    if (root.reminderTime === reminderModel.get(i).value){
77
                        _reminders.selectedIndex = i
78
                        return;
450.1.2 by Nekhelesh Ramananthan
Refreshed Reminders Page design
79
                    }
80
                }
81
            }
526.4.4 by Mihir Soni
Removed column , also added scrollbar
82
        }
83
        Component {
84
            id: selectorDelegate
85
            OptionSelectorDelegate { text: label; }
86
        }
87
412.5.1 by Mihir Soni
Moved reminder to different page
88
    }
89
}