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

List:       kde-bugs-dist
Subject:    [Bug 49292] make new messages visible when selected and new
From:       Thomas Zander <zander () kde ! org>
Date:       2005-06-15 23:21:52
Message-ID: 20050615232152.5881.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=49292         
zander kde org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From zander kde org  2005-06-16 01:21 -------
SVN commit 425948 by zander:

When new emails are added to the current folder re-init the view to
show any new email that would otherwise have appeared outside of the
widget.

BUG: 49292


 M  +31 -28    kmheaders.cpp  
 M  +1 -4      kmheaders.h  
 M  +0 -5      kmmainwidget.cpp  


--- trunk/KDE/kdepim/kmail/kmheaders.cpp #425947:425948
 @ -778,7 +778,7  @
   QValueList<int> curItems = selectedItems();
   updateMessageList(); // do not change the selection
   // restore the old state
-  setTopItemByIndex( i );
+  setTopItemByIndex( i, true);
   setCurrentMsg( cur );
   setSelectedByIndex( curItems, true );
   connect(this,SIGNAL(currentChanged(QListViewItem*)),
 @ -2352,37 +2352,40  @
 //-----------------------------------------------------------------------------
 int KMHeaders::topItemIndex()
 {
-  HeaderItem *item = static_cast<HeaderItem*>(itemAt(QPoint(1,1)));
-  if (item)
-    return item->msgId();
-  else
-    return -1;
+  int i=0;
+  HeaderItem *topItem = static_cast<HeaderItem*>(itemAt(QPoint(1,1)));
+  QListViewItem *item =  firstChild();
+  while(item && item != topItem) {
+    item = item->itemBelow();
+    i++;
+  }
+  if(item)
+    return i;
+  return -1;
 }
 
-// If sorting ascending by date/ooa then try to scroll list when new mail
-// arrives to show it, but don't scroll current item out of view.
-void KMHeaders::showNewMail()
-{
-  if (mSortCol != mPaintInfo.dateCol)
-    return;
- for( int i = 0; i < (int)mItems.size(); ++i)
-   if (mFolder->getMsgBase(i)->isNew()) {
-     if (!mSortDescending)
-       setTopItemByIndex( currentItemIndex() );
-     break;
-   }
-}
-
 //-----------------------------------------------------------------------------
-void KMHeaders::setTopItemByIndex( int aMsgIdx)
+void KMHeaders::setTopItemByIndex( int aMsgIdx, bool fuzzy)
 {
-  int msgIdx = aMsgIdx;
-  if (msgIdx < 0)
-    msgIdx = 0;
-  else if (msgIdx >= (int)mItems.size())
-    msgIdx = mItems.size() - 1;
-  if ((msgIdx >= 0) && (msgIdx < (int)mItems.size()))
-    setContentsPos( 0, itemPos( mItems[msgIdx] ));
+  int y = 0;
+  QListViewItem *item =  firstChild();
+  while(item) {
+    if(aMsgIdx-- <= 0)
+        break;
+    y += item->totalHeight();
+    item = item->itemBelow();
+  }
+  if(fuzzy) {
+    item = item->itemAbove();
+    while(item) {
+        int mesgId = static_cast<HeaderItem*>(item)->msgId();
+        if( !mFolder->getMsgBase(mesgId)->isUnread() )
+          break;
+        y -= item->totalHeight();
+        item = item->itemAbove();
+    }
+  }
+  setContentsPos( 0, y );
 }
 
 //-----------------------------------------------------------------------------
--- trunk/KDE/kdepim/kmail/kmheaders.h #425947:425948
 @ -125,9 +125,6  @
   /** Read color options and set palette. */
   virtual void readColorConfig(void);
 
-  /** Scroll to show new mail */
-  void showNewMail();
-
   /** Return the current message */
   virtual KMMessage* currentMsg();
   /** Return the current list view item */
 @ -142,7 +139,7  @
   virtual int topItemIndex();
   /** Make the item corresponding to the message with the given id the
       top most visible item. */
-  virtual void setTopItemByIndex( int aMsgIdx );
+  virtual void setTopItemByIndex( int aMsgIdx, bool fuzzy=false);
   virtual void setNestedOverride( bool override );
   virtual void setSubjectThreading( bool subjThreading );
   /** Double force items to always be open */
--- trunk/KDE/kdepim/kmail/kmmainwidget.cpp #425947:425948
 @ -847,11 +847,6  @
   if (mBeepOnNew) {
     KNotifyClient::beep();
   }
-
-  // Todo:
-  // scroll mHeaders to show new items if current item would
-  // still be visible
-  //  mHeaders->showNewMail();
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

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