author | zautrix <zautrix> | 2005-02-02 15:21:26 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-02 15:21:26 (UTC) |
commit | f94c5075fdd356c7a73b23150287034216ef0bdf (patch) (side-by-side diff) | |
tree | de0cc9b2b2caf41f4c1d3a7a81de8579030abab3 /korganizer | |
parent | 66c1429e6d29331dac4182d2c42aaf1630916c7d (diff) | |
download | kdepimpi-f94c5075fdd356c7a73b23150287034216ef0bdf.zip kdepimpi-f94c5075fdd356c7a73b23150287034216ef0bdf.tar.gz kdepimpi-f94c5075fdd356c7a73b23150287034216ef0bdf.tar.bz2 |
fihix
-rw-r--r-- | korganizer/calendarview.cpp | 2 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 6 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 7 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 34 | ||||
-rw-r--r-- | korganizer/navigatorbar.h | 2 |
5 files changed, 41 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index be78057..e0380fa 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -353,16 +353,18 @@ void CalendarView::init() connect( mNavigatorBar, SIGNAL( goPrevYear() ), mNavigator, SLOT( selectPreviousYear() ) ); connect( mNavigatorBar, SIGNAL( goNextYear() ), mNavigator, SLOT( selectNextYear() ) ); connect( mNavigatorBar, SIGNAL( goPrevMonth() ), mNavigator, SLOT( selectPreviousMonth() ) ); connect( mNavigatorBar, SIGNAL( goNextMonth() ), mNavigator, SLOT( selectNextMonth() ) ); + connect( mNavigatorBar, SIGNAL( selectWeek( int ) ), + mNavigator, SLOT( selectWeek( int ) ) ); connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), mNavigator, SLOT( selectWeek( const QDate & ) ) ); connect( mDateNavigator, SIGNAL( goPrevYear() ), diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index aed9bae..c018dc7 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -432,18 +432,22 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : dummyAllDayRightB->setFlat( true ); dummyAllDayRightB->setFocusPolicy(NoFocus); // dummyAllDayRightB->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); //dummyAllDayRightB->setFixedHeight( dummyAllDayRightB->sizeHint().height()/2 ); QPopupMenu * wpo = new QPopupMenu (this); wpo->insertItem( i18n("W#"), 0 ); int i; - for ( i = 1; i < 54; i++ ) + for ( i = 1; i < 53; i++ ) 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 ); 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 *))); diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index ab96786..9c1e4c3 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -804,41 +804,36 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) //label->setFrameStyle(QFrame::Panel|QFrame::Raised); //label->setLineWidth(1); //label->setAlignment(AlignCenter); mWeekLabels.insert( i, label ); } mWeekLabels[mNumWeeks]->setText( i18n("")); QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); int row, col; - QPopupMenu * wpo = new QPopupMenu (this); - wpo->insertItem( i18n("W#"), 0 ); - for ( i = 1; i < 54; i++ ) - wpo->insertItem( i18n("%1").arg(i), i ); - mWeekLabels[mNumWeeks]->setPopup( wpo ); mCells.resize( mNumCells ); for( row = 0; row < mNumWeeks; ++row ) { for( col = 0; col < mDaysPerWeek; ++col ) { MonthViewCell *cell = new MonthViewCell( this ); mCells.insert( row * mDaysPerWeek + col, cell ); connect( cell, SIGNAL( defaultAction( Incidence * ) ), SLOT( defaultAction( Incidence * ) ) ); connect( cell, SIGNAL( newEventSignal( QDateTime ) ), SIGNAL( newEventSignal( QDateTime ) ) ); connect( cell, SIGNAL( showDaySignal( QDate ) ), SIGNAL( showDaySignal( QDate ) ) ); } } //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); - connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); mContextMenu = eventPopup(); // updateConfig(); //useless here + mWeekLabels[mNumWeeks]->setText( i18n("W")); emit incidenceSelected( 0 ); } KOMonthView::~KOMonthView() { delete mContextMenu; } void KOMonthView::selectDateWeekNum ( int ) diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index f339c67..2406bb5 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -23,16 +23,17 @@ */ #include <qstring.h> #include <qtooltip.h> #include <qpushbutton.h> #include <qlayout.h> #include <qframe.h> #include <qlabel.h> +#include <qpopupmenu.h> #include <qapplication.h> #include <kdebug.h> #include <klocale.h> #include <kglobal.h> #include <kiconloader.h> #include "libkdepim/kdatepicker.h" #include <knotifyclient.h> @@ -66,48 +67,58 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam tfont.setBold(true); bool isRTL = KOGlobals::self()->reverseLayout(); #ifndef DESKTOP_VERSION bool isDesktop = false; #else bool isDesktop = true; #endif - if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) + bool insertWeek = (QString ( name ) == QString("useBigPixmaps")) ; + if ( insertWeek && QApplication::desktop()->width() > 320 ) isDesktop = true; // Create backward navigation buttons mPrevYear = new QPushButton( mCtrlFrame ); mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); QToolTip::add( mPrevYear, i18n("Previous Year") ); mPrevMonth = new QPushButton( mCtrlFrame ); mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); QToolTip::add( mPrevMonth, i18n("Previous Month") ); // Create forward navigation buttons mNextMonth = new QPushButton( mCtrlFrame ); mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); QToolTip::add( mNextMonth, i18n("Next Month") ); + QPushButton * selWeek = 0; + if ( insertWeek ) { + selWeek = new QPushButton( mCtrlFrame ); + QToolTip::add( selWeek, i18n("Select Week") ); + selWeek->setFocusPolicy(NoFocus); + } + mNextYear = new QPushButton( mCtrlFrame ); mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); QToolTip::add( mNextYear, i18n("Next Year") ); mSelectMonth = new QPushButton( mCtrlFrame ); // Create month name label //selectMonth->setFont( tfont ); // selectMonth->setAlignment( AlignCenter ); //mDateLabel = new QLabel( selectMonth ); //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); + 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); @@ -118,16 +129,32 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam // 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 ) { + wpo->insertItem( QString::number(i), i ); + } + for ( i = 53; i < 54; ++i ) { + wpo->insertItem( "", 52 ); + } + selWeek->setPopup( wpo ); + selWeek->setFixedWidth( (size/4)*3 ); + 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 ); @@ -136,27 +163,30 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam //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); mNextYear->setFocusPolicy(NoFocus); mSelectMonth->setFocusPolicy(NoFocus); + } NavigatorBar::~NavigatorBar() { } void NavigatorBar::selectMonth() { diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h index 9c5c0cf..ee4c06d 100644 --- a/korganizer/navigatorbar.h +++ b/korganizer/navigatorbar.h @@ -44,17 +44,17 @@ class NavigatorBar: public QWidget void selectMonth(); signals: void goNextMonth(); void goPrevMonth(); void goNextYear(); void goPrevYear(); void monthSelected( int ); - + void selectWeek( int ); private: QFrame *mCtrlFrame; QPushButton *mPrevYear; QPushButton *mPrevMonth; QPushButton *mNextMonth; QPushButton *mNextYear; |