summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--korganizer/datenavigatorcontainer.cpp13
-rw-r--r--korganizer/kdatenavigator.cpp11
-rw-r--r--korganizer/kdatenavigator.h6
-rw-r--r--korganizer/kodaymatrix.cpp7
-rw-r--r--korganizer/komonthview.cpp2
-rw-r--r--korganizer/navigatorbar.cpp4
-rw-r--r--korganizer/navigatorbar.h2
8 files changed, 32 insertions, 14 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 90b36ac..8100e25 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -309,16 +309,17 @@ void CalendarView::init()
} else {
//mainBoxLayout = new QHBoxLayout(mainBox);
//leftFrameLayout = new QVBoxLayout(leftFrame );
mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
}
+ mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
//QBoxLayout * leftFrameLayout;
topLayout->addWidget( mMainFrame );
//mainBoxLayout->addWidget (mLeftFrame);
mDateNavigator = new DateNavigatorContainer( mLeftFrame,
"CalendarView::DateNavigator" );
#if 0
// FIXME
mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index b147427..ab0dd50 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -40,16 +40,17 @@ DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
: QWidget( parent, name ), mCalendar( 0 ),
mHorizontalCount( 1 ), mVerticalCount( 1 )
{
mExtraViews.setAutoDelete( true );
mNavigatorView = new KDateNavigator( this, name );
connectNavigatorView( mNavigatorView );
+ //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
}
DateNavigatorContainer::~DateNavigatorContainer()
{
}
void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
{
@@ -170,27 +171,34 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
// 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;
+ if ( horizontalCount == 1)
+ horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width();
QFont fo;
if ( horizontalCount != mHorizontalCount ||
verticalCount != mVerticalCount ) {
uint count = horizontalCount * verticalCount;
if ( count == 0 ) {
bool ok;
- fo = mNavigatorView->yourFontHint( size() , &ok);
+ fo = mNavigatorView->yourFontHint( size() , &ok );
//mNavigatorView->resize( size() );
//if ( ! ok )
// return;
- minSize = mNavigatorView->sizeHintTwoButtons();
+ int butt = 2;
+ horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width();
+ if ( horizontalCount <= 1 )
+ minSize = mNavigatorView->sizeHintTwoButtons( 4 );
+ else
+ minSize = mNavigatorView->sizeHintTwoButtons();
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;
@@ -226,16 +234,17 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
for( i = 0; i < mExtraViews.count(); ++i ) {
KDateNavigator *view = mExtraViews.at( i );
view->changeFont( fo );
}
}
mHorizontalCount = horizontalCount;
mVerticalCount = verticalCount;
}
+ //qDebug("COUNT %d ", mExtraViews.count());
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,
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index fe83e09..231095f 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -111,16 +111,17 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
SIGNAL( eventDropped( Event * ) ) );
topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
// read settings from configuration file.
updateConfig();
enableRollover(FollowMonth);
mySizeHint = sizeHintTwoButtons();
+ myFullSizeHint = sizeHintTwoButtons( 4 );
mFontChanged = false;
}
void KDateNavigator::changeFont ( QFont fo )
{
setFont( fo );
mNavigatorBar->resetFont( fo );
}
QFont KDateNavigator::yourFontHint( QSize si , bool *b)
@@ -129,19 +130,23 @@ QFont KDateNavigator::yourFontHint( QSize si , bool *b)
*b = false;
int fontPoint = fo.pointSize();
while ( fontPoint > 5 ) {
--fontPoint;
fo.setPointSize( fontPoint );
setFont( fo );
mFontChanged = true;
mNavigatorBar->resetFont( fo );
- QSize sh = sizeHintTwoButtons();
+ QSize sh = sizeHintTwoButtons( 2 );
//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()) {
+ if ( si.width() / sh.width() == 1 ) {
+ if ( si.width() < sizeHintTwoButtons( 4 ).width())
+ continue;
+ }
*b = true;
//qDebug("fooooooooooooooooooooooouuuuund ");
break;
}
}
//qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() );
return fo;
}
@@ -152,21 +157,21 @@ QSize KDateNavigator::sizeHint() const
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 );
}
-QSize KDateNavigator::sizeHintTwoButtons() const
+QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const
{
QFontMetrics fm ( font() );
QSize day = daymatrix->sizeHint();
- QSize nav = mNavigatorBar->sizeHintTwoButtons();
+ QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum );
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 77b9b7c..10bc1be 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -59,23 +59,24 @@ class KDateNavigator: public QFrame
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%12;}
- QSize yourSizeHint() { return mySizeHint; }
+ QSize yourSizeHint()const { return mySizeHint; };
+ QSize yourFullSizeHint() const { return myFullSizeHint;};
QFont yourFontHint( QSize , bool * b);
bool fontChanged() {return mFontChanged; }
void unsetFontChanged() { mFontChanged = false; }
KODayMatrix *dayMatrix() { return daymatrix ;}
QSize sizeHint() const;
- QSize sizeHintTwoButtons() const;
+ QSize sizeHintTwoButtons( int butnum = 2 ) const;
void changeFont ( QFont fo );
public slots:
void selectDates( const KCal::DateList & );
void updateView();
void updateConfig();
void updateDayMatrix();
signals:
@@ -118,16 +119,17 @@ class KDateNavigator: public QFrame
void updateDates();
void wheelEvent (QWheelEvent *);
bool eventFilter (QObject *,QEvent *);
private:
QSize mySizeHint;
+ QSize myFullSizeHint;
bool mFontChanged;
int mMonthSignalOffset;
NavigatorBar *mNavigatorBar;
QFrame *headingSep;
QFrame *weeknumSep;
QLabel *headings[7];
QLabel *weeknos[7];
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 120bc89..a2e0ae0 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -409,17 +409,18 @@ void KODayMatrix::updateView(QDate actdate)
recalculateToday();
}
//qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
if ( !isVisible() ) {
mPendingUpdateBeforeRepaint = true;
} else {
#ifdef DESKTOP_VERSION
//mRepaintTimer->start( 100 );
- mUpdateTimer->start( 100 );
+ //updateViewTimed();
+ mUpdateTimer->start( 20 );
#else
mRepaintTimer->start( 350 );
mUpdateTimer->start( 1200 );
#endif
}
}
void KODayMatrix::updateEvents()
{
@@ -838,18 +839,18 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
if (rowModulo) {
if ( row >= 6 - rowModulo )
addRow = row - 5 + rowModulo;
}
if ( colModulo ) {
if ( col >= 7 - colModulo )
addCol = col - 6 + colModulo-1;
}
- if ( col == 0 )
- addCol = 1;
+
+ addCol += 1;
p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1);
p.setPen(tmppen);
}
// if any events are on that day then draw it using a bold font
if (events[i] > 0) {
QFont myFont = font();
myFont.setBold(true);
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 76982b4..9fd1f68 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -300,17 +300,17 @@ void MonthViewItem::paint(QPainter *p)
yPos = fm.ascent() + fm.leading()/2;
else
yPos = pmheight/2 - fm.height()/2 + fm.ascent();
p->setPen( palette().color( QPalette::Normal, sel ? \
QColorGroup::HighlightedText : QColorGroup::Foreground ) );
p->drawText( x, yPos, text() );
if ( mIncidence->cancelled() ) {
int wid = fm.width( text() );
- p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
+ p->drawLine( x, heihei/2-1 ,x+wid, heihei/2-1 );
}
}
int MonthViewItem::height(const QListBox *lb) const
{
if ( lb )
return lb->fontMetrics().lineSpacing()+1;
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 1b4ee52..06f5ef8 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -170,19 +170,19 @@ QSize NavigatorBar::sizeHint() const
wid += mCurrentButtonMinWid;
if ( mNextWeek->isVisible() )
wid += mCurrentButtonMinWid;
if ( mNextYear->isVisible() )
wid += mCurrentButtonMinWid;
//qDebug("ret %d %d ", wid, mCurrentHei);
return QSize ( wid, mCurrentHei );
}
-QSize NavigatorBar::sizeHintTwoButtons() const
+QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const
{
- return QSize ( mCurrentMinWid + 2 * mCurrentButtonMinWid , mCurrentHei );
+ return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei );
}
void NavigatorBar::resetFont ( QFont fo )
{
QFont tfont = fo;
if ( QApplication::desktop()->width() >= 480 )
tfont.setPointSize(tfont.pointSize()+2);
tfont.setBold(true);
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h
index bf6d173..9ccef14 100644
--- a/korganizer/navigatorbar.h
+++ b/korganizer/navigatorbar.h
@@ -36,17 +36,17 @@ 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 );
QSize sizeHint() const;
- QSize sizeHintTwoButtons() const;
+ QSize sizeHintTwoButtons( int butNum = 2 ) const;
public slots:
void selectDates( const KCal::DateList & );
void selectMonth();
signals:
void goNextMonth();
void goPrevMonth();