summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp16
-rw-r--r--korganizer/koagenda.cpp25
-rw-r--r--korganizer/koagendaitem.cpp18
-rw-r--r--korganizer/koagendaitem.h1
-rw-r--r--korganizer/koeventviewerdialog.cpp11
5 files changed, 68 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 1009956..d6918d3 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -459,48 +459,49 @@ void CalendarView::init()
459 mAlarmDialog = new AlarmDialog( this ); 459 mAlarmDialog = new AlarmDialog( this );
460 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 460 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
461 mAlarmDialog->setServerNotification( false ); 461 mAlarmDialog->setServerNotification( false );
462 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 462 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
463 463
464 464
465#ifndef DESKTOP_VERSION 465#ifndef DESKTOP_VERSION
466//US listen for arriving address resultsets 466//US listen for arriving address resultsets
467 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 467 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
468 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 468 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
469#endif 469#endif
470 470
471} 471}
472 472
473 473
474CalendarView::~CalendarView() 474CalendarView::~CalendarView()
475{ 475{
476 // kdDebug() << "~CalendarView()" << endl; 476 // kdDebug() << "~CalendarView()" << endl;
477 //qDebug("CalendarView::~CalendarView() "); 477 //qDebug("CalendarView::~CalendarView() ");
478 delete mDialogManager; 478 delete mDialogManager;
479 delete mViewManager; 479 delete mViewManager;
480 delete mStorage; 480 delete mStorage;
481 delete mDateFrame ; 481 delete mDateFrame ;
482 delete beamDialog; 482 delete beamDialog;
483 delete mEventViewerDialog;
483 //kdDebug() << "~CalendarView() done" << endl; 484 //kdDebug() << "~CalendarView() done" << endl;
484} 485}
485 486
486void CalendarView::showDay( QDate d ) 487void CalendarView::showDay( QDate d )
487{ 488{
488 dateNavigator()->blockSignals( true ); 489 dateNavigator()->blockSignals( true );
489 dateNavigator()->selectDate( d ); 490 dateNavigator()->selectDate( d );
490 dateNavigator()->blockSignals( false ); 491 dateNavigator()->blockSignals( false );
491 mViewManager->showDayView(); 492 mViewManager->showDayView();
492 //dateNavigator()->selectDate( d ); 493 //dateNavigator()->selectDate( d );
493} 494}
494void CalendarView::timerAlarm() 495void CalendarView::timerAlarm()
495{ 496{
496 //qDebug("CalendarView::timerAlarm() "); 497 //qDebug("CalendarView::timerAlarm() ");
497 computeAlarm(mAlarmNotification ); 498 computeAlarm(mAlarmNotification );
498} 499}
499 500
500void CalendarView::suspendAlarm() 501void CalendarView::suspendAlarm()
501{ 502{
502 //qDebug(" CalendarView::suspendAlarm() "); 503 //qDebug(" CalendarView::suspendAlarm() ");
503 computeAlarm(mSuspendAlarmNotification ); 504 computeAlarm(mSuspendAlarmNotification );
504 505
505} 506}
506 507
@@ -2506,65 +2507,77 @@ void CalendarView::showDatePickerPopup()
2506 int dw = topLevelWidget()->width(); 2507 int dw = topLevelWidget()->width();
2507 int dh = topLevelWidget()->height(); 2508 int dh = topLevelWidget()->height();
2508 offX = topLevelWidget()->x(); 2509 offX = topLevelWidget()->x();
2509 offY = topLevelWidget()->y(); 2510 offY = topLevelWidget()->y();
2510#else 2511#else
2511 int w =mDatePicker->sizeHint().width() ; 2512 int w =mDatePicker->sizeHint().width() ;
2512 int h = mDatePicker->sizeHint().height() ; 2513 int h = mDatePicker->sizeHint().height() ;
2513 int dw = QApplication::desktop()->width(); 2514 int dw = QApplication::desktop()->width();
2514 int dh = QApplication::desktop()->height(); 2515 int dh = QApplication::desktop()->height();
2515#endif 2516#endif
2516 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); 2517 mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h );
2517 mDateFrame->show(); 2518 mDateFrame->show();
2518 } 2519 }
2519} 2520}
2520void CalendarView::showDatePicker( ) 2521void CalendarView::showDatePicker( )
2521{ 2522{
2522 showDatePickerPopup(); 2523 showDatePickerPopup();
2523 mDatePickerMode = 1; 2524 mDatePickerMode = 1;
2524 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2525 mDatePicker->setDate( mNavigator->selectedDates().first() );
2525} 2526}
2526 2527
2527void CalendarView::showEventEditor() 2528void CalendarView::showEventEditor()
2528{ 2529{
2529#ifdef DESKTOP_VERSION 2530#ifdef DESKTOP_VERSION
2531 int x,y,w,h;
2532 x = mEventEditor->geometry().x();
2533 y = mEventEditor->geometry().y();
2534 w = mEventEditor->width();
2535 h = mEventEditor->height();
2530 mEventEditor->show(); 2536 mEventEditor->show();
2537 mEventEditor->setGeometry(x,y,w,h);
2531#else 2538#else
2532 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { 2539 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2533 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2540 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2534 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); 2541 qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2535 qApp->processEvents(); 2542 qApp->processEvents();
2536 delete mEventEditor; 2543 delete mEventEditor;
2537 mEventEditor = mDialogManager->getEventEditor(); 2544 mEventEditor = mDialogManager->getEventEditor();
2538 topLevelWidget()->setCaption( i18n("") ); 2545 topLevelWidget()->setCaption( i18n("") );
2539 } 2546 }
2540 mEventEditor->showMaximized(); 2547 mEventEditor->showMaximized();
2541#endif 2548#endif
2542} 2549}
2543void CalendarView::showTodoEditor() 2550void CalendarView::showTodoEditor()
2544{ 2551{
2545#ifdef DESKTOP_VERSION 2552#ifdef DESKTOP_VERSION
2553 int x,y,w,h;
2554 x = mTodoEditor->geometry().x();
2555 y = mTodoEditor->geometry().y();
2556 w = mTodoEditor->width();
2557 h = mTodoEditor->height();
2546 mTodoEditor->show(); 2558 mTodoEditor->show();
2559 mTodoEditor->setGeometry(x,y,w,h);
2547#else 2560#else
2548 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { 2561 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
2549 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); 2562 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2550 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); 2563 qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
2551 qApp->processEvents(); 2564 qApp->processEvents();
2552 delete mTodoEditor; 2565 delete mTodoEditor;
2553 mTodoEditor = mDialogManager->getTodoEditor(); 2566 mTodoEditor = mDialogManager->getTodoEditor();
2554 topLevelWidget()->setCaption( i18n("") ); 2567 topLevelWidget()->setCaption( i18n("") );
2555 } 2568 }
2556 mTodoEditor->showMaximized(); 2569 mTodoEditor->showMaximized();
2557#endif 2570#endif
2558} 2571}
2559 2572
2560void CalendarView::cloneIncidence() 2573void CalendarView::cloneIncidence()
2561{ 2574{
2562 Incidence *incidence = currentSelection(); 2575 Incidence *incidence = currentSelection();
2563 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2576 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2564 if ( incidence ) { 2577 if ( incidence ) {
2565 cloneIncidence(incidence); 2578 cloneIncidence(incidence);
2566 } 2579 }
2567} 2580}
2568void CalendarView::moveIncidence() 2581void CalendarView::moveIncidence()
2569{ 2582{
2570 Incidence *incidence = currentSelection(); 2583 Incidence *incidence = currentSelection();
@@ -2772,49 +2785,49 @@ void CalendarView::editJournal( Journal *jour )
2772{ 2785{
2773 if ( !jour ) return; 2786 if ( !jour ) return;
2774 mDialogManager->hideSearchDialog(); 2787 mDialogManager->hideSearchDialog();
2775 mViewManager->showJournalView(); 2788 mViewManager->showJournalView();
2776 mNavigator->slotDaySelect( jour->dtStart().date() ); 2789 mNavigator->slotDaySelect( jour->dtStart().date() );
2777} 2790}
2778void CalendarView::editTodo( Todo *todo ) 2791void CalendarView::editTodo( Todo *todo )
2779{ 2792{
2780 if ( !todo ) return; 2793 if ( !todo ) return;
2781 2794
2782 if ( todo->isReadOnly() ) { 2795 if ( todo->isReadOnly() ) {
2783 showTodo( todo ); 2796 showTodo( todo );
2784 return; 2797 return;
2785 } 2798 }
2786 showTodoEditor(); 2799 showTodoEditor();
2787 mTodoEditor->editTodo( todo ,mFlagEditDescription); 2800 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2788 mTodoEditor->exec(); 2801 mTodoEditor->exec();
2789 setActiveWindow(); 2802 setActiveWindow();
2790 2803
2791} 2804}
2792 2805
2793KOEventViewerDialog* CalendarView::getEventViewerDialog() 2806KOEventViewerDialog* CalendarView::getEventViewerDialog()
2794{ 2807{
2795 if ( !mEventViewerDialog ) { 2808 if ( !mEventViewerDialog ) {
2796 mEventViewerDialog = new KOEventViewerDialog(this); 2809 mEventViewerDialog = new KOEventViewerDialog(0);
2797 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2810 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
2798 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); 2811 connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
2799 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), 2812 connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
2800 dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 2813 dateNavigator(), SLOT( selectWeek( const QDate & ) ) );
2801 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), 2814 connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ),
2802 viewManager(), SLOT( showAgendaView( bool ) ) ); 2815 viewManager(), SLOT( showAgendaView( bool ) ) );
2803 connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), 2816 connect( mEventViewerDialog, SIGNAL(signalViewerClosed()),
2804 this, SLOT( slotViewerClosed() ) ); 2817 this, SLOT( slotViewerClosed() ) );
2805 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), 2818 connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ),
2806 this, SLOT( todoChanged(Todo *) ) ); 2819 this, SLOT( todoChanged(Todo *) ) );
2807 mEventViewerDialog->resize( 640, 480 ); 2820 mEventViewerDialog->resize( 640, 480 );
2808 2821
2809 } 2822 }
2810 return mEventViewerDialog; 2823 return mEventViewerDialog;
2811} 2824}
2812void CalendarView::showEvent(Event *event) 2825void CalendarView::showEvent(Event *event)
2813{ 2826{
2814 getEventViewerDialog()->setEvent(event); 2827 getEventViewerDialog()->setEvent(event);
2815 getEventViewerDialog()->showMe(); 2828 getEventViewerDialog()->showMe();
2816} 2829}
2817 2830
2818void CalendarView::showTodo(Todo *event) 2831void CalendarView::showTodo(Todo *event)
2819{ 2832{
2820 getEventViewerDialog()->setTodo(event); 2833 getEventViewerDialog()->setTodo(event);
@@ -3946,29 +3959,30 @@ void CalendarView::undo_delete()
3946 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 3959 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
3947 mCalendar->undoDeleteIncidence(); 3960 mCalendar->undoDeleteIncidence();
3948 updateView(); 3961 updateView();
3949 } 3962 }
3950} 3963}
3951 3964
3952void CalendarView::slotViewerClosed() 3965void CalendarView::slotViewerClosed()
3953{ 3966{
3954 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 3967 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
3955} 3968}
3956 3969
3957void CalendarView::resetFocus() 3970void CalendarView::resetFocus()
3958{ 3971{
3959 if ( mViewerCallerIsSearchDialog ) { 3972 if ( mViewerCallerIsSearchDialog ) {
3960 if ( mDialogManager->getSearchDialog()->isVisible() ){ 3973 if ( mDialogManager->getSearchDialog()->isVisible() ){
3961 mDialogManager->getSearchDialog()->raise(); 3974 mDialogManager->getSearchDialog()->raise();
3962 mDialogManager->getSearchDialog()->setActiveWindow(); 3975 mDialogManager->getSearchDialog()->setActiveWindow();
3963 mDialogManager->getSearchDialog()->listview()->resetFocus(); 3976 mDialogManager->getSearchDialog()->listview()->resetFocus();
3964 } else 3977 } else
3965 mViewerCallerIsSearchDialog = false; 3978 mViewerCallerIsSearchDialog = false;
3966 } 3979 }
3967 if ( !mViewerCallerIsSearchDialog ) { 3980 if ( !mViewerCallerIsSearchDialog ) {
3968 //mViewManager->currentView()->setFocus(); 3981 //mViewManager->currentView()->setFocus();
3969 //qDebug("sssssssssssssssset focus "); 3982 //qDebug("sssssssssssssssset focus ");
3983 topLevelWidget()->raise();
3970 setActiveWindow(); 3984 setActiveWindow();
3971 //setFocus(); 3985 //setFocus();
3972 } 3986 }
3973 mViewerCallerIsSearchDialog = false; 3987 mViewerCallerIsSearchDialog = false;
3974} 3988}
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 195b1fa..ec81d44 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1160,49 +1160,72 @@ void KOAgenda::drawContents(QPainter* p, int cx, int cy, int cw, int ch)
1160 (mColumns - 1 - mSelectionCellX) * mGridSpacingX : 1160 (mColumns - 1 - mSelectionCellX) * mGridSpacingX :
1161 mSelectionCellX * mGridSpacingX; 1161 mSelectionCellX * mGridSpacingX;
1162 contentsToViewport ( cx, cy, vx,vy); 1162 contentsToViewport ( cx, cy, vx,vy);
1163 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ; 1163 // qDebug(" %d %d %d %d ", cx, cy, cw,ch) ;
1164 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) ) 1164 if ( !(selectionX == cx && cy == mSelectionYTop && cw ==mGridSpacingX && ch == mSelectionHeight ) )
1165 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP); 1165 bitBlt ( pd, vx, vy, &mPaintPixmap, cx, cy, cw, ch ,CopyROP);
1166 1166
1167 if ( mSelectionHeight > 0 ) { 1167 if ( mSelectionHeight > 0 ) {
1168 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight ); 1168 //qDebug("---- %d %d %d %d ", selectionX, mSelectionYTop, mGridSpacingX, mSelectionHeight );
1169 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) && 1169 if ( ( cx + cw ) >= selectionX && cx <= ( selectionX + mGridSpacingX ) &&
1170 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) { 1170 ( cy + ch ) >= mSelectionYTop && cy <= ( mSelectionYTop + mSelectionHeight ) ) {
1171 contentsToViewport ( selectionX, mSelectionYTop, vx,vy); 1171 contentsToViewport ( selectionX, mSelectionYTop, vx,vy);
1172 bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP); 1172 bitBlt ( pd, vx+1, vy, &mHighlightPixmap, 0, mSelectionYTop, mGridSpacingX-1, mSelectionHeight ,CopyROP);
1173 } 1173 }
1174 } 1174 }
1175 //qDebug("btbl "); 1175 //qDebug("btbl ");
1176 p->begin( pd ); 1176 p->begin( pd );
1177 //qDebug("end "); 1177 //qDebug("end ");
1178} 1178}
1179 1179
1180void KOAgenda::finishUpdate() 1180void KOAgenda::finishUpdate()
1181{ 1181{
1182 1182
1183 KOAgendaItem *item; 1183 KOAgendaItem *item;
1184 globalFlagBlockAgendaItemPaint = 1; 1184 globalFlagBlockAgendaItemPaint = 1;
1185 // Adjust sub cell geometry of all conflict items of all conflict items of all conflict items ... of the conflict item with the max number of conflictitems
1186 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1187 if ( !item->checkLayout() ) {
1188 //qDebug(" conflictitem found ");
1189 int newSubCellWidth;
1190 if (mAllDayMode) newSubCellWidth = mGridSpacingY / item->subCells();
1191 else newSubCellWidth = mGridSpacingX / item->subCells();
1192
1193 if (mAllDayMode) {
1194 item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth);
1195 } else {
1196 item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY);
1197 }
1198 int x,y;
1199 gridToContents(item->cellX(),item->cellYTop(),x,y);
1200 if (mAllDayMode) {
1201 y += item->subCell() * newSubCellWidth;
1202 } else {
1203 x += item->subCell() * newSubCellWidth;
1204 }
1205 moveChild(item,x,y);
1206 }
1207 }
1185 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1208 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1186 if ( !item->isVisible() ) 1209 if ( !item->isVisible() )
1187 item->show(); 1210 item->show();
1188 1211
1189 } 1212 }
1190 globalFlagBlockAgendaItemUpdate = 0; 1213 globalFlagBlockAgendaItemUpdate = 0;
1191 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1214 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1192 item->repaintMe( ); 1215 item->repaintMe( );
1193 } 1216 }
1194 globalFlagBlockAgendaItemUpdate = 1; 1217 globalFlagBlockAgendaItemUpdate = 1;
1195 qApp->processEvents(); 1218 qApp->processEvents();
1196 globalFlagBlockAgendaItemPaint = 0; 1219 globalFlagBlockAgendaItemPaint = 0;
1197 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1220 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1198 item->repaint( false ); 1221 item->repaint( false );
1199 } 1222 }
1200 1223
1201} 1224}
1202 1225
1203/* 1226/*
1204 Draw grid in the background of the agenda. 1227 Draw grid in the background of the agenda.
1205*/ 1228*/
1206void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch) 1229void KOAgenda::drawContentsToPainter( QPainter* paint, bool backgroundOnly )// int cx, int cy, int cw, int ch)
1207{ 1230{
1208 1231
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 38bd93a..042a789 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -743,24 +743,42 @@ void KOAgendaItem::dropEvent( QDropEvent *e )
743#endif 743#endif
744} 744}
745 745
746 746
747QPtrList<KOAgendaItem> KOAgendaItem::conflictItems() 747QPtrList<KOAgendaItem> KOAgendaItem::conflictItems()
748{ 748{
749 return mConflictItems; 749 return mConflictItems;
750} 750}
751 751
752void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci) 752void KOAgendaItem::setConflictItems(QPtrList<KOAgendaItem> ci)
753{ 753{
754 mConflictItems = ci; 754 mConflictItems = ci;
755 KOAgendaItem *item; 755 KOAgendaItem *item;
756 for ( item=mConflictItems.first(); item != 0; 756 for ( item=mConflictItems.first(); item != 0;
757 item=mConflictItems.next() ) { 757 item=mConflictItems.next() ) {
758 item->addConflictItem(this); 758 item->addConflictItem(this);
759 } 759 }
760} 760}
761 761
762void KOAgendaItem::addConflictItem(KOAgendaItem *ci) 762void KOAgendaItem::addConflictItem(KOAgendaItem *ci)
763{ 763{
764 if (mConflictItems.find(ci)<0) 764 if (mConflictItems.find(ci)<0)
765 mConflictItems.append(ci); 765 mConflictItems.append(ci);
766} 766}
767
768bool KOAgendaItem::checkLayout()
769{
770 if ( !mConflictItems.count() )
771 return true;
772 int max = 0;
773 KOAgendaItem *item;
774 for ( item=mConflictItems.first(); item != 0;
775 item=mConflictItems.next() ) {
776 if ( item->subCells() > max )
777 max = item->subCells();
778 }
779 if ( max > subCells() ) {
780 setSubCells( max );
781 return false;
782 }
783 return true;
784}
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
index 5b8f420..b4dba79 100644
--- a/korganizer/koagendaitem.h
+++ b/korganizer/koagendaitem.h
@@ -86,48 +86,49 @@ class KOAgendaItem : public QWidget
86 QDate itemDate() { return mDate; } 86 QDate itemDate() { return mDate; }
87 87
88 /** Update the date of this item's occurence (not in the event) */ 88 /** Update the date of this item's occurence (not in the event) */
89 void setItemDate(QDate qd); 89 void setItemDate(QDate qd);
90 90
91 void setText ( const QString & text ) { mDisplayedText = text; } 91 void setText ( const QString & text ) { mDisplayedText = text; }
92 QString text () { return mDisplayedText; } 92 QString text () { return mDisplayedText; }
93 93
94 virtual bool eventFilter ( QObject *, QEvent * ); 94 virtual bool eventFilter ( QObject *, QEvent * );
95 95
96 static QToolTipGroup *toolTipGroup(); 96 static QToolTipGroup *toolTipGroup();
97 97
98 QPtrList<KOAgendaItem> conflictItems(); 98 QPtrList<KOAgendaItem> conflictItems();
99 void setConflictItems(QPtrList<KOAgendaItem>); 99 void setConflictItems(QPtrList<KOAgendaItem>);
100 void addConflictItem(KOAgendaItem *ci); 100 void addConflictItem(KOAgendaItem *ci);
101 void paintMe( bool, QPainter* painter = 0 ); 101 void paintMe( bool, QPainter* painter = 0 );
102 void repaintMe(); 102 void repaintMe();
103 static void resizePixmap( int, int ); 103 static void resizePixmap( int, int );
104 static QPixmap * paintPix(); 104 static QPixmap * paintPix();
105 static QPixmap * paintPixSel(); 105 static QPixmap * paintPixSel();
106 static QPixmap * paintPixAllday(); 106 static QPixmap * paintPixAllday();
107 void updateItem(); 107 void updateItem();
108 void computeText(); 108 void computeText();
109 void recreateIncidence(); 109 void recreateIncidence();
110 bool checkLayout();
110 public slots: 111 public slots:
111 bool updateIcons( QPainter *, bool ); 112 bool updateIcons( QPainter *, bool );
112 void select(bool=true); 113 void select(bool=true);
113 114
114 protected: 115 protected:
115 void dragEnterEvent(QDragEnterEvent *e); 116 void dragEnterEvent(QDragEnterEvent *e);
116 void dropEvent(QDropEvent *e); 117 void dropEvent(QDropEvent *e);
117 void paintEvent ( QPaintEvent * ); 118 void paintEvent ( QPaintEvent * );
118 void resizeEvent ( QResizeEvent *ev ); 119 void resizeEvent ( QResizeEvent *ev );
119 120
120 private: 121 private:
121 bool mAllDay; 122 bool mAllDay;
122 int mCellX; 123 int mCellX;
123 int mCellXWidth; 124 int mCellXWidth;
124 int mCellYTop,mCellYBottom; 125 int mCellYTop,mCellYBottom;
125 int mSubCell; // subcell number of this item 126 int mSubCell; // subcell number of this item
126 int mSubCells; // Total number of subcells in cell of this item 127 int mSubCells; // Total number of subcells in cell of this item
127 int xPaintCoord; 128 int xPaintCoord;
128 int yPaintCoord; 129 int yPaintCoord;
129 int wPaintCoord; 130 int wPaintCoord;
130 int hPaintCoord; 131 int hPaintCoord;
131 // Variables to remember start position 132 // Variables to remember start position
132 int mStartCellX; 133 int mStartCellX;
133 int mStartCellXWidth; 134 int mStartCellXWidth;
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index 8bada3b..e2c8e6e 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -53,52 +53,59 @@ KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name)
53 mIncidence = 0; 53 mIncidence = 0;
54 // TODO: Set a sensible size (based on the content?). 54 // TODO: Set a sensible size (based on the content?).
55 //showMaximized(); 55 //showMaximized();
56 //qDebug("++++++++++++KOEventViewerDialog() "); 56 //qDebug("++++++++++++KOEventViewerDialog() ");
57 // if ( KOPrefs::instance()->mCompactDialogs ) { 57 // if ( KOPrefs::instance()->mCompactDialogs ) {
58// setFixedSize( 240,284 ); 58// setFixedSize( 240,284 );
59// move( 0, 15 ); 59// move( 0, 15 );
60// } else { 60// } else {
61// setMinimumSize(300,200); 61// setMinimumSize(300,200);
62// resize(320,300); 62// resize(320,300);
63// } 63// }
64 mSyncMode = false; 64 mSyncMode = false;
65 mSyncResult = 0; 65 mSyncResult = 0;
66 66
67} 67}
68 68
69KOEventViewerDialog::~KOEventViewerDialog() 69KOEventViewerDialog::~KOEventViewerDialog()
70{ 70{
71 //qDebug("-------~KOEventViewerDialog() "); 71 //qDebug("-------~KOEventViewerDialog() ");
72} 72}
73void KOEventViewerDialog::showMe() 73void KOEventViewerDialog::showMe()
74{ 74{
75 75
76#ifdef DESKTOP_VERSION 76#ifdef DESKTOP_VERSION
77 int x,y,w,h;
78 x = geometry().x();
79 y = geometry().y();
80 w = width();
81 h = height();
77 show(); 82 show();
83 setGeometry(x,y,w,h);
78#else 84#else
79 showMaximized(); 85 showMaximized();
80#endif 86#endif
87 raise();
81 setActiveWindow(); 88 setActiveWindow();
82 mEventViewer->setFocus(); 89 mEventViewer->setFocus();
83 90
84} 91}
85void KOEventViewerDialog::setSyncMode( bool b ) 92void KOEventViewerDialog::setSyncMode( bool b )
86{ 93{
87 mSyncMode = b; 94 mSyncMode = b;
88 //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); 95 //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode );
89 if ( mSyncMode ) { 96 if ( mSyncMode ) {
90 findButton( Close )->setText( i18n("Cancel Sync")); 97 findButton( Close )->setText( i18n("Cancel Sync"));
91 findButton( Ok )->setText( i18n("Remote")); 98 findButton( Ok )->setText( i18n("Remote"));
92 findButton( User1 )->setText( i18n("Local")); 99 findButton( User1 )->setText( i18n("Local"));
93 } else { 100 } else {
94 findButton( Close )->setText( i18n("Close")); 101 findButton( Close )->setText( i18n("Close"));
95 findButton( Ok )->setText( i18n("Edit")); 102 findButton( Ok )->setText( i18n("Edit"));
96 findButton( User1 )->setText( i18n("Agenda")); 103 findButton( User1 )->setText( i18n("Agenda"));
97 } 104 }
98 mEventViewer->setSyncMode( b ); 105 mEventViewer->setSyncMode( b );
99} 106}
100void KOEventViewerDialog::setColorMode( int m ) 107void KOEventViewerDialog::setColorMode( int m )
101{ 108{
102 mEventViewer->setColorMode( m ); 109 mEventViewer->setColorMode( m );
103} 110}
104int KOEventViewerDialog::executeS( bool local ) 111int KOEventViewerDialog::executeS( bool local )
@@ -237,47 +244,49 @@ void KOEventViewerDialog::showIncidence()
237 date = mIncidence->dtStart().date(); 244 date = mIncidence->dtStart().date();
238 globalFlagBlockAgenda = 1; 245 globalFlagBlockAgenda = 1;
239 emit showAgendaView( false ); 246 emit showAgendaView( false );
240 globalFlagBlockAgenda = 2; 247 globalFlagBlockAgenda = 2;
241 emit jumpToTime( date ); 248 emit jumpToTime( date );
242 } 249 }
243} 250}
244void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) 251void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e )
245{ 252{
246 switch ( e->key() ) { 253 switch ( e->key() ) {
247 254
248 case Qt::Key_A : 255 case Qt::Key_A :
249 case Qt::Key_L : 256 case Qt::Key_L :
250 showIncidence(); 257 showIncidence();
251 break; 258 break;
252 case Qt::Key_E : 259 case Qt::Key_E :
253 case Qt::Key_R : 260 case Qt::Key_R :
254 editIncidence(); 261 editIncidence();
255 break; 262 break;
256 case Qt::Key_C: 263 case Qt::Key_C:
257 case Qt::Key_Escape: 264 case Qt::Key_Escape:
258 close(); 265 close();
259 break; 266 break;
260 case Qt::Key_I: 267 case Qt::Key_I:
261 accept(); 268 sendSignalViewerClosed = true;
269 slotViewerClosed();
270 //accept();
262 break; 271 break;
263 default: 272 default:
264 KDialogBase::keyPressEvent ( e ); 273 KDialogBase::keyPressEvent ( e );
265 break; 274 break;
266 } 275 }
267 276
268} 277}
269void KOEventViewerDialog::hideEvent ( QHideEvent * e ) 278void KOEventViewerDialog::hideEvent ( QHideEvent * e )
270{ 279{
271 KDialogBase::hideEvent ( e ); 280 KDialogBase::hideEvent ( e );
272 QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); 281 QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) );
273} 282}
274 283
275void KOEventViewerDialog::slotViewerClosed() 284void KOEventViewerDialog::slotViewerClosed()
276{ 285{
277 if ( sendSignalViewerClosed ) { 286 if ( sendSignalViewerClosed ) {
278 //qDebug("KOEventViewerDialog::hideEvent "); 287 //qDebug("KOEventViewerDialog::hideEvent ");
279 emit signalViewerClosed(); 288 emit signalViewerClosed();
280 } 289 }
281 sendSignalViewerClosed = true; 290 sendSignalViewerClosed = true;
282} 291}
283 292