summaryrefslogtreecommitdiff
path: root/frontend/delta/js/Clipperz/PM/DataModel/DevicePreferences.js
Unidiff
Diffstat (limited to 'frontend/delta/js/Clipperz/PM/DataModel/DevicePreferences.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/delta/js/Clipperz/PM/DataModel/DevicePreferences.js90
1 files changed, 90 insertions, 0 deletions
diff --git a/frontend/delta/js/Clipperz/PM/DataModel/DevicePreferences.js b/frontend/delta/js/Clipperz/PM/DataModel/DevicePreferences.js
new file mode 100644
index 0000000..ff3b33f
--- a/dev/null
+++ b/frontend/delta/js/Clipperz/PM/DataModel/DevicePreferences.js
@@ -0,0 +1,90 @@
1/*
2
3Copyright 2008-2013 Clipperz Srl
4
5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please
7refer to http://www.clipperz.com.
8
9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details.
18
19* You should have received a copy of the GNU Affero General Public
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21
22*/
23
24Clipperz.PM.DataModel.DevicePreferences = function (args) {
25 args = args || {};
26
27 this._data = null;
28
29 Clipperz.PM.DataModel.DevicePreferences.superclass.constructor.apply(this, arguments);
30
31 return this;
32}
33
34Clipperz.Base.extend(Clipperz.PM.DataModel.DevicePreferences, Object, {
35
36 toString: function () {
37 return "Clipperz.PM.DataModel.DevicePreferences";
38 },
39
40 //-------------------------------------------------------------------------
41
42 shouldStoreDataLocally: function () {
43 return (localStorage.getItem('shouldStoreDataLocally') === 'true');
44 },
45
46 setShouldStoreDataLocally: function (aValue) {
47 localStorage.setItem('shouldStoreDataLocally', aValue);
48 },
49
50 //-------------------------------------------------------------------------
51
52 setAccountDataWityResponse: function (aResponse) {
53 localStorage.setItem('clipperz_dump_data', aResponse['data']);
54 localStorage.setItem('clipperz_dump_version',aResponse['version']);
55 localStorage.setItem('clipperz_dump_date', new Date());
56
57 this._data = null;
58 },
59
60 accountData: function () {
61 if (this._data == null) {
62 vardata;
63
64 data = localStorage.getItem('clipperz_dump_data');
65 if (data != null) {
66 this._data = JSON.parse(data);
67 }
68 }
69
70 return this._data;
71 },
72
73 latestDownload: function () {
74 varresult;
75 vardate;
76
77 date = localStorage.getItem('clipperz_dump_date');
78 if (date != null) {
79 result = new Date(date);
80 } else {
81 result = null;
82 }
83
84 return result;
85 },
86
87 //=========================================================================
88 __syntaxFix__: "syntax fix"
89});
90