-rw-r--r-- | microkde/kdeui/klistview.cpp | 7 | ||||
-rw-r--r-- | microkde/kdeui/klistview.h | 1 |
2 files changed, 5 insertions, 3 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 | |||
@@ -1698,388 +1698,389 @@ void KListView::fileManagerKeyPressEvent (QKeyEvent* e) | |||
1698 | }; | 1698 | }; |
1699 | 1699 | ||
1700 | for (int i=0; i<items; i++) | 1700 | for (int i=0; i<items; i++) |
1701 | { | 1701 | { |
1702 | if (shiftOrCtrl) | 1702 | if (shiftOrCtrl) |
1703 | nextItem->setSelected(!nextItem->isSelected()); | 1703 | nextItem->setSelected(!nextItem->isSelected()); |
1704 | //the end | 1704 | //the end |
1705 | if ((i==items-1) || (nextItem->itemBelow()==0)) | 1705 | if ((i==items-1) || (nextItem->itemBelow()==0)) |
1706 | 1706 | ||
1707 | { | 1707 | { |
1708 | if (shiftOrCtrl) | 1708 | if (shiftOrCtrl) |
1709 | nextItem->setSelected(!nextItem->isSelected()); | 1709 | nextItem->setSelected(!nextItem->isSelected()); |
1710 | if (d->selectedBySimpleMove) | 1710 | if (d->selectedBySimpleMove) |
1711 | nextItem->setSelected(true); | 1711 | nextItem->setSelected(true); |
1712 | ensureItemVisible(nextItem); | 1712 | ensureItemVisible(nextItem); |
1713 | setCurrentItem(nextItem); | 1713 | setCurrentItem(nextItem); |
1714 | update(); | 1714 | update(); |
1715 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) | 1715 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) |
1716 | { | 1716 | { |
1717 | emit selectionChanged(); | 1717 | emit selectionChanged(); |
1718 | } | 1718 | } |
1719 | return; | 1719 | return; |
1720 | } | 1720 | } |
1721 | nextItem=nextItem->itemBelow(); | 1721 | nextItem=nextItem->itemBelow(); |
1722 | } | 1722 | } |
1723 | break; | 1723 | break; |
1724 | 1724 | ||
1725 | case Key_Prior: | 1725 | case Key_Prior: |
1726 | items=visibleHeight()/item->height(); | 1726 | items=visibleHeight()/item->height(); |
1727 | nextItem=item; | 1727 | nextItem=item; |
1728 | if (d->selectedBySimpleMove) | 1728 | if (d->selectedBySimpleMove) |
1729 | item->setSelected(false); | 1729 | item->setSelected(false); |
1730 | if (shiftOrCtrl) | 1730 | if (shiftOrCtrl) |
1731 | { | 1731 | { |
1732 | d->selectionDirection=-1; | 1732 | d->selectionDirection=-1; |
1733 | d->selectedBySimpleMove=false; | 1733 | d->selectedBySimpleMove=false; |
1734 | }; | 1734 | }; |
1735 | 1735 | ||
1736 | for (int i=0; i<items; i++) | 1736 | for (int i=0; i<items; i++) |
1737 | { | 1737 | { |
1738 | if ((nextItem!=item) &&(shiftOrCtrl)) | 1738 | if ((nextItem!=item) &&(shiftOrCtrl)) |
1739 | nextItem->setSelected(!nextItem->isSelected()); | 1739 | nextItem->setSelected(!nextItem->isSelected()); |
1740 | //the end | 1740 | //the end |
1741 | if ((i==items-1) || (nextItem->itemAbove()==0)) | 1741 | if ((i==items-1) || (nextItem->itemAbove()==0)) |
1742 | 1742 | ||
1743 | { | 1743 | { |
1744 | if (d->selectedBySimpleMove) | 1744 | if (d->selectedBySimpleMove) |
1745 | nextItem->setSelected(true); | 1745 | nextItem->setSelected(true); |
1746 | ensureItemVisible(nextItem); | 1746 | ensureItemVisible(nextItem); |
1747 | setCurrentItem(nextItem); | 1747 | setCurrentItem(nextItem); |
1748 | update(); | 1748 | update(); |
1749 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) | 1749 | if ((shiftOrCtrl) || (d->selectedBySimpleMove)) |
1750 | { | 1750 | { |
1751 | emit selectionChanged(); | 1751 | emit selectionChanged(); |
1752 | } | 1752 | } |
1753 | return; | 1753 | return; |
1754 | } | 1754 | } |
1755 | nextItem=nextItem->itemAbove(); | 1755 | nextItem=nextItem->itemAbove(); |
1756 | } | 1756 | } |
1757 | break; | 1757 | break; |
1758 | 1758 | ||
1759 | case Key_Minus: | 1759 | case Key_Minus: |
1760 | if ( item->isOpen() ) | 1760 | if ( item->isOpen() ) |
1761 | setOpen( item, FALSE ); | 1761 | setOpen( item, FALSE ); |
1762 | break; | 1762 | break; |
1763 | case Key_Plus: | 1763 | case Key_Plus: |
1764 | if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) | 1764 | if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) |
1765 | setOpen( item, TRUE ); | 1765 | setOpen( item, TRUE ); |
1766 | break; | 1766 | break; |
1767 | default: | 1767 | default: |
1768 | bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control) | 1768 | bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control) |
1769 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)); | 1769 | && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)); |
1770 | 1770 | ||
1771 | bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); | 1771 | bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); |
1772 | if (realKey && selectCurrentItem) | 1772 | if (realKey && selectCurrentItem) |
1773 | item->setSelected(false); | 1773 | item->setSelected(false); |
1774 | //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) | 1774 | //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) |
1775 | QListView::SelectionMode oldSelectionMode = selectionMode(); | 1775 | QListView::SelectionMode oldSelectionMode = selectionMode(); |
1776 | setSelectionMode (QListView::Multi); | 1776 | setSelectionMode (QListView::Multi); |
1777 | QListView::keyPressEvent (e); | 1777 | QListView::keyPressEvent (e); |
1778 | setSelectionMode (oldSelectionMode); | 1778 | setSelectionMode (oldSelectionMode); |
1779 | if (realKey && selectCurrentItem) | 1779 | if (realKey && selectCurrentItem) |
1780 | { | 1780 | { |
1781 | currentItem()->setSelected(true); | 1781 | currentItem()->setSelected(true); |
1782 | emitSelectionChanged=TRUE; | 1782 | emitSelectionChanged=TRUE; |
1783 | } | 1783 | } |
1784 | repaintItem2=currentItem(); | 1784 | repaintItem2=currentItem(); |
1785 | if (realKey) | 1785 | if (realKey) |
1786 | visItem=currentItem(); | 1786 | visItem=currentItem(); |
1787 | break; | 1787 | break; |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | if (visItem) | 1790 | if (visItem) |
1791 | ensureItemVisible(visItem); | 1791 | ensureItemVisible(visItem); |
1792 | 1792 | ||
1793 | QRect ir; | 1793 | QRect ir; |
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 contextMenu (this, i, p); | 1893 | emit contextRequest( i, p, col ); |
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 | { |
1989 | d->alternateBackground = c; | 1990 | d->alternateBackground = c; |
1990 | repaint(); | 1991 | repaint(); |
1991 | } | 1992 | } |
1992 | 1993 | ||
1993 | void KListView::saveLayout(KConfig *config, const QString &group) const | 1994 | void KListView::saveLayout(KConfig *config, const QString &group) const |
1994 | { | 1995 | { |
1995 | KConfigGroupSaver saver(config, group); | 1996 | KConfigGroupSaver saver(config, group); |
1996 | QStringList widths, order; | 1997 | QStringList widths, order; |
1997 | for (int i = 0; i < columns(); ++i) | 1998 | for (int i = 0; i < columns(); ++i) |
1998 | { | 1999 | { |
1999 | widths << QString::number(columnWidth(i)); | 2000 | widths << QString::number(columnWidth(i)); |
2000 | order << QString::number(header()->mapToIndex(i)); | 2001 | order << QString::number(header()->mapToIndex(i)); |
2001 | } | 2002 | } |
2002 | config->writeEntry("ColumnWidths", widths); | 2003 | config->writeEntry("ColumnWidths", widths); |
2003 | config->writeEntry("ColumnOrder", order); | 2004 | config->writeEntry("ColumnOrder", order); |
2004 | config->writeEntry("SortColumn", d->sortColumn); | 2005 | config->writeEntry("SortColumn", d->sortColumn); |
2005 | config->writeEntry("SortAscending", d->sortAscending); | 2006 | config->writeEntry("SortAscending", d->sortAscending); |
2006 | } | 2007 | } |
2007 | 2008 | ||
2008 | void KListView::restoreLayout(KConfig *config, const QString &group) | 2009 | void KListView::restoreLayout(KConfig *config, const QString &group) |
2009 | { | 2010 | { |
2010 | KConfigGroupSaver saver(config, group); | 2011 | KConfigGroupSaver saver(config, group); |
2011 | QStringList cols = config->readListEntry("ColumnWidths"); | 2012 | QStringList cols = config->readListEntry("ColumnWidths"); |
2012 | int i = 0; | 2013 | int i = 0; |
2013 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) | 2014 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) |
2014 | setColumnWidth(i++, (*it).toInt()); | 2015 | setColumnWidth(i++, (*it).toInt()); |
2015 | 2016 | ||
2016 | cols = config->readListEntry("ColumnOrder"); | 2017 | cols = config->readListEntry("ColumnOrder"); |
2017 | i = 0; | 2018 | i = 0; |
2018 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) | 2019 | for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) |
2019 | header()->moveSection(i++, (*it).toInt()); | 2020 | header()->moveSection(i++, (*it).toInt()); |
2020 | 2021 | ||
2021 | /*US I changed the following code, because hasKey is not available. | 2022 | /*US I changed the following code, because hasKey is not available. |
2022 | !!! check if my version is correct | 2023 | !!! check if my version is correct |
2023 | if (config->hasKey("SortColumn")) | 2024 | if (config->hasKey("SortColumn")) |
2024 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); | 2025 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); |
2025 | */ | 2026 | */ |
2026 | QStringList langLst = config->readListEntry( "SortColumn" ); | 2027 | QStringList langLst = config->readListEntry( "SortColumn" ); |
2027 | if (!langLst.isEmpty()) | 2028 | if (!langLst.isEmpty()) |
2028 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); | 2029 | setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); |
2029 | } | 2030 | } |
2030 | 2031 | ||
2031 | void KListView::setSorting(int column, bool ascending) | 2032 | void KListView::setSorting(int column, bool ascending) |
2032 | { | 2033 | { |
2033 | d->sortColumn = column; | 2034 | d->sortColumn = column; |
2034 | d->sortAscending = ascending; | 2035 | d->sortAscending = ascending; |
2035 | QListView::setSorting(column, ascending); | 2036 | QListView::setSorting(column, ascending); |
2036 | } | 2037 | } |
2037 | 2038 | ||
2038 | int KListView::columnSorted(void) const | 2039 | int KListView::columnSorted(void) const |
2039 | { | 2040 | { |
2040 | return d->sortColumn; | 2041 | return d->sortColumn; |
2041 | } | 2042 | } |
2042 | 2043 | ||
2043 | bool KListView::ascendingSort(void) const | 2044 | bool KListView::ascendingSort(void) const |
2044 | { | 2045 | { |
2045 | return d->sortAscending; | 2046 | return d->sortAscending; |
2046 | } | 2047 | } |
2047 | 2048 | ||
2048 | KListViewItem::KListViewItem(QListView *parent) | 2049 | KListViewItem::KListViewItem(QListView *parent) |
2049 | : QListViewItem(parent) | 2050 | : QListViewItem(parent) |
2050 | { | 2051 | { |
2051 | init(); | 2052 | init(); |
2052 | } | 2053 | } |
2053 | 2054 | ||
2054 | KListViewItem::KListViewItem(QListViewItem *parent) | 2055 | KListViewItem::KListViewItem(QListViewItem *parent) |
2055 | : QListViewItem(parent) | 2056 | : QListViewItem(parent) |
2056 | { | 2057 | { |
2057 | init(); | 2058 | init(); |
2058 | } | 2059 | } |
2059 | 2060 | ||
2060 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after) | 2061 | KListViewItem::KListViewItem(QListView *parent, QListViewItem *after) |
2061 | : QListViewItem(parent, after) | 2062 | : QListViewItem(parent, after) |
2062 | { | 2063 | { |
2063 | init(); | 2064 | init(); |
2064 | } | 2065 | } |
2065 | 2066 | ||
2066 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after) | 2067 | KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after) |
2067 | : QListViewItem(parent, after) | 2068 | : QListViewItem(parent, after) |
2068 | { | 2069 | { |
2069 | init(); | 2070 | init(); |
2070 | } | 2071 | } |
2071 | 2072 | ||
2072 | KListViewItem::KListViewItem(QListView *parent, | 2073 | KListViewItem::KListViewItem(QListView *parent, |
2073 | QString label1, QString label2, QString label3, QString label4, | 2074 | QString label1, QString label2, QString label3, QString label4, |
2074 | QString label5, QString label6, QString label7, QString label8) | 2075 | QString label5, QString label6, QString label7, QString label8) |
2075 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) | 2076 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) |
2076 | { | 2077 | { |
2077 | init(); | 2078 | init(); |
2078 | } | 2079 | } |
2079 | 2080 | ||
2080 | KListViewItem::KListViewItem(QListViewItem *parent, | 2081 | KListViewItem::KListViewItem(QListViewItem *parent, |
2081 | QString label1, QString label2, QString label3, QString label4, | 2082 | QString label1, QString label2, QString label3, QString label4, |
2082 | QString label5, QString label6, QString label7, QString label8) | 2083 | QString label5, QString label6, QString label7, QString label8) |
2083 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) | 2084 | : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) |
2084 | { | 2085 | { |
2085 | init(); | 2086 | init(); |
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h index f7d9f85..8d933f6 100644 --- a/microkde/kdeui/klistview.h +++ b/microkde/kdeui/klistview.h | |||
@@ -224,384 +224,385 @@ public: | |||
224 | * @see #setRenameable() | 224 | * @see #setRenameable() |
225 | */ | 225 | */ |
226 | bool isRenameable (int column) const; | 226 | bool isRenameable (int column) const; |
227 | 227 | ||
228 | /** | 228 | /** |
229 | * @return true if drawing of the drop-visualizer has been enabled. True by default. | 229 | * @return true if drawing of the drop-visualizer has been enabled. True by default. |
230 | * | 230 | * |
231 | * @see #setDropVisualizer() | 231 | * @see #setDropVisualizer() |
232 | */ | 232 | */ |
233 | bool dropVisualizer() const; | 233 | bool dropVisualizer() const; |
234 | 234 | ||
235 | /** | 235 | /** |
236 | * @return the column for which tooltips are displayed (or -1 if none set). | 236 | * @return the column for which tooltips are displayed (or -1 if none set). |
237 | * | 237 | * |
238 | * @see #setTooltipColumn() | 238 | * @see #setTooltipColumn() |
239 | */ | 239 | */ |
240 | int tooltipColumn() const; | 240 | int tooltipColumn() const; |
241 | 241 | ||
242 | /** | 242 | /** |
243 | * For future expansions. | 243 | * For future expansions. |
244 | * | 244 | * |
245 | * Do not use. | 245 | * Do not use. |
246 | * @deprecated | 246 | * @deprecated |
247 | */ | 247 | */ |
248 | bool createChildren() const; | 248 | bool createChildren() const; |
249 | 249 | ||
250 | /** | 250 | /** |
251 | * @return true if drawing of the drop-highlighter has been enabled. False by default. | 251 | * @return true if drawing of the drop-highlighter has been enabled. False by default. |
252 | * | 252 | * |
253 | * @see #setDropHighlighter() | 253 | * @see #setDropHighlighter() |
254 | */ | 254 | */ |
255 | bool dropHighlighter() const; | 255 | bool dropHighlighter() const; |
256 | 256 | ||
257 | /** | 257 | /** |
258 | * The dropVisualizerWidth defaults to 4. | 258 | * The dropVisualizerWidth defaults to 4. |
259 | * | 259 | * |
260 | * @see #setDropVisualizerWidth() | 260 | * @see #setDropVisualizerWidth() |
261 | * @return the current width of the drop-visualizer. | 261 | * @return the current width of the drop-visualizer. |
262 | */ | 262 | */ |
263 | int dropVisualizerWidth () const; | 263 | int dropVisualizerWidth () const; |
264 | 264 | ||
265 | /** | 265 | /** |
266 | * @return the "extended" selection mode of this listview. | 266 | * @return the "extended" selection mode of this listview. |
267 | * | 267 | * |
268 | * @see SelectionModeExt | 268 | * @see SelectionModeExt |
269 | * @see setSelectionModeExt | 269 | * @see setSelectionModeExt |
270 | */ | 270 | */ |
271 | SelectionModeExt selectionModeExt () const; | 271 | SelectionModeExt selectionModeExt () const; |
272 | 272 | ||
273 | /** | 273 | /** |
274 | * Returns the index of @p item within the item tree or -1 if | 274 | * Returns the index of @p item within the item tree or -1 if |
275 | * @p item doesn't exist in this list view. This function takes | 275 | * @p item doesn't exist in this list view. This function takes |
276 | * all items into account not only the visible ones. | 276 | * all items into account not only the visible ones. |
277 | */ | 277 | */ |
278 | int itemIndex( const QListViewItem *item ) const; | 278 | int itemIndex( const QListViewItem *item ) const; |
279 | 279 | ||
280 | /** | 280 | /** |
281 | * Returns the item of @p index within the item tree or 0 if | 281 | * Returns the item of @p index within the item tree or 0 if |
282 | * @p index doesn't exist in this list view. This function takes | 282 | * @p index doesn't exist in this list view. This function takes |
283 | * all items into account not only the visible ones. | 283 | * all items into account not only the visible ones. |
284 | */ | 284 | */ |
285 | QListViewItem* itemAtIndex(int index); | 285 | QListViewItem* itemAtIndex(int index); |
286 | 286 | ||
287 | /** | 287 | /** |
288 | * @deprecated | 288 | * @deprecated |
289 | * @see #setFullWidth() | 289 | * @see #setFullWidth() |
290 | */ | 290 | */ |
291 | void setFullWidth(); | 291 | void setFullWidth(); |
292 | 292 | ||
293 | /** | 293 | /** |
294 | * Let the last column fit exactly all the available width. | 294 | * Let the last column fit exactly all the available width. |
295 | * | 295 | * |
296 | * @see #fullWidth() | 296 | * @see #fullWidth() |
297 | */ | 297 | */ |
298 | void setFullWidth(bool fullWidth); | 298 | void setFullWidth(bool fullWidth); |
299 | 299 | ||
300 | /** | 300 | /** |
301 | * Returns whether the last column is set to fit the available width. | 301 | * Returns whether the last column is set to fit the available width. |
302 | * | 302 | * |
303 | * @see #setFullWidth() | 303 | * @see #setFullWidth() |
304 | */ | 304 | */ |
305 | bool fullWidth() const; | 305 | bool fullWidth() const; |
306 | 306 | ||
307 | /** | 307 | /** |
308 | * Reimplemented for full width support | 308 | * Reimplemented for full width support |
309 | * | 309 | * |
310 | * @see #removeColumn() | 310 | * @see #removeColumn() |
311 | */ | 311 | */ |
312 | virtual int addColumn(const QString& label, int width = -1); | 312 | virtual int addColumn(const QString& label, int width = -1); |
313 | /** | 313 | /** |
314 | * Reimplemented for full width support | 314 | * Reimplemented for full width support |
315 | */ | 315 | */ |
316 | virtual int addColumn(const QIconSet& iconset, const QString& label, int width = -1); | 316 | virtual int addColumn(const QIconSet& iconset, const QString& label, int width = -1); |
317 | /** | 317 | /** |
318 | * Reimplemented for full width support | 318 | * Reimplemented for full width support |
319 | * | 319 | * |
320 | * @see #addColumn() | 320 | * @see #addColumn() |
321 | */ | 321 | */ |
322 | virtual void removeColumn(int index); | 322 | virtual void removeColumn(int index); |
323 | 323 | ||
324 | /** | 324 | /** |
325 | * sets the alternate background background color. | 325 | * sets the alternate background background color. |
326 | * This only has an effect if the items are KListViewItems | 326 | * This only has an effect if the items are KListViewItems |
327 | * | 327 | * |
328 | * @param c the color to use for every other item. Set to an invalid | 328 | * @param c the color to use for every other item. Set to an invalid |
329 | * colour to disable alternate colours. | 329 | * colour to disable alternate colours. |
330 | * | 330 | * |
331 | * @see #alternateBackground() | 331 | * @see #alternateBackground() |
332 | **/ | 332 | **/ |
333 | void setAlternateBackground(const QColor &c); | 333 | void setAlternateBackground(const QColor &c); |
334 | /** | 334 | /** |
335 | * @return the alternate background color | 335 | * @return the alternate background color |
336 | * | 336 | * |
337 | * @see #setAlternateBackground() | 337 | * @see #setAlternateBackground() |
338 | */ | 338 | */ |
339 | const QColor &alternateBackground() const; | 339 | const QColor &alternateBackground() const; |
340 | 340 | ||
341 | /** | 341 | /** |
342 | * Saves the list view's layout (column widtsh, column order, sort column) | 342 | * Saves the list view's layout (column widtsh, column order, sort column) |
343 | * to a KConfig group | 343 | * to a KConfig group |
344 | * | 344 | * |
345 | * @param config the @ref KConfig object to write to | 345 | * @param config the @ref KConfig object to write to |
346 | * @param group the config group to use | 346 | * @param group the config group to use |
347 | */ | 347 | */ |
348 | void saveLayout(KConfig *config, const QString &group) const; | 348 | void saveLayout(KConfig *config, const QString &group) const; |
349 | /** | 349 | /** |
350 | * Reads the list view's layout from a KConfig group as stored with | 350 | * Reads the list view's layout from a KConfig group as stored with |
351 | * @ref #saveLayout | 351 | * @ref #saveLayout |
352 | * | 352 | * |
353 | * @param config the @ref KConfig object to read from | 353 | * @param config the @ref KConfig object to read from |
354 | * @param group the config group to use | 354 | * @param group the config group to use |
355 | */ | 355 | */ |
356 | void restoreLayout(KConfig *config, const QString &group); | 356 | void restoreLayout(KConfig *config, const QString &group); |
357 | /** | 357 | /** |
358 | * Reimplemented to remember the current sort column and order. | 358 | * Reimplemented to remember the current sort column and order. |
359 | * @param column is the column to be sorted, or -1 to sort in order of | 359 | * @param column is the column to be sorted, or -1 to sort in order of |
360 | * insertion | 360 | * insertion |
361 | * @param whether to sort ascending (or descending) | 361 | * @param whether to sort ascending (or descending) |
362 | */ | 362 | */ |
363 | virtual void setSorting(int column, bool ascending = true); | 363 | virtual void setSorting(int column, bool ascending = true); |
364 | 364 | ||
365 | /** | 365 | /** |
366 | * @return the currently sorted column, or -1 if none is sorted | 366 | * @return the currently sorted column, or -1 if none is sorted |
367 | */ | 367 | */ |
368 | int columnSorted(void) const; | 368 | int columnSorted(void) const; |
369 | 369 | ||
370 | /** | 370 | /** |
371 | * @return whether the current sort is ascending (or descending) | 371 | * @return whether the current sort is ascending (or descending) |
372 | */ | 372 | */ |
373 | bool ascendingSort(void) const; | 373 | bool ascendingSort(void) const; |
374 | 374 | ||
375 | signals: | 375 | signals: |
376 | 376 | ||
377 | /** | 377 | /** |
378 | * This signal is emitted whenever the user executes an listview item. | 378 | * This signal is emitted whenever the user executes an listview item. |
379 | * That means depending on the KDE wide Single Click/Double Click | 379 | * That means depending on the KDE wide Single Click/Double Click |
380 | * setting the user clicked or double clicked on that item. | 380 | * setting the user clicked or double clicked on that item. |
381 | * @param item is the pointer to the executed listview item. | 381 | * @param item is the pointer to the executed listview item. |
382 | * | 382 | * |
383 | * Note that you may not delete any @ref QListViewItem objects in slots | 383 | * Note that you may not delete any @ref QListViewItem objects in slots |
384 | * connected to this signal. | 384 | * connected to this signal. |
385 | */ | 385 | */ |
386 | void executed( QListViewItem *item ); | 386 | void executed( QListViewItem *item ); |
387 | 387 | ||
388 | /** | 388 | /** |
389 | * This signal is emitted whenever the user executes an listview item. | 389 | * This signal is emitted whenever the user executes an listview item. |
390 | * That means depending on the KDE wide Single Click/Double Click | 390 | * That means depending on the KDE wide Single Click/Double Click |
391 | * setting the user clicked or double clicked on that item. | 391 | * setting the user clicked or double clicked on that item. |
392 | * @param item is the pointer to the executed listview item. | 392 | * @param item is the pointer to the executed listview item. |
393 | * @param pos is the position where the user has clicked | 393 | * @param pos is the position where the user has clicked |
394 | * @param c is the column into which the user clicked. | 394 | * @param c is the column into which the user clicked. |
395 | * | 395 | * |
396 | * Note that you may not delete any @ref QListViewItem objects in slots | 396 | * Note that you may not delete any @ref QListViewItem objects in slots |
397 | * connected to this signal. | 397 | * connected to this signal. |
398 | */ | 398 | */ |
399 | void executed( QListViewItem *item, const QPoint &pos, int c ); | 399 | void executed( QListViewItem *item, const QPoint &pos, int c ); |
400 | 400 | ||
401 | /** | 401 | /** |
402 | * This signal gets emitted whenever the user double clicks into the | 402 | * This signal gets emitted whenever the user double clicks into the |
403 | * listview. | 403 | * listview. |
404 | * @param item is the pointer to the clicked listview item. | 404 | * @param item is the pointer to the clicked listview item. |
405 | * @param pos is the position where the user has clicked, and | 405 | * @param pos is the position where the user has clicked, and |
406 | * @param c is the column into which the user clicked. | 406 | * @param c is the column into which the user clicked. |
407 | * | 407 | * |
408 | * Note that you may not delete any @ref QListViewItem objects in slots | 408 | * Note that you may not delete any @ref QListViewItem objects in slots |
409 | * connected to this signal. | 409 | * connected to this signal. |
410 | * | 410 | * |
411 | * This signal is more or less here for the sake of completeness. | 411 | * This signal is more or less here for the sake of completeness. |
412 | * You should normally not need to use this. In most cases its better | 412 | * You should normally not need to use this. In most cases its better |
413 | * to use @ref #executed() instead. | 413 | * to use @ref #executed() instead. |
414 | */ | 414 | */ |
415 | void doubleClicked( QListViewItem *item, const QPoint &pos, int c ); | 415 | void doubleClicked( QListViewItem *item, const QPoint &pos, int c ); |
416 | void contextRequest( QListViewItem *item, const QPoint &pos, int c ); | ||
416 | 417 | ||
417 | /** | 418 | /** |
418 | * This signal gets emitted whenever something acceptable is | 419 | * This signal gets emitted whenever something acceptable is |
419 | * dropped onto the listview. | 420 | * dropped onto the listview. |
420 | * | 421 | * |
421 | * @param e is the drop event itself (it has already been accepted) | 422 | * @param e is the drop event itself (it has already been accepted) |
422 | * @param after is the item after which the drop occured (or 0L, if | 423 | * @param after is the item after which the drop occured (or 0L, if |
423 | * the drop was above all items) | 424 | * the drop was above all items) |
424 | * | 425 | * |
425 | * @see #acceptDrop() | 426 | * @see #acceptDrop() |
426 | */ | 427 | */ |
427 | void dropped (QDropEvent * e, QListViewItem *after); | 428 | void dropped (QDropEvent * e, QListViewItem *after); |
428 | 429 | ||
429 | /** | 430 | /** |
430 | * This signal gets emitted whenever something acceptable is | 431 | * This signal gets emitted whenever something acceptable is |
431 | * dropped onto the listview. | 432 | * dropped onto the listview. |
432 | * | 433 | * |
433 | * This is an overloaded version of the above (provided to simplify | 434 | * This is an overloaded version of the above (provided to simplify |
434 | * processing drops outside of the class). | 435 | * processing drops outside of the class). |
435 | * | 436 | * |
436 | * @param list is the listview | 437 | * @param list is the listview |
437 | * @param e is the drop event itself (it has already been accepted) | 438 | * @param e is the drop event itself (it has already been accepted) |
438 | * @param after is the item after which the drop occured (or 0L, if | 439 | * @param after is the item after which the drop occured (or 0L, if |
439 | * the drop was above all items | 440 | * the drop was above all items |
440 | */ | 441 | */ |
441 | void dropped (KListView* list, QDropEvent* e, QListViewItem* after); | 442 | void dropped (KListView* list, QDropEvent* e, QListViewItem* after); |
442 | 443 | ||
443 | /** | 444 | /** |
444 | * This signal gets emitted whenever something acceptable is | 445 | * This signal gets emitted whenever something acceptable is |
445 | * dropped onto the listview. | 446 | * dropped onto the listview. |
446 | * | 447 | * |
447 | * This function also provides a parent, in the event that your listview | 448 | * This function also provides a parent, in the event that your listview |
448 | * is a tree | 449 | * is a tree |
449 | * @param list is the listview | 450 | * @param list is the listview |
450 | * @param e is the drop event itself (it has already been accepted) | 451 | * @param e is the drop event itself (it has already been accepted) |
451 | * @param parent the item that is to be the parent of the new item | 452 | * @param parent the item that is to be the parent of the new item |
452 | * @param after is the item after which the drop occured (or 0L, if | 453 | * @param after is the item after which the drop occured (or 0L, if |
453 | * the drop was above all items | 454 | * the drop was above all items |
454 | */ | 455 | */ |
455 | void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after); | 456 | void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after); |
456 | 457 | ||
457 | /** | 458 | /** |
458 | * This signal gets emitted whenever something acceptable is | 459 | * This signal gets emitted whenever something acceptable is |
459 | * dropped onto the listview. | 460 | * dropped onto the listview. |
460 | * | 461 | * |
461 | * This function also provides a parent, in the event that your listview | 462 | * This function also provides a parent, in the event that your listview |
462 | * is a tree | 463 | * is a tree |
463 | * @param e is the drop event itself (it has already been accepted) | 464 | * @param e is the drop event itself (it has already been accepted) |
464 | * @param parent the item that is to be the parent of the new item | 465 | * @param parent the item that is to be the parent of the new item |
465 | * @param after is the item after which the drop occured (or 0L, if | 466 | * @param after is the item after which the drop occured (or 0L, if |
466 | * the drop was above all items | 467 | * the drop was above all items |
467 | */ | 468 | */ |
468 | void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after); | 469 | void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after); |
469 | 470 | ||
470 | /** | 471 | /** |
471 | * This signal is emitted when ever the user moves an item in the list via | 472 | * This signal is emitted when ever the user moves an item in the list via |
472 | * DnD. | 473 | * DnD. |
473 | * If more than one item is moved at the same time, this signal is only emitted | 474 | * If more than one item is moved at the same time, this signal is only emitted |
474 | * once. | 475 | * once. |
475 | */ | 476 | */ |
476 | void moved(); | 477 | void moved(); |
477 | 478 | ||
478 | /** | 479 | /** |
479 | * Connect to this signal if you want to do some preprocessing before | 480 | * Connect to this signal if you want to do some preprocessing before |
480 | * a move is made, for example, to disable sorting | 481 | * a move is made, for example, to disable sorting |
481 | * | 482 | * |
482 | * This is sent only once per each groups of moves. That is, for each | 483 | * This is sent only once per each groups of moves. That is, for each |
483 | * drop that is a move this will be emitted once, before KListView calls | 484 | * drop that is a move this will be emitted once, before KListView calls |
484 | * @see moveItem() | 485 | * @see moveItem() |
485 | */ | 486 | */ |
486 | void aboutToMove(); | 487 | void aboutToMove(); |
487 | 488 | ||
488 | /** | 489 | /** |
489 | * This signal is emitted when ever the user moves an item in the list via | 490 | * This signal is emitted when ever the user moves an item in the list via |
490 | * DnD. | 491 | * DnD. |
491 | * If more than one item is moved at the same time, @p afterFirst and | 492 | * If more than one item is moved at the same time, @p afterFirst and |
492 | * @p afterNow will reflect what was true before the move. | 493 | * @p afterNow will reflect what was true before the move. |
493 | * This differs from @ref moved(), so be careful. All the items will have been | 494 | * This differs from @ref moved(), so be careful. All the items will have been |
494 | * moved before @ref moved() is emitted, which is not true in this method. // FIXME | 495 | * moved before @ref moved() is emitted, which is not true in this method. // FIXME |
495 | * @param item the item that was moved | 496 | * @param item the item that was moved |
496 | * @param afterFirst the item that parameter item was in before the move, in the list | 497 | * @param afterFirst the item that parameter item was in before the move, in the list |
497 | * @param afterNow the item it's currently after. | 498 | * @param afterNow the item it's currently after. |
498 | */ | 499 | */ |
499 | void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow); | 500 | void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow); |
500 | 501 | ||
501 | 502 | ||
502 | /** | 503 | /** |
503 | * This signal is emitted after all the items have been moved. It reports info for | 504 | * This signal is emitted after all the items have been moved. It reports info for |
504 | * each and every item moved, in order. The first element in @p items associates | 505 | * each and every item moved, in order. The first element in @p items associates |
505 | * with the first of afterFirst and afterNow. | 506 | * with the first of afterFirst and afterNow. |
506 | */ | 507 | */ |
507 | void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow); | 508 | void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow); |
508 | 509 | ||
509 | /** | 510 | /** |
510 | * This signal gets emitted when an item is renamed via in-place renaming. | 511 | * This signal gets emitted when an item is renamed via in-place renaming. |
511 | * | 512 | * |
512 | * @param item is the renamed item. | 513 | * @param item is the renamed item. |
513 | * @param str is the new value of column @p col. | 514 | * @param str is the new value of column @p col. |
514 | * @param col is the renamed column. | 515 | * @param col is the renamed column. |
515 | */ | 516 | */ |
516 | void itemRenamed(QListViewItem* item, const QString &str, int col); | 517 | void itemRenamed(QListViewItem* item, const QString &str, int col); |
517 | 518 | ||
518 | /** | 519 | /** |
519 | * Same as above, but without the extra information. | 520 | * Same as above, but without the extra information. |
520 | */ | 521 | */ |
521 | void itemRenamed(QListViewItem* item); | 522 | void itemRenamed(QListViewItem* item); |
522 | void signalDelete(); | 523 | void signalDelete(); |
523 | 524 | ||
524 | /** | 525 | /** |
525 | * This signal is emitted when the shortcut key for popup-menus is pressed. | 526 | * This signal is emitted when the shortcut key for popup-menus is pressed. |
526 | * | 527 | * |
527 | * Normally you should not use this, just connect a slot to signal | 528 | * Normally you should not use this, just connect a slot to signal |
528 | * @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly | 529 | * @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly |
529 | * handle showing context menus regardless of settings. | 530 | * handle showing context menus regardless of settings. |
530 | * | 531 | * |
531 | * @param list is this listview. | 532 | * @param list is this listview. |
532 | * @param item is the @ref currentItem() at the time the key was pressed. May be 0L. | 533 | * @param item is the @ref currentItem() at the time the key was pressed. May be 0L. |
533 | */ | 534 | */ |
534 | void menuShortCutPressed (KListView* list, QListViewItem* item); | 535 | void menuShortCutPressed (KListView* list, QListViewItem* item); |
535 | 536 | ||
536 | /** | 537 | /** |
537 | * This signal is emitted whenever a context-menu should be shown for item @p i. | 538 | * This signal is emitted whenever a context-menu should be shown for item @p i. |
538 | * It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click). | 539 | * It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click). |
539 | * | 540 | * |
540 | * @param l is this listview. | 541 | * @param l is this listview. |
541 | * @param i is the item for which the menu should be shown. May be 0L. | 542 | * @param i is the item for which the menu should be shown. May be 0L. |
542 | * @param p is the point at which the menu should be shown. | 543 | * @param p is the point at which the menu should be shown. |
543 | */ | 544 | */ |
544 | void contextMenu (KListView* l, QListViewItem* i, const QPoint& p); | 545 | void contextMenu (KListView* l, QListViewItem* i, const QPoint& p); |
545 | 546 | ||
546 | public slots: | 547 | public slots: |
547 | /** | 548 | /** |
548 | * Rename column @p c of @p item. | 549 | * Rename column @p c of @p item. |
549 | */ | 550 | */ |
550 | virtual void rename(QListViewItem *item, int c); | 551 | virtual void rename(QListViewItem *item, int c); |
551 | 552 | ||
552 | /** | 553 | /** |
553 | * By default, if you called setItemsRenameable(true), | 554 | * By default, if you called setItemsRenameable(true), |
554 | * only the first column is renameable. | 555 | * only the first column is renameable. |
555 | * Use this function to enable the feature on other columns. | 556 | * Use this function to enable the feature on other columns. |
556 | * | 557 | * |
557 | * If you want more intelligent (dynamic) selection, | 558 | * If you want more intelligent (dynamic) selection, |
558 | * you'll have to derive from KListView, | 559 | * you'll have to derive from KListView, |
559 | * and override @ref rename() and call only call it | 560 | * and override @ref rename() and call only call it |
560 | * if you want the item to be renamed. | 561 | * if you want the item to be renamed. |
561 | */ | 562 | */ |
562 | void setRenameable (int column, bool yesno=true); | 563 | void setRenameable (int column, bool yesno=true); |
563 | 564 | ||
564 | /** | 565 | /** |
565 | * Set whether items in the list view can be moved. | 566 | * Set whether items in the list view can be moved. |
566 | * It is enabled by default. | 567 | * It is enabled by default. |
567 | * | 568 | * |
568 | * @see itemsMovable() | 569 | * @see itemsMovable() |
569 | */ | 570 | */ |
570 | virtual void setItemsMovable(bool b); | 571 | virtual void setItemsMovable(bool b); |
571 | 572 | ||
572 | /** | 573 | /** |
573 | * Enables inplace-renaming of items. | 574 | * Enables inplace-renaming of items. |
574 | * It is disabled by default. | 575 | * It is disabled by default. |
575 | * | 576 | * |
576 | * @see itemsRenameable() | 577 | * @see itemsRenameable() |
577 | * @see setRenameable() | 578 | * @see setRenameable() |
578 | */ | 579 | */ |
579 | virtual void setItemsRenameable(bool b); | 580 | virtual void setItemsRenameable(bool b); |
580 | 581 | ||
581 | /** | 582 | /** |
582 | * Enable/Disable the dragging of items. | 583 | * Enable/Disable the dragging of items. |
583 | * It is disabled by default. | 584 | * It is disabled by default. |
584 | */ | 585 | */ |
585 | virtual void setDragEnabled(bool b); | 586 | virtual void setDragEnabled(bool b); |
586 | 587 | ||
587 | /** | 588 | /** |
588 | * Enable/Disable AutoOpen (not implemented currently). | 589 | * Enable/Disable AutoOpen (not implemented currently). |
589 | */ | 590 | */ |
590 | virtual void setAutoOpen(bool b); | 591 | virtual void setAutoOpen(bool b); |
591 | 592 | ||
592 | /** | 593 | /** |
593 | * Enable/Disable the drawing of a drop-visualizer | 594 | * Enable/Disable the drawing of a drop-visualizer |
594 | * (a bar that shows where a dropped item would be inserted). | 595 | * (a bar that shows where a dropped item would be inserted). |
595 | * It is enabled by default, if dragging is enabled | 596 | * It is enabled by default, if dragging is enabled |
596 | */ | 597 | */ |
597 | virtual void setDropVisualizer(bool b); | 598 | virtual void setDropVisualizer(bool b); |
598 | 599 | ||
599 | /** | 600 | /** |
600 | * Set the width of the (default) drop-visualizer. | 601 | * Set the width of the (default) drop-visualizer. |
601 | * If you don't call this method, the width is set to 4. | 602 | * If you don't call this method, the width is set to 4. |
602 | */ | 603 | */ |
603 | void setDropVisualizerWidth (int w); | 604 | void setDropVisualizerWidth (int w); |
604 | 605 | ||
605 | /** | 606 | /** |
606 | * Set which column should be used for automatic tooltips. | 607 | * Set which column should be used for automatic tooltips. |
607 | * | 608 | * |