Friendiqa v0.3
This commit is contained in:
parent
585e329bcb
commit
bda2d9f7b5
63 changed files with 2746 additions and 1357 deletions
|
@ -126,14 +126,19 @@ Rectangle {
|
|||
xhr.clearParams();
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
if (conversationModel.get(0).newsitemobject.messagetype==0){
|
||||
|
||||
//xhr.url= login.server + "/api/statuses/update.json";
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/statuses/update");
|
||||
xhr.setParam("source", "Friendiqa");
|
||||
xhr.url= login.server + "/api/statuses/update.json";
|
||||
xhr.setParam("status", body);
|
||||
xhr.setParam("in_reply_to_status_id", conversationModel.get(conversationModel.count-1).newsitemobject.status_id)}
|
||||
else {xhr.url= login.server + "/api/direct_messages/new.json";
|
||||
xhr.setParam("in_reply_to_status_id", conversationModel.get(conversationModel.count-1).newsitemobject.id)}
|
||||
else {//xhr.url= login.server + "/api/direct_messages/new.json";
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/direct_messages/new");
|
||||
xhr.setParam("text", body);
|
||||
xhr.setParam("screen_name",conversationModel.get(conversationModel.count-1).newsitemobject.screen_name);
|
||||
xhr.setParam("replyto", conversationModel.get(conversationModel.count-1).newsitemobject.status_id)
|
||||
xhr.setParam("replyto", conversationModel.get(conversationModel.count-1).newsitemobject.id)
|
||||
}
|
||||
xhr.post();
|
||||
} catch(e){Helperjs.showMessage("Error",e.toString(),root)}
|
||||
|
|
|
@ -77,7 +77,7 @@ Rectangle {
|
|||
font.pixelSize: 3*mm
|
||||
anchors.left: contactImage.right
|
||||
anchors.margins: 1*mm
|
||||
text:Qt.atob(contact.name)
|
||||
text:contact.name
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
|
|
51
source-android/qml/newsqml/Hashtag.qml
Normal file
51
source-android/qml/newsqml/Hashtag.qml
Normal file
|
@ -0,0 +1,51 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://github.com/lubuwest/Friendiqa
|
||||
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations including
|
||||
// the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for all
|
||||
// of the code used other than OpenSSL. If you modify file(s) with this
|
||||
// exception, you may extend this exception to your version of the
|
||||
// file(s), but you are not obligated to do so. If you do not wish to do
|
||||
// so, delete this exception statement from your version. If you delete
|
||||
// this exception statement from all source files in the program, then
|
||||
// also delete it here.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
Rectangle {
|
||||
id:hasgtagRectangle
|
||||
color: "light grey"
|
||||
property alias text: hashtagText.text
|
||||
radius:0.3*mm
|
||||
width:hashtagText.contentWidth+mm
|
||||
height:2.5* mm
|
||||
Text{
|
||||
id:hashtagText
|
||||
font.pixelSize: 1.5*mm
|
||||
anchors.centerIn: parent
|
||||
anchors.margins: 0.5*mm
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{search(hashtagText.text.replace("#",""))}
|
||||
}
|
||||
}
|
|
@ -39,12 +39,11 @@ import "qrc:/js/smiley.js" as Smileyjs
|
|||
import "qrc:/qml/genericqml"
|
||||
|
||||
|
||||
Flickable{
|
||||
Rectangle{
|
||||
color:"white"
|
||||
width:root.width-5*mm
|
||||
height:root.height-12*mm
|
||||
contentHeight: messageColumn.height
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
id:messageSend
|
||||
//anchors.fill: parent
|
||||
property string parentId: ""
|
||||
property string reply_to_user:""
|
||||
property alias bodyMessage: bodyField.text
|
||||
|
@ -57,15 +56,17 @@ Flickable{
|
|||
property var group_allow:login.permissions[2]
|
||||
property var group_deny:login.permissions[3]
|
||||
|
||||
function attachImage(url){
|
||||
function attachImage(url){ print("attachImage "+url)
|
||||
var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
|
||||
url.toString()+'"; x:2*mm; width: 45*mm; height: 45*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+
|
||||
url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
|
||||
}
|
||||
|
||||
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
|
||||
xhr.url= login.server + "/api/statuses/update.json";
|
||||
//xhr.url= login.server + "/api/statuses/update.json";
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/statuses/update");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("source", "Friendiqa");
|
||||
xhr.setParam("status", status);
|
||||
|
@ -80,17 +81,27 @@ Flickable{
|
|||
}
|
||||
|
||||
function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
|
||||
xhr.url= login.server + "/api/direct_messages/new.json";
|
||||
//xhr.url= login.server + "/api/direct_messages/new.json";
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/direct_messages/new");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("text", text);
|
||||
xhr.setParam("screen_name", screen_name);
|
||||
if (parentId!="") {xhr.setParam("replyto", replyto)};
|
||||
if (title!=="") {xhr.setParam("title", title)};
|
||||
//if (title!=="") {xhr.setParam("title", title)};
|
||||
xhr.post();
|
||||
}
|
||||
|
||||
Column {
|
||||
Flickable{
|
||||
anchors.fill: parent
|
||||
contentHeight: messageColumn.height
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
id:messageSend
|
||||
|
||||
|
||||
|
||||
Column {
|
||||
id:messageColumn
|
||||
spacing: 0.5*mm
|
||||
width: parent.width
|
||||
|
@ -98,7 +109,7 @@ Flickable{
|
|||
id: titleField
|
||||
width: parent.width
|
||||
placeholderText: qsTr("Title (optional)")
|
||||
visible: messageSend.parentId === ""
|
||||
visible: parentId === ""
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
|
@ -236,3 +247,4 @@ Flickable{
|
|||
}
|
||||
Component.onCompleted: if(attachImageURLs.length>0){attachImage(attachImageURLs[0])}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,64 +31,98 @@
|
|||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick.Dialogs 1.3
|
||||
import "qrc:/qml/genericqml"
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/service.js" as Service
|
||||
|
||||
//import AndroidNative 1.0
|
||||
|
||||
Item {
|
||||
Connections{
|
||||
target:newstab
|
||||
onNewstabstatusChanged:{
|
||||
newstabstatusButton.text= qsTr(newstab.newstabstatus)
|
||||
// switch(newstab.newstabstatus){
|
||||
// case "Timeline": newstabstatusCombo.currentIndex=1; break;
|
||||
// case "Conversations":newstabstatusCombo.currentIndex=2; break;
|
||||
// case "Favorites":newstabstatusCombo.currentIndex=3; break;
|
||||
// case "Network":newstabstatusCombo.currentIndex=4; break;
|
||||
// case "Direct Messages":newstabstatusCombo.currentIndex=5; break;
|
||||
// case "Notifications":newstabstatusCombo.currentIndex=6; break;
|
||||
// case "Search":newstabstatusCombo.currentIndex=7; break;
|
||||
// case "Groupnews":newstabstatusCombo.currentIndex=8; break;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
// onError:{if (data=="contact"){downloadNotice.text=root.newContacts[root.currentContact].name+"... Error!"}}
|
||||
onSuccess:{replytimer.start() //wait 1 second to load new timeline
|
||||
onError:{
|
||||
Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);
|
||||
}
|
||||
onSuccess:{
|
||||
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
|
||||
Service.processNews(api,data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
||||
onTriggered: {
|
||||
if(newstab.newstabstatus=="Conversation"){
|
||||
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
|
||||
else{
|
||||
var onlynew=true;
|
||||
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
root.contactLoadType="news";
|
||||
root.news=rns;root.newContacts=rnc;})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {id:contacttimer; interval: 50; running: false; repeat: false
|
||||
onTriggered: {
|
||||
// downloadNotice.text=downloadNotice.text + "\n contactTimer start "+ Date.now()
|
||||
root.newContacts=Newsjs.findNewContacts(root.news,root.contactlist);
|
||||
Newsjs.storeNews(login,db,root.news,root)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function showNews(newsToShow){
|
||||
try{if (newsStack.depth>1){newsStack.pop()}}catch(e){}
|
||||
newsBusy.running=false;
|
||||
var currentTime= new Date();
|
||||
downloadNotice.text="";
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow};
|
||||
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
|
||||
//print("appendnews "+newsStack.appendNews +JSON.stringify(newsToShow))
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'appendnews':newsStack.appendNews};
|
||||
newsWorker.sendMessage(msg);
|
||||
newsStack.appendNews=false
|
||||
}
|
||||
|
||||
|
||||
|
||||
function showConversation(conversationIndex,newsitemobject){
|
||||
//newsBusy.running=true;
|
||||
root.contactLoadType="conversation";
|
||||
newsStack.conversationIndex= conversationIndex;
|
||||
//print(newsitemobject.id);
|
||||
if(newsitemobject.messagetype==0){
|
||||
Newsjs.requestConversation(root.login,db,newsitemobject.status_id,root.contactlist,root,function(ns,nc){
|
||||
root.news=ns;root.newContacts=nc;
|
||||
})}
|
||||
else{Newsjs.conversationfromdb(root.db,root.login.username,newsitemobject.statusnet_conversation_id, function(newsarray){
|
||||
root.news=newsarray;root.newContacts=[];
|
||||
})}
|
||||
xhr.clearParams();
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/conversation/show");
|
||||
xhr.setParam("id",newsitemobject.id)
|
||||
xhr.get();
|
||||
}
|
||||
else{
|
||||
xhr.clearParams();
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/direct_messages/conversation");
|
||||
xhr.setParam("uri",newsitemobject.statusnet_conversation_id)
|
||||
xhr.get();
|
||||
}
|
||||
}
|
||||
|
||||
function showContact(contact){
|
||||
|
@ -98,6 +132,21 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
function search(term){print("Search "+term)
|
||||
if (term!=""){
|
||||
newstab.newstabstatus="Search";
|
||||
newsBusy.running=true;
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/search");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("q",term)
|
||||
xhr.get();}
|
||||
newsSearch.visible=false;
|
||||
newsView.anchors.topMargin=7*mm
|
||||
}
|
||||
|
||||
|
||||
function onFriendsMessages(friend){
|
||||
newstab.newstabstatus="Contact"
|
||||
Newsjs.newsfromdb(db,root.login.username, function(dbnews){
|
||||
|
@ -132,18 +181,163 @@ Item {
|
|||
id: newsStack
|
||||
anchors.fill:parent
|
||||
property int conversationIndex: 0
|
||||
|
||||
property bool appendNews: false
|
||||
property var allchats: ({})
|
||||
initialItem:Rectangle {
|
||||
id:newslistRectangle
|
||||
y:1
|
||||
color: "white"
|
||||
|
||||
// ComboBox{
|
||||
// id:newstabstatusCombo
|
||||
// anchors.top: parent.top
|
||||
// anchors.topMargin: 0.5*mm
|
||||
// width: 1/3*root.width
|
||||
// height: 5*mm;
|
||||
// style:
|
||||
// ComboBoxStyle{
|
||||
// background: Rectangle {
|
||||
// color:"light blue"
|
||||
// radius: 0.5*mm
|
||||
// }
|
||||
// label: Text {
|
||||
// verticalAlignment: Text.AlignVCenter
|
||||
// horizontalAlignment: Text.AlignHCenter
|
||||
// text: control.currentText
|
||||
// }
|
||||
// }
|
||||
|
||||
// model: ListModel {
|
||||
// id: newscomboItems
|
||||
// ListElement { type: "Timeline"; text: qsTr("Timeline")}
|
||||
// ListElement { type: "Conversations";text: qsTr("Conversations")}
|
||||
// ListElement { type: "Favorites";text: qsTr("Favorites") }
|
||||
// ListElement { type: "PublicTimeline";text: qsTr("Public timeline") }
|
||||
// ListElement { type: "DirectMessages";text: qsTr("Direct Messages") }
|
||||
// ListElement { type: "Notifications";text: qsTr("Notifications") }
|
||||
// ListElement { type: "Search";text: qsTr("Search") }
|
||||
// ListElement { type: "Groupnews"; text: qsTr("Group News") }
|
||||
// ListElement { type: "Quit";text: qsTr("Quit") }
|
||||
// }
|
||||
// currentIndex:(login.newsViewType=="Timeline")?0:1
|
||||
// onCurrentIndexChanged:{
|
||||
// //onActivated:{
|
||||
// print(newscomboItems.get(currentIndex).type);
|
||||
// switch(newscomboItems.get(currentIndex).type){
|
||||
// case "Timeline":
|
||||
// newstab.newstabstatus="Timeline";
|
||||
// newsModel.clear();
|
||||
// try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){
|
||||
// showNews(dbnews)
|
||||
// })}catch(e){Helperjs.showMessage("Error",e,root)}
|
||||
// break;
|
||||
// case "Conversations":
|
||||
// newsModel.clear();
|
||||
// newstab.newstabstatus="Conversations";
|
||||
// Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)})
|
||||
// break;
|
||||
// case "Favorites":
|
||||
// newstab.newstabstatus="Favorites";
|
||||
// root.contactLoadType="favorites";
|
||||
// Service.updateView("Favorites");
|
||||
// break;
|
||||
// case "PublicTimeline":
|
||||
// newstab.newstabstatus="Network";
|
||||
// Service.updateView("Network");
|
||||
// break;
|
||||
// case "DirectMessages":
|
||||
// newstab.newstabstatus="DirectMessages";
|
||||
// Service.updateView("DirectMessages");
|
||||
// break;
|
||||
// case "Notifications":
|
||||
// newstab.newstabstatus="Notifications";
|
||||
// Service.updateView("Notifications");
|
||||
// break;
|
||||
// case "Search":
|
||||
// newsView.anchors.topMargin=18*mm;
|
||||
// newsSearch.visible=true
|
||||
// break;
|
||||
// case "Groupnews":
|
||||
// Service.showGroups();
|
||||
// break;
|
||||
// case "Quit":
|
||||
// Service.cleanNews(root.db,function(){
|
||||
// Service.cleanContacts(root.login,root.db,function(){
|
||||
// Qt.quit()})
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
BlueButton{
|
||||
id:newstabstatusButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
text: qsTr(newstab.newstabstatus)
|
||||
onClicked: {newstabmenu.popup()}
|
||||
|
||||
Menu{id:newstabmenu
|
||||
MenuItem {
|
||||
text: qsTr("Timeline")
|
||||
onTriggered: {
|
||||
newstab.newstabstatus="Timeline";
|
||||
newsModel.clear();
|
||||
try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){
|
||||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)}}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Conversations")
|
||||
onTriggered:{
|
||||
newsModel.clear();
|
||||
newstab.newstabstatus="Conversations";
|
||||
Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)})
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Favorites")
|
||||
onTriggered:{
|
||||
newstab.newstabstatus="Favorites";
|
||||
// root.contactLoadType="favorites";
|
||||
Service.updateView("Favorites")
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Public timeline")
|
||||
onTriggered:{
|
||||
newstab.newstabstatus="Public Timeline";
|
||||
Service.updateView("Public Timeline")
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Direct Messages")
|
||||
onTriggered:{
|
||||
newstab.newstabstatus="Direct Messages";
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Notifications")
|
||||
onTriggered:{
|
||||
newstab.newstabstatus="Notifications";
|
||||
Service.updateView("Notifications")
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Group news")
|
||||
onTriggered:Service.showGroups();
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Quit")
|
||||
onTriggered:{
|
||||
Service.cleanNews(root.db,function(){
|
||||
Service.cleanContacts(root.login,root.db,function(){
|
||||
Qt.quit()})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row{
|
||||
|
@ -152,6 +346,20 @@ Item {
|
|||
anchors.topMargin: 0.5*mm
|
||||
anchors.right: parent.right
|
||||
|
||||
BlueButton {
|
||||
id: searchButton
|
||||
text: "\uf002"
|
||||
onClicked: {
|
||||
if (newsSearch.visible==false){
|
||||
newsView.anchors.topMargin=18*mm;
|
||||
newsSearch.visible=true}
|
||||
else{
|
||||
newsSearch.visible=false;
|
||||
newsView.anchors.topMargin=7*mm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
id: newMessageButton
|
||||
text: "\uf040"
|
||||
|
@ -166,32 +374,20 @@ Item {
|
|||
},"isFriend",1);
|
||||
}
|
||||
}
|
||||
BlueButton {
|
||||
id: quitButton
|
||||
text: "\uf08b"
|
||||
onClicked: {Service.cleanNews(root.db,function(){
|
||||
Service.cleanContacts(root.login,root.db,function(){
|
||||
Qt.quit() })
|
||||
})}
|
||||
}
|
||||
// BlueButton {
|
||||
// id: quitButton
|
||||
// text: "\uf08b"
|
||||
// onClicked: {Service.cleanNews(root.db,function(){
|
||||
// Service.cleanContacts(root.login,root.db,function(){
|
||||
// Qt.quit() })
|
||||
// })}
|
||||
// }
|
||||
BlueButton {
|
||||
id: update
|
||||
text: "\uf021"
|
||||
onClicked: {
|
||||
newsBusy.running=true;
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
root.contactLoadType="news";
|
||||
var onlynew=true;
|
||||
//print("newstab "+ JSON.stringify(contactlist));
|
||||
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(ns,nc){
|
||||
root.news=ns;root.newContacts=nc;
|
||||
if (ns.length==0){// update last 20 existing news for changes and likes
|
||||
onlynew=false;
|
||||
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){
|
||||
root.contactLoadType="news";
|
||||
root.news=rns;root.newContacts=rnc;})
|
||||
}
|
||||
})
|
||||
//root.contactLoadType="news";
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,7 +407,6 @@ Item {
|
|||
onClicked:{
|
||||
var currentTime= new Date();
|
||||
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
|
||||
print("Lastnews ID "+lastnews_id+Qt.atob(newsModel.get(newsModel.count-1).newsitemobject.statusnet_html))
|
||||
if(newstab.newstabstatus=="Timeline"){
|
||||
Newsjs.newsfromdb(root.db,root.login.username, function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
|
||||
|
@ -227,11 +422,27 @@ Item {
|
|||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
|
||||
newsWorker.sendMessage(msg);
|
||||
},newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)}
|
||||
}
|
||||
else if (newstab.newstabstatus=="Notifications"){}
|
||||
else{
|
||||
newsStack.appendNews=true;
|
||||
xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);
|
||||
xhr.get()
|
||||
}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id: newsSearch
|
||||
color: "#FFFAFA"
|
||||
y:8*mm
|
||||
width:root.width
|
||||
height: 8*mm
|
||||
visible:false
|
||||
Search{
|
||||
anchors.fill: parent
|
||||
anchors.margins: mm
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
id: newsView
|
||||
anchors.fill: parent
|
||||
|
@ -245,19 +456,9 @@ Item {
|
|||
delegate: Newsitem{}
|
||||
//onContentYChanged:{if(contentY<-8*mm&&contentY>(-8*mm-1)){print("refreshing");
|
||||
onDragEnded:{if(contentY<-5*mm){//print("refreshing");
|
||||
newsBusy.running=true;
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
root.contactLoadType="news";
|
||||
var onlynew=true;
|
||||
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(ns,nc){
|
||||
root.news=ns;root.newContacts=nc;
|
||||
if (ns.length==0){// update last 20 existing news for changes and likes
|
||||
onlynew=false;
|
||||
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){
|
||||
root.contactLoadType="news";
|
||||
root.news=rns;root.newContacts=rnc;})
|
||||
}
|
||||
})
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}}
|
||||
}
|
||||
|
||||
|
@ -299,67 +500,23 @@ Item {
|
|||
text:""
|
||||
}
|
||||
}
|
||||
Menu {
|
||||
id:newstabmenu
|
||||
MenuItem {
|
||||
text: qsTr("Timeline")
|
||||
onTriggered: {
|
||||
newstab.newstabstatus="Timeline";
|
||||
newsModel.clear();
|
||||
try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){
|
||||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)}}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Favorites")
|
||||
onTriggered:{
|
||||
newstab.newstabstatus="Favorites";
|
||||
root.contactLoadType="favorites";
|
||||
newsBusy.running=true;
|
||||
Newsjs.requestFavorites(root.login,db,root.contactlist,root,function(ns,nc){
|
||||
root.news=ns; root.newContacts=nc;
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Conversations")
|
||||
onTriggered:{
|
||||
newsModel.clear();
|
||||
newstab.newstabstatus="Conversations";
|
||||
Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)})
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Notifications")
|
||||
onTriggered:{
|
||||
newstab.newstabstatus="Notifications";
|
||||
newsBusy.running=true;
|
||||
Newsjs.getNotifications(root.login,db,root,function(news){
|
||||
showNews(news)}
|
||||
)}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
root.messageSignal.connect(onFriendsMessages);
|
||||
root.directmessageSignal.connect(onDirectMessage);
|
||||
root.newsSignal.connect(showNews);
|
||||
root.uploadSignal.connect(sendUrls);
|
||||
root.sendtextSignal.connect(sendtext);
|
||||
try{newsModel.clear()} catch(e){}
|
||||
|
||||
//print("imageUrls "+JSON.stringify(imageUrls)+" newsstack.depth:"+newsStack.depth);
|
||||
//newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:[imageUrl]}})
|
||||
// var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
|
||||
// osSettings.imagePickQml+'{multiple : true; onReady: {'+
|
||||
// 'if(imageUrls.length==1){root.currentIndex=0;newstab.active=true;root.uploadSignal(imageUrls)} else{'+
|
||||
// ' root.currentIndex=2;fotostab.active=true;'+
|
||||
// 'root.uploadSignal(imageUrls)};}}',newstab,"imagePicker");
|
||||
//SystemDispatcher.setInitialized();
|
||||
root.messageSignal.connect(onFriendsMessages);
|
||||
root.directmessageSignal.connect(onDirectMessage);
|
||||
root.newsSignal.connect(showNews);
|
||||
root.uploadSignal.connect(sendUrls);
|
||||
root.sendtextSignal.connect(sendtext);
|
||||
try{newsModel.clear()} catch(e){}
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
if(root.news.length>0){showNews(root.news)}
|
||||
else{ newstab.newstabstatus=login.newsViewType;
|
||||
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
}
|
||||
if(osSettings.imagePickQml=="ImagePicker"){var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml");
|
||||
var IntentReceiverQml = component.createObject(root)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,11 @@ Item {
|
|||
var component = Qt.createComponent("qrc:/qml/newsqml/FriendicaActivities.qml");
|
||||
var imagedialog = component.createObject(friendicaActivities,{"activitymembers": contacts});
|
||||
}
|
||||
|
||||
function findTags(fulltext){
|
||||
return fulltext.match(/\s+[#]+[A-Za-z0-9-_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]+/g)
|
||||
}
|
||||
|
||||
Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"}
|
||||
|
||||
Rectangle{
|
||||
|
@ -72,7 +77,8 @@ Item {
|
|||
height: 7*mm
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{showContact(newsitemobject.user)}
|
||||
onClicked:{
|
||||
showContact(newsitemobject.user)}
|
||||
}
|
||||
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
}
|
||||
|
@ -82,7 +88,7 @@ Item {
|
|||
width:parent.width
|
||||
font.pixelSize: 1.5*mm
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
text: Qt.atob(newsitemobject.user.name)+forumname
|
||||
text: newsitemobject.user.name+forumname
|
||||
}
|
||||
}
|
||||
Column {
|
||||
|
@ -143,7 +149,7 @@ Item {
|
|||
linkColor: "light green"
|
||||
id: itemMessage
|
||||
textFormat: Text.RichText
|
||||
text:Qt.atob(newsitemobject.statusnet_html)
|
||||
text:newsitemobject.statusnet_html
|
||||
width: newsitem.width-8*mm-2
|
||||
height: Math.min(implicitHeight,3/4*root.height)
|
||||
wrapMode: Text.Wrap
|
||||
|
@ -151,6 +157,14 @@ Item {
|
|||
onLinkActivated:{
|
||||
Qt.openUrlExternally(link)}
|
||||
Component.onCompleted:{
|
||||
if (newsitemobject.messagetype==0){
|
||||
var hashtags=[];
|
||||
hashtags=findTags(newsitemobject.text);
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/Hashtag.qml");
|
||||
for (var tags in hashtags){
|
||||
var hashtagQml = component.createObject(friendicaActivities,{"text":hashtags[tags].trim()});
|
||||
}}
|
||||
|
||||
if (newsitemobject.attachmentList.length>0){
|
||||
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url);
|
||||
var attachcomponent = Qt.createQmlObject('import QtQuick 2.0; '+
|
||||
|
@ -198,7 +212,7 @@ Item {
|
|||
text: friendica_activities.likeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.like)}
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)}
|
||||
}
|
||||
}
|
||||
Label{color: "grey"
|
||||
|
@ -207,7 +221,7 @@ Item {
|
|||
text: friendica_activities.dislikeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.dislike)}
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.dislike)}
|
||||
}
|
||||
}
|
||||
Label{color: "grey"
|
||||
|
@ -216,7 +230,7 @@ Item {
|
|||
text: friendica_activities.attendyesText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.attendyes)}
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendyes)}
|
||||
}}
|
||||
Label{color: "grey"
|
||||
height:3.5*mm
|
||||
|
@ -224,7 +238,7 @@ Item {
|
|||
text: friendica_activities.attendnoText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.attendno)}
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendno)}
|
||||
}
|
||||
}
|
||||
Label{color: "grey"
|
||||
|
@ -233,7 +247,7 @@ Item {
|
|||
text: friendica_activities.attendmaybeText
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: { showActivityContacts(newsitemobject.attendmaybe)}
|
||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendmaybe)}
|
||||
}
|
||||
}
|
||||
Label{
|
||||
|
@ -267,8 +281,8 @@ Item {
|
|||
}
|
||||
}
|
||||
onClicked: {
|
||||
if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.status_id,root);dislikeCheckbox.checked=false; model.friendica_activities.self.liked=0 }
|
||||
else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.status_id,root); model.friendica_activities.self.liked=1}}
|
||||
if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.id,root);dislikeCheckbox.checked=false; model.friendica_activities.self.liked=0 }
|
||||
else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.id,root); model.friendica_activities.self.liked=1}}
|
||||
}
|
||||
CheckBox{
|
||||
id: dislikeCheckbox
|
||||
|
@ -289,8 +303,8 @@ Item {
|
|||
}
|
||||
}
|
||||
onClicked: {
|
||||
if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.status_id,root);likeCheckbox.checked=false; model.friendica_activities.self.disliked=0}
|
||||
else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.status_id,root); model.friendica_activities.self.disliked=1}}
|
||||
if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.id,root);likeCheckbox.checked=false; model.friendica_activities.self.disliked=0}
|
||||
else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.id,root); model.friendica_activities.self.disliked=1}}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
|
@ -312,22 +326,23 @@ Item {
|
|||
checked:(newsitemobject.favorited>0)
|
||||
onClicked:{
|
||||
if(favoritedCheckbox.checkedState==Qt.Checked){
|
||||
Newsjs.favorite(login,true,newsitemobject.status_id,root); model.newsitemobject.favorited=1}
|
||||
Newsjs.favorite(login,true,newsitemobject.id,root); model.newsitemobject.favorited=1}
|
||||
else if(favoritedCheckbox.checkedState==Qt.Unchecked){
|
||||
Newsjs.favorite(login,false,newsitemobject.status_id,root);model.newsitemobject.favorited=0}
|
||||
Newsjs.favorite(login,false,newsitemobject.id,root);model.newsitemobject.favorited=0}
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
width: 10*mm
|
||||
height: 4*mm
|
||||
visible:(newsitemobject.messagetype!==2)
|
||||
color:"transparent"
|
||||
Text{
|
||||
id:newsmenusymbol
|
||||
color: "grey"
|
||||
anchors.centerIn: parent
|
||||
font.pixelSize: 2*mm
|
||||
font.bold: true
|
||||
text: "\u22EE"
|
||||
font.pixelSize: 2.5*mm
|
||||
font.family:fontAwesome.name
|
||||
text: "\uf142"
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
|
@ -336,7 +351,7 @@ Item {
|
|||
Rectangle{
|
||||
width: 10*mm
|
||||
height: 4*mm
|
||||
visible:newstab.newstabstatus!="Conversation"
|
||||
visible:(newsitemobject.messagetype!==2)&&(newstab.newstabstatus!="Conversation")
|
||||
color:"transparent"
|
||||
Text{
|
||||
id:conversationsymbol
|
||||
|
@ -365,7 +380,7 @@ Item {
|
|||
onTriggered: {
|
||||
var directmessage=0;
|
||||
if (newsitemobject.messagetype==1){ directmessage=1}
|
||||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.status_id,"login":root.login,"directmessage":directmessage}});
|
||||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.id,"login":root.login,"directmessage":directmessage}});
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
|
@ -377,7 +392,7 @@ Item {
|
|||
MenuItem {
|
||||
text: qsTr("Repost")
|
||||
onTriggered: {
|
||||
Newsjs.retweetNews(root.login,db,newsitemobject.status_id,root,function(reply){
|
||||
Newsjs.retweetNews(root.login,db,newsitemobject.id,root,function(reply){
|
||||
Helperjs.showMessage("Repost",qsTr("Success!"),root)
|
||||
})
|
||||
}
|
||||
|
@ -396,17 +411,17 @@ Item {
|
|||
title: qsTr("Attending")
|
||||
MenuItem{
|
||||
text:qsTr("yes")
|
||||
onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.status_id,root,function(){
|
||||
onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.id,root,function(){
|
||||
model.friendica_activities.self.attending="yes";attending="yes"})
|
||||
}
|
||||
}
|
||||
MenuItem{text:qsTr("maybe")
|
||||
onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.status_id,root,function(){
|
||||
onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.id,root,function(){
|
||||
model.friendica_activities.self.attending="maybe";attending="maybe"})
|
||||
}
|
||||
}
|
||||
MenuItem{text:qsTr("no")
|
||||
onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.status_id,root,function(){
|
||||
onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.id,root,function(){
|
||||
model.friendica_activities.self.attending="no";attending="no"})}
|
||||
}
|
||||
}
|
||||
|
@ -414,7 +429,7 @@ Item {
|
|||
MenuItem {
|
||||
text: qsTr("Delete")
|
||||
onTriggered: {
|
||||
Newsjs.deleteNews(root.login,root.db,newsitemobject.status_id,newsitemobject.messagetype,root,function(reply){
|
||||
Newsjs.deleteNews(root.login,root.db,newsitemobject.id,newsitemobject.messagetype,root,function(reply){
|
||||
var msg = {'deleteId': index, 'model': newsModel};
|
||||
newsWorker.sendMessage(msg);
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue