This commit is contained in:
pankraz 2017-11-07 21:57:40 +01:00
commit 7e37546ae9
108 changed files with 6063 additions and 1450 deletions

View file

@ -18,7 +18,7 @@ Rectangle {
property int offsetTime: currentTime.getTimezoneOffset() * 60 * 1000
property var events:[]
property var eventdays:[]
onEventdaysChanged: print(JSON.stringify(eventdays))
//onEventdaysChanged: print(JSON.stringify(eventdays))
function showEvents(friend){
if(friend=="backButton"){Service.eventsfromdb(db,login.username,function(eventArray,dayArray){
@ -32,10 +32,10 @@ Rectangle {
eventdays=dayArray})
}
else {calendartab.calendartabstatus="Events";
Service.eventsfromdb(db,login.username,function(eventArray,dayArray){
events=eventArray;
eventdays=dayArray;
calBusy.running=false
Service.eventsfromdb(db,login.username,function(eventArray,dayArray){
events=eventArray;
eventdays=dayArray;
calBusy.running=false
})
}
}

View file

@ -1,6 +1,7 @@
import QtQuick 2.7
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.2
import "qrc:/js/service.js" as Service
import "qrc:/js/layout.js" as Layoutjs
import "qrc:/js/helper.js" as Helperjs

View file

@ -10,15 +10,17 @@ Rectangle{
anchors.top:closeButton.bottom
anchors.topMargin: mm
textFormat: Text.RichText
wrapMode: Text.Wrap
text: "<b>Friendiqa v0.003 </b><br>Licensed under GPL 3<br> "+
width: parent.width
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: "<b>Friendiqa v0.1 </b><br>Licensed under GPL 3<br> "+
"Profile <a href='https://freunde.ma-nic.de/profile/friendiqa'>https://freunde.ma-nic.de/profile/friendiqa</a><br>"+
"Sourcecode: <a href='https://github.com/LubuWest/Friendiqa'>https://github.com/LubuWest/Friendica</a><br>"+
"C++ code by <a href='https://kirgroup.com/profile/fabrixxm'>Fabio</a><br>"+
"QML and Javascript code by <a href='https://freunde.ma-nic.de/profile/marco'>Marco</a><br>"+
"Qt Framework <a href='https://www.qt.io'>www.qt.io</a><br>"+
"Icons by <a href='http://fontawesome.io'>FontAwesome</a><br>"+
"Folder Icon by <a href='https://github.com/KDE/breeze-icons'>KDE Breeze Icons</a>"
"Folder Icon by <a href='https://github.com/KDE/breeze-icons'>KDE Breeze Icons</a><br>"+
"AndroidNative by <a href='https://github.com/benlau/androidnative.pri'>Ben Lau</a>"
onLinkActivated:{
Qt.openUrlExternally(link)}
}
@ -28,7 +30,7 @@ Rectangle{
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057" //qsTr("Close")
text: "\uf057"
onClicked:{configStack.pop()}
}
}

View file

@ -20,7 +20,7 @@ Rectangle {
width: 10*mm
height:10*mm
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
onStatusChanged: {if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}}
}
Label {

View file

@ -13,8 +13,8 @@ property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend==1)?""
Rectangle {
id: wrapper
width:friendsTabView.width;
height:friendsTabView.height-15*mm
width:root.width-2*mm //friendsTabView.width;
height:root.height-20*mm// friendsTabView.height-15*mm
border.color: "grey"
color:"white"
Image {
@ -30,7 +30,7 @@ Rectangle {
Label {
id: namelabel
x: mm
width:friendsTabView.width-4*mm
width: root.width-6*mm //friendsTabView.width-4*mm
height: 3*mm
text:Qt.atob(contact.name)+" (@"+contact.screen_name+")"
elide:Text.ElideRight
@ -50,7 +50,7 @@ Rectangle{
frameVisible: true
id:namelabelflickable
width: root.width-10*mm
height:friendsTabView.height-45*mm
height:root.height-50*mm//friendsTabView.height-45*mm
x: mm
clip:true
Text{
@ -83,6 +83,7 @@ Rectangle{
root.currentIndex=2;
fotostab.active=true;
root.fotoSignal(contact) ;
contactLargeComponent.destroy();
}
}
@ -93,6 +94,7 @@ Rectangle{
root.currentIndex=0;
newstab.active=true;
root.messageSignal(contact.id) ;
contactLargeComponent.destroy();
}
}
@ -104,6 +106,7 @@ Rectangle{
root.currentIndex=0;
newstab.active=true;
root.directmessageSignal(contact.screen_name);
contactLargeComponent.destroy();
}
}
@ -117,6 +120,7 @@ Rectangle{
calendartab.active=true;
calendartab.calendartabstatus="Friend"
root.eventSignal(contact.url);
contactLargeComponent.destroy();
}
}
@ -124,8 +128,7 @@ Rectangle{
id: closeButton
text: "\uf057" //"close"
onClicked:{contactLargeComponent.destroy();
//contactComponent.state="";
friendsTabView.contactSignal}
}
}
}
}

View file

@ -0,0 +1,101 @@
// List of people
import QtQuick 2.0
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
Rectangle {
id:contactlistRectangle
property var contacts:[]
property var possibleUsers: []
//y:8*mm
color: "white"
border.color: "light grey"
radius:0.5*mm
width:groupListView.width
height:groupListView.height
ListView {
id: contactView
x:mm
y:6*mm
width: contactlistRectangle.width-2*mm
height: contactlistRectangle.height-10*mm
clip: true
spacing: 0
model: contactModel
delegate: listContact
}
ListModel{id: contactModel}
Component { id:listContact
Rectangle{
border.color: "#EEEEEE"
border.width: 1
radius:0.5*mm
width:contactView.width
height:6*mm
Image {
id: contactImage
x:1
y:1
width: 5*mm
height:5*mm
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: if (contactImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text{
font.pixelSize: 3*mm
anchors.left: contactImage.right
anchors.margins: 1*mm
text:Qt.atob(contact.name)
}
Text {
id:selected
anchors.right:parent.right
visible: contactlist.indexOf(contact)>-1
z:4
text: "\u2713"
width: 5*mm
anchors.top: parent.top
color: "green"
font.pixelSize: 3*mm
}
MouseArea{
anchors.fill: parent
onClicked:{
if(selected.visible==true){
contacts.splice(Helperjs.inArray(contacts,"id",contact.id),1);
selected.visible=false
}
else{
contacts.push(contact);
selected.visible=true;
}
}
}
}
}
BlueButton {
id: closeButton
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
color:"white"
text: "\uf057"
onClicked: {
groupModelAppend(contacts,function(){
contactlistRectangle.destroy()
});
}
}
Component.onCompleted: {
for (var user in possibleUsers){
contactModel.append({"contact":possibleUsers[user]})
}
}
}

View file

@ -3,6 +3,7 @@ import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
import "qrc:/qml/contactqml"
import "qrc:/qml/genericqml"
@ -20,6 +21,9 @@ Rectangle {
var contactDetails = component.createObject(friendstab,{"contact": contact})
}
}
TabView{
id:friendsTabView
tabPosition: Qt.TopEdge
@ -63,7 +67,7 @@ Rectangle {
id: friendsGridTab
function showFriends(contact){
try {friendsModel.clear()} catch(e){print(e)};
Helperjs.readData(db,"contacts",root.login.username,function(friendsobject){
Helperjs.readData(db,"contacts",login.username,function(friendsobject){
for (var i=0;i<friendsobject.length;i++){
if(Helperjs.getCount(db,login,"contacts","screen_name",friendsobject[i].screen_name)>1){
friendsobject[i].screen_name=friendsobject[i].screen_name+"+"+friendsobject[i].cid
@ -140,13 +144,30 @@ Rectangle {
}
},"isFriend",0,"screen_name ASC");
}
BlueButton {
id: cleanButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
onClicked: {
Service.cleanContacts(root.login,root.db,function(){
try {contactsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
for (var j=0;j<contactsobject.length;j++){
contactsModel.append({"contact":contactsobject[j]});
}
},"isFriend",0,"screen_name ASC");
})
}
}
GridView {
id: contactsView
x:mm
y:2*mm
y:cleanButton.height+2*mm
width:contactsGridTab.width-2*mm
height:contactsGridTab.height-2*mm
height:contactsGridTab.height-cleanButton.height-2*mm
clip: true
cellHeight: 16*mm
cellWidth: 17*mm
@ -173,16 +194,65 @@ Rectangle {
for (var j=0;j<groupsobject.length;j++){
groupsModel.append({"group":groupsobject[j]});
}})}
function updateGroup(login,database,group){
// update groups
//var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
//var groupdata={"gid":group.id,"name":group.name,"user":group.user};
//print("Groupdata "+JSON.stringify(group));
var api="";
if (group.new){api="/api/friendica/group_create.json?name="+group.name}else{api="/api/friendica/group_update.json?gid="+group.id}
xhr.url= login.server + api;
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.clearParams();
xhr.setParam("gid",group.id);
xhr.setParam("name",group.name);
xhr.setParam("user", group.user);
xhr.setParam("json",group);
xhr.post();
// Helperjs.friendicaPostRequest(login,api,groupdata,"POST",rootwindow, function (obj){print("groupcreate "+obj);
// var groups=JSON.parse(obj);
// db.transaction( function(tx) {
// var result = tx.executeSql('DELETE from groups where username="'+login.username+'"'); // clean old groups
// for (var i=0;i<groups.length;i++){
// var memberarray=[]; for (var user in groups[i].user){memberarray.push(parseInt(groups[i].user[user].cid))}
// //print("Members: "+groups[i].user)
// var result2 = tx.executeSql('INSERT INTO groups VALUES (?,?,?,?)', [login.username,groups[i].name,groups[i].gid,JSON.stringify(memberarray)])}
// callback()
// });
// })
}
Connections{
target:xhr
onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}}
onSuccess:{print("gruppe "+data);
Newsjs.requestGroups(root.login,root.db,root,function(){
showGroups(root.login.username)});
}
}
BlueButton {
id: updateGroupsButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
anchors.rightMargin: mm
onClicked: {
Newsjs.requestGroups(root.login,root.db,root,function(){
showGroups(root.login.username)})}
}
// BlueButton {
// id: newGroupButton
// text: "\uf234"
// anchors.top: parent.top
// anchors.topMargin: mm
// anchors.right: updateGroupsButton.left
// anchors.rightMargin: mm
// onClicked: {
// groupsModel.append({"group": {"new":true}});
// }
// }
GridView {
id: groupsView
x:mm
@ -196,11 +266,29 @@ Rectangle {
NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
}
model: groupsModel
delegate: GroupComponent { }
delegate: GroupComponent {}
//footer:groupFooter
}
ListModel{
id: groupsModel
}
// Component{
// id: groupFooter
// Image{
// id: footerImage
// width: 15*mm
// height: 15*mm
// fillMode: Image.PreserveAspectFit
// source:"qrc:/images/addImage.png"
// MouseArea{
// anchors.fill: parent
// onClicked:{
// print("new group")
// var component = Qt.createComponent("qrc:/qml/contactqml/GroupComponent.qml");
// var imagedialog = component.createObject(groupsView,{"group": []});}
// }
// }
// }
Component.onCompleted: {
friendsTabView.groupsSignal.connect(showGroups);
}

View file

@ -1,128 +1,215 @@
import QtQuick 2.0
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/news.js" as Newsjs
import "qrc:/qml/genericqml"
Item {
id: groupComponent
Rectangle {
id: wrapper
width: 16*mm
height: 15*mm
border.color: "grey"
color:"white"
Item {
id: groupComponent
property var groupmembers:[]
//property bool newGroup: false
function groupModelAppend(groupcontacts,callback){
for (var n in groupcontacts){
groupModel.append({"groupmember":groupcontacts[n]});}
callback()
}
Image {
id: photoImage
x:1
y:1
width: 10*mm
height:10*mm
source:"qrc:/images/defaultcontact.jpg"
}
Text {
id: namelabel
x: 1
width: wrapper.width-2
height: 3*mm
text: group.groupname
color: "#303030"
font.pixelSize: 3*mm
anchors.top: photoImage.bottom
}
BlueButton{
id:infobutton
width: 5*mm
height: 5*mm
color:"transparent"
text:"?"
anchors.left: photoImage.right
anchors.leftMargin: 3
anchors.topMargin: 3
anchors.top: parent.top
onClicked:{
Helperjs.readField("members",root.db,"groups",root.login.username,function(groups){
try {groupModel.clear()}catch (e){print(e)}
var groupmembers=JSON.parse(groups);
for (var user in groupmembers){
Helperjs.readData(root.db,"contacts",root.login.username,function(userdata){
if (userdata[0]){groupModel.append({"groupmember":userdata[0]})}
},"id",groupmembers[user])}
},"groupname",group.groupname);
groupComponent.state="large"}
}
Rectangle {
id: wrapper
width: 16*mm
height: 15*mm
border.color: "grey"
color:"white"
Image {
id: photoImage
x:1
y:1
width: 10*mm
height:10*mm
source:"qrc:/images/defaultcontact.jpg"
}
Rectangle{
id:namelabelRect
x: 1
width: wrapper.width-2
height: 3.5*mm
anchors.top: photoImage.bottom
border.color: "light grey"
TextInput {
id: namelabel
anchors.fill: parent
readOnly: true
text: group.new?"":group.groupname
color: "#303030"
font.pixelSize: 3*mm
Rectangle{
}
}
BlueButton{
id:infobutton
width: 5*mm
height: 5*mm
color:"transparent"
text:"?"
anchors.left: photoImage.right
anchors.leftMargin: 3
anchors.topMargin: 3
anchors.top: parent.top
onClicked:{
//if(group.new){
Helperjs.readField("members",root.db,"groups",root.login.username,function(groups){
try {groupModel.clear()}catch (e){print(e)}
groupmembers=JSON.parse(groups);
for (var user in groupmembers){
Helperjs.readData(root.db,"contacts",root.login.username,function(userdata){
if (userdata[0]){groupModel.append({"groupmember":userdata[0]})}
},"id",groupmembers[user])
} //catch(e){}
},"groupname",group.groupname);
//}
groupComponent.state="large"
}
}
Rectangle{
id: detailsrectangle
anchors.top: namelabel.bottom
anchors.top: namelabelRect.bottom
anchors.topMargin: 2*mm
opacity: 0
Component { id:groupMember
Rectangle{
border.color: "#EEEEEE"
border.width: 1
width:parent.width
height:6*mm
Image {
id: memberImage
x:1
y:1
width: 5*mm
height:5*mm
source:(groupmember.isFriend==1)? "file://"+groupmember.profile_image :groupmember.profile_image_url
onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text{
font.pixelSize: 3*mm
anchors.left: memberImage.right
anchors.margins: 1*mm
text:Qt.atob(groupmember.name)
}
MouseArea{
anchors.fill: parent
onClicked:{
root.currentIndex=1;
friendstab.active=true;
root.contactdetailsSignal(groupmember)
Component {
id:groupMember
Rectangle{
width:parent.width
height:6*mm
Rectangle{id:memberrectangle
border.color: "#EEEEEE"
border.width: 1
width:parent.width-12*mm
height:6*mm
Image {
id: memberImage
x:1
y:1
width: 5*mm
height:5*mm
source:(groupmember.isFriend==1)? "file://"+groupmember.profile_image :groupmember.profile_image_url
onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text{
font.pixelSize: 3*mm
anchors.left: memberImage.right
anchors.margins: 1*mm
width:parent.width-1
text:Qt.atob(groupmember.name)
}
MouseArea{
anchors.fill: parent
onClicked:{
root.currentIndex=1;
friendstab.active=true;
root.contactdetailsSignal(groupmember)
}
}
// BlueButton{
// anchors.left: memberrectangle.right
// anchors.margins: 1*mm
// text: "\uf056"
// onClicked:{
// groupModel.remove(index)
// }
// }
}
}
}
}}
ListView{
id: groupListView
x:1
//anchors.top: parent.top
width: root.width-10*mm
height:groupsView.height -29*mm
clip: true
spacing: 2
model: groupModel
delegate: groupMember
}
ListView{
id: groupListView
x:1
//anchors.top: parent.top
width: root.width-10*mm
height:groupsView.height -31*mm
clip: true
spacing: 2
model: groupModel
delegate: groupMember
}
ListModel{id: groupModel}
ListModel{id: groupModel}
BlueButton{
id: closeButton
anchors.top: groupListView.bottom
anchors.topMargin: mm
text: "\uf057"
onClicked:{groupComponent.state=""}
Row{
anchors.top: groupListView.bottom
anchors.topMargin: mm
spacing: mm
BlueButton{
id: closeButton
text: "\uf057"
onClicked:{groupComponent.state="";
if (group.new){groupsModel.remove(index)}
}
}
// BlueButton{
// id: addMembers
// text:"\uf234"
// onClicked: {
// Newsjs.listFriends(root.login,root.db,function(userdata){
// var newlistcontacts=[];
// for (var n in userdata){
// if (groupmembers.indexOf(userdata[n].id)==-1){
// newlistcontacts.push(userdata[n])
// }
// }
// var component = Qt.createComponent("qrc:/qml/contactqml/Contactlist.qml");
// var contactlistobject = component.createObject(groupListView,{"possibleUsers":newlistcontacts});
// })
// }
// }
// BlueButton{
// id: updateButton
// text: "\uf0ee"
// onClicked:{
// var groupobject={};
// var groupmembers=[];
// for (var i=0;i<groupModel.count;i++){groupmembers.push(groupModel.get(i).groupmember)}
// try{ groupobject.id=group.gid} catch(e){};
// try{ groupobject.new=group.new} catch(e){};
// if (namelabel.text==""){
// Helperjs.showMessage(qsTr("Error"),qsTr("No name given"),root)}
// else {
// groupobject.name=namelabel.text;
// groupobject.user=groupmembers;
// updateGroup(login,db,groupobject)
// groupComponent.state="";
// }
// }
// }
// BlueButton{
// id: deleteButton
// text: "\uf056"
// onClicked:{
// Newsjs.deleteGroup(root.login,root.db,root,group,function(){
// groupComponent.state="";
// groupsModel.remove(index)})
// }
// }
}
}
Component.onCompleted:{if(group.new){groupComponent.state="large"}}
}
}
states: [
State {
states: [
State {
name: "large"
PropertyChanges { target: namelabel; font.pixelSize: 4*mm; width:groupsView.width}
PropertyChanges { target: namelabel; font.pixelSize: 4*mm; width:groupsView.width; readOnly:false}
PropertyChanges { target: namelabelRect; height: 4.5*mm}
PropertyChanges { target: groupComponent; z: 2 }
PropertyChanges { target: wrapper; width:groupsView.width;height:groupsView.height -2*mm-1}
PropertyChanges { target: photoImage; width:15*mm;height:15*mm }
PropertyChanges { target:groupComponent.GridView.view ;contentY:groupComponent.y;contentX:groupComponent.x;interactive:false}
PropertyChanges { target: detailsrectangle; opacity:1 }
}
]
]
}

View file

@ -25,7 +25,6 @@ TabView{
signal friendsSignal(var username)
signal contactdetailsSignal(var contact)
signal eventSignal(var contact)
//currentIndex: (login=="")? 3:0
property var news:[]
property var newContacts:[]
@ -49,7 +48,7 @@ TabView{
})}
}
onCurrentContactChanged:{// download next contact image after photoplaceholder is finished saving and update db
onCurrentContactChanged:{// download next contact image after successful download and update db
if(currentContact<newContacts.length){
Service.updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])}
@ -117,7 +116,7 @@ TabView{
tab: Rectangle {
color: styleData.selected?"sky blue":"light blue"
border.color: "light grey"
implicitWidth: root.width/5-2*mm
implicitWidth: root.width/5
implicitHeight: 5*mm
Text { id: text
anchors.centerIn: parent

View file

@ -0,0 +1,148 @@
import QtQuick 2.0
import QtQuick.Controls 1.2
import Qt.labs.folderlistmodel 2.1
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
Rectangle{
id:imageDialog
z:2
border.color: "grey"
width: parent.width-4*mm
height:parent.height-12*mm
x:2*mm
y:10*mm
property string directory: ""
property bool multiSelection: false
Text{
id:directoryText
x:0.5*mm
y:0.5*mm
width: imageDialog.width-15*mm
height:contentHeight
wrapMode: Text.Wrap
text: directory
}
BlueButton{
id:closeButton
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
onClicked:{imageDialog.destroy()}
}
ListView {
id: imageView
x:0.5*mm
y: Math.max(directoryText.height, closeButton.height)+mm
width: imageDialog.width-2*mm
height: imageDialog.height-imageView.y-4*mm
clip: true
model: imageModel
delegate: imageItem
}
FolderListModel{
id: imageModel
nameFilters: ["*.png", "*.jpg",".jpeg","*.JPG","*.gif"]
sortField: FolderListModel.Time
sortReversed:false
showDotAndDotDot: true
showDirs: true
showDirsFirst: true
folder:directory
}
BusyIndicator{
id: imageBusy
anchors.horizontalCenter: imageView.horizontalCenter
anchors.top:imageView.top
anchors.topMargin: 2*mm
width:10*mm
height: 10*mm
running:false
}
Component{
id:imageItem
Item{
width:imageView.width
height:folderImage.height+2*mm
Rectangle{
id:imagetextRectangle
color:"black"
x:mm
z:3
opacity: fileIsDir?0:0.5
width:imagetext.contentWidth
height: imagetext.contentHeight
anchors.bottom: folderImage.bottom
}
Text {
id:imagetext
x:fileIsDir?11*mm:mm
z:4
text: fileName
width: fileIsDir?parent.width - 12*mm :imageView.width-mm
anchors.bottom: folderImage.bottom
color: fileIsDir?"black":"white"
font.pixelSize: 3*mm
wrapMode:Text.Wrap
}
Text {
id:selected
anchors.right:parent.right
visible: attachImageURLs.indexOf(fileURL)>-1
z:4
text: "\u2713"
width: 10*mm
anchors.top: folderImage.top
color: "green"
font.pixelSize: 10*mm
}
Image{id:folderImage
width: fileIsDir?10*mm: imageView.width-mm
fillMode:Image.PreserveAspectFit
source:fileIsDir?"qrc:/images/folder-blue.png":fileURL
}
MouseArea{
anchors.fill: parent
onClicked:{
if (fileName==".."){
imageModel.folder=imageModel.parentFolder;
directory=imageModel.parentFolder
}
else if (fileIsDir){
imageModel.folder=fileURL;
directory=fileURL
}
else{
if (multiSelection!=true){
attachImageURLs.push(fileURL);
attachImage(fileURL);
imageDialog.destroy()
}
else {
if(selected.visible==true){
attachImageURLs.splice(attachImageURLs.indexOf(fileURL,1))
selected.visible=false
}
else{
attachImageURLs.push(fileURL);
selected.visible=true;
}
attachImage(fileURL)
}
}
}
}
}
}
}

View file

@ -0,0 +1,59 @@
import QtQuick 2.0
import AndroidNative 1.0
Item {
/// Set it to true if multiple images should be picked.
property bool multiple: false
/// If it is true, it will broadcast the taked photo to other application (e.g Let it show in Google Photos)
property bool broadcast: true
/// The URL of the image chosen. If multiple images are picked, it will be equal to the first image.
property string imageUrl: ""
/// A list of images chosen
property var imageUrls: []
/// It is emitted whatever photo(s) are picked/taken.
signal ready();
function pickImage() {
SystemDispatcher.dispatch(m_PICK_IMAGE_MESSAGE,{ multiple: multiple});
}
function takePhoto() {
SystemDispatcher.dispatch(m_TAKE_PHOTO_MESSAGE,{
broadcast: broadcast
})
}
property string m_PICK_IMAGE_MESSAGE: "androidnative.ImagePicker.pickImage";
property string m_TAKE_PHOTO_MESSAGE: "androidnative.ImagePicker.takePhoto";
property string m_CHOSEN_MESSAGE: "androidnative.ImagePicker.chosen";
Connections {
target: SystemDispatcher
onDispatched: {
if (type === m_CHOSEN_MESSAGE) {
//imageUrls = message.imageUrls;
//imageUrl = imageUrls[0];
var h=[];
for (var n in message.imageUrls){
h.push("file://"+ decodeURIComponent(message.imageUrls[n]).substring(5))
}
imageUrls=h;
imageUrl=h[0];
ready();
}
}
}
Component.onCompleted: {
SystemDispatcher.loadClass("androidnative.ImagePicker");
}
}

View file

@ -1,8 +0,0 @@
import QtQuick 2.0
import QtQuick.Window 2.0
QtObject{
property int appWidth: Screen.desktopAvailableWidth
property int appHeight: Screen.desktopAvailableHeight
property int backKey: Qt.Key_Back
property string attachImageDir:filesystem.cameraPath+"/"
}

View file

@ -1,7 +0,0 @@
import QtQuick 2.0
QtObject{
property real appWidth: 500
property real appHeight: 500
property int backKey: Qt.Key_Escape
property string attachImageDir:filesystem.homePath+"/Pictures/"
}

View file

@ -0,0 +1,189 @@
import QtQuick 2.0
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
Rectangle{
id:permissionDialog
// x: mm
width: parent.width-5*mm
height:root.height/3
function updatePerms(){
for (var i=0;i<groupModel.count;i++)
{if (groupModel.get(i).groupstatus=="positive"){
group_allow.push(groupModel.get(i).group.gid)
}
if (groupModel.get(i).groupstatus=="negative"){
group_deny.push(groupModel.get(i).group.gid)
}
}
for (var j=0;j<contactModel.count;j++){
if (contactModel.get(j).contactstatus=="positive"){
contact_allow.push(contactModel.get(j).contact.cid)
}
if (contactModel.get(j).contactstatus=="negative"){
contact_deny.push(contactModel.get(j).contact.cid)
}
if ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))
{permButton.text="\uf09c"}
else{permButton.text="\uf023"}
}}
Text{
x:0.5*mm
y:0.5*mm
text: qsTr("Friends")
}
ListView {
id: contactView
x:0.5*mm
y:5.5*mm
width: permissionDialog.width/2-2*mm
height: permissionDialog.height-14*mm
clip: true
spacing: 1
model: contactModel
delegate: contactItem
}
ListModel{id: contactModel}
Component{
id:contactItem
Rectangle{
id:contactitemRect
width:contactView.width
height: 5*mm
radius: 0.5*mm
property string contactstatus
onContactstatusChanged:{
if(contactstatus=="positive"){contactitemRect.color="light green"}
else if (contactstatus=="negative"){contactitemRect.color= "ffe6e6"}
else{contactitemRect.color= "white"}}
color: "white"
border.color:"grey"
Text{
color:"grey"
text:contact.screen_name
}
MouseArea{
anchors.fill: parent
onClicked:{
if(contactModel.get(index).contactstatus=="neutral"){
contactModel.set(index,{"contactstatus":"positive"});
contactstatus="positive"
}
else if (contactModel.get(index).contactstatus=="positive"){
contactModel.set(index,{"contactstatus":"negative"})
contactstatus="negative"
}
else{contactModel.set(index,{"contactstatus":"neutral"});
contactstatus="neutral";
}
}}
Component.onCompleted:{
if (contactModel.get(index).contactstatus=="positive"){
contactstatus="positive"
}
else if (contactModel.get(index).contactstatus=="negative"){
contactstatus="negative"
}
else {contactstatus="neutral"} }
}
}
Text{
x:contactView.width+2*mm
y:0.5*mm
text: qsTr("Groups")
}
ListView {
id: groupView
x:contactView.width+2*mm
y:5.5*mm
width: permissionDialog.width/2-2*mm
height: permissionDialog.height-14*mm
clip: true
spacing: 1
model: groupModel
delegate: groupItem
}
ListModel{id: groupModel}
Component{
id:groupItem
Rectangle{
id:groupitemRect
width:groupView.width
radius: 0.5*mm
height: 5*mm
property string groupstatus:"neutral"
onGroupstatusChanged:
{if(groupstatus=="positive"){groupitemRect.color="light green"}
else if (groupstatus=="negative"){groupitemRect.color= "#ffe6e6"}
else{groupitemRect.color= "white"}}
color: "white"
border.color:"grey"
Text{
color:"grey"
text:group.groupname
}
MouseArea{
anchors.fill: parent
onClicked:{
if(groupModel.get(index).groupstatus=="neutral"){
groupModel.set(index,{"groupstatus":"positive"});
groupstatus="positive"}
else if (groupModel.get(index).groupstatus=="positive"){
groupModel.set(index,{"groupstatus":"negative"});
groupstatus="negative"}
else{groupModel.set(index,{"groupstatus":"neutral"})
groupstatus="neutral"}
}}
Component.onCompleted:{ if (groupModel.get(index).groupstatus=="positive"){
groupstatus="positive"
}
else if (groupModel.get(index).groupstatus=="negative"){
groupstatus="negative"
}
else {groupstatus="neutral"} }
}
}
BlueButton{
x:0.5*mm
anchors.bottom: parent.bottom
anchors.bottomMargin:1
text:"\uf0c7"
onClicked:{
updatePerms();
var perms=[];
perms.push(contact_allow,contact_deny,group_allow,group_deny);
Service.savePermissions(db,perms)
}
}
BlueButton{
x:contactView.width+2*mm
anchors.bottom: parent.bottom
anchors.bottomMargin:1
text:"\u2713"
onClicked:{updatePerms();
permissionDialog.destroy();
}
}
Component.onCompleted:{
Helperjs.readData(db,"contacts",login.username,function(contacts){
for (var name in contacts){
var contactstatus="neutral";
if (contact_allow.indexOf(contacts[name].cid)>-1){contactstatus="positive"}
else if (contact_deny.indexOf(contacts[name].cid)>-1){contactstatus="negative"}
contactModel.append({"contact":contacts[name],"contactstatus":contactstatus})
}},"isFriend",1);
Helperjs.readData(db,"groups",login.username,function(owngroups){
for (var number in owngroups){
var groupstatus= "neutral";
if (group_allow.indexOf(owngroups[number].gid)>-1){groupstatus="positive"}
else if (group_deny.indexOf(owngroups[number].gid)>-1){groupstatus="negative"}
groupModel.append({"group":owngroups[number],"groupstatus":groupstatus})
}});
}
}

View file

@ -1,74 +0,0 @@
import QtQuick 2.0
import Qt.labs.folderlistmodel 2.1
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
Rectangle{
id:attachmentDialog
z:2
border.color: "grey"
width: parent.width-4*mm
height:parent.height-12*mm
x:2*mm
y:10*mm
property var parsedAttachments: JSON.parse(attachedobjects)
Text{
x:0.5*mm
y:0.5*mm
width: imageDialog-8*mm
elide:Text.ElideRight
text: "Attachments:"
}
BlueButton{
id:closeButton
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
onClicked:{attachmentDialog.destroy()}
}
ListView {
id: attachmentView
x:0.5*mm
y:5.5*mm
width: attachmentDialog.width-2*mm
height: attachmentDialog.height-14*mm
clip: true
spacing:0
model: attachmentModel
delegate: attachmentItem
}
ListModel{id: attachmentModel}
Component { id:attachmentItem
Rectangle{
border.color: "#EEEEEE"
border.width: 1
width:parent.width
height:6*mm
Text{
font.pixelSize: 3*mm
x: mm
text:attachment.name
}
MouseArea{
anchors.fill: parent
onClicked:{
Qt.openUrlExternally(attachment.url)
}
}
}}
}
Component.onCompleted: {
for (var a in parsedAttachments){
attachmentModel.append({"attachment":parsedAttachments[a]})
}
}
}

View file

@ -1,26 +1,18 @@
// ConversationView with button
import QtQuick 2.0
import QtQuick.Controls 1.2
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
Rectangle {
id:conversationList
property var news
//property var news
y:1
z:2
color: "white"
border.color: "grey"
width:root.width-5*mm
height: conversationView.height+10*mm
Connections{
target:newstab
onConversationChanged:{
if(newstab.conversation.length==0){
newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
conversationList.destroy(); conversationsymbol.color="grey"
}
}
}
ListView {
id: conversationView
@ -34,6 +26,32 @@ Rectangle {
model: conversationModel
delegate: Newsitem{}
}
BusyIndicator{
id: conversationBusy
anchors.horizontalCenter: conversationView.horizontalCenter
anchors.top:conversationList.top
anchors.topMargin: 2*mm
width:10*mm
height: 10*mm
running: true
}
Connections{
target:newstab
onConversationChanged:{
if(newsitem.itemindex==newsStack.conversationIndex){
if(newstab.conversation.length==0){
newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
conversationList.destroy(); conversationsymbol.color="grey"
} else { conversationBusy.running=false;
conversationModel.clear();
var currentTime= new Date();
var msg = {'currentTime': currentTime, 'model': conversationModel,'news':newstab.conversation};
conversationWorker.sendMessage(msg)
conversationsymbol.color="grey"}
}
}
}
Component { id:footerReply
Rectangle{
@ -117,9 +135,9 @@ Rectangle {
}
}
Component.onCompleted: {
var currentTime= new Date();
var msg = {'currentTime': currentTime, 'model': conversationModel,'news':news};
conversationWorker.sendMessage(msg)
}
// Component.onCompleted: {
// if (news){var currentTime= new Date();
// var msg = {'currentTime': currentTime, 'model': conversationModel,'news':news};
// conversationWorker.sendMessage(msg)}
// }
}

View file

@ -1,4 +1,4 @@
// List if people from Friendica Activities
// List of people from Friendica Activities
import QtQuick 2.0
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
@ -51,11 +51,7 @@ Rectangle {
MouseArea{
anchors.fill: parent
onClicked:{
try {root.currentIndex=1;
friendstab.active=true;
root.contactdetailsSignal(contact)
} catch(e) {Helperjs.showMessage("Error",e,root)}}
onClicked:{showContact(contact)}
}
}}

View file

@ -1,121 +0,0 @@
import QtQuick 2.0
import QtQuick.Controls 1.2
import Qt.labs.folderlistmodel 2.1
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
Rectangle{
id:imageDialog
z:2
border.color: "grey"
width: parent.width-4*mm
height:parent.height-12*mm
x:2*mm
y:10*mm
property string directory: ""
Text{
id:directoryText
x:0.5*mm
y:0.5*mm
width: imageDialog.width-15*mm
height:contentHeight
wrapMode: Text.Wrap
text: directory
}
BlueButton{
id:closeButton
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
onClicked:{imageDialog.destroy()}
}
ListView {
id: imageView
x:0.5*mm
y:directoryText.height+mm
width: imageDialog.width-2*mm
height: imageDialog.height-directoryText.height-4*mm
clip: true
model: imageModel
delegate: imageItem
}
FolderListModel{
id: imageModel
nameFilters: ["*.png", "*.jpg",".jpeg","*.JPG","*.gif"]
sortField: FolderListModel.Time
sortReversed:false
showDotAndDotDot: true
showDirs: true
showDirsFirst: true
folder:directory
}
BusyIndicator{
id: imageBusy
anchors.horizontalCenter: imageView.horizontalCenter
anchors.top:imageView.top
anchors.topMargin: 2*mm
width:10*mm
height: 10*mm
running:false
}
Component{
id:imageItem
Item{
width:imageView.width
height:folderImage.height+2*mm
Rectangle{
id:imagetextRectangle
color:"black"
x:mm
z:3
opacity: fileIsDir?0:0.5
width:imagetext.contentWidth
height: imagetext.contentHeight
anchors.bottom: folderImage.bottom
}
Text {
id:imagetext
x:fileIsDir?11*mm:mm
z:4
text: fileName
width: fileIsDir?parent.width - 12*mm :imageView.width-mm
anchors.bottom: folderImage.bottom
color: fileIsDir?"black":"white"
font.pixelSize: 3*mm
wrapMode:Text.Wrap
}
Image{id:folderImage
width: fileIsDir?10*mm: imageView.width-mm
fillMode:Image.PreserveAspectFit
source:fileIsDir?"qrc:/images/folder-blue.png":fileURL
}
MouseArea{
anchors.fill: parent
onClicked:{
if (fileName==".."){
imageModel.folder=imageModel.parentFolder;
directory=imageModel.parentFolder
}
else if (fileIsDir){
imageModel.folder=fileURL;
directory=fileURL
}
else{
attachImageURLs.push(fileURL);
attachImage(fileURL);
imageDialog.destroy()
}
}
}
}
}
}

View file

@ -26,10 +26,8 @@ Flickable{
property var group_deny:login.permissions[3]
function attachImage(url){
//onAttachImageURLsChanged: {if(attachImageURL!=""){
var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
url.toString()+'"; width: 15*mm; height: 15*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+url+'",1)); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
console.log("You chose: " + url)
var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
url.toString()+'"; width: 15*mm; height: 15*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
}
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
@ -125,12 +123,21 @@ Flickable{
}
Row{
ImagePicker {
id: imagePicker;
multiple : false
onReady: {
attachImageURLs.push(imagePicker.imageUrl);
attachImage(imagePicker.imageUrl)
}
}
spacing:2
BlueButton{id:permButton
visible: (directmessage==1)?false:true
text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"
onClicked: {
var component = Qt.createComponent("qrc:/qml/newsqml/PermissionDialog.qml");
var component = Qt.createComponent("qrc:/qml/genericqml/PermissionDialog.qml");
var permissions = component.createObject(messageColumn);
}}
BlueButton {
@ -142,9 +149,10 @@ Flickable{
Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment supported at the moment.\n Remove other attachment first!"), messageColumn)
}
else{
var defaultDirectory="file://"+osSettings.attachImageDir;
var component = Qt.createComponent("qrc:/qml/newsqml/ImageDialog.qml");
var imagedialog = component.createObject(messageSend,{"directory": defaultDirectory});
//var defaultDirectory="file://"+osSettings.attachImageDir;
//var component = Qt.createComponent("qrc:/qml/genericqml/ImageDialog.qml");
//var imagedialog = component.createObject(messageSend,{"directory": defaultDirectory});
imagePicker.pickImage()
}
}
}
@ -159,7 +167,7 @@ Flickable{
if(Helperjs.getCount(db,login,"contacts","screen_name",contacts[i].screen_name)>1){
contacts[i].screen_name=contacts[i].screen_name+"+"+contacts[i].cid
}
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+"';iconSource:'"+contacts[i].profile_image+"'; onTriggered: bodyField.insert(0,' @"+contacts[i].screen_name+"+"+contacts[i].cid+" ')}"
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+"';iconSource:'"+contacts[i].profile_image+"'; onTriggered: bodyField.insert(0,' @"+contacts[i].screen_name+" ')}"
}}
var menuString="import QtQuick.Controls 1.4; Menu {"+contactitems+"}";
var contactlistObject=Qt.createQmlObject(menuString,messageSend,"contactmenuOutput")
@ -171,7 +179,6 @@ Flickable{
text: "\uf118"
onClicked: {
var smileyarray=Smileyjs.smileys
//print(JSON.stringify(smileyarray[0]))
var component = Qt.createComponent("qrc:/qml/newsqml/SmileyDialog.qml");
var smileydialog = component.createObject(messageColumn)
}}

View file

@ -33,13 +33,16 @@ Item {
}
Timer {id:replytimer; interval: 1000; running: false; repeat: false
onTriggered: {if(newstab.newstabstatus=="Conversation"){
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)} else{
onTriggered: {
if(newstab.newstabstatus=="Conversation"){
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
else{
var onlynew=true;
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){
root.contactLoadType="news";
root.news=rns;root.newContacts=rnc;root.currentContact=0})
}}
}
}
}
@ -53,7 +56,7 @@ Item {
}
function showConversation(conversationIndex,newsitemobject){
newsBusy.running=true;
//newsBusy.running=true;
root.contactLoadType="conversation";
newsStack.conversationIndex= conversationIndex;
if(newsitemobject.messagetype==0){
@ -65,6 +68,13 @@ Item {
})}
}
function showContact(contact){
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
if (component.status== Component.Ready){
var contactDetails = component.createObject(newstab,{"contact": contact})
}
}
function onFriendsMessages(friend){
newstab.newstabstatus="Contact"
Newsjs.newsfromdb(db,root.login.username, function(dbnews){showNews(dbnews)},friend)
@ -75,6 +85,8 @@ Item {
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}});
}
StackView{
id: newsStack
anchors.fill:parent
@ -100,7 +112,6 @@ Item {
BlueButton {
id: newMessageButton
width:10*mm
text: "\uf040"
onClicked: {
var groups=[];
@ -115,7 +126,6 @@ Item {
}
BlueButton {
id: quitButton
width:10*mm
text: "\uf08b"
onClicked: {Service.cleanNews(root.db,function(){Qt.quit() })}
}
@ -127,6 +137,7 @@ Item {
newstab.newstabstatus=login.newsViewType;
root.contactLoadType="news";
var onlynew=true;
//print("newstab "+ JSON.stringify(contactlist));
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(ns,nc){
root.news=ns;root.newContacts=nc;root.currentContact=0;
if (ns.length==0){// update last 20 existing news for changes and likes
@ -153,29 +164,29 @@ Item {
}
MouseArea{anchors.fill:parent
onClicked:{
var currentTime= new Date();
if(newstab.newstabstatus=="Timeline"){
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
var currentTime= new Date();
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
print("Lastnews ID "+lastnews_id+Qt.atob(newsModel.get(newsModel.count-1).newsitemobject.statusnet_html))
if(newstab.newstabstatus=="Timeline"){
Newsjs.newsfromdb(root.db,root.login.username, function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
newsWorker.sendMessage(msg);
},false,lastnews_id)}
if(newstab.newstabstatus=="Conversations"){
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
newsWorker.sendMessage(msg);
},false,lastnews_id)}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(root.db,root.login.username, function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
newsWorker.sendMessage(msg);
},lastnews_id)}
else if(newstab.newstabstatus=="Contact"){
Newsjs.newsfromdb(root.db,root.login.username, function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
newsWorker.sendMessage(msg);
},newsModel.get(newsModel.count-1).newsitemobject.uid,newsModel.get(newsModel.count-1).newsitemobject.created_at)}
}}
}
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
newsWorker.sendMessage(msg);
},lastnews_id)}
else if(newstab.newstabstatus=="Contact"){
Newsjs.newsfromdb(root.db,root.login.username, function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
newsWorker.sendMessage(msg);
},newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)}
}
}
}
}
ListView {
id: newsView
anchors.fill: parent
@ -187,8 +198,8 @@ Item {
footer: footerComponent
model: newsModel
delegate: Newsitem{}
//onContentYChanged:{if(contentY<-15*mm&&contentY>(-15*mm-1)){print("refreshing");
onDragEnded:{if(contentY<-8*mm){//print("refreshing");
//onContentYChanged:{if(contentY<-8*mm&&contentY>(-8*mm-1)){print("refreshing");
onDragEnded:{if(contentY<-5*mm){//print("refreshing");
newsBusy.running=true;
newstab.newstabstatus=login.newsViewType;
root.contactLoadType="news";

View file

@ -10,21 +10,8 @@ Item {
width: parent.width
height:toprow.height+friendicaActivities.height+controlrow.height+1//Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm)
Connections{
target:newstab
onConversationChanged:{
newsBusy.running=false;
if(index==newsStack.conversationIndex){
if(newstab.conversation.length>0){
var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml");
var conversation = component.createObject(friendicaActivities,{"news":newstab.conversation});
}
else{conversationsymbol.color="grey"}
}
}
}
property string attending: ""
property int itemindex: index
onAttendingChanged: {attendLabel.visible=true;
attendLabel.text= qsTr("attending: ")+ qsTr(attending)}
@ -54,11 +41,7 @@ Item {
height: 7*mm
MouseArea{
anchors.fill: parent
onClicked:{
try{root.currentIndex=1;
friendstab.active=true;
root.contactdetailsSignal(newsitemobject.user)} catch (e){Helperjs.showMessage("Error",e,root)}
}
onClicked:{showContact(newsitemobject.user)}
}
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
@ -68,13 +51,12 @@ Item {
width:parent.width
font.pixelSize: 1.5*mm
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: Qt.atob(newsitemobject.user.name)//+forumname
text: Qt.atob(newsitemobject.user.name)+forumname
}
}
Column {
id:newscolumn
width: newsitem.width-8*mm
//anchors.left: authorcolumn.right
Flow{
id:topFlow
@ -114,7 +96,13 @@ Item {
text: try {(newsitemobject.newscount-1)+qsTr(" comments") }catch(e){" "}
MouseArea{
anchors.fill:parent
onClicked: {conversationsymbol.color="black";showConversation(index,newsitemobject)}
onClicked: {
conversationsymbol.color="black";
newsView.contentY+=newsitem.height;
var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml");
var conversationItem = component.createObject(friendicaActivities,{"news":newsitemobject.chatArray});
showConversation(index,newsitemobject);
}
}
}
}
@ -150,6 +138,7 @@ Item {
spacing:mm
Label{color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
text: friendica_activities.likeText
MouseArea{
@ -158,6 +147,7 @@ Item {
}
}
Label{color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
text: friendica_activities.dislikeText
MouseArea{
@ -166,6 +156,7 @@ Item {
}
}
Label{color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
text: friendica_activities.attendyesText
MouseArea{
@ -173,6 +164,7 @@ Item {
onClicked: { showActivityContacts(newsitemobject.attendyes)}
}}
Label{color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
text: friendica_activities.attendnoText
MouseArea{
@ -181,6 +173,7 @@ Item {
}
}
Label{color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
text: friendica_activities.attendmaybeText
MouseArea{
@ -190,7 +183,6 @@ Item {
}
Label{
id:attendLabel
//visible: false
color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
@ -203,28 +195,21 @@ Item {
CheckBox{
id:likeCheckbox
//height:3*mm
width:8*mm
width:10*mm
visible: (newsitemobject.messagetype==0)? true:false
checked:(friendica_activities.self.liked==1)?true:false
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 6*mm
implicitHeight: 3*mm
color:"white"
}
indicator: Rectangle{
implicitWidth: 3*mm
implicitHeight:3*mm
color:control.checked?"yellow":"white"
x: 4*mm
Text{
anchors.centerIn: parent
font.pixelSize: 2.5*mm
font.family:fontAwesome.name
color:control.checked?"black": "grey"
text:"\uf118"
}}
indicator: Rectangle{
implicitWidth: 10*mm
implicitHeight:3*mm
Text{
anchors.centerIn: parent
font.pixelSize: 2.5*mm
font.family:fontAwesome.name
color:control.checked?"black": "grey"
text:"\uf118"
}
}
}
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 }
@ -232,73 +217,43 @@ Item {
}
CheckBox{
id: dislikeCheckbox
//height:3*mm
width:8*mm
width:10*mm
visible: (newsitemobject.messagetype==0)? true:false
checked: (friendica_activities.self.disliked==1)?true:false
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 6*mm
implicitHeight:3*mm
color:"white"
}
indicator: Rectangle{
implicitWidth: 3*mm
implicitWidth: 10*mm
implicitHeight:3*mm
color:control.checked?"yellow":"white"
x:4*mm
Text{
anchors.centerIn: parent
font.pixelSize: 2.5*mm
font.family:fontAwesome.name
color:control.checked?"black": "grey"
text: "\uf119"
}}
}
}
}
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}}
}
// Rectangle{
// width: 8*mm
// height: 3*mm
// color:"transparent"
// Text{
// id:trashsymbol
// color: "grey"
// anchors.centerIn: parent
// font.pixelSize: 2*mm
// font.bold: true
// text: "\uf1f8"
// }
// MouseArea{
// anchors.fill:parent
// onClicked: {
// Newsjs.deleteNews(root.login,root.db,newsitemobject.status_id,newsitemobject.messagetype,root,function(reply){
// newsModel.remove(index)})
// }}
// }
CheckBox {
id:favoritedCheckbox
visible:(newsitemobject.messagetype==0)
width: 8*mm
width: 10*mm
style: CheckBoxStyle {
background: Rectangle {
implicitWidth: 6*mm
implicitHeight:3*mm
color:"transparent"
indicator:Rectangle{
x:4*mm
width: 3*mm
implicitHeight:4*mm
Text{
color: control.checked?"black":"grey"
font.pixelSize: 2.5*mm
text:"\uf005"
}
}
indicator:Rectangle{
x:3*mm
width: 3*mm
implicitHeight:3*mm
Text{
color: control.checked?"black":"grey"
font.pixelSize: 2.5*mm
text:"\uf005"
}}
}
}
checked:(newsitemobject.favorited>0)
onClicked:{
if(favoritedCheckbox.checkedState==Qt.Checked){
@ -308,8 +263,8 @@ Item {
}
}
Rectangle{
width: 8*mm
height: 3*mm
width: 10*mm
height: 4*mm
color:"transparent"
Text{
id:newsmenusymbol
@ -324,8 +279,8 @@ Item {
onClicked: {newsmenu.popup()}}
}
Rectangle{
width: 8*mm
height: 3*mm
width: 10*mm
height: 4*mm
visible:newstab.newstabstatus!="Conversation"
color:"transparent"
Text{
@ -340,7 +295,11 @@ Item {
anchors.fill:parent
onClicked:{
conversationsymbol.color="black";
showConversation(index,newsitemobject)
//Newsjs.conversationfromdb(db,login.username,newsitemobject.conversation_id,function(conversation){
var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml");
// var conversationItem = component.createObject(friendicaActivities,{"news":newsitemobject.chatArray});
var conversationItem = component.createObject(friendicaActivities); showConversation(index,newsitemobject)
}
}
}
@ -367,12 +326,19 @@ Item {
text: qsTr("Repost")
onTriggered: {
Newsjs.retweetNews(root.login,db,newsitemobject.status_id,root,function(reply){
print(reply)})
Helperjs.showMessage("Repost",qsTr("Success!"),root)
})
}
}
MenuItem {
text: qsTr("Conversation")
onTriggered: showConversation(index,newsitemobject)
onTriggered: {
conversationsymbol.color="black";
//Newsjs.conversationfromdb(db,login.username,newsitemobject.conversation_id,function(conversation){
var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml");
var conversationItem = component.createObject(friendicaActivities,{"news":newsitemobject.chatArray});
showConversation(index,newsitemobject)
}
}
Menu{
@ -398,8 +364,15 @@ Item {
text: qsTr("Delete")
onTriggered: {
Newsjs.deleteNews(root.login,root.db,newsitemobject.status_id,newsitemobject.messagetype,root,function(reply){
newsModel.remove(index)})
// newsModel.remove(index)
var msg = {'deleteId': index, 'model': newsModel};
newsWorker.sendMessage(msg);
})
}
}
//MenuItem{
// text:qsTr("Show on website")
// onTriggered:Qt.openUrlExternally(login.server+"/display/"+newsitemobject
//}
}
}}

View file

@ -173,7 +173,7 @@ Rectangle{
Helperjs.readData(db,"contacts",login.username,function(contacts){
for (var name in contacts){
var contactstatus="neutral";
if (contact_allow.indexOf(contacts[name].cid)>-1){contactstatus="positive";print(contacts[name].cid+" pos")}
if (contact_allow.indexOf(contacts[name].cid)>-1){contactstatus="positive"}
else if (contact_deny.indexOf(contacts[name].cid)>-1){contactstatus="negative"}
contactModel.append({"contact":contacts[name],"contactstatus":contactstatus})
}},"isFriend",1);

View file

@ -0,0 +1,244 @@
import QtQuick 2.7
import QtQuick.Controls 1.4
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
Rectangle{
id:imageDialog
//property var attachImageURLs: []
property var contacts: []
property var groups: []
property var contact_allow:login.permissions[0]
property var contact_deny:login.permissions[1]
property var group_allow:login.permissions[2]
property var group_deny:login.permissions[3]
property int imageNo: 0
function uploadSelectedImage(inumber){
xhr.url= login.server + "/api/friendica/photo/create.json";
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.clearParams();
xhr.setParam("desc",imageUploadModel.get(inumber).description);
xhr.setParam("album", album.currentText);
xhr.setParam("contact_allow","27");
if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))};
if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))};
//if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))};
if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))};
xhr.setImageFileParam("media", imageUploadModel.get(inumber).imageUrl );
xhr.post();
}
z:2
border.color: "grey"
width: parent.width-4*mm
height:parent.height-12*mm
x:2*mm
y:10*mm
property string directory: ""
ImagePicker {
id: imagePicker;
multiple : true
onReady: {//var urlstring=decodeURIComponent(imagePicker.imageUrl);
//var fileurl="file://"+urlstring.substring(5);
for (var n in imagePicker.imageUrls){
imageUploadModel.append({"imageUrl":imagePicker.imageUrls[n].toString(),"description":""})
}
}
}
Connections{
target:xhr
onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}}
onSuccess:{
imageNo=imageNo+1;
if(imageNo<imageUploadModel.count){
uploadSelectedImage(imageNo);
}else{
Service.requestList(root.login,root.db, fotostab,function(obj){
fotorectangle.newimages=obj;
imageDialog.destroy()
})
}
}
}
Row{
id:buttonRow
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
spacing:mm
// BlueButton{
// id:permButton
// text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"
// onClicked: {
// var component = Qt.createComponent("qrc:/qml/genericqml/PermissionDialog.qml");
// var permissions = component.createObject(imageDialog,{"x":mm,"y":40*mm});
// }
// }
BlueButton{
id:closeButton
text: "\uf057"
onClicked:{imageDialog.destroy()}
}
}
Text {
text: qsTr("Album")
x: 4*mm; y: 10*mm
}
Text {
text: qsTr("Image")
x: 4*mm; y: 17*mm
}
Text {
text: qsTr("Description")
x: 4*mm; y: 33*mm
}
ListView{
id: imageUploadView
x:23*mm
y:17*mm
width: imageDialog.width-25*mm
height: 25*mm
model: imageUploadModel
delegate: imageDelegate
footer: imageFooter
clip:true
orientation: ListView.Horizontal
spacing: mm
}
ListModel{
id: imageUploadModel
}
Component{
id: imageDelegate
Rectangle{
width:Math.max(20*mm,descriptionInput.contentWidth)
height:20*mm
Image{
id: uploadImage
width: 20*mm
height: 14*mm
fillMode: Image.PreserveAspectFit
source:imageUrl
MouseArea{
anchors.fill: parent
onClicked:{
imageUploadModel.remove(index)
// attachImageURLs.splice(attachImageURLs.indexOf(imageUrl,1))
// attachImage(imageUrl)
}
}
}
Rectangle{
color: "light grey"
border.color: "grey"
x: mm; y: 15*mm; width:Math.max(20*mm, descriptionInput.contentWidth);
height: 5*mm;
TextInput {
id: descriptionInput
anchors.fill: parent
selectByMouse: true
text:description
onTextChanged: imageUploadModel.set(index,{"description":descriptionInput.text});
}
}
}
}
Component{
id: imageFooter
Image{
id: footerImage
width: 15*mm
height: 15*mm
fillMode: Image.PreserveAspectFit
source:"qrc:/images/addImage.png"
MouseArea{
anchors.fill: parent
onClicked:{
//var defaultDirectory="file://"+osSettings.attachImageDir;
//var component = Qt.createComponent("qrc:/qml/genericqml/ImageDialog.qml");
//var imagedialog = component.createObject(imageDialog,{"directory": defaultDirectory, "multiSelection": true})
// filesystem.search
imagePicker.pickImage()
}
}
}
}
ComboBox{
id: album
x: 23*mm
y: 10*mm
width: root.width/2;
height: 5*mm;
editable:true
model: albumModel
onAccepted: {
if (find(currentText) === -1) {
albumModel.append({text: editText})
currentIndex = find(editText)
}
}
}
ListModel{id:albumModel}
BlueButton{
id:uploadButton
x:4*mm; y:40*mm
text: qsTr("Upload")
onClicked:{
//imageBusy.running=true;
if(album.currentText==""){Helperjs.showMessage(qsTr("Error"),qsTr(" No album name given"), imageDialog)}
else{newimageProgress.visible=true;
if (imageUploadModel.count>0){
uploadSelectedImage(0)
}}
}
}
ProgressBar{
id: newimageProgress
width: 15*mm
height: buttonRow.height
anchors.top: parent.top
anchors.right:buttonRow.left
anchors.rightMargin:mm
visible: false
value: imageNo/imageUploadModel.count
}
Component.onCompleted:{
albumModel.append({"text":""});
try{Helperjs.readField("album",db,"imageData",login.username,function(storedAlbums){
//print(JSON.stringify(storedAlbums))
for (var n in storedAlbums){
albumModel.append({"text":storedAlbums[n]})}
})}
catch (e){print(e)}
}
// BusyIndicator{
// id: imageBusy
// anchors.horizontalCenter: imageUploadView.horizontalCenter
// anchors.top:imageUploadView.top
// anchors.topMargin: 2*mm
// width:10*mm
// height: 10*mm
// running:false
// }
}

