Friendiqa v0.3.1

This commit is contained in:
LubuWest 2018-07-20 21:15:54 +02:00
parent 6f9aad9099
commit 2afa7cbe6b
29 changed files with 490 additions and 465 deletions

View File

@ -74,3 +74,9 @@
* Public timeline
* Timeline for selected group
* Small redesign of SendMessage page
## v0.3.1 ##
* By popular demand: Conversations open in a new stack, like in Twidere
* Conversations open after (long) press on news, like in Twidere
* Image attachments are shown below text and can be enlarged, like in Twidere (solves issue #8)
* New messages are html, line breaks work (solves issue #7)

View File

@ -21,6 +21,7 @@ Currently supported:
* Shows Posts from friends, selected group, favorited messages, public timeline, Direct Messages and notifications
* Search button for news
* Click on hashtag in newsitem starts search for news with that word
* Click on image shows image fullscreen
* Open links in external browser
* Click on contact photo for contact details
* Click on like text for additional contact info
@ -39,7 +40,7 @@ ToDo:
* Videos and other binary data as attachment (sending and receiving)
* More than one attachment (currently not supported in API)
* Rich text editing in Send Dialog
* Rich text editing in Send Dialog (currently not possible in QML)
* Attachments for Direct messages (currently not supported in API)

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.3" android:versionCode="7" android:installLocation="auto">
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.3.1" android:versionCode="8" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:vmSafeMode="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Friendiqa" android:icon="@drawable/friendiqa" android:logo="@drawable/friendiqa" android:theme="@android:style/Theme.Holo.Light">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="androidnative.friendiqa.FriendiqaActivity" android:label="Friendiqa" android:screenOrientation="unspecified" android:launchMode="singleInstance" android:taskAffinity="">
<intent-filter>
@ -7,15 +7,15 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<action android:name="android.intent.action.SEND_MULTIPLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
<action android:name="android.intent.action.SEND"/>
<action android:name="android.intent.action.SEND_MULTIPLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/*"/>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/*"/>
</intent-filter>
<meta-data android:name="android.app.lib_name" android:value="friendiqa"/>
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
@ -50,7 +50,7 @@
<!-- Background running -->
</activity>
</application>
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="21"/>
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.

View File

@ -220,6 +220,6 @@
<file>qml/genericqml/Search.qml</file>
<file>qml/newsqml/Hashtag.qml</file>
<file>qml/genericqml/IntentReceiver.qml</file>
<file>qml/newsqml/NewsImage.qml</file>
</qresource>
</RCC>

View File

@ -41,7 +41,7 @@
#include "AndroidNative/mediascannerconnection.h"
#ifdef Q_OS_ANDROID
#ifdef Q_OS_ANDROID
#include <QtAndroidExtras/QAndroidJniObject>
#include <QtAndroidExtras/QAndroidJniEnvironment>
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {

View File

@ -151,8 +151,8 @@ var where = " AND "+ filter +" = '" + filtervalue+"'";
});
}
function showMessage(header,message,rootwindow){print("message: "+message);
var cleanmessage=message.replace(/"/g,"-"); //print(cleanmessage);
function showMessage(header,message,rootwindow){
var cleanmessage=message.replace(/"/g,"-");
if(cleanmessage.length>200){cleanmessage=cleanmessage.slice(0,200)+'...'}
var messageString='import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:"'+header+'";standardButtons: StandardButton.Ok; text:" '+cleanmessage+'"}';
var messageObject=Qt.createQmlObject(messageString,rootwindow,"messageOutput");

View File

@ -326,7 +326,7 @@ function favorite(login,favorite,newsid,rootwindow){
// toggle favorites
if(favorite){ Helperjs.friendicaPostRequest(login,"/api/favorites/create?id="+newsid,"","POST", rootwindow,function (obj){
})}
else {Helperjs.friendicaPostRequest(login,"/api/favorites/destroy?id="+newsid, "POST",rootwindow,function (obj){
else {Helperjs.friendicaPostRequest(login,"/api/favorites/destroy?id="+newsid,"","POST",rootwindow,function (obj){
})}
}

View File

@ -82,15 +82,27 @@ else{
if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1}
}}} catch(e){print("Activities "+e+ " "+JSON.stringify(newsitemobject.friendica_activities))}
var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self}
var attachmentList=[];try{if(newsitemobject.attachments){
var attachmentList=[];
try{if(newsitemobject.attachments){
var attachArray=newsitemobject.attachments;
for (var image in attachArray){if(attachArray[image].mimetype=="image/gif"){
attachmentList.push(attachArray[image])
for (var image in attachArray){
var attachhelper={mimetype:attachArray[image].mimetype}
var attachhelperstring=Qt.btoa(attachArray[image].url)
var helperstringposition=newsitemobject.text.indexOf(attachhelperstring);
if (helperstringposition>-1){attachhelper.url=newsitemobject.text.substring(newsitemobject.text.lastIndexOf("http",helperstringposition),helperstringposition+attachhelperstring.length);
if (attachArray[image].mimetype=="image/jpeg"){attachhelper.url=attachhelper.url+".jpg"}
else if (attachArray[image].mimetype=="image/gif"){attachhelper.url=attachhelper.url+".gif"}
else if (attachArray[image].mimetype=="image/png"){attachhelper.url=attachhelper.url+".png"}
}
else {attachhelper.url=attachArray[image].url}
attachmentList.push(attachhelper)
newsitemobject.text=newsitemobject.text.replace(attachhelper.url,"")
newsitemobject.text=newsitemobject.text.replace(attachhelper.url.substring(0,attachhelper.url.length-4)+".jpeg","")
newsitemobject.text=newsitemobject.text.replace(attachhelper.url.substring(0,attachhelper.url.length-4),"")
}
}}catch(e){print("attachment "+e)}
}}catch(e){print("attachment "+e)}
newsitemobject.attachmentList=attachmentList;
var seconds=(msg.currentTime-newsitemobject.created_at)/1000;
var timestring="";
if (seconds<60) {timestring=seconds+" "+qsTr("seconds") +" "+qsTr("ago");}

View File

@ -39,6 +39,7 @@ function initDatabase(database) { // initialize the database object
var db =Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
print('initDatabase()'+database[0]+database[1]+database[2]+database[3])
db.transaction( function(tx) {
//var version=tx.executeSql('PRAGMA user_version');print(JSON.stringify(version.rows.item(0)))
tx.executeSql('CREATE TABLE IF NOT EXISTS imageData(username TEXT,id INT, created TEXT,edited TEXT, title TEXT, desc TEXT, album TEXT,filename TEXT, type TEXT, height INT, width INT, profile INT, link TEXT,location TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS config(server TEXT, username TEXT, password TEXT, imagestore TEXT, maxnews INT, timerInterval INT, newsViewType TEXT,isActive INT, permissions TEXT,maxContactAge INT,APIVersion TEXT,layout TEXT, addons TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS news(username TEXT, messagetype INT, text TEXT, created_at INT, in_reply_to_status_id INT, source TEXT, status_id INT, in_reply_to_user_id INT, geo TEXT,favorited TEXT, uid INT, statusnet_html TEXT, statusnet_conversation_id TEXT,friendica_activities TEXT, friendica_activities_self TEXT, attachments TEXT, friendica_owner TEXT)');
@ -356,9 +357,7 @@ function updateContactInDB(login,database,isFriend,contact){// for newstab and f
}
function processNews(api,data){
try{var newslist=JSON.parse(data);
} catch(e){
Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root)};
try{var newslist=JSON.parse(data)} catch(e){newsBusy.running=false;};
if (typeof(newslist)=='undefined'){
Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root)
}
@ -462,6 +461,7 @@ function processNews(api,data){
var newstabarray=["Conversations","Favorites","Timeline","DirectMessage"];
if (newstabarray.indexOf(newstab.newstabstatus)>-1){contacttimer.start()}
}
}

View File

@ -43,10 +43,10 @@ Rectangle{
textFormat: Text.RichText
width: parent.width
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: "<b>Friendiqa v0.3 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
text: "<b>Friendiqa v0.3.1 </b><br>Licensed under GPL 3 with the exception of OpenSSL <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/Friendiqa</a><br>"+
"C++ code by <a href='https://kirgroup.com/profile/fabrixxm'>Fabio</a><br>"+
"Sourcecode: <a href='https://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+
"Most of 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>"+

View File

@ -40,6 +40,7 @@ Rectangle{
// border.width:1
radius: mm
property alias text: mainText.text
property alias font: mainText.font
signal clicked
state:""

View File

@ -37,20 +37,23 @@ import "qrc:/qml/genericqml"
Rectangle {
id:conversationList
// width:root.width-5*mm
// height:root.height-12*mm
//property var news
y:1
z:2
// y:1
// z:2
color: "white"
border.color: "grey"
width:root.width-5*mm
height: conversationView.height+10*mm
// border.color: "grey"
// width:root.width-5*mm
// height: conversationView.height+10*mm
ListView {
id: conversationView
x:3*mm
y:8*mm
width: conversationList.width-4*mm
height: contentHeight
//height: contentHeight
height:conversationList.height-10*mm
clip: true
spacing: 0
footer: footerReply
@ -70,17 +73,19 @@ Rectangle {
Connections{
target:newstab
onConversationChanged:{
if(newsitem.itemindex==newsStack.conversationIndex){
//if(newsitem.itemindex==newsStack.conversationIndex){
if(newstab.conversation.length==0){
newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
conversationList.destroy(); conversationsymbol.color="grey"
newsStack.pop()
//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"}
}
//conversationsymbol.color="grey"
}
//}
}
}
@ -165,9 +170,10 @@ Rectangle {
anchors.rightMargin: 1*mm
text: "\uf057"
onClicked: {
newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
conversationList.destroy();
conversationsymbol.color="grey"
//newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
newsStack.pop()
//conversationList.destroy();
//conversationsymbol.color="grey"
}
}

View File

@ -32,8 +32,8 @@
// message.qml
// message with buttons
import QtQuick 2.0
import QtQuick.Controls 1.3
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4
//import QtQuick.Dialogs 1.2
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/smiley.js" as Smileyjs
import "qrc:/qml/genericqml"
@ -41,8 +41,8 @@ import "qrc:/qml/genericqml"
Rectangle{
color:"white"
width:root.width-5*mm
height:root.height-12*mm
// width:root.width-5*mm
// height:root.height-12*mm
//anchors.fill: parent
property string parentId: ""
property string reply_to_user:""
@ -69,7 +69,7 @@ Rectangle{
xhr.setApi("/api/statuses/update");
xhr.clearParams();
xhr.setParam("source", "Friendiqa");
xhr.setParam("status", status);
xhr.setParam("htmlstatus", status);
if (parentId!="") {xhr.setParam("in_reply_to_status_id", parentId)};
if (title!=="") {xhr.setParam("title", title)};
if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))};
@ -94,14 +94,11 @@ Rectangle{
}
Flickable{
anchors.fill: parent
contentHeight: messageColumn.height
boundsBehavior: Flickable.StopAtBounds
id:messageSend
Column {
anchors.fill: parent
contentHeight: messageColumn.height
boundsBehavior: Flickable.StopAtBounds
id:messageSend
Column {
id:messageColumn
spacing: 0.5*mm
width: parent.width
@ -124,13 +121,15 @@ Rectangle{
font.pixelSize: 3*mm
wrapMode: Text.Wrap
selectByMouse: true
textFormat: TextEdit.PlainText
textFormat: TextEdit.RichText //TextEdit.PlainText
onLinkActivated:{Qt.openUrlExternally(link)}
}
}
Row{
spacing: 2
width: parent.width
CheckBox{
id:dmCheckbox
text:"DM"
@ -142,38 +141,38 @@ Rectangle{
}
}
BlueButton{
text:"\uf0c1"
onClicked: {
if(bodyField.selectedText==""){Helperjs.showMessage("Error","No text selected",messageSend)}
else{urlTextEdit.text="";
urlRectangle.visible=true}}
}
Rectangle{
id:urlRectangle
BlueButton{
text:"\uf0c1"
onClicked: {
if(bodyField.selectedText==""){Helperjs.showMessage("Error","No text selected",messageSend)}
else{urlTextEdit.text="";
urlRectangle.visible=true}}
}
}
Rectangle{
id:urlRectangle
height: 7*mm //parent.height
width:parent.width-2*mm
visible:false
TextField{
id:urlTextEdit
width:parent.width-7*mm
height:parent.height
width:37*mm
visible:false
TextField{
id:urlTextEdit
width:30*mm
height:parent.height
}
BlueButton{
anchors.left:urlTextEdit.right
anchors.leftMargin:mm
text:"\u2713"
onClicked: {if(urlTextEdit.text!=""){
var start = bodyField.selectionStart;
var text=bodyField.selectedText
text = "[url="+urlTextEdit.text+"]" + text + "[/url]";
bodyField.remove(start,bodyField.selectionEnd);
bodyField.insert(start,text);}
urlRectangle.visible=false}
}
}
BlueButton{
anchors.left:urlTextEdit.right
anchors.leftMargin:mm
text:"\u2713"
onClicked: {if(urlTextEdit.text!=""){
var start = bodyField.selectionStart;
var text=bodyField.selectedText
if(text.lastIndexOf(".jpg")>-1 || text.lastIndexOf(".jpeg")>-1 || text.lastIndexOf(".png")>-1){text="<img src="+text+">"}
text = "[url="+urlTextEdit.text+"]" + text + "[/url]";
bodyField.remove(start,bodyField.selectionEnd);
bodyField.insert(start,text);}
urlRectangle.visible=false}
}
}
Row{
spacing:2
BlueButton{id:permButton
@ -208,7 +207,7 @@ Rectangle{
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+"'; onTriggered: bodyField.insert(0,' @"+contacts[i].screen_name+" ')}"
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+"'; onTriggered: bodyField.insert("+bodyField.cursorPosition+",' @"+contacts[i].screen_name+" ')}"
}}
var menuString="import QtQuick.Controls 1.4; Menu {"+contactitems+"}";
var contactlistObject=Qt.createQmlObject(menuString,messageColumn,"contactmenuOutput")
@ -234,10 +233,11 @@ Rectangle{
text: "\uf1d9"
onClicked: {
var title=titleField.text.replace("\"","\'");
var body=bodyField.getText(0,bodyField.length);
var body=bodyField.getFormattedText(0,bodyField.length);
var dmbody=bodyField.getText(0,bodyField.length);
if (directmessage==0){
statusUpdate(title,body,messageSend.parentId,attachImageURLs)}
else {dmUpdate(title,body,"",messageSend.reply_to_user) }
statusUpdate(title,body,parentId,attachImageURLs)}
else {dmUpdate(title,dmbody,parentId,reply_to_user) }
newstab.newstabstatus=login.newsViewType; newsStack.pop(null)
}
}

View File

@ -0,0 +1,50 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
AnimatedImage {id:gif;
width:newscolumn.width;
property string mimetype:""
fillMode: Image.PreserveAspectFit;
onStatusChanged: playing = (status == AnimatedImage.Ready);
MouseArea {anchors.fill:parent;
onClicked:{
if (mimetype!="image/gif"){
var attachcomponent = Qt.createQmlObject('import QtQuick 2.0; '+
'Rectangle{id:recfullscreen;color:"white";width:root.width;height:root.height;'+
'MouseArea {anchors.fill:parent;onClicked:{recfullscreen.destroy()}}'+
'AnimatedImage {id:giffullscreen;source: "'+gif.source+
'";anchors.centerIn:parent; width:root.width;fillMode: Image.PreserveAspectFit; onStatusChanged: playing = (status == AnimatedImage.Ready);'+
'}}',root,"Attachmentlarge")
}
}
}
}

View File

@ -30,8 +30,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls 2.3
//import QtQuick.Controls.Styles 2.3
import QtQuick.Dialogs 1.3
import "qrc:/qml/genericqml"
import "qrc:/js/news.js" as Newsjs
@ -44,16 +44,6 @@ Item {
target:newstab
onNewstabstatusChanged:{
newstabstatusButton.text= qsTr(newstab.newstabstatus)
// switch(newstab.newstabstatus){
// case "Timeline": newstabstatusCombo.currentIndex=1; break;
// case "Conversations":newstabstatusCombo.currentIndex=2; break;
// case "Favorites":newstabstatusCombo.currentIndex=3; break;
// case "Network":newstabstatusCombo.currentIndex=4; break;
// case "Direct Messages":newstabstatusCombo.currentIndex=5; break;
// case "Notifications":newstabstatusCombo.currentIndex=6; break;
// case "Search":newstabstatusCombo.currentIndex=7; break;
// case "Groupnews":newstabstatusCombo.currentIndex=8; break;
// }
}
}
@ -132,7 +122,7 @@ Item {
}
}
function search(term){print("Search "+term)
function search(term){//print("Search "+term)
if (term!=""){
newstab.newstabstatus="Search";
newsBusy.running=true;
@ -161,19 +151,21 @@ Item {
function onDirectMessage(friend){
newstab.newstabstatus="SendMessage"
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}});
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": friend,"directmessage":1,"login":root.login});
}
function sendUrls(urls){
if((urls.length==1)&&(newsStack.depth<2)){
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:urls}}])
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"attachImageURLs":urls})
}
}
function sendtext(text){
if(text&&(newsStack.depth<2)){
if (text.subject=="undefined"){text.subject=""}
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{bodyMessage:text.subject+"\n"+text.plaintext}}])
if(text.plaintext.lastIndexOf(".jpg")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1 || text.plaintext.lastIndexOf(".png")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1){
text.plaintext="<a href="+text.plaintext+"><img src="+text.plaintext+"></a>"}
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"bodyMessage":text.subject+"\n"+text.plaintext})
}
}
@ -188,96 +180,28 @@ Item {
y:1
color: "white"
// ComboBox{
// id:newstabstatusCombo
// anchors.top: parent.top
// anchors.topMargin: 0.5*mm
// width: 1/3*root.width
// height: 5*mm;
// style:
// ComboBoxStyle{
// background: Rectangle {
// color:"light blue"
// radius: 0.5*mm
// }
// label: Text {
// verticalAlignment: Text.AlignVCenter
// horizontalAlignment: Text.AlignHCenter
// text: control.currentText
// }
// }
// model: ListModel {
// id: newscomboItems
// ListElement { type: "Timeline"; text: qsTr("Timeline")}
// ListElement { type: "Conversations";text: qsTr("Conversations")}
// ListElement { type: "Favorites";text: qsTr("Favorites") }
// ListElement { type: "PublicTimeline";text: qsTr("Public timeline") }
// ListElement { type: "DirectMessages";text: qsTr("Direct Messages") }
// ListElement { type: "Notifications";text: qsTr("Notifications") }
// ListElement { type: "Search";text: qsTr("Search") }
// ListElement { type: "Groupnews"; text: qsTr("Group News") }
// ListElement { type: "Quit";text: qsTr("Quit") }
// }
// currentIndex:(login.newsViewType=="Timeline")?0:1
// onCurrentIndexChanged:{
// //onActivated:{
// print(newscomboItems.get(currentIndex).type);
// switch(newscomboItems.get(currentIndex).type){
// case "Timeline":
// newstab.newstabstatus="Timeline";
// newsModel.clear();
// try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){
// showNews(dbnews)
// })}catch(e){Helperjs.showMessage("Error",e,root)}
// break;
// case "Conversations":
// newsModel.clear();
// newstab.newstabstatus="Conversations";
// Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)})
// break;
// case "Favorites":
// newstab.newstabstatus="Favorites";
// root.contactLoadType="favorites";
// Service.updateView("Favorites");
// break;
// case "PublicTimeline":
// newstab.newstabstatus="Network";
// Service.updateView("Network");
// break;
// case "DirectMessages":
// newstab.newstabstatus="DirectMessages";
// Service.updateView("DirectMessages");
// break;
// case "Notifications":
// newstab.newstabstatus="Notifications";
// Service.updateView("Notifications");
// break;
// case "Search":
// newsView.anchors.topMargin=18*mm;
// newsSearch.visible=true
// break;
// case "Groupnews":
// Service.showGroups();
// break;
// case "Quit":
// Service.cleanNews(root.db,function(){
// Service.cleanContacts(root.login,root.db,function(){
// Qt.quit()})
// })
// }
// }
// }
BlueButton{
id:newstabstatusButton
anchors.top: parent.top
anchors.topMargin: 0.5*mm
text: qsTr(newstab.newstabstatus)
onClicked: {newstabmenu.popup()}
onClicked: {newstabmenu.popup(2*mm,6*mm)}
Menu{id:newstabmenu
MenuItem {
width: 40*mm
delegate:MenuItem{
contentItem: Text{
font.pixelSize: 3.5*mm
text:parent.text
}
background: Rectangle {
implicitWidth: 40*mm; implicitHeight: 5*mm
color: "#ffffff"
border.color: "grey"
}
}
Action {
text: qsTr("Timeline")
onTriggered: {
newstab.newstabstatus="Timeline";
@ -286,7 +210,7 @@ Item {
showNews(dbnews)
})}catch(e){Helperjs.showMessage("Error",e,root)}}
}
MenuItem {
Action {
text: qsTr("Conversations")
onTriggered:{
newsModel.clear();
@ -294,15 +218,14 @@ Item {
Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)})
}
}
MenuItem {
Action {
text: qsTr("Favorites")
onTriggered:{
newstab.newstabstatus="Favorites";
// root.contactLoadType="favorites";
Service.updateView("Favorites")
}
}
MenuItem {
Action {
text: qsTr("Public timeline")
onTriggered:{
newstab.newstabstatus="Public Timeline";
@ -310,25 +233,25 @@ Item {
}
}
MenuItem {
Action {
text: qsTr("Direct Messages")
onTriggered:{
newstab.newstabstatus="Direct Messages";
Service.updateView("Direct Messages")
}
}
MenuItem {
Action {
text: qsTr("Notifications")
onTriggered:{
newstab.newstabstatus="Notifications";
Service.updateView("Notifications")
}
}
MenuItem {
Action {
text: qsTr("Group news")
onTriggered:Service.showGroups();
}
MenuItem {
Action {
text: qsTr("Quit")
onTriggered:{
Service.cleanNews(root.db,function(){
@ -370,7 +293,7 @@ Item {
});
newstab.newstabstatus="SendMessage";
Helperjs.readData(root.db,"contacts",root.login.username,function(friends){
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"contacts": friends,"login":root.login}})
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"contacts": friends,"login":root.login})
},"isFriend",1);
}
}
@ -386,7 +309,7 @@ Item {
id: update
text: "\uf021"
onClicked: {
//root.contactLoadType="news";
root.contactLoadType="news";
Service.updateView(newstab.newstabstatus)
}
}
@ -502,21 +425,18 @@ Item {
}
Component.onCompleted: {
root.messageSignal.connect(onFriendsMessages);
root.directmessageSignal.connect(onDirectMessage);
root.newsSignal.connect(showNews);
root.uploadSignal.connect(sendUrls);
root.sendtextSignal.connect(sendtext);
try{newsModel.clear()} catch(e){}
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
root.messageSignal.connect(onFriendsMessages);
root.directmessageSignal.connect(onDirectMessage);
root.newsSignal.connect(showNews);
root.uploadSignal.connect(sendUrls);
root.sendtextSignal.connect(sendtext);
try{newsModel.clear()} catch(e){}
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
if(root.news.length>0){showNews(root.news)}
else{ newstab.newstabstatus=login.newsViewType;
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
}
if(osSettings.imagePickQml=="ImagePicker"){var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml");
var IntentReceiverQml = component.createObject(root)
else{ newstab.newstabstatus=login.newsViewType;
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
}
}
}

View File

@ -144,16 +144,31 @@ Item {
}
}
Text {
Column{ id: messageColumn
//anchors.top:topFlow.bottom
width:parent.width
spacing:mm
clip:true
height: Math.min(implicitHeight,3/4*root.height)
MouseArea{
width: newsitem.width-8*mm-2
height: itemMessage.height
onPressAndHold: {
newsStack.push("qrc:/qml/newsqml/Conversation.qml");
showConversation(index,newsitemobject)
}
Text {
color: "#404040"
linkColor: "light green"
id: itemMessage
textFormat: Text.RichText
text:newsitemobject.statusnet_html
text: newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html
width: newsitem.width-8*mm-2
height: Math.min(implicitHeight,3/4*root.height)
height: implicitHeight
wrapMode: Text.Wrap
clip:true
//MouseArea{anchors.fill:parent;onClicked: print("Test")}
onLinkActivated:{
Qt.openUrlExternally(link)}
Component.onCompleted:{
@ -166,38 +181,38 @@ Item {
}}
if (newsitemobject.attachmentList.length>0){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url);
var attachcomponent = Qt.createQmlObject('import QtQuick 2.0; '+
'AnimatedImage {id:gif;source: "'+newsitemobject.attachmentList[attachments].url+
'";onStatusChanged: playing = (status == AnimatedImage.Ready)}',
friendicaActivities,"Attachment"+attachments);
var imageQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
}
}
}
BlueButton{
width: newsitem.width-8*mm-2
height:10*mm
anchors.bottom: itemMessage.bottom
visible: itemMessage.implicitHeight>3/4*root.height
text:"\uf078"
fontColor:"grey"
border.color: "transparent"
gradient: Gradient {
GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 0.5; color: "white" }
}
radius:0
onClicked: {
if (text=="\uf078"){
itemMessage.height=itemMessage.implicitHeight+10*mm;text="\uf077"
} else {
itemMessage.height=Math.min(itemMessage.implicitHeight,3/4*root.height);
text="\uf078";
newsView.positionViewAtIndex(index,ListView.Beginning);
}
}
}
}
}}
}
BlueButton{
width: newsitem.width-8*mm-2
height:5*mm
//anchors.bottom: messageColumn.bottom//itemMessage.bottom
visible: messageColumn.implicitHeight>3/4*root.height//itemMessage.implicitHeight>3/4*root.height
text:"\uf078"
fontColor:"grey"
border.color: "transparent"
color:"white"
// gradient: Gradient {
// GradientStop { position: 0.0; color: "transparent" }
// GradientStop { position: 0.5; color: "white" }
// }
radius:0
onClicked: {
if (text=="\uf078"){
messageColumn.height=messageColumn.implicitHeight+10*mm;text="\uf077"
} else {
messageColumn.height=Math.min(messageColumn.implicitHeight,3/4*root.height);
text="\uf078";
newsView.positionViewAtIndex(index,ListView.Beginning);
}
}
}
}
}
Flow{
@ -364,9 +379,11 @@ Item {
MouseArea{
anchors.fill:parent
onClicked:{
conversationsymbol.color="black";
var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml");
var conversationItem = component.createObject(friendicaActivities); showConversation(index,newsitemobject)
//conversationsymbol.color="black";
// var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml");
// var conversationItem = component.createObject(friendicaActivities);
newsStack.push("qrc:/qml/newsqml/Conversation.qml")
showConversation(index,newsitemobject)
}
}
}
@ -380,7 +397,7 @@ Item {
onTriggered: {
var directmessage=0;
if (newsitemobject.messagetype==1){ directmessage=1}
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.id,"login":root.login,"directmessage":directmessage}});
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.id,"login":root.login,"directmessage":directmessage});
}
}
MenuItem {

View File

@ -220,6 +220,6 @@
<file>qml/genericqml/Search.qml</file>
<file>qml/newsqml/Hashtag.qml</file>
<file>qml/genericqml/IntentReceiver.qml</file>
<file>qml/newsqml/NewsImage.qml</file>
</qresource>
</RCC>

View File

@ -51,4 +51,5 @@ DISTFILES += \
qml/photoqml/*.qml \
qml/configqml/*.qml \
js/*.js \
qml/newsqml/Hashtag.qml
qml/newsqml/Hashtag.qml \
qml/newsqml/NewsImage.qml

View File

@ -151,8 +151,8 @@ var where = " AND "+ filter +" = '" + filtervalue+"'";
});
}
function showMessage(header,message,rootwindow){print("message: "+message);
var cleanmessage=message.replace(/"/g,"-"); //print(cleanmessage);
function showMessage(header,message,rootwindow){
var cleanmessage=message.replace(/"/g,"-");
if(cleanmessage.length>200){cleanmessage=cleanmessage.slice(0,200)+'...'}
var messageString='import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:"'+header+'";standardButtons: StandardButton.Ok; text:" '+cleanmessage+'"}';
var messageObject=Qt.createQmlObject(messageString,rootwindow,"messageOutput");

View File

@ -326,7 +326,7 @@ function favorite(login,favorite,newsid,rootwindow){
// toggle favorites
if(favorite){ Helperjs.friendicaPostRequest(login,"/api/favorites/create?id="+newsid,"","POST", rootwindow,function (obj){
})}
else {Helperjs.friendicaPostRequest(login,"/api/favorites/destroy?id="+newsid, "POST",rootwindow,function (obj){
else {Helperjs.friendicaPostRequest(login,"/api/favorites/destroy?id="+newsid,"","POST",rootwindow,function (obj){
})}
}

View File

@ -82,15 +82,27 @@ else{
if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1}
}}} catch(e){print("Activities "+e+ " "+JSON.stringify(newsitemobject.friendica_activities))}
var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self}
var attachmentList=[];try{if(newsitemobject.attachments){
var attachmentList=[];
try{if(newsitemobject.attachments){
var attachArray=newsitemobject.attachments;
for (var image in attachArray){if(attachArray[image].mimetype=="image/gif"){
attachmentList.push(attachArray[image])
for (var image in attachArray){
var attachhelper={mimetype:attachArray[image].mimetype}
var attachhelperstring=Qt.btoa(attachArray[image].url)
var helperstringposition=newsitemobject.text.indexOf(attachhelperstring);
if (helperstringposition>-1){attachhelper.url=newsitemobject.text.substring(newsitemobject.text.lastIndexOf("http",helperstringposition),helperstringposition+attachhelperstring.length);
if (attachArray[image].mimetype=="image/jpeg"){attachhelper.url=attachhelper.url+".jpg"}
else if (attachArray[image].mimetype=="image/gif"){attachhelper.url=attachhelper.url+".gif"}
else if (attachArray[image].mimetype=="image/png"){attachhelper.url=attachhelper.url+".png"}
}
else {attachhelper.url=attachArray[image].url}
attachmentList.push(attachhelper)
newsitemobject.text=newsitemobject.text.replace(attachhelper.url,"")
newsitemobject.text=newsitemobject.text.replace(attachhelper.url.substring(0,attachhelper.url.length-4)+".jpeg","")
newsitemobject.text=newsitemobject.text.replace(attachhelper.url.substring(0,attachhelper.url.length-4),"")
}
}}catch(e){print("attachment "+e)}
}}catch(e){print("attachment "+e)}
newsitemobject.attachmentList=attachmentList;
var seconds=(msg.currentTime-newsitemobject.created_at)/1000;
var timestring="";
if (seconds<60) {timestring=seconds+" "+qsTr("seconds") +" "+qsTr("ago");}

View File

@ -39,6 +39,7 @@ function initDatabase(database) { // initialize the database object
var db =Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
print('initDatabase()'+database[0]+database[1]+database[2]+database[3])
db.transaction( function(tx) {
//var version=tx.executeSql('PRAGMA user_version');print(JSON.stringify(version.rows.item(0)))
tx.executeSql('CREATE TABLE IF NOT EXISTS imageData(username TEXT,id INT, created TEXT,edited TEXT, title TEXT, desc TEXT, album TEXT,filename TEXT, type TEXT, height INT, width INT, profile INT, link TEXT,location TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS config(server TEXT, username TEXT, password TEXT, imagestore TEXT, maxnews INT, timerInterval INT, newsViewType TEXT,isActive INT, permissions TEXT,maxContactAge INT,APIVersion TEXT,layout TEXT, addons TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS news(username TEXT, messagetype INT, text TEXT, created_at INT, in_reply_to_status_id INT, source TEXT, status_id INT, in_reply_to_user_id INT, geo TEXT,favorited TEXT, uid INT, statusnet_html TEXT, statusnet_conversation_id TEXT,friendica_activities TEXT, friendica_activities_self TEXT, attachments TEXT, friendica_owner TEXT)');
@ -313,7 +314,7 @@ function cleanNews(database,callback){
var maxnewsrs = tx.executeSql("SELECT DISTINCT maxnews FROM config");
var maxnews=maxnewsrs.rows.item(0).maxnews;
var newscountrs = tx.executeSql('SELECT COUNT(*) from news');
var newscount = newscountrs.rows.item(0)["COUNT(*)"];
var newscount = newscountrs.rows.item(0)["COUNT(*)"];//print("newscount "+newscount)
if (newscount>maxnews){
var lastvalidtimers= tx.executeSql('SELECT DISTINCT created_at FROM news ORDER BY created_at ASC LIMIT ' +(newscount-maxnews));
var lastvalidtime=lastvalidtimers.rows.item(newscount-maxnews-1).created_at;
@ -329,6 +330,7 @@ function cleanContacts(login,database,callback){
if (oldestnewsrs.rows.length>0){ var oldestnewsTime=oldestnewsrs.rows.item(0).created_at- 604800000;} else{var oldestnewsTime=0} //contacts can be 7 days old
//print(login.username+" älteste news: "+ oldestnewsTime);
var result = tx.executeSql('SELECT * from contacts WHERE username="'+login.username+'" AND isFriend=0 AND imageAge<'+oldestnewsTime); // check for friends
//print ("Contact result length: "+ result.rows.length)
for (var i=0;i<result.rows.length;i++){
filesystem.rmFile(result.rows.item(i).profile_image);
var deleters = tx.executeSql('DELETE from contacts WHERE username="'+login.username+'" AND url="'+result.rows.item(i).url+'"');
@ -355,9 +357,7 @@ function updateContactInDB(login,database,isFriend,contact){// for newstab and f
}
function processNews(api,data){
try{var newslist=JSON.parse(data);
} catch(e){
Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root)};
try{var newslist=JSON.parse(data)} catch(e){newsBusy.running=false;};
if (typeof(newslist)=='undefined'){
Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root)
}
@ -461,6 +461,7 @@ function processNews(api,data){
var newstabarray=["Conversations","Favorites","Timeline","DirectMessage"];
if (newstabarray.indexOf(newstab.newstabstatus)>-1){contacttimer.start()}
}
}
@ -535,6 +536,7 @@ function updateView(viewtype){
newstab.newstabstatus="Conversations";
}
xhr.get();
if (viewtype==="Conversations"){Newsjs.allchatsfromdb(db,login.username,function(temp){
newsStack.allchats=temp
})}

View File

@ -43,10 +43,10 @@ Rectangle{
textFormat: Text.RichText
width: parent.width
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: "<b>Friendiqa v0.3 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
text: "<b>Friendiqa v0.3.1 </b><br>Licensed under GPL 3 with the exception of OpenSSL <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/Friendiqa</a><br>"+
"C++ code by <a href='https://kirgroup.com/profile/fabrixxm'>Fabio</a><br>"+
"Sourcecode: <a href='https://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+
"Most of 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>"+

View File

@ -40,6 +40,7 @@ Rectangle{
// border.width:1
radius: mm
property alias text: mainText.text
property alias font: mainText.font
signal clicked
state:""

View File

@ -37,20 +37,23 @@ import "qrc:/qml/genericqml"
Rectangle {
id:conversationList
// width:root.width-5*mm
// height:root.height-12*mm
//property var news
y:1
z:2
// y:1
// z:2
color: "white"
border.color: "grey"
width:root.width-5*mm
height: conversationView.height+10*mm
// border.color: "grey"
// width:root.width-5*mm
// height: conversationView.height+10*mm
ListView {
id: conversationView
x:3*mm
y:8*mm
width: conversationList.width-4*mm
height: contentHeight
//height: contentHeight
height:conversationList.height-10*mm
clip: true
spacing: 0
footer: footerReply
@ -70,17 +73,19 @@ Rectangle {
Connections{
target:newstab
onConversationChanged:{
if(newsitem.itemindex==newsStack.conversationIndex){
//if(newsitem.itemindex==newsStack.conversationIndex){
if(newstab.conversation.length==0){
newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
conversationList.destroy(); conversationsymbol.color="grey"
newsStack.pop()
//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"}
}
//conversationsymbol.color="grey"
}
//}
}
}
@ -165,9 +170,10 @@ Rectangle {
anchors.rightMargin: 1*mm
text: "\uf057"
onClicked: {
newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
conversationList.destroy();
conversationsymbol.color="grey"
//newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
newsStack.pop()
//conversationList.destroy();
//conversationsymbol.color="grey"
}
}

View File

@ -32,8 +32,8 @@
// message.qml
// message with buttons
import QtQuick 2.0
import QtQuick.Controls 1.3
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4
//import QtQuick.Dialogs 1.2
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/smiley.js" as Smileyjs
import "qrc:/qml/genericqml"
@ -41,8 +41,8 @@ import "qrc:/qml/genericqml"
Rectangle{
color:"white"
width:root.width-5*mm
height:root.height-12*mm
// width:root.width-5*mm
// height:root.height-12*mm
//anchors.fill: parent
property string parentId: ""
property string reply_to_user:""
@ -69,7 +69,7 @@ Rectangle{
xhr.setApi("/api/statuses/update");
xhr.clearParams();
xhr.setParam("source", "Friendiqa");
xhr.setParam("status", status);
xhr.setParam("htmlstatus", status);
if (parentId!="") {xhr.setParam("in_reply_to_status_id", parentId)};
if (title!=="") {xhr.setParam("title", title)};
if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))};
@ -94,14 +94,11 @@ Rectangle{
}
Flickable{
anchors.fill: parent
contentHeight: messageColumn.height
boundsBehavior: Flickable.StopAtBounds
id:messageSend
Column {
anchors.fill: parent
contentHeight: messageColumn.height
boundsBehavior: Flickable.StopAtBounds
id:messageSend
Column {
id:messageColumn
spacing: 0.5*mm
width: parent.width
@ -124,13 +121,15 @@ Rectangle{
font.pixelSize: 3*mm
wrapMode: Text.Wrap
selectByMouse: true
textFormat: TextEdit.PlainText
textFormat: TextEdit.RichText //TextEdit.PlainText
onLinkActivated:{Qt.openUrlExternally(link)}
}
}
Row{
spacing: 2
width: parent.width
CheckBox{
id:dmCheckbox
text:"DM"
@ -142,38 +141,38 @@ Rectangle{
}
}
BlueButton{
text:"\uf0c1"
onClicked: {
if(bodyField.selectedText==""){Helperjs.showMessage("Error","No text selected",messageSend)}
else{urlTextEdit.text="";
urlRectangle.visible=true}}
}
Rectangle{
id:urlRectangle
BlueButton{
text:"\uf0c1"
onClicked: {
if(bodyField.selectedText==""){Helperjs.showMessage("Error","No text selected",messageSend)}
else{urlTextEdit.text="";
urlRectangle.visible=true}}
}
}
Rectangle{
id:urlRectangle
height: 7*mm //parent.height
width:parent.width-2*mm
visible:false
TextField{
id:urlTextEdit
width:parent.width-7*mm
height:parent.height
width:37*mm
visible:false
TextField{
id:urlTextEdit
width:30*mm
height:parent.height
}
BlueButton{
anchors.left:urlTextEdit.right
anchors.leftMargin:mm
text:"\u2713"
onClicked: {if(urlTextEdit.text!=""){
var start = bodyField.selectionStart;
var text=bodyField.selectedText
text = "[url="+urlTextEdit.text+"]" + text + "[/url]";
bodyField.remove(start,bodyField.selectionEnd);
bodyField.insert(start,text);}
urlRectangle.visible=false}
}
}
BlueButton{
anchors.left:urlTextEdit.right
anchors.leftMargin:mm
text:"\u2713"
onClicked: {if(urlTextEdit.text!=""){
var start = bodyField.selectionStart;
var text=bodyField.selectedText
if(text.lastIndexOf(".jpg")>-1 || text.lastIndexOf(".jpeg")>-1 || text.lastIndexOf(".png")>-1){text="<img src="+text+">"}
text = "[url="+urlTextEdit.text+"]" + text + "[/url]";
bodyField.remove(start,bodyField.selectionEnd);
bodyField.insert(start,text);}
urlRectangle.visible=false}
}
}
Row{
spacing:2
BlueButton{id:permButton
@ -208,7 +207,7 @@ Rectangle{
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+"'; onTriggered: bodyField.insert(0,' @"+contacts[i].screen_name+" ')}"
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+"'; onTriggered: bodyField.insert("+bodyField.cursorPosition+",' @"+contacts[i].screen_name+" ')}"
}}
var menuString="import QtQuick.Controls 1.4; Menu {"+contactitems+"}";
var contactlistObject=Qt.createQmlObject(menuString,messageColumn,"contactmenuOutput")
@ -234,10 +233,11 @@ Rectangle{
text: "\uf1d9"
onClicked: {
var title=titleField.text.replace("\"","\'");
var body=bodyField.getText(0,bodyField.length);
var body=bodyField.getFormattedText(0,bodyField.length);
var dmbody=bodyField.getText(0,bodyField.length);
if (directmessage==0){
statusUpdate(title,body,messageSend.parentId,attachImageURLs)}
else {dmUpdate(title,body,"",messageSend.reply_to_user) }
statusUpdate(title,body,parentId,attachImageURLs)}
else {dmUpdate(title,dmbody,parentId,reply_to_user) }
newstab.newstabstatus=login.newsViewType; newsStack.pop(null)
}
}

View File

@ -0,0 +1,50 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
AnimatedImage {id:gif;
width:newscolumn.width;
property string mimetype:""
fillMode: Image.PreserveAspectFit;
onStatusChanged: playing = (status == AnimatedImage.Ready);
MouseArea {anchors.fill:parent;
onClicked:{
if (mimetype!="image/gif"){
var attachcomponent = Qt.createQmlObject('import QtQuick 2.0; '+
'Rectangle{id:recfullscreen;color:"white";width:root.width;height:root.height;'+
'MouseArea {anchors.fill:parent;onClicked:{recfullscreen.destroy()}}'+
'AnimatedImage {id:giffullscreen;source: "'+gif.source+
'";anchors.centerIn:parent; width:root.width;fillMode: Image.PreserveAspectFit; onStatusChanged: playing = (status == AnimatedImage.Ready);'+
'}}',root,"Attachmentlarge")
}
}
}
}

View File

@ -30,8 +30,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls 2.3
//import QtQuick.Controls.Styles 2.3
import QtQuick.Dialogs 1.3
import "qrc:/qml/genericqml"
import "qrc:/js/news.js" as Newsjs
@ -44,16 +44,6 @@ Item {
target:newstab
onNewstabstatusChanged:{
newstabstatusButton.text= qsTr(newstab.newstabstatus)
// switch(newstab.newstabstatus){
// case "Timeline": newstabstatusCombo.currentIndex=1; break;
// case "Conversations":newstabstatusCombo.currentIndex=2; break;
// case "Favorites":newstabstatusCombo.currentIndex=3; break;
// case "Network":newstabstatusCombo.currentIndex=4; break;
// case "Direct Messages":newstabstatusCombo.currentIndex=5; break;
// case "Notifications":newstabstatusCombo.currentIndex=6; break;
// case "Search":newstabstatusCombo.currentIndex=7; break;
// case "Groupnews":newstabstatusCombo.currentIndex=8; break;
// }
}
}
@ -161,19 +151,21 @@ Item {
function onDirectMessage(friend){
newstab.newstabstatus="SendMessage"
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}});
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": friend,"directmessage":1,"login":root.login});
}
function sendUrls(urls){
if((urls.length==1)&&(newsStack.depth<2)){
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:urls}}])
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"attachImageURLs":urls})
}
}
function sendtext(text){
if(text&&(newsStack.depth<2)){
if (text.subject=="undefined"){text.subject=""}
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{bodyMessage:text.subject+"\n"+text.plaintext}}])
if(text.plaintext.lastIndexOf(".jpg")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1 || text.plaintext.lastIndexOf(".png")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1){
text.plaintext="<a href="+text.plaintext+"><img src="+text.plaintext+"></a>"}
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"bodyMessage":text.subject+"\n"+text.plaintext})
}
}
@ -188,96 +180,28 @@ Item {
y:1
color: "white"
// ComboBox{
// id:newstabstatusCombo
// anchors.top: parent.top
// anchors.topMargin: 0.5*mm
// width: 1/3*root.width
// height: 5*mm;
// style:
// ComboBoxStyle{
// background: Rectangle {
// color:"light blue"
// radius: 0.5*mm
// }
// label: Text {
// verticalAlignment: Text.AlignVCenter
// horizontalAlignment: Text.AlignHCenter
// text: control.currentText
// }
// }
// model: ListModel {
// id: newscomboItems
// ListElement { type: "Timeline"; text: qsTr("Timeline")}
// ListElement { type: "Conversations";text: qsTr("Conversations")}
// ListElement { type: "Favorites";text: qsTr("Favorites") }
// ListElement { type: "PublicTimeline";text: qsTr("Public timeline") }
// ListElement { type: "DirectMessages";text: qsTr("Direct Messages") }
// ListElement { type: "Notifications";text: qsTr("Notifications") }
// ListElement { type: "Search";text: qsTr("Search") }
// ListElement { type: "Groupnews"; text: qsTr("Group News") }
// ListElement { type: "Quit";text: qsTr("Quit") }
// }
// currentIndex:(login.newsViewType=="Timeline")?0:1
// onCurrentIndexChanged:{
// //onActivated:{
// print(newscomboItems.get(currentIndex).type);
// switch(newscomboItems.get(currentIndex).type){
// case "Timeline":
// newstab.newstabstatus="Timeline";
// newsModel.clear();
// try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){
// showNews(dbnews)
// })}catch(e){Helperjs.showMessage("Error",e,root)}
// break;
// case "Conversations":
// newsModel.clear();
// newstab.newstabstatus="Conversations";
// Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)})
// break;
// case "Favorites":
// newstab.newstabstatus="Favorites";
// root.contactLoadType="favorites";
// Service.updateView("Favorites");
// break;
// case "PublicTimeline":
// newstab.newstabstatus="Network";
// Service.updateView("Network");
// break;
// case "DirectMessages":
// newstab.newstabstatus="DirectMessages";
// Service.updateView("DirectMessages");
// break;
// case "Notifications":
// newstab.newstabstatus="Notifications";
// Service.updateView("Notifications");
// break;
// case "Search":
// newsView.anchors.topMargin=18*mm;
// newsSearch.visible=true
// break;
// case "Groupnews":
// Service.showGroups();
// break;
// case "Quit":
// Service.cleanNews(root.db,function(){
// Service.cleanContacts(root.login,root.db,function(){
// Qt.quit()})
// })
// }
// }
// }
BlueButton{
id:newstabstatusButton
anchors.top: parent.top
anchors.topMargin: 0.5*mm
text: qsTr(newstab.newstabstatus)
onClicked: {newstabmenu.popup()}
onClicked: {newstabmenu.popup(2*mm,6*mm)}
Menu{id:newstabmenu
MenuItem {
width: 40*mm
delegate:MenuItem{
contentItem: Text{
font.pixelSize: 3.5*mm
text:parent.text
}
background: Rectangle {
implicitWidth: 40*mm; implicitHeight: 5*mm
color: "#ffffff"
border.color: "grey"
}
}
Action {
text: qsTr("Timeline")
onTriggered: {
newstab.newstabstatus="Timeline";
@ -286,7 +210,7 @@ Item {
showNews(dbnews)
})}catch(e){Helperjs.showMessage("Error",e,root)}}
}
MenuItem {
Action {
text: qsTr("Conversations")
onTriggered:{
newsModel.clear();
@ -294,15 +218,14 @@ Item {
Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)})
}
}
MenuItem {
Action {
text: qsTr("Favorites")
onTriggered:{
newstab.newstabstatus="Favorites";
// root.contactLoadType="favorites";
Service.updateView("Favorites")
}
}
MenuItem {
Action {
text: qsTr("Public timeline")
onTriggered:{
newstab.newstabstatus="Public Timeline";
@ -310,25 +233,25 @@ Item {
}
}
MenuItem {
Action {
text: qsTr("Direct Messages")
onTriggered:{
newstab.newstabstatus="Direct Messages";
Service.updateView("Direct Messages")
}
}
MenuItem {
Action {
text: qsTr("Notifications")
onTriggered:{
newstab.newstabstatus="Notifications";
Service.updateView("Notifications")
}
}
MenuItem {
Action {
text: qsTr("Group news")
onTriggered:Service.showGroups();
}
MenuItem {
Action {
text: qsTr("Quit")
onTriggered:{
Service.cleanNews(root.db,function(){
@ -370,7 +293,7 @@ Item {
});
newstab.newstabstatus="SendMessage";
Helperjs.readData(root.db,"contacts",root.login.username,function(friends){
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"contacts": friends,"login":root.login}})
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"contacts": friends,"login":root.login})
},"isFriend",1);
}
}

View File

@ -144,16 +144,31 @@ Item {
}
}
Text {
Column{ id: messageColumn
//anchors.top:topFlow.bottom
width:parent.width
spacing:mm
clip:true
height: Math.min(implicitHeight,3/4*root.height)
MouseArea{
width: newsitem.width-8*mm-2
height: itemMessage.height
onPressAndHold: {
newsStack.push("qrc:/qml/newsqml/Conversation.qml");
showConversation(index,newsitemobject)
}
Text {
color: "#404040"
linkColor: "light green"
id: itemMessage
textFormat: Text.RichText
text:newsitemobject.statusnet_html
text: newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html
width: newsitem.width-8*mm-2
height: Math.min(implicitHeight,3/4*root.height)
height: implicitHeight
wrapMode: Text.Wrap
clip:true
//MouseArea{anchors.fill:parent;onClicked: print("Test")}
onLinkActivated:{
Qt.openUrlExternally(link)}
Component.onCompleted:{
@ -166,38 +181,38 @@ Item {
}}
if (newsitemobject.attachmentList.length>0){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url);
var attachcomponent = Qt.createQmlObject('import QtQuick 2.0; '+
'AnimatedImage {id:gif;source: "'+newsitemobject.attachmentList[attachments].url+
'";onStatusChanged: playing = (status == AnimatedImage.Ready)}',
friendicaActivities,"Attachment"+attachments);
var imageQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
}
}
}
BlueButton{
width: newsitem.width-8*mm-2
height:10*mm
anchors.bottom: itemMessage.bottom
visible: itemMessage.implicitHeight>3/4*root.height
text:"\uf078"
fontColor:"grey"
border.color: "transparent"
gradient: Gradient {
GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 0.5; color: "white" }
}
radius:0
onClicked: {
if (text=="\uf078"){
itemMessage.height=itemMessage.implicitHeight+10*mm;text="\uf077"
} else {
itemMessage.height=Math.min(itemMessage.implicitHeight,3/4*root.height);
text="\uf078";
newsView.positionViewAtIndex(index,ListView.Beginning);
}
}
}
}
}}
}
BlueButton{
width: newsitem.width-8*mm-2
height:5*mm
//anchors.bottom: messageColumn.bottom//itemMessage.bottom
visible: messageColumn.implicitHeight>3/4*root.height//itemMessage.implicitHeight>3/4*root.height
text:"\uf078"
fontColor:"grey"
border.color: "transparent"
color:"white"
// gradient: Gradient {
// GradientStop { position: 0.0; color: "transparent" }
// GradientStop { position: 0.5; color: "white" }
// }
radius:0
onClicked: {
if (text=="\uf078"){
messageColumn.height=messageColumn.implicitHeight+10*mm;text="\uf077"
} else {
messageColumn.height=Math.min(messageColumn.implicitHeight,3/4*root.height);
text="\uf078";
newsView.positionViewAtIndex(index,ListView.Beginning);
}
}
}
}
}
Flow{
@ -364,9 +379,11 @@ Item {
MouseArea{
anchors.fill:parent
onClicked:{
conversationsymbol.color="black";
var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml");
var conversationItem = component.createObject(friendicaActivities); showConversation(index,newsitemobject)
//conversationsymbol.color="black";
// var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml");
// var conversationItem = component.createObject(friendicaActivities);
newsStack.push("qrc:/qml/newsqml/Conversation.qml")
showConversation(index,newsitemobject)
}
}
}
@ -380,7 +397,7 @@ Item {
onTriggered: {
var directmessage=0;
if (newsitemobject.messagetype==1){ directmessage=1}
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.id,"login":root.login,"directmessage":directmessage}});
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.id,"login":root.login,"directmessage":directmessage});
}
}
MenuItem {