summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-04 23:11:42 (UTC)
committer zautrix <zautrix>2005-02-04 23:11:42 (UTC)
commit3a822a4c4867acb28dc1b3b9557918d0971f732c (patch) (unidiff)
tree31e5c2627cf739feb944bda079935fa9b2b9df6b
parentc6dceabcb41f6300ca97e69872fc801451944a32 (diff)
downloadkdepimpi-3a822a4c4867acb28dc1b3b9557918d0971f732c.zip
kdepimpi-3a822a4c4867acb28dc1b3b9557918d0971f732c.tar.gz
kdepimpi-3a822a4c4867acb28dc1b3b9557918d0971f732c.tar.bz2
nochn fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index df5e060..31c5659 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -158,193 +158,193 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
158 158
159void KNoScrollListBox::oneDown() 159void KNoScrollListBox::oneDown()
160{ 160{
161 setCurrentItem((currentItem()+1)%count()); 161 setCurrentItem((currentItem()+1)%count());
162 if(!itemVisible(currentItem())) { 162 if(!itemVisible(currentItem())) {
163 if(currentItem() == 0) { 163 if(currentItem() == 0) {
164 setTopItem(0); 164 setTopItem(0);
165 } else { 165 } else {
166 setTopItem(topItem()+1); 166 setTopItem(topItem()+1);
167 } 167 }
168 } 168 }
169} 169}
170void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 170void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
171{ 171{
172 switch(e->key()) { 172 switch(e->key()) {
173 case Key_Shift: 173 case Key_Shift:
174 emit shiftUp(); 174 emit shiftUp();
175 break; 175 break;
176 default: 176 default:
177 break; 177 break;
178 } 178 }
179} 179}
180 180
181void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 181void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
182{ 182{
183 QListBox::mousePressEvent(e); 183 QListBox::mousePressEvent(e);
184 184
185 if(e->button() == RightButton) { 185 if(e->button() == RightButton) {
186 emit rightClick(); 186 emit rightClick();
187 } 187 }
188} 188}
189 189
190MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 190MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
191 : QListBoxItem() 191 : QListBoxItem()
192{ 192{
193 setText( s ); 193 setText( s );
194 194
195 mIncidence = incidence; 195 mIncidence = incidence;
196 mDate = qd; 196 mDate = qd;
197 // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); 197 // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence ));
198 mRecur = false; 198 mRecur = false;
199 mAlarm = false; 199 mAlarm = false;
200 mReply = false; 200 mReply = false;
201 mInfo = false; 201 mInfo = false;
202} 202}
203 203
204void MonthViewItem::paint(QPainter *p) 204void MonthViewItem::paint(QPainter *p)
205{ 205{
206#if QT_VERSION >= 0x030000 206#if QT_VERSION >= 0x030000
207 bool sel = isSelected(); 207 bool sel = isSelected();
208#else 208#else
209 bool sel = selected(); 209 bool sel = selected();
210#endif 210#endif
211 211
212 212
213 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) 213 if (KOPrefs::instance()->mMonthViewUsesCategoryColor)
214 { 214 {
215 p->setBackgroundColor( palette().color( QPalette::Normal, \ 215 p->setBackgroundColor( palette().color( QPalette::Normal, \
216 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 216 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
217 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); 217 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) );
218 } 218 }
219 int x = 1; 219 int x = 1;
220 int y = 3;//(height() - mRecurPixmap.height()) /2; 220 int y = 3;//(height() - mRecurPixmap.height()) /2;
221 int size = PIXMAP_SIZE; 221 int size = PIXMAP_SIZE;
222 if ( QApplication::desktop()->width() < 300 ) 222 if ( QApplication::desktop()->width() < 300 )
223 size = 3; 223 size = 3;
224 if ( KOPrefs::instance()->mMonthShowIcons ) { 224 if ( KOPrefs::instance()->mMonthShowIcons ) {
225 if ( mInfo ) { 225 if ( mInfo ) {
226 p->fillRect ( x, y,size,size, Qt::darkGreen ); 226 p->fillRect ( x, y,size,size, Qt::darkGreen );
227 x += size + 1; 227 x += size + 1;
228 } 228 }
229 if ( mRecur ) { 229 if ( mRecur ) {
230 p->fillRect ( x, y,size,size, Qt::blue ); 230 p->fillRect ( x, y,size,size, Qt::blue );
231 x += size + 1; 231 x += size + 1;
232 } 232 }
233 if ( mAlarm ) { 233 if ( mAlarm ) {
234 p->fillRect ( x, y,size,size, Qt::red ); 234 p->fillRect ( x, y,size,size, Qt::red );
235 x += size + 1; 235 x += size + 1;
236 } 236 }
237 if ( mReply ) { 237 if ( mReply ) {
238 p->fillRect ( x, y,size,size, Qt::yellow ); 238 p->fillRect ( x, y,size,size, Qt::yellow );
239 x += size + 1; 239 x += size + 1;
240 } 240 }
241 } 241 }
242 QFontMetrics fm = p->fontMetrics(); 242 QFontMetrics fm = p->fontMetrics();
243 int yPos; 243 int yPos;
244 int pmheight = size; 244 int pmheight = size;
245 if( pmheight < fm.height() ) 245 if( pmheight < fm.height() )
246 yPos = fm.ascent() + fm.leading()/2; 246 yPos = fm.ascent() + fm.leading()/2;
247 else 247 else
248 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 248 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
249 p->setPen( palette().color( QPalette::Normal, sel ? \ 249 p->setPen( palette().color( QPalette::Normal, sel ? \
250 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 250 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
251 p->drawText( x, yPos, text() ); 251 p->drawText( x, yPos, text() );
252 if ( mIncidence->cancelled() ) { 252 if ( mIncidence->cancelled() ) {
253 int wid = fm.width( text() ); 253 int wid = fm.width( text() );
254 p->drawLine( x, yPos- fm.height()/2+2,x+wid, yPos- fm.height()/2 +2); 254 p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3);
255 } 255 }
256 256
257} 257}
258 258
259int MonthViewItem::height(const QListBox *lb) const 259int MonthViewItem::height(const QListBox *lb) const
260{ 260{
261 return lb->fontMetrics().lineSpacing()+1; 261 return lb->fontMetrics().lineSpacing()+1;
262} 262}
263 263
264int MonthViewItem::width(const QListBox *lb) const 264int MonthViewItem::width(const QListBox *lb) const
265{ 265{
266 int size = PIXMAP_SIZE; 266 int size = PIXMAP_SIZE;
267 if ( QApplication::desktop()->width() < 300 ) 267 if ( QApplication::desktop()->width() < 300 )
268 size = 3; 268 size = 3;
269 int x = 1; 269 int x = 1;
270 if ( mInfo ) { 270 if ( mInfo ) {
271 x += size + 1; 271 x += size + 1;
272 } 272 }
273 if( mRecur ) { 273 if( mRecur ) {
274 x += size+1; 274 x += size+1;
275 } 275 }
276 if( mAlarm ) { 276 if( mAlarm ) {
277 x += size+1; 277 x += size+1;
278 } 278 }
279 if( mReply ) { 279 if( mReply ) {
280 x += size+1; 280 x += size+1;
281 } 281 }
282 282
283 return( x + lb->fontMetrics().width( text() ) + 1 ); 283 return( x + lb->fontMetrics().width( text() ) + 1 );
284} 284}
285 285
286 286
287MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) 287MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
288 : QWidget( par ), 288 : QWidget( par ),
289 mMonthView( parent ) 289 mMonthView( parent )
290{ 290{
291 291
292 QVBoxLayout *topLayout = new QVBoxLayout( this ); 292 QVBoxLayout *topLayout = new QVBoxLayout( this );
293 293
294 // mLabel = new QLabel( this );QPushButton 294 // mLabel = new QLabel( this );QPushButton
295 mLabel = new QPushButton( this ); 295 mLabel = new QPushButton( this );
296 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); 296 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
297 //mLabel->setLineWidth( 1 ); 297 //mLabel->setLineWidth( 1 );
298 //mLabel->setAlignment( AlignCenter ); 298 //mLabel->setAlignment( AlignCenter );
299 mLabel->setFlat( true ); 299 mLabel->setFlat( true );
300 mLabel->setFocusPolicy(NoFocus); 300 mLabel->setFocusPolicy(NoFocus);
301 mItemList = new KNoScrollListBox( this ); 301 mItemList = new KNoScrollListBox( this );
302 mItemList->setMinimumSize( 10, 10 ); 302 mItemList->setMinimumSize( 10, 10 );
303 mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); 303 mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain );
304 mItemList->setLineWidth( 1 ); 304 mItemList->setLineWidth( 1 );
305 topLayout->addWidget( mItemList ); 305 topLayout->addWidget( mItemList );
306 mLabel->raise(); 306 mLabel->raise();
307 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 307 // QColor( 0,0,255 ) QColor( 160,1600,255 )
308 mStandardPalette = palette(); 308 mStandardPalette = palette();
309 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 309 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
310 310
311 enableScrollBars( false ); 311 enableScrollBars( false );
312 updateConfig(); 312 updateConfig();
313 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); 313 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
314 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); 314 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
315 connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), 315 connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ),
316 SLOT( defaultAction( QListBoxItem * ) ) ); 316 SLOT( defaultAction( QListBoxItem * ) ) );
317 connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, 317 connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *,
318 const QPoint &) ), 318 const QPoint &) ),
319 SLOT( contextMenu( QListBoxItem * ) ) ); 319 SLOT( contextMenu( QListBoxItem * ) ) );
320 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), 320 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ),
321 SLOT( selection( QListBoxItem * ) ) ); 321 SLOT( selection( QListBoxItem * ) ) );
322 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), 322 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
323 SLOT( cellClicked( QListBoxItem * ) ) ); 323 SLOT( cellClicked( QListBoxItem * ) ) );
324 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), 324 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
325 SLOT( selection( QListBoxItem * ) ) ); 325 SLOT( selection( QListBoxItem * ) ) );
326} 326}
327#ifdef DESKTOP_VERSION 327#ifdef DESKTOP_VERSION
328QToolTipGroup *MonthViewCell::toolTipGroup() 328QToolTipGroup *MonthViewCell::toolTipGroup()
329{ 329{
330 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 330 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
331 return mToolTipGroup; 331 return mToolTipGroup;
332} 332}
333#endif 333#endif
334 334
335void MonthViewCell::setDate( const QDate &date ) 335void MonthViewCell::setDate( const QDate &date )
336{ 336{
337 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; 337 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
338 mDate = date; 338 mDate = date;
339 339
340 340
341 341
342 //resizeEvent( 0 ); 342 //resizeEvent( 0 );
343} 343}
344 344
345QDate MonthViewCell::date() const 345QDate MonthViewCell::date() const
346{ 346{
347 return mDate; 347 return mDate;
348} 348}
349 349
350void MonthViewCell::setPrimary( bool primary ) 350void MonthViewCell::setPrimary( bool primary )