Version 0.002 code cleanup and event attending

This commit is contained in:
LubuWest 2017-01-29 17:26:09 +01:00
parent dc7e6cdee5
commit d8186978e7
42 changed files with 925 additions and 968 deletions

View file

@ -2,7 +2,8 @@
QML based client for the Friendica Social Network.
Tabs for news (incl. Direct Messages), friends and photos.
OS: currently Linux and Android(4.4.4).
OS: currently Linux and Android(4.3).
Source code is a QtCreator project.
## Screenshots ##
@ -16,20 +17,22 @@ OS: currently Linux and Android(4.4.4).
# News #
Currently supported:
* Shows Posts from friends, Direct Messages and Notifications
* Shows Posts from friends, favorited messages, Direct Messages and Notifications
* Show news as timeline or tree (conversation opens in separate window)
* Open links in external browser
* Deletion, Reposting, Answering of Posts
* Liking, disliking, favoriting
* Liking, disliking, favoriting
* Attending events
* Update fetches new posts since last in local DB
* More shows older posts from local DB
* New Message with images, also possible as DM, Contact/Group access rights
* Create new Message with images or direct messages, Contact/Group access rights
ToDo:
* Nice symbols for liking, disliking
* Videos and other binary data as attachment (sending and receiving)
* Rich text editing in Send Dialog
* Attachments for Direct messages (currently not supported in API
* Attachments for Direct messages (currently not supported in API)
* Better image selection (currently ugly file dialog)

Binary file not shown.

View file

@ -21,7 +21,6 @@ signals:
void error(QString data, int code);
public slots:
//void setDirectory(QString Directory);
void makeDir(QString name);
void rmDir();
void rmFile(QString name);

View file

@ -88,17 +88,12 @@ void XHR::clearParams()
void XHR::download()
{
QUrl requrl(m_url);
//qDebug()<< "replyerror"<<reply->error();
// qDebug() << "start download of " << requrl;
request.setUrl(requrl);
reply = manager.get(request);
// qDebug() << "reply " << reply->header(QNetworkRequest::LocationHeader)<<reply->header(QNetworkRequest::LastModifiedHeader);
// qDebug() << "request " << request.url();
// reply->ignoreSslErrors();
connect(reply, &QNetworkReply::readyRead,this, &XHR::onReadyRead);
//connect(reply,SIGNAL(downloadProgress(qint64,qint64)), this,SLOT(updateDownloadProgress(qint64,qint64)));
connect(reply, &QNetworkReply::finished,this, &XHR::onRequestFinished);
//connect(reply, SIGNAL(finished()),this, SLOT(onRequestFinished()));
connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError);
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError)));
}
@ -200,7 +195,6 @@ void XHR::onRequestFinished()
file.write(buffer);
buffer.clear();
file.close();
//qDebug() << m_url << "File downloaded "<<file.fileName();
emit this->downloaded(m_downloadtype);
//reply->deleteLater();
}

View file

