-rw-r--r-- | pwmanager/pwmanager/pwmdoc.cpp | 15 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmprefs.cpp | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmprefs.h | 4 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle.cpp | 32 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle_0.cpp | 21 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle_0.h | 6 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle_1.cpp | 20 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle_1.h | 5 | ||||
-rw-r--r-- | pwmanager/pwmanager/serializer.cpp | 34 |
9 files changed, 107 insertions, 31 deletions
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp index 9fe4809..c167c2c 100644 --- a/pwmanager/pwmanager/pwmdoc.cpp +++ b/pwmanager/pwmanager/pwmdoc.cpp | |||
@@ -45,9 +45,11 @@ | |||
45 | #include <qfile.h> | 45 | #include <qfile.h> |
46 | 46 | ||
47 | #define __USE_GNU | ||
48 | #define _GNU_SOURCE | ||
47 | #include <stdio.h> | 49 | #include <stdio.h> |
48 | #include <stdlib.h> | 50 | #include <stdlib.h> |
49 | #include <errno.h> | 51 | #include <errno.h> |
50 | #include <string.h> | 52 | #include <string.h> |
51 | #include <iostream> | 53 | //US#include <iostream> |
52 | #include <algorithm> | 54 | #include <algorithm> |
53 | #include <sys/types.h> | 55 | #include <sys/types.h> |
@@ -1155,5 +1157,7 @@ bool PwMDoc::deSerializeDta(const string *d, bool entriesLocked) | |||
1155 | { | 1157 | { |
1156 | PWM_ASSERT(d); | 1158 | PWM_ASSERT(d); |
1159 | #ifndef PWM_EMBEDDED | ||
1157 | try { | 1160 | try { |
1161 | |||
1158 | Serializer ser(d->c_str()); | 1162 | Serializer ser(d->c_str()); |
1159 | ser.setDefaultLockStat(entriesLocked); | 1163 | ser.setDefaultLockStat(entriesLocked); |
@@ -1163,4 +1167,13 @@ bool PwMDoc::deSerializeDta(const string *d, bool entriesLocked) | |||
1163 | return false; | 1167 | return false; |
1164 | } | 1168 | } |
1169 | #else | ||
1170 | Serializer ser(d->c_str()); | ||
1171 | ser.setDefaultLockStat(entriesLocked); | ||
1172 | if (!ser.deSerialize(&dta)) | ||
1173 | return false; | ||
1174 | else | ||
1175 | return false; | ||
1176 | #endif | ||
1177 | |||
1165 | emitDataChanged(this); | 1178 | emitDataChanged(this); |
1166 | return true; | 1179 | return true; |
diff --git a/pwmanager/pwmanager/pwmprefs.cpp b/pwmanager/pwmanager/pwmprefs.cpp index 5779ecc..d3847f6 100644 --- a/pwmanager/pwmanager/pwmprefs.cpp +++ b/pwmanager/pwmanager/pwmprefs.cpp | |||
@@ -62,4 +62,5 @@ PWMPrefs::PWMPrefs() | |||
62 | addItemBool( "autoMinimizeOnStart", &mAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE ); | 62 | addItemBool( "autoMinimizeOnStart", &mAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE ); |
63 | addItemBool( "close", &mClose, CONF_DEFAULT_WNDCLOSE ); | 63 | addItemBool( "close", &mClose, CONF_DEFAULT_WNDCLOSE ); |
64 | addItemIntList( "CommentSplitter", &mCommentSplitter ); | ||
64 | } | 65 | } |
65 | 66 | ||
diff --git a/pwmanager/pwmanager/pwmprefs.h b/pwmanager/pwmanager/pwmprefs.h index bf7d8b1..6a89d10 100644 --- a/pwmanager/pwmanager/pwmprefs.h +++ b/pwmanager/pwmanager/pwmprefs.h | |||
@@ -135,4 +135,8 @@ public: | |||
135 | bool mClose; | 135 | bool mClose; |
136 | 136 | ||
137 | //US ENH | ||
138 | QValueList<int> mCommentSplitter; | ||
139 | |||
140 | |||
137 | // US introduce a nonconst way to return the config object. | 141 | // US introduce a nonconst way to return the config object. |
138 | KConfig* getConfig(); | 142 | KConfig* getConfig(); |
diff --git a/pwmanager/pwmanager/pwmviewstyle.cpp b/pwmanager/pwmanager/pwmviewstyle.cpp index 51d8f6c..9704615 100644 --- a/pwmanager/pwmanager/pwmviewstyle.cpp +++ b/pwmanager/pwmanager/pwmviewstyle.cpp | |||
@@ -42,7 +42,19 @@ PwMViewStyle::PwMViewStyle(QWidget *parent, const char *name) | |||
42 | PwMViewStyle::~PwMViewStyle() | 42 | PwMViewStyle::~PwMViewStyle() |
43 | { | 43 | { |
44 | //US ENH : load and store the size of the listviewcolumns | 44 | //US ENH : store the size of the listviewcolumns |
45 | lv->saveLayout(conf()->getConfig(), "listview"); | 45 | switch (curStyle) |
46 | conf()->getConfig()->sync(); | 46 | { |
47 | case style_0: | ||
48 | s0->saveSettings(PWMPrefs::instance()); | ||
49 | break; | ||
50 | case style_1: | ||
51 | s1->saveSettings(PWMPrefs::instance()); | ||
52 | break; | ||
53 | default: | ||
54 | BUG(); | ||
55 | } | ||
56 | |||
57 | |||
58 | PWMPrefs::instance()->getConfig()->sync(); | ||
47 | 59 | ||
48 | delete_ifnot_null(s0); | 60 | delete_ifnot_null(s0); |
@@ -89,6 +101,16 @@ void PwMViewStyle::initStyle(style_t style) | |||
89 | v->tmpReEnableSort(); | 101 | v->tmpReEnableSort(); |
90 | 102 | ||
91 | //US ENH : load and store the size of the listviewcolumns | 103 | //US ENH : load the size of the listviewcolumns |
92 | lv->restoreLayout(conf()->getConfig(), "listview"); | 104 | switch (style) |
105 | { | ||
106 | case style_0: | ||
107 | s0->restoreSettings(PWMPrefs::instance()); | ||
108 | break; | ||
109 | case style_1: | ||
110 | s1->restoreSettings(PWMPrefs::instance()); | ||
111 | break; | ||
112 | default: | ||
113 | BUG(); | ||
114 | } | ||
93 | 115 | ||
94 | resizeView(v->size()); | 116 | resizeView(v->size()); |
diff --git a/pwmanager/pwmanager/pwmviewstyle_0.cpp b/pwmanager/pwmanager/pwmviewstyle_0.cpp index 6d46ac6..7262684 100644 --- a/pwmanager/pwmanager/pwmviewstyle_0.cpp +++ b/pwmanager/pwmanager/pwmviewstyle_0.cpp | |||
@@ -24,5 +24,5 @@ | |||
24 | 24 | ||
25 | #include <klocale.h> | 25 | #include <klocale.h> |
26 | 26 | #include "pwmprefs.h" | |
27 | 27 | ||
28 | PwMViewStyle_0::PwMViewStyle_0(PwMView *view) | 28 | PwMViewStyle_0::PwMViewStyle_0(PwMView *view) |
@@ -92,2 +92,21 @@ void PwMViewStyle_0::selectCategory(const QString &cat) | |||
92 | categoriesCombo->setCurrentItem(0); | 92 | categoriesCombo->setCurrentItem(0); |
93 | } | 93 | } |
94 | |||
95 | |||
96 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize | ||
97 | void PwMViewStyle_0::restoreSettings(PWMPrefs* prefs) | ||
98 | { | ||
99 | //load and store the size of the listviewcolumns | ||
100 | lv->restoreLayout(prefs->getConfig(), "listview"); | ||
101 | splitter1->setSizes( prefs->mCommentSplitter ); | ||
102 | |||
103 | } | ||
104 | |||
105 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize | ||
106 | void PwMViewStyle_0::saveSettings(PWMPrefs* prefs) | ||
107 | { | ||
108 | //store the size of the listviewcolumns | ||
109 | lv->saveLayout(prefs->getConfig(), "listview"); | ||
110 | prefs->mCommentSplitter = splitter1->sizes(); | ||
111 | |||
112 | } | ||
diff --git a/pwmanager/pwmanager/pwmviewstyle_0.h b/pwmanager/pwmanager/pwmviewstyle_0.h index cc564c3..bd93c06 100644 --- a/pwmanager/pwmanager/pwmviewstyle_0.h +++ b/pwmanager/pwmanager/pwmviewstyle_0.h | |||
@@ -37,4 +37,5 @@ class PwMView; | |||
37 | class ListViewPwM; | 37 | class ListViewPwM; |
38 | class CommentBox; | 38 | class CommentBox; |
39 | class PWMPrefs; | ||
39 | 40 | ||
40 | class PwMViewStyle_0 : public QObject | 41 | class PwMViewStyle_0 : public QObject |
@@ -72,4 +73,9 @@ public: | |||
72 | { vbox1->resize(size); } | 73 | { vbox1->resize(size); } |
73 | 74 | ||
75 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize | ||
76 | void restoreSettings(PWMPrefs* prefs); | ||
77 | void saveSettings(PWMPrefs* prefs); | ||
78 | |||
79 | |||
74 | protected: | 80 | protected: |
75 | /** main list view */ | 81 | /** main list view */ |
diff --git a/pwmanager/pwmanager/pwmviewstyle_1.cpp b/pwmanager/pwmanager/pwmviewstyle_1.cpp index 4c24bc4..8b2d6d3 100644 --- a/pwmanager/pwmanager/pwmviewstyle_1.cpp +++ b/pwmanager/pwmanager/pwmviewstyle_1.cpp | |||
@@ -24,4 +24,5 @@ | |||
24 | 24 | ||
25 | #include <klocale.h> | 25 | #include <klocale.h> |
26 | #include "pwmprefs.h" | ||
26 | 27 | ||
27 | #define INITIAL_CATEGORIES_WIDTH100 | 28 | #define INITIAL_CATEGORIES_WIDTH100 |
@@ -126,4 +127,23 @@ void PwMViewStyle_1::selectCategory(const QString &cat) | |||
126 | } | 127 | } |
127 | 128 | ||
129 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize | ||
130 | void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs) | ||
131 | { | ||
132 | //load and store the size of the listviewcolumns | ||
133 | lv->restoreLayout(prefs->getConfig(), "listview"); | ||
134 | splitter2->setSizes( prefs->mCommentSplitter ); | ||
135 | |||
136 | } | ||
137 | |||
138 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize | ||
139 | void PwMViewStyle_1::saveSettings(PWMPrefs* prefs) | ||
140 | { | ||
141 | //store the size of the listviewcolumns | ||
142 | lv->saveLayout(prefs->getConfig(), "listview"); | ||
143 | prefs->mCommentSplitter = splitter2->sizes(); | ||
144 | |||
145 | } | ||
146 | |||
147 | |||
128 | #ifndef PWM_EMBEDDED | 148 | #ifndef PWM_EMBEDDED |
129 | #include "pwmviewstyle_1.moc" | 149 | #include "pwmviewstyle_1.moc" |
diff --git a/pwmanager/pwmanager/pwmviewstyle_1.h b/pwmanager/pwmanager/pwmviewstyle_1.h index a50f587..a7f100c 100644 --- a/pwmanager/pwmanager/pwmviewstyle_1.h +++ b/pwmanager/pwmanager/pwmviewstyle_1.h | |||
@@ -38,4 +38,5 @@ class PwMView; | |||
38 | class ListViewPwM; | 38 | class ListViewPwM; |
39 | class CommentBox; | 39 | class CommentBox; |
40 | class PWMPrefs; | ||
40 | 41 | ||
41 | class PwMViewStyle_1 : public QObject | 42 | class PwMViewStyle_1 : public QObject |
@@ -74,4 +75,8 @@ public: | |||
74 | { splitter->resize(size); } | 75 | { splitter->resize(size); } |
75 | 76 | ||
77 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize | ||
78 | void restoreSettings(PWMPrefs* prefs); | ||
79 | void saveSettings(PWMPrefs* prefs); | ||
80 | |||
76 | protected slots: | 81 | protected slots: |
77 | /** user clicked right button in category list */ | 82 | /** user clicked right button in category list */ |
diff --git a/pwmanager/pwmanager/serializer.cpp b/pwmanager/pwmanager/serializer.cpp index 9377e3d..a54ba8a 100644 --- a/pwmanager/pwmanager/serializer.cpp +++ b/pwmanager/pwmanager/serializer.cpp | |||
@@ -405,34 +405,15 @@ bool Serializer::extractMeta(const QDomNode &n, | |||
405 | #else | 405 | #else |
406 | 406 | ||
407 | QDateTime m_dt; | ||
408 | |||
409 | if ((name == META_CREATE_DATE) || | ||
410 | (name == META_VALID_DATE) || | ||
411 | (name == META_EXPIRE_DATE) || | ||
412 | (name == META_UPDATE_DATE)) | ||
413 | { | ||
414 | int pos = val.find("T"); | ||
415 | QString date = val.left(pos); | ||
416 | QString time = val.mid(pos+1); | ||
417 | qDebug("Serializer::extractMeta from %s to date=%s ,time=%s",val.latin1(), date.latin1(), time.latin1() ); | ||
418 | bool ok1, ok2; | ||
419 | |||
420 | QDate m_date = KGlobal::locale()->readDate(date, &ok1); | ||
421 | QTime m_time = KGlobal::locale()->readTime(time, &ok2); | ||
422 | if ((ok1 == false) || (ok2 == false)) | ||
423 | qDebug("Serializer::extractMeta invalid date or time !!!!!!!!!!!!!"); | ||
424 | m_dt.setDate(m_date); | ||
425 | m_dt.setTime(m_time); | ||
426 | } | ||
427 | 407 | ||
408 | bool ok = true; | ||
428 | 409 | ||
429 | if (name == META_CREATE_DATE) { | 410 | if (name == META_CREATE_DATE) { |
430 | dta->create = m_dt; | 411 | dta->create = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok); |
431 | } else if (name == META_VALID_DATE) { | 412 | } else if (name == META_VALID_DATE) { |
432 | dta->valid = m_dt; | 413 | dta->valid = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok); |
433 | } else if (name == META_EXPIRE_DATE) { | 414 | } else if (name == META_EXPIRE_DATE) { |
434 | dta->expire = m_dt; | 415 | dta->expire = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok); |
435 | } else if (name == META_UPDATE_DATE) { | 416 | } else if (name == META_UPDATE_DATE) { |
436 | dta->update = m_dt; | 417 | dta->update = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok); |
437 | } else if (name == META_UPDATE_INT) { | 418 | } else if (name == META_UPDATE_INT) { |
438 | dta->updateInt = strtoul(val.latin1(), 0, 10); | 419 | dta->updateInt = strtoul(val.latin1(), 0, 10); |
@@ -443,4 +424,9 @@ bool Serializer::extractMeta(const QDomNode &n, | |||
443 | + name.latin1()); | 424 | + name.latin1()); |
444 | } | 425 | } |
426 | |||
427 | if (ok == false) | ||
428 | qDebug("Serializer::extractMeta invalid date or time !!!!!!!!!!!!!"); | ||
429 | |||
430 | |||
445 | #endif | 431 | #endif |
446 | cur = cur.nextSibling(); | 432 | cur = cur.nextSibling(); |