summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-19 21:14:06 (UTC)
committer zautrix <zautrix>2005-03-19 21:14:06 (UTC)
commit6c913e8e5fb19ef3c5a74b94757aeabb9b808cc4 (patch) (unidiff)
tree0facf1e6f5040d1345f1e067efe44d2382a3981a
parent88e1a262374ba8cb018469f7873df45b12050c67 (diff)
downloadkdepimpi-6c913e8e5fb19ef3c5a74b94757aeabb9b808cc4.zip
kdepimpi-6c913e8e5fb19ef3c5a74b94757aeabb9b808cc4.tar.gz
kdepimpi-6c913e8e5fb19ef3c5a74b94757aeabb9b808cc4.tar.bz2
month select fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigatorcontainer.cpp1
-rw-r--r--korganizer/kdatenavigator.cpp12
-rw-r--r--korganizer/kdatenavigator.h5
3 files changed, 14 insertions, 4 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index cbfc5b2..3f6e29b 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -164,12 +164,13 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * )
164 verticalCount != mVerticalCount ) { 164 verticalCount != mVerticalCount ) {
165 uint count = horizontalCount * verticalCount; 165 uint count = horizontalCount * verticalCount;
166 if ( count == 0 ) return; 166 if ( count == 0 ) return;
167 167
168 while ( count > ( mExtraViews.count() + 1 ) ) { 168 while ( count > ( mExtraViews.count() + 1 ) ) {
169 KDateNavigator *n = new KDateNavigator( this ); 169 KDateNavigator *n = new KDateNavigator( this );
170 n->setMonthSignalOffset ( mExtraViews.count()+1 );
170 mExtraViews.append( n ); 171 mExtraViews.append( n );
171 n->setCalendar( mCalendar ); 172 n->setCalendar( mCalendar );
172 setBaseDates(); 173 setBaseDates();
173 connectNavigatorView( n ); 174 connectNavigatorView( n );
174 n->show(); 175 n->show();
175 } 176 }
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index e76a85a..ab9a40f 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -54,26 +54,26 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
54 QGridLayout *topLayout = new QGridLayout(this,8,8); 54 QGridLayout *topLayout = new QGridLayout(this,8,8);
55 55
56 if (! startDate.isValid()) { 56 if (! startDate.isValid()) {
57 qDebug("KDateNavigator::invalid startdate "); 57 qDebug("KDateNavigator::invalid startdate ");
58 startDate = QDate::currentDate(); 58 startDate = QDate::currentDate();
59 } 59 }
60 60 mMonthSignalOffset = 0;
61 mSelectedDates.append(startDate); 61 mSelectedDates.append(startDate);
62 m_MthYr = startDate; 62 m_MthYr = startDate;
63 m_bShowWeekNums = true; 63 m_bShowWeekNums = true;
64 64
65 setFont( KOPrefs::instance()->mDateNavigatorFont ); 65 setFont( KOPrefs::instance()->mDateNavigatorFont );
66 mNavigatorBar = new NavigatorBar( startDate, this ); 66 mNavigatorBar = new NavigatorBar( startDate, this );
67 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); 67 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 );
68 //mNavigatorBar->resize( 1,1); 68 //mNavigatorBar->resize( 1,1);
69 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); 69 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
70 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 70 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
71 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 71 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
72 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); 72 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
73 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); 73 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
74 74
75 // get the day of the week on the first day 75 // get the day of the week on the first day
76 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 76 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
77 m_fstDayOfWk = dayone.dayOfWeek(); 77 m_fstDayOfWk = dayone.dayOfWeek();
78 78
79 int i; 79 int i;
@@ -114,12 +114,20 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
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 //setFixedSize ( sizeHint() );
119} 119}
120void KDateNavigator::slotMonthSelected( int m )
121{
122 if ( m_MthYr.month() <= mMonthSignalOffset)
123 m += 12;
124 int mo = m - mMonthSignalOffset;
125 emit monthSelected( m - mMonthSignalOffset );
126
127}
120void KDateNavigator::setCalendar( Calendar *cal ) 128void KDateNavigator::setCalendar( Calendar *cal )
121{ 129{
122 daymatrix->setCalendar( cal ); 130 daymatrix->setCalendar( cal );
123} 131}
124 132
125void KDateNavigator::setBaseDate( const QDate &date ) 133void KDateNavigator::setBaseDate( const QDate &date )
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 0aeb77a..56822fa 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -60,13 +60,13 @@ class KDateNavigator: public QFrame
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 & );
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 66 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off;}
67 public slots: 67 public slots:
68 void selectDates( const KCal::DateList & ); 68 void selectDates( const KCal::DateList & );
69 void updateView(); 69 void updateView();
70 void updateConfig(); 70 void updateConfig();
71 void updateDayMatrix(); 71 void updateDayMatrix();
72 72
@@ -102,21 +102,22 @@ class KDateNavigator: public QFrame
102 void possiblyPastMidnight(); 102 void possiblyPastMidnight();
103 103
104 /** handles updating the view when midnight has come by due to idle time. 104 /** handles updating the view when midnight has come by due to idle time.
105 * 105 *
106 */ 106 */
107 void passedMidnight(); 107 void passedMidnight();
108 108 void slotMonthSelected( int m );
109 protected: 109 protected:
110 void updateDates(); 110 void updateDates();
111 111
112 void wheelEvent (QWheelEvent *); 112 void wheelEvent (QWheelEvent *);
113 113
114 bool eventFilter (QObject *,QEvent *); 114 bool eventFilter (QObject *,QEvent *);
115 115
116 private: 116 private:
117 int mMonthSignalOffset;
117 NavigatorBar *mNavigatorBar; 118 NavigatorBar *mNavigatorBar;
118 119
119 QFrame *headingSep; 120 QFrame *headingSep;
120 QFrame *weeknumSep; 121 QFrame *weeknumSep;
121 QLabel *headings[7]; 122 QLabel *headings[7];
122 QLabel *weeknos[7]; 123 QLabel *weeknos[7];