Skip to content

Commit 5ebc02c

Browse files
committed
some ui tuning
Action Items now dynamically added/removed and better text to explain the options Signed-off-by: ekkes-corner <ekke@ekkes-corner.org>
1 parent d231a6a commit 5ebc02c

File tree

4 files changed

+135
-49
lines changed

4 files changed

+135
-49
lines changed

assets/main.qml

Lines changed: 67 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,51 +36,60 @@ Page {
3636
sortOrder: FilePickerSortOrder.Default
3737
onFileSelected: {
3838
selectedFile = selectedFiles[0]
39-
fileLabel.text = selectedFile
40-
cloudAction.enabled = true
41-
shareAction.enabled = true
39+
fileActions()
4240
}
4341
}
4442
]
4543
actions: [
4644
ActionItem {
47-
id: cloudAction
48-
title: qsTr("ODS") + Retranslate.onLanguageChanged
45+
id: cloudActionPreviewer
46+
title: qsTr("Preview") + Retranslate.onLanguageChanged
4947
imageSource: "asset:///images/ics/4-collections-cloud_newLabel81.png"
50-
enabled: false
5148
ActionBar.placement: ActionBarPlacement.OnBar
5249
onTriggered: {
5350
app.invokeBoundODSPreviewer(picker.selectedFile)
51+
resetFields()
52+
}
53+
},
54+
ActionItem {
55+
id: cloudActionComposer
56+
title: qsTr("Compose") + Retranslate.onLanguageChanged
57+
imageSource: "asset:///images/ics/4-collections-cloud_newLabel81.png"
58+
ActionBar.placement: ActionBarPlacement.OnBar
59+
onTriggered: {
60+
app.invokeBoundODSComposer(picker.selectedFile)
61+
resetFields()
5462
}
5563
},
5664
InvokeActionItem {
57-
id: shareAction
58-
enabled: false
65+
id: openAction
5966
ActionBar.placement: ActionBarPlacement.OnBar
6067
query {
6168
// little trick: always use same mime type, because query needs a mime type
6269
// ODS then takes a look at file path suffix to see if file is supported
6370
mimeType: "image/png"
64-
invokeActionId: "bb.action.SHARE"
65-
invokeTargetId: "io.ods.bb10.card.upload.previewer"
71+
invokeActionId: "bb.action.OPEN"
72+
invokeTargetId: "io.ods.bb10.invoke"
6673
}
6774
onTriggered: {
68-
// next trick: all properties from query are read-only
69-
// but we can use the data, which is read-write
70-
data = picker.selectedFile
75+
// we dont need the file - the app is only opened
7176
}
7277
},
7378
InvokeActionItem {
79+
id: shareAction
7480
ActionBar.placement: ActionBarPlacement.OnBar
7581
query {
7682
// little trick: always use same mime type, because query needs a mime type
7783
// ODS then takes a look at file path suffix to see if file is supported
7884
mimeType: "image/png"
79-
invokeActionId: "bb.action.OPEN"
80-
invokeTargetId: "io.ods.bb10.invoke"
85+
invokeActionId: "bb.action.SHARE"
86+
invokeTargetId: "io.ods.bb10.card.upload.previewer"
8187
}
8288
onTriggered: {
83-
// we dont need the file - the app is only opened
89+
// next trick: all properties from query are read-only
90+
// but we can use the data, which is read-write
91+
data = picker.selectedFile
92+
resetFields()
8493
}
8594
},
8695
ActionItem {
@@ -132,23 +141,60 @@ Page {
132141
}
133142
}
134143
]
135-
titleBar: {
136-
title: qsTr("Invoke ODS as Card vs App") + Retranslate.onLanguageChanged
144+
titleBar: TitleBar {
145+
id: titleBarId
146+
title: qsTr("Invoke ODS as APP vs Card") + Retranslate.onLanguageChanged
147+
visibility: ChromeVisibility.Visible
137148
}
138149
Container {
139150
layout: DockLayout {
140151
}
152+
TextArea {
153+
id: theNextStep
154+
editable: false
155+
text: ""
156+
textStyle.base: SystemDefaults.TextStyles.BodyText
157+
verticalAlignment: VerticalAlignment.Top
158+
horizontalAlignment: HorizontalAlignment.Left
159+
translationX: 80
160+
translationY: 40
161+
}
141162
TextArea {
142163
id: fileLabel
143164
editable: false
144-
text: qsTr("[selected file]")
165+
visible: false
166+
text: ""
145167
textStyle.base: SystemDefaults.TextStyles.BodyText
146-
verticalAlignment: VerticalAlignment.Center
147-
horizontalAlignment: HorizontalAlignment.Center
168+
verticalAlignment: VerticalAlignment.Top
169+
horizontalAlignment: HorizontalAlignment.Left
170+
translationX: 80
171+
translationY: 360
148172
}
149173
}
174+
function fileActions() {
175+
theNextStep.text = qsTr("You have selected the file below.\nEmbed the card from ODS:\nCloud Action (Previewer/Composer)\nor Share Action (Previewer)") + Retranslate.onLanguageChanged
176+
fileLabel.text = picker.selectedFile
177+
fileLabel.visible = true
178+
page.addAction(cloudActionPreviewer,0)
179+
page.addAction(cloudActionComposer,1)
180+
page.addAction(shareAction,2)
181+
//cloudActionPreviewer.enabled = true
182+
//cloudActionComposer.enabled = true
183+
//shareAction.enabled = true
184+
}
185+
function resetFields() {
186+
fileLabel.visible = false
187+
page.removeAction(cloudActionPreviewer)
188+
page.removeAction(cloudActionComposer)
189+
page.removeAction(shareAction)
190+
//cloudActionPreviewer.enabled = false
191+
//cloudActionComposer.enabled = false
192+
//shareAction.enabled = false
193+
theNextStep.text = qsTr("Select a file from Overflow Menu:\n\nDocument, Image,\nVideo or Music)\n\nor invoke ODS as Application:\nOpen in... Action") + Retranslate.onLanguageChanged
194+
}
150195
onCreationCompleted: {
151196
// support all orientations
152197
OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All;
198+
resetFields();
153199
}
154200
}

