-rw-r--r-- | korganizer/calendarview.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a46cd87..7ddbe23 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -245,93 +245,95 @@ void CalendarView::init() | |||
245 | mSelectedIncidence = 0; | 245 | mSelectedIncidence = 0; |
246 | mCalPrinter = 0; | 246 | mCalPrinter = 0; |
247 | mFilters.setAutoDelete(true); | 247 | mFilters.setAutoDelete(true); |
248 | 248 | ||
249 | mCalendar->registerObserver( this ); | 249 | mCalendar->registerObserver( this ); |
250 | // TODO: Make sure that view is updated, when calendar is changed. | 250 | // TODO: Make sure that view is updated, when calendar is changed. |
251 | 251 | ||
252 | mStorage = new FileStorage( mCalendar ); | 252 | mStorage = new FileStorage( mCalendar ); |
253 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 253 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
254 | 254 | ||
255 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 255 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
256 | #ifndef KORG_NOSPLITTER | 256 | #ifndef KORG_NOSPLITTER |
257 | // create the main layout frames. | 257 | // create the main layout frames. |
258 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 258 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
259 | topLayout->addWidget(mPanner); | 259 | topLayout->addWidget(mPanner); |
260 | 260 | ||
261 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 261 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
262 | "CalendarView::LeftFrame"); | 262 | "CalendarView::LeftFrame"); |
263 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 263 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
264 | 264 | ||
265 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, | 265 | mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, |
266 | "CalendarView::DateNavigator", QDate::currentDate() ); | 266 | "CalendarView::DateNavigator", QDate::currentDate() ); |
267 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 267 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
268 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 268 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
269 | mTodoList->setNavigator( mNavigator ); | ||
269 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 270 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
270 | 271 | ||
271 | #ifdef KORG_NORESOURCEVIEW | 272 | #ifdef KORG_NORESOURCEVIEW |
272 | mResourceView = 0; | 273 | mResourceView = 0; |
273 | #else | 274 | #else |
274 | if ( mResourceManager ) { | 275 | if ( mResourceManager ) { |
275 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 276 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
276 | mResourceView->updateView(); | 277 | mResourceView->updateView(); |
277 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 278 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
278 | SLOT( updateView() ) ); | 279 | SLOT( updateView() ) ); |
279 | } else { | 280 | } else { |
280 | mResourceView = 0; | 281 | mResourceView = 0; |
281 | } | 282 | } |
282 | #endif | 283 | #endif |
283 | QWidget *rightBox = new QWidget( mPanner ); | 284 | QWidget *rightBox = new QWidget( mPanner ); |
284 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 285 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
285 | 286 | ||
286 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 287 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
287 | rightLayout->addWidget( mNavigatorBar ); | 288 | rightLayout->addWidget( mNavigatorBar ); |
288 | 289 | ||
289 | mRightFrame = new QWidgetStack( rightBox ); | 290 | mRightFrame = new QWidgetStack( rightBox ); |
290 | rightLayout->addWidget( mRightFrame, 1 ); | 291 | rightLayout->addWidget( mRightFrame, 1 ); |
291 | 292 | ||
292 | mLeftFrame = mLeftSplitter; | 293 | mLeftFrame = mLeftSplitter; |
293 | #else | 294 | #else |
294 | QWidget *mainBox = new QWidget( this ); | 295 | QWidget *mainBox = new QWidget( this ); |
295 | QWidget *leftFrame = new QWidget( mainBox ); | 296 | QWidget *leftFrame = new QWidget( mainBox ); |
296 | 297 | ||
297 | QBoxLayout * mainBoxLayout; | 298 | QBoxLayout * mainBoxLayout; |
298 | QBoxLayout * leftFrameLayout; | 299 | QBoxLayout * leftFrameLayout; |
299 | if ( KOPrefs::instance()->mVerticalScreen ) { | 300 | if ( KOPrefs::instance()->mVerticalScreen ) { |
300 | mainBoxLayout = new QVBoxLayout(mainBox); | 301 | mainBoxLayout = new QVBoxLayout(mainBox); |
301 | leftFrameLayout = new QHBoxLayout(leftFrame ); | 302 | leftFrameLayout = new QHBoxLayout(leftFrame ); |
302 | } else { | 303 | } else { |
303 | mainBoxLayout = new QHBoxLayout(mainBox); | 304 | mainBoxLayout = new QHBoxLayout(mainBox); |
304 | leftFrameLayout = new QVBoxLayout(leftFrame ); | 305 | leftFrameLayout = new QVBoxLayout(leftFrame ); |
305 | } | 306 | } |
306 | topLayout->addWidget( mainBox ); | 307 | topLayout->addWidget( mainBox ); |
307 | mainBoxLayout->addWidget (leftFrame); | 308 | mainBoxLayout->addWidget (leftFrame); |
308 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, | 309 | mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, |
309 | "CalendarView::DateNavigator", QDate::currentDate()); | 310 | "CalendarView::DateNavigator", QDate::currentDate()); |
310 | // mDateNavigator->blockSignals( true ); | 311 | // mDateNavigator->blockSignals( true ); |
311 | leftFrameLayout->addWidget( mDateNavigator ); | 312 | leftFrameLayout->addWidget( mDateNavigator ); |
312 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); | 313 | mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); |
313 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); | 314 | mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); |
315 | mTodoList->setNavigator( mNavigator ); | ||
314 | 316 | ||
315 | if ( QApplication::desktop()->width() < 480 ) { | 317 | if ( QApplication::desktop()->width() < 480 ) { |
316 | leftFrameLayout->addWidget(mFilterView); | 318 | leftFrameLayout->addWidget(mFilterView); |
317 | leftFrameLayout->addWidget(mTodoList, 2 ); | 319 | leftFrameLayout->addWidget(mTodoList, 2 ); |
318 | 320 | ||
319 | } else { | 321 | } else { |
320 | leftFrameLayout->addWidget(mTodoList,2 ); | 322 | leftFrameLayout->addWidget(mTodoList,2 ); |
321 | leftFrameLayout->addWidget(mFilterView ); | 323 | leftFrameLayout->addWidget(mFilterView ); |
322 | } | 324 | } |
323 | mFilterView->hide(); | 325 | mFilterView->hide(); |
324 | QWidget *rightBox = new QWidget( mainBox ); | 326 | QWidget *rightBox = new QWidget( mainBox ); |
325 | mainBoxLayout->addWidget ( rightBox, 10 ); | 327 | mainBoxLayout->addWidget ( rightBox, 10 ); |
326 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 328 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
327 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); | 329 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); |
328 | mRightFrame = new QWidgetStack( rightBox ); | 330 | mRightFrame = new QWidgetStack( rightBox ); |
329 | rightLayout->addWidget( mNavigatorBar ); | 331 | rightLayout->addWidget( mNavigatorBar ); |
330 | rightLayout->addWidget( mRightFrame, 10 ); | 332 | rightLayout->addWidget( mRightFrame, 10 ); |
331 | 333 | ||
332 | mLeftFrame = leftFrame; | 334 | mLeftFrame = leftFrame; |
333 | if ( KOPrefs::instance()->mVerticalScreen ) { | 335 | if ( KOPrefs::instance()->mVerticalScreen ) { |
334 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 336 | mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
335 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 337 | leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
336 | } else { | 338 | } else { |
337 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 339 | mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
@@ -2123,48 +2125,50 @@ void CalendarView::changeEventDisplay(Event *which, int action) | |||
2123 | 2125 | ||
2124 | 2126 | ||
2125 | void CalendarView::updateTodoViews() | 2127 | void CalendarView::updateTodoViews() |
2126 | { | 2128 | { |
2127 | 2129 | ||
2128 | mTodoList->updateView(); | 2130 | mTodoList->updateView(); |
2129 | mViewManager->currentView()->updateView(); | 2131 | mViewManager->currentView()->updateView(); |
2130 | 2132 | ||
2131 | } | 2133 | } |
2132 | 2134 | ||
2133 | 2135 | ||
2134 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2136 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2135 | { | 2137 | { |
2136 | mTodoList->updateView(); | 2138 | mTodoList->updateView(); |
2137 | mViewManager->updateView(start, end); | 2139 | mViewManager->updateView(start, end); |
2138 | //mDateNavigator->updateView(); | 2140 | //mDateNavigator->updateView(); |
2139 | } | 2141 | } |
2140 | 2142 | ||
2141 | void CalendarView::updateView() | 2143 | void CalendarView::updateView() |
2142 | { | 2144 | { |
2143 | DateList tmpList = mNavigator->selectedDates(); | 2145 | DateList tmpList = mNavigator->selectedDates(); |
2144 | 2146 | ||
2145 | // We assume that the navigator only selects consecutive days. | 2147 | // We assume that the navigator only selects consecutive days. |
2146 | updateView( tmpList.first(), tmpList.last() ); | 2148 | updateView( tmpList.first(), tmpList.last() ); |
2149 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | ||
2150 | mTodoList->updateView(); | ||
2147 | } | 2151 | } |
2148 | 2152 | ||
2149 | void CalendarView::updateUnmanagedViews() | 2153 | void CalendarView::updateUnmanagedViews() |
2150 | { | 2154 | { |
2151 | mDateNavigator->updateDayMatrix(); | 2155 | mDateNavigator->updateDayMatrix(); |
2152 | } | 2156 | } |
2153 | 2157 | ||
2154 | int CalendarView::msgItemDelete() | 2158 | int CalendarView::msgItemDelete() |
2155 | { | 2159 | { |
2156 | return KMessageBox::warningContinueCancel(this, | 2160 | return KMessageBox::warningContinueCancel(this, |
2157 | i18n("This item will be\npermanently deleted."), | 2161 | i18n("This item will be\npermanently deleted."), |
2158 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2162 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2159 | } | 2163 | } |
2160 | 2164 | ||
2161 | 2165 | ||
2162 | void CalendarView::edit_cut() | 2166 | void CalendarView::edit_cut() |
2163 | { | 2167 | { |
2164 | Event *anEvent=0; | 2168 | Event *anEvent=0; |
2165 | 2169 | ||
2166 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2170 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2167 | 2171 | ||
2168 | if (mViewManager->currentView()->isEventView()) { | 2172 | if (mViewManager->currentView()->isEventView()) { |
2169 | if ( incidence && incidence->type() == "Event" ) { | 2173 | if ( incidence && incidence->type() == "Event" ) { |
2170 | anEvent = static_cast<Event *>(incidence); | 2174 | anEvent = static_cast<Event *>(incidence); |