'Last sync' label
This commit is contained in:
parent
b904c6dbcc
commit
214600f894
13 changed files with 52 additions and 51 deletions
Binary file not shown.
|
|
@ -70,7 +70,8 @@ Page {
|
|||
anchors.left: parent.left; anchors.right: parent.right
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
textFormat: Text.StyledText
|
||||
text: "<a href='"+PAGE+"'>"+PAGE+"</a>";
|
||||
//text: "<a href='"+PAGE+"'>"+PAGE+"</a>";
|
||||
text: PAGE;
|
||||
}
|
||||
|
||||
Label {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ Page {
|
|||
}
|
||||
|
||||
ViewPlaceholder {
|
||||
enabled: listView.model.count == 0
|
||||
enabled: listView.count == 0
|
||||
text: qsTr("No dashboards")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
import "scripts.js" as Scripts
|
||||
|
||||
ListItem {
|
||||
id: root
|
||||
|
|
@ -169,48 +170,11 @@ ListItem {
|
|||
}
|
||||
|
||||
Label {
|
||||
function getHumanFriendlyTimeString(date) {
|
||||
var delta = Math.floor(Date.now()/1000-date);
|
||||
if (delta===0) {
|
||||
return "just now";
|
||||
}
|
||||
if (delta===1) {
|
||||
return "1 second ago";
|
||||
}
|
||||
if (delta<60) {
|
||||
return "" + delta + " seconds ago";
|
||||
}
|
||||
if (delta>=60&&delta<120) {
|
||||
return "1 minute ago";
|
||||
}
|
||||
if (delta<3600) {
|
||||
return "" + Math.floor(delta/60) + " minutes ago";
|
||||
}
|
||||
if (delta>=3600&&delta<7200) {
|
||||
return "1 hour ago";
|
||||
}
|
||||
if (delta<86400) {
|
||||
return "" + Math.floor(delta/3600) + " hours ago";
|
||||
}
|
||||
if (delta>=86400&&delta<172800) {
|
||||
return "yesterday";
|
||||
}
|
||||
if (delta<604800) {
|
||||
return "" + Math.floor(delta/86400) + " days ago";
|
||||
}
|
||||
if (delta>=604800&&delta<1209600) {
|
||||
return "1 week ago";
|
||||
}
|
||||
if (delta<2419200) {
|
||||
return "" + Math.floor(delta/604800) + " weeks ago";
|
||||
}
|
||||
return Qt.formatDateTime(new Date(date*1000),"dddd, d MMMM yy");
|
||||
}
|
||||
anchors.left: parent.left; anchors.right: parent.right;
|
||||
anchors.leftMargin: Theme.paddingLarge; anchors.rightMargin: Theme.paddingMedium
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
color: Theme.secondaryColor
|
||||
text: getHumanFriendlyTimeString(date)
|
||||
text: Scripts.getHumanFriendlyTimeString(date)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ Page {
|
|||
}
|
||||
|
||||
ViewPlaceholder {
|
||||
enabled: listView.model.count == 0
|
||||
enabled: listView.count == 0
|
||||
text: qsTr("No entries")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ Page {
|
|||
}
|
||||
|
||||
ViewPlaceholder {
|
||||
enabled: listView.model.count == 0
|
||||
enabled: listView.count == 0
|
||||
text: qsTr("No feeds")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
import "scripts.js" as Scripts
|
||||
|
||||
|
||||
PullDownMenu {
|
||||
|
||||
|
|
@ -57,11 +59,28 @@ PullDownMenu {
|
|||
}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Update")
|
||||
text: qsTr("Sync")
|
||||
|
||||
onClicked: {
|
||||
fetcher.update();
|
||||
}
|
||||
}
|
||||
|
||||
MenuLabel {
|
||||
function update() {
|
||||
var lastSync = settings.getNetvibesLastUpdateDate();
|
||||
if (lastSync>0)
|
||||
text = qsTr("Last sync") + ": " + Scripts.getHumanFriendlyTimeString(lastSync);
|
||||
else
|
||||
text = qsTr("Not yet synced");
|
||||
}
|
||||
|
||||
Component.onCompleted: update();
|
||||
|
||||
Connections {
|
||||
target: fetcher
|
||||
onReady: update()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,10 @@ Page {
|
|||
console.log(settings.getSignedIn());
|
||||
}
|
||||
|
||||
contentHeight: flow.height + 2*Theme.paddingLarge
|
||||
|
||||
Flow {
|
||||
id: flow
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left; anchors.right: parent.right
|
||||
spacing: Theme.paddingMedium
|
||||
|
|
@ -51,11 +54,11 @@ Page {
|
|||
anchors.rightMargin: Theme.paddingLarge
|
||||
|
||||
Label {
|
||||
text: qsTr("Not logged into Netvibes")
|
||||
text: qsTr("Not signed in into Netvibes")
|
||||
visible: !signinForm.signedIn
|
||||
}
|
||||
Label {
|
||||
text: qsTr("Logged into Netvibes as:")
|
||||
text: qsTr("Signed in into Netvibes as:")
|
||||
visible: signinForm.signedIn
|
||||
}
|
||||
Label {
|
||||
|
|
@ -92,8 +95,8 @@ Page {
|
|||
|
||||
TextSwitch {
|
||||
id: autodownload
|
||||
text: qsTr("Cache articles after Update")
|
||||
description: qsTr("If enabled, all articles will be downloaded and cached for access in Offline mode after every update.")
|
||||
text: qsTr("Cache articles after Sync action")
|
||||
description: qsTr("If enabled, all articles will be downloaded and cached for access in Offline mode after every Sync action.")
|
||||
|
||||
Component.onCompleted: {
|
||||
checked = settings.getAutoDownloadOnUpdate();
|
||||
|
|
@ -107,7 +110,7 @@ Page {
|
|||
TextSwitch {
|
||||
id: offlinemode
|
||||
text: qsTr("Offline mode")
|
||||
description: qsTr("If enabled, content of articles will be displayed from local cache, without a network connection usage.")
|
||||
description: qsTr("If enabled, content of articles will be displayed from local cache, without a network usage.")
|
||||
|
||||
Component.onCompleted: {
|
||||
checked = settings.getOfflineMode();
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ Page {
|
|||
|
||||
ViewPlaceholder {
|
||||
enabled: listView.count == 0
|
||||
//enabled: true
|
||||
text: qsTr("No tabs")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ ApplicationWindow {
|
|||
|
||||
onBusy: {
|
||||
console.log("DM busy!");
|
||||
busy.text = "Caching for offline...";
|
||||
busy.text = "Caching...";
|
||||
busy.cancelable = true;
|
||||
busy.show();
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ ApplicationWindow {
|
|||
console.log("Fetcher progress: " + current + "/" + total);
|
||||
busy.text = "Fetching data... " + Math.floor((current / total) * 100) + "%";
|
||||
if (current === total) {
|
||||
busy.text = "Update done!";
|
||||
busy.text = "Sync done!";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -838,6 +838,9 @@ void NetvibesFetcher::taskEnd()
|
|||
_currentReply->deleteLater();
|
||||
_currentReply = 0;
|
||||
|
||||
Settings *s = Settings::instance();
|
||||
s->setNetvibesLastUpdateDate(QDateTime::currentDateTime().toTime_t());
|
||||
|
||||
if(_busyType) {
|
||||
qDebug() << "Update ends!";
|
||||
emit ready();
|
||||
|
|
|
|||
|
|
@ -115,6 +115,16 @@ int Settings::getNetvibesFeedUpdateAtOnce()
|
|||
return settings.value("feedupdateatonce", 20).toInt();
|
||||
}
|
||||
|
||||
void Settings::setNetvibesLastUpdateDate(int value)
|
||||
{
|
||||
settings.setValue("lastupdatedate", value);
|
||||
}
|
||||
|
||||
int Settings::getNetvibesLastUpdateDate()
|
||||
{
|
||||
return settings.value("lastupdatedate", 0).toInt();
|
||||
}
|
||||
|
||||
void Settings::setDmCacheRetencyFeedLimit(int value)
|
||||
{
|
||||
settings.setValue("dm_limit", value);
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ public:
|
|||
Q_INVOKABLE int getNetvibesFeedLimit();
|
||||
Q_INVOKABLE void setNetvibesFeedUpdateAtOnce(int value);
|
||||
Q_INVOKABLE int getNetvibesFeedUpdateAtOnce();
|
||||
Q_INVOKABLE void setNetvibesLastUpdateDate(int value);
|
||||
Q_INVOKABLE int getNetvibesLastUpdateDate();
|
||||
|
||||
// Download Manger
|
||||
Q_INVOKABLE void setDmConnections(int value);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue