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. QML based client for the Friendica Social Network.
Tabs for news (incl. Direct Messages), friends and photos. 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 ## ## Screenshots ##
@ -16,20 +17,22 @@ OS: currently Linux and Android(4.4.4).
# News # # News #
Currently supported: 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 * Open links in external browser
* Deletion, Reposting, Answering of Posts * Deletion, Reposting, Answering of Posts
* Liking, disliking, favoriting * Liking, disliking, favoriting
* Attending events
* Update fetches new posts since last in local DB * Update fetches new posts since last in local DB
* More shows older posts from 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: ToDo:
* Nice symbols for liking, disliking * Nice symbols for liking, disliking
* Videos and other binary data as attachment (sending and receiving) * Videos and other binary data as attachment (sending and receiving)
* Rich text editing in Send Dialog * 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) * Better image selection (currently ugly file dialog)

Binary file not shown.

View File

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

View File

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

View File

@ -292,32 +292,32 @@ function like(login,database,toggle,verb,newsid,rootwindow){
function attend(login,database,attend,newsid,rootwindow,callback){ function attend(login,database,attend,newsid,rootwindow,callback){
Helperjs.friendicaPostRequest(login,"/api/friendica/activity/attend"+attend+"?id="+newsid, rootwindow,function (obj){ Helperjs.friendicaPostRequest(login,"/api/friendica/activity/attend"+attend+"?id="+newsid, rootwindow,function (obj){
var attendReturn=JSON.parse(obj); //print("attend: "+attend+obj);
// print("attend: "+obj); if (obj=='"ok"')
if (attendReturn=="OK") var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
{var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) { 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_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)); var currentActivities=JSON.parse(currentActivities_rs.rows.item(0).friendica_activities_self);
print("currentActivities "+JSON.stringify(currentActivities)); if ((attend=="yes")&&(currentActivities.indexOf(3)==-1)){
if ((attend=="attendyes")&&(currentActivities.indexOf(3)==-1)){
currentActivities.push(3); currentActivities.push(3);
currentActivities.splice(currentActivities.indexOf(4),1) if (currentActivities.indexOf(4)!=-1){currentActivities.splice(currentActivities.indexOf(4),1)}
currentActivities.splice(currentActivities.indexOf(5),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.push(4);
currentActivities.splice(currentActivities.indexOf(3),1) if (currentActivities.indexOf(3)!=-1){currentActivities.splice(currentActivities.indexOf(3),1)}
currentActivities.splice(currentActivities.indexOf(5),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.push(5);
currentActivities.splice(currentActivities.indexOf(3),1) if (currentActivities.indexOf(3)!=-1){currentActivities.splice(currentActivities.indexOf(3),1)}
currentActivities.splice(currentActivities.indexOf(4),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); var result = tx.executeSql('UPDATE news SET friendica_activities_self ="'+JSON.stringify(currentActivities)+'" where username="'+login.username+'" AND status_id ='+newsid);
callback(); callback();
})}})} })})}
function requestConversation(login,database,newsid,contacts,rootwindow,callback){ function requestConversation(login,database,newsid,contacts,rootwindow,callback){
Helperjs.friendicaRequest(login,"/api/conversation/show?id="+newsid,rootwindow, function (obj){ 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++){ for (var j=0;j<msg.news.length;j++){
if (msg.news[j]) { if (msg.news[j]) {
var newsitemobject=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){ if (newsitemobject.messagetype==2){
newsitemobject.user={}; newsitemobject.user={};
newsitemobject.user.profile_image=""; 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.")} if (newsitemobject.attendmaybe.length==1){attendmaybeText= Qt.atob(newsitemobject.attendmaybe[0].name)+" "+ qsTr("may attend.")}
else {attendmaybeText= newsitemobject.attendmaybe.length+" "+ qsTr("persons may attend.")} else {attendmaybeText= newsitemobject.attendmaybe.length+" "+ qsTr("persons may attend.")}
} }
var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self); //var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self);
if (friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")} if (newsitemobject.friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")}
if (friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")} if (newsitemobject.friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")}
if (friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")} if (newsitemobject.friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")}
if (friendica_activities_self.indexOf(1)!=-1){self.liked=1} if (newsitemobject.friendica_activities_self.indexOf(1)!=-1){self.liked=1}
if (friendica_activities_self.indexOf(2)!=-1){self.disliked=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} var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self}
//print(JSON.stringify(friendica_activities) ) ; //print(JSON.stringify(friendica_activities) ) ;

View File

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

View File

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

View File

@ -1,6 +1,5 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 1.3 import QtQuick.Controls 1.3
import "qrc:/js/layout.js" as Layoutjs
import "qrc:/qml/genericqml" import "qrc:/qml/genericqml"
Item { Item {
@ -61,7 +60,9 @@ states: [
PropertyChanges { target: contactComponent; z: 2 } PropertyChanges { target: contactComponent; z: 2 }
PropertyChanges { target: wrapper; width:friendsTabView.width-3*mm;height:friendsTabView.height-10*mm} PropertyChanges { target: wrapper; width:friendsTabView.width-3*mm;height:friendsTabView.height-10*mm}
PropertyChanges { target: photoImage; width:15*mm;height:15*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 id: detailsrectangle
anchors.top: namelabel.bottom anchors.top: namelabel.bottom
anchors.topMargin: 2*mm anchors.topMargin: 2*mm
//opacity: 0
ScrollView{ ScrollView{
horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff
frameVisible: true frameVisible: true
//Flickable{
id:namelabelflickable id:namelabelflickable
width: root.width-10*mm width: root.width-10*mm
height:friendsTabView.height-45*mm height:friendsTabView.height-45*mm
//boundsBehavior:Flickable.StopAtBounds
//flickableDirection:Flickable.VerticalFlick
//contentWidth:width
//contentHeight: namelabeltext.height
clip:true clip:true
Text{ Text{
id:namelabeltext id:namelabeltext
@ -43,8 +38,8 @@ Rectangle{
BlueButton{ BlueButton{
id:photobutton id:photobutton
text:"Photos" text:"Photos"
visible:contact.network=="dfrn"? 1:0 visible:(contact.network=="dfrn")
onClicked:{contactComponent.state="";detailsrectangle.destroy(); onClicked:{
root.currentIndex=2; root.currentIndex=2;
fotostab.active=true; fotostab.active=true;
root.fotoSignal(contact) ; root.fotoSignal(contact) ;
@ -54,7 +49,7 @@ Rectangle{
BlueButton{ BlueButton{
id:messagebutton id:messagebutton
text:"Messages" text:"Messages"
onClicked:{contactComponent.state="";detailsrectangle.destroy(); onClicked:{
root.currentIndex=0; root.currentIndex=0;
newstab.active=true; newstab.active=true;
root.messageSignal(contact.id) ; root.messageSignal(contact.id) ;
@ -63,9 +58,9 @@ Rectangle{
BlueButton{ BlueButton{
id:dmbutton id:dmbutton
visible: contact.following=="true"?true:false visible: (contact.following=="true")
text: "DM" text: "DM"
onClicked:{contactComponent.state="";detailsrectangle.destroy(); onClicked:{
root.currentIndex=0; root.currentIndex=0;
newstab.active=true; newstab.active=true;
root.directmessageSignal(contact.screen_name); root.directmessageSignal(contact.screen_name);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,8 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Dialogs 1.2 //import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
//import QtQuick.LocalStorage 2.0 as Sql //import QtQuick.LocalStorage 2.0 as Sql
import "qrc:/qml" //import "qrc:/qml"
import "qrc:/qml/genericqml" import "qrc:/qml/genericqml"
import "qrc:/js/news.js" as Newsjs import "qrc:/js/news.js" as Newsjs
import "qrc:/js/helper.js" as Helperjs import "qrc:/js/helper.js" as Helperjs
@ -15,6 +15,7 @@ Item {
newstabstatusButton.text= qsTr(newstab.newstabstatus) newstabstatusButton.text= qsTr(newstab.newstabstatus)
} }
} }
Connections{ Connections{
target:newstab target:newstab
onConversationChanged:{ onConversationChanged:{
@ -23,14 +24,24 @@ Item {
newsStack.push({item:"qrc:/qml/newsqml/Conversation.qml",properties:{"news": conversation}}) newsStack.push({item:"qrc:/qml/newsqml/Conversation.qml",properties:{"news": conversation}})
} }
} }
Connections{ Connections{
target:root target:root
onCurrentContactChanged:{ onCurrentContactChanged:{
if (root.newContacts.length>0){ 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){ function showNews(newsToShow){
if (newsStack.depth>1){newsStack.pop()} if (newsStack.depth>1){newsStack.pop()}
newsBusy.running=false; newsBusy.running=false;
@ -40,7 +51,7 @@ Item {
} }
function onFriendsMessages(friend){ function onFriendsMessages(friend){
newstab.newstabstatus="Contact"; newstab.newstabstatus="Contact"
Newsjs.newsfromdb(db,root.login.username, function(dbnews){showNews(dbnews)},friend) Newsjs.newsfromdb(db,root.login.username, function(dbnews){showNews(dbnews)},friend)
} }
@ -83,7 +94,7 @@ Item {
var groups=[]; var groups=[];
Helperjs.readData(root.db,"groups",root.login.username,function(groupobject){ Helperjs.readData(root.db,"groups",root.login.username,function(groupobject){
groups=groupobject}); groups=groupobject});
newstab.newstabstatus="SendMessage" newstab.newstabstatus="SendMessage";
Helperjs.readData(root.db,"contacts",root.login.username,function(friends){ 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({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"contacts": friends,"login":root.login}})
},"isFriend",1); },"isFriend",1);
@ -177,7 +188,29 @@ Item {
width:10*mm width:10*mm
height: 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 { Menu {
id:newstabmenu id:newstabmenu
MenuItem { MenuItem {
@ -224,6 +257,7 @@ Item {
root.directmessageSignal.connect(onDirectMessage); root.directmessageSignal.connect(onDirectMessage);
root.newsSignal.connect(showNews); root.newsSignal.connect(showNews);
try{newsModel.clear()} catch(e){} try{newsModel.clear()} catch(e){}
newstab.newstabstatus=login.newsViewType;
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
} }

View File

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

View File

@ -1,7 +1,4 @@
import QtQuick 2.0 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/service.js" as Service
import "qrc:/js/helper.js" as Helperjs import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml" import "qrc:/qml/genericqml"
@ -20,10 +17,8 @@ Rectangle{
group_deny.push(groupModel.get(i).group.gid) group_deny.push(groupModel.get(i).group.gid)
} }
} }
for (var j=0;j<contactModel.count;j++) for (var j=0;j<contactModel.count;j++){
{//print("contact: "+JSON.stringify(contactModel.get(j).contact));
if (contactModel.get(j).contactstatus=="positive"){ if (contactModel.get(j).contactstatus=="positive"){
print(JSON.stringify(contact_allow));
contact_allow.push(contactModel.get(j).contact.cid) contact_allow.push(contactModel.get(j).contact.cid)
} }
if (contactModel.get(j).contactstatus=="negative"){ if (contactModel.get(j).contactstatus=="negative"){
@ -118,8 +113,8 @@ Rectangle{
property string groupstatus:"neutral" property string groupstatus:"neutral"
onGroupstatusChanged: onGroupstatusChanged:
{if(groupstatus=="positive"){groupitemRect.color="light green"} {if(groupstatus=="positive"){groupitemRect.color="light green"}
else if (groupstatus=="negative"){groupitemRect.color= "red"} else if (groupstatus=="negative"){groupitemRect.color= "red"}
else{groupitemRect.color= "white"}} else{groupitemRect.color= "white"}}
color: "white" color: "white"
border.color:"grey" border.color:"grey"
Text{ Text{
@ -153,9 +148,10 @@ Rectangle{
anchors.bottomMargin:1 anchors.bottomMargin:1
text:qsTr("Save") text:qsTr("Save")
onClicked:{ onClicked:{
updatePerms(); updatePerms();
var perms=[]; 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{ BlueButton{
@ -163,16 +159,13 @@ Rectangle{
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin:1 anchors.bottomMargin:1
text:qsTr("Done") text:qsTr("Done")
onClicked:{//var group_allow=[];var group_deny=[]; onClicked:{updatePerms();
//print("contacts: "+Helperjs.cleanArray(contact_allow))
permissionDialog.destroy(); permissionDialog.destroy();
} }
} }
Component.onCompleted:{ Component.onCompleted:{
Helperjs.readData(db,"contacts",login.username,function(contacts){
Helperjs.readData(db,"contacts",login.username,function(contacts){
for (var name in contacts){ for (var name in contacts){
var contactstatus="neutral"; var contactstatus="neutral";
if (contact_allow.indexOf(contacts[name].cid)>-1){contactstatus="positive";print(contacts[name].cid+" pos")} 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 2.0
//import QtQuick.LocalStorage 2.0
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
Package { Package {
@ -17,62 +16,58 @@ Package {
id: placeHolder id: placeHolder
color: 'lightblue'; antialiasing: true color: 'lightblue'; antialiasing: true
anchors.fill:parent anchors.fill:parent
} }
BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready }
BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready } Image {
Image { id: realImage;
id: realImage; width: photoWrapper.width; height: photoWrapper.height
// property string hqphotolink: photoLink antialiasing: true;
width: photoWrapper.width; height: photoWrapper.height asynchronous: true
antialiasing: true; cache: false
asynchronous: true fillMode: Image.PreserveAspectFit;
cache: false source: imageLocation
fillMode: Image.PreserveAspectFit; }
source: imageLocation Rectangle{
// onStatusChanged: if (realImage.status == Image.Ready) print(realImage.paintedHeight+"x"+realImage.paintedWidth) id:phototextRectangle
} color:"black"
Rectangle{ z:3
id:phototextRectangle opacity: 0.5
color:"black" width:phototext.contentWidth
z:3 height: phototext.contentHeight
opacity: 0.5 anchors.bottom: photoWrapper.bottom
width:phototext.contentWidth }
height: phototext.contentHeight Text {
anchors.bottom: photoWrapper.bottom id:phototext
} z:4
Text { text: photoDescription.trim()
id:phototext width:15*mm
z:4 anchors.bottom: photoWrapper.bottom
text: photoDescription.trim() color: "white"
width:15*mm font.pixelSize: 2*mm
anchors.bottom: photoWrapper.bottom wrapMode:Text.Wrap
color: "white" }
font.pixelSize: 2*mm MouseArea {
wrapMode:Text.Wrap 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: [ states: [
State { State {
name: 'stacked'; when: albumWrapper.state == '' name: 'stacked'; when: albumWrapper.state == ''
ParentChange { target: photoWrapper; parent: stackItem; }//x: 1*mm; y: 1*mm } ParentChange { target: photoWrapper; parent: stackItem; }//x: 1*mm; y: 1*mm }
PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 } PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 }
PropertyChanges { target: phototext; opacity: 0.0 } PropertyChanges { target: phototext; opacity: 0.0 }
PropertyChanges { target: phototextRectangle; opacity: 0.0 } PropertyChanges { target: phototextRectangle; opacity: 0.0 }
}, },
State { State {
name: 'inGrid'; when: albumWrapper.state == 'inGrid' name: 'inGrid'; when: albumWrapper.state == 'inGrid'
ParentChange { target: photoWrapper; parent: gridItem; x: 1*mm; y: 1*mm;} ParentChange { target: photoWrapper; parent: gridItem; x: 1*mm; y: 1*mm;}
PropertyChanges { target: phototext; opacity: 1.0 } PropertyChanges { target: phototext; opacity: 1.0 }
@ -86,14 +81,12 @@ Package {
width: root.width-mm; height: root.height-8*mm width: root.width-mm; height: root.height-8*mm
} }
PropertyChanges { target: placeHolder; opacity: 0.0 } 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; anchors.bottom: realImage.bottom}
PropertyChanges { target: phototext; width:realImage.width } PropertyChanges { target: phototext; width:realImage.width }
PropertyChanges { target: phototextRectangle; anchors.bottom: realImage.bottom } PropertyChanges { target: phototextRectangle; anchors.bottom: realImage.bottom }
PropertyChanges { target: realImage; width: Math.min(listItem.width,sourceSize.width);height: Math.min(listItem.height,sourceSize.height) } 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 2.0
import QtQuick.Dialogs 1.2 //import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQml.Models 2.1 import QtQml.Models 2.1
import "qrc:/js/service.js" as Service import "qrc:/js/service.js" as Service
@ -18,21 +18,17 @@ Rectangle {
color: '#fff' color: '#fff'
property var newimages:[] property var newimages:[]
property int currentimageno: 0 property int currentimageno: 0
//onLoginChanged:{var msg = {'model': photogroupModel,'albums':[],'firstalbum':0,'foreignPicture':false};
// photoWorker.sendMessage(msg);
//}
onNewimagesChanged:{ onNewimagesChanged:{
if(newimages.length>0){ if(newimages.length>0){
Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){ 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++){
for (var i=0;i<newimages.length;i++){ if(albums.indexOf(newimages[i].album)==-1){
if(albums.indexOf(newimages[i].album)==-1){ filesystem.Directory=root.login.imagestore+"/albums";
filesystem.Directory=root.login.imagestore+"/albums"; filesystem.makeDir(newimages[i].album)}}
filesystem.makeDir(newimages[i].album)}}
}) })
//print("Current image number"+currentImageNo) Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab);
Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab); newImagesProgress.visible=true //download first image
newImagesProgress.visible=true //download first image
} }
} }
@ -44,20 +40,21 @@ Rectangle {
} }
function showOwnFotos(){ function showOwnFotos(){
try {photogroupModel.clear()}catch (e){print(e)} try {photogroupModel.clear()}catch (e){print(e)}
Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){ Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
if (albums[0]) { if (albums[0]) {
var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false}; var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false};
photoWorker.sendMessage(msg); photoWorker.sendMessage(msg);
}; }
}) })
}
Connections{
target:root
onLoginChanged:{var msg = {'model': photogroupModel,'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{ Connections{
target:xhr target:xhr
@ -72,110 +69,111 @@ Rectangle {
function onFriendsFotos(friend){ function onFriendsFotos(friend){
fotostab.phototabstatus=friend.screen_name; fotostab.phototabstatus=friend.screen_name;
//print("Friend "+friend.url);
try {photogroupModel.clear()}catch (e){print(e)} try {photogroupModel.clear()}catch (e){print(e)}
Service.requestFriendsAlbumPictures(root.login,friend,fotostab,function(albums){ Service.requestFriendsAlbumPictures(root.login,friend,fotostab,function(albums){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true}; var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true}
photoWorker.sendMessage(msg); photoWorker.sendMessage(msg);
}) })
} }
ProgressBar{ ProgressBar{
id: newImagesProgress id: newImagesProgress
width: 15*mm width: 15*mm
height: updatePhotolist.height height: updatePhotolist.height
anchors.top: parent.top anchors.top: parent.top
anchors.right:updatePhotolist.left anchors.right:updatePhotolist.left
anchors.rightMargin:mm anchors.rightMargin:mm
visible: false visible: false
value: currentimageno/newimages.length value: currentimageno/newimages.length
} }
BlueButton{ BlueButton{
id: updatePhotolist id: updatePhotolist
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 0.5*mm anchors.topMargin: 0.5*mm
anchors.right:phototabstatusButton.left anchors.right:phototabstatusButton.left
anchors.rightMargin:mm anchors.rightMargin:mm
text: qsTr("Update") text: qsTr("Update")
onClicked: { onClicked: {
Service.requestList(root.login,root.db, fotostab,function(obj){ Service.requestList(root.login,root.db, fotostab,function(obj){
newimages=obj;print("newimages"+JSON.stringify(obj)) newimages=obj;print("newimages"+JSON.stringify(obj))
})}} })}}
BlueButton{ BlueButton{
id: phototabstatusButton id: phototabstatusButton
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 0.5*mm anchors.topMargin: 0.5*mm
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin:2*mm anchors.rightMargin:2*mm
text: qsTr(phototabstatus) text: qsTr(phototabstatus)
onClicked: {phototabmenu.popup()} onClicked: {phototabmenu.popup()}
} }
Menu { Menu {
id:phototabmenu id:phototabmenu
MenuItem { MenuItem {
text: qsTr("Own Images") text: qsTr("Own Images")
onTriggered: { onTriggered: {
phototabstatus="Images"; phototabstatus="Images";
showOwnFotos()} showOwnFotos()}
} }
} }
DelegateModel{
id: visualphotoModel DelegateModel{
delegate: PhotogroupComponent{} id: visualphotoModel
model: photogroupModel delegate: PhotogroupComponent{}
} model: photogroupModel
}
ListModel{
id: photogroupModel ListModel{
} id: photogroupModel
}
GridView {
id: albumgridview GridView {
cellWidth: 17*mm id: albumgridview
cellHeight: 17*mm cellWidth: 17*mm
x: mm;y:8*mm cellHeight: 17*mm
width: parent.width-2*mm; height: parent.height-9*mm x: mm;y:8*mm
clip: true width: parent.width-2*mm; height: parent.height-9*mm
model: visualphotoModel.parts.album clip: true
footer: model: visualphotoModel.parts.album
Rectangle{ footer:Rectangle{
border.color: "#EEEEEE" border.color: "#EEEEEE"
border.width: 1 border.width: 1
width:12*mm width:12*mm
height:6*mm height:6*mm
Text{ Text{
font.pixelSize: 1.5*mm font.pixelSize: 1.5*mm
anchors.centerIn: parent anchors.centerIn: parent
text:qsTr("More") text:qsTr("More")
} }
MouseArea{anchors.fill:parent MouseArea{anchors.fill:parent
onClicked:{ onClicked:{
var lastalbum_id=photogroupModel.get(photogroupModel.count-1); var lastalbum_id=photogroupModel.get(photogroupModel.count-1);
if(photogroupModel.get(photogroupModel.count-1).foreignPictures==false){Service.requestFriendsAlbumPictures(friend,fotostab,function(albums){ if(photogroupModel.get(photogroupModel.count-1).foreignPictures==false){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true}; Service.requestFriendsAlbumPictures(friend,fotostab,function(albums){
photoWorker.sendMessage(msg); })} var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true}
else { Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){ photoWorker.sendMessage(msg)
var msg = { 'model': photogroupModel,'albums':albums,'foreignPicture': false,'firstalbum':lastalbum_id+1}; })}
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 } Rectangle { id: photoBackground; color: 'light grey'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 }
BlueButton { ListView { anchors.fill: parent; model: visualphotoModel.parts.browser; interactive: false }
id: backButton
text: qsTr("Back") BlueButton {
x: parent.width - backButton.width - 3*mm id: backButton
y: -backButton.height - 4*mm text: qsTr("Back")
onClicked: {photoBackground.opacity=0} 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"}
ListView {anchors.fill: parent; model: visualphotoModel.parts.fullscreen; interactive: false }
Component.onCompleted: { root.fotoSignal.connect(onFriendsFotos);} 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 2.0
import QtQuick.LocalStorage 2.0
import QtQuick.Controls 1.3 import QtQuick.Controls 1.3
import QtQml.Models 2.1 import QtQml.Models 2.1
import "qrc:/js/service.js" as Service import "qrc:/js/service.js" as Service
@ -27,8 +26,7 @@ Package {
Item { Item {
Package.name: 'album' 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 { DelegateModel {
id: visualModel; delegate: PhotoComponent { } id: visualModel; delegate: PhotoComponent { }
model: photoModel model: photoModel
@ -55,7 +53,7 @@ Package {
} }
Text { Text {
id:albumtext id:albumtext
text: albumname //foreignPicture ? album.name.trim() : album text: albumname
width:albumWrapper.width-1*mm width:albumWrapper.width-1*mm
height: albumtext.contentHeight height: albumtext.contentHeight
wrapMode:Text.Wrap wrapMode:Text.Wrap
@ -72,25 +70,21 @@ Package {
Component.onCompleted:{ Component.onCompleted:{
try {photoModel.clear()}catch (e){print(e)} try {photoModel.clear()}catch (e){print(e)}
if(foreignPicture){ if(foreignPicture){
//print("Albumlink"+album.link);
Service.requestFriendsPictures(albumlink,fotostab,function(obj){ Service.requestFriendsPictures(albumlink,fotostab,function(obj){
if (obj) { if (obj) {
for (var k=0;k<obj.length;k++){ 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})
photoModel.append({"imageLocation": obj[k].thumb,"photoDescription":obj[k].name,"photoLink":obj[k].link}) }
}; }
}
})} })}
else{ else{
Helperjs.readData(db,"imageData",root.login.username,function(obj){ Helperjs.readData(db,"imageData",root.login.username,function(obj){
// obj.sort(function(obj1,obj2){return obj1.data-obj2.data}); if (obj) {
if (obj) { for (var k=0;k<obj.length;k++){
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})
// 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)}
}
},"album",albumname)}
} }
MouseArea { MouseArea {

View File

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

View File

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

View File

@ -292,32 +292,32 @@ function like(login,database,toggle,verb,newsid,rootwindow){
function attend(login,database,attend,newsid,rootwindow,callback){ function attend(login,database,attend,newsid,rootwindow,callback){
Helperjs.friendicaPostRequest(login,"/api/friendica/activity/attend"+attend+"?id="+newsid, rootwindow,function (obj){ Helperjs.friendicaPostRequest(login,"/api/friendica/activity/attend"+attend+"?id="+newsid, rootwindow,function (obj){
var attendReturn=JSON.parse(obj); //print("attend: "+attend+obj);
// print("attend: "+obj); if (obj=='"ok"')
if (attendReturn=="OK") var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
{var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) { 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_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)); var currentActivities=JSON.parse(currentActivities_rs.rows.item(0).friendica_activities_self);
print("currentActivities "+JSON.stringify(currentActivities)); if ((attend=="yes")&&(currentActivities.indexOf(3)==-1)){
if ((attend=="attendyes")&&(currentActivities.indexOf(3)==-1)){
currentActivities.push(3); currentActivities.push(3);
currentActivities.splice(currentActivities.indexOf(4),1) if (currentActivities.indexOf(4)!=-1){currentActivities.splice(currentActivities.indexOf(4),1)}
currentActivities.splice(currentActivities.indexOf(5),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.push(4);
currentActivities.splice(currentActivities.indexOf(3),1) if (currentActivities.indexOf(3)!=-1){currentActivities.splice(currentActivities.indexOf(3),1)}
currentActivities.splice(currentActivities.indexOf(5),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.push(5);
currentActivities.splice(currentActivities.indexOf(3),1) if (currentActivities.indexOf(3)!=-1){currentActivities.splice(currentActivities.indexOf(3),1)}
currentActivities.splice(currentActivities.indexOf(4),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); var result = tx.executeSql('UPDATE news SET friendica_activities_self ="'+JSON.stringify(currentActivities)+'" where username="'+login.username+'" AND status_id ='+newsid);
callback(); callback();
})}})} })})}
function requestConversation(login,database,newsid,contacts,rootwindow,callback){ function requestConversation(login,database,newsid,contacts,rootwindow,callback){
Helperjs.friendicaRequest(login,"/api/conversation/show?id="+newsid,rootwindow, function (obj){ 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++){ for (var j=0;j<msg.news.length;j++){
if (msg.news[j]) { if (msg.news[j]) {
var newsitemobject=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){ if (newsitemobject.messagetype==2){
newsitemobject.user={}; newsitemobject.user={};
newsitemobject.user.profile_image=""; 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.")} if (newsitemobject.attendmaybe.length==1){attendmaybeText= Qt.atob(newsitemobject.attendmaybe[0].name)+" "+ qsTr("may attend.")}
else {attendmaybeText= newsitemobject.attendmaybe.length+" "+ qsTr("persons may attend.")} else {attendmaybeText= newsitemobject.attendmaybe.length+" "+ qsTr("persons may attend.")}
} }
var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self); //var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self);
if (friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")} if (newsitemobject.friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")}
if (friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")} if (newsitemobject.friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")}
if (friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")} if (newsitemobject.friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")}
if (friendica_activities_self.indexOf(1)!=-1){self.liked=1} if (newsitemobject.friendica_activities_self.indexOf(1)!=-1){self.liked=1}
if (friendica_activities_self.indexOf(2)!=-1){self.disliked=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} var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self}
//print(JSON.stringify(friendica_activities) ) ; //print(JSON.stringify(friendica_activities) ) ;

View File

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

View File

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

View File

@ -1,6 +1,5 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 1.3 import QtQuick.Controls 1.3
import "qrc:/js/layout.js" as Layoutjs
import "qrc:/qml/genericqml" import "qrc:/qml/genericqml"
Item { Item {
@ -61,7 +60,9 @@ states: [
PropertyChanges { target: contactComponent; z: 2 } PropertyChanges { target: contactComponent; z: 2 }
PropertyChanges { target: wrapper; width:friendsTabView.width-3*mm;height:friendsTabView.height-10*mm} PropertyChanges { target: wrapper; width:friendsTabView.width-3*mm;height:friendsTabView.height-10*mm}
PropertyChanges { target: photoImage; width:15*mm;height:15*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 id: detailsrectangle
anchors.top: namelabel.bottom anchors.top: namelabel.bottom
anchors.topMargin: 2*mm anchors.topMargin: 2*mm
//opacity: 0
ScrollView{ ScrollView{
horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff
frameVisible: true frameVisible: true
//Flickable{
id:namelabelflickable id:namelabelflickable
width: root.width-10*mm width: root.width-10*mm
height:friendsTabView.height-45*mm height:friendsTabView.height-45*mm
//boundsBehavior:Flickable.StopAtBounds
//flickableDirection:Flickable.VerticalFlick
//contentWidth:width
//contentHeight: namelabeltext.height
clip:true clip:true
Text{ Text{
id:namelabeltext id:namelabeltext
@ -43,8 +38,8 @@ Rectangle{
BlueButton{ BlueButton{
id:photobutton id:photobutton
text:"Photos" text:"Photos"
visible:contact.network=="dfrn"? 1:0 visible:(contact.network=="dfrn")
onClicked:{contactComponent.state="";detailsrectangle.destroy(); onClicked:{
root.currentIndex=2; root.currentIndex=2;
fotostab.active=true; fotostab.active=true;
root.fotoSignal(contact) ; root.fotoSignal(contact) ;
@ -54,7 +49,7 @@ Rectangle{
BlueButton{ BlueButton{
id:messagebutton id:messagebutton
text:"Messages" text:"Messages"
onClicked:{contactComponent.state="";detailsrectangle.destroy(); onClicked:{
root.currentIndex=0; root.currentIndex=0;
newstab.active=true; newstab.active=true;
root.messageSignal(contact.id) ; root.messageSignal(contact.id) ;
@ -63,9 +58,9 @@ Rectangle{
BlueButton{ BlueButton{
id:dmbutton id:dmbutton
visible: contact.following=="true"?true:false visible: (contact.following=="true")
text: "DM" text: "DM"
onClicked:{contactComponent.state="";detailsrectangle.destroy(); onClicked:{
root.currentIndex=0; root.currentIndex=0;
newstab.active=true; newstab.active=true;
root.directmessageSignal(contact.screen_name); root.directmessageSignal(contact.screen_name);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,8 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Dialogs 1.2 //import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
//import QtQuick.LocalStorage 2.0 as Sql //import QtQuick.LocalStorage 2.0 as Sql
import "qrc:/qml" //import "qrc:/qml"
import "qrc:/qml/genericqml" import "qrc:/qml/genericqml"
import "qrc:/js/news.js" as Newsjs import "qrc:/js/news.js" as Newsjs
import "qrc:/js/helper.js" as Helperjs import "qrc:/js/helper.js" as Helperjs
@ -15,6 +15,7 @@ Item {
newstabstatusButton.text= qsTr(newstab.newstabstatus) newstabstatusButton.text= qsTr(newstab.newstabstatus)
} }
} }
Connections{ Connections{
target:newstab target:newstab
onConversationChanged:{ onConversationChanged:{
@ -23,14 +24,24 @@ Item {
newsStack.push({item:"qrc:/qml/newsqml/Conversation.qml",properties:{"news": conversation}}) newsStack.push({item:"qrc:/qml/newsqml/Conversation.qml",properties:{"news": conversation}})
} }
} }
Connections{ Connections{
target:root target:root
onCurrentContactChanged:{ onCurrentContactChanged:{
if (root.newContacts.length>0){ 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){ function showNews(newsToShow){
if (newsStack.depth>1){newsStack.pop()} if (newsStack.depth>1){newsStack.pop()}
newsBusy.running=false; newsBusy.running=false;
@ -40,7 +51,7 @@ Item {
} }
function onFriendsMessages(friend){ function onFriendsMessages(friend){
newstab.newstabstatus="Contact"; newstab.newstabstatus="Contact"
Newsjs.newsfromdb(db,root.login.username, function(dbnews){showNews(dbnews)},friend) Newsjs.newsfromdb(db,root.login.username, function(dbnews){showNews(dbnews)},friend)
} }
@ -83,7 +94,7 @@ Item {
var groups=[]; var groups=[];
Helperjs.readData(root.db,"groups",root.login.username,function(groupobject){ Helperjs.readData(root.db,"groups",root.login.username,function(groupobject){
groups=groupobject}); groups=groupobject});
newstab.newstabstatus="SendMessage" newstab.newstabstatus="SendMessage";
Helperjs.readData(root.db,"contacts",root.login.username,function(friends){ 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({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"contacts": friends,"login":root.login}})
},"isFriend",1); },"isFriend",1);
@ -177,7 +188,29 @@ Item {
width:10*mm width:10*mm
height: 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 { Menu {
id:newstabmenu id:newstabmenu
MenuItem { MenuItem {
@ -224,6 +257,7 @@ Item {
root.directmessageSignal.connect(onDirectMessage); root.directmessageSignal.connect(onDirectMessage);
root.newsSignal.connect(showNews); root.newsSignal.connect(showNews);
try{newsModel.clear()} catch(e){} try{newsModel.clear()} catch(e){}
newstab.newstabstatus=login.newsViewType;
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
} }

View File

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

View File

@ -1,7 +1,4 @@
import QtQuick 2.0 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/service.js" as Service
import "qrc:/js/helper.js" as Helperjs import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml" import "qrc:/qml/genericqml"
@ -20,10 +17,8 @@ Rectangle{
group_deny.push(groupModel.get(i).group.gid) group_deny.push(groupModel.get(i).group.gid)
} }
} }
for (var j=0;j<contactModel.count;j++) for (var j=0;j<contactModel.count;j++){
{//print("contact: "+JSON.stringify(contactModel.get(j).contact));
if (contactModel.get(j).contactstatus=="positive"){ if (contactModel.get(j).contactstatus=="positive"){
print(JSON.stringify(contact_allow));
contact_allow.push(contactModel.get(j).contact.cid) contact_allow.push(contactModel.get(j).contact.cid)
} }
if (contactModel.get(j).contactstatus=="negative"){ if (contactModel.get(j).contactstatus=="negative"){
@ -118,8 +113,8 @@ Rectangle{
property string groupstatus:"neutral" property string groupstatus:"neutral"
onGroupstatusChanged: onGroupstatusChanged:
{if(groupstatus=="positive"){groupitemRect.color="light green"} {if(groupstatus=="positive"){groupitemRect.color="light green"}
else if (groupstatus=="negative"){groupitemRect.color= "red"} else if (groupstatus=="negative"){groupitemRect.color= "red"}
else{groupitemRect.color= "white"}} else{groupitemRect.color= "white"}}
color: "white" color: "white"
border.color:"grey" border.color:"grey"
Text{ Text{
@ -153,9 +148,10 @@ Rectangle{
anchors.bottomMargin:1 anchors.bottomMargin:1
text:qsTr("Save") text:qsTr("Save")
onClicked:{ onClicked:{
updatePerms(); updatePerms();
var perms=[]; 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{ BlueButton{
@ -163,16 +159,13 @@ Rectangle{
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin:1 anchors.bottomMargin:1
text:qsTr("Done") text:qsTr("Done")
onClicked:{//var group_allow=[];var group_deny=[]; onClicked:{updatePerms();
//print("contacts: "+Helperjs.cleanArray(contact_allow))
permissionDialog.destroy(); permissionDialog.destroy();
} }
} }
Component.onCompleted:{ Component.onCompleted:{
Helperjs.readData(db,"contacts",login.username,function(contacts){
Helperjs.readData(db,"contacts",login.username,function(contacts){
for (var name in contacts){ for (var name in contacts){
var contactstatus="neutral"; var contactstatus="neutral";
if (contact_allow.indexOf(contacts[name].cid)>-1){contactstatus="positive";print(contacts[name].cid+" pos")} 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 2.0
//import QtQuick.LocalStorage 2.0
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
Package { Package {
@ -17,62 +16,58 @@ Package {
id: placeHolder id: placeHolder
color: 'lightblue'; antialiasing: true color: 'lightblue'; antialiasing: true
anchors.fill:parent anchors.fill:parent
} }
BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready }
BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready } Image {
Image { id: realImage;
id: realImage; width: photoWrapper.width; height: photoWrapper.height
// property string hqphotolink: photoLink antialiasing: true;
width: photoWrapper.width; height: photoWrapper.height asynchronous: true
antialiasing: true; cache: false
asynchronous: true fillMode: Image.PreserveAspectFit;
cache: false source: imageLocation
fillMode: Image.PreserveAspectFit; }
source: imageLocation Rectangle{
// onStatusChanged: if (realImage.status == Image.Ready) print(realImage.paintedHeight+"x"+realImage.paintedWidth) id:phototextRectangle
} color:"black"
Rectangle{ z:3
id:phototextRectangle opacity: 0.5
color:"black" width:phototext.contentWidth
z:3 height: phototext.contentHeight
opacity: 0.5 anchors.bottom: photoWrapper.bottom
width:phototext.contentWidth }
height: phototext.contentHeight Text {
anchors.bottom: photoWrapper.bottom id:phototext
} z:4
Text { text: photoDescription.trim()
id:phototext width:15*mm
z:4 anchors.bottom: photoWrapper.bottom
text: photoDescription.trim() color: "white"
width:15*mm font.pixelSize: 2*mm
anchors.bottom: photoWrapper.bottom wrapMode:Text.Wrap
color: "white" }
font.pixelSize: 2*mm MouseArea {
wrapMode:Text.Wrap 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: [ states: [
State { State {
name: 'stacked'; when: albumWrapper.state == '' name: 'stacked'; when: albumWrapper.state == ''
ParentChange { target: photoWrapper; parent: stackItem; }//x: 1*mm; y: 1*mm } ParentChange { target: photoWrapper; parent: stackItem; }//x: 1*mm; y: 1*mm }
PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 } PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 }
PropertyChanges { target: phototext; opacity: 0.0 } PropertyChanges { target: phototext; opacity: 0.0 }
PropertyChanges { target: phototextRectangle; opacity: 0.0 } PropertyChanges { target: phototextRectangle; opacity: 0.0 }
}, },
State { State {
name: 'inGrid'; when: albumWrapper.state == 'inGrid' name: 'inGrid'; when: albumWrapper.state == 'inGrid'
ParentChange { target: photoWrapper; parent: gridItem; x: 1*mm; y: 1*mm;} ParentChange { target: photoWrapper; parent: gridItem; x: 1*mm; y: 1*mm;}
PropertyChanges { target: phototext; opacity: 1.0 } PropertyChanges { target: phototext; opacity: 1.0 }
@ -86,14 +81,12 @@ Package {
width: root.width-mm; height: root.height-8*mm width: root.width-mm; height: root.height-8*mm
} }
PropertyChanges { target: placeHolder; opacity: 0.0 } 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; anchors.bottom: realImage.bottom}
PropertyChanges { target: phototext; width:realImage.width } PropertyChanges { target: phototext; width:realImage.width }
PropertyChanges { target: phototextRectangle; anchors.bottom: realImage.bottom } PropertyChanges { target: phototextRectangle; anchors.bottom: realImage.bottom }
PropertyChanges { target: realImage; width: Math.min(listItem.width,sourceSize.width);height: Math.min(listItem.height,sourceSize.height) } 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 2.0
import QtQuick.Dialogs 1.2 //import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQml.Models 2.1 import QtQml.Models 2.1
import "qrc:/js/service.js" as Service import "qrc:/js/service.js" as Service
@ -18,21 +18,17 @@ Rectangle {
color: '#fff' color: '#fff'
property var newimages:[] property var newimages:[]
property int currentimageno: 0 property int currentimageno: 0
//onLoginChanged:{var msg = {'model': photogroupModel,'albums':[],'firstalbum':0,'foreignPicture':false};
// photoWorker.sendMessage(msg);
//}
onNewimagesChanged:{ onNewimagesChanged:{
if(newimages.length>0){ if(newimages.length>0){
Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){ 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++){
for (var i=0;i<newimages.length;i++){ if(albums.indexOf(newimages[i].album)==-1){
if(albums.indexOf(newimages[i].album)==-1){ filesystem.Directory=root.login.imagestore+"/albums";
filesystem.Directory=root.login.imagestore+"/albums"; filesystem.makeDir(newimages[i].album)}}
filesystem.makeDir(newimages[i].album)}}
}) })
//print("Current image number"+currentImageNo) Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab);
Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab); newImagesProgress.visible=true //download first image
newImagesProgress.visible=true //download first image
} }
} }
@ -44,20 +40,21 @@ Rectangle {
} }
function showOwnFotos(){ function showOwnFotos(){
try {photogroupModel.clear()}catch (e){print(e)} try {photogroupModel.clear()}catch (e){print(e)}
Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){ Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
if (albums[0]) { if (albums[0]) {
var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false}; var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false};
photoWorker.sendMessage(msg); photoWorker.sendMessage(msg);
}; }
}) })
}
Connections{
target:root
onLoginChanged:{var msg = {'model': photogroupModel,'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{ Connections{
target:xhr target:xhr
@ -72,110 +69,111 @@ Rectangle {
function onFriendsFotos(friend){ function onFriendsFotos(friend){
fotostab.phototabstatus=friend.screen_name; fotostab.phototabstatus=friend.screen_name;
//print("Friend "+friend.url);
try {photogroupModel.clear()}catch (e){print(e)} try {photogroupModel.clear()}catch (e){print(e)}
Service.requestFriendsAlbumPictures(root.login,friend,fotostab,function(albums){ Service.requestFriendsAlbumPictures(root.login,friend,fotostab,function(albums){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true}; var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true}
photoWorker.sendMessage(msg); photoWorker.sendMessage(msg);
}) })
} }
ProgressBar{ ProgressBar{
id: newImagesProgress id: newImagesProgress
width: 15*mm width: 15*mm
height: updatePhotolist.height height: updatePhotolist.height
anchors.top: parent.top anchors.top: parent.top
anchors.right:updatePhotolist.left anchors.right:updatePhotolist.left
anchors.rightMargin:mm anchors.rightMargin:mm
visible: false visible: false
value: currentimageno/newimages.length value: currentimageno/newimages.length
} }
BlueButton{ BlueButton{
id: updatePhotolist id: updatePhotolist
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 0.5*mm anchors.topMargin: 0.5*mm
anchors.right:phototabstatusButton.left anchors.right:phototabstatusButton.left
anchors.rightMargin:mm anchors.rightMargin:mm
text: qsTr("Update") text: qsTr("Update")
onClicked: { onClicked: {
Service.requestList(root.login,root.db, fotostab,function(obj){ Service.requestList(root.login,root.db, fotostab,function(obj){
newimages=obj;print("newimages"+JSON.stringify(obj)) newimages=obj;print("newimages"+JSON.stringify(obj))
})}} })}}
BlueButton{ BlueButton{
id: phototabstatusButton id: phototabstatusButton
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 0.5*mm anchors.topMargin: 0.5*mm
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin:2*mm anchors.rightMargin:2*mm
text: qsTr(phototabstatus) text: qsTr(phototabstatus)
onClicked: {phototabmenu.popup()} onClicked: {phototabmenu.popup()}
} }
Menu { Menu {
id:phototabmenu id:phototabmenu
MenuItem { MenuItem {
text: qsTr("Own Images") text: qsTr("Own Images")
onTriggered: { onTriggered: {
phototabstatus="Images"; phototabstatus="Images";
showOwnFotos()} showOwnFotos()}
} }
} }
DelegateModel{
id: visualphotoModel DelegateModel{
delegate: PhotogroupComponent{} id: visualphotoModel
model: photogroupModel delegate: PhotogroupComponent{}
} model: photogroupModel
}
ListModel{
id: photogroupModel ListModel{
} id: photogroupModel
}
GridView {
id: albumgridview GridView {
cellWidth: 17*mm id: albumgridview
cellHeight: 17*mm cellWidth: 17*mm
x: mm;y:8*mm cellHeight: 17*mm
width: parent.width-2*mm; height: parent.height-9*mm x: mm;y:8*mm
clip: true width: parent.width-2*mm; height: parent.height-9*mm
model: visualphotoModel.parts.album clip: true
footer: model: visualphotoModel.parts.album
Rectangle{ footer:Rectangle{
border.color: "#EEEEEE" border.color: "#EEEEEE"
border.width: 1 border.width: 1
width:12*mm width:12*mm
height:6*mm height:6*mm
Text{ Text{
font.pixelSize: 1.5*mm font.pixelSize: 1.5*mm
anchors.centerIn: parent anchors.centerIn: parent
text:qsTr("More") text:qsTr("More")
} }
MouseArea{anchors.fill:parent MouseArea{anchors.fill:parent
onClicked:{ onClicked:{
var lastalbum_id=photogroupModel.get(photogroupModel.count-1); var lastalbum_id=photogroupModel.get(photogroupModel.count-1);
if(photogroupModel.get(photogroupModel.count-1).foreignPictures==false){Service.requestFriendsAlbumPictures(friend,fotostab,function(albums){ if(photogroupModel.get(photogroupModel.count-1).foreignPictures==false){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true}; Service.requestFriendsAlbumPictures(friend,fotostab,function(albums){
photoWorker.sendMessage(msg); })} var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true}
else { Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){ photoWorker.sendMessage(msg)
var msg = { 'model': photogroupModel,'albums':albums,'foreignPicture': false,'firstalbum':lastalbum_id+1}; })}
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 } Rectangle { id: photoBackground; color: 'light grey'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 }
BlueButton { ListView { anchors.fill: parent; model: visualphotoModel.parts.browser; interactive: false }
id: backButton
text: qsTr("Back") BlueButton {
x: parent.width - backButton.width - 3*mm id: backButton
y: -backButton.height - 4*mm text: qsTr("Back")
onClicked: {photoBackground.opacity=0} 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"}
ListView {anchors.fill: parent; model: visualphotoModel.parts.fullscreen; interactive: false }
Component.onCompleted: { root.fotoSignal.connect(onFriendsFotos);} 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 2.0
import QtQuick.LocalStorage 2.0
import QtQuick.Controls 1.3 import QtQuick.Controls 1.3
import QtQml.Models 2.1 import QtQml.Models 2.1
import "qrc:/js/service.js" as Service import "qrc:/js/service.js" as Service
@ -27,8 +26,7 @@ Package {
Item { Item {
Package.name: 'album' 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 { DelegateModel {
id: visualModel; delegate: PhotoComponent { } id: visualModel; delegate: PhotoComponent { }
model: photoModel model: photoModel
@ -55,7 +53,7 @@ Package {
} }
Text { Text {
id:albumtext id:albumtext
text: albumname //foreignPicture ? album.name.trim() : album text: albumname
width:albumWrapper.width-1*mm width:albumWrapper.width-1*mm
height: albumtext.contentHeight height: albumtext.contentHeight
wrapMode:Text.Wrap wrapMode:Text.Wrap
@ -72,25 +70,21 @@ Package {
Component.onCompleted:{ Component.onCompleted:{
try {photoModel.clear()}catch (e){print(e)} try {photoModel.clear()}catch (e){print(e)}
if(foreignPicture){ if(foreignPicture){
//print("Albumlink"+album.link);
Service.requestFriendsPictures(albumlink,fotostab,function(obj){ Service.requestFriendsPictures(albumlink,fotostab,function(obj){
if (obj) { if (obj) {
for (var k=0;k<obj.length;k++){ 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})
photoModel.append({"imageLocation": obj[k].thumb,"photoDescription":obj[k].name,"photoLink":obj[k].link}) }
}; }
}
})} })}
else{ else{
Helperjs.readData(db,"imageData",root.login.username,function(obj){ Helperjs.readData(db,"imageData",root.login.username,function(obj){
// obj.sort(function(obj1,obj2){return obj1.data-obj2.data}); if (obj) {
if (obj) { for (var k=0;k<obj.length;k++){
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})
// 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)}
}
},"album",albumname)}
} }
MouseArea { MouseArea {