-rw-r--r-- | korganizer/komonthview.cpp | 44 | ||||
-rw-r--r-- | korganizer/komonthview.h | 8 |
2 files changed, 26 insertions, 26 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 64b0e95..1c2d6a2 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -139,13 +139,13 @@ void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) | |||
139 | if ( i >= 0 ) { | 139 | if ( i >= 0 ) { |
140 | setSelected ( i, false ); | 140 | setSelected ( i, false ); |
141 | } | 141 | } |
142 | QListBox::focusOutEvent ( e ); | 142 | QListBox::focusOutEvent ( e ); |
143 | setVScrollBarMode(QScrollView::AlwaysOff); | 143 | setVScrollBarMode(QScrollView::AlwaysOff); |
144 | setHScrollBarMode(QScrollView::AlwaysOff); | 144 | setHScrollBarMode(QScrollView::AlwaysOff); |
145 | emit highligtIncidence( 0, (MonthViewCell*)this, 0 ); | 145 | emit highlightIncidence( 0, (MonthViewCell*)this, 0 ); |
146 | } | 146 | } |
147 | 147 | ||
148 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 148 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
149 | { | 149 | { |
150 | QListBoxItem* item = itemAt ( p ); | 150 | QListBoxItem* item = itemAt ( p ); |
151 | if ( ! item ) { | 151 | if ( ! item ) { |
@@ -284,42 +284,42 @@ MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s) | |||
284 | mblockRepaint = true; | 284 | mblockRepaint = true; |
285 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; | 285 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; |
286 | recycle( incidence, s ); | 286 | recycle( incidence, s ); |
287 | } | 287 | } |
288 | void MonthViewItem::recycle( Incidence *incidence, const QString & s) | 288 | void MonthViewItem::recycle( Incidence *incidence, const QString & s) |
289 | { | 289 | { |
290 | mDisplayHightlighted = false; | 290 | mDisplayHighlighted = false; |
291 | setText( s ); | 291 | setText( s ); |
292 | mMultiday = 0; | 292 | mMultiday = 0; |
293 | mIncidence = incidence; | 293 | mIncidence = incidence; |
294 | mRecur = false; | 294 | mRecur = false; |
295 | mAlarm = false; | 295 | mAlarm = false; |
296 | mReply = false; | 296 | mReply = false; |
297 | mInfo = false; | 297 | mInfo = false; |
298 | mdayPos = 0; | 298 | mdayPos = 0; |
299 | } | 299 | } |
300 | 300 | ||
301 | bool MonthViewItem::setHighlightedFalse() | 301 | bool MonthViewItem::setHighlightedFalse() |
302 | { | 302 | { |
303 | if ( !mDisplayHightlighted ) | 303 | if ( !mDisplayHighlighted ) |
304 | return false; | 304 | return false; |
305 | mDisplayHightlighted = false; | 305 | mDisplayHighlighted = false; |
306 | return true; | 306 | return true; |
307 | } | 307 | } |
308 | 308 | ||
309 | bool MonthViewItem::setHighlighted( Incidence * inc ) | 309 | bool MonthViewItem::setHighlighted( Incidence * inc ) |
310 | { | 310 | { |
311 | if ( inc == mIncidence ) { | 311 | if ( inc == mIncidence ) { |
312 | if ( mDisplayHightlighted ) | 312 | if ( mDisplayHighlighted ) |
313 | return false; | 313 | return false; |
314 | mDisplayHightlighted = true; | 314 | mDisplayHighlighted = true; |
315 | return true; | 315 | return true; |
316 | } else { | 316 | } else { |
317 | if ( !mDisplayHightlighted ) | 317 | if ( !mDisplayHighlighted ) |
318 | return false; | 318 | return false; |
319 | mDisplayHightlighted = false; | 319 | mDisplayHighlighted = false; |
320 | return true; | 320 | return true; |
321 | } | 321 | } |
322 | return false; | 322 | return false; |
323 | } | 323 | } |
324 | void MonthViewItem::paint(QPainter *p) | 324 | void MonthViewItem::paint(QPainter *p) |
325 | { | 325 | { |
@@ -330,17 +330,17 @@ void MonthViewItem::paint(QPainter *p) | |||
330 | bool sel = isSelected(); | 330 | bool sel = isSelected(); |
331 | #else | 331 | #else |
332 | bool sel = selected(); | 332 | bool sel = selected(); |
333 | #endif | 333 | #endif |
334 | int heihei = height( listBox () ); | 334 | int heihei = height( listBox () ); |
335 | int x = 1; | 335 | int x = 1; |
336 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHightlighted || sel ) | 336 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHighlighted || sel ) |
337 | { | 337 | { |
338 | 338 | ||
339 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 339 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
340 | sel ||mDisplayHightlighted ? QColorGroup::Highlight : QColorGroup::Background ) ); | 340 | sel ||mDisplayHighlighted ? QColorGroup::Highlight : QColorGroup::Background ) ); |
341 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); | 341 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); |
342 | } | 342 | } |
343 | 343 | ||
344 | //int y = 3;//(height() - mRecurPixmap.height()) /2; | 344 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
345 | int size = PIXMAP_SIZE; | 345 | int size = PIXMAP_SIZE; |
346 | if ( QApplication::desktop()->width() < 300 ) | 346 | if ( QApplication::desktop()->width() < 300 ) |
@@ -1097,31 +1097,31 @@ void MonthViewCell::contextMenu( QListBoxItem *item ) | |||
1097 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 1097 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | void MonthViewCell::selection( QListBoxItem *item ) | 1100 | void MonthViewCell::selection( QListBoxItem *item ) |
1101 | { | 1101 | { |
1102 | if ( !item ) { | 1102 | if ( !item ) { |
1103 | emit highligtIncidence( 0 , this, 0 ); | 1103 | emit highlightIncidence( 0 , this, 0 ); |
1104 | return; | 1104 | return; |
1105 | } | 1105 | } |
1106 | MonthViewItem * it = (static_cast<MonthViewItem *>( item )); | 1106 | MonthViewItem * it = (static_cast<MonthViewItem *>( item )); |
1107 | emit highligtIncidence( it->incidence(), this, it->multiDay() ); | 1107 | emit highlightIncidence( it->incidence(), this, it->multiDay() ); |
1108 | mMonthView->setSelectedCell( this ); | 1108 | mMonthView->setSelectedCell( this ); |
1109 | } | 1109 | } |
1110 | 1110 | ||
1111 | void MonthViewCell::deHightLight() | 1111 | void MonthViewCell::deHighLight() |
1112 | { | 1112 | { |
1113 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 1113 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
1114 | while ( mitem ) { | 1114 | while ( mitem ) { |
1115 | if ( mitem->setHighlightedFalse() ) | 1115 | if ( mitem->setHighlightedFalse() ) |
1116 | updateItem ( mitem ); | 1116 | updateItem ( mitem ); |
1117 | mitem = (MonthViewItem *)mitem->next(); | 1117 | mitem = (MonthViewItem *)mitem->next(); |
1118 | } | 1118 | } |
1119 | } | 1119 | } |
1120 | // returns true if no inc found | 1120 | // returns true if no inc found |
1121 | bool MonthViewCell::doHightLight( Incidence * inc ) | 1121 | bool MonthViewCell::doHighLight( Incidence * inc ) |
1122 | { | 1122 | { |
1123 | 1123 | ||
1124 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 1124 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
1125 | while ( mitem ) { | 1125 | while ( mitem ) { |
1126 | if ( mitem->incidence() == inc ) { | 1126 | if ( mitem->incidence() == inc ) { |
1127 | if ( mitem->setHighlighted( inc ) ) | 1127 | if ( mitem->setHighlighted( inc ) ) |
@@ -1240,13 +1240,13 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
1240 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1240 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1241 | SIGNAL( showDaySignal( QDate ) ) ); | 1241 | SIGNAL( showDaySignal( QDate ) ) ); |
1242 | connect( cell, SIGNAL( nextCell() ), | 1242 | connect( cell, SIGNAL( nextCell() ), |
1243 | SLOT( nextCell() ) ); | 1243 | SLOT( nextCell() ) ); |
1244 | connect( cell, SIGNAL( prevCell() ), | 1244 | connect( cell, SIGNAL( prevCell() ), |
1245 | SLOT( prevCell() ) ); | 1245 | SLOT( prevCell() ) ); |
1246 | connect( cell, SIGNAL( highligtIncidence( Incidence * , MonthViewCell *, int ) ), | 1246 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), |
1247 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); | 1247 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); |
1248 | } | 1248 | } |
1249 | } | 1249 | } |
1250 | mCellsW.resize( mDaysPerWeek ); | 1250 | mCellsW.resize( mDaysPerWeek ); |
1251 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1251 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1252 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 1252 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
@@ -1259,13 +1259,13 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
1259 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1259 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1260 | SIGNAL( showDaySignal( QDate ) ) ); | 1260 | SIGNAL( showDaySignal( QDate ) ) ); |
1261 | connect( cell, SIGNAL( nextCell() ), | 1261 | connect( cell, SIGNAL( nextCell() ), |
1262 | SLOT( nextCell() ) ); | 1262 | SLOT( nextCell() ) ); |
1263 | connect( cell, SIGNAL( prevCell() ), | 1263 | connect( cell, SIGNAL( prevCell() ), |
1264 | SLOT( prevCell() ) ); | 1264 | SLOT( prevCell() ) ); |
1265 | connect( cell, SIGNAL( highligtIncidence( Incidence * , MonthViewCell *, int ) ), | 1265 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), |
1266 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); | 1266 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); |
1267 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 1267 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
1268 | } | 1268 | } |
1269 | 1269 | ||
1270 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 1270 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
1271 | mContextMenu = eventPopup(); | 1271 | mContextMenu = eventPopup(); |
@@ -1334,57 +1334,57 @@ KOMonthView::~KOMonthView() | |||
1334 | { | 1334 | { |
1335 | delete mContextMenu; | 1335 | delete mContextMenu; |
1336 | } | 1336 | } |
1337 | 1337 | ||
1338 | void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) | 1338 | void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) |
1339 | { | 1339 | { |
1340 | //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); | 1340 | qDebug("11 KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); |
1341 | static Incidence * lastInc = 0; | 1341 | static Incidence * lastInc = 0; |
1342 | static MonthViewCell * lastCell = 0; | 1342 | static MonthViewCell * lastCell = 0; |
1343 | 1343 | ||
1344 | if ( lastInc == inc && lastCell == mc ) | 1344 | if ( lastInc == inc && lastCell == mc ) |
1345 | return; | 1345 | return; |
1346 | lastInc = inc; | 1346 | lastInc = inc; |
1347 | lastCell = mc; | 1347 | lastCell = mc; |
1348 | //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); | 1348 | qDebug("222 KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); |
1349 | 1349 | ||
1350 | bool weekview = false; | 1350 | bool weekview = false; |
1351 | int index = 0; | 1351 | int index = 0; |
1352 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1352 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1353 | if ( mCellsW[i] == mc ) { | 1353 | if ( mCellsW[i] == mc ) { |
1354 | weekview = true; | 1354 | weekview = true; |
1355 | index = i; | 1355 | index = i; |
1356 | break; | 1356 | break; |
1357 | } | 1357 | } |
1358 | } | 1358 | } |
1359 | QPtrVector<MonthViewCell> *cells; | 1359 | QPtrVector<MonthViewCell> *cells; |
1360 | if ( weekview ) | 1360 | if ( weekview ) |
1361 | cells = &mCellsW; | 1361 | cells = &mCellsW; |
1362 | else { | 1362 | else { |
1363 | for (uint i = 0; i < mCells.count(); ++i) { | 1363 | for (uint i = 0; i < mCells.count(); ++i) { |
1364 | if ( mCells[i] == mc ) { | 1364 | if ( mCells[i] == mc ) { |
1365 | index = i; | 1365 | index = i; |
1366 | break; | 1366 | break; |
1367 | } | 1367 | } |
1368 | } | 1368 | } |
1369 | cells = &mCells; | 1369 | cells = &mCells; |
1370 | } | 1370 | } |
1371 | for (uint i = 0; i < (*cells).count(); ++i) { | 1371 | for (uint i = 0; i < (*cells).count(); ++i) { |
1372 | (*cells)[i]->deHightLight(); | 1372 | (*cells)[i]->deHighLight(); |
1373 | } | 1373 | } |
1374 | if ( ! inc ) | 1374 | if ( ! inc ) |
1375 | return; | 1375 | return; |
1376 | if ( mday > 1 && index > 0 ) | 1376 | if ( mday > 1 && index > 0 ) |
1377 | for (int i = index-1; i >= 0; --i) { | 1377 | for (int i = index-1; i >= 0; --i) { |
1378 | //qDebug("index %d iii %d ", index, i); | 1378 | //qDebug("index %d iii %d ", index, i); |
1379 | if ( (*cells)[(uint)i]->doHightLight(inc) ) | 1379 | if ( (*cells)[(uint)i]->doHighLight(inc) ) |
1380 | break; | 1380 | break; |
1381 | } | 1381 | } |
1382 | if ( mday < 3 && mday > 0 && index < (*cells).count()-1) | 1382 | if ( mday < 3 && mday > 0 && index < (*cells).count()-1) |
1383 | for (uint i = index+1; i < (*cells).count(); ++i) { | 1383 | for (uint i = index+1; i < (*cells).count(); ++i) { |
1384 | if ( (*cells)[i]->doHightLight(inc) ) | 1384 | if ( (*cells)[i]->doHighLight(inc) ) |
1385 | break; | 1385 | break; |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | } | 1388 | } |
1389 | void KOMonthView::selectInternalWeekNum ( int n ) | 1389 | void KOMonthView::selectInternalWeekNum ( int n ) |
1390 | { | 1390 | { |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 2622d10..0f3aa54 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -83,13 +83,13 @@ class KNoScrollListBox: public QListBox | |||
83 | signals: | 83 | signals: |
84 | void shiftDown(); | 84 | void shiftDown(); |
85 | void shiftUp(); | 85 | void shiftUp(); |
86 | void rightClick(); | 86 | void rightClick(); |
87 | void nextCell(); | 87 | void nextCell(); |
88 | void prevCell(); | 88 | void prevCell(); |
89 | void highligtIncidence( Incidence * , MonthViewCell*, int ); | 89 | void highlightIncidence( Incidence * , MonthViewCell*, int ); |
90 | 90 | ||
91 | protected slots: | 91 | protected slots: |
92 | void oneDown(); | 92 | void oneDown(); |
93 | void keyPressEvent(QKeyEvent *); | 93 | void keyPressEvent(QKeyEvent *); |
94 | void keyReleaseEvent(QKeyEvent *); | 94 | void keyReleaseEvent(QKeyEvent *); |
95 | void mousePressEvent(QMouseEvent *); | 95 | void mousePressEvent(QMouseEvent *); |
@@ -134,13 +134,13 @@ class MonthViewItem: public QListBoxItem | |||
134 | bool mblockRepaint; | 134 | bool mblockRepaint; |
135 | int mMultiday; | 135 | int mMultiday; |
136 | bool mRecur; | 136 | bool mRecur; |
137 | bool mAlarm; | 137 | bool mAlarm; |
138 | bool mReply; | 138 | bool mReply; |
139 | bool mInfo; | 139 | bool mInfo; |
140 | bool mDisplayHightlighted; | 140 | bool mDisplayHighlighted; |
141 | 141 | ||
142 | QPalette mPalette; | 142 | QPalette mPalette; |
143 | QDate mDate; | 143 | QDate mDate; |
144 | 144 | ||
145 | Incidence *mIncidence; | 145 | Incidence *mIncidence; |
146 | }; | 146 | }; |
@@ -175,14 +175,14 @@ class MonthViewCell : public KNoScrollListBox | |||
175 | 175 | ||
176 | void enableScrollBars( bool ); | 176 | void enableScrollBars( bool ); |
177 | 177 | ||
178 | Incidence *selectedIncidence(); | 178 | Incidence *selectedIncidence(); |
179 | QDate selectedIncidenceDate(); | 179 | QDate selectedIncidenceDate(); |
180 | QPushButton * dateLabel() { return mLabel; } | 180 | QPushButton * dateLabel() { return mLabel; } |
181 | void deHightLight(); | 181 | void deHighLight(); |
182 | bool doHightLight( Incidence *); | 182 | bool doHighLight( Incidence *); |
183 | void deselect(); | 183 | void deselect(); |
184 | void select(); | 184 | void select(); |
185 | #ifdef DESKTOP_VERSION | 185 | #ifdef DESKTOP_VERSION |
186 | static QToolTipGroup *toolTipGroup(); | 186 | static QToolTipGroup *toolTipGroup(); |
187 | #endif | 187 | #endif |
188 | signals: | 188 | signals: |