summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-02-02 21:31:25 (UTC)
committer zautrix <zautrix>2005-02-02 21:31:25 (UTC)
commit279354f19275e5e654636acb87c465edf652eeae (patch) (unidiff)
tree1721c6201fa28392cb02a80510c47a12ae4e0d4c /korganizer
parentf79d089ec5c44a27f9005da76e452b4574eae27f (diff)
downloadkdepimpi-279354f19275e5e654636acb87c465edf652eeae.zip
kdepimpi-279354f19275e5e654636acb87c465edf652eeae.tar.gz
kdepimpi-279354f19275e5e654636acb87c465edf652eeae.tar.bz2
fifix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp27
-rw-r--r--korganizer/navigatorbar.cpp22
2 files changed, 33 insertions, 16 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 918931a..1908b1c 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -412,59 +412,68 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
412 mDummyAllDayLeft = new QVBox( mAllDayFrame ); 412 mDummyAllDayLeft = new QVBox( mAllDayFrame );
413 413
414 mExpandButton = new QPushButton(mDummyAllDayLeft); 414 mExpandButton = new QPushButton(mDummyAllDayLeft);
415 mExpandButton->setPixmap( mNotExpandedPixmap ); 415 mExpandButton->setPixmap( mNotExpandedPixmap );
416 int widebut = mExpandButton->sizeHint().width(); 416 int widebut = mExpandButton->sizeHint().width();
417 if ( QApplication::desktop()->width() < 480 ) 417 if ( QApplication::desktop()->width() < 480 )
418 widebut = widebut*2; 418 widebut = widebut*2;
419 else 419 else
420 widebut = (widebut*3) / 2; 420 widebut = (widebut*3) / 2;
421 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, 421 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
422 // QSizePolicy::Fixed ) ); 422 // QSizePolicy::Fixed ) );
423 mExpandButton->setFixedSize( widebut, widebut); 423 mExpandButton->setFixedSize( widebut, widebut);
424 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); 424 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
425 mExpandButton->setFocusPolicy(NoFocus); 425 mExpandButton->setFocusPolicy(NoFocus);
426 mAllDayAgenda = new KOAgenda(1,mAllDayFrame); 426 mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
427 mAllDayAgenda->setFocusPolicy(NoFocus); 427 mAllDayAgenda->setFocusPolicy(NoFocus);
428 QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); 428 QVBox *dummyAllDayRight = new QVBox(mAllDayFrame);
429 429
430 QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); 430 QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight);
431 mDummyAllDayRightL = new QLabel ( dummyAllDayRight ); 431 mDummyAllDayRightL = new QLabel ( dummyAllDayRight );
432 432
433 dummyAllDayRightB->setFlat( true ); 433 dummyAllDayRightB->setFlat( true );
434 dummyAllDayRightB->setFocusPolicy(NoFocus); 434 dummyAllDayRightB->setFocusPolicy(NoFocus);
435 dummyAllDayRightB->setFixedHeight( (dummyAllDayRightB->sizeHint().height()/4)*3 ); 435 dummyAllDayRightB->setFixedHeight( (dummyAllDayRightB->sizeHint().height()/4)*3 );
436
436 QPopupMenu * wpo = new QPopupMenu (this); 437 QPopupMenu * wpo = new QPopupMenu (this);
437 wpo->insertItem( i18n("W#"), 0 ); 438 QPopupMenu * all = new QPopupMenu (this);
439 //wpo->insertItem( i18n("W#"), 0 );
440 int first = 1;
438 int i; 441 int i;
439 for ( i = 1; i < 53; i++ ) 442 for ( i = 1; i < 50; ++i ) {
440 wpo->insertItem( QString::number( i ),i ); 443 if ( !(i%10) ) {
441 //Qt bug - we must add some empty fields... 444 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
442 for ( i = 53; i < 54; ++i ) { 445 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) );
443 wpo->insertItem( "", 52 ); 446 first = i;
447 wpo = new QPopupMenu (this);
448 }
449 wpo->insertItem( QString::number(i), i );
450 }
451 for ( i = 50; i < 53; ++i ) {
452 wpo->insertItem( QString::number(i), i);
444 } 453 }
445 dummyAllDayRightB->setPopup( wpo ); 454 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
446 455 dummyAllDayRightB->setPopup( all );
447 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); 456 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) );
448 457
449 // Create event context menu for all day agenda 458 // Create event context menu for all day agenda
450 mAllDayAgendaPopup = eventPopup(); 459 mAllDayAgendaPopup = eventPopup();
451 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 460 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
452 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 461 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
453 462
454 // Create agenda frame 463 // Create agenda frame
455 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); 464 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3);
456 // QHBox *agendaFrame = new QHBox(splitterAgenda); 465 // QHBox *agendaFrame = new QHBox(splitterAgenda);
457 466
458 // create event indicator bars 467 // create event indicator bars
459 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); 468 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
460 agendaLayout->addWidget(mEventIndicatorTop,0,1); 469 agendaLayout->addWidget(mEventIndicatorTop,0,1);
461 mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); 470 mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
462 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, 471 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
463 agendaFrame); 472 agendaFrame);
464 agendaLayout->addWidget(mEventIndicatorBottom,2,1); 473 agendaLayout->addWidget(mEventIndicatorBottom,2,1);
465 QWidget *dummyAgendaRight = new QWidget(agendaFrame); 474 QWidget *dummyAgendaRight = new QWidget(agendaFrame);
466 agendaLayout->addWidget(dummyAgendaRight,0,2); 475 agendaLayout->addWidget(dummyAgendaRight,0,2);
467 476
468 // Create time labels 477 // Create time labels
469 mTimeLabels = new TimeLabels(24,agendaFrame); 478 mTimeLabels = new TimeLabels(24,agendaFrame);
470 agendaLayout->addWidget(mTimeLabels,1,0); 479 agendaLayout->addWidget(mTimeLabels,1,0);
@@ -560,49 +569,49 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
560 SLOT(startDrag(Event *))); 569 SLOT(startDrag(Event *)));
561 */ 570 */
562 // synchronize selections 571 // synchronize selections
563 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 572 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
564 mAllDayAgenda, SLOT( deselectItem() ) ); 573 mAllDayAgenda, SLOT( deselectItem() ) );
565 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 574 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
566 mAgenda, SLOT( deselectItem() ) ); 575 mAgenda, SLOT( deselectItem() ) );
567 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 576 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
568 SIGNAL( incidenceSelected( Incidence * ) ) ); 577 SIGNAL( incidenceSelected( Incidence * ) ) );
569 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 578 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
570 SIGNAL( incidenceSelected( Incidence * ) ) ); 579 SIGNAL( incidenceSelected( Incidence * ) ) );
571 connect( mAgenda, SIGNAL( resizedSignal() ), 580 connect( mAgenda, SIGNAL( resizedSignal() ),
572 SLOT( updateConfig( ) ) ); 581 SLOT( updateConfig( ) ) );
573 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), 582 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ),
574 SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); 583 SLOT( addToCalSlot(Incidence *, Incidence * ) ) );
575 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), 584 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ),
576 SLOT( addToCalSlot(Incidence * , Incidence *) ) ); 585 SLOT( addToCalSlot(Incidence * , Incidence *) ) );
577 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 586 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
578 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 587 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
579 588
580 QFont dlf = KOPrefs::instance()->mTimeLabelsFont; 589 QFont dlf = KOPrefs::instance()->mTimeLabelsFont;
581 QFontMetrics fm ( dlf ); 590 QFontMetrics fm ( dlf );
582 QString dayTest = "30"; 591 QString dayTest = "30";
583 int wid = fm.width( dayTest ); 592 int wid = fm.width( dayTest );
584 int maxWid = dummyAllDayRight->width(); 593 int maxWid = dummyAllDayRight->width()-2;
585 int fontPoint = dlf.pointSize(); 594 int fontPoint = dlf.pointSize();
586 while ( wid > maxWid ) { 595 while ( wid > maxWid ) {
587 --fontPoint; 596 --fontPoint;
588 dlf.setPointSize( fontPoint ); 597 dlf.setPointSize( fontPoint );
589 QFontMetrics f( dlf ); 598 QFontMetrics f( dlf );
590 wid = f.width( dayTest ); 599 wid = f.width( dayTest );
591 } 600 }
592 mDummyAllDayRightL->setFont( dlf ); 601 mDummyAllDayRightL->setFont( dlf );
593 mDummyAllDayRightL->setAlignment( AlignHCenter ); 602 mDummyAllDayRightL->setAlignment( AlignHCenter );
594} 603}
595 604
596void KOAgendaView::toggleAllDay() 605void KOAgendaView::toggleAllDay()
597{ 606{
598 if ( mSplitterAgenda->firstHandle() ) 607 if ( mSplitterAgenda->firstHandle() )
599 mSplitterAgenda->firstHandle()->toggle(); 608 mSplitterAgenda->firstHandle()->toggle();
600} 609}
601void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) 610void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
602{ 611{
603 calendar()->addIncidence( inc ); 612 calendar()->addIncidence( inc );
604 613
605 if ( incOld ) { 614 if ( incOld ) {
606 if ( incOld->type() == "Todo" ) 615 if ( incOld->type() == "Todo" )
607 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); 616 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
608 else 617 else
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 2406bb5..24de01f 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -115,59 +115,67 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
115 if ( insertWeek ) 115 if ( insertWeek )
116 selWeek->setFlat( true); 116 selWeek->setFlat( true);
117 } 117 }
118 mSelectMonth->setFont( tfont ); 118 mSelectMonth->setFont( tfont );
119 // Set minimum width to width of widest month name label 119 // Set minimum width to width of widest month name label
120 int i; 120 int i;
121 int maxwidth = 0; 121 int maxwidth = 0;
122 QFontMetrics fm ( mSelectMonth->font() ); 122 QFontMetrics fm ( mSelectMonth->font() );
123 int width = fm.width("September '00" ); 123 int width = fm.width("September '00" );
124// for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); 124// for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date);
125// ++i ) { 125// ++i ) {
126// //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, 126// //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i,
127// // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); 127// // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" );
128// int width = fm.width("September 2000" ); 128// int width = fm.width("September 2000" );
129// if ( width > maxwidth ) maxwidth = width; 129// if ( width > maxwidth ) maxwidth = width;
130// } 130// }
131 maxwidth = width+2; 131 maxwidth = width+2;
132 int size = fm.height()+2; 132 int size = fm.height()+2;
133 if ( QApplication::desktop()->width() >= 480 ) { 133 if ( QApplication::desktop()->width() >= 480 ) {
134 size += 6; 134 size += 6;
135 maxwidth+= 6; 135 maxwidth+= 6;
136 } 136 }
137 137
138 if ( insertWeek ) { 138 if ( insertWeek ) {
139 //shit : bug in Qt. after inserting 53 item, only 51 are shown...
140 QPopupMenu * wpo = new QPopupMenu (this); 139 QPopupMenu * wpo = new QPopupMenu (this);
141 wpo->insertItem( i18n("W#"), 0 ); 140 QPopupMenu * all = new QPopupMenu (this);
142 for ( i = 1; i < 53; ++i ) { 141 //wpo->insertItem( i18n("W#"), 0 );
142 int first = 1;
143 for ( i = 1; i < 50; ++i ) {
144 if ( !(i%10) ) {
145 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
146 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) );
147 first = i;
148 wpo = new QPopupMenu (this);
149 }
143 wpo->insertItem( QString::number(i), i ); 150 wpo->insertItem( QString::number(i), i );
144 } 151 }
145 for ( i = 53; i < 54; ++i ) { 152 for ( i = 50; i < 53; ++i ) {
146 wpo->insertItem( "", 52 ); 153 wpo->insertItem( QString::number(i), i);
147 } 154 }
148 selWeek->setPopup( wpo ); 155 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
149 selWeek->setFixedWidth( (size/4)*3 ); 156 selWeek->setPopup( all );
157 selWeek->setFixedWidth( (size/5)*4 );
150 selWeek->setFixedHeight( size ); 158 selWeek->setFixedHeight( size );
151 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); 159 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) );
152 } 160 }
153 mSelectMonth->setFixedWidth( maxwidth ); 161 mSelectMonth->setFixedWidth( maxwidth );
154 mSelectMonth->setFixedHeight( size ); 162 mSelectMonth->setFixedHeight( size );
155 mPrevYear->setFixedHeight( size ); 163 mPrevYear->setFixedHeight( size );
156 mPrevMonth->setFixedHeight( size ); 164 mPrevMonth->setFixedHeight( size );
157 mNextMonth->setFixedHeight( size ); 165 mNextMonth->setFixedHeight( size );
158 mNextYear->setFixedHeight ( size ); 166 mNextYear->setFixedHeight ( size );
159 // set up control frame layout 167 // set up control frame layout
160 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); 168 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 );
161 ctrlLayout->addWidget( mPrevYear, 3 ); 169 ctrlLayout->addWidget( mPrevYear, 3 );
162 ctrlLayout->addWidget( mPrevMonth, 3 ); 170 ctrlLayout->addWidget( mPrevMonth, 3 );
163 //ctrlLayout->addStretch( 1 ); 171 //ctrlLayout->addStretch( 1 );
164 // ctrlLayout->addSpacing( 1 ); 172 // ctrlLayout->addSpacing( 1 );
165 // ctrlLayout->addWidget( mDateLabel ); 173 // ctrlLayout->addWidget( mDateLabel );
166 ctrlLayout->addWidget( mSelectMonth ); 174 ctrlLayout->addWidget( mSelectMonth );
167 // ctrlLayout->addSpacing( 1 ); 175 // ctrlLayout->addSpacing( 1 );
168 // ctrlLayout->addStretch( 1 ); 176 // ctrlLayout->addStretch( 1 );
169 ctrlLayout->addWidget( mNextMonth, 3 ); 177 ctrlLayout->addWidget( mNextMonth, 3 );
170 ctrlLayout->addWidget( mNextYear, 3 ); 178 ctrlLayout->addWidget( mNextYear, 3 );
171 if ( insertWeek ) 179 if ( insertWeek )
172 ctrlLayout->addWidget( selWeek ); 180 ctrlLayout->addWidget( selWeek );
173 181