View file

@ -48,10 +48,16 @@ Package {
}
MouseArea {
width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage
onClicked: {
onPressAndHold:{
var menuString="import QtQuick.Controls 1.4; Menu {MenuItem{text:qsTr('Delete on client and server'); onTriggered: {deletepics('image','"+imageLocation+"');photoModel.remove(index)}}}";
var imagemenuObject=Qt.createQmlObject(menuString,photoWrapper,"imagemenuOutput")
imagemenuObject.popup()
}
onClicked: {
if (albumWrapper.state == 'inGrid') {
gridItem.GridView.view.currentIndex = index;
albumWrapper.state = 'fullscreen'
albumWrapper.state = 'fullscreen';
listItem.ListView.view.currentIndex=index
} else {
gridItem.GridView.view.currentIndex = index;
albumWrapper.state = 'inGrid'

View file

@ -1,21 +0,0 @@
import QtQuick 2.0
import "qrc:/js/helper.js" as Helperjs
Image {
id:photoPlaceholder
property string imageName:"x.jpg"
property string downloadtype:""
fillMode: Image.PreserveAspectFit
onStatusChanged: {
if (photoPlaceholder.status == Image.Ready) {
//print("Source: "+source+"Photo width"+width+" height"+height+" Ratio "+ fillMode);
var saveprocess=photoPlaceholder.grabToImage(function(result){
var saveresult=result.saveToFile(imageName.toString());
if (saveresult){
if ((downloadtype=="picture")&&(newImages.length>0)){
photoPlaceholder.destroy();
currentImageNo=currentImageNo+1
}
S }});
}}}

View file

@ -47,6 +47,12 @@ Rectangle {
onError:{if(data=="picture"){print("Error"+data);
currentimageno=currentimageno+1}}
}
// Connections{
// target:filesystem
// onError:{print("Error deleting");
// }
// onSuccess:print("Success deleting");
// }
function showFotos(friend){
if(friend=="backButton"){
@ -76,28 +82,46 @@ Rectangle {
}}
}
function deletepics(type,url ,imageId){
Service.deleteImage(db,login,type, url,root,function(){//showFotos("")
})
}
ProgressBar{
id: newImagesProgress
width: 15*mm
height: updatePhotolist.height
anchors.top: parent.top
anchors.right:updatePhotolist.left
anchors.right:uploadPhoto.left
anchors.rightMargin:mm
visible: false
value: currentimageno/newimages.length
}
//ImageUploadDialog{}
BlueButton{
id: uploadPhoto
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:updatePhotolist.left
anchors.rightMargin:mm
text:"\uf0ee"
onClicked: {
var component = Qt.createComponent("qrc:/qml/photoqml/ImageUploadDialog.qml");
var imageUpload = component.createObject(fotorectangle);
}}
BlueButton{
id: updatePhotolist
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:phototabstatusButton.left
anchors.rightMargin:mm
text:"\uf021"
text:"\uf0ed"
onClicked: {
Service.requestList(root.login,root.db, fotostab,function(obj){
newimages=obj;print("newimages"+JSON.stringify(obj))
})}}
Service.requestList(root.login,root.db, fotostab,function(obj){newimages=obj})
}
}
BlueButton{
id: phototabstatusButton

View file

@ -83,7 +83,8 @@ Package {
Helperjs.readData(db,"imageData",root.login.username,function(obj){
if (obj) {
for (var k=0;k<obj.length;k++){
photoModel.append({"imageLocation": obj[k].location+obj[k].filename,"photoDescription":obj[k].filename,"photoLink":obj[k].location+obj[k].filename})
if(obj[k].desc!=""&&obj[k].desc!="null"){var name=obj[k].desc}else{var name=obj[k].filename}
photoModel.append({"imageLocation": obj[k].location+obj[k].filename,"photoDescription":name,"photoLink":obj[k].location+obj[k].filename})
}
}
},"album",albumname)}
@ -91,6 +92,11 @@ Package {
MouseArea {
anchors.fill: parent
onPressAndHold:{
var menuString="import QtQuick.Controls 1.4; Menu {MenuItem{text:qsTr('Delete on client and server'); onTriggered: {deletepics('album',albumname);photogroupModel.remove(index)}}}";
var albummenuObject=Qt.createQmlObject(menuString,albumWrapper,"albummenuOutput")
albummenuObject.popup()
}
onClicked: albumWrapper.state = 'inGrid'
}