-rw-r--r-- | korganizer/kolistview.cpp | 10 | ||||
-rw-r--r-- | korganizer/kolistview.h | 1 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 35 | ||||
-rw-r--r-- | korganizer/komonthview.h | 6 |
4 files changed, 35 insertions, 17 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 1b4397f..db3f802 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -319,16 +319,18 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent, | |||
319 | SLOT(setCat()),true); | 319 | SLOT(setCat()),true); |
320 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 320 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
321 | i18n("Set alarm..."),this, | 321 | i18n("Set alarm..."),this, |
322 | SLOT(setAlarm()),true); | 322 | SLOT(setAlarm()),true); |
323 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, | 323 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, |
324 | SLOT( populateCalPopup() )); | 324 | SLOT( populateCalPopup() )); |
325 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, | 325 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, |
326 | SLOT( setCalendar( int ) )); | 326 | SLOT( setCalendar( int ) )); |
327 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, | ||
328 | SLOT( catChanged( Incidence * ) )); | ||
327 | QPopupMenu * exportPO = new QPopupMenu ( this ); | 329 | QPopupMenu * exportPO = new QPopupMenu ( this ); |
328 | mPopupMenu->insertItem( i18n("Export"), exportPO ); | 330 | mPopupMenu->insertItem( i18n("Export"), exportPO ); |
329 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, | 331 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, |
330 | SLOT(saveToFile())); | 332 | SLOT(saveToFile())); |
331 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, | 333 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, |
332 | SLOT(saveToFileVCS())); | 334 | SLOT(saveToFileVCS())); |
333 | exportPO->insertItem( i18n("Journal/Details..."),this, | 335 | exportPO->insertItem( i18n("Journal/Details..."),this, |
334 | SLOT(saveDescriptionToFile())); | 336 | SLOT(saveDescriptionToFile())); |
@@ -375,16 +377,24 @@ KOListView::~KOListView() | |||
375 | delete mPopupMenu; | 377 | delete mPopupMenu; |
376 | #if QT_VERSION >= 0x030000 | 378 | #if QT_VERSION >= 0x030000 |
377 | 379 | ||
378 | #else | 380 | #else |
379 | delete mKOListViewWhatsThis; | 381 | delete mKOListViewWhatsThis; |
380 | #endif | 382 | #endif |
381 | } | 383 | } |
382 | 384 | ||
385 | void KOListView::catChanged( Incidence* inc) | ||
386 | { | ||
387 | KOListViewItem* item = getItemForEvent(inc); | ||
388 | if (item) { | ||
389 | ListItemVisitor v(item, mStartDate ); | ||
390 | inc->accept(v); | ||
391 | } | ||
392 | } | ||
383 | QString KOListView::getWhatsThisText(QPoint p) | 393 | QString KOListView::getWhatsThisText(QPoint p) |
384 | { | 394 | { |
385 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); | 395 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); |
386 | if ( item ) | 396 | if ( item ) |
387 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), | 397 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), |
388 | KOPrefs::instance()->mWTshowDetails, | 398 | KOPrefs::instance()->mWTshowDetails, |
389 | KOPrefs::instance()->mWTshowCreated, | 399 | KOPrefs::instance()->mWTshowCreated, |
390 | KOPrefs::instance()->mWTshowChanged); | 400 | KOPrefs::instance()->mWTshowChanged); |
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index a54b550..99d0561 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h | |||
@@ -289,16 +289,17 @@ class KOListView : public KOEventView | |||
289 | 289 | ||
290 | void defaultItemAction(QListViewItem *item); | 290 | void defaultItemAction(QListViewItem *item); |
291 | void popupMenu(QListViewItem *item,const QPoint &,int); | 291 | void popupMenu(QListViewItem *item,const QPoint &,int); |
292 | void setCalendar( int c ); | 292 | void setCalendar( int c ); |
293 | void populateCalPopup(); | 293 | void populateCalPopup(); |
294 | 294 | ||
295 | protected slots: | 295 | protected slots: |
296 | void processSelectionChange(QListViewItem *); | 296 | void processSelectionChange(QListViewItem *); |
297 | void catChanged( Incidence* ); | ||
297 | 298 | ||
298 | protected: | 299 | protected: |
299 | void writeToFile( bool iCal ); | 300 | void writeToFile( bool iCal ); |
300 | void addEvents(QPtrList<Event> eventList); | 301 | void addEvents(QPtrList<Event> eventList); |
301 | void addIncidence(Incidence *); | 302 | void addIncidence(Incidence *); |
302 | KOListViewItem *getItemForEvent(Incidence *event); | 303 | KOListViewItem *getItemForEvent(Incidence *event); |
303 | 304 | ||
304 | private: | 305 | private: |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 4fc447e..2289977 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -197,17 +197,17 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
197 | } | 197 | } |
198 | break; | 198 | break; |
199 | case Key_Down: | 199 | case Key_Down: |
200 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 200 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
201 | e->ignore(); | 201 | e->ignore(); |
202 | break; | 202 | break; |
203 | } | 203 | } |
204 | if ( count () ) { | 204 | if ( count () ) { |
205 | if ( currentItem()+1 == count () ) { | 205 | if ( ((uint)currentItem()+1) == count () ) { |
206 | emit nextCell(); | 206 | emit nextCell(); |
207 | } else { | 207 | } else { |
208 | setCurrentItem((currentItem()+1)%count()); | 208 | setCurrentItem((currentItem()+1)%count()); |
209 | if(!itemVisible(currentItem())) { | 209 | if(!itemVisible(currentItem())) { |
210 | if(currentItem() == 0) { | 210 | if(currentItem() == 0) { |
211 | setTopItem(0); | 211 | setTopItem(0); |
212 | } else { | 212 | } else { |
213 | setTopItem(topItem()+1); | 213 | setTopItem(topItem()+1); |
@@ -238,17 +238,17 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
238 | e->ignore(); | 238 | e->ignore(); |
239 | break; | 239 | break; |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | void KNoScrollListBox::oneDown() | 243 | void KNoScrollListBox::oneDown() |
244 | { | 244 | { |
245 | if ( count () ) { | 245 | if ( count () ) { |
246 | if ( currentItem()+1 == count () ) { | 246 | if ( ((uint)currentItem()+1) == count () ) { |
247 | emit nextCell(); | 247 | emit nextCell(); |
248 | } else { | 248 | } else { |
249 | resetOnFocusIn = false; | 249 | resetOnFocusIn = false; |
250 | setCurrentItem((currentItem()+1)%count()); | 250 | setCurrentItem((currentItem()+1)%count()); |
251 | if(!itemVisible(currentItem())) { | 251 | if(!itemVisible(currentItem())) { |
252 | if(currentItem() == 0) { | 252 | if(currentItem() == 0) { |
253 | setTopItem(0); | 253 | setTopItem(0); |
254 | } else { | 254 | } else { |
@@ -1287,16 +1287,18 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
1287 | SLOT(slotNewEvent()),false); | 1287 | SLOT(slotNewEvent()),false); |
1288 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1288 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1289 | i18n("New Todo..."),this, | 1289 | i18n("New Todo..."),this, |
1290 | SLOT(slotNewTodo()),false); | 1290 | SLOT(slotNewTodo()),false); |
1291 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1291 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1292 | i18n("Journal"),this, | 1292 | i18n("Journal"),this, |
1293 | SLOT(slotEditJournal()),false); | 1293 | SLOT(slotEditJournal()),false); |
1294 | 1294 | ||
1295 | connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this, | ||
1296 | SLOT( catChanged( Incidence * ) )); | ||
1295 | 1297 | ||
1296 | 1298 | ||
1297 | QString pathString = ""; | 1299 | QString pathString = ""; |
1298 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { | 1300 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { |
1299 | if ( QApplication::desktop()->width() < 480 ) | 1301 | if ( QApplication::desktop()->width() < 480 ) |
1300 | pathString += "icons16/"; | 1302 | pathString += "icons16/"; |
1301 | } else | 1303 | } else |
1302 | pathString += "iconsmini/"; | 1304 | pathString += "iconsmini/"; |
@@ -1343,29 +1345,33 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
1343 | mWidStack->raiseWidget( mMonthView ); | 1345 | mWidStack->raiseWidget( mMonthView ); |
1344 | } | 1346 | } |
1345 | 1347 | ||
1346 | KOMonthView::~KOMonthView() | 1348 | KOMonthView::~KOMonthView() |
1347 | { | 1349 | { |
1348 | delete mContextMenu; | 1350 | delete mContextMenu; |
1349 | } | 1351 | } |
1350 | 1352 | ||
1353 | void KOMonthView::catChanged( Incidence * ) | ||
1354 | { | ||
1355 | updateView(); | ||
1356 | } | ||
1351 | void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) | 1357 | void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) |
1352 | { | 1358 | { |
1353 | static Incidence * lastInc = 0; | 1359 | static Incidence * lastInc = 0; |
1354 | static MonthViewCell * lastCell = 0; | 1360 | static MonthViewCell * lastCell = 0; |
1355 | 1361 | ||
1356 | if ( lastInc == inc && lastCell == mc ) | 1362 | if ( lastInc == inc && lastCell == mc ) |
1357 | return; | 1363 | return; |
1358 | lastInc = inc; | 1364 | lastInc = inc; |
1359 | lastCell = mc; | 1365 | lastCell = mc; |
1360 | //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); | 1366 | //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); |
1361 | 1367 | ||
1362 | bool weekview = false; | 1368 | bool weekview = false; |
1363 | int index = 0; | 1369 | uint index = 0; |
1364 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1370 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1365 | if ( mCellsW[i] == mc ) { | 1371 | if ( mCellsW[i] == mc ) { |
1366 | weekview = true; | 1372 | weekview = true; |
1367 | index = i; | 1373 | index = i; |
1368 | break; | 1374 | break; |
1369 | } | 1375 | } |
1370 | } | 1376 | } |
1371 | QPtrVector<MonthViewCell> *cells; | 1377 | QPtrVector<MonthViewCell> *cells; |
@@ -1381,30 +1387,30 @@ void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int | |||
1381 | cells = &mCells; | 1387 | cells = &mCells; |
1382 | } | 1388 | } |
1383 | for (uint i = 0; i < (*cells).count(); ++i) { | 1389 | for (uint i = 0; i < (*cells).count(); ++i) { |
1384 | (*cells)[i]->deHighLight(); | 1390 | (*cells)[i]->deHighLight(); |
1385 | } | 1391 | } |
1386 | if ( ! inc ) | 1392 | if ( ! inc ) |
1387 | return; | 1393 | return; |
1388 | 1394 | ||
1389 | int count = (*cells).count(); | 1395 | uint count = (*cells).count(); |
1390 | bool goLeft = (mday > 1 && index > 0); | 1396 | bool goLeft = (mday > 1 && index > 0); |
1391 | bool goRight = (mday < 3 && mday > 0 && index < count -1); | 1397 | bool goRight = (mday < 3 && mday > 0 && index < count -1); |
1392 | for (uint iii = 1; iii < count; ++iii) { | 1398 | for (uint iii = 1; iii < count; ++iii) { |
1393 | if ( goLeft ) { | 1399 | if ( goLeft ) { |
1394 | int left = index - iii; | 1400 | int left = index - iii; |
1395 | if ( left >= 0 ) { | 1401 | if ( left >= 0 ) { |
1396 | if ( (*cells)[(uint)left]->doHighLight(inc) ) | 1402 | if ( (*cells)[(uint)left]->doHighLight(inc) ) |
1397 | goLeft = false; | 1403 | goLeft = false; |
1398 | } else | 1404 | } else |
1399 | goLeft = false; | 1405 | goLeft = false; |
1400 | } | 1406 | } |
1401 | if ( goRight ) { | 1407 | if ( goRight ) { |
1402 | int right = index + iii; | 1408 | uint right = index + iii; |
1403 | if ( right < count ) { | 1409 | if ( right < count ) { |
1404 | if ( (*cells)[right]->doHighLight(inc) ) | 1410 | if ( (*cells)[right]->doHighLight(inc) ) |
1405 | goRight = false; | 1411 | goRight = false; |
1406 | 1412 | ||
1407 | } else | 1413 | } else |
1408 | goRight = false; | 1414 | goRight = false; |
1409 | } | 1415 | } |
1410 | 1416 | ||
@@ -1484,25 +1490,25 @@ DateList KOMonthView::selectedDates() | |||
1484 | 1490 | ||
1485 | if ( mSelectedCell ) { | 1491 | if ( mSelectedCell ) { |
1486 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 1492 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
1487 | if ( qd.isValid() ) selected.append( qd ); | 1493 | if ( qd.isValid() ) selected.append( qd ); |
1488 | } | 1494 | } |
1489 | 1495 | ||
1490 | return selected; | 1496 | return selected; |
1491 | } | 1497 | } |
1492 | 1498 | #if 0 | |
1493 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1499 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1494 | const QDate &td) | 1500 | const QDate &td) |
1495 | { | 1501 | { |
1496 | #ifndef KORG_NOPRINTER | 1502 | #ifndef KORG_NOPRINTER |
1497 | calPrinter->preview(CalPrinter::Month, fd, td); | 1503 | calPrinter->preview(CalPrinter::Month, fd, td); |
1498 | #endif | 1504 | #endif |
1499 | } | 1505 | } |
1500 | 1506 | #endif | |
1501 | void KOMonthView::updateConfig() | 1507 | void KOMonthView::updateConfig() |
1502 | { | 1508 | { |
1503 | 1509 | ||
1504 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1510 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1505 | 1511 | ||
1506 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { | 1512 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1507 | mWeekStartsMonday = true; | 1513 | mWeekStartsMonday = true; |
1508 | } | 1514 | } |
@@ -1578,17 +1584,17 @@ void KOMonthView::clearList() | |||
1578 | } | 1584 | } |
1579 | void KOMonthView::showDates(const QDate &start, const QDate &) | 1585 | void KOMonthView::showDates(const QDate &start, const QDate &) |
1580 | { | 1586 | { |
1581 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; | 1587 | // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; |
1582 | 1588 | ||
1583 | QPtrVector<MonthViewCell> *cells; | 1589 | QPtrVector<MonthViewCell> *cells; |
1584 | QPtrVector<QLabel> *dayLabels; | 1590 | QPtrVector<QLabel> *dayLabels; |
1585 | QPtrVector<KOWeekButton> *weekLabels; | 1591 | QPtrVector<KOWeekButton> *weekLabels; |
1586 | int weekNum = 6; | 1592 | uint weekNum = 6; |
1587 | mStartDate = start; | 1593 | mStartDate = start; |
1588 | if ( mShowWeekView ) { | 1594 | if ( mShowWeekView ) { |
1589 | weekNum = 1; | 1595 | weekNum = 1; |
1590 | cells = &mCellsW; | 1596 | cells = &mCellsW; |
1591 | dayLabels = &mDayLabelsW; | 1597 | dayLabels = &mDayLabelsW; |
1592 | weekLabels = &mWeekLabelsW; | 1598 | weekLabels = &mWeekLabelsW; |
1593 | if ( !KGlobal::locale()->weekStartsMonday() ) { | 1599 | if ( !KGlobal::locale()->weekStartsMonday() ) { |
1594 | mStartDate = mStartDate.addDays( 1 ); | 1600 | mStartDate = mStartDate.addDays( 1 ); |
@@ -1604,17 +1610,16 @@ void KOMonthView::showDates(const QDate &start, const QDate &) | |||
1604 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { | 1610 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1605 | mWeekStartsMonday = true; | 1611 | mWeekStartsMonday = true; |
1606 | } | 1612 | } |
1607 | int startWeekDay = mWeekStartsMonday ? 1 : 7; | 1613 | int startWeekDay = mWeekStartsMonday ? 1 : 7; |
1608 | 1614 | ||
1609 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { | 1615 | while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { |
1610 | mStartDate = mStartDate.addDays( -1 ); | 1616 | mStartDate = mStartDate.addDays( -1 ); |
1611 | } | 1617 | } |
1612 | bool primary = false; | ||
1613 | uint i; | 1618 | uint i; |
1614 | for( i = 0; i < (*cells).size(); ++i ) { | 1619 | for( i = 0; i < (*cells).size(); ++i ) { |
1615 | QDate date = mStartDate.addDays( i ); | 1620 | QDate date = mStartDate.addDays( i ); |
1616 | (*cells)[i]->setDate( date ); | 1621 | (*cells)[i]->setDate( date ); |
1617 | 1622 | ||
1618 | #ifndef KORG_NOPLUGINS | 1623 | #ifndef KORG_NOPLUGINS |
1619 | // add holiday, if present | 1624 | // add holiday, if present |
1620 | QString hstring(KOCore::self()->holiday(date)); | 1625 | QString hstring(KOCore::self()->holiday(date)); |
@@ -1674,17 +1679,16 @@ void KOMonthView::updateView() | |||
1674 | timeSpan = 6; | 1679 | timeSpan = 6; |
1675 | for( i = 0; i < timeSpan + 1; ++i ) { | 1680 | for( i = 0; i < timeSpan + 1; ++i ) { |
1676 | (*cells)[i]->startUpdateCell(); | 1681 | (*cells)[i]->startUpdateCell(); |
1677 | } | 1682 | } |
1678 | 1683 | ||
1679 | QPtrList<Event> events = calendar()->events(); | 1684 | QPtrList<Event> events = calendar()->events(); |
1680 | Event *event; | 1685 | Event *event; |
1681 | QDateTime dt; | 1686 | QDateTime dt; |
1682 | bool ok; | ||
1683 | QDate endDate = mStartDate.addDays( timeSpan ); | 1687 | QDate endDate = mStartDate.addDays( timeSpan ); |
1684 | for( event = events.first(); event; event = events.next() ) { // for event | 1688 | for( event = events.first(); event; event = events.next() ) { // for event |
1685 | if ( event->doesRecur() ) { | 1689 | if ( event->doesRecur() ) { |
1686 | bool last; | 1690 | bool last; |
1687 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1691 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1688 | QDateTime incidenceEnd; | 1692 | QDateTime incidenceEnd; |
1689 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1693 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1690 | bool invalid = false; | 1694 | bool invalid = false; |
@@ -1806,16 +1810,17 @@ void KOMonthView::setKeyBFocus() | |||
1806 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1810 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1807 | { | 1811 | { |
1808 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1812 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1809 | if ( isVisible() ) { | 1813 | if ( isVisible() ) { |
1810 | //qDebug("KOMonthView::isVisible "); | 1814 | //qDebug("KOMonthView::isVisible "); |
1811 | slotComputeLayout(); | 1815 | slotComputeLayout(); |
1812 | } else | 1816 | } else |
1813 | mComputeLayoutTimer->start( 100 ); | 1817 | mComputeLayoutTimer->start( 100 ); |
1818 | KOEventView::resizeEvent( e ); | ||
1814 | } | 1819 | } |
1815 | 1820 | ||
1816 | void KOMonthView::slotComputeLayout() | 1821 | void KOMonthView::slotComputeLayout() |
1817 | { | 1822 | { |
1818 | mComputeLayoutTimer->stop(); | 1823 | mComputeLayoutTimer->stop(); |
1819 | //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); | 1824 | //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); |
1820 | computeLayout(); | 1825 | computeLayout(); |
1821 | clPending = true; | 1826 | clPending = true; |
@@ -1856,17 +1861,16 @@ void KOMonthView::computeLayoutWeek() | |||
1856 | combinedSatSun = true; | 1861 | combinedSatSun = true; |
1857 | 1862 | ||
1858 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); | 1863 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); |
1859 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1864 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1860 | int weeklabelwid = fm.width( "888" ); | 1865 | int weeklabelwid = fm.width( "888" ); |
1861 | wid -= weeklabelwid; | 1866 | wid -= weeklabelwid; |
1862 | 1867 | ||
1863 | int colWid = wid / daysToShow; | 1868 | int colWid = wid / daysToShow; |
1864 | int lastCol = wid - ( colWid*6 ); | ||
1865 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1869 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1866 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1870 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1867 | int colModulo = wid % daysToShow; | 1871 | int colModulo = wid % daysToShow; |
1868 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1872 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1869 | //qDebug("rowmod %d ", rowModulo); | 1873 | //qDebug("rowmod %d ", rowModulo); |
1870 | int i; | 1874 | int i; |
1871 | int x,y,w,h; | 1875 | int x,y,w,h; |
1872 | x= 0; | 1876 | x= 0; |
@@ -1900,17 +1904,18 @@ void KOMonthView::computeLayoutWeek() | |||
1900 | } | 1904 | } |
1901 | x += w; | 1905 | x += w; |
1902 | } | 1906 | } |
1903 | x= 0; | 1907 | x= 0; |
1904 | y= dayLabelHei; | 1908 | y= dayLabelHei; |
1905 | w = colWid; | 1909 | w = colWid; |
1906 | h = cellHei; | 1910 | h = cellHei; |
1907 | int max = 0; | 1911 | int max = 0; |
1908 | for ( i = 0; i < mCellsW.count(); ++i) { | 1912 | int w_count = mCellsW.count(); |
1913 | for ( i = 0; i < w_count; ++i) { | ||
1909 | if ( i > 6 ) { | 1914 | if ( i > 6 ) { |
1910 | mCellsW[i]->hide(); | 1915 | mCellsW[i]->hide(); |
1911 | continue; | 1916 | continue; |
1912 | } | 1917 | } |
1913 | 1918 | ||
1914 | w = colWid; | 1919 | w = colWid; |
1915 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1920 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1916 | ++w; | 1921 | ++w; |
@@ -1992,17 +1997,16 @@ void KOMonthView::computeLayout() | |||
1992 | lastWid = width(); | 1997 | lastWid = width(); |
1993 | lastHei = height(); | 1998 | lastHei = height(); |
1994 | //qDebug("KOMonthView::computeLayout() MMM ------------------- "); | 1999 | //qDebug("KOMonthView::computeLayout() MMM ------------------- "); |
1995 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 2000 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1996 | int weeklabelwid = fm.width( "888" ); | 2001 | int weeklabelwid = fm.width( "888" ); |
1997 | wid -= weeklabelwid; | 2002 | wid -= weeklabelwid; |
1998 | 2003 | ||
1999 | int colWid = wid / daysToShow; | 2004 | int colWid = wid / daysToShow; |
2000 | int lastCol = wid - ( colWid*6 ); | ||
2001 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); | 2005 | int dayLabelHei = mDayLabels[0]->sizeHint().height(); |
2002 | int cellHei = (hei - dayLabelHei) /6; | 2006 | int cellHei = (hei - dayLabelHei) /6; |
2003 | int colModulo = wid % daysToShow; | 2007 | int colModulo = wid % daysToShow; |
2004 | int rowModulo = (hei- dayLabelHei) % 6; | 2008 | int rowModulo = (hei- dayLabelHei) % 6; |
2005 | //qDebug("rowmod %d ", rowModulo); | 2009 | //qDebug("rowmod %d ", rowModulo); |
2006 | int i; | 2010 | int i; |
2007 | int x,y,w,h; | 2011 | int x,y,w,h; |
2008 | x= 0; | 2012 | x= 0; |
@@ -2027,17 +2031,18 @@ void KOMonthView::computeLayout() | |||
2027 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); | 2031 | mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); |
2028 | x += w; | 2032 | x += w; |
2029 | } | 2033 | } |
2030 | x= 0; | 2034 | x= 0; |
2031 | y= dayLabelHei; | 2035 | y= dayLabelHei; |
2032 | w = colWid; | 2036 | w = colWid; |
2033 | h = cellHei ; | 2037 | h = cellHei ; |
2034 | int max = 0; | 2038 | int max = 0; |
2035 | for ( i = 0; i < mCells.count(); ++i) { | 2039 | int mc_count = mCells.count(); |
2040 | for ( i = 0; i < mc_count; ++i) { | ||
2036 | //qDebug("iii %d ", i); | 2041 | //qDebug("iii %d ", i); |
2037 | w = colWid; | 2042 | w = colWid; |
2038 | if ( ((i) % 7) >= 7-colModulo ) { | 2043 | if ( ((i) % 7) >= 7-colModulo ) { |
2039 | ++w; | 2044 | ++w; |
2040 | } | 2045 | } |
2041 | if ( i == (6-rowModulo)*7) | 2046 | if ( i == (6-rowModulo)*7) |
2042 | ++h; | 2047 | ++h; |
2043 | if ( combinedSatSun ) { | 2048 | if ( combinedSatSun ) { |
@@ -2205,17 +2210,17 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) | |||
2205 | default: | 2210 | default: |
2206 | e->ignore(); | 2211 | e->ignore(); |
2207 | break; | 2212 | break; |
2208 | } | 2213 | } |
2209 | } | 2214 | } |
2210 | 2215 | ||
2211 | void KOMonthView::nextCell() | 2216 | void KOMonthView::nextCell() |
2212 | { | 2217 | { |
2213 | bool res = focusNextPrevChild ( true ); | 2218 | focusNextPrevChild ( true ); |
2214 | } | 2219 | } |
2215 | void KOMonthView::prevCell() | 2220 | void KOMonthView::prevCell() |
2216 | { | 2221 | { |
2217 | focusNextPrevChild ( false ); | 2222 | focusNextPrevChild ( false ); |
2218 | } | 2223 | } |
2219 | 2224 | ||
2220 | void KOMonthView::slotNewTodo() | 2225 | void KOMonthView::slotNewTodo() |
2221 | { | 2226 | { |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index a41eb54..4d62e9b 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -191,17 +191,17 @@ class MonthViewCell : public KNoScrollListBox | |||
191 | protected: | 191 | protected: |
192 | QStringList mToolTip; | 192 | QStringList mToolTip; |
193 | void resizeEvent( QResizeEvent * ); | 193 | void resizeEvent( QResizeEvent * ); |
194 | 194 | ||
195 | public slots: | 195 | public slots: |
196 | void showDay(); | 196 | void showDay(); |
197 | void deHighLight(); | 197 | void deHighLight(); |
198 | void repaintfinishUpdateCell(); | 198 | void repaintfinishUpdateCell(); |
199 | protected slots: | 199 | protected slots: |
200 | void defaultAction( QListBoxItem * ); | 200 | void defaultAction( QListBoxItem * ); |
201 | void contextMenu( QListBoxItem * ); | 201 | void contextMenu( QListBoxItem * ); |
202 | void selection( QListBoxItem * ); | 202 | void selection( QListBoxItem * ); |
203 | void cellClicked( QListBoxItem * ); | 203 | void cellClicked( QListBoxItem * ); |
204 | void newEvent(); | 204 | void newEvent(); |
205 | 205 | ||
206 | private: | 206 | private: |
207 | int mdayCount; | 207 | int mdayCount; |
@@ -245,19 +245,20 @@ class KOMonthView: public KOEventView | |||
245 | /** Returns number of currently shown dates. */ | 245 | /** Returns number of currently shown dates. */ |
246 | virtual int currentDateCount(); | 246 | virtual int currentDateCount(); |
247 | 247 | ||
248 | /** returns the currently selected events */ | 248 | /** returns the currently selected events */ |
249 | virtual QPtrList<Incidence> selectedIncidences(); | 249 | virtual QPtrList<Incidence> selectedIncidences(); |
250 | 250 | ||
251 | /** returns dates of the currently selected events */ | 251 | /** returns dates of the currently selected events */ |
252 | virtual DateList selectedDates(); | 252 | virtual DateList selectedDates(); |
253 | 253 | #if 0 | |
254 | virtual void printPreview(CalPrinter *calPrinter, | 254 | virtual void printPreview(CalPrinter *calPrinter, |
255 | const QDate &, const QDate &); | 255 | const QDate &, const QDate &); |
256 | #endif | ||
256 | bool isMonthView() { return !mShowWeekView; } | 257 | bool isMonthView() { return !mShowWeekView; } |
257 | bool isUpdatePossible() { return updatePossible; } | 258 | bool isUpdatePossible() { return updatePossible; } |
258 | 259 | ||
259 | MonthViewCell * selectedCell(); | 260 | MonthViewCell * selectedCell(); |
260 | bool skipResize; | 261 | bool skipResize; |
261 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} | 262 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} |
262 | void clearList(); | 263 | void clearList(); |
263 | public slots: | 264 | public slots: |
@@ -276,16 +277,17 @@ class KOMonthView: public KOEventView | |||
276 | void showContextMenu( Incidence * ); | 277 | void showContextMenu( Incidence * ); |
277 | 278 | ||
278 | void setSelectedCell( MonthViewCell * ); | 279 | void setSelectedCell( MonthViewCell * ); |
279 | void setPopupCell( MonthViewCell * ); | 280 | void setPopupCell( MonthViewCell * ); |
280 | void switchView(); | 281 | void switchView(); |
281 | void setKeyBFocus(); | 282 | void setKeyBFocus(); |
282 | 283 | ||
283 | protected slots: | 284 | protected slots: |
285 | void catChanged( Incidence * ); | ||
284 | void setKeyBoardFocus(); | 286 | void setKeyBoardFocus(); |
285 | void slotNewTodo(); | 287 | void slotNewTodo(); |
286 | void slotNewEvent(); | 288 | void slotNewEvent(); |
287 | void slotEditJournal(); | 289 | void slotEditJournal(); |
288 | void slotComputeLayout(); | 290 | void slotComputeLayout(); |
289 | void selectInternalWeekNum ( int ); | 291 | void selectInternalWeekNum ( int ); |
290 | void processSelectionChange(); | 292 | void processSelectionChange(); |
291 | signals: | 293 | signals: |