-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 | |||
@@ -1452,6 +1452,8 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
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 ) |
@@ -1464,6 +1466,8 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
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 ); |
@@ -1494,4 +1498,6 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
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; |
@@ -1503,4 +1509,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
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; |
@@ -1560,4 +1567,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
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 | } |
@@ -1574,4 +1582,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
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 | } |
@@ -2144,4 +2153,13 @@ bool CalendarView::openCalendar(QString filename, bool merge) | |||
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 | { |
@@ -3359,4 +3377,5 @@ void CalendarView::newEvent() | |||
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() ) { |
@@ -3365,4 +3384,5 @@ void CalendarView::newEvent() | |||
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 + |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 706d05d..799c297 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -139,4 +139,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
139 | Incidence *currentSelection(); | 139 | Incidence *currentSelection(); |
140 | void checkSuspendAlarm(); | 140 | void checkSuspendAlarm(); |
141 | void mergeFile( QString fn ); | ||
141 | 142 | ||
142 | signals: | 143 | signals: |
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index b8a4cf2..f0e0f86 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -77,5 +77,6 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
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); |
@@ -113,4 +114,9 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
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); |
@@ -129,4 +135,18 @@ JournalEntry::~JournalEntry() | |||
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 | { |
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h index ed04b7c..a69846c 100644 --- a/korganizer/journalentry.h +++ b/korganizer/journalentry.h | |||
@@ -56,4 +56,5 @@ class JournalEntry : public QFrame { | |||
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(); |
@@ -72,4 +73,6 @@ class JournalEntry : public QFrame { | |||
72 | 73 | ||
73 | private: | 74 | private: |
75 | int mMaxWidDiff; | ||
76 | int mDeskWid; | ||
74 | bool visibleMode; | 77 | bool visibleMode; |
75 | bool showOnlyMode; | 78 | bool showOnlyMode; |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 5249300..4bedb61 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -2545,5 +2545,5 @@ void MainWindow::getFile( bool success ) | |||
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 ); |
diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index a662eeb..b7990d4 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp | |||
@@ -361,5 +361,6 @@ 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); |
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 4652fe5..14a1a45 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -77,4 +77,5 @@ public: | |||
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; |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index cce798f..3e42ec0 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -69,4 +69,79 @@ CalendarLocal::~CalendarLocal() | |||
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 | { |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 98d16a3..23b0542 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -46,4 +46,7 @@ class CalendarLocal : public Calendar | |||
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(); |