@ -292,32 +292,32 @@ function like(login,database,toggle,verb,newsid,rootwindow){
function attend(login,database,attend,newsid,rootwindow,callback){
Helperjs.friendicaPostRequest(login,"/api/friendica/activity/attend"+attend+"?id="+newsid, rootwindow,function (obj){
var attendReturn=JSON.parse(obj);
// print("attend: "+obj);
if (attendReturn=="OK")
{var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
//print("attend: "+attend+obj);
if (obj=='"ok"')
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) {
var currentActivities_rs=tx.executeSql('select friendica_activities_self from news WHERE username="'+login.username+'" AND status_id='+newsid) ;
var currentActivities=JSON.parse(currentActivities_rs.rows.item(0));
print("currentActivities "+JSON.stringify(currentActivities));
if ((attend=="attendyes")&&(currentActivities.indexOf(3)==-1)){
var currentActivities=JSON.parse(currentActivities_rs.rows.item(0).friendica_activities_self);
if ((attend=="yes")&&(currentActivities.indexOf(3)==-1)){
currentActivities.push(3);
currentActivities.splice(currentActivities.indexOf(4),1)
currentActivities.splice(currentActivities.indexOf(5),1)
if (currentActivities.indexOf(4)!=-1){currentActivities.splice(currentActivities.indexOf(4),1)}
if (currentActivities.indexOf(5)!=-1){currentActivities.splice(currentActivities.indexOf(5),1)}
print(JSON.stringify(currentActivities));
}
if ((attend=="attendno")&&(currentActivities.indexOf(4)==-1)){
if ((attend=="no")&&(currentActivities.indexOf(4)==-1)){
currentActivities.push(4);
currentActivities.splice(currentActivities.indexOf(3),1)
currentActivities.splice(currentActivities.indexOf(5),1)
if (currentActivities.indexOf(3)!=-1){currentActivities.splice(currentActivities.indexOf(3),1)}
if (currentActivities.indexOf(5)!=-1){currentActivities.splice(currentActivities.indexOf(5),1)}
}
if ((attend=="attendmaybe")&&(currentActivities.indexOf(5)==-1)){
if ((attend=="maybe")&&(currentActivities.indexOf(5)==-1)){
currentActivities.push(5);
currentActivities.splice(currentActivities.indexOf(3),1)
currentActivities.splice(currentActivities.indexOf(4),1)
if (currentActivities.indexOf(3)!=-1){currentActivities.splice(currentActivities.indexOf(3),1)}
if (currentActivities.indexOf(4)!=-1){currentActivities.splice(currentActivities.indexOf(4),1)}
}
var result = tx.executeSql('UPDATE news SET friendica_activities_self ="'+JSON.stringify(currentActivities)+'" where username="'+login.username+'" AND status_id ='+newsid);
callback();
})}})}
})})}
function requestConversation(login,database,newsid,contacts,rootwindow,callback){
Helperjs.friendicaRequest(login,"/api/conversation/show?id="+newsid,rootwindow, function (obj){

View file

@ -4,7 +4,7 @@ WorkerScript.onMessage = function(msg) {
for (var j=0;j<msg.news.length;j++){
if (msg.news[j]) {
var newsitemobject=msg.news[j];
//print("Newsitem"+JSON.stringify(newsitemobject));
//print("Newsitem"+JSON.stringify(newsitemobject.friendica_activities_self));
if (newsitemobject.messagetype==2){
newsitemobject.user={};
newsitemobject.user.profile_image="";
@ -33,12 +33,12 @@ WorkerScript.onMessage = function(msg) {
if (newsitemobject.attendmaybe.length==1){attendmaybeText= Qt.atob(newsitemobject.attendmaybe[0].name)+" "+ qsTr("may attend.")}
else {attendmaybeText= newsitemobject.attendmaybe.length+" "+ qsTr("persons may attend.")}
}
var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self);
if (friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")}
if (friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")}
if (friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")}
if (friendica_activities_self.indexOf(1)!=-1){self.liked=1}
if (friendica_activities_self.indexOf(2)!=-1){self.disliked=1}
//var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self);
if (newsitemobject.friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")}
if (newsitemobject.friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")}
if (newsitemobject.friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")}
if (newsitemobject.friendica_activities_self.indexOf(1)!=-1){self.liked=1}
if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1}
}
var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self}
//print(JSON.stringify(friendica_activities) ) ;

View file

@ -214,8 +214,8 @@ function cleanNews(database,callback){
}
function processNews(callback){
Newsjs.getCurrentContacts(login,db,function(contacts){
contactlist=contacts});
// Newsjs.getCurrentContacts(login,db,function(contacts){
// contactlist=contacts});
if (contactLoadType=="news"){
if(root.news.length==0){}

View file

@ -214,14 +214,15 @@ StackView{
return obj1.isActive - obj2.isActive;
});
configBackground.users=storedUsers});
isActiveField.text="yes"
isActiveField.text="yes";
//reset values
root.login=userconfig;
root.contactlist=[];
root.news=[]
root.newContacts=[]
root.currentContact= 0
root.contactLoadType= ""
root.news=[];
root.newContacts=[];
root.currentContact= 0;
root.contactLoadType= "";
newstab.newstabstatus=userconfig.newsViewType;
root.currentIndex=0;
newstab.active=true;
})},"isActive",0);

View file

@ -1,6 +1,5 @@
import QtQuick 2.0
import QtQuick.Controls 1.3
import "qrc:/js/layout.js" as Layoutjs
import "qrc:/qml/genericqml"
Item {
@ -61,7 +60,9 @@ states: [
PropertyChanges { target: contactComponent; z: 2 }
PropertyChanges { target: wrapper; width:friendsTabView.width-3*mm;height:friendsTabView.height-10*mm}
PropertyChanges { target: photoImage; width:15*mm;height:15*mm }
PropertyChanges { target:contactComponent.GridView.view;contentY:contactComponent.y;contentX:contactComponent.x;interactive:false}
ParentChange { target: contactComponent; parent:friendstab;x:2*mm;y:13*mm}
//PropertyChanges { target:contactComponent.GridView.view;contentY:0;contentX:0;interactive:false}
//PropertyChanges { target:contactComponent.GridView.view;contentY:contactComponent.y;contentX:contactComponent.x;interactive:false}
}
]
}

View file

@ -6,19 +6,14 @@ Rectangle{
id: detailsrectangle
anchors.top: namelabel.bottom
anchors.topMargin: 2*mm
//opacity: 0
ScrollView{
horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff
frameVisible: true
//Flickable{
id:namelabelflickable
width: root.width-10*mm
height:friendsTabView.height-45*mm
//boundsBehavior:Flickable.StopAtBounds
//flickableDirection:Flickable.VerticalFlick
//contentWidth:width
//contentHeight: namelabeltext.height
clip:true
Text{
id:namelabeltext
@ -43,8 +38,8 @@ Rectangle{
BlueButton{
id:photobutton
text:"Photos"
visible:contact.network=="dfrn"? 1:0
onClicked:{contactComponent.state="";detailsrectangle.destroy();
visible:(contact.network=="dfrn")
onClicked:{
root.currentIndex=2;
fotostab.active=true;
root.fotoSignal(contact) ;
@ -54,7 +49,7 @@ Rectangle{
BlueButton{
id:messagebutton
text:"Messages"
onClicked:{contactComponent.state="";detailsrectangle.destroy();
onClicked:{
root.currentIndex=0;
newstab.active=true;
root.messageSignal(contact.id) ;
@ -63,9 +58,9 @@ Rectangle{
BlueButton{
id:dmbutton
visible: contact.following=="true"?true:false
visible: (contact.following=="true")
text: "DM"
onClicked:{contactComponent.state="";detailsrectangle.destroy();
onClicked:{
root.currentIndex=0;
newstab.active=true;
root.directmessageSignal(contact.screen_name);

View file

@ -1,8 +1,6 @@
import QtQuick 2.0
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/news.js" as Newsjs
import "qrc:/qml/contactqml"
@ -31,7 +29,6 @@ Rectangle {
frameOverlap: 1
tab: Rectangle {
color: "white"
//border.color: "light grey"
implicitWidth: root.width/3-2*mm
implicitHeight: 4*mm
Text { id: text

View file

@ -1,5 +1,4 @@
import QtQuick 2.0
import QtQuick.Controls 1.3
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
@ -20,7 +19,7 @@ import "qrc:/qml/genericqml"
height:10*mm
source:"qrc:/images/defaultcontact.jpg"
}
Label {
Text {
id: namelabel
x: 1
width: wrapper.width-2

View file

@ -1,16 +1,13 @@
import QtQuick 2.0
import QtQuick.LocalStorage 2.0
import QtQuick.Window 2.0
import QtQuick.Dialogs 1.2
//import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import QtQml.Models 2.1
//import QtQml.Models 2.1
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
//import "qrc:/js/layout.js" as Layoutjs
//import "qrc:/js/helper.js" as Helperjs
//import "qrc:/qml"
TabView{
id:root
@ -28,7 +25,7 @@ TabView{
signal newsSignal(var news)
signal friendsSignal(var username)
currentIndex: (login=="")? 3:0
//currentIndex: (login=="")? 3:0
property var news:[]
property var newContacts:[]
@ -36,8 +33,11 @@ TabView{
property string contactLoadType: ""
onLoginChanged:{
Newsjs.getCurrentContacts(login,db,function(contacts){
contactlist=contacts});
if(login==""){root.currentIndex=3}
else{
newstab.newstabstatus=login.newsViewType;
Newsjs.getCurrentContacts(login,db,function(contacts){print(JSON.stringify(contacts));
contactlist=contacts})}
}
onNewContactsChanged:{
if(newContacts.length>0){// download first contact image and update db
@ -127,7 +127,7 @@ TabView{
Tab{
title: qsTr("News")
id: newstab
property string newstabstatus:login.newsViewType
property string newstabstatus//: login.newsViewType
property var conversation
source:(root.currentIndex==0)? "qrc:/qml/newsqml/NewsTab.qml":""
}

View file

@ -31,8 +31,7 @@ Rectangle{
states: [
State { name: "Pressed"
PropertyChanges { target: blueButton; color: "lightsteelblue"} }
//State { name: "RELEASED" PropertyChanges { target: button; color: "lightsteelblue"}
PropertyChanges { target: blueButton; color: "sky blue"} }
]
transitions: [
Transition { to:"*"

View file

@ -1,9 +1,7 @@
// ConversationStack with buttons
import QtQuick 2.0
import QtQuick.Controls 1.2
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
import "qrc:/qml"
Rectangle {
id:conversationStack

View file

@ -1,7 +1,7 @@
// message.qml
// message with buttons
import QtQuick 2.0
import QtQml 2.2
//import QtQml 2.2
import QtQuick.Controls 1.3
import QtQuick.Dialogs 1.2
import "qrc:/js/helper.js" as Helperjs
@ -13,7 +13,6 @@ Flickable{
contentHeight: messageColumn.height
boundsBehavior: Flickable.StopAtBounds
id:messageSend
//property var login
property string parentId: ""
property string reply_to_user:""
property string attachImageURL: "";
@ -135,7 +134,6 @@ Flickable{
if (attachImageURL!=""){
Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment. Remove other attachment first!"), messageColumn)}
else{
try{imageAttachmentObject.destroy()}catch(e){print(e)}
imageAttachmentDialog.open()}
}
}
@ -156,28 +154,25 @@ Flickable{
id: cancelButton
text: qsTr("Cancel")
onClicked: {newstab.newstabstatus=login.newsViewType;
newsStack.pop()}
newsStack.pop()}
}
BlueButton {
id: sendButton
text: qsTr("Send")
onClicked: {
//print("login: "+login.server+login.username);
var title=titleField.text.replace("\"","\'");
var body=bodyField.getText(0,bodyField.length);
if (directmessage==0){
statusUpdate(title,body,messageSend.parentId,attachImageURL.toString())}
else {dmUpdate(title,body,"",messageSend.reply_to_user) }
newsStack.pop()
newstab.newstabstatus=login.newsViewType; newsStack.pop()
}
}
}
}
}
FileDialog {
FileDialog {
id: imageAttachmentDialog
title: "Please choose a picture"
folder: shortcuts.pictures
@ -192,8 +187,5 @@ newsStack.pop()}
else{attachImageURL=imageAttachmentDialog.fileUrl;}
}
onRejected: {
//console.log("Canceled")
}
}
}

View file

@ -1,8 +1,8 @@
import QtQuick 2.0
import QtQuick.Dialogs 1.2
//import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.2
//import QtQuick.LocalStorage 2.0 as Sql
import "qrc:/qml"
//import "qrc:/qml"
import "qrc:/qml/genericqml"
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/helper.js" as Helperjs
@ -15,6 +15,7 @@ Item {
newstabstatusButton.text= qsTr(newstab.newstabstatus)
}
}
Connections{
target:newstab
onConversationChanged:{
@ -23,14 +24,24 @@ Item {
newsStack.push({item:"qrc:/qml/newsqml/Conversation.qml",properties:{"news": conversation}})
}
}
Connections{
target:root
onCurrentContactChanged:{
if (root.newContacts.length>0){
print(Qt.atob(root.newContacts[root.currentContact].name))
}
if(root.currentContact<root.newContacts.length){
downloadNotice.text= qsTr("Download profile image for ")+ root.newContacts[root.currentContact].name;
print(root.newContacts[root.currentContact].name)
}
}else{downloadNotice.text=""}
}
}
Connections{
target:xhr
onError:{if (data=="contact"){downloadNotice.text=downloadNotice.text+"... Error!"}}
}
function showNews(newsToShow){
if (newsStack.depth>1){newsStack.pop()}
newsBusy.running=false;
@ -40,7 +51,7 @@ Item {
}
function onFriendsMessages(friend){
newstab.newstabstatus="Contact";
newstab.newstabstatus="Contact"
Newsjs.newsfromdb(db,root.login.username, function(dbnews){showNews(dbnews)},friend)
}
@ -83,7 +94,7 @@ Item {
var groups=[];
Helperjs.readData(root.db,"groups",root.login.username,function(groupobject){
groups=groupobject});
newstab.newstabstatus="SendMessage"
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}})
},"isFriend",1);
@ -177,7 +188,29 @@ Item {
width:10*mm
height: 10*mm
}
Rectangle{
id:downloadNotice
property alias text: noticeText.text
color:"white"
border.color:"grey"
z:1
anchors.horizontalCenter: newsView.horizontalCenter
anchors.bottom:newsView.bottom
anchors.bottomMargin: 2*mm
width: noticeText.width+2*mm
height: noticeText.height+2*mm
visible: (downloadNotice.text!="")
Text{
id:noticeText
color: "grey"
anchors.centerIn: parent
width: contentWidth
height: contentHeight
font.pixelSize: 2*mm
text:""
}
}
Menu {
id:newstabmenu
MenuItem {
@ -224,6 +257,7 @@ Item {
root.directmessageSignal.connect(onDirectMessage);
root.newsSignal.connect(showNews);
try{newsModel.clear()} catch(e){}
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)})}
}

View file

@ -1,5 +1,5 @@
import QtQuick 2.0
import QtQuick.LocalStorage 2.0
//import QtQuick.LocalStorage 2.0
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "qrc:/js/news.js" as Newsjs
@ -10,16 +10,16 @@ Item {
width: newsView.width
height:Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm)
property string conversation_id: ""
property string attending: ""
onAttendingChanged: {attendLabel.visible=true;
attendLabel.text= qsTr("attending: ")+ qsTr(attending)}
signal replyto(string parent_id)
function showConversation(){
conversationsymbol.color="black";
newsBusy.running=true;
root.contactLoadType="conversation";
//newstabstatus="Conversation";
if(newsitemobject.messagetype==0){
Newsjs.requestConversation(root.login,db,newsitemobject.status_id,root.contactlist,root,function(ns,nc){
@ -27,14 +27,11 @@ Item {
})}
else{Newsjs.conversationfromdb(root.db,root.login.username,newsitemobject.statusnet_conversation_id, function(newsarray){
root.news=newsarray;root.newContacts=[];root.currentContact=1;
})}}
})}
}
Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"}
//MouseArea{
// anchors.fill: parent;
// enabled: (newstabstatus=="Chats")
// onClicked: {showConversation()}
//}
Rectangle{
width:newsitem.width
height:newsitem.height-1
@ -54,12 +51,11 @@ Item {
anchors.fill: parent
onPressAndHold: { newsmenu.popup()}
}
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Label {
id:user_name
color: "grey"
//height:3.5*mm
width:parent.width
font.pixelSize: 1.5*mm
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
@ -85,7 +81,6 @@ Item {
Label {
id:createdAtLabel
color: "grey"
//height:3.5*mm
font.pixelSize: 1.5*mm
horizontalAlignment: Label.AlignRight
text: dateDiff
@ -93,7 +88,6 @@ Item {
Label {
id:replytoLabel
color: "grey"
//height:3.5*mm
font.pixelSize: 1.5*mm
horizontalAlignment: Label.AlignRight
text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name
@ -129,7 +123,8 @@ Item {
Qt.openUrlExternally(link)}
}
Row{id:friendicaActivities
Row{
id:friendicaActivities
spacing:mm
Label{color: "grey"
font.pixelSize: 1.5*mm
@ -152,192 +147,186 @@ Item {
text: friendica_activities.attendmaybeText
}
}
Row {
CheckBox{id:likeCheckbox
height:3*mm
width:8*mm
visible: (newsitemobject.messagetype==0)? true:false
checked:(friendica_activities.self.liked==1)?true:false
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 7*mm
implicitHeight: 3*mm
color:"white"
}
indicator:
Rectangle{
implicitWidth: 3*mm
implicitHeight:3*mm
color:control.checked?"yellow":"white"
x: 5*mm
Text{
font.pixelSize: 2*mm
color:"grey"
text:":-)"
}}
}
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}}
}
CheckBox{id: dislikeCheckbox
height:3*mm
width:8*mm
visible: (newsitemobject.messagetype==0)? true:false
checked: (friendica_activities.self.disliked==1)?true:false
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 7*mm
implicitHeight:3*mm
color:"white"
}
indicator:
Rectangle{
implicitWidth: 3*mm
implicitHeight:3*mm
color:control.checked?"yellow":"white"
x:5*mm
Text{
font.pixelSize: 2*mm
color:"grey"
text:":-("
}}
}
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}}
}
CheckBox {
id:favoritedCheckbox
visible:(newsitemobject.messagetype==0)
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 6*mm
implicitHeight:3*mm
color:"transparent"
}
indicator:
Rectangle{x:3*mm
width: 3*mm
implicitHeight:3*mm
Text{
anchors.centerIn: parent
color:control.checked?"black":"grey"
text:"\u2605"
}}
}
checked:(newsitemobject.favorited>0)
onClicked:{
if(favoritedCheckbox.checkedState==Qt.Checked)
{Newsjs.favorite(login,true,newsitemobject.status_id,root); model.newsitemobject.favorited=1}
else if(favoritedCheckbox.checkedState==Qt.Unchecked)
{Newsjs.favorite(login,false,newsitemobject.status_id,root);model.newsitemobject.favorited=0}
}
}
Rectangle{
width: 4*mm
height: 3*mm
color:"transparent"
Row{
CheckBox{
id:likeCheckbox
height:3*mm
width:8*mm
visible: (newsitemobject.messagetype==0)? true:false
checked:(friendica_activities.self.liked==1)?true:false
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 7*mm
implicitHeight: 3*mm
color:"white"
}
indicator: Rectangle{
implicitWidth: 3*mm
implicitHeight:3*mm
color:control.checked?"yellow":"white"
x: 5*mm
Text{
id:newsmenusymbol
color: "grey"
anchors.centerIn: parent
font.pixelSize: 2*mm
font.bold: true
text: "\u22EE"
font.pixelSize: 3*mm
color:"grey"
text:":-)"
}}
}
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}}
}
CheckBox{
id: dislikeCheckbox
height:3*mm
width:8*mm
visible: (newsitemobject.messagetype==0)? true:false
checked: (friendica_activities.self.disliked==1)?true:false
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 7*mm
implicitHeight:3*mm
color:"white"
}
MouseArea{
indicator: Rectangle{
implicitWidth: 3*mm
implicitHeight:3*mm
color:control.checked?"yellow":"white"
x:5*mm
Text{
font.pixelSize: 3*mm
color:"grey"
text:":-("
}}
}
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}}
}
CheckBox {
id:favoritedCheckbox
visible:(newsitemobject.messagetype==0)
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 6*mm
implicitHeight:3*mm
color:"transparent"
}
indicator:Rectangle{
x:3*mm
width: 3*mm
implicitHeight:3*mm
Text{
anchors.centerIn: parent
color:control.checked?"black":"grey"
text:"\u2605"
}}
}
checked:(newsitemobject.favorited>0)
onClicked:{
if(favoritedCheckbox.checkedState==Qt.Checked){
Newsjs.favorite(login,true,newsitemobject.status_id,root); model.newsitemobject.favorited=1}
else if(favoritedCheckbox.checkedState==Qt.Unchecked){
Newsjs.favorite(login,false,newsitemobject.status_id,root);model.newsitemobject.favorited=0}
}
}
Rectangle{
width: 4*mm
height: 3*mm
color:"transparent"
Text{
id:newsmenusymbol
color: "grey"
anchors.centerIn: parent
font.pixelSize: 2*mm
font.bold: true
text: "\u22EE"
}
MouseArea{
anchors.fill:parent
onClicked: {newsmenu.popup()}}
}
Rectangle{
width: 4*mm
height: 3*mm
color:"transparent"
//visible:(newsitemobject.in_reply_to_status_id!="")?true:false
Text{
id:conversationsymbol
color: "grey"
anchors.centerIn: parent
font.pixelSize: 2*mm
text: "\u21C4"
}
MouseArea{
Rectangle{
width: 4*mm
height: 3*mm
color:"transparent"
Text{
id:conversationsymbol
color: "grey"
anchors.centerIn: parent
font.pixelSize: 2*mm
text: "\u21C4"
}
MouseArea{
anchors.fill:parent
onClicked: showConversation()
}
}
Label {
}
Label{
id:attendLabel
visible: false
//visible: false
color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
horizontalAlignment: Label.AlignRight
text: (friendica_activities.self.attending)?qsTr("attending: ")+ qsTr(attending):""
}
text: (friendica_activities.self.attending)?(qsTr("Attending: ")+ qsTr(friendica_activities.self.attending)):""
}
}
}
Menu {
id:newsmenu
MenuItem {
text: qsTr("Reply")
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}});
id:newsmenu
MenuItem {
text: qsTr("Reply")
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}});
}
}
}
MenuItem {
text: qsTr("DM")
onTriggered: {
root.directmessageSignal(newsitemobject.user.screen_name);
MenuItem {
text: qsTr("DM")
onTriggered: {
root.directmessageSignal(newsitemobject.user.screen_name);
}
}
}
MenuItem {
text: qsTr("Repost")
onTriggered: {
Newsjs.retweetNews(root.login,db,newsitemobject.status_id,root,function(reply){
print(reply);
})
MenuItem {
text: qsTr("Repost")
onTriggered: {
Newsjs.retweetNews(root.login,db,newsitemobject.status_id,root,function(reply){
print(reply)})
}
}
MenuItem {
text: qsTr("Conversation")
onTriggered: showConversation()
}
}
MenuItem {
text: qsTr("Conversation")
onTriggered: showConversation()
}
Menu{
title: qsTr("Attending")
MenuItem{text:qsTr("yes")
Menu{
title: qsTr("Attending")
MenuItem{
text:qsTr("yes")
onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.status_id,root,function(){
newsitem.attending="yes";
attendLabel.visible=true})}
model.friendica_activities.self.attending="yes";attending="yes"})
}
MenuItem{text:qsTr("maybe")
onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.status_id,root,function(){
newsitem.attending="maybe"})}
}
MenuItem{text:qsTr("no")
onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.status_id,root,function(){
newsitem.attending="no"})}
MenuItem{text:qsTr("maybe")
onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.status_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(){
model.friendica_activities.self.attending="no";attending="no"})}
}
}
MenuItem {
text: qsTr("Delete")
onTriggered: {
Newsjs.deleteNews(root.login,root.db,newsitemobject.status_id,newsitemobject.messagetype,root,function(reply){
newsModel.remove(index);
})
MenuItem {
text: qsTr("Delete")
onTriggered: {
Newsjs.deleteNews(root.login,root.db,newsitemobject.status_id,newsitemobject.messagetype,root,function(reply){
newsModel.remove(index)})
}
}
}
}
}
}

