summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-09-29 06:21:37 (UTC)
committer ulf69 <ulf69>2004-09-29 06:21:37 (UTC)
commit53c2eac6f60a37f9ac8fc10b86460eb9c7347b51 (patch) (unidiff)
tree1f2fb8a996c9e97465df770364777eacaecefa34
parent72b990edf0191c2e86204308ce2cac07120284bf (diff)
downloadkdepimpi-53c2eac6f60a37f9ac8fc10b86460eb9c7347b51.zip
kdepimpi-53c2eac6f60a37f9ac8fc10b86460eb9c7347b51.tar.gz
kdepimpi-53c2eac6f60a37f9ac8fc10b86460eb9c7347b51.tar.bz2
*** empty log message ***
Diffstat (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
@@ -23,53 +23,55 @@
23#include "sha1.h" 23#include "sha1.h"
24#include "globalstuff.h" 24#include "globalstuff.h"
25#include "gpasmanfile.h" 25#include "gpasmanfile.h"
26#include "serializer.h" 26#include "serializer.h"
27#include "compressgzip.h" 27#include "compressgzip.h"
28#include "compressbzip2.h" 28#include "compressbzip2.h"
29#include "randomizer.h" 29#include "randomizer.h"
30#include "pwminit.h" 30#include "pwminit.h"
31#ifndef PWM_EMBEDDED 31#ifndef PWM_EMBEDDED
32//US #include "libgryptif.h" 32//US #include "libgryptif.h"
33#else 33#else
34#include "pwmprefs.h" 34#include "pwmprefs.h"
35#include "kglobal.h" 35#include "kglobal.h"
36#endif 36#endif
37 37
38#ifdef CONFIG_KWALLETIF 38#ifdef CONFIG_KWALLETIF
39# include "kwalletemu.h" 39# include "kwalletemu.h"
40#endif // CONFIG_KWALLETIF 40#endif // CONFIG_KWALLETIF
41 41
42#include <qdatetime.h> 42#include <qdatetime.h>
43#include <qsize.h> 43#include <qsize.h>
44#include <qfileinfo.h> 44#include <qfileinfo.h>
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>
54#include <sys/stat.h> 56#include <sys/stat.h>
55#include <unistd.h> 57#include <unistd.h>
56#include <stdint.h> 58#include <stdint.h>
57 59
58//TODO: reset to its normal value. 60//TODO: reset to its normal value.
59 #define META_CHECK_TIMER_INTERVAL10/*300*/ /* sek */ 61 #define META_CHECK_TIMER_INTERVAL10/*300*/ /* sek */
60 62
61using namespace std; 63using namespace std;
62 64
63 65
64void PwMDocList::add(PwMDoc *doc, const string &id) 66void PwMDocList::add(PwMDoc *doc, const string &id)
65{ 67{
66#ifdef PWM_DEBUG 68#ifdef PWM_DEBUG
67 // check for existance of object in debug mode only. 69 // check for existance of object in debug mode only.
68 vector<listItem>::iterator begin = docList.begin(), 70 vector<listItem>::iterator begin = docList.begin(),
69 end = docList.end(), 71 end = docList.end(),
70 i = begin; 72 i = begin;
71 while (i != end) { 73 while (i != end) {
72 if (i->doc == doc) { 74 if (i->doc == doc) {
73 BUG(); 75 BUG();
74 return; 76 return;
75 } 77 }
@@ -1133,56 +1135,67 @@ unsigned int PwMDoc::numEntries(const QString &category)
1133 1135
1134 if (!findCategory(category, &cat)) { 1136 if (!findCategory(category, &cat)) {
1135 BUG(); 1137 BUG();
1136 return 0; 1138 return 0;
1137 } 1139 }
1138 1140
1139 return numEntries(cat); 1141 return numEntries(cat);
1140} 1142}
1141 1143
1142bool PwMDoc::serializeDta(string *d) 1144bool PwMDoc::serializeDta(string *d)
1143{ 1145{
1144 PWM_ASSERT(d); 1146 PWM_ASSERT(d);
1145 Serializer ser; 1147 Serializer ser;
1146 if (!ser.serialize(dta)) 1148 if (!ser.serialize(dta))
1147 return false; 1149 return false;
1148 d->assign(ser.getXml()); 1150 d->assign(ser.getXml());
1149 if (!d->size()) 1151 if (!d->size())
1150 return false; 1152 return false;
1151 return true; 1153 return true;
1152} 1154}
1153 1155
1154bool PwMDoc::deSerializeDta(const string *d, bool entriesLocked) 1156bool 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);
1160 if (!ser.deSerialize(&dta)) 1164 if (!ser.deSerialize(&dta))
1161 return false; 1165 return false;
1162 } catch (PwMException) { 1166 } catch (PwMException) {
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;
1167} 1180}
1168 1181
1169bool PwMDoc::getEntry(const QString &category, unsigned int index, 1182bool PwMDoc::getEntry(const QString &category, unsigned int index,
1170 PwMDataItem * d, bool unlockIfLocked) 1183 PwMDataItem * d, bool unlockIfLocked)
1171{ 1184{
1172 PWM_ASSERT(d); 1185 PWM_ASSERT(d);
1173 unsigned int cat = 0; 1186 unsigned int cat = 0;
1174 1187
1175 if (!findCategory(category, &cat)) { 1188 if (!findCategory(category, &cat)) {
1176 BUG(); 1189 BUG();
1177 return false; 1190 return false;
1178 } 1191 }
1179 1192
1180 return getEntry(cat, index, d, unlockIfLocked); 1193 return getEntry(cat, index, d, unlockIfLocked);
1181} 1194}
1182 1195
1183bool PwMDoc::getEntry(unsigned int category, unsigned int index, 1196bool PwMDoc::getEntry(unsigned int category, unsigned int index,
1184 PwMDataItem *d, bool unlockIfLocked) 1197 PwMDataItem *d, bool unlockIfLocked)
1185{ 1198{
1186 if (index > dta[category].d.size() - 1) 1199 if (index > dta[category].d.size() - 1)
1187 return false; 1200 return false;
1188 1201
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
@@ -40,48 +40,49 @@ PWMPrefs::PWMPrefs()
40 40
41 addItemString( "autoStart", &mAutoStart, "" ); 41 addItemString( "autoStart", &mAutoStart, "" );
42 addItemString( "browserCommand", &mBrowserCommand, "" ); 42 addItemString( "browserCommand", &mBrowserCommand, "" );
43 addItemString( "xtermCommand", &mXTermCommand, CONF_DEFAULT_XTERMCOMMAND); 43 addItemString( "xtermCommand", &mXTermCommand, CONF_DEFAULT_XTERMCOMMAND);
44 addItemFont( "entryFont", &mEntryFont); 44 addItemFont( "entryFont", &mEntryFont);
45 addItemInt( "pwTimeout", &mPwTimeout, CONF_DEFAULT_PWTIMEOUT ); 45 addItemInt( "pwTimeout", &mPwTimeout, CONF_DEFAULT_PWTIMEOUT );
46 addItemInt( "lockTimeout", &mLockTimeout, CONF_DEFAULT_LOCKTIMEOUT ); 46 addItemInt( "lockTimeout", &mLockTimeout, CONF_DEFAULT_LOCKTIMEOUT );
47 addItemInt( "compression", &mCompression, CONF_DEFAULT_COMPRESSION ); 47 addItemInt( "compression", &mCompression, CONF_DEFAULT_COMPRESSION );
48 addItemInt( "filePermissions", &mFilePermissions, CONF_DEFAULT_FILEPERMISSIONS ); 48 addItemInt( "filePermissions", &mFilePermissions, CONF_DEFAULT_FILEPERMISSIONS );
49 addItemInt( "minimizeLock", &mMinimizeLock, CONF_DEFAULT_MINIMIZELOCK ); 49 addItemInt( "minimizeLock", &mMinimizeLock, CONF_DEFAULT_MINIMIZELOCK );
50 addItemBool( "unlockOnOpen", &mUnlockOnOpen, CONF_DEFAULT_UNLOCKONOPEN ); 50 addItemBool( "unlockOnOpen", &mUnlockOnOpen, CONF_DEFAULT_UNLOCKONOPEN );
51 addItemBool( "tray", &mTray, CONF_DEFAULT_TRAY ); 51 addItemBool( "tray", &mTray, CONF_DEFAULT_TRAY );
52 addItemBool( "makeFileBackup", &mMakeFileBackup, CONF_DEFAULT_MAKEFILEBACKUP ); 52 addItemBool( "makeFileBackup", &mMakeFileBackup, CONF_DEFAULT_MAKEFILEBACKUP );
53 addItemBool( "autostartDeepLocked", &mAutostartDeeplocked, CONF_DEFAULT_AUTOSTART_DEEPL ); 53 addItemBool( "autostartDeepLocked", &mAutostartDeeplocked, CONF_DEFAULT_AUTOSTART_DEEPL );
54 addItemBool( "autoDeepLock", &mAutoDeeplock, CONF_DEFAULT_AUTODEEPLOCK ); 54 addItemBool( "autoDeepLock", &mAutoDeeplock, CONF_DEFAULT_AUTODEEPLOCK );
55 addItemBool( "kwalletEmu", &mKWalletEmu, CONF_DEFAULT_KWALLETEMU ); 55 addItemBool( "kwalletEmu", &mKWalletEmu, CONF_DEFAULT_KWALLETEMU );
56 addItemBool( "newEntrLockStat", &mNewEntrLockStat, CONF_DEFAULT_NEWENTRLOCKSTAT ); 56 addItemBool( "newEntrLockStat", &mNewEntrLockStat, CONF_DEFAULT_NEWENTRLOCKSTAT );
57 57
58 KPrefs::setCurrentGroup( "Wnd" ); 58 KPrefs::setCurrentGroup( "Wnd" );
59 59
60 addItemSize( "MainWndSize", &mMainWndSize); 60 addItemSize( "MainWndSize", &mMainWndSize);
61 addItemInt( "MainViewStyle", &mMainViewStyle, CONF_DEFAULT_MAINVIEWSTYLE ); 61 addItemInt( "MainViewStyle", &mMainViewStyle, CONF_DEFAULT_MAINVIEWSTYLE );
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
66PWMPrefs::~PWMPrefs() 67PWMPrefs::~PWMPrefs()
67{ 68{
68} 69}
69 70
70PWMPrefs *PWMPrefs::instance() 71PWMPrefs *PWMPrefs::instance()
71{ 72{
72 if ( !sInstance ) { 73 if ( !sInstance ) {
73#ifdef PWM_EMBEDDED 74#ifdef PWM_EMBEDDED
74 sInstance = staticDeleter.setObject( new PWMPrefs() ); 75 sInstance = staticDeleter.setObject( new PWMPrefs() );
75#else //PWM_EMBEDDED 76#else //PWM_EMBEDDED
76 //US the following line has changed ???. Why 77 //US the following line has changed ???. Why
77 staticDeleter.setObject( sInstance, new PWMPrefs() ); 78 staticDeleter.setObject( sInstance, new PWMPrefs() );
78#endif //KAB_EMBEDDED 79#endif //KAB_EMBEDDED
79 sInstance->readConfig(); 80 sInstance->readConfig();
80 } 81 }
81 82
82 return sInstance; 83 return sInstance;
83} 84}
84 85
85 // US introduce a nonconst way to return the config object. 86 // US introduce a nonconst way to return the config object.
86KConfig* PWMPrefs::getConfig() 87KConfig* PWMPrefs::getConfig()
87{ 88{
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
@@ -113,34 +113,38 @@ public:
113 113
114 114
115 115
116 QString mAutoStart; 116 QString mAutoStart;
117 QString mBrowserCommand; 117 QString mBrowserCommand;
118 QString mXTermCommand; 118 QString mXTermCommand;
119 QFont mEntryFont; 119 QFont mEntryFont;
120 int mPwTimeout; 120 int mPwTimeout;
121 int mLockTimeout; 121 int mLockTimeout;
122 int mCompression; 122 int mCompression;
123 int mFilePermissions; 123 int mFilePermissions;
124 int mMinimizeLock; 124 int mMinimizeLock;
125 bool mUnlockOnOpen; 125 bool mUnlockOnOpen;
126 bool mTray; 126 bool mTray;
127 bool mMakeFileBackup; 127 bool mMakeFileBackup;
128 bool mAutostartDeeplocked; 128 bool mAutostartDeeplocked;
129 bool mAutoDeeplock; 129 bool mAutoDeeplock;
130 bool mKWalletEmu; 130 bool mKWalletEmu;
131 bool mNewEntrLockStat; 131 bool mNewEntrLockStat;
132 QSize mMainWndSize; 132 QSize mMainWndSize;
133 int mMainViewStyle; 133 int mMainViewStyle;
134 bool mAutoMinimizeOnStart; 134 bool mAutoMinimizeOnStart;
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();
139 143
140 private: 144 private:
141 PWMPrefs(); 145 PWMPrefs();
142 146
143 static PWMPrefs *sInstance; 147 static PWMPrefs *sInstance;
144}; 148};
145 149
146#endif 150#endif
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
@@ -20,97 +20,119 @@
20 20
21#include "pwmviewstyle.h" 21#include "pwmviewstyle.h"
22#include "pwmexception.h" 22#include "pwmexception.h"
23#include "pwmviewstyle_0.h" 23#include "pwmviewstyle_0.h"
24#include "pwmviewstyle_1.h" 24#include "pwmviewstyle_1.h"
25#include "listviewpwm.h" 25#include "listviewpwm.h"
26#include "pwmview.h" 26#include "pwmview.h"
27#include "commentbox.h" 27#include "commentbox.h"
28#ifndef PWM_EMBEDDED 28#ifndef PWM_EMBEDDED
29#include "configuration.h" 29#include "configuration.h"
30#else 30#else
31#include "pwmprefs.h" 31#include "pwmprefs.h"
32#endif 32#endif
33 33
34PwMViewStyle::PwMViewStyle(QWidget *parent, const char *name) 34PwMViewStyle::PwMViewStyle(QWidget *parent, const char *name)
35 : QWidget(parent, name) 35 : QWidget(parent, name)
36{ 36{
37 curStyle = style_notset; 37 curStyle = style_notset;
38 s0 = 0; 38 s0 = 0;
39 s1 = 0; 39 s1 = 0;
40} 40}
41 41
42PwMViewStyle::~PwMViewStyle() 42PwMViewStyle::~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);
49 delete_ifnot_null(s1); 61 delete_ifnot_null(s1);
50} 62}
51 63
52void PwMViewStyle::initStyle(style_t style) 64void PwMViewStyle::initStyle(style_t style)
53{ 65{
54 printDebug(string("initializing style ") + tostr(style)); 66 printDebug(string("initializing style ") + tostr(style));
55 bool wasMaximized = v->isMaximized(); 67 bool wasMaximized = v->isMaximized();
56 if (v->isVisible()) 68 if (v->isVisible())
57 v->hide(); 69 v->hide();
58 switch (style) { 70 switch (style) {
59 case style_0: 71 case style_0:
60 delete_ifnot_null(s0); 72 delete_ifnot_null(s0);
61 delete_ifnot_null(s1); 73 delete_ifnot_null(s1);
62 s0 = new PwMViewStyle_0(v); 74 s0 = new PwMViewStyle_0(v);
63 lv = s0->getLv(); 75 lv = s0->getLv();
64 commentBox = s0->getCommentBox(); 76 commentBox = s0->getCommentBox();
65 break; 77 break;
66 case style_1: 78 case style_1:
67 delete_ifnot_null(s0); 79 delete_ifnot_null(s0);
68 delete_ifnot_null(s1); 80 delete_ifnot_null(s1);
69 s1 = new PwMViewStyle_1(v); 81 s1 = new PwMViewStyle_1(v);
70 lv = s1->getLv(); 82 lv = s1->getLv();
71 commentBox = s1->getCommentBox(); 83 commentBox = s1->getCommentBox();
72 break; 84 break;
73 default: 85 default:
74 BUG(); 86 BUG();
75 return; 87 return;
76 } 88 }
77 curStyle = style; 89 curStyle = style;
78 connect(lv, SIGNAL(pressed(QListViewItem *)), 90 connect(lv, SIGNAL(pressed(QListViewItem *)),
79 v, SLOT(handleToggle(QListViewItem *))); 91 v, SLOT(handleToggle(QListViewItem *)));
80 connect(lv, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)), 92 connect(lv, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)),
81 v, SLOT(handleRightClick(QListViewItem *, const QPoint &, int))); 93 v, SLOT(handleRightClick(QListViewItem *, const QPoint &, int)));
82 connect(lv, SIGNAL(clicked(QListViewItem *)), 94 connect(lv, SIGNAL(clicked(QListViewItem *)),
83 v, SLOT(refreshCommentTextEdit(QListViewItem *))); 95 v, SLOT(refreshCommentTextEdit(QListViewItem *)));
84 lv->addColumn(i18n("Description"), 180); 96 lv->addColumn(i18n("Description"), 180);
85 lv->addColumn(i18n("Username"), 150); 97 lv->addColumn(i18n("Username"), 150);
86 lv->addColumn(i18n("Password"), 150); 98 lv->addColumn(i18n("Password"), 150);
87 lv->addColumn(i18n("URL"), 180); 99 lv->addColumn(i18n("URL"), 180);
88 lv->addColumn(i18n("Launcher"), 120); 100 lv->addColumn(i18n("Launcher"), 120);
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());
95 v->updateView(); 117 v->updateView();
96 if (wasMaximized) { 118 if (wasMaximized) {
97 v->showMaximized(); 119 v->showMaximized();
98 } else { 120 } else {
99 v->show(); 121 v->show();
100 } 122 }
101 connect(lv, SIGNAL(layoutChanged()), 123 connect(lv, SIGNAL(layoutChanged()),
102 v, SLOT(reorgLp())); 124 v, SLOT(reorgLp()));
103} 125}
104 126
105void PwMViewStyle::resizeView(const QSize &size) 127void PwMViewStyle::resizeView(const QSize &size)
106{ 128{
107 switch (curStyle) { 129 switch (curStyle) {
108 case style_0: 130 case style_0:
109 PWM_ASSERT(s0); 131 PWM_ASSERT(s0);
110 s0->resize(size); 132 s0->resize(size);
111 return; 133 return;
112 case style_1: 134 case style_1:
113 PWM_ASSERT(s1); 135 PWM_ASSERT(s1);
114 s1->resize(size); 136 s1->resize(size);
115 return; 137 return;
116 default: 138 default:
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
@@ -2,49 +2,49 @@
2 * * 2 * *
3 * copyright (C) 2004 by Michael Buesch * 3 * copyright (C) 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "pwmviewstyle_0.h" 20#include "pwmviewstyle_0.h"
21#include "pwmview.h" 21#include "pwmview.h"
22#include "listviewpwm.h" 22#include "listviewpwm.h"
23#include "commentbox.h" 23#include "commentbox.h"
24 24
25#include <klocale.h> 25#include <klocale.h>
26 26#include "pwmprefs.h"
27 27
28PwMViewStyle_0::PwMViewStyle_0(PwMView *view) 28PwMViewStyle_0::PwMViewStyle_0(PwMView *view)
29 : QObject() 29 : QObject()
30{ 30{
31 vbox1 = new QVBox(view); 31 vbox1 = new QVBox(view);
32 vbox1->setSpacing(3); 32 vbox1->setSpacing(3);
33 hbox1 = new QHBox(vbox1); 33 hbox1 = new QHBox(vbox1);
34 hbox1->setSpacing(10); 34 hbox1->setSpacing(10);
35 categoriesTitle = new QLabel(hbox1); 35 categoriesTitle = new QLabel(hbox1);
36 categoriesTitle->setText(i18n("Categories:")); 36 categoriesTitle->setText(i18n("Categories:"));
37 categoriesCombo = new QComboBox(hbox1); 37 categoriesCombo = new QComboBox(hbox1);
38 renCatButton = new QPushButton(i18n("&Rename"), hbox1); 38 renCatButton = new QPushButton(i18n("&Rename"), hbox1);
39 delCatButton = new QPushButton(i18n("&Delete"), hbox1); 39 delCatButton = new QPushButton(i18n("&Delete"), hbox1);
40#ifndef PWM_EMBEDDED 40#ifndef PWM_EMBEDDED
41 splitter1 = new QSplitter(vbox1); 41 splitter1 = new QSplitter(vbox1);
42 splitter1->setOrientation(Qt::Vertical); 42 splitter1->setOrientation(Qt::Vertical);
43#else 43#else
44 splitter1 = new KDGanttMinimizeSplitter( Qt::Vertical, vbox1); 44 splitter1 = new KDGanttMinimizeSplitter( Qt::Vertical, vbox1);
45 splitter1->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 45 splitter1->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
46 46
47 //US topLayout->addWidget(mMiniSplitter ); 47 //US topLayout->addWidget(mMiniSplitter );
48#endif 48#endif
49 lv = new ListViewPwM(splitter1); 49 lv = new ListViewPwM(splitter1);
50 commentBox = new CommentBox(splitter1); 50 commentBox = new CommentBox(splitter1);
@@ -70,24 +70,43 @@ void PwMViewStyle_0::delCategory(const QString &cat)
70 PWM_ASSERT(categoriesCombo); 70 PWM_ASSERT(categoriesCombo);
71 int i, count = categoriesCombo->count(); 71 int i, count = categoriesCombo->count();
72 for (i = 0; i < count; ++i) { 72 for (i = 0; i < count; ++i) {
73 if (categoriesCombo->text(i) == cat) { 73 if (categoriesCombo->text(i) == cat) {
74 categoriesCombo->removeItem(i); 74 categoriesCombo->removeItem(i);
75 return; 75 return;
76 } 76 }
77 } 77 }
78 BUG(); 78 BUG();
79} 79}
80 80
81void PwMViewStyle_0::selectCategory(const QString &cat) 81void PwMViewStyle_0::selectCategory(const QString &cat)
82{ 82{
83 PWM_ASSERT(categoriesCombo); 83 PWM_ASSERT(categoriesCombo);
84 int i, count = categoriesCombo->count(); 84 int i, count = categoriesCombo->count();
85 for (i = 0; i < count; ++i) { 85 for (i = 0; i < count; ++i) {
86 if (categoriesCombo->text(i) == cat) { 86 if (categoriesCombo->text(i) == cat) {
87 categoriesCombo->setCurrentItem(i); 87 categoriesCombo->setCurrentItem(i);
88 return; 88 return;
89 } 89 }
90 } 90 }
91 // fall back to 0 91 // fall back to 0
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
97void 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
106void 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
@@ -15,83 +15,89 @@
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#ifndef PWMVIEWSTYLE_0_H 20#ifndef PWMVIEWSTYLE_0_H
21#define PWMVIEWSTYLE_0_H 21#define PWMVIEWSTYLE_0_H
22 22
23#include <qhbox.h> 23#include <qhbox.h>
24#include <qvbox.h> 24#include <qvbox.h>
25#include <qpushbutton.h> 25#include <qpushbutton.h>
26#ifndef PWM_EMBEDDED 26#ifndef PWM_EMBEDDED
27#include <qtextedit.h> 27#include <qtextedit.h>
28#include <qsplitter.h> 28#include <qsplitter.h>
29#else 29#else
30#include <qmultilineedit.h> 30#include <qmultilineedit.h>
31#include <KDGanttMinimizeSplitter.h> 31#include <KDGanttMinimizeSplitter.h>
32#endif 32#endif
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35 35
36class PwMView; 36class PwMView;
37class ListViewPwM; 37class ListViewPwM;
38class CommentBox; 38class CommentBox;
39class PWMPrefs;
39 40
40class PwMViewStyle_0 : public QObject 41class PwMViewStyle_0 : public QObject
41{ 42{
42public: 43public:
43 PwMViewStyle_0(PwMView *view); 44 PwMViewStyle_0(PwMView *view);
44 ~PwMViewStyle_0(); 45 ~PwMViewStyle_0();
45 46
46 ListViewPwM * getLv() 47 ListViewPwM * getLv()
47 { return lv; } 48 { return lv; }
48 CommentBox * getCommentBox() 49 CommentBox * getCommentBox()
49 { return commentBox; } 50 { return commentBox; }
50 51
51 /** returns the currently selected category */ 52 /** returns the currently selected category */
52 QString getCurrentCategory() 53 QString getCurrentCategory()
53 { return categoriesCombo->currentText(); } 54 { return categoriesCombo->currentText(); }
54 /** add Category to the view */ 55 /** add Category to the view */
55 void addCategory(const QString &cat) 56 void addCategory(const QString &cat)
56 { categoriesCombo->insertItem(cat); } 57 { categoriesCombo->insertItem(cat); }
57 /** delete Category from view */ 58 /** delete Category from view */
58 void delCategory(const QString &cat); 59 void delCategory(const QString &cat);
59 /** delete all categories from view */ 60 /** delete all categories from view */
60 void delAllCategories() 61 void delAllCategories()
61 { categoriesCombo->clear(); } 62 { categoriesCombo->clear(); }
62 /** select the specified category */ 63 /** select the specified category */
63 void selectCategory(const QString &cat); 64 void selectCategory(const QString &cat);
64 /** returns the number of categories in this view. 65 /** returns the number of categories in this view.
65 * This value dosn't say anything about the number of 66 * This value dosn't say anything about the number of
66 * categories in the document. 67 * categories in the document.
67 */ 68 */
68 int numCategories() 69 int numCategories()
69 { return categoriesCombo->count(); } 70 { return categoriesCombo->count(); }
70 /** resize the view */ 71 /** resize the view */
71 void resize(const QSize &size) 72 void resize(const QSize &size)
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
74protected: 80protected:
75 /** main list view */ 81 /** main list view */
76 ListViewPwM *lv; 82 ListViewPwM *lv;
77 /** categories combo-box */ 83 /** categories combo-box */
78 QComboBox *categoriesCombo; 84 QComboBox *categoriesCombo;
79 /** title string for the categories combo or list box */ 85 /** title string for the categories combo or list box */
80 QLabel *categoriesTitle; 86 QLabel *categoriesTitle;
81 /** hbox1 for widget style */ 87 /** hbox1 for widget style */
82 QHBox *hbox1; 88 QHBox *hbox1;
83 /** vbox1 for widget style */ 89 /** vbox1 for widget style */
84 QVBox *vbox1; 90 QVBox *vbox1;
85 /** splitter for commentTextEdit */ 91 /** splitter for commentTextEdit */
86 #ifndef PWM_EMBEDDED 92 #ifndef PWM_EMBEDDED
87 QSplitter *splitter1; 93 QSplitter *splitter1;
88#else 94#else
89 KDGanttMinimizeSplitter * splitter1; 95 KDGanttMinimizeSplitter * splitter1;
90#endif 96#endif
91 /** push button to change the category name */ 97 /** push button to change the category name */
92 QPushButton *renCatButton; 98 QPushButton *renCatButton;
93 /** push button to delete the category */ 99 /** push button to delete the category */
94 QPushButton *delCatButton; 100 QPushButton *delCatButton;
95 /** comment box */ 101 /** comment box */
96 CommentBox *commentBox; 102 CommentBox *commentBox;
97}; 103};
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
@@ -2,48 +2,49 @@
2 * * 2 * *
3 * copyright (C) 2004 by Michael Buesch * 3 * copyright (C) 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "pwmviewstyle_1.h" 20#include "pwmviewstyle_1.h"
21#include "pwmview.h" 21#include "pwmview.h"
22#include "listviewpwm.h" 22#include "listviewpwm.h"
23#include "commentbox.h" 23#include "commentbox.h"
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
28 29
29PwMViewStyle_1::PwMViewStyle_1(PwMView *view) 30PwMViewStyle_1::PwMViewStyle_1(PwMView *view)
30 : QObject() 31 : QObject()
31{ 32{
32#ifndef PWM_EMBEDDED 33#ifndef PWM_EMBEDDED
33 splitter = new QSplitter(view); 34 splitter = new QSplitter(view);
34#else 35#else
35 splitter = new KDGanttMinimizeSplitter( Qt::Horizontal, view); 36 splitter = new KDGanttMinimizeSplitter( Qt::Horizontal, view);
36 splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 37 splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
37 38
38 //US topLayout->addWidget(mMiniSplitter ); 39 //US topLayout->addWidget(mMiniSplitter );
39#endif 40#endif
40 41
41 vbox1 = new QVBox(splitter); 42 vbox1 = new QVBox(splitter);
42 categoriesTitle = new QLabel(vbox1); 43 categoriesTitle = new QLabel(vbox1);
43 categoriesList = new QListBox(vbox1); 44 categoriesList = new QListBox(vbox1);
44#ifndef PWM_EMBEDDED 45#ifndef PWM_EMBEDDED
45 splitter2 = new QSplitter(splitter); 46 splitter2 = new QSplitter(splitter);
46 splitter2->setOrientation(Qt::Vertical); 47 splitter2->setOrientation(Qt::Vertical);
47#else 48#else
48 splitter2 = new KDGanttMinimizeSplitter( Qt::Vertical, splitter); 49 splitter2 = new KDGanttMinimizeSplitter( Qt::Vertical, splitter);
49 splitter2->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 50 splitter2->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
@@ -104,27 +105,46 @@ void PwMViewStyle_1::delCategory(const QString &cat)
104 int i, count = categoriesList->count(); 105 int i, count = categoriesList->count();
105 for (i = 0; i < count; ++i) { 106 for (i = 0; i < count; ++i) {
106 if (categoriesList->text(i) == cat) { 107 if (categoriesList->text(i) == cat) {
107 categoriesList->removeItem(i); 108 categoriesList->removeItem(i);
108 return; 109 return;
109 } 110 }
110 } 111 }
111 BUG(); 112 BUG();
112} 113}
113 114
114void PwMViewStyle_1::selectCategory(const QString &cat) 115void PwMViewStyle_1::selectCategory(const QString &cat)
115{ 116{
116 PWM_ASSERT(categoriesList); 117 PWM_ASSERT(categoriesList);
117 int i, count = categoriesList->count(); 118 int i, count = categoriesList->count();
118 for (i = 0; i < count; ++i) { 119 for (i = 0; i < count; ++i) {
119 if (categoriesList->text(i) == cat) { 120 if (categoriesList->text(i) == cat) {
120 categoriesList->setCurrentItem(i); 121 categoriesList->setCurrentItem(i);
121 return; 122 return;
122 } 123 }
123 } 124 }
124 // fall back to 0 125 // fall back to 0
125 categoriesList->setCurrentItem(0); 126 categoriesList->setCurrentItem(0);
126} 127}
127 128
129//US ENH: I need a place to load the view dependend settings. Eg. splittersize
130void 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
139void 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"
130#endif 150#endif
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
@@ -16,84 +16,89 @@
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#ifndef PWMVIEWSTYLE_1_H 20#ifndef PWMVIEWSTYLE_1_H
21#define PWMVIEWSTYLE_1_H 21#define PWMVIEWSTYLE_1_H
22 22
23#include <qvbox.h> 23#include <qvbox.h>
24 24
25#ifndef PWM_EMBEDDED 25#ifndef PWM_EMBEDDED
26#include <qtextedit.h> 26#include <qtextedit.h>
27#include <qsplitter.h> 27#include <qsplitter.h>
28#else 28#else
29#include <qmultilineedit.h> 29#include <qmultilineedit.h>
30#include <KDGanttMinimizeSplitter.h> 30#include <KDGanttMinimizeSplitter.h>
31#endif 31#endif
32 32
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qlistbox.h> 34#include <qlistbox.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36 36
37class PwMView; 37class PwMView;
38class ListViewPwM; 38class ListViewPwM;
39class CommentBox; 39class CommentBox;
40class PWMPrefs;
40 41
41class PwMViewStyle_1 : public QObject 42class PwMViewStyle_1 : public QObject
42{ 43{
43 Q_OBJECT 44 Q_OBJECT
44public: 45public:
45 PwMViewStyle_1(PwMView *view); 46 PwMViewStyle_1(PwMView *view);
46 ~PwMViewStyle_1(); 47 ~PwMViewStyle_1();
47 48
48 ListViewPwM * getLv() 49 ListViewPwM * getLv()
49 { return lv; } 50 { return lv; }
50 CommentBox * getCommentBox() 51 CommentBox * getCommentBox()
51 { return commentBox; } 52 { return commentBox; }
52 53
53 /** returns the currently selected category */ 54 /** returns the currently selected category */
54 QString getCurrentCategory() 55 QString getCurrentCategory()
55 { return categoriesList->currentText(); } 56 { return categoriesList->currentText(); }
56 /** add Category to the view */ 57 /** add Category to the view */
57 void addCategory(const QString &cat) 58 void addCategory(const QString &cat)
58 { categoriesList->insertItem(cat); } 59 { categoriesList->insertItem(cat); }
59 /** delete Category from view */ 60 /** delete Category from view */
60 void delCategory(const QString &cat); 61 void delCategory(const QString &cat);
61 /** delete all categories from view */ 62 /** delete all categories from view */
62 void delAllCategories() 63 void delAllCategories()
63 { categoriesList->clear(); } 64 { categoriesList->clear(); }
64 /** select the specified category */ 65 /** select the specified category */
65 void selectCategory(const QString &cat); 66 void selectCategory(const QString &cat);
66 /** returns the number of categories in this view. 67 /** returns the number of categories in this view.
67 * This value dosn't say anything about the number of 68 * This value dosn't say anything about the number of
68 * categories in the document. 69 * categories in the document.
69 */ 70 */
70 int numCategories() 71 int numCategories()
71 { return categoriesList->count(); } 72 { return categoriesList->count(); }
72 /** resize the view */ 73 /** resize the view */
73 void resize(const QSize &size) 74 void resize(const QSize &size)
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
76protected slots: 81protected slots:
77 /** user clicked right button in category list */ 82 /** user clicked right button in category list */
78 void catRightClick(QListBoxItem *item, const QPoint &point); 83 void catRightClick(QListBoxItem *item, const QPoint &point);
79 84
80protected: 85protected:
81 /** main list view */ 86 /** main list view */
82 ListViewPwM *lv; 87 ListViewPwM *lv;
83#ifndef PWM_EMBEDDED 88#ifndef PWM_EMBEDDED
84 /** main splitter widget */ 89 /** main splitter widget */
85 QSplitter *splitter; 90 QSplitter *splitter;
86 /** commentTextEdit splitter */ 91 /** commentTextEdit splitter */
87 QSplitter *splitter2; 92 QSplitter *splitter2;
88#else 93#else
89 /** main splitter widget */ 94 /** main splitter widget */
90 KDGanttMinimizeSplitter *splitter; 95 KDGanttMinimizeSplitter *splitter;
91 /** commentTextEdit splitter */ 96 /** commentTextEdit splitter */
92 KDGanttMinimizeSplitter *splitter2; 97 KDGanttMinimizeSplitter *splitter2;
93#endif 98#endif
94 99
95 /** categories list-box */ 100 /** categories list-box */
96 QListBox *categoriesList; 101 QListBox *categoriesList;
97 /** title string for the categories combo or list box */ 102 /** title string for the categories combo or list box */
98 QLabel *categoriesTitle; 103 QLabel *categoriesTitle;
99 /** hbox1 for widget style */ 104 /** hbox1 for widget style */
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
@@ -383,86 +383,72 @@ bool Serializer::extractMeta(const QDomNode &n,
383 val = cur.toElement().text(); 383 val = cur.toElement().text();
384 if (val == "") { 384 if (val == "") {
385 cur = cur.nextSibling(); 385 cur = cur.nextSibling();
386 continue; 386 continue;
387 } 387 }
388#ifndef PWM_EMBEDDED 388#ifndef PWM_EMBEDDED
389 if (name == META_CREATE_DATE) { 389 if (name == META_CREATE_DATE) {
390 dta->create = QDateTime::fromString(val, Qt::ISODate); 390 dta->create = QDateTime::fromString(val, Qt::ISODate);
391 } else if (name == META_VALID_DATE) { 391 } else if (name == META_VALID_DATE) {
392 dta->valid = QDateTime::fromString(val, Qt::ISODate); 392 dta->valid = QDateTime::fromString(val, Qt::ISODate);
393 } else if (name == META_EXPIRE_DATE) { 393 } else if (name == META_EXPIRE_DATE) {
394 dta->expire = QDateTime::fromString(val, Qt::ISODate); 394 dta->expire = QDateTime::fromString(val, Qt::ISODate);
395 } else if (name == META_UPDATE_DATE) { 395 } else if (name == META_UPDATE_DATE) {
396 dta->update = QDateTime::fromString(val, Qt::ISODate); 396 dta->update = QDateTime::fromString(val, Qt::ISODate);
397 } else if (name == META_UPDATE_INT) { 397 } else if (name == META_UPDATE_INT) {
398 dta->updateInt = strtoul(val.latin1(), 0, 10); 398 dta->updateInt = strtoul(val.latin1(), 0, 10);
399 } else if (name == META_UNIQUEID) { 399 } else if (name == META_UNIQUEID) {
400 dta->uniqueid = unescapeEntryData(val).latin1(); 400 dta->uniqueid = unescapeEntryData(val).latin1();
401 } else { 401 } else {
402 printDebug(string("extractMeta(): invalid: ") 402 printDebug(string("extractMeta(): invalid: ")
403 + name.latin1()); 403 + name.latin1());
404 } 404 }
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);
439 } else if (name == META_UNIQUEID) { 420 } else if (name == META_UNIQUEID) {
440 dta->uniqueid = unescapeEntryData(val).latin1(); 421 dta->uniqueid = unescapeEntryData(val).latin1();
441 } else { 422 } else {
442 printDebug(string("extractMeta(): invalid: ") 423 printDebug(string("extractMeta(): invalid: ")
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();
447 } 433 }
448 return true; 434 return true;
449} 435}
450 436
451bool Serializer::checkValid() 437bool Serializer::checkValid()
452{ 438{
453 PWM_ASSERT(domDoc); 439 PWM_ASSERT(domDoc);
454 QDomElement root(domDoc->documentElement()); 440 QDomElement root(domDoc->documentElement());
455 if (root.nodeName() != ROOT_MAGIC_NEW && 441 if (root.nodeName() != ROOT_MAGIC_NEW &&
456 root.nodeName() != ROOT_MAGIC_OLD) { 442 root.nodeName() != ROOT_MAGIC_OLD) {
457 printDebug("Serializer: wrong magic"); 443 printDebug("Serializer: wrong magic");
458 return false; 444 return false;
459 } 445 }
460 if (root.attribute(VER_STR_NEW) != COMPAT_VER_NEW && 446 if (root.attribute(VER_STR_NEW) != COMPAT_VER_NEW &&
461 root.attribute(VER_STR_OLD) != COMPAT_VER_OLD) { 447 root.attribute(VER_STR_OLD) != COMPAT_VER_OLD) {
462 printDebug("Serializer: wrong version"); 448 printDebug("Serializer: wrong version");
463 return false; 449 return false;
464 } 450 }
465 return true; 451 return true;
466} 452}
467 453
468QDomElement Serializer::genNewRoot() 454QDomElement Serializer::genNewRoot()