Skip to content

Commit 6f84515

Browse files
committed
red and green image for success or failure on Child Card Done
Signed-off-by: ekkes-corner <ekke@ekkes-corner.org>
1 parent c39fe83 commit 6f84515

File tree

7 files changed

+48
-12
lines changed

7 files changed

+48
-12
lines changed

assets/images/cancel_red.png

8.74 KB
Loading

assets/images/checked_green.png

6.8 KB
Loading

assets/main.qml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,24 @@ Page {
149149
Container {
150150
layout: DockLayout {
151151
}
152+
ImageView {
153+
id: redImage
154+
visible: false
155+
imageSource: "asset:///images/cancel_red.png"
156+
verticalAlignment: VerticalAlignment.Top
157+
horizontalAlignment: HorizontalAlignment.Left
158+
translationX: 10
159+
translationY: 10
160+
}
161+
ImageView {
162+
id: greenImage
163+
visible: false
164+
imageSource: "asset:///images/checked_green.png"
165+
verticalAlignment: VerticalAlignment.Top
166+
horizontalAlignment: HorizontalAlignment.Left
167+
translationX: 10
168+
translationY: 10
169+
}
152170
TextArea {
153171
id: theNextStep
154172
editable: false
@@ -175,9 +193,9 @@ Page {
175193
theNextStep.text = qsTr("You have selected the file below.\nEmbed the card from ODS:\nCloud Action (Previewer/Composer)\nor Share Action (Previewer)") + Retranslate.onLanguageChanged
176194
fileLabel.text = picker.selectedFile
177195
fileLabel.visible = true
178-
page.addAction(cloudActionPreviewer,0)
179-
page.addAction(cloudActionComposer,1)
180-
page.addAction(shareAction,2)
196+
page.addAction(cloudActionPreviewer, 0)
197+
page.addAction(cloudActionComposer, 1)
198+
page.addAction(shareAction, 2)
181199
//cloudActionPreviewer.enabled = true
182200
//cloudActionComposer.enabled = true
183201
//shareAction.enabled = true
@@ -192,9 +210,20 @@ Page {
192210
//shareAction.enabled = false
193211
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
194212
}
213+
function onGreen() {
214+
redImage.visible = false
215+
greenImage.visible = true
216+
}
217+
function onRed() {
218+
greenImage.visible = false
219+
redImage.visible = true
220+
}
195221
onCreationCompleted: {
196222
// support all orientations
197223
OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All;
224+
// connect to results
225+
app.cardSuccess.connect(onGreen)
226+
app.cardCanceled.connect(onRed)
198227
resetFields();
199228
}
200229
}

src/FileUpload2ODS.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,17 @@ void FileUpload2ODS::invokeBoundODSComposer(QString data) {
7676
m_invokeManager->invoke(cardRequest);
7777
}
7878

79+
80+
7981
void FileUpload2ODS::childCardDone(const bb::system::CardDoneMessage &message) {
8082
qDebug() << "childCardDone";
81-
if (message.reason() == "Success") {
83+
// Card Child done with Success ?
84+
if (message.reason() == "save") {
8285
qDebug() << "childCardDone with Success " << message.data();
83-
return;
84-
}
85-
if (message.reason() == "Cancel") {
86+
emit cardSuccess();
87+
} else {
8688
qDebug() << "childCardDone with Cancel: " << message.data();
87-
return;
89+
emit cardCanceled();
8890
}
8991
// now close the card !
9092
qDebug() << "close the card";

src/FileUpload2ODS.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ Q_OBJECT
5353
Q_INVOKABLE
5454
void invokeBoundODSComposer(QString data);
5555

56+
Q_SIGNALS:
57+
58+
void cardSuccess();
59+
void cardCanceled();
60+
5661
private Q_SLOTS:
5762
// This slot updates the status message when the invocation of a card is done
5863
void childCardDone(const bb::system::CardDoneMessage&);

translations/FileUpload2ODS.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@
5656
<translation type="unfinished"></translation>
5757
</message>
5858
<message>
59-
<location filename="../assets/main.qml" line="175"/>
59+
<location filename="../assets/main.qml" line="193"/>
6060
<source>You have selected the file below.
6161
Embed the card from ODS:
6262
Cloud Action (Previewer/Composer)
6363
or Share Action (Previewer)</source>
6464
<translation type="unfinished"></translation>
6565
</message>
6666
<message>
67-
<location filename="../assets/main.qml" line="193"/>
67+
<location filename="../assets/main.qml" line="211"/>
6868
<source>Select a file from Overflow Menu:
6969

7070
Document, Image,

translations/FileUpload2ODS_de.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@
5656
<translation type="unfinished"></translation>
5757
</message>
5858
<message>
59-
<location filename="../assets/main.qml" line="175"/>
59+
<location filename="../assets/main.qml" line="193"/>
6060
<source>You have selected the file below.
6161
Embed the card from ODS:
6262
Cloud Action (Previewer/Composer)
6363
or Share Action (Previewer)</source>
6464
<translation type="unfinished"></translation>
6565
</message>
6666
<message>
67-
<location filename="../assets/main.qml" line="193"/>
67+
<location filename="../assets/main.qml" line="211"/>
6868
<source>Select a file from Overflow Menu:
6969

7070
Document, Image,

0 commit comments

Comments
 (0)