View file

@ -1,7 +1,4 @@
import QtQuick 2.0
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4
import QtQml.Models 2.1
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
@ -20,10 +17,8 @@ Rectangle{
group_deny.push(groupModel.get(i).group.gid)
}
}
for (var j=0;j<contactModel.count;j++)
{//print("contact: "+JSON.stringify(contactModel.get(j).contact));
for (var j=0;j<contactModel.count;j++){
if (contactModel.get(j).contactstatus=="positive"){
print(JSON.stringify(contact_allow));
contact_allow.push(contactModel.get(j).contact.cid)
}
if (contactModel.get(j).contactstatus=="negative"){
@ -118,8 +113,8 @@ Rectangle{
property string groupstatus:"neutral"
onGroupstatusChanged:
{if(groupstatus=="positive"){groupitemRect.color="light green"}
else if (groupstatus=="negative"){groupitemRect.color= "red"}
else{groupitemRect.color= "white"}}
else if (groupstatus=="negative"){groupitemRect.color= "red"}
else{groupitemRect.color= "white"}}
color: "white"
border.color:"grey"
Text{
@ -153,9 +148,10 @@ Rectangle{
anchors.bottomMargin:1
text:qsTr("Save")
onClicked:{
updatePerms();
updatePerms();
var perms=[];
perms.push(contact_allow,contact_deny,group_allow,group_deny); Service.savePermissions(db,perms)
perms.push(contact_allow,contact_deny,group_allow,group_deny);
Service.savePermissions(db,perms)
}
}
BlueButton{
@ -163,16 +159,13 @@ Rectangle{
anchors.bottom: parent.bottom
anchors.bottomMargin:1
text:qsTr("Done")
onClicked:{//var group_allow=[];var group_deny=[];
//print("contacts: "+Helperjs.cleanArray(contact_allow))
onClicked:{updatePerms();
permissionDialog.destroy();
}
}
Component.onCompleted:{
Helperjs.readData(db,"contacts",login.username,function(contacts){
Helperjs.readData(db,"contacts",login.username,function(contacts){
for (var name in contacts){
var contactstatus="neutral";
if (contact_allow.indexOf(contacts[name].cid)>-1){contactstatus="positive";print(contacts[name].cid+" pos")}

View file

@ -1,5 +1,4 @@
import QtQuick 2.0
//import QtQuick.LocalStorage 2.0
import QtQuick.Controls 1.2
Package {
@ -17,62 +16,58 @@ Package {
id: placeHolder
color: 'lightblue'; antialiasing: true
anchors.fill:parent
}
BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready }
Image {
id: realImage;
// property string hqphotolink: photoLink
width: photoWrapper.width; height: photoWrapper.height
antialiasing: true;
asynchronous: true
cache: false
fillMode: Image.PreserveAspectFit;
source: imageLocation
// onStatusChanged: if (realImage.status == Image.Ready) print(realImage.paintedHeight+"x"+realImage.paintedWidth)
}
Rectangle{
id:phototextRectangle
color:"black"
z:3
opacity: 0.5
width:phototext.contentWidth
height: phototext.contentHeight
anchors.bottom: photoWrapper.bottom
}
Text {
id:phototext
z:4
text: photoDescription.trim()
width:15*mm
anchors.bottom: photoWrapper.bottom
color: "white"
font.pixelSize: 2*mm
wrapMode:Text.Wrap
}
BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready }
Image {
id: realImage;
width: photoWrapper.width; height: photoWrapper.height
antialiasing: true;
asynchronous: true
cache: false
fillMode: Image.PreserveAspectFit;
source: imageLocation
}
Rectangle{
id:phototextRectangle
color:"black"
z:3
opacity: 0.5
width:phototext.contentWidth
height: phototext.contentHeight
anchors.bottom: photoWrapper.bottom
}
Text {
id:phototext
z:4
text: photoDescription.trim()
width:15*mm
anchors.bottom: photoWrapper.bottom
color: "white"
font.pixelSize: 2*mm
wrapMode:Text.Wrap
}
MouseArea {
width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage
onClicked: {
if (albumWrapper.state == 'inGrid') {
gridItem.GridView.view.currentIndex = index;
albumWrapper.state = 'fullscreen'
} else {
gridItem.GridView.view.currentIndex = index;
albumWrapper.state = 'inGrid'
}
MouseArea {
width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage
onClicked: {
if (albumWrapper.state == 'inGrid') {
gridItem.GridView.view.currentIndex = index;
//print("photoLink"+realImage.photoLink)
albumWrapper.state = 'fullscreen'
} else {
gridItem.GridView.view.currentIndex = index;
albumWrapper.state = 'inGrid'
}
}
}
}
}
states: [
State {
name: 'stacked'; when: albumWrapper.state == ''
states: [
State {
name: 'stacked'; when: albumWrapper.state == ''
ParentChange { target: photoWrapper; parent: stackItem; }//x: 1*mm; y: 1*mm }
PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 }
PropertyChanges { target: phototext; opacity: 0.0 }
PropertyChanges { target: phototextRectangle; opacity: 0.0 }
},
State {
PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 }
PropertyChanges { target: phototext; opacity: 0.0 }
PropertyChanges { target: phototextRectangle; opacity: 0.0 }
},
State {
name: 'inGrid'; when: albumWrapper.state == 'inGrid'
ParentChange { target: photoWrapper; parent: gridItem; x: 1*mm; y: 1*mm;}
PropertyChanges { target: phototext; opacity: 1.0 }
@ -86,14 +81,12 @@ Package {
width: root.width-mm; height: root.height-8*mm
}
PropertyChanges { target: placeHolder; opacity: 0.0 }
PropertyChanges { target: realImage; source: photoWrapper.hqphotolink}
PropertyChanges { target: realImage; source: photoWrapper.hqphotolink}
PropertyChanges { target: phototext; anchors.bottom: realImage.bottom}
PropertyChanges { target: phototext; width:realImage.width }
PropertyChanges { target: phototextRectangle; anchors.bottom: realImage.bottom }
PropertyChanges { target: realImage; width: Math.min(listItem.width,sourceSize.width);height: Math.min(listItem.height,sourceSize.height) }
}
]
}
]
}
}

View file

@ -1,5 +1,5 @@
import QtQuick 2.0
import QtQuick.Dialogs 1.2
//import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4
import QtQml.Models 2.1
import "qrc:/js/service.js" as Service
@ -18,21 +18,17 @@ Rectangle {
color: '#fff'
property var newimages:[]
property int currentimageno: 0
//onLoginChanged:{var msg = {'model': photogroupModel,'albums':[],'firstalbum':0,'foreignPicture':false};
// photoWorker.sendMessage(msg);
//}
onNewimagesChanged:{
if(newimages.length>0){
Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){
//print("albums"+JSON.stringify(albums)+JSON.stringify(newimages[currentimageno]));
for (var i=0;i<newimages.length;i++){
if(albums.indexOf(newimages[i].album)==-1){
filesystem.Directory=root.login.imagestore+"/albums";
filesystem.makeDir(newimages[i].album)}}
if(newimages.length>0){
Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){
for (var i=0;i<newimages.length;i++){
if(albums.indexOf(newimages[i].album)==-1){
filesystem.Directory=root.login.imagestore+"/albums";
filesystem.makeDir(newimages[i].album)}}
})
//print("Current image number"+currentImageNo)
Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab);
newImagesProgress.visible=true //download first image
Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab);
newImagesProgress.visible=true //download first image
}
}
@ -44,20 +40,21 @@ Rectangle {
}
function showOwnFotos(){
try {photogroupModel.clear()}catch (e){print(e)}
Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
if (albums[0]) {
var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false};
photoWorker.sendMessage(msg);
};
})
}
Connections{
target:root
onLoginChanged:{var msg = {'model': photogroupModel,'albums':[],'firstalbum':0,'foreignPicture':false};
photoWorker.sendMessage(msg);}
try {photogroupModel.clear()}catch (e){print(e)}
Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
if (albums[0]) {
var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false};
photoWorker.sendMessage(msg);
}
})
}
Connections{
target:root
onLoginChanged:{
var msg = {'model': photogroupModel,'albums':[],'firstalbum':0,'foreignPicture':false};
photoWorker.sendMessage(msg)}
}
Connections{
target:xhr
@ -72,110 +69,111 @@ Rectangle {
function onFriendsFotos(friend){
fotostab.phototabstatus=friend.screen_name;
//print("Friend "+friend.url);
try {photogroupModel.clear()}catch (e){print(e)}
Service.requestFriendsAlbumPictures(root.login,friend,fotostab,function(albums){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true};
photoWorker.sendMessage(msg);
})
}
Service.requestFriendsAlbumPictures(root.login,friend,fotostab,function(albums){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true}
photoWorker.sendMessage(msg);
})
}
ProgressBar{
id: newImagesProgress
width: 15*mm
height: updatePhotolist.height
anchors.top: parent.top
anchors.right:updatePhotolist.left
anchors.rightMargin:mm
visible: false
value: currentimageno/newimages.length
}
ProgressBar{
id: newImagesProgress
width: 15*mm
height: updatePhotolist.height
anchors.top: parent.top
anchors.right:updatePhotolist.left
anchors.rightMargin:mm
visible: false
value: currentimageno/newimages.length
}
BlueButton{
id: updatePhotolist
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:phototabstatusButton.left
anchors.rightMargin:mm
text: qsTr("Update")
onClicked: {
Service.requestList(root.login,root.db, fotostab,function(obj){
newimages=obj;print("newimages"+JSON.stringify(obj))
})}}
BlueButton{
id: updatePhotolist
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:phototabstatusButton.left
anchors.rightMargin:mm
text: qsTr("Update")
onClicked: {
Service.requestList(root.login,root.db, fotostab,function(obj){
newimages=obj;print("newimages"+JSON.stringify(obj))
})}}
BlueButton{
id: phototabstatusButton
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right: parent.right
anchors.rightMargin:2*mm
text: qsTr(phototabstatus)
onClicked: {phototabmenu.popup()}
}
Menu {
id:phototabmenu
MenuItem {
text: qsTr("Own Images")
onTriggered: {
phototabstatus="Images";
showOwnFotos()}
}
}
DelegateModel{
id: visualphotoModel
delegate: PhotogroupComponent{}
model: photogroupModel
}
ListModel{
id: photogroupModel
}
GridView {
id: albumgridview
cellWidth: 17*mm
cellHeight: 17*mm
x: mm;y:8*mm
width: parent.width-2*mm; height: parent.height-9*mm
clip: true
model: visualphotoModel.parts.album
footer:
Rectangle{
border.color: "#EEEEEE"
border.width: 1
width:12*mm
height:6*mm
Text{
font.pixelSize: 1.5*mm
anchors.centerIn: parent
text:qsTr("More")
}
MouseArea{anchors.fill:parent
onClicked:{
var lastalbum_id=photogroupModel.get(photogroupModel.count-1);
if(photogroupModel.get(photogroupModel.count-1).foreignPictures==false){Service.requestFriendsAlbumPictures(friend,fotostab,function(albums){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true};
photoWorker.sendMessage(msg); })}
else { Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
var msg = { 'model': photogroupModel,'albums':albums,'foreignPicture': false,'firstalbum':lastalbum_id+1};
photoWorker.sendMessage(msg)})}
}}}
}
Rectangle { id: photoBackground; color: 'light grey'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 }
ListView { anchors.fill: parent; model: visualphotoModel.parts.browser; interactive: false }
BlueButton {
id: backButton
text: qsTr("Back")
x: parent.width - backButton.width - 3*mm
y: -backButton.height - 4*mm
onClicked: {photoBackground.opacity=0}
}
ListView {anchors.fill: parent; model: visualphotoModel.parts.fullscreen; interactive: false }
WorkerScript{id: photoWorker;source: "qrc:/js/photoworker.js"}
Component.onCompleted: { root.fotoSignal.connect(onFriendsFotos);}
BlueButton{
id: phototabstatusButton
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right: parent.right
anchors.rightMargin:2*mm
text: qsTr(phototabstatus)
onClicked: {phototabmenu.popup()}
}
Menu {
id:phototabmenu
MenuItem {
text: qsTr("Own Images")
onTriggered: {
phototabstatus="Images";
showOwnFotos()}
}
}
DelegateModel{
id: visualphotoModel
delegate: PhotogroupComponent{}
model: photogroupModel
}
ListModel{
id: photogroupModel
}
GridView {
id: albumgridview
cellWidth: 17*mm
cellHeight: 17*mm
x: mm;y:8*mm
width: parent.width-2*mm; height: parent.height-9*mm
clip: true
model: visualphotoModel.parts.album
footer:Rectangle{
border.color: "#EEEEEE"
border.width: 1
width:12*mm
height:6*mm
Text{
font.pixelSize: 1.5*mm
anchors.centerIn: parent
text:qsTr("More")
}
MouseArea{anchors.fill:parent
onClicked:{
var lastalbum_id=photogroupModel.get(photogroupModel.count-1);
if(photogroupModel.get(photogroupModel.count-1).foreignPictures==false){
Service.requestFriendsAlbumPictures(friend,fotostab,function(albums){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true}
photoWorker.sendMessage(msg)
})}
else{Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
var msg = { 'model': photogroupModel,'albums':albums,'foreignPicture': false,'firstalbum':lastalbum_id+1};
photoWorker.sendMessage(msg)})}
}}}
}
Rectangle { id: photoBackground; color: 'light grey'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 }
ListView { anchors.fill: parent; model: visualphotoModel.parts.browser; interactive: false }
BlueButton {
id: backButton
text: qsTr("Back")
x: parent.width - backButton.width - 3*mm
y: -backButton.height - 4*mm
onClicked: {photoBackground.opacity=0}
}
ListView {anchors.fill: parent; model: visualphotoModel.parts.fullscreen; interactive: false }
WorkerScript{id: photoWorker;source: "qrc:/js/photoworker.js"}
Component.onCompleted: { root.fotoSignal.connect(onFriendsFotos)}
}

