author | zautrix <zautrix> | 2004-10-16 13:36:11 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-16 13:36:11 (UTC) |
commit | c3325ebbb92a2814fcb622caaf71316cfa0c2908 (patch) (unidiff) | |
tree | b53545c39f84fc6ce694f371509b4a9fe2ddd743 /microkde | |
parent | 023b3c542a6dd4d1c4b53dba6bb2c68f605a7917 (diff) | |
download | kdepimpi-c3325ebbb92a2814fcb622caaf71316cfa0c2908.zip kdepimpi-c3325ebbb92a2814fcb622caaf71316cfa0c2908.tar.gz kdepimpi-c3325ebbb92a2814fcb622caaf71316cfa0c2908.tar.bz2 |
made todos reparentable
-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 | |||
@@ -1842,100 +1842,101 @@ KListView::SelectionModeExt KListView::selectionModeExt () const | |||
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 | { |
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 | |||
@@ -368,96 +368,97 @@ public: | |||
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) |