summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 15c5dd9..a46cd87 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2468,31 +2468,33 @@ void CalendarView::showDatePicker( )
2468 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2468 mDatePicker->setDate( mNavigator->selectedDates().first() );
2469} 2469}
2470 2470
2471void CalendarView::showEventEditor() 2471void CalendarView::showEventEditor()
2472{ 2472{
2473#ifdef DESKTOP_VERSION 2473#ifdef DESKTOP_VERSION
2474 mEventEditor->show(); 2474 mEventEditor->show();
2475#else 2475#else
2476 if ( mEventEditor->width() != QApplication::desktop()->width() ) { 2476 if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) {
2477 qDebug("CalendarView: recreate mEventEditor "); 2477 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2478 qDebug("CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() );
2478 delete mEventEditor; 2479 delete mEventEditor;
2479 mEventEditor = mDialogManager->getEventEditor(); 2480 mEventEditor = mDialogManager->getEventEditor();
2480 } 2481 }
2481 mEventEditor->showMaximized(); 2482 mEventEditor->showMaximized();
2482#endif 2483#endif
2483} 2484}
2484void CalendarView::showTodoEditor() 2485void CalendarView::showTodoEditor()
2485{ 2486{
2486#ifdef DESKTOP_VERSION 2487#ifdef DESKTOP_VERSION
2487 mTodoEditor->show(); 2488 mTodoEditor->show();
2488#else 2489#else
2489 if ( mTodoEditor->width() != QApplication::desktop()->width() ) { 2490 if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) {
2490 qDebug("CalendarView: recreate mTodoEditor "); 2491 topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") );
2492 qDebug("CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() );
2491 delete mTodoEditor; 2493 delete mTodoEditor;
2492 mTodoEditor = mDialogManager->getTodoEditor(); 2494 mTodoEditor = mDialogManager->getTodoEditor();
2493 } 2495 }
2494 mTodoEditor->showMaximized(); 2496 mTodoEditor->showMaximized();
2495#endif 2497#endif
2496} 2498}
2497 2499
2498void CalendarView::cloneIncidence() 2500void CalendarView::cloneIncidence()
@@ -2537,29 +2539,29 @@ void CalendarView::cancelIncidence(Incidence * inc )
2537} 2539}
2538void CalendarView::cloneIncidence(Incidence * orgInc ) 2540void CalendarView::cloneIncidence(Incidence * orgInc )
2539{ 2541{
2540 Incidence * newInc = orgInc->clone(); 2542 Incidence * newInc = orgInc->clone();
2541 newInc->recreate(); 2543 newInc->recreate();
2542 2544
2543 if ( newInc->type() == "Todo" ) { 2545 if ( newInc->type() == "Todo" ) {
2544 Todo* t = (Todo*) newInc; 2546 Todo* t = (Todo*) newInc;
2545 mTodoEditor->editTodo( t );
2546 showTodoEditor(); 2547 showTodoEditor();
2548 mTodoEditor->editTodo( t );
2547 if ( mTodoEditor->exec() ) { 2549 if ( mTodoEditor->exec() ) {
2548 mCalendar->addTodo( t ); 2550 mCalendar->addTodo( t );
2549 updateView(); 2551 updateView();
2550 } else { 2552 } else {
2551 delete t; 2553 delete t;
2552 } 2554 }
2553 } 2555 }
2554 else { 2556 else {
2555 Event* e = (Event*) newInc; 2557 Event* e = (Event*) newInc;
2556 mEventEditor->editEvent( e );
2557 showEventEditor(); 2558 showEventEditor();
2559 mEventEditor->editEvent( e );
2558 if ( mEventEditor->exec() ) { 2560 if ( mEventEditor->exec() ) {
2559 mCalendar->addEvent( e ); 2561 mCalendar->addEvent( e );
2560 updateView(); 2562 updateView();
2561 } else { 2563 } else {
2562 delete e; 2564 delete e;
2563 } 2565 }
2564 } 2566 }
2565} 2567}
@@ -2601,26 +2603,26 @@ void CalendarView::newEvent(QDate dt)
2601{ 2603{
2602 newEvent(QDateTime(dt, QTime(0,0,0)), 2604 newEvent(QDateTime(dt, QTime(0,0,0)),
2603 QDateTime(dt, QTime(0,0,0)), true); 2605 QDateTime(dt, QTime(0,0,0)), true);
2604} 2606}
2605 2607
2606void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) 2608void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
2607{ 2609{
2608 2610
2611 showEventEditor();
2609 mEventEditor->newEvent(fromHint,toHint,allDay); 2612 mEventEditor->newEvent(fromHint,toHint,allDay);
2610 if ( mFilterView->filtersEnabled() ) { 2613 if ( mFilterView->filtersEnabled() ) {
2611 CalFilter *filter = mFilterView->selectedFilter(); 2614 CalFilter *filter = mFilterView->selectedFilter();
2612 if (filter && filter->showCategories()) { 2615 if (filter && filter->showCategories()) {
2613 mEventEditor->setCategories(filter->categoryList().join(",") ); 2616 mEventEditor->setCategories(filter->categoryList().join(",") );
2614 } 2617 }
2615 if ( filter ) 2618 if ( filter )
2616 mEventEditor->setSecrecy( filter->getSecrecy() ); 2619 mEventEditor->setSecrecy( filter->getSecrecy() );
2617 } 2620 }
2618 showEventEditor();
2619} 2621}
2620void CalendarView::todoAdded(Todo * t) 2622void CalendarView::todoAdded(Todo * t)
2621{ 2623{
2622 2624
2623 changeTodoDisplay ( t ,KOGlobals::EVENTADDED); 2625 changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
2624 updateTodoViews(); 2626 updateTodoViews();
2625} 2627}
2626void CalendarView::todoChanged(Todo * t) 2628void CalendarView::todoChanged(Todo * t)
@@ -2639,39 +2641,39 @@ void CalendarView::todoDeleted()
2639 updateTodoViews(); 2641 updateTodoViews();
2640} 2642}
2641 2643
2642 2644
2643 2645
2644void CalendarView::newTodo() 2646void CalendarView::newTodo()
2645{ 2647{
2646 2648
2649 showTodoEditor();
2647 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); 2650 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true);
2648 if ( mFilterView->filtersEnabled() ) { 2651 if ( mFilterView->filtersEnabled() ) {
2649 CalFilter *filter = mFilterView->selectedFilter(); 2652 CalFilter *filter = mFilterView->selectedFilter();
2650 if (filter && filter->showCategories()) { 2653 if (filter && filter->showCategories()) {
2651 mTodoEditor->setCategories(filter->categoryList().join(",") ); 2654 mTodoEditor->setCategories(filter->categoryList().join(",") );
2652 } 2655 }
2653 if ( filter ) 2656 if ( filter )
2654 mTodoEditor->setSecrecy( filter->getSecrecy() ); 2657 mTodoEditor->setSecrecy( filter->getSecrecy() );
2655 } 2658 }
2656 showTodoEditor();
2657} 2659}
2658 2660
2659void CalendarView::newSubTodo() 2661void CalendarView::newSubTodo()
2660{ 2662{
2661 Todo *todo = selectedTodo(); 2663 Todo *todo = selectedTodo();
2662 if ( todo ) newSubTodo( todo ); 2664 if ( todo ) newSubTodo( todo );
2663} 2665}
2664 2666
2665void CalendarView::newSubTodo(Todo *parentEvent) 2667void CalendarView::newSubTodo(Todo *parentEvent)
2666{ 2668{
2667 2669
2668 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
2669 showTodoEditor(); 2670 showTodoEditor();
2671 mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true);
2670} 2672}
2671 2673
2672void CalendarView::newFloatingEvent() 2674void CalendarView::newFloatingEvent()
2673{ 2675{
2674 DateList tmpList = mNavigator->selectedDates(); 2676 DateList tmpList = mNavigator->selectedDates();
2675 QDate date = tmpList.first(); 2677 QDate date = tmpList.first();
2676 2678
2677 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), 2679 newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
@@ -2682,36 +2684,36 @@ void CalendarView::newFloatingEvent()
2682void CalendarView::editEvent( Event *event ) 2684void CalendarView::editEvent( Event *event )
2683{ 2685{
2684 2686
2685 if ( !event ) return; 2687 if ( !event ) return;
2686 if ( event->isReadOnly() ) { 2688 if ( event->isReadOnly() ) {
2687 showEvent( event ); 2689 showEvent( event );
2688 return; 2690 return;
2689 } 2691 }
2690 mEventEditor->editEvent( event , mFlagEditDescription);
2691 showEventEditor(); 2692 showEventEditor();
2693 mEventEditor->editEvent( event , mFlagEditDescription);
2692} 2694}
2693void CalendarView::editJournal( Journal *jour ) 2695void CalendarView::editJournal( Journal *jour )
2694{ 2696{
2695 if ( !jour ) return; 2697 if ( !jour ) return;
2696 mDialogManager->hideSearchDialog(); 2698 mDialogManager->hideSearchDialog();
2697 mViewManager->showJournalView(); 2699 mViewManager->showJournalView();
2698 mNavigator->slotDaySelect( jour->dtStart().date() ); 2700 mNavigator->slotDaySelect( jour->dtStart().date() );
2699} 2701}
2700void CalendarView::editTodo( Todo *todo ) 2702void CalendarView::editTodo( Todo *todo )
2701{ 2703{
2702 if ( !todo ) return; 2704 if ( !todo ) return;
2703 2705
2704 if ( todo->isReadOnly() ) { 2706 if ( todo->isReadOnly() ) {
2705 showTodo( todo ); 2707 showTodo( todo );
2706 return; 2708 return;
2707 } 2709 }
2708 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2709 showTodoEditor(); 2710 showTodoEditor();
2711 mTodoEditor->editTodo( todo ,mFlagEditDescription);
2710 2712
2711} 2713}
2712 2714
2713KOEventViewerDialog* CalendarView::getEventViewerDialog() 2715KOEventViewerDialog* CalendarView::getEventViewerDialog()
2714{ 2716{
2715 if ( !mEventViewerDialog ) { 2717 if ( !mEventViewerDialog ) {
2716 mEventViewerDialog = new KOEventViewerDialog(this); 2718 mEventViewerDialog = new KOEventViewerDialog(this);
2717 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); 2719 connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );