[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/konqueror/listview
From:       Michael Brade <brade () kde ! org>
Date:       2005-02-01 21:08:27
Message-ID: 20050201210827.34E7B1BB53 () office ! kde ! org
[Download RAW message or body]

CVS commit by brade: 

Ahh, what a relief! Don't show the tooltips all the time the mouse is in
the listview but only when actually hovering a filename.

Simplified the code a litte and removed the sort of ugly slot2On* methods.

Also fixed the active item and the statusbar text when leaving the window,
these weren't reset ever before.


  M +22 -30    konq_listviewwidget.cc   1.265
  M +1 -3      konq_listviewwidget.h   1.98


--- kdebase/konqueror/listview/konq_listviewwidget.cc  #1.264:1.265
@@ -137,7 +137,4 @@ KonqBaseListViewWidget::KonqBaseListView
    connect( this, SIGNAL(selectionChanged()), this, SLOT(slotSelectionChanged()) );
 
-   connect( this, SIGNAL(onItem(QListViewItem *)), SLOT(slot2OnItem(QListViewItem *)) );
-   connect( this, SIGNAL(onViewport()), SLOT(slot2OnViewport()) );
-
    connect( horizontalScrollBar(), SIGNAL(valueChanged( int )),
             this, SIGNAL(viewportAdjusted()) );
@@ -496,4 +493,8 @@ void KonqBaseListViewWidget::contentsMou
          emit m_pBrowserView->setStatusBarText( item->item()->getStatusBarInfo() );
          m_pBrowserView->emitMouseOver( item->item() );
+         
+         vp.setY( itemRect( item ).y() );
+         QRect rect( viewportToContents( vp ), QSize(20, item->height()) );
+         m_fileTip->setItem( item->item(), rect, item->pixmap( 0 ) );
       }
       else
@@ -501,4 +502,6 @@ void KonqBaseListViewWidget::contentsMou
          reportItemCounts();
          m_pBrowserView->emitMouseOver( 0 );
+
+         m_fileTip->setItem( 0 );
       }
    }
@@ -514,4 +517,20 @@ void KonqBaseListViewWidget::contentsWhe
 }
 
+void KonqBaseListViewWidget::leaveEvent( QEvent *e )
+{
+   if ( m_activeItem != 0 )
+   {
+      m_activeItem->setActive( false );
+      m_activeItem = 0;
+   }
+
+   reportItemCounts();
+   m_pBrowserView->emitMouseOver( 0 );
+   
+   m_fileTip->setItem( 0 );
+
+   KListView::leaveEvent( e );
+}
+
 void KonqBaseListViewWidget::drawRubber()
 {
@@ -759,31 +778,4 @@ void KonqBaseListViewWidget::startDrag()
 }
 
-void KonqBaseListViewWidget::slot2OnItem( QListViewItem *_item )
-{
-   if ( m_rubber ) return;  // don't show tooltip during rubber banding
-
-   KFileItem *fileItem = static_cast<KonqBaseListViewItem *>(_item)->item();
-   QPoint viewPos = viewport()->mapFromGlobal( QCursor::pos() );
-   viewPos.setY( itemRect(_item).y() );
-
-   QRect rect( viewportToContents(viewPos), QSize(20, _item->height()) );
-
-   m_fileTip->setItem( fileItem,
-                       rect,
-                       _item->pixmap(0) );
-}
-
-void KonqBaseListViewWidget::slot2OnViewport()
-{
-   m_fileTip->setItem( 0 );
-}
-
-void KonqBaseListViewWidget::leaveEvent( QEvent *e )
-{
-   m_fileTip->setItem( 0 );
-
-   KListView::leaveEvent( e );
-}
-
 void KonqBaseListViewWidget::slotItemRenamed( QListViewItem *item, const QString &name, int col )
 {

--- kdebase/konqueror/listview/konq_listviewwidget.h  #1.97:1.98
@@ -161,6 +161,4 @@ protected slots:
    void slotAutoScroll();
 
-   virtual void slot2OnItem( QListViewItem *_item );
-   virtual void slot2OnViewport();
    // from QListView
    virtual void slotReturnPressed( QListViewItem *_item );
@@ -214,5 +212,5 @@ protected:
    virtual void contentsWheelEvent( QWheelEvent * e );
 
-   virtual void leaveEvent( QEvent * );
+   virtual void leaveEvent( QEvent *e );
 
    /** Common method for slotCompleted and slotCanceled */


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic