From a8caa4c7d30925f270a6ed6e279e52da96fad4b4 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 13 Feb 2009 09:50:48 +0300 Subject: [PATCH] offline: only ask for offline mode when possible --- offline.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/offline.js b/offline.js index ff09b716..d9b32cf2 100644 --- a/offline.js +++ b/offline.js @@ -1130,9 +1130,7 @@ function init_gears() { } } -function gotoOffline() { - -// debug("[Local store] currentVersion = " + store.currentVersion); +function offlineArticlesStored() { var rs = db.execute("SELECT COUNT(*) FROM articles"); var count = 0; @@ -1142,7 +1140,15 @@ function gotoOffline() { rs.close(); - if (count == 0) { + return count; +} + +function gotoOffline() { + +// debug("[Local store] currentVersion = " + store.currentVersion); + + + if (offlineArticlesStored() == 0) { notify_error("You have to synchronize some articles before going into offline mode."); return; } @@ -1692,7 +1698,7 @@ function offlineSyncShowHideElems(syncing) { function offlineConfirmModeChange() { try { - if (db) { + if (db && getInitParam("offline_enabled") == "1" && offlineArticlesStored() > 0) { var ok = confirm(__("Tiny Tiny RSS has trouble accessing its server. Would you like to go offline?")); if (ok) { -- 2.39.5