summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-27 05:42:05 (UTC)
committer zautrix <zautrix>2005-06-27 05:42:05 (UTC)
commit16d3551a207f02679aeaeb943f00684db223934d (patch) (unidiff)
tree79e42304c0249c8ae78ad40ec7b88b0f42a839dd
parentfe17413ed808afb7b3e722e1f2ea9a5381a44955 (diff)
downloadkdepimpi-16d3551a207f02679aeaeb943f00684db223934d.zip
kdepimpi-16d3551a207f02679aeaeb943f00684db223934d.tar.gz
kdepimpi-16d3551a207f02679aeaeb943f00684db223934d.tar.bz2
compile fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp2
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
@@ -1517,193 +1517,193 @@ void CalendarView::syncExternal( int mode )
1517{ 1517{
1518 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1518 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1519 1519
1520 qApp->processEvents(); 1520 qApp->processEvents();
1521 CalendarLocal* calendar = new CalendarLocal(); 1521 CalendarLocal* calendar = new CalendarLocal();
1522 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1522 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1523 bool syncOK = false; 1523 bool syncOK = false;
1524 bool loadSuccess = false; 1524 bool loadSuccess = false;
1525 PhoneFormat* phoneFormat = 0; 1525 PhoneFormat* phoneFormat = 0;
1526 emit tempDisableBR(true); 1526 emit tempDisableBR(true);
1527#ifndef DESKTOP_VERSION 1527#ifndef DESKTOP_VERSION
1528 SharpFormat* sharpFormat = 0; 1528 SharpFormat* sharpFormat = 0;
1529 if ( mode == 0 ) { // sharp 1529 if ( mode == 0 ) { // sharp
1530 sharpFormat = new SharpFormat () ; 1530 sharpFormat = new SharpFormat () ;
1531 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1531 loadSuccess = sharpFormat->load( calendar, mCalendar );
1532 1532
1533 } else 1533 } else
1534#endif 1534#endif
1535 if ( mode == 1 ) { // phone 1535 if ( mode == 1 ) { // phone
1536 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1536 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1537 mSyncManager->mPhoneDevice, 1537 mSyncManager->mPhoneDevice,
1538 mSyncManager->mPhoneConnection, 1538 mSyncManager->mPhoneConnection,
1539 mSyncManager->mPhoneModel); 1539 mSyncManager->mPhoneModel);
1540 loadSuccess = phoneFormat->load( calendar,mCalendar); 1540 loadSuccess = phoneFormat->load( calendar,mCalendar);
1541 1541
1542 } else { 1542 } else {
1543 emit tempDisableBR(false); 1543 emit tempDisableBR(false);
1544 return; 1544 return;
1545 } 1545 }
1546 if ( loadSuccess ) { 1546 if ( loadSuccess ) {
1547 getEventViewerDialog()->setSyncMode( true ); 1547 getEventViewerDialog()->setSyncMode( true );
1548 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1548 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1549 getEventViewerDialog()->setSyncMode( false ); 1549 getEventViewerDialog()->setSyncMode( false );
1550 qApp->processEvents(); 1550 qApp->processEvents();
1551 if ( syncOK ) { 1551 if ( syncOK ) {
1552 if ( mSyncManager->mWriteBackFile ) 1552 if ( mSyncManager->mWriteBackFile )
1553 { 1553 {
1554 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1554 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1555 Incidence* inc = iL.first(); 1555 Incidence* inc = iL.first();
1556 if ( phoneFormat ) { 1556 if ( phoneFormat ) {
1557 while ( inc ) { 1557 while ( inc ) {
1558 inc->removeID(mCurrentSyncDevice); 1558 inc->removeID(mCurrentSyncDevice);
1559 inc = iL.next(); 1559 inc = iL.next();
1560 } 1560 }
1561 } 1561 }
1562#ifndef DESKTOP_VERSION 1562#ifndef DESKTOP_VERSION
1563 if ( sharpFormat ) 1563 if ( sharpFormat )
1564 sharpFormat->save(calendar); 1564 sharpFormat->save(calendar);
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
1605bool CalendarView::importBday() 1605bool 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
1662 1662
1663#endif //KORG_NOKABC 1663#endif //KORG_NOKABC
1664 1664
1665 1665
1666 return true; 1666 return true;
1667} 1667}
1668 1668
1669// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI 1669// This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI
1670void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, 1670void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList,
1671 const QStringList& anniversaryList, const QStringList& realNameList, 1671 const QStringList& anniversaryList, const QStringList& realNameList,
1672 const QStringList& emailList, const QStringList& assembledNameList, 1672 const QStringList& emailList, const QStringList& assembledNameList,
1673 const QStringList& uidList) 1673 const QStringList& uidList)
1674{ 1674{
1675 1675
1676 //qDebug("KO::CalendarView::insertBirthdays"); 1676 //qDebug("KO::CalendarView::insertBirthdays");
1677 if (uid == this->name()) 1677 if (uid == this->name())
1678 { 1678 {
1679 int curCal = mCalendar->defaultCalendar(); 1679 int curCal = mCalendar->defaultCalendar();
1680 int bd = mCalEditView->getBirtdayID(); 1680 int bd = mCalEditView->getBirtdayID();
1681 if ( bd == 0 ) 1681 if ( bd == 0 )
1682 return; 1682 return;
1683 mCalendar->setDefaultCalendar( bd ); 1683 mCalendar->setDefaultCalendar( bd );
1684 1684
1685 1685
1686 int count = birthdayList.count(); 1686 int count = birthdayList.count();
1687 int addCount = 0; 1687 int addCount = 0;
1688 KCal::Attendee* a = 0; 1688 KCal::Attendee* a = 0;
1689 1689
1690 //qDebug("CalView 1 %i", count); 1690 //qDebug("CalView 1 %i", count);
1691 1691
1692 QProgressBar bar(count,0 ); 1692 QProgressBar bar(count,0 );
1693 int w = 300; 1693 int w = 300;
1694 if ( QApplication::desktop()->width() < 320 ) 1694 if ( QApplication::desktop()->width() < 320 )
1695 w = 220; 1695 w = 220;
1696 int h = bar.sizeHint().height() ; 1696 int h = bar.sizeHint().height() ;
1697 int dw = QApplication::desktop()->width(); 1697 int dw = QApplication::desktop()->width();
1698 int dh = QApplication::desktop()->height(); 1698 int dh = QApplication::desktop()->height();
1699 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 1699 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
1700 bar.show(); 1700 bar.show();
1701 bar.setCaption (i18n("inserting birthdays - close to abort!") ); 1701 bar.setCaption (i18n("inserting birthdays - close to abort!") );
1702 qApp->processEvents(); 1702 qApp->processEvents();
1703 1703
1704 QDate birthday; 1704 QDate birthday;
1705 QDate anniversary; 1705 QDate anniversary;
1706 QString realName; 1706 QString realName;
1707 QString email; 1707 QString email;
1708 QString assembledName; 1708 QString assembledName;
1709 QString uid; 1709 QString uid;