~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/helpviewer/qgshelpserver.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 *   (at your option) any later version.                                   *
16
16
 *                                                                         *
17
17
 ***************************************************************************/
18
 
/* $Id: qgshelpserver.cpp 4252 2005-11-21 05:51:31Z gsherman $ */
 
18
/* $Id$ */
19
19
#include "qgshelpserver.h"
20
20
 
21
21
// The communications technique used here has been adapted from Qt Assistant.
22
22
// See qt/tools/assistant/ main.cpp and lib/qassistantclient.cpp (Qt 3.3.4).
23
23
 
24
 
QgsHelpContextServer::QgsHelpContextServer(QObject *parent) :
25
 
   Q3ServerSocket(0x7f000001, 0, parent)
 
24
QgsHelpContextServer::QgsHelpContextServer( QObject *parent ) :
 
25
    QTcpServer( parent )
26
26
{
27
 
  // Superclass listens for localhost connection
 
27
  listen( QHostAddress::LocalHost, 0 );
28
28
}
29
29
 
30
30
QgsHelpContextServer::~QgsHelpContextServer()
32
32
  // Socket is automatically deleted here because it is a QQbject child
33
33
}
34
34
 
35
 
void QgsHelpContextServer::newConnection(int socket)
 
35
void QgsHelpContextServer::incomingConnection( int socket )
36
36
{
37
37
  // Create socket in response to new connection
38
 
  QgsHelpContextSocket *helpSocket = new QgsHelpContextSocket(socket, this);
 
38
  QgsHelpContextSocket *helpSocket = new QgsHelpContextSocket( socket, this );
39
39
  // Pass context from socket upwards
40
 
  connect(helpSocket, SIGNAL(setContext(const QString&)),
41
 
    SIGNAL(setContext(const QString&)));
 
40
  connect( helpSocket, SIGNAL( setContext( const QString& ) ),
 
41
           SIGNAL( setContext( const QString& ) ) );
 
42
  emit newConnection();
42
43
}
43
44
 
44
 
QgsHelpContextSocket::QgsHelpContextSocket(int socket, QObject *parent) :
45
 
  Q3Socket(parent, 0)
 
45
QgsHelpContextSocket::QgsHelpContextSocket( int socket, QObject *parent ) :
 
46
    QTcpSocket( parent )
46
47
{
47
 
  connect(this, SIGNAL(readyRead()), SLOT(readClient()));
48
 
  setSocket(socket);
 
48
  connect( this, SIGNAL( readyRead() ), SLOT( readClient() ) );
 
49
  setSocketDescriptor( socket );
49
50
}
50
51
 
51
52
QgsHelpContextSocket::~QgsHelpContextSocket()
59
60
  while ( canReadLine() )
60
61
  {
61
62
    contextId = readLine();
62
 
    contextId.remove('\n');
63
 
    emit setContext(contextId);
 
63
    contextId.remove( '\n' );
 
64
    emit setContext( contextId );
64
65
  }
65
66
}