diff options
Diffstat (limited to 'src/webquerysciencedirect.cpp')
-rw-r--r-- | src/webquerysciencedirect.cpp | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/src/webquerysciencedirect.cpp b/src/webquerysciencedirect.cpp index 152d05b..2b62da1 100644 --- a/src/webquerysciencedirect.cpp +++ b/src/webquerysciencedirect.cpp @@ -17,11 +17,11 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include <qlayout.h> -#include <qlabel.h> -#include <qspinbox.h> -#include <qbuffer.h> -#include <qfile.h> +#include <ntqlayout.h> +#include <ntqlabel.h> +#include <ntqspinbox.h> +#include <ntqbuffer.h> +#include <ntqfile.h> #include <kpushbutton.h> #include <klocale.h> @@ -37,35 +37,35 @@ namespace KBibTeX { - WebQueryScienceDirectWidget::WebQueryScienceDirectWidget( QWidget *parent, const char *name ) + WebQueryScienceDirectWidget::WebQueryScienceDirectWidget( TQWidget *parent, const char *name ) : WebQueryWidget( parent, name ) { init(); - QString allValues; + TQString allValues; Settings *settings = Settings::self(); - QString value = settings->getWebQueryDefault( "ScienceDirect_title" ); - value = value == QString::null ? "" : value; + TQString value = settings->getWebQueryDefault( "ScienceDirect_title" ); + value = value == TQString::null ? "" : value; lineEditQuery->setText( value ); allValues += value; value = settings->getWebQueryDefault( "ScienceDirect_author" ); - value = value == QString::null ? "" : value; + value = value == TQString::null ? "" : value; lineEditAuthor->setText( value ); allValues += value; value = settings->getWebQueryDefault( "ScienceDirect_journal" ); - value = value == QString::null ? "" : value; + value = value == TQString::null ? "" : value; lineEditJournal->setText( value ); allValues += value; value = settings->getWebQueryDefault( "ScienceDirect_volume" ); - value = value == QString::null ? "" : value; + value = value == TQString::null ? "" : value; lineEditVolume->setText( value ); allValues += value; value = settings->getWebQueryDefault( "ScienceDirect_issue" ); - value = value == QString::null ? "" : value; + value = value == TQString::null ? "" : value; lineEditIssue->setText( value ); allValues += value; value = settings->getWebQueryDefault( "ScienceDirect_page" ); - value = value == QString::null ? "" : value; + value = value == TQString::null ? "" : value; lineEditPage->setText( value ); allValues += value; @@ -74,65 +74,65 @@ namespace KBibTeX void WebQueryScienceDirectWidget::init() { - QVBoxLayout *vLayout = new QVBoxLayout( this, 0, KDialog::spacingHint() ); + TQVBoxLayout *vLayout = new TQVBoxLayout( this, 0, KDialog::spacingHint() ); - QHBoxLayout *hLayout = new QHBoxLayout( ); + TQHBoxLayout *hLayout = new TQHBoxLayout( ); vLayout->addLayout( hLayout ); KPushButton *clearSearchText = new KPushButton( this ); - clearSearchText->setIconSet( QIconSet( SmallIcon( "locationbar_erase" ) ) ); + clearSearchText->setIconSet( TQIconSet( SmallIcon( "locationbar_erase" ) ) ); hLayout->addWidget( clearSearchText ); - QLabel *label = new QLabel( i18n( "Title, abstract, keywords:" ), this ); + TQLabel *label = new TQLabel( i18n( "Title, abstract, keywords:" ), this ); hLayout->addWidget( label ); lineEditQuery = new KLineEdit( this ); KCompletion *completionQuery = lineEditQuery->completionObject(); hLayout->addWidget( lineEditQuery ); label->setBuddy( lineEditQuery ); connect( clearSearchText, SIGNAL( clicked() ), lineEditQuery, SLOT( clear() ) ); - connect( lineEditQuery, SIGNAL( textChanged( const QString& ) ), this, SLOT( slotTextChangedSD( ) ) ); + connect( lineEditQuery, SIGNAL( textChanged( const TQString& ) ), this, SLOT( slotTextChangedSD( ) ) ); hLayout->setStretchFactor( lineEditQuery, 7 ); connect( lineEditQuery, SIGNAL( returnPressed() ), this, SIGNAL( startSearch() ) ); - connect( lineEditQuery, SIGNAL( returnPressed( const QString& ) ), completionQuery, SLOT( addItem( const QString& ) ) ); + connect( lineEditQuery, SIGNAL( returnPressed( const TQString& ) ), completionQuery, SLOT( addItem( const TQString& ) ) ); - hLayout = new QHBoxLayout( ); + hLayout = new TQHBoxLayout( ); vLayout->addLayout( hLayout ); KPushButton *clearAuthor = new KPushButton( this ); - clearAuthor->setIconSet( QIconSet( SmallIcon( "locationbar_erase" ) ) ); + clearAuthor->setIconSet( TQIconSet( SmallIcon( "locationbar_erase" ) ) ); hLayout->addWidget( clearAuthor ); - label = new QLabel( i18n( "Author:" ), this ); + label = new TQLabel( i18n( "Author:" ), this ); hLayout->addWidget( label ); lineEditAuthor = new KLineEdit( this ); completionQuery = lineEditAuthor->completionObject(); hLayout->addWidget( lineEditAuthor ); label->setBuddy( lineEditAuthor ); connect( clearAuthor, SIGNAL( clicked() ), lineEditAuthor, SLOT( clear() ) ); - connect( lineEditAuthor, SIGNAL( textChanged( const QString& ) ), this, SLOT( slotTextChangedSD( ) ) ); + connect( lineEditAuthor, SIGNAL( textChanged( const TQString& ) ), this, SLOT( slotTextChangedSD( ) ) ); hLayout->setStretchFactor( lineEditAuthor, 7 ); connect( lineEditAuthor, SIGNAL( returnPressed() ), this, SIGNAL( startSearch() ) ); - connect( lineEditAuthor, SIGNAL( returnPressed( const QString& ) ), completionQuery, SLOT( addItem( const QString& ) ) ); + connect( lineEditAuthor, SIGNAL( returnPressed( const TQString& ) ), completionQuery, SLOT( addItem( const TQString& ) ) ); hLayout->addSpacing( KDialog::spacingHint() * 2 ); KPushButton *clearJournal = new KPushButton( this ); - clearJournal->setIconSet( QIconSet( SmallIcon( "locationbar_erase" ) ) ); + clearJournal->setIconSet( TQIconSet( SmallIcon( "locationbar_erase" ) ) ); hLayout->addWidget( clearJournal ); - label = new QLabel( i18n( "Journal/book title:" ), this ); + label = new TQLabel( i18n( "Journal/book title:" ), this ); hLayout->addWidget( label ); lineEditJournal = new KLineEdit( this ); completionQuery = lineEditJournal->completionObject(); hLayout->addWidget( lineEditJournal ); label->setBuddy( lineEditJournal ); connect( clearJournal, SIGNAL( clicked() ), lineEditJournal, SLOT( clear() ) ); - connect( lineEditJournal, SIGNAL( textChanged( const QString& ) ), this, SLOT( slotTextChangedSD( ) ) ); + connect( lineEditJournal, SIGNAL( textChanged( const TQString& ) ), this, SLOT( slotTextChangedSD( ) ) ); hLayout->setStretchFactor( lineEditJournal, 4 ); connect( lineEditJournal, SIGNAL( returnPressed() ), this, SIGNAL( startSearch() ) ); - connect( lineEditJournal, SIGNAL( returnPressed( const QString& ) ), completionQuery, SLOT( addItem( const QString& ) ) ); + connect( lineEditJournal, SIGNAL( returnPressed( const TQString& ) ), completionQuery, SLOT( addItem( const TQString& ) ) ); - hLayout = new QHBoxLayout( ); + hLayout = new TQHBoxLayout( ); vLayout->addLayout( hLayout ); - label = new QLabel( i18n( "Volume:" ), this ); + label = new TQLabel( i18n( "Volume:" ), this ); hLayout->addWidget( label ); lineEditVolume = new KLineEdit( this ); hLayout->addWidget( lineEditVolume ); @@ -142,7 +142,7 @@ namespace KBibTeX hLayout->addSpacing( KDialog::spacingHint() * 2 ); - label = new QLabel( i18n( "Issue:" ), this ); + label = new TQLabel( i18n( "Issue:" ), this ); hLayout->addWidget( label ); lineEditIssue = new KLineEdit( this ); hLayout->addWidget( lineEditIssue ); @@ -152,7 +152,7 @@ namespace KBibTeX hLayout->addSpacing( KDialog::spacingHint() * 2 ); - label = new QLabel( i18n( "Page:" ), this ); + label = new TQLabel( i18n( "Page:" ), this ); hLayout->addWidget( label ); lineEditPage = new KLineEdit( this ); hLayout->addWidget( lineEditPage ); @@ -162,9 +162,9 @@ namespace KBibTeX hLayout->addSpacing( KDialog::spacingHint() * 2 ); - label = new QLabel( i18n( "&Number of results:" ), this ); + label = new TQLabel( i18n( "&Number of results:" ), this ); hLayout->addWidget( label ); - spinBoxMaxHits = new QSpinBox( 1, 100, 1, this ); + spinBoxMaxHits = new TQSpinBox( 1, 100, 1, this ); spinBoxMaxHits->setValue( 10 ); hLayout->addWidget( spinBoxMaxHits ); hLayout->setStretchFactor( spinBoxMaxHits, 1 ); @@ -174,11 +174,11 @@ namespace KBibTeX void WebQueryScienceDirectWidget::slotTextChangedSD() { - QString text = lineEditQuery->text().stripWhiteSpace().append( lineEditAuthor->text().stripWhiteSpace() ).append( lineEditJournal->text().stripWhiteSpace() ).replace( '$', "" ); + TQString text = lineEditQuery->text().stripWhiteSpace().append( lineEditAuthor->text().stripWhiteSpace() ).append( lineEditJournal->text().stripWhiteSpace() ).replace( '$', "" ); emit enableSearch( !text.isEmpty() ); } - WebQueryScienceDirect::WebQueryScienceDirect( QWidget* parent ): WebQuery( parent ) + WebQueryScienceDirect::WebQueryScienceDirect( TQWidget* parent ): WebQuery( parent ) { m_importer = new BibTeX::FileImporterBibTeX( FALSE ); m_importer->setIgnoreComments( TRUE ); @@ -191,17 +191,17 @@ namespace KBibTeX delete m_importer; } - QString WebQueryScienceDirect::title() + TQString WebQueryScienceDirect::title() { return i18n( "ScienceDirect" ); } - QString WebQueryScienceDirect::disclaimer() + TQString WebQueryScienceDirect::disclaimer() { return i18n( "About ScienceDirect" ); } - QString WebQueryScienceDirect::disclaimerURL() + TQString WebQueryScienceDirect::disclaimerURL() { return "http://info.sciencedirect.com/"; } @@ -222,12 +222,12 @@ namespace KBibTeX settings->setWebQueryDefault( "ScienceDirect_issue", m_widget->lineEditIssue->text() ); settings->setWebQueryDefault( "ScienceDirect_page", m_widget->lineEditPage->text() ); - QString tak = m_widget->lineEditQuery->text().stripWhiteSpace().replace( '$', "" ).replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ); - QString author = m_widget->lineEditAuthor->text().stripWhiteSpace().replace( '$', "" ).replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ); - QString journal = m_widget->lineEditJournal->text().stripWhiteSpace().replace( '$', "" ).replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ); - QString volume = m_widget->lineEditVolume->text().stripWhiteSpace().replace( '$', "" ).replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ); - QString issue = m_widget->lineEditIssue->text().stripWhiteSpace().replace( '$', "" ).replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ); - QString page = m_widget->lineEditPage->text().stripWhiteSpace().replace( '$', "" ).replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ); + TQString tak = m_widget->lineEditQuery->text().stripWhiteSpace().replace( '$', "" ).replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ); + TQString author = m_widget->lineEditAuthor->text().stripWhiteSpace().replace( '$', "" ).replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ); + TQString journal = m_widget->lineEditJournal->text().stripWhiteSpace().replace( '$', "" ).replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ); + TQString volume = m_widget->lineEditVolume->text().stripWhiteSpace().replace( '$', "" ).replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ); + TQString issue = m_widget->lineEditIssue->text().stripWhiteSpace().replace( '$', "" ).replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ); + TQString page = m_widget->lineEditPage->text().stripWhiteSpace().replace( '$', "" ).replace( "%", "%25" ).replace( "+", "%2B" ).replace( " ", "%20" ).replace( "#", "%23" ).replace( "&", "%26" ).replace( "?", "%3F" ); if ( tak.isEmpty() && author.isEmpty() && journal.isEmpty() ) { @@ -248,13 +248,13 @@ namespace KBibTeX bool WebQueryScienceDirect::getStartPage() { - QString startPage = downloadHTML( KURL( "http://www.sciencedirect.com/" ) ); + TQString startPage = downloadHTML( KURL( "http://www.sciencedirect.com/" ) ); if ( m_aborted ) { setEndSearch( WebQuery::statusAborted ); return false; } - else if ( startPage == QString::null ) + else if ( startPage == TQString::null ) { setEndSearch( WebQuery::statusError ); return false; @@ -278,16 +278,16 @@ namespace KBibTeX return true; } - bool WebQueryScienceDirect::getResultPage( const QString &tak, const QString &author, const QString &journal, const QString &volume, const QString &issue, const QString &page ) + bool WebQueryScienceDirect::getResultPage( const TQString &tak, const TQString &author, const TQString &journal, const TQString &volume, const TQString &issue, const TQString &page ) { - KURL url = KURL( QString( "http://www.sciencedirect.com/science?_ob=QuickSearchURL&_method=submitForm&qs_tak=" ).append( tak ).append( "&qs_author=" ).append( author ).append( "&qs_title=" ).append( journal ).append( "&qs_vol=" ).append( volume ).append( "&qs_issue=" ).append( issue ).append( "&qs_pages=" ).append( page ).append( "&_acct=" ).append( m_account ).append( "&md5=" ).append( m_md5 ).append( "&x=0&y=0&=Submit" ) ); - QString resultPage = downloadHTML( url ); + KURL url = KURL( TQString( "http://www.sciencedirect.com/science?_ob=QuickSearchURL&_method=submitForm&qs_tak=" ).append( tak ).append( "&qs_author=" ).append( author ).append( "&qs_title=" ).append( journal ).append( "&qs_vol=" ).append( volume ).append( "&qs_issue=" ).append( issue ).append( "&qs_pages=" ).append( page ).append( "&_acct=" ).append( m_account ).append( "&md5=" ).append( m_md5 ).append( "&x=0&y=0&=Submit" ) ); + TQString resultPage = downloadHTML( url ); if ( m_aborted ) { setEndSearch( WebQuery::statusAborted ); return false; } - else if ( resultPage == QString::null ) + else if ( resultPage == TQString::null ) { setEndSearch( WebQuery::statusError ); return false; @@ -321,21 +321,21 @@ namespace KBibTeX bool WebQueryScienceDirect::getArticleListPage() { - KURL url = KURL( QString( "http://www.sciencedirect.com/science?_ob=ArticleListURL&_method=tag&refSource=search&_st=13&_chunk=0&NEXT_LIST=1&view=c&md5=%1&_ArticleListID=%2&sisr_search=&sisrterm=&export=Export+Citations&count=%3" ).arg( m_md5 ).arg( m_articleListID ).arg( m_widget->spinBoxMaxHits->value() ) ); - QString articleListPage = downloadHTML( url ); + KURL url = KURL( TQString( "http://www.sciencedirect.com/science?_ob=ArticleListURL&_method=tag&refSource=search&_st=13&_chunk=0&NEXT_LIST=1&view=c&md5=%1&_ArticleListID=%2&sisr_search=&sisrterm=&export=Export+Citations&count=%3" ).arg( m_md5 ).arg( m_articleListID ).arg( m_widget->spinBoxMaxHits->value() ) ); + TQString articleListPage = downloadHTML( url ); if ( m_aborted ) { setEndSearch( WebQuery::statusAborted ); return false; } - else if ( articleListPage == QString::null ) + else if ( articleListPage == TQString::null ) { setEndSearch( WebQuery::statusError ); return false; } else if ( articleListPage.find( "subscription does not entitle" ) >= 0 ) { - qWarning( "Your subscription does not entitle you to access the download feature of ScienceDirect" ); + tqWarning( "Your subscription does not entitle you to access the download feature of ScienceDirect" ); setEndSearch( WebQuery::statusInsufficientPermissions ); return false; } @@ -361,20 +361,20 @@ namespace KBibTeX bool WebQueryScienceDirect::getRISFile() { m_incomingData = ""; - QString data = QString( "_ob=DownloadURL&_method=finish&_acct=%1&_userid=%2&_ArticleListID=%3&count=10&md5=%4&JAVASCRIPT_ON=&format=cite&citation-type=RIS&RETURN_URL=http://www.sciencedirect.com/science/home" ).arg( m_account ).arg( m_userid ).arg( m_articleListID ).arg( m_md5 ); + TQString data = TQString( "_ob=DownloadURL&_method=finish&_acct=%1&_userid=%2&_ArticleListID=%3&count=10&md5=%4&JAVASCRIPT_ON=&format=cite&citation-type=RIS&RETURN_URL=http://www.sciencedirect.com/science/home" ).arg( m_account ).arg( m_userid ).arg( m_articleListID ).arg( m_md5 ); KURL url = KURL( "http://www.sciencedirect.com/science" ); KIO::TransferJob *job = KIO::http_post( url, 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 * ) ) ); return true; } - void WebQueryScienceDirect::slotData( KIO::Job *, const QByteArray &data ) + void WebQueryScienceDirect::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 WebQueryScienceDirect::slotResult( KIO::Job *job ) @@ -386,11 +386,11 @@ namespace KBibTeX } BibTeX::FileImporterRIS importer; - QBuffer buffer; + TQBuffer buffer; buffer.open( IO_WriteOnly ); - QTextStream ts( &buffer ); - ts.setEncoding( QTextStream::UnicodeUTF8 ); + TQTextStream ts( &buffer ); + ts.setEncoding( TQTextStream::UnicodeUTF8 ); ts << m_incomingData << endl; buffer.close(); |