[atlantik-cvs] CVS: kdegames/atlantik/client monopigator.cpp,1.9.8.4,1.9.8.5 monopigator.h,1.8.8.4,1.8.8.5 selectserver_widget.cpp,1.18.6.4,1.18.6.5

[email protected]
Newsgroups gmane.comp.kde.devel.atlantik
Message-ID <[email protected]>
Update of /home/kde/kdegames/atlantik/client
In directory office:/tmp/cvs-serv11804/client

Modified Files:
      Tag: KDE_3_1_BRANCH
	monopigator.cpp monopigator.h selectserver_widget.cpp 
Log Message:
backport to kde 3.1 branch, fix #61152: sort by user doesn't work in the
right way

CCMAIL: [email protected]


Index: monopigator.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/monopigator.cpp,v
retrieving revision 1.9.8.4
retrieving revision 1.9.8.5
diff -u -d -r1.9.8.4 -r1.9.8.5
--- monopigator.cpp	2 Jun 2003 18:39:39 -0000	1.9.8.4
+++ monopigator.cpp	12 Jul 2003 23:16:15 -0000	1.9.8.5
@@ -102,3 +102,22 @@
 		}
 	}
 }
+
+MonopigatorEntry::MonopigatorEntry(QListView *parent, QString host, QString version, QString users, QString port) : QListViewItem(parent, host, version, users, port)
+{
+}
+
+int MonopigatorEntry::compare(QListViewItem *i, int col, bool ascending) const
+{
+	if (col == 2)
+	{
+		int myVal = text(col).toInt(), iVal = i->text(col).toInt();
+		if (myVal == iVal)
+			return 0;
+		else if (myVal > iVal)
+			return 1;
+		else
+			return -1;
+	}
+	return key( col, ascending ).compare( i->key( col, ascending) );
+}

Index: monopigator.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/monopigator.h,v
retrieving revision 1.8.8.4
retrieving revision 1.8.8.5
diff -u -d -r1.8.8.4 -r1.8.8.5
--- monopigator.h	2 Jun 2003 18:39:39 -0000	1.8.8.4
+++ monopigator.h	12 Jul 2003 23:16:15 -0000	1.8.8.5
@@ -19,6 +19,7 @@
 
 #include <qobject.h>
 #include <qbuffer.h>
+#include <qlistview.h>
 #include <qtimer.h>
 
 #include <kio/job.h>
@@ -49,6 +50,13 @@
 	QBuffer *m_downloadData;
 	QTimer *m_timer;
 	KIO::Job *m_job;
+};
+
+class MonopigatorEntry : public QListViewItem
+{
+public:
+	MonopigatorEntry(QListView *parent, QString host, QString version, QString users, QString port);
+	int compare(QListViewItem *i, int col, bool ascending) const;
 };
 
 #endif

Index: selectserver_widget.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectserver_widget.cpp,v
retrieving revision 1.18.6.4
retrieving revision 1.18.6.5
diff -u -d -r1.18.6.4 -r1.18.6.5
--- selectserver_widget.cpp	3 Jun 2003 07:54:18 -0000	1.18.6.4
+++ selectserver_widget.cpp	12 Jul 2003 23:16:15 -0000	1.18.6.5
@@ -114,7 +114,7 @@
 
 void SelectServer::slotMonopigatorAdd(QString host, QString port, QString version, int users)
 {
-	QListViewItem *item = new QListViewItem(m_serverList, host, version, (users == -1) ? i18n("unknown") : QString::number(users), port);
+	MonopigatorEntry *item = new MonopigatorEntry(m_serverList, host, version, (users == -1) ? i18n("unknown") : QString::number(users), port);
 	item->setPixmap(0, BarIcon("atlantik", KIcon::SizeSmall));
 	validateConnectButton();
 }
@@ -123,9 +123,8 @@
 {
 	m_localServerAvailable = true;
 
-	QListViewItem *item = new QListViewItem(m_serverList, "localhost", i18n("unknown"), i18n("unknown"), QString::number(1234));
+	MonopigatorEntry *item = new MonopigatorEntry(m_serverList, "localhost", i18n("unknown"), i18n("unknown"), QString::number(1234));
 	item->setPixmap(0, BarIcon("atlantik", KIcon::SizeSmall));
-
 	validateConnectButton();
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.