author | zautrix <zautrix> | 2004-10-07 07:59:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-07 07:59:05 (UTC) |
commit | f1699230250cdfb37216121257196b5be9f094fa (patch) (unidiff) | |
tree | e6bf9c6a3814e9a5ee617a726266489aa820bb9c | |
parent | 77280f6a176a15b60004f312e6cacdfbbd3909c1 (diff) | |
download | kdepimpi-f1699230250cdfb37216121257196b5be9f094fa.zip kdepimpi-f1699230250cdfb37216121257196b5be9f094fa.tar.gz kdepimpi-f1699230250cdfb37216121257196b5be9f094fa.tar.bz2 |
Fixed debug messages
-rw-r--r-- | korganizer/calendarview.cpp | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index b3b4cdb..d71ea08 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1379,130 +1379,131 @@ bool CalendarView::importBday() | |||
1379 | #else //DESKTOP_VERSION | 1379 | #else //DESKTOP_VERSION |
1380 | 1380 | ||
1381 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1381 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
1382 | // the result should now arrive through method insertBirthdays | 1382 | // the result should now arrive through method insertBirthdays |
1383 | 1383 | ||
1384 | #endif //DESKTOP_VERSION | 1384 | #endif //DESKTOP_VERSION |
1385 | 1385 | ||
1386 | #endif //KORG_NOKABC | 1386 | #endif //KORG_NOKABC |
1387 | 1387 | ||
1388 | 1388 | ||
1389 | return true; | 1389 | return true; |
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | 1392 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI |
1393 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 1393 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, |
1394 | const QStringList& anniversaryList, const QStringList& realNameList, | 1394 | const QStringList& anniversaryList, const QStringList& realNameList, |
1395 | const QStringList& emailList, const QStringList& assembledNameList, | 1395 | const QStringList& emailList, const QStringList& assembledNameList, |
1396 | const QStringList& uidList) | 1396 | const QStringList& uidList) |
1397 | { | 1397 | { |
1398 | qDebug("CalendarView::insertBirthdays"); | 1398 | qDebug("CalendarView::insertBirthdays"); |
1399 | if (uid == this->name()) | 1399 | if (uid == this->name()) |
1400 | { | 1400 | { |
1401 | int count = birthdayList.count(); | 1401 | int count = birthdayList.count(); |
1402 | int addCount = 0; | 1402 | int addCount = 0; |
1403 | KCal::Attendee* a = 0; | 1403 | KCal::Attendee* a = 0; |
1404 | 1404 | ||
1405 | qDebug("CalView 1 %i", count); | 1405 | qDebug("CalView 1 %i", count); |
1406 | 1406 | ||
1407 | QProgressBar bar(count,0 ); | 1407 | QProgressBar bar(count,0 ); |
1408 | int w = 300; | 1408 | int w = 300; |
1409 | if ( QApplication::desktop()->width() < 320 ) | 1409 | if ( QApplication::desktop()->width() < 320 ) |
1410 | w = 220; | 1410 | w = 220; |
1411 | int h = bar.sizeHint().height() ; | 1411 | int h = bar.sizeHint().height() ; |
1412 | int dw = QApplication::desktop()->width(); | 1412 | int dw = QApplication::desktop()->width(); |
1413 | int dh = QApplication::desktop()->height(); | 1413 | int dh = QApplication::desktop()->height(); |
1414 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1414 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1415 | bar.show(); | 1415 | bar.show(); |
1416 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | 1416 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); |
1417 | qApp->processEvents(); | 1417 | qApp->processEvents(); |
1418 | 1418 | ||
1419 | QDate birthday; | 1419 | QDate birthday; |
1420 | QDate anniversary; | 1420 | QDate anniversary; |
1421 | QString realName; | 1421 | QString realName; |
1422 | QString email; | 1422 | QString email; |
1423 | QString assembledName; | 1423 | QString assembledName; |
1424 | QString uid; | 1424 | QString uid; |
1425 | bool ok = true; | 1425 | bool ok = true; |
1426 | for ( int i = 0; i < count; i++) | 1426 | for ( int i = 0; i < count; i++) |
1427 | { | 1427 | { |
1428 | if ( ! bar.isVisible() ) | 1428 | if ( ! bar.isVisible() ) |
1429 | return; | 1429 | return; |
1430 | bar.setProgress( i ); | 1430 | bar.setProgress( i ); |
1431 | qApp->processEvents(); | 1431 | qApp->processEvents(); |
1432 | |||
1433 | qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); | ||
1434 | |||
1435 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); | ||
1436 | if (!ok) | ||
1437 | qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); | ||
1438 | |||
1439 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); | ||
1440 | if (!ok) | ||
1441 | qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | ||
1442 | realName = realNameList[i]; | ||
1443 | email = emailList[i]; | ||
1444 | assembledName = assembledNameList[i]; | ||
1445 | uid = uidList[i]; | ||
1446 | 1432 | ||
1447 | if ( birthday.isValid() ){ | 1433 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); |
1448 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1434 | if (!ok) { |
1449 | KCal::Attendee::ReqParticipant,uid) ; | 1435 | ; //qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); |
1450 | if ( addAnniversary( birthday, assembledName, a, true ) ) | 1436 | } |
1451 | ++addCount; | ||
1452 | } | ||
1453 | 1437 | ||
1454 | if ( anniversary.isValid() ){ | 1438 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); |
1455 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1439 | if (!ok) { |
1456 | KCal::Attendee::ReqParticipant,uid) ; | 1440 | ;// qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); |
1457 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | 1441 | } |
1458 | ++addCount; | 1442 | realName = realNameList[i]; |
1443 | email = emailList[i]; | ||
1444 | assembledName = assembledNameList[i]; | ||
1445 | uid = uidList[i]; | ||
1446 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); | ||
1447 | |||
1448 | if ( birthday.isValid() ){ | ||
1449 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | ||
1450 | KCal::Attendee::ReqParticipant,uid) ; | ||
1451 | if ( addAnniversary( birthday, assembledName, a, true ) ) | ||
1452 | ++addCount; | ||
1453 | } | ||
1454 | |||
1455 | if ( anniversary.isValid() ){ | ||
1456 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | ||
1457 | KCal::Attendee::ReqParticipant,uid) ; | ||
1458 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | ||
1459 | ++addCount; | ||
1460 | } | ||
1459 | } | 1461 | } |
1460 | } | ||
1461 | 1462 | ||
1462 | updateView(); | 1463 | updateView(); |
1463 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1464 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1464 | 1465 | ||
1465 | } | 1466 | } |
1466 | 1467 | ||
1467 | } | 1468 | } |
1468 | 1469 | ||
1469 | 1470 | ||
1470 | 1471 | ||
1471 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1472 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1472 | { | 1473 | { |
1473 | //qDebug("addAnni "); | 1474 | //qDebug("addAnni "); |
1474 | Event * ev = new Event(); | 1475 | Event * ev = new Event(); |
1475 | if ( a ) { | 1476 | if ( a ) { |
1476 | ev->addAttendee( a ); | 1477 | ev->addAttendee( a ); |
1477 | } | 1478 | } |
1478 | QString kind; | 1479 | QString kind; |
1479 | if ( birthday ) | 1480 | if ( birthday ) |
1480 | kind = i18n( "Birthday" ); | 1481 | kind = i18n( "Birthday" ); |
1481 | else | 1482 | else |
1482 | kind = i18n( "Anniversary" ); | 1483 | kind = i18n( "Anniversary" ); |
1483 | ev->setSummary( name + " - " + kind ); | 1484 | ev->setSummary( name + " - " + kind ); |
1484 | ev->setOrganizer( "nobody@nowhere" ); | 1485 | ev->setOrganizer( "nobody@nowhere" ); |
1485 | ev->setCategories( kind ); | 1486 | ev->setCategories( kind ); |
1486 | ev->setDtStart( QDateTime(date) ); | 1487 | ev->setDtStart( QDateTime(date) ); |
1487 | ev->setDtEnd( QDateTime(date) ); | 1488 | ev->setDtEnd( QDateTime(date) ); |
1488 | ev->setFloats( true ); | 1489 | ev->setFloats( true ); |
1489 | Recurrence * rec = ev->recurrence(); | 1490 | Recurrence * rec = ev->recurrence(); |
1490 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1491 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1491 | rec->addYearlyNum( date.month() ); | 1492 | rec->addYearlyNum( date.month() ); |
1492 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1493 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1493 | delete ev; | 1494 | delete ev; |
1494 | return false; | 1495 | return false; |
1495 | } | 1496 | } |
1496 | return true; | 1497 | return true; |
1497 | 1498 | ||
1498 | } | 1499 | } |
1499 | bool CalendarView::importQtopia( const QString &categories, | 1500 | bool CalendarView::importQtopia( const QString &categories, |
1500 | const QString &datebook, | 1501 | const QString &datebook, |
1501 | const QString &todolist ) | 1502 | const QString &todolist ) |
1502 | { | 1503 | { |
1503 | 1504 | ||
1504 | QtopiaFormat qtopiaFormat; | 1505 | QtopiaFormat qtopiaFormat; |
1505 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1506 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1506 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1507 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1507 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1508 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1508 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1509 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |