Warning, /graphics/digikam/core/libs/dplugins/webservices/o2/examples/sialis/main.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick
0002 import QtQuick.Controls
0003 import QtWebView
0004 import com.pipacs.o2
0005
0006 ApplicationWindow {
0007 id: app
0008 visible: true
0009 title: "Sialis"
0010 minimumWidth: 300
0011 minimumHeight: 200
0012 height: 700
0013
0014 O1Twitter {
0015 id: o1Twitter
0016 clientId: "The app's API Key from developer.twitter.com"
0017 clientSecret: "The app's API Secret from developer.twitter.com "
0018 localPort: 8888
0019
0020 onOpenBrowser: {
0021 browser.url = url
0022 browser.visible = true
0023 }
0024
0025 onCloseBrowser: {
0026 browser.visible = false
0027 }
0028
0029 onLinkedChanged: {
0030 loginButton.enabled = true
0031 twitterApi.requestTweets()
0032 }
0033 }
0034
0035 TwitterApi {
0036 id: twitterApi
0037 authenticator: o1Twitter
0038 }
0039
0040 footer: ToolBar {
0041 Label {
0042 anchors.left: parent.left
0043 anchors.verticalCenter: parent.verticalCenter
0044 text: o1Twitter.linked? ("Logged in as " + o1Twitter.extraTokens["screen_name"]): "Not logged in"
0045 }
0046
0047 Button {
0048 id: loginButton
0049 anchors.right: parent.right
0050 anchors.verticalCenter: parent.verticalCenter
0051 text: o1Twitter.linked? "Logout": "Login"
0052 onClicked: {
0053 enabled = false
0054 if (o1Twitter.linked) {
0055 o1Twitter.unlink()
0056 } else {
0057 o1Twitter.link()
0058 }
0059 }
0060 }
0061
0062 height: loginButton.height + 5
0063 }
0064
0065 ListView {
0066 id: listView
0067 anchors.fill: parent
0068 model: twitterApi.tweetModel
0069 delegate: listDelegate
0070 highlight: Rectangle {color: "#10000000"}
0071 focus: true
0072
0073 Component {
0074 id: listDelegate
0075 Item {
0076 width: parent.width
0077 height: label.contentHeight + 10
0078 Row {
0079 anchors.fill: parent
0080 Label {
0081 id: label
0082 anchors.centerIn: parent
0083 width: parent.width
0084 text: rawText
0085 wrapMode: Text.Wrap
0086 }
0087 Rectangle {
0088 width: parent.width
0089 height: 1
0090 color: "#10000000"
0091 border.color: "transparent"
0092 }
0093 }
0094 MouseArea {
0095 anchors.fill: parent
0096 onClicked: listView.currentIndex = index
0097 }
0098 }
0099 }
0100 }
0101
0102 ApplicationWindow {
0103 id: browser
0104 visible: false
0105 minimumHeight: 800
0106 minimumWidth: 500
0107 title: "Login"
0108
0109 property url url: ""
0110
0111 WebView {
0112 anchors.fill: parent
0113 url: browser.url
0114 }
0115
0116 onClosing: {
0117 close.accepted = true
0118 loginButton.enabled = true
0119 }
0120 }
0121
0122 Timer {
0123 interval: 30000
0124 repeat: true
0125 running: true
0126 triggeredOnStart: true
0127 onTriggered: twitterApi.requestTweets()
0128 }
0129 }