View file

@ -1,5 +1,4 @@
import QtQuick 2.0
import QtQuick.LocalStorage 2.0
import QtQuick.Controls 1.3
import QtQml.Models 2.1
import "qrc:/js/service.js" as Service
@ -27,8 +26,7 @@ Package {
Item {
Package.name: 'album'
id: albumWrapper; width: 16.5*mm; height: 16.5*mm //-albumtext.contentHeight
id: albumWrapper; width: 16.5*mm; height: 16.5*mm
DelegateModel {
id: visualModel; delegate: PhotoComponent { }
model: photoModel
@ -55,7 +53,7 @@ Package {
}
Text {
id:albumtext
text: albumname //foreignPicture ? album.name.trim() : album
text: albumname
width:albumWrapper.width-1*mm
height: albumtext.contentHeight
wrapMode:Text.Wrap
@ -72,25 +70,21 @@ Package {
Component.onCompleted:{
try {photoModel.clear()}catch (e){print(e)}
if(foreignPicture){
//print("Albumlink"+album.link);
Service.requestFriendsPictures(albumlink,fotostab,function(obj){
if (obj) {
for (var k=0;k<obj.length;k++){
//print("Photomodel:"+obj[k].thumb+obj[k].name+obj[k].link);
photoModel.append({"imageLocation": obj[k].thumb,"photoDescription":obj[k].name,"photoLink":obj[k].link})
};
}
if (obj) {
for (var k=0;k<obj.length;k++){
photoModel.append({"imageLocation": obj[k].thumb,"photoDescription":obj[k].name,"photoLink":obj[k].link})
}
}
})}
else{
Helperjs.readData(db,"imageData",root.login.username,function(obj){
// obj.sort(function(obj1,obj2){return obj1.data-obj2.data});
if (obj) {
for (var k=0;k<obj.length;k++){
// print("Photomodel:"+obj[k].location+obj[k].filename);
photoModel.append({"imageLocation": obj[k].location+obj[k].filename,"photoDescription":obj[k].filename,"photoLink":obj[k].location+obj[k].filename})
};
}
},"album",albumname)}
if (obj) {
for (var k=0;k<obj.length;k++){
photoModel.append({"imageLocation": obj[k].location+obj[k].filename,"photoDescription":obj[k].filename,"photoLink":obj[k].location+obj[k].filename})
}
}
},"album",albumname)}
}
MouseArea {

View file

@ -21,7 +21,6 @@ signals:
void error(QString data, int code);
public slots:
//void setDirectory(QString Directory);
void makeDir(QString name);
void rmDir();
void rmFile(QString name);

View file

@ -88,17 +88,12 @@ void XHR::clearParams()
void XHR::download()
{
QUrl requrl(m_url);
//qDebug()<< "replyerror"<<reply->error();
// qDebug() << "start download of " << requrl;
request.setUrl(requrl);
reply = manager.get(request);
// qDebug() << "reply " << reply->header(QNetworkRequest::LocationHeader)<<reply->header(QNetworkRequest::LastModifiedHeader);
// qDebug() << "request " << request.url();
// reply->ignoreSslErrors();
connect(reply, &QNetworkReply::readyRead,this, &XHR::onReadyRead);
//connect(reply,SIGNAL(downloadProgress(qint64,qint64)), this,SLOT(updateDownloadProgress(qint64,qint64)));
connect(reply, &QNetworkReply::finished,this, &XHR::onRequestFinished);
//connect(reply, SIGNAL(finished()),this, SLOT(onRequestFinished()));
connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError);
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError)));
}
@ -200,7 +195,6 @@ void XHR::onRequestFinished()
file.write(buffer);
buffer.clear();
file.close();
//qDebug() << m_url << "File downloaded "<<file.fileName();
emit this->downloaded(m_downloadtype);
//reply->deleteLater();
}

