offline: only ask for offline mode when possible

This commit is contained in:
Andrew Dolgov 2009-02-13 09:50:48 +03:00
parent 9ca945a6d2
commit a8caa4c7d3

View file

@ -1130,9 +1130,7 @@ function init_gears() {
} }
} }
function gotoOffline() { function offlineArticlesStored() {
// debug("[Local store] currentVersion = " + store.currentVersion);
var rs = db.execute("SELECT COUNT(*) FROM articles"); var rs = db.execute("SELECT COUNT(*) FROM articles");
var count = 0; var count = 0;
@ -1142,7 +1140,15 @@ function gotoOffline() {
rs.close(); 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."); notify_error("You have to synchronize some articles before going into offline mode.");
return; return;
} }
@ -1692,7 +1698,7 @@ function offlineSyncShowHideElems(syncing) {
function offlineConfirmModeChange() { function offlineConfirmModeChange() {
try { 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?")); var ok = confirm(__("Tiny Tiny RSS has trouble accessing its server. Would you like to go offline?"));
if (ok) { if (ok) {