Dynamic news tabs
This commit is contained in:
parent
2debd8f2ab
commit
3c1c97d489
|
@ -1 +0,0 @@
|
|||
../source-linux/application.qrc
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/alarm.h
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/alarmandroid.cpp
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/alarmlinux.cpp
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/filesystem.cpp
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/filesystem.h
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/filesystemandroid.cpp
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/oauth.cpp
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/oauth.h
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/remoteauthasyncimageprovider.cpp
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/remoteauthasyncimageprovider.h
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/updatenews.cpp
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/updatenews.h
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/uploadableimage.cpp
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/uploadableimage.h
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/xhr.cpp
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/common/xhr.h
|
|
@ -1 +0,0 @@
|
|||
../source-linux/images
|
|
@ -1 +0,0 @@
|
|||
../source-linux/js
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/qml/calendarqml
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/qml/configqml
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/qml/contactqml
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/qml/genericqml
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/qml/newsqml
|
|
@ -1 +0,0 @@
|
|||
../../source-linux/qml/photoqml
|
|
@ -1 +0,0 @@
|
|||
../source-linux/qtquickcontrols2.conf
|
|
@ -1 +0,0 @@
|
|||
../source-linux/translations
|
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,9 +185,19 @@ 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++){
|
||||
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]);
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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]})
|
||||
}
|
||||
}
|
||||
})}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
78
source-linux/qml/genericqml/SearchDialog.qml
Normal file
78
source-linux/qml/genericqml/SearchDialog.qml
Normal 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()
|
||||
}
|
|
@ -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()}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,9 +47,10 @@ Rectangle{
|
|||
property string newstabstatus: ""
|
||||
property bool expectScreenUpdate: false
|
||||
|
||||
function newstypeHandling(newstype){
|
||||
function newstypeHandling(newstype){print("newstype "+newstype)
|
||||
if (!newsBusy.running) {
|
||||
try{newsBusy.running=true}catch(e){print(e)};
|
||||
root.replySignal("");
|
||||
//root.replySignal("");
|
||||
switch(newstype){
|
||||
case "timeline":
|
||||
newstab.newstabstatus="Timeline";
|
||||
|
@ -103,12 +105,12 @@ Rectangle{
|
|||
} 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)
|
||||
Service.updateView(newstab.newstabstatus,lastnewsid)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="DirectMessage"){
|
||||
Service.updateView("Direct Messages")
|
||||
else if (newsSwipeview.stacktype=="Directmessage"){
|
||||
Service.updateView("Direct Messages",lastnewsid)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Notifications"){
|
||||
Service.updateView("Notifications")
|
||||
|
@ -123,17 +125,33 @@ Rectangle{
|
|||
else {newsStack.updateMethodNews="refresh"}
|
||||
//root.contactLoadType="news";
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
Service.updateView(newstab.newstabstatus,lastnewsid)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Directmessage"){
|
||||
Service.updateView("Direct Messages")
|
||||
Service.updateView("Direct Messages",lastnewsid)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Notifications"){
|
||||
Service.updateView("Notifications")
|
||||
Service.updateView("Notifications",lastnewsid)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Favorites"){
|
||||
Service.updateView("Favorites",lastnewsid)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Replies"){
|
||||
Service.updateView("Replies",lastnewsid)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Public Timeline"){
|
||||
Service.updateView("Public Timeline",lastnewsid)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Search"){
|
||||
Service.updateView("Search",lastnewsid)
|
||||
}
|
||||
else{
|
||||
Service.updateView(newstab.newstabstatus,lastnewsid)
|
||||
}
|
||||
expectScreenUpdate=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showNews(newsToShow){
|
||||
try{if (rootstackView.depth>1){rootstackView.pop()}}catch(e){}
|
||||
|
@ -161,7 +179,7 @@ Rectangle{
|
|||
newsView.anchors.topMargin=mm
|
||||
}
|
||||
|
||||
function getOldNews(){
|
||||
function getOldNews(){print("getoldnews")
|
||||
var currentTime= new Date();
|
||||
|
||||
try{var oldnewsitemobject=newsModel.get(newsModel.count-1).newsitemobject;
|
||||
|
@ -199,13 +217,13 @@ Rectangle{
|
|||
|
||||
else if (newstab.newstabstatus=="Notifications" || newstabstatus=="Notifications"){}
|
||||
else{
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
case "Notifications":messagetype=2;break;
|
||||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
// switch(newsSwipeview.stacktype){
|
||||
// case "Home":messagetype=0;break;
|
||||
// case "DirectMessages": messagetype=1;break;
|
||||
// case "Notifications":messagetype=2;break;
|
||||
// case "Replies":messagetype=3;break;
|
||||
// default:messagetype=0;
|
||||
// }
|
||||
|
||||
try{xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);}catch(e){}
|
||||
xhr.get()
|
||||
|
@ -215,20 +233,24 @@ Rectangle{
|
|||
|
||||
|
||||
function loadDBNews(){
|
||||
var messagetype=0;
|
||||
var messagetype=99;
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
case "Notifications":messagetype=2;break;
|
||||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
default:messagetype=99;
|
||||
}
|
||||
print("messagetype " + messagetype);
|
||||
if((newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
|
||||
Newsjs.chatsfromdb(db,login,messagetype,[],function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews);
|
||||
})
|
||||
}
|
||||
else if (messagetype==99){
|
||||
newstypeHandling()
|
||||
}
|
||||
else{
|
||||
Newsjs.newsfromdb(db,login,messagetype,function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
|
@ -243,7 +265,7 @@ Rectangle{
|
|||
newsBusy.running=false;
|
||||
expectScreenUpdate=false;
|
||||
}
|
||||
function onSuccess(data,api){
|
||||
function onSuccess(data,api){print("newsstack api "+api);
|
||||
const newsApiArray=["/api/statuses/friends_timeline",
|
||||
"/api/direct_messages/all",
|
||||
"/api/direct_messages/conversation",
|
||||
|
@ -262,8 +284,7 @@ Rectangle{
|
|||
if(newsApiArray.includes(api) && expectScreenUpdate==true){
|
||||
expectScreenUpdate=false;
|
||||
Service.processNews(api,data)
|
||||
root.replySignal("")
|
||||
expectScreenUpdate=false;
|
||||
//root.replySignal("")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +303,7 @@ Rectangle{
|
|||
}
|
||||
|
||||
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
||||
onTriggered: {
|
||||
onTriggered: {print("replytimer")
|
||||
newsBusy.running=true;
|
||||
if(newstab.newstabstatus=="Conversation"){
|
||||
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
|
||||
|
@ -344,6 +365,17 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
|
||||
BusyIndicator{
|
||||
id: newsBusy
|
||||
anchors.horizontalCenter: newsStack.horizontalCenter
|
||||
anchors.top:parent.top
|
||||
anchors.topMargin: mm
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
z:2
|
||||
running: false
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: newsView
|
||||
property real oldContentY:0
|
||||
|
@ -450,6 +482,33 @@ Rectangle{
|
|||
source: "qrc:/js/newsworker.js"
|
||||
}
|
||||
|
||||
Text {
|
||||
id: closeButton
|
||||
//Svisible: !(globaloptions.defaultNewsTypes.indexOf(newsSwipeview.stacktype)>-1)
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
width: root.fontFactor*osSettings.bigFontSize*2
|
||||
height: root.fontFactor*osSettings.bigFontSize*2
|
||||
font.bold: true
|
||||
font.family: fontAwesome.name
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
HoverHandler{id:closehover}
|
||||
ToolTip.visible: closehover.hovered
|
||||
ToolTip.text: qsTr("Close this timeline")
|
||||
text: "\uf057"
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
newstabitem.newstypes.splice(newsSwipeview.currentIndex,1)
|
||||
newstabbar.removeItem(newstabbar.contentChildren[newstabbar.currentIndex]);
|
||||
newstabbar.currentIndex=0;
|
||||
newsSwipeview.removeItem(newsStack)
|
||||
newsSwipeview.currentIndex=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id:downloadNotice
|
||||
|
@ -476,6 +535,7 @@ Rectangle{
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
print("globaloptions.defaultNewsTypes.indexOf(newsSwipeview.stacktype)>-1 " +(globaloptions.defaultNewsTypes.indexOf(newsSwipeview.stacktype)>-1))
|
||||
root.newstypeSignal.connect(newstypeHandling);
|
||||
root.contactdetailsSignal.connect(showContact);
|
||||
root.newsSignal.connect(showNews);
|
||||
|
|
|
@ -41,6 +41,7 @@ Page{
|
|||
id:newstabitem
|
||||
width:rootstack.width
|
||||
height: rootstack.height
|
||||
property var newstypes: globaloptions.hasOwnProperty("defaultNewsTypes")?globaloptions.defaultNewsTypes:["Home","Replies","DirectMessages","Notifications"]
|
||||
|
||||
Timer {id:contacttimer; interval: 50; running: false; repeat: false
|
||||
onTriggered: {
|
||||
|
@ -126,6 +127,24 @@ Page{
|
|||
messageWindow.show();
|
||||
}
|
||||
|
||||
function getIcon(typerequest){
|
||||
switch (typerequest){
|
||||
case "Home": return "\uf015"
|
||||
case "Favorites": return "\uf005";
|
||||
case "Replies": return "\uf0ec";
|
||||
case "DirectMessages": return "\uf0e0";
|
||||
case "Public Timeline": return "\uf0ac";
|
||||
case "Group News": return "\uf0c0";
|
||||
case "Search": return "\uf002";
|
||||
case "Notifications": return "\uf0f3";
|
||||
}
|
||||
}
|
||||
|
||||
function addToolbutton(buttontype){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsTabbutton.qml");
|
||||
var tabcomp = component.createObject(newstabbar,{"buttontype":buttontype});
|
||||
newstabbar.addItem(tabcomp);
|
||||
}
|
||||
// CalendarTab{
|
||||
// visible: wideScreen&&rootstackView.depth<2
|
||||
// width: newstabitem.width/3
|
||||
|
@ -140,7 +159,7 @@ Page{
|
|||
// anchors.left: newsSwipeview.right
|
||||
// }
|
||||
|
||||
MessageSend{}
|
||||
//MessageSend{}
|
||||
|
||||
BlueButton{
|
||||
z:2
|
||||
|
@ -184,64 +203,13 @@ Page{
|
|||
id: newstabbar
|
||||
x: leftDrawer.width
|
||||
width: newsSwipeview.width
|
||||
height: contentHeight+2
|
||||
spacing: 1
|
||||
position: TabBar.Header
|
||||
onCurrentIndexChanged: {
|
||||
newsSwipeview.currentIndex=newstabbar.currentIndex;
|
||||
}
|
||||
TabButton {
|
||||
font.family: fontAwesome.name
|
||||
font.pointSize : osSettings.bigFontSize
|
||||
width: newstabbar.width/5
|
||||
text: "\uf015"
|
||||
background:Rectangle{
|
||||
anchors.fill: parent
|
||||
color: osSettings.backgroundDimColor
|
||||
border.color: newsSwipeview.currentIndex==0?osSettings.accentColor:color
|
||||
}
|
||||
ToolTip.visible: pressed || hovered
|
||||
ToolTip.text: qsTr("Home")
|
||||
onDoubleClicked: {newstypeSignal("refresh")}
|
||||
}
|
||||
TabButton {
|
||||
font.family: fontAwesome.name
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
width: newstabbar.width/5
|
||||
text: "\uf0ec"
|
||||
background:Rectangle{
|
||||
anchors.fill: parent
|
||||
color: osSettings.backgroundDimColor
|
||||
border.color: newsSwipeview.currentIndex==1?osSettings.accentColor:color
|
||||
}
|
||||
ToolTip.visible: pressed || hovered
|
||||
ToolTip.text: qsTr("Replies")
|
||||
}
|
||||
TabButton {
|
||||
font.family: fontAwesome.name
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
width: newstabbar.width/5
|
||||
text: "\uf0e0"
|
||||
background:Rectangle{
|
||||
anchors.fill: parent
|
||||
color: osSettings.backgroundDimColor
|
||||
border.color: newsSwipeview.currentIndex==2?osSettings.accentColor:color
|
||||
}
|
||||
ToolTip.visible: pressed || hovered
|
||||
ToolTip.text: qsTr("Direct Messages")
|
||||
}
|
||||
TabButton {
|
||||
font.family: fontAwesome.name
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
width: newstabbar.width/5
|
||||
text: "\uf0f3"
|
||||
background:Rectangle{
|
||||
anchors.fill: parent
|
||||
color: osSettings.backgroundDimColor
|
||||
border.color: newsSwipeview.currentIndex==3?osSettings.accentColor:color
|
||||
}
|
||||
ToolTip.visible: pressed || hovered
|
||||
ToolTip.text: qsTr("Notifications")
|
||||
}
|
||||
clip: true
|
||||
}
|
||||
|
||||
SwipeView{
|
||||
|
@ -255,38 +223,22 @@ Page{
|
|||
function onDirectMessage(friend){currentIndex=2}
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
switch(currentIndex){
|
||||
case 0: stacktype="Home";break;
|
||||
case 1: stacktype="Replies";break;
|
||||
case 2: stacktype="DirectMessages";break;
|
||||
case 3: stacktype="Notifications";break;
|
||||
default: stacktype="Home";
|
||||
}
|
||||
if(newstypes[currentIndex]){stacktype=newstypes[currentIndex]}
|
||||
else{stacktype="Home"}
|
||||
}
|
||||
|
||||
//anchors.fill: parent
|
||||
Loader{
|
||||
id: friendstimeline
|
||||
source:(newsSwipeview.currentIndex==0)? "qrc:/qml/newsqml/NewsStack.qml":""
|
||||
//onLoaded: newsSwipeview.stacktype="Home"
|
||||
}
|
||||
Loader{
|
||||
id: replies
|
||||
//property string stacktype:"Replies"
|
||||
source:(newsSwipeview.currentIndex==1)? "qrc:/qml/newsqml/NewsStack.qml":""
|
||||
//onLoaded: newsSwipeview.stacktype="Replies"
|
||||
}
|
||||
Loader{
|
||||
id: directmessages
|
||||
property var friend:({})
|
||||
//property var friend:({})
|
||||
source:(newsSwipeview.currentIndex==2)? "qrc:/qml/newsqml/NewsStack.qml":""
|
||||
//onLoaded: newsSwipeview.stacktype="DirectMessages"
|
||||
}
|
||||
Loader{
|
||||
id: notifications
|
||||
//property string stacktype:"Notifications"
|
||||
source:(newsSwipeview.currentIndex==3)? "qrc:/qml/newsqml/NewsStack.qml":""
|
||||
//onLoaded: newsSwipeview.stacktype="Notifications"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,16 +253,20 @@ Page{
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
BusyIndicator{
|
||||
id: newsBusy
|
||||
anchors.horizontalCenter: newsSwipeview.horizontalCenter
|
||||
anchors.top:parent.top
|
||||
anchors.topMargin: mm
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
z:2
|
||||
running: false
|
||||
Connections{
|
||||
target: root
|
||||
function onGlobaloptionsChanged(){
|
||||
newstypes=globaloptions.defaultNewsTypes;
|
||||
while (newstabbar.count>0){
|
||||
newstabbar.removeItem(newstabbar.contentData[0]);
|
||||
}
|
||||
for (let view in newstypes){
|
||||
addToolbutton(newstypes[view])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {root.directmessageSignal.connect(newsSwipeview.onDirectMessage)}
|
||||
Component.onCompleted: {
|
||||
root.directmessageSignal.connect(newsSwipeview.onDirectMessage)
|
||||
}
|
||||
}
|
||||
|
|
51
source-linux/qml/newsqml/NewsTabbutton.qml
Normal file
51
source-linux/qml/newsqml/NewsTabbutton.qml
Normal file
|
@ -0,0 +1,51 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/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.15
|
||||
import QtQuick.Controls 6.3
|
||||
|
||||
TabButton {
|
||||
id: tabbutton
|
||||
font.family: fontAwesome.name
|
||||
font.pointSize : osSettings.bigFontSize
|
||||
width: newstabbar.width/5
|
||||
property string buttontype: ""
|
||||
text: getIcon(buttontype)
|
||||
background:Rectangle{
|
||||
anchors.fill: parent
|
||||
color: osSettings.backgroundDimColor
|
||||
border.color: newstypes[newsSwipeview.currentIndex]==buttontype?osSettings.accentColor:color
|
||||
}
|
||||
ToolTip.delay: 500
|
||||
ToolTip.visible: pressed || hovered
|
||||
ToolTip.text: qsTr(buttontype)
|
||||
onDoubleClicked: {newstypeSignal(buttontype)}
|
||||
}
|
Loading…
Reference in a new issue