author | zautrix <zautrix> | 2005-07-09 14:48:54 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-09 14:48:54 (UTC) |
commit | 875884b2517f9b82153a14852c0f1676f985494f (patch) (unidiff) | |
tree | 89e1c773a2fdae7a4f2e2fb9ba9d4c59e921d60f /korganizer | |
parent | fa7a30172aa502aaa9e81868e5960efba76cbb0d (diff) | |
download | kdepimpi-875884b2517f9b82153a14852c0f1676f985494f.zip kdepimpi-875884b2517f9b82153a14852c0f1676f985494f.tar.gz kdepimpi-875884b2517f9b82153a14852c0f1676f985494f.tar.bz2 |
layout fixes
-rw-r--r-- | korganizer/komonthview.cpp | 2 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index b5a59af..498d9b0 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1753,193 +1753,193 @@ void KOMonthView::updateView() | |||
1753 | if ( todo->hasDueDate() ) { | 1753 | if ( todo->hasDueDate() ) { |
1754 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1754 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1755 | if ( day >= 0 && day < timeSpan + 1) { | 1755 | if ( day >= 0 && day < timeSpan + 1) { |
1756 | (*cells)[day]->insertTodo( todo ); | 1756 | (*cells)[day]->insertTodo( todo ); |
1757 | } | 1757 | } |
1758 | } | 1758 | } |
1759 | } | 1759 | } |
1760 | 1760 | ||
1761 | for( i = 0; i < timeSpan+1; ++i ) { | 1761 | for( i = 0; i < timeSpan+1; ++i ) { |
1762 | (*cells)[i]->finishUpdateCell(); | 1762 | (*cells)[i]->finishUpdateCell(); |
1763 | } | 1763 | } |
1764 | processSelectionChange(); | 1764 | processSelectionChange(); |
1765 | //qApp->processEvents(); | 1765 | //qApp->processEvents(); |
1766 | for( i = 0; i < timeSpan+1; ++i ) { | 1766 | for( i = 0; i < timeSpan+1; ++i ) { |
1767 | //(*cells)[i]->repaintfinishUpdateCell(); | 1767 | //(*cells)[i]->repaintfinishUpdateCell(); |
1768 | QTimer::singleShot( 0, (*cells)[i], SLOT ( repaintfinishUpdateCell() ) ); | 1768 | QTimer::singleShot( 0, (*cells)[i], SLOT ( repaintfinishUpdateCell() ) ); |
1769 | } | 1769 | } |
1770 | setKeyBFocus(); | 1770 | setKeyBFocus(); |
1771 | #else | 1771 | #else |
1772 | // old code | 1772 | // old code |
1773 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1773 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1774 | int i; | 1774 | int i; |
1775 | for( i = 0; i < (*cells).count(); ++i ) { | 1775 | for( i = 0; i < (*cells).count(); ++i ) { |
1776 | (*cells)[i]->updateCell(); | 1776 | (*cells)[i]->updateCell(); |
1777 | } | 1777 | } |
1778 | 1778 | ||
1779 | //qDebug("KOMonthView::updateView() "); | 1779 | //qDebug("KOMonthView::updateView() "); |
1780 | processSelectionChange(); | 1780 | processSelectionChange(); |
1781 | // qDebug("---------------------------------------------------------------------+ "); | 1781 | // qDebug("---------------------------------------------------------------------+ "); |
1782 | (*cells)[0]->setFocus(); | 1782 | (*cells)[0]->setFocus(); |
1783 | #endif | 1783 | #endif |
1784 | 1784 | ||
1785 | //qDebug("update time %d ", ti.elapsed()); | 1785 | //qDebug("update time %d ", ti.elapsed()); |
1786 | } | 1786 | } |
1787 | 1787 | ||
1788 | void KOMonthView::setKeyBoardFocus() | 1788 | void KOMonthView::setKeyBoardFocus() |
1789 | { | 1789 | { |
1790 | //qDebug("KOMonthView::setKeyBoardFocus() "); | 1790 | //qDebug("KOMonthView::setKeyBoardFocus() "); |
1791 | bool shootAgain = false; | 1791 | bool shootAgain = false; |
1792 | if ( mShowWeekView ) { | 1792 | if ( mShowWeekView ) { |
1793 | shootAgain = !mWeekLabelsW[1]->hasFocus(); | 1793 | shootAgain = !mWeekLabelsW[1]->hasFocus(); |
1794 | mWeekLabelsW[1]->setFocus(); | 1794 | mWeekLabelsW[1]->setFocus(); |
1795 | } | 1795 | } |
1796 | else { | 1796 | else { |
1797 | shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); | 1797 | shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); |
1798 | mWeekLabels[mNumWeeks]->setFocus(); | 1798 | mWeekLabels[mNumWeeks]->setFocus(); |
1799 | } | 1799 | } |
1800 | --mKBFcounter; | 1800 | --mKBFcounter; |
1801 | if ( shootAgain && mKBFcounter > 0 ) { | 1801 | if ( shootAgain && mKBFcounter > 0 ) { |
1802 | QTimer::singleShot( 50, this, SLOT ( setKeyBoardFocus() ) ); | 1802 | QTimer::singleShot( 50, this, SLOT ( setKeyBoardFocus() ) ); |
1803 | } | 1803 | } |
1804 | } | 1804 | } |
1805 | void KOMonthView::setKeyBFocus() | 1805 | void KOMonthView::setKeyBFocus() |
1806 | { | 1806 | { |
1807 | //qDebug("KOMonthView::setKeyBFocus() "); | 1807 | //qDebug("KOMonthView::setKeyBFocus() "); |
1808 | mKBFcounter = 10; | 1808 | mKBFcounter = 10; |
1809 | QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); | 1809 | QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); |
1810 | } | 1810 | } |
1811 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1811 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1812 | { | 1812 | { |
1813 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1813 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1814 | if ( isVisible() ) { | 1814 | if ( isVisible() ) { |
1815 | //qDebug("KOMonthView::isVisible "); | 1815 | //qDebug("KOMonthView::isVisible "); |
1816 | slotComputeLayout(); | 1816 | slotComputeLayout(); |
1817 | } else | 1817 | } else |
1818 | mComputeLayoutTimer->start( 100 ); | 1818 | mComputeLayoutTimer->start( 100 ); |
1819 | if ( e ) | 1819 | if ( e ) |
1820 | KOEventView::resizeEvent( e ); | 1820 | KOEventView::resizeEvent( e ); |
1821 | } | 1821 | } |
1822 | 1822 | ||
1823 | void KOMonthView::slotComputeLayout() | 1823 | void KOMonthView::slotComputeLayout() |
1824 | { | 1824 | { |
1825 | mComputeLayoutTimer->stop(); | 1825 | mComputeLayoutTimer->stop(); |
1826 | //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); | 1826 | //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); |
1827 | computeLayout(); | 1827 | computeLayout(); |
1828 | clPending = true; | 1828 | clPending = true; |
1829 | setKeyBFocus(); | 1829 | setKeyBFocus(); |
1830 | } | 1830 | } |
1831 | 1831 | ||
1832 | void KOMonthView::doComputeLayoutWeek() | 1832 | void KOMonthView::doComputeLayoutWeek() |
1833 | { | 1833 | { |
1834 | 1834 | ||
1835 | int daysToShow; | 1835 | int daysToShow; |
1836 | bool combinedSatSun = false; | 1836 | bool combinedSatSun = false; |
1837 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1837 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1838 | daysToShow = 6; | 1838 | daysToShow = 6; |
1839 | combinedSatSun = true; | 1839 | combinedSatSun = true; |
1840 | } | 1840 | } |
1841 | int wid = width();//e | 1841 | int wid = width();//e |
1842 | int hei = height()-1-mNavigatorBar->height(); | 1842 | int hei = height()-1-mNavigatorBar->height(); |
1843 | #ifdef DESKTOP_VERSION | 1843 | #ifdef DESKTOP_VERSION |
1844 | if ( !KOPrefs::instance()->mMonthViewWeekRowlayout ) { | 1844 | if ( !KOPrefs::instance()->mMonthViewWeekRowlayout ) { |
1845 | daysToShow = 2; | 1845 | daysToShow = 2; |
1846 | } else | 1846 | } else |
1847 | #endif | 1847 | #endif |
1848 | { | 1848 | { |
1849 | if ( wid < hei ) | 1849 | if ( wid < hei + 40 ) |
1850 | daysToShow = 2; | 1850 | daysToShow = 2; |
1851 | else | 1851 | else |
1852 | daysToShow = 3; | 1852 | daysToShow = 3; |
1853 | } | 1853 | } |
1854 | bool landscape = (daysToShow == 3); | 1854 | bool landscape = (daysToShow == 3); |
1855 | mShowSatSunComp = true; | 1855 | mShowSatSunComp = true; |
1856 | combinedSatSun = true; | 1856 | combinedSatSun = true; |
1857 | 1857 | ||
1858 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); | 1858 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); |
1859 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1859 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1860 | int weeklabelwid = fm.width( "888" ); | 1860 | int weeklabelwid = fm.width( "888" ); |
1861 | wid -= weeklabelwid; | 1861 | wid -= weeklabelwid; |
1862 | 1862 | ||
1863 | int colWid = wid / daysToShow; | 1863 | int colWid = wid / daysToShow; |
1864 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); | 1864 | int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); |
1865 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); | 1865 | int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); |
1866 | int colModulo = wid % daysToShow; | 1866 | int colModulo = wid % daysToShow; |
1867 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; | 1867 | int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; |
1868 | //qDebug("rowmod %d ", rowModulo); | 1868 | //qDebug("rowmod %d ", rowModulo); |
1869 | int i; | 1869 | int i; |
1870 | int x,y,w,h; | 1870 | int x,y,w,h; |
1871 | x= 0; | 1871 | x= 0; |
1872 | y= 0; | 1872 | y= 0; |
1873 | w = colWid; | 1873 | w = colWid; |
1874 | h = dayLabelHei ; | 1874 | h = dayLabelHei ; |
1875 | for ( i = 0; i < 7; i++) { | 1875 | for ( i = 0; i < 7; i++) { |
1876 | if ( i && !( i % daysToShow) && i < 6) { | 1876 | if ( i && !( i % daysToShow) && i < 6) { |
1877 | y += hei/(5-daysToShow); | 1877 | y += hei/(5-daysToShow); |
1878 | x = 0; | 1878 | x = 0; |
1879 | w = colWid; | 1879 | w = colWid; |
1880 | } | 1880 | } |
1881 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1881 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1882 | ++w; | 1882 | ++w; |
1883 | } | 1883 | } |
1884 | int xC,yC,wC,hC; | 1884 | int xC,yC,wC,hC; |
1885 | if ( i >= 5 ) { | 1885 | if ( i >= 5 ) { |
1886 | int wi = width() - x - weeklabelwid; | 1886 | int wi = width() - x - weeklabelwid; |
1887 | if ( i == 5 ) { | 1887 | if ( i == 5 ) { |
1888 | xC = x+weeklabelwid; | 1888 | xC = x+weeklabelwid; |
1889 | yC = y; | 1889 | yC = y; |
1890 | wC = wi/2+wi%2; | 1890 | wC = wi/2+wi%2; |
1891 | hC = h; | 1891 | hC = h; |
1892 | } else { | 1892 | } else { |
1893 | xC = x+weeklabelwid; | 1893 | xC = x+weeklabelwid; |
1894 | yC = y; | 1894 | yC = y; |
1895 | wC = wi; | 1895 | wC = wi; |
1896 | hC = h; | 1896 | hC = h; |
1897 | } | 1897 | } |
1898 | x = x - w + wi - (wi/2 ); | 1898 | x = x - w + wi - (wi/2 ); |
1899 | } | 1899 | } |
1900 | else { | 1900 | else { |
1901 | int wi = w; | 1901 | int wi = w; |
1902 | if ( !(( i+1) % daysToShow)) { | 1902 | if ( !(( i+1) % daysToShow)) { |
1903 | wi = width() - x - weeklabelwid; | 1903 | wi = width() - x - weeklabelwid; |
1904 | } | 1904 | } |
1905 | xC = x+weeklabelwid; | 1905 | xC = x+weeklabelwid; |
1906 | yC = y; | 1906 | yC = y; |
1907 | wC = wi; | 1907 | wC = wi; |
1908 | hC = h; | 1908 | hC = h; |
1909 | } | 1909 | } |
1910 | mDayLabelsW[mapWeekLayout(i,landscape)]->setGeometry( xC,yC,wC,hC); | 1910 | mDayLabelsW[mapWeekLayout(i,landscape)]->setGeometry( xC,yC,wC,hC); |
1911 | 1911 | ||
1912 | 1912 | ||
1913 | x += w; | 1913 | x += w; |
1914 | } | 1914 | } |
1915 | x= 0; | 1915 | x= 0; |
1916 | y= dayLabelHei; | 1916 | y= dayLabelHei; |
1917 | w = colWid; | 1917 | w = colWid; |
1918 | h = cellHei; | 1918 | h = cellHei; |
1919 | int max = 0; | 1919 | int max = 0; |
1920 | int w_count = mCellsW.count(); | 1920 | int w_count = mCellsW.count(); |
1921 | for ( i = 0; i < w_count; ++i) { | 1921 | for ( i = 0; i < w_count; ++i) { |
1922 | if ( i > 6 ) { | 1922 | if ( i > 6 ) { |
1923 | mCellsW[i]->hide(); | 1923 | mCellsW[i]->hide(); |
1924 | continue; | 1924 | continue; |
1925 | } | 1925 | } |
1926 | 1926 | ||
1927 | w = colWid; | 1927 | w = colWid; |
1928 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1928 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1929 | ++w; | 1929 | ++w; |
1930 | } | 1930 | } |
1931 | if ( i == (daysToShow-1-rowModulo)*7) | 1931 | if ( i == (daysToShow-1-rowModulo)*7) |
1932 | ++h; | 1932 | ++h; |
1933 | 1933 | ||
1934 | int xC,yC,wC,hC; | 1934 | int xC,yC,wC,hC; |
1935 | if ( i >= 5 ) { | 1935 | if ( i >= 5 ) { |
1936 | if ( i ==5 ) { | 1936 | if ( i ==5 ) { |
1937 | max = h/2; | 1937 | max = h/2; |
1938 | xC = x+weeklabelwid; | 1938 | xC = x+weeklabelwid; |
1939 | yC = y; | 1939 | yC = y; |
1940 | wC = w; | 1940 | wC = w; |
1941 | hC = max; | 1941 | hC = max; |
1942 | x -= w ;y += h/2; | 1942 | x -= w ;y += h/2; |
1943 | } else { | 1943 | } else { |
1944 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1944 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
1945 | ++w; | 1945 | ++w; |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index c2ad886..add1819 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -423,193 +423,193 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | |||
423 | ci->setOn( false ); | 423 | ci->setOn( false ); |
424 | else | 424 | else |
425 | ci->setOn( true ); | 425 | ci->setOn( true ); |
426 | cn = cn->itemBelow(); | 426 | cn = cn->itemBelow(); |
427 | if ( cn ) { | 427 | if ( cn ) { |
428 | setCurrentItem ( cn ); | 428 | setCurrentItem ( cn ); |
429 | ensureItemVisible ( cn ); | 429 | ensureItemVisible ( cn ); |
430 | } | 430 | } |
431 | 431 | ||
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
435 | return; | 435 | return; |
436 | } | 436 | } |
437 | 437 | ||
438 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 438 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
439 | switch ( e->key() ) { | 439 | switch ( e->key() ) { |
440 | case Qt::Key_Down: | 440 | case Qt::Key_Down: |
441 | case Qt::Key_Up: | 441 | case Qt::Key_Up: |
442 | QListView::keyPressEvent ( e ); | 442 | QListView::keyPressEvent ( e ); |
443 | break; | 443 | break; |
444 | case Qt::Key_Left: | 444 | case Qt::Key_Left: |
445 | case Qt::Key_Right: | 445 | case Qt::Key_Right: |
446 | QListView::keyPressEvent ( e ); | 446 | QListView::keyPressEvent ( e ); |
447 | e->accept(); | 447 | e->accept(); |
448 | return; | 448 | return; |
449 | break; | 449 | break; |
450 | default: | 450 | default: |
451 | e->ignore(); | 451 | e->ignore(); |
452 | break; | 452 | break; |
453 | } | 453 | } |
454 | return; | 454 | return; |
455 | } | 455 | } |
456 | e->ignore(); | 456 | e->ignore(); |
457 | } | 457 | } |
458 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 458 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
459 | { | 459 | { |
460 | QListView::contentsMouseReleaseEvent(e); | 460 | QListView::contentsMouseReleaseEvent(e); |
461 | mMousePressed = false; | 461 | mMousePressed = false; |
462 | } | 462 | } |
463 | 463 | ||
464 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 464 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
465 | { | 465 | { |
466 | if (!e) return; | 466 | if (!e) return; |
467 | 467 | ||
468 | QPoint vp = contentsToViewport(e->pos()); | 468 | QPoint vp = contentsToViewport(e->pos()); |
469 | 469 | ||
470 | QListViewItem *item = itemAt(vp); | 470 | QListViewItem *item = itemAt(vp); |
471 | 471 | ||
472 | emit double_Clicked(item); | 472 | emit double_Clicked(item); |
473 | if (!item) return; | 473 | if (!item) return; |
474 | 474 | ||
475 | emit doubleClicked(item,vp,0); | 475 | emit doubleClicked(item,vp,0); |
476 | } | 476 | } |
477 | 477 | ||
478 | ///////////////////////////////////////////////////////////////////////////// | 478 | ///////////////////////////////////////////////////////////////////////////// |
479 | 479 | ||
480 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 480 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
481 | QLineEdit(parent) | 481 | QLineEdit(parent) |
482 | { | 482 | { |
483 | setText(i18n("Click to add new Todo")); | 483 | setText(i18n("Click to add new Todo")); |
484 | } | 484 | } |
485 | 485 | ||
486 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 486 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
487 | { | 487 | { |
488 | if ( text()==i18n("Click to add new Todo") ) | 488 | if ( text()==i18n("Click to add new Todo") ) |
489 | setText(""); | 489 | setText(""); |
490 | QLineEdit::focusInEvent(ev); | 490 | QLineEdit::focusInEvent(ev); |
491 | } | 491 | } |
492 | 492 | ||
493 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 493 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
494 | { | 494 | { |
495 | setText(i18n("Click to add new Todo")); | 495 | setText(i18n("Click to add new Todo")); |
496 | QLineEdit::focusOutEvent(ev); | 496 | QLineEdit::focusOutEvent(ev); |
497 | } | 497 | } |
498 | 498 | ||
499 | ///////////////////////////////////////////////////////////////////////////// | 499 | ///////////////////////////////////////////////////////////////////////////// |
500 | 500 | ||
501 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 501 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
502 | KOrg::BaseView(calendar,parent,name) | 502 | KOrg::BaseView(calendar,parent,name) |
503 | { | 503 | { |
504 | mCategoryPopupMenu = 0; | 504 | mCategoryPopupMenu = 0; |
505 | mPendingUpdateBeforeRepaint = false; | 505 | mPendingUpdateBeforeRepaint = false; |
506 | isFlatDisplay = false; | 506 | isFlatDisplay = false; |
507 | mNavigator = 0; | 507 | mNavigator = 0; |
508 | QBoxLayout *topLayout = new QVBoxLayout(this); | 508 | QBoxLayout *topLayout = new QVBoxLayout(this); |
509 | mName = QString ( name ); | 509 | mName = QString ( name ); |
510 | mBlockUpdate = false; | 510 | mBlockUpdate = false; |
511 | mQuickBar = new QWidget( this ); | 511 | mQuickBar = new QWidget( this ); |
512 | topLayout->addWidget(mQuickBar); | 512 | topLayout->addWidget(mQuickBar); |
513 | 513 | ||
514 | mQuickAdd = new KOQuickTodo(mQuickBar); | 514 | mQuickAdd = new KOQuickTodo(mQuickBar); |
515 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); | 515 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); |
516 | quickLayout->addWidget( mQuickAdd ); | 516 | quickLayout->addWidget( mQuickAdd ); |
517 | QPushButton * flat = new QPushButton( "F",mQuickBar ); | 517 | QPushButton * flat = new QPushButton( "F",mQuickBar ); |
518 | int fixwid = flat->sizeHint().height(); | 518 | int fixwid = flat->sizeHint().height(); |
519 | if ( QApplication::desktop()->width() > 320 ) | 519 | if ( QApplication::desktop()->width() >= 800 ) |
520 | fixwid *= 2; | 520 | fixwid *= 2; |
521 | flat->setFixedWidth( fixwid ); | 521 | flat->setFixedWidth( fixwid ); |
522 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); | 522 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); |
523 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); | 523 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); |
524 | allopen->setFixedWidth( fixwid ); | 524 | allopen->setFixedWidth( fixwid ); |
525 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); | 525 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); |
526 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); | 526 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); |
527 | allclose->setFixedWidth( fixwid ); | 527 | allclose->setFixedWidth( fixwid ); |
528 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); | 528 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); |
529 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); | 529 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); |
530 | s_done->setPixmap( SmallIcon("greenhook16")); | 530 | s_done->setPixmap( SmallIcon("greenhook16")); |
531 | s_done->setFixedWidth( fixwid ); | 531 | s_done->setFixedWidth( fixwid ); |
532 | s_done->setFixedHeight( flat->sizeHint().height() ); | 532 | s_done->setFixedHeight( flat->sizeHint().height() ); |
533 | connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); | 533 | connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); |
534 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); | 534 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); |
535 | s_run->setPixmap( SmallIcon("ko16old")); | 535 | s_run->setPixmap( SmallIcon("ko16old")); |
536 | s_run->setFixedWidth( fixwid ); | 536 | s_run->setFixedWidth( fixwid ); |
537 | s_run->setFixedHeight( flat->sizeHint().height() ); | 537 | s_run->setFixedHeight( flat->sizeHint().height() ); |
538 | connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); | 538 | connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); |
539 | 539 | ||
540 | mNewSubBut = new QPushButton( "sub",mQuickBar ); | 540 | mNewSubBut = new QPushButton( "sub",mQuickBar ); |
541 | mNewSubBut->setFixedWidth( fixwid*3/2 ); | 541 | mNewSubBut->setFixedWidth( fixwid*3/2 ); |
542 | connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); | 542 | connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); |
543 | mNewSubBut->setEnabled( false ); | 543 | mNewSubBut->setEnabled( false ); |
544 | quickLayout->addWidget( mNewSubBut ); | 544 | quickLayout->addWidget( mNewSubBut ); |
545 | quickLayout->addWidget( s_done ); | 545 | quickLayout->addWidget( s_done ); |
546 | quickLayout->addWidget( s_run ); | 546 | quickLayout->addWidget( s_run ); |
547 | 547 | ||
548 | quickLayout->addWidget( allopen ); | 548 | quickLayout->addWidget( allopen ); |
549 | quickLayout->addWidget( allclose ); | 549 | quickLayout->addWidget( allclose ); |
550 | quickLayout->addWidget( flat ); | 550 | quickLayout->addWidget( flat ); |
551 | 551 | ||
552 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); | 552 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); |
553 | 553 | ||
554 | mTodoListView = new KOTodoListView(calendar,this, name ); | 554 | mTodoListView = new KOTodoListView(calendar,this, name ); |
555 | topLayout->addWidget(mTodoListView); | 555 | topLayout->addWidget(mTodoListView); |
556 | //mTodoListView->header()->setMaximumHeight(30); | 556 | //mTodoListView->header()->setMaximumHeight(30); |
557 | mTodoListView->setRootIsDecorated(true); | 557 | mTodoListView->setRootIsDecorated(true); |
558 | mTodoListView->setAllColumnsShowFocus(true); | 558 | mTodoListView->setAllColumnsShowFocus(true); |
559 | 559 | ||
560 | mTodoListView->setShowSortIndicator(true); | 560 | mTodoListView->setShowSortIndicator(true); |
561 | 561 | ||
562 | mTodoListView->addColumn(i18n("Todo")); | 562 | mTodoListView->addColumn(i18n("Todo")); |
563 | mTodoListView->addColumn(i18n("Prio")); | 563 | mTodoListView->addColumn(i18n("Prio")); |
564 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 564 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
565 | mTodoListView->addColumn(i18n("Complete")); | 565 | mTodoListView->addColumn(i18n("Complete")); |
566 | mTodoListView->setColumnAlignment(2,AlignCenter); | 566 | mTodoListView->setColumnAlignment(2,AlignCenter); |
567 | 567 | ||
568 | mTodoListView->addColumn(i18n("Due Date")); | 568 | mTodoListView->addColumn(i18n("Due Date")); |
569 | mTodoListView->setColumnAlignment(3,AlignLeft); | 569 | mTodoListView->setColumnAlignment(3,AlignLeft); |
570 | mTodoListView->addColumn(i18n("Due Time")); | 570 | mTodoListView->addColumn(i18n("Due Time")); |
571 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 571 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
572 | 572 | ||
573 | mTodoListView->addColumn(i18n("Start Date")); | 573 | mTodoListView->addColumn(i18n("Start Date")); |
574 | mTodoListView->setColumnAlignment(5,AlignLeft); | 574 | mTodoListView->setColumnAlignment(5,AlignLeft); |
575 | mTodoListView->addColumn(i18n("Start Time")); | 575 | mTodoListView->addColumn(i18n("Start Time")); |
576 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 576 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
577 | 577 | ||
578 | mTodoListView->addColumn(i18n("Cancelled")); | 578 | mTodoListView->addColumn(i18n("Cancelled")); |
579 | mTodoListView->addColumn(i18n("Categories")); | 579 | mTodoListView->addColumn(i18n("Categories")); |
580 | mTodoListView->addColumn(i18n("Calendar")); | 580 | mTodoListView->addColumn(i18n("Calendar")); |
581 | #if 0 | 581 | #if 0 |
582 | mTodoListView->addColumn(i18n("Sort Id")); | 582 | mTodoListView->addColumn(i18n("Sort Id")); |
583 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 583 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
584 | #endif | 584 | #endif |
585 | 585 | ||
586 | mTodoListView->setMinimumHeight( 60 ); | 586 | mTodoListView->setMinimumHeight( 60 ); |
587 | mTodoListView->setItemsRenameable( true ); | 587 | mTodoListView->setItemsRenameable( true ); |
588 | mTodoListView->setRenameable( 0 ); | 588 | mTodoListView->setRenameable( 0 ); |
589 | mTodoListView->setColumnWidth( 0, 120 ); | 589 | mTodoListView->setColumnWidth( 0, 120 ); |
590 | int iii = 0; | 590 | int iii = 0; |
591 | for ( iii = 0; iii< 10 ; ++iii ) | 591 | for ( iii = 0; iii< 10 ; ++iii ) |
592 | mTodoListView->setColumnWidthMode( iii, QListView::Manual ); | 592 | mTodoListView->setColumnWidthMode( iii, QListView::Manual ); |
593 | 593 | ||
594 | 594 | ||
595 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 595 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
596 | 596 | ||
597 | mPriorityPopupMenu = new QPopupMenu(this); | 597 | mPriorityPopupMenu = new QPopupMenu(this); |
598 | for (int i = 1; i <= 5; i++) { | 598 | for (int i = 1; i <= 5; i++) { |
599 | QString label = QString ("%1").arg (i); | 599 | QString label = QString ("%1").arg (i); |
600 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 600 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
601 | } | 601 | } |
602 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 602 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
603 | 603 | ||
604 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 604 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
605 | for (int i = 0; i <= 100; i+=20) { | 605 | for (int i = 0; i <= 100; i+=20) { |
606 | QString label = QString ("%1 %").arg (i); | 606 | QString label = QString ("%1 %").arg (i); |
607 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 607 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
608 | } | 608 | } |
609 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 609 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
610 | 610 | ||
611 | 611 | ||
612 | mCategoryPopupMenu = new QPopupMenu (this); | 612 | mCategoryPopupMenu = new QPopupMenu (this); |
613 | mCategoryPopupMenu->setCheckable (true); | 613 | mCategoryPopupMenu->setCheckable (true); |
614 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 614 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
615 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); | 615 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); |