View file

@ -292,32 +292,32 @@ function like(login,database,toggle,verb,newsid,rootwindow){
function attend(login,database,attend,newsid,rootwindow,callback){
Helperjs.friendicaPostRequest(login,"/api/friendica/activity/attend"+attend+"?id="+newsid, rootwindow,function (obj){
var attendReturn=JSON.parse(obj);
// print("attend: "+obj);
if (attendReturn=="OK")
{var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
//print("attend: "+attend+obj);
if (obj=='"ok"')
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) {
var currentActivities_rs=tx.executeSql('select friendica_activities_self from news WHERE username="'+login.username+'" AND status_id='+newsid) ;
var currentActivities=JSON.parse(currentActivities_rs.rows.item(0));
print("currentActivities "+JSON.stringify(currentActivities));
if ((attend=="attendyes")&&(currentActivities.indexOf(3)==-1)){
var currentActivities=JSON.parse(currentActivities_rs.rows.item(0).friendica_activities_self);
if ((attend=="yes")&&(currentActivities.indexOf(3)==-1)){
currentActivities.push(3);
currentActivities.splice(currentActivities.indexOf(4),1)
currentActivities.splice(currentActivities.indexOf(5),1)
if (currentActivities.indexOf(4)!=-1){currentActivities.splice(currentActivities.indexOf(4),1)}
if (currentActivities.indexOf(5)!=-1){currentActivities.splice(currentActivities.indexOf(5),1)}
print(JSON.stringify(currentActivities));
}
if ((attend=="attendno")&&(currentActivities.indexOf(4)==-1)){
if ((attend=="no")&&(currentActivities.indexOf(4)==-1)){
currentActivities.push(4);
currentActivities.splice(currentActivities.indexOf(3),1)
currentActivities.splice(currentActivities.indexOf(5),1)
if (currentActivities.indexOf(3)!=-1){currentActivities.splice(currentActivities.indexOf(3),1)}
if (currentActivities.indexOf(5)!=-1){currentActivities.splice(currentActivities.indexOf(5),1)}
}
if ((attend=="attendmaybe")&&(currentActivities.indexOf(5)==-1)){
if ((attend=="maybe")&&(currentActivities.indexOf(5)==-1)){
currentActivities.push(5);
currentActivities.splice(currentActivities.indexOf(3),1)
currentActivities.splice(currentActivities.indexOf(4),1)
if (currentActivities.indexOf(3)!=-1){currentActivities.splice(currentActivities.indexOf(3),1)}
if (currentActivities.indexOf(4)!=-1){currentActivities.splice(currentActivities.indexOf(4),1)}
}
var result = tx.executeSql('UPDATE news SET friendica_activities_self ="'+JSON.stringify(currentActivities)+'" where username="'+login.username+'" AND status_id ='+newsid);
callback();
})}})}
})})}
function requestConversation(login,database,newsid,contacts,rootwindow,callback){
Helperjs.friendicaRequest(login,"/api/conversation/show?id="+newsid,rootwindow, function (obj){

View file

@ -4,7 +4,7 @@ WorkerScript.onMessage = function(msg) {
for (var j=0;j<msg.news.length;j++){
if (msg.news[j]) {
var newsitemobject=msg.news[j];
//print("Newsitem"+JSON.stringify(newsitemobject));
//print("Newsitem"+JSON.stringify(newsitemobject.friendica_activities_self));
if (newsitemobject.messagetype==2){
newsitemobject.user={};
newsitemobject.user.profile_image="";
@ -33,12 +33,12 @@ WorkerScript.onMessage = function(msg) {
if (newsitemobject.attendmaybe.length==1){attendmaybeText= Qt.atob(newsitemobject.attendmaybe[0].name)+" "+ qsTr("may attend.")}
else {attendmaybeText= newsitemobject.attendmaybe.length+" "+ qsTr("persons may attend.")}
}
var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self);
if (friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")}
if (friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")}
if (friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")}
if (friendica_activities_self.indexOf(1)!=-1){self.liked=1}
if (friendica_activities_self.indexOf(2)!=-1){self.disliked=1}
//var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self);
if (newsitemobject.friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")}
if (newsitemobject.friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")}
if (newsitemobject.friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")}
if (newsitemobject.friendica_activities_self.indexOf(1)!=-1){self.liked=1}
if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1}
}
var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self}
//print(JSON.stringify(friendica_activities) ) ;

View file

@ -214,8 +214,8 @@ function cleanNews(database,callback){
}
function processNews(callback){
Newsjs.getCurrentContacts(login,db,function(contacts){
contactlist=contacts});
// Newsjs.getCurrentContacts(login,db,function(contacts){
// contactlist=contacts});
if (contactLoadType=="news"){
if(root.news.length==0){}

View file

@ -214,14 +214,15 @@ StackView{
return obj1.isActive - obj2.isActive;
});
configBackground.users=storedUsers});
isActiveField.text="yes"
isActiveField.text="yes";
//reset values
root.login=userconfig;
root.contactlist=[];
root.news=[]
root.newContacts=[]
root.currentContact= 0
root.contactLoadType= ""
root.news=[];
root.newContacts=[];
root.currentContact= 0;
root.contactLoadType= "";
newstab.newstabstatus=userconfig.newsViewType;
root.currentIndex=0;
newstab.active=true;
})},"isActive",0);

View file

@ -1,6 +1,5 @@
import QtQuick 2.0
import QtQuick.Controls 1.3
import "qrc:/js/layout.js" as Layoutjs
import "qrc:/qml/genericqml"
Item {
@ -61,7 +60,9 @@ states: [
PropertyChanges { target: contactComponent; z: 2 }
PropertyChanges { target: wrapper; width:friendsTabView.width-3*mm;height:friendsTabView.height-10*mm}
PropertyChanges { target: photoImage; width:15*mm;height:15*mm }
PropertyChanges { target:contactComponent.GridView.view;contentY:contactComponent.y;contentX:contactComponent.x;interactive:false}
ParentChange { target: contactComponent; parent:friendstab;x:2*mm;y:13*mm}
//PropertyChanges { target:contactComponent.GridView.view;contentY:0;contentX:0;interactive:false}
//PropertyChanges { target:contactComponent.GridView.view;contentY:contactComponent.y;contentX:contactComponent.x;interactive:false}
}
]
}

View file

@ -6,19 +6,14 @@ Rectangle{
id: detailsrectangle
anchors.top: namelabel.bottom
anchors.topMargin: 2*mm
//opacity: 0
ScrollView{
horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff
frameVisible: true
//Flickable{
id:namelabelflickable
width: root.width-10*mm
height:friendsTabView.height-45*mm
//boundsBehavior:Flickable.StopAtBounds
//flickableDirection:Flickable.VerticalFlick
//contentWidth:width
//contentHeight: namelabeltext.height
clip:true
Text{
id:namelabeltext
@ -43,8 +38,8 @@ Rectangle{
BlueButton{
id:photobutton
text:"Photos"
visible:contact.network=="dfrn"? 1:0
onClicked:{contactComponent.state="";detailsrectangle.destroy();
visible:(contact.network=="dfrn")
onClicked:{
root.currentIndex=2;
fotostab.active=true;
root.fotoSignal(contact) ;
@ -54,7 +49,7 @@ Rectangle{
BlueButton{
id:messagebutton
text:"Messages"
onClicked:{contactComponent.state="";detailsrectangle.destroy();
onClicked:{
root.currentIndex=0;
newstab.active=true;
root.messageSignal(contact.id) ;
@ -63,9 +58,9 @@ Rectangle{
BlueButton{
id:dmbutton
visible: contact.following=="true"?true:false
visible: (contact.following=="true")
text: "DM"
onClicked:{contactComponent.state="";detailsrectangle.destroy();
onClicked:{
root.currentIndex=0;
newstab.active=true;
root.directmessageSignal(contact.screen_name);

View file

@ -1,8 +1,6 @@
import QtQuick 2.0
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/news.js" as Newsjs
import "qrc:/qml/contactqml"
@ -31,7 +29,6 @@ Rectangle {
frameOverlap: 1
tab: Rectangle {
color: "white"
//border.color: "light grey"
implicitWidth: root.width/3-2*mm
implicitHeight: 4*mm
Text { id: text

View file

@ -1,5 +1,4 @@
import QtQuick 2.0
import QtQuick.Controls 1.3
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
@ -20,7 +19,7 @@ import "qrc:/qml/genericqml"
height:10*mm
source:"qrc:/images/defaultcontact.jpg"
}
Label {
Text {
id: namelabel
x: 1
width: wrapper.width-2

View file

@ -1,16 +1,13 @@
import QtQuick 2.0
import QtQuick.LocalStorage 2.0
import QtQuick.Window 2.0
import QtQuick.Dialogs 1.2
//import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import QtQml.Models 2.1
//import QtQml.Models 2.1
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
//import "qrc:/js/layout.js" as Layoutjs
//import "qrc:/js/helper.js" as Helperjs
//import "qrc:/qml"
TabView{
id:root
@ -28,7 +25,7 @@ TabView{
signal newsSignal(var news)
signal friendsSignal(var username)
currentIndex: (login=="")? 3:0
//currentIndex: (login=="")? 3:0
property var news:[]
property var newContacts:[]
@ -36,8 +33,11 @@ TabView{
property string contactLoadType: ""
onLoginChanged:{
Newsjs.getCurrentContacts(login,db,function(contacts){
contactlist=contacts});
if(login==""){root.currentIndex=3}
else{
newstab.newstabstatus=login.newsViewType;
Newsjs.getCurrentContacts(login,db,function(contacts){print(JSON.stringify(contacts));
contactlist=contacts})}
}
onNewContactsChanged:{
if(newContacts.length>0){// download first contact image and update db
@ -127,7 +127,7 @@ TabView{
Tab{
title: qsTr("News")
id: newstab
property string newstabstatus:login.newsViewType
property string newstabstatus//: login.newsViewType
property var conversation
source:(root.currentIndex==0)? "qrc:/qml/newsqml/NewsTab.qml":""
}

View file

@ -31,8 +31,7 @@ Rectangle{
states: [
State { name: "Pressed"
PropertyChanges { target: blueButton; color: "lightsteelblue"} }
//State { name: "RELEASED" PropertyChanges { target: button; color: "lightsteelblue"}
PropertyChanges { target: blueButton; color: "sky blue"} }
]
transitions: [
Transition { to:"*"

View file

@ -1,9 +1,7 @@
// ConversationStack with buttons
import QtQuick 2.0
import QtQuick.Controls 1.2
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
import "qrc:/qml"
Rectangle {
id:conversationStack

View file

@ -1,7 +1,7 @@
// message.qml
// message with buttons
import QtQuick 2.0
import QtQml 2.2
//import QtQml 2.2
import QtQuick.Controls 1.3
import QtQuick.Dialogs 1.2
import "qrc:/js/helper.js" as Helperjs
@ -13,7 +13,6 @@ Flickable{
contentHeight: messageColumn.height
boundsBehavior: Flickable.StopAtBounds
id:messageSend
//property var login
property string parentId: ""
property string reply_to_user:""
property string attachImageURL: "";
@ -135,7 +134,6 @@ Flickable{
if (attachImageURL!=""){
Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment. Remove other attachment first!"), messageColumn)}
else{
try{imageAttachmentObject.destroy()}catch(e){print(e)}
imageAttachmentDialog.open()}
}
}
@ -156,28 +154,25 @@ Flickable{
id: cancelButton
text: qsTr("Cancel")
onClicked: {newstab.newstabstatus=login.newsViewType;
newsStack.pop()}
newsStack.pop()}
}
BlueButton {
id: sendButton
text: qsTr("Send")
onClicked: {
//print("login: "+login.server+login.username);
var title=titleField.text.replace("\"","\'");
var body=bodyField.getText(0,bodyField.length);
if (directmessage==0){
statusUpdate(title,body,messageSend.parentId,attachImageURL.toString())}
else {dmUpdate(title,body,"",messageSend.reply_to_user) }
newsStack.pop()
newstab.newstabstatus=login.newsViewType; newsStack.pop()
}
}
}
}
}
FileDialog {
FileDialog {
id: imageAttachmentDialog
title: "Please choose a picture"
folder: shortcuts.pictures
@ -192,8 +187,5 @@ newsStack.pop()}
else{attachImageURL=imageAttachmentDialog.fileUrl;}
}
onRejected: {
//console.log("Canceled")
}
}
}

View file

@ -1,8 +1,8 @@
import QtQuick 2.0
import QtQuick.Dialogs 1.2
//import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.2
//import QtQuick.LocalStorage 2.0 as Sql
import "qrc:/qml"
//import "qrc:/qml"
import "qrc:/qml/genericqml"
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/helper.js" as Helperjs
@ -15,6 +15,7 @@ Item {
newstabstatusButton.text= qsTr(newstab.newstabstatus)
}
}
Connections{
target:newstab
onConversationChanged:{
@ -23,14 +24,24 @@ Item {
newsStack.push({item:"qrc:/qml/newsqml/Conversation.qml",properties:{"news": conversation}})
}
}
Connections{
target:root
onCurrentContactChanged:{
if (root.newContacts.length>0){
print(Qt.atob(root.newContacts[root.currentContact].name))
}
if(root.currentContact<root.newContacts.length){
downloadNotice.text= qsTr("Download profile image for ")+ root.newContacts[root.currentContact].name;
print(root.newContacts[root.currentContact].name)
}
}else{downloadNotice.text=""}
}
}
Connections{
target:xhr
onError:{if (data=="contact"){downloadNotice.text=downloadNotice.text+"... Error!"}}
}
function showNews(newsToShow){
if (newsStack.depth>1){newsStack.pop()}
newsBusy.running=false;
@ -40,7 +51,7 @@ Item {
}
function onFriendsMessages(friend){
newstab.newstabstatus="Contact";
newstab.newstabstatus="Contact"
Newsjs.newsfromdb(db,root.login.username, function(dbnews){showNews(dbnews)},friend)
}
@ -83,7 +94,7 @@ Item {
var groups=[];
Helperjs.readData(root.db,"groups",root.login.username,function(groupobject){
groups=groupobject});
newstab.newstabstatus="SendMessage"
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}})
},"isFriend",1);
@ -177,7 +188,29 @@ Item {
width:10*mm
height: 10*mm
}
Rectangle{
id:downloadNotice
property alias text: noticeText.text
color:"white"
border.color:"grey"
z:1
anchors.horizontalCenter: newsView.horizontalCenter
anchors.bottom:newsView.bottom
anchors.bottomMargin: 2*mm
width: noticeText.width+2*mm
height: noticeText.height+2*mm
visible: (downloadNotice.text!="")
Text{
id:noticeText
color: "grey"
anchors.centerIn: parent
width: contentWidth
height: contentHeight
font.pixelSize: 2*mm
text:""
}
}
Menu {
id:newstabmenu
MenuItem {
@ -224,6 +257,7 @@ Item {
root.directmessageSignal.connect(onDirectMessage);
root.newsSignal.connect(showNews);
try{newsModel.clear()} catch(e){}
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)})}
}

View file

@ -1,5 +1,5 @@
import QtQuick 2.0
import QtQuick.LocalStorage 2.0
//import QtQuick.LocalStorage 2.0
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "qrc:/js/news.js" as Newsjs
@ -10,16 +10,18 @@ Item {
width: newsView.width
height:Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm)
property string conversation_id: ""
//property string conversation_id: ""
property string attending: ""
onAttendingChanged: {attendLabel.visible=true;
attendLabel.text= qsTr("attending: ")+ qsTr(attending)}
signal replyto(string parent_id)
function showConversation(){
conversationsymbol.color="black";
newsBusy.running=true;
root.contactLoadType="conversation";
//newstabstatus="Conversation";
if(newsitemobject.messagetype==0){
Newsjs.requestConversation(root.login,db,newsitemobject.status_id,root.contactlist,root,function(ns,nc){
@ -27,14 +29,11 @@ Item {
})}
else{Newsjs.conversationfromdb(root.db,root.login.username,newsitemobject.statusnet_conversation_id, function(newsarray){
root.news=newsarray;root.newContacts=[];root.currentContact=1;
})}}
})}
}
Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"}
//MouseArea{
// anchors.fill: parent;
// enabled: (newstabstatus=="Chats")
// onClicked: {showConversation()}
//}
Rectangle{
width:newsitem.width
height:newsitem.height-1
@ -54,12 +53,11 @@ Item {
anchors.fill: parent
onPressAndHold: { newsmenu.popup()}
}
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Label {
id:user_name
color: "grey"
//height:3.5*mm
width:parent.width
font.pixelSize: 1.5*mm
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
@ -85,7 +83,6 @@ Item {
Label {
id:createdAtLabel
color: "grey"
//height:3.5*mm
font.pixelSize: 1.5*mm
horizontalAlignment: Label.AlignRight
text: dateDiff
@ -93,7 +90,6 @@ Item {
Label {
id:replytoLabel
color: "grey"
//height:3.5*mm
font.pixelSize: 1.5*mm
horizontalAlignment: Label.AlignRight
text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name
@ -129,7 +125,8 @@ Item {
Qt.openUrlExternally(link)}
}
Row{id:friendicaActivities
Row{
id:friendicaActivities
spacing:mm
Label{color: "grey"
font.pixelSize: 1.5*mm
@ -152,192 +149,186 @@ Item {
text: friendica_activities.attendmaybeText
}
}
Row {
CheckBox{id:likeCheckbox
height:3*mm
width:8*mm
visible: (newsitemobject.messagetype==0)? true:false
checked:(friendica_activities.self.liked==1)?true:false
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 7*mm
implicitHeight: 3*mm
color:"white"
}
indicator:
Rectangle{
implicitWidth: 3*mm
implicitHeight:3*mm
color:control.checked?"yellow":"white"
x: 5*mm
Text{
font.pixelSize: 2*mm
color:"grey"
text:":-)"
}}
}
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}}
}
CheckBox{id: dislikeCheckbox
height:3*mm
width:8*mm
visible: (newsitemobject.messagetype==0)? true:false
checked: (friendica_activities.self.disliked==1)?true:false
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 7*mm
implicitHeight:3*mm
color:"white"
}
indicator:
Rectangle{
implicitWidth: 3*mm
implicitHeight:3*mm
color:control.checked?"yellow":"white"
x:5*mm
Text{
font.pixelSize: 2*mm
color:"grey"
text:":-("
}}
}
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}}
}
CheckBox {
id:favoritedCheckbox
visible:(newsitemobject.messagetype==0)
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 6*mm
implicitHeight:3*mm
color:"transparent"
}
indicator:
Rectangle{x:3*mm
width: 3*mm
implicitHeight:3*mm
Text{
anchors.centerIn: parent
color:control.checked?"black":"grey"
text:"\u2605"
}}
}
checked:(newsitemobject.favorited>0)
onClicked:{
if(favoritedCheckbox.checkedState==Qt.Checked)
{Newsjs.favorite(login,true,newsitemobject.status_id,root); model.newsitemobject.favorited=1}
else if(favoritedCheckbox.checkedState==Qt.Unchecked)
{Newsjs.favorite(login,false,newsitemobject.status_id,root);model.newsitemobject.favorited=0}
}
}
Rectangle{
width: 4*mm
height: 3*mm
color:"transparent"
Row{
CheckBox{
id:likeCheckbox
height:3*mm
width:8*mm
visible: (newsitemobject.messagetype==0)? true:false
checked:(friendica_activities.self.liked==1)?true:false
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 7*mm
implicitHeight: 3*mm
color:"white"
}
indicator: Rectangle{
implicitWidth: 3*mm
implicitHeight:3*mm
color:control.checked?"yellow":"white"
x: 5*mm
Text{
id:newsmenusymbol
color: "grey"
anchors.centerIn: parent
font.pixelSize: 2*mm
font.bold: true
text: "\u22EE"
font.pixelSize: 3*mm
color:"grey"
text:":-)"
}}
}
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}}
}
CheckBox{
id: dislikeCheckbox
height:3*mm
width:8*mm
visible: (newsitemobject.messagetype==0)? true:false
checked: (friendica_activities.self.disliked==1)?true:false
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 7*mm
implicitHeight:3*mm
color:"white"
}
MouseArea{
indicator: Rectangle{
implicitWidth: 3*mm
implicitHeight:3*mm
color:control.checked?"yellow":"white"
x:5*mm
Text{
font.pixelSize: 3*mm
color:"grey"
text:":-("
}}
}
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}}
}
CheckBox {
id:favoritedCheckbox
visible:(newsitemobject.messagetype==0)
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 6*mm
implicitHeight:3*mm
color:"transparent"
}
indicator:Rectangle{
x:3*mm
width: 3*mm
implicitHeight:3*mm
Text{
anchors.centerIn: parent
color:control.checked?"black":"grey"
text:"\u2605"
}}
}
checked:(newsitemobject.favorited>0)
onClicked:{
if(favoritedCheckbox.checkedState==Qt.Checked){
Newsjs.favorite(login,true,newsitemobject.status_id,root); model.newsitemobject.favorited=1}
else if(favoritedCheckbox.checkedState==Qt.Unchecked){
Newsjs.favorite(login,false,newsitemobject.status_id,root);model.newsitemobject.favorited=0}
}
}
Rectangle{
width: 4*mm
height: 3*mm
color:"transparent"
Text{
id:newsmenusymbol
color: "grey"
anchors.centerIn: parent
font.pixelSize: 2*mm
font.bold: true
text: "\u22EE"
}
MouseArea{
anchors.fill:parent
onClicked: {newsmenu.popup()}}
}
Rectangle{
width: 4*mm
height: 3*mm
color:"transparent"
//visible:(newsitemobject.in_reply_to_status_id!="")?true:false
Text{
id:conversationsymbol
color: "grey"
anchors.centerIn: parent
font.pixelSize: 2*mm
text: "\u21C4"
}
MouseArea{
Rectangle{
width: 4*mm
height: 3*mm
color:"transparent"
Text{
id:conversationsymbol
color: "grey"
anchors.centerIn: parent
font.pixelSize: 2*mm
text: "\u21C4"
}
MouseArea{
anchors.fill:parent
onClicked: showConversation()
}
}
Label {
}
Label{
id:attendLabel
visible: false
//visible: false
color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
font.pixelSize: 2*mm
horizontalAlignment: Label.AlignRight
text: (friendica_activities.self.attending)?qsTr("attending: ")+ qsTr(attending):""
}
text: (friendica_activities.self.attending)?(qsTr("Attending: ")+ qsTr(friendica_activities.self.attending)):""
}
}
}
Menu {
id:newsmenu
MenuItem {
text: qsTr("Reply")
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}});
id:newsmenu
MenuItem {
text: qsTr("Reply")
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}});
}
}
}
MenuItem {
text: qsTr("DM")
onTriggered: {
root.directmessageSignal(newsitemobject.user.screen_name);
MenuItem {
text: qsTr("DM")
onTriggered: {
root.directmessageSignal(newsitemobject.user.screen_name);
}
}
}
MenuItem {
text: qsTr("Repost")
onTriggered: {
Newsjs.retweetNews(root.login,db,newsitemobject.status_id,root,function(reply){
print(reply);
})
MenuItem {
text: qsTr("Repost")
onTriggered: {
Newsjs.retweetNews(root.login,db,newsitemobject.status_id,root,function(reply){
print(reply)})
}
}
MenuItem {
text: qsTr("Conversation")
onTriggered: showConversation()
}
}
MenuItem {
text: qsTr("Conversation")
onTriggered: showConversation()
}
Menu{
title: qsTr("Attending")
MenuItem{text:qsTr("yes")
Menu{
title: qsTr("Attending")
MenuItem{
text:qsTr("yes")
onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.status_id,root,function(){
newsitem.attending="yes";
attendLabel.visible=true})}
model.friendica_activities.self.attending="yes";attending="yes"})
}
MenuItem{text:qsTr("maybe")
onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.status_id,root,function(){
newsitem.attending="maybe"})}
}
MenuItem{text:qsTr("no")
onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.status_id,root,function(){
newsitem.attending="no"})}
MenuItem{text:qsTr("maybe")
onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.status_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(){
model.friendica_activities.self.attending="no";attending="no"})}
}
}
MenuItem {
text: qsTr("Delete")
onTriggered: {
Newsjs.deleteNews(root.login,root.db,newsitemobject.status_id,newsitemobject.messagetype,root,function(reply){
newsModel.remove(index);
})
MenuItem {
text: qsTr("Delete")
onTriggered: {
Newsjs.deleteNews(root.login,root.db,newsitemobject.status_id,newsitemobject.messagetype,root,function(reply){
newsModel.remove(index)})
}
}
}
}
}
}

