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.

svn path=/branches/proko2/kdepim/; revision=382046
wilder-work
David Faure 21 years ago
parent 86d3343dfb
commit caacd1377f
  1. 10
      headerlistquicksearch.cpp
  2. 2
      kmheaders.cpp
  3. 15
      kmheaders.h

@ -73,6 +73,16 @@ HeaderListQuickSearch::HeaderListQuickSearch( QWidget *parent,
this, SLOT( slotStatusChanged( int ) ) );
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* ) ) );
}
HeaderListQuickSearch::~HeaderListQuickSearch()

@ -1251,7 +1251,7 @@ void KMHeaders::msgAdded(int id)
connect( this, SIGNAL(currentChanged(QListViewItem*)),
this, SLOT(highlightMessage(QListViewItem*)));
emit messageListUpdated();
emit msgAddedToListView( hi );
END_TIMER(msgAdded);
SHOW_TIMER(msgAdded);
}

@ -169,14 +169,21 @@ public:
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:
/** For when a list view item has been double clicked */

Loading…
Cancel
Save