From kde-commits Thu Jul 01 13:27:09 2010 From: Stephan Binner Date: Thu, 01 Jul 2010 13:27:09 +0000 To: kde-commits Subject: [Konversation] 051b512: Return to previous update hack, Message-Id: <20100701132709.3FEFEBB551E () projects ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=127799903318754 commit 051b51291dfda179dd42813b94da4669768c65a3 Author: Stephan Binner Date: Fri Dec 5 20:13:35 2003 +0000 Return to previous update hack, start update timer if not already running when new channel data arrives, disable "Refresh List" and "Apply Filter" buttons during loading to prevent more than one run resulting in duplicates. svn path=/trunk/kdeextragear-2/konversation/; revision=271409 diff --git a/konversation/channellistpanel.cpp b/konversation/channellistpanel.cpp index 3e8d1d1..18ec957 100644 --- a/konversation/channellistpanel.cpp +++ b/konversation/channellistpanel.cpp @@ -82,7 +82,7 @@ ChannelListPanel::ChannelListPanel(QWidget* parent) : channelFilter=new QCheckBox(i18n("&Channel"),targetBox,"filter_target_channel_check"); topicFilter=new QCheckBox(i18n("&Topic"),targetBox,"filter_target_topic_check"); regexpCheck=new QCheckBox(i18n("&Regular expression"),targetBox,"regexp_check"); - QPushButton* applyFilter=new QPushButton(i18n("Appl&y Filter"),targetBox,"apply_filter_button"); + applyFilter=new QPushButton(i18n("Appl&y Filter"),targetBox,"apply_filter_button"); channelFilter->setChecked(getChannelTarget()); topicFilter->setChecked(getTopicTarget()); @@ -107,7 +107,7 @@ ChannelListPanel::ChannelListPanel(QWidget* parent) : QHBox* actionBox=new QHBox(this); actionBox->setSpacing(spacing()); - QPushButton* refreshListButton=new QPushButton(i18n("Re&fresh List"),actionBox,"refresh_list_button"); + refreshListButton=new QPushButton(i18n("Re&fresh List"),actionBox,"refresh_list_button"); QPushButton* saveListButton=new QPushButton(i18n("&Save List..."),actionBox,"save_list_button"); QPushButton* joinChannelButton=new QPushButton(i18n("&Join Channel"),actionBox,"join_channel_button"); @@ -164,8 +164,8 @@ void ChannelListPanel::refreshList() updateUsersChannels(); - // update list view every 0.5 seconds - updateTimer.start(500); + applyFilter->setEnabled(false); + refreshListButton->setEnabled(false); emit refreshChannelList(); } @@ -253,6 +253,11 @@ void ChannelListPanel::addToChannelList(const QString& channel,int users,const Q // set internal numbers of channels and users, display will be updated by a timer setNumChannels(getNumChannels()+1); setNumUsers(getNumUsers()+users); + + if (!updateTimer.isActive()) + { + updateTimer.start(500); + } } void ChannelListPanel::updateDisplay() @@ -273,14 +278,13 @@ void ChannelListPanel::updateDisplay() QString users=channelLine.section(' ',1,1); QString topic=channelLine.section(' ',2); // add channel line to list view - ChannelListViewItem* item=new ChannelListViewItem(channelListView,channel,users,topic); - applyFilterToItem(item); - // if it's the last one of this batch, update the widget if(index==pendingChannels.count()-1) { channelListView->setUpdatesEnabled(true); - channelListView->update(); } + ChannelListViewItem* item=new ChannelListViewItem(channelListView,channel,users,topic); + applyFilterToItem(item); + // if it's the last one of this batch, update the widget } // clear list of pending inserts pendingChannels.clear(); @@ -290,6 +294,8 @@ void ChannelListPanel::updateDisplay() else { updateTimer.stop(); + applyFilter->setEnabled(true); + refreshListButton->setEnabled(true); } } @@ -485,4 +491,4 @@ void ChannelListPanel::contextMenu (KListView* /* l */, QListViewItem* i, const delete showURLmenu; } -#include "channellistpanel.moc" +#include "channellistpanel.moc" \ No newline at end of file diff --git a/konversation/channellistpanel.h b/konversation/channellistpanel.h index bad39ab..41df215 100644 --- a/konversation/channellistpanel.h +++ b/konversation/channellistpanel.h @@ -116,6 +116,9 @@ class ChannelListPanel : public ChatWindow QCheckBox* topicFilter; QCheckBox* regexpCheck; + QPushButton* applyFilter; + QPushButton* refreshListButton; + KListView* channelListView; QString filterText;