From d388de5f9fde32a5ccce126737e30b873e105667 Mon Sep 17 00:00:00 2001 From: molan-git <59296158+molan-git@users.noreply.github.com> Date: Fri, 24 Jan 2020 21:52:27 +0100 Subject: [PATCH] Add Bio to Profile page --- qml/pages/Profile.qml | 73 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/qml/pages/Profile.qml b/qml/pages/Profile.qml index cbcd27a..5e9f86d 100644 --- a/qml/pages/Profile.qml +++ b/qml/pages/Profile.qml @@ -16,8 +16,9 @@ Page { property int favourites_count; property int reblogs_count; property int count_moments; - property string profile_background : ""; + property string profile_background: ""; property string note: ""; + property string url: ""; property bool locked : false; property date created_at; @@ -28,7 +29,6 @@ Page { property bool muting : false; property bool domain_blocking : false; - WorkerScript { id: worker source: "../lib/Worker.js" @@ -68,9 +68,10 @@ Page { following_count = messageObject.data break; case 'acct': - //username = messageObject.data + // line below was commented out, reason unknown + // username = messageObject.data break; - case 'locked': + case 'locked':m locked = messageObject.data break; case 'created_at': @@ -82,6 +83,9 @@ Page { case 'note': note = messageObject.data break; + case 'url': + url = messageObject.data + break; case 'following': following = messageObject.data followers_count = followers_count + (following ? 1 : - 1) @@ -238,10 +242,65 @@ Page { } } - /*ExpandingSection { - title: "Tweets" + ExpandingSection { + title: qsTr("Bio") + content.sourceComponent: Column { + spacing: Theme.paddingMedium + anchors.bottomMargin: Theme.paddingLarge + Text { + x: Theme.horizontalPageMargin + width: parent.width - ( 2 * Theme.horizontalPageMargin ) + id: txtnote + text: qsTr(note) + font.pixelSize: Theme.fontSizeExtraSmall + color: Theme.secondaryColor + linkColor: Theme.secondaryHighlightColor + wrapMode: Text.Wrap + anchors { + horizontalCenter: parent.horizontalCenter + } + onLinkActivated: { + var test = link.split("/") + console.log(link) + console.log(JSON.stringify(test)) + console.log(JSON.stringify(test.length)) - }*/ + if (test.length === 5 && (test[3] === "tags" || test[3] === "tag") ) { + pageStack.pop(pageStack.find(function(page) { + var check = page.isFirstPage === true; + if (check) + page.onLinkActivated(link) + return check; + })); + send(link) + + } else if (test.length === 4 && test[3][0] === "@" ) { + tlSearch.search = decodeURIComponent("@"+test[3].substring(1)+"@"+test[2]) + slideshow.positionViewAtIndex(4, ListView.SnapToItem) + navigation.navigateTo('search') + + } else { + Qt.openUrlExternally(link); + } + } + + } + Column { + spacing: Theme.paddingMedium + anchors.horizontalCenter: parent.horizontalCenter + Button { + id: btnUrl + text: ("Open profile in browser") + onClicked: { + Qt.openUrlExternally(url); + } + } + } + Label { + text: " " + } + } + } }