summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-19 22:56:08 (UTC)
committer zautrix <zautrix>2005-03-19 22:56:08 (UTC)
commit84c18843bbd1203878367572d3a6800a0586c7f1 (patch) (unidiff)
tree9f58b7356ea700d47e6ec84fb4a462a666a24049 /korganizer
parent39b719bdc75d95913c3aaf9a03aaa57b1161cc61 (diff)
downloadkdepimpi-84c18843bbd1203878367572d3a6800a0586c7f1.zip
kdepimpi-84c18843bbd1203878367572d3a6800a0586c7f1.tar.gz
kdepimpi-84c18843bbd1203878367572d3a6800a0586c7f1.tar.bz2
mochn fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--korganizer/datenavigatorcontainer.cpp20
-rw-r--r--korganizer/kdatenavigator.cpp7
-rw-r--r--korganizer/kdatenavigator.h5
-rw-r--r--korganizer/kodaymatrix.cpp2
5 files changed, 24 insertions, 11 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
126void DateNavigatorContainer::selectDates( const DateList &dateList ) 126void 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
132void DateNavigatorContainer::setBaseDates() 137void 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
146void DateNavigatorContainer::resizeEvent( QResizeEvent * ) 153void 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,52 +106,53 @@ 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}
120void KDateNavigator::slotMonthSelected( int m ) 120void 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}
128void KDateNavigator::setCalendar( Calendar *cal ) 128void KDateNavigator::setCalendar( Calendar *cal )
129{ 129{
130 daymatrix->setCalendar( cal ); 130 daymatrix->setCalendar( cal );
131} 131}
132 132
133void KDateNavigator::setBaseDate( const QDate &date ) 133void 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 daymatrix->repaint(); 145 if ( doRepaint )
146 daymatrix->repaint();
146} 147}
147 148
148void KDateNavigator::enableRollover(RolloverType r) 149void 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;
157 updateTimer=0L; 158 updateTimer=0L;
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
@@ -192,25 +192,25 @@ void KODayMatrix::addSelectedDaysTo(DateList& selDays)
192 selDays.append(days[i]); 192 selDays.append(days[i]);
193 } 193 }
194 } 194 }
195} 195}
196 196
197void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) 197void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
198{ 198{
199 mSelStart = startdate.daysTo(start); 199 mSelStart = startdate.daysTo(start);
200 mSelEnd = startdate.daysTo(end); 200 mSelEnd = startdate.daysTo(end);
201} 201}
202void KODayMatrix::clearSelection() 202void KODayMatrix::clearSelection()
203{ 203{
204 mSelEnd = mSelStart = NOSELECTION; 204 mSelEnd = mSelStart = NOSELECTION;
205} 205}
206 206
207 207
208void KODayMatrix::recalculateToday() 208void KODayMatrix::recalculateToday()
209{ 209{
210 today = -1; 210 today = -1;
211 for (int i=0; i<NUMDAYS; i++) { 211 for (int i=0; i<NUMDAYS; i++) {
212 events[i] = 0; 212 events[i] = 0;
213 days[i] = startdate.addDays(i); 213 days[i] = startdate.addDays(i);
214 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); 214 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
215 215
216 // if today is in the currently displayed month, hilight today 216 // if today is in the currently displayed month, hilight today