~ubuntu-branches/ubuntu/vivid/reminders-app/vivid-proposed

« back to all changes in this revision

Viewing changes to src/app/qml/ui/AccountSelectorPage.qml

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-07-04 07:35:58 UTC
  • Revision ID: package-import@ubuntu.com-20140704073558-t2grq61xc07lv2bh
Tags: upstream-0.4+14.10.20140704
ImportĀ upstreamĀ versionĀ 0.4+14.10.20140704

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright: 2013 - 2014 Canonical, Ltd
 
3
 *
 
4
 * This file is part of reminders
 
5
 *
 
6
 * reminders is free software: you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; version 3.
 
9
 *
 
10
 * reminders 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.0
 
20
import Ubuntu.Components 0.1
 
21
import Ubuntu.Components.ListItems 0.1
 
22
import Ubuntu.OnlineAccounts 0.1
 
23
import Ubuntu.OnlineAccounts.Client 0.1
 
24
import Evernote 0.1
 
25
 
 
26
Page {
 
27
    id: root
 
28
    objectName: "Accountselectorpage"
 
29
    title: "Select Evernote account"
 
30
 
 
31
    property alias accounts: listView.model
 
32
    property bool isChangingAccount
 
33
 
 
34
    signal accountSelected(var handle)
 
35
 
 
36
    Setup {
 
37
        id: setup
 
38
        applicationId: "com.ubuntu.reminders_reminders"
 
39
        providerId: useSandbox ? "evernote-sandbox" : "evernote"
 
40
    }
 
41
 
 
42
    Column {
 
43
        anchors { fill: parent; margins: units.gu(2) }
 
44
        spacing: units.gu(1)
 
45
 
 
46
        ListView {
 
47
            id: listView
 
48
            width: parent.width
 
49
            height: units.gu(10)
 
50
            model: accounts
 
51
            currentIndex: -1
 
52
 
 
53
            delegate: Standard {
 
54
                objectName: "EvernoteAccount"
 
55
                text: displayName
 
56
                MouseArea {
 
57
                    anchors.fill: parent
 
58
                    onClicked: root.accountSelected(accountServiceHandle)
 
59
                }
 
60
            }
 
61
 
 
62
            footer: Button {
 
63
                text: i18n.tr("Add account")
 
64
                onClicked: setup.exec()
 
65
            }
 
66
        }
 
67
    }
 
68
 
 
69
    tools: ToolbarItems {
 
70
        locked: !isChangingAccount
 
71
        opened: isChangingAccount
 
72
    }
 
73
}