Browse Source

Version 0.004

pull/2/head
LubuWest 5 years ago
parent
commit
438f8a4e4d
  1. 30
      CHANGELOG.md
  2. BIN
      Friendiqa.apk
  3. 80
      README.md
  4. BIN
      Screenshots/ConfigTab.jpg
  5. BIN
      Screenshots/EventsTab.jpg
  6. BIN
      Screenshots/FriendsTab.jpg
  7. BIN
      Screenshots/NewsTab.jpg
  8. BIN
      Screenshots/PhotoTab.jpg
  9. 4
      source-android/android/AndroidManifest.xml
  10. BIN
      source-android/android/res/drawable-hdpi/friendiqa.png
  11. BIN
      source-android/android/res/drawable-ldpi/friendiqa.png
  12. BIN
      source-android/android/res/drawable-mdpi/friendiqa.png
  13. BIN
      source-android/android/res/drawable-xhdpi/friendiqa.png
  14. BIN
      source-android/android/res/drawable-xxhdpi/friendiqa.png
  15. BIN
      source-android/android/res/drawable-xxxhdpi/friendiqa.png
  16. 12
      source-android/application.qrc
  17. 4
      source-android/common/friendiqa.cpp
  18. 15
      source-android/js/helper.js
  19. 23
      source-android/js/news.js
  20. 14
      source-android/js/newsworker.js
  21. 112
      source-android/js/service.js
  22. 47
      source-android/qml/calendarqml/CalendarDay.qml
  23. 134
      source-android/qml/calendarqml/CalendarTab.qml
  24. 85
      source-android/qml/calendarqml/EventList.qml
  25. 71
      source-android/qml/configqml/ConfigTab.qml
  26. 29
      source-android/qml/contactqml/ContactComponent.qml
  27. 57
      source-android/qml/contactqml/ContactDetailsComponent.qml
  28. 91
      source-android/qml/contactqml/ContactDetailsComponentOld.qml
  29. 37
      source-android/qml/contactqml/FriendsTab.qml
  30. 24
      source-android/qml/friendiqa.qml
  31. 103
      source-android/qml/newsqml/Conversation.qml
  32. 8
      source-android/qml/newsqml/ImageDialog.qml
  33. 37
      source-android/qml/newsqml/MessageSend.qml
  34. 170
      source-android/qml/newsqml/NewsTab.qml
  35. 112
      source-android/qml/newsqml/Newsitem.qml
  36. 4
      source-android/qml/newsqml/PermissionDialog.qml
  37. 4
      source-android/qml/photoqml/PhotoTab.qml
  38. BIN
      source-android/translations/friendiqa-de.qm
  39. 470
      source-android/translations/friendiqa-de.ts
  40. 12
      source-linux/application.qrc
  41. 4
      source-linux/common/friendiqa.cpp
  42. 19
      source-linux/common/xhr.cpp
  43. 4
      source-linux/friendiqa.pro
  44. 15
      source-linux/js/helper.js
  45. 23
      source-linux/js/news.js
  46. 14
      source-linux/js/newsworker.js
  47. 112
      source-linux/js/service.js
  48. 47
      source-linux/qml/calendarqml/CalendarDay.qml
  49. 134
      source-linux/qml/calendarqml/CalendarTab.qml
  50. 85
      source-linux/qml/calendarqml/EventList.qml
  51. 71
      source-linux/qml/configqml/ConfigTab.qml
  52. 29
      source-linux/qml/contactqml/ContactComponent.qml
  53. 57
      source-linux/qml/contactqml/ContactDetailsComponent.qml
  54. 37
      source-linux/qml/contactqml/FriendsTab.qml
  55. 24
      source-linux/qml/friendiqa.qml
  56. 103
      source-linux/qml/newsqml/Conversation.qml
  57. 8
      source-linux/qml/newsqml/ImageDialog.qml
  58. 37
      source-linux/qml/newsqml/MessageSend.qml
  59. 170
      source-linux/qml/newsqml/NewsTab.qml
  60. 112
      source-linux/qml/newsqml/Newsitem.qml
  61. 4
      source-linux/qml/newsqml/PermissionDialog.qml
  62. 4
      source-linux/qml/photoqml/PhotoTab.qml
  63. BIN
      source-linux/translations/friendiqa-de.qm
  64. 470
      source-linux/translations/friendiqa-de.ts

30
CHANGELOG.md

@ -0,0 +1,30 @@
## v0.004#
# News #
* Conversation opens as child of news item
* Pull-to-refresh news
* Delete Icon
* Animated Gif attachments shown below news item
* Improved image selector for new message
* Gif attachments for new message
* Timeline reloaded after new message
# Contacts #
* Contact details window mechanism completely reworked
* New calendar icon for Friendica contacts
* "Connect" opens connect request page for Friendica contacs
# Calendar #
* new calendar tab
* shows own public events and public events of Friendica contacts
* list view of events of selected date
* click on event to show details
# Config #
* the icon of the server is shown if url is correct
* Click on icon for server details
# Translations #
* German

BIN
android-build-release-signed.apk → Friendiqa.apk

80
README.md

