-rw-r--r-- | korganizer/calendarview.cpp | 1 | ||||
-rw-r--r-- | korganizer/datenavigatorcontainer.cpp | 20 | ||||
-rw-r--r-- | korganizer/kdatenavigator.cpp | 5 | ||||
-rw-r--r-- | korganizer/kdatenavigator.h | 5 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 0 |
5 files changed, 22 insertions, 9 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 29c530b..9acbbb1 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1847,25 +1847,24 @@ void CalendarView::readSettings() | |||
1847 | if ( KOPrefs::instance()->mVerticalScreen ) { | 1847 | if ( KOPrefs::instance()->mVerticalScreen ) { |
1848 | maxVal = QApplication::desktop()->width() -10; | 1848 | maxVal = QApplication::desktop()->width() -10; |
1849 | } else { | 1849 | } else { |
1850 | maxVal = QApplication::desktop()->height()-10; | 1850 | maxVal = QApplication::desktop()->height()-10; |
1851 | } | 1851 | } |
1852 | sizes << resetval; | 1852 | sizes << resetval; |
1853 | if ( maxVal < resetval + resetval) | 1853 | if ( maxVal < resetval + resetval) |
1854 | resetval = maxVal - resetval; | 1854 | resetval = maxVal - resetval; |
1855 | sizes << resetval; | 1855 | sizes << resetval; |
1856 | sizes << 100; | 1856 | sizes << 100; |
1857 | } | 1857 | } |
1858 | mLeftFrame->setSizes(sizes); | 1858 | mLeftFrame->setSizes(sizes); |
1859 | qDebug("sizes count %d ", sizes.count()); | ||
1860 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1859 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1861 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1860 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1862 | else mNavigator->selectDates( dateCount ); | 1861 | else mNavigator->selectDates( dateCount ); |
1863 | // mViewManager->readSettings( config ); | 1862 | // mViewManager->readSettings( config ); |
1864 | updateConfig(); | 1863 | updateConfig(); |
1865 | globalFlagBlockAgenda = 2; | 1864 | globalFlagBlockAgenda = 2; |
1866 | mViewManager->readSettings( config ); | 1865 | mViewManager->readSettings( config ); |
1867 | #ifdef DESKTOP_VERSION | 1866 | #ifdef DESKTOP_VERSION |
1868 | config->setGroup("WidgetLayout"); | 1867 | config->setGroup("WidgetLayout"); |
1869 | QStringList list; | 1868 | QStringList list; |
1870 | list = config->readListEntry("MainLayout"); | 1869 | list = config->readListEntry("MainLayout"); |
1871 | int x,y,w,h; | 1870 | int x,y,w,h; |
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index 3f6e29b..d09f484 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp | |||
@@ -118,61 +118,71 @@ void DateNavigatorContainer::updateConfig() | |||
118 | { | 118 | { |
119 | mNavigatorView->updateConfig(); | 119 | mNavigatorView->updateConfig(); |
120 | KDateNavigator *n; | 120 | KDateNavigator *n; |
121 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 121 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
122 | n->updateConfig(); | 122 | n->updateConfig(); |
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | void DateNavigatorContainer::selectDates( const DateList &dateList ) | 126 | void DateNavigatorContainer::selectDates( const DateList &dateList ) |
127 | { | 127 | { |
128 | mNavigatorView->selectDates( dateList ); | 128 | mNavigatorView->selectDates( dateList ); |
129 | setBaseDates(); | 129 | setBaseDates(); |
130 | if ( mExtraViews.count() ) { | ||
131 | KDateNavigator *view = mExtraViews.at( 0 ); | ||
132 | view->dayMatrix()->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); | ||
133 | view->dayMatrix()->repaint(); | ||
134 | } | ||
130 | } | 135 | } |
131 | 136 | ||
132 | void DateNavigatorContainer::setBaseDates() | 137 | void DateNavigatorContainer::setBaseDates() |
133 | { | 138 | { |
134 | KCal::DateList dateList = mNavigatorView->selectedDates(); | 139 | KCal::DateList dateList = mNavigatorView->selectedDates(); |
135 | if ( dateList.isEmpty() ) { | 140 | if ( dateList.isEmpty() ) { |
136 | kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; | 141 | kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; |
137 | } | 142 | } |
138 | QDate baseDate = dateList.first(); | 143 | QDate baseDate = dateList.first(); |
139 | KDateNavigator *n; | 144 | KDateNavigator *n; |
145 | bool doRepaint = false; // skip first repaint | ||
140 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { | 146 | for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { |
141 | baseDate = baseDate.addDays( baseDate.daysInMonth () ); | 147 | baseDate = baseDate.addDays( baseDate.daysInMonth () ); |
142 | n->setBaseDate( baseDate ); | 148 | n->setBaseDate( baseDate, doRepaint ); |
149 | doRepaint = true; | ||
143 | } | 150 | } |
144 | } | 151 | } |
145 | 152 | ||
146 | void DateNavigatorContainer::resizeEvent( QResizeEvent * ) | 153 | void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) |
147 | { | 154 | { |
148 | #if 0 | 155 | #if 0 |
149 | kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; | 156 | kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; |
150 | kdDebug(5850) << " CURRENT SIZE: " << size() << endl; | 157 | kdDebug(5850) << " CURRENT SIZE: " << size() << endl; |
151 | kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; | 158 | kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; |
152 | kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl; | 159 | kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl; |
153 | kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; | 160 | kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; |
154 | #endif | 161 | #endif |
155 | 162 | QSize minSize = mNavigatorView->yourSizeHint(); | |
156 | QSize minSize = mNavigatorView->minimumSizeHint(); | ||
157 | 163 | ||
158 | // kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; | 164 | // kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; |
159 | 165 | ||
160 | int verticalCount = size().height() / minSize.height(); | 166 | int verticalCount = size().height() / minSize.height(); |
161 | int horizontalCount = size().width() / minSize.width(); | 167 | int horizontalCount = size().width() / minSize.width(); |
168 | //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); | ||
162 | //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); | 169 | //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); |
163 | if ( horizontalCount != mHorizontalCount || | 170 | if ( horizontalCount != mHorizontalCount || |
164 | verticalCount != mVerticalCount ) { | 171 | verticalCount != mVerticalCount ) { |
165 | uint count = horizontalCount * verticalCount; | 172 | uint count = horizontalCount * verticalCount; |
166 | if ( count == 0 ) return; | 173 | if ( count == 0 ) { |
174 | mNavigatorView->resize( minSize ); | ||
175 | return; | ||
176 | } | ||
167 | 177 | ||
168 | while ( count > ( mExtraViews.count() + 1 ) ) { | 178 | while ( count > ( mExtraViews.count() + 1 ) ) { |
169 | KDateNavigator *n = new KDateNavigator( this ); | 179 | KDateNavigator *n = new KDateNavigator( this ); |
170 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); | 180 | n->setMonthSignalOffset ( mExtraViews.count()+1 ); |
171 | mExtraViews.append( n ); | 181 | mExtraViews.append( n ); |
172 | n->setCalendar( mCalendar ); | 182 | n->setCalendar( mCalendar ); |
173 | setBaseDates(); | 183 | setBaseDates(); |
174 | connectNavigatorView( n ); | 184 | connectNavigatorView( n ); |
175 | n->show(); | 185 | n->show(); |
176 | } | 186 | } |
177 | 187 | ||
178 | while ( count < ( mExtraViews.count() + 1 ) ) { | 188 | while ( count < ( mExtraViews.count() + 1 ) ) { |
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index ab9a40f..b097dc1 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -106,51 +106,52 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) | |||
106 | 106 | ||
107 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), | 107 | connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), |
108 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); | 108 | SIGNAL( datesSelected( const KCal::DateList & ) ) ); |
109 | 109 | ||
110 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), | 110 | connect( daymatrix, SIGNAL( eventDropped( Event * ) ), |
111 | SIGNAL( eventDropped( Event * ) ) ); | 111 | SIGNAL( eventDropped( Event * ) ) ); |
112 | 112 | ||
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 | //setFixedSize ( sizeHint() ); | 118 | mySizeHint = sizeHint(); |
119 | } | 119 | } |
120 | void KDateNavigator::slotMonthSelected( int m ) | 120 | void KDateNavigator::slotMonthSelected( int m ) |
121 | { | 121 | { |
122 | if ( m_MthYr.month() <= mMonthSignalOffset) | 122 | if ( m_MthYr.month() <= mMonthSignalOffset) |
123 | m += 12; | 123 | m += 12; |
124 | int mo = m - mMonthSignalOffset; | 124 | int mo = m - mMonthSignalOffset; |
125 | emit monthSelected( m - mMonthSignalOffset ); | 125 | emit monthSelected( m - mMonthSignalOffset ); |
126 | 126 | ||
127 | } | 127 | } |
128 | void KDateNavigator::setCalendar( Calendar *cal ) | 128 | void KDateNavigator::setCalendar( Calendar *cal ) |
129 | { | 129 | { |
130 | daymatrix->setCalendar( cal ); | 130 | daymatrix->setCalendar( cal ); |
131 | } | 131 | } |
132 | 132 | ||
133 | void KDateNavigator::setBaseDate( const QDate &date ) | 133 | void KDateNavigator::setBaseDate( const QDate &date , bool doRepaint ) // = true |
134 | { | 134 | { |
135 | m_MthYr = date; | 135 | m_MthYr = date; |
136 | 136 | ||
137 | updateDates(); | 137 | updateDates(); |
138 | updateView(); | 138 | updateView(); |
139 | 139 | ||
140 | KCal::DateList dates; | 140 | KCal::DateList dates; |
141 | dates.append( date ); | 141 | dates.append( date ); |
142 | mNavigatorBar->selectDates( dates ); | 142 | mNavigatorBar->selectDates( dates ); |
143 | 143 | ||
144 | daymatrix->clearSelection(); | 144 | daymatrix->clearSelection(); |
145 | if ( doRepaint ) | ||
145 | daymatrix->repaint(); | 146 | daymatrix->repaint(); |
146 | } | 147 | } |
147 | 148 | ||
148 | void KDateNavigator::enableRollover(RolloverType r) | 149 | void KDateNavigator::enableRollover(RolloverType r) |
149 | { | 150 | { |
150 | switch(r) | 151 | switch(r) |
151 | { | 152 | { |
152 | case None : | 153 | case None : |
153 | if (updateTimer) | 154 | if (updateTimer) |
154 | { | 155 | { |
155 | updateTimer->stop(); | 156 | updateTimer->stop(); |
156 | delete updateTimer; | 157 | delete updateTimer; |
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h index 56822fa..292e71c 100644 --- a/korganizer/kdatenavigator.h +++ b/korganizer/kdatenavigator.h | |||
@@ -51,28 +51,30 @@ class KDateNavigator: public QFrame | |||
51 | * processing is done. With rollover set to | 51 | * processing is done. With rollover set to |
52 | * FollowDay, the day highlighter changes at | 52 | * FollowDay, the day highlighter changes at |
53 | * midnight and dayPassed() is emitted. | 53 | * midnight and dayPassed() is emitted. |
54 | * With FollowMonth, it has the same effect | 54 | * With FollowMonth, it has the same effect |
55 | * as FollowDay but also adjusts the month that is | 55 | * as FollowDay but also adjusts the month that is |
56 | * visible and emits monthPassed() when the month changes. | 56 | * visible and emits monthPassed() when the month changes. |
57 | */ | 57 | */ |
58 | enum RolloverType { None, FollowDay, FollowMonth } ; | 58 | enum RolloverType { None, FollowDay, FollowMonth } ; |
59 | void enableRollover( RolloverType ); | 59 | void enableRollover( RolloverType ); |
60 | 60 | ||
61 | void setShowWeekNums( bool enabled ); | 61 | void setShowWeekNums( bool enabled ); |
62 | void setCalendar( Calendar * ); | 62 | void setCalendar( Calendar * ); |
63 | void setBaseDate( const QDate & ); | 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;} | 66 | void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off;} |
67 | QSize yourSizeHint() { return mySizeHint; } | ||
68 | KODayMatrix *dayMatrix() { return daymatrix ;} | ||
67 | public slots: | 69 | public slots: |
68 | void selectDates( const KCal::DateList & ); | 70 | void selectDates( const KCal::DateList & ); |
69 | void updateView(); | 71 | void updateView(); |
70 | void updateConfig(); | 72 | void updateConfig(); |
71 | void updateDayMatrix(); | 73 | void updateDayMatrix(); |
72 | 74 | ||
73 | signals: | 75 | signals: |
74 | void datesSelected( const KCal::DateList & ); | 76 | void datesSelected( const KCal::DateList & ); |
75 | void eventDropped( Event * ); | 77 | void eventDropped( Event * ); |
76 | void weekClicked( const QDate &); | 78 | void weekClicked( const QDate &); |
77 | 79 | ||
78 | void goPrevious(); | 80 | void goPrevious(); |
@@ -105,24 +107,25 @@ class KDateNavigator: public QFrame | |||
105 | * | 107 | * |
106 | */ | 108 | */ |
107 | void passedMidnight(); | 109 | void passedMidnight(); |
108 | void slotMonthSelected( int m ); | 110 | void slotMonthSelected( int m ); |
109 | protected: | 111 | protected: |
110 | void updateDates(); | 112 | void updateDates(); |
111 | 113 | ||
112 | void wheelEvent (QWheelEvent *); | 114 | void wheelEvent (QWheelEvent *); |
113 | 115 | ||
114 | bool eventFilter (QObject *,QEvent *); | 116 | bool eventFilter (QObject *,QEvent *); |
115 | 117 | ||
116 | private: | 118 | private: |
119 | QSize mySizeHint; | ||
117 | int mMonthSignalOffset; | 120 | int mMonthSignalOffset; |
118 | NavigatorBar *mNavigatorBar; | 121 | NavigatorBar *mNavigatorBar; |
119 | 122 | ||
120 | QFrame *headingSep; | 123 | QFrame *headingSep; |
121 | QFrame *weeknumSep; | 124 | QFrame *weeknumSep; |
122 | QLabel *headings[7]; | 125 | QLabel *headings[7]; |
123 | QLabel *weeknos[7]; | 126 | QLabel *weeknos[7]; |
124 | KODayMatrix *daymatrix; | 127 | KODayMatrix *daymatrix; |
125 | 128 | ||
126 | KCal::DateList mSelectedDates; | 129 | KCal::DateList mSelectedDates; |
127 | QDate m_MthYr; | 130 | QDate m_MthYr; |
128 | int m_fstDayOfWk; | 131 | int m_fstDayOfWk; |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index a886f4a..17a8546 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||