2
* Copyright (C) 2012-2013 Canonical, Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
import QtQuick.Window 2.0
19
import Ubuntu.Components 0.1
20
import Ubuntu.Components.ListItems 0.1 as ListItem
21
import Ubuntu.OnlineAccounts 0.1
26
color: Theme.palette.normal.background
27
property string fileToShare
29
property string serviceType: "webapps"
30
property string provider: "facebook"
31
property string userAccountId
32
property string accessToken
34
signal accountSelected
36
signal uploadCompleted(bool success)
39
activitySpinner.visible = false;
41
print ("Successfully posted");
43
print ("Failed to post");
48
serviceType: root.serviceType
49
provider: root.provider
50
Component.onCompleted: {
52
srv.objectHandle = get(0, "accountServiceHandle");
59
onObjectHandleChanged: {
61
root.account.authenticate(null);
64
root.userAccountId = accountId;
65
root.accessToken = reply.AccessToken;
66
shareComponent.visible = true;
67
sharemenu.visible = false;
74
objectName: "shareComponent"
76
color: Theme.palette.normal.background
86
anchors.left: parent.left
87
anchors.right: parent.right
88
anchors.topMargin: units.gu(1)
89
anchors.leftMargin: units.gu(1)
90
anchors.rightMargin: units.gu(1)
91
height: childrenRect.height
98
iconName: root.account.provider.iconName
99
text: root.account.provider.displayName
100
subText: root.account.displayName
105
ListItem.ThinDivider {}
109
objectName: "messageArea"
110
anchors.left: parent.left
111
anchors.right: parent.right
112
anchors.topMargin: units.gu(1)
113
anchors.leftMargin: units.gu(1)
114
anchors.rightMargin: units.gu(1)
122
anchors.top: parent.top
123
anchors.left: snapshot.right
124
anchors.bottom: parent.bottom
125
anchors.margins: units.gu(1)
127
width: parent.width - snapshot.width -
128
snapshot.anchors.margins * 2 -
129
message.anchors.leftMargin - message.anchors.rightMargin
131
font.pixelSize: FontUtils.sizeToPixels("medium")
132
font.weight: Font.Light
138
anchors.centerIn: message
145
anchors.top: parent.top
146
anchors.left: parent.left
147
anchors.margins: units.gu(1)
153
sourceSize.height: snapshot.height
154
sourceSize.width: snapshot.width
155
fillMode: Image.PreserveAspectCrop
162
anchors.left: parent.left
163
anchors.right: parent.right
164
anchors.topMargin: units.gu(2)
165
anchors.leftMargin: units.gu(1)
166
anchors.rightMargin: units.gu(1)
167
height: childrenRect.height
170
objectName: "cancelButton"
171
anchors.left: parent.left
172
text: i18n.dtr("ubuntu-ui-extras", "Cancel")
176
onClicked: canceled()
180
objectName: "postButton"
181
anchors.right: parent.right
182
anchors.top: parent.top
183
text: i18n.dtr("ubuntu-ui-extras", "Post")
187
enabled: !activitySpinner.visible
189
activitySpinner.visible = true;
190
callback(accessToken, fileToShare, message.text, uploadCompleted);
199
leftMargin: units.gu(1)
200
topMargin: units.gu(1)
202
color: selected ? "#cccccc" : "transparent"
203
property bool selected: false
209
onClicked: parent.selected = !parent.selected
211
source: "assets/icon_location.png"
212
anchors.centerIn: parent
213
height: parent.height * 0.75
214
fillMode: Image.PreserveAspectFit
221
anchors.left: useLocation.right
222
anchors.baseline: useLocation.top
223
anchors.baselineOffset: units.gu(3)
224
anchors.leftMargin: units.gu(1)
225
text: i18n.dtr("ubuntu-ui-extras", "Include location")
233
name: "landscape-with-keyborad"
235
target: serviceHeader
236
y: - serviceHeader.height
245
state: ((Screen.orientation === Qt.LandscapeOrientation) ||
246
(Screen.orientation === Qt.InvertedLandscapeOrientation)) &&
247
Qt.inputMethod.visible ? "landscape-with-keyborad" : ""
250
/* Menu listing online accounts */
256
signal selected(string accountId, string token)
258
Component.onCompleted: {
262
root.userAccountId = accountId;
263
root.accessToken = token;
264
shareComponent.visible = true;
265
sharemenu.visible = false;
277
objectHandle: accountServiceHandle
279
sharemenu.selected(accountId, reply.AccessToken);
283
height: childrenRect.height
290
text: service.provider.displayName
292
iconName: service.provider.iconName
293
__iconHeight: units.gu(5)
294
__iconWidth: units.gu(5)
297
root.account = service;
298
root.account.authenticate(null);
310
height: childrenRect.height
313
header: ListItem.Header {
318
text: i18n.tr("Select account")
320
delegate: acctDelegate