summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (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
@@ -311,12 +311,13 @@ void CalendarView::init()
311 //leftFrameLayout = new QVBoxLayout(leftFrame ); 311 //leftFrameLayout = new QVBoxLayout(leftFrame );
312 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 312 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
313 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 313 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
314 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 314 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
315 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 315 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
316 } 316 }
317 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
317 //QBoxLayout * leftFrameLayout; 318 //QBoxLayout * leftFrameLayout;
318 topLayout->addWidget( mMainFrame ); 319 topLayout->addWidget( mMainFrame );
319 //mainBoxLayout->addWidget (mLeftFrame); 320 //mainBoxLayout->addWidget (mLeftFrame);
320 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 321 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
321 "CalendarView::DateNavigator" ); 322 "CalendarView::DateNavigator" );
322#if 0 323#if 0
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index b147427..ab0dd50 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -42,12 +42,13 @@ DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
42{ 42{
43 mExtraViews.setAutoDelete( true ); 43 mExtraViews.setAutoDelete( true );
44 44
45 mNavigatorView = new KDateNavigator( this, name ); 45 mNavigatorView = new KDateNavigator( this, name );
46 46
47 connectNavigatorView( mNavigatorView ); 47 connectNavigatorView( mNavigatorView );
48 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
48} 49}
49 50
50DateNavigatorContainer::~DateNavigatorContainer() 51DateNavigatorContainer::~DateNavigatorContainer()
51{ 52{
52} 53}
53 54
@@ -172,23 +173,30 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
172 173
173 int verticalCount = size().height() / minSize.height(); 174 int verticalCount = size().height() / minSize.height();
174 int horizontalCount = size().width() / minSize.width(); 175 int horizontalCount = size().width() / minSize.width();
175 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); 176 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() );
176 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); 177 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
177 bool fontchange = false; 178 bool fontchange = false;
179 if ( horizontalCount == 1)
180 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width();
178 QFont fo; 181 QFont fo;
179 if ( horizontalCount != mHorizontalCount || 182 if ( horizontalCount != mHorizontalCount ||
180 verticalCount != mVerticalCount ) { 183 verticalCount != mVerticalCount ) {
181 uint count = horizontalCount * verticalCount; 184 uint count = horizontalCount * verticalCount;
182 if ( count == 0 ) { 185 if ( count == 0 ) {
183 bool ok; 186 bool ok;
184 fo = mNavigatorView->yourFontHint( size() , &ok); 187 fo = mNavigatorView->yourFontHint( size() , &ok );
185 //mNavigatorView->resize( size() ); 188 //mNavigatorView->resize( size() );
186 //if ( ! ok ) 189 //if ( ! ok )
187 // return; 190 // return;
188 minSize = mNavigatorView->sizeHintTwoButtons(); 191 int butt = 2;
192 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width();
193 if ( horizontalCount <= 1 )
194 minSize = mNavigatorView->sizeHintTwoButtons( 4 );
195 else
196 minSize = mNavigatorView->sizeHintTwoButtons();
189 verticalCount = size().height() / minSize.height(); 197 verticalCount = size().height() / minSize.height();
190 horizontalCount = size().width() / minSize.width(); 198 horizontalCount = size().width() / minSize.width();
191 if ( horizontalCount == 0 ) 199 if ( horizontalCount == 0 )
192 horizontalCount = 1; 200 horizontalCount = 1;
193 if ( verticalCount == 0 ) 201 if ( verticalCount == 0 )
194 verticalCount = 1; 202 verticalCount = 1;
@@ -228,12 +236,13 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e )
228 view->changeFont( fo ); 236 view->changeFont( fo );
229 } 237 }
230 } 238 }
231 mHorizontalCount = horizontalCount; 239 mHorizontalCount = horizontalCount;
232 mVerticalCount = verticalCount; 240 mVerticalCount = verticalCount;
233 } 241 }
242 //qDebug("COUNT %d ", mExtraViews.count());
234 int height = size().height() / verticalCount; 243 int height = size().height() / verticalCount;
235 int width = size().width() / horizontalCount; 244 int width = size().width() / horizontalCount;
236 245
237 NavigatorBar *bar = mNavigatorView->navigatorBar(); 246 NavigatorBar *bar = mNavigatorView->navigatorBar();
238 if ( horizontalCount > 1 ) bar->showButtons( true, false ); 247 if ( horizontalCount > 1 ) bar->showButtons( true, false );
239 else bar->showButtons( true, true ); 248 else bar->showButtons( true, true );
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index fe83e09..231095f 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -113,12 +113,13 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7); 113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
114 114
115 // read settings from configuration file. 115 // read settings from configuration file.
116 updateConfig(); 116 updateConfig();
117 enableRollover(FollowMonth); 117 enableRollover(FollowMonth);
118 mySizeHint = sizeHintTwoButtons(); 118 mySizeHint = sizeHintTwoButtons();
119 myFullSizeHint = sizeHintTwoButtons( 4 );
119 mFontChanged = false; 120 mFontChanged = false;
120} 121}
121void KDateNavigator::changeFont ( QFont fo ) 122void KDateNavigator::changeFont ( QFont fo )
122{ 123{
123 setFont( fo ); 124 setFont( fo );
124 mNavigatorBar->resetFont( fo ); 125 mNavigatorBar->resetFont( fo );
@@ -131,15 +132,19 @@ QFont KDateNavigator::yourFontHint( QSize si , bool *b)
131 while ( fontPoint > 5 ) { 132 while ( fontPoint > 5 ) {
132 --fontPoint; 133 --fontPoint;
133 fo.setPointSize( fontPoint ); 134 fo.setPointSize( fontPoint );
134 setFont( fo ); 135 setFont( fo );
135 mFontChanged = true; 136 mFontChanged = true;
136 mNavigatorBar->resetFont( fo ); 137 mNavigatorBar->resetFont( fo );
137 QSize sh = sizeHintTwoButtons(); 138 QSize sh = sizeHintTwoButtons( 2 );
138 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); 139 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() );
139 if ( si.width() > sh.width() && si.height() > sh.height()) { 140 if ( si.width() > sh.width() && si.height() > sh.height()) {
141 if ( si.width() / sh.width() == 1 ) {
142 if ( si.width() < sizeHintTwoButtons( 4 ).width())
143 continue;
144 }
140 *b = true; 145 *b = true;
141 //qDebug("fooooooooooooooooooooooouuuuund "); 146 //qDebug("fooooooooooooooooooooooouuuuund ");
142 break; 147 break;
143 } 148 }
144 } 149 }
145 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); 150 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() );
@@ -154,17 +159,17 @@ QSize KDateNavigator::sizeHint() const
154 int hei = fm.height() +day.height()+nav.height()+2; 159 int hei = fm.height() +day.height()+nav.height()+2;
155 if ( wid < nav.width() ) 160 if ( wid < nav.width() )
156 wid = nav.width() ; 161 wid = nav.width() ;
157 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 162 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
158 return QSize ( wid, hei ); 163 return QSize ( wid, hei );
159} 164}
160QSize KDateNavigator::sizeHintTwoButtons() const 165QSize KDateNavigator::sizeHintTwoButtons( int butnum ) const
161{ 166{
162 QFontMetrics fm ( font() ); 167 QFontMetrics fm ( font() );
163 QSize day = daymatrix->sizeHint(); 168 QSize day = daymatrix->sizeHint();
164 QSize nav = mNavigatorBar->sizeHintTwoButtons(); 169 QSize nav = mNavigatorBar->sizeHintTwoButtons( butnum );
165 int wid = fm.width( "30") + day.width()+3; 170 int wid = fm.width( "30") + day.width()+3;
166 int hei = fm.height() +day.height()+nav.height()+2; 171 int hei = fm.height() +day.height()+nav.height()+2;
167 if ( wid < nav.width() ) 172 if ( wid < nav.width() )
168 wid = nav.width() ; 173 wid = nav.width() ;
169 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); 174 //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei);
170 return QSize ( wid, hei ); 175 return QSize ( wid, hei );
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 77b9b7c..10bc1be 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -61,19 +61,20 @@ class KDateNavigator: public QFrame
61 void setShowWeekNums( bool enabled ); 61 void setShowWeekNums( bool enabled );
62 void setCalendar( Calendar * ); 62 void setCalendar( Calendar * );
63 void setBaseDate( const QDate & , bool doRepaint = true ); 63 void setBaseDate( const QDate & , bool doRepaint = true );
64 KCal::DateList selectedDates() const { return mSelectedDates; } 64 KCal::DateList selectedDates() const { return mSelectedDates; }
65 NavigatorBar *navigatorBar() const { return mNavigatorBar; } 65 NavigatorBar *navigatorBar() const { return mNavigatorBar; }
66 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;} 66 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;}
67 QSize yourSizeHint() { return mySizeHint; } 67 QSize yourSizeHint()const { return mySizeHint; };
68 QSize yourFullSizeHint() const { return myFullSizeHint;};
68 QFont yourFontHint( QSize , bool * b); 69 QFont yourFontHint( QSize , bool * b);
69 bool fontChanged() {return mFontChanged; } 70 bool fontChanged() {return mFontChanged; }
70 void unsetFontChanged() { mFontChanged = false; } 71 void unsetFontChanged() { mFontChanged = false; }
71 KODayMatrix *dayMatrix() { return daymatrix ;} 72 KODayMatrix *dayMatrix() { return daymatrix ;}
72 QSize sizeHint() const; 73 QSize sizeHint() const;
73 QSize sizeHintTwoButtons() const; 74 QSize sizeHintTwoButtons( int butnum = 2 ) const;
74 void changeFont ( QFont fo ); 75 void changeFont ( QFont fo );
75 public slots: 76 public slots:
76 void selectDates( const KCal::DateList & ); 77 void selectDates( const KCal::DateList & );
77 void updateView(); 78 void updateView();
78 void updateConfig(); 79 void updateConfig();
79 void updateDayMatrix(); 80 void updateDayMatrix();
@@ -120,12 +121,13 @@ class KDateNavigator: public QFrame
120 void wheelEvent (QWheelEvent *); 121 void wheelEvent (QWheelEvent *);
121 122
122 bool eventFilter (QObject *,QEvent *); 123 bool eventFilter (QObject *,QEvent *);
123 124
124 private: 125 private:
125 QSize mySizeHint; 126 QSize mySizeHint;
127 QSize myFullSizeHint;
126 bool mFontChanged; 128 bool mFontChanged;
127 int mMonthSignalOffset; 129 int mMonthSignalOffset;
128 NavigatorBar *mNavigatorBar; 130 NavigatorBar *mNavigatorBar;
129 131
130 QFrame *headingSep; 132 QFrame *headingSep;
131 QFrame *weeknumSep; 133 QFrame *weeknumSep;
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 120bc89..a2e0ae0 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -411,13 +411,14 @@ void KODayMatrix::updateView(QDate actdate)
411 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); 411 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
412 if ( !isVisible() ) { 412 if ( !isVisible() ) {
413 mPendingUpdateBeforeRepaint = true; 413 mPendingUpdateBeforeRepaint = true;
414 } else { 414 } else {
415#ifdef DESKTOP_VERSION 415#ifdef DESKTOP_VERSION
416 //mRepaintTimer->start( 100 ); 416 //mRepaintTimer->start( 100 );
417 mUpdateTimer->start( 100 ); 417 //updateViewTimed();
418 mUpdateTimer->start( 20 );
418#else 419#else
419 mRepaintTimer->start( 350 ); 420 mRepaintTimer->start( 350 );
420 mUpdateTimer->start( 1200 ); 421 mUpdateTimer->start( 1200 );
421#endif 422#endif
422 } 423 }
423} 424}
@@ -840,14 +841,14 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
840 addRow = row - 5 + rowModulo; 841 addRow = row - 5 + rowModulo;
841 } 842 }
842 if ( colModulo ) { 843 if ( colModulo ) {
843 if ( col >= 7 - colModulo ) 844 if ( col >= 7 - colModulo )
844 addCol = col - 6 + colModulo-1; 845 addCol = col - 6 + colModulo-1;
845 } 846 }
846 if ( col == 0 ) 847
847 addCol = 1; 848 addCol += 1;
848 p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); 849 p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1);
849 p.setPen(tmppen); 850 p.setPen(tmppen);
850 } 851 }
851 852
852 // if any events are on that day then draw it using a bold font 853 // if any events are on that day then draw it using a bold font
853 if (events[i] > 0) { 854 if (events[i] > 0) {
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 76982b4..9fd1f68 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -302,13 +302,13 @@ void MonthViewItem::paint(QPainter *p)
302 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 302 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
303 p->setPen( palette().color( QPalette::Normal, sel ? \ 303 p->setPen( palette().color( QPalette::Normal, sel ? \
304 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 304 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
305 p->drawText( x, yPos, text() ); 305 p->drawText( x, yPos, text() );
306 if ( mIncidence->cancelled() ) { 306 if ( mIncidence->cancelled() ) {
307 int wid = fm.width( text() ); 307 int wid = fm.width( text() );
308 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 308 p->drawLine( x, heihei/2-1 ,x+wid, heihei/2-1 );
309 } 309 }
310 310
311} 311}
312 312
313int MonthViewItem::height(const QListBox *lb) const 313int MonthViewItem::height(const QListBox *lb) const
314{ 314{
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 1b4ee52..06f5ef8 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -172,15 +172,15 @@ QSize NavigatorBar::sizeHint() const
172 wid += mCurrentButtonMinWid; 172 wid += mCurrentButtonMinWid;
173 if ( mNextYear->isVisible() ) 173 if ( mNextYear->isVisible() )
174 wid += mCurrentButtonMinWid; 174 wid += mCurrentButtonMinWid;
175 //qDebug("ret %d %d ", wid, mCurrentHei); 175 //qDebug("ret %d %d ", wid, mCurrentHei);
176 return QSize ( wid, mCurrentHei ); 176 return QSize ( wid, mCurrentHei );
177} 177}
178QSize NavigatorBar::sizeHintTwoButtons() const 178QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const
179{ 179{
180 return QSize ( mCurrentMinWid + 2 * mCurrentButtonMinWid , mCurrentHei ); 180 return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei );
181} 181}
182void NavigatorBar::resetFont ( QFont fo ) 182void NavigatorBar::resetFont ( QFont fo )
183{ 183{
184 184
185 QFont tfont = fo; 185 QFont tfont = fo;
186 if ( QApplication::desktop()->width() >= 480 ) 186 if ( QApplication::desktop()->width() >= 480 )
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h
index bf6d173..9ccef14 100644
--- a/korganizer/navigatorbar.h
+++ b/korganizer/navigatorbar.h
@@ -38,13 +38,13 @@ class NavigatorBar: public QWidget
38 public: 38 public:
39 NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); 39 NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 );
40 ~NavigatorBar(); 40 ~NavigatorBar();
41 void showButtons( bool left, bool right ); 41 void showButtons( bool left, bool right );
42 void resetFont ( QFont fo ); 42 void resetFont ( QFont fo );
43 QSize sizeHint() const; 43 QSize sizeHint() const;
44 QSize sizeHintTwoButtons() const; 44 QSize sizeHintTwoButtons( int butNum = 2 ) const;
45 45
46 public slots: 46 public slots:
47 void selectDates( const KCal::DateList & ); 47 void selectDates( const KCal::DateList & );
48 void selectMonth(); 48 void selectMonth();
49 49
50 signals: 50 signals: