diff --git a/harbour-tooter.pro b/harbour-tooter.pro index 88c2be7..12d4943 100644 --- a/harbour-tooter.pro +++ b/harbour-tooter.pro @@ -45,6 +45,7 @@ CONFIG += sailfishapp_i18n # modify the localized app name in the the .desktop file. TRANSLATIONS += \ translations/harbour-tooter-fr.ts \ + translations/harbour-tooter-nl.ts \ translations/harbour-tooter-oc.ts DISTFILES += \ diff --git a/harbour-tooter.pro.user b/harbour-tooter.pro.user index 5f6b490..610f4b9 100644 --- a/harbour-tooter.pro.user +++ b/harbour-tooter.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -779,7 +779,7 @@ 3768 false true - false + true false true diff --git a/qml/lib/Worker.js b/qml/lib/Worker.js index ac1f292..63e7db5 100644 --- a/qml/lib/Worker.js +++ b/qml/lib/Worker.js @@ -39,12 +39,40 @@ WorkerScript.onMessage = function(msg) { if(msg.action === "accounts/search") { item = parseAccounts(data[i]); items.push(item) + } else if(msg.action === "notifications") { - console.log("Is notification... parsing...") + // notification + //console.log("Is notification... parsing...") item = parseNotification(data[i]); items.push(item) + + } else if(msg.action.indexOf("statuses") >-1 && msg.action.indexOf("context") >-1 && i === "ancestors") { + // status ancestors toots - conversation + console.log("ancestors") + for (var j = 0; j < data[i].length; j ++) { + item = parseToot(data[i][j]); + item['id'] = item['status_id'] + items.push(item) + console.log(JSON.stringify(data[i][j])) + } + addDataToModel (msg.model, "prepend", items); + items = []; + + //console.log(JSON.stringify(i)) + } else if(msg.action.indexOf("statuses") >-1 && msg.action.indexOf("context") >-1 && i === "descendants") { + // status ancestors toots - conversation + console.log("descendants") + for (var j = 0; j < data[i].length; j ++) { + item = parseToot(data[i][j]); + item['id'] = item['status_id'] + items.push(item) + console.log(JSON.stringify(data[i][j])) + } + addDataToModel (msg.model, "append", items); + items = []; + } else if (data[i].hasOwnProperty("content")){ - console.log("Is toot... parsing...") + //console.log("Is toot... parsing...") item = parseToot(data[i]); item['id'] = item['status_id'] items.push(item) @@ -53,7 +81,7 @@ WorkerScript.onMessage = function(msg) { } } } - if(msg.model) + if(msg.model && items.length) addDataToModel(msg.model, msg.mode, items) if(msg.action === "notifications") orderNotifications(items) @@ -155,6 +183,7 @@ function collect() { function parseToot (data){ //console.log(JSON.stringify(data)) var item = {}; + item['highlight'] = false item['status_id'] = data["id"] item['status_uri'] = data["uri"] item['status_in_reply_to_id'] = data["in_reply_to_id"] diff --git a/qml/pages/Conversation.qml b/qml/pages/Conversation.qml index 7079bc0..f3161a9 100644 --- a/qml/pages/Conversation.qml +++ b/qml/pages/Conversation.qml @@ -10,6 +10,7 @@ Page { property alias description: header.description property alias avatar: header.image property int toot_id + property ListModel mdl; WorkerScript { id: worker @@ -21,6 +22,34 @@ Page { ProfileHeader { id: header + visible: false + } + SilicaListView { + id: conversationList + header: PageHeader { + title: qsTr("Conversation") + } + clip: true; + anchors { + top: parent.top + bottom: panel.top + left: parent.left + right: parent.right + } + model: mdl + delegate: VisualContainer {} + onCountChanged: { + for (var i = 0; i < mdl.count; i++){ + if (mdl.get(i).status_id === toot_id) { + console.log(mdl.get(i).status_id) + positionViewAtIndex(i, ListView.Center ) + } + } + + //last_id_MN + + } + } DockedPanel { @@ -57,7 +86,7 @@ Page { } autoScrollEnabled: true labelVisible: false - focus: true +// focus: true text: description !== "" && (description.charAt(0) == '@' || description.charAt(0) == '#') ? description+' ' : '' height: implicitHeight horizontalAlignment: Text.AlignLeft @@ -73,8 +102,8 @@ Page { leftMargin: Theme.paddingMedium } icon.source: "image://theme/icon-s-high-importance?" + (pressed - ? Theme.highlightColor - : (warningContent.visible ? Theme.secondaryHighlightColor : Theme.primaryColor)) + ? Theme.highlightColor + : (warningContent.visible ? Theme.secondaryHighlightColor : Theme.primaryColor)) onClicked: warningContent.visible = !warningContent.visible } ComboBox { @@ -95,8 +124,8 @@ Page { IconButton { id: btnSend icon.source: "image://theme/icon-m-enter?" + (pressed - ? Theme.highlightColor - : Theme.primaryColor) + ? Theme.highlightColor + : Theme.primaryColor) anchors { top: toot.bottom right: parent.right @@ -123,7 +152,6 @@ Page { } worker.sendMessage(msg); - console.log(JSON.stringify(msg)); warningContent.text = "" toot.text = "" } @@ -131,5 +159,12 @@ Page { } Component.onCompleted: { toot.cursorPosition = toot.text.length + worker.sendMessage({ + 'action' : 'statuses/'+mdl.get(0).status_id+'/context', + 'method' : 'GET', + 'model' : mdl, + 'params' : { }, + 'conf' : Logic.conf + }); } } diff --git a/qml/pages/components/VisualContainer.qml b/qml/pages/components/VisualContainer.qml index 422d606..bb1339f 100644 --- a/qml/pages/components/VisualContainer.qml +++ b/qml/pages/components/VisualContainer.qml @@ -112,18 +112,21 @@ BackgroundItem { linkColor : Theme.highlightColor wrapMode: Text.Wrap font.pixelSize: Theme.fontSizeSmall - color: (pressed ? Theme.highlightColor : Theme.primaryColor) + color: (pressed ? Theme.highlightColor : (highlight ? Theme.primaryColor : Theme.secondaryColor)) } onClicked: { + var m = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject'); + m.append(mdl.get(index)) pageStack.push(Qt.resolvedUrl("../Conversation.qml"), { - toot_id: id, + toot_id: status_id, title: account_display_name, description: '@'+account_acct, avatar: account_avatar, + mdl: m, type: "reply" }) } diff --git a/translations/harbour-tooter-fr.ts b/translations/harbour-tooter-fr.ts index 798e9f2..57be6bd 100644 --- a/translations/harbour-tooter-fr.ts +++ b/translations/harbour-tooter-fr.ts @@ -48,25 +48,29 @@ Conversation + + Conversation + + Content warning! - Contenu sensible ! + public - public + unlisted - non-listé + followers only - abonnés uniquement + direct - direct + diff --git a/translations/harbour-tooter-nl.ts b/translations/harbour-tooter-nl.ts new file mode 100644 index 0000000..4fcff59 --- /dev/null +++ b/translations/harbour-tooter-nl.ts @@ -0,0 +1,194 @@ + + + + + + + + Uitloggen + + + + Inloggen + + + + API + + favourited + favoriet gemaakt + + + followed you + volgde jou + + + boosted + boostte + + + said + zei + + + + Browser + + Open in Browser + Openen in browser + + + Web mode + Webmodus + + + Reading mode + Leesmodus + + + + Conversation + + Conversation + Gesprek + + + Content warning! + Gevoelige inhoud! + + + public + openbaar + + + unlisted + niet op lijst + + + followers only + alleen volgers + + + direct + direct + + + + CoverPage + + Tooter + Tooter + + + + MainPage + + Home + Thuis + + + Timeline + Tijdlijn + + + Notifications + Meldingen + + + Search + Zoeken + + + New Toot + Nieuw + + + + MiniStatus + + boosted + heeft geboost + + + favourited + favoriet gemaakt + + + followed you + volgde jou + + + + MyList + + Load more + Meer laden + + + + Profile + + Unfollow + Ontvolgen + + + Follow request sent! + Volgverzoek verstuurd! + + + Following + Volgend + + + Mute + Dempen + + + Unmute + Ontdempen + + + Unblock + Deblokkeren + + + Block + Blokkeren + + + Statuses + Statussen + + + Favourites + Favorieten + + + Follow + Volgen + + + Summary + Samenvatting + + + Followers + Volgers + + + + Toot + + boosted + boostte + + + favourited + maakte favoriet + + + followed you + volgde jou + + + diff --git a/translations/harbour-tooter-oc.ts b/translations/harbour-tooter-oc.ts index 49d4b73..f6feb1d 100644 --- a/translations/harbour-tooter-oc.ts +++ b/translations/harbour-tooter-oc.ts @@ -48,25 +48,29 @@ Conversation + + Conversation + + Content warning! - Contengut sensible ! + public - public + unlisted - pas listat + followers only - seguidors solament + direct - messatge privat + diff --git a/translations/harbour-tooter.ts b/translations/harbour-tooter.ts index a766423..09f7dbd 100644 --- a/translations/harbour-tooter.ts +++ b/translations/harbour-tooter.ts @@ -48,6 +48,10 @@ Conversation + + Conversation + + Content warning!