summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-20 14:04:37 (UTC)
committer zautrix <zautrix>2005-03-20 14:04:37 (UTC)
commit69d75020eea5f95b9f5d77d97ed85ec8869d32db (patch) (side-by-side diff)
tree378b920b9392e7ed4472597e586154d7b99b0645 /korganizer
parent289dd44f4f23d92c45d8f28c867a14a980fd5dde (diff)
downloadkdepimpi-69d75020eea5f95b9f5d77d97ed85ec8869d32db.zip
kdepimpi-69d75020eea5f95b9f5d77d97ed85ec8869d32db.tar.gz
kdepimpi-69d75020eea5f95b9f5d77d97ed85ec8869d32db.tar.bz2
layout fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp76
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/datenavigatorcontainer.cpp36
-rw-r--r--korganizer/kdatenavigator.cpp40
-rw-r--r--korganizer/kdatenavigator.h8
-rw-r--r--korganizer/kodaymatrix.cpp11
-rw-r--r--korganizer/kodaymatrix.h1
-rw-r--r--korganizer/navigatorbar.cpp67
-rw-r--r--korganizer/navigatorbar.h1
9 files changed, 184 insertions, 58 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3ce123c..ab59d00 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -287,79 +287,83 @@ void CalendarView::init()
} else {
mResourceView = 0;
}
#endif
QWidget *rightBox = new QWidget( mPanner );
QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
mRightFrame = new QWidgetStack( rightBox );
rightLayout->addWidget( mRightFrame, 1 );
mLeftFrame = mLeftSplitter;
#else
- QWidget *mainBox = new QWidget( this );
+ //QWidget *mainBox = new QWidget( this );
//QWidget *leftFrame = new QWidget( mainBox );
- QBoxLayout * mainBoxLayout;
+ //QBoxLayout * mainBoxLayout;
if ( KOPrefs::instance()->mVerticalScreen ) {
- mainBoxLayout = new QVBoxLayout(mainBox);
+ //mainBoxLayout = new QVBoxLayout(mainBox);
//leftFrameLayout = new QHBoxLayout(leftFrame );
- mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mainBox);;
- mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left );
+ mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
+ mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
+ mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
+ mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
} else {
- mainBoxLayout = new QHBoxLayout(mainBox);
+ //mainBoxLayout = new QHBoxLayout(mainBox);
//leftFrameLayout = new QVBoxLayout(leftFrame );
- mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mainBox);;
+ mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
+ mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
+ mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
}
//QBoxLayout * leftFrameLayout;
- topLayout->addWidget( mainBox );
- mainBoxLayout->addWidget (mLeftFrame);
+ topLayout->addWidget( mMainFrame );
+ //mainBoxLayout->addWidget (mLeftFrame);
mDateNavigator = new DateNavigatorContainer( mLeftFrame,
"CalendarView::DateNavigator" );
#if 0
// FIXME
mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
"CalendarView::DateNavigator", QDate::currentDate());
#endif
// mDateNavigator->blockSignals( true );
//leftFrameLayout->addWidget( mDateNavigator );
mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
mTodoList->setNavigator( mNavigator );
#if 0
if ( QApplication::desktop()->width() < 480 ) {
leftFrameLayout->addWidget(mFilterView);
leftFrameLayout->addWidget(mTodoList, 2 );
} else {
leftFrameLayout->addWidget(mTodoList,2 );
leftFrameLayout->addWidget(mFilterView );
}
#endif
mFilterView->hide();
- QWidget *rightBox = new QWidget( mainBox );
- mainBoxLayout->addWidget ( rightBox, 10 );
+ QWidget *rightBox = new QWidget( mMainFrame );
+ //mainBoxLayout->addWidget ( rightBox, 10 );
QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
mRightFrame = new QWidgetStack( rightBox );
rightLayout->addWidget( mRightFrame, 10 );
//mLeftFrame = (QWidget *)leftFrame;
if ( KOPrefs::instance()->mVerticalScreen ) {
- mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
+ //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
//mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
- mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
+ //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
//leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
} else {
- mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
- mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
+ //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
+ //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
//leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
}
if ( !KOPrefs::instance()->mShowDateNavigator)
mDateNavigator->hide();
//qDebug("Calendarview Size %d %d ", width(), height());
#endif
connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
SLOT( showDates( const KCal::DateList & ) ) );
connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
@@ -1826,45 +1830,76 @@ void CalendarView::readSettings()
int resetval = 0;
int maxVal = 0;
if (sizes.count() != 3) {
if ( KOPrefs::instance()->mVerticalScreen ) {
resetval = mDateNavigator->sizeHint().width()+2;
} else {
resetval = mDateNavigator->sizeHint().height()+2;
}
}
if ( !resetval ){// i.e. sizes.count() == 3
if ( KOPrefs::instance()->mVerticalScreen ) {
- if ( sizes[0] < mDateNavigator->sizeHint().width()+1 )
- resetval = mDateNavigator->sizeHint().width()+2;
+ if ( sizes[0] < mDateNavigator->sizeHint().width()+1 )
+ resetval = mDateNavigator->sizeHint().width()+2;
} else {
- if ( sizes[0] < mDateNavigator->sizeHint().height()+1 )
- resetval = mDateNavigator->sizeHint().height()+2;
+ if ( sizes[0] < mDateNavigator->sizeHint().height()+1 )
+ resetval = mDateNavigator->sizeHint().height()+2;
}
}
if ( resetval ) {
sizes.clear();
if ( KOPrefs::instance()->mVerticalScreen ) {
maxVal = QApplication::desktop()->width() -10;
} else {
maxVal = QApplication::desktop()->height()-10;
}
sizes << resetval;
if ( maxVal < resetval + resetval)
resetval = maxVal - resetval;
sizes << resetval;
sizes << 100;
}
mLeftFrame->setSizes(sizes);
+ sizes = config->readIntListEntry("Main Splitter Frame");
+ if (sizes.count() != 3) {
+ if ( !KOPrefs::instance()->mVerticalScreen ) {
+ resetval = mDateNavigator->sizeHint().width()+2;
+ } else {
+ resetval = mDateNavigator->sizeHint().height()+2;
+ }
+ }
+ if ( !resetval ){// i.e. sizes.count() == 3
+ if ( !KOPrefs::instance()->mVerticalScreen ) {
+ if ( sizes[0] < mDateNavigator->sizeHint().width()+1 )
+ resetval = mDateNavigator->sizeHint().width()+2;
+ } else {
+ if ( sizes[0] < mDateNavigator->sizeHint().height()+1 )
+ resetval = mDateNavigator->sizeHint().height()+2;
+ }
+ }
+ if ( resetval ) {
+ sizes.clear();
+ if ( !KOPrefs::instance()->mVerticalScreen ) {
+ maxVal = QApplication::desktop()->width() -10;
+ } else {
+ maxVal = QApplication::desktop()->height()-10;
+ }
+ sizes << resetval;
+ if ( maxVal < resetval + resetval)
+ resetval = maxVal - resetval;
+ sizes << resetval;
+ }
+ mMainFrame->setSizes(sizes);
+
if ( dateCount == 5 ) mNavigator->selectWorkWeek();
else if ( dateCount == 7 ) mNavigator->selectWeek();
else mNavigator->selectDates( dateCount );
// mViewManager->readSettings( config );
updateConfig();
globalFlagBlockAgenda = 2;
mViewManager->readSettings( config );
#ifdef DESKTOP_VERSION
config->setGroup("WidgetLayout");
QStringList list;
list = config->readListEntry("MainLayout");
int x,y,w,h;
@@ -1919,25 +1954,26 @@ void CalendarView::writeSettings()
mTodoList->saveLayout(config,QString("Todo Layout"));
mDialogManager->writeSettings( config );
//KOPrefs::instance()->usrWriteConfig();
KOPrefs::instance()->writeConfig();
writeFilterSettings(config);
config->setGroup( "Views" );
config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
QValueList<int> listINT = mLeftFrame->sizes();
config->writeEntry("Left Splitter Frame",listINT);
-
+ listINT = mMainFrame->sizes();
+ config->writeEntry("Main Splitter Frame",listINT);
#ifdef DESKTOP_VERSION
config->setGroup("WidgetLayout");
QStringList list ;//= config->readListEntry("MainLayout");
int x,y,w,h;
QWidget* wid;
wid = topLevelWidget();
x = wid->geometry().x();
y = wid->geometry().y();
w = wid->width();
h = wid->height();
list.clear();
list << QString::number( x );
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index fac9a9e..16e671f 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -522,25 +522,25 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void init();
int mDatePickerMode;
bool mFlagEditDescription;
QDateTime mLastCalendarSync;
void createPrinter();
void calendarModified( bool, Calendar * );
CalPrinter *mCalPrinter;
QSplitter *mPanner;
QSplitter *mLeftSplitter;
- KDGanttMinimizeSplitter *mLeftFrame;
+ KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
QWidgetStack *mRightFrame;
KDatePicker* mDatePicker;
QVBox* mDateFrame;
DateNavigatorContainer *mDateNavigator; // widget showing small month view.
KOFilterView *mFilterView;
ResourceView *mResourceView;
// calendar object for this viewing instance
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index b9bd1b9..3358ecf 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -24,24 +24,25 @@
*/
#include <kdebug.h>
#include <klocale.h>
//#include "koglobals.h"
#include "navigatorbar.h"
#include "kdatenavigator.h"
#include <kcalendarsystem.h>
#include "datenavigatorcontainer.h"
+#include "koprefs.h"
DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
const char *name )
: QWidget( parent, name ), mCalendar( 0 ),
mHorizontalCount( 1 ), mVerticalCount( 1 )
{
mExtraViews.setAutoDelete( true );
mNavigatorView = new KDateNavigator( this, name );
connectNavigatorView( mNavigatorView );
}
@@ -158,50 +159,77 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl;
kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl;
kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl;
#endif
QSize minSize = mNavigatorView->yourSizeHint();
// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl;
int verticalCount = size().height() / minSize.height();
int horizontalCount = size().width() / minSize.width();
//qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() );
//qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
+ bool fontchange = false;
+ QFont fo;
if ( horizontalCount != mHorizontalCount ||
verticalCount != mVerticalCount ) {
uint count = horizontalCount * verticalCount;
if ( count == 0 ) {
- mNavigatorView->resize( minSize );
- return;
+ bool ok;
+ fo = mNavigatorView->yourFontHint( size() , &ok);
+ //mNavigatorView->resize( size() );
+ //if ( ! ok )
+ // return;
+ minSize = mNavigatorView->sizeHint();
+ verticalCount = size().height() / minSize.height();
+ horizontalCount = size().width() / minSize.width();
+ if ( horizontalCount == 0 )
+ horizontalCount = 1;
+ if ( verticalCount == 0 )
+ verticalCount = 1;
+ fontchange = true;
+ count = horizontalCount * verticalCount;
+ } else {
+ if ( mNavigatorView->fontChanged() ) {
+ fontchange = true;
+ fo = KOPrefs::instance()->mDateNavigatorFont;
+ mNavigatorView->changeFont( fo );
+ mNavigatorView->unsetFontChanged();
+ }
}
while ( count > ( mExtraViews.count() + 1 ) ) {
KDateNavigator *n = new KDateNavigator( this );
n->setMonthSignalOffset ( mExtraViews.count()+1 );
mExtraViews.append( n );
n->setCalendar( mCalendar );
setBaseDates();
connectNavigatorView( n );
n->show();
}
while ( count < ( mExtraViews.count() + 1 ) ) {
mExtraViews.removeLast();
}
-
+ if ( fontchange ) {
+ //mNavigatorView->changeFont( fo );
+ uint i;
+ for( i = 0; i < mExtraViews.count(); ++i ) {
+ KDateNavigator *view = mExtraViews.at( i );
+ view->changeFont( fo );
+ }
+ }
mHorizontalCount = horizontalCount;
mVerticalCount = verticalCount;
}
-
int height = size().height() / verticalCount;
int width = size().width() / horizontalCount;
NavigatorBar *bar = mNavigatorView->navigatorBar();
if ( horizontalCount > 1 ) bar->showButtons( true, false );
else bar->showButtons( true, true );
mNavigatorView->setGeometry(0,
0, width, height );
for( uint i = 0; i < mExtraViews.count(); ++i ) {
int x = ( i + 1 ) % horizontalCount;
int y = ( i + 1 ) / horizontalCount;
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index b097dc1..92a0ac2 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -107,24 +107,64 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
SIGNAL( datesSelected( const KCal::DateList & ) ) );
connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
SIGNAL( eventDropped( Event * ) ) );
topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
// read settings from configuration file.
updateConfig();
enableRollover(FollowMonth);
mySizeHint = sizeHint();
+ mFontChanged = false;
+}
+void KDateNavigator::changeFont ( QFont fo )
+{
+ setFont( fo );
+ mNavigatorBar->resetFont( fo );
+}
+QFont KDateNavigator::yourFontHint( QSize si , bool *b)
+{
+ QFont fo = KOPrefs::instance()->mDateNavigatorFont;
+ *b = false;
+ int fontPoint = fo.pointSize();
+ while ( fontPoint > 5 ) {
+ --fontPoint;
+ fo.setPointSize( fontPoint );
+ setFont( fo );
+ mFontChanged = true;
+ mNavigatorBar->resetFont( fo );
+ QSize sh = sizeHint();
+ //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() );
+ if ( si.width() > sh.width() && si.height() > sh.height()) {
+ *b = true;
+ //qDebug("fooooooooooooooooooooooouuuuund ");
+ break;
+ }
+ }
+ //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() );
+ return fo;
+}
+QSize KDateNavigator::sizeHint() const
+{
+ QFontMetrics fm ( font() );
+ QSize day = daymatrix->sizeHint();
+ QSize nav = mNavigatorBar->sizeHint();
+ int wid = fm.width( "30") + day.width()+3;
+ int hei = fm.height() +day.height()+nav.height()+2;
+ if ( wid < nav.width() )
+ wid = nav.width() ;
+ //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
+ return QSize ( wid, hei );
}
void KDateNavigator::slotMonthSelected( int m )
{
if ( m_MthYr.month() <= mMonthSignalOffset)
m += 12;
int mo = m - mMonthSignalOffset;
emit monthSelected( m - mMonthSignalOffset );
}
void KDateNavigator::setCalendar( Calendar *cal )
{
daymatrix->setCalendar( cal );
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 292e71c..3177687 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -56,25 +56,30 @@ class KDateNavigator: public QFrame
* visible and emits monthPassed() when the month changes.
*/
enum RolloverType { None, FollowDay, FollowMonth } ;
void enableRollover( RolloverType );
void setShowWeekNums( bool enabled );
void setCalendar( Calendar * );
void setBaseDate( const QDate & , bool doRepaint = true );
KCal::DateList selectedDates() const { return mSelectedDates; }
NavigatorBar *navigatorBar() const { return mNavigatorBar; }
void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off;}
QSize yourSizeHint() { return mySizeHint; }
- KODayMatrix *dayMatrix() { return daymatrix ;}
+ QFont yourFontHint( QSize , bool * b);
+ bool fontChanged() {return mFontChanged; }
+ void unsetFontChanged() { mFontChanged = false; }
+ KODayMatrix *dayMatrix() { return daymatrix ;}
+ QSize sizeHint() const;
+ void changeFont ( QFont fo );
public slots:
void selectDates( const KCal::DateList & );
void updateView();
void updateConfig();
void updateDayMatrix();
signals:
void datesSelected( const KCal::DateList & );
void eventDropped( Event * );
void weekClicked( const QDate &);
void goPrevious();
@@ -108,24 +113,25 @@ class KDateNavigator: public QFrame
*/
void passedMidnight();
void slotMonthSelected( int m );
protected:
void updateDates();
void wheelEvent (QWheelEvent *);
bool eventFilter (QObject *,QEvent *);
private:
QSize mySizeHint;
+ bool mFontChanged;
int mMonthSignalOffset;
NavigatorBar *mNavigatorBar;
QFrame *headingSep;
QFrame *weeknumSep;
QLabel *headings[7];
QLabel *weeknos[7];
KODayMatrix *daymatrix;
KCal::DateList mSelectedDates;
QDate m_MthYr;
int m_fstDayOfWk;
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 619ae39..9181936 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -787,12 +787,23 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
}
// ----------------------------------------------------------------------------
// R E SI Z E E V E N T H A N D L I N G
// ----------------------------------------------------------------------------
void KODayMatrix::resizeEvent(QResizeEvent *)
{
QRect sz = frameRect();
daysize.setHeight(sz.height()*7 / NUMDAYS);
daysize.setWidth(sz.width() / 7);
}
+
+QSize KODayMatrix::sizeHint() const
+{
+
+ QFontMetrics fm ( font() );
+ int wid = fm.width( "30") *7+7;
+ int hei = fm.height() * 6+4;
+ //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei);
+ return QSize ( wid, hei );
+
+}
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index c049942..39946de 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -161,24 +161,25 @@ public:
*/
bool isTodayVisible() const { return today>=0; } ;
/** If today is visible, then we can find out if today is
* near the beginning or the end of the month.
* This is dependent on today remaining the index
* in the array of visible dates and going from
* top left (0) to bottom right (41).
*/
bool isBeginningOfMonth() const { return today<=8; } ;
bool isEndOfMonth() const { return today>=27; } ;
QString getWhatsThisText( QPoint ) ;
+ QSize sizeHint() const;
public slots:
/** Recalculates all the flags of the days in the matrix like holidays or events
* on a day (Actually calls above method with the actual startdate).
*/
void updateView();
void updateViewTimed();
void repaintViewTimed();
/**
* Calculate which square in the matrix should be
* hilighted to indicate it's today.
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 27d4d17..4a51bba 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -53,28 +53,25 @@
NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name )
: QWidget( parent, name )
{
QBoxLayout *topLayout = new QHBoxLayout( this );
// Set up the control buttons and date label
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;
#endif
if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 )
isDesktop = true;
// Create backward navigation buttons
mPrevYear = new QPushButton( mCtrlFrame );
mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) );
@@ -111,52 +108,28 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
if ( QString ( name ) == QString("useBigPixmaps") ) {
mNextMonth->setFlat( true);
mNextWeek->setFlat( true);
mNextYear->setFlat( true);
mSelectMonth->setFlat( true);
mPrevYear->setFlat( true);
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 );
// ctrlLayout->addSpacing( 1 );
// ctrlLayout->addWidget( mDateLabel );
ctrlLayout->addWidget( mSelectMonth );
// ctrlLayout->addSpacing( 1 );
// ctrlLayout->addStretch( 1 );
ctrlLayout->addWidget( mNextWeek, 3 );
@@ -175,43 +148,73 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
mNextMonth->setFocusPolicy(NoFocus);
mPrevWeek->setFocusPolicy(NoFocus);
mNextWeek->setFocusPolicy(NoFocus);
mNextYear->setFocusPolicy(NoFocus);
mSelectMonth->setFocusPolicy(NoFocus);
setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
}
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 {
mPrevYear->hide();
mPrevMonth->hide();
}
if ( right ) {
mNextYear->show();
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()
{
int month;
KPopupFrame* popup = new KPopupFrame(this);
KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup);
// -----
picker->resize(picker->sizeHint());
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h
index 4442caa..0b2f60b 100644
--- a/korganizer/navigatorbar.h
+++ b/korganizer/navigatorbar.h
@@ -30,24 +30,25 @@
class QPushButton;
class QFrame;
class QLabel;
class NavigatorBar: public QWidget
{
Q_OBJECT
public:
NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 );
~NavigatorBar();
void showButtons( bool left, bool right );
+ void resetFont ( QFont fo );
public slots:
void selectDates( const KCal::DateList & );
void selectMonth();
signals:
void goNextMonth();
void goPrevMonth();
void goNextWeek();
void goPrevWeek();
void goNextYear();
void goPrevYear();