summaryrefslogtreecommitdiffabout
path: root/pwmanager
authorulf69 <ulf69>2004-09-29 06:21:37 (UTC)
committer ulf69 <ulf69>2004-09-29 06:21:37 (UTC)
commit53c2eac6f60a37f9ac8fc10b86460eb9c7347b51 (patch) (side-by-side diff)
tree1f2fb8a996c9e97465df770364777eacaecefa34 /pwmanager
parent72b990edf0191c2e86204308ce2cac07120284bf (diff)
downloadkdepimpi-53c2eac6f60a37f9ac8fc10b86460eb9c7347b51.zip
kdepimpi-53c2eac6f60a37f9ac8fc10b86460eb9c7347b51.tar.gz
kdepimpi-53c2eac6f60a37f9ac8fc10b86460eb9c7347b51.tar.bz2
*** empty log message ***
Diffstat (limited to 'pwmanager') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp15
-rw-r--r--pwmanager/pwmanager/pwmprefs.cpp1
-rw-r--r--pwmanager/pwmanager/pwmprefs.h4
-rw-r--r--pwmanager/pwmanager/pwmviewstyle.cpp32
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_0.cpp21
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_0.h6
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_1.cpp20
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_1.h5
-rw-r--r--pwmanager/pwmanager/serializer.cpp34
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
@@ -46,2 +46,4 @@
+#define __USE_GNU
+#define _GNU_SOURCE
#include <stdio.h>
@@ -50,3 +52,3 @@
#include <string.h>
-#include <iostream>
+//US#include <iostream>
#include <algorithm>
@@ -1156,3 +1158,5 @@ bool PwMDoc::deSerializeDta(const string *d, bool entriesLocked)
PWM_ASSERT(d);
+#ifndef PWM_EMBEDDED
try {
+
Serializer ser(d->c_str());
@@ -1164,2 +1168,11 @@ bool PwMDoc::deSerializeDta(const string *d, bool entriesLocked)
}
+#else
+ Serializer ser(d->c_str());
+ ser.setDefaultLockStat(entriesLocked);
+ if (!ser.deSerialize(&dta))
+ return false;
+ else
+ return false;
+#endif
+
emitDataChanged(this);
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
@@ -63,2 +63,3 @@ PWMPrefs::PWMPrefs()
addItemBool( "close", &mClose, CONF_DEFAULT_WNDCLOSE );
+ addItemIntList( "CommentSplitter", &mCommentSplitter );
}
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
@@ -136,2 +136,6 @@ public:
+ //US ENH
+ QValueList<int> mCommentSplitter;
+
+
// US introduce a nonconst way to return the config object.
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
@@ -43,5 +43,17 @@ PwMViewStyle::~PwMViewStyle()
{
- //US ENH : load and store the size of the listviewcolumns
- lv->saveLayout(conf()->getConfig(), "listview");
- conf()->getConfig()->sync();
+ //US ENH : store the size of the listviewcolumns
+ switch (curStyle)
+ {
+ case style_0:
+ s0->saveSettings(PWMPrefs::instance());
+ break;
+ case style_1:
+ s1->saveSettings(PWMPrefs::instance());
+ break;
+ default:
+ BUG();
+ }
+
+
+ PWMPrefs::instance()->getConfig()->sync();
@@ -90,4 +102,14 @@ void PwMViewStyle::initStyle(style_t style)
- //US ENH : load and store the size of the listviewcolumns
- lv->restoreLayout(conf()->getConfig(), "listview");
+ //US ENH : load the size of the listviewcolumns
+ switch (style)
+ {
+ case style_0:
+ s0->restoreSettings(PWMPrefs::instance());
+ break;
+ case style_1:
+ s1->restoreSettings(PWMPrefs::instance());
+ break;
+ default:
+ BUG();
+ }
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
@@ -25,3 +25,3 @@
#include <klocale.h>
-
+#include "pwmprefs.h"
@@ -93 +93,20 @@ void PwMViewStyle_0::selectCategory(const QString &cat)
}
+
+
+//US ENH: I need a place to load the view dependend settings. Eg. splittersize
+void PwMViewStyle_0::restoreSettings(PWMPrefs* prefs)
+{
+ //load and store the size of the listviewcolumns
+ lv->restoreLayout(prefs->getConfig(), "listview");
+ splitter1->setSizes( prefs->mCommentSplitter );
+
+}
+
+//US ENH: I need a place to load the view dependend settings. Eg. splittersize
+void PwMViewStyle_0::saveSettings(PWMPrefs* prefs)
+{
+ //store the size of the listviewcolumns
+ lv->saveLayout(prefs->getConfig(), "listview");
+ prefs->mCommentSplitter = splitter1->sizes();
+
+}
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
@@ -38,2 +38,3 @@ class ListViewPwM;
class CommentBox;
+class PWMPrefs;
@@ -73,2 +74,7 @@ public:
+ //US ENH: I need a place to load the view dependend settings. Eg. splittersize
+ void restoreSettings(PWMPrefs* prefs);
+ void saveSettings(PWMPrefs* prefs);
+
+
protected:
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
@@ -25,2 +25,3 @@
#include <klocale.h>
+#include "pwmprefs.h"
@@ -127,2 +128,21 @@ void PwMViewStyle_1::selectCategory(const QString &cat)
+//US ENH: I need a place to load the view dependend settings. Eg. splittersize
+void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs)
+{
+ //load and store the size of the listviewcolumns
+ lv->restoreLayout(prefs->getConfig(), "listview");
+ splitter2->setSizes( prefs->mCommentSplitter );
+
+}
+
+//US ENH: I need a place to load the view dependend settings. Eg. splittersize
+void PwMViewStyle_1::saveSettings(PWMPrefs* prefs)
+{
+ //store the size of the listviewcolumns
+ lv->saveLayout(prefs->getConfig(), "listview");
+ prefs->mCommentSplitter = splitter2->sizes();
+
+}
+
+
#ifndef PWM_EMBEDDED
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
@@ -39,2 +39,3 @@ class ListViewPwM;
class CommentBox;
+class PWMPrefs;
@@ -75,2 +76,6 @@ public:
+ //US ENH: I need a place to load the view dependend settings. Eg. splittersize
+ void restoreSettings(PWMPrefs* prefs);
+ void saveSettings(PWMPrefs* prefs);
+
protected slots:
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
@@ -406,32 +406,13 @@ bool Serializer::extractMeta(const QDomNode &n,
- QDateTime m_dt;
-
- if ((name == META_CREATE_DATE) ||
- (name == META_VALID_DATE) ||
- (name == META_EXPIRE_DATE) ||
- (name == META_UPDATE_DATE))
- {
- int pos = val.find("T");
- QString date = val.left(pos);
- QString time = val.mid(pos+1);
- qDebug("Serializer::extractMeta from %s to date=%s ,time=%s",val.latin1(), date.latin1(), time.latin1() );
- bool ok1, ok2;
-
- QDate m_date = KGlobal::locale()->readDate(date, &ok1);
- QTime m_time = KGlobal::locale()->readTime(time, &ok2);
- if ((ok1 == false) || (ok2 == false))
- qDebug("Serializer::extractMeta invalid date or time !!!!!!!!!!!!!");
- m_dt.setDate(m_date);
- m_dt.setTime(m_time);
- }
+ bool ok = true;
if (name == META_CREATE_DATE) {
- dta->create = m_dt;
+ dta->create = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok);
} else if (name == META_VALID_DATE) {
- dta->valid = m_dt;
+ dta->valid = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok);
} else if (name == META_EXPIRE_DATE) {
- dta->expire = m_dt;
+ dta->expire = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok);
} else if (name == META_UPDATE_DATE) {
- dta->update = m_dt;
+ dta->update = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok);
} else if (name == META_UPDATE_INT) {
@@ -444,2 +425,7 @@ bool Serializer::extractMeta(const QDomNode &n,
}
+
+ if (ok == false)
+ qDebug("Serializer::extractMeta invalid date or time !!!!!!!!!!!!!");
+
+
#endif