summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp68
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/datenavigatorcontainer.cpp36
-rw-r--r--korganizer/kdatenavigator.cpp40
-rw-r--r--korganizer/kdatenavigator.h6
-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, 179 insertions, 53 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3ce123c..ab59d00 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -296,23 +296,27 @@ void CalendarView::init()
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
@@ -336,21 +340,21 @@ void CalendarView::init()
}
#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)
@@ -1856,6 +1860,37 @@ void CalendarView::readSettings()
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 );
@@ -1928,7 +1963,8 @@ void CalendarView::writeSettings()
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");
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index fac9a9e..16e671f 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -531,7 +531,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
QSplitter *mPanner;
QSplitter *mLeftSplitter;
- KDGanttMinimizeSplitter *mLeftFrame;
+ KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
QWidgetStack *mRightFrame;
KDatePicker* mDatePicker;
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index b9bd1b9..3358ecf 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -33,6 +33,7 @@
#include <kcalendarsystem.h>
#include "datenavigatorcontainer.h"
+#include "koprefs.h"
DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
const char *name )
@@ -167,12 +168,33 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
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 ) ) {
@@ -188,11 +210,17 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
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;
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index b097dc1..92a0ac2 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -116,6 +116,46 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
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 )
{
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 292e71c..3177687 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -65,7 +65,12 @@ class KDateNavigator: public QFrame
NavigatorBar *navigatorBar() const { return mNavigatorBar; }
void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off;}
QSize yourSizeHint() { return mySizeHint; }
+ 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();
@@ -117,6 +122,7 @@ class KDateNavigator: public QFrame
private:
QSize mySizeHint;
+ bool mFontChanged;
int mMonthSignalOffset;
NavigatorBar *mNavigatorBar;
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 619ae39..9181936 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -796,3 +796,14 @@ void KODayMatrix::resizeEvent(QResizeEvent *)
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
@@ -170,6 +170,7 @@ public:
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
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 27d4d17..4a51bba 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -62,10 +62,7 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
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
@@ -120,34 +117,10 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
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 );
@@ -184,6 +157,36 @@ 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 ) {
@@ -202,7 +205,7 @@ void NavigatorBar::showButtons( bool left, bool right )
mNextMonth->hide();
}
if ( !left && !right ) {
- mSelectMonth->setMaximumWidth( 1024 );
+ //mSelectMonth->setMaximumWidth( 1024 );
mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
}
}
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h
index 4442caa..0b2f60b 100644
--- a/korganizer/navigatorbar.h
+++ b/korganizer/navigatorbar.h
@@ -39,6 +39,7 @@ class NavigatorBar: public QWidget
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 & );