author | llornkcor <llornkcor> | 2002-03-19 13:06:04 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-19 13:06:04 (UTC) |
commit | 4813077950f77a616ce5cd79276aa18db3dc23d4 (patch) (side-by-side diff) | |
tree | 27d21d8c0af3424e7afe704511077964a1290d8e | |
parent | f298cb9f5557d88b9ff38feb4b5e090e5c164ec2 (diff) | |
download | opie-4813077950f77a616ce5cd79276aa18db3dc23d4.zip opie-4813077950f77a616ce5cd79276aa18db3dc23d4.tar.gz opie-4813077950f77a616ce5cd79276aa18db3dc23d4.tar.bz2 |
fixed spelling error on qDebug message
-rw-r--r-- | core/launcher/qcopbridge.cpp | 322 |
1 files changed, 161 insertions, 161 deletions
diff --git a/core/launcher/qcopbridge.cpp b/core/launcher/qcopbridge.cpp index c78e827..c8af919 100644 --- a/core/launcher/qcopbridge.cpp +++ b/core/launcher/qcopbridge.cpp @@ -54,12 +54,12 @@ QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent = 0, { if ( !ok() ) - qWarning( "Failed to bind to port %d", port ); + qWarning( "Failed to bind to port %d", port ); else { - desktopChannel = new QCopChannel( "QPE/Desktop", this ); - connect( desktopChannel, SIGNAL(received(const QCString &, const QByteArray &)), - this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); - cardChannel = new QCopChannel( "QPE/Card", this ); - connect( cardChannel, SIGNAL(received(const QCString &, const QByteArray &)), - this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); + desktopChannel = new QCopChannel( "QPE/Desktop", this ); + connect( desktopChannel, SIGNAL(received(const QCString &, const QByteArray &)), + this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); + cardChannel = new QCopChannel( "QPE/Card", this ); + connect( cardChannel, SIGNAL(received(const QCString &, const QByteArray &)), + this, SLOT(desktopMessage( const QCString &, const QByteArray &)) ); } sendSync = FALSE; @@ -79,6 +79,6 @@ void QCopBridge::newConnection( int socket ) if ( sendSync ) { - pi ->startSync(); - sendSync = FALSE; + pi ->startSync(); + sendSync = FALSE; } } @@ -88,5 +88,5 @@ void QCopBridge::connectionClosed( QCopBridgePI *pi ) openConnections.remove( pi ); if ( openConnections.count() == 0 ) { - QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; + QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; } } @@ -96,5 +96,5 @@ void QCopBridge::closeOpenConnections() QCopBridgePI *pi; for ( pi = openConnections.first(); pi != 0; pi = openConnections.next() ) - pi->close(); + pi->close(); } @@ -106,12 +106,12 @@ void QCopBridge::desktopMessage( const QCString &command, const QByteArray &args int paren = command.find( "(" ); if ( paren <= 0 ) { - qDebug("DesktopMessage: bad qcop syntax"); - return; + qDebug("DesktopMessage: bad qcop syntax"); + return; } QString params = command.mid( paren + 1 ); if ( params[params.length()-1] != ')' ) { - qDebug("DesktopMessage: bad qcop syntax"); - return; + qDebug("DesktopMessage: bad qcop syntax"); + return; } @@ -121,43 +121,43 @@ void QCopBridge::desktopMessage( const QCString &command, const QByteArray &args QString data; if ( paramList.count() ) { - QDataStream stream( args, IO_ReadOnly ); - for ( QStringList::Iterator it = paramList.begin(); it != paramList.end(); ++it ) { - QString str; - if ( *it == "QString" ) { - stream >> str; - } else if ( *it == "QCString" ) { - QCString cstr; - stream >> cstr; - str = QString::fromLocal8Bit( cstr ); - } else if ( *it == "int" ) { - int i; - stream >> i; - str = QString::number( i ); - } else if ( *it == "bool" ) { - int i; - stream >> i; - str = QString::number( i ); - } else { - qDebug(" cannot route the argument type %s throught the qcop bridge", (*it).latin1() ); - return; - } - str.replace( QRegExp("&"), "&" ); - str.replace( QRegExp(" "), "&0x20;" ); - str.replace( QRegExp("\n"), "&0x0d;" ); - str.replace( QRegExp("\r"), "&0x0a;" ); - data += " " + str; - } + QDataStream stream( args, IO_ReadOnly ); + for ( QStringList::Iterator it = paramList.begin(); it != paramList.end(); ++it ) { + QString str; + if ( *it == "QString" ) { + stream >> str; + } else if ( *it == "QCString" ) { + QCString cstr; + stream >> cstr; + str = QString::fromLocal8Bit( cstr ); + } else if ( *it == "int" ) { + int i; + stream >> i; + str = QString::number( i ); + } else if ( *it == "bool" ) { + int i; + stream >> i; + str = QString::number( i ); + } else { + qDebug(" cannot route the argument type %s through the qcop bridge", (*it).latin1() ); + return; + } + str.replace( QRegExp("&"), "&" ); + str.replace( QRegExp(" "), "&0x20;" ); + str.replace( QRegExp("\n"), "&0x0d;" ); + str.replace( QRegExp("\r"), "&0x0a;" ); + data += " " + str; + } } QString sendCommand = QString(command.data()) + data; // send the command to all open connections if ( command == "startSync()" ) { - // we need to buffer it a bit - sendSync = TRUE; - startTimer( 20000 ); + // we need to buffer it a bit + sendSync = TRUE; + startTimer( 20000 ); } QCopBridgePI *pi; for ( pi = openConnections.first(); pi != 0; pi = openConnections.next() ) { - pi->sendDesktopMessage( sendCommand ); + pi->sendDesktopMessage( sendCommand ); } } @@ -180,20 +180,20 @@ QCopBridgePI::QCopBridgePI( int socket, QObject *parent = 0, const char* name = #ifndef INSECURE if ( !accessAuthorized(peeraddress) ) { - state = Forbidden; - startTimer( 0 ); + state = Forbidden; + startTimer( 0 ); } else -#endif +#endif { - state = Connected; - sendSync = FALSE; - connect( this, SIGNAL( readyRead() ), SLOT( read() ) ); - connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); + state = Connected; + sendSync = FALSE; + connect( this, SIGNAL( readyRead() ), SLOT( read() ) ); + connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); - send( "220 Qtopia QCop bridge ready!" ); - state = Wait_USER; + send( "220 Qtopia QCop bridge ready!" ); + state = Wait_USER; - // idle timer to close connections when not used anymore - startTimer( 60000 ); - connected = TRUE; + // idle timer to close connections when not used anymore + startTimer( 60000 ); + connected = TRUE; } } @@ -229,5 +229,5 @@ void QCopBridgePI::read() { while ( canReadLine() ) - process( readLine().stripWhiteSpace() ); + process( readLine().stripWhiteSpace() ); } @@ -256,5 +256,5 @@ bool QCopBridgePI::checkPassword( const QString& password ) QString cpwd = QString::fromLocal8Bit( pw->pw_passwd ); if ( cpwd == "x" && spw ) - cpwd = QString::fromLocal8Bit( spw->sp_pwdp ); + cpwd = QString::fromLocal8Bit( spw->sp_pwdp ); QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) ); @@ -277,27 +277,27 @@ void QCopBridgePI::process( const QString& message ) QString arg; if ( msg.count() >= 2 ) - arg = msg[1]; + arg = msg[1]; // we always respond to QUIT, regardless of state if ( cmd == "QUIT" ) { - send( "211 Have a nice day!" ); - delete this; - return; + send( "211 Have a nice day!" ); + delete this; + return; } // connected to client if ( Connected == state ) - return; + return; // waiting for user name if ( Wait_USER == state ) { - if ( cmd != "USER" || msg.count() < 2 || !checkUser( arg ) ) { - send( "530 Please login with USER and PASS" ); - return; - } - send( "331 User name ok, need password" ); - state = Wait_PASS; - return; + if ( cmd != "USER" || msg.count() < 2 || !checkUser( arg ) ) { + send( "530 Please login with USER and PASS" ); + return; + } + send( "331 User name ok, need password" ); + state = Wait_PASS; + return; } @@ -305,22 +305,22 @@ void QCopBridgePI::process( const QString& message ) if ( Wait_PASS == state ) { - if ( cmd != "PASS" || !checkPassword( arg ) ) { - //if ( cmd != "PASS" || msg.count() < 2 || !checkPassword( arg ) ) { - send( "530 Please login with USER and PASS" ); - return; - } - send( "230 User logged in, proceed" ); - state = Ready; - if ( sendSync ) { - sendDesktopMessage( "startSync()" ); - sendSync = FALSE; - } - return; + if ( cmd != "PASS" || !checkPassword( arg ) ) { + //if ( cmd != "PASS" || msg.count() < 2 || !checkPassword( arg ) ) { + send( "530 Please login with USER and PASS" ); + return; + } + send( "230 User logged in, proceed" ); + state = Ready; + if ( sendSync ) { + sendDesktopMessage( "startSync()" ); + sendSync = FALSE; + } + return; } // noop (NOOP) else if ( cmd == "NOOP" ) { - connected = TRUE; - send( "200 Command okay" ); + connected = TRUE; + send( "200 Command okay" ); } @@ -328,80 +328,80 @@ void QCopBridgePI::process( const QString& message ) else if ( cmd == "CALL" ) { - // example: call QPE/System execute(QString) addressbook - - if ( msg.count() < 3 ) { - send( "500 Syntax error, command unrecognized" ); - } - else { - - QString channel = msg[1]; - QString command = msg[2]; - - command.stripWhiteSpace(); - - int paren = command.find( "(" ); - if ( paren <= 0 ) { - send( "500 Syntax error, command unrecognized" ); - return; - } - - QString params = command.mid( paren + 1 ); - if ( params[params.length()-1] != ')' ) { - send( "500 Syntax error, command unrecognized" ); - return; - } - - params.truncate( params.length()-1 ); - QByteArray buffer; - QDataStream ds( buffer, IO_WriteOnly ); - - int msgId = 3; - - QStringList paramList = QStringList::split( ",", params ); - if ( paramList.count() > msg.count() - 3 ) { - send( "500 Syntax error, command unrecognized" ); - return; - } - - for ( QStringList::Iterator it = paramList.begin(); it != paramList.end(); ++it ) { - - QString arg = msg[msgId]; - arg.replace( QRegExp("&0x20;"), " " ); - arg.replace( QRegExp("&"), "&" ); - arg.replace( QRegExp("&0x0d;"), "\n" ); - arg.replace( QRegExp("&0x0a;"), "\r" ); - if ( *it == "QString" ) - ds << arg; - else if ( *it == "QCString" ) - ds << arg.local8Bit(); - else if ( *it == "int" ) - ds << arg.toInt(); - else if ( *it == "bool" ) - ds << arg.toInt(); - else { - send( "500 Syntax error, command unrecognized" ); - return; - } - msgId++; - } - - if ( !QCopChannel::isRegistered( channel.latin1() ) ) { - // send message back about it - QString answer = "599 ChannelNotRegistered " + channel; - send( answer ); - return; - } - - if ( paramList.count() ) - QCopChannel::send( channel.latin1(), command.latin1(), buffer ); - else - QCopChannel::send( channel.latin1(), command.latin1() ); - - send( "200 Command okay" ); - } + // example: call QPE/System execute(QString) addressbook + + if ( msg.count() < 3 ) { + send( "500 Syntax error, command unrecognized" ); + } + else { + + QString channel = msg[1]; + QString command = msg[2]; + + command.stripWhiteSpace(); + + int paren = command.find( "(" ); + if ( paren <= 0 ) { + send( "500 Syntax error, command unrecognized" ); + return; + } + + QString params = command.mid( paren + 1 ); + if ( params[params.length()-1] != ')' ) { + send( "500 Syntax error, command unrecognized" ); + return; + } + + params.truncate( params.length()-1 ); + QByteArray buffer; + QDataStream ds( buffer, IO_WriteOnly ); + + int msgId = 3; + + QStringList paramList = QStringList::split( ",", params ); + if ( paramList.count() > msg.count() - 3 ) { + send( "500 Syntax error, command unrecognized" ); + return; + } + + for ( QStringList::Iterator it = paramList.begin(); it != paramList.end(); ++it ) { + + QString arg = msg[msgId]; + arg.replace( QRegExp("&0x20;"), " " ); + arg.replace( QRegExp("&"), "&" ); + arg.replace( QRegExp("&0x0d;"), "\n" ); + arg.replace( QRegExp("&0x0a;"), "\r" ); + if ( *it == "QString" ) + ds << arg; + else if ( *it == "QCString" ) + ds << arg.local8Bit(); + else if ( *it == "int" ) + ds << arg.toInt(); + else if ( *it == "bool" ) + ds << arg.toInt(); + else { + send( "500 Syntax error, command unrecognized" ); + return; + } + msgId++; + } + + if ( !QCopChannel::isRegistered( channel.latin1() ) ) { + // send message back about it + QString answer = "599 ChannelNotRegistered " + channel; + send( answer ); + return; + } + + if ( paramList.count() ) + QCopChannel::send( channel.latin1(), command.latin1(), buffer ); + else + QCopChannel::send( channel.latin1(), command.latin1() ); + + send( "200 Command okay" ); + } } // not implemented else - send( "502 Command not implemented" ); + send( "502 Command not implemented" ); } @@ -411,6 +411,6 @@ void QCopBridgePI::timerEvent( QTimerEvent * ) { if ( connected ) - connected = FALSE; + connected = FALSE; else - connectionClosed(); + connectionClosed(); } |