diff options
author | Slávek Banko <[email protected]> | 2013-06-29 12:56:53 +0200 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2013-07-04 03:11:35 +0200 |
commit | 5f5e7c5455d52826b0bd50f64fcffb7695ce970d (patch) | |
tree | c8ee8792d3fb139365abbf70c2255f1e69d2aa34 /src/webqueryieeexplore.cpp | |
parent | 251c9a439759c830d34c70683d0fc9454d703010 (diff) | |
download | kbibtex-5f5e7c5455d52826b0bd50f64fcffb7695ce970d.tar.gz kbibtex-5f5e7c5455d52826b0bd50f64fcffb7695ce970d.zip |
Initial TQt conversion
Diffstat (limited to 'src/webqueryieeexplore.cpp')
-rw-r--r-- | src/webqueryieeexplore.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/webqueryieeexplore.cpp b/src/webqueryieeexplore.cpp index 070f8ca..1ffbd9e 100644 --- a/src/webqueryieeexplore.cpp +++ b/src/webqueryieeexplore.cpp @@ -17,8 +17,8 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include <qspinbox.h> -#include <qfile.h> +#include <ntqspinbox.h> +#include <ntqfile.h> #include <kio/jobclasses.h> #include <kio/job.h> @@ -38,19 +38,19 @@ namespace KBibTeX { - WebQueryIEEExploreWidget::WebQueryIEEExploreWidget( QWidget *parent, const char *name ) + WebQueryIEEExploreWidget::WebQueryIEEExploreWidget( TQWidget *parent, const char *name ) : WebQueryWidget( parent, name ) { init(); Settings *settings = Settings::self(); - QString value = settings->getWebQueryDefault( "IEEE" ); - value = value == QString::null ? "" : value; + TQString value = settings->getWebQueryDefault( "IEEE" ); + value = value == TQString::null ? "" : value; lineEditQuery->setText( value ); slotTextChanged( value, true ); } - WebQueryIEEExplore::WebQueryIEEExplore( QWidget* parent ): WebQuery( parent ), m_numberOfMatches( "Your search matched <strong>(\\d+)</strong> of" ), m_findArNumber( "srchabstract.jsp\\?arnumber=(\\d+)" ), m_date( "(?:([A-Z][a-z]{2,3})(?:(?:/|-\\d+\\s+)([A-Z][a-z]{2,3}))?)?\\.?\\s*(\\d{4})$" ), m_risURL( "http://ieeexplore.ieee.org/xpls/citationAct" ) + WebQueryIEEExplore::WebQueryIEEExplore( TQWidget* parent ): WebQuery( parent ), m_numberOfMatches( "Your search matched <strong>(\\d+)</strong> of" ), m_findArNumber( "srchabstract.jsp\\?arnumber=(\\d+)" ), m_date( "(?:([A-Z][a-z]{2,3})(?:(?:/|-\\d+\\s+)([A-Z][a-z]{2,3}))?)?\\.?\\s*(\\d{4})$" ), m_risURL( "http://ieeexplore.ieee.org/xpls/citationAct" ) { m_widget = new WebQueryIEEExploreWidget( parent ); m_bibtexImporter = new BibTeX::FileImporterBibTeX( false ); @@ -62,17 +62,17 @@ namespace KBibTeX delete m_widget; } - QString WebQueryIEEExplore::title() + TQString WebQueryIEEExplore::title() { return i18n( "IEEExplore" ); } - QString WebQueryIEEExplore::disclaimer() + TQString WebQueryIEEExplore::disclaimer() { return i18n( "What is IEEE Xplore?" ); } - QString WebQueryIEEExplore::disclaimerURL() + TQString WebQueryIEEExplore::disclaimerURL() { return "http://ieeexplore.ieee.org/guide/g_oview_faq.jsp"; } @@ -91,18 +91,18 @@ namespace KBibTeX m_arnumList.clear(); m_numMaxHits = min( 50, m_widget->spinBoxMaxHits->value() ); setNumStages( m_numMaxHits + 1 ); - QString searchTerm = m_widget->lineEditQuery->text().stripWhiteSpace().replace( '$', "" ); + TQString searchTerm = m_widget->lineEditQuery->text().stripWhiteSpace().replace( '$', "" ); if ( searchTerm.isEmpty() ) { setEndSearch( WebQuery::statusInvalidQuery ); return; } - QString category = "metadata"; - KURL url = KURL( QString( "http://ieeexplore.ieee.org/search/freesearchresult.jsp?queryText=" ).append( searchTerm.replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ) ).append( "+%3Cin%3E+" ).append( category ).append( "&ResultCount=" ).append( QString::number( m_numMaxHits ) ).append( "&ResultStart=0" ) ); + TQString category = "metadata"; + KURL url = KURL( TQString( "http://ieeexplore.ieee.org/search/freesearchresult.jsp?queryText=" ).append( searchTerm.replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ) ).append( "+%3Cin%3E+" ).append( category ).append( "&ResultCount=" ).append( TQString::number( m_numMaxHits ) ).append( "&ResultStart=0" ) ); - QString completeText = downloadHTML( url ); - if ( completeText != QString::null && !m_aborted ) + TQString completeText = downloadHTML( url ); + if ( completeText != TQString::null && !m_aborted ) { if ( completeText.find( "You have entered an invalid search" ) > -1 ) { @@ -150,10 +150,10 @@ namespace KBibTeX } else if ( !m_aborted ) { - QString message = KIO::NetAccess::lastErrorString(); + TQString message = KIO::NetAccess::lastErrorString(); if ( message.isEmpty() ) message.prepend( '\n' ); - message.prepend( QString( i18n( "Querying database '%1' failed." ) ).arg( title() ) ); + message.prepend( TQString( i18n( "Querying database '%1' failed." ) ).arg( title() ) ); KMessageBox::error( m_parent, message ); setEndSearch( WebQuery::statusError ); } @@ -171,23 +171,23 @@ namespace KBibTeX m_arnumList.remove( m_arnumList.begin() ); m_incomingData = ""; - QString data = "dlSelect=cite&fileFormate=BibTex&arnumber=%3Carnumber%3E" + QString::number( arnum ) + "%3C%2Farnumber%3E&Submit=Download"; + TQString data = "dlSelect=cite&fileFormate=BibTex&arnumber=%3Carnumber%3E" + TQString::number( arnum ) + "%3C%2Farnumber%3E&Submit=Download"; KIO::TransferJob *job = KIO::http_post( m_risURL, data.utf8(), false ); job->addMetaData( "content-type", "Content-Type: application/x-www-form-urlencoded" ); - connect( job, SIGNAL( data( KIO::Job *, const QByteArray & ) ), this, SLOT( slotData( KIO::Job *, const QByteArray & ) ) ); + connect( job, SIGNAL( data( KIO::Job *, const TQByteArray & ) ), this, SLOT( slotData( KIO::Job *, const TQByteArray & ) ) ); connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotResult( KIO::Job * ) ) ); } - void WebQueryIEEExplore::slotData( KIO::Job *, const QByteArray &data ) + void WebQueryIEEExplore::slotData( KIO::Job *, const TQByteArray &data ) { if ( data.size() > 0 ) - m_incomingData.append( QCString( data, data.size() + 1 ) ); + m_incomingData.append( TQCString( data, data.size() + 1 ) ); } void WebQueryIEEExplore::slotResult( KIO::Job *job ) { - QRegExp m_date( "^(((\\d{1,2}(-\\d{1,2}))\\s+)?(([A-Z][a-z]{2,3})(/([A-Z][a-z]{2,3}))?)\\.?\\s+)?(\\d{4})$" ); + TQRegExp m_date( "^(((\\d{1,2}(-\\d{1,2}))\\s+)?(([A-Z][a-z]{2,3})(/([A-Z][a-z]{2,3}))?)\\.?\\s+)?(\\d{4})$" ); if ( job->error() ) { job->showErrorDialog(); @@ -235,8 +235,8 @@ namespace KBibTeX field->setValue( new BibTeX::Value( m_date.cap( 3 ), true ) ); } - QString newMonth = QString::null; - if ( !m_date.cap( 1 ).isNull() && !m_date.cap( 1 ).isEmpty() && ( newMonth = parseMonth( m_date.cap( 1 ) ) ) != QString::null ) + TQString newMonth = TQString::null; + if ( !m_date.cap( 1 ).isNull() && !m_date.cap( 1 ).isEmpty() && ( newMonth = parseMonth( m_date.cap( 1 ) ) ) != TQString::null ) { BibTeX::EntryField * field = entry->getField( BibTeX::EntryField::ftMonth ); if ( field == NULL ) @@ -247,8 +247,8 @@ namespace KBibTeX field->setValue( new BibTeX::Value( newMonth, true ) ); - newMonth = QString::null; - if ( !m_date.cap( 2 ).isNull() && !m_date.cap( 2 ).isEmpty() && ( newMonth = parseMonth( m_date.cap( 2 ) ) ) != QString::null ) + newMonth = TQString::null; + if ( !m_date.cap( 2 ).isNull() && !m_date.cap( 2 ).isEmpty() && ( newMonth = parseMonth( m_date.cap( 2 ) ) ) != TQString::null ) { field->value()->items.append( new BibTeX::PlainText( "/" ) ); field->value()->items.append( new BibTeX::MacroKey( newMonth ) ); @@ -256,11 +256,11 @@ namespace KBibTeX } } - QString WebQueryIEEExplore::parseMonth( const QString &month ) + TQString WebQueryIEEExplore::parseMonth( const TQString &month ) { for ( unsigned int i = 0; i < sizeof( BibTeX::MonthsTriple ) / sizeof( BibTeX::MonthsTriple[0] ); ++i ) if ( month.startsWith( BibTeX::MonthsTriple[i], false ) ) return BibTeX::MonthsTriple[i]; - return QString::null; + return TQString::null; } } |