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

List:       kde-commits
Subject:    KDE_3_3_BRANCH: kdepim/kmail
From:       David Faure <faure () kde ! org>
Date:       2005-01-24 20:56:20
Message-ID: 20050124205620.5CAFA1D01E () office ! kde ! org
[Download RAW message or body]

CVS commit by faure: 

Backport Till's fix:
Fix at least one of the reasons for the infamous "suddenly the
headers list is empty", also known as the "QGArray::at: Absolute index 
n out of range" issue, by making sure that the quick search is only 
updated after a new list view item has been completed added, not right
after the KListViewItem ctor, where we don't have valid folder index
entries in the header list items yet, which the status quick search needs.


  M +10 -0     headerlistquicksearch.cpp   1.5.2.1
  M +2 -0      kmheaders.cpp   1.658.2.10
  M +11 -4     kmheaders.h   1.157.2.1


--- kdepim/kmail/headerlistquicksearch.cpp  #1.5:1.5.2.1
@@ -74,4 +74,14 @@ HeaderListQuickSearch::HeaderListQuickSe
 
   label->setBuddy( mStatusCombo );
+
+  /* Disable the signal connected by KListViewSearchLine since it will call 
+   * itemAdded during KMHeaders::readSortOrder() which will in turn result
+   * in getMsgBaseForItem( item ) wanting to access items which are no longer
+   * there. Rather rely on KMHeaders::msgAdded and its signal. */
+  disconnect(listView, SIGNAL(itemAdded(QListViewItem *)),
+             this, SLOT(itemAdded(QListViewItem *)));
+  KMHeaders *headers = static_cast<KMHeaders*>( listView );
+  connect( headers, SIGNAL( msgAddedToListView( QListViewItem * ) ),
+           this, SLOT( itemAdded( QListViewItem* ) ) );
 }
 

--- kdepim/kmail/kmheaders.cpp  #1.658.2.9:1.658.2.10
@@ -1252,4 +1252,6 @@ void KMHeaders::msgAdded(int id)
            this, SLOT(highlightMessage(QListViewItem*)));
 
+  emit msgAddedToListView( hi );
+
   END_TIMER(msgAdded);
   SHOW_TIMER(msgAdded);

--- kdepim/kmail/kmheaders.h  #1.157:1.157.2.1
@@ -170,12 +170,19 @@ signals:
   /** emitted when the list view item corresponding to this message
       has been selected */
-  virtual void selected(KMMessage *);
+  void selected(KMMessage *);
   /** emitted when the list view item corresponding to this message
       has been double clicked */
-  virtual void activated(KMMessage *);
+  void activated(KMMessage *);
   /** emitted when we might be about to delete messages */
-  virtual void maybeDeleting();
+  void maybeDeleting();
   /** emitted when the list of messages has been completely rebuilt */
-  virtual void messageListUpdated();
+  void messageListUpdated();
+
+  /** emitted after a new item has been fully built and added to the 
+   * list view. We can't use KListView::itemAdded, as that is emitted
+   * from the ctor of the item, at which point the building of the item
+   * is not yet far enough along to update the quick search, which is 
+   * what is connected to this signal. */
+  void msgAddedToListView( QListViewItem* );
 
 public slots:


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

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