@ -1,16 +1,16 @@
## Friendiqa#
QML based client for the Friendica Social Network.
Tabs for news (incl. Direct Messages), friends and photos.
Delete old version first when upgrading (due to database changes)
OS: currently Linux and Android(4.3).
Source code is a QtCreator project.
Tabs for news (incl. Direct Messages), friends, photos and events.
OS: currently Linux and Android(4.3).
Source code is a QtCreator project.
## Screenshots ##
![Newstab](Screenshots/NewsTab.jpg)
![Friendstab](Screenshots/FriendsTab.jpg)
![Photostab](Screenshots/PhotoTab.jpg)
![Eventstab](Screenshots/EventTab.jpg)
![Configtab](Screenshots/ConfigTab.jpg)
@ -18,34 +18,36 @@ Source code is a QtCreator project.
# News #
Currently supported:
* Shows Posts from friends, favorited messages, Direct Messages and Notifications
* Show news as timeline or tree (conversation opens in same window)
* Open links in external browser
* Click on contact phot for additional information
* Deletion, Reposting, Answering of Posts
* Liking, disliking, favoriting
* Shows Posts from friends, favorited messages, Direct Messages and Notifications
* Open links in external browser
* Click on contact photo for contact details
* Click on like text for additional contact info
* Attending events
* Update fetches new posts since last in local DB
* Deletion, Reposting, Answering of Posts
* Liking, disliking, favoriting
* Attending for event posts
* Update fetches new posts (up to last 50) since last in local DB
* More shows older posts from local DB
* Create new Message with images or direct messages, Contact/Group access rights(can be stored), smileys
* Create new Message with images or direct messages, Contact/Group access rights(can be stored), smileys
* New image dialog
ToDo:
* Videos and other binary data as attachment (sending and receiving)
* Rich text editing in Send Dialog
* Videos and other binary data as attachment (sending and receiving)
* More than one attachment
* Rich text editing in Send Dialog
* Attachments for Direct messages (currently not supported in API)
# Friends #
Currently supported:
* Tabs for friends, other contacts and groups
* Grid of all known contacts with locally downloaded pictures
* Large friend item for addional information and functionality
* Show news of contact from local database
* Send direct message, if contact is following
* Show public pictures of contact (screenscraping of contact's website, works only with certain theme)
* Open website of contact or connect page (for other contacts)
* Grid of all known contacts with locally downloaded pictures
* Large friend item for addional information and functionality
* Show news of contact from local database
* Send direct message, if contact is following
* Show public pictures of contact (screenscraping of contact's website, works only with certain theme)
* Open website of contact or connect page (for other contacts)
ToDo:
* More information for contact from description page, possibly private information for friends
@ -58,12 +60,21 @@ Currently supported:
* Show albums in grid, show images in album in grid and fullscreen
* Show albums and images of contacts
* Pinch to zoom, swipe to scroll
ToDo:
* Private images of friends
* Support for all themes of friends
* Delete downloaded own images
# Events #
* download own public events and public events of Friendica contacts
* list view of events of selected date
* click on event to show details
ToDo
* private events
# Config #
Currently supported:
@ -73,27 +84,20 @@ Currently supported:
ToDo
* OAuth?
# Other #
ToDo
* Calendar tab, video tab
* Video tab
* Photo upload to album (needs API change)
* Translation
* Blingbling
# Translations #
* German
# New in version 0.003
* improved BackButton behaviour
* click on contact everywhere to get to contact details
* Image dialog automatically opens in Android camera directory
* Smiley Dialog in Message Dialog
* Extensive use of FontAwesome for icons
* Bugfixes
## License ##
* v0.001 for Friendica < 3.5
* v0.002 for Friendica >= 3.5
* Published under the [GPL v3](http://gplv3.fsf.org).
Pubished under the [GPL v3](http://gplv3.fsf.org).

BIN
Screenshots/ConfigTab.jpg

Before

Width: 169  |  Height: 300  |  Size: 16 KiB

After

Width: 169  |  Height: 300  |  Size: 17 KiB

BIN
Screenshots/EventsTab.jpg

After

Width: 169  |  Height: 300  |  Size: 20 KiB

BIN
Screenshots/FriendsTab.jpg

Before

Width: 169  |  Height: 300  |  Size: 18 KiB

After

Width: 169  |  Height: 300  |  Size: 20 KiB

BIN
Screenshots/NewsTab.jpg

Before

Width: 169  |  Height: 300  |  Size: 20 KiB

After

Width: 169  |  Height: 300  |  Size: 19 KiB

BIN
Screenshots/PhotoTab.jpg

Before

Width: 169  |  Height: 300  |  Size: 15 KiB

After

Width: 169  |  Height: 300  |  Size: 15 KiB

4
source-android/android/AndroidManifest.xml

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.3" android:versionCode="3" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Friendiqa" android:icon="@drawable/icon" android:logo="@drawable/icon">
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.4" android:versionCode="4" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Friendiqa" android:icon="@drawable/friendiqa" android:logo="@drawable/friendiqa">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="Friendiqa" android:screenOrientation="unspecified" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

BIN
source-android/android/res/drawable-hdpi/friendiqa.png

After

Width: 72  |  Height: 72  |  Size: 2.0 KiB

BIN
source-android/android/res/drawable-ldpi/friendiqa.png

After

Width: 36  |  Height: 36  |  Size: 1.1 KiB

BIN
source-android/android/res/drawable-mdpi/friendiqa.png

After

Width: 48  |  Height: 48  |  Size: 1.4 KiB

BIN
source-android/android/res/drawable-xhdpi/friendiqa.png

After

Width: 96  |  Height: 96  |  Size: 2.9 KiB

BIN
source-android/android/res/drawable-xxhdpi/friendiqa.png

After

Width: 144  |  Height: 144  |  Size: 4.2 KiB

BIN
source-android/android/res/drawable-xxxhdpi/friendiqa.png

After

Width: 196  |  Height: 196  |  Size: 6.0 KiB

12
source-android/application.qrc

@ -196,5 +196,17 @@
<file>images/smileys/adult/finger.gif</file>
<file>images/smileys/adult/sperm.gif</file>
<file>images/smileys/adult/tits.gif</file>
<file>common/filesystem.cpp</file>
<file>common/filesystem.h</file>
<file>common/friendiqa.cpp</file>
<file>common/uploadableimage.cpp</file>
<file>common/uploadableimage.h</file>
<file>common/xhr.cpp</file>
<file>common/xhr.h</file>
<file>qml/calendarqml/CalendarTab.qml</file>
<file>qml/calendarqml/CalendarDay.qml</file>
<file>qml/calendarqml/EventList.qml</file>
<file>translations/friendiqa-de.qm</file>
<file>translations/friendiqa-de.ts</file>
</qresource>
</RCC>

4
source-android/common/friendiqa.cpp

@ -7,7 +7,9 @@
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QQuickView view;
QTranslator qtTranslator;
qtTranslator.load("friendiqa-" + QLocale::system().name(),":/translations");
app.installTranslator(&qtTranslator);
XHR* xhr = XHR::instance();
view.rootContext()->setContextProperty("xhr", xhr);

15
source-android/js/helper.js

@ -9,12 +9,12 @@ function friendicaRequest(login,api,rootwindow,callback) {
try{ if (xhrequest.status=200){ //if (xhrequest.responseText!=""){
callback(xhrequest.responseText)
}else{
showMessage("Error","API:" +api+"\n NO RESPONSE"+xhrequest.statusText,rootwindow);
callback(xhrequest.responseText)
showMessage("Error","API:" +login.server+api+"\n NO RESPONSE"+xhrequest.statusText,rootwindow);
//callback(xhrequest.responseText)
}
}
catch (e){
showMessage("Error", api+" "+e+" "+xhrequest.statusText,rootwindow)
catch (e){print(e);
showMessage("Error", xhrequest.responseText,rootwindow)
}
}
}
@ -60,7 +60,7 @@ function friendicaWebRequest(url,rootwindow,callback) {
} else if(xhrequest.readyState === XMLHttpRequest.DONE) {
try{ callback(xhrequest.responseText);
}
catch (e){
catch (e){print(e);
showMessage("Error",url+" "+e, rootwindow)
}
}
@ -130,3 +130,8 @@ var arraystring=JSON.stringify(array);
arraystring=arraystring.replace(/[\[\]]/g , '');
return arraystring;
}
function cleanDate(date){
var cleanedDate= date.slice(0,3)+", "+date.slice(8,11)+date.slice(4,7)+date.slice(25,30)+date.slice(10,25);
return cleanedDate
}

23
source-android/js/news.js

@ -32,13 +32,12 @@ function requestGroups(login,database,rootwindow,callback){
function getFriendsTimeline(login,database,contacts,onlynew,rootwindow,callback){
// retrieve and return timeline since last news, return contacts which are not friends and older than 2 days for update (friends can be updated in Contactstab)
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
var parameter = "";
var parameter = "?count=50";
if(onlynew){db.transaction( function(tx) {
var result = tx.executeSql('SELECT status_id from news WHERE username="'+login.username+'" AND messagetype=0 ORDER BY status_id DESC LIMIT 1'); // check for last news id
try{parameter="&since_id="+result.rows.item(0).status_id;}catch(e){};})}
try{parameter=parameter+"&since_id="+result.rows.item(0).status_id;}catch(e){};})}
var newContacts=[];
//print("/api/statuses/friends_timeline"+parameter);
Helperjs.friendicaRequest(login,"/api/statuses/friends_timeline"+parameter, rootwindow,function (obj){
Helperjs.friendicaRequest(login,"/api/statuses/friends_timeline"+parameter, rootwindow,function (obj){print(obj);
var news=JSON.parse(obj);
var newContacts=findNewContacts(news,contacts);
callback(news,newContacts)
@ -53,7 +52,7 @@ function getCurrentContacts(login,database,callback){
contactlist.push(result.rows.item(i).url )
//print(result.rows.item(i).url)
}
var lastDate=Date.now()-172800000;// 2 days old
var lastDate=Date.now()-604800000;// 7 days old
//print('SELECT url from contacts WHERE username="'+login.username+'" AND isFriend=0 AND imageAge>'+lastDate);
var result2 = tx.executeSql('SELECT url from contacts WHERE username="'+login.username+'" AND isFriend=0 AND imageAge > '+lastDate);
for (var j=0;j<result2.rows.length;j++){
@ -63,18 +62,18 @@ function getCurrentContacts(login,database,callback){
callback(contactlist)
}
function findNewContacts(news,contacts){//print("contacts: "+JSON.stringify(contacts))
function findNewContacts(news,contacts){//print("contacts: "+JSON.stringify(news))
var newContacts=[];
for (var i=0;i<news.length;i++){
var url=news[i].user.url;
if(contacts.indexOf(url)==-1 && !(inArray(newContacts,"url",url))){print("new contact "+JSON.stringify(news[i].user));
if(contacts.indexOf(url)==-1 && !(inArray(newContacts,"url",url))){
news[i].user.isFriend=0;
newContacts.push(news[i].user);
}
if (news[i].friendica_activities.like.length>0){
for (var j=0;j<news[i].friendica_activities.like.length;j++){
var like_url=news[i].friendica_activities.like[j].url;
if(contacts.indexOf(like_url)==-1 && !(inArray(newContacts,"url",like_url))){print("new like contact "+JSON.stringify(news[i].friendica_activities.like[j]));
if(contacts.indexOf(like_url)==-1 && !(inArray(newContacts,"url",like_url))){
news[i].friendica_activities.like[j].isFriend=0;
newContacts.push(news[i].friendica_activities.like[j]);
}
@ -83,7 +82,7 @@ function findNewContacts(news,contacts){//print("contacts: "+JSON.stringify(cont
if (news[i].friendica_activities.dislike.length>0){
for (var k=0;j<news[k].friendica_activities.dislike.length;k++){
var dislike_url=news[i].friendica_activities.dislike[k].url;
if(contacts.indexOf(dislike_url)==-1 && !(inArray(newContacts,"url",dislike_url))){print("new dislike contact "+JSON.stringify(news[i].friendica_activities.dislike[k]));
if(contacts.indexOf(dislike_url)==-1 && !(inArray(newContacts,"url",dislike_url))){
news[i].friendica_activities.dislike[k].isFriend=0;
newContacts.push(news[i].friendica_activities.dislike[k]);
}
@ -110,7 +109,7 @@ function storeNews(login,database,news,rootwindow,callback){
var attendnoarray=[]; for (var user in news[i].friendica_activities.attendno){attendnoarray.push(news[i].friendica_activities.attendno[user].url)}
var attendmaybearray=[]; for (var user in news[i].friendica_activities.attendmaybe){attendmaybearray.push(news[i].friendica_activities.attendmaybe[user].url)}
var friendica_activities=[likearray,dislikearray,attendyesarray,attendnoarray,attendmaybearray]
var attachments="";if (news[i].attachments){attachments=Qt.btoa(JSON.stringify(news[i].attachments))}print(attachments)
var attachments="";if (news[i].attachments){attachments=Qt.btoa(JSON.stringify(news[i].attachments))}
db.transaction( function(tx) {
var result = tx.executeSql('SELECT * from news where username="'+login.username+'" AND status_id = "'+news[i].id+'" AND messagetype=0'); // check for news id
if(result.rows.length === 1) {// use update
@ -265,7 +264,7 @@ function likerequest(login,database,verb,newsid,rootwindow){
db.transaction( function(tx) {
var currentActivities_rs=tx.executeSql('select friendica_activities_self from news WHERE username="'+login.username+'" AND status_id='+newsid) ;
var currentActivities=JSON.parse(currentActivities_rs.rows.item(0).friendica_activities_self);
print(verb+"currentActivities "+JSON.stringify(currentActivities));
//print(verb+"currentActivities "+JSON.stringify(currentActivities));
if ((verb=="like")&&(currentActivities.indexOf(1)==-1)){ currentActivities.push(1);
if (currentActivities.indexOf(2)!=-1){currentActivities.splice(currentActivities.indexOf(2),1)}
}
@ -349,7 +348,7 @@ function requestFavorites(login,database,contacts,rootwindow,callback){
function favoritesfromdb(database,user,callback){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) {
print('select * from news WHERE username="'+user+'" AND favorited=1 ORDER BY status_id DESC');
//print('select * from news WHERE username="'+user+'" AND favorited=1 ORDER BY status_id DESC');
var newsrs=tx.executeSql('select * from news WHERE username="'+user+'" AND favorited=1 ORDER BY status_id DESC');
var newsArray=[];
for(var i = 0; i < newsrs.rows.length; i++) {

14
source-android/js/newsworker.js

@ -19,7 +19,7 @@ WorkerScript.onMessage = function(msg) {
else {likeText= newsitemobject.like.length+" "+ qsTr("like this.")}
}
if (newsitemobject.dislike.length>0){
if (newsitemobject.dislike.length==1){dislikeText= QT.atob(newsitemobject.dislike[0].name)+" "+ qsTr("doesn't like this.")}
if (newsitemobject.dislike.length==1){dislikeText= Qt.atob(newsitemobject.dislike[0].name)+" "+ qsTr("doesn't like this.")}
else {dislikeText= newsitemobject.dislike.length+" "+ qsTr("don't like this.")}
}
if (newsitemobject.attendyes.length>0){
@ -42,7 +42,15 @@ WorkerScript.onMessage = function(msg) {
if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1}
}
var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self}
//print(JSON.stringify(friendica_activities) ) ;
var attachmentList=[];if(newsitemobject.attachments){
var attachArray=JSON.parse(Qt.atob(newsitemobject.attachments));
for (var image in attachArray){if(attachArray[image].mimetype=="image/gif"){
attachmentList.push(attachArray[image])
}
}
}
newsitemobject.attachmentList=attachmentList;
var seconds=(msg.currentTime-newsitemobject.created_at)/1000;
var timestring="";
if (seconds<60) {timestring=seconds+" "+qsTr("seconds") +" "+qsTr("ago");}
@ -54,7 +62,7 @@ WorkerScript.onMessage = function(msg) {
else if (seconds<3888000){timestring=Math.round(seconds/86400)+" "+qsTr("days") +" "+qsTr("ago");}
else if (seconds<5832000){timestring=Math.round(seconds/3888000)+" "+qsTr("month") +" "+qsTr("ago");}
else if (seconds<69984000){timestring=Math.round(seconds/3888000)+" "+qsTr("months") +" "+qsTr("ago");}
else {timestring=Math.round(seconds/69984000)+" "+qsTr("years") +" "+qsTr("ago");}
else {timestring=Math.round(seconds/46656000)+" "+qsTr("years") +" "+qsTr("ago");}
var data=({"newsitemobject": newsitemobject,"dateDiff":timestring,"friendica_activities":friendica_activities})}
//print("News:"+j+msg.news.length+JSON.stringify(data));
msg.model.append(data);}

112
source-android/js/service.js

@ -121,8 +121,93 @@ function initDatabase(database) { // initialize the database object
tx.executeSql('CREATE TABLE IF NOT EXISTS news(username TEXT, messagetype INT, text TEXT, created_at INT, in_reply_to_status_id INT, source TEXT, status_id INT, in_reply_to_user_id INT, geo TEXT,favorited TEXT, uid INT, statusnet_html TEXT, statusnet_conversation_id TEXT,friendica_activities TEXT, friendica_activities_self TEXT, attachments TEXT, friendica_owner INT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS contacts(username TEXT, id INT, name TEXT, screen_name TEXT, location TEXT,imageAge INT, profile_image_url TEXT, description TEXT, profile_image BLOB, url TEXT, protected TEXT, followers_count INT, friends_count INT, created_at INT, favourites_count TEXT, utc_offset TEXT, time_zone TEXT, statuses_count INT, following TEXT, verified TEXT, statusnet_blocking TEXT, notifications TEXT, statusnet_profile_url TEXT, cid INT, network TEXT, isFriend INT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS groups(username TEXT, groupname TEXT, gid INT, members TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS events(username TEXT, id INT, start INT, end INT, allday INT, title TEXT, j INT, d TEXT, isFirst INT, uid INT, cid INT, uri TEXT, created INT, edited INT, desc TEXT, location TEXT, type TEXT, nofinish TEXT, adjust INT, ignore INT, permissions TEXT, guid INT, itemid INT, plink TEXT, authorName TEXT, authorAvatar TEXT, authorLink TEXT, html TEXT)');
})}
function cleanPermissions(oldperms){
var newperms=oldperms.replace("<","");newperms=newperms.replace(">","");newperms="["+newperms+"]";
var newpermArray=JSON.parse(newperms);
return (newpermArray)
}
function getEvents(database,login,rootwindow,callback){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
Helperjs.friendicaWebRequest(login.server+"/cal/"+login.username+"/json",rootwindow,function(obj){
var events = JSON.parse(obj);
db.transaction( function(tx) {
for (var i=0;i<events.length;i++){
var permissions=[];
permissions.push(cleanPermissions(events[i].item.allow_cid));
permissions.push(cleanPermissions(events[i].item.allow_gid));
permissions.push(cleanPermissions(events[i].item.deny_cid));
permissions.push(cleanPermissions(events[i].item.deny_gid));
var result = tx.executeSql('SELECT * from events where username="'+login.username+'" AND id = '+events[i].id); // check for news id
if(result.rows.length === 1) {// use update
result = tx.executeSql('UPDATE events SET username="'+login.username+'", start="'+Date.parse(events[i].start)+'", end="'+Date.parse(events[i].end)+'", allday="'+Number(events[i].allday)+'", title="'+events[i].title+'", j="'+events[i].j+'", d="'+events[i].d+ '", isFirst="'+Number(events[i].isFirst)+'", uid="'+events[i].item.uid+'", cid="'+events[i].item.cid+'", uri="'+events[i].item.uri+'", created="'+ Date.parse(events[i].item.created)+'", edited="'+ Date.parse(events[i].item.edited)+'", desc="'+events[i].item.desc+'", location="'+events[i].item.location+'", type="'+events[i].item.type+'", nofinish="'+events[i].item.nofinish+'", adjust ="'+events[i].item.adjust+'", ignore="'+events[i].item.ignore+'", permissions="'+ JSON.stringify(permissions)+'", guid="'+events[i].item.guid+'", itemid="'+events[i].item.itemid+ '", plink="'+events[i].item.plink+ '", authorName="'+events[i].item["author-name"]+ '", authorAvatar="'+events[i].item["author-avatar"]+ '", authorLink="'+events[i].item["author-link"]+ '", html="'+Qt.btoa(events[i].html)+'" where username="'+login.username+'" AND id='+events[i].id);
} else {// use insert
result = tx.executeSql('INSERT INTO events (username,id,start,end,allday,title,j,d,isFirst,uid,cid,uri,created,edited,desc,location,type,nofinish,adjust,ignore,permissions,guid,itemid,plink,authorName,authorAvatar,authorLink,html) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username, events[i].id, Date.parse(events[i].start), Date.parse(events[i].end), events[i].allday, events[i].title, events[i].j, events[i].d, events[i].isFirst, events[i].item.uid, events[i].item.cid, events[i].item.uri, Date.parse(events[i].item.created), Date.parse(events[i].item.edited), events[i].item.desc, events[i].item.location, events[i].item.type, events[i].item.nofinish, events[i].item.adjust, events[i].item.ignore, JSON.stringify(permissions), events[i].item.guid, events[i].item.itemid, events[i].item.plink, events[i].item["author-name"], events[i].item["author-avatar"], events[i].item["author-link"], Qt.btoa(events[i].html)])}
callback()
}
})})}
function newscount(database, callback){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) {
var newscountrs = tx.executeSql('SELECT COUNT(*) from news');
var newscount = newscountrs.rows.item(0)["COUNT(*)"];
callback(newscount)
})
}
function eventsfromdb(database, username,callback){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) {
var eventrs=tx.executeSql('select * from events WHERE username="'+username+'" ORDER BY start ASC');
var eventArray=[];
var dayArray=[];
for(var i = 0; i < eventrs.rows.length; i++) {
eventArray.push(eventrs.rows.item(i));
// eventArray[i]=fetchUsersForNews(database,username,newsArray[i])
dayArray.push(Math.floor(eventrs.rows.item(i).start/86400000));
}
callback(eventArray,dayArray)});
}
function requestFriendsEvents(login,friend,rootwindow,callback){
// get calendar JSON object of contact without user and password
Helperjs.friendicaWebRequest(friend.replace("profile","cal")+"/json",rootwindow,function(calhtml){
//print(calhtml);
var eventarray=[];var eventdays=[];
var events=JSON.parse(calhtml);
for (var i=0;i<events.length;i++){
var permissions=[];
permissions.push(cleanPermissions(events[i].item.allow_cid));
permissions.push(cleanPermissions(events[i].item.allow_gid));
permissions.push(cleanPermissions(events[i].item.deny_cid));
permissions.push(cleanPermissions(events[i].item.deny_gid));
var event ={}
event.start=Date.parse(events[i].start);event.end=Date.parse(events[i].end);
event.allday=events[i].allday; event.title=events[i].title; event.j=events[i].j;
event.d=events[i].d; event.isFirst=events[i].isFirst; event.uid=events[i].item.uid;
event.cid=events[i].item.cid; event.uri=events[i].item.uri;
event.created=Date.parse(events[i].item.created); event.edited=Date.parse(events[i].item.edited);
event.desc=events[i].item.desc; event.location=events[i].item.location; event.type=events[i].item.type;
event.nofinish=events[i].item.nofinish; event.adjust =events[i].item.adjust; event.ignore=events[i].item.ignore;
event.permissions=JSON.stringify(permissions); event.guid=events[i].item.guid;
event.itemid=events[i].item.itemid; event.plink=events[i].plink; event.authorName=events[i].item["author-name"];
event.authorAvatar=events[i].item["author-avatar"]; event. authorLink=events[i].item["author-link"];
event.html=Qt.btoa(events[i].html);
eventarray.push(event);
// var offsetTime = new Date().getTimezoneOffset() * 60 * 1000;print(new Date(event.start).toLocaleString()+"Zeitverschiebung:"+offsetTime)
// var time = event.start - offsetTime;
eventdays.push(Math.floor(event.start/(24*60*60*1000)))
}
//print(JSON.stringify(eventarray));
callback(eventarray,eventdays)
})
}
function savePermissions(database,obj) { // stores config to DB
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
var permissions=JSON.stringify(obj)
@ -147,6 +232,18 @@ function storeConfig(database,obj) { // stores config to DB
}
})}
function showServerConfig(url,rootwindow,callback){//print(url);
Helperjs.friendicaWebRequest(url+"/api/statusnet/config",rootwindow, function (obj){
var serverconfig = JSON.parse(obj);
var serverConfigString="import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:'Server';standardButtons: StandardButton.Ok;text: 'Name: "+serverconfig.site.name+"\nLanguage: "+serverconfig.site.language+
"\nEmail: "+serverconfig.site.email+"\nTimezone: "+serverconfig.site.timezone+"\nClosed: "+serverconfig.site.closed+
"\nText limit: "+serverconfig.site.textlimit+"\nShort Url length: "+serverconfig.site.shorturllength+
"\nFriendica version: "+serverconfig.site.friendica.FRIENDICA_VERSION+"\nDFRN version: "+serverconfig.site.friendica.DFRN_PROTOCOL_VERSION +
"\nDB Update version: "+serverconfig.site.friendica.DB_UPDATE_VERSION+"'}";
callback(serverConfigString)
})}
function getServerConfig(database,login,rootwindow,callback){
// check server with given credentials
try {Helperjs.friendicaRequest(login,"/api/statusnet/config",rootwindow, function (obj){
@ -212,8 +309,9 @@ function cleanNews(database,callback){
var maxnews=maxnewsrs.rows.item(0).maxnews;
var newscountrs = tx.executeSql('SELECT COUNT(*) from news');
var newscount = newscountrs.rows.item(0)["COUNT(*)"];
if (newscount>maxnews){var lastvalidtimers= tx.executeSql('select created_at from news ORDER BY created_at DESC LIMIT ' +(newscount-maxnews));
var lastvalidtime=lastvalidtimers.rows.item(maxnews).created_at;
if (newscount>maxnews){
var lastvalidtimers= tx.executeSql('SELECT DISTINCT created_at FROM news ORDER BY created_at ASC LIMIT ' +(newscount-maxnews));
var lastvalidtime=lastvalidtimers.rows.item(newscount-maxnews-1).created_at;
var deleters = tx.executeSql('DELETE from news WHERE created_at<='+lastvalidtime)}
callback()
})
@ -260,13 +358,17 @@ function processNews(callback){
function updateContactInDB(login,database,isFriend,contact){// for newstab and friendstab
// var suffix=contact.profile_image_url.substring(contact.profile_image_url.lastIndexOf("."), contact.profile_image_url.length);
// var imagename=login.imagestore+"contacts/"+contact.screen_name.trim()+suffix;
var imagename=login.imagestore+"contacts/"+contact.screen_name+"-"+contact.profile_image_url.substring(contact.profile_image_url.lastIndexOf("/")+1, contact.profile_image_url.length);
contacttimer.restart();
var imagename="";
contacttimer.restart();
var currentTime=Date.now();
if(contact.profile_image_url==""){root.currentContact=root.currentContact+1 } else{//print(JSON.stringify(contact))
imagename=login.imagestore+"contacts/"+contact.screen_name+"-"+contact.profile_image_url.substring(contact.profile_image_url.lastIndexOf("/")+1, contact.profile_image_url.length);
xhr.setUrl(Qt.resolvedUrl(contact.profile_image_url));
xhr.setFilename(imagename);
xhr.setDownloadtype("contact");
xhr.download();
xhr.download();}
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
var result;
db.transaction( function(tx) {

47
source-android/qml/calendarqml/CalendarDay.qml

@ -0,0 +1,47 @@
import QtQuick 2.0
import QtQuick.Controls 1.4
Item {
id: calendarDay
width:7*mm
height: 7*mm
property int dateInt:Math.floor((Date.parse(model.date)-(new Date().getTimezoneOffset() * 60 * 1000))/86400000)
Rectangle {
id: placeHolder
color: 'lightblue'; antialiasing: true
anchors.fill:parent
}
Text {
id:daytext
anchors.right: parent.right
anchors.margins: 0.5*mm
color:(model.month==monthgrid.month)?"black":"grey"
wrapMode: Text.WrapAnywhere
text: model.day
font.bold: model.today
font.pixelSize: 4*mm
}
Rectangle {
id:eventRect
color:"black"
anchors.margins: 0.5*mm
anchors.bottom: calendarDay.bottom
width: parent.width-mm
height: mm
visible: eventdays.indexOf(dateInt)>-1
}
MouseArea {
anchors.fill: calendarDay
onClicked: {
var eventDate=[];
var idx = eventdays.indexOf(dateInt);
while (idx != -1) {
eventDate.push(idx);
idx = eventdays.indexOf(dateInt,idx + 1)
}
var component = Qt.createComponent("qrc:/qml/calendarqml/EventList.qml");
if (component.status== Component.Ready){
var eventlist = component.createObject(calendartab,{"daylist": eventDate})}
}
}
}

134
source-android/qml/calendarqml/CalendarTab.qml

@ -0,0 +1,134 @@
import QtQuick 2.0
import QtQuick.Controls 2.1
import QtQml 2.2
import Qt.labs.calendar 1.0
import QtQuick.Layouts 1.3
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/calendarqml"
import "qrc:/qml/genericqml"
Rectangle {
id:calendarrectangle
y:1
width:root.width-mm
height:root.height-5*mm
color: '#fff'
property date currentTime: new Date()
property int offsetTime: currentTime.getTimezoneOffset() * 60 * 1000
property var events:[]
property var eventdays:[]
onEventdaysChanged: print(JSON.stringify(eventdays))
function showEvents(friend){
if(friend=="backButton"){Service.eventsfromdb(db,login.username,function(eventArray,dayArray){
events=eventArray;
eventdays=dayArray})
}
else if (friend!=""){
calendartab.calendartabstatus=friend.substring(friend.lastIndexOf("/")+1,friend.length)
Service.requestFriendsEvents(login,friend,calendartab,function(eventArray,dayArray){
events=eventArray;
eventdays=dayArray})
}
else {calendartab.calendartabstatus="Events";
Service.eventsfromdb(db,login.username,function(eventArray,dayArray){
events=eventArray;
eventdays=dayArray;
calBusy.running=false
})
}
}
BusyIndicator{
id: calBusy
anchors.horizontalCenter: calendarView.horizontalCenter
anchors.top:calendarView.top
anchors.topMargin: 2*mm
width:10*mm
height: 10*mm
running: false
}
BlueButton{
id: updateEvents
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right:calendartabstatusButton.left
anchors.rightMargin:mm
text:"\uf021"
onClicked: {
Service.getEvents(db,login, calendartab,function(){
showEvents("")
})}}
BlueButton{
id: calendartabstatusButton
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right: parent.right
anchors.rightMargin:2*mm
text: calendartab.calendartabstatus=="Events"?qsTr("Events"):calendartabstatus
onClicked: {calendartabmenu.popup()}
}
Menu {
id:calendartabmenu
MenuItem {
text: qsTr("Own Calendar")
onTriggered: {
calendartab.calendartabstatus="Events";
// calendartabstatusButton.text=qsTr("own Calendar");
showEvents("")}
}
}
ListView{
id: calendarView
x: mm;y:8*mm
width: parent.width-2*mm; height: parent.height-9*mm
clip: true
snapMode: ListView.SnapOneItem
orientation: ListView.Horizontal
highlightRangeMode: ListView.StrictlyEnforceRange
model: CalendarModel {id:calendarModel
from: new Date()
to: new Date(new Date().valueOf()+93312000000)
}
delegate:
ColumnLayout{
width:calendarView.width
Text{
font.bold: true
Layout.fillWidth: true
horizontalAlignment:Text.AlignHCenter
text: model.year
}
Text{
text: Qt.locale().standaloneMonthName(model.month)
Layout.fillWidth: true
horizontalAlignment:Text.AlignHCenter
}
DayOfWeekRow{
locale: monthgrid.locale
Layout.fillWidth: true
}
MonthGrid {
id: monthgrid
Layout.fillWidth: true
month: model.month
year: model.year
locale: Qt.locale()
delegate: CalendarDay{}
}
}
ScrollIndicator.horizontal: ScrollIndicator { }
}
Component.onCompleted: {
root.eventSignal.connect(showEvents);
if (calendartab.calendartabstatus=="Events"){showEvents("")}
}
}

85
source-android/qml/calendarqml/EventList.qml

@ -0,0 +1,85 @@
import QtQuick 2.0
import QtQuick.Controls 1.2
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
Rectangle{
id:eventList
z:2
border.color: "grey"
width: parent.width-4*mm
height:parent.height-12*mm
x:mm
y:mm
property var daylist:[]
BlueButton{
id:closeButton
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
onClicked:{eventList.destroy()}
}
ListView {
id: eventlistView
x: mm
y:closeButton.height+2*mm
width: eventList.width-2*mm
height: eventList.height-closeButton.height-4*mm
clip: true
model: eventModel
delegate: eventItem
}
ListModel{
id: eventModel
}
Component.onCompleted:{
//print(JSON.stringify(daylist))
for (var i=0; i<daylist.length;i++){//print(JSON.stringify(events[daylist[i]]));
var liststate="";if(daylist.length<2){liststate="large"}
eventModel.append({"event":events[daylist[i]],"eventstatus":liststate});
}
}
Component{
id:eventItem
Rectangle{
property string status: eventstatus
width:eventlistView.width
height:eventNameText.height+eventDetailsText.height+mm
border.color: "light grey"
border.width: 1
Text {
id:eventNameText
x:mm
width:parent.width
height:contentHeight
text: new Date(event.start+calendarrectangle.offsetTime).toLocaleTimeString()+": "+event.title
font.pixelSize: 3*mm
wrapMode:Text.Wrap
}
Text {
id:eventDetailsText
x:mm
z:4
width: parent.width
height: contentHeight
text: status==""?"":Qt.atob(event.html)
anchors.top: eventNameText.bottom
font.pixelSize: 3*mm
wrapMode:Text.Wrap
}
MouseArea{
anchors.fill: parent
onClicked:{if (status==""){status="large"} else {status=""}
}
}
}
}
}

71
source-android/qml/configqml/ConfigTab.qml

@ -1,4 +1,4 @@
import QtQuick 2.0
import QtQuick 2.7
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.2
import "qrc:/js/service.js" as Service
@ -15,13 +15,18 @@ StackView{
height:root.height-12*mm
contentHeight: configBackground.height
boundsBehavior: Flickable.StopAtBounds
Rectangle{
id:configBackground
color: "white"
width:parent.width
height:Math.max(90*mm,root.height-12*mm)
property var users:[]
function setServericon(server){
try {Helperjs.friendicaWebRequest(server+"/api/statusnet/config",configBackground, function (obj){
var serverdata = JSON.parse(obj);
servericon.source=serverdata.site.logo})} catch(e){print(e)}
}
BlueButton{
id:userButton
text:qsTr("User")
@ -35,6 +40,7 @@ StackView{
"'; onTriggered: {Service.readConfig(db,function(obj){
userButton.text=obj.username;
servername.text=obj.server;
configBackground.setServericon(obj.server);
username.text= obj.username;
password.text=Qt.atob(obj.password);
imagestore.text=obj.imagestore;
@ -49,37 +55,51 @@ StackView{
}
Text {
text: "Server"
text: qsTr("Server")
x: 4*mm; y: 10*mm
}
Text {
text: "User"
text: qsTr("User")
x: 4*mm; y: 20*mm
}
Text {
text: "Password"
text: qsTr("Password")
x: 4*mm; y: 30*mm
}
Text {
text: "Image dir."
text: qsTr("Image dir.")
x: 4*mm; y: 40*mm
}
Text {
text: "Max. News"
text: qsTr("Max. News")
x: 4*mm; y: 50*mm
}
Text {
text: "News as"
text: qsTr("News as")
x: 4*mm; y: 60*mm
}
Text {
text: "Interval (0=None)"
text: qsTr("Interval (0=None)")
visible: false
x: 4*mm; y: 70*mm; width:20*mm;wrapMode: Text.Wrap
}
Image{
id:servericon
x:19*mm;y:10*mm
width:5*mm; height: 5*mm
source:""
MouseArea{
anchors.fill:parent
onClicked:{
Service.showServerConfig(servername.text, configBackground, function(configString){
var serverconfigObject=Qt.createQmlObject(configString,configBackground,"serverconfigOutput");})
}
}
}
Rectangle{color: "light grey"; x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm;}
Flickable {
id: servernameFlickable
@ -93,9 +113,13 @@ StackView{
height: servernameFlickable.height
focus: true
text:"https://..."
//wrapMode: TextEdit.NoWrap
//validator: RegExpValidator { regExp: /^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$/}
// onEditingFinished:{}
onEditingFinished:{
if((servername.text).substring(0,14) =="https://...http"){
serverstring.text= (serverstring.text).substring(11)
}
configBackground.setServericon(servername.text)
}
onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,servernameFlickable)
}
}
@ -134,9 +158,11 @@ StackView{
}
}
Slider{ id: maxNews
x:37*mm; y: 50*mm;width: root.width/3;height:5*mm
minimumValue: 0;maximumValue:100000; stepSize: 1000
x:34*mm; y: 50*mm;width: root.width/3;height:5*mm
minimumValue: 0;maximumValue:2000; stepSize: 100
}
Rectangle{color: "light grey"; x: 25*mm; y: 50*mm; width: 9*mm; height: 5*mm;
TextEdit{id:maxNewsText;
anchors.fill: parent
@ -199,13 +225,12 @@ StackView{
BlueButton {
x: 25*mm; y: 80*mm
text: "Confirm"
x: 25*mm; y: 78*mm
text: qsTr("Confirm")
onClicked:{
var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestore.text,maxnews:maxNewsText.text,interval: messageIntervalField.text, newsViewType:newsTypeField.text};
var errormessage="";
if (servername.text==""){errormessage=qsTr("No server given! ")}
//if (!servername.acceptableInput){errormessage+=qsTr("Server name not valid! ")}
else if (username.text==""){errormessage+=qsTr("No username given! ")}
else if (password.text=="") {errormessage+=qsTr("No password given! ")}
else if (imagestore.text=="") {errormessage+=qsTr("No image directory given!")}
@ -228,11 +253,6 @@ StackView{
userButton.color="black"
//reset values
root.login=userconfig;
// root.contactlist=[];
// root.news=[];
// root.newContacts=[];
// root.currentContact= 0;
// root.contactLoadType= "";
newstab.newstabstatus=userconfig.newsViewType;
root.currentIndex=0;
newstab.active=true;
@ -252,6 +272,7 @@ StackView{
filesystem.Directory=imagestore.text+"albums";
filesystem.rmDir();
servername.text="https://...";
servericon.source="";
username.text="";
password.text="";
imagestore.text="";
@ -272,6 +293,7 @@ StackView{
text: "+"
onClicked:{
servername.text="https://..."
servericon.source="";
username.text=""
password.text=""
imagestore.text=""
@ -297,8 +319,8 @@ StackView{
onTriggered: {newsTypeField.text="Timeline"}
}
MenuItem {
text: qsTr("Tree")
onTriggered: {newsTypeField.text="Tree"}
text: qsTr("Conversations")
onTriggered: {newsTypeField.text="Conversations"}
}
}
@ -311,6 +333,7 @@ StackView{
Service.readConfig(db,function(obj){
userButton.text=obj.username;
servername.text=obj.server;
configBackground.setServericon(obj.server);
username.text= obj.username;
password.text=Qt.atob(obj.password);
imagestore.text=obj.imagestore;

29
source-android/qml/contactqml/ContactComponent.qml

@ -47,38 +47,11 @@ Rectangle {
anchors.topMargin: mm
anchors.top: parent.top
onClicked:{
contactComponent.state="large";
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
if (component.status== Component.Ready){
var contactDetails = component.createObject(wrapper,{"contact": contact})}
var contactDetails = component.createObject(friendstab,{"contact": contact})}
}
}
}
Timer{id:selectiontimer; //weird behaviour when state set to "large" onCompleted
interval: 200; running: false; repeat: false
onTriggered: {
contactComponent.state="large";
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
if (component.status== Component.Ready){
var contactDetails = component.createObject(wrapper,{"contact": contact})}
}
}
Component.onCompleted: {
if(status=="large"){selectiontimer.start()}
else{contactComponent.state=""}
}
states: [
State {
name: "large"
PropertyChanges { target: namelabel; font.pixelSize: 4*mm; x:mm; width:friendsTabView.width-4*mm; text:Qt.atob(contact.name)+" (@"+contact.screen_name+")"}
ParentChange{target:contactComponent;parent:root; x:mm;y:2*mm}
//PropertyChanges { target: contactComponent; z: 2; x:0;y:0}
PropertyChanges { target: wrapper; width:friendsTabView.width;height:friendsTabView.height-15*mm}
PropertyChanges { target: photoImage; width:15*mm;height:15*mm;x:mm;y:mm }
PropertyChanges { target: contactComponent.GridView.view; interactive:false}
}
]
}

57
source-android/qml/contactqml/ContactDetailsComponent.qml

@ -2,6 +2,44 @@ import QtQuick 2.0
import QtQuick.Controls 1.3
import "qrc:/qml/genericqml"
Item {
id: contactLargeComponent
x:mm
y:mm
property var contact:{}
property var createdAtDate: new Date(contact.created_at)
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend==1)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
Rectangle {
id: wrapper
width:friendsTabView.width;
height:friendsTabView.height-15*mm
border.color: "grey"
color:"white"
Image {
id: photoImage
x:mm
y:mm
width: 15*mm
height:15*mm
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Label {
id: namelabel
x: mm
width:friendsTabView.width-4*mm
height: 3*mm
text:Qt.atob(contact.name)+" (@"+contact.screen_name+")"
elide:Text.ElideRight
anchors.topMargin: 0
anchors.left: photoImage.left
color: "#303030"
font.pixelSize: 4*mm
anchors.top: photoImage.bottom
}
Rectangle{
id: detailsrectangle
anchors.top: namelabel.bottom
@ -69,10 +107,27 @@ Rectangle{
}
}
BlueButton{
id:eventbutton
visible:(contact.network=="dfrn")
text:"\uf073"
onClicked:{
root.currentIndex=3;
calendartab.active=true;
calendartab.calendartabstatus="Friend"
root.eventSignal(contact.url);
}
}
BlueButton{
id: closeButton
text: "\uf057" //"close"
onClicked:{detailsrectangle.destroy();contactComponent.state="";friendsTabView.contactSignal}
onClicked:{contactLargeComponent.destroy();
//contactComponent.state="";
friendsTabView.contactSignal}
}
}
}
}
}

91
source-android/qml/contactqml/ContactDetailsComponentOld.qml

@ -0,0 +1,91 @@
import QtQuick 2.0
import QtQuick.Controls 1.3
import "qrc:/qml/genericqml"
Rectangle{
id: detailsrectangle
anchors.top: namelabel.bottom
anchors.topMargin: 2*mm
ScrollView{
horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff
frameVisible: true
id:namelabelflickable
width: root.width-10*mm
height:friendsTabView.height-45*mm
x: mm
clip:true
Text{
id:namelabeltext
width: namelabelflickable.width
height: implicitHeight
font.pixelSize: 3*mm
textFormat:Text.RichText
wrapMode: Text.Wrap
text:"<b>"+qsTr("Description")+": </b> "+Qt.atob(contact.description)+"<br> <b>"+qsTr("Location")+":</b> "+contact.location+"<br> <b>"+qsTr("Posts")+":</b> "+contact.statuses_count+
"<br> <b>"+qsTr("URL")+":</b> <a href='"+ contact.url+"'>"+contact.url+"</a><br>"+
connectUrl+ "<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())
onLinkActivated: {
Qt.openUrlExternally(link)}
}
}
Row{
anchors.top: namelabelflickable.bottom
anchors.topMargin: 2*mm
x: mm
spacing:4
BlueButton{
id:photobutton
text: "\uf03e" // "Photos"
visible:(contact.network=="dfrn")
onClicked:{
fotostab.phototabstatus="Contact";
root.currentIndex=2;
fotostab.active=true;
root.fotoSignal(contact) ;
}
}
BlueButton{
id:messagebutton
text: "\uf0e6" //"Messages"
onClicked:{
root.currentIndex=0;
newstab.active=true;
root.messageSignal(contact.id) ;
}
}
BlueButton{
id:dmbutton
visible: (contact.following=="true")
text: "\uf040" //"DM"
onClicked:{
root.currentIndex=0;
newstab.active=true;
root.directmessageSignal(contact.screen_name);
}
}
BlueButton{
id:eventbutton
visible:(contact.network=="dfrn")
text:"\uf073"
onClicked:{
root.currentIndex=3;
calendartab.active=true;
calendartab.calendartabstatus="Friend"
root.eventSignal(contact.url);
}
}
BlueButton{
id: closeButton
text: "\uf057" //"close"
onClicked:{detailsrectangle.destroy();contactComponent.state="";friendsTabView.contactSignal}
}
}
}

37
source-android/qml/contactqml/FriendsTab.qml

@ -11,12 +11,13 @@ Rectangle {
color: "white"
function showContactdetails(contact){
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
if(contact.isFriend){
friendsTabView.currentIndex=0;
friendsTabView.contactsSignal(contact)
var contactDetails = component.createObject(friendstab,{"contact": contact})
}
else{friendsTabView.currentIndex=1;
friendsTabView.contactsSignal(contact)
var contactDetails = component.createObject(friendstab,{"contact": contact})
}
}
TabView{
@ -30,7 +31,7 @@ Rectangle {
signal contactsSignal(var contact)
signal groupsSignal(var username)
onCurrentIndexChanged:{
if (currentIndex==0){//print("currentindex 0");
if (currentIndex==0){
contactsSignal("")
}
else if (currentIndex==1){
@ -60,18 +61,14 @@ Rectangle {
title: qsTr("Friends")
Rectangle{
id: friendsGridTab
function makebig(friendindex){print("friendindex"+friendindex);if (friendindex){friendsModel.set(friendindex,{"status":"large"})}}
function showFriends(contact,callback){//print("contact"+JSON.stringify(contact));
function showFriends(contact){
try {friendsModel.clear()} catch(e){print(e)};
var friendindex;
Helperjs.readData(db,"contacts",root.login.username,function(friendsobject){
for (var i=0;i<friendsobject.length;i++){
var status="";
if(Helperjs.getCount(db,login,"contacts","screen_name",friendsobject[i].screen_name)>1){
if(Helperjs.getCount(db,login,"contacts","screen_name",friendsobject[i].screen_name)>1){
friendsobject[i].screen_name=friendsobject[i].screen_name+"+"+friendsobject[i].cid
}
if(contact){if (contact.cid==friendsobject[i].cid){status="large"}}
friendsModel.append({"contact":friendsobject[i],"status":status});
friendsModel.append({"contact":friendsobject[i]});
}
@ -113,12 +110,11 @@ Rectangle {
clip: true
cellHeight: 16*mm
cellWidth: 17*mm
add: Transition {
NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
}
//add: Transition {
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
// }
model: friendsModel
delegate: ContactComponent { }
Component.onCompleted: positionViewAtBeginning()
}
ListModel{id:friendsModel}
@ -132,7 +128,7 @@ Rectangle {
}
Tab{
title: qsTr("Other Contacts")
title: qsTr("Contacts")
Rectangle{
id: contactsGridTab
@ -140,9 +136,7 @@ Rectangle {
try {contactsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){