[atlantik-cvs] CVS: kdegames/atlantik/client atlantik.cpp, 1.157.2.6, 1.157.2.7 atlantik.h, 1.62.2.1, 1.62.2.2

[email protected] Mon, 8 Dec 2003 22:55:40 +0100 (CET)
Newsgroups gmane.comp.kde.devel.atlantik
Message-ID <[email protected]>
Update of /home/kde/kdegames/atlantik/client
In directory office:/tmp/cvs-serv687/client

Modified Files:
      Tag: atlantik_3_3_branch
	atlantik.cpp atlantik.h 
Log Message:
notify client when connection with server is lost, put message for intentional disconnect on parsing close signal, not in showSelectServer which is merely a result of the condition

Index: atlantik.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/atlantik.cpp,v
retrieving revision 1.157.2.6
retrieving revision 1.157.2.7
diff -u -d -r1.157.2.6 -r1.157.2.7
--- atlantik.cpp	8 Dec 2003 04:50:03 -0000	1.157.2.6
+++ atlantik.cpp	8 Dec 2003 21:55:36 -0000	1.157.2.7
@@ -419,6 +419,19 @@
 	initNetworkObject();
 }
 
+void Atlantik::networkClosed(int status)
+{
+	switch( status )
+	{
+	case KBufferedIO::involuntary:
+		slotMsgStatus( i18n("Connection with server %1:%2 lost.").arg(m_atlantikNetwork->host()).arg(m_atlantikNetwork->port()), QString("connect_no") );
+		showSelectServer();
+		break;
+	default:
+		slotMsgStatus( i18n("Disconnected from %1:%2.").arg(m_atlantikNetwork->host()).arg(m_atlantikNetwork->port()), QString("connect_no") );
+		break;
+	}
+}
 
 void Atlantik::slotConfigure()
 {
@@ -647,8 +660,6 @@
 {
 	if (m_atlantikNetwork)
 	{
-		if (!m_atlantikNetwork->host().isEmpty())
-			slotMsgStatus( i18n("Disconnected from %1:%2.").arg(m_atlantikNetwork->host()).arg(m_atlantikNetwork->port()), QString("connect_no") );
 		m_atlantikNetwork->reset();
 		return;
 	}
@@ -661,6 +672,7 @@
 
 	connect(m_atlantikNetwork, SIGNAL(connectionSuccess()), this, SLOT(slotNetworkConnected()));
 	connect(m_atlantikNetwork, SIGNAL(connectionFailed(int)), this, SLOT(slotNetworkError(int)));
+	connect(m_atlantikNetwork, SIGNAL(closed(int)), this, SLOT(networkClosed(int)));
 
 	connect(m_atlantikNetwork, SIGNAL(receivedHandshake()), this, SLOT(sendHandshake()));
 

Index: atlantik.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/atlantik.h,v
retrieving revision 1.62.2.1
retrieving revision 1.62.2.2
diff -u -d -r1.62.2.1 -r1.62.2.2
--- atlantik.h	15 Nov 2003 13:31:04 -0000	1.62.2.1
+++ atlantik.h	8 Dec 2003 21:55:36 -0000	1.62.2.2
@@ -117,7 +117,7 @@
 	 * list instead of the server list.
 	 *
 	 */
-	 void slotNetworkConnected();
+	void slotNetworkConnected();
 
 	/**
 	 * An error occurred while setting up the network connection. Inform the
@@ -125,8 +125,10 @@
 	 *
 	 * @param errno See http://doc.trolltech.com/3.0/qsocket.html#Error-enum
 	 */
-	 void slotNetworkError(int errnum);
+	void slotNetworkError(int errnum);
 
+	void networkClosed(int status);
+	 
 	/**
 	 * Creates a new modeless configure dialog or raises it when it already exists.
 	 *