-rw-r--r-- | microkde/kdeui/klistview.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 2856f2d..6477d11 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -1794,195 +1794,196 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1794 | if (repaintItem1) | 1794 | if (repaintItem1) |
1795 | ir = ir.unite( itemRect(repaintItem1) ); | 1795 | ir = ir.unite( itemRect(repaintItem1) ); |
1796 | if (repaintItem2) | 1796 | if (repaintItem2) |
1797 | ir = ir.unite( itemRect(repaintItem2) ); | 1797 | ir = ir.unite( itemRect(repaintItem2) ); |
1798 | 1798 | ||
1799 | if ( !ir.isEmpty() ) | 1799 | if ( !ir.isEmpty() ) |
1800 | { // rectangle to be repainted | 1800 | { // rectangle to be repainted |
1801 | if ( ir.x() < 0 ) | 1801 | if ( ir.x() < 0 ) |
1802 | ir.moveBy( -ir.x(), 0 ); | 1802 | ir.moveBy( -ir.x(), 0 ); |
1803 | viewport()->repaint( ir, FALSE ); | 1803 | viewport()->repaint( ir, FALSE ); |
1804 | } | 1804 | } |
1805 | /*if (repaintItem1) | 1805 | /*if (repaintItem1) |
1806 | repaintItem1->repaint(); | 1806 | repaintItem1->repaint(); |
1807 | if (repaintItem2) | 1807 | if (repaintItem2) |
1808 | repaintItem2->repaint();*/ | 1808 | repaintItem2->repaint();*/ |
1809 | update(); | 1809 | update(); |
1810 | if (emitSelectionChanged) | 1810 | if (emitSelectionChanged) |
1811 | emit selectionChanged(); | 1811 | emit selectionChanged(); |
1812 | } | 1812 | } |
1813 | 1813 | ||
1814 | void KListView::setSelectionModeExt (SelectionModeExt mode) | 1814 | void KListView::setSelectionModeExt (SelectionModeExt mode) |
1815 | { | 1815 | { |
1816 | d->selectionMode = mode; | 1816 | d->selectionMode = mode; |
1817 | 1817 | ||
1818 | switch (mode) | 1818 | switch (mode) |
1819 | { | 1819 | { |
1820 | case Single: | 1820 | case Single: |
1821 | case Multi: | 1821 | case Multi: |
1822 | case Extended: | 1822 | case Extended: |
1823 | case NoSelection: | 1823 | case NoSelection: |
1824 | setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); | 1824 | setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); |
1825 | break; | 1825 | break; |
1826 | 1826 | ||
1827 | case FileManager: | 1827 | case FileManager: |
1828 | setSelectionMode (QListView::Extended); | 1828 | setSelectionMode (QListView::Extended); |
1829 | break; | 1829 | break; |
1830 | 1830 | ||
1831 | default: | 1831 | default: |
1832 | kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; | 1832 | kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; |
1833 | break; | 1833 | break; |
1834 | } | 1834 | } |
1835 | } | 1835 | } |
1836 | 1836 | ||
1837 | KListView::SelectionModeExt KListView::selectionModeExt () const | 1837 | KListView::SelectionModeExt KListView::selectionModeExt () const |
1838 | { | 1838 | { |
1839 | return d->selectionMode; | 1839 | return d->selectionMode; |
1840 | } | 1840 | } |
1841 | 1841 | ||
1842 | int KListView::itemIndex( const QListViewItem *item ) const | 1842 | int KListView::itemIndex( const QListViewItem *item ) const |
1843 | { | 1843 | { |
1844 | if ( !item ) | 1844 | if ( !item ) |
1845 | return -1; | 1845 | return -1; |
1846 | 1846 | ||
1847 | if ( item == firstChild() ) | 1847 | if ( item == firstChild() ) |
1848 | return 0; | 1848 | return 0; |
1849 | else { | 1849 | else { |
1850 | QListViewItemIterator it(firstChild()); | 1850 | QListViewItemIterator it(firstChild()); |
1851 | uint j = 0; | 1851 | uint j = 0; |
1852 | for (; it.current() && it.current() != item; ++it, ++j ); | 1852 | for (; it.current() && it.current() != item; ++it, ++j ); |
1853 | 1853 | ||
1854 | if( !it.current() ) | 1854 | if( !it.current() ) |
1855 | return -1; | 1855 | return -1; |
1856 | 1856 | ||
1857 | return j; | 1857 | return j; |
1858 | } | 1858 | } |
1859 | } | 1859 | } |
1860 | 1860 | ||
1861 | QListViewItem* KListView::itemAtIndex(int index) | 1861 | QListViewItem* KListView::itemAtIndex(int index) |
1862 | { | 1862 | { |
1863 | if (index<0) | 1863 | if (index<0) |
1864 | return 0; | 1864 | return 0; |
1865 | 1865 | ||
1866 | int j(0); | 1866 | int j(0); |
1867 | for (QListViewItemIterator it=firstChild(); it.current(); it++) | 1867 | for (QListViewItemIterator it=firstChild(); it.current(); it++) |
1868 | { | 1868 | { |
1869 | if (j==index) | 1869 | if (j==index) |
1870 | return it.current(); | 1870 | return it.current(); |
1871 | j++; | 1871 | j++; |
1872 | }; | 1872 | }; |
1873 | return 0; | 1873 | return 0; |
1874 | } | 1874 | } |
1875 | 1875 | ||
1876 | 1876 | ||
1877 | void KListView::emitContextMenu (KListView*, QListViewItem* i) | 1877 | void KListView::emitContextMenu (KListView*, QListViewItem* i) |
1878 | { | 1878 | { |
1879 | QPoint p; | 1879 | QPoint p; |
1880 | qDebug("KListView::emitContextMenu "); | 1880 | qDebug("KListView::emitContextMenu "); |
1881 | 1881 | ||
1882 | if (i) | 1882 | if (i) |
1883 | p = viewport()->mapToGlobal(itemRect(i).center()); | 1883 | p = viewport()->mapToGlobal(itemRect(i).center()); |
1884 | else | 1884 | else |
1885 | p = mapToGlobal(rect().center()); | 1885 | p = mapToGlobal(rect().center()); |
1886 | 1886 | ||
1887 | emit contextMenu (this, i, p); | 1887 | emit contextMenu (this, i, p); |
1888 | } | 1888 | } |
1889 | 1889 | ||
1890 | void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int) | 1890 | void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col) |
1891 | { | 1891 | { |
1892 | qDebug("KListView::emitContextMenu "); | 1892 | qDebug("KListView::emitContextMenu col"); |
1893 | emit contextRequest( i, p, col ); | ||
1893 | emit contextMenu (this, i, p); | 1894 | emit contextMenu (this, i, p); |
1894 | } | 1895 | } |
1895 | 1896 | ||
1896 | void KListView::setAcceptDrops (bool val) | 1897 | void KListView::setAcceptDrops (bool val) |
1897 | { | 1898 | { |
1898 | QListView::setAcceptDrops (val); | 1899 | QListView::setAcceptDrops (val); |
1899 | viewport()->setAcceptDrops (val); | 1900 | viewport()->setAcceptDrops (val); |
1900 | } | 1901 | } |
1901 | 1902 | ||
1902 | int KListView::dropVisualizerWidth () const | 1903 | int KListView::dropVisualizerWidth () const |
1903 | { | 1904 | { |
1904 | return d->mDropVisualizerWidth; | 1905 | return d->mDropVisualizerWidth; |
1905 | } | 1906 | } |
1906 | 1907 | ||
1907 | 1908 | ||
1908 | void KListView::viewportPaintEvent(QPaintEvent *e) | 1909 | void KListView::viewportPaintEvent(QPaintEvent *e) |
1909 | { | 1910 | { |
1910 | QListView::viewportPaintEvent(e); | 1911 | QListView::viewportPaintEvent(e); |
1911 | 1912 | ||
1912 | if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) | 1913 | if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) |
1913 | { | 1914 | { |
1914 | QPainter painter(viewport()); | 1915 | QPainter painter(viewport()); |
1915 | 1916 | ||
1916 | // This is where we actually draw the drop-visualizer | 1917 | // This is where we actually draw the drop-visualizer |
1917 | painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); | 1918 | painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); |
1918 | } | 1919 | } |
1919 | if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) | 1920 | if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) |
1920 | { | 1921 | { |
1921 | QPainter painter(viewport()); | 1922 | QPainter painter(viewport()); |
1922 | 1923 | ||
1923 | qDebug("KListView::viewportPaintEvent has to be verified"); | 1924 | qDebug("KListView::viewportPaintEvent has to be verified"); |
1924 | 1925 | ||
1925 | // This is where we actually draw the drop-highlighter | 1926 | // This is where we actually draw the drop-highlighter |
1926 | //US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(), | 1927 | //US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(), |
1927 | //US QStyle::Style_FocusAtBorder); | 1928 | //US QStyle::Style_FocusAtBorder); |
1928 | 1929 | ||
1929 | //LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true); | 1930 | //LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true); |
1930 | 1931 | ||
1931 | 1932 | ||
1932 | } | 1933 | } |
1933 | } | 1934 | } |
1934 | 1935 | ||
1935 | void KListView::setFullWidth() | 1936 | void KListView::setFullWidth() |
1936 | { | 1937 | { |
1937 | setFullWidth(true); | 1938 | setFullWidth(true); |
1938 | } | 1939 | } |
1939 | 1940 | ||
1940 | void KListView::setFullWidth(bool fullWidth) | 1941 | void KListView::setFullWidth(bool fullWidth) |
1941 | { | 1942 | { |
1942 | d->fullWidth = fullWidth; | 1943 | d->fullWidth = fullWidth; |
1943 | //US header()->setStretchEnabled(fullWidth, columns()-1); | 1944 | //US header()->setStretchEnabled(fullWidth, columns()-1); |
1944 | } | 1945 | } |
1945 | 1946 | ||
1946 | bool KListView::fullWidth() const | 1947 | bool KListView::fullWidth() const |
1947 | { | 1948 | { |
1948 | return d->fullWidth; | 1949 | return d->fullWidth; |
1949 | } | 1950 | } |
1950 | 1951 | ||
1951 | int KListView::addColumn(const QString& label, int width) | 1952 | int KListView::addColumn(const QString& label, int width) |
1952 | { | 1953 | { |
1953 | int result = QListView::addColumn(label, width); | 1954 | int result = QListView::addColumn(label, width); |
1954 | if (d->fullWidth) { | 1955 | if (d->fullWidth) { |
1955 | //US header()->setStretchEnabled(false, columns()-2); | 1956 | //US header()->setStretchEnabled(false, columns()-2); |
1956 | //US header()->setStretchEnabled(true, columns()-1); | 1957 | //US header()->setStretchEnabled(true, columns()-1); |
1957 | } | 1958 | } |
1958 | return result; | 1959 | return result; |
1959 | } | 1960 | } |
1960 | 1961 | ||
1961 | int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) | 1962 | int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) |
1962 | { | 1963 | { |
1963 | int result = QListView::addColumn(iconset, label, width); | 1964 | int result = QListView::addColumn(iconset, label, width); |
1964 | if (d->fullWidth) { | 1965 | if (d->fullWidth) { |
1965 | //US header()->setStretchEnabled(false, columns()-2); | 1966 | //US header()->setStretchEnabled(false, columns()-2); |
1966 | //US header()->setStretchEnabled(true, columns()-1); | 1967 | //US header()->setStretchEnabled(true, columns()-1); |
1967 | } | 1968 | } |
1968 | return result; | 1969 | return result; |
1969 | } | 1970 | } |
1970 | 1971 | ||
1971 | void KListView::removeColumn(int index) | 1972 | void KListView::removeColumn(int index) |
1972 | { | 1973 | { |
1973 | QListView::removeColumn(index); | 1974 | QListView::removeColumn(index); |
1974 | //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); | 1975 | //US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); |
1975 | } | 1976 | } |
1976 | 1977 | ||
1977 | void KListView::viewportResizeEvent(QResizeEvent* e) | 1978 | void KListView::viewportResizeEvent(QResizeEvent* e) |
1978 | { | 1979 | { |
1979 | QListView::viewportResizeEvent(e); | 1980 | QListView::viewportResizeEvent(e); |
1980 | } | 1981 | } |
1981 | 1982 | ||
1982 | const QColor &KListView::alternateBackground() const | 1983 | const QColor &KListView::alternateBackground() const |
1983 | { | 1984 | { |
1984 | return d->alternateBackground; | 1985 | return d->alternateBackground; |
1985 | } | 1986 | } |
1986 | 1987 | ||
1987 | void KListView::setAlternateBackground(const QColor &c) | 1988 | void KListView::setAlternateBackground(const QColor &c) |
1988 | { | 1989 | { |