post.qml Example File
httptest/assets/post.qml
import bb.cascades 1.0
import Network.PostHttp 1.0
import "controls"
import my.library 1.0
Page {
Container {
layout: DockLayout {}
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///images/background.png"
}
Container {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Center
leftPadding: 30
Label {
id: postResponseLabel
visible: false
text: qsTr("Response:")
textStyle {
base: SystemDefaults.TextStyles.BodyText;
color: Color.White
}
}
TextArea {
id: postResponseBody
visible: false
editable: false
backgroundVisible: false
textStyle {
base: SystemDefaults.TextStyles.BodyText;
color: Color.White
}
}
}
NetworkActivity {
id: progressIndicator
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
title: qsTr("Posting...")
}
attachedObjects: [
QTimer {
id: timer
interval: 1000
onTimeout: {
netpost.post(_httpsample.postBody);
}
},
PostHttp {
id : netpost
onComplete :{
progressIndicator.active = false;
progressIndicator.visible = false;
postResponseBody.text = info;
postResponseBody.visible = true;
postResponseLabel.visible = true;
timer.stop();
}
}
]
onCreationCompleted: {
progressIndicator.active = true;
timer.start();
}
}
}