Diffstat (limited to 'korganizer/kdatenavigator.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/kdatenavigator.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index ab9a40f..b097dc1 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp | |||
@@ -70,124 +70,125 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) | |||
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 ) ), SLOT( slotMonthSelected( 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; |
80 | 80 | ||
81 | // Set up the heading fields. | 81 | // Set up the heading fields. |
82 | for( i = 0; i < 7; i++ ) { | 82 | for( i = 0; i < 7; i++ ) { |
83 | headings[i] = new QLabel("",this); | 83 | headings[i] = new QLabel("",this); |
84 | //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); | 84 | //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); |
85 | headings[i]->setAlignment(AlignCenter); | 85 | headings[i]->setAlignment(AlignCenter); |
86 | 86 | ||
87 | topLayout->addWidget(headings[i],1,i+1); | 87 | topLayout->addWidget(headings[i],1,i+1); |
88 | } | 88 | } |
89 | 89 | ||
90 | // Create the weeknumber labels | 90 | // Create the weeknumber labels |
91 | for( i = 0; i < 6; i++ ) { | 91 | for( i = 0; i < 6; i++ ) { |
92 | weeknos[i] = new QLabel(this); | 92 | weeknos[i] = new QLabel(this); |
93 | weeknos[i]->setAlignment(AlignCenter); | 93 | weeknos[i]->setAlignment(AlignCenter); |
94 | //weeknos[i]->setFont(QFont("Arial", 10)); | 94 | //weeknos[i]->setFont(QFont("Arial", 10)); |
95 | if(!m_bShowWeekNums) { | 95 | if(!m_bShowWeekNums) { |
96 | weeknos[i]->hide(); | 96 | weeknos[i]->hide(); |
97 | } | 97 | } |
98 | weeknos[i]->installEventFilter(this); | 98 | weeknos[i]->installEventFilter(this); |
99 | 99 | ||
100 | topLayout->addWidget(weeknos[i],i+2,0); | 100 | topLayout->addWidget(weeknos[i],i+2,0); |
101 | } | 101 | } |
102 | 102 | ||
103 | daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); | 103 | daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); |
104 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 104 | daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
105 | daymatrix->setLineWidth(1); | 105 | daymatrix->setLineWidth(1); |
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 | daymatrix->repaint(); | 145 | if ( doRepaint ) |
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; |
157 | updateTimer=0L; | 158 | updateTimer=0L; |
158 | } | 159 | } |
159 | break; | 160 | break; |
160 | case FollowDay : | 161 | case FollowDay : |
161 | case FollowMonth : | 162 | case FollowMonth : |
162 | if (!updateTimer) | 163 | if (!updateTimer) |
163 | { | 164 | { |
164 | updateTimer = new QTimer(this); | 165 | updateTimer = new QTimer(this); |
165 | QObject::connect(updateTimer,SIGNAL(timeout()), | 166 | QObject::connect(updateTimer,SIGNAL(timeout()), |
166 | this,SLOT(possiblyPastMidnight())); | 167 | this,SLOT(possiblyPastMidnight())); |
167 | } | 168 | } |
168 | updateTimer->start(0,true); | 169 | updateTimer->start(0,true); |
169 | lastDayChecked = QDate::currentDate(); | 170 | lastDayChecked = QDate::currentDate(); |
170 | } | 171 | } |
171 | updateRollover=r; | 172 | updateRollover=r; |
172 | } | 173 | } |
173 | 174 | ||
174 | 175 | ||
175 | KDateNavigator::~KDateNavigator() | 176 | KDateNavigator::~KDateNavigator() |
176 | { | 177 | { |
177 | } | 178 | } |
178 | 179 | ||
179 | 180 | ||
180 | void KDateNavigator::passedMidnight() | 181 | void KDateNavigator::passedMidnight() |
181 | { | 182 | { |
182 | QDate today = QDate::currentDate(); | 183 | QDate today = QDate::currentDate(); |
183 | bool emitMonth = false; | 184 | bool emitMonth = false; |
184 | 185 | ||
185 | if (today.month() != lastDayChecked.month()) | 186 | if (today.month() != lastDayChecked.month()) |
186 | { | 187 | { |
187 | if (updateRollover==FollowMonth && | 188 | if (updateRollover==FollowMonth && |
188 | daymatrix->isEndOfMonth()) { | 189 | daymatrix->isEndOfMonth()) { |
189 | goNextMonth(); | 190 | goNextMonth(); |
190 | emitMonth=true; | 191 | emitMonth=true; |
191 | } | 192 | } |
192 | } | 193 | } |
193 | daymatrix->recalculateToday(); | 194 | daymatrix->recalculateToday(); |