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

List:       atlantik-devel
Subject:    [atlantik-devel] A small patch for atlantik
From:       "Albert 'TSDgeos' Astals Cid" <tsdgeos () terra ! es>
Date:       2003-05-10 9:42:52
[Download RAW message or body]

It removes two command line layout warnings like 
QLayout "unnamed" added to SelectServer "selectServer", which already has a 
layout
and makes the program exit when downloading the server list 'hangs' (for 
example you are not connected to the internet) and you click on [x], 
previously the prompt didn't return.

The patch is:

Index: monopigator.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/monopigator.cpp,v
retrieving revision 1.11
diff -u -r1.11 monopigator.cpp
--- monopigator.cpp	21 Jan 2003 02:44:31 -0000	1.11
+++ monopigator.cpp	10 May 2003 09:40:34 -0000
@@ -24,6 +24,11 @@
 	m_downloadData = 0;
 }
 
+Monopigator::~Monopigator()
+{
+	if (m_job != NULL) m_job -> kill();
+}
+
 void Monopigator::loadData(const KURL &url)
 {
 	if (m_downloadData)
@@ -32,11 +37,11 @@
 	m_downloadData->open(IO_WriteOnly);
 	m_downloadData->reset();
 
-	KIO::Job *job = KIO::get(url.url(), true, false);
-	job->addMetaData(QString::fromLatin1("UserAgent"), 
QString::fromLatin1("Atlantik/" ATLANTIK_VERSION_STRING));
+	m_job = KIO::get(url.url(), true, false);
+	m_job->addMetaData(QString::fromLatin1("UserAgent"), 
QString::fromLatin1("Atlantik/" ATLANTIK_VERSION_STRING));
 
-	connect(job, SIGNAL(data(KIO::Job *, const QByteArray &)), 
SLOT(slotData(KIO::Job *, const QByteArray &)));
-	connect(job, SIGNAL(result(KIO::Job *)), SLOT(slotResult(KIO::Job *)));
+	connect(m_job, SIGNAL(data(KIO::Job *, const QByteArray &)), 
SLOT(slotData(KIO::Job *, const QByteArray &)));
+	connect(m_job, SIGNAL(result(KIO::Job *)), SLOT(slotResult(KIO::Job *)));
 }
 
 void Monopigator::slotData(KIO::Job *, const QByteArray &data)
@@ -47,6 +52,7 @@
 void Monopigator::slotResult(KIO::Job *job)
 {
 	processData(m_downloadData->buffer(), !job->error());
+	m_job = NULL;
 }
 
 void Monopigator::processData(const QByteArray &data, bool okSoFar)
Index: monopigator.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/monopigator.h,v
retrieving revision 1.10
diff -u -r1.10 monopigator.h
--- monopigator.h	21 Jan 2003 02:44:31 -0000	1.10
+++ monopigator.h	10 May 2003 09:40:34 -0000
@@ -29,6 +29,7 @@
 
 public:
 	Monopigator();
+	~Monopigator();
 	void loadData(const KURL &);
 
 signals:
@@ -43,6 +44,7 @@
 	void processData(const QByteArray &, bool = true);
 
 	QBuffer *m_downloadData;
+	KIO::Job *m_job;
 };
 
 #endif
Index: selectgame_widget.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectgame_widget.cpp,v
retrieving revision 1.27
diff -u -r1.27 selectgame_widget.cpp
--- selectgame_widget.cpp	25 Feb 2003 02:49:48 -0000	1.27
+++ selectgame_widget.cpp	10 May 2003 09:40:34 -0000
@@ -48,8 +48,7 @@
 	connect(m_gameList, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint 
&, int)), this, SLOT(validateConnectButton()));
 	connect(m_gameList, SIGNAL(selectionChanged(QListViewItem *)), this, 
SLOT(validateConnectButton()));
 
-	QHBoxLayout *buttonBox = new QHBoxLayout(this, 0, KDialog::spacingHint());
-	m_mainLayout->addItem(buttonBox);
+	QHBoxLayout *buttonBox = new QHBoxLayout(m_mainLayout, 
KDialog::spacingHint());
 
 	KPushButton *backButton = new KPushButton(SmallIcon("back"), i18n("Server 
List"), this);
 	buttonBox->addWidget(backButton);
@@ -63,7 +62,7 @@
 	buttonBox->addWidget(m_connectButton);
 
 	connect(m_connectButton, SIGNAL(clicked()), this, SLOT(connectClicked()));
-	
+
     // Status indicator
 	m_statusLabel = new QLabel(this);
 	m_statusLabel->setText(i18n("Retrieving game list..."));
Index: selectserver_widget.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectserver_widget.cpp,v
retrieving revision 1.24
diff -u -r1.24 selectserver_widget.cpp
--- selectserver_widget.cpp	6 Mar 2003 13:42:53 -0000	1.24
+++ selectserver_widget.cpp	10 May 2003 09:40:34 -0000
@@ -49,9 +49,7 @@
 	connect(m_serverList, SIGNAL(rightButtonClicked(QListViewItem *, const 
QPoint &, int)), this, SLOT(validateConnectButton()));
 	connect(m_serverList, SIGNAL(selectionChanged(QListViewItem *)), this, 
SLOT(validateConnectButton()));
 
-	QHBoxLayout *buttonBox = new QHBoxLayout(this, 0, KDialog::spacingHint());
-	m_mainLayout->addItem(buttonBox);
-
+	QHBoxLayout *buttonBox = new QHBoxLayout(m_mainLayout, 
KDialog::spacingHint());
 	buttonBox->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, 
QSizePolicy::Minimum));
 
 	// Add Server

_______________________________________________
atlantik-devel mailing list
atlantik-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/atlantik-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

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