author | zautrix <zautrix> | 2005-07-09 08:48:32 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-09 08:48:32 (UTC) |
commit | f731dd9fc5b3f14c44d4de26eb5370a79c63887c (patch) (unidiff) | |
tree | e3d7b3929cc8819a5451bd04c9698bc0767e49b1 | |
parent | e27ad31c6016152449bbdaf4f9f387fa61183c37 (diff) | |
download | kdepimpi-f731dd9fc5b3f14c44d4de26eb5370a79c63887c.zip kdepimpi-f731dd9fc5b3f14c44d4de26eb5370a79c63887c.tar.gz kdepimpi-f731dd9fc5b3f14c44d4de26eb5370a79c63887c.tar.bz2 |
fixi
-rw-r--r-- | korganizer/calendarview.cpp | 20 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/journalentry.cpp | 22 | ||||
-rw-r--r-- | korganizer/journalentry.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 2 | ||||
-rw-r--r-- | libkcal/calendar.cpp | 3 | ||||
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 75 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 3 |
9 files changed, 127 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 940ea91..ccacc52 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1442,38 +1442,42 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1442 | if ( !skipIncidence ) { | 1442 | if ( !skipIncidence ) { |
1443 | inL = local->incidence( uid ); | 1443 | inL = local->incidence( uid ); |
1444 | if ( inL ) { // maybe conflict - same uid in both calendars | 1444 | if ( inL ) { // maybe conflict - same uid in both calendars |
1445 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1445 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1446 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1446 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1447 | if ( take == 3 ) | 1447 | if ( take == 3 ) |
1448 | return false; | 1448 | return false; |
1449 | if ( take == 1 ) {// take local ********************** | 1449 | if ( take == 1 ) {// take local ********************** |
1450 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1450 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1451 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1451 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1452 | else | 1452 | else |
1453 | idS = inR->IDStr(); | 1453 | idS = inR->IDStr(); |
1454 | int calID = inR->calID(); | ||
1454 | remote->deleteIncidence( inR ); | 1455 | remote->deleteIncidence( inR ); |
1455 | inR = inL->clone(); | 1456 | inR = inL->clone(); |
1457 | inR->setCalID( calID ); | ||
1456 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1458 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1457 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1459 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1458 | inR->setIDStr( idS ); | 1460 | inR->setIDStr( idS ); |
1459 | remote->addIncidence( inR ); | 1461 | remote->addIncidence( inR ); |
1460 | if ( mSyncManager->syncWithDesktop() ) | 1462 | if ( mSyncManager->syncWithDesktop() ) |
1461 | inR->setPilotId( 2 ); | 1463 | inR->setPilotId( 2 ); |
1462 | ++changedRemote; | 1464 | ++changedRemote; |
1463 | } else {// take remote ********************** | 1465 | } else {// take remote ********************** |
1464 | idS = inL->IDStr(); | 1466 | idS = inL->IDStr(); |
1465 | int pid = inL->pilotId(); | 1467 | int pid = inL->pilotId(); |
1468 | int calID = inL->calID(); | ||
1466 | local->deleteIncidence( inL ); | 1469 | local->deleteIncidence( inL ); |
1467 | inL = inR->clone(); | 1470 | inL = inR->clone(); |
1471 | inL->setCalID( calID ); | ||
1468 | if ( mSyncManager->syncWithDesktop() ) | 1472 | if ( mSyncManager->syncWithDesktop() ) |
1469 | inL->setPilotId( pid ); | 1473 | inL->setPilotId( pid ); |
1470 | inL->setIDStr( idS ); | 1474 | inL->setIDStr( idS ); |
1471 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1475 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1472 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1476 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1473 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1477 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1474 | } | 1478 | } |
1475 | local->addIncidence( inL ); | 1479 | local->addIncidence( inL ); |
1476 | ++changedLocal; | 1480 | ++changedLocal; |
1477 | } | 1481 | } |
1478 | } | 1482 | } |
1479 | } else { // no conflict ********** add or delete remote | 1483 | } else { // no conflict ********** add or delete remote |
@@ -1484,33 +1488,36 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1484 | if ( inR->typeID() == todoID ) | 1488 | if ( inR->typeID() == todoID ) |
1485 | pref = "t"; | 1489 | pref = "t"; |
1486 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1490 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1487 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1491 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1488 | //remote->deleteIncidence( inR ); | 1492 | //remote->deleteIncidence( inR ); |
1489 | ++deletedEventR; | 1493 | ++deletedEventR; |
1490 | } else { | 1494 | } else { |
1491 | inR->setLastModified( modifiedCalendar ); | 1495 | inR->setLastModified( modifiedCalendar ); |
1492 | inL = inR->clone(); | 1496 | inL = inR->clone(); |
1493 | inL->setIDStr( ":" ); | 1497 | inL->setIDStr( ":" ); |
1494 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1498 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1495 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1499 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1500 | |||
1501 | inL->setCalID( 0 );// add to default cal | ||
1496 | local->addIncidence( inL ); | 1502 | local->addIncidence( inL ); |
1497 | ++addedEvent; | 1503 | ++addedEvent; |
1498 | 1504 | ||
1499 | } | 1505 | } |
1500 | } else { | 1506 | } else { |
1501 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1507 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1502 | inR->setLastModified( modifiedCalendar ); | 1508 | inR->setLastModified( modifiedCalendar ); |
1503 | inL = inR->clone(); | 1509 | inL = inR->clone(); |
1504 | inL->setIDStr( ":" ); | 1510 | inL->setIDStr( ":" ); |
1511 | inL->setCalID( 0 );// add to default cal | ||
1505 | local->addIncidence( inL ); | 1512 | local->addIncidence( inL ); |
1506 | ++addedEvent; | 1513 | ++addedEvent; |
1507 | 1514 | ||
1508 | } else { | 1515 | } else { |
1509 | checkExternSyncEvent(eventRSyncSharp, inR); | 1516 | checkExternSyncEvent(eventRSyncSharp, inR); |
1510 | remote->deleteIncidence( inR ); | 1517 | remote->deleteIncidence( inR ); |
1511 | ++deletedEventR; | 1518 | ++deletedEventR; |
1512 | } | 1519 | } |
1513 | } | 1520 | } |
1514 | } else { | 1521 | } else { |
1515 | ++filteredIN; | 1522 | ++filteredIN; |
1516 | } | 1523 | } |
@@ -1550,38 +1557,40 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1550 | checkExternSyncEvent(eventLSyncSharp, inL); | 1557 | checkExternSyncEvent(eventLSyncSharp, inL); |
1551 | local->deleteIncidence( inL ); | 1558 | local->deleteIncidence( inL ); |
1552 | ++deletedEventL; | 1559 | ++deletedEventL; |
1553 | } else { | 1560 | } else { |
1554 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1561 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1555 | inL->removeID(mCurrentSyncDevice ); | 1562 | inL->removeID(mCurrentSyncDevice ); |
1556 | ++addedEventR; | 1563 | ++addedEventR; |
1557 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1564 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1558 | inL->setLastModified( modifiedCalendar ); | 1565 | inL->setLastModified( modifiedCalendar ); |
1559 | inR = inL->clone(); | 1566 | inR = inL->clone(); |
1560 | inR->setIDStr( ":" ); | 1567 | inR->setIDStr( ":" ); |
1561 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1568 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1569 | inR->setCalID( 0 );// add to default cal | ||
1562 | remote->addIncidence( inR ); | 1570 | remote->addIncidence( inR ); |
1563 | } | 1571 | } |
1564 | } | 1572 | } |
1565 | } else { | 1573 | } else { |
1566 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1574 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1567 | checkExternSyncEvent(eventLSyncSharp, inL); | 1575 | checkExternSyncEvent(eventLSyncSharp, inL); |
1568 | local->deleteIncidence( inL ); | 1576 | local->deleteIncidence( inL ); |
1569 | ++deletedEventL; | 1577 | ++deletedEventL; |
1570 | } else { | 1578 | } else { |
1571 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1579 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1572 | ++addedEventR; | 1580 | ++addedEventR; |
1573 | inL->setLastModified( modifiedCalendar ); | 1581 | inL->setLastModified( modifiedCalendar ); |
1574 | inR = inL->clone(); | 1582 | inR = inL->clone(); |
1575 | inR->setIDStr( ":" ); | 1583 | inR->setIDStr( ":" ); |
1584 | inR->setCalID( 0 );// add to default cal | ||
1576 | remote->addIncidence( inR ); | 1585 | remote->addIncidence( inR ); |
1577 | } | 1586 | } |
1578 | } | 1587 | } |
1579 | } | 1588 | } |
1580 | } else { | 1589 | } else { |
1581 | ++filteredOUT; | 1590 | ++filteredOUT; |
1582 | } | 1591 | } |
1583 | } | 1592 | } |
1584 | } | 1593 | } |
1585 | inL = el.next(); | 1594 | inL = el.next(); |
1586 | } | 1595 | } |
1587 | int delFut = 0; | 1596 | int delFut = 0; |
@@ -2134,24 +2143,33 @@ bool CalendarView::openCalendar(QString filename, bool merge) | |||
2134 | 2143 | ||
2135 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 2144 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
2136 | 2145 | ||
2137 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 2146 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
2138 | globalFlagBlockAgenda = 2; | 2147 | globalFlagBlockAgenda = 2; |
2139 | mCalendar->reInitAlarmSettings(); | 2148 | mCalendar->reInitAlarmSettings(); |
2140 | setSyncEventsReadOnly(); | 2149 | setSyncEventsReadOnly(); |
2141 | updateUnmanagedViews(); | 2150 | updateUnmanagedViews(); |
2142 | updateView(); | 2151 | updateView(); |
2143 | } | 2152 | } |
2144 | return false; | 2153 | return false; |
2145 | } | 2154 | } |
2155 | void CalendarView::mergeFile( QString fn ) | ||
2156 | { | ||
2157 | clearAllViews(); | ||
2158 | mCalendar->mergeCalendarFile( fn ); | ||
2159 | mCalendar->reInitAlarmSettings(); | ||
2160 | setSyncEventsReadOnly(); | ||
2161 | updateUnmanagedViews(); | ||
2162 | updateView(); | ||
2163 | } | ||
2146 | void CalendarView::showOpenError() | 2164 | void CalendarView::showOpenError() |
2147 | { | 2165 | { |
2148 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 2166 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
2149 | } | 2167 | } |
2150 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 2168 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
2151 | { | 2169 | { |
2152 | loadedFileVersion = dt; | 2170 | loadedFileVersion = dt; |
2153 | } | 2171 | } |
2154 | bool CalendarView::checkFileChanged(QString fn) | 2172 | bool CalendarView::checkFileChanged(QString fn) |
2155 | { | 2173 | { |
2156 | QFileInfo finf ( fn ); | 2174 | QFileInfo finf ( fn ); |
2157 | if ( !finf.exists() ) | 2175 | if ( !finf.exists() ) |
@@ -3349,30 +3367,32 @@ void CalendarView::newEvent() | |||
3349 | if (aView) { | 3367 | if (aView) { |
3350 | if (aView->selectionStart().isValid()) { | 3368 | if (aView->selectionStart().isValid()) { |
3351 | if (aView->selectedIsAllDay()) { | 3369 | if (aView->selectedIsAllDay()) { |
3352 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 3370 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
3353 | } else { | 3371 | } else { |
3354 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 3372 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
3355 | } | 3373 | } |
3356 | return; | 3374 | return; |
3357 | } | 3375 | } |
3358 | } | 3376 | } |
3359 | 3377 | ||
3360 | QDate date = mNavigator->selectedDates().first(); | 3378 | QDate date = mNavigator->selectedDates().first(); |
3379 | #if 0 | ||
3361 | QDateTime current = QDateTime::currentDateTime(); | 3380 | QDateTime current = QDateTime::currentDateTime(); |
3362 | if ( date <= current.date() ) { | 3381 | if ( date <= current.date() ) { |
3363 | int hour = current.time().hour() +1; | 3382 | int hour = current.time().hour() +1; |
3364 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 3383 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
3365 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3384 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3366 | } else | 3385 | } else |
3386 | #endif | ||
3367 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 3387 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
3368 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 3388 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
3369 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 3389 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
3370 | } | 3390 | } |
3371 | 3391 | ||
3372 | void CalendarView::newEvent(QDateTime fh) | 3392 | void CalendarView::newEvent(QDateTime fh) |
3373 | { | 3393 | { |
3374 | newEvent(fh, | 3394 | newEvent(fh, |
3375 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 3395 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
3376 | } | 3396 | } |
3377 | 3397 | ||
3378 | void CalendarView::newEvent(QDate dt) | 3398 | void CalendarView::newEvent(QDate dt) |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 706d05d..799c297 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -129,24 +129,25 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
129 | 129 | ||
130 | QWidgetStack *viewStack(); | 130 | QWidgetStack *viewStack(); |
131 | QWidget *leftFrame(); | 131 | QWidget *leftFrame(); |
132 | 132 | ||
133 | DateNavigator *dateNavigator(); | 133 | DateNavigator *dateNavigator(); |
134 | KDateNavigator *dateNavigatorWidget(); | 134 | KDateNavigator *dateNavigatorWidget(); |
135 | 135 | ||
136 | void addView(KOrg::BaseView *); | 136 | void addView(KOrg::BaseView *); |
137 | void showView(KOrg::BaseView *); | 137 | void showView(KOrg::BaseView *); |
138 | KOEventViewerDialog* getEventViewerDialog(); | 138 | KOEventViewerDialog* getEventViewerDialog(); |
139 | Incidence *currentSelection(); | 139 | Incidence *currentSelection(); |
140 | void checkSuspendAlarm(); | 140 | void checkSuspendAlarm(); |
141 | void mergeFile( QString fn ); | ||
141 | 142 | ||
142 | signals: | 143 | signals: |
143 | void save (); | 144 | void save (); |
144 | void saveStopTimer (); | 145 | void saveStopTimer (); |
145 | void tempDisableBR(bool); | 146 | void tempDisableBR(bool); |
146 | /** This todo has been modified */ | 147 | /** This todo has been modified */ |
147 | void todoModified(Todo *, int); | 148 | void todoModified(Todo *, int); |
148 | 149 | ||
149 | /** when change is made to options dialog, the topwidget will catch this | 150 | /** when change is made to options dialog, the topwidget will catch this |
150 | * and emit this signal which notifies all widgets which have registered | 151 | * and emit this signal which notifies all widgets which have registered |
151 | * for notification to update their settings. */ | 152 | * for notification to update their settings. */ |
152 | void configChanged(); | 153 | void configChanged(); |
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index b8a4cf2..f0e0f86 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -67,25 +67,26 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
67 | heiHint = heiHint / fac; | 67 | heiHint = heiHint / fac; |
68 | 68 | ||
69 | showOnlyMode = false; | 69 | showOnlyMode = false; |
70 | mCalendar = calendar; | 70 | mCalendar = calendar; |
71 | mJournal = 0; | 71 | mJournal = 0; |
72 | visibleMode = true; | 72 | visibleMode = true; |
73 | QHBox * vb = new QHBox ( this ); | 73 | QHBox * vb = new QHBox ( this ); |
74 | QPixmap iconp; | 74 | QPixmap iconp; |
75 | vb->setMargin ( KDialog::marginHint()-1 ); | 75 | vb->setMargin ( KDialog::marginHint()-1 ); |
76 | QPushButton * toggleJournal = new QPushButton( vb ); | 76 | QPushButton * toggleJournal = new QPushButton( vb ); |
77 | iconp = SmallIcon("1updownarrow"); | 77 | iconp = SmallIcon("1updownarrow"); |
78 | toggleJournal->setPixmap (iconp ) ; | 78 | toggleJournal->setPixmap (iconp ) ; |
79 | vb->setStretchFactor (new QLabel(" "+i18n("Title: "),vb),1); | 79 | QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb); |
80 | vb->setStretchFactor (textLabel,1); | ||
80 | vb->setStretchFactor( toggleJournal, 1 ); | 81 | vb->setStretchFactor( toggleJournal, 1 ); |
81 | mTitle = new KOLocationBox(TRUE, vb, 30); | 82 | mTitle = new KOLocationBox(TRUE, vb, 30); |
82 | mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); | 83 | mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); |
83 | mCalendarBox = new QComboBox(vb); | 84 | mCalendarBox = new QComboBox(vb); |
84 | mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); | 85 | mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); |
85 | #ifndef DESKTOP_VERSION | 86 | #ifndef DESKTOP_VERSION |
86 | mTitle->setSizeLimit( 8 ); | 87 | mTitle->setSizeLimit( 8 ); |
87 | mCalendarBox->setSizeLimit( 8 ); | 88 | mCalendarBox->setSizeLimit( 8 ); |
88 | #endif | 89 | #endif |
89 | vb->setStretchFactor ( mTitle, 8 ); | 90 | vb->setStretchFactor ( mTitle, 8 ); |
90 | vb->setStretchFactor ( mCalendarBox, 3 ); | 91 | vb->setStretchFactor ( mCalendarBox, 3 ); |
91 | //mTitleLabel->setMargin(0); | 92 | //mTitleLabel->setMargin(0); |
@@ -103,40 +104,59 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
103 | else | 104 | else |
104 | iconp = SmallIcon("fileimport"); | 105 | iconp = SmallIcon("fileimport"); |
105 | loadTemplate->setPixmap (iconp ) ; | 106 | loadTemplate->setPixmap (iconp ) ; |
106 | loadTemplate->setFixedSize( size, size ); | 107 | loadTemplate->setFixedSize( size, size ); |
107 | saveTemplate->setFixedSize( size, size ); | 108 | saveTemplate->setFixedSize( size, size ); |
108 | toggleJournal->setFixedSize( size , size ); | 109 | toggleJournal->setFixedSize( size , size ); |
109 | mTitle->setFixedHeight( size+4); | 110 | mTitle->setFixedHeight( size+4); |
110 | mCalendarBox->setFixedHeight( size+4); | 111 | mCalendarBox->setFixedHeight( size+4); |
111 | mEditor = new KTextEdit(this); | 112 | mEditor = new KTextEdit(this); |
112 | #ifndef DESKTOP_VERSION | 113 | #ifndef DESKTOP_VERSION |
113 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); | 114 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); |
114 | #endif | 115 | #endif |
116 | mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width(); | ||
117 | mDeskWid = QApplication::desktop()->width(); | ||
118 | int maxwid = mDeskWid - mMaxWidDiff; | ||
119 | mTitle->setMaximumWidth( maxwid/2 +20 ); | ||
120 | mCalendarBox->setMaximumWidth( maxwid/2 -20 ); | ||
115 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); | 121 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); |
116 | QBoxLayout *topLayout = new QVBoxLayout(this); | 122 | QBoxLayout *topLayout = new QVBoxLayout(this); |
117 | topLayout->addWidget(vb); | 123 | topLayout->addWidget(vb); |
118 | topLayout->addWidget(mEditor); | 124 | topLayout->addWidget(mEditor); |
119 | mEditor->installEventFilter(this); | 125 | mEditor->installEventFilter(this); |
120 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 126 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
121 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 127 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
122 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); | 128 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); |
123 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); | 129 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); |
124 | mTitle->lineEdit ()->setText(""); | 130 | mTitle->lineEdit ()->setText(""); |
125 | } | 131 | } |
126 | 132 | ||
127 | JournalEntry::~JournalEntry() | 133 | JournalEntry::~JournalEntry() |
128 | { | 134 | { |
129 | //qDebug("JournalEntry::~JournalEntry() "); | 135 | //qDebug("JournalEntry::~JournalEntry() "); |
130 | } | 136 | } |
137 | void JournalEntry::resizeEvent(QResizeEvent* e ) | ||
138 | { | ||
139 | #ifndef DESKTOP_VERSION | ||
140 | if ( mDeskWid != QApplication::desktop()->width() ) { | ||
141 | mDeskWid == QApplication::desktop()->width(); | ||
142 | int maxwid = mDeskWid - mMaxWidDiff; | ||
143 | mTitle->setMaximumWidth( maxwid/2 +20 ); | ||
144 | mCalendarBox->setMaximumWidth( maxwid/2 -20 ); | ||
145 | } | ||
146 | setMaximumWidth( QApplication::desktop()->width() ); | ||
147 | qDebug("MAXXX %d ", QApplication::desktop()->width()); | ||
148 | #endif | ||
149 | QFrame::resizeEvent( e ); | ||
150 | } | ||
131 | QSize JournalEntry::sizeHint() const | 151 | QSize JournalEntry::sizeHint() const |
132 | { | 152 | { |
133 | return QSize ( 240, heiHint ); | 153 | return QSize ( 240, heiHint ); |
134 | } | 154 | } |
135 | void JournalEntry::slotSaveTemplate() | 155 | void JournalEntry::slotSaveTemplate() |
136 | { | 156 | { |
137 | QString fileName =locateLocal( "templates", "journals" ); | 157 | QString fileName =locateLocal( "templates", "journals" ); |
138 | QDir t_dir; | 158 | QDir t_dir; |
139 | if ( !t_dir.exists(fileName) ) | 159 | if ( !t_dir.exists(fileName) ) |
140 | t_dir.mkdir ( fileName ); | 160 | t_dir.mkdir ( fileName ); |
141 | fileName += "/journal"; | 161 | fileName += "/journal"; |
142 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); | 162 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); |
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h index ed04b7c..a69846c 100644 --- a/korganizer/journalentry.h +++ b/korganizer/journalentry.h | |||
@@ -46,40 +46,43 @@ class JournalEntry : public QFrame { | |||
46 | void setJournal(Journal *, bool saveJournal = true ); | 46 | void setJournal(Journal *, bool saveJournal = true ); |
47 | Journal *journal() const; | 47 | Journal *journal() const; |
48 | 48 | ||
49 | void setDate(const QDate &); | 49 | void setDate(const QDate &); |
50 | 50 | ||
51 | void clear(); | 51 | void clear(); |
52 | 52 | ||
53 | void flushEntry(); | 53 | void flushEntry(); |
54 | void setShowOnly(); | 54 | void setShowOnly(); |
55 | QSize sizeHint() const; | 55 | QSize sizeHint() const; |
56 | void setVisibleMode( bool b ) { visibleMode = b;} | 56 | void setVisibleMode( bool b ) { visibleMode = b;} |
57 | void fillCalendar( int id = 0 ); | 57 | void fillCalendar( int id = 0 ); |
58 | void resizeEvent(QResizeEvent* e ) ; | ||
58 | protected slots: | 59 | protected slots: |
59 | void slotSaveTemplate(); | 60 | void slotSaveTemplate(); |
60 | void slotLoadTemplate(); | 61 | void slotLoadTemplate(); |
61 | void toggleShowJournal(); | 62 | void toggleShowJournal(); |
62 | void setVisibleOn(); | 63 | void setVisibleOn(); |
63 | signals: | 64 | signals: |
64 | void deleteJournal(Journal *); | 65 | void deleteJournal(Journal *); |
65 | void newJournal(); | 66 | void newJournal(); |
66 | void showJournalOnly( Journal * ); | 67 | void showJournalOnly( Journal * ); |
67 | 68 | ||
68 | protected: | 69 | protected: |
69 | bool eventFilter( QObject *o, QEvent *e ); | 70 | bool eventFilter( QObject *o, QEvent *e ); |
70 | 71 | ||
71 | void writeJournal(); | 72 | void writeJournal(); |
72 | 73 | ||
73 | private: | 74 | private: |
75 | int mMaxWidDiff; | ||
76 | int mDeskWid; | ||
74 | bool visibleMode; | 77 | bool visibleMode; |
75 | bool showOnlyMode; | 78 | bool showOnlyMode; |
76 | Calendar *mCalendar; | 79 | Calendar *mCalendar; |
77 | Journal *mJournal; | 80 | Journal *mJournal; |
78 | QDate mDate; | 81 | QDate mDate; |
79 | void keyPressEvent ( QKeyEvent * ) ; | 82 | void keyPressEvent ( QKeyEvent * ) ; |
80 | QComboBox *mCalendarBox; | 83 | QComboBox *mCalendarBox; |
81 | KOLocationBox * mTitle; | 84 | KOLocationBox * mTitle; |
82 | KTextEdit *mEditor; | 85 | KTextEdit *mEditor; |
83 | int heiHint; | 86 | int heiHint; |
84 | }; | 87 | }; |
85 | 88 | ||
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 5249300..4bedb61 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -2535,25 +2535,25 @@ void MainWindow::syncFileRequest() | |||
2535 | 2535 | ||
2536 | setCaption(i18n("Saving Data to temp file ..." )); | 2536 | setCaption(i18n("Saving Data to temp file ..." )); |
2537 | mView->saveCalendar( sentSyncFile() ); | 2537 | mView->saveCalendar( sentSyncFile() ); |
2538 | setCaption(i18n("Data saved to temp file!" )); | 2538 | setCaption(i18n("Data saved to temp file!" )); |
2539 | 2539 | ||
2540 | } | 2540 | } |
2541 | void MainWindow::getFile( bool success ) | 2541 | void MainWindow::getFile( bool success ) |
2542 | { | 2542 | { |
2543 | if ( ! success ) { | 2543 | if ( ! success ) { |
2544 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2544 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2545 | return; | 2545 | return; |
2546 | } | 2546 | } |
2547 | mView->openCalendar( sentSyncFile() ); | 2547 | mView->mergeFile( sentSyncFile() ); |
2548 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2548 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2549 | mSyncManager->slotSyncMenu( 999 ); | 2549 | mSyncManager->slotSyncMenu( 999 ); |
2550 | } | 2550 | } |
2551 | setCaption( i18n("Pi-Sync successful!") ); | 2551 | setCaption( i18n("Pi-Sync successful!") ); |
2552 | } | 2552 | } |
2553 | void MainWindow::printListView() | 2553 | void MainWindow::printListView() |
2554 | { | 2554 | { |
2555 | 2555 | ||
2556 | QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); | 2556 | QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); |
2557 | 2557 | ||
2558 | KMessageBox::information( this, message); | 2558 | KMessageBox::information( this, message); |
2559 | } | 2559 | } |
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index a662eeb..b7990d4 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -351,25 +351,26 @@ void Calendar::addIncidenceBranch(Incidence *i) | |||
351 | { | 351 | { |
352 | addIncidence( i ); | 352 | addIncidence( i ); |
353 | Incidence * inc; | 353 | Incidence * inc; |
354 | QPtrList<Incidence> Relations = i->relations(); | 354 | QPtrList<Incidence> Relations = i->relations(); |
355 | for (inc=Relations.first();inc;inc=Relations.next()) { | 355 | for (inc=Relations.first();inc;inc=Relations.next()) { |
356 | addIncidenceBranch( inc ); | 356 | addIncidenceBranch( inc ); |
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | bool Calendar::addIncidence(Incidence *i) | 360 | bool Calendar::addIncidence(Incidence *i) |
361 | { | 361 | { |
362 | Incidence::AddVisitor<Calendar> v(this); | 362 | Incidence::AddVisitor<Calendar> v(this); |
363 | i->setCalID( mDefaultCalendar ); | 363 | if ( i->calID() == 0 ) |
364 | i->setCalID( mDefaultCalendar ); | ||
364 | i->setCalEnabled( true ); | 365 | i->setCalEnabled( true ); |
365 | return i->accept(v); | 366 | return i->accept(v); |
366 | } | 367 | } |
367 | void Calendar::deleteIncidence(Incidence *in) | 368 | void Calendar::deleteIncidence(Incidence *in) |
368 | { | 369 | { |
369 | if ( in->typeID() == eventID ) | 370 | if ( in->typeID() == eventID ) |
370 | deleteEvent( (Event*) in ); | 371 | deleteEvent( (Event*) in ); |
371 | else if ( in->typeID() == todoID ) | 372 | else if ( in->typeID() == todoID ) |
372 | deleteTodo( (Todo*) in); | 373 | deleteTodo( (Todo*) in); |
373 | else if ( in->typeID() == journalID ) | 374 | else if ( in->typeID() == journalID ) |
374 | deleteJournal( (Journal*) in ); | 375 | deleteJournal( (Journal*) in ); |
375 | } | 376 | } |
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 4652fe5..14a1a45 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -67,24 +67,25 @@ public: | |||
67 | virtual ~Calendar(); | 67 | virtual ~Calendar(); |
68 | Incidence * undoIncidence() { return mUndoIncidence; }; | 68 | Incidence * undoIncidence() { return mUndoIncidence; }; |
69 | bool undoDeleteIncidence(); | 69 | bool undoDeleteIncidence(); |
70 | void deleteIncidence(Incidence *in); | 70 | void deleteIncidence(Incidence *in); |
71 | void resetTempSyncStat(); | 71 | void resetTempSyncStat(); |
72 | void resetPilotStat(int id); | 72 | void resetPilotStat(int id); |
73 | /** | 73 | /** |
74 | Clears out the current calendar, freeing all used memory etc. | 74 | Clears out the current calendar, freeing all used memory etc. |
75 | */ | 75 | */ |
76 | virtual void close() = 0; | 76 | virtual void close() = 0; |
77 | virtual void addCalendar( Calendar* ) = 0; | 77 | virtual void addCalendar( Calendar* ) = 0; |
78 | virtual bool addCalendarFile( QString name, int id ) = 0; | 78 | virtual bool addCalendarFile( QString name, int id ) = 0; |
79 | virtual bool mergeCalendarFile( QString name ) = 0; | ||
79 | virtual void setSyncEventsReadOnly() = 0; | 80 | virtual void setSyncEventsReadOnly() = 0; |
80 | virtual void stopAllTodos() = 0; | 81 | virtual void stopAllTodos() = 0; |
81 | 82 | ||
82 | /** | 83 | /** |
83 | Sync changes in memory to persistant storage. | 84 | Sync changes in memory to persistant storage. |
84 | */ | 85 | */ |
85 | virtual void save() = 0; | 86 | virtual void save() = 0; |
86 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; | 87 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; |
87 | virtual void removeSyncInfo( QString syncProfile) = 0; | 88 | virtual void removeSyncInfo( QString syncProfile) = 0; |
88 | virtual bool isSaving() { return false; } | 89 | virtual bool isSaving() { return false; } |
89 | 90 | ||
90 | /** | 91 | /** |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index cce798f..3e42ec0 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -59,24 +59,99 @@ CalendarLocal::CalendarLocal(const QString &timeZoneId) | |||
59 | 59 | ||
60 | void CalendarLocal::init() | 60 | void CalendarLocal::init() |
61 | { | 61 | { |
62 | mNextAlarmIncidence = 0; | 62 | mNextAlarmIncidence = 0; |
63 | } | 63 | } |
64 | 64 | ||
65 | 65 | ||
66 | CalendarLocal::~CalendarLocal() | 66 | CalendarLocal::~CalendarLocal() |
67 | { | 67 | { |
68 | if ( mDeleteIncidencesOnClose ) | 68 | if ( mDeleteIncidencesOnClose ) |
69 | close(); | 69 | close(); |
70 | } | 70 | } |
71 | bool CalendarLocal::mergeCalendarFile( QString name ) | ||
72 | { | ||
73 | CalendarLocal calendar( timeZoneId() ); | ||
74 | calendar.setDefaultCalendar( 1 ); | ||
75 | if ( calendar.load( name ) ) { | ||
76 | mergeCalendar( &calendar ); | ||
77 | return true; | ||
78 | } | ||
79 | return false; | ||
80 | } | ||
81 | |||
82 | Incidence* CalendarLocal::incidenceForUid( const QString& uid ) | ||
83 | { | ||
84 | Todo *todo;; | ||
85 | Incidence *retVal = 0; | ||
86 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | ||
87 | if ( todo->uid() == uid ) { | ||
88 | if ( retVal ) { | ||
89 | if ( retVal->calID() > todo->calID() ) { | ||
90 | retVal = todo; | ||
91 | } | ||
92 | } else { | ||
93 | retVal = todo; | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | if ( retVal ) return retVal; | ||
98 | Event *event; | ||
99 | for ( event = mEventList.first(); event; event = mEventList.next() ) { | ||
100 | if ( event->uid() == uid ) { | ||
101 | if ( retVal ) { | ||
102 | if ( retVal->calID() > event->calID() ) { | ||
103 | retVal = event; | ||
104 | } | ||
105 | } else { | ||
106 | retVal = event; | ||
107 | } | ||
108 | } | ||
109 | } | ||
110 | if ( retVal ) return retVal; | ||
111 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | ||
112 | if ( it->uid() == uid ) { | ||
113 | if ( retVal ) { | ||
114 | if ( retVal->calID() > it->calID() ) { | ||
115 | retVal = it; | ||
116 | } | ||
117 | } else { | ||
118 | retVal = it; | ||
119 | } | ||
120 | } | ||
121 | return retVal; | ||
122 | } | ||
123 | |||
124 | bool CalendarLocal::mergeCalendar( Calendar* remote ) | ||
125 | { | ||
126 | QPtrList<Incidence> er = remote->rawIncidences(); | ||
127 | Incidence* inR = er.first(); | ||
128 | Incidence* inL; | ||
129 | while ( inR ) { | ||
130 | inL = incidenceForUid( inR->uid() ); | ||
131 | if ( inL ) { | ||
132 | int calID = inL->calID(); | ||
133 | deleteIncidence( inL ); | ||
134 | inL = inR->clone(); | ||
135 | inL->setCalID( calID ); | ||
136 | addIncidence( inL ); | ||
137 | } else { | ||
138 | inL = inR->clone(); | ||
139 | inL->setCalID( 0 );// add to default cal | ||
140 | addIncidence( inL ); | ||
141 | } | ||
142 | inR = er.next(); | ||
143 | } | ||
144 | return true; | ||
145 | } | ||
71 | bool CalendarLocal::addCalendarFile( QString name, int id ) | 146 | bool CalendarLocal::addCalendarFile( QString name, int id ) |
72 | { | 147 | { |
73 | CalendarLocal calendar( timeZoneId() ); | 148 | CalendarLocal calendar( timeZoneId() ); |
74 | calendar.setDefaultCalendar( id ); | 149 | calendar.setDefaultCalendar( id ); |
75 | if ( calendar.load( name ) ) { | 150 | if ( calendar.load( name ) ) { |
76 | addCalendar( &calendar ); | 151 | addCalendar( &calendar ); |
77 | return true; | 152 | return true; |
78 | } | 153 | } |
79 | return false; | 154 | return false; |
80 | } | 155 | } |
81 | void CalendarLocal::setSyncEventsReadOnly() | 156 | void CalendarLocal::setSyncEventsReadOnly() |
82 | { | 157 | { |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 98d16a3..23b0542 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -36,24 +36,27 @@ class CalendarLocal : public Calendar | |||
36 | public: | 36 | public: |
37 | /** | 37 | /** |
38 | Constructs a new calendar, with variables initialized to sane values. | 38 | Constructs a new calendar, with variables initialized to sane values. |
39 | */ | 39 | */ |
40 | CalendarLocal(); | 40 | CalendarLocal(); |
41 | /** | 41 | /** |
42 | Constructs a new calendar, with variables initialized to sane values. | 42 | Constructs a new calendar, with variables initialized to sane values. |
43 | */ | 43 | */ |
44 | CalendarLocal( const QString &timeZoneId ); | 44 | CalendarLocal( const QString &timeZoneId ); |
45 | ~CalendarLocal(); | 45 | ~CalendarLocal(); |
46 | void addCalendar( Calendar* ); | 46 | void addCalendar( Calendar* ); |
47 | bool addCalendarFile( QString name, int id ); | 47 | bool addCalendarFile( QString name, int id ); |
48 | bool mergeCalendarFile( QString name ); | ||
49 | bool mergeCalendar( Calendar* cal ); | ||
50 | Incidence* incidenceForUid( const QString& uid ); | ||
48 | void setSyncEventsReadOnly(); | 51 | void setSyncEventsReadOnly(); |
49 | void stopAllTodos(); | 52 | void stopAllTodos(); |
50 | /** | 53 | /** |
51 | Loads a calendar on disk in vCalendar or iCalendar format into the current | 54 | Loads a calendar on disk in vCalendar or iCalendar format into the current |
52 | calendar. Any information already present is lost. | 55 | calendar. Any information already present is lost. |
53 | @return true, if successfull, false on error. | 56 | @return true, if successfull, false on error. |
54 | @param fileName the name of the calendar on disk. | 57 | @param fileName the name of the calendar on disk. |
55 | */ | 58 | */ |
56 | bool load( const QString &fileName ); | 59 | bool load( const QString &fileName ); |
57 | /** | 60 | /** |
58 | Writes out the calendar to disk in the specified \a format. | 61 | Writes out the calendar to disk in the specified \a format. |
59 | CalendarLocal takes ownership of the CalFormat object. | 62 | CalendarLocal takes ownership of the CalFormat object. |