bar-descriptor.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
<!-- The icon for the application, which should be 86x86. -->
8787
<icon>
8888
<image></image>
89+
<image>icon.png</image>
8990
</icon>
9091

9192
<asset path="assets">assets</asset>
@@ -94,6 +95,7 @@
9495
<asset path="translations" dest="qm">
9596
<include name="*.qm"/>
9697
</asset>
98+
<asset path="icon.png">icon.png</asset>
9799

98100
<!-- Request permission to execute native code. Required for native applications. -->
99101
<permission system="true">run_native</permission>

translations/FileUpload2ODS.ts

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,50 +9,69 @@
99
<translation type="unfinished"></translation>
1010
</message>
1111
<message>
12-
<location filename="../assets/main.qml" line="48"/>
13-
<source>ODS</source>
12+
<location filename="../assets/main.qml" line="46"/>
13+
<source>Preview</source>
1414
<translation type="unfinished"></translation>
1515
</message>
1616
<message>
17-
<location filename="../assets/main.qml" line="87"/>
18-
<location filename="../assets/main.qml" line="91"/>
17+
<location filename="../assets/main.qml" line="56"/>
18+
<source>Compose</source>
19+
<translation type="unfinished"></translation>
20+
</message>
21+
<message>
22+
<location filename="../assets/main.qml" line="96"/>
23+
<location filename="../assets/main.qml" line="100"/>
1924
<source>Select Document</source>
2025
<translation type="unfinished"></translation>
2126
</message>
2227
<message>
23-
<location filename="../assets/main.qml" line="99"/>
28+
<location filename="../assets/main.qml" line="108"/>
2429
<source>Select | Capture Image</source>
2530
<translation type="unfinished"></translation>
2631
</message>
2732
<message>
28-
<location filename="../assets/main.qml" line="103"/>
33+
<location filename="../assets/main.qml" line="112"/>
2934
<source>Select Image</source>
3035
<translation type="unfinished"></translation>
3136
</message>
3237
<message>
33-
<location filename="../assets/main.qml" line="111"/>
38+
<location filename="../assets/main.qml" line="120"/>
3439
<source>Select | Capture Video</source>
3540
<translation type="unfinished"></translation>
3641
</message>
3742
<message>
38-
<location filename="../assets/main.qml" line="115"/>
43+
<location filename="../assets/main.qml" line="124"/>
3944
<source>Select Video</source>
4045
<translation type="unfinished"></translation>
4146
</message>
4247
<message>
43-
<location filename="../assets/main.qml" line="123"/>
44-
<location filename="../assets/main.qml" line="127"/>
48+
<location filename="../assets/main.qml" line="132"/>
49+
<location filename="../assets/main.qml" line="136"/>
4550
<source>Select Music</source>
4651
<translation type="unfinished"></translation>
4752
</message>
4853
<message>
49-
<location filename="../assets/main.qml" line="136"/>
50-
<source>Invoke ODS as Card vs App</source>
54+
<location filename="../assets/main.qml" line="146"/>
55+
<source>Invoke ODS as APP vs Card</source>
56+
<translation type="unfinished"></translation>
57+
</message>
58+
<message>
59+
<location filename="../assets/main.qml" line="175"/>
60+
<source>You have selected the file below.
61+
Embed the card from ODS:
62+
Cloud Action (Previewer/Composer)
63+
or Share Action (Previewer)</source>
5164
<translation type="unfinished"></translation>
5265
</message>
5366
<message>
54-
<location filename="../assets/main.qml" line="144"/>
55-
<source>[selected file]</source>
67+
<location filename="../assets/main.qml" line="193"/>
68+
<source>Select a file from Overflow Menu:
69+
70+
Document, Image,
71+
Video or Music)
72+
73+
or invoke ODS as Application:
74+
Open in... Action</source>
5675
<translation type="unfinished"></translation>
5776
</message>
5877
</context>

