forked from lubuwest/Friendiqa
Friendiqa v0.3.1
This commit is contained in:
parent
6f9aad9099
commit
2afa7cbe6b
29 changed files with 490 additions and 465 deletions
|
@ -30,8 +30,8 @@
|
|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick.Controls 2.3
|
||||
//import QtQuick.Controls.Styles 2.3
|
||||
import QtQuick.Dialogs 1.3
|
||||
import "qrc:/qml/genericqml"
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
|
@ -44,16 +44,6 @@ Item {
|
|||
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;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,7 +122,7 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
function search(term){print("Search "+term)
|
||||
function search(term){//print("Search "+term)
|
||||
if (term!=""){
|
||||
newstab.newstabstatus="Search";
|
||||
newsBusy.running=true;
|
||||
|
@ -161,19 +151,21 @@ Item {
|
|||
|
||||
function onDirectMessage(friend){
|
||||
newstab.newstabstatus="SendMessage"
|
||||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}});
|
||||
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": friend,"directmessage":1,"login":root.login});
|
||||
}
|
||||
|
||||
function sendUrls(urls){
|
||||
if((urls.length==1)&&(newsStack.depth<2)){
|
||||
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:urls}}])
|
||||
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"attachImageURLs":urls})
|
||||
}
|
||||
}
|
||||
|
||||
function sendtext(text){
|
||||
if(text&&(newsStack.depth<2)){
|
||||
if (text.subject=="undefined"){text.subject=""}
|
||||
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{bodyMessage:text.subject+"\n"+text.plaintext}}])
|
||||
if(text.plaintext.lastIndexOf(".jpg")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1 || text.plaintext.lastIndexOf(".png")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1){
|
||||
text.plaintext="<a href="+text.plaintext+"><img src="+text.plaintext+"></a>"}
|
||||
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"bodyMessage":text.subject+"\n"+text.plaintext})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,96 +180,28 @@ Item {
|
|||
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()}
|
||||
onClicked: {newstabmenu.popup(2*mm,6*mm)}
|
||||
|
||||
Menu{id:newstabmenu
|
||||
MenuItem {
|
||||
width: 40*mm
|
||||
|
||||
delegate:MenuItem{
|
||||
contentItem: Text{
|
||||
font.pixelSize: 3.5*mm
|
||||
text:parent.text
|
||||
}
|
||||
background: Rectangle {
|
||||
implicitWidth: 40*mm; implicitHeight: 5*mm
|
||||
color: "#ffffff"
|
||||
border.color: "grey"
|
||||
}
|
||||
}
|
||||
Action {
|
||||
text: qsTr("Timeline")
|
||||
onTriggered: {
|
||||
newstab.newstabstatus="Timeline";
|
||||
|
@ -286,7 +210,7 @@ Item {
|
|||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)}}
|
||||
}
|
||||
MenuItem {
|
||||
Action {
|
||||
text: qsTr("Conversations")
|
||||
onTriggered:{
|
||||
newsModel.clear();
|
||||
|
@ -294,15 +218,14 @@ Item {
|
|||
Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)})
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
Action {
|
||||
text: qsTr("Favorites")
|
||||
onTriggered:{
|
||||
newstab.newstabstatus="Favorites";
|
||||
// root.contactLoadType="favorites";
|
||||
Service.updateView("Favorites")
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
Action {
|
||||
text: qsTr("Public timeline")
|
||||
onTriggered:{
|
||||
newstab.newstabstatus="Public Timeline";
|
||||
|
@ -310,25 +233,25 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
Action {
|
||||
text: qsTr("Direct Messages")
|
||||
onTriggered:{
|
||||
newstab.newstabstatus="Direct Messages";
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
Action {
|
||||
text: qsTr("Notifications")
|
||||
onTriggered:{
|
||||
newstab.newstabstatus="Notifications";
|
||||
Service.updateView("Notifications")
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
Action {
|
||||
text: qsTr("Group news")
|
||||
onTriggered:Service.showGroups();
|
||||
}
|
||||
MenuItem {
|
||||
Action {
|
||||
text: qsTr("Quit")
|
||||
onTriggered:{
|
||||
Service.cleanNews(root.db,function(){
|
||||
|
@ -370,7 +293,7 @@ Item {
|
|||
});
|
||||
newstab.newstabstatus="SendMessage";
|
||||
Helperjs.readData(root.db,"contacts",root.login.username,function(friends){
|
||||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"contacts": friends,"login":root.login}})
|
||||
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"contacts": friends,"login":root.login})
|
||||
},"isFriend",1);
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +309,7 @@ Item {
|
|||
id: update
|
||||
text: "\uf021"
|
||||
onClicked: {
|
||||
//root.contactLoadType="news";
|
||||
root.contactLoadType="news";
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
}
|
||||
|
@ -502,21 +425,18 @@ Item {
|
|||
}
|
||||
|
||||
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){}
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
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(osSettings.imagePickQml=="ImagePicker"){var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml");
|
||||
var IntentReceiverQml = component.createObject(root)
|
||||
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)})}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue