diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c840a62057..2e7bc632ab 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,18 @@ The license applies to all entries newer than 2009-04-28. */ +2012-05-08 15:14 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtnetwork/qth/QFtp.qth + * contrib/hbqt/qtnetwork/qth/QHttp.qth + * contrib/hbqt/qtnetwork/qth/QHttpHeader.qth + * contrib/hbqt/qtnetwork/qth/QHttpRequestHeader.qth + * contrib/hbqt/qtnetwork/qth/QHttpResponseHeader.qth + * contrib/hbqt/qtnetwork/qth/QNetworkProxy.qth + * contrib/hbqt/qtnetwork/qth/QNetworkRequest.qth + * contrib/hbqt/qtnetwork/qth/QUrlInfo.qth + - Replaced: HB_ISOBJECT() => hbqt_par_isDerivedFrom() + * Rationalized: constructors. + 2012-05-08 18:20 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbnetio/utils/hbnetio/netiosrv.prg * contrib/hbrun/plugins.prg diff --git a/harbour/contrib/hbqt/qtnetwork/qth/QFtp.qth b/harbour/contrib/hbqt/qtnetwork/qth/QFtp.qth index 32b3d2fff4..a1b23e841c 100644 --- a/harbour/contrib/hbqt/qtnetwork/qth/QFtp.qth +++ b/harbour/contrib/hbqt/qtnetwork/qth/QFtp.qth @@ -29,7 +29,14 @@ New = pParent */ HB_FUNC( QT_QFTP ) { - __HB_RETPTRGC__( new QFtp( hbqt_par_QObject( 1 ) ) ); + if( hb_pcount() == 1 && hbqt_par_isDerivedFrom( 1, "QOBJECT" ) ) + { + __HB_RETPTRGC__( new QFtp( hbqt_par_QObject( 1 ) ) ); + } + else + { + __HB_RETPTRGC__( new QFtp() ); + } } /* diff --git a/harbour/contrib/hbqt/qtnetwork/qth/QHttp.qth b/harbour/contrib/hbqt/qtnetwork/qth/QHttp.qth index 1c00b13bae..6b0c603712 100644 --- a/harbour/contrib/hbqt/qtnetwork/qth/QHttp.qth +++ b/harbour/contrib/hbqt/qtnetwork/qth/QHttp.qth @@ -31,7 +31,20 @@ New = pParent */ HB_FUNC( QT_QHTTP ) { - __HB_RETPTRGC__( new QHttp( hbqt_par_QObject( 1 ) ) ); + if( hb_pcount() == 1 && hbqt_par_isDerivedFrom( 1, "QOBJECT" ) ) + { + __HB_RETPTRGC__( new QHttp( hbqt_par_QObject( 1 ) ) ); + } + else if( hb_pcount() == 1 && HB_ISCHAR( 1 ) ) + { + void * pText01 = NULL; + __HB_RETPTRGC__( new QHttp( hb_parstr_utf8( 1, &pText01, NULL ) ) ); + hb_strfree( pText01 ); + } + else + { + __HB_RETPTRGC__( new QHttp() ); + } } /* @@ -83,7 +96,7 @@ int request ( const QHttpRequestHeader & header, const QByteArray & data, QIODev //int setHost ( const QString & hostName, quint16 port = 80 ) int setHost ( const QString & hostName, ConnectionMode mode, quint16 port = 0 ) int setProxy ( const QString & host, int port, const QString & username = QString(), const QString & password = QString() ) -// int setProxy ( const QNetworkProxy & proxy ) +int setProxy ( const QNetworkProxy & proxy ) // int setSocket ( QTcpSocket * socket ) int setUser ( const QString & userName, const QString & password = QString() ) State state () const diff --git a/harbour/contrib/hbqt/qtnetwork/qth/QHttpHeader.qth b/harbour/contrib/hbqt/qtnetwork/qth/QHttpHeader.qth index e56caf07ce..84906a7c02 100644 --- a/harbour/contrib/hbqt/qtnetwork/qth/QHttpHeader.qth +++ b/harbour/contrib/hbqt/qtnetwork/qth/QHttpHeader.qth @@ -32,7 +32,22 @@ Constructor = no */ HB_FUNC( QT_QHTTPHEADER ) { - +/* //QHttpHeader.cpp:128:67: error: cannot allocate an object of abstract type 'QHttpHeader' // This can be subclassed only + if( hb_pcount() == 1 && HB_ISCHAR( 1 ) ) + { + void * pText01 = NULL; + __HB_RETPTRGC__( new QHttpHeader( hb_parstr_utf8( 1, &pText01, NULL ) ) ); + hb_strfree( pText01 ); + } + else if( hb_pcount() == 1 && hbqt_par_isDerivedFrom( 1, "QHTTPHEADER" ) ) + { + __HB_RETPTRGC__( new QHttpHeader( *hbqt_par_QHttpHeader( 1 ) ) ); + } + else + { + __HB_RETPTRGC__( new QHttpHeader() ); + } +*/ } diff --git a/harbour/contrib/hbqt/qtnetwork/qth/QHttpRequestHeader.qth b/harbour/contrib/hbqt/qtnetwork/qth/QHttpRequestHeader.qth index cb5f60eb2e..5e33aeb71a 100644 --- a/harbour/contrib/hbqt/qtnetwork/qth/QHttpRequestHeader.qth +++ b/harbour/contrib/hbqt/qtnetwork/qth/QHttpRequestHeader.qth @@ -30,7 +30,28 @@ Destructor = */ HB_FUNC( QT_QHTTPREQUESTHEADER ) { - __HB_RETPTRGC__( new QHttpRequestHeader() ); + if( hb_pcount() == 1 && HB_ISCHAR( 1 ) ) + { + void * pText01 = NULL; + __HB_RETPTRGC__( new QHttpRequestHeader( hb_parstr_utf8( 1, &pText01, NULL ) ) ); + hb_strfree( pText01 ); + } + else if( hb_pcount() >= 2 && HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) ) + { + void * pText01 = NULL; + void * pText02 = NULL; + __HB_RETPTRGC__( new QHttpRequestHeader( hb_parstr_utf8( 1, &pText01, NULL ), hb_parstr_utf8( 2, &pText02, NULL ), HB_ISNUM( 3 ) ? hb_parni( 3 ) : 1, HB_ISNUM( 4 ) ? hb_parni( 4 ) : 1 ) ); + hb_strfree( pText01 ); + hb_strfree( pText02 ); + } + else if( hb_pcount() == 1 && hbqt_par_isDerivedFrom( 1, "QHTTPREQUESTHEADER" ) ) + { + __HB_RETPTRGC__( new QHttpRequestHeader( *hbqt_par_QHttpRequestHeader( 1 ) ) ); + } + else + { + __HB_RETPTRGC__( new QHttpRequestHeader() ); + } } diff --git a/harbour/contrib/hbqt/qtnetwork/qth/QHttpResponseHeader.qth b/harbour/contrib/hbqt/qtnetwork/qth/QHttpResponseHeader.qth index b41623b51a..254cc4fc4f 100644 --- a/harbour/contrib/hbqt/qtnetwork/qth/QHttpResponseHeader.qth +++ b/harbour/contrib/hbqt/qtnetwork/qth/QHttpResponseHeader.qth @@ -30,7 +30,30 @@ Destructor = */ HB_FUNC( QT_QHTTPRESPONSEHEADER ) { - __HB_RETPTRGC__( new QHttpResponseHeader() ); + if( hb_pcount() == 1 && HB_ISCHAR( 1 ) ) + { + void * pText01 = NULL; + __HB_RETPTRGC__( new QHttpResponseHeader( hb_parstr_utf8( 1, &pText01, NULL ) ) ); + hb_strfree( pText01 ); + } + else if( hb_pcount() >= 2 && HB_ISNUM( 1 ) && HB_ISCHAR( 2 ) ) + { + void * pText01 = NULL; + __HB_RETPTRGC__( new QHttpResponseHeader( hb_parni( 1 ), hb_parstr_utf8( 2, &pText01, NULL ), HB_ISNUM( 3 ) ? hb_parni( 3 ) : 1, HB_ISNUM( 4 ) ? hb_parni( 4 ) : 1 ) ); + hb_strfree( pText01 ); + } + else if( hb_pcount() == 1 && HB_ISNUM( 1 ) ) + { + __HB_RETPTRGC__( new QHttpResponseHeader( hb_parni( 1 ) ) ); + } + else if( hb_pcount() == 1 && hbqt_par_isDerivedFrom( 1, "QHTTPRESPONSEHEADER" ) ) + { + __HB_RETPTRGC__( new QHttpResponseHeader( *hbqt_par_QHttpResponseHeader( 1 ) ) ); + } + else + { + __HB_RETPTRGC__( new QHttpResponseHeader() ); + } } diff --git a/harbour/contrib/hbqt/qtnetwork/qth/QNetworkProxy.qth b/harbour/contrib/hbqt/qtnetwork/qth/QNetworkProxy.qth index 900c490835..73fe2ae58d 100644 --- a/harbour/contrib/hbqt/qtnetwork/qth/QNetworkProxy.qth +++ b/harbour/contrib/hbqt/qtnetwork/qth/QNetworkProxy.qth @@ -32,14 +32,14 @@ New = */ HB_FUNC( QT_QNETWORKPROXY ) { - if( hb_pcount() == 1 && HB_ISOBJECT( 1 ) ) + if( hb_pcount() == 1 && hbqt_par_isDerivedFrom( 1, "QNETWORKPROXY" ) ) { __HB_RETPTRGC__( new QNetworkProxy( *hbqt_par_QNetworkProxy( 1 ) ) ); } else if( hb_pcount() >= 2 && HB_ISNUM( 1 ) && HB_ISCHAR( 2 ) ) { void * pText01 = NULL; - __HB_RETPTRGC__( new QNetworkProxy( ( QNetworkProxy::ProxyType ) hb_parni( 1 ), hb_parstr_utf8( 2, &pText01, NULL ), ( quint16 ) ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 0 ), ( HB_ISCHAR( 4 ) ? hbqt_par_QString( 4 ) : QString() ), ( HB_ISCHAR( 5 ) ? hbqt_par_QString( 5 ) : QString() ) ) ); + __HB_RETPTRGC__( new QNetworkProxy( ( QNetworkProxy::ProxyType ) hb_parni( 1 ), hb_parstr_utf8( 2, &pText01, NULL ), ( quint16 ) hb_parni( 3 ), QString(), QString() ) ); hb_strfree( pText01 ); } else if( hb_pcount() >= 1 && HB_ISNUM( 1 ) ) diff --git a/harbour/contrib/hbqt/qtnetwork/qth/QNetworkRequest.qth b/harbour/contrib/hbqt/qtnetwork/qth/QNetworkRequest.qth index 5ee0b1ef1b..69a801e113 100644 --- a/harbour/contrib/hbqt/qtnetwork/qth/QNetworkRequest.qth +++ b/harbour/contrib/hbqt/qtnetwork/qth/QNetworkRequest.qth @@ -29,7 +29,18 @@ Destructor = */ HB_FUNC( QT_QNETWORKREQUEST ) { - __HB_RETPTRGC__( new QNetworkRequest() ); + if( hb_pcount() == 1 && hbqt_par_isDerivedFrom( 1, "QURL" ) ) + { + __HB_RETPTRGC__( new QNetworkRequest( *hbqt_par_QUrl( 1 ) ) ); + } + else if( hb_pcount() == 1 && hbqt_par_isDerivedFrom( 1, "QNETWORKREQUEST" ) ) + { + __HB_RETPTRGC__( new QNetworkRequest( *hbqt_par_QNetworkRequest( 1 ) ) ); + } + else + { + __HB_RETPTRGC__( new QNetworkRequest() ); + } } diff --git a/harbour/contrib/hbqt/qtnetwork/qth/QUrlInfo.qth b/harbour/contrib/hbqt/qtnetwork/qth/QUrlInfo.qth index 5127631ba6..1f5d61b311 100644 --- a/harbour/contrib/hbqt/qtnetwork/qth/QUrlInfo.qth +++ b/harbour/contrib/hbqt/qtnetwork/qth/QUrlInfo.qth @@ -34,7 +34,7 @@ New = */ HB_FUNC( QT_QURLINFO ) { - if( hb_pcount() == 1 && HB_ISOBJECT( 1 ) ) + if( hb_pcount() == 1 && hbqt_par_isDerivedFrom( 1, "QURLINFO" ) ) { __HB_RETPTRGC__( new QUrlInfo( *hbqt_par_QUrlInfo( 1 ) ) ); }