-rw-r--r-- | korganizer/calendarview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 13cf69b..a62145a 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1565,97 +1565,97 @@ void CalendarView::syncExternal( int mode ) | |||
1565 | #endif | 1565 | #endif |
1566 | if ( phoneFormat ) | 1566 | if ( phoneFormat ) |
1567 | phoneFormat->save(calendar); | 1567 | phoneFormat->save(calendar); |
1568 | iL = calendar->rawIncidences(); | 1568 | iL = calendar->rawIncidences(); |
1569 | inc = iL.first(); | 1569 | inc = iL.first(); |
1570 | Incidence* loc; | 1570 | Incidence* loc; |
1571 | while ( inc ) { | 1571 | while ( inc ) { |
1572 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1572 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1573 | loc = mCalendar->incidence(inc->uid() ); | 1573 | loc = mCalendar->incidence(inc->uid() ); |
1574 | if ( loc ) { | 1574 | if ( loc ) { |
1575 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1575 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1576 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1576 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1577 | } | 1577 | } |
1578 | } | 1578 | } |
1579 | inc = iL.next(); | 1579 | inc = iL.next(); |
1580 | } | 1580 | } |
1581 | Incidence* lse = getLastSyncEvent(); | 1581 | Incidence* lse = getLastSyncEvent(); |
1582 | if ( lse ) { | 1582 | if ( lse ) { |
1583 | lse->setReadOnly( false ); | 1583 | lse->setReadOnly( false ); |
1584 | lse->setDescription( "" ); | 1584 | lse->setDescription( "" ); |
1585 | lse->setReadOnly( true ); | 1585 | lse->setReadOnly( true ); |
1586 | } | 1586 | } |
1587 | } | 1587 | } |
1588 | } else { | 1588 | } else { |
1589 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 1589 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
1590 | } | 1590 | } |
1591 | setModified( true ); | 1591 | setModified( true ); |
1592 | } else { | 1592 | } else { |
1593 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1593 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1594 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1594 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1595 | question, i18n("Ok")) ; | 1595 | question, i18n("Ok")) ; |
1596 | 1596 | ||
1597 | } | 1597 | } |
1598 | delete calendar; | 1598 | delete calendar; |
1599 | updateView(); | 1599 | updateView(); |
1600 | emit tempDisableBR(false); | 1600 | emit tempDisableBR(false); |
1601 | return ;//syncOK; | 1601 | return ;//syncOK; |
1602 | 1602 | ||
1603 | } | 1603 | } |
1604 | 1604 | ||
1605 | bool CalendarView::importBday() | 1605 | bool CalendarView::importBday() |
1606 | { | 1606 | { |
1607 | #ifndef KORG_NOKABC | 1607 | #ifndef KORG_NOKABC |
1608 | 1608 | ||
1609 | #ifdef DESKTOP_VERSION | 1609 | #ifdef DESKTOP_VERSION |
1610 | int curCal = mCalendar->defaultCalendar(); | 1610 | int curCal = mCalendar->defaultCalendar(); |
1611 | int bd = mCalEditView->getBirtdayID(); | 1611 | int bd = mCalEditView->getBirtdayID(); |
1612 | if ( bd == 0 ) | 1612 | if ( bd == 0 ) |
1613 | return; | 1613 | return false; |
1614 | mCalendar->setDefaultCalendar( bd ); | 1614 | mCalendar->setDefaultCalendar( bd ); |
1615 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1615 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1616 | KABC::AddressBook::Iterator it; | 1616 | KABC::AddressBook::Iterator it; |
1617 | int count = 0; | 1617 | int count = 0; |
1618 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1618 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1619 | ++count; | 1619 | ++count; |
1620 | } | 1620 | } |
1621 | QProgressBar bar(count,0 ); | 1621 | QProgressBar bar(count,0 ); |
1622 | int w = 300; | 1622 | int w = 300; |
1623 | if ( QApplication::desktop()->width() < 320 ) | 1623 | if ( QApplication::desktop()->width() < 320 ) |
1624 | w = 220; | 1624 | w = 220; |
1625 | int h = bar.sizeHint().height() ; | 1625 | int h = bar.sizeHint().height() ; |
1626 | int dw = QApplication::desktop()->width(); | 1626 | int dw = QApplication::desktop()->width(); |
1627 | int dh = QApplication::desktop()->height(); | 1627 | int dh = QApplication::desktop()->height(); |
1628 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1628 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1629 | bar.show(); | 1629 | bar.show(); |
1630 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1630 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1631 | qApp->processEvents(); | 1631 | qApp->processEvents(); |
1632 | count = 0; | 1632 | count = 0; |
1633 | int addCount = 0; | 1633 | int addCount = 0; |
1634 | KCal::Attendee* a = 0; | 1634 | KCal::Attendee* a = 0; |
1635 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1635 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1636 | if ( ! bar.isVisible() ) | 1636 | if ( ! bar.isVisible() ) |
1637 | return false; | 1637 | return false; |
1638 | bar.setProgress( count++ ); | 1638 | bar.setProgress( count++ ); |
1639 | qApp->processEvents(); | 1639 | qApp->processEvents(); |
1640 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1640 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1641 | if ( (*it).birthday().date().isValid() ){ | 1641 | if ( (*it).birthday().date().isValid() ){ |
1642 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1642 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1643 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1643 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1644 | ++addCount; | 1644 | ++addCount; |
1645 | } | 1645 | } |
1646 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1646 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1647 | if ( anni.isValid() ){ | 1647 | if ( anni.isValid() ){ |
1648 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1648 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1649 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1649 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1650 | ++addCount; | 1650 | ++addCount; |
1651 | } | 1651 | } |
1652 | } | 1652 | } |
1653 | mCalendar->setDefaultCalendar( curCal ); | 1653 | mCalendar->setDefaultCalendar( curCal ); |
1654 | updateView(); | 1654 | updateView(); |
1655 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1655 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1656 | #else //DESKTOP_VERSION | 1656 | #else //DESKTOP_VERSION |
1657 | 1657 | ||
1658 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1658 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
1659 | // the result should now arrive through method insertBirthdays | 1659 | // the result should now arrive through method insertBirthdays |
1660 | 1660 | ||
1661 | #endif //DESKTOP_VERSION | 1661 | #endif //DESKTOP_VERSION |