Dynamic news tabs

This commit is contained in:
LubuWest 2023-11-04 18:04:55 +01:00
parent 2debd8f2ab
commit 3c1c97d489
43 changed files with 526 additions and 327 deletions

View File

@ -1 +0,0 @@
../source-linux/application.qrc

View File

@ -1 +0,0 @@
../../source-linux/common/alarm.h

View File

@ -1 +0,0 @@
../../source-linux/common/alarmandroid.cpp

View File

@ -1 +0,0 @@
../../source-linux/common/alarmlinux.cpp

View File

@ -1 +0,0 @@
../../source-linux/common/filesystem.cpp

View File

@ -1 +0,0 @@
../../source-linux/common/filesystem.h

View File

@ -1 +0,0 @@
../../source-linux/common/filesystemandroid.cpp

View File

@ -1 +0,0 @@
../../source-linux/common/oauth.cpp

View File

@ -1 +0,0 @@
../../source-linux/common/oauth.h

View File

@ -1 +0,0 @@
../../source-linux/common/remoteauthasyncimageprovider.cpp

View File

@ -1 +0,0 @@
../../source-linux/common/remoteauthasyncimageprovider.h

View File

@ -1 +0,0 @@
../../source-linux/common/updatenews.cpp

View File

@ -1 +0,0 @@
../../source-linux/common/updatenews.h

View File

@ -1 +0,0 @@
../../source-linux/common/uploadableimage.cpp

View File

@ -1 +0,0 @@
../../source-linux/common/uploadableimage.h

View File

@ -1 +0,0 @@
../../source-linux/common/xhr.cpp

View File

@ -1 +0,0 @@
../../source-linux/common/xhr.h

View File

@ -1 +0,0 @@
../source-linux/images

View File

@ -1 +0,0 @@
../source-linux/js

View File

@ -1 +0,0 @@
../../source-linux/qml/calendarqml

View File

@ -1 +0,0 @@
../../source-linux/qml/configqml

View File

@ -1 +0,0 @@
../../source-linux/qml/contactqml

View File

@ -1 +0,0 @@
../../source-linux/qml/genericqml

View File

@ -1 +0,0 @@
../../source-linux/qml/newsqml

View File

@ -1 +0,0 @@
../../source-linux/qml/photoqml

View File

@ -1 +0,0 @@
../source-linux/qtquickcontrols2.conf

View File

@ -1 +0,0 @@
../source-linux/translations

View File

@ -256,5 +256,7 @@
<file>qml/configqml/AcceptRules.qml</file>
<file>translations/friendiqa-nl.qm</file>
<file>translations/friendiqa-nl.ts</file>
<file>qml/genericqml/SearchDialog.qml</file>
<file>qml/newsqml/NewsTabbutton.qml</file>
</qresource>
</RCC>

View File

