| 1 |
/* |
| 2 |
* Copyright (C) 2013-2015 Canonical Ltd. |
| 3 |
* |
| 4 |
* Contact: Alberto Mardegan <[email protected]> |
| 5 |
* |
| 6 |
* This program is free software: you can redistribute it and/or modify it |
| 7 |
* under the terms of the GNU General Public License version 3, as published |
| 8 |
* by the Free Software Foundation. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, but |
| 11 |
* WITHOUT ANY WARRANTY; without even the implied warranties of |
| 12 |
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 13 |
* PURPOSE. See the GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License along |
| 16 |
* with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
import QtQuick 2.9 |
| 20 |
import Lomiri.Components 1.3 |
| 21 |
import SSO.OnlineAccounts 0.1 |
| 22 |
|
| 23 |
ListItem { |
| 24 |
id: root |
| 25 |
property string titleText: "" |
| 26 |
property string subtitleText: "" |
| 27 |
property var accountHandle |
| 28 |
property var globalServiceHandle |
| 29 |
property var __editPage: null |
| 30 |
property bool running: false |
| 31 |
readonly property string iconSource: globalService.provider.iconName.indexOf("/") === 0 ? |
| 32 |
globalService.provider.iconName : "image://theme/" + globalService.provider.iconName |
| 33 |
|
| 34 |
opacity: globalService.enabled ? 1 : 0.5 |
| 35 |
|
| 36 |
ListItemLayout { |
| 37 |
id: layout |
| 38 |
|
| 39 |
title.text: titleText |
| 40 |
subtitle.text: subtitleText |
| 41 |
LomiriShape { |
| 42 |
SlotsLayout.position: SlotsLayout.Leading |
| 43 |
height: Math.min(units.gu(5), root.height - units.gu(1)) |
| 44 |
width: height |
| 45 |
source: Image { source: iconSource} |
| 46 |
} |
| 47 |
|
| 48 |
ProgressionSlot {} |
| 49 |
} |
| 50 |
|
| 51 |
resources: [ |
| 52 |
AccountService { |
| 53 |
id: globalService |
| 54 |
objectHandle: globalServiceHandle |
| 55 |
}, |
| 56 |
Component { |
| 57 |
id: accountEditPage |
| 58 |
AccountEditPage {} |
| 59 |
} |
| 60 |
] |
| 61 |
|
| 62 |
onClicked: { |
| 63 |
__editPage = accountEditPage.createObject(null, { |
| 64 |
"accountHandle": accountHandle }) |
| 65 |
__editPage.finished.connect(__onEditFinished) |
| 66 |
pageStack.addPageToNextColumn(mainAccountsPage, __editPage) |
| 67 |
running = true; |
| 68 |
} |
| 69 |
|
| 70 |
function __onEditFinished() { |
| 71 |
__editPage.destroy(1000) |
| 72 |
pageStack.removePages(__editPage) |
| 73 |
__editPage = null |
| 74 |
running = false |
| 75 |
} |
| 76 |
} |