summaryrefslogtreecommitdiffabout
path: root/pwmanager
authorulf69 <ulf69>2004-09-29 01:42:40 (UTC)
committer ulf69 <ulf69>2004-09-29 01:42:40 (UTC)
commitaf63a131d742aff8e448e5fe0f3e62b11a4d9a33 (patch) (unidiff)
tree2b299c6a4b365bf938c7b6269cd51bf38b0d9d99 /pwmanager
parentbb0e15259ccb1883410435ad76eb0de08b7e2069 (diff)
downloadkdepimpi-af63a131d742aff8e448e5fe0f3e62b11a4d9a33.zip
kdepimpi-af63a131d742aff8e448e5fe0f3e62b11a4d9a33.tar.gz
kdepimpi-af63a131d742aff8e448e5fe0f3e62b11a4d9a33.tar.bz2
added some debug output
Diffstat (limited to 'pwmanager') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/serializer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/serializer.cpp b/pwmanager/pwmanager/serializer.cpp
index fcdcec3..9377e3d 100644
--- a/pwmanager/pwmanager/serializer.cpp
+++ b/pwmanager/pwmanager/serializer.cpp
@@ -369,97 +369,97 @@ bool Serializer::extractEntry(const QDomNode &n,
369 + name.latin1()); 369 + name.latin1());
370 } 370 }
371 } 371 }
372 dta->lockStat = defaultLockStat; 372 dta->lockStat = defaultLockStat;
373 return true; 373 return true;
374} 374}
375 375
376bool Serializer::extractMeta(const QDomNode &n, 376bool Serializer::extractMeta(const QDomNode &n,
377 PwMMetaData *dta) 377 PwMMetaData *dta)
378{ 378{
379 QDomNode cur(n.firstChild()); 379 QDomNode cur(n.firstChild());
380 QString name, val; 380 QString name, val;
381 while (!cur.isNull()) { 381 while (!cur.isNull()) {
382 name = cur.nodeName(); 382 name = cur.nodeName();
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; 407 QDateTime m_dt;
408 408
409 if ((name == META_CREATE_DATE) || 409 if ((name == META_CREATE_DATE) ||
410 (name == META_VALID_DATE) || 410 (name == META_VALID_DATE) ||
411 (name == META_EXPIRE_DATE) || 411 (name == META_EXPIRE_DATE) ||
412 (name == META_UPDATE_DATE)) 412 (name == META_UPDATE_DATE))
413 { 413 {
414 int pos = val.find("T"); 414 int pos = val.find("T");
415 QString date = val.left(pos); 415 QString date = val.left(pos);
416 QString time = val.mid(pos+1); 416 QString time = val.mid(pos+1);
417 qDebug("Serializer::extractMeta : date=%s ,time=%s",date.latin1(), time.latin1() ); 417 qDebug("Serializer::extractMeta from %s to date=%s ,time=%s",val.latin1(), date.latin1(), time.latin1() );
418 bool ok1, ok2; 418 bool ok1, ok2;
419 419
420 QDate m_date = KGlobal::locale()->readDate(date, &ok1); 420 QDate m_date = KGlobal::locale()->readDate(date, &ok1);
421 QTime m_time = KGlobal::locale()->readTime(time, &ok2); 421 QTime m_time = KGlobal::locale()->readTime(time, &ok2);
422 if ((ok1 == false) || (ok2 == false)) 422 if ((ok1 == false) || (ok2 == false))
423 qDebug("Serializer::extractMeta invalid date or time !!!!!!!!!!!!!"); 423 qDebug("Serializer::extractMeta invalid date or time !!!!!!!!!!!!!");
424 m_dt.setDate(m_date); 424 m_dt.setDate(m_date);
425 m_dt.setTime(m_time); 425 m_dt.setTime(m_time);
426 } 426 }
427 427
428 428
429 if (name == META_CREATE_DATE) { 429 if (name == META_CREATE_DATE) {
430 dta->create = m_dt; 430 dta->create = m_dt;
431 } else if (name == META_VALID_DATE) { 431 } else if (name == META_VALID_DATE) {
432 dta->valid = m_dt; 432 dta->valid = m_dt;
433 } else if (name == META_EXPIRE_DATE) { 433 } else if (name == META_EXPIRE_DATE) {
434 dta->expire = m_dt; 434 dta->expire = m_dt;
435 } else if (name == META_UPDATE_DATE) { 435 } else if (name == META_UPDATE_DATE) {
436 dta->update = m_dt; 436 dta->update = m_dt;
437 } else if (name == META_UPDATE_INT) { 437 } else if (name == META_UPDATE_INT) {
438 dta->updateInt = strtoul(val.latin1(), 0, 10); 438 dta->updateInt = strtoul(val.latin1(), 0, 10);
439 } else if (name == META_UNIQUEID) { 439 } else if (name == META_UNIQUEID) {
440 dta->uniqueid = unescapeEntryData(val).latin1(); 440 dta->uniqueid = unescapeEntryData(val).latin1();
441 } else { 441 } else {
442 printDebug(string("extractMeta(): invalid: ") 442 printDebug(string("extractMeta(): invalid: ")
443 + name.latin1()); 443 + name.latin1());
444 } 444 }
445#endif 445#endif
446 cur = cur.nextSibling(); 446 cur = cur.nextSibling();
447 } 447 }
448 return true; 448 return true;
449} 449}
450 450
451bool Serializer::checkValid() 451bool Serializer::checkValid()
452{ 452{
453 PWM_ASSERT(domDoc); 453 PWM_ASSERT(domDoc);
454 QDomElement root(domDoc->documentElement()); 454 QDomElement root(domDoc->documentElement());
455 if (root.nodeName() != ROOT_MAGIC_NEW && 455 if (root.nodeName() != ROOT_MAGIC_NEW &&
456 root.nodeName() != ROOT_MAGIC_OLD) { 456 root.nodeName() != ROOT_MAGIC_OLD) {
457 printDebug("Serializer: wrong magic"); 457 printDebug("Serializer: wrong magic");
458 return false; 458 return false;
459 } 459 }
460 if (root.attribute(VER_STR_NEW) != COMPAT_VER_NEW && 460 if (root.attribute(VER_STR_NEW) != COMPAT_VER_NEW &&
461 root.attribute(VER_STR_OLD) != COMPAT_VER_OLD) { 461 root.attribute(VER_STR_OLD) != COMPAT_VER_OLD) {
462 printDebug("Serializer: wrong version"); 462 printDebug("Serializer: wrong version");
463 return false; 463 return false;
464 } 464 }
465 return true; 465 return true;