summaryrefslogtreecommitdiffabout
path: root/korganizer/navigatorbar.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/navigatorbar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/navigatorbar.cpp67
1 files changed, 35 insertions, 32 deletions
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 27d4d17..4a51bba 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -59,16 +59,13 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
mCtrlFrame = new QFrame( this );
mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised);
mCtrlFrame->setLineWidth(1);
topLayout->addWidget( mCtrlFrame );
- QFont tfont = font();
- if ( QApplication::desktop()->width() >= 480 )
- tfont.setPointSize(tfont.pointSize()+2);
- tfont.setBold(true);
+
bool isRTL = KOGlobals::self()->reverseLayout();
#ifndef DESKTOP_VERSION
bool isDesktop = false;
#else
bool isDesktop = true;
@@ -117,40 +114,16 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
mPrevMonth->setFlat( true);
mPrevWeek->setFlat( true);
} else {
mPrevWeek->hide();
mNextWeek->hide();
}
- 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;
- }
- mSelectMonth->setFixedWidth( maxwidth );
- mSelectMonth->setFixedHeight( size );
- mPrevYear->setFixedHeight( size );
- mPrevMonth->setFixedHeight( size );
- mPrevWeek->setFixedHeight( size );
- mNextMonth->setFixedHeight( size );
- mNextWeek->setFixedHeight( size );
- mNextYear->setFixedHeight ( size );
+ resetFont( font() );
+
+
// set up control frame layout
QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 );
ctrlLayout->addWidget( mPrevYear, 3 );
ctrlLayout->addWidget( mPrevMonth, 3 );
ctrlLayout->addWidget( mPrevWeek, 3 );
//ctrlLayout->addStretch( 1 );
@@ -181,12 +154,42 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
}
NavigatorBar::~NavigatorBar()
{
}
+void NavigatorBar::resetFont ( QFont fo )
+{
+
+ QFont tfont = fo;
+ if ( QApplication::desktop()->width() >= 480 )
+ tfont.setPointSize(tfont.pointSize()+2);
+ tfont.setBold(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" );
+ maxwidth = width+2;
+ int size = fm.height()+2;
+ if ( QApplication::desktop()->width() >= 480 ) {
+ size += 6;
+ maxwidth+= 6;
+ }
+ mSelectMonth->setMinimumWidth( maxwidth );
+ mSelectMonth->setFixedHeight( size );
+ mPrevYear->setFixedHeight( size );
+ mPrevMonth->setFixedHeight( size );
+ mPrevWeek->setFixedHeight( size );
+ mNextMonth->setFixedHeight( size );
+ mNextWeek->setFixedHeight( size );
+ mNextYear->setFixedHeight ( size );
+}
+
void NavigatorBar::showButtons( bool left, bool right )
{
if ( left ) {
mPrevYear->show();
mPrevMonth->show();
} else {
@@ -199,13 +202,13 @@ void NavigatorBar::showButtons( bool left, bool right )
mNextMonth->show();
} else {
mNextYear->hide();
mNextMonth->hide();
}
if ( !left && !right ) {
- mSelectMonth->setMaximumWidth( 1024 );
+ //mSelectMonth->setMaximumWidth( 1024 );
mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
}
}
void NavigatorBar::selectMonth()
{