summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-19 11:30:17 (UTC)
committer zautrix <zautrix>2005-03-19 11:30:17 (UTC)
commitea9e00a1f70e9c3c855707213b51c6b6d43c330c (patch) (unidiff)
tree55237352955511fccb58ee5aa4ae56866fd107c6
parent297208a61298fceab6d96bbd1c46198b1c0f7a76 (diff)
downloadkdepimpi-ea9e00a1f70e9c3c855707213b51c6b6d43c330c.zip
kdepimpi-ea9e00a1f70e9c3c855707213b51c6b6d43c330c.tar.gz
kdepimpi-ea9e00a1f70e9c3c855707213b51c6b6d43c330c.tar.bz2
daylables moved down
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp44
1 files changed, 11 insertions, 33 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 8448a4c..d7ea4d4 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -181,469 +181,447 @@ void TimeLabels::updateConfig()
181 // set the font 181 // set the font
182 // config->setGroup("Fonts"); 182 // config->setGroup("Fonts");
183 // QFont font = config->readFontEntry("TimeBar Font"); 183 // QFont font = config->readFontEntry("TimeBar Font");
184 setFont(KOPrefs::instance()->mTimeBarFont); 184 setFont(KOPrefs::instance()->mTimeBarFont);
185 185
186 // update geometry restrictions based on new settings 186 // update geometry restrictions based on new settings
187 setFixedWidth(minimumWidth()); 187 setFixedWidth(minimumWidth());
188 188
189 // update HourSize 189 // update HourSize
190 mCellHeight = KOPrefs::instance()->mHourSize*4; 190 mCellHeight = KOPrefs::instance()->mHourSize*4;
191 resizeContents(50,mRows * mCellHeight); 191 resizeContents(50,mRows * mCellHeight);
192} 192}
193 193
194/** update time label positions */ 194/** update time label positions */
195void TimeLabels::positionChanged() 195void TimeLabels::positionChanged()
196{ 196{
197 int adjustment = mAgenda->contentsY(); 197 int adjustment = mAgenda->contentsY();
198 setContentsPos(0, adjustment); 198 setContentsPos(0, adjustment);
199} 199}
200 200
201/** */ 201/** */
202void TimeLabels::setAgenda(KOAgenda* agenda) 202void TimeLabels::setAgenda(KOAgenda* agenda)
203{ 203{
204 mAgenda = agenda; 204 mAgenda = agenda;
205} 205}
206 206
207void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) 207void TimeLabels::contentsMousePressEvent ( QMouseEvent * e)
208{ 208{
209 mMouseDownY = e->pos().y(); 209 mMouseDownY = e->pos().y();
210 mOrgCap = topLevelWidget()->caption(); 210 mOrgCap = topLevelWidget()->caption();
211} 211}
212 212
213void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) 213void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e )
214{ 214{
215 int diff = mMouseDownY - e->pos().y(); 215 int diff = mMouseDownY - e->pos().y();
216 if ( diff < 10 && diff > -10 ) 216 if ( diff < 10 && diff > -10 )
217 return; 217 return;
218 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; 218 int tSize = KOPrefs::instance()->mHourSize + (diff/10) ;
219 if ( tSize < 4 ) 219 if ( tSize < 4 )
220 tSize = 4; 220 tSize = 4;
221 if ( tSize > 22 ) 221 if ( tSize > 22 )
222 tSize = 22; 222 tSize = 22;
223 tSize = (tSize-2)/2; 223 tSize = (tSize-2)/2;
224 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); 224 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize));
225 225
226} 226}
227void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) 227void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e )
228{ 228{
229 topLevelWidget()->setCaption( mOrgCap ); 229 topLevelWidget()->setCaption( mOrgCap );
230 int diff = mMouseDownY - e->pos().y(); 230 int diff = mMouseDownY - e->pos().y();
231 if ( diff < 10 && diff > -10 ) 231 if ( diff < 10 && diff > -10 )
232 return; 232 return;
233 int tSize = KOPrefs::instance()->mHourSize + (diff/10); 233 int tSize = KOPrefs::instance()->mHourSize + (diff/10);
234 if ( tSize < 4 ) 234 if ( tSize < 4 )
235 tSize = 4; 235 tSize = 4;
236 if ( tSize > 22 ) 236 if ( tSize > 22 )
237 tSize = 22; 237 tSize = 22;
238 tSize = (tSize/2)*2; 238 tSize = (tSize/2)*2;
239 if ( tSize == KOPrefs::instance()->mHourSize ) 239 if ( tSize == KOPrefs::instance()->mHourSize )
240 return; 240 return;
241 KOPrefs::instance()->mHourSize = tSize; 241 KOPrefs::instance()->mHourSize = tSize;
242 emit scaleChanged(); 242 emit scaleChanged();
243} 243}
244 244
245/** This is called in response to repaint() */ 245/** This is called in response to repaint() */
246void TimeLabels::paintEvent(QPaintEvent*) 246void TimeLabels::paintEvent(QPaintEvent*)
247{ 247{
248 248
249 // kdDebug() << "paintevent..." << endl; 249 // kdDebug() << "paintevent..." << endl;
250 // this is another hack! 250 // this is another hack!
251 // QPainter painter(this); 251 // QPainter painter(this);
252 //QString c 252 //QString c
253 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); 253 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight());
254} 254}
255 255
256//////////////////////////////////////////////////////////////////////////// 256////////////////////////////////////////////////////////////////////////////
257 257
258EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) 258EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name)
259 : QFrame(parent,name) 259 : QFrame(parent,name)
260{ 260{
261 mColumns = 1; 261 mColumns = 1;
262 mTopBox = 0; 262 mTopBox = 0;
263 mLocation = loc; 263 mLocation = loc;
264 mTopLayout = 0; 264 mTopLayout = 0;
265 mPaintWidget = 0; 265 mPaintWidget = 0;
266 mXOffset = 0; 266 mXOffset = 0;
267 if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); 267 if (mLocation == Top) mPixmap = SmallIcon("1uparrow");
268 else mPixmap = SmallIcon("1downarrow"); 268 else mPixmap = SmallIcon("1downarrow");
269 mEnabled.resize(mColumns); 269 mEnabled.resize(mColumns);
270 if (mLocation == Top) 270 if (mLocation == Top)
271 setMaximumHeight(0); 271 setMaximumHeight(0);
272 else 272 else
273 setMinimumHeight(mPixmap.height()); 273 setMinimumHeight(mPixmap.height());
274} 274}
275 275
276EventIndicator::~EventIndicator() 276EventIndicator::~EventIndicator()
277{ 277{
278} 278}
279 279
280void EventIndicator::drawContents(QPainter *p) 280void EventIndicator::drawContents(QPainter *p)
281{ 281{
282 282
283 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; 283 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl;
284 KDGanttSplitterHandle* han = 0; 284 KDGanttSplitterHandle* han = 0;
285 if ( mPaintWidget ) 285 if ( mPaintWidget )
286 han = mPaintWidget->firstHandle(); 286 han = mPaintWidget->firstHandle();
287 if ( ! han ) { 287 if ( ! han ) {
288 int i; 288 int i;
289 for(i=0;i<mColumns;++i) { 289 for(i=0;i<mColumns;++i) {
290 if (mEnabled[i]) { 290 if (mEnabled[i]) {
291 int cellWidth = contentsRect().right()/mColumns; 291 int cellWidth = contentsRect().right()/mColumns;
292 int xOffset = KOGlobals::self()->reverseLayout() ? 292 int xOffset = KOGlobals::self()->reverseLayout() ?
293 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : 293 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 :
294 i*cellWidth + cellWidth/2 -mPixmap.width()/2; 294 i*cellWidth + cellWidth/2 -mPixmap.width()/2;
295 p->drawPixmap(QPoint(xOffset,0),mPixmap); 295 p->drawPixmap(QPoint(xOffset,0),mPixmap);
296 } 296 }
297 } 297 }
298 } else { 298 } else {
299 han->repaint(); 299 han->repaint();
300 //mPaintWidget->setBackgroundColor( red ); 300 //mPaintWidget->setBackgroundColor( red );
301 301
302 QPainter pa( han ); 302 QPainter pa( han );
303 int i; 303 int i;
304 bool setColor = false; 304 bool setColor = false;
305 for(i=0;i<mColumns;++i) { 305 for(i=0;i<mColumns;++i) {
306 if (mEnabled[i]) { 306 if (mEnabled[i]) {
307 setColor = true; 307 setColor = true;
308 308
309 int cellWidth = contentsRect().right()/mColumns; 309 int cellWidth = contentsRect().right()/mColumns;
310 int xOffset = KOGlobals::self()->reverseLayout() ? 310 int xOffset = KOGlobals::self()->reverseLayout() ?
311 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : 311 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 :
312 i*cellWidth + cellWidth/2 -mPixmap.width()/2; 312 i*cellWidth + cellWidth/2 -mPixmap.width()/2;
313 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); 313 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap);
314 //qDebug("222draw pix %d ",xOffset ); 314 //qDebug("222draw pix %d ",xOffset );
315 315
316 } 316 }
317 317
318 } 318 }
319 pa.end(); 319 pa.end();
320 320
321 } 321 }
322} 322}
323 323
324void EventIndicator::setXOffset( int x ) 324void EventIndicator::setXOffset( int x )
325{ 325{
326 mXOffset = x; 326 mXOffset = x;
327} 327}
328void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) 328void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w )
329{ 329{
330 mPaintWidget = w; 330 mPaintWidget = w;
331} 331}
332void EventIndicator::changeColumns(int columns) 332void EventIndicator::changeColumns(int columns)
333{ 333{
334 mColumns = columns; 334 mColumns = columns;
335 mEnabled.resize(mColumns); 335 mEnabled.resize(mColumns);
336 336
337 update(); 337 update();
338} 338}
339 339
340void EventIndicator::enableColumn(int column, bool enable) 340void EventIndicator::enableColumn(int column, bool enable)
341{ 341{
342 mEnabled[column] = enable; 342 mEnabled[column] = enable;
343} 343}
344 344
345 345
346//////////////////////////////////////////////////////////////////////////// 346////////////////////////////////////////////////////////////////////////////
347//////////////////////////////////////////////////////////////////////////// 347////////////////////////////////////////////////////////////////////////////
348//////////////////////////////////////////////////////////////////////////// 348////////////////////////////////////////////////////////////////////////////
349 349
350KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : 350KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
351 KOEventView (cal,parent,name) 351 KOEventView (cal,parent,name)
352{ 352{
353 mBlockUpdating = true; 353 mBlockUpdating = true;
354 mStartHour = 8; 354 mStartHour = 8;
355 mSelectedDates.append(QDate::currentDate()); 355 mSelectedDates.append(QDate::currentDate());
356 356
357 mLayoutDayLabels = 0; 357 mLayoutDayLabels = 0;
358 mDayLabelsFrame = 0; 358 mDayLabelsFrame = 0;
359 mDayLabels = 0; 359 mDayLabels = 0;
360 bool isRTL = KOGlobals::self()->reverseLayout(); 360 bool isRTL = KOGlobals::self()->reverseLayout();
361 361
362 if ( KOPrefs::instance()->mVerticalScreen ) { 362 if ( KOPrefs::instance()->mVerticalScreen ) {
363 mExpandedPixmap = SmallIcon( "1downarrow" ); 363 mExpandedPixmap = SmallIcon( "1downarrow" );
364 mNotExpandedPixmap = SmallIcon( "1uparrow" ); 364 mNotExpandedPixmap = SmallIcon( "1uparrow" );
365 } else { 365 } else {
366 mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); 366 mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" );
367 mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); 367 mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" );
368 } 368 }
369 369
370 QBoxLayout *topLayout = new QVBoxLayout(this); 370 QBoxLayout *topLayout = new QVBoxLayout(this);
371 371
372 // Create day name labels for agenda columns 372 // Create day name labels for agenda columns
373 mDayLabelsFrame = new QHBox(this);
374 topLayout->addWidget(mDayLabelsFrame);
375 mDayLabels = new QFrame (mDayLabelsFrame);
376 mLayoutDayLabels = new QHBoxLayout(mDayLabels);
377 // Create agenda splitter 373 // Create agenda splitter
378#ifndef KORG_NOSPLITTER
379 mSplitterAgenda = new QSplitter(Vertical,this);
380 topLayout->addWidget(mSplitterAgenda);
381 mSplitterAgenda->setOpaqueResize();
382
383 mAllDayFrame = new QHBox(mSplitterAgenda);
384 374
385 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
386#else
387#if 0
388 QWidget *mainBox = new QWidget( this );
389 topLayout->addWidget( mainBox );
390 QBoxLayout *mainLayout = new QVBoxLayout(mainBox);
391 mAllDayFrame = new QHBox(mainBox);
392 mainLayout->addWidget(mAllDayFrame);
393 mainLayout->setStretchFactor( mAllDayFrame, 0 );
394 mAllDayFrame->setFocusPolicy(NoFocus);
395 QWidget *agendaFrame = new QWidget(mainBox);
396 mainLayout->addWidget(agendaFrame);
397 mainLayout->setStretchFactor( agendaFrame, 10 );
398
399 agendaFrame->setFocusPolicy(NoFocus);
400#endif
401 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); 375 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
402 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 376 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
403 topLayout->addWidget( mSplitterAgenda ); 377 topLayout->addWidget( mSplitterAgenda );
404 mAllDayFrame = new QHBox(mSplitterAgenda); 378 mAllDayFrame = new QHBox(mSplitterAgenda);
405 mAllDayFrame->setFocusPolicy(NoFocus); 379 mAllDayFrame->setFocusPolicy(NoFocus);
406 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 380 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
407 agendaFrame->setFocusPolicy(NoFocus); 381 agendaFrame->setFocusPolicy(NoFocus);
408 382
409#endif
410
411 // Create all-day agenda widget 383 // Create all-day agenda widget
412 mDummyAllDayLeft = new QVBox( mAllDayFrame ); 384 mDummyAllDayLeft = new QVBox( mAllDayFrame );
413 385
414 mExpandButton = new QPushButton(mDummyAllDayLeft); 386 mExpandButton = new QPushButton(mDummyAllDayLeft);
415 mExpandButton->setPixmap( mNotExpandedPixmap ); 387 mExpandButton->setPixmap( mNotExpandedPixmap );
416 int widebut = mExpandButton->sizeHint().width(); 388 int widebut = mExpandButton->sizeHint().width();
417 if ( QApplication::desktop()->width() < 480 ) 389 if ( QApplication::desktop()->width() < 480 )
418 widebut = widebut*2; 390 widebut = widebut*2;
419 else 391 else
420 widebut = (widebut*3) / 2; 392 widebut = (widebut*3) / 2;
421 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, 393 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
422 // QSizePolicy::Fixed ) ); 394 // QSizePolicy::Fixed ) );
423 mExpandButton->setFixedSize( widebut, widebut); 395 mExpandButton->setFixedSize( widebut, widebut);
424 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); 396 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
425 mExpandButton->setFocusPolicy(NoFocus); 397 mExpandButton->setFocusPolicy(NoFocus);
426 mAllDayAgenda = new KOAgenda(1,mAllDayFrame); 398 mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
427 mAllDayAgenda->setFocusPolicy(NoFocus); 399 mAllDayAgenda->setFocusPolicy(NoFocus);
428 QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); 400 QLabel *dummyAllDayRight = new QLabel (mAllDayFrame);
429 401
430 // Create event context menu for all day agenda 402 // Create event context menu for all day agenda
431 mAllDayAgendaPopup = eventPopup(); 403 mAllDayAgendaPopup = eventPopup();
432 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 404 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
433 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 405 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
434 406
435 // Create agenda frame 407 // Create agenda frame
436 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); 408 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3);
437 // QHBox *agendaFrame = new QHBox(splitterAgenda); 409 // QHBox *agendaFrame = new QHBox(splitterAgenda);
438 410
439 // create event indicator bars 411 // create event indicator bars
440 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); 412 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
441 agendaLayout->addWidget(mEventIndicatorTop,0,1); 413 agendaLayout->addWidget(mEventIndicatorTop,0,1);
414
415 mDayLabelsFrame = new QHBox(agendaFrame);
416 //topLayout->addWidget(mDayLabelsFrame);
417 mDayLabels = new QFrame (mDayLabelsFrame);
418 mLayoutDayLabels = new QHBoxLayout(mDayLabels);
419 agendaLayout->addMultiCellWidget(mDayLabelsFrame ,1,1,0,2);
442 mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); 420 mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
443 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, 421 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
444 agendaFrame); 422 agendaFrame);
445 agendaLayout->addWidget(mEventIndicatorBottom,2,1); 423 agendaLayout->addWidget(mEventIndicatorBottom,3,1);
446 QWidget *dummyAgendaRight = new QWidget(agendaFrame); 424 QWidget *dummyAgendaRight = new QWidget(agendaFrame);
447 agendaLayout->addWidget(dummyAgendaRight,0,2); 425 agendaLayout->addWidget(dummyAgendaRight,0,2);
448 426
449 // Create time labels 427 // Create time labels
450 mTimeLabels = new TimeLabels(24,agendaFrame); 428 mTimeLabels = new TimeLabels(24,agendaFrame);
451 agendaLayout->addWidget(mTimeLabels,1,0); 429 agendaLayout->addWidget(mTimeLabels,2,0);
452 connect(mTimeLabels,SIGNAL( scaleChanged()), 430 connect(mTimeLabels,SIGNAL( scaleChanged()),
453 this,SLOT(updateConfig())); 431 this,SLOT(updateConfig()));
454 432
455 // Create agenda 433 // Create agenda
456 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); 434 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
457 agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); 435 agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2);
458 agendaLayout->setColStretch(1,1); 436 agendaLayout->setColStretch(1,1);
459 mAgenda->setFocusPolicy(NoFocus); 437 mAgenda->setFocusPolicy(NoFocus);
460 // Create event context menu for agenda 438 // Create event context menu for agenda
461 mAgendaPopup = eventPopup(); 439 mAgendaPopup = eventPopup();
462 440
463 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), 441 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")),
464 i18n("Toggle Alarm"),mAgenda, 442 i18n("Toggle Alarm"),mAgenda,
465 SLOT(popupAlarm()),true); 443 SLOT(popupAlarm()),true);
466 444
467 445
468 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 446 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
469 mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 447 mAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
470 448
471 // make connections between dependent widgets 449 // make connections between dependent widgets
472 mTimeLabels->setAgenda(mAgenda); 450 mTimeLabels->setAgenda(mAgenda);
473 451
474 // Update widgets to reflect user preferences 452 // Update widgets to reflect user preferences
475 // updateConfig(); 453 // updateConfig();
476 454
477 // createDayLabels(); 455 // createDayLabels();
478 456
479 // these blank widgets make the All Day Event box line up with the agenda 457 // these blank widgets make the All Day Event box line up with the agenda
480 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 458 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
481 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 459 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
482 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 460 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
483 461
484 // Scrolling 462 // Scrolling
485 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), 463 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)),
486 mTimeLabels, SLOT(positionChanged())); 464 mTimeLabels, SLOT(positionChanged()));
487 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), 465 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)),
488 SLOT(setContentsPos(int))); 466 SLOT(setContentsPos(int)));
489 467
490 connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); 468 connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate )));
491 connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); 469 connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate )));
492 470
493 // Create/Show/Edit/Delete Event 471 // Create/Show/Edit/Delete Event
494 connect(mAgenda,SIGNAL(newEventSignal(int,int)), 472 connect(mAgenda,SIGNAL(newEventSignal(int,int)),
495 SLOT(newEvent(int,int))); 473 SLOT(newEvent(int,int)));
496 connect(mAgenda,SIGNAL(newTodoSignal(int,int)), 474 connect(mAgenda,SIGNAL(newTodoSignal(int,int)),
497 SLOT(newTodo(int,int))); 475 SLOT(newTodo(int,int)));
498 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), 476 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)),
499 SLOT(newEvent(int,int,int,int))); 477 SLOT(newEvent(int,int,int,int)));
500 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), 478 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)),
501 SLOT(newEventAllDay(int,int))); 479 SLOT(newEventAllDay(int,int)));
502 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), 480 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)),
503 SLOT(newTodoAllDay(int,int))); 481 SLOT(newTodoAllDay(int,int)));
504 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), 482 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)),
505 SLOT(newEventAllDay(int,int))); 483 SLOT(newEventAllDay(int,int)));
506 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 484 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
507 SLOT(newTimeSpanSelected(int,int,int,int))); 485 SLOT(newTimeSpanSelected(int,int,int,int)));
508 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 486 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
509 SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); 487 SLOT(newTimeSpanSelectedAllDay(int,int,int,int)));
510 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 488 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
511 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 489 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
512 490
513 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 491 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
514 SIGNAL(editIncidenceSignal(Incidence *))); 492 SIGNAL(editIncidenceSignal(Incidence *)));
515 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 493 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
516 SIGNAL(editIncidenceSignal(Incidence *))); 494 SIGNAL(editIncidenceSignal(Incidence *)));
517 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 495 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
518 SIGNAL(showIncidenceSignal(Incidence *))); 496 SIGNAL(showIncidenceSignal(Incidence *)));
519 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 497 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
520 SIGNAL(showIncidenceSignal(Incidence *))); 498 SIGNAL(showIncidenceSignal(Incidence *)));
521 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 499 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
522 SIGNAL(deleteIncidenceSignal(Incidence *))); 500 SIGNAL(deleteIncidenceSignal(Incidence *)));
523 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 501 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
524 SIGNAL(deleteIncidenceSignal(Incidence *))); 502 SIGNAL(deleteIncidenceSignal(Incidence *)));
525 503
526 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 504 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
527 SLOT(updateEventDates(KOAgendaItem *, int ))); 505 SLOT(updateEventDates(KOAgendaItem *, int )));
528 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 506 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
529 SLOT(updateEventDates(KOAgendaItem *, int))); 507 SLOT(updateEventDates(KOAgendaItem *, int)));
530 508
531 // event indicator update 509 // event indicator update
532 connect(mAgenda,SIGNAL(lowerYChanged(int)), 510 connect(mAgenda,SIGNAL(lowerYChanged(int)),
533 SLOT(updateEventIndicatorTop(int))); 511 SLOT(updateEventIndicatorTop(int)));
534 connect(mAgenda,SIGNAL(upperYChanged(int)), 512 connect(mAgenda,SIGNAL(upperYChanged(int)),
535 SLOT(updateEventIndicatorBottom(int))); 513 SLOT(updateEventIndicatorBottom(int)));
536 // drag signals 514 // drag signals
537 /* 515 /*
538 connect(mAgenda,SIGNAL(startDragSignal(Event *)), 516 connect(mAgenda,SIGNAL(startDragSignal(Event *)),
539 SLOT(startDrag(Event *))); 517 SLOT(startDrag(Event *)));
540 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), 518 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)),
541 SLOT(startDrag(Event *))); 519 SLOT(startDrag(Event *)));
542 */ 520 */
543 // synchronize selections 521 // synchronize selections
544 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 522 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
545 mAllDayAgenda, SLOT( deselectItem() ) ); 523 mAllDayAgenda, SLOT( deselectItem() ) );
546 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 524 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
547 mAgenda, SLOT( deselectItem() ) ); 525 mAgenda, SLOT( deselectItem() ) );
548 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 526 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
549 SIGNAL( incidenceSelected( Incidence * ) ) ); 527 SIGNAL( incidenceSelected( Incidence * ) ) );
550 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 528 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
551 SIGNAL( incidenceSelected( Incidence * ) ) ); 529 SIGNAL( incidenceSelected( Incidence * ) ) );
552 connect( mAgenda, SIGNAL( resizedSignal() ), 530 connect( mAgenda, SIGNAL( resizedSignal() ),
553 SLOT( updateConfig( ) ) ); 531 SLOT( updateConfig( ) ) );
554 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), 532 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ),
555 SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); 533 SLOT( addToCalSlot(Incidence *, Incidence * ) ) );
556 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), 534 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ),
557 SLOT( addToCalSlot(Incidence * , Incidence *) ) ); 535 SLOT( addToCalSlot(Incidence * , Incidence *) ) );
558 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 536 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
559 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 537 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
560 538
561 539
562} 540}
563 541
564void KOAgendaView::toggleAllDay() 542void KOAgendaView::toggleAllDay()
565{ 543{
566 if ( mSplitterAgenda->firstHandle() ) 544 if ( mSplitterAgenda->firstHandle() )
567 mSplitterAgenda->firstHandle()->toggle(); 545 mSplitterAgenda->firstHandle()->toggle();
568} 546}
569void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) 547void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
570{ 548{
571 calendar()->addIncidence( inc ); 549 calendar()->addIncidence( inc );
572 550
573 if ( incOld ) { 551 if ( incOld ) {
574 if ( incOld->type() == "Todo" ) 552 if ( incOld->type() == "Todo" )
575 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); 553 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
576 else 554 else
577 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); 555 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED);
578 } 556 }
579 557
580} 558}
581 559
582KOAgendaView::~KOAgendaView() 560KOAgendaView::~KOAgendaView()
583{ 561{
584 delete mAgendaPopup; 562 delete mAgendaPopup;
585 delete mAllDayAgendaPopup; 563 delete mAllDayAgendaPopup;
586 delete KOAgendaItem::paintPix(); 564 delete KOAgendaItem::paintPix();
587 delete KOAgendaItem::paintPixSel(); 565 delete KOAgendaItem::paintPixSel();
588} 566}
589void KOAgendaView::resizeEvent( QResizeEvent* e ) 567void KOAgendaView::resizeEvent( QResizeEvent* e )
590{ 568{
591 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); 569 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width());
592 bool uc = false; 570 bool uc = false;
593 int ow = e->oldSize().width(); 571 int ow = e->oldSize().width();
594 int oh = e->oldSize().height(); 572 int oh = e->oldSize().height();
595 int w = e->size().width(); 573 int w = e->size().width();
596 int h = e->size().height(); 574 int h = e->size().height();
597 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { 575 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) {
598 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) 576 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda )
599 uc = true; 577 uc = true;
600 //qDebug("view changed %d %d %d %d ", ow, oh , w , h); 578 //qDebug("view changed %d %d %d %d ", ow, oh , w , h);
601 } 579 }
602 mUpcomingWidth = e->size().width() ; 580 mUpcomingWidth = e->size().width() ;
603 if ( mBlockUpdating || uc ) { 581 if ( mBlockUpdating || uc ) {
604 mBlockUpdating = false; 582 mBlockUpdating = false;
605 //mAgenda->setMinimumSize(800 , 600 ); 583 //mAgenda->setMinimumSize(800 , 600 );
606 //qDebug("mAgenda->resize+++++++++++++++ "); 584 //qDebug("mAgenda->resize+++++++++++++++ ");
607 updateConfig(); 585 updateConfig();
608 //qDebug("KOAgendaView::Updating now possible "); 586 //qDebug("KOAgendaView::Updating now possible ");
609 } else 587 } else
610 createDayLabels(); 588 createDayLabels();
611 //qDebug("resizeEvent end "); 589 //qDebug("resizeEvent end ");
612 590
613} 591}
614void KOAgendaView::slotDaylabelClicked( int num ) 592void KOAgendaView::slotDaylabelClicked( int num )
615{ 593{
616 594
617 QDate firstDate = mSelectedDates.first(); 595 QDate firstDate = mSelectedDates.first();
618 if ( num == -1 ) 596 if ( num == -1 )
619 emit showDateView( 6, firstDate ); 597 emit showDateView( 6, firstDate );
620 else if (num >= 0 ) { 598 else if (num >= 0 ) {
621 if ( mSelectedDates.count() == 1) 599 if ( mSelectedDates.count() == 1)
622 emit showDateView( 9, firstDate.addDays( num ) ); 600 emit showDateView( 9, firstDate.addDays( num ) );
623 else 601 else
624 emit showDateView( 3, firstDate.addDays( num ) ); 602 emit showDateView( 3, firstDate.addDays( num ) );
625 } 603 }
626 else 604 else
627 showDateView( 10, firstDate.addDays(1) ); 605 showDateView( 10, firstDate.addDays(1) );
628} 606}
629 607
630KOAgendaButton* KOAgendaView::getNewDaylabel() 608KOAgendaButton* KOAgendaView::getNewDaylabel()
631{ 609{
632 610
633 KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); 611 KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels);
634 connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); 612 connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) );
635 mDayLabelsList.append( dayLabel ); 613 mDayLabelsList.append( dayLabel );
636 mLayoutDayLabels->addWidget(dayLabel); 614 mLayoutDayLabels->addWidget(dayLabel);
637 return dayLabel ; 615 return dayLabel ;
638} 616}
639 617
640void KOAgendaView::createDayLabels() 618void KOAgendaView::createDayLabels()
641{ 619{
642 620
643 if ( mBlockUpdating || globalFlagBlockLabel == 1) { 621 if ( mBlockUpdating || globalFlagBlockLabel == 1) {
644 // qDebug(" KOAgendaView::createDayLabels() blocked "); 622 // qDebug(" KOAgendaView::createDayLabels() blocked ");
645 return; 623 return;
646 624
647 } 625 }
648 int newHight; 626 int newHight;
649 627