translations/FileUpload2ODS_de.ts

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,50 +9,69 @@
99
<translation type="unfinished"></translation>
1010
</message>
1111
<message>
12-
<location filename="../assets/main.qml" line="48"/>
13-
<source>ODS</source>
12+
<location filename="../assets/main.qml" line="46"/>
13+
<source>Preview</source>
1414
<translation type="unfinished"></translation>
1515
</message>
1616
<message>
17-
<location filename="../assets/main.qml" line="87"/>
18-
<location filename="../assets/main.qml" line="91"/>
17+
<location filename="../assets/main.qml" line="56"/>
18+
<source>Compose</source>
19+
<translation type="unfinished"></translation>
20+
</message>
21+
<message>
22+
<location filename="../assets/main.qml" line="96"/>
23+
<location filename="../assets/main.qml" line="100"/>
1924
<source>Select Document</source>
2025
<translation type="unfinished"></translation>
2126
</message>
2227
<message>
23-
<location filename="../assets/main.qml" line="99"/>
28+
<location filename="../assets/main.qml" line="108"/>
2429
<source>Select | Capture Image</source>
2530
<translation type="unfinished"></translation>
2631
</message>
2732
<message>
28-
<location filename="../assets/main.qml" line="103"/>
33+
<location filename="../assets/main.qml" line="112"/>
2934
<source>Select Image</source>
3035
<translation type="unfinished"></translation>
3136
</message>
3237
<message>
33-
<location filename="../assets/main.qml" line="111"/>
38+
<location filename="../assets/main.qml" line="120"/>
3439
<source>Select | Capture Video</source>
3540
<translation type="unfinished"></translation>
3641
</message>
3742
<message>
38-
<location filename="../assets/main.qml" line="115"/>
43+
<location filename="../assets/main.qml" line="124"/>
3944
<source>Select Video</source>
4045
<translation type="unfinished"></translation>
4146
</message>
4247
<message>
43-
<location filename="../assets/main.qml" line="123"/>
44-
<location filename="../assets/main.qml" line="127"/>
48+
<location filename="../assets/main.qml" line="132"/>
49+
<location filename="../assets/main.qml" line="136"/>
4550
<source>Select Music</source>
4651
<translation type="unfinished"></translation>
4752
</message>
4853
<message>
49-
<location filename="../assets/main.qml" line="136"/>
50-
<source>Invoke ODS as Card vs App</source>
54+
<location filename="../assets/main.qml" line="146"/>
55+
<source>Invoke ODS as APP vs Card</source>
56+
<translation type="unfinished"></translation>
57+
</message>
58+
<message>
59+
<location filename="../assets/main.qml" line="175"/>
60+
<source>You have selected the file below.
61+
Embed the card from ODS:
62+
Cloud Action (Previewer/Composer)
63+
or Share Action (Previewer)</source>
5164
<translation type="unfinished"></translation>
5265
</message>
5366
<message>
54-
<location filename="../assets/main.qml" line="144"/>
55-
<source>[selected file]</source>
67+
<location filename="../assets/main.qml" line="193"/>
68+
<source>Select a file from Overflow Menu:
69+
70+
Document, Image,
71+
Video or Music)
72+
73+
or invoke ODS as Application:
74+
Open in... Action</source>
5675
<translation type="unfinished"></translation>
5776
</message>
5877
</context>

0 commit comments

Comments
 (0)