summaryrefslogtreecommitdiffabout
path: root/pwmanager
authorulf69 <ulf69>2004-10-18 02:55:13 (UTC)
committer ulf69 <ulf69>2004-10-18 02:55:13 (UTC)
commit2fd3f09238a624b1a91793d43b5f3653e2b34763 (patch) (side-by-side diff)
tree07cff893e261ad594ff44d7ab2e8e457a88d6390 /pwmanager
parent4e7fac5fdb4c0dace10cada64f036c56bb29fe58 (diff)
downloadkdepimpi-2fd3f09238a624b1a91793d43b5f3653e2b34763.zip
kdepimpi-2fd3f09238a624b1a91793d43b5f3653e2b34763.tar.gz
kdepimpi-2fd3f09238a624b1a91793d43b5f3653e2b34763.tar.bz2
*** empty log message ***
Diffstat (limited to 'pwmanager') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwm.cpp57
-rw-r--r--pwmanager/pwmanager/pwm.h8
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp85
-rw-r--r--pwmanager/pwmanager/pwmdoc.h39
-rw-r--r--pwmanager/pwmanager/pwmview.cpp92
-rw-r--r--pwmanager/pwmanager/pwmview.h25
-rw-r--r--pwmanager/pwmanager/serializer.cpp126
7 files changed, 287 insertions, 145 deletions
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index 014e809..57b4432 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -134,3 +134,4 @@ enum {
BUTTON_POPUP_HELP_FAQ,
- BUTTON_POPUP_HELP_ABOUT
+ BUTTON_POPUP_HELP_ABOUT,
+ BUTTON_POPUP_HELP_SYNC
};
@@ -158,3 +159,3 @@ PwM::PwM(PwMInit *_init, PwMDoc *doc,
QWidget *parent, const char *name)
- : KMainWindow(parent, name)
+ : KMainWindow(parent, "HALLO")
, forceQuit (false)
@@ -360,2 +361,6 @@ void PwM::initMenubar()
+ helpPopup->insertItem(i18n("&Sync HowTo"), this,
+ SLOT(syncHowTo_slot()), 0,
+ BUTTON_POPUP_HELP_SYNC);
+
#endif
@@ -611,2 +616,8 @@ void PwM::addPwd_slot(QString *pw, PwMDoc *_doc)
PwMDataItem d;
+
+ //US BUG: to initialize all values of curEntr with meaningfulldata,
+ // we call clear on it. Reason: Metadata will be uninitialized otherwise.
+ // another option would be to create a constructor for PwMDataItem
+ d.clear(true);
+
d.desc = w.getDescription().latin1();
@@ -621,3 +632,3 @@ void PwM::addPwd_slot(QString *pw, PwMDoc *_doc)
i18n
- ("An entry with this \"Description\", "
+ ("An entry with this \"Description\",\n"
"does already exist.\n"
@@ -627,4 +638,4 @@ void PwM::addPwd_slot(QString *pw, PwMDoc *_doc)
} else if (ret == e_maxAllowedEntr) {
- KMessageBox::error(this, i18n("The maximum possible number of entries "
- "has been reached. You can't add more entries."),
+ KMessageBox::error(this, i18n("The maximum possible number of\nentries"
+ "has been reached.\nYou can't add more entries."),
i18n("maximum number of entries"));
@@ -1289,2 +1300,9 @@ void PwM::faq_slot()
+void PwM::syncHowTo_slot()
+{
+ qDebug("PwM::syncHowTo_slot");
+ KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
+}
+
+
void PwM::createAboutData_slot()
@@ -1328,2 +1346,4 @@ bool PwM::sync(KSyncManager* manager, QString filename, int mode)
+ qDebug("PwM::sync save now: ret=%i", ret);
+
if (ret == true) {
@@ -1331,2 +1351,5 @@ bool PwM::sync(KSyncManager* manager, QString filename, int mode)
//mViewManager->refreshView();
+
+ //US curDoc()->sync sets the dirtyFlag in case the sync was successfull.
+ save();
}
@@ -1335,26 +1358,2 @@ bool PwM::sync(KSyncManager* manager, QString filename, int mode)
}
-
-//called by the syncmanager to indicate that the work has to be marked as dirty.
-void PwM::sync_setModified()
-{
- PWM_ASSERT(curDoc());
- curDoc()->sync_setModified();
-}
-
-//called by the syncmanager to ask if the dirty flag is set.
-bool PwM::sync_isModified()
-{
- PWM_ASSERT(curDoc());
- return curDoc()->sync_isModified();
-}
-
-//called by the syncmanager to indicate that the work has to be saved.
-void PwM::sync_save()
-{
- PWM_ASSERT(curDoc());
- return curDoc()->sync_save();
-}
-
-
-
#endif
diff --git a/pwmanager/pwmanager/pwm.h b/pwmanager/pwmanager/pwm.h
index 7c6bf0d..6ed9d34 100644
--- a/pwmanager/pwmanager/pwm.h
+++ b/pwmanager/pwmanager/pwm.h
@@ -179,2 +179,3 @@ public slots:
void createAboutData_slot();
+ void syncHowTo_slot();
#endif
@@ -274,9 +275,2 @@ protected:
- //called by the syncmanager to indicate that the work has to marked as dirty.
- virtual void sync_setModified();
- //called by the syncmanager to ask if the dirty flag is set.
- virtual bool sync_isModified();
- //called by the syncmanager to indicate that the work has to be saved.
- virtual void sync_save();
-
// LR *******************************
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index 0ac5517..2a7b11d 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -489,3 +489,4 @@ PwMerror PwMDoc::saveDoc(char compress, const QString *file)
ret = e_success;
- printDebug(string("writing file { compress: ")
+ printDebug(string("writing file { name: ")
+ + filename.latin1() + " compress: "
+ tostr(static_cast<int>(compress)) + " cryptAlgo: "
@@ -607,3 +608,5 @@ PwMerror PwMDoc::writeFileHeader(char keyHash, char dataHash, char crypt, char c
PWM_ASSERT(f);
- PWM_ASSERT(listView);
+ //US ENH: or maybe a bug: checking here for listView does not make sense because we do not check anywhere else
+ //Wenn I sync, I open a doc without a view => listView is 0 => Assertion
+ //US PWM_ASSERT(listView);
if (f->writeBlock(FILE_ID_HEADER, strlen(FILE_ID_HEADER)) !=
@@ -2806,3 +2809,9 @@ void PwMDoc::ensureLvp()
+ //US ENH BUG: when using syncronizing, this way of sorting
+ //is not sufficient, because there might be empty spaces
+ // at the beginning. But this algorythm only can add elements
+ //to the end.The result are crashes because of listoverflows
+ //we need something to fill all gaps.
vector< vector<PwMDataItem>::iterator > undefined;
+ vector< vector<PwMDataItem>::iterator > sorted;
vector< vector<PwMDataItem>::iterator >::iterator undefBegin,
@@ -2810,2 +2819,5 @@ void PwMDoc::ensureLvp()
undefI;
+ vector< vector<PwMDataItem>::iterator >::iterator sortedBegin,
+ sortedEnd,
+ sortedI;
vector<PwMCategoryItem>::iterator catBegin = dti.dta.begin(),
@@ -2828,6 +2840,20 @@ void PwMDoc::ensureLvp()
undefined.push_back(entrI);
- else if (tmpLvp > lvpTop)
- lvpTop = tmpLvp;
+ else
+ sorted[tmpLvp] = entrI;
+ //US else if (tmpLvp > lvpTop)
+ //US lvpTop = tmpLvp;
++entrI;
}
+
+ //now we have all undefied in the collection. Now insert the existing
+ sortedBegin = sorted.begin();
+ sortedEnd = sorted.end();
+ sortedI = sortedBegin;
+
+ while (sortedI != sortedEnd) {
+ tmpLvp = (*sortedI)->listViewPos;
+ undefined[tmpLvp] = *sortedI;
+ ++sortedI;
+ }
+
undefBegin = undefined.begin();
@@ -2850,2 +2876,12 @@ QString PwMDoc::getTitle()
QString title(getFilename());
+
+ //US ENH: The whole filename on PDAs is too long. So use only the last characters
+ if (QApplication::desktop()->width() < 640)
+ {
+ if (title.length() > 30)
+ title = "..." + title.right(30);
+
+ }
+
+
if (title.isEmpty()) {
@@ -2929,3 +2965,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
syncItemLocal = syncLocal->getSyncDataEntry(index);
- qDebug("Last Sync %s ", syncItemLocal->lastSyncDate.toString().latin1());
+ qDebug("Last Sync Local %s ", syncItemLocal->lastSyncDate.toString().latin1());
@@ -2949,2 +2985,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
syncItemRemote = syncRemote->getSyncDataEntry(index);
+ qDebug("Last Sync Remote %s ", syncItemRemote->lastSyncDate.toString().latin1());
//and remove the found entry here. We will reenter it later again.
@@ -2961,4 +2998,4 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
- // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
- //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
+ // qDebug("set fulldate to true %s %s" ,syncItemLocal->lastSyncDate.toString().latin1(), syncItemRemote->lastSyncDate.toString().latin1() );
+ // qDebug("%d %d %d %d ", syncItemLocal->lastSyncDate.time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
fullDateRange = true;
@@ -2975,3 +3012,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
qDebug("*************************** ");
- // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
+ qDebug("mLastSync %s ",mLastSync.toString().latin1() );
QStringList er = syncRemote->getIDEntryList();
@@ -3003,3 +3040,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
if ( (take = takePwMDataItem( inLocal, inRemote, mLastSync, mode, fullDateRange) ) ) {
- //qDebug("take %d %s ", take, inL.summary().latin1());
+ qDebug("take %d %s ", take, inLocal->desc.c_str());
if ( take == 3 )
@@ -3054,2 +3091,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
uid = el[ incCounter ];
+ qDebug("sync uid %s from local file", uid.latin1());
@@ -3134,7 +3172,7 @@ int PwMDoc::takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime
//qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
- //full = true; //debug only
+ full = true; //debug only
if ( full ) {
- bool equ = true;//US ( (*local) == (*remote) );
+ bool equ = ( (*local) == (*remote) );
if ( equ ) {
- //qDebug("equal ");
+ qDebug("equal ");
if ( mode < SYNC_PREF_FORCE_LOCAL )
@@ -3142,4 +3180,4 @@ int PwMDoc::takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime
- }//else //debug only
- //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
+ }else //debug only
+ qDebug("not equal %s %s ", local->desc.c_str(), remote->desc.c_str());
}
@@ -3217,3 +3255,3 @@ bool PwMDoc::sync(KSyncManager* manager, QString filename, int mode)
- //2) construct and open a new doc on the stack(automatic cleanup) for remote file.
+ //2) construct and open a new doc on the stack(automatic cleanup of remote file).
PwMDoc syncTarget(this, "synctarget");
@@ -3269,19 +3307,2 @@ bool PwMDoc::sync(KSyncManager* manager, QString filename, int mode)
-//called by the syncmanager to indicate that the work has to marked as dirty.
-void PwMDoc::sync_setModified()
-{
- flagDirty();
-}
-
-//called by the syncmanager to ask if the dirty flag is set.
-bool PwMDoc::sync_isModified()
-{
- return isDirty();
-}
-
-//called by the syncmanager to indicate that the work has to be saved.
-void PwMDoc::sync_save()
-{
- saveDoc(conf()->confGlobCompression());
-}
#endif
diff --git a/pwmanager/pwmanager/pwmdoc.h b/pwmanager/pwmanager/pwmdoc.h
index 2e9547e..6a1dd30 100644
--- a/pwmanager/pwmanager/pwmdoc.h
+++ b/pwmanager/pwmanager/pwmdoc.h
@@ -132,12 +132,2 @@ struct PwMMetaData
- PwMMetaData& operator = (const PwMMetaData& x)
- {
- create = x.create;
- expire = x.expire;
- update = x.update;
- updateInt = x.updateInt;
- uniqueid = x.uniqueid;
- return *this;
- }
-
inline bool isValid() const
@@ -219,6 +209,22 @@ struct PwMDataItem
}
-
+ //US ENH: we need this operator to compare two items if we have no unique ids
+ //available. Generaly this happens before the first sync
+ bool PwMDataItem::operator==( const PwMDataItem &a ) const
+ {
+ qDebug("oper==%s", a.desc.c_str());
+ if ( desc != a.desc ) return false;
+ if ( name != a.name ) return false;
+ if ( pw != a.pw ) return false;
+ if ( comment != a.comment ) return false;
+ if ( url != a.url ) return false;
+ if ( launcher != a.launcher ) return false;
+ //all other field will not be checked.
+ return true;
+ }
+
+ //US ENH:this operator is used to copy an elements data during syncronization
+ //Attention: listViewPos will not be copied. So the position will stay the same.
PwMDataItem& operator = (const PwMDataItem& x)
{
- qDebug("oper=%s", x.desc.c_str());
+ // qDebug("oper=%s", x.desc.c_str());
desc = x.desc;
@@ -230,3 +236,3 @@ struct PwMDataItem
lockStat = x.lockStat;
- listViewPos = x.listViewPos;
+ //Do not copy listViewPos!!! listViewPos = x.listViewPos;
binary = x.binary;
@@ -776,9 +782,2 @@ protected:
- //called by the syncmanager to indicate that the work has to be marked as dirty.
- virtual void sync_setModified();
- //called by the syncmanager to ask if the dirty flag is set.
- virtual bool sync_isModified();
- //called by the syncmanager to indicate that the work has to be saved.
- virtual void sync_save();
-
#endif
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp
index e23ce25..e53124f 100644
--- a/pwmanager/pwmanager/pwmview.cpp
+++ b/pwmanager/pwmanager/pwmview.cpp
@@ -458,7 +458,87 @@ void PwMView::copyCommentToClip()
+/************************************************************************
+ *
+ *
+ *
+ ************************************************************************/
+
+
+PwMDataItemView::PwMDataItemView( QWidget *parent, const char *name )
+ : QTextBrowser( parent, name )
+
+
+{
+//US setWrapPolicy( QTextEdit::AtWordBoundary );
+ setLinkUnderline( false );
+ // setVScrollBarMode( QScrollView::AlwaysOff );
+ //setHScrollBarMode( QScrollView::AlwaysOff );
+
+//US QStyleSheet *sheet = styleSheet();
+//US QStyleSheetItem *link = sheet->item( "a" );
+//US link->setColor( KGlobalSettings::linkColor() );
+
+}
+
+void PwMDataItemView::setPwMDataItem( const PwMDataItem& a )
+
+{
+ mItem = a;
+ // clear view
+ setText( QString::null );
+
+
+ QString dynamicPart;
+ QString format = "<tr><td align=\"right\"><b>%1</b></td>"
+ "<td align=\"left\">%2</td></tr>";
+
+ dynamicPart += format
+ .arg( i18n("Description") )
+ .arg( mItem.desc.c_str() );
+ dynamicPart += format
+ .arg( i18n("Name") )
+ .arg( mItem.name.c_str() );
+
+ dynamicPart += format
+ .arg( i18n("Password") )
+ .arg( mItem.pw.c_str() );
+
+ QString comment(mItem.pw.c_str());
+ dynamicPart += format
+ .arg( i18n("Comment") )
+ .arg( comment.replace( QRegExp("\n"), "<br>" ) );
+
+ dynamicPart += format
+ .arg( i18n("URL") )
+ .arg( mItem.url.c_str() );
+
+ dynamicPart += format
+ .arg( i18n("Launcher") )
+ .arg( mItem.launcher.c_str() );
+
+ QString mText = "<table><td colspan=\"2\">&nbsp;</td>";
+
+ mText += dynamicPart;
+ mText += "</table>";
+
+ // at last display it...
+ setText( mText );
+
+}
+
+PwMDataItem PwMDataItemView::pwmdataitem() const
+{
+ return mItem;
+}
+
+/************************************************************************
+ *
+ *
+ *
+ ************************************************************************/
-PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name,
- true ,i18n("Conflict! Please choose Entry!"),Ok|User1|Close,Close, false)
+PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool takeloc, QWidget *parent, const char *name )
+ : KDialogBase(parent, name, true ,
+ i18n("Conflict! Please choose Entry!"),Ok|User1|Close,Close, false)
{
@@ -480,4 +560,4 @@ PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool t
lab->setBackgroundColor(Qt::green.light() );
- // AddresseeView * av = new AddresseeView( subframe );
- // av->setAddressee( loc );
+ PwMDataItemView * av = new PwMDataItemView( subframe );
+ av->setPwMDataItem( loc );
subframe = new QVBox( topframe );
@@ -487,4 +567,4 @@ PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool t
lab->setBackgroundColor(Qt::green.light() );
- // av = new AddresseeView( subframe );
- // av->setAddressee( rem );
+ av = new PwMDataItemView( subframe );
+ av->setPwMDataItem( rem );
QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));
diff --git a/pwmanager/pwmanager/pwmview.h b/pwmanager/pwmanager/pwmview.h
index 75cce51..e42b17a 100644
--- a/pwmanager/pwmanager/pwmview.h
+++ b/pwmanager/pwmanager/pwmview.h
@@ -43,2 +43,3 @@
#include <qobject.h>
+#include <qtextbrowser.h>
@@ -151,2 +152,26 @@ private:
+//US ENH basic widget to view an password entry. We need it for the sync stuff.
+//But might be oif interest for other functionalities as well.
+class PwMDataItemView : public QTextBrowser
+{
+ public:
+ PwMDataItemView( QWidget *parent = 0, const char *name = 0 );
+
+ /**
+ Sets the PwMDataItem object. It is displayed immediately.
+
+ @param a The PwMDataItem object.
+ */
+ void setPwMDataItem( const PwMDataItem& a );
+
+ /**
+ Returns the current PwMDataItem object.
+ */
+ PwMDataItem pwmdataitem() const;
+
+ private:
+ PwMDataItem mItem;
+};
+
+
//US ENH we need this chooser when syncing results in a conflict
diff --git a/pwmanager/pwmanager/serializer.cpp b/pwmanager/pwmanager/serializer.cpp
index 203f82c..5c6568f 100644
--- a/pwmanager/pwmanager/serializer.cpp
+++ b/pwmanager/pwmanager/serializer.cpp
@@ -29,3 +29,3 @@
/* enable/disable serializer debugging (0/1) */
-#define SERIALIZER_DEBUG 0
+#define SERIALIZER_DEBUG 1
/* use the old xml tags for writing (0/1) */
@@ -306,2 +306,6 @@ bool Serializer::readEntries(const QDomNode &n,
PwMDataItem curEntr;
+ //US BUG: to initialize all values of curEntr with meaningfulldata,
+ // we call clear on it. Reason: Information in the file we will read might be incomplete.
+ // e.g. the metadata is missing.
+ curEntr.clear(true);
@@ -403,32 +407,38 @@ bool Serializer::extractMeta(const QDomNode &n,
}
+
+ //US BUG: The transformation of an empty date into an ISO date and back is different on different systems/compilers.
+ //because of that it is possible that here some values are not set, which means they are null.
+ //US ENH: at the same moment we need backwardcompatibility. So older versions might have stored invalid dates.
+
+ QDateTime dtval; //dtval should be invalid by definition.
+
+ if ((name == META_CREATE_DATE) ||
+ (name == META_VALID_DATE) ||
+ (name == META_EXPIRE_DATE) ||
+ (name == META_UPDATE_DATE))
+ {
+ //qDebug("Serializer::extractMeta:: val:%s, empty:%i, length:%i",val.utf8(), val.isEmpty(), val.length());
+
#ifndef PWM_EMBEDDED
- if (name == META_CREATE_DATE) {
- dta->create = QDateTime::fromString(val, Qt::ISODate);
- } else if (name == META_VALID_DATE) {
- dta->valid = QDateTime::fromString(val, Qt::ISODate);
- } else if (name == META_EXPIRE_DATE) {
- dta->expire = QDateTime::fromString(val, Qt::ISODate);
- } else if (name == META_UPDATE_DATE) {
- dta->update = QDateTime::fromString(val, Qt::ISODate);
- } else if (name == META_UPDATE_INT) {
- dta->updateInt = strtoul(val.latin1(), 0, 10);
- } else if (name == META_UNIQUEID) {
- dta->uniqueid = unescapeEntryData(val).latin1();
- } else {
- printDebug(string("extractMeta(): invalid: ")
- + name.latin1());
- }
+ dtval = QDateTime::fromString(val, Qt::ISODate);
#else
+ bool ok;
+ dtval = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok);
+
+ if (ok == false)
+ qDebug("Serializer::extractMeta invalid date or time !!!!!!!!!!!!!");
+#endif
+ //if the parsed data is wrong, dtval should be invalid at this time.
- bool ok = true;
+ }
if (name == META_CREATE_DATE) {
- dta->create = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok);
+ dta->create = dtval;
} else if (name == META_VALID_DATE) {
- dta->valid = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok);
+ dta->valid = dtval;
} else if (name == META_EXPIRE_DATE) {
- dta->expire = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok);
+ dta->expire = dtval;
} else if (name == META_UPDATE_DATE) {
- dta->update = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok);
+ dta->update = dtval;
} else if (name == META_UPDATE_INT) {
@@ -442,7 +452,2 @@ bool Serializer::extractMeta(const QDomNode &n,
- if (ok == false)
- qDebug("Serializer::extractMeta invalid date or time !!!!!!!!!!!!!");
-
-
-#endif
cur = cur.nextSibling();
@@ -606,37 +611,57 @@ bool Serializer::writeMeta(QDomElement *e,
- tag = domDoc->createElement(META_CREATE_DATE);
+ //US BUG!!!: The transformation of an empty date into an ISO date is different on different systems/compilers.
+ //So do not transform an empty value at all.
+ if (dta.create.isValid())
+ {
+ tag = domDoc->createElement(META_CREATE_DATE);
#ifndef PWM_EMBEDDED
- text = domDoc->createTextNode(dta.create.toString(Qt::ISODate));
+ text = domDoc->createTextNode(dta.create.toString(Qt::ISODate));
#else
- text = domDoc->createTextNode(KGlobal::locale()->formatDateTime(dta.create, KLocale::ISODate));
+ text = domDoc->createTextNode(KGlobal::locale()->formatDateTime(dta.create, KLocale::ISODate));
#endif
- tag.appendChild(text);
- e->appendChild(tag);
+ tag.appendChild(text);
+ e->appendChild(tag);
+ }
- tag = domDoc->createElement(META_VALID_DATE);
+ //US BUG!!!: The transformation of an empty date into an ISO date is different on different systems/compilers.
+ //So do not transform an empty value at all.
+ if (dta.valid.isValid())
+ {
+ tag = domDoc->createElement(META_VALID_DATE);
#ifndef PWM_EMBEDDED
- text = domDoc->createTextNode(dta.valid.toString(Qt::ISODate));
+ text = domDoc->createTextNode(dta.valid.toString(Qt::ISODate));
#else
- text = domDoc->createTextNode(KGlobal::locale()->formatDateTime(dta.valid, KLocale::ISODate));
+ text = domDoc->createTextNode(KGlobal::locale()->formatDateTime(dta.valid, KLocale::ISODate));
#endif
- tag.appendChild(text);
- e->appendChild(tag);
+ tag.appendChild(text);
+ e->appendChild(tag);
+ }
- tag = domDoc->createElement(META_EXPIRE_DATE);
+ //US BUG!!!: The transformation of an empty date into an ISO date is different on different systems/compilers.
+ //So do not transform an empty value at all.
+ if (dta.expire.isValid())
+ {
+ tag = domDoc->createElement(META_EXPIRE_DATE);
#ifndef PWM_EMBEDDED
- text = domDoc->createTextNode(dta.expire.toString(Qt::ISODate));
+ text = domDoc->createTextNode(dta.expire.toString(Qt::ISODate));
#else
- text = domDoc->createTextNode(KGlobal::locale()->formatDateTime(dta.expire, KLocale::ISODate));
+ text = domDoc->createTextNode(KGlobal::locale()->formatDateTime(dta.expire, KLocale::ISODate));
#endif
- tag.appendChild(text);
- e->appendChild(tag);
+ tag.appendChild(text);
+ e->appendChild(tag);
+ }
- tag = domDoc->createElement(META_UPDATE_DATE);
+ //US BUG!!!: The transformation of an empty date into an ISO date is different on different systems/compilers.
+ //So do not transform an empty value at all.
+ if (dta.update.isValid())
+ {
+ tag = domDoc->createElement(META_UPDATE_DATE);
#ifndef PWM_EMBEDDED
- text = domDoc->createTextNode(dta.update.toString(Qt::ISODate));
+ text = domDoc->createTextNode(dta.update.toString(Qt::ISODate));
#else
- text = domDoc->createTextNode(KGlobal::locale()->formatDateTime(dta.update, KLocale::ISODate));
+ text = domDoc->createTextNode(KGlobal::locale()->formatDateTime(dta.update, KLocale::ISODate));
#endif
- tag.appendChild(text);
- e->appendChild(tag);
+ tag.appendChild(text);
+ e->appendChild(tag);
+ }
@@ -674,3 +699,3 @@ QString Serializer::unescapeEntryData(QString dta)
#else
- dta.replace(QRegExp("$>--endl--<$"), "\n");
+ dta.replace(QRegExp("\\$>--endl--<\\$"), "\n");
dta.replace(QRegExp("||>"), "]]>");
@@ -732,3 +757,3 @@ bool Serializer::addSyncData(QDomElement *e,
QString curId, curDeviceName;
- QDomElement curSync, curSyncDate;
+ QDomElement curSync;
QDomText text;
@@ -747,4 +772,3 @@ bool Serializer::addSyncData(QDomElement *e,
#endif
- curSyncDate.appendChild(text);
- curSync.appendChild(curSyncDate);
+ curSync.appendChild(text);