From kde-commits Thu Jul 01 13:26:49 2010 From: Dario Abatianni Date: Thu, 01 Jul 2010 13:26:49 +0000 To: kde-commits Subject: [Konversation] 8e30f31: Channel list now sorts correctly when number Message-Id: <20100701132649.24F52BB544B () projects ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=127799630513042 A konversation/channellistviewitem.h [License: UNKNOWN] A konversation/channellistviewitem.cpp [License: UNKNOWN] commit 8e30f31d0cb0178640330737286bdd4335d5d703 Author: Dario Abatianni Date: Mon Sep 1 12:47:00 2003 +0000 Channel list now sorts correctly when number column is clicked svn path=/trunk/kdeextragear-2/konversation/; revision=247545 diff --git a/ChangeLog b/ChangeLog index 1252fcc..b960310 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ Changes from 0.12 to 0.13 - Added system tray icon patch by Frauke Oster (thanks!) - Channel list update is now more CPU friendly - Tell the user why the channel list could not be opened +- Channel list now sorts correctly when number column is clicked Changes from 0.11 to 0.12 - Now handles multi server mode in one single window diff --git a/konversation/Makefile.am b/konversation/Makefile.am index e2f5707..3225b4f 100644 --- a/konversation/Makefile.am +++ b/konversation/Makefile.am @@ -3,7 +3,7 @@ bin_PROGRAMS = konversation ## INCLUDES were found outside kdevelop specific part -konversation_SOURCES = konviface.skel konversationmainwindow.cpp valuelistviewitem.cpp urlcatcher.cpp searchdialog.cpp prefspagehighlight.cpp scriptlauncher.cpp rawlog.cpp prefspagenotify.cpp prefspagedialogs.cpp prefspagecolorsimages.cpp prefspagebuttons.cpp konvdcop.cpp channellistpanel.cpp konsolepanel.cpp dcctransferhandler.cpp prefspageignore.cpp ircresolver.cpp identity.cpp statuspanel.cpp prefspageappearance.cpp dccrecipientdialog.cpp topiccombobox.cpp prefspagegeneralsettings.cpp prefspagelog.cpp prefspagedccsettings.cpp prefspagescripts.cpp nicksonline.cpp prefspageidentity.cpp prefspage.cpp prefspageserverlist.cpp dccpanel.cpp dcctransfer.cpp ledlistviewitem.cpp highlight.cpp highlightviewitem.cpp nickchangedialog.cpp modebutton.cpp ignorelistviewitem.cpp ignorecheckbox.cpp ignore.cpp nicklistview.cpp ircinput.cpp ledtabbar.cpp ledtab.cpp ledtabwidget.cpp images.cpp editserverdialog.cpp serverlistitem.cpp serverentry.cpp prefsdialog.cpp quickbutton.cpp preferences. cpp chatwindow.cpp outputfilter.cpp query.cpp konversationapplication.cpp nick.cpp inputfilter.cpp channel.cpp ircview.cpp server.cpp ircserversocket.cpp main.cpp prefspageirccolorsui.ui prefspageirccolors.cpp irccolorchooserui.ui irccolorchooser.cpp prefspagealiases.cpp +konversation_SOURCES = konviface.skel konversationmainwindow.cpp valuelistviewitem.cpp urlcatcher.cpp searchdialog.cpp prefspagehighlight.cpp scriptlauncher.cpp rawlog.cpp prefspagenotify.cpp prefspagedialogs.cpp prefspagecolorsimages.cpp prefspagebuttons.cpp konvdcop.cpp channellistpanel.cpp konsolepanel.cpp dcctransferhandler.cpp prefspageignore.cpp ircresolver.cpp identity.cpp statuspanel.cpp prefspageappearance.cpp dccrecipientdialog.cpp topiccombobox.cpp prefspagegeneralsettings.cpp prefspagelog.cpp prefspagedccsettings.cpp prefspagescripts.cpp nicksonline.cpp prefspageidentity.cpp prefspage.cpp prefspageserverlist.cpp dccpanel.cpp dcctransfer.cpp ledlistviewitem.cpp highlight.cpp highlightviewitem.cpp nickchangedialog.cpp modebutton.cpp ignorelistviewitem.cpp ignorecheckbox.cpp ignore.cpp nicklistview.cpp ircinput.cpp ledtabbar.cpp ledtab.cpp ledtabwidget.cpp images.cpp editserverdialog.cpp serverlistitem.cpp serverentry.cpp prefsdialog.cpp quickbutton.cpp preferences. cpp chatwindow.cpp outputfilter.cpp query.cpp konversationapplication.cpp nick.cpp inputfilter.cpp channel.cpp ircview.cpp server.cpp ircserversocket.cpp main.cpp prefspageirccolorsui.ui prefspageirccolors.cpp irccolorchooserui.ui irccolorchooser.cpp prefspagealiases.cpp channellistviewitem.h channellistviewitem.cpp konversation_LDADD = -lkio -lm $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) $(LIBSOCKET) diff --git a/konversation/channellistpanel.cpp b/konversation/channellistpanel.cpp index 32dd80b..562d83d 100644 --- a/konversation/channellistpanel.cpp +++ b/konversation/channellistpanel.cpp @@ -31,6 +31,7 @@ #include #include "channellistpanel.h" +#include "channellistviewitem.h" #include "server.h" ChannelListPanel::ChannelListPanel(QWidget* parent) : @@ -233,9 +234,7 @@ void ChannelListPanel::joinChannelClicked() void ChannelListPanel::addToChannelList(const QString& channel,int users,const QString& topic) { - pendingChannels.append(channel+" "+users+" "+topic); - -// new KListViewItem(channelListView,channel,QString::number(users),topic); + pendingChannels.append(channel+" "+QString::number(users)+" "+topic); // set internal numbers of channels and users, display will be updated by a timer setNumChannels(getNumChannels()+1); @@ -266,7 +265,7 @@ void ChannelListPanel::updateDisplay() // if it's the last one of this batch, update the widget if(index==pendingChannels.count()-1) channelListView->setUpdatesEnabled(true); // add channel line to list view - new KListViewItem(channelListView,channel,users,topic); + new ChannelListViewItem(channelListView,channel,users,topic); } // clear list of pending inserts pendingChannels.clear(); diff --git a/konversation/channellistpanel.h b/konversation/channellistpanel.h index 9a80e1f..8edc275 100644 --- a/konversation/channellistpanel.h +++ b/konversation/channellistpanel.h @@ -26,6 +26,7 @@ class QStringList; class QTimer; class KListView; +class ChannelListViewItem; class ChannelListPanel : public ChatWindow { diff --git a/konversation/channellistviewitem.cpp b/konversation/channellistviewitem.cpp new file mode 100644 index 0000000..1a08efd --- /dev/null +++ b/konversation/channellistviewitem.cpp @@ -0,0 +1,41 @@ +/* + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. +*/ + +/* + channellistviewitem.cpp - item in the channel list + begin: Die Apr 29 2003 + copyright: (C) 2003 by Dario Abatianni + email: eisfuchs@tigress.com +*/ + +#include + +#include "channellistviewitem.h" + +ChannelListViewItem::ChannelListViewItem(KListView* parent,QString channel,QString users,QString topic) + : KListViewItem(parent,channel,users,topic) +{ +} + +ChannelListViewItem::~ChannelListViewItem() +{ +} + +int ChannelListViewItem::compare(QListViewItem* item, int col, bool ascending) const +{ + if(col==1) + { + bool ok; + int i=text(col).toInt(&ok); + if(ok) + { + int j=item->text(col).toInt(&ok); + if(ok) return (ij) ? 1 : 0; + } + } + return KListViewItem::compare(item,col,ascending); +} diff --git a/konversation/channellistviewitem.h b/konversation/channellistviewitem.h new file mode 100644 index 0000000..7ca5290 --- /dev/null +++ b/konversation/channellistviewitem.h @@ -0,0 +1,31 @@ +/* + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. +*/ + +/* + channellistviewitem.h - item in the channel list + begin: Die Apr 29 2003 + copyright: (C) 2003 by Dario Abatianni + email: eisfuchs@tigress.com +*/ + +#ifndef CHANNELLISTVIEWITEM_H +#define CHANNELLISTVIEWITEM_H + +#include + +#include + +class ChannelListViewItem : public KListViewItem +{ + public: + ChannelListViewItem(KListView* parent,QString channel,QString users,QString topic); + ~ChannelListViewItem(); + + int compare(QListViewItem* item, int col, bool ascending) const; +}; + +#endif