summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorniko <niko>2012-05-21 21:13:25 (GMT)
committerniko <niko>2012-05-21 21:13:25 (GMT)
commitee08d9d1d312aa2940930bc6f6d7d5fc08b3bf19 (patch)
tree6159a5c474e6e709aa2445f6af950ae4ffe51fcf /src
parent6183e431b066f444a63a0bb90cb0fe3d147ac0b9 (diff)
downloadsynckolab-ee08d9d1d312aa2940930bc6f6d7d5fc08b3bf19.tar.gz
fix #24904
Diffstat (limited to 'src')
-rw-r--r--src/chrome/content/synckolab/calendarTools.js38
-rw-r--r--src/chrome/content/synckolab/tools.js7
-rw-r--r--src/chrome/content/synckolab/wndConfig.js64
-rw-r--r--src/chrome/locale/de/synckolab.properties1
-rw-r--r--src/chrome/locale/en-US/synckolab.properties1
-rw-r--r--src/chrome/locale/fr-FR/synckolab.properties1
-rw-r--r--src/chrome/locale/hu-HU/synckolab.properties1
-rw-r--r--src/chrome/locale/it/synckolab.properties1
-rw-r--r--src/chrome/locale/ja-JP/synckolab.properties1
-rw-r--r--src/chrome/locale/pl-PL/synckolab.properties1
10 files changed, 103 insertions, 13 deletions
diff --git a/src/chrome/content/synckolab/calendarTools.js b/src/chrome/content/synckolab/calendarTools.js
index ef59c71..e21c489 100644
--- a/src/chrome/content/synckolab/calendarTools.js
+++ b/src/chrome/content/synckolab/calendarTools.js
@@ -175,7 +175,22 @@ com.synckolab.calendarTools = {
case "title":
item.title = value;
break;
-
+ case "priority":
+ if(!isNaN(value)) {
+ item.priority = Number(value);
+ } else
+ {
+ item.priority = 0;
+ }
+ break;
+ case "daynumber":
+ if(!isNaN(value)) {
+ item.daynumber = Number(value);
+ } else
+ {
+ item.daynumber = 0;
+ }
+ break;
default:
if (!value || value === "") {
item.deleteProperty(propertyName);
@@ -490,15 +505,13 @@ com.synckolab.calendarTools.event2json = function (event, syncTasks) {
// Alarms (only allow relative alarms)
var alarm;
var alarms = event.getAlarms({});
-
for(i=0; i < alarms.length; i++) {
alarm = alarms[i];
// skip absolute - ALARM_RELATED_ABSOLUTE = 0;
- if (alarm.related === 0) {
+ if (alarm.related === alarm.ALARM_RELATED_ABSOLUTE) {
continue;
}
minutes = Math.floor(Math.abs(alarm.offset.inSeconds)/60);
-
tmpobj = {
offset: minutes,
related: 1
@@ -511,10 +524,11 @@ com.synckolab.calendarTools.event2json = function (event, syncTasks) {
// only create if there are alarms
if(calarms.length > 0) {
- tmpobj.alarms = calarms;
+ jobj.alarms = calarms;
}
}
- else if (event.alarmOffset && event.alarmOffset.inSeconds !== 0)
+
+ if ((!jobj.alarms || jobj.alarms.length === 0) && event.alarmOffset && event.alarmOffset.inSeconds !== 0)
{
jobj.alarms = [];
minutes = Math.floor(Math.abs(event.alarmOffset.inSeconds)/60);
@@ -1262,7 +1276,7 @@ com.synckolab.calendarTools.xml2json = function (xml, syncTasks)
detail = cur.getChildNode("daynumber");
if ((detail) && (detail.nodeType === Node.ELEMENT_NODE) && (detail.nodeName.toUpperCase() === "DAYNUMBER"))
{
- jobj.recurrence.daynumber = detail.firstChild.data;
+ jobj.recurrence.daynumber = Number(detail.firstChild.data);
}
break;
case "WEEKDAY":
@@ -1277,7 +1291,7 @@ com.synckolab.calendarTools.xml2json = function (xml, syncTasks)
}
if ((detail.nodeType === Node.ELEMENT_NODE) && (detail.nodeName.toUpperCase() === "DAYNUMBER"))
{
- jobj.recurrence.daynumber = detail.firstChild.data;
+ jobj.recurrence.daynumber = Number(detail.firstChild.data);
}
detail = detail.nextSibling;
}
@@ -1297,7 +1311,7 @@ com.synckolab.calendarTools.xml2json = function (xml, syncTasks)
detail = cur.firstChild;
if ((detail) && (detail.nodeType === Node.ELEMENT_NODE) && (detail.nodeName.toUpperCase() === "DAYNUMBER"))
{
- daynumber = detail.firstChild.data;
+ daynumber = Number(detail.firstChild.data);
// FIXME this needs to be written to the event when supported by Lightning
}
break;
@@ -1308,11 +1322,11 @@ com.synckolab.calendarTools.xml2json = function (xml, syncTasks)
{
if ((detail.nodeType === Node.ELEMENT_NODE) && (detail.nodeName.toUpperCase() === "MONTH"))
{
- month = detail.firstChild.data;
+ month = Number(detail.firstChild.data);
}
if ((detail.nodeType === Node.ELEMENT_NODE) && (detail.nodeName.toUpperCase() === "DAYNUMBER"))
{
- daynumber = detail.firstChild.data;
+ daynumber = Number(detail.firstChild.data);
}
detail = detail.nextSibling;
}
@@ -1333,7 +1347,7 @@ com.synckolab.calendarTools.xml2json = function (xml, syncTasks)
}
if ((detail.nodeType === Node.ELEMENT_NODE) && (detail.nodeName.toUpperCase() === "DAYNUMBER"))
{
- daynumber = detail.firstChild.data;
+ daynumber = Number(detail.firstChild.data);
}
detail = detail.nextSibling;
}
diff --git a/src/chrome/content/synckolab/tools.js b/src/chrome/content/synckolab/tools.js
index 24bf2d1..b423d03 100644
--- a/src/chrome/content/synckolab/tools.js
+++ b/src/chrome/content/synckolab/tools.js
@@ -183,6 +183,11 @@ equalsObject: function(a, b)
var p;
for(p in a) {
if(p !== "synckolab" && typeof(b[p]) === 'undefined' && a[p] !== null && a[p] !== "") {
+ // 0 == undefined
+ if((a[p] === "0" || a[p] === 0) && !b[p])
+ {
+ continue;
+ }
com.synckolab.tools.logMessage("not equals: " + p + " a: " + a[p] + " b: " + b[p], com.synckolab.global.LOG_DEBUG);
return false;
}
@@ -201,7 +206,7 @@ equalsObject: function(a, b)
case 'function': // skip functions
break;
default:
- if (a[p] !== b[p]) {
+ if (a[p] !== b[p] && Number(a[p]) !== Number(b[p])) {
com.synckolab.tools.logMessage("not equals: : " + p + " a: " + a[p] + " b: " + b[p], com.synckolab.global.LOG_DEBUG);
return false;
}
diff --git a/src/chrome/content/synckolab/wndConfig.js b/src/chrome/content/synckolab/wndConfig.js
index f2f27b7..47a8dd7 100644
--- a/src/chrome/content/synckolab/wndConfig.js
+++ b/src/chrome/content/synckolab/wndConfig.js
@@ -207,6 +207,8 @@ com.synckolab.settings.writeAccountConfig = function (pref, acct, orig) {
*/
com.synckolab.settings.init = function () {
var i = 0, j;
+
+ com.synckolab.settings.checkOldConfig();
// load the string bundle for translation
com.synckolab.settings.strBundle = document.getElementById("synckolabBundle");
@@ -408,6 +410,68 @@ com.synckolab.settings.init = function () {
};
/**
+ * read the current configuration and see if its "old" style
+ */
+com.synckolab.settings.checkOldConfig = function() {
+ var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+
+ var configString = com.synckolab.tools.getConfigValue(pref, "Configs");
+ // no configs - no old config
+ if(!configString || configString.length === 0) {
+ return;
+ }
+ /*
+ if(!confirm( com.synckolab.global.strBundle.getString("config.convert"))) {
+ pref.resetBranch("SyncKolab");
+ return;
+ }
+
+ configs = configString.split(';');
+ var curConfig = {
+ version: com.synckolab.tools.getConfigValue(pref, "configVersion", com.synckolab.tools.CONFIG_TYPE_INT, 0),
+ debugLevel: com.synckolab.tools.getConfigValue(pref, "debugLevel", com.synckolab.tools.CONFIG_TYPE_INT, com.synckolab.global.LOG_WARNING),
+ // hide folder
+ hideFolder: com.synckolab.tools.getConfigValue(pref, "hideFolder", com.synckolab.tools.CONFIG_TYPE_BOOL, false),
+ // hide the window while sync
+ hiddenWindow: com.synckolab.tools.getConfigValue(pref, "hiddenWindow", com.synckolab.tools.CONFIG_TYPE_BOOL, false),
+ // sync automatically once on start
+ syncOnStart: com.synckolab.tools.getConfigValue(pref, "syncOnStart", com.synckolab.tools.CONFIG_TYPE_BOOL, false),
+ accounts: []
+ };
+
+ for(var i = 0; i < configs.length; i++) {
+ var config = configs[i];
+ var act = pref.getCharPref("SyncKolab."+config+".IncomingServer");
+ if(!act) {
+ continue;
+ }
+
+ act = com.synckolab.tools.text.fixNameToMiniCharset(act);
+
+ var acct = null;
+ var j;
+ for(j = 0; j < curConfig.accounts.length; j++) {
+ if(curConfig.accounts[j].name === act) {
+ acct = curConfig.accounts[j];
+ }
+ }
+
+ if(acct == null) {
+ acct = {
+ name: act,
+ contact: [],
+ calendar: [],
+ task: []
+ }
+ }
+
+ sConf = com.synckolab.tools.getConfigValue(pref, "accounts." + acct.name+"." + type + ".list");
+ }
+
+ */
+};
+
+/**
* re-create the config tree,
*/
com.synckolab.settings.repaintConfigTree = function() {
diff --git a/src/chrome/locale/de/synckolab.properties b/src/chrome/locale/de/synckolab.properties
index a8b8ad4..92daed0 100644
--- a/src/chrome/locale/de/synckolab.properties
+++ b/src/chrome/locale/de/synckolab.properties
@@ -7,6 +7,7 @@ aboutSyncKolab=\u00dcber SyncKolab
saveConfig=Konfiguration Speichern
configFiles=Konfigurationen
loadConfig=Konfiguration Laden
+configImport=Es wurde eine alte Konfiguration gefunden. M\u00f6chten Sie diese laden?
configReplaceAll=M\u00f6chten Sie die gesamte Konfiguration \u00fcberschreiben?
configInvalid=Die Konfigurationsdatei ist fehlerhaft!
configOverwrite=M\u00f6chten Sie die Konfiguration \u00fcberschreiben:
diff --git a/src/chrome/locale/en-US/synckolab.properties b/src/chrome/locale/en-US/synckolab.properties
index 277c43d..793382d 100644
--- a/src/chrome/locale/en-US/synckolab.properties
+++ b/src/chrome/locale/en-US/synckolab.properties
@@ -7,6 +7,7 @@ aboutSyncKolab=About SyncKolab
saveConfig=Save Configuration
configFiles=Config Files
loadConfig=Load Configuration
+configImport=Found an old configuration, do you want to import it?
configReplaceAll=Are you sure you want to replace the current configuration?
configInvalid=Invalid Configuration File
configOverwrite=Are you sure you want to overwrite:
diff --git a/src/chrome/locale/fr-FR/synckolab.properties b/src/chrome/locale/fr-FR/synckolab.properties
index 262e43b..977c6bf 100644
--- a/src/chrome/locale/fr-FR/synckolab.properties
+++ b/src/chrome/locale/fr-FR/synckolab.properties
@@ -7,6 +7,7 @@ aboutSyncKolab=A propos de SyncKolab
saveConfig=Sauver la Configuration
configFiles=Fichiers de Configuration
loadConfig=Charger la Configuration
+configImport=Found an old configuration, do you want to import it?
configReplaceAll=Etes vous sur de vouloir remplacer la configuration actuelle ?
configInvalid=Fichiers de Configuration incorrects
configOverwrite=Etes vous sur que vous voulez r\u00e9ecrire:
diff --git a/src/chrome/locale/hu-HU/synckolab.properties b/src/chrome/locale/hu-HU/synckolab.properties
index badf786..63c868a 100644
--- a/src/chrome/locale/hu-HU/synckolab.properties
+++ b/src/chrome/locale/hu-HU/synckolab.properties
@@ -7,6 +7,7 @@ aboutSyncKolab=SyncKolab n\u00e9vjegye
saveConfig=Be\u00e1ll\u00edt\u00e1sok ment\u00e9se
configFiles=Konfigur\u00e1ci\u00f3s f\u00e1jlok
loadConfig=Be\u00e1ll\u00edt\u00e1sok bet\u00f6lt\u00e9se
+configImport=Found an old configuration, do you want to import it?
configReplaceAll=Biztos benne, hogy le akarja cser\u00e9lni a jelenlegi be\u00e1ll\u00edt\u00e1sokat?
configInvalid=Helytelen konfigur\u00e1ci\u00f3s f\u00e1jl
configOverwrite=Biztos, hogy fel\u00fcl akarja \u00edrni:
diff --git a/src/chrome/locale/it/synckolab.properties b/src/chrome/locale/it/synckolab.properties
index f3a9f39..47a1625 100644
--- a/src/chrome/locale/it/synckolab.properties
+++ b/src/chrome/locale/it/synckolab.properties
@@ -7,6 +7,7 @@ aboutSyncKolab=About SyncKolab
saveConfig=Save Configuration
configFiles=Config Files
loadConfig=Load Configuration
+configImport=Found an old configuration, do you want to import it?
configReplaceAll=Are you sure you want to replace the current configuration?
configInvalid=Invalid Configuration File
configOverwrite=Are you sure you want to overwrite:
diff --git a/src/chrome/locale/ja-JP/synckolab.properties b/src/chrome/locale/ja-JP/synckolab.properties
index 96ba929..f4d44ab 100644
--- a/src/chrome/locale/ja-JP/synckolab.properties
+++ b/src/chrome/locale/ja-JP/synckolab.properties
@@ -7,6 +7,7 @@ aboutSyncKolab=About SyncKolab
saveConfig=Save Configuration
configFiles=Config Files
loadConfig=Load Configuration
+configImport=Found an old configuration, do you want to import it?
configReplaceAll=Are you sure you want to replace the current configuration?
configInvalid=Invalid Configuration File
configOverwrite=Are you sure you want to overwrite:
diff --git a/src/chrome/locale/pl-PL/synckolab.properties b/src/chrome/locale/pl-PL/synckolab.properties
index d9dc813..42e2d46 100644
--- a/src/chrome/locale/pl-PL/synckolab.properties
+++ b/src/chrome/locale/pl-PL/synckolab.properties
@@ -7,6 +7,7 @@ aboutSyncKolab=O SyncKolabie
saveConfig=Zapisz konfiguracj\u0119
configFiles=Pliki konfiguracyjne
loadConfig=Za\u0142aduj konfiguracj\u0119
+configImport=Found an old configuration, do you want to import it?
configReplaceAll=Czy na pewno chcesz nadpisa\u0107 bierz\u0105c\u0105 konfiguracj\u0119?
configInvalid=Niew\u0142a\u015bciwy plik konfiguracyjny
configOverwrite=Czy na pewno chcesz nadpisa\u0107: