author | zautrix <zautrix> | 2005-02-02 21:31:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-02 21:31:25 (UTC) |
commit | 279354f19275e5e654636acb87c465edf652eeae (patch) (side-by-side diff) | |
tree | 1721c6201fa28392cb02a80510c47a12ae4e0d4c /korganizer | |
parent | f79d089ec5c44a27f9005da76e452b4574eae27f (diff) | |
download | kdepimpi-279354f19275e5e654636acb87c465edf652eeae.zip kdepimpi-279354f19275e5e654636acb87c465edf652eeae.tar.gz kdepimpi-279354f19275e5e654636acb87c465edf652eeae.tar.bz2 |
fifix
-rw-r--r-- | korganizer/koagendaview.cpp | 25 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 22 |
2 files changed, 32 insertions, 15 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 918931a..1908b1c 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -404,75 +404,84 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : mAllDayFrame = new QHBox(mSplitterAgenda); mAllDayFrame->setFocusPolicy(NoFocus); QWidget *agendaFrame = new QWidget(mSplitterAgenda); agendaFrame->setFocusPolicy(NoFocus); #endif // Create all-day agenda widget mDummyAllDayLeft = new QVBox( mAllDayFrame ); mExpandButton = new QPushButton(mDummyAllDayLeft); mExpandButton->setPixmap( mNotExpandedPixmap ); int widebut = mExpandButton->sizeHint().width(); if ( QApplication::desktop()->width() < 480 ) widebut = widebut*2; else widebut = (widebut*3) / 2; //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, // QSizePolicy::Fixed ) ); mExpandButton->setFixedSize( widebut, widebut); connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); mExpandButton->setFocusPolicy(NoFocus); mAllDayAgenda = new KOAgenda(1,mAllDayFrame); mAllDayAgenda->setFocusPolicy(NoFocus); QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); mDummyAllDayRightL = new QLabel ( dummyAllDayRight ); dummyAllDayRightB->setFlat( true ); dummyAllDayRightB->setFocusPolicy(NoFocus); dummyAllDayRightB->setFixedHeight( (dummyAllDayRightB->sizeHint().height()/4)*3 ); + QPopupMenu * wpo = new QPopupMenu (this); - wpo->insertItem( i18n("W#"), 0 ); + QPopupMenu * all = new QPopupMenu (this); + //wpo->insertItem( i18n("W#"), 0 ); + int first = 1; int i; - for ( i = 1; i < 53; i++ ) + for ( i = 1; i < 50; ++i ) { + if ( !(i%10) ) { + all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); + connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); + first = i; + wpo = new QPopupMenu (this); + } wpo->insertItem( QString::number( i ),i ); - //Qt bug - we must add some empty fields... - for ( i = 53; i < 54; ++i ) { - wpo->insertItem( "", 52 ); } - dummyAllDayRightB->setPopup( wpo ); - + for ( i = 50; i < 53; ++i ) { + wpo->insertItem( QString::number(i), i); + } + all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); + dummyAllDayRightB->setPopup( all ); connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); // Create event context menu for all day agenda mAllDayAgendaPopup = eventPopup(); connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); // Create agenda frame QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); // QHBox *agendaFrame = new QHBox(splitterAgenda); // create event indicator bars mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); agendaLayout->addWidget(mEventIndicatorTop,0,1); mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, agendaFrame); agendaLayout->addWidget(mEventIndicatorBottom,2,1); QWidget *dummyAgendaRight = new QWidget(agendaFrame); agendaLayout->addWidget(dummyAgendaRight,0,2); // Create time labels mTimeLabels = new TimeLabels(24,agendaFrame); agendaLayout->addWidget(mTimeLabels,1,0); connect(mTimeLabels,SIGNAL( scaleChanged()), this,SLOT(updateConfig())); // Create agenda mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); agendaLayout->setColStretch(1,1); mAgenda->setFocusPolicy(NoFocus); @@ -552,65 +561,65 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : SLOT(updateEventIndicatorTop(int))); connect(mAgenda,SIGNAL(upperYChanged(int)), SLOT(updateEventIndicatorBottom(int))); // drag signals /* connect(mAgenda,SIGNAL(startDragSignal(Event *)), SLOT(startDrag(Event *))); connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), SLOT(startDrag(Event *))); */ // synchronize selections connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), mAllDayAgenda, SLOT( deselectItem() ) ); connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), mAgenda, SLOT( deselectItem() ) ); connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), SIGNAL( incidenceSelected( Incidence * ) ) ); connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), SIGNAL( incidenceSelected( Incidence * ) ) ); connect( mAgenda, SIGNAL( resizedSignal() ), SLOT( updateConfig( ) ) ); connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), SLOT( addToCalSlot(Incidence * , Incidence *) ) ); // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); QFont dlf = KOPrefs::instance()->mTimeLabelsFont; QFontMetrics fm ( dlf ); QString dayTest = "30"; int wid = fm.width( dayTest ); - int maxWid = dummyAllDayRight->width(); + int maxWid = dummyAllDayRight->width()-2; int fontPoint = dlf.pointSize(); while ( wid > maxWid ) { --fontPoint; dlf.setPointSize( fontPoint ); QFontMetrics f( dlf ); wid = f.width( dayTest ); } mDummyAllDayRightL->setFont( dlf ); mDummyAllDayRightL->setAlignment( AlignHCenter ); } void KOAgendaView::toggleAllDay() { if ( mSplitterAgenda->firstHandle() ) mSplitterAgenda->firstHandle()->toggle(); } void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) { calendar()->addIncidence( inc ); if ( incOld ) { if ( incOld->type() == "Todo" ) emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); else emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); } } KOAgendaView::~KOAgendaView() { delete mAgendaPopup; diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 2406bb5..24de01f 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -107,75 +107,83 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam //mDateLabel->setFont( tfont ); //mDateLabel->setAlignment( AlignCenter ); if ( QString ( name ) == QString("useBigPixmaps") ) { mNextMonth->setFlat( true); mNextYear->setFlat( true); mSelectMonth->setFlat( true); mPrevYear->setFlat( true); mPrevMonth->setFlat( true); if ( insertWeek ) selWeek->setFlat( true); } mSelectMonth->setFont( tfont ); // Set minimum width to width of widest month name label int i; int maxwidth = 0; QFontMetrics fm ( mSelectMonth->font() ); int width = fm.width("September '00" ); // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); // ++i ) { // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); // int width = fm.width("September 2000" ); // if ( width > maxwidth ) maxwidth = width; // } maxwidth = width+2; int size = fm.height()+2; if ( QApplication::desktop()->width() >= 480 ) { size += 6; maxwidth+= 6; } if ( insertWeek ) { - //shit : bug in Qt. after inserting 53 item, only 51 are shown... QPopupMenu * wpo = new QPopupMenu (this); - wpo->insertItem( i18n("W#"), 0 ); - for ( i = 1; i < 53; ++i ) { + QPopupMenu * all = new QPopupMenu (this); + //wpo->insertItem( i18n("W#"), 0 ); + int first = 1; + for ( i = 1; i < 50; ++i ) { + if ( !(i%10) ) { + all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); + connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); + first = i; + wpo = new QPopupMenu (this); + } wpo->insertItem( QString::number(i), i ); } - for ( i = 53; i < 54; ++i ) { - wpo->insertItem( "", 52 ); + for ( i = 50; i < 53; ++i ) { + wpo->insertItem( QString::number(i), i); } - selWeek->setPopup( wpo ); - selWeek->setFixedWidth( (size/4)*3 ); + all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); + selWeek->setPopup( all ); + selWeek->setFixedWidth( (size/5)*4 ); selWeek->setFixedHeight( size ); connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); } mSelectMonth->setFixedWidth( maxwidth ); mSelectMonth->setFixedHeight( size ); mPrevYear->setFixedHeight( size ); mPrevMonth->setFixedHeight( size ); mNextMonth->setFixedHeight( size ); mNextYear->setFixedHeight ( size ); // set up control frame layout QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); ctrlLayout->addWidget( mPrevYear, 3 ); ctrlLayout->addWidget( mPrevMonth, 3 ); //ctrlLayout->addStretch( 1 ); // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addWidget( mDateLabel ); ctrlLayout->addWidget( mSelectMonth ); // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addStretch( 1 ); ctrlLayout->addWidget( mNextMonth, 3 ); ctrlLayout->addWidget( mNextYear, 3 ); if ( insertWeek ) ctrlLayout->addWidget( selWeek ); connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); mPrevYear->setFocusPolicy(NoFocus); mPrevMonth->setFocusPolicy(NoFocus); mNextMonth->setFocusPolicy(NoFocus); |