View file

@ -1,7 +1,4 @@
import QtQuick 2.0
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4
import QtQml.Models 2.1
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
@ -20,10 +17,8 @@ Rectangle{
group_deny.push(groupModel.get(i).group.gid)
}
}
for (var j=0;j<contactModel.count;j++)
{//print("contact: "+JSON.stringify(contactModel.get(j).contact));
for (var j=0;j<contactModel.count;j++){
if (contactModel.get(j).contactstatus=="positive"){
print(JSON.stringify(contact_allow));
contact_allow.push(contactModel.get(j).contact.cid)
}
if (contactModel.get(j).contactstatus=="negative"){
@ -118,8 +113,8 @@ Rectangle{
property string groupstatus:"neutral"
onGroupstatusChanged:
{if(groupstatus=="positive"){groupitemRect.color="light green"}
else if (groupstatus=="negative"){groupitemRect.color= "red"}
else{groupitemRect.color= "white"}}
else if (groupstatus=="negative"){groupitemRect.color= "red"}
else{groupitemRect.color= "white"}}
color: "white"
border.color:"grey"
Text{
@ -153,9 +148,10 @@ Rectangle{
anchors.bottomMargin:1
text:qsTr("Save")
onClicked:{
updatePerms();
updatePerms();
var perms=[];
perms.push(contact_allow,contact_deny,group_allow,group_deny); Service.savePermissions(db,perms)
perms.push(contact_allow,contact_deny,group_allow,group_deny);
Service.savePermissions(db,perms)
}
}
BlueButton{
@ -163,16 +159,13 @@ Rectangle{
anchors.bottom: parent.bottom
anchors.bottomMargin:1
text:qsTr("Done")
onClicked:{//var group_allow=[];var group_deny=[];
//print("contacts: "+Helperjs.cleanArray(contact_allow))
onClicked:{updatePerms();
permissionDialog.destroy();
}
}
Component.onCompleted:{
Helperjs.readData(db,"contacts",login.username,function(contacts){
Helperjs.readData(db,"contacts",login.username,function(contacts){
for (var name in contacts){
var contactstatus="neutral";
if (contact_allow.indexOf(contacts[name].cid)>-1){contactstatus="positive";print(contacts[name].cid+" pos")}

View file

@ -1,5 +1,4 @@
import QtQuick 2.0
//import QtQuick.LocalStorage 2.0
import QtQuick.Controls 1.2
Package {
@ -17,62 +16,58 @@ Package {
id: placeHolder
color: 'lightblue'; antialiasing: true
anchors.fill:parent
}
BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready }
Image {
id: realImage;
// property string hqphotolink: photoLink
width: photoWrapper.width; height: photoWrapper.height
antialiasing: true;
asynchronous: true
cache: false
fillMode: Image.PreserveAspectFit;
source: imageLocation
// onStatusChanged: if (realImage.status == Image.Ready) print(realImage.paintedHeight+"x"+realImage.paintedWidth)
}
Rectangle{
id:phototextRectangle
color:"black"
z:3
opacity: 0.5
width:phototext.contentWidth
height: phototext.contentHeight
anchors.bottom: photoWrapper.bottom
}
Text {
id:phototext
z:4
text: photoDescription.trim()
width:15*mm
anchors.bottom: photoWrapper.bottom
color: "white"
font.pixelSize: 2*mm
wrapMode:Text.Wrap
}
BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready }
Image {
id: realImage;
width: photoWrapper.width; height: photoWrapper.height
antialiasing: true;
asynchronous: true
cache: false
fillMode: Image.PreserveAspectFit;
source: imageLocation
}
Rectangle{
id:phototextRectangle
color:"black"
z:3
opacity: 0.5
width:phototext.contentWidth
height: phototext.contentHeight
anchors.bottom: photoWrapper.bottom
}
Text {
id:phototext
z:4
text: photoDescription.trim()
width:15*mm
anchors.bottom: photoWrapper.bottom
color: "white"
font.pixelSize: 2*mm
wrapMode:Text.Wrap
}
MouseArea {
width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage
onClicked: {
if (albumWrapper.state == 'inGrid') {
gridItem.GridView.view.currentIndex = index;
albumWrapper.state = 'fullscreen'
} else {
gridItem.GridView.view.currentIndex = index;
albumWrapper.state = 'inGrid'
}
MouseArea {
width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage
onClicked: {
if (albumWrapper.state == 'inGrid') {
gridItem.GridView.view.currentIndex = index;
//print("photoLink"+realImage.photoLink)
albumWrapper.state = 'fullscreen'
} else {
gridItem.GridView.view.currentIndex = index;
albumWrapper.state = 'inGrid'
}
}
}
}
}
states: [
State {
name: 'stacked'; when: albumWrapper.state == ''
states: [
State {
name: 'stacked'; when: albumWrapper.state == ''
ParentChange { target: photoWrapper; parent: stackItem; }//x: 1*mm; y: 1*mm }
PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 }
PropertyChanges { target: phototext; opacity: 0.0 }
PropertyChanges { target: phototextRectangle; opacity: 0.0 }
},
State {
PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 }
PropertyChanges { target: phototext; opacity: 0.0 }
PropertyChanges { target: phototextRectangle; opacity: 0.0 }
},
State {
name: 'inGrid'; when: albumWrapper.state == 'inGrid'
ParentChange { target: photoWrapper; parent: gridItem; x: 1*mm; y: 1*mm;}
PropertyChanges { target: phototext; opacity: 1.0 }
@ -86,14 +81,12 @@ Package {
width: root.width-mm; height: root.height-8*mm
}
PropertyChanges { target: placeHolder; opacity: 0.0 }
PropertyChanges { target: realImage; source: photoWrapper.hqphotolink}
PropertyChanges { target: realImage; source: photoWrapper.hqphotolink}
PropertyChanges { target: phototext; anchors.bottom: realImage.bottom}
PropertyChanges { target: phototext; width:realImage.width }
PropertyChanges { target: phototextRectangle; anchors.bottom: realImage.bottom }
PropertyChanges { target: realImage; width: Math.min(listItem.width,sourceSize.width);height: Math.min(listItem.height,sourceSize.height) }
}
]
}
]
}
}

View file

@ -1,5 +1,5 @@
import QtQuick 2.0
import QtQuick.Dialogs 1.2
//import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4
import QtQml.Models 2.1
import "qrc:/js/service.js" as Service
@ -18,21 +18,17 @@ Rectangle {
color: '#fff'
property var newimages:[]
property int currentimageno: 0
//onLoginChanged:{var msg = {'model': photogroupModel,'albums':[],'firstalbum':0,'foreignPicture':false};
// photoWorker.sendMessage(msg);
//}
onNewimagesChanged:{
if(newimages.length>0){
Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){
//print("albums"+JSON.stringify(albums)+JSON.stringify(newimages[currentimageno]));
for (var i=0;i<newimages.length;i++){
if(albums.indexOf(newimages[i].album)==-1){
filesystem.Directory=root.login.imagestore+"/albums";
filesystem.makeDir(newimages[i].album)}}
if(newimages.length>0){
Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){
for (var i=0;i<newimages.length;i++){
if(albums.indexOf(newimages[i].album)==-1){
filesystem.Directory=root.login.imagestore+"/albums";
filesystem.makeDir(newimages[i].album)}}
})
//print("Current image number"+currentImageNo)
Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab);
newImagesProgress.visible=true //download first image
Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab);
newImagesProgress.visible=true //download first image
}
}
@ -44,20 +40,21 @@ Rectangle {
}
function showOwnFotos(){
try {photogroupModel.clear()}catch (e){print(e)}
Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
if (albums[0]) {
var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false};
photoWorker.sendMessage(msg);
};
})
}
Connections{
target:root
onLoginChanged:{var msg = {'model': photogroupModel,'albums':[],'firstalbum':0,'foreignPicture':false};
photoWorker.sendMessage(msg);}
try {photogroupModel.clear()}catch (e){print(e)}
Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
if (albums[0]) {
var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false};
photoWorker.sendMessage(msg);
}
})
}
Connections{
target:root
onLoginChanged:{
var msg = {'model': photogroupModel,'albums':[],'firstalbum':0,'foreignPicture':false};
photoWorker.sendMessage(msg)}
}
Connections{
target:xhr
@ -72,110 +69,111 @@ Rectangle {
function onFriendsFotos(friend){
fotostab.phototabstatus=friend.screen_name;
//print("Friend "+friend.url);
try {photogroupModel.clear()}catch (e){print(e)}
Service.requestFriendsAlbumPictures(root.login,friend,fotostab,function(albums){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true};
photoWorker.sendMessage(msg);
})
}
Service.requestFriendsAlbumPictures(root.login,friend,fotostab,function(albums){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true}
photoWorker.sendMessage(msg);
})
}
ProgressBar{
id: newImagesProgress
width: 15*mm
height: updatePhotolist.height
anchors.top: parent.top
anchors.right:updatePhotolist.left
anchors.rightMargin:mm
visible: false
value: currentimageno/newimages.length
}
ProgressBar{
id: newImagesProgress
width: 15*mm
height: updatePhotolist.height
anchors.top: parent.top
anchors.right:updatePhotolist.left
anchors.rightMargin:mm
visible: false
value: currentimageno/newimages.length
}
BlueButton{
id: updatePhotolist
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:phototabstatusButton.left
anchors.rightMargin:mm
text: qsTr("Update")
onClicked: {
Service.requestList(root.login,root.db, fotostab,function(obj){
newimages=obj;print("newimages"+JSON.stringify(obj))
})}}
BlueButton{
id: updatePhotolist
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:phototabstatusButton.left
anchors.rightMargin:mm
text: qsTr("Update")
onClicked: {
Service.requestList(root.login,root.db, fotostab,function(obj){
newimages=obj;print("newimages"+JSON.stringify(obj))
})}}
BlueButton{
id: phototabstatusButton
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right: parent.right
anchors.rightMargin:2*mm
text: qsTr(phototabstatus)
onClicked: {phototabmenu.popup()}
}
Menu {
id:phototabmenu
MenuItem {
text: qsTr("Own Images")
onTriggered: {
phototabstatus="Images";
showOwnFotos()}
}
}
DelegateModel{
id: visualphotoModel
delegate: PhotogroupComponent{}
model: photogroupModel
}
ListModel{
id: photogroupModel
}
GridView {
id: albumgridview
cellWidth: 17*mm
cellHeight: 17*mm
x: mm;y:8*mm
width: parent.width-2*mm; height: parent.height-9*mm
clip: true
model: visualphotoModel.parts.album
footer:
Rectangle{
border.color: "#EEEEEE"
border.width: 1
width:12*mm
height:6*mm
Text{
font.pixelSize: 1.5*mm
anchors.centerIn: parent
text:qsTr("More")
}
MouseArea{anchors.fill:parent
onClicked:{
var lastalbum_id=photogroupModel.get(photogroupModel.count-1);
if(photogroupModel.get(photogroupModel.count-1).foreignPictures==false){Service.requestFriendsAlbumPictures(friend,fotostab,function(albums){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true};
photoWorker.sendMessage(msg); })}
else { Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
var msg = { 'model': photogroupModel,'albums':albums,'foreignPicture': false,'firstalbum':lastalbum_id+1};
photoWorker.sendMessage(msg)})}
}}}
}
Rectangle { id: photoBackground; color: 'light grey'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 }
ListView { anchors.fill: parent; model: visualphotoModel.parts.browser; interactive: false }
BlueButton {
id: backButton
text: qsTr("Back")
x: parent.width - backButton.width - 3*mm
y: -backButton.height - 4*mm
onClicked: {photoBackground.opacity=0}
}
ListView {anchors.fill: parent; model: visualphotoModel.parts.fullscreen; interactive: false }
WorkerScript{id: photoWorker;source: "qrc:/js/photoworker.js"}
Component.onCompleted: { root.fotoSignal.connect(onFriendsFotos);}
BlueButton{
id: phototabstatusButton
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right: parent.right
anchors.rightMargin:2*mm
text: qsTr(phototabstatus)
onClicked: {phototabmenu.popup()}
}
Menu {
id:phototabmenu
MenuItem {
text: qsTr("Own Images")
onTriggered: {
phototabstatus="Images";
showOwnFotos()}
}
}
DelegateModel{
id: visualphotoModel
delegate: PhotogroupComponent{}
model: photogroupModel
}
ListModel{
id: photogroupModel
}
GridView {
id: albumgridview
cellWidth: 17*mm
cellHeight: 17*mm
x: mm;y:8*mm
width: parent.width-2*mm; height: parent.height-9*mm
clip: true
model: visualphotoModel.parts.album
footer:Rectangle{
border.color: "#EEEEEE"
border.width: 1
width:12*mm
height:6*mm
Text{
font.pixelSize: 1.5*mm
anchors.centerIn: parent
text:qsTr("More")
}
MouseArea{anchors.fill:parent
onClicked:{
var lastalbum_id=photogroupModel.get(photogroupModel.count-1);
if(photogroupModel.get(photogroupModel.count-1).foreignPictures==false){
Service.requestFriendsAlbumPictures(friend,fotostab,function(albums){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true}
photoWorker.sendMessage(msg)
})}
else{Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
var msg = { 'model': photogroupModel,'albums':albums,'foreignPicture': false,'firstalbum':lastalbum_id+1};
photoWorker.sendMessage(msg)})}
}}}
}
Rectangle { id: photoBackground; color: 'light grey'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 }
ListView { anchors.fill: parent; model: visualphotoModel.parts.browser; interactive: false }
BlueButton {
id: backButton
text: qsTr("Back")
x: parent.width - backButton.width - 3*mm
y: -backButton.height - 4*mm
onClicked: {photoBackground.opacity=0}
}
ListView {anchors.fill: parent; model: visualphotoModel.parts.fullscreen; interactive: false }
WorkerScript{id: photoWorker;source: "qrc:/js/photoworker.js"}
Component.onCompleted: { root.fotoSignal.connect(onFriendsFotos)}
}

