-rw-r--r-- | korganizer/calendarview.cpp | 54 | ||||
-rw-r--r-- | korganizer/calendarview.h | 3 | ||||
-rw-r--r-- | korganizer/koeventviewer.h | 2 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 21 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.h | 10 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 8 | ||||
-rw-r--r-- | korganizer/kolistview.h | 1 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 22 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 1 |
9 files changed, 111 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3dac20b..1009956 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -184,100 +184,104 @@ class KOCatPrefs : public QDialog | |||
184 | lay->setSpacing( 3 ); | 184 | lay->setSpacing( 3 ); |
185 | lay->setMargin( 3 ); | 185 | lay->setMargin( 3 ); |
186 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 186 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
187 | lay->addWidget( lab ); | 187 | lay->addWidget( lab ); |
188 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 188 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
189 | lay->addWidget( format ); | 189 | lay->addWidget( format ); |
190 | format->setExclusive ( true ) ; | 190 | format->setExclusive ( true ) ; |
191 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 191 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
192 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 192 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
193 | addCatBut->setChecked( true ); | 193 | addCatBut->setChecked( true ); |
194 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 194 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
195 | lay->addWidget( ok ); | 195 | lay->addWidget( ok ); |
196 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 196 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
197 | lay->addWidget( cancel ); | 197 | lay->addWidget( cancel ); |
198 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 198 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
199 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 199 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
200 | resize( 200, 200 ); | 200 | resize( 200, 200 ); |
201 | } | 201 | } |
202 | 202 | ||
203 | bool addCat() { return addCatBut->isChecked(); } | 203 | bool addCat() { return addCatBut->isChecked(); } |
204 | private: | 204 | private: |
205 | QRadioButton* addCatBut; | 205 | QRadioButton* addCatBut; |
206 | }; | 206 | }; |
207 | 207 | ||
208 | 208 | ||
209 | 209 | ||
210 | CalendarView::CalendarView( CalendarResources *calendar, | 210 | CalendarView::CalendarView( CalendarResources *calendar, |
211 | QWidget *parent, const char *name ) | 211 | QWidget *parent, const char *name ) |
212 | : CalendarViewBase( parent, name ), | 212 | : CalendarViewBase( parent, name ), |
213 | mCalendar( calendar ), | 213 | mCalendar( calendar ), |
214 | mResourceManager( calendar->resourceManager() ) | 214 | mResourceManager( calendar->resourceManager() ) |
215 | { | 215 | { |
216 | 216 | ||
217 | mEventEditor = 0; | 217 | mEventEditor = 0; |
218 | mTodoEditor = 0; | 218 | mTodoEditor = 0; |
219 | 219 | ||
220 | init(); | 220 | init(); |
221 | } | 221 | } |
222 | 222 | ||
223 | CalendarView::CalendarView( Calendar *calendar, | 223 | CalendarView::CalendarView( Calendar *calendar, |
224 | QWidget *parent, const char *name ) | 224 | QWidget *parent, const char *name ) |
225 | : CalendarViewBase( parent, name ), | 225 | : CalendarViewBase( parent, name ), |
226 | mCalendar( calendar ), | 226 | mCalendar( calendar ), |
227 | mResourceManager( 0 ) | 227 | mResourceManager( 0 ) |
228 | { | 228 | { |
229 | 229 | ||
230 | mEventEditor = 0; | 230 | mEventEditor = 0; |
231 | mTodoEditor = 0; | 231 | mTodoEditor = 0; |
232 | init();} | 232 | init(); |
233 | } | ||
233 | 234 | ||
234 | void CalendarView::init() | 235 | void CalendarView::init() |
235 | { | 236 | { |
237 | |||
238 | setFocusPolicy ( WheelFocus ); | ||
239 | mViewerCallerIsSearchDialog = false; | ||
236 | mBlockShowDates = false; | 240 | mBlockShowDates = false; |
237 | beamDialog = new KOBeamPrefs(); | 241 | beamDialog = new KOBeamPrefs(); |
238 | mDatePickerMode = 0; | 242 | mDatePickerMode = 0; |
239 | mCurrentSyncDevice = ""; | 243 | mCurrentSyncDevice = ""; |
240 | writeLocale(); | 244 | writeLocale(); |
241 | mViewManager = new KOViewManager( this ); | 245 | mViewManager = new KOViewManager( this ); |
242 | mDialogManager = new KODialogManager( this ); | 246 | mDialogManager = new KODialogManager( this ); |
243 | mEventViewerDialog = 0; | 247 | mEventViewerDialog = 0; |
244 | mModified = false; | 248 | mModified = false; |
245 | mReadOnly = false; | 249 | mReadOnly = false; |
246 | mSelectedIncidence = 0; | 250 | mSelectedIncidence = 0; |
247 | mCalPrinter = 0; | 251 | mCalPrinter = 0; |
248 | mFilters.setAutoDelete(true); | 252 | mFilters.setAutoDelete(true); |
249 | 253 | ||
250 | mCalendar->registerObserver( this ); | 254 | mCalendar->registerObserver( this ); |
251 | // TODO: Make sure that view is updated, when calendar is changed. | 255 | // TODO: Make sure that view is updated, when calendar is changed. |
252 | 256 | ||
253 | mStorage = new FileStorage( mCalendar ); | 257 | mStorage = new FileStorage( mCalendar ); |
254 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 258 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
255 | 259 | ||
256 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 260 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
257 | #ifndef KORG_NOSPLITTER | 261 | #ifndef KORG_NOSPLITTER |
258 | // create the main layout frames. | 262 | // create the main layout frames. |
259 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 263 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
260 | topLayout->addWidget(mPanner); | 264 | topLayout->addWidget(mPanner); |
261 | 265 | ||
262 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 266 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
263 | "CalendarView::LeftFrame"); | 267 | "CalendarView::LeftFrame"); |
264 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 268 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
265 | 269 | ||
266 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, | 270 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, |
267 | "CalendarView::DateNavigator", QDate::currentDate() ); | 271 | "CalendarView::DateNavigator", QDate::currentDate() ); |
268 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 272 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
269 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 273 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
270 | mTodoList->setNavigator( mNavigator ); | 274 | mTodoList->setNavigator( mNavigator ); |
271 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 275 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
272 | 276 | ||
273 | #ifdef KORG_NORESOURCEVIEW | 277 | #ifdef KORG_NORESOURCEVIEW |
274 | mResourceView = 0; | 278 | mResourceView = 0; |
275 | #else | 279 | #else |
276 | if ( mResourceManager ) { | 280 | if ( mResourceManager ) { |
277 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 281 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
278 | mResourceView->updateView(); | 282 | mResourceView->updateView(); |
279 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 283 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
280 | SLOT( updateView() ) ); | 284 | SLOT( updateView() ) ); |
281 | } else { | 285 | } else { |
282 | mResourceView = 0; | 286 | mResourceView = 0; |
283 | } | 287 | } |
@@ -2575,260 +2579,274 @@ void CalendarView::beamIncidence() | |||
2575 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2579 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2576 | if ( incidence ) { | 2580 | if ( incidence ) { |
2577 | beamIncidence(incidence); | 2581 | beamIncidence(incidence); |
2578 | } | 2582 | } |
2579 | } | 2583 | } |
2580 | void CalendarView::toggleCancelIncidence() | 2584 | void CalendarView::toggleCancelIncidence() |
2581 | { | 2585 | { |
2582 | Incidence *incidence = currentSelection(); | 2586 | Incidence *incidence = currentSelection(); |
2583 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2587 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2584 | if ( incidence ) { | 2588 | if ( incidence ) { |
2585 | cancelIncidence(incidence); | 2589 | cancelIncidence(incidence); |
2586 | } | 2590 | } |
2587 | } | 2591 | } |
2588 | 2592 | ||
2589 | 2593 | ||
2590 | void CalendarView::cancelIncidence(Incidence * inc ) | 2594 | void CalendarView::cancelIncidence(Incidence * inc ) |
2591 | { | 2595 | { |
2592 | inc->setCancelled( ! inc->cancelled() ); | 2596 | inc->setCancelled( ! inc->cancelled() ); |
2593 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 2597 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
2594 | updateView(); | 2598 | updateView(); |
2595 | } | 2599 | } |
2596 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 2600 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
2597 | { | 2601 | { |
2598 | Incidence * newInc = orgInc->clone(); | 2602 | Incidence * newInc = orgInc->clone(); |
2599 | newInc->recreate(); | 2603 | newInc->recreate(); |
2600 | 2604 | ||
2601 | if ( newInc->type() == "Todo" ) { | 2605 | if ( newInc->type() == "Todo" ) { |
2602 | Todo* t = (Todo*) newInc; | 2606 | Todo* t = (Todo*) newInc; |
2603 | showTodoEditor(); | 2607 | showTodoEditor(); |
2604 | mTodoEditor->editTodo( t ); | 2608 | mTodoEditor->editTodo( t ); |
2605 | if ( mTodoEditor->exec() ) { | 2609 | if ( mTodoEditor->exec() ) { |
2606 | mCalendar->addTodo( t ); | 2610 | mCalendar->addTodo( t ); |
2607 | updateView(); | 2611 | updateView(); |
2608 | } else { | 2612 | } else { |
2609 | delete t; | 2613 | delete t; |
2610 | } | 2614 | } |
2611 | } | 2615 | } |
2612 | else { | 2616 | else { |
2613 | Event* e = (Event*) newInc; | 2617 | Event* e = (Event*) newInc; |
2614 | showEventEditor(); | 2618 | showEventEditor(); |
2615 | mEventEditor->editEvent( e ); | 2619 | mEventEditor->editEvent( e ); |
2616 | if ( mEventEditor->exec() ) { | 2620 | if ( mEventEditor->exec() ) { |
2617 | mCalendar->addEvent( e ); | 2621 | mCalendar->addEvent( e ); |
2618 | updateView(); | 2622 | updateView(); |
2619 | } else { | 2623 | } else { |
2620 | delete e; | 2624 | delete e; |
2621 | } | 2625 | } |
2622 | } | 2626 | } |
2627 | setActiveWindow(); | ||
2623 | } | 2628 | } |
2624 | 2629 | ||
2625 | void CalendarView::newEvent() | 2630 | void CalendarView::newEvent() |
2626 | { | 2631 | { |
2627 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 2632 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
2628 | KOAgendaView *aView = mViewManager->agendaView(); | 2633 | KOAgendaView *aView = mViewManager->agendaView(); |
2629 | if (aView) { | 2634 | if (aView) { |
2630 | if (aView->selectionStart().isValid()) { | 2635 | if (aView->selectionStart().isValid()) { |
2631 | if (aView->selectedIsAllDay()) { | 2636 | if (aView->selectedIsAllDay()) { |
2632 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 2637 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
2633 | } else { | 2638 | } else { |
2634 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 2639 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
2635 | } | 2640 | } |
2636 | return; | 2641 | return; |
2637 | } | 2642 | } |
2638 | } | 2643 | } |
2639 | 2644 | ||
2640 | QDate date = mNavigator->selectedDates().first(); | 2645 | QDate date = mNavigator->selectedDates().first(); |
2641 | QDateTime current = QDateTime::currentDateTime(); | 2646 | QDateTime current = QDateTime::currentDateTime(); |
2642 | if ( date <= current.date() ) { | 2647 | if ( date <= current.date() ) { |
2643 | int hour = current.time().hour() +1; | 2648 | int hour = current.time().hour() +1; |
2644 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 2649 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
2645 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2650 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2646 | } else | 2651 | } else |
2647 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 2652 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
2648 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 2653 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
2649 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2654 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2650 | } | 2655 | } |
2651 | 2656 | ||
2652 | void CalendarView::newEvent(QDateTime fh) | 2657 | void CalendarView::newEvent(QDateTime fh) |
2653 | { | 2658 | { |
2654 | newEvent(fh, | 2659 | newEvent(fh, |
2655 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 2660 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
2656 | } | 2661 | } |
2657 | 2662 | ||
2658 | void CalendarView::newEvent(QDate dt) | 2663 | void CalendarView::newEvent(QDate dt) |
2659 | { | 2664 | { |
2660 | newEvent(QDateTime(dt, QTime(0,0,0)), | 2665 | newEvent(QDateTime(dt, QTime(0,0,0)), |
2661 | QDateTime(dt, QTime(0,0,0)), true); | 2666 | QDateTime(dt, QTime(0,0,0)), true); |
2662 | } | 2667 | } |
2663 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) | 2668 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) |
2664 | { | 2669 | { |
2665 | newEvent(fromHint, toHint, false); | 2670 | newEvent(fromHint, toHint, false); |
2666 | } | 2671 | } |
2667 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 2672 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
2668 | { | 2673 | { |
2669 | 2674 | ||
2670 | showEventEditor(); | 2675 | showEventEditor(); |
2671 | mEventEditor->newEvent(fromHint,toHint,allDay); | 2676 | mEventEditor->newEvent(fromHint,toHint,allDay); |
2672 | if ( mFilterView->filtersEnabled() ) { | 2677 | if ( mFilterView->filtersEnabled() ) { |
2673 | CalFilter *filter = mFilterView->selectedFilter(); | 2678 | CalFilter *filter = mFilterView->selectedFilter(); |
2674 | if (filter && filter->showCategories()) { | 2679 | if (filter && filter->showCategories()) { |
2675 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 2680 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
2676 | } | 2681 | } |
2677 | if ( filter ) | 2682 | if ( filter ) |
2678 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 2683 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
2679 | } | 2684 | } |
2685 | mEventEditor->exec(); | ||
2686 | setActiveWindow(); | ||
2680 | } | 2687 | } |
2681 | void CalendarView::todoAdded(Todo * t) | 2688 | void CalendarView::todoAdded(Todo * t) |
2682 | { | 2689 | { |
2683 | 2690 | ||
2684 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 2691 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
2685 | updateTodoViews(); | 2692 | updateTodoViews(); |
2686 | } | 2693 | } |
2687 | void CalendarView::todoChanged(Todo * t) | 2694 | void CalendarView::todoChanged(Todo * t) |
2688 | { | 2695 | { |
2689 | emit todoModified( t, 4 ); | 2696 | emit todoModified( t, 4 ); |
2690 | // updateTodoViews(); | 2697 | // updateTodoViews(); |
2691 | } | 2698 | } |
2692 | void CalendarView::todoToBeDeleted(Todo *) | 2699 | void CalendarView::todoToBeDeleted(Todo *) |
2693 | { | 2700 | { |
2694 | //qDebug("todoToBeDeleted(Todo *) "); | 2701 | //qDebug("todoToBeDeleted(Todo *) "); |
2695 | updateTodoViews(); | 2702 | updateTodoViews(); |
2696 | } | 2703 | } |
2697 | void CalendarView::todoDeleted() | 2704 | void CalendarView::todoDeleted() |
2698 | { | 2705 | { |
2699 | //qDebug(" todoDeleted()"); | 2706 | //qDebug(" todoDeleted()"); |
2700 | updateTodoViews(); | 2707 | updateTodoViews(); |
2701 | } | 2708 | } |
2702 | 2709 | ||
2703 | 2710 | ||
2704 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) | 2711 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) |
2705 | { | 2712 | { |
2706 | showTodoEditor(); | 2713 | showTodoEditor(); |
2707 | mTodoEditor->newTodo(dt,0,allday); | 2714 | mTodoEditor->newTodo(dt,0,allday); |
2708 | if ( mFilterView->filtersEnabled() ) { | 2715 | if ( mFilterView->filtersEnabled() ) { |
2709 | CalFilter *filter = mFilterView->selectedFilter(); | 2716 | CalFilter *filter = mFilterView->selectedFilter(); |
2710 | if (filter && filter->showCategories()) { | 2717 | if (filter && filter->showCategories()) { |
2711 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 2718 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
2712 | } | 2719 | } |
2713 | if ( filter ) | 2720 | if ( filter ) |
2714 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 2721 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
2715 | } | 2722 | } |
2723 | mTodoEditor->exec(); | ||
2724 | setActiveWindow(); | ||
2716 | } | 2725 | } |
2717 | 2726 | ||
2718 | void CalendarView::newTodo() | 2727 | void CalendarView::newTodo() |
2719 | { | 2728 | { |
2720 | newTodoDateTime( QDateTime(),true ); | 2729 | newTodoDateTime( QDateTime(),true ); |
2721 | } | 2730 | } |
2722 | 2731 | ||
2723 | void CalendarView::newSubTodo() | 2732 | void CalendarView::newSubTodo() |
2724 | { | 2733 | { |
2725 | Todo *todo = selectedTodo(); | 2734 | Todo *todo = selectedTodo(); |
2726 | if ( todo ) newSubTodo( todo ); | 2735 | if ( todo ) newSubTodo( todo ); |
2727 | } | 2736 | } |
2728 | 2737 | ||
2729 | void CalendarView::newSubTodo(Todo *parentEvent) | 2738 | void CalendarView::newSubTodo(Todo *parentEvent) |
2730 | { | 2739 | { |
2731 | 2740 | ||
2732 | showTodoEditor(); | 2741 | showTodoEditor(); |
2733 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); | 2742 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); |
2743 | mTodoEditor->exec(); | ||
2744 | setActiveWindow(); | ||
2734 | } | 2745 | } |
2735 | 2746 | ||
2736 | void CalendarView::newFloatingEvent() | 2747 | void CalendarView::newFloatingEvent() |
2737 | { | 2748 | { |
2738 | DateList tmpList = mNavigator->selectedDates(); | 2749 | DateList tmpList = mNavigator->selectedDates(); |
2739 | QDate date = tmpList.first(); | 2750 | QDate date = tmpList.first(); |
2740 | 2751 | ||
2741 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 2752 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
2742 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 2753 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
2743 | } | 2754 | } |
2744 | 2755 | ||
2745 | 2756 | ||
2746 | void CalendarView::editEvent( Event *event ) | 2757 | void CalendarView::editEvent( Event *event ) |
2747 | { | 2758 | { |
2748 | 2759 | ||
2749 | if ( !event ) return; | 2760 | if ( !event ) return; |
2750 | if ( event->isReadOnly() ) { | 2761 | if ( event->isReadOnly() ) { |
2751 | showEvent( event ); | 2762 | showEvent( event ); |
2752 | return; | 2763 | return; |
2753 | } | 2764 | } |
2754 | showEventEditor(); | 2765 | showEventEditor(); |
2755 | mEventEditor->editEvent( event , mFlagEditDescription); | 2766 | mEventEditor->editEvent( event , mFlagEditDescription); |
2767 | mEventEditor->exec(); | ||
2768 | setActiveWindow(); | ||
2769 | |||
2756 | } | 2770 | } |
2757 | void CalendarView::editJournal( Journal *jour ) | 2771 | void CalendarView::editJournal( Journal *jour ) |
2758 | { | 2772 | { |
2759 | if ( !jour ) return; | 2773 | if ( !jour ) return; |
2760 | mDialogManager->hideSearchDialog(); | 2774 | mDialogManager->hideSearchDialog(); |
2761 | mViewManager->showJournalView(); | 2775 | mViewManager->showJournalView(); |
2762 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 2776 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
2763 | } | 2777 | } |
2764 | void CalendarView::editTodo( Todo *todo ) | 2778 | void CalendarView::editTodo( Todo *todo ) |
2765 | { | 2779 | { |
2766 | if ( !todo ) return; | 2780 | if ( !todo ) return; |
2767 | 2781 | ||
2768 | if ( todo->isReadOnly() ) { | 2782 | if ( todo->isReadOnly() ) { |
2769 | showTodo( todo ); | 2783 | showTodo( todo ); |
2770 | return; | 2784 | return; |
2771 | } | 2785 | } |
2772 | showTodoEditor(); | 2786 | showTodoEditor(); |
2773 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 2787 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
2788 | mTodoEditor->exec(); | ||
2789 | setActiveWindow(); | ||
2774 | 2790 | ||
2775 | } | 2791 | } |
2776 | 2792 | ||
2777 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 2793 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
2778 | { | 2794 | { |
2779 | if ( !mEventViewerDialog ) { | 2795 | if ( !mEventViewerDialog ) { |
2780 | mEventViewerDialog = new KOEventViewerDialog(this); | 2796 | mEventViewerDialog = new KOEventViewerDialog(this); |
2781 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 2797 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
2782 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 2798 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
2783 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 2799 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
2784 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 2800 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
2785 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 2801 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
2786 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 2802 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
2803 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), | ||
2804 | this, SLOT( slotViewerClosed() ) ); | ||
2787 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), | 2805 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), |
2788 | this, SLOT( todoChanged(Todo *) ) ); | 2806 | this, SLOT( todoChanged(Todo *) ) ); |
2789 | mEventViewerDialog->resize( 640, 480 ); | 2807 | mEventViewerDialog->resize( 640, 480 ); |
2790 | 2808 | ||
2791 | } | 2809 | } |
2792 | return mEventViewerDialog; | 2810 | return mEventViewerDialog; |
2793 | } | 2811 | } |
2794 | void CalendarView::showEvent(Event *event) | 2812 | void CalendarView::showEvent(Event *event) |
2795 | { | 2813 | { |
2796 | getEventViewerDialog()->setEvent(event); | 2814 | getEventViewerDialog()->setEvent(event); |
2797 | getEventViewerDialog()->showMe(); | 2815 | getEventViewerDialog()->showMe(); |
2798 | } | 2816 | } |
2799 | 2817 | ||
2800 | void CalendarView::showTodo(Todo *event) | 2818 | void CalendarView::showTodo(Todo *event) |
2801 | { | 2819 | { |
2802 | getEventViewerDialog()->setTodo(event); | 2820 | getEventViewerDialog()->setTodo(event); |
2803 | getEventViewerDialog()->showMe(); | 2821 | getEventViewerDialog()->showMe(); |
2804 | } | 2822 | } |
2805 | void CalendarView::showJournal( Journal *jour ) | 2823 | void CalendarView::showJournal( Journal *jour ) |
2806 | { | 2824 | { |
2807 | getEventViewerDialog()->setJournal(jour); | 2825 | getEventViewerDialog()->setJournal(jour); |
2808 | getEventViewerDialog()->showMe(); | 2826 | getEventViewerDialog()->showMe(); |
2809 | 2827 | ||
2810 | } | 2828 | } |
2811 | // void CalendarView::todoModified (Todo *event, int changed) | 2829 | // void CalendarView::todoModified (Todo *event, int changed) |
2812 | // { | 2830 | // { |
2813 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 2831 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
2814 | // // kdDebug() << "Todo modified and open" << endl; | 2832 | // // kdDebug() << "Todo modified and open" << endl; |
2815 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 2833 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
2816 | // // temp->modified (changed); | 2834 | // // temp->modified (changed); |
2817 | 2835 | ||
2818 | // // } | 2836 | // // } |
2819 | 2837 | ||
2820 | // mViewManager->updateView(); | 2838 | // mViewManager->updateView(); |
2821 | // } | 2839 | // } |
2822 | 2840 | ||
2823 | void CalendarView::appointment_show() | 2841 | void CalendarView::appointment_show() |
2824 | { | 2842 | { |
2825 | Event *anEvent = 0; | 2843 | Event *anEvent = 0; |
2826 | 2844 | ||
2827 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2845 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2828 | 2846 | ||
2829 | if (mViewManager->currentView()->isEventView()) { | 2847 | if (mViewManager->currentView()->isEventView()) { |
2830 | if ( incidence && incidence->type() == "Event" ) { | 2848 | if ( incidence && incidence->type() == "Event" ) { |
2831 | anEvent = static_cast<Event *>(incidence); | 2849 | anEvent = static_cast<Event *>(incidence); |
2832 | } | 2850 | } |
2833 | } | 2851 | } |
2834 | 2852 | ||
@@ -3693,131 +3711,139 @@ void CalendarView::toggleAllDaySize() | |||
3693 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 3711 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
3694 | */ | 3712 | */ |
3695 | viewManager()->agendaView()->toggleAllDay(); | 3713 | viewManager()->agendaView()->toggleAllDay(); |
3696 | } | 3714 | } |
3697 | void CalendarView::toggleExpand() | 3715 | void CalendarView::toggleExpand() |
3698 | { | 3716 | { |
3699 | // if ( mLeftFrame->isHidden() ) { | 3717 | // if ( mLeftFrame->isHidden() ) { |
3700 | // mLeftFrame->show(); | 3718 | // mLeftFrame->show(); |
3701 | // emit calendarViewExpanded( false ); | 3719 | // emit calendarViewExpanded( false ); |
3702 | // } else { | 3720 | // } else { |
3703 | // mLeftFrame->hide(); | 3721 | // mLeftFrame->hide(); |
3704 | // emit calendarViewExpanded( true ); | 3722 | // emit calendarViewExpanded( true ); |
3705 | // } | 3723 | // } |
3706 | //qDebug(" CalendarView::toggleExpand()"); | 3724 | //qDebug(" CalendarView::toggleExpand()"); |
3707 | globalFlagBlockAgenda = 1; | 3725 | globalFlagBlockAgenda = 1; |
3708 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 3726 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
3709 | globalFlagBlockAgenda = 5; | 3727 | globalFlagBlockAgenda = 5; |
3710 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 3728 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
3711 | //mViewManager->showView( 0, true ); | 3729 | //mViewManager->showView( 0, true ); |
3712 | } | 3730 | } |
3713 | 3731 | ||
3714 | void CalendarView::calendarModified( bool modified, Calendar * ) | 3732 | void CalendarView::calendarModified( bool modified, Calendar * ) |
3715 | { | 3733 | { |
3716 | setModified( modified ); | 3734 | setModified( modified ); |
3717 | } | 3735 | } |
3718 | 3736 | ||
3719 | Todo *CalendarView::selectedTodo() | 3737 | Todo *CalendarView::selectedTodo() |
3720 | { | 3738 | { |
3721 | Incidence *incidence = currentSelection(); | 3739 | Incidence *incidence = currentSelection(); |
3722 | if ( incidence && incidence->type() == "Todo" ) { | 3740 | if ( incidence && incidence->type() == "Todo" ) { |
3723 | return static_cast<Todo *>( incidence ); | 3741 | return static_cast<Todo *>( incidence ); |
3724 | } | 3742 | } |
3725 | 3743 | ||
3726 | incidence = mTodoList->selectedIncidences().first(); | 3744 | incidence = mTodoList->selectedIncidences().first(); |
3727 | if ( incidence && incidence->type() == "Todo" ) { | 3745 | if ( incidence && incidence->type() == "Todo" ) { |
3728 | return static_cast<Todo *>( incidence ); | 3746 | return static_cast<Todo *>( incidence ); |
3729 | } | 3747 | } |
3730 | 3748 | ||
3731 | return 0; | 3749 | return 0; |
3732 | } | 3750 | } |
3733 | 3751 | ||
3734 | void CalendarView::dialogClosing(Incidence *in) | 3752 | void CalendarView::dialogClosing(Incidence *in) |
3735 | { | 3753 | { |
3736 | // mDialogList.remove(in); | 3754 | // mDialogList.remove(in); |
3737 | } | 3755 | } |
3738 | 3756 | ||
3739 | void CalendarView::showIncidence() | 3757 | void CalendarView::showIncidence() |
3740 | { | 3758 | { |
3759 | mViewerCallerIsSearchDialog = false; | ||
3741 | Incidence *incidence = currentSelection(); | 3760 | Incidence *incidence = currentSelection(); |
3742 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3761 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3743 | if ( incidence ) { | 3762 | if ( incidence ) { |
3744 | ShowIncidenceVisitor v; | 3763 | ShowIncidenceVisitor v; |
3745 | v.act( incidence, this ); | 3764 | v.act( incidence, this ); |
3746 | } | 3765 | } |
3747 | } | 3766 | } |
3748 | void CalendarView::editIncidenceDescription() | 3767 | void CalendarView::editIncidenceDescription() |
3749 | { | 3768 | { |
3750 | mFlagEditDescription = true; | 3769 | mFlagEditDescription = true; |
3751 | editIncidence(); | 3770 | editIncidence(); |
3752 | mFlagEditDescription = false; | 3771 | mFlagEditDescription = false; |
3753 | } | 3772 | } |
3754 | void CalendarView::editIncidence() | 3773 | void CalendarView::editIncidence() |
3755 | { | 3774 | { |
3756 | // qDebug("editIncidence() "); | 3775 | // qDebug("editIncidence() "); |
3757 | Incidence *incidence = currentSelection(); | 3776 | Incidence *incidence = currentSelection(); |
3758 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3777 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3759 | if ( incidence ) { | 3778 | if ( incidence ) { |
3760 | EditIncidenceVisitor v; | 3779 | EditIncidenceVisitor v; |
3761 | v.act( incidence, this ); | 3780 | v.act( incidence, this ); |
3762 | } | 3781 | } |
3763 | } | 3782 | } |
3764 | 3783 | ||
3765 | void CalendarView::deleteIncidence() | 3784 | void CalendarView::deleteIncidence() |
3766 | { | 3785 | { |
3767 | Incidence *incidence = currentSelection(); | 3786 | Incidence *incidence = currentSelection(); |
3768 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 3787 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
3769 | if ( incidence ) { | 3788 | if ( incidence ) { |
3770 | deleteIncidence(incidence); | 3789 | deleteIncidence(incidence); |
3771 | } | 3790 | } |
3772 | } | 3791 | } |
3773 | 3792 | ||
3774 | void CalendarView::showIncidence(Incidence *incidence) | 3793 | void CalendarView::showIncidence(Incidence *incidence) |
3775 | { | 3794 | { |
3795 | mViewerCallerIsSearchDialog = false; | ||
3796 | //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); | ||
3797 | if ( sender() && mDialogManager->getSearchDialog() ) { | ||
3798 | if ( sender () == mDialogManager->getSearchDialog()->listview() ) { | ||
3799 | mViewerCallerIsSearchDialog = true; | ||
3800 | } | ||
3801 | } | ||
3776 | if ( incidence ) { | 3802 | if ( incidence ) { |
3777 | ShowIncidenceVisitor v; | 3803 | ShowIncidenceVisitor v; |
3778 | v.act( incidence, this ); | 3804 | v.act( incidence, this ); |
3779 | } | 3805 | } |
3780 | } | 3806 | } |
3781 | 3807 | ||
3782 | void CalendarView::editIncidence(Incidence *incidence) | 3808 | void CalendarView::editIncidence(Incidence *incidence) |
3783 | { | 3809 | { |
3784 | if ( incidence ) { | 3810 | if ( incidence ) { |
3785 | 3811 | ||
3786 | EditIncidenceVisitor v; | 3812 | EditIncidenceVisitor v; |
3787 | v.act( incidence, this ); | 3813 | v.act( incidence, this ); |
3788 | 3814 | ||
3789 | } | 3815 | } |
3790 | } | 3816 | } |
3791 | 3817 | ||
3792 | void CalendarView::deleteIncidence(Incidence *incidence) | 3818 | void CalendarView::deleteIncidence(Incidence *incidence) |
3793 | { | 3819 | { |
3794 | //qDebug(" CalendarView::deleteIncidence "); | 3820 | //qDebug(" CalendarView::deleteIncidence "); |
3795 | if ( incidence ) { | 3821 | if ( incidence ) { |
3796 | DeleteIncidenceVisitor v; | 3822 | DeleteIncidenceVisitor v; |
3797 | v.act( incidence, this ); | 3823 | v.act( incidence, this ); |
3798 | } | 3824 | } |
3799 | } | 3825 | } |
3800 | 3826 | ||
3801 | 3827 | ||
3802 | void CalendarView::lookForOutgoingMessages() | 3828 | void CalendarView::lookForOutgoingMessages() |
3803 | { | 3829 | { |
3804 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); | 3830 | OutgoingDialog *ogd = mDialogManager->outgoingDialog(); |
3805 | ogd->loadMessages(); | 3831 | ogd->loadMessages(); |
3806 | } | 3832 | } |
3807 | 3833 | ||
3808 | void CalendarView::lookForIncomingMessages() | 3834 | void CalendarView::lookForIncomingMessages() |
3809 | { | 3835 | { |
3810 | IncomingDialog *icd = mDialogManager->incomingDialog(); | 3836 | IncomingDialog *icd = mDialogManager->incomingDialog(); |
3811 | icd->retrieve(); | 3837 | icd->retrieve(); |
3812 | } | 3838 | } |
3813 | 3839 | ||
3814 | bool CalendarView::removeCompletedSubTodos( Todo* t ) | 3840 | bool CalendarView::removeCompletedSubTodos( Todo* t ) |
3815 | { | 3841 | { |
3816 | bool deleteTodo = true; | 3842 | bool deleteTodo = true; |
3817 | QPtrList<Incidence> subTodos; | 3843 | QPtrList<Incidence> subTodos; |
3818 | Incidence *aTodo; | 3844 | Incidence *aTodo; |
3819 | subTodos = t->relations(); | 3845 | subTodos = t->relations(); |
3820 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { | 3846 | for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { |
3821 | if (! removeCompletedSubTodos( (Todo*) aTodo )) | 3847 | if (! removeCompletedSubTodos( (Todo*) aTodo )) |
3822 | deleteTodo = false; | 3848 | deleteTodo = false; |
3823 | } | 3849 | } |
@@ -3877,48 +3903,72 @@ bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | |||
3877 | // mSyncManager = manager; | 3903 | // mSyncManager = manager; |
3878 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 3904 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
3879 | qDebug("KO: SyncKDE request detected!"); | 3905 | qDebug("KO: SyncKDE request detected!"); |
3880 | } | 3906 | } |
3881 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3907 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3882 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3908 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3883 | return syncCalendar( filename, mode ); | 3909 | return syncCalendar( filename, mode ); |
3884 | } | 3910 | } |
3885 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 3911 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
3886 | { | 3912 | { |
3887 | //mSyncManager = manager; | 3913 | //mSyncManager = manager; |
3888 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 3914 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
3889 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 3915 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
3890 | if ( resource == "sharp" ) | 3916 | if ( resource == "sharp" ) |
3891 | syncExternal( 0 ); | 3917 | syncExternal( 0 ); |
3892 | if ( resource == "phone" ) | 3918 | if ( resource == "phone" ) |
3893 | syncExternal( 1 ); | 3919 | syncExternal( 1 ); |
3894 | // pending setmodified | 3920 | // pending setmodified |
3895 | return true; | 3921 | return true; |
3896 | } | 3922 | } |
3897 | void CalendarView::setSyncManager(KSyncManager* manager) | 3923 | void CalendarView::setSyncManager(KSyncManager* manager) |
3898 | { | 3924 | { |
3899 | mSyncManager = manager; | 3925 | mSyncManager = manager; |
3900 | } | 3926 | } |
3901 | 3927 | ||
3902 | void CalendarView::removeSyncInfo( QString syncProfile) | 3928 | void CalendarView::removeSyncInfo( QString syncProfile) |
3903 | { | 3929 | { |
3904 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); | 3930 | qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); |
3905 | mCalendar->removeSyncInfo( syncProfile ); | 3931 | mCalendar->removeSyncInfo( syncProfile ); |
3906 | 3932 | ||
3907 | } | 3933 | } |
3908 | 3934 | ||
3909 | void CalendarView::undo_delete() | 3935 | void CalendarView::undo_delete() |
3910 | { | 3936 | { |
3911 | //qDebug("undo_delete() "); | 3937 | //qDebug("undo_delete() "); |
3912 | Incidence* undo = mCalendar->undoIncidence(); | 3938 | Incidence* undo = mCalendar->undoIncidence(); |
3913 | if ( !undo ) { | 3939 | if ( !undo ) { |
3914 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), | 3940 | KMessageBox::sorry(this,i18n("There is nothing to undo!"), |
3915 | i18n("KO/Pi")); | 3941 | i18n("KO/Pi")); |
3916 | return; | 3942 | return; |
3917 | } | 3943 | } |
3918 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + | 3944 | if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + |
3919 | i18n("\nAre you sure you want\nto restore this?"), | 3945 | i18n("\nAre you sure you want\nto restore this?"), |
3920 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { | 3946 | i18n("KO/Pi Confirmation"),i18n("Restore"))) { |
3921 | mCalendar->undoDeleteIncidence(); | 3947 | mCalendar->undoDeleteIncidence(); |
3922 | updateView(); | 3948 | updateView(); |
3923 | } | 3949 | } |
3924 | } | 3950 | } |
3951 | |||
3952 | void CalendarView::slotViewerClosed() | ||
3953 | { | ||
3954 | QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); | ||
3955 | } | ||
3956 | |||
3957 | void CalendarView::resetFocus() | ||
3958 | { | ||
3959 | if ( mViewerCallerIsSearchDialog ) { | ||
3960 | if ( mDialogManager->getSearchDialog()->isVisible() ){ | ||
3961 | mDialogManager->getSearchDialog()->raise(); | ||
3962 | mDialogManager->getSearchDialog()->setActiveWindow(); | ||
3963 | mDialogManager->getSearchDialog()->listview()->resetFocus(); | ||
3964 | } else | ||
3965 | mViewerCallerIsSearchDialog = false; | ||
3966 | } | ||
3967 | if ( !mViewerCallerIsSearchDialog ) { | ||
3968 | //mViewManager->currentView()->setFocus(); | ||
3969 | //qDebug("sssssssssssssssset focus "); | ||
3970 | setActiveWindow(); | ||
3971 | //setFocus(); | ||
3972 | } | ||
3973 | mViewerCallerIsSearchDialog = false; | ||
3974 | } | ||
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index e626ea3..664d700 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -411,135 +411,138 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
411 | /** Move to the previous date(s) in the current view */ | 411 | /** Move to the previous date(s) in the current view */ |
412 | void goPrevious(); | 412 | void goPrevious(); |
413 | /** Move to the next date(s) in the current view */ | 413 | /** Move to the next date(s) in the current view */ |
414 | void goNextMonth(); | 414 | void goNextMonth(); |
415 | 415 | ||
416 | /** Move to the previous date(s) in the current view */ | 416 | /** Move to the previous date(s) in the current view */ |
417 | void goPreviousMonth(); | 417 | void goPreviousMonth(); |
418 | 418 | ||
419 | void toggleExpand(); | 419 | void toggleExpand(); |
420 | void toggleDateNavigatorWidget(); | 420 | void toggleDateNavigatorWidget(); |
421 | void toggleAllDaySize(); | 421 | void toggleAllDaySize(); |
422 | void dialogClosing(Incidence *); | 422 | void dialogClosing(Incidence *); |
423 | 423 | ||
424 | /** Look for new messages in the inbox */ | 424 | /** Look for new messages in the inbox */ |
425 | void lookForIncomingMessages(); | 425 | void lookForIncomingMessages(); |
426 | /** Look for new messages in the outbox */ | 426 | /** Look for new messages in the outbox */ |
427 | void lookForOutgoingMessages(); | 427 | void lookForOutgoingMessages(); |
428 | 428 | ||
429 | void processMainViewSelection( Incidence * ); | 429 | void processMainViewSelection( Incidence * ); |
430 | void processTodoListSelection( Incidence * ); | 430 | void processTodoListSelection( Incidence * ); |
431 | 431 | ||
432 | void processIncidenceSelection( Incidence * ); | 432 | void processIncidenceSelection( Incidence * ); |
433 | 433 | ||
434 | void purgeCompleted(); | 434 | void purgeCompleted(); |
435 | bool removeCompletedSubTodos( Todo* ); | 435 | bool removeCompletedSubTodos( Todo* ); |
436 | void slotCalendarChanged(); | 436 | void slotCalendarChanged(); |
437 | bool importBday(); | 437 | bool importBday(); |
438 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 438 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
439 | bool importQtopia( const QString &categoriesFile, | 439 | bool importQtopia( const QString &categoriesFile, |
440 | const QString &datebookFile, | 440 | const QString &datebookFile, |
441 | const QString &tasklistFile ); | 441 | const QString &tasklistFile ); |
442 | void syncExternal( int mode ); | 442 | void syncExternal( int mode ); |
443 | void slotSelectPickerDate( QDate ) ; | 443 | void slotSelectPickerDate( QDate ) ; |
444 | void showDatePicker() ; | 444 | void showDatePicker() ; |
445 | void showDatePickerPopup() ; | 445 | void showDatePickerPopup() ; |
446 | void moveIncidence(Incidence *) ; | 446 | void moveIncidence(Incidence *) ; |
447 | void beamIncidence(Incidence *) ; | 447 | void beamIncidence(Incidence *) ; |
448 | void beamCalendar() ; | 448 | void beamCalendar() ; |
449 | void beamFilteredCalendar() ; | 449 | void beamFilteredCalendar() ; |
450 | void beamIncidenceList(QPtrList<Incidence>) ; | 450 | void beamIncidenceList(QPtrList<Incidence>) ; |
451 | void manageCategories(); | 451 | void manageCategories(); |
452 | int addCategories(); | 452 | int addCategories(); |
453 | void removeCategories(); | 453 | void removeCategories(); |
454 | void setSyncDevice( QString ); | 454 | void setSyncDevice( QString ); |
455 | void setSyncName( QString ); | 455 | void setSyncName( QString ); |
456 | void showDay( QDate ); | 456 | void showDay( QDate ); |
457 | void undo_delete(); | 457 | void undo_delete(); |
458 | protected slots: | 458 | protected slots: |
459 | void resetFocus(); | ||
460 | void slotViewerClosed(); | ||
459 | void timerAlarm(); | 461 | void timerAlarm(); |
460 | void suspendAlarm(); | 462 | void suspendAlarm(); |
461 | void beamDone( Ir *ir ); | 463 | void beamDone( Ir *ir ); |
462 | /** Select a view or adapt the current view to display the specified dates. */ | 464 | /** Select a view or adapt the current view to display the specified dates. */ |
463 | void showDates( const KCal::DateList & ); | 465 | void showDates( const KCal::DateList & ); |
464 | void selectWeekNum ( int ); | 466 | void selectWeekNum ( int ); |
465 | 467 | ||
466 | public: | 468 | public: |
467 | // show a standard warning | 469 | // show a standard warning |
468 | // returns KMsgBox::yesNoCancel() | 470 | // returns KMsgBox::yesNoCancel() |
469 | int msgCalModified(); | 471 | int msgCalModified(); |
470 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 472 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
471 | 473 | ||
472 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 474 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
473 | virtual void removeSyncInfo( QString syncProfile); | 475 | virtual void removeSyncInfo( QString syncProfile); |
474 | void setSyncManager(KSyncManager* manager); | 476 | void setSyncManager(KSyncManager* manager); |
475 | void setLoadedFileVersion(QDateTime); | 477 | void setLoadedFileVersion(QDateTime); |
476 | bool checkFileVersion(QString fn); | 478 | bool checkFileVersion(QString fn); |
477 | bool checkFileChanged(QString fn); | 479 | bool checkFileChanged(QString fn); |
478 | Event* getLastSyncEvent(); | 480 | Event* getLastSyncEvent(); |
479 | /** Adapt navigation units correpsonding to step size of navigation of the | 481 | /** Adapt navigation units correpsonding to step size of navigation of the |
480 | * current view. | 482 | * current view. |
481 | */ | 483 | */ |
482 | void adaptNavigationUnits(); | 484 | void adaptNavigationUnits(); |
483 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 485 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
484 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 486 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
485 | //Attendee* getYourAttendee(Event *event); | 487 | //Attendee* getYourAttendee(Event *event); |
486 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} | 488 | void setBlockShowDates( bool b ) { mBlockShowDates = b ;} |
487 | protected: | 489 | protected: |
488 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 490 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
489 | 491 | ||
490 | // returns KMsgBox::OKCandel() | 492 | // returns KMsgBox::OKCandel() |
491 | int msgItemDelete(const QString name); | 493 | int msgItemDelete(const QString name); |
492 | void showEventEditor(); | 494 | void showEventEditor(); |
493 | void showTodoEditor(); | 495 | void showTodoEditor(); |
494 | void writeLocale(); | 496 | void writeLocale(); |
495 | Todo *selectedTodo(); | 497 | Todo *selectedTodo(); |
496 | 498 | ||
497 | private: | 499 | private: |
500 | bool mViewerCallerIsSearchDialog; | ||
498 | bool mBlockShowDates; | 501 | bool mBlockShowDates; |
499 | KSyncManager* mSyncManager; | 502 | KSyncManager* mSyncManager; |
500 | AlarmDialog * mAlarmDialog; | 503 | AlarmDialog * mAlarmDialog; |
501 | QString mAlarmNotification; | 504 | QString mAlarmNotification; |
502 | QString mSuspendAlarmNotification; | 505 | QString mSuspendAlarmNotification; |
503 | QTimer* mSuspendTimer; | 506 | QTimer* mSuspendTimer; |
504 | QTimer* mAlarmTimer; | 507 | QTimer* mAlarmTimer; |
505 | QTimer* mRecheckAlarmTimer; | 508 | QTimer* mRecheckAlarmTimer; |
506 | void computeAlarm( QString ); | 509 | void computeAlarm( QString ); |
507 | void startAlarm( QString, QString ); | 510 | void startAlarm( QString, QString ); |
508 | void setSyncEventsReadOnly(); | 511 | void setSyncEventsReadOnly(); |
509 | 512 | ||
510 | QDateTime loadedFileVersion; | 513 | QDateTime loadedFileVersion; |
511 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 514 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
512 | void checkExternalId( Incidence * inc ); | 515 | void checkExternalId( Incidence * inc ); |
513 | int mGlobalSyncMode; | 516 | int mGlobalSyncMode; |
514 | QString mCurrentSyncDevice; | 517 | QString mCurrentSyncDevice; |
515 | QString mCurrentSyncName; | 518 | QString mCurrentSyncName; |
516 | KOBeamPrefs* beamDialog; | 519 | KOBeamPrefs* beamDialog; |
517 | void init(); | 520 | void init(); |
518 | int mDatePickerMode; | 521 | int mDatePickerMode; |
519 | bool mFlagEditDescription; | 522 | bool mFlagEditDescription; |
520 | QDateTime mLastCalendarSync; | 523 | QDateTime mLastCalendarSync; |
521 | void createPrinter(); | 524 | void createPrinter(); |
522 | 525 | ||
523 | void calendarModified( bool, Calendar * ); | 526 | void calendarModified( bool, Calendar * ); |
524 | 527 | ||
525 | CalPrinter *mCalPrinter; | 528 | CalPrinter *mCalPrinter; |
526 | 529 | ||
527 | QSplitter *mPanner; | 530 | QSplitter *mPanner; |
528 | QSplitter *mLeftSplitter; | 531 | QSplitter *mLeftSplitter; |
529 | QWidget *mLeftFrame; | 532 | QWidget *mLeftFrame; |
530 | QWidgetStack *mRightFrame; | 533 | QWidgetStack *mRightFrame; |
531 | 534 | ||
532 | KDatePicker* mDatePicker; | 535 | KDatePicker* mDatePicker; |
533 | QVBox* mDateFrame; | 536 | QVBox* mDateFrame; |
534 | 537 | ||
535 | KDateNavigator *mDateNavigator; // widget showing small month view. | 538 | KDateNavigator *mDateNavigator; // widget showing small month view. |
536 | 539 | ||
537 | KOFilterView *mFilterView; | 540 | KOFilterView *mFilterView; |
538 | 541 | ||
539 | ResourceView *mResourceView; | 542 | ResourceView *mResourceView; |
540 | 543 | ||
541 | // calendar object for this viewing instance | 544 | // calendar object for this viewing instance |
542 | Calendar *mCalendar; | 545 | Calendar *mCalendar; |
543 | 546 | ||
544 | CalendarResourceManager *mResourceManager; | 547 | CalendarResourceManager *mResourceManager; |
545 | 548 | ||
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h index d8142ca..2d4a08e 100644 --- a/korganizer/koeventviewer.h +++ b/korganizer/koeventviewer.h | |||
@@ -25,52 +25,52 @@ | |||
25 | #include <qtextbrowser.h> | 25 | #include <qtextbrowser.h> |
26 | 26 | ||
27 | #include <libkcal/event.h> | 27 | #include <libkcal/event.h> |
28 | #include <libkcal/journal.h> | 28 | #include <libkcal/journal.h> |
29 | 29 | ||
30 | 30 | ||
31 | using namespace KCal; | 31 | using namespace KCal; |
32 | 32 | ||
33 | class KOEventViewer : public QTextBrowser { | 33 | class KOEventViewer : public QTextBrowser { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | KOEventViewer(QWidget *parent=0,const char *name=0); | 36 | KOEventViewer(QWidget *parent=0,const char *name=0); |
37 | virtual ~KOEventViewer(); | 37 | virtual ~KOEventViewer(); |
38 | 38 | ||
39 | void setSource(const QString &); | 39 | void setSource(const QString &); |
40 | void setEvent(Event *event); | 40 | void setEvent(Event *event); |
41 | void addEvent(Event *event); | 41 | void addEvent(Event *event); |
42 | void setTodo(Todo *event, bool clearV = true ); | 42 | void setTodo(Todo *event, bool clearV = true ); |
43 | void setJournal(Journal *jour, bool clearV = true ); | 43 | void setJournal(Journal *jour, bool clearV = true ); |
44 | 44 | ||
45 | void appendEvent(Event *event, int mode = 0 ); | 45 | void appendEvent(Event *event, int mode = 0 ); |
46 | void appendTodo(Todo *event, int mode = 0 ); | 46 | void appendTodo(Todo *event, int mode = 0 ); |
47 | void appendJournal(Journal *jour, int mode = 0 ); | 47 | void appendJournal(Journal *jour, int mode = 0 ); |
48 | 48 | ||
49 | void clearEvents(bool now=false); | 49 | void clearEvents(bool now=false); |
50 | 50 | ||
51 | void addText(QString text); | 51 | void addText(QString text); |
52 | void setSyncMode( bool ); | 52 | void setSyncMode( bool ); |
53 | void setColorMode( int ); | 53 | void setColorMode( int ); |
54 | void mailToAttendees( bool all ); | 54 | void mailToAttendees( bool all ); |
55 | 55 | ||
56 | protected: | 56 | protected: |
57 | int mColorMode; | 57 | int mColorMode; |
58 | void addTag(const QString & tag,const QString & text); | 58 | void addTag(const QString & tag,const QString & text); |
59 | 59 | ||
60 | void formatCategories(Incidence *event); | 60 | void formatCategories(Incidence *event); |
61 | void formatAttendees(Incidence *event); | 61 | void formatAttendees(Incidence *event); |
62 | void formatReadOnly(Incidence *event); | 62 | void formatReadOnly(Incidence *event); |
63 | void keyPressEvent ( QKeyEvent * e ); | 63 | void keyPressEvent ( QKeyEvent * e ); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | QTextBrowser *mEventTextView; | 66 | QTextBrowser *mEventTextView; |
67 | bool mSyncMode; | 67 | bool mSyncMode; |
68 | 68 | ||
69 | QString mText; | 69 | QString mText; |
70 | QString mMailSubject; | 70 | QString mMailSubject; |
71 | Incidence* mCurrentIncidence; | 71 | Incidence* mCurrentIncidence; |
72 | signals: | 72 | signals: |
73 | void launchaddressbook(QString uid); | 73 | void launchaddressbook(QString uid); |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #endif | 76 | #endif |
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 23e62d3..8bada3b 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp | |||
@@ -1,90 +1,91 @@ | |||
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 | 19 | ||
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | 21 | ||
22 | #include <libkcal/event.h> | 22 | #include <libkcal/event.h> |
23 | #include <qtimer.h> | ||
23 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
24 | 25 | ||
25 | #include "koeventviewer.h" | 26 | #include "koeventviewer.h" |
26 | #include "koprefs.h" | 27 | #include "koprefs.h" |
27 | #include <libkcal/todo.h> | 28 | #include <libkcal/todo.h> |
28 | #include "qapp.h" | 29 | #include "qapp.h" |
29 | 30 | ||
30 | #include "koeventviewerdialog.h" | 31 | #include "koeventviewerdialog.h" |
31 | extern int globalFlagBlockAgenda; | 32 | extern int globalFlagBlockAgenda; |
32 | 33 | ||
33 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) | 34 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) |
34 | : KDialogBase(parent,name, | 35 | : KDialogBase(parent,name, |
35 | #ifndef DESKTOP_VERSION | 36 | #ifndef DESKTOP_VERSION |
36 | true , | 37 | true , |
37 | #else | 38 | #else |
38 | false, | 39 | false, |
39 | #endif | 40 | #endif |
40 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) | 41 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) |
41 | { | 42 | { |
42 | 43 | sendSignalViewerClosed = true; | |
43 | mEventViewer = new KOEventViewer(this); | 44 | mEventViewer = new KOEventViewer(this); |
44 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 45 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
45 | setMainWidget(mEventViewer); | 46 | setMainWidget(mEventViewer); |
46 | setButtonText(Ok, i18n("Edit") ); | 47 | setButtonText(Ok, i18n("Edit") ); |
47 | 48 | ||
48 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), | 49 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), |
49 | SLOT(editIncidence())); | 50 | SLOT(editIncidence())); |
50 | QObject::connect(this,SIGNAL(user1Clicked()), | 51 | QObject::connect(this,SIGNAL(user1Clicked()), |
51 | SLOT(showIncidence())); | 52 | SLOT(showIncidence())); |
52 | mIncidence = 0; | 53 | mIncidence = 0; |
53 | // TODO: Set a sensible size (based on the content?). | 54 | // TODO: Set a sensible size (based on the content?). |
54 | //showMaximized(); | 55 | //showMaximized(); |
55 | //qDebug("++++++++++++KOEventViewerDialog() "); | 56 | //qDebug("++++++++++++KOEventViewerDialog() "); |
56 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 57 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
57 | // setFixedSize( 240,284 ); | 58 | // setFixedSize( 240,284 ); |
58 | // move( 0, 15 ); | 59 | // move( 0, 15 ); |
59 | // } else { | 60 | // } else { |
60 | // setMinimumSize(300,200); | 61 | // setMinimumSize(300,200); |
61 | // resize(320,300); | 62 | // resize(320,300); |
62 | // } | 63 | // } |
63 | mSyncMode = false; | 64 | mSyncMode = false; |
64 | mSyncResult = 0; | 65 | mSyncResult = 0; |
65 | 66 | ||
66 | } | 67 | } |
67 | 68 | ||
68 | KOEventViewerDialog::~KOEventViewerDialog() | 69 | KOEventViewerDialog::~KOEventViewerDialog() |
69 | { | 70 | { |
70 | //qDebug("-------~KOEventViewerDialog() "); | 71 | //qDebug("-------~KOEventViewerDialog() "); |
71 | } | 72 | } |
72 | void KOEventViewerDialog::showMe() | 73 | void KOEventViewerDialog::showMe() |
73 | { | 74 | { |
74 | 75 | ||
75 | #ifdef DESKTOP_VERSION | 76 | #ifdef DESKTOP_VERSION |
76 | show(); | 77 | show(); |
77 | #else | 78 | #else |
78 | showMaximized(); | 79 | showMaximized(); |
79 | #endif | 80 | #endif |
80 | setActiveWindow(); | 81 | setActiveWindow(); |
81 | mEventViewer->setFocus(); | 82 | mEventViewer->setFocus(); |
82 | 83 | ||
83 | } | 84 | } |
84 | void KOEventViewerDialog::setSyncMode( bool b ) | 85 | void KOEventViewerDialog::setSyncMode( bool b ) |
85 | { | 86 | { |
86 | mSyncMode = b; | 87 | mSyncMode = b; |
87 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); | 88 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); |
88 | if ( mSyncMode ) { | 89 | if ( mSyncMode ) { |
89 | findButton( Close )->setText( i18n("Cancel Sync")); | 90 | findButton( Close )->setText( i18n("Cancel Sync")); |
90 | findButton( Ok )->setText( i18n("Remote")); | 91 | findButton( Ok )->setText( i18n("Remote")); |
@@ -144,123 +145,139 @@ void KOEventViewerDialog::addIncidence(Incidence *in) | |||
144 | else if ( in->type() =="Journal" ) | 145 | else if ( in->type() =="Journal" ) |
145 | mEventViewer->setJournal( (Journal*) in, false ); | 146 | mEventViewer->setJournal( (Journal*) in, false ); |
146 | if ( mSyncMode ) { | 147 | if ( mSyncMode ) { |
147 | findButton( User1 )->setFocus(); | 148 | findButton( User1 )->setFocus(); |
148 | setCaption(i18n("Conflict! Please choose entry")); | 149 | setCaption(i18n("Conflict! Please choose entry")); |
149 | } | 150 | } |
150 | } | 151 | } |
151 | 152 | ||
152 | void KOEventViewerDialog::addEvent(Event *event) | 153 | void KOEventViewerDialog::addEvent(Event *event) |
153 | { | 154 | { |
154 | mEventViewer->addEvent(event); | 155 | mEventViewer->addEvent(event); |
155 | mIncidence = event; | 156 | mIncidence = event; |
156 | mEventViewer->setFocus(); | 157 | mEventViewer->setFocus(); |
157 | //findButton( Close )->setFocus(); | 158 | //findButton( Close )->setFocus(); |
158 | if ( !mSyncMode ) { | 159 | if ( !mSyncMode ) { |
159 | findButton( User1 )->setText( i18n("Agenda")); | 160 | findButton( User1 )->setText( i18n("Agenda")); |
160 | } | 161 | } |
161 | } | 162 | } |
162 | 163 | ||
163 | void KOEventViewerDialog::setTodo(Todo *event) | 164 | void KOEventViewerDialog::setTodo(Todo *event) |
164 | { | 165 | { |
165 | mEventViewer->setTodo(event); | 166 | mEventViewer->setTodo(event); |
166 | mIncidence = (Incidence*)event; | 167 | mIncidence = (Incidence*)event; |
167 | mEventViewer->setFocus(); | 168 | mEventViewer->setFocus(); |
168 | //findButton( Close )->setFocus(); | 169 | //findButton( Close )->setFocus(); |
169 | if ( !mSyncMode ) { | 170 | if ( !mSyncMode ) { |
170 | findButton( User1 )->setText( i18n("Set complete")); | 171 | findButton( User1 )->setText( i18n("Set complete")); |
171 | } | 172 | } |
172 | } | 173 | } |
173 | void KOEventViewerDialog::setJournal(Journal *j) | 174 | void KOEventViewerDialog::setJournal(Journal *j) |
174 | { | 175 | { |
175 | mEventViewer->setJournal(j); | 176 | mEventViewer->setJournal(j); |
176 | mIncidence = (Incidence*)j; | 177 | mIncidence = (Incidence*)j; |
177 | mEventViewer->setFocus(); | 178 | mEventViewer->setFocus(); |
178 | //findButton( Close )->setFocus(); | 179 | //findButton( Close )->setFocus(); |
179 | if ( !mSyncMode ) { | 180 | if ( !mSyncMode ) { |
180 | findButton( User1 )->setText( i18n("Agenda")); | 181 | findButton( User1 )->setText( i18n("Agenda")); |
181 | } | 182 | } |
182 | } | 183 | } |
183 | 184 | ||
184 | void KOEventViewerDialog::addText(QString text) | 185 | void KOEventViewerDialog::addText(QString text) |
185 | { | 186 | { |
186 | mEventViewer->addText(text); | 187 | mEventViewer->addText(text); |
187 | mEventViewer->setFocus(); | 188 | mEventViewer->setFocus(); |
188 | //findButton( Close )->setFocus(); | 189 | //findButton( Close )->setFocus(); |
189 | } | 190 | } |
190 | void KOEventViewerDialog::editIncidence() | 191 | void KOEventViewerDialog::editIncidence() |
191 | { | 192 | { |
193 | sendSignalViewerClosed = false; | ||
192 | if ( mSyncMode ) { | 194 | if ( mSyncMode ) { |
193 | mSyncResult = 2; | 195 | mSyncResult = 2; |
194 | accept(); | 196 | accept(); |
195 | return; | 197 | return; |
196 | } | 198 | } |
197 | if ( mIncidence ){ | 199 | if ( mIncidence ){ |
198 | #ifndef DESKTOP_VERSION | 200 | #ifndef DESKTOP_VERSION |
199 | hide(); | 201 | hide(); |
200 | #endif | 202 | #endif |
201 | emit editIncidence( mIncidence ); | 203 | emit editIncidence( mIncidence ); |
202 | } | 204 | } |
203 | } | 205 | } |
204 | void KOEventViewerDialog::showIncidence() | 206 | void KOEventViewerDialog::showIncidence() |
205 | { | 207 | { |
206 | 208 | sendSignalViewerClosed = false; | |
207 | if ( mSyncMode ) { | 209 | if ( mSyncMode ) { |
208 | mSyncResult = 1; | 210 | mSyncResult = 1; |
209 | accept(); | 211 | accept(); |
210 | return; | 212 | return; |
211 | } | 213 | } |
212 | 214 | ||
213 | if ( mIncidence ){ | 215 | if ( mIncidence ){ |
214 | #ifndef DESKTOP_VERSION | 216 | #ifndef DESKTOP_VERSION |
215 | hide(); | 217 | hide(); |
216 | #endif | 218 | #endif |
217 | QDate date; | 219 | QDate date; |
218 | if ( mIncidence->type() == "Todo" ) { | 220 | if ( mIncidence->type() == "Todo" ) { |
219 | /* | 221 | /* |
220 | if ( ((Todo*)mIncidence)->hasDueDate() ) | 222 | if ( ((Todo*)mIncidence)->hasDueDate() ) |
221 | date = ((Todo*)mIncidence)->dtDue().date(); | 223 | date = ((Todo*)mIncidence)->dtDue().date(); |
222 | else { | 224 | else { |
223 | globalFlagBlockAgenda = 2; | 225 | globalFlagBlockAgenda = 2; |
224 | emit showAgendaView( false ); | 226 | emit showAgendaView( false ); |
225 | return; | 227 | return; |
226 | } | 228 | } |
227 | */ | 229 | */ |
228 | ((Todo*)mIncidence)->setCompleted( true ); | 230 | ((Todo*)mIncidence)->setCompleted( true ); |
229 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); | 231 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); |
230 | hide(); | 232 | hide(); |
231 | emit todoCompleted(((Todo*)mIncidence)); | 233 | emit todoCompleted(((Todo*)mIncidence)); |
232 | return; | 234 | return; |
233 | 235 | ||
234 | } else | 236 | } else |
235 | date = mIncidence->dtStart().date(); | 237 | date = mIncidence->dtStart().date(); |
236 | globalFlagBlockAgenda = 1; | 238 | globalFlagBlockAgenda = 1; |
237 | emit showAgendaView( false ); | 239 | emit showAgendaView( false ); |
238 | globalFlagBlockAgenda = 2; | 240 | globalFlagBlockAgenda = 2; |
239 | emit jumpToTime( date ); | 241 | emit jumpToTime( date ); |
240 | } | 242 | } |
241 | } | 243 | } |
242 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) | 244 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) |
243 | { | 245 | { |
244 | switch ( e->key() ) { | 246 | switch ( e->key() ) { |
245 | 247 | ||
246 | case Qt::Key_A : | 248 | case Qt::Key_A : |
247 | case Qt::Key_L : | 249 | case Qt::Key_L : |
248 | showIncidence(); | 250 | showIncidence(); |
249 | break; | 251 | break; |
250 | case Qt::Key_E : | 252 | case Qt::Key_E : |
251 | case Qt::Key_R : | 253 | case Qt::Key_R : |
252 | editIncidence(); | 254 | editIncidence(); |
253 | break; | 255 | break; |
254 | case Qt::Key_C: | 256 | case Qt::Key_C: |
255 | case Qt::Key_Escape: | 257 | case Qt::Key_Escape: |
256 | close(); | 258 | close(); |
257 | break; | 259 | break; |
258 | case Qt::Key_I: | 260 | case Qt::Key_I: |
259 | accept(); | 261 | accept(); |
260 | break; | 262 | break; |
261 | default: | 263 | default: |
262 | KDialogBase::keyPressEvent ( e ); | 264 | KDialogBase::keyPressEvent ( e ); |
263 | break; | 265 | break; |
264 | } | 266 | } |
265 | 267 | ||
266 | } | 268 | } |
269 | void KOEventViewerDialog::hideEvent ( QHideEvent * e ) | ||
270 | { | ||
271 | KDialogBase::hideEvent ( e ); | ||
272 | QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); | ||
273 | } | ||
274 | |||
275 | void KOEventViewerDialog::slotViewerClosed() | ||
276 | { | ||
277 | if ( sendSignalViewerClosed ) { | ||
278 | //qDebug("KOEventViewerDialog::hideEvent "); | ||
279 | emit signalViewerClosed(); | ||
280 | } | ||
281 | sendSignalViewerClosed = true; | ||
282 | } | ||
283 | |||
diff --git a/korganizer/koeventviewerdialog.h b/korganizer/koeventviewerdialog.h index b6b4103..36431ad 100644 --- a/korganizer/koeventviewerdialog.h +++ b/korganizer/koeventviewerdialog.h | |||
@@ -10,62 +10,66 @@ | |||
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 | #ifndef KOEVENTVIEWERDIALOG_H | 19 | #ifndef KOEVENTVIEWERDIALOG_H |
20 | #define KOEVENTVIEWERDIALOG_H | 20 | #define KOEVENTVIEWERDIALOG_H |
21 | // | 21 | // |
22 | // Viewer dialog for events. | 22 | // Viewer dialog for events. |
23 | // | 23 | // |
24 | 24 | ||
25 | #include <qtextview.h> | 25 | #include <qtextview.h> |
26 | 26 | ||
27 | #include <kdialogbase.h> | 27 | #include <kdialogbase.h> |
28 | 28 | ||
29 | #include <libkcal/event.h> | 29 | #include <libkcal/event.h> |
30 | 30 | ||
31 | using namespace KCal; | 31 | using namespace KCal; |
32 | 32 | ||
33 | class KOEventViewer; | 33 | class KOEventViewer; |
34 | 34 | ||
35 | class KOEventViewerDialog : public KDialogBase { | 35 | class KOEventViewerDialog : public KDialogBase { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | KOEventViewerDialog(QWidget *parent=0,const char *name=0); | 38 | KOEventViewerDialog(QWidget *parent=0,const char *name=0); |
39 | virtual ~KOEventViewerDialog(); | 39 | virtual ~KOEventViewerDialog(); |
40 | 40 | ||
41 | void setEvent(Event *event); | 41 | void setEvent(Event *event); |
42 | void addEvent(Event *event); | 42 | void addEvent(Event *event); |
43 | void setTodo(Todo *event); | 43 | void setTodo(Todo *event); |
44 | void setJournal(Journal *journal); | 44 | void setJournal(Journal *journal); |
45 | void setIncidence(Incidence *inc); | 45 | void setIncidence(Incidence *inc); |
46 | void addIncidence(Incidence *inc); | 46 | void addIncidence(Incidence *inc); |
47 | void addText(QString text); | 47 | void addText(QString text); |
48 | void showMe(); | 48 | void showMe(); |
49 | void setSyncMode( bool ); | 49 | void setSyncMode( bool ); |
50 | void setColorMode( int m ); | 50 | void setColorMode( int m ); |
51 | int executeS( bool ); | 51 | int executeS( bool ); |
52 | public slots: | 52 | public slots: |
53 | void updateConfig(); | 53 | void updateConfig(); |
54 | signals: | 54 | signals: |
55 | void editIncidence( Incidence* ); | 55 | void editIncidence( Incidence* ); |
56 | void jumpToTime( const QDate &); | 56 | void jumpToTime( const QDate &); |
57 | void showAgendaView( bool ); | 57 | void showAgendaView( bool ); |
58 | void todoCompleted(Todo*); | 58 | void todoCompleted(Todo*); |
59 | void signalViewerClosed(); | ||
59 | private slots: | 60 | private slots: |
61 | void slotViewerClosed(); | ||
60 | void editIncidence(); | 62 | void editIncidence(); |
61 | void showIncidence(); | 63 | void showIncidence(); |
62 | 64 | protected: | |
65 | void hideEvent ( QHideEvent * e ); | ||
63 | private: | 66 | private: |
67 | bool sendSignalViewerClosed; | ||
64 | bool mSyncMode; | 68 | bool mSyncMode; |
65 | int mSyncResult; | 69 | int mSyncResult; |
66 | KOEventViewer *mEventViewer; | 70 | KOEventViewer *mEventViewer; |
67 | Incidence* mIncidence; | 71 | Incidence* mIncidence; |
68 | void keyPressEvent ( QKeyEvent * e ); | 72 | void keyPressEvent ( QKeyEvent * e ); |
69 | }; | 73 | }; |
70 | 74 | ||
71 | #endif | 75 | #endif |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 4a6e17d..6acee75 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -739,97 +739,100 @@ QPtrList<Incidence> KOListView::selectedIncidences() | |||
739 | // // QListViewItem *item = mListView->selectedItem(); | 739 | // // QListViewItem *item = mListView->selectedItem(); |
740 | //if (item) eventList.append(((KOListViewItem *)item)->data()); | 740 | //if (item) eventList.append(((KOListViewItem *)item)->data()); |
741 | 741 | ||
742 | return eventList; | 742 | return eventList; |
743 | } | 743 | } |
744 | 744 | ||
745 | DateList KOListView::selectedDates() | 745 | DateList KOListView::selectedDates() |
746 | { | 746 | { |
747 | DateList eventList; | 747 | DateList eventList; |
748 | return eventList; | 748 | return eventList; |
749 | } | 749 | } |
750 | 750 | ||
751 | void KOListView::showDates(bool show) | 751 | void KOListView::showDates(bool show) |
752 | { | 752 | { |
753 | // Shouldn't we set it to a value greater 0? When showDates is called with | 753 | // Shouldn't we set it to a value greater 0? When showDates is called with |
754 | // show == true at first, then the columnwidths are set to zero. | 754 | // show == true at first, then the columnwidths are set to zero. |
755 | static int oldColWidth1 = 0; | 755 | static int oldColWidth1 = 0; |
756 | static int oldColWidth3 = 0; | 756 | static int oldColWidth3 = 0; |
757 | 757 | ||
758 | if (!show) { | 758 | if (!show) { |
759 | oldColWidth1 = mListView->columnWidth(1); | 759 | oldColWidth1 = mListView->columnWidth(1); |
760 | oldColWidth3 = mListView->columnWidth(3); | 760 | oldColWidth3 = mListView->columnWidth(3); |
761 | mListView->setColumnWidth(1, 0); | 761 | mListView->setColumnWidth(1, 0); |
762 | mListView->setColumnWidth(3, 0); | 762 | mListView->setColumnWidth(3, 0); |
763 | } else { | 763 | } else { |
764 | mListView->setColumnWidth(1, oldColWidth1); | 764 | mListView->setColumnWidth(1, oldColWidth1); |
765 | mListView->setColumnWidth(3, oldColWidth3); | 765 | mListView->setColumnWidth(3, oldColWidth3); |
766 | } | 766 | } |
767 | mListView->repaint(); | 767 | mListView->repaint(); |
768 | } | 768 | } |
769 | 769 | ||
770 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 770 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
771 | const QDate &td) | 771 | const QDate &td) |
772 | { | 772 | { |
773 | #ifndef KORG_NOPRINTER | 773 | #ifndef KORG_NOPRINTER |
774 | calPrinter->preview(CalPrinter::Day, fd, td); | 774 | calPrinter->preview(CalPrinter::Day, fd, td); |
775 | #endif | 775 | #endif |
776 | } | 776 | } |
777 | 777 | ||
778 | void KOListView::showDates() | 778 | void KOListView::showDates() |
779 | { | 779 | { |
780 | showDates(true); | 780 | showDates(true); |
781 | } | 781 | } |
782 | 782 | ||
783 | void KOListView::hideDates() | 783 | void KOListView::hideDates() |
784 | { | 784 | { |
785 | showDates(false); | 785 | showDates(false); |
786 | } | 786 | } |
787 | 787 | void KOListView::resetFocus() | |
788 | { | ||
789 | mListView->setFocus(); | ||
790 | } | ||
788 | void KOListView::updateView() | 791 | void KOListView::updateView() |
789 | { | 792 | { |
790 | mListView->setFocus(); | 793 | mListView->setFocus(); |
791 | if ( mListView->firstChild () ) | 794 | if ( mListView->firstChild () ) |
792 | mListView->setCurrentItem( mListView->firstChild () ); | 795 | mListView->setCurrentItem( mListView->firstChild () ); |
793 | } | 796 | } |
794 | void KOListView::updateConfig() | 797 | void KOListView::updateConfig() |
795 | { | 798 | { |
796 | 799 | ||
797 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 800 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
798 | updateView(); | 801 | updateView(); |
799 | 802 | ||
800 | } | 803 | } |
801 | void KOListView::setStartDate(const QDate &start) | 804 | void KOListView::setStartDate(const QDate &start) |
802 | { | 805 | { |
803 | mStartDate = start; | 806 | mStartDate = start; |
804 | } | 807 | } |
805 | 808 | ||
806 | void KOListView::showDates(const QDate &start, const QDate &end) | 809 | void KOListView::showDates(const QDate &start, const QDate &end) |
807 | { | 810 | { |
808 | clear(); | 811 | clear(); |
809 | mStartDate = start; | 812 | mStartDate = start; |
810 | QDate date = start; | 813 | QDate date = start; |
811 | QPtrList<Journal> j_list; | 814 | QPtrList<Journal> j_list; |
812 | while( date <= end ) { | 815 | while( date <= end ) { |
813 | addEvents(calendar()->events(date)); | 816 | addEvents(calendar()->events(date)); |
814 | addTodos(calendar()->todos(date)); | 817 | addTodos(calendar()->todos(date)); |
815 | Journal* jo = calendar()->journal(date); | 818 | Journal* jo = calendar()->journal(date); |
816 | if ( jo ) | 819 | if ( jo ) |
817 | j_list.append( jo ); | 820 | j_list.append( jo ); |
818 | date = date.addDays( 1 ); | 821 | date = date.addDays( 1 ); |
819 | } | 822 | } |
820 | addJournals(j_list); | 823 | addJournals(j_list); |
821 | emit incidenceSelected( 0 ); | 824 | emit incidenceSelected( 0 ); |
822 | updateView(); | 825 | updateView(); |
823 | 826 | ||
824 | } | 827 | } |
825 | 828 | ||
826 | void KOListView::addEvents(QPtrList<Event> eventList) | 829 | void KOListView::addEvents(QPtrList<Event> eventList) |
827 | { | 830 | { |
828 | Event *ev; | 831 | Event *ev; |
829 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 832 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
830 | addIncidence(ev); | 833 | addIncidence(ev); |
831 | } | 834 | } |
832 | if ( !mListView->currentItem() ){ | 835 | if ( !mListView->currentItem() ){ |
833 | updateView(); | 836 | updateView(); |
834 | } | 837 | } |
835 | } | 838 | } |
@@ -1030,101 +1033,102 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e) | |||
1030 | jump = 1; | 1033 | jump = 1; |
1031 | while ( jump && cn->nextSibling() ) { | 1034 | while ( jump && cn->nextSibling() ) { |
1032 | cn = cn->nextSibling(); | 1035 | cn = cn->nextSibling(); |
1033 | --jump; | 1036 | --jump; |
1034 | } | 1037 | } |
1035 | setCurrentItem ( cn ); | 1038 | setCurrentItem ( cn ); |
1036 | ensureItemVisible ( cn ); | 1039 | ensureItemVisible ( cn ); |
1037 | 1040 | ||
1038 | } else | 1041 | } else |
1039 | QListView::keyPressEvent ( e ) ; | 1042 | QListView::keyPressEvent ( e ) ; |
1040 | e->accept(); | 1043 | e->accept(); |
1041 | break; | 1044 | break; |
1042 | 1045 | ||
1043 | case Qt::Key_Up: | 1046 | case Qt::Key_Up: |
1044 | if ( e->state() == ShiftButton ) { | 1047 | if ( e->state() == ShiftButton ) { |
1045 | QListViewItem* cn = firstChild(); | 1048 | QListViewItem* cn = firstChild(); |
1046 | if ( cn ) { | 1049 | if ( cn ) { |
1047 | setCurrentItem ( cn ); | 1050 | setCurrentItem ( cn ); |
1048 | ensureItemVisible ( cn ); | 1051 | ensureItemVisible ( cn ); |
1049 | } | 1052 | } |
1050 | e->accept(); | 1053 | e->accept(); |
1051 | return; | 1054 | return; |
1052 | } | 1055 | } |
1053 | if ( e->state() == ControlButton ) { | 1056 | if ( e->state() == ControlButton ) { |
1054 | int count = childCount (); | 1057 | int count = childCount (); |
1055 | int jump = count / 5; | 1058 | int jump = count / 5; |
1056 | QListViewItem* cn; | 1059 | QListViewItem* cn; |
1057 | cn = currentItem(); | 1060 | cn = currentItem(); |
1058 | if ( ! cn ) | 1061 | if ( ! cn ) |
1059 | return; | 1062 | return; |
1060 | if ( jump == 0 ) | 1063 | if ( jump == 0 ) |
1061 | jump = 1; | 1064 | jump = 1; |
1062 | while ( jump && cn->itemAbove ()) { | 1065 | while ( jump && cn->itemAbove ()) { |
1063 | cn = cn->itemAbove (); | 1066 | cn = cn->itemAbove (); |
1064 | --jump; | 1067 | --jump; |
1065 | } | 1068 | } |
1066 | setCurrentItem ( cn ); | 1069 | setCurrentItem ( cn ); |
1067 | ensureItemVisible ( cn ); | 1070 | ensureItemVisible ( cn ); |
1068 | } else | 1071 | } else |
1069 | QListView::keyPressEvent ( e ) ; | 1072 | QListView::keyPressEvent ( e ) ; |
1070 | e->accept(); | 1073 | e->accept(); |
1071 | break; | 1074 | break; |
1072 | case Qt::Key_I: { | 1075 | case Qt::Key_I: { |
1073 | QListViewItem* cn; | 1076 | QListViewItem* cn; |
1074 | cn = currentItem(); | 1077 | cn = currentItem(); |
1075 | if ( cn ) { | 1078 | if ( cn ) { |
1076 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1079 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1077 | if ( ci ){ | 1080 | if ( ci ){ |
1078 | emit showIncidence( ci->data()); | 1081 | //emit showIncidence( ci->data()); |
1079 | cn = cn->nextSibling(); | 1082 | cn = cn->nextSibling(); |
1080 | if ( cn ) { | 1083 | if ( cn ) { |
1081 | setCurrentItem ( cn ); | 1084 | setCurrentItem ( cn ); |
1082 | ensureItemVisible ( cn ); | 1085 | ensureItemVisible ( cn ); |
1086 | emit showIncidence( ci->data()); | ||
1083 | } | 1087 | } |
1084 | } | 1088 | } |
1085 | } | 1089 | } |
1086 | e->accept(); | 1090 | e->accept(); |
1087 | } | 1091 | } |
1088 | break; | 1092 | break; |
1089 | case Qt::Key_Return: | 1093 | case Qt::Key_Return: |
1090 | case Qt::Key_Enter: | 1094 | case Qt::Key_Enter: |
1091 | { | 1095 | { |
1092 | QListViewItem* cn; | 1096 | QListViewItem* cn; |
1093 | cn = currentItem(); | 1097 | cn = currentItem(); |
1094 | if ( cn ) { | 1098 | if ( cn ) { |
1095 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1099 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1096 | if ( ci ){ | 1100 | if ( ci ){ |
1097 | if ( e->state() == ShiftButton ) | 1101 | if ( e->state() == ShiftButton ) |
1098 | ci->setSelected( false ); | 1102 | ci->setSelected( false ); |
1099 | else | 1103 | else |
1100 | ci->setSelected( true ); | 1104 | ci->setSelected( true ); |
1101 | cn = cn->nextSibling(); | 1105 | cn = cn->nextSibling(); |
1102 | if ( cn ) { | 1106 | if ( cn ) { |
1103 | setCurrentItem ( cn ); | 1107 | setCurrentItem ( cn ); |
1104 | ensureItemVisible ( cn ); | 1108 | ensureItemVisible ( cn ); |
1105 | } | 1109 | } |
1106 | } | 1110 | } |
1107 | } | 1111 | } |
1108 | e->accept(); | 1112 | e->accept(); |
1109 | } | 1113 | } |
1110 | break; | 1114 | break; |
1111 | default: | 1115 | default: |
1112 | e->ignore(); | 1116 | e->ignore(); |
1113 | } | 1117 | } |
1114 | } | 1118 | } |
1115 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1119 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1116 | : KListView( lv ) | 1120 | : KListView( lv ) |
1117 | { | 1121 | { |
1118 | #ifndef DESKTOP_VERSION | 1122 | #ifndef DESKTOP_VERSION |
1119 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1123 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1120 | #endif | 1124 | #endif |
1121 | mYMousePos = -1000; | 1125 | mYMousePos = -1000; |
1122 | setSelectionMode( QListView::Multi ); | 1126 | setSelectionMode( QListView::Multi ); |
1123 | setMultiSelection( true); | 1127 | setMultiSelection( true); |
1124 | mAllowPopupMenu = true; | 1128 | mAllowPopupMenu = true; |
1125 | mMouseDown = false; | 1129 | mMouseDown = false; |
1126 | 1130 | ||
1127 | } | 1131 | } |
1128 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1132 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1129 | { | 1133 | { |
1130 | if (!e) return; | 1134 | if (!e) return; |
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index bd5bd12..c86449d 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h | |||
@@ -209,95 +209,96 @@ class ListItemVisitor : public Incidence::Visitor | |||
209 | */ | 209 | */ |
210 | class KOListView; | 210 | class KOListView; |
211 | 211 | ||
212 | class KOListViewListView : public KListView | 212 | class KOListViewListView : public KListView |
213 | { | 213 | { |
214 | Q_OBJECT | 214 | Q_OBJECT |
215 | public: | 215 | public: |
216 | KOListViewListView(KOListView * lv ); | 216 | KOListViewListView(KOListView * lv ); |
217 | signals: | 217 | signals: |
218 | void newEvent(); | 218 | void newEvent(); |
219 | void showIncidence( Incidence* ); | 219 | void showIncidence( Incidence* ); |
220 | private: | 220 | private: |
221 | void keyPressEvent ( QKeyEvent * ) ; | 221 | void keyPressEvent ( QKeyEvent * ) ; |
222 | void contentsMouseDoubleClickEvent(QMouseEvent *e); | 222 | void contentsMouseDoubleClickEvent(QMouseEvent *e); |
223 | void contentsMousePressEvent(QMouseEvent *e); | 223 | void contentsMousePressEvent(QMouseEvent *e); |
224 | void contentsMouseReleaseEvent(QMouseEvent *e); | 224 | void contentsMouseReleaseEvent(QMouseEvent *e); |
225 | void contentsMouseMoveEvent(QMouseEvent *e); | 225 | void contentsMouseMoveEvent(QMouseEvent *e); |
226 | bool mAllowPopupMenu; | 226 | bool mAllowPopupMenu; |
227 | bool mMouseDown; | 227 | bool mMouseDown; |
228 | int mYMousePos; | 228 | int mYMousePos; |
229 | }; | 229 | }; |
230 | 230 | ||
231 | class KOListView : public KOEventView | 231 | class KOListView : public KOEventView |
232 | { | 232 | { |
233 | Q_OBJECT | 233 | Q_OBJECT |
234 | public: | 234 | public: |
235 | KOListView(Calendar *calendar, QWidget *parent = 0, | 235 | KOListView(Calendar *calendar, QWidget *parent = 0, |
236 | const char *name = 0); | 236 | const char *name = 0); |
237 | ~KOListView(); | 237 | ~KOListView(); |
238 | 238 | ||
239 | virtual int maxDatesHint(); | 239 | virtual int maxDatesHint(); |
240 | virtual int currentDateCount(); | 240 | virtual int currentDateCount(); |
241 | virtual QPtrList<Incidence> selectedIncidences(); | 241 | virtual QPtrList<Incidence> selectedIncidences(); |
242 | virtual DateList selectedDates(); | 242 | virtual DateList selectedDates(); |
243 | 243 | ||
244 | void showDates(bool show); | 244 | void showDates(bool show); |
245 | Incidence* currentItem(); | 245 | Incidence* currentItem(); |
246 | void addTodos(QPtrList<Todo> eventList); | 246 | void addTodos(QPtrList<Todo> eventList); |
247 | void addJournals(QPtrList<Journal> eventList); | 247 | void addJournals(QPtrList<Journal> eventList); |
248 | virtual void printPreview(CalPrinter *calPrinter, | 248 | virtual void printPreview(CalPrinter *calPrinter, |
249 | const QDate &, const QDate &); | 249 | const QDate &, const QDate &); |
250 | 250 | ||
251 | void readSettings(KConfig *config, QString setting = "KOListView Layout"); | 251 | void readSettings(KConfig *config, QString setting = "KOListView Layout"); |
252 | void writeSettings(KConfig *config, QString setting = "KOListView Layout"); | 252 | void writeSettings(KConfig *config, QString setting = "KOListView Layout"); |
253 | void updateList(); | 253 | void updateList(); |
254 | void setStartDate(const QDate &start); | 254 | void setStartDate(const QDate &start); |
255 | int count(); | 255 | int count(); |
256 | QString getWhatsThisText(QPoint p); | 256 | QString getWhatsThisText(QPoint p); |
257 | void resetFocus(); | ||
257 | signals: | 258 | signals: |
258 | void signalNewEvent(); | 259 | void signalNewEvent(); |
259 | void beamIncidenceList(QPtrList<Incidence>); | 260 | void beamIncidenceList(QPtrList<Incidence>); |
260 | 261 | ||
261 | public slots: | 262 | public slots: |
262 | virtual void updateView(); | 263 | virtual void updateView(); |
263 | virtual void showDates(const QDate &start, const QDate &end); | 264 | virtual void showDates(const QDate &start, const QDate &end); |
264 | virtual void showEvents(QPtrList<Event> eventList); | 265 | virtual void showEvents(QPtrList<Event> eventList); |
265 | void clearSelection(); | 266 | void clearSelection(); |
266 | void allSelection(); | 267 | void allSelection(); |
267 | 268 | ||
268 | void clear(); | 269 | void clear(); |
269 | void beamDone( Ir *ir ); | 270 | void beamDone( Ir *ir ); |
270 | void showDates(); | 271 | void showDates(); |
271 | void hideDates(); | 272 | void hideDates(); |
272 | void deleteAll(); | 273 | void deleteAll(); |
273 | void saveToFile(); | 274 | void saveToFile(); |
274 | void saveDescriptionToFile(); | 275 | void saveDescriptionToFile(); |
275 | void beamSelected(); | 276 | void beamSelected(); |
276 | void updateConfig(); | 277 | void updateConfig(); |
277 | void addCat(); | 278 | void addCat(); |
278 | void setCat(); | 279 | void setCat(); |
279 | void setAlarm(); | 280 | void setAlarm(); |
280 | void setCategories( bool removeOld ); | 281 | void setCategories( bool removeOld ); |
281 | void changeEventDisplay(Event *, int); | 282 | void changeEventDisplay(Event *, int); |
282 | 283 | ||
283 | void defaultItemAction(QListViewItem *item); | 284 | void defaultItemAction(QListViewItem *item); |
284 | void popupMenu(QListViewItem *item,const QPoint &,int); | 285 | void popupMenu(QListViewItem *item,const QPoint &,int); |
285 | 286 | ||
286 | protected slots: | 287 | protected slots: |
287 | void processSelectionChange(QListViewItem *); | 288 | void processSelectionChange(QListViewItem *); |
288 | 289 | ||
289 | protected: | 290 | protected: |
290 | void addEvents(QPtrList<Event> eventList); | 291 | void addEvents(QPtrList<Event> eventList); |
291 | void addIncidence(Incidence *); | 292 | void addIncidence(Incidence *); |
292 | KOListViewItem *getItemForEvent(Event *event); | 293 | KOListViewItem *getItemForEvent(Event *event); |
293 | 294 | ||
294 | private: | 295 | private: |
295 | KOListViewListView *mListView; | 296 | KOListViewListView *mListView; |
296 | KOEventPopupMenu *mPopupMenu; | 297 | KOEventPopupMenu *mPopupMenu; |
297 | KOListViewItem *mActiveItem; | 298 | KOListViewItem *mActiveItem; |
298 | QDict<Incidence> mUidDict; | 299 | QDict<Incidence> mUidDict; |
299 | QDate mStartDate; | 300 | QDate mStartDate; |
300 | void keyPressEvent ( QKeyEvent * ) ; | 301 | void keyPressEvent ( QKeyEvent * ) ; |
301 | }; | 302 | }; |
302 | 303 | ||
303 | #endif | 304 | #endif |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 3483e95..5e8ea27 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -560,177 +560,199 @@ QString KOTodoView::getWhatsThisText(QPoint p) | |||
560 | KOPrefs::instance()->mWTshowDetails, | 560 | KOPrefs::instance()->mWTshowDetails, |
561 | KOPrefs::instance()->mWTshowCreated, | 561 | KOPrefs::instance()->mWTshowCreated, |
562 | KOPrefs::instance()->mWTshowChanged); | 562 | KOPrefs::instance()->mWTshowChanged); |
563 | return i18n("That is the todo view" ); | 563 | return i18n("That is the todo view" ); |
564 | 564 | ||
565 | } | 565 | } |
566 | 566 | ||
567 | void KOTodoView::jumpToDate () | 567 | void KOTodoView::jumpToDate () |
568 | { | 568 | { |
569 | // if (mActiveItem) { | 569 | // if (mActiveItem) { |
570 | // mActiveItem->todo()); | 570 | // mActiveItem->todo()); |
571 | // if ( mActiveItem->todo()->hasDueDate() ) | 571 | // if ( mActiveItem->todo()->hasDueDate() ) |
572 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 572 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
573 | } | 573 | } |
574 | void KOTodoView::paintNeeded() | 574 | void KOTodoView::paintNeeded() |
575 | { | 575 | { |
576 | if ( mPendingUpdateBeforeRepaint ) { | 576 | if ( mPendingUpdateBeforeRepaint ) { |
577 | updateView(); | 577 | updateView(); |
578 | mPendingUpdateBeforeRepaint = false; | 578 | mPendingUpdateBeforeRepaint = false; |
579 | } | 579 | } |
580 | } | 580 | } |
581 | void KOTodoView::paintEvent(QPaintEvent * pevent) | 581 | void KOTodoView::paintEvent(QPaintEvent * pevent) |
582 | { | 582 | { |
583 | if ( mPendingUpdateBeforeRepaint ) { | 583 | if ( mPendingUpdateBeforeRepaint ) { |
584 | updateView(); | 584 | updateView(); |
585 | mPendingUpdateBeforeRepaint = false; | 585 | mPendingUpdateBeforeRepaint = false; |
586 | } | 586 | } |
587 | KOrg::BaseView::paintEvent( pevent); | 587 | KOrg::BaseView::paintEvent( pevent); |
588 | } | 588 | } |
589 | 589 | ||
590 | void KOTodoView::updateView() | 590 | void KOTodoView::updateView() |
591 | { | 591 | { |
592 | pendingSubtodo = 0; | 592 | pendingSubtodo = 0; |
593 | if ( mBlockUpdate ) { | 593 | if ( mBlockUpdate ) { |
594 | return; | 594 | return; |
595 | } | 595 | } |
596 | if ( !isVisible() ) { | 596 | if ( !isVisible() ) { |
597 | mPendingUpdateBeforeRepaint = true; | 597 | mPendingUpdateBeforeRepaint = true; |
598 | return; | 598 | return; |
599 | } | 599 | } |
600 | //qDebug("KOTodoView::updateView() %x", this); | 600 | //qDebug("KOTodoView::updateView() %x", this); |
601 | if ( isFlatDisplay ) { | 601 | if ( isFlatDisplay ) { |
602 | displayAllFlat(); | 602 | displayAllFlat(); |
603 | return; | 603 | return; |
604 | } | 604 | } |
605 | //qDebug("update "); | 605 | //qDebug("update "); |
606 | // kdDebug() << "KOTodoView::updateView()" << endl; | 606 | // kdDebug() << "KOTodoView::updateView()" << endl; |
607 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 607 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
608 | Incidence* oldInc = 0; | ||
609 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | ||
610 | if (mActiveItem) | ||
611 | oldInc = mActiveItem->todo(); | ||
612 | |||
608 | mTodoListView->clear(); | 613 | mTodoListView->clear(); |
609 | if ( mName == "todolistsmall" ) { | 614 | if ( mName == "todolistsmall" ) { |
610 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 615 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
611 | int ps = fo.pointSize() -2; | 616 | int ps = fo.pointSize() -2; |
612 | if ( ps > 12 ) | 617 | if ( ps > 12 ) |
613 | ps -= 2; | 618 | ps -= 2; |
614 | fo.setPointSize( ps ); | 619 | fo.setPointSize( ps ); |
615 | } | 620 | } |
616 | } | 621 | } |
617 | 622 | ||
618 | mTodoListView->setFont( fo ); | 623 | mTodoListView->setFont( fo ); |
619 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 624 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
620 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 625 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
621 | QPtrList<Todo> todoList = calendar()->todos(); | 626 | QPtrList<Todo> todoList = calendar()->todos(); |
622 | 627 | ||
623 | /* | 628 | /* |
624 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 629 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
625 | Event *t; | 630 | Event *t; |
626 | for(t = todoList.first(); t; t = todoList.next()) { | 631 | for(t = todoList.first(); t; t = todoList.next()) { |
627 | kdDebug() << " " << t->getSummary() << endl; | 632 | kdDebug() << " " << t->getSummary() << endl; |
628 | 633 | ||
629 | if (t->getRelatedTo()) { | 634 | if (t->getRelatedTo()) { |
630 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 635 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
631 | } | 636 | } |
632 | 637 | ||
633 | QPtrList<Event> l = t->getRelations(); | 638 | QPtrList<Event> l = t->getRelations(); |
634 | Event *c; | 639 | Event *c; |
635 | for(c=l.first();c;c=l.next()) { | 640 | for(c=l.first();c;c=l.next()) { |
636 | kdDebug() << " - relation: " << c->getSummary() << endl; | 641 | kdDebug() << " - relation: " << c->getSummary() << endl; |
637 | } | 642 | } |
638 | } | 643 | } |
639 | */ | 644 | */ |
640 | 645 | ||
641 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 646 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
642 | // specific order of events. That means that we have to generate parent items | 647 | // specific order of events. That means that we have to generate parent items |
643 | // recursively for proper hierarchical display of Todos. | 648 | // recursively for proper hierarchical display of Todos. |
644 | mTodoMap.clear(); | 649 | mTodoMap.clear(); |
645 | Todo *todo; | 650 | Todo *todo; |
646 | todo = todoList.first();// todo; todo = todoList.next()) { | 651 | todo = todoList.first();// todo; todo = todoList.next()) { |
647 | while ( todo ) { | 652 | while ( todo ) { |
648 | bool next = true; | 653 | bool next = true; |
649 | // qDebug("todo %s ", todo->summary().latin1()); | 654 | // qDebug("todo %s ", todo->summary().latin1()); |
650 | Incidence *incidence = todo->relatedTo(); | 655 | Incidence *incidence = todo->relatedTo(); |
651 | while ( incidence ) { | 656 | while ( incidence ) { |
652 | if ( incidence->type() == "Todo") { | 657 | if ( incidence->type() == "Todo") { |
653 | //qDebug("related %s ",incidence->summary().latin1() ); | 658 | //qDebug("related %s ",incidence->summary().latin1() ); |
654 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 659 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { |
655 | //qDebug("related not found "); | 660 | //qDebug("related not found "); |
656 | todoList.remove( ); | 661 | todoList.remove( ); |
657 | todo = todoList.current(); | 662 | todo = todoList.current(); |
658 | next = false; | 663 | next = false; |
659 | incidence = 0; | 664 | incidence = 0; |
660 | 665 | ||
661 | } else { | 666 | } else { |
662 | //qDebug("related found "); | 667 | //qDebug("related found "); |
663 | incidence = incidence->relatedTo(); | 668 | incidence = incidence->relatedTo(); |
664 | } | 669 | } |
665 | } else | 670 | } else |
666 | incidence = 0; | 671 | incidence = 0; |
667 | } | 672 | } |
668 | if ( next ) | 673 | if ( next ) |
669 | todo = todoList.next(); | 674 | todo = todoList.next(); |
670 | } | 675 | } |
671 | // qDebug("again .... "); | 676 | // qDebug("again .... "); |
672 | // for(todo = todoList.first(); todo; todo = todoList.next()) { | 677 | // for(todo = todoList.first(); todo; todo = todoList.next()) { |
673 | 678 | ||
674 | // qDebug("yytodo %s ", todo->summary().latin1()); | 679 | // qDebug("yytodo %s ", todo->summary().latin1()); |
675 | // } | 680 | // } |
676 | //qDebug("for "); | 681 | //qDebug("for "); |
677 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 682 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
678 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) | 683 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) |
679 | { | 684 | { |
680 | insertTodoItem(todo); | 685 | insertTodoItem(todo); |
681 | } | 686 | } |
682 | } | 687 | } |
683 | //qDebug("for end "); | 688 | //qDebug("for end "); |
684 | // Restore opened/closed state | 689 | // Restore opened/closed state |
685 | mTodoListView->blockSignals( true ); | 690 | mTodoListView->blockSignals( true ); |
686 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 691 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
687 | mTodoListView->blockSignals( false ); | 692 | mTodoListView->blockSignals( false ); |
688 | mTodoListView->setFocus(); | 693 | mTodoListView->setFocus(); |
694 | if ( mTodoListView->firstChild () ) { | ||
695 | if ( oldInc ) { | ||
696 | KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); | ||
697 | while ( item ) { | ||
698 | if ( item->todo() == oldInc ) { | ||
699 | mTodoListView->setCurrentItem( item ); | ||
700 | mTodoListView->ensureItemVisible( item ); | ||
701 | break; | ||
702 | } | ||
703 | item = (KOTodoViewItem*)item->itemBelow(); | ||
704 | } | ||
705 | if ( ! item ) | ||
706 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | ||
707 | } else { | ||
708 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | ||
709 | } | ||
710 | } | ||
689 | processSelectionChange(); | 711 | processSelectionChange(); |
690 | } | 712 | } |
691 | 713 | ||
692 | bool KOTodoView::checkTodo( Todo * todo ) | 714 | bool KOTodoView::checkTodo( Todo * todo ) |
693 | { | 715 | { |
694 | 716 | ||
695 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 717 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
696 | return false; | 718 | return false; |
697 | if ( !todo->isCompleted() ) { | 719 | if ( !todo->isCompleted() ) { |
698 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) | 720 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) |
699 | return true; | 721 | return true; |
700 | } | 722 | } |
701 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 723 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
702 | if ( todo->hasStartDate() ) | 724 | if ( todo->hasStartDate() ) |
703 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 725 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
704 | return false; | 726 | return false; |
705 | if ( todo->hasDueDate() ) | 727 | if ( todo->hasDueDate() ) |
706 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 728 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
707 | return false; | 729 | return false; |
708 | } | 730 | } |
709 | return true; | 731 | return true; |
710 | } | 732 | } |
711 | 733 | ||
712 | void KOTodoView::restoreItemState( QListViewItem *item ) | 734 | void KOTodoView::restoreItemState( QListViewItem *item ) |
713 | { | 735 | { |
714 | pendingSubtodo = 0; | 736 | pendingSubtodo = 0; |
715 | while( item ) { | 737 | while( item ) { |
716 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 738 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
717 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 739 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
718 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 740 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
719 | item = item->nextSibling(); | 741 | item = item->nextSibling(); |
720 | } | 742 | } |
721 | } | 743 | } |
722 | 744 | ||
723 | 745 | ||
724 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 746 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
725 | KOTodoView::insertTodoItem(Todo *todo) | 747 | KOTodoView::insertTodoItem(Todo *todo) |
726 | { | 748 | { |
727 | 749 | ||
728 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 750 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
729 | // TODO: Check, if dynmaic cast is necessary | 751 | // TODO: Check, if dynmaic cast is necessary |
730 | 752 | ||
731 | pendingSubtodo = 0; | 753 | pendingSubtodo = 0; |
732 | Incidence *incidence = todo->relatedTo(); | 754 | Incidence *incidence = todo->relatedTo(); |
733 | if (incidence && incidence->type() == "Todo") { | 755 | if (incidence && incidence->type() == "Todo") { |
734 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 756 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
735 | 757 | ||
736 | // kdDebug() << " has Related" << endl; | 758 | // kdDebug() << " has Related" << endl; |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 4f2cccf..2de7f28 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -242,97 +242,96 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
242 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 242 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
243 | SLOT( disableBR(bool) ) ); | 243 | SLOT( disableBR(bool) ) ); |
244 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 244 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
245 | mView->setModified( false ); | 245 | mView->setModified( false ); |
246 | mBlockAtStartup = false; | 246 | mBlockAtStartup = false; |
247 | mView->setModified( false ); | 247 | mView->setModified( false ); |
248 | setCentralWidget( mView ); | 248 | setCentralWidget( mView ); |
249 | globalFlagBlockStartup = 0; | 249 | globalFlagBlockStartup = 0; |
250 | mView->show(); | 250 | mView->show(); |
251 | delete splash; | 251 | delete splash; |
252 | if ( newFile ) | 252 | if ( newFile ) |
253 | mView->updateConfig(); | 253 | mView->updateConfig(); |
254 | // qApp->processEvents(); | 254 | // qApp->processEvents(); |
255 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 255 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
256 | //fillSyncMenu(); | 256 | //fillSyncMenu(); |
257 | 257 | ||
258 | 258 | ||
259 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 259 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
260 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 260 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
261 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 261 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 262 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 263 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
264 | mSyncManager->setDefaultFileName( sentSyncFile()); | 264 | mSyncManager->setDefaultFileName( sentSyncFile()); |
265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 265 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
266 | mSyncManager->fillSyncMenu(); | 266 | mSyncManager->fillSyncMenu(); |
267 | 267 | ||
268 | 268 | ||
269 | 269 | ||
270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 270 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
271 | if ( showWarning ) { | 271 | if ( showWarning ) { |
272 | KMessageBox::information( this, | 272 | KMessageBox::information( this, |
273 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 273 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
274 | qApp->processEvents(); | 274 | qApp->processEvents(); |
275 | mView->dialogManager()->showSyncOptions(); | 275 | mView->dialogManager()->showSyncOptions(); |
276 | } | 276 | } |
277 | 277 | ||
278 | //US listen for result adressed from Ka/Pi | 278 | //US listen for result adressed from Ka/Pi |
279 | #ifndef DESKTOP_VERSION | 279 | #ifndef DESKTOP_VERSION |
280 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 280 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
281 | #endif | 281 | #endif |
282 | #ifndef DESKTOP_VERSION | 282 | #ifndef DESKTOP_VERSION |
283 | infrared = 0; | 283 | infrared = 0; |
284 | #endif | 284 | #endif |
285 | updateWeek( mView->startDate() ); | 285 | updateWeek( mView->startDate() ); |
286 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 286 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
287 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 287 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
288 | mBRdisabled = false; | 288 | mBRdisabled = false; |
289 | //toggleBeamReceive(); | 289 | //toggleBeamReceive(); |
290 | setFocusPolicy ( WheelFocus ); | ||
291 | } | 290 | } |
292 | MainWindow::~MainWindow() | 291 | MainWindow::~MainWindow() |
293 | { | 292 | { |
294 | //qDebug("MainWindow::~MainWindow() "); | 293 | //qDebug("MainWindow::~MainWindow() "); |
295 | //save toolbar location | 294 | //save toolbar location |
296 | delete mCalendar; | 295 | delete mCalendar; |
297 | delete mSyncManager; | 296 | delete mSyncManager; |
298 | #ifndef DESKTOP_VERSION | 297 | #ifndef DESKTOP_VERSION |
299 | if ( infrared ) | 298 | if ( infrared ) |
300 | delete infrared; | 299 | delete infrared; |
301 | #endif | 300 | #endif |
302 | 301 | ||
303 | 302 | ||
304 | } | 303 | } |
305 | 304 | ||
306 | void MainWindow::disableBR(bool b) | 305 | void MainWindow::disableBR(bool b) |
307 | { | 306 | { |
308 | #ifndef DESKTOP_VERSION | 307 | #ifndef DESKTOP_VERSION |
309 | if ( b ) { | 308 | if ( b ) { |
310 | if ( infrared ) { | 309 | if ( infrared ) { |
311 | toggleBeamReceive(); | 310 | toggleBeamReceive(); |
312 | mBRdisabled = true; | 311 | mBRdisabled = true; |
313 | } | 312 | } |
314 | mBRdisabled = true; | 313 | mBRdisabled = true; |
315 | } else { | 314 | } else { |
316 | if ( mBRdisabled ) { | 315 | if ( mBRdisabled ) { |
317 | mBRdisabled = false; | 316 | mBRdisabled = false; |
318 | //makes no sense,because other cal ap is probably running | 317 | //makes no sense,because other cal ap is probably running |
319 | // toggleBeamReceive(); | 318 | // toggleBeamReceive(); |
320 | } | 319 | } |
321 | } | 320 | } |
322 | #endif | 321 | #endif |
323 | 322 | ||
324 | } | 323 | } |
325 | bool MainWindow::beamReceiveEnabled() | 324 | bool MainWindow::beamReceiveEnabled() |
326 | { | 325 | { |
327 | #ifndef DESKTOP_VERSION | 326 | #ifndef DESKTOP_VERSION |
328 | return ( infrared != 0 ); | 327 | return ( infrared != 0 ); |
329 | #endif | 328 | #endif |
330 | return false; | 329 | return false; |
331 | } | 330 | } |
332 | 331 | ||
333 | void MainWindow::toggleBeamReceive() | 332 | void MainWindow::toggleBeamReceive() |
334 | { | 333 | { |
335 | if ( mBRdisabled ) | 334 | if ( mBRdisabled ) |
336 | return; | 335 | return; |
337 | #ifndef DESKTOP_VERSION | 336 | #ifndef DESKTOP_VERSION |
338 | if ( infrared ) { | 337 | if ( infrared ) { |