author | zautrix <zautrix> | 2005-03-08 11:48:20 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-08 11:48:20 (UTC) |
commit | f20f8ca063abd322387a72f3f5a65c480f6a4233 (patch) (unidiff) | |
tree | 6136c01f0ac27b0ee869d5fb1169ebe95229faef | |
parent | 90f53697a44fdcccec00ef8c53fe5c9c15aca713 (diff) | |
download | kdepimpi-f20f8ca063abd322387a72f3f5a65c480f6a4233.zip kdepimpi-f20f8ca063abd322387a72f3f5a65c480f6a4233.tar.gz kdepimpi-f20f8ca063abd322387a72f3f5a65c480f6a4233.tar.bz2 |
list weekview fix
-rw-r--r-- | korganizer/komonthview.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index c125ce9..f983ff9 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1538,127 +1538,133 @@ void KOMonthView::computeLayout() | |||
1538 | ++h; | 1538 | ++h; |
1539 | if ( combinedSatSun ) { | 1539 | if ( combinedSatSun ) { |
1540 | if ( (i)%7 >= daysToShow-1 ) { | 1540 | if ( (i)%7 >= daysToShow-1 ) { |
1541 | if ( (i)%7 == daysToShow-1 ) { | 1541 | if ( (i)%7 == daysToShow-1 ) { |
1542 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); | 1542 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); |
1543 | x -= w ;y += h/2; | 1543 | x -= w ;y += h/2; |
1544 | } else { | 1544 | } else { |
1545 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); | 1545 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); |
1546 | y -= h/2; | 1546 | y -= h/2; |
1547 | } | 1547 | } |
1548 | } else | 1548 | } else |
1549 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1549 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1550 | 1550 | ||
1551 | } | 1551 | } |
1552 | else | 1552 | else |
1553 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1553 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1554 | x += w; | 1554 | x += w; |
1555 | if ( x + w/2 > wid ) { | 1555 | if ( x + w/2 > wid ) { |
1556 | x = 0; | 1556 | x = 0; |
1557 | y += h; | 1557 | y += h; |
1558 | } | 1558 | } |
1559 | } | 1559 | } |
1560 | y= dayLabelHei; | 1560 | y= dayLabelHei; |
1561 | h = cellHei ; | 1561 | h = cellHei ; |
1562 | for ( i = 0; i < 6; i++) { | 1562 | for ( i = 0; i < 6; i++) { |
1563 | if ( i == (6-rowModulo)) | 1563 | if ( i == (6-rowModulo)) |
1564 | ++h; | 1564 | ++h; |
1565 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1565 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1566 | y += h; | 1566 | y += h; |
1567 | } | 1567 | } |
1568 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1568 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1569 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1569 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1570 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1570 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1571 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; | 1571 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; |
1572 | updateDayLabels(); | 1572 | updateDayLabels(); |
1573 | //bool forceUpdate = !updatePossible; | 1573 | //bool forceUpdate = !updatePossible; |
1574 | updatePossible = true; | 1574 | updatePossible = true; |
1575 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1575 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1576 | } | 1576 | } |
1577 | 1577 | ||
1578 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1578 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1579 | { | 1579 | { |
1580 | mContextMenu->showIncidencePopup(incidence); | 1580 | mContextMenu->showIncidencePopup(incidence); |
1581 | /* | 1581 | /* |
1582 | if( incidence && incidence->type() == "Event" ) { | 1582 | if( incidence && incidence->type() == "Event" ) { |
1583 | Event *event = static_cast<Event *>(incidence); | 1583 | Event *event = static_cast<Event *>(incidence); |
1584 | mContextMenu->showEventPopup(event); | 1584 | mContextMenu->showEventPopup(event); |
1585 | } else { | 1585 | } else { |
1586 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1586 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1587 | } | 1587 | } |
1588 | */ | 1588 | */ |
1589 | } | 1589 | } |
1590 | MonthViewCell * KOMonthView::selectedCell( ) | 1590 | MonthViewCell * KOMonthView::selectedCell( ) |
1591 | { | 1591 | { |
1592 | return mSelectedCell; | 1592 | return mSelectedCell; |
1593 | } | 1593 | } |
1594 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1594 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1595 | { | 1595 | { |
1596 | // qDebug("KOMonthView::setSelectedCell "); | 1596 | // qDebug("KOMonthView::setSelectedCell "); |
1597 | if ( mSelectedCell && mSelectedCell != cell ) { | 1597 | if ( mSelectedCell && mSelectedCell != cell ) { |
1598 | MonthViewCell * mvc = mSelectedCell; | 1598 | MonthViewCell * mvc = mSelectedCell; |
1599 | mSelectedCell = cell; | 1599 | mSelectedCell = cell; |
1600 | mvc->deselect(); | 1600 | mvc->deselect(); |
1601 | } else | 1601 | } else |
1602 | mSelectedCell = cell; | 1602 | mSelectedCell = cell; |
1603 | // if ( mSelectedCell ) | 1603 | // if ( mSelectedCell ) |
1604 | // mSelectedCell->select(); | 1604 | // mSelectedCell->select(); |
1605 | if ( !mSelectedCell ) | 1605 | if ( !mSelectedCell ) |
1606 | emit incidenceSelected( 0 ); | 1606 | emit incidenceSelected( 0 ); |
1607 | else | 1607 | else |
1608 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1608 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1609 | } | 1609 | } |
1610 | 1610 | ||
1611 | void KOMonthView::processSelectionChange() | 1611 | void KOMonthView::processSelectionChange() |
1612 | { | 1612 | { |
1613 | QPtrList<Incidence> incidences = selectedIncidences(); | 1613 | QPtrList<Incidence> incidences = selectedIncidences(); |
1614 | if (incidences.count() > 0) { | 1614 | if (incidences.count() > 0) { |
1615 | emit incidenceSelected( incidences.first() ); | 1615 | emit incidenceSelected( incidences.first() ); |
1616 | } else { | 1616 | } else { |
1617 | emit incidenceSelected( 0 ); | 1617 | emit incidenceSelected( 0 ); |
1618 | } | 1618 | } |
1619 | } | 1619 | } |
1620 | 1620 | ||
1621 | void KOMonthView::clearSelection() | 1621 | void KOMonthView::clearSelection() |
1622 | { | 1622 | { |
1623 | if ( mSelectedCell ) { | 1623 | if ( mSelectedCell ) { |
1624 | mSelectedCell->deselect(); | 1624 | mSelectedCell->deselect(); |
1625 | mSelectedCell = 0; | 1625 | mSelectedCell = 0; |
1626 | } | 1626 | } |
1627 | } | 1627 | } |
1628 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1628 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1629 | { | 1629 | { |
1630 | //qDebug("KOMonthView::keyPressEvent "); | 1630 | //qDebug("KOMonthView::keyPressEvent "); |
1631 | switch(e->key()) { | 1631 | switch(e->key()) { |
1632 | case Key_Up: | 1632 | case Key_Up: |
1633 | { | 1633 | { |
1634 | emit prevMonth(); | 1634 | if ( mShowWeekView ) { |
1635 | if ( mShowWeekView ) | ||
1636 | mCellsW[0]->setFocus(); | 1635 | mCellsW[0]->setFocus(); |
1637 | else | 1636 | emit selectWeekNum ( currentWeek() - 1 ); |
1637 | } | ||
1638 | else { | ||
1638 | mCells[0]->setFocus(); | 1639 | mCells[0]->setFocus(); |
1640 | emit prevMonth(); | ||
1641 | } | ||
1639 | } | 1642 | } |
1640 | e->accept(); | 1643 | e->accept(); |
1641 | break; | 1644 | break; |
1642 | case Key_Down: | 1645 | case Key_Down: |
1643 | { | 1646 | { |
1644 | emit nextMonth(); | 1647 | if ( mShowWeekView ) { |
1645 | if ( mShowWeekView ) | ||
1646 | mCellsW[0]->setFocus(); | 1648 | mCellsW[0]->setFocus(); |
1647 | else | 1649 | emit selectWeekNum ( currentWeek() +1); |
1650 | } | ||
1651 | else { | ||
1648 | mCells[0]->setFocus(); | 1652 | mCells[0]->setFocus(); |
1653 | emit nextMonth(); | ||
1654 | } | ||
1649 | 1655 | ||
1650 | } | 1656 | } |
1651 | e->accept(); | 1657 | e->accept(); |
1652 | break; | 1658 | break; |
1653 | case Key_Return: | 1659 | case Key_Return: |
1654 | case Key_Enter: | 1660 | case Key_Enter: |
1655 | { | 1661 | { |
1656 | selectInternalWeekNum ( currentWeek() ); | 1662 | selectInternalWeekNum ( currentWeek() ); |
1657 | } | 1663 | } |
1658 | e->accept(); | 1664 | e->accept(); |
1659 | break; | 1665 | break; |
1660 | default: | 1666 | default: |
1661 | e->ignore(); | 1667 | e->ignore(); |
1662 | break; | 1668 | break; |
1663 | } | 1669 | } |
1664 | } | 1670 | } |