summaryrefslogtreecommitdiffstats
path: root/src/webqueryarxiv.cpp
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2013-06-29 12:56:53 +0200
committerSlávek Banko <[email protected]>2013-07-04 03:11:35 +0200
commit5f5e7c5455d52826b0bd50f64fcffb7695ce970d (patch)
treec8ee8792d3fb139365abbf70c2255f1e69d2aa34 /src/webqueryarxiv.cpp
parent251c9a439759c830d34c70683d0fc9454d703010 (diff)
downloadkbibtex-5f5e7c5455d52826b0bd50f64fcffb7695ce970d.tar.gz
kbibtex-5f5e7c5455d52826b0bd50f64fcffb7695ce970d.zip
Initial TQt conversion
Diffstat (limited to 'src/webqueryarxiv.cpp')
-rw-r--r--src/webqueryarxiv.cpp106
1 files changed, 53 insertions, 53 deletions
diff --git a/src/webqueryarxiv.cpp b/src/webqueryarxiv.cpp
index f24fa44..93261ad 100644
--- a/src/webqueryarxiv.cpp
+++ b/src/webqueryarxiv.cpp
@@ -17,9 +17,9 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#include <qfile.h>
-#include <qbuffer.h>
-#include <qspinbox.h>
+#include <ntqfile.h>
+#include <ntqbuffer.h>
+#include <ntqspinbox.h>
#include <klocale.h>
#include <klineedit.h>
@@ -33,19 +33,19 @@
namespace KBibTeX
{
- WebQueryArXivWidget::WebQueryArXivWidget( QWidget *parent, const char *name )
+ WebQueryArXivWidget::WebQueryArXivWidget( TQWidget *parent, const char *name )
: WebQueryWidget( parent, name )
{
init();
Settings *settings = Settings::self();
- QString value = settings->getWebQueryDefault( "ArXiv" );
- value = value == QString::null ? "" : value;
+ TQString value = settings->getWebQueryDefault( "ArXiv" );
+ value = value == TQString::null ? "" : value;
lineEditQuery->setText( value );
slotTextChanged( value, true );
}
- WebQueryArXiv::WebQueryArXiv( QWidget* parent )
+ WebQueryArXiv::WebQueryArXiv( TQWidget* parent )
: WebQuery( parent ), m_arXivServer( "www.arxiv.org" ),
/** examples:
@@ -117,17 +117,17 @@ namespace KBibTeX
delete m_importer;
}
- QString WebQueryArXiv::title()
+ TQString WebQueryArXiv::title()
{
return i18n( "arXiv" );
}
- QString WebQueryArXiv::disclaimer()
+ TQString WebQueryArXiv::disclaimer()
{
return i18n( "arXiv is an archive for preprints" );
}
- QString WebQueryArXiv::disclaimerURL()
+ TQString WebQueryArXiv::disclaimerURL()
{
return "http://www.arxiv.org/";
}
@@ -154,20 +154,20 @@ namespace KBibTeX
m_numberOfResults = m_widget->spinBoxMaxHits->value();
setNumStages( m_numberOfResults + 1 );
- QString searchTerm = m_widget->lineEditQuery->text().stripWhiteSpace().replace( '$', "" );
- QStringList queryWords = QStringList::split( QRegExp( "\\s+" ), searchTerm );
+ TQString searchTerm = m_widget->lineEditQuery->text().stripWhiteSpace().replace( '$', "" );
+ TQStringList queryWords = TQStringList::split( TQRegExp( "\\s+" ), searchTerm );
if ( searchTerm.isEmpty() || queryWords.size() == 0 )
{
setEndSearch( WebQuery::statusInvalidQuery );
return;
}
- QString query;
+ TQString query;
for ( unsigned int i = 0; i < queryWords.size() - 1; ++i )
query = query.append( "AND " ).append( queryWords[i] ).append( " " );
query.append( queryWords[queryWords.size()-1] );
- KURL url = KURL( QString( "http://www.arxiv.org/find/all/1/all:+%2/0/1/0/all/0/1?per_page=%1" ).arg( m_numberOfResults ).arg( query.replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ) ) );
+ KURL url = KURL( TQString( "http://www.arxiv.org/find/all/1/all:+%2/0/1/0/all/0/1?per_page=%1" ).arg( m_numberOfResults ).arg( query.replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ) ) );
m_currentJobMutex.lock();
KIO::Job *job = KIO::storedGet( url, FALSE, FALSE );
connect( job, SIGNAL( result( KIO::Job * ) ), this, SLOT( unlockJob( KIO::Job * ) ) );
@@ -185,13 +185,13 @@ namespace KBibTeX
{
enterNextStage();
- QBuffer data;
+ TQBuffer data;
data.open( IO_WriteOnly );
data.writeBlock( dynamic_cast<KIO::StoredTransferJob*>( job )->data() );
data.close();
data.open( IO_ReadOnly );
- QTextStream ts( &data );
- QString result = ts.read();
+ TQTextStream ts( &data );
+ TQString result = ts.read();
data.close();
int p = -1;
@@ -200,12 +200,12 @@ namespace KBibTeX
while ( !m_aborted && ( int ) m_totalHits < m_numberOfResults && ( p = result.find( "arXiv:", p + 1 ) ) >= 0 )
{
int p2 = result.find( "<", p + 2 );
- QString hit = result.mid( p + 6, p2 - p - 6 );
+ TQString hit = result.mid( p + 6, p2 - p - 6 );
++m_totalHits;
p = p2 + 1;
- KURL url = KURL( QString( "http://%2/abs/%1" ).arg( hit ).arg( m_arXivServer ) );
+ KURL url = KURL( TQString( "http://%2/abs/%1" ).arg( hit ).arg( m_arXivServer ) );
m_urls.append( url );
}
@@ -238,13 +238,13 @@ namespace KBibTeX
++m_receivedHits;
enterNextStage();
- QBuffer data;
+ TQBuffer data;
data.open( IO_WriteOnly );
data.writeBlock( dynamic_cast<KIO::StoredTransferJob*>( job )->data() );
data.close();
data.open( IO_ReadOnly );
- QTextStream ts( &data );
- QString result = BibTeX::EncoderXML::currentEncoderXML()->decode( ts.read() );
+ TQTextStream ts( &data );
+ TQString result = BibTeX::EncoderXML::currentEncoderXML()->decode( ts.read() );
data.close();
/** find id */
@@ -252,24 +252,24 @@ namespace KBibTeX
if ( p < 0 ) return;
int p2 = result.find( "<", p + 2 );
if ( p2 < 0 ) return;
- QString id = result.mid( p + 6, p2 - p - 6 );
+ TQString id = result.mid( p + 6, p2 - p - 6 );
/** find cite_as */
- QString citeas = "";
+ TQString citeas = "";
p = result.find( "Cite&nbsp;as", 0 );
p = result.find( ">arXiv:", p );
p2 = result.find( "</", p );
if ( p >= 0 && p2 >= 0 )
citeas = result.mid( p + 7, p2 - p - 7 );
- BibTeX::Entry * entry = new BibTeX::Entry( BibTeX::Entry::etMisc, citeas.isEmpty() ? ( id.isEmpty() ? QString( "arXiv" ).append( m_receivedHits ) : id ) : citeas );
+ BibTeX::Entry * entry = new BibTeX::Entry( BibTeX::Entry::etMisc, citeas.isEmpty() ? ( id.isEmpty() ? TQString( "arXiv" ).append( m_receivedHits ) : id ) : citeas );
/** find abstract */
p = result.find( "Abstract:</span>", 0 );
if ( p < 0 ) return;
p2 = result.find( "</blockq", p + 14 );
if ( p2 < 0 ) return;
- QString abstract = result.mid( p + 16, p2 - p - 16 ).replace( QRegExp( "\\s+" ), " " ).replace( QRegExp( "^\\s+|\\s+$" ), "" ).replace( QRegExp( "<[^>]+>" ), "" );
+ TQString abstract = result.mid( p + 16, p2 - p - 16 ).replace( TQRegExp( "\\s+" ), " " ).replace( TQRegExp( "^\\s+|\\s+$" ), "" ).replace( TQRegExp( "<[^>]+>" ), "" );
BibTeX::EntryField * field = new BibTeX::EntryField( BibTeX::EntryField::ftAbstract );
entry->addField( field );
field->setValue( new BibTeX::Value( abstract ) );
@@ -281,7 +281,7 @@ namespace KBibTeX
{
p = result.find( ">", p + 1 );
p2 = result.find( "<", p + 1 );
- QString author = result.mid( p + 1, p2 - p - 1 );
+ TQString author = result.mid( p + 1, p2 - p - 1 );
personContainer->persons.append( new BibTeX::Person( author ) );
}
if ( personContainer->persons.isEmpty() )
@@ -300,7 +300,7 @@ namespace KBibTeX
p2 = result.find( "<", p + 10 );
if ( p >= 0 && p2 >= 0 )
{
- QString title = result.mid( p + 13, p2 - p - 13 ).replace( QRegExp( "\\s+" ), " " ).replace( QRegExp( "^\\s+|\\s+$" ), "" );
+ TQString title = result.mid( p + 13, p2 - p - 13 ).replace( TQRegExp( "\\s+" ), " " ).replace( TQRegExp( "^\\s+|\\s+$" ), "" );
BibTeX::EntryField * field = new BibTeX::EntryField( BibTeX::EntryField::ftTitle );
entry->addField( field );
field->setValue( new BibTeX::Value( title ) );
@@ -310,7 +310,7 @@ namespace KBibTeX
p = result.find( "Submitted on", 0 );
while (( p2 = result.find( "last revised", p + 1 ) ) >= 0 )
p = p2;
- p2 = result.find( QRegExp( "\\d\\d\\d\\d" ), p );
+ p2 = result.find( TQRegExp( "\\d\\d\\d\\d" ), p );
bool ok = FALSE;
int year = result.mid( p2, 4 ).toInt( &ok );
if ( !ok ) year = 0;
@@ -318,12 +318,12 @@ namespace KBibTeX
{
BibTeX::EntryField * field = new BibTeX::EntryField( BibTeX::EntryField::ftYear );
entry->addField( field );
- field->setValue( new BibTeX::Value( QString::number( year ) ) );
+ field->setValue( new BibTeX::Value( TQString::number( year ) ) );
}
- p2 = result.find( QRegExp( "\\b[A-Z][a-z]{2}\\b" ), p );
+ p2 = result.find( TQRegExp( "\\b[A-Z][a-z]{2}\\b" ), p );
if ( p2 >= 0 )
{
- QString month = result.mid( p2, 3 ).lower();
+ TQString month = result.mid( p2, 3 ).lower();
BibTeX::EntryField * field = new BibTeX::EntryField( BibTeX::EntryField::ftMonth );
entry->addField( field );
BibTeX::Value *value = new BibTeX::Value();
@@ -336,7 +336,7 @@ namespace KBibTeX
p2 = result.find( "\"", p + 1 );
if ( p >= 0 && p2 >= 0 )
{
- QString doi = result.mid( p, p2 - p );
+ TQString doi = result.mid( p, p2 - p );
BibTeX::EntryField * field = new BibTeX::EntryField( BibTeX::EntryField::ftDoi );
entry->addField( field );
field->setValue( new BibTeX::Value( doi ) );
@@ -347,7 +347,7 @@ namespace KBibTeX
p2 = result.find( "</td>", p + 1 );
if ( p >= 0 && p2 >= 0 )
{
- QString keywords = result.mid( p + 31, p2 - p - 31 ).replace( QRegExp( "</?span[^>]*>" ), "" );
+ TQString keywords = result.mid( p + 31, p2 - p - 31 ).replace( TQRegExp( "</?span[^>]*>" ), "" );
BibTeX::EntryField * field = new BibTeX::EntryField( BibTeX::EntryField::ftKeywords );
entry->addField( field );
BibTeX::Value *value = new BibTeX::Value();
@@ -360,7 +360,7 @@ namespace KBibTeX
p2 = result.find( "</td>", p + 1 );
if ( p >= 0 && p2 >= 0 )
{
- QString acmclasses = result.mid( p + 34, p2 - p - 34 );
+ TQString acmclasses = result.mid( p + 34, p2 - p - 34 );
BibTeX::EntryField * field = new BibTeX::EntryField( "acm-classes" );
entry->addField( field );
field->setValue( new BibTeX::Value( acmclasses ) );
@@ -369,7 +369,7 @@ namespace KBibTeX
/** find versions */
for ( int v = 1; !m_aborted && v < 20; ++v )
{
- p = result.find( QString( ">[v%1]<" ).arg( v ), 0 );
+ p = result.find( TQString( ">[v%1]<" ).arg( v ), 0 );
if ( p < 0 ) break;
int p3 = result.findRev( "href=\"", p );
@@ -378,18 +378,18 @@ namespace KBibTeX
p2 = result.find( "\">", p3 );
if ( p2 >= 0 )
{
- QString url = result.mid( p3 + 6, p2 - p3 - 6 );
- BibTeX::EntryField * field = new BibTeX::EntryField( QString( "v%1url" ).arg( v ) );
+ TQString url = result.mid( p3 + 6, p2 - p3 - 6 );
+ BibTeX::EntryField * field = new BibTeX::EntryField( TQString( "v%1url" ).arg( v ) );
entry->addField( field );
- field->setValue( new BibTeX::Value( QString( "http://www.arxiv.org" ).append( url ) ) );
+ field->setValue( new BibTeX::Value( TQString( "http://www.arxiv.org" ).append( url ) ) );
}
}
p = result.find( "</b>", p + 1 );
p2 = result.find( "<br", p + 1 );
if ( p >= 0 && p2 >= 0 )
{
- QString version = result.mid( p + 5, p2 - p - 5 );
- BibTeX::EntryField * field = new BibTeX::EntryField( QString( "v%1descr" ).arg( v ) );
+ TQString version = result.mid( p + 5, p2 - p - 5 );
+ BibTeX::EntryField * field = new BibTeX::EntryField( TQString( "v%1descr" ).arg( v ) );
entry->addField( field );
field->setValue( new BibTeX::Value( version ) );
}
@@ -400,7 +400,7 @@ namespace KBibTeX
p2 = result.find( "</td>", p + 1 );
if ( p >= 0 && p2 >= 0 )
{
- QString techRepNr = result.mid( p + 36, p2 - p - 36 );
+ TQString techRepNr = result.mid( p + 36, p2 - p - 36 );
BibTeX::EntryField * field = new BibTeX::EntryField( BibTeX::EntryField::ftNumber );
entry->addField( field );
field->setValue( new BibTeX::Value( techRepNr ) );
@@ -412,15 +412,15 @@ namespace KBibTeX
p2 = result.find( "</td>", p + 1 );
if ( p >= 0 && p2 >= 0 )
{
- QString jref = result.mid( p + 27, p2 - p - 27 );
+ TQString jref = result.mid( p + 27, p2 - p - 27 );
jref.replace( "\n", " " );
- QString jTitle = "";
- QString jVol = "";
- QString jNo = "";
- QString jYear = "";
- QString jPage1 = "";
- QString jPage2 = "";
+ TQString jTitle = "";
+ TQString jVol = "";
+ TQString jNo = "";
+ TQString jYear = "";
+ TQString jPage1 = "";
+ TQString jPage2 = "";
// m_jourRef1( "^([a-zA-Z. ]+[a-zA-Z.])\\s*(\\d+)\\s+\\((\\d{4})\\)\\s+([0-9A-Z]+)(-([0-9A-Z]+))?$" )
if ( m_jourRef1.search( jref ) == 0 )
@@ -527,22 +527,22 @@ namespace KBibTeX
entry->deleteField( BibTeX::EntryField::ftPages );
BibTeX::EntryField * field = new BibTeX::EntryField( BibTeX::EntryField::ftPages );
entry->addField( field );
- QString text = jPage1;
+ TQString text = jPage1;
if ( !jPage2.isEmpty() ) text.append( "--" ).append( jPage2 );
field->setValue( new BibTeX::Value( text ) );
}
}
- if ( result.find( QRegExp( "Ph\\.?D\\.? Thesis", FALSE ), 0 ) >= 0 )
+ if ( result.find( TQRegExp( "Ph\\.?D\\.? Thesis", FALSE ), 0 ) >= 0 )
entry->setEntryType( BibTeX::Entry::etPhDThesis );
field = new BibTeX::EntryField( BibTeX::EntryField::ftURL );
entry->addField( field );
- field->setValue( new BibTeX::Value( QString( "http://arxiv.org/abs/%1" ).arg( id ) ) );
+ field->setValue( new BibTeX::Value( TQString( "http://arxiv.org/abs/%1" ).arg( id ) ) );
field = new BibTeX::EntryField( "pdf" );
entry->addField( field );
- field->setValue( new BibTeX::Value( QString( "http://arxiv.org/pdf/%1" ).arg( id ) ) );
+ field->setValue( new BibTeX::Value( TQString( "http://arxiv.org/pdf/%1" ).arg( id ) ) );
emit foundEntry( entry, false );