@ -233,10 +233,11 @@ void XHR::download()
void XHR::get()
{
QUrlQuery query;
qDebug() << "get";
QHashIterator<QString, QString> i(params);
while(i.hasNext()) {
i.next();
qDebug() << "value" << i.value();
query.addQueryItem(i.key(), i.value());
}
QUrl requrl(m_url+m_api);
@ -354,6 +355,11 @@ void XHR::onReplyError(QNetworkReply::NetworkError code)
void XHR::onReplySuccess()
{
qDebug() << "!";
QHashIterator<QString, QString> i(params);
while(i.hasNext()) {
i.next();
qDebug() << i.key()<< " " << i.value();
}
emit this->success(buffer, m_api);
buffer.clear();
// reply->deleteLater();

View File

@ -34,6 +34,10 @@
.import "qrc:/js/helper.js" as Helperjs
.import "qrc:/js/news.js" as Newsjs
const newsViewType = 'Conversations'
const defaultNewsTypes = encodeURI(JSON.stringify(["Home","Replies","DirectMessages","Notifications"])) //'[\"Home\",\"Replies\",\"DirectMessages\",\"Notifications\"]'
// CONFIG FUNCTIONS
function initDatabase(database) { // initialize the database object
@ -171,7 +175,8 @@ function readActiveConfig(database){
function setDefaultOptions(database){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) {
var rs = tx.executeSql('INSERT INTO globaloptions (k,v) VALUES ("newsViewType","Conversations")');
let rs = tx.executeSql('INSERT INTO globaloptions (k,v) VALUES ("newsViewType","'+ newsViewType+'")');
let rs2 = tx.executeSql('INSERT INTO globaloptions (k,v) VALUES ("defaultNewsTypes","'+ defaultNewsTypes+'")');
})
}
@ -180,8 +185,18 @@ function readGlobaloptions(database,callback){
var go=({});
db.transaction( function(tx) {
var rs = tx.executeSql('select * from globaloptions');
for (var r=0; r<rs.rows.length; r++){
go[rs.rows.item(r).k]=rs.rows.item(r).v
for (var r=0; r<rs.rows.length; r++){//print("rs.rows.item(r).k "+rs.rows.item(r).k +" rs.rows.item(r).v "+rs.rows.item(r).v)
if(rs.rows.item(r).k=="defaultNewsTypes"){
go[rs.rows.item(r).k]=JSON.parse(decodeURI(rs.rows.item(r).v))
} else{
go[rs.rows.item(r).k]=rs.rows.item(r).v
}
}
if (!go.hasOwnProperty('defaultNewsTypes')){
go.defaultNewsTypes=JSON.parse(decodeURI(defaultNewsTypes))
}
else if (!go.hasOwnProperty('newsViewType')){
go.newsViewType=newsViewType
}
callback(go)
})
@ -195,12 +210,14 @@ function readGO(database){
function updateglobaloptions(database,key,value){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
if(key=='defaultNewsTypes'){var dbValue=encodeURI(JSON.stringify(value))} else {var dbValue=value}
db.transaction( function(tx) {
var result = tx.executeSql('SELECT * from globaloptions where k="'+key+'"'); // check for key
if(result.rows.length > 0) {// use update
result = tx.executeSql('UPDATE globaloptions SET v="'+value+'" WHERE k="'+key+'"')
result = tx.executeSql('UPDATE globaloptions SET v="'+dbValue+'" WHERE k="'+key+'"')
} else {// use insert
result = tx.executeSql('INSERT INTO globaloptions (k,v) VALUES (?,?)', [key,value])
result = tx.executeSql('INSERT INTO globaloptions (k,v) VALUES (?,?)', [key,dbValue])
}
})
root.globaloptions[key]=value;
@ -221,14 +238,14 @@ function deleteConfig(database,userobj,callback) { // delete user data from DB
})
}
function updateNewsviewtype(database, newsViewtype){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
if(!db) { return; }
db.transaction( function(tx) {
var rs1 = tx.executeSql('INSERT INTO globaloptions (k,v) VALUES (?,?)', ["newsViewType",newsViewtype])
var rs2 = tx.executeSql('UPDATE config SET newsViewType=""');
})
}
//function updateNewsviewtype(database, newsViewtype){
// var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
// if(!db) { return; }
// db.transaction( function(tx) {
// var rs1 = tx.executeSql('INSERT INTO globaloptions (k,v) VALUES (?,?)', ["newsViewType",newsViewtype])
// var rs2 = tx.executeSql('UPDATE config SET newsViewType=""');
// })
//}
function cleanNews(database,callback){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);

View File

@ -62,19 +62,18 @@ Page{
Helperjs.friendicaRequest(userconfig,"/api/v1/accounts/verify_credentials",root,function(obj){
accountBusy.running=false;
try{var credentials=JSON.parse(obj);
if (credentials.hasOwnProperty('error')){
if (credentials.hasOwnProperty('error')){print("error "+credentials.error);
Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password or 2FA enabled!"),root)
}
else{
if (users.length==0){Service.setDefaultOptions(db);}
if (userconfig.APIVersion!=""){userconfig.password=""}
if (userconfig.hasOwnProperty("APIVersion")){userconfig.password=""}
if (imagestoredir==""){
imagestoredir=filesystem.homePath+"/"+credentials.username+"/";
userconfig.imagestore=imagestoredir
}
if(userconfig.imagestore == filesystem.homePath+"/"+credentials.username+"/")
{filesystem.makePath(filesystem.homePath+"/"+credentials.username);}
print("imagestoredir "+imagestoredir)
filesystem.Directory=imagestoredir;
filesystem.makeDir("contacts");
filesystem.makeDir("albums");
@ -97,7 +96,7 @@ Page{
Helperjs.showMessage(qsTr("Success"),qsTr("Name")+": "+credentials.display_name+"\nScreen Name: "+credentials.username,root)
rootstackView.pop()
}
}catch(e){Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password or 2FA enabled!"),root)};
}catch(e){Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password or 2FA enabled!"+e),root)};
})
}
@ -212,6 +211,28 @@ Page{
rootstackView.push("qrc:/qml/configqml/InfoBox.qml");
}
}
MButton {
text: "\uf150"
font.family: fontAwesome.name
font.pointSize: osSettings.bigFontSize
Menu {
id:authMethodMenu
width: 10*root.fontFactor*osSettings.systemFontSize
MenuItem {
text: qsTr("OAuth")
font.pointSize: osSettings.systemFontSize
font.bold:accountPage.state=="oauth"
onTriggered: {accountPage.state="oauth"}
}
MenuItem {
text: qsTr("Password")
font.pointSize: osSettings.systemFontSize
font.bold:accountPage.state=="password"
onTriggered: {accountPage.state="password"}
}
}
onClicked: {authMethodMenu.popup()}
}
MButton{
id:closeButton
visible: users.length>0
@ -248,7 +269,7 @@ Page{
MButton{
id:serverSearchButton
width: 3*root.fontFactor*osSettings.bigFontSize; height: 2.5*root.fontFactor*osSettings.bigFontSize
text:"\uf002"
//text:"\uf002"
icon.name: "search"
font.pointSize: osSettings.bigFontSize
visible: servericon.visible?false:true
@ -353,7 +374,7 @@ Page{
TextField {
id: username
width: root.width-5*root.fontFactor*osSettings.bigFontSize
height: servername.height
height: 2.5*root.fontFactor*osSettings.bigFontSize;
Layout.leftMargin: 3*root.fontFactor*osSettings.bigFontSize;
font.pointSize: osSettings.systemFontSize
visible: (osSettings.osType=="Android")?(text!= ""):true
@ -370,6 +391,7 @@ Page{
TextField {
id: password
width: root.width-9*mm; height: 2.5*root.fontFactor*osSettings.bigFontSize;
Layout.leftMargin: 3*root.fontFactor*osSettings.bigFontSize;
font.pointSize: osSettings.systemFontSize
visible: (osSettings.osType=="Android")?(userButton.text!= qsTr("User")):true
selectByMouse: true
@ -469,7 +491,7 @@ Page{
catch(e){print(e)}
}
else if (api=="/api/v1/apps"){print("/api/v1/apps text "+text)
else if (api=="/api/v1/apps"){
let app=JSON.parse(text);
accountPage.appdata=app;
oauth2.setClientId(app.client_id);
@ -546,7 +568,7 @@ Page{
},
State {
name:"oauth"
PropertyChanges {target: username; visible: true}
PropertyChanges {target: username; visible: false}
PropertyChanges {target: password; visible: false}
PropertyChanges {target: confirmationOAuth; visible: true}
PropertyChanges {target: setDefault; visible: true}

View File

@ -33,6 +33,7 @@ import QtQuick 2.11
//import QtQuick.Dialogs 1.2
import QtQuick.Controls 2.12
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/configqml"
import "qrc:/qml/genericqml"
@ -155,10 +156,37 @@ Page{
// }
// }
// }
Column{
visible: osSettings.osType=="Android"
x: root.fontFactor*osSettings.bigFontSize
y: 18*root.fontFactor*osSettings.bigFontSize
Label{
text: qsTr("Default News Tabs")
font.pointSize: osSettings.systemFontSize
}
Repeater{id:newstypeRepeater
model: 4
delegate:ComboBox{
required property int index
model: ["Home", "Replies", "DirectMessages","Favorites","Public Timeline","Notifications"]
currentIndex: model.indexOf(globaloptions.defaultNewsTypes[index])
onCurrentTextChanged: {
if (currentText !== globaloptions.defaultNewsTypes[index]){
globaloptions.defaultNewsTypes.splice(index,1,currentText);
Service.updateglobaloptions(root.db,"defaultNewsTypes",globaloptions.defaultNewsTypes)
root.globaloptionsChanged()
}
}
}
}
}
Column{
//visible: osSettings.osType=="Android"
x: root.fontFactor*osSettings.bigFontSize
y: 26*root.fontFactor*osSettings.bigFontSize
Label{
text: qsTr("Dark Mode")
font.pointSize: osSettings.systemFontSize}
@ -198,38 +226,7 @@ Page{
}
}
Column{
x: root.fontFactor*osSettings.bigFontSize
y: 28*root.fontFactor*osSettings.bigFontSize
Label{
text: qsTr("Toolbar Postion")
font.pointSize: osSettings.systemFontSize}
RadioButton{
text: qsTr("Top")
checked: (globaloptions["toolbarposition"]==0 || globaloptions["toolbarposition"]==undefined)?true:false
font.pointSize: osSettings.bigFontSize
onClicked: {
if(checked==true){
Service.updateglobaloptions(root.db,"roottoolbarposition",0);
globaloptions.toolbarposition=0;
root.roottoolbar.position=ToolBar.Header
}
}
}
RadioButton{
text: qsTr("Bottom")
checked: (globaloptions["toolbarposition"]==1)?true:false
font.pointSize: osSettings.bigFontSize
onClicked: {
if(checked==true){
Service.updateglobaloptions(root.db,"roottoolbarposition",1);
globaloptions.toolbarposition=1;
root.roottoolbar.position=ToolBar.Footer
}
}
}
}
MButton {

View File

@ -91,25 +91,33 @@ ScrollView{
}
}
}
ListModel{id:accountModel}
Component{id:accountLoader
Loader{
source: bar.currentIndex==0?"qrc:/qml/genericqml/DrawerAccountComponent.qml":"qrc:/qml/genericqml/DrawerAccountComponentContacts.qml"
}
}
ListView{
id:accountList
y: 6.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
height: contentHeight
model: accountModel
delegate: accountLoader
}
}
Component.onCompleted:{
Service.readAllLogins(db,function(accounts){
if (accounts.length>0 && bar.currentIndex==0){
leftDrawerColumn.height=4.5*root.fontFactor*osSettings.bigFontSize+accounts.length*17*root.fontFactor*osSettings.bigFontSize
for(var i = 0; i < accounts.length; i++) {
var accountComponent = Qt.createComponent("qrc:/qml/genericqml/DrawerAccountComponent.qml");
var accountQml = accountComponent.createObject(leftDrawerColumn,{
"y":4.5*root.fontFactor*osSettings.bigFontSize+i*17*root.fontFactor*osSettings.bigFontSize,
"currentnewstabstatus":currentnewstabstatus,
"account":accounts[i]});
leftDrawerColumn.height=6.5*root.fontFactor*osSettings.bigFontSize+accounts.length*17*root.fontFactor*osSettings.bigFontSize
for(var account in accounts) {
accountModel.append({"account":accounts[account]})
}
}else if(accounts.length>0 && bar.currentIndex==1){
leftDrawerColumn.height=4.5*root.fontFactor*osSettings.bigFontSize+accounts.length*8*root.fontFactor*osSettings.bigFontSize
for(var i = 0; i < accounts.length; i++) {
var accountComponent = Qt.createComponent("qrc:/qml/genericqml/DrawerAccountComponentContacts.qml");
var accountQml = accountComponent.createObject(leftDrawerColumn,{
"y":4.5*root.fontFactor*osSettings.bigFontSize+i*8*root.fontFactor*osSettings.bigFontSize,
"account":accounts[i]});
leftDrawerColumn.height=6.5*root.fontFactor*osSettings.bigFontSize+accounts.length*8*root.fontFactor*osSettings.bigFontSize
for(var account in accounts) {
accountModel.append({"account":accounts[account]})
}
}
})}

View File

@ -113,10 +113,6 @@ ApplicationWindow{
Service.updateglobaloptions(db,"appWidth",appWidth)
}
}
}
Connections {
target: root
function onHeightChanged(appHeight) {
if(osSettings.osType=="Linux" && Math.abs(appHeight-(globaloptions.appHeight||0))>50){
Service.updateglobaloptions(db,"appHeight",appHeight)
@ -190,7 +186,6 @@ ApplicationWindow{
footer: ToolBar{
id: roottoolbar
//position: ToolBar.Footer//globaloptions.roottoolbarposition==0 || globaloptions.roottoolbarposition==undefined?ToolBar.Header:ToolBar.Footer
width:root.width
background: Rectangle{
anchors.fill: parent
@ -307,7 +302,6 @@ ApplicationWindow{
}
}
Component.onCompleted: {
onLoginChanged(login);
globaloptions=Service.readGO(db);
@ -326,7 +320,6 @@ ApplicationWindow{
var IntentReceiverQml = component.createObject(root);
}
else if (osSettings.osType=="Linux"){
//if (login!=""){newstypeSignal("refresh")}
var component = Qt.createComponent("qrc:/qml/genericqml/LinuxSync.qml");
var LinuxSyncQml = component.createObject(root);
}

View File

@ -34,7 +34,7 @@ Rectangle{
id: blueButton
width: Math.max(mainText.width+2*mm,5*mm)
height: 5*mm
border.color: "light blue"
//border.color: "light blue"
color:"transparent"//"#EFEAEA" "sky blue"
property alias fontColor: mainText.color
border.width:1

View File

@ -32,11 +32,28 @@
import QtQuick 2.15
import QtQuick.Controls 6.3
import "qrc:/qml/genericqml"
import "qrc:/qml/newsqml"
Item {
id: drawerAccountComponent
property var account: ({})
width: parent.width
width: accountList.width
height: 17*root.fontFactor*osSettings.bigFontSize
function changeNews(typeRequest){
newsSwipeview.stacktype=typeRequest;
if (newstabitem.newstypes.indexOf(typeRequest)<0){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsStack.qml");
var newscomp = component.createObject(newsSwipeview,{"expectScreenUpdate":true});
newsSwipeview.addItem(newscomp);
newstabitem.newstypes.push(typeRequest);
newsSwipeview.currentIndex=newsSwipeview.count;
addToolbutton(typeRequest)
newstabbar.currentIndex=newsSwipeview.count
}else{
newsSwipeview.currentIndex=newstabitem.newstypes.indexOf(typeRequest);
newstabbar.currentIndex=newstabitem.newstypes.indexOf(typeRequest);
}
}
Label{
y:0.5*root.fontFactor*osSettings.bigFontSize
@ -58,11 +75,10 @@ Item {
onClicked: {
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
// newstypeSignal("refresh")
newsBusy.running=true;
updatenews.setDatabase();
updatenews.login();
updatenews.startsync();
newstypeSignal("")
// updatenews.setDatabase();
// updatenews.login();
// updatenews.startsync();
}
}
}
@ -72,14 +88,14 @@ Item {
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Timeline"
font.bold: account.username==login.username && newsSwipeview.stacktype=="Home" && newstab.newstabstatus=="Timeline"
text: "\uf1da " + qsTr("Timeline")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=0;
changeNews("Home");
currentnewstabstatus="Timeline";
newstypeSignal("timeline")
}
@ -91,36 +107,34 @@ Item {
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Conversations"
font.bold: account.username==login.username && newsSwipeview.stacktype=="Home" && newstab.newstabstatus=="Conversations"
text: "\uf086 " + qsTr("Conversations")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=0;
changeNews("Home");
currentnewstabstatus="Conversations";
newstypeSignal("conversation")
}
}
}
Label{
y:6.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Replies"
font.bold: account.username==login.username && newsSwipeview.stacktype=="Replies"
text: "\uf0ec " + qsTr("Replies")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=1
currentnewstabstatus="Replies";
changeNews("Replies");
//urrentnewstabstatus="Replies";
newstypeSignal("replies")
}
}
@ -131,32 +145,33 @@ Item {
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="DirectMessages"
font.bold: account.username==login.username && newsSwipeview.stacktype=="DirectMessages"
text: "\uf0e0 " + qsTr("Direct Messages")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=2//newstypeSignal("replies")
currentnewstabstatus="DirectMessages";
changeNews("DirectMessages")
//currentnewstabstatus="DirectMessages";
}
}
}
Label{
y:9.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Favorites"
font.bold: account.username==login.username && newsSwipeview.stacktype=="Favorites"
text: "\uf005 " + qsTr("Favorites")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=0;
currentnewstabstatus="Favorites";
changeNews("Favorites")
//currentnewstabstatus="Favorites";
newstypeSignal("favorites")
}
}
@ -167,14 +182,14 @@ Item {
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Public Timeline"
font.bold: account.username==login.username && newsSwipeview.stacktype=="Public Timeline"
text: "\uf0ac " + qsTr("Public Timeline")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=0;
changeNews("Public Timeline")
currentnewstabstatus="Public Timeline";
newstypeSignal("publictimeline")
}
@ -186,15 +201,14 @@ Item {
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Groupnews"
font.bold: account.username==login.username && newsSwipeview.stacktype=="Groupnews"
text: "\uf0c0 " + qsTr("Group news")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=0;
currentnewstabstatus="Groupnews";
changeNews("Group News")
newstypeSignal("groupnews")
}
}
@ -205,16 +219,19 @@ Item {
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Search"
font.bold: account.username==login.username && newsSwipeview.stacktype=="Search"
text: "\uf002 " + qsTr("Search")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=0;
currentnewstabstatus="Search";
newstypeSignal("search")
// newsSwipeview.currentIndex=0;
// currentnewstabstatus="Search";
// newstypeSignal("search")
var component = Qt.createComponent("qrc:/qml/genericqml/SearchDialog.qml");
var searchItem = component.createObject(newstab,{"selfdestroying":true});
searchItem.open()
}
}
}
@ -224,15 +241,14 @@ Item {
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Notifications"
font.bold: account.username==login.username && newsSwipeview.stacktype=="Notifications"
text: "\uf0f3 " + qsTr("Notifications")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=3;
currentnewstabstatus="Notifications";
changeNews("Notifications")
newstypeSignal("notifications")
}
}

View File

@ -35,11 +35,10 @@ import "qrc:/qml/genericqml"
Item {
id: drawerAccountComponent
property var account: ({})
width: parent.width
width: accountList.width
height: 8*root.fontFactor*osSettings.bigFontSize
Label{
y:0.5*osSettings.bigFontSize
width:parent.width
height: 1.5*root.fontFactor*osSettings.bigFontSize

View File

@ -0,0 +1,78 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2020 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.7
import QtQuick.Controls 2.12
import "qrc:/qml/genericqml"
Dialog {
id: searchDialog
// width: 0.5*parent.width
// height: 0.5*parent.height
anchors.centerIn: parent
title: qsTr("Search")
standardButtons: Dialog.Ok | Dialog.Abort
modal: true
onAccepted: {
}
onRejected: {close()}
property bool selfdestroying:true
/* anchors.left: parent.left
anchors.leftMargin:mm
anchors.top:parent.top
anchors.topMargin: 0.5*mm
width:parent.width-2*mm
height: 4*mm *///Math.max( searchText.contentHeight,5*mm)
TextInput {
id: searchText
color: osSettings.primaryTextColor
focus: true
font.pointSize: osSettings.bigFontSize
wrapMode: Text.Wrap
anchors.fill: parent
selectByMouse: true
cursorVisible: false
onAccepted:{
if (displayText!=""){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsStack.qml");
var newscomp = component.createObject(newsSwipeview,{"expectScreenUpdate":true});
newsSwipeview.addItem(newscomp);
newsSwipeview.currentIndex=newsSwipeview.count;
currentnewstabstatus="Public Timeline";
newscomp.search(displayText)
};
if(selfdestroying){close()}
}
}
Component.onCompleted: searchText.forceActiveFocus()
}

View File

@ -32,7 +32,7 @@
// ConversationView with button
import QtQuick 2.0
import QtQuick.Controls 2.12
import "qrc:/js/helper.js" as Helperjs
//import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
import "qrc:/qml/newsqml"
@ -88,6 +88,17 @@ Page {
return {likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText}
}
function openMessageSend(messageState,newsitemobject){
var parentId=""
var replyUser=""
if(newsitemobject!=""){
parentId=newsitemobject.id
replyUser=newsitemobject.user.screen_name;
}
var messageObject = Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
var messageWindow=messageObject.createObject(root, { parentId: parentId, reply_to_user: replyUser, windowstate: messageState });
messageWindow.show();
}
ListView {
id: conversationView
@ -140,7 +151,6 @@ Page {
width: 2*root.fontFactor*osSettings.bigFontSize;
text: "\uf057"
onClicked: {
//newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
newstab.conversation=[];
if (rootstackView.depth>1){ rootstackView.pop()}
}

View File

@ -46,7 +46,7 @@ import "qrc:/qml/newsqml"
Window{
color: osSettings.backgroundColor
width: parent.width
height: parent.height//messageColumn.height+2*mm
height: 2/3*parent.height//messageColumn.height+2*mm
id: messageSend
property bool wideScreen : width>height
// visible: conversation || (newstab.newstabstatus!="Search")?true:false
@ -391,6 +391,7 @@ Window{
MButton {
id: boldButton
text: "\uf032" // icon-bold
ToolTip.delay: 500
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Bold")
focusPolicy: Qt.NoFocus
@ -406,6 +407,7 @@ Window{
MButton {
id: italicButton
text: "\uf033" // icon-italic
ToolTip.delay: 500
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Italic")
focusPolicy: Qt.NoFocus
@ -418,6 +420,7 @@ Window{
MButton {
id: liststyleButton
text: "\uf03a" // icon-align-justify
ToolTip.delay: 500
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Create list")
// focusPolicy: Qt.NoFocus
@ -428,6 +431,7 @@ Window{
MButton {
id: codeblockButton
text: "\uf121" // icon-code
ToolTip.delay: 500
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Format as code")
// focusPolicy: Qt.NoFocus
@ -438,6 +442,7 @@ Window{
MButton {
id: plainButton
text: bodyField.textFormat==TextEdit.PlainText?qsTr("Rendered"):qsTr("MD") // icon-code
ToolTip.delay: 500
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Show Markdown code")
// focusPolicy: Qt.NoFocus
@ -472,6 +477,7 @@ Window{
MButton{
id:smileyButton
text: "\uf118"
ToolTip.delay: 500
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Insert smiley")
height: 3*root.fontFactor*osSettings.bigFontSize
@ -482,6 +488,7 @@ Window{
MButton{
id:hastagButton
text: "\uf292"
ToolTip.delay: 500
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Insert previous hashtag")
height: 3*root.fontFactor*osSettings.bigFontSize
@ -492,6 +499,7 @@ Window{
id:imagesButton
visible:(newsSwipeview.stacktype!="DirectMessages")
text: "\uf03e"
ToolTip.delay: 500
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Insert images")
height: 3*root.fontFactor*osSettings.bigFontSize
@ -506,6 +514,7 @@ Window{
MButton {
id: cancelButton
ToolTip.delay: 500
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Cancel message")
height: 3*root.fontFactor*osSettings.bigFontSize
@ -515,6 +524,7 @@ Window{
}
MButton {
id: formatButton
ToolTip.delay: 500
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Format message")
height: 3*root.fontFactor*osSettings.bigFontSize
@ -524,6 +534,7 @@ Window{
}
MButton {
id: sendButton
ToolTip.delay: 500
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Send message")
height: 3*root.fontFactor*osSettings.bigFontSize

View File

@ -34,11 +34,12 @@ import QtQuick.Controls 2.12
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/service.js" as Service
import "qrc:/qml/genericqml"
Rectangle{
id: newsStack
width: parent.width
height: parent.height
// width: parent.width
// height: parent.height
color: osSettings.backgroundColor
property string updateMethodNews: "refresh"
property var allchats: ({})
@ -46,92 +47,109 @@ Rectangle{
property string newstabstatus: ""
property bool expectScreenUpdate: false
function newstypeHandling(newstype){
try{newsBusy.running=true}catch(e){print(e)};
root.replySignal("");
switch(newstype){
case "timeline":
newstab.newstabstatus="Timeline";
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews)
})}catch(e){//Helperjs.showMessage("Error",e,root)
};
break;
case "conversation":
newsStack.updateMethodNews="conversation";
newstab.newstabstatus="Conversations";
Newsjs.chatsfromdb(root.db,root.login,0,[],function(news,lastid){
lastnewsid=lastid;
showNews(news)});
break;
case "favorites":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Favorites";
Service.updateView("Favorites");
expectScreenUpdate=true;
break;
case "replies":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Replies";
Service.updateView("Replies");
expectScreenUpdate=true;
break;
case "publictimeline":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Public Timeline";
Service.updateView("Public Timeline");
expectScreenUpdate=true;
break;
case "groupnews":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Groupnews";
Service.showGroups();
expectScreenUpdate=true;
break;
case "search":
newsView.anchors.topMargin=7*mm;
newstab.newstabstatus="Search";
newsBusy.running=false;
var leftoffset=(osSettings.osType=="Android")?2*root.fontFactor*osSettings.bigFontSize:0
var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml");
var searchItem = component.createObject(newsStack,{y:mm,x:leftoffset,width:root.width-(leftoffset+mm),height: 1.5*root.fontFactor*osSettings.systemFontSize,selfdestroying:true});
break;
case "refresh":
if (newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else if (newstab.newstabstatus=="Conversations" || newstabstatus=="Conversations"){
newsStack.updateMethodNews="conversation"}
else {newsStack.updateMethodNews="refresh"}
if (newsSwipeview.stacktype=="Home"){
Service.updateView(newstab.newstabstatus)
function newstypeHandling(newstype){print("newstype "+newstype)
if (!newsBusy.running) {
try{newsBusy.running=true}catch(e){print(e)};
//root.replySignal("");
switch(newstype){
case "timeline":
newstab.newstabstatus="Timeline";
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews)
})}catch(e){//Helperjs.showMessage("Error",e,root)
};
break;
case "conversation":
newsStack.updateMethodNews="conversation";
newstab.newstabstatus="Conversations";
Newsjs.chatsfromdb(root.db,root.login,0,[],function(news,lastid){
lastnewsid=lastid;
showNews(news)});
break;
case "favorites":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Favorites";
Service.updateView("Favorites");
expectScreenUpdate=true;
break;
case "replies":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Replies";
Service.updateView("Replies");
expectScreenUpdate=true;
break;
case "publictimeline":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Public Timeline";
Service.updateView("Public Timeline");
expectScreenUpdate=true;
break;
case "groupnews":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Groupnews";
Service.showGroups();
expectScreenUpdate=true;
break;
case "search":
newsView.anchors.topMargin=7*mm;
newstab.newstabstatus="Search";
newsBusy.running=false;
var leftoffset=(osSettings.osType=="Android")?2*root.fontFactor*osSettings.bigFontSize:0
var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml");
var searchItem = component.createObject(newsStack,{y:mm,x:leftoffset,width:root.width-(leftoffset+mm),height: 1.5*root.fontFactor*osSettings.systemFontSize,selfdestroying:true});
break;
case "refresh":
if (newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else if (newstab.newstabstatus=="Conversations" || newstabstatus=="Conversations"){
newsStack.updateMethodNews="conversation"}
else {newsStack.updateMethodNews="refresh"}
//root.contactLoadType="news";
if (newsSwipeview.stacktype=="Home"){
Service.updateView(newstab.newstabstatus,lastnewsid)
}
else if (newsSwipeview.stacktype=="Directmessage"){
Service.updateView("Direct Messages",lastnewsid)
}
else if (newsSwipeview.stacktype=="Notifications"){
Service.updateView("Notifications")
}
expectScreenUpdate=true;
break;
default:
if (newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else if (newstab.newstabstatus=="Conversations" || newstabstatus=="Conversations"){
newsStack.updateMethodNews="conversation"}
else {newsStack.updateMethodNews="refresh"}
//root.contactLo