View file

@ -1,5 +1,4 @@
import QtQuick 2.0
import QtQuick.LocalStorage 2.0
import QtQuick.Controls 1.3
import QtQml.Models 2.1
import "qrc:/js/service.js" as Service
@ -27,8 +26,7 @@ Package {
Item {
Package.name: 'album'
id: albumWrapper; width: 16.5*mm; height: 16.5*mm //-albumtext.contentHeight
id: albumWrapper; width: 16.5*mm; height: 16.5*mm
DelegateModel {
id: visualModel; delegate: PhotoComponent { }
model: photoModel
@ -55,7 +53,7 @@ Package {
}
Text {
id:albumtext
text: albumname //foreignPicture ? album.name.trim() : album
text: albumname
width:albumWrapper.width-1*mm
height: albumtext.contentHeight
wrapMode:Text.Wrap
@ -72,25 +70,21 @@ Package {
Component.onCompleted:{
try {photoModel.clear()}catch (e){print(e)}
if(foreignPicture){
//print("Albumlink"+album.link);
Service.requestFriendsPictures(albumlink,fotostab,function(obj){
if (obj) {
for (var k=0;k<obj.length;k++){
//print("Photomodel:"+obj[k].thumb+obj[k].name+obj[k].link);
photoModel.append({"imageLocation": obj[k].thumb,"photoDescription":obj[k].name,"photoLink":obj[k].link})
};
}
if (obj) {
for (var k=0;k<obj.length;k++){
photoModel.append({"imageLocation": obj[k].thumb,"photoDescription":obj[k].name,"photoLink":obj[k].link})
}
}
})}
else{
Helperjs.readData(db,"imageData",root.login.username,function(obj){
// obj.sort(function(obj1,obj2){return obj1.data-obj2.data});
if (obj) {
for (var k=0;k<obj.length;k++){
// print("Photomodel:"+obj[k].location+obj[k].filename);
photoModel.append({"imageLocation": obj[k].location+obj[k].filename,"photoDescription":obj[k].filename,"photoLink":obj[k].location+obj[k].filename})
};
}
},"album",albumname)}
if (obj) {
for (var k=0;k<obj.length;k++){
photoModel.append({"imageLocation": obj[k].location+obj[k].filename,"photoDescription":obj[k].filename,"photoLink":obj[k].location+obj[k].filename})
}
}
},"album",albumname)}
}
MouseArea {