-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 37 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 7 | ||||
-rw-r--r-- | korganizer/kodialogmanager.cpp | 7 |
4 files changed, 51 insertions, 4 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 06454c2..1d5a57e 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2420,210 +2420,210 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | |||
2420 | in->setDescription(""); | 2420 | in->setDescription(""); |
2421 | } else { | 2421 | } else { |
2422 | in->setSummary( in->description().left(20)); | 2422 | in->setSummary( in->description().left(20)); |
2423 | in->setDescription(""); | 2423 | in->setDescription(""); |
2424 | } | 2424 | } |
2425 | if ( addText ) | 2425 | if ( addText ) |
2426 | description += in->summary() + "\n"; | 2426 | description += in->summary() + "\n"; |
2427 | cal->addIncidence( in ); | 2427 | cal->addIncidence( in ); |
2428 | incidence = delSel.next(); | 2428 | incidence = delSel.next(); |
2429 | } | 2429 | } |
2430 | if ( beamDialog->beamVcal() ) { | 2430 | if ( beamDialog->beamVcal() ) { |
2431 | fn += ".vcs"; | 2431 | fn += ".vcs"; |
2432 | FileStorage storage( cal, fn, new VCalFormat ); | 2432 | FileStorage storage( cal, fn, new VCalFormat ); |
2433 | storage.save(); | 2433 | storage.save(); |
2434 | } else { | 2434 | } else { |
2435 | fn += ".ics"; | 2435 | fn += ".ics"; |
2436 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 2436 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2437 | storage.save(); | 2437 | storage.save(); |
2438 | } | 2438 | } |
2439 | delete cal; | 2439 | delete cal; |
2440 | mes = i18n("KO/Pi: Ready for beaming"); | 2440 | mes = i18n("KO/Pi: Ready for beaming"); |
2441 | topLevelWidget()->setCaption(mes); | 2441 | topLevelWidget()->setCaption(mes); |
2442 | KApplication::convert2latin1( fn ); | 2442 | KApplication::convert2latin1( fn ); |
2443 | #ifndef DESKTOP_VERSION | 2443 | #ifndef DESKTOP_VERSION |
2444 | Ir *ir = new Ir( this ); | 2444 | Ir *ir = new Ir( this ); |
2445 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2445 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2446 | ir->send( fn, description, "text/x-vCalendar" ); | 2446 | ir->send( fn, description, "text/x-vCalendar" ); |
2447 | #endif | 2447 | #endif |
2448 | } | 2448 | } |
2449 | } | 2449 | } |
2450 | void CalendarView::beamDone( Ir *ir ) | 2450 | void CalendarView::beamDone( Ir *ir ) |
2451 | { | 2451 | { |
2452 | #ifndef DESKTOP_VERSION | 2452 | #ifndef DESKTOP_VERSION |
2453 | delete ir; | 2453 | delete ir; |
2454 | #endif | 2454 | #endif |
2455 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 2455 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
2456 | topLevelWidget()->raise(); | 2456 | topLevelWidget()->raise(); |
2457 | } | 2457 | } |
2458 | 2458 | ||
2459 | void CalendarView::moveIncidence(Incidence * inc ) | 2459 | void CalendarView::moveIncidence(Incidence * inc ) |
2460 | { | 2460 | { |
2461 | if ( !inc ) return; | 2461 | if ( !inc ) return; |
2462 | // qDebug("showDatePickerForIncidence( ) "); | 2462 | // qDebug("showDatePickerForIncidence( ) "); |
2463 | if ( mDateFrame->isVisible() ) | 2463 | if ( mDateFrame->isVisible() ) |
2464 | mDateFrame->hide(); | 2464 | mDateFrame->hide(); |
2465 | else { | 2465 | else { |
2466 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; | 2466 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; |
2467 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; | 2467 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; |
2468 | int dw = QApplication::desktop()->width(); | 2468 | int dw = QApplication::desktop()->width(); |
2469 | int dh = QApplication::desktop()->height(); | 2469 | int dh = QApplication::desktop()->height(); |
2470 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2470 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2471 | mDateFrame->show(); | 2471 | mDateFrame->show(); |
2472 | } | 2472 | } |
2473 | mDatePickerMode = 2; | 2473 | mDatePickerMode = 2; |
2474 | mMoveIncidence = inc ; | 2474 | mMoveIncidence = inc ; |
2475 | QDate da; | 2475 | QDate da; |
2476 | if ( mMoveIncidence->type() == "Todo" ) { | 2476 | if ( mMoveIncidence->type() == "Todo" ) { |
2477 | Todo * to = (Todo *) mMoveIncidence; | 2477 | Todo * to = (Todo *) mMoveIncidence; |
2478 | if ( to->hasDueDate() ) | 2478 | if ( to->hasDueDate() ) |
2479 | da = to->dtDue().date(); | 2479 | da = to->dtDue().date(); |
2480 | else | 2480 | else |
2481 | da = QDate::currentDate(); | 2481 | da = QDate::currentDate(); |
2482 | } else { | 2482 | } else { |
2483 | da = mMoveIncidence->dtStart().date(); | 2483 | da = mMoveIncidence->dtStart().date(); |
2484 | } | 2484 | } |
2485 | //PENDING set date for recurring incidence to date of recurrence | 2485 | //PENDING set date for recurring incidence to date of recurrence |
2486 | //mMoveIncidenceOldDate; | 2486 | //mMoveIncidenceOldDate; |
2487 | mDatePicker->setDate( da ); | 2487 | mDatePicker->setDate( da ); |
2488 | } | 2488 | } |
2489 | void CalendarView::showDatePicker( ) | 2489 | void CalendarView::showDatePicker( ) |
2490 | { | 2490 | { |
2491 | //qDebug("CalendarView::showDatePicker( ) "); | 2491 | //qDebug("CalendarView::showDatePicker( ) "); |
2492 | if ( mDateFrame->isVisible() ) | 2492 | if ( mDateFrame->isVisible() ) |
2493 | mDateFrame->hide(); | 2493 | mDateFrame->hide(); |
2494 | else { | 2494 | else { |
2495 | int w =mDatePicker->sizeHint().width() ; | 2495 | int w =mDatePicker->sizeHint().width() ; |
2496 | int h = mDatePicker->sizeHint().height() ; | 2496 | int h = mDatePicker->sizeHint().height() ; |
2497 | int dw = QApplication::desktop()->width(); | 2497 | int dw = QApplication::desktop()->width(); |
2498 | int dh = QApplication::desktop()->height(); | 2498 | int dh = QApplication::desktop()->height(); |
2499 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2499 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2500 | mDateFrame->show(); | 2500 | mDateFrame->show(); |
2501 | } | 2501 | } |
2502 | mDatePickerMode = 1; | 2502 | mDatePickerMode = 1; |
2503 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 2503 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
2504 | } | 2504 | } |
2505 | 2505 | ||
2506 | void CalendarView::showEventEditor() | 2506 | void CalendarView::showEventEditor() |
2507 | { | 2507 | { |
2508 | #ifdef DESKTOP_VERSION | 2508 | #ifdef DESKTOP_VERSION |
2509 | mEventEditor->show(); | 2509 | mEventEditor->show(); |
2510 | #else | 2510 | #else |
2511 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { | 2511 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { |
2512 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2512 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2513 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); | 2513 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); |
2514 | delete mEventEditor; | 2514 | delete mEventEditor; |
2515 | mEventEditor = mDialogManager->getEventEditor(); | 2515 | mEventEditor = mDialogManager->getEventEditor(); |
2516 | topLevelWidget()->setCaption( i18n("") ); | ||
2516 | } | 2517 | } |
2517 | mEventEditor->showMaximized(); | 2518 | mEventEditor->showMaximized(); |
2518 | topLevelWidget()->setCaption( i18n("") ); | ||
2519 | #endif | 2519 | #endif |
2520 | } | 2520 | } |
2521 | void CalendarView::showTodoEditor() | 2521 | void CalendarView::showTodoEditor() |
2522 | { | 2522 | { |
2523 | #ifdef DESKTOP_VERSION | 2523 | #ifdef DESKTOP_VERSION |
2524 | mTodoEditor->show(); | 2524 | mTodoEditor->show(); |
2525 | #else | 2525 | #else |
2526 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { | 2526 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { |
2527 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2527 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2528 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); | 2528 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); |
2529 | delete mTodoEditor; | 2529 | delete mTodoEditor; |
2530 | mTodoEditor = mDialogManager->getTodoEditor(); | 2530 | mTodoEditor = mDialogManager->getTodoEditor(); |
2531 | topLevelWidget()->setCaption( i18n("") ); | ||
2531 | } | 2532 | } |
2532 | mTodoEditor->showMaximized(); | 2533 | mTodoEditor->showMaximized(); |
2533 | topLevelWidget()->setCaption( i18n("") ); | ||
2534 | #endif | 2534 | #endif |
2535 | } | 2535 | } |
2536 | 2536 | ||
2537 | void CalendarView::cloneIncidence() | 2537 | void CalendarView::cloneIncidence() |
2538 | { | 2538 | { |
2539 | Incidence *incidence = currentSelection(); | 2539 | Incidence *incidence = currentSelection(); |
2540 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2540 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2541 | if ( incidence ) { | 2541 | if ( incidence ) { |
2542 | cloneIncidence(incidence); | 2542 | cloneIncidence(incidence); |
2543 | } | 2543 | } |
2544 | } | 2544 | } |
2545 | void CalendarView::moveIncidence() | 2545 | void CalendarView::moveIncidence() |
2546 | { | 2546 | { |
2547 | Incidence *incidence = currentSelection(); | 2547 | Incidence *incidence = currentSelection(); |
2548 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2548 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2549 | if ( incidence ) { | 2549 | if ( incidence ) { |
2550 | moveIncidence(incidence); | 2550 | moveIncidence(incidence); |
2551 | } | 2551 | } |
2552 | } | 2552 | } |
2553 | void CalendarView::beamIncidence() | 2553 | void CalendarView::beamIncidence() |
2554 | { | 2554 | { |
2555 | Incidence *incidence = currentSelection(); | 2555 | Incidence *incidence = currentSelection(); |
2556 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2556 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2557 | if ( incidence ) { | 2557 | if ( incidence ) { |
2558 | beamIncidence(incidence); | 2558 | beamIncidence(incidence); |
2559 | } | 2559 | } |
2560 | } | 2560 | } |
2561 | void CalendarView::toggleCancelIncidence() | 2561 | void CalendarView::toggleCancelIncidence() |
2562 | { | 2562 | { |
2563 | Incidence *incidence = currentSelection(); | 2563 | Incidence *incidence = currentSelection(); |
2564 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2564 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2565 | if ( incidence ) { | 2565 | if ( incidence ) { |
2566 | cancelIncidence(incidence); | 2566 | cancelIncidence(incidence); |
2567 | } | 2567 | } |
2568 | } | 2568 | } |
2569 | 2569 | ||
2570 | 2570 | ||
2571 | void CalendarView::cancelIncidence(Incidence * inc ) | 2571 | void CalendarView::cancelIncidence(Incidence * inc ) |
2572 | { | 2572 | { |
2573 | inc->setCancelled( ! inc->cancelled() ); | 2573 | inc->setCancelled( ! inc->cancelled() ); |
2574 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 2574 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
2575 | updateView(); | 2575 | updateView(); |
2576 | } | 2576 | } |
2577 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 2577 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
2578 | { | 2578 | { |
2579 | Incidence * newInc = orgInc->clone(); | 2579 | Incidence * newInc = orgInc->clone(); |
2580 | newInc->recreate(); | 2580 | newInc->recreate(); |
2581 | 2581 | ||
2582 | if ( newInc->type() == "Todo" ) { | 2582 | if ( newInc->type() == "Todo" ) { |
2583 | Todo* t = (Todo*) newInc; | 2583 | Todo* t = (Todo*) newInc; |
2584 | showTodoEditor(); | 2584 | showTodoEditor(); |
2585 | mTodoEditor->editTodo( t ); | 2585 | mTodoEditor->editTodo( t ); |
2586 | if ( mTodoEditor->exec() ) { | 2586 | if ( mTodoEditor->exec() ) { |
2587 | mCalendar->addTodo( t ); | 2587 | mCalendar->addTodo( t ); |
2588 | updateView(); | 2588 | updateView(); |
2589 | } else { | 2589 | } else { |
2590 | delete t; | 2590 | delete t; |
2591 | } | 2591 | } |
2592 | } | 2592 | } |
2593 | else { | 2593 | else { |
2594 | Event* e = (Event*) newInc; | 2594 | Event* e = (Event*) newInc; |
2595 | showEventEditor(); | 2595 | showEventEditor(); |
2596 | mEventEditor->editEvent( e ); | 2596 | mEventEditor->editEvent( e ); |
2597 | if ( mEventEditor->exec() ) { | 2597 | if ( mEventEditor->exec() ) { |
2598 | mCalendar->addEvent( e ); | 2598 | mCalendar->addEvent( e ); |
2599 | updateView(); | 2599 | updateView(); |
2600 | } else { | 2600 | } else { |
2601 | delete e; | 2601 | delete e; |
2602 | } | 2602 | } |
2603 | } | 2603 | } |
2604 | } | 2604 | } |
2605 | 2605 | ||
2606 | void CalendarView::newEvent() | 2606 | void CalendarView::newEvent() |
2607 | { | 2607 | { |
2608 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 2608 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
2609 | KOAgendaView *aView = mViewManager->agendaView(); | 2609 | KOAgendaView *aView = mViewManager->agendaView(); |
2610 | if (aView) { | 2610 | if (aView) { |
2611 | if (aView->selectionStart().isValid()) { | 2611 | if (aView->selectionStart().isValid()) { |
2612 | if (aView->selectedIsAllDay()) { | 2612 | if (aView->selectedIsAllDay()) { |
2613 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 2613 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
2614 | } else { | 2614 | } else { |
2615 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 2615 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
2616 | } | 2616 | } |
2617 | return; | 2617 | return; |
2618 | } | 2618 | } |
2619 | } | 2619 | } |
2620 | 2620 | ||
2621 | QDate date = mNavigator->selectedDates().first(); | 2621 | QDate date = mNavigator->selectedDates().first(); |
2622 | QDateTime current = QDateTime::currentDateTime(); | 2622 | QDateTime current = QDateTime::currentDateTime(); |
2623 | if ( date <= current.date() ) { | 2623 | if ( date <= current.date() ) { |
2624 | int hour = current.time().hour() +1; | 2624 | int hour = current.time().hour() +1; |
2625 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 2625 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
2626 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2626 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2627 | } else | 2627 | } else |
2628 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 2628 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
2629 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 2629 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 6428757..b5596d9 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -108,193 +108,228 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | |||
108 | 108 | ||
109 | // if ( globalFlagBlockAgenda ) | 109 | // if ( globalFlagBlockAgenda ) |
110 | // return; | 110 | // return; |
111 | // bug: the parameters cx, cy, cw, ch are the areas that need to be | 111 | // bug: the parameters cx, cy, cw, ch are the areas that need to be |
112 | // redrawn, not the area of the widget. unfortunately, this | 112 | // redrawn, not the area of the widget. unfortunately, this |
113 | // code assumes the latter... | 113 | // code assumes the latter... |
114 | 114 | ||
115 | // now, for a workaround... | 115 | // now, for a workaround... |
116 | // these two assignments fix the weird redraw bug | 116 | // these two assignments fix the weird redraw bug |
117 | cx = contentsX() + 2; | 117 | cx = contentsX() + 2; |
118 | cw = contentsWidth() - 2; | 118 | cw = contentsWidth() - 2; |
119 | // end of workaround | 119 | // end of workaround |
120 | 120 | ||
121 | int cell = ((int)(cy/mCellHeight)); | 121 | int cell = ((int)(cy/mCellHeight)); |
122 | int y = cell * mCellHeight; | 122 | int y = cell * mCellHeight; |
123 | QFontMetrics fm = fontMetrics(); | 123 | QFontMetrics fm = fontMetrics(); |
124 | QString hour; | 124 | QString hour; |
125 | QString suffix; | 125 | QString suffix; |
126 | QString fullTime; | 126 | QString fullTime; |
127 | int tW = fm.width("24:00i"); | 127 | int tW = fm.width("24:00i"); |
128 | 128 | ||
129 | while (y < cy + ch) { | 129 | while (y < cy + ch) { |
130 | p->drawLine(cx,y,cx+tW,y); | 130 | p->drawLine(cx,y,cx+tW,y); |
131 | hour.setNum(cell); | 131 | hour.setNum(cell); |
132 | suffix = "am"; | 132 | suffix = "am"; |
133 | 133 | ||
134 | // handle 24h and am/pm time formats | 134 | // handle 24h and am/pm time formats |
135 | if (KGlobal::locale()->use12Clock()) { | 135 | if (KGlobal::locale()->use12Clock()) { |
136 | if (cell > 11) suffix = "pm"; | 136 | if (cell > 11) suffix = "pm"; |
137 | if (cell == 0) hour.setNum(12); | 137 | if (cell == 0) hour.setNum(12); |
138 | if (cell > 12) hour.setNum(cell - 12); | 138 | if (cell > 12) hour.setNum(cell - 12); |
139 | } else { | 139 | } else { |
140 | suffix = ":00"; | 140 | suffix = ":00"; |
141 | } | 141 | } |
142 | 142 | ||
143 | // create string in format of "XX:XX" or "XXpm/am" | 143 | // create string in format of "XX:XX" or "XXpm/am" |
144 | fullTime = hour + suffix; | 144 | fullTime = hour + suffix; |
145 | 145 | ||
146 | // center and draw the time label | 146 | // center and draw the time label |
147 | int timeWidth = fm.width(fullTime+"i"); | 147 | int timeWidth = fm.width(fullTime+"i"); |
148 | int offset = this->width() - timeWidth; | 148 | int offset = this->width() - timeWidth; |
149 | int borderWidth = 5; | 149 | int borderWidth = 5; |
150 | int timeHeight = fm.height(); | 150 | int timeHeight = fm.height(); |
151 | timeHeight = timeHeight + 2 - ( timeHeight / 4 ); | 151 | timeHeight = timeHeight + 2 - ( timeHeight / 4 ); |
152 | p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime); | 152 | p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime); |
153 | 153 | ||
154 | // increment indices | 154 | // increment indices |
155 | y += mCellHeight; | 155 | y += mCellHeight; |
156 | cell++; | 156 | cell++; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | /** | 160 | /** |
161 | Calculates the minimum width. | 161 | Calculates the minimum width. |
162 | */ | 162 | */ |
163 | int TimeLabels::minimumWidth() const | 163 | int TimeLabels::minimumWidth() const |
164 | { | 164 | { |
165 | QFontMetrics fm = fontMetrics(); | 165 | QFontMetrics fm = fontMetrics(); |
166 | 166 | ||
167 | //TODO: calculate this value | 167 | //TODO: calculate this value |
168 | int borderWidth = 4; | 168 | int borderWidth = 4; |
169 | 169 | ||
170 | // the maximum width possible | 170 | // the maximum width possible |
171 | int width = fm.width("88:88x") + borderWidth; | 171 | int width = fm.width("88:88x") + borderWidth; |
172 | 172 | ||
173 | return width; | 173 | return width; |
174 | } | 174 | } |
175 | 175 | ||
176 | /** updates widget's internal state */ | 176 | /** updates widget's internal state */ |
177 | void TimeLabels::updateConfig() | 177 | void TimeLabels::updateConfig() |
178 | { | 178 | { |
179 | // set the font | 179 | // set the font |
180 | // config->setGroup("Fonts"); | 180 | // config->setGroup("Fonts"); |
181 | // QFont font = config->readFontEntry("TimeBar Font"); | 181 | // QFont font = config->readFontEntry("TimeBar Font"); |
182 | setFont(KOPrefs::instance()->mTimeBarFont); | 182 | setFont(KOPrefs::instance()->mTimeBarFont); |
183 | 183 | ||
184 | // update geometry restrictions based on new settings | 184 | // update geometry restrictions based on new settings |
185 | setFixedWidth(minimumWidth()); | 185 | setFixedWidth(minimumWidth()); |
186 | 186 | ||
187 | // update HourSize | 187 | // update HourSize |
188 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 188 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
189 | resizeContents(50,mRows * mCellHeight); | 189 | resizeContents(50,mRows * mCellHeight); |
190 | } | 190 | } |
191 | 191 | ||
192 | /** update time label positions */ | 192 | /** update time label positions */ |
193 | void TimeLabels::positionChanged() | 193 | void TimeLabels::positionChanged() |
194 | { | 194 | { |
195 | int adjustment = mAgenda->contentsY(); | 195 | int adjustment = mAgenda->contentsY(); |
196 | setContentsPos(0, adjustment); | 196 | setContentsPos(0, adjustment); |
197 | } | 197 | } |
198 | 198 | ||
199 | /** */ | 199 | /** */ |
200 | void TimeLabels::setAgenda(KOAgenda* agenda) | 200 | void TimeLabels::setAgenda(KOAgenda* agenda) |
201 | { | 201 | { |
202 | mAgenda = agenda; | 202 | mAgenda = agenda; |
203 | } | 203 | } |
204 | |||
205 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) | ||
206 | { | ||
207 | mMouseDownY = e->pos().y(); | ||
208 | } | ||
209 | |||
210 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) | ||
211 | { | ||
212 | int diff = mMouseDownY - e->pos().y(); | ||
213 | if ( diff < 10 && diff > -10 ) | ||
214 | return; | ||
215 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; | ||
216 | if ( tSize < 4 ) | ||
217 | tSize = 4; | ||
218 | if ( tSize > 18 ) | ||
219 | tSize = 18; | ||
220 | tSize = (tSize-2)/2; | ||
221 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); | ||
204 | 222 | ||
223 | } | ||
224 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) | ||
225 | { | ||
226 | int diff = mMouseDownY - e->pos().y(); | ||
227 | if ( diff < 10 && diff > -10 ) | ||
228 | return; | ||
229 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); | ||
230 | if ( tSize < 4 ) | ||
231 | tSize = 4; | ||
232 | if ( tSize > 18 ) | ||
233 | tSize = 18; | ||
234 | tSize = (tSize/2)*2; | ||
235 | if ( tSize == KOPrefs::instance()->mHourSize ) | ||
236 | return; | ||
237 | KOPrefs::instance()->mHourSize = tSize; | ||
238 | emit scaleChanged(); | ||
239 | } | ||
205 | 240 | ||
206 | /** This is called in response to repaint() */ | 241 | /** This is called in response to repaint() */ |
207 | void TimeLabels::paintEvent(QPaintEvent*) | 242 | void TimeLabels::paintEvent(QPaintEvent*) |
208 | { | 243 | { |
209 | 244 | ||
210 | // kdDebug() << "paintevent..." << endl; | 245 | // kdDebug() << "paintevent..." << endl; |
211 | // this is another hack! | 246 | // this is another hack! |
212 | // QPainter painter(this); | 247 | // QPainter painter(this); |
213 | //QString c | 248 | //QString c |
214 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); | 249 | repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); |
215 | } | 250 | } |
216 | 251 | ||
217 | //////////////////////////////////////////////////////////////////////////// | 252 | //////////////////////////////////////////////////////////////////////////// |
218 | 253 | ||
219 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) | 254 | EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) |
220 | : QFrame(parent,name) | 255 | : QFrame(parent,name) |
221 | { | 256 | { |
222 | mColumns = 1; | 257 | mColumns = 1; |
223 | mTopBox = 0; | 258 | mTopBox = 0; |
224 | mLocation = loc; | 259 | mLocation = loc; |
225 | mTopLayout = 0; | 260 | mTopLayout = 0; |
226 | mPaintWidget = 0; | 261 | mPaintWidget = 0; |
227 | mXOffset = 0; | 262 | mXOffset = 0; |
228 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); | 263 | if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); |
229 | else mPixmap = SmallIcon("1downarrow"); | 264 | else mPixmap = SmallIcon("1downarrow"); |
230 | mEnabled.resize(mColumns); | 265 | mEnabled.resize(mColumns); |
231 | if (mLocation == Top) | 266 | if (mLocation == Top) |
232 | setMaximumHeight(0); | 267 | setMaximumHeight(0); |
233 | else | 268 | else |
234 | setMinimumHeight(mPixmap.height()); | 269 | setMinimumHeight(mPixmap.height()); |
235 | } | 270 | } |
236 | 271 | ||
237 | EventIndicator::~EventIndicator() | 272 | EventIndicator::~EventIndicator() |
238 | { | 273 | { |
239 | } | 274 | } |
240 | 275 | ||
241 | void EventIndicator::drawContents(QPainter *p) | 276 | void EventIndicator::drawContents(QPainter *p) |
242 | { | 277 | { |
243 | 278 | ||
244 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; | 279 | // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; |
245 | KDGanttSplitterHandle* han = 0; | 280 | KDGanttSplitterHandle* han = 0; |
246 | if ( mPaintWidget ) | 281 | if ( mPaintWidget ) |
247 | han = mPaintWidget->firstHandle(); | 282 | han = mPaintWidget->firstHandle(); |
248 | if ( ! han ) { | 283 | if ( ! han ) { |
249 | int i; | 284 | int i; |
250 | for(i=0;i<mColumns;++i) { | 285 | for(i=0;i<mColumns;++i) { |
251 | if (mEnabled[i]) { | 286 | if (mEnabled[i]) { |
252 | int cellWidth = contentsRect().right()/mColumns; | 287 | int cellWidth = contentsRect().right()/mColumns; |
253 | int xOffset = KOGlobals::self()->reverseLayout() ? | 288 | int xOffset = KOGlobals::self()->reverseLayout() ? |
254 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 289 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : |
255 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 290 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; |
256 | p->drawPixmap(QPoint(xOffset,0),mPixmap); | 291 | p->drawPixmap(QPoint(xOffset,0),mPixmap); |
257 | } | 292 | } |
258 | } | 293 | } |
259 | } else { | 294 | } else { |
260 | han->repaint(); | 295 | han->repaint(); |
261 | //mPaintWidget->setBackgroundColor( red ); | 296 | //mPaintWidget->setBackgroundColor( red ); |
262 | 297 | ||
263 | QPainter pa( han ); | 298 | QPainter pa( han ); |
264 | int i; | 299 | int i; |
265 | bool setColor = false; | 300 | bool setColor = false; |
266 | for(i=0;i<mColumns;++i) { | 301 | for(i=0;i<mColumns;++i) { |
267 | if (mEnabled[i]) { | 302 | if (mEnabled[i]) { |
268 | setColor = true; | 303 | setColor = true; |
269 | 304 | ||
270 | int cellWidth = contentsRect().right()/mColumns; | 305 | int cellWidth = contentsRect().right()/mColumns; |
271 | int xOffset = KOGlobals::self()->reverseLayout() ? | 306 | int xOffset = KOGlobals::self()->reverseLayout() ? |
272 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 307 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : |
273 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 308 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; |
274 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); | 309 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); |
275 | //qDebug("222draw pix %d ",xOffset ); | 310 | //qDebug("222draw pix %d ",xOffset ); |
276 | 311 | ||
277 | } | 312 | } |
278 | 313 | ||
279 | } | 314 | } |
280 | pa.end(); | 315 | pa.end(); |
281 | 316 | ||
282 | } | 317 | } |
283 | } | 318 | } |
284 | 319 | ||
285 | void EventIndicator::setXOffset( int x ) | 320 | void EventIndicator::setXOffset( int x ) |
286 | { | 321 | { |
287 | mXOffset = x; | 322 | mXOffset = x; |
288 | } | 323 | } |
289 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) | 324 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) |
290 | { | 325 | { |
291 | mPaintWidget = w; | 326 | mPaintWidget = w; |
292 | } | 327 | } |
293 | void EventIndicator::changeColumns(int columns) | 328 | void EventIndicator::changeColumns(int columns) |
294 | { | 329 | { |
295 | mColumns = columns; | 330 | mColumns = columns; |
296 | mEnabled.resize(mColumns); | 331 | mEnabled.resize(mColumns); |
297 | 332 | ||
298 | update(); | 333 | update(); |
299 | } | 334 | } |
300 | 335 | ||
@@ -317,192 +352,194 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
317 | 352 | ||
318 | mLayoutDayLabels = 0; | 353 | mLayoutDayLabels = 0; |
319 | mDayLabelsFrame = 0; | 354 | mDayLabelsFrame = 0; |
320 | mDayLabels = 0; | 355 | mDayLabels = 0; |
321 | bool isRTL = KOGlobals::self()->reverseLayout(); | 356 | bool isRTL = KOGlobals::self()->reverseLayout(); |
322 | 357 | ||
323 | if ( KOPrefs::instance()->mVerticalScreen ) { | 358 | if ( KOPrefs::instance()->mVerticalScreen ) { |
324 | mExpandedPixmap = SmallIcon( "1downarrow" ); | 359 | mExpandedPixmap = SmallIcon( "1downarrow" ); |
325 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); | 360 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); |
326 | } else { | 361 | } else { |
327 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); | 362 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); |
328 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); | 363 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); |
329 | } | 364 | } |
330 | 365 | ||
331 | QBoxLayout *topLayout = new QVBoxLayout(this); | 366 | QBoxLayout *topLayout = new QVBoxLayout(this); |
332 | 367 | ||
333 | // Create day name labels for agenda columns | 368 | // Create day name labels for agenda columns |
334 | mDayLabelsFrame = new QHBox(this); | 369 | mDayLabelsFrame = new QHBox(this); |
335 | topLayout->addWidget(mDayLabelsFrame); | 370 | topLayout->addWidget(mDayLabelsFrame); |
336 | mDayLabels = new QFrame (mDayLabelsFrame); | 371 | mDayLabels = new QFrame (mDayLabelsFrame); |
337 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 372 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
338 | // Create agenda splitter | 373 | // Create agenda splitter |
339 | #ifndef KORG_NOSPLITTER | 374 | #ifndef KORG_NOSPLITTER |
340 | mSplitterAgenda = new QSplitter(Vertical,this); | 375 | mSplitterAgenda = new QSplitter(Vertical,this); |
341 | topLayout->addWidget(mSplitterAgenda); | 376 | topLayout->addWidget(mSplitterAgenda); |
342 | mSplitterAgenda->setOpaqueResize(); | 377 | mSplitterAgenda->setOpaqueResize(); |
343 | 378 | ||
344 | mAllDayFrame = new QHBox(mSplitterAgenda); | 379 | mAllDayFrame = new QHBox(mSplitterAgenda); |
345 | 380 | ||
346 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 381 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
347 | #else | 382 | #else |
348 | #if 0 | 383 | #if 0 |
349 | QWidget *mainBox = new QWidget( this ); | 384 | QWidget *mainBox = new QWidget( this ); |
350 | topLayout->addWidget( mainBox ); | 385 | topLayout->addWidget( mainBox ); |
351 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); | 386 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); |
352 | mAllDayFrame = new QHBox(mainBox); | 387 | mAllDayFrame = new QHBox(mainBox); |
353 | mainLayout->addWidget(mAllDayFrame); | 388 | mainLayout->addWidget(mAllDayFrame); |
354 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); | 389 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); |
355 | mAllDayFrame->setFocusPolicy(NoFocus); | 390 | mAllDayFrame->setFocusPolicy(NoFocus); |
356 | QWidget *agendaFrame = new QWidget(mainBox); | 391 | QWidget *agendaFrame = new QWidget(mainBox); |
357 | mainLayout->addWidget(agendaFrame); | 392 | mainLayout->addWidget(agendaFrame); |
358 | mainLayout->setStretchFactor( agendaFrame, 10 ); | 393 | mainLayout->setStretchFactor( agendaFrame, 10 ); |
359 | 394 | ||
360 | agendaFrame->setFocusPolicy(NoFocus); | 395 | agendaFrame->setFocusPolicy(NoFocus); |
361 | #endif | 396 | #endif |
362 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 397 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
363 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 398 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
364 | topLayout->addWidget( mSplitterAgenda ); | 399 | topLayout->addWidget( mSplitterAgenda ); |
365 | mAllDayFrame = new QHBox(mSplitterAgenda); | 400 | mAllDayFrame = new QHBox(mSplitterAgenda); |
366 | mAllDayFrame->setFocusPolicy(NoFocus); | 401 | mAllDayFrame->setFocusPolicy(NoFocus); |
367 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 402 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
368 | agendaFrame->setFocusPolicy(NoFocus); | 403 | agendaFrame->setFocusPolicy(NoFocus); |
369 | 404 | ||
370 | #endif | 405 | #endif |
371 | 406 | ||
372 | // Create all-day agenda widget | 407 | // Create all-day agenda widget |
373 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 408 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
374 | 409 | ||
375 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 410 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
376 | mExpandButton->setPixmap( mNotExpandedPixmap ); | 411 | mExpandButton->setPixmap( mNotExpandedPixmap ); |
377 | int widebut = mExpandButton->sizeHint().width(); | 412 | int widebut = mExpandButton->sizeHint().width(); |
378 | if ( QApplication::desktop()->width() < 480 ) | 413 | if ( QApplication::desktop()->width() < 480 ) |
379 | widebut = widebut*2; | 414 | widebut = widebut*2; |
380 | else | 415 | else |
381 | widebut = (widebut*3) / 2; | 416 | widebut = (widebut*3) / 2; |
382 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 417 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
383 | // QSizePolicy::Fixed ) ); | 418 | // QSizePolicy::Fixed ) ); |
384 | mExpandButton->setFixedSize( widebut, widebut); | 419 | mExpandButton->setFixedSize( widebut, widebut); |
385 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 420 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
386 | mExpandButton->setFocusPolicy(NoFocus); | 421 | mExpandButton->setFocusPolicy(NoFocus); |
387 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 422 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
388 | mAllDayAgenda->setFocusPolicy(NoFocus); | 423 | mAllDayAgenda->setFocusPolicy(NoFocus); |
389 | QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); | 424 | QWidget *dummyAllDayRight = new QWidget(mAllDayFrame); |
390 | 425 | ||
391 | // Create event context menu for all day agenda | 426 | // Create event context menu for all day agenda |
392 | mAllDayAgendaPopup = eventPopup(); | 427 | mAllDayAgendaPopup = eventPopup(); |
393 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 428 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
394 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 429 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
395 | 430 | ||
396 | // Create agenda frame | 431 | // Create agenda frame |
397 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); | 432 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); |
398 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 433 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
399 | 434 | ||
400 | // create event indicator bars | 435 | // create event indicator bars |
401 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 436 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
402 | agendaLayout->addWidget(mEventIndicatorTop,0,1); | 437 | agendaLayout->addWidget(mEventIndicatorTop,0,1); |
403 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 438 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
404 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 439 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
405 | agendaFrame); | 440 | agendaFrame); |
406 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); | 441 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); |
407 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 442 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
408 | agendaLayout->addWidget(dummyAgendaRight,0,2); | 443 | agendaLayout->addWidget(dummyAgendaRight,0,2); |
409 | 444 | ||
410 | // Create time labels | 445 | // Create time labels |
411 | mTimeLabels = new TimeLabels(24,agendaFrame); | 446 | mTimeLabels = new TimeLabels(24,agendaFrame); |
412 | agendaLayout->addWidget(mTimeLabels,1,0); | 447 | agendaLayout->addWidget(mTimeLabels,1,0); |
448 | connect(mTimeLabels,SIGNAL( scaleChanged()), | ||
449 | this,SLOT(updateConfig())); | ||
413 | 450 | ||
414 | // Create agenda | 451 | // Create agenda |
415 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 452 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
416 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); | 453 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); |
417 | agendaLayout->setColStretch(1,1); | 454 | agendaLayout->setColStretch(1,1); |
418 | mAgenda->setFocusPolicy(NoFocus); | 455 | mAgenda->setFocusPolicy(NoFocus); |
419 | // Create event context menu for agenda | 456 | // Create event context menu for agenda |
420 | mAgendaPopup = eventPopup(); | 457 | mAgendaPopup = eventPopup(); |
421 | 458 | ||
422 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 459 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
423 | i18n("Toggle Alarm"),mAgenda, | 460 | i18n("Toggle Alarm"),mAgenda, |
424 | SLOT(popupAlarm()),true); | 461 | SLOT(popupAlarm()),true); |
425 | 462 | ||
426 | 463 | ||
427 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 464 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
428 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 465 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
429 | 466 | ||
430 | // make connections between dependent widgets | 467 | // make connections between dependent widgets |
431 | mTimeLabels->setAgenda(mAgenda); | 468 | mTimeLabels->setAgenda(mAgenda); |
432 | 469 | ||
433 | // Update widgets to reflect user preferences | 470 | // Update widgets to reflect user preferences |
434 | // updateConfig(); | 471 | // updateConfig(); |
435 | 472 | ||
436 | // createDayLabels(); | 473 | // createDayLabels(); |
437 | 474 | ||
438 | // these blank widgets make the All Day Event box line up with the agenda | 475 | // these blank widgets make the All Day Event box line up with the agenda |
439 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 476 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
440 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 477 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
441 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 478 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
442 | 479 | ||
443 | // Scrolling | 480 | // Scrolling |
444 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 481 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
445 | mTimeLabels, SLOT(positionChanged())); | 482 | mTimeLabels, SLOT(positionChanged())); |
446 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 483 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
447 | SLOT(setContentsPos(int))); | 484 | SLOT(setContentsPos(int))); |
448 | 485 | ||
449 | // Create/Show/Edit/Delete Event | 486 | // Create/Show/Edit/Delete Event |
450 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 487 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
451 | SLOT(newEvent(int,int))); | 488 | SLOT(newEvent(int,int))); |
452 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 489 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
453 | SLOT(newEvent(int,int,int,int))); | 490 | SLOT(newEvent(int,int,int,int))); |
454 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 491 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
455 | SLOT(newEventAllDay(int,int))); | 492 | SLOT(newEventAllDay(int,int))); |
456 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 493 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
457 | SLOT(newEventAllDay(int,int))); | 494 | SLOT(newEventAllDay(int,int))); |
458 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 495 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
459 | SLOT(newTimeSpanSelected(int,int,int,int))); | 496 | SLOT(newTimeSpanSelected(int,int,int,int))); |
460 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 497 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
461 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 498 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
462 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 499 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
463 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 500 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
464 | 501 | ||
465 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 502 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
466 | SIGNAL(editIncidenceSignal(Incidence *))); | 503 | SIGNAL(editIncidenceSignal(Incidence *))); |
467 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 504 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
468 | SIGNAL(editIncidenceSignal(Incidence *))); | 505 | SIGNAL(editIncidenceSignal(Incidence *))); |
469 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 506 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
470 | SIGNAL(showIncidenceSignal(Incidence *))); | 507 | SIGNAL(showIncidenceSignal(Incidence *))); |
471 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 508 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
472 | SIGNAL(showIncidenceSignal(Incidence *))); | 509 | SIGNAL(showIncidenceSignal(Incidence *))); |
473 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 510 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
474 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 511 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
475 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 512 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
476 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 513 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
477 | 514 | ||
478 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 515 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
479 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 516 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
480 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 517 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
481 | SLOT(updateEventDates(KOAgendaItem *, int))); | 518 | SLOT(updateEventDates(KOAgendaItem *, int))); |
482 | 519 | ||
483 | // event indicator update | 520 | // event indicator update |
484 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 521 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
485 | SLOT(updateEventIndicatorTop(int))); | 522 | SLOT(updateEventIndicatorTop(int))); |
486 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 523 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
487 | SLOT(updateEventIndicatorBottom(int))); | 524 | SLOT(updateEventIndicatorBottom(int))); |
488 | // drag signals | 525 | // drag signals |
489 | /* | 526 | /* |
490 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 527 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
491 | SLOT(startDrag(Event *))); | 528 | SLOT(startDrag(Event *))); |
492 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 529 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
493 | SLOT(startDrag(Event *))); | 530 | SLOT(startDrag(Event *))); |
494 | */ | 531 | */ |
495 | // synchronize selections | 532 | // synchronize selections |
496 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 533 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
497 | mAllDayAgenda, SLOT( deselectItem() ) ); | 534 | mAllDayAgenda, SLOT( deselectItem() ) ); |
498 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 535 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
499 | mAgenda, SLOT( deselectItem() ) ); | 536 | mAgenda, SLOT( deselectItem() ) ); |
500 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 537 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
501 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 538 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
502 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 539 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
503 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 540 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
504 | connect( mAgenda, SIGNAL( resizedSignal() ), | 541 | connect( mAgenda, SIGNAL( resizedSignal() ), |
505 | SLOT( updateConfig( ) ) ); | 542 | SLOT( updateConfig( ) ) ); |
506 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 543 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
507 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 544 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
508 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 545 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 0079253..221b0ea 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -1,170 +1,175 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOAGENDAVIEW_H | 23 | #ifndef KOAGENDAVIEW_H |
24 | #define KOAGENDAVIEW_H | 24 | #define KOAGENDAVIEW_H |
25 | 25 | ||
26 | #include <qscrollview.h> | 26 | #include <qscrollview.h> |
27 | #include <qdatetime.h> | 27 | #include <qdatetime.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #ifndef DESKTOP_VERSION | 29 | #ifndef DESKTOP_VERSION |
30 | #include <qksplitter.h> | 30 | #include <qksplitter.h> |
31 | #else | 31 | #else |
32 | #include <qsplitter.h> | 32 | #include <qsplitter.h> |
33 | #endif | 33 | #endif |
34 | #include <qmemarray.h> | 34 | #include <qmemarray.h> |
35 | 35 | ||
36 | #include "koeventview.h" | 36 | #include "koeventview.h" |
37 | 37 | ||
38 | 38 | ||
39 | class QHBox; | 39 | class QHBox; |
40 | class QFrame; | 40 | class QFrame; |
41 | class QLabel; | 41 | class QLabel; |
42 | class QPushButton; | 42 | class QPushButton; |
43 | class CalendarView; | 43 | class CalendarView; |
44 | class KOAgenda; | 44 | class KOAgenda; |
45 | class KOAgendaItem; | 45 | class KOAgendaItem; |
46 | class KConfig; | 46 | class KConfig; |
47 | class KDGanttMinimizeSplitter; | 47 | class KDGanttMinimizeSplitter; |
48 | class TimeLabels : public QScrollView { | 48 | class TimeLabels : public QScrollView { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0); | 51 | TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0); |
52 | 52 | ||
53 | void setCellHeight(int height); | 53 | void setCellHeight(int height); |
54 | 54 | ||
55 | /** Calculates the minimum width */ | 55 | /** Calculates the minimum width */ |
56 | virtual int minimumWidth() const; | 56 | virtual int minimumWidth() const; |
57 | 57 | ||
58 | /** updates widget's internal state */ | 58 | /** updates widget's internal state */ |
59 | void updateConfig(); | 59 | void updateConfig(); |
60 | 60 | ||
61 | /** */ | 61 | /** */ |
62 | void setAgenda(KOAgenda* agenda); | 62 | void setAgenda(KOAgenda* agenda); |
63 | 63 | ||
64 | /** */ | 64 | /** */ |
65 | virtual void paintEvent(QPaintEvent* e); | 65 | virtual void paintEvent(QPaintEvent* e); |
66 | void contentsMousePressEvent ( QMouseEvent * ) ; | ||
67 | void contentsMouseReleaseEvent ( QMouseEvent * ); | ||
68 | void contentsMouseMoveEvent ( QMouseEvent * ); | ||
66 | 69 | ||
67 | public slots: | 70 | public slots: |
68 | /** update time label positions */ | 71 | /** update time label positions */ |
69 | void positionChanged(); | 72 | void positionChanged(); |
70 | 73 | signals: | |
74 | void scaleChanged(); | ||
71 | protected: | 75 | protected: |
72 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); | 76 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); |
73 | 77 | ||
74 | private: | 78 | private: |
79 | int mMouseDownY; | ||
75 | int mRows; | 80 | int mRows; |
76 | int mCellHeight; | 81 | int mCellHeight; |
77 | 82 | ||
78 | /** */ | 83 | /** */ |
79 | KOAgenda* mAgenda; | 84 | KOAgenda* mAgenda; |
80 | }; | 85 | }; |
81 | 86 | ||
82 | class EventIndicator : public QFrame { | 87 | class EventIndicator : public QFrame { |
83 | Q_OBJECT | 88 | Q_OBJECT |
84 | public: | 89 | public: |
85 | enum Location { Top, Bottom }; | 90 | enum Location { Top, Bottom }; |
86 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); | 91 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); |
87 | virtual ~EventIndicator(); | 92 | virtual ~EventIndicator(); |
88 | 93 | ||
89 | void changeColumns(int columns); | 94 | void changeColumns(int columns); |
90 | void setPaintWidget( KDGanttMinimizeSplitter* ); | 95 | void setPaintWidget( KDGanttMinimizeSplitter* ); |
91 | void setXOffset( int ); | 96 | void setXOffset( int ); |
92 | void enableColumn(int column, bool enable); | 97 | void enableColumn(int column, bool enable); |
93 | 98 | ||
94 | protected: | 99 | protected: |
95 | void drawContents(QPainter *); | 100 | void drawContents(QPainter *); |
96 | 101 | ||
97 | private: | 102 | private: |
98 | int mXOffset; | 103 | int mXOffset; |
99 | KDGanttMinimizeSplitter* mPaintWidget; | 104 | KDGanttMinimizeSplitter* mPaintWidget; |
100 | int mColumns; | 105 | int mColumns; |
101 | QHBox *mTopBox; | 106 | QHBox *mTopBox; |
102 | QBoxLayout *mTopLayout; | 107 | QBoxLayout *mTopLayout; |
103 | Location mLocation; | 108 | Location mLocation; |
104 | QPixmap mPixmap; | 109 | QPixmap mPixmap; |
105 | QMemArray<bool> mEnabled; | 110 | QMemArray<bool> mEnabled; |
106 | }; | 111 | }; |
107 | 112 | ||
108 | /** | 113 | /** |
109 | KOAgendaView is the agenda-like view used to display events in an one or | 114 | KOAgendaView is the agenda-like view used to display events in an one or |
110 | multi-day view. | 115 | multi-day view. |
111 | */ | 116 | */ |
112 | class KOAgendaView : public KOEventView { | 117 | class KOAgendaView : public KOEventView { |
113 | Q_OBJECT | 118 | Q_OBJECT |
114 | public: | 119 | public: |
115 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); | 120 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); |
116 | virtual ~KOAgendaView(); | 121 | virtual ~KOAgendaView(); |
117 | void setStartHour( int ); | 122 | void setStartHour( int ); |
118 | void toggleAllDay(); | 123 | void toggleAllDay(); |
119 | 124 | ||
120 | 125 | ||
121 | /** Returns maximum number of days supported by the koagendaview */ | 126 | /** Returns maximum number of days supported by the koagendaview */ |
122 | virtual int maxDatesHint(); | 127 | virtual int maxDatesHint(); |
123 | 128 | ||
124 | /** Returns number of currently shown dates. */ | 129 | /** Returns number of currently shown dates. */ |
125 | virtual int currentDateCount(); | 130 | virtual int currentDateCount(); |
126 | 131 | ||
127 | /** returns the currently selected events */ | 132 | /** returns the currently selected events */ |
128 | virtual QPtrList<Incidence> selectedIncidences(); | 133 | virtual QPtrList<Incidence> selectedIncidences(); |
129 | 134 | ||
130 | /** returns the currently selected events */ | 135 | /** returns the currently selected events */ |
131 | virtual DateList selectedDates(); | 136 | virtual DateList selectedDates(); |
132 | 137 | ||
133 | /** Remove all events from view */ | 138 | /** Remove all events from view */ |
134 | void clearView(); | 139 | void clearView(); |
135 | KOAgenda *agenda() { return mAgenda;} | 140 | KOAgenda *agenda() { return mAgenda;} |
136 | virtual void printPreview(CalPrinter *calPrinter, | 141 | virtual void printPreview(CalPrinter *calPrinter, |
137 | const QDate &, const QDate &); | 142 | const QDate &, const QDate &); |
138 | 143 | ||
139 | /** start-datetime of selection */ | 144 | /** start-datetime of selection */ |
140 | QDateTime selectionStart() {return mTimeSpanBegin;} | 145 | QDateTime selectionStart() {return mTimeSpanBegin;} |
141 | /** end-datetime of selection */ | 146 | /** end-datetime of selection */ |
142 | QDateTime selectionEnd() {return mTimeSpanEnd;} | 147 | QDateTime selectionEnd() {return mTimeSpanEnd;} |
143 | /** returns true if selection is for whole day */ | 148 | /** returns true if selection is for whole day */ |
144 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} | 149 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} |
145 | /** make selected start/end invalid */ | 150 | /** make selected start/end invalid */ |
146 | void deleteSelectedDateTime(); | 151 | void deleteSelectedDateTime(); |
147 | void repaintAgenda(); | 152 | void repaintAgenda(); |
148 | public slots: | 153 | public slots: |
149 | virtual void updateView(); | 154 | virtual void updateView(); |
150 | virtual void updateConfig(); | 155 | virtual void updateConfig(); |
151 | virtual void showDates(const QDate &start, const QDate &end); | 156 | virtual void showDates(const QDate &start, const QDate &end); |
152 | virtual void showEvents(QPtrList<Event> eventList); | 157 | virtual void showEvents(QPtrList<Event> eventList); |
153 | 158 | ||
154 | void updateTodo( Todo *, int ); | 159 | void updateTodo( Todo *, int ); |
155 | void changeEventDisplay(Event *, int); | 160 | void changeEventDisplay(Event *, int); |
156 | 161 | ||
157 | void clearSelection(); | 162 | void clearSelection(); |
158 | 163 | ||
159 | void newEvent(int gx,int gy); | 164 | void newEvent(int gx,int gy); |
160 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); | 165 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); |
161 | void newEventAllDay(int gx, int gy); | 166 | void newEventAllDay(int gx, int gy); |
162 | 167 | ||
163 | void startDrag(Event *); | 168 | void startDrag(Event *); |
164 | 169 | ||
165 | void readSettings(); | 170 | void readSettings(); |
166 | void readSettings(KConfig *); | 171 | void readSettings(KConfig *); |
167 | void writeSettings(KConfig *); | 172 | void writeSettings(KConfig *); |
168 | 173 | ||
169 | void setContentsPos(int y); | 174 | void setContentsPos(int y); |
170 | 175 | ||
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp index c99c0cb..41a4dc1 100644 --- a/korganizer/kodialogmanager.cpp +++ b/korganizer/kodialogmanager.cpp | |||
@@ -200,142 +200,147 @@ void KODialogManager::showSearchDialog() | |||
200 | QStringList list; | 200 | QStringList list; |
201 | list = config->readListEntry("SearchLayout"); | 201 | list = config->readListEntry("SearchLayout"); |
202 | int x,y,w,h; | 202 | int x,y,w,h; |
203 | if ( ! list.isEmpty() ) { | 203 | if ( ! list.isEmpty() ) { |
204 | x = list[0].toInt(); | 204 | x = list[0].toInt(); |
205 | y = list[1].toInt(); | 205 | y = list[1].toInt(); |
206 | w = list[2].toInt(); | 206 | w = list[2].toInt(); |
207 | h = list[3].toInt(); | 207 | h = list[3].toInt(); |
208 | mSearchDialog->setGeometry(x,y,w,h); | 208 | mSearchDialog->setGeometry(x,y,w,h); |
209 | 209 | ||
210 | } | 210 | } |
211 | 211 | ||
212 | #endif | 212 | #endif |
213 | } | 213 | } |
214 | // make sure the widget is on top again | 214 | // make sure the widget is on top again |
215 | mSearchDialog->show(); | 215 | mSearchDialog->show(); |
216 | mSearchDialog->raise(); | 216 | mSearchDialog->raise(); |
217 | } | 217 | } |
218 | 218 | ||
219 | SearchDialog * KODialogManager::getSearchDialog() | 219 | SearchDialog * KODialogManager::getSearchDialog() |
220 | { | 220 | { |
221 | return mSearchDialog; | 221 | return mSearchDialog; |
222 | } | 222 | } |
223 | void KODialogManager::showArchiveDialog() | 223 | void KODialogManager::showArchiveDialog() |
224 | { | 224 | { |
225 | #ifndef KORG_NOARCHIVE | 225 | #ifndef KORG_NOARCHIVE |
226 | if (!mArchiveDialog) { | 226 | if (!mArchiveDialog) { |
227 | mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); | 227 | mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); |
228 | connect(mArchiveDialog,SIGNAL(eventsDeleted()), | 228 | connect(mArchiveDialog,SIGNAL(eventsDeleted()), |
229 | mMainView,SLOT(updateView())); | 229 | mMainView,SLOT(updateView())); |
230 | } | 230 | } |
231 | mArchiveDialog->show(); | 231 | mArchiveDialog->show(); |
232 | mArchiveDialog->raise(); | 232 | mArchiveDialog->raise(); |
233 | 233 | ||
234 | // Workaround. | 234 | // Workaround. |
235 | QApplication::restoreOverrideCursor(); | 235 | QApplication::restoreOverrideCursor(); |
236 | #endif | 236 | #endif |
237 | } | 237 | } |
238 | 238 | ||
239 | void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters) | 239 | void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters) |
240 | { | 240 | { |
241 | if (!mFilterEditDialog) { | 241 | if (!mFilterEditDialog) { |
242 | mFilterEditDialog = new FilterEditDialog(filters,mMainView); | 242 | mFilterEditDialog = new FilterEditDialog(filters,mMainView); |
243 | connect(mFilterEditDialog,SIGNAL(filterChanged()), | 243 | connect(mFilterEditDialog,SIGNAL(filterChanged()), |
244 | mMainView,SLOT(filterEdited())); | 244 | mMainView,SLOT(filterEdited())); |
245 | 245 | ||
246 | } | 246 | } |
247 | 247 | ||
248 | #ifndef DESKTOP_VERSION | 248 | #ifndef DESKTOP_VERSION |
249 | mFilterEditDialog->showMaximized(); | 249 | mFilterEditDialog->showMaximized(); |
250 | #else | 250 | #else |
251 | mFilterEditDialog->show(); | 251 | mFilterEditDialog->show(); |
252 | #endif | 252 | #endif |
253 | mFilterEditDialog->raise(); | 253 | mFilterEditDialog->raise(); |
254 | } | 254 | } |
255 | 255 | ||
256 | void KODialogManager::showPluginDialog() | 256 | void KODialogManager::showPluginDialog() |
257 | { | 257 | { |
258 | #ifndef KORG_NOPLUGINS | 258 | #ifndef KORG_NOPLUGINS |
259 | if (!mPluginDialog) { | 259 | if (!mPluginDialog) { |
260 | mPluginDialog = new PluginDialog(mMainView); | 260 | mPluginDialog = new PluginDialog(mMainView); |
261 | connect(mPluginDialog,SIGNAL(configChanged()), | 261 | connect(mPluginDialog,SIGNAL(configChanged()), |
262 | mMainView,SLOT(updateConfig())); | 262 | mMainView,SLOT(updateConfig())); |
263 | } | 263 | } |
264 | mPluginDialog->show(); | 264 | mPluginDialog->show(); |
265 | mPluginDialog->raise(); | 265 | mPluginDialog->raise(); |
266 | #endif | 266 | #endif |
267 | } | 267 | } |
268 | 268 | ||
269 | KOEventEditor *KODialogManager::getEventEditor() | 269 | KOEventEditor *KODialogManager::getEventEditor() |
270 | { | 270 | { |
271 | KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(), | 271 | KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(), |
272 | mMainView ); | 272 | mMainView ); |
273 | 273 | ||
274 | connect(eventEditor,SIGNAL(eventAdded(Event *)), | 274 | connect(eventEditor,SIGNAL(eventAdded(Event *)), |
275 | mMainView,SLOT(eventAdded(Event *))); | 275 | mMainView,SLOT(eventAdded(Event *))); |
276 | connect(eventEditor,SIGNAL(eventChanged(Event *)), | 276 | connect(eventEditor,SIGNAL(eventChanged(Event *)), |
277 | mMainView,SLOT(eventChanged(Event *))); | 277 | mMainView,SLOT(eventChanged(Event *))); |
278 | connect(eventEditor,SIGNAL(eventDeleted()), | 278 | connect(eventEditor,SIGNAL(eventDeleted()), |
279 | mMainView,SLOT(eventDeleted())); | 279 | mMainView,SLOT(eventDeleted())); |
280 | connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)), | 280 | connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)), |
281 | mMainView,SLOT(schedule_cancel(Incidence *))); | 281 | mMainView,SLOT(schedule_cancel(Incidence *))); |
282 | connect( eventEditor, SIGNAL(jumpToTime( const QDate &)), | 282 | connect( eventEditor, SIGNAL(jumpToTime( const QDate &)), |
283 | mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 283 | mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
284 | connect( eventEditor, SIGNAL( showAgendaView( bool)), | 284 | connect( eventEditor, SIGNAL( showAgendaView( bool)), |
285 | mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); | 285 | mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); |
286 | 286 | ||
287 | // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), | 287 | // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), |
288 | // eventEditor,SLOT(updateCategoryConfig())); | 288 | // eventEditor,SLOT(updateCategoryConfig())); |
289 | // connect(eventEditor,SIGNAL(editCategories()), | 289 | // connect(eventEditor,SIGNAL(editCategories()), |
290 | // mCategoryEditDialog,SLOT(show())); | 290 | // mCategoryEditDialog,SLOT(show())); |
291 | connect(eventEditor,SIGNAL(dialogClose(Incidence*)), | 291 | connect(eventEditor,SIGNAL(dialogClose(Incidence*)), |
292 | mMainView,SLOT(dialogClosing(Incidence*))); | 292 | mMainView,SLOT(dialogClosing(Incidence*))); |
293 | 293 | ||
294 | //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject())); | 294 | //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject())); |
295 | 295 | ||
296 | #ifndef DESKTOP_VERSION | ||
297 | eventEditor->resize( QApplication::desktop()->width() -20, 100 ); | ||
298 | #endif | ||
296 | return eventEditor; | 299 | return eventEditor; |
297 | } | 300 | } |
298 | 301 | ||
299 | KOTodoEditor *KODialogManager::getTodoEditor() | 302 | KOTodoEditor *KODialogManager::getTodoEditor() |
300 | { | 303 | { |
301 | KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), | 304 | KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), |
302 | mMainView ); | 305 | mMainView ); |
303 | 306 | ||
304 | // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), | 307 | // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), |
305 | // todoEditor,SLOT(updateCategoryConfig())); | 308 | // todoEditor,SLOT(updateCategoryConfig())); |
306 | // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show())); | 309 | // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show())); |
307 | 310 | ||
308 | connect(todoEditor,SIGNAL(todoAdded(Todo *)), | 311 | connect(todoEditor,SIGNAL(todoAdded(Todo *)), |
309 | mMainView,SLOT(todoAdded(Todo *))); | 312 | mMainView,SLOT(todoAdded(Todo *))); |
310 | connect(todoEditor,SIGNAL(todoChanged(Todo *)), | 313 | connect(todoEditor,SIGNAL(todoChanged(Todo *)), |
311 | mMainView,SLOT(todoChanged(Todo *))); | 314 | mMainView,SLOT(todoChanged(Todo *))); |
312 | connect(todoEditor,SIGNAL(todoDeleted()), | 315 | connect(todoEditor,SIGNAL(todoDeleted()), |
313 | mMainView,SLOT(todoDeleted())); | 316 | mMainView,SLOT(todoDeleted())); |
314 | connect(todoEditor,SIGNAL(dialogClose(Incidence*)), | 317 | connect(todoEditor,SIGNAL(dialogClose(Incidence*)), |
315 | mMainView,SLOT(dialogClosing(Incidence*))); | 318 | mMainView,SLOT(dialogClosing(Incidence*))); |
316 | connect( todoEditor, SIGNAL(jumpToTime( const QDate &)), | 319 | connect( todoEditor, SIGNAL(jumpToTime( const QDate &)), |
317 | mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 320 | mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
318 | connect( todoEditor, SIGNAL( showAgendaView( bool)), | 321 | connect( todoEditor, SIGNAL( showAgendaView( bool)), |
319 | mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); | 322 | mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); |
320 | // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)), | 323 | // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)), |
321 | // mMainView,SLOT(schedule_cancel(Incidence *))); | 324 | // mMainView,SLOT(schedule_cancel(Incidence *))); |
322 | //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject())); | 325 | //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject())); |
323 | 326 | #ifndef DESKTOP_VERSION | |
327 | todoEditor->resize( QApplication::desktop()->width() -20, 100 ); | ||
328 | #endif | ||
324 | return todoEditor; | 329 | return todoEditor; |
325 | } | 330 | } |
326 | 331 | ||
327 | void KODialogManager::updateSearchDialog() | 332 | void KODialogManager::updateSearchDialog() |
328 | { | 333 | { |
329 | if (mSearchDialog) mSearchDialog->updateView(); | 334 | if (mSearchDialog) mSearchDialog->updateView(); |
330 | } | 335 | } |
331 | 336 | ||
332 | void KODialogManager::setDocumentId( const QString &id ) | 337 | void KODialogManager::setDocumentId( const QString &id ) |
333 | { | 338 | { |
334 | if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id ); | 339 | if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id ); |
335 | } | 340 | } |
336 | 341 | ||
337 | void KODialogManager::writeSettings( KConfig *config ) | 342 | void KODialogManager::writeSettings( KConfig *config ) |
338 | { | 343 | { |
339 | if (mSearchDialog) | 344 | if (mSearchDialog) |
340 | mSearchDialog->listview()->writeSettings(config,"SearchListView Layout"); | 345 | mSearchDialog->listview()->writeSettings(config,"SearchListView Layout"); |
341 | } | 346 | } |