summaryrefslogtreecommitdiffstats
path: root/lib/compatibility/knewstuff/engine.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:54:04 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:54:04 +0000
commitdc6b8e72fed2586239e3514819238c520636c9d9 (patch)
tree88b200df0a0b7fab9d6f147596173556f1ed9a13 /lib/compatibility/knewstuff/engine.cpp
parent6927d4436e54551917f600b706a8d6109e49de1c (diff)
downloadtdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.tar.gz
tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1157656 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/compatibility/knewstuff/engine.cpp')
-rw-r--r--lib/compatibility/knewstuff/engine.cpp94
1 files changed, 47 insertions, 47 deletions
diff --git a/lib/compatibility/knewstuff/engine.cpp b/lib/compatibility/knewstuff/engine.cpp
index c141aeeb..ace0b75e 100644
--- a/lib/compatibility/knewstuff/engine.cpp
+++ b/lib/compatibility/knewstuff/engine.cpp
@@ -18,9 +18,9 @@
Boston, MA 02110-1301, USA.
*/
-#include <qcstring.h>
-#include <qdom.h>
-#include <qfileinfo.h>
+#include <tqcstring.h>
+#include <tqdom.h>
+#include <tqfileinfo.h>
#include <kapplication.h>
#include <kdebug.h>
@@ -39,8 +39,8 @@
using namespace KNS;
-Engine::Engine( KNewStuff *newStuff, const QString &type,
- QWidget *parentWidget ) :
+Engine::Engine( KNewStuff *newStuff, const TQString &type,
+ TQWidget *parentWidget ) :
mParentWidget( parentWidget ), mDownloadDialog( 0 ),
mUploadDialog( 0 ), mProviderDialog( 0 ), mUploadProvider( 0 ),
mNewStuff( newStuff ), mType( type )
@@ -50,8 +50,8 @@ Engine::Engine( KNewStuff *newStuff, const QString &type,
mNewStuffList.setAutoDelete( true );
}
-Engine::Engine( KNewStuff *newStuff, const QString &type,
- const QString &providerList, QWidget *parentWidget ) :
+Engine::Engine( KNewStuff *newStuff, const TQString &type,
+ const TQString &providerList, TQWidget *parentWidget ) :
mParentWidget( parentWidget ),
mDownloadDialog( 0 ), mUploadDialog( 0 ),
mProviderDialog( 0 ), mUploadProvider( 0 ),
@@ -75,8 +75,8 @@ void Engine::download()
kdDebug(5850) << "Engine::download()" << endl;
connect( mProviderLoader,
- SIGNAL( providersLoaded( Provider::List * ) ),
- SLOT( getMetaInformation( Provider::List * ) ) );
+ TQT_SIGNAL( providersLoaded( Provider::List * ) ),
+ TQT_SLOT( getMetaInformation( Provider::List * ) ) );
mProviderLoader->load( mType, mProviderList );
}
@@ -97,25 +97,25 @@ void Engine::getMetaInformation( Provider::List *providers )
if ( p->downloadUrl().isEmpty() ) continue;
KIO::TransferJob *job = KIO::get( p->downloadUrl() );
- connect( job, SIGNAL( result( KIO::Job * ) ),
- SLOT( slotNewStuffJobResult( KIO::Job * ) ) );
- connect( job, SIGNAL( data( KIO::Job *, const QByteArray & ) ),
- SLOT( slotNewStuffJobData( KIO::Job *, const QByteArray & ) ) );
+ connect( job, TQT_SIGNAL( result( KIO::Job * ) ),
+ TQT_SLOT( slotNewStuffJobResult( KIO::Job * ) ) );
+ connect( job, TQT_SIGNAL( data( KIO::Job *, const TQByteArray & ) ),
+ TQT_SLOT( slotNewStuffJobData( KIO::Job *, const TQByteArray & ) ) );
mNewStuffJobData.insert( job, "" );
mProviderJobs[ job ] = p;
}
}
-void Engine::slotNewStuffJobData( KIO::Job *job, const QByteArray &data )
+void Engine::slotNewStuffJobData( KIO::Job *job, const TQByteArray &data )
{
if ( data.isEmpty() ) return;
kdDebug(5850) << "Engine:slotNewStuffJobData()" << endl;
- QCString str( data, data.size() + 1 );
+ TQCString str( data, data.size() + 1 );
- mNewStuffJobData[ job ].append( QString::fromUtf8( str ) );
+ mNewStuffJobData[ job ].append( TQString::fromUtf8( str ) );
}
void Engine::slotNewStuffJobResult( KIO::Job *job )
@@ -124,25 +124,25 @@ void Engine::slotNewStuffJobResult( KIO::Job *job )
kdDebug(5850) << "Error downloading new stuff descriptions." << endl;
job->showErrorDialog( mParentWidget );
} else {
- QString knewstuffDoc = mNewStuffJobData[ job ];
+ TQString knewstuffDoc = mNewStuffJobData[ job ];
kdDebug(5850) << "---START---" << endl << knewstuffDoc << "---END---" << endl;
mDownloadDialog->addProvider( mProviderJobs[ job ] );
- QDomDocument doc;
+ TQDomDocument doc;
if ( !doc.setContent( knewstuffDoc ) ) {
kdDebug(5850) << "Error parsing knewstuff.xml." << endl;
return;
} else {
- QDomElement knewstuff = doc.documentElement();
+ TQDomElement knewstuff = doc.documentElement();
if ( knewstuff.isNull() ) {
kdDebug(5850) << "No document in knewstuffproviders.xml." << endl;
} else {
- QDomNode p;
+ TQDomNode p;
for ( p = knewstuff.firstChild(); !p.isNull(); p = p.nextSibling() ) {
- QDomElement stuff = p.toElement();
+ TQDomElement stuff = p.toElement();
if ( stuff.tagName() != "stuff" ) continue;
if ( stuff.attribute("type", mType) != mType ) continue;
@@ -193,8 +193,8 @@ void Engine::download( Entry *entry )
kdDebug(5850) << " DESTINATION: " << destination.url() << endl;
KIO::FileCopyJob *job = KIO::file_copy( source, destination, -1, true );
- connect( job, SIGNAL( result( KIO::Job * ) ),
- SLOT( slotDownloadJobResult( KIO::Job * ) ) );
+ connect( job, TQT_SIGNAL( result( KIO::Job * ) ),
+ TQT_SLOT( slotDownloadJobResult( KIO::Job * ) ) );
}
void Engine::slotDownloadJobResult( KIO::Job *job )
@@ -217,14 +217,14 @@ void Engine::slotDownloadJobResult( KIO::Job *job )
}
}
-void Engine::upload(const QString &fileName, const QString &previewName )
+void Engine::upload(const TQString &fileName, const TQString &previewName )
{
mUploadFile = fileName;
mPreviewFile = previewName;
connect( mProviderLoader,
- SIGNAL( providersLoaded( Provider::List * ) ),
- SLOT( selectUploadProvider( Provider::List * ) ) );
+ TQT_SIGNAL( providersLoaded( Provider::List * ) ),
+ TQT_SLOT( selectUploadProvider( Provider::List * ) ) );
mProviderLoader->load( mType );
}
@@ -264,7 +264,7 @@ void Engine::upload( Entry *entry )
{
if ( mUploadFile.isNull()) {
mUploadFile = entry->fullName();
- mUploadFile = locateLocal( "data", QString(kapp->instanceName()) + "/upload/" + mUploadFile );
+ mUploadFile = locateLocal( "data", TQString(kapp->instanceName()) + "/upload/" + mUploadFile );
if ( !mNewStuff->createUploadFile( mUploadFile ) ) {
KMessageBox::error( mParentWidget, i18n("Unable to create file to upload.") );
@@ -273,8 +273,8 @@ void Engine::upload( Entry *entry )
}
}
- QString lang = entry->langs().first();
- QFileInfo fi( mUploadFile );
+ TQString lang = entry->langs().first();
+ TQFileInfo fi( mUploadFile );
entry->setPayload( KURL::fromPathOrURL( fi.fileName() ), lang );
if ( !createMetaFile( entry ) ) {
@@ -282,7 +282,7 @@ void Engine::upload( Entry *entry )
return;
}
- QString text = i18n("The files to be uploaded have been created at:\n");
+ TQString text = i18n("The files to be uploaded have been created at:\n");
text.append( i18n("Data file: %1\n").arg( mUploadFile) );
if (!mPreviewFile.isEmpty()) {
text.append( i18n("Preview image: %1\n").arg( mPreviewFile) );
@@ -291,7 +291,7 @@ void Engine::upload( Entry *entry )
text.append( i18n("Those files can now be uploaded.\n") );
text.append( i18n("Beware that any people might have access to them at any time.") );
- QString caption = i18n("Upload Files");
+ TQString caption = i18n("Upload Files");
if ( mUploadProvider->noUpload() ) {
KURL noUploadUrl = mUploadProvider->noUploadUrl();
@@ -314,8 +314,8 @@ void Engine::upload( Entry *entry )
destination.setFileName( fi.fileName() );
KIO::FileCopyJob *job = KIO::file_copy( KURL::fromPathOrURL( mUploadFile ), destination );
- connect( job, SIGNAL( result( KIO::Job * ) ),
- SLOT( slotUploadPayloadJobResult( KIO::Job * ) ) );
+ connect( job, TQT_SIGNAL( result( KIO::Job * ) ),
+ TQT_SLOT( slotUploadPayloadJobResult( KIO::Job * ) ) );
} else {
emit uploadFinished( false );
}
@@ -324,10 +324,10 @@ void Engine::upload( Entry *entry )
bool Engine::createMetaFile( Entry *entry )
{
- QDomDocument doc("knewstuff");
+ TQDomDocument doc("knewstuff");
doc.appendChild( doc.createProcessingInstruction(
"xml", "version=\"1.0\" encoding=\"UTF-8\"" ) );
- QDomElement de = doc.createElement("knewstuff");
+ TQDomElement de = doc.createElement("knewstuff");
doc.appendChild( de );
entry->setType(type());
@@ -338,17 +338,17 @@ bool Engine::createMetaFile( Entry *entry )
if ( mUploadMetaFile.isNull() ) {
mUploadMetaFile = entry->fullName() + ".meta";
- mUploadMetaFile = locateLocal( "data", QString(kapp->instanceName()) + "/upload/" + mUploadMetaFile );
+ mUploadMetaFile = locateLocal( "data", TQString(kapp->instanceName()) + "/upload/" + mUploadMetaFile );
}
- QFile f( mUploadMetaFile );
+ TQFile f( mUploadMetaFile );
if ( !f.open( IO_WriteOnly ) ) {
- mUploadMetaFile = QString::null;
+ mUploadMetaFile = TQString::null;
return false;
}
- QTextStream ts( &f );
- ts.setEncoding( QTextStream::UnicodeUTF8 );
+ TQTextStream ts( &f );
+ ts.setEncoding( TQTextStream::UnicodeUTF8 );
ts << doc.toString();
f.close();
@@ -370,14 +370,14 @@ void Engine::slotUploadPayloadJobResult( KIO::Job *job )
return;
}
- QFileInfo fi( mPreviewFile );
+ TQFileInfo fi( mPreviewFile );
KURL previewDestination = mUploadProvider->uploadUrl();
previewDestination.setFileName( fi.fileName() );
KIO::FileCopyJob *newJob = KIO::file_copy( KURL::fromPathOrURL( mPreviewFile ), previewDestination );
- connect( newJob, SIGNAL( result( KIO::Job * ) ),
- SLOT( slotUploadPreviewJobResult( KIO::Job * ) ) );
+ connect( newJob, TQT_SIGNAL( result( KIO::Job * ) ),
+ TQT_SLOT( slotUploadPreviewJobResult( KIO::Job * ) ) );
}
void Engine::slotUploadPreviewJobResult( KIO::Job *job )
@@ -389,19 +389,19 @@ void Engine::slotUploadPreviewJobResult( KIO::Job *job )
return;
}
- QFileInfo fi( mUploadMetaFile );
+ TQFileInfo fi( mUploadMetaFile );
KURL metaDestination = mUploadProvider->uploadUrl();
metaDestination.setFileName( fi.fileName() );
KIO::FileCopyJob *newJob = KIO::file_copy( KURL::fromPathOrURL( mUploadMetaFile ), metaDestination );
- connect( newJob, SIGNAL( result( KIO::Job * ) ),
- SLOT( slotUploadMetaJobResult( KIO::Job * ) ) );
+ connect( newJob, TQT_SIGNAL( result( KIO::Job * ) ),
+ TQT_SLOT( slotUploadMetaJobResult( KIO::Job * ) ) );
}
void Engine::slotUploadMetaJobResult( KIO::Job *job )
{
- mUploadMetaFile = QString::null;
+ mUploadMetaFile = TQString::null;
if ( job->error() ) {
kdDebug(5850) << "Error uploading new stuff metadata." << endl;
job->showErrorDialog( mParentWidget );