| 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 |
| 21 |
import SSO.OnlineAccounts 0.1 |
| 22 |
|
| 23 |
Item { |
| 24 |
id: root |
| 25 |
|
| 26 |
property string providerId |
| 27 |
property var flickable: null |
| 28 |
|
| 29 |
signal finished(int accountId) |
| 30 |
|
| 31 |
Account { |
| 32 |
id: account |
| 33 |
objectHandle: Manager.createAccount(providerId) |
| 34 |
} |
| 35 |
|
| 36 |
Loader { |
| 37 |
id: loader |
| 38 |
property var account: account |
| 39 |
|
| 40 |
anchors.fill: parent |
| 41 |
source: localQmlPluginPath + "/" + providerId + "/Main.qml" |
| 42 |
onLoaded: checkFlickable() |
| 43 |
|
| 44 |
onStatusChanged: { |
| 45 |
if (loader.status == Loader.Error) { |
| 46 |
loader.source = systemQmlPluginPath + "/" + providerId + "/Main.qml" |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
Connections { |
| 51 |
target: loader.item |
| 52 |
function onFinished() { |
| 53 |
console.log("====== PLUGIN FINISHED ======") |
| 54 |
finished(account.accountId) |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
function checkFlickable() { |
| 59 |
if (item.hasOwnProperty("flickable")) { |
| 60 |
root.flickable = item.flickable |
| 61 |
} |
| 62 |
} |
| 63 |
} |
| 64 |
} |