diff --git a/source-android/application.qrc b/source-android/application.qrc
deleted file mode 120000
index 4607047..0000000
--- a/source-android/application.qrc
+++ /dev/null
@@ -1 +0,0 @@
-../source-linux/application.qrc
\ No newline at end of file
diff --git a/source-android/common/alarm.h b/source-android/common/alarm.h
deleted file mode 120000
index b5e49ca..0000000
--- a/source-android/common/alarm.h
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/alarm.h
\ No newline at end of file
diff --git a/source-android/common/alarmandroid.cpp b/source-android/common/alarmandroid.cpp
deleted file mode 120000
index adb6cb0..0000000
--- a/source-android/common/alarmandroid.cpp
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/alarmandroid.cpp
\ No newline at end of file
diff --git a/source-android/common/alarmlinux.cpp b/source-android/common/alarmlinux.cpp
deleted file mode 120000
index af9de81..0000000
--- a/source-android/common/alarmlinux.cpp
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/alarmlinux.cpp
\ No newline at end of file
diff --git a/source-android/common/filesystem.cpp b/source-android/common/filesystem.cpp
deleted file mode 120000
index 94a7237..0000000
--- a/source-android/common/filesystem.cpp
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/filesystem.cpp
\ No newline at end of file
diff --git a/source-android/common/filesystem.h b/source-android/common/filesystem.h
deleted file mode 120000
index 0ee6500..0000000
--- a/source-android/common/filesystem.h
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/filesystem.h
\ No newline at end of file
diff --git a/source-android/common/filesystemandroid.cpp b/source-android/common/filesystemandroid.cpp
deleted file mode 120000
index dbfaf68..0000000
--- a/source-android/common/filesystemandroid.cpp
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/filesystemandroid.cpp
\ No newline at end of file
diff --git a/source-android/common/oauth.cpp b/source-android/common/oauth.cpp
deleted file mode 120000
index 7e5af5f..0000000
--- a/source-android/common/oauth.cpp
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/oauth.cpp
\ No newline at end of file
diff --git a/source-android/common/oauth.h b/source-android/common/oauth.h
deleted file mode 120000
index 607b211..0000000
--- a/source-android/common/oauth.h
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/oauth.h
\ No newline at end of file
diff --git a/source-android/common/remoteauthasyncimageprovider.cpp b/source-android/common/remoteauthasyncimageprovider.cpp
deleted file mode 120000
index e13424b..0000000
--- a/source-android/common/remoteauthasyncimageprovider.cpp
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/remoteauthasyncimageprovider.cpp
\ No newline at end of file
diff --git a/source-android/common/remoteauthasyncimageprovider.h b/source-android/common/remoteauthasyncimageprovider.h
deleted file mode 120000
index 9a79dbe..0000000
--- a/source-android/common/remoteauthasyncimageprovider.h
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/remoteauthasyncimageprovider.h
\ No newline at end of file
diff --git a/source-android/common/updatenews.cpp b/source-android/common/updatenews.cpp
deleted file mode 120000
index 4d79e7e..0000000
--- a/source-android/common/updatenews.cpp
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/updatenews.cpp
\ No newline at end of file
diff --git a/source-android/common/updatenews.h b/source-android/common/updatenews.h
deleted file mode 120000
index f506bd0..0000000
--- a/source-android/common/updatenews.h
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/updatenews.h
\ No newline at end of file
diff --git a/source-android/common/uploadableimage.cpp b/source-android/common/uploadableimage.cpp
deleted file mode 120000
index 069ff8f..0000000
--- a/source-android/common/uploadableimage.cpp
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/uploadableimage.cpp
\ No newline at end of file
diff --git a/source-android/common/uploadableimage.h b/source-android/common/uploadableimage.h
deleted file mode 120000
index 32396a1..0000000
--- a/source-android/common/uploadableimage.h
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/uploadableimage.h
\ No newline at end of file
diff --git a/source-android/common/xhr.cpp b/source-android/common/xhr.cpp
deleted file mode 120000
index 660c2c7..0000000
--- a/source-android/common/xhr.cpp
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/xhr.cpp
\ No newline at end of file
diff --git a/source-android/common/xhr.h b/source-android/common/xhr.h
deleted file mode 120000
index d383456..0000000
--- a/source-android/common/xhr.h
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/common/xhr.h
\ No newline at end of file
diff --git a/source-android/images b/source-android/images
deleted file mode 120000
index f6e087d..0000000
--- a/source-android/images
+++ /dev/null
@@ -1 +0,0 @@
-../source-linux/images
\ No newline at end of file
diff --git a/source-android/js b/source-android/js
deleted file mode 120000
index d7539d8..0000000
--- a/source-android/js
+++ /dev/null
@@ -1 +0,0 @@
-../source-linux/js
\ No newline at end of file
diff --git a/source-android/qml/calendarqml b/source-android/qml/calendarqml
deleted file mode 120000
index efa5132..0000000
--- a/source-android/qml/calendarqml
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/qml/calendarqml
\ No newline at end of file
diff --git a/source-android/qml/configqml b/source-android/qml/configqml
deleted file mode 120000
index 1d9fc92..0000000
--- a/source-android/qml/configqml
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/qml/configqml
\ No newline at end of file
diff --git a/source-android/qml/contactqml b/source-android/qml/contactqml
deleted file mode 120000
index 3e93dac..0000000
--- a/source-android/qml/contactqml
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/qml/contactqml
\ No newline at end of file
diff --git a/source-android/qml/genericqml b/source-android/qml/genericqml
deleted file mode 120000
index 5fdbcc3..0000000
--- a/source-android/qml/genericqml
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/qml/genericqml
\ No newline at end of file
diff --git a/source-android/qml/newsqml b/source-android/qml/newsqml
deleted file mode 120000
index f6ab73f..0000000
--- a/source-android/qml/newsqml
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/qml/newsqml
\ No newline at end of file
diff --git a/source-android/qml/photoqml b/source-android/qml/photoqml
deleted file mode 120000
index 4528ee0..0000000
--- a/source-android/qml/photoqml
+++ /dev/null
@@ -1 +0,0 @@
-../../source-linux/qml/photoqml
\ No newline at end of file
diff --git a/source-android/qtquickcontrols2.conf b/source-android/qtquickcontrols2.conf
deleted file mode 120000
index 4fb6470..0000000
--- a/source-android/qtquickcontrols2.conf
+++ /dev/null
@@ -1 +0,0 @@
-../source-linux/qtquickcontrols2.conf
\ No newline at end of file
diff --git a/source-android/translations b/source-android/translations
deleted file mode 120000
index d630c0b..0000000
--- a/source-android/translations
+++ /dev/null
@@ -1 +0,0 @@
-../source-linux/translations
\ No newline at end of file
diff --git a/source-linux/application.qrc b/source-linux/application.qrc
index 4d944a4..ad823aa 100644
--- a/source-linux/application.qrc
+++ b/source-linux/application.qrc
@@ -256,5 +256,7 @@
qml/configqml/AcceptRules.qml
translations/friendiqa-nl.qm
translations/friendiqa-nl.ts
+ qml/genericqml/SearchDialog.qml
+ qml/newsqml/NewsTabbutton.qml
diff --git a/source-linux/common/xhr.cpp b/source-linux/common/xhr.cpp
index adaba69..42042e3 100644
--- a/source-linux/common/xhr.cpp
+++ b/source-linux/common/xhr.cpp
@@ -233,10 +233,11 @@ void XHR::download()
void XHR::get()
{
QUrlQuery query;
-
+ qDebug() << "get";
QHashIterator 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 i(params);
+ while(i.hasNext()) {
+ i.next();
+ qDebug() << i.key()<< " " << i.value();
+ }
emit this->success(buffer, m_api);
buffer.clear();
// reply->deleteLater();
diff --git a/source-linux/js/service.js b/source-linux/js/service.js
index bab8db9..daf7fac 100644
--- a/source-linux/js/service.js
+++ b/source-linux/js/service.js
@@ -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 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]);
diff --git a/source-linux/qml/configqml/AccountPage.qml b/source-linux/qml/configqml/AccountPage.qml
index d076d37..886d1f3 100644
--- a/source-linux/qml/configqml/AccountPage.qml
+++ b/source-linux/qml/configqml/AccountPage.qml
@@ -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}
diff --git a/source-linux/qml/configqml/ConfigAppearancePage.qml b/source-linux/qml/configqml/ConfigAppearancePage.qml
index c6a0ee0..a758a2f 100644
--- a/source-linux/qml/configqml/ConfigAppearancePage.qml
+++ b/source-linux/qml/configqml/ConfigAppearancePage.qml
@@ -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 {
diff --git a/source-linux/qml/configqml/LeftDrawerScrollview.qml b/source-linux/qml/configqml/LeftDrawerScrollview.qml
index 674f8db..cd635d2 100644
--- a/source-linux/qml/configqml/LeftDrawerScrollview.qml
+++ b/source-linux/qml/configqml/LeftDrawerScrollview.qml
@@ -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]})
}
}
})}
diff --git a/source-linux/qml/friendiqa.qml b/source-linux/qml/friendiqa.qml
index c47c75c..8dc4ca3 100644
--- a/source-linux/qml/friendiqa.qml
+++ b/source-linux/qml/friendiqa.qml
@@ -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);
}
diff --git a/source-linux/qml/genericqml/BlueButton.qml b/source-linux/qml/genericqml/BlueButton.qml
index b1bc5f0..2375717 100644
--- a/source-linux/qml/genericqml/BlueButton.qml
+++ b/source-linux/qml/genericqml/BlueButton.qml
@@ -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
diff --git a/source-linux/qml/genericqml/DrawerAccountComponent.qml b/source-linux/qml/genericqml/DrawerAccountComponent.qml
index a8c9f1a..3833bd2 100644
--- a/source-linux/qml/genericqml/DrawerAccountComponent.qml
+++ b/source-linux/qml/genericqml/DrawerAccountComponent.qml
@@ -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")
}
}
diff --git a/source-linux/qml/genericqml/DrawerAccountComponentContacts.qml b/source-linux/qml/genericqml/DrawerAccountComponentContacts.qml
index d5f4f7e..3f8018c 100644
--- a/source-linux/qml/genericqml/DrawerAccountComponentContacts.qml
+++ b/source-linux/qml/genericqml/DrawerAccountComponentContacts.qml
@@ -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
diff --git a/source-linux/qml/genericqml/SearchDialog.qml b/source-linux/qml/genericqml/SearchDialog.qml
new file mode 100644
index 0000000..8a57e30
--- /dev/null
+++ b/source-linux/qml/genericqml/SearchDialog.qml
@@ -0,0 +1,78 @@
+// This file is part of Friendiqa
+// https://github.com/lubuwest/Friendiqa
+// Copyright (C) 2020 Marco R.
+//
+// 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 .
+
+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()
+}
diff --git a/source-linux/qml/newsqml/Conversation.qml b/source-linux/qml/newsqml/Conversation.qml
index c51dccb..5104c4c 100644
--- a/source-linux/qml/newsqml/Conversation.qml
+++ b/source-linux/qml/newsqml/Conversation.qml
@@ -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()}
}
diff --git a/source-linux/qml/newsqml/MessageSend.qml b/source-linux/qml/newsqml/MessageSend.qml
index 6b7ca44..96988e2 100644
--- a/source-linux/qml/newsqml/MessageSend.qml
+++ b/source-linux/qml/newsqml/MessageSend.qml
@@ -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
diff --git a/source-linux/qml/newsqml/NewsStack.qml b/source-linux/qml/newsqml/NewsStack.qml
index 906dcf5..7781190 100644
--- a/source-linux/qml/newsqml/NewsStack.qml
+++ b/source-linux/qml/newsqml/NewsStack.qml
@@ -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.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",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;
}
- else if (newsSwipeview.stacktype=="DirectMessage"){
- Service.updateView("Direct Messages")
- }
- 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.contactLoadType="news";
- if (newsSwipeview.stacktype=="Home"){
- Service.updateView(newstab.newstabstatus)
- }
- else if (newsSwipeview.stacktype=="Directmessage"){
- Service.updateView("Direct Messages")
- }
- else if (newsSwipeview.stacktype=="Notifications"){
- Service.updateView("Notifications")
- }
- expectScreenUpdate=true;
}
}
@@ -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",
@@ -258,12 +280,11 @@ Rectangle{
"/api/lists/statuses",
"/api/statuses/update",
"/api/direct_messages/new"
- ];
+ ];
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);
diff --git a/source-linux/qml/newsqml/NewsTab.qml b/source-linux/qml/newsqml/NewsTab.qml
index 45e61c1..65a92db 100644
--- a/source-linux/qml/newsqml/NewsTab.qml
+++ b/source-linux/qml/newsqml/NewsTab.qml
@@ -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)
+ }
}
diff --git a/source-linux/qml/newsqml/NewsTabbutton.qml b/source-linux/qml/newsqml/NewsTabbutton.qml
new file mode 100644
index 0000000..cbde67c
--- /dev/null
+++ b/source-linux/qml/newsqml/NewsTabbutton.qml
@@ -0,0 +1,51 @@
+// This file is part of Friendiqa
+// https://git.friendi.ca/lubuwest/Friendiqa
+// Copyright (C) 2020 Marco R.
+//
+// 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 .
+
+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)}
+}