diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:51:49 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:51:49 +0000 |
commit | 4ae0c208b66e0f7954e194384464fe2d0a2c56dd (patch) | |
tree | b0a7cd1c184f0003c0292eb416ed27f674f9cc43 /kompare/libdiff2/komparemodellist.cpp | |
parent | 1964ea0fb4ab57493ca2ebb709c8d3b5395fd653 (diff) | |
download | tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.tar.gz tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1157652 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kompare/libdiff2/komparemodellist.cpp')
-rw-r--r-- | kompare/libdiff2/komparemodellist.cpp | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/kompare/libdiff2/komparemodellist.cpp b/kompare/libdiff2/komparemodellist.cpp index ac3c725a..db10f4c3 100644 --- a/kompare/libdiff2/komparemodellist.cpp +++ b/kompare/libdiff2/komparemodellist.cpp @@ -19,11 +19,11 @@ * * ***************************************************************************/ -#include <qfile.h> -#include <qdir.h> -#include <qregexp.h> -#include <qtextcodec.h> -#include <qvaluelist.h> +#include <tqfile.h> +#include <tqdir.h> +#include <tqregexp.h> +#include <tqtextcodec.h> +#include <tqvaluelist.h> #include <kaction.h> #include <kcharsets.h> @@ -46,8 +46,8 @@ using namespace Diff2; -KompareModelList::KompareModelList( DiffSettings* diffSettings, struct Kompare::Info& info, QObject* parent, const char* name ) - : QObject( parent, name ), +KompareModelList::KompareModelList( DiffSettings* diffSettings, struct Kompare::Info& info, TQObject* parent, const char* name ) + : TQObject( parent, name ), m_diffProcess( 0 ), m_diffSettings( diffSettings ), m_models( 0 ), @@ -59,33 +59,33 @@ KompareModelList::KompareModelList( DiffSettings* diffSettings, struct Kompare:: m_textCodec( 0 ) { m_applyDifference = new KAction( i18n("&Apply Difference"), "1rightarrow", Qt::Key_Space, - this, SLOT(slotActionApplyDifference()), + this, TQT_SLOT(slotActionApplyDifference()), (( KomparePart* )parent)->actionCollection(), "difference_apply" ); m_unApplyDifference = new KAction( i18n("Un&apply Difference"), "1leftarrow", Qt::Key_BackSpace, - this, SLOT(slotActionUnApplyDifference()), + this, TQT_SLOT(slotActionUnApplyDifference()), (( KomparePart* )parent)->actionCollection(), "difference_unapply" ); m_applyAll = new KAction( i18n("App&ly All"), "2rightarrow", Qt::CTRL + Qt::Key_A, - this, SLOT(slotActionApplyAllDifferences()), + this, TQT_SLOT(slotActionApplyAllDifferences()), (( KomparePart* )parent)->actionCollection(), "difference_applyall" ); m_unapplyAll = new KAction( i18n("&Unapply All"), "2leftarrow", Qt::CTRL + Qt::Key_U, - this, SLOT(slotActionUnapplyAllDifferences()), + this, TQT_SLOT(slotActionUnapplyAllDifferences()), (( KomparePart* )parent)->actionCollection(), "difference_unapplyall" ); m_previousFile = new KAction( i18n("P&revious File"), "2uparrow", Qt::CTRL + Qt::Key_PageUp, - this, SLOT(slotPreviousModel()), + this, TQT_SLOT(slotPreviousModel()), (( KomparePart* )parent)->actionCollection(), "difference_previousfile" ); m_nextFile = new KAction( i18n("N&ext File"), "2downarrow", Qt::CTRL + Qt::Key_PageDown, - this, SLOT(slotNextModel()), + this, TQT_SLOT(slotNextModel()), (( KomparePart* )parent)->actionCollection(), "difference_nextfile" ); m_previousDifference = new KAction( i18n("&Previous Difference"), "1uparrow", Qt::CTRL + Qt::Key_Up, - this, SLOT(slotPreviousDifference()), + this, TQT_SLOT(slotPreviousDifference()), (( KomparePart* )parent)->actionCollection(), "difference_previous" ); m_nextDifference = new KAction( i18n("&Next Difference"), "1downarrow", Qt::CTRL + Qt::Key_Down, - this, SLOT(slotNextDifference()), + this, TQT_SLOT(slotNextDifference()), (( KomparePart* )parent)->actionCollection(), "difference_next" ); m_previousDifference->setEnabled( false ); m_nextDifference->setEnabled( false ); - m_save = KStdAction::save( this, SLOT(slotSaveDestination()), ((KomparePart*)parent)->actionCollection() ); + m_save = KStdAction::save( this, TQT_SLOT(slotSaveDestination()), ((KomparePart*)parent)->actionCollection() ); m_save->setEnabled( false ); updateModelListActions(); @@ -95,16 +95,16 @@ KompareModelList::~KompareModelList() { } -bool KompareModelList::isDirectory( const QString& url ) const +bool KompareModelList::isDirectory( const TQString& url ) const { - QFileInfo fi( url ); + TQFileInfo fi( url ); if ( fi.isDir() ) return true; else return false; } -bool KompareModelList::isDiff( const QString& mimeType ) const +bool KompareModelList::isDiff( const TQString& mimeType ) const { if ( mimeType == "text/x-diff" ) return true; @@ -112,7 +112,7 @@ bool KompareModelList::isDiff( const QString& mimeType ) const return false; } -bool KompareModelList::compare( const QString& source, const QString& destination ) +bool KompareModelList::compare( const TQString& source, const TQString& destination ) { bool result = false; @@ -126,15 +126,15 @@ bool KompareModelList::compare( const QString& source, const QString& destinatio } else if ( !sourceIsDirectory && !destinationIsDirectory ) { - QFile sourceFile( source ); + TQFile sourceFile( source ); sourceFile.open( IO_ReadOnly ); - QString sourceMimeType = ( KMimeType::findByContent( sourceFile.readAll() ) )->name(); + TQString sourceMimeType = ( KMimeType::findByContent( sourceFile.readAll() ) )->name(); sourceFile.close(); kdDebug(8101) << "Mimetype source : " << sourceMimeType << endl; - QFile destinationFile( destination ); + TQFile destinationFile( destination ); destinationFile.open( IO_ReadOnly ); - QString destinationMimeType = ( KMimeType::findByContent( destinationFile.readAll() ) )->name(); + TQString destinationMimeType = ( KMimeType::findByContent( destinationFile.readAll() ) )->name(); destinationFile.close(); kdDebug(8101) << "Mimetype destination: " << destinationMimeType << endl; @@ -172,7 +172,7 @@ bool KompareModelList::compare( const QString& source, const QString& destinatio return result; } -bool KompareModelList::compareFiles( const QString& source, const QString& destination ) +bool KompareModelList::compareFiles( const TQString& source, const TQString& destination ) { m_source = source; m_destination = destination; @@ -183,16 +183,16 @@ bool KompareModelList::compareFiles( const QString& source, const QString& desti // m_fileWatch->addFile( m_source ); // m_fileWatch->addFile( m_destination ); -// connect( m_fileWatch, SIGNAL( dirty( const QString& ) ), this, SLOT( slotFileChanged( const QString& ) ) ); -// connect( m_fileWatch, SIGNAL( created( const QString& ) ), this, SLOT( slotFileChanged( const QString& ) ) ); -// connect( m_fileWatch, SIGNAL( deleted( const QString& ) ), this, SLOT( slotFileChanged( const QString& ) ) ); +// connect( m_fileWatch, TQT_SIGNAL( dirty( const TQString& ) ), this, TQT_SLOT( slotFileChanged( const TQString& ) ) ); +// connect( m_fileWatch, TQT_SIGNAL( created( const TQString& ) ), this, TQT_SLOT( slotFileChanged( const TQString& ) ) ); +// connect( m_fileWatch, TQT_SIGNAL( deleted( const TQString& ) ), this, TQT_SLOT( slotFileChanged( const TQString& ) ) ); // m_fileWatch->startScan(); m_diffProcess = new KompareProcess( m_diffSettings, Kompare::Custom, m_source, m_destination ); m_diffProcess->setEncoding( m_encoding ); - connect( m_diffProcess, SIGNAL(diffHasFinished( bool )), - this, SLOT(slotDiffProcessFinished( bool )) ); + connect( m_diffProcess, TQT_SIGNAL(diffHasFinished( bool )), + this, TQT_SLOT(slotDiffProcessFinished( bool )) ); emit status( Kompare::RunningDiff ); m_diffProcess->start(); @@ -200,7 +200,7 @@ bool KompareModelList::compareFiles( const QString& source, const QString& desti return true; } -bool KompareModelList::compareDirs( const QString& source, const QString& destination ) +bool KompareModelList::compareDirs( const TQString& source, const TQString& destination ) { m_source = source; m_destination = destination; @@ -212,16 +212,16 @@ bool KompareModelList::compareDirs( const QString& source, const QString& destin // m_dirWatch->addDir( m_source, true, true ); // m_dirWatch->addDir( m_destination, true, true ); -// connect( m_dirWatch, SIGNAL( dirty ( const QString& ) ), this, SLOT( slotDirectoryChanged( const QString& ) ) ); -// connect( m_dirWatch, SIGNAL( created( const QString& ) ), this, SLOT( slotDirectoryChanged( const QString& ) ) ); -// connect( m_dirWatch, SIGNAL( deleted( const QString& ) ), this, SLOT( slotDirectoryChanged( const QString& ) ) ); +// connect( m_dirWatch, TQT_SIGNAL( dirty ( const TQString& ) ), this, TQT_SLOT( slotDirectoryChanged( const TQString& ) ) ); +// connect( m_dirWatch, TQT_SIGNAL( created( const TQString& ) ), this, TQT_SLOT( slotDirectoryChanged( const TQString& ) ) ); +// connect( m_dirWatch, TQT_SIGNAL( deleted( const TQString& ) ), this, TQT_SLOT( slotDirectoryChanged( const TQString& ) ) ); // m_dirWatch->startScan(); m_diffProcess = new KompareProcess( m_diffSettings, Kompare::Custom, m_source, m_destination ); m_diffProcess->setEncoding( m_encoding ); - connect( m_diffProcess, SIGNAL(diffHasFinished( bool )), - this, SLOT(slotDiffProcessFinished( bool )) ); + connect( m_diffProcess, TQT_SIGNAL(diffHasFinished( bool )), + this, TQT_SLOT(slotDiffProcessFinished( bool )) ); emit status( Kompare::RunningDiff ); m_diffProcess->start(); @@ -229,7 +229,7 @@ bool KompareModelList::compareDirs( const QString& source, const QString& destin return true; } -bool KompareModelList::openFileAndDiff( const QString& file, const QString& diff ) +bool KompareModelList::openFileAndDiff( const TQString& file, const TQString& diff ) { clear(); @@ -253,7 +253,7 @@ bool KompareModelList::openFileAndDiff( const QString& file, const QString& diff return true; } -bool KompareModelList::openDirAndDiff( const QString& dir, const QString& diff ) +bool KompareModelList::openDirAndDiff( const TQString& dir, const TQString& diff ) { clear(); @@ -302,8 +302,8 @@ bool KompareModelList::saveDestination( DiffModel* model ) return false; } - QTextStream* stream = temp->textStream(); - QStringList list; + TQTextStream* stream = temp->textStream(); + TQStringList list; DiffHunkListConstIterator hunkIt = model->hunks()->begin(); DiffHunkListConstIterator hEnd = model->hunks()->end(); @@ -357,25 +357,25 @@ bool KompareModelList::saveDestination( DiffModel* model ) if ( m_info.mode == Kompare::ComparingDirs ) { - QString destination = model->destinationPath() + model->destinationFile(); + TQString destination = model->destinationPath() + model->destinationFile(); kdDebug(8101) << "Tempfilename : " << temp->name() << endl; kdDebug(8101) << "DestinationURL : " << destination << endl; KIO::UDSEntry entry; - if ( !KIO::NetAccess::stat( KURL( destination ).path(), entry, (QWidget*)parent() ) ) + if ( !KIO::NetAccess::stat( KURL( destination ).path(), entry, (TQWidget*)parent() ) ) { - if ( !KIO::NetAccess::mkdir( KURL( destination ).path(), (QWidget*)parent() ) ) + if ( !KIO::NetAccess::mkdir( KURL( destination ).path(), (TQWidget*)parent() ) ) { emit error( i18n( "<qt>Could not create destination directory <b>%1</b>.\nThe file has not been saved.</qt>" ) ); return false; } } - result = KIO::NetAccess::upload( temp->name(), KURL( destination ), (QWidget*)parent() ); + result = KIO::NetAccess::upload( temp->name(), KURL( destination ), (TQWidget*)parent() ); } else { kdDebug(8101) << "Tempfilename : " << temp->name() << endl; kdDebug(8101) << "DestinationURL : " << m_destination << endl; - result = KIO::NetAccess::upload( temp->name(), KURL( m_destination ), (QWidget*)parent() ); + result = KIO::NetAccess::upload( temp->name(), KURL( m_destination ), (TQWidget*)parent() ); } if ( !result ) @@ -407,12 +407,12 @@ bool KompareModelList::saveAll() return true; } -void KompareModelList::setEncoding( const QString& encoding ) +void KompareModelList::setEncoding( const TQString& encoding ) { m_encoding = encoding; if ( encoding.lower() == "default" ) { - m_textCodec = QTextCodec::codecForLocale(); + m_textCodec = TQTextCodec::codecForLocale(); } else { @@ -420,7 +420,7 @@ void KompareModelList::setEncoding( const QString& encoding ) m_textCodec = KGlobal::charsets()->codecForName( encoding.latin1() ); kdDebug() << "TextCodec: " << m_textCodec << endl; if ( !m_textCodec ) - m_textCodec = QTextCodec::codecForLocale(); + m_textCodec = TQTextCodec::codecForLocale(); } kdDebug() << "TextCodec: " << m_textCodec << endl; } @@ -459,7 +459,7 @@ void KompareModelList::slotDiffProcessFinished( bool success ) m_diffProcess = 0; } -void KompareModelList::slotDirectoryChanged( const QString& /*dir*/ ) +void KompareModelList::slotDirectoryChanged( const TQString& /*dir*/ ) { // some debug output to see if watching works properly kdDebug(8101) << "Yippie directories are being watched !!! :)" << endl; @@ -470,7 +470,7 @@ void KompareModelList::slotDirectoryChanged( const QString& /*dir*/ ) } } -void KompareModelList::slotFileChanged( const QString& /*file*/ ) +void KompareModelList::slotFileChanged( const TQString& /*file*/ ) { // some debug output to see if watching works properly kdDebug(8101) << "Yippie files are being watched !!! :)" << endl; @@ -481,10 +481,10 @@ void KompareModelList::slotFileChanged( const QString& /*file*/ ) } } -QStringList KompareModelList::split( const QString& fileContents ) +TQStringList KompareModelList::split( const TQString& fileContents ) { - QString contents = fileContents; - QStringList list; + TQString contents = fileContents; + TQStringList list; int pos = 0; unsigned int oldpos = 0; @@ -508,36 +508,36 @@ QStringList KompareModelList::split( const QString& fileContents ) return list; } -QString KompareModelList::readFile( const QString& fileName ) +TQString KompareModelList::readFile( const TQString& fileName ) { - QStringList list; + TQStringList list; - QFile file( fileName ); + TQFile file( fileName ); file.open( IO_ReadOnly ); - QTextStream stream( &file ); + TQTextStream stream( &file ); kdDebug() << "Codec = " << m_textCodec << endl; if ( !m_textCodec ) - m_textCodec = QTextCodec::codecForLocale(); + m_textCodec = TQTextCodec::codecForLocale(); stream.setCodec( m_textCodec ); - QString contents = stream.read(); + TQString contents = stream.read(); file.close(); return contents; } -bool KompareModelList::openDiff( const QString& diffFile ) +bool KompareModelList::openDiff( const TQString& diffFile ) { kdDebug(8101) << "Stupid :) Url = " << diffFile << endl; if ( diffFile.isEmpty() ) return false; - QString diff = readFile( diffFile ); + TQString diff = readFile( diffFile ); clear(); // Clear the current models @@ -557,9 +557,9 @@ bool KompareModelList::openDiff( const QString& diffFile ) return true; } -QString KompareModelList::recreateDiff() const +TQString KompareModelList::recreateDiff() const { - QString diff; + TQString diff; DiffModelListConstIterator modelIt = m_models->begin(); DiffModelListConstIterator mEnd = m_models->end(); @@ -571,7 +571,7 @@ QString KompareModelList::recreateDiff() const return diff; } -bool KompareModelList::saveDiff( const QString& url, QString directory, DiffSettings* diffSettings ) +bool KompareModelList::saveDiff( const TQString& url, TQString directory, DiffSettings* diffSettings ) { kdDebug() << "KompareModelList::saveDiff: " << endl; @@ -589,8 +589,8 @@ bool KompareModelList::saveDiff( const QString& url, QString directory, DiffSett m_diffProcess = new KompareProcess( diffSettings, Kompare::Custom, m_source, m_destination, directory ); m_diffProcess->setEncoding( m_encoding ); - connect( m_diffProcess, SIGNAL(diffHasFinished( bool )), - this, SLOT(slotWriteDiffOutput( bool )) ); + connect( m_diffProcess, TQT_SIGNAL(diffHasFinished( bool )), + this, TQT_SLOT(slotWriteDiffOutput( bool )) ); emit status( Kompare::RunningDiff ); return m_diffProcess->start(); @@ -602,7 +602,7 @@ void KompareModelList::slotWriteDiffOutput( bool success ) if( success ) { - QTextStream* stream = m_diffTemp->textStream(); + TQTextStream* stream = m_diffTemp->textStream(); *stream << m_diffProcess->diffOutput(); @@ -613,7 +613,7 @@ void KompareModelList::slotWriteDiffOutput( bool success ) emit error( i18n( "Could not write to the temporary file." ) ); } - KIO::NetAccess::upload( m_diffTemp->name(), KURL( m_diffURL ), (QWidget*)parent() ); + KIO::NetAccess::upload( m_diffTemp->name(), KURL( m_diffURL ), (TQWidget*)parent() ); emit status( Kompare::FinishedWritingDiff ); } @@ -857,11 +857,11 @@ void KompareModelList::slotApplyAllDifferences( bool apply ) emit applyAllDifferences( apply ); } -int KompareModelList::parseDiffOutput( const QString& diff ) +int KompareModelList::parseDiffOutput( const TQString& diff ) { kdDebug(8101) << "KompareModelList::parseDiffOutput" << endl; - QStringList diffLines = split( diff ); + TQStringList diffLines = split( diff ); Parser* parser = new Parser( this ); m_models = parser->parse( diffLines ); @@ -888,30 +888,30 @@ int KompareModelList::parseDiffOutput( const QString& diff ) return 0; } -bool KompareModelList::blendOriginalIntoModelList( const QString& localURL ) +bool KompareModelList::blendOriginalIntoModelList( const TQString& localURL ) { kdDebug() << "Hurrah we are blending..." << endl; - QFileInfo fi( localURL ); + TQFileInfo fi( localURL ); bool result = false; DiffModel* model; - QString fileContents; + TQString fileContents; if ( fi.isDir() ) { // is a dir kdDebug() << "Blend Dir" << endl; -// QDir dir( localURL, QString::null, QDir::Name|QDir::DirsFirst, QDir::All ); +// TQDir dir( localURL, TQString::null, TQDir::Name|TQDir::DirsFirst, TQDir::All ); DiffModelListIterator modelIt = m_models->begin(); DiffModelListIterator mEnd = m_models->end(); for ( ; modelIt != mEnd; ++modelIt ) { model = *modelIt; kdDebug(8101) << "Model : " << model << endl; - QString filename = model->sourcePath() + model->sourceFile(); + TQString filename = model->sourcePath() + model->sourceFile(); if ( !filename.startsWith( localURL ) ) filename.prepend( localURL ); - QFileInfo fi2( filename ); + TQFileInfo fi2( filename ); if ( fi2.exists() ) { kdDebug(8101) << "Reading from: " << filename << endl; @@ -941,7 +941,7 @@ bool KompareModelList::blendOriginalIntoModelList( const QString& localURL ) return result; } -bool KompareModelList::blendFile( DiffModel* model, const QString& fileContents ) +bool KompareModelList::blendFile( DiffModel* model, const TQString& fileContents ) { if ( !model ) { @@ -953,10 +953,10 @@ bool KompareModelList::blendFile( DiffModel* model, const QString& fileContents int srcLineNo = 1, destLineNo = 1; - QStringList lines = split( fileContents ); + TQStringList lines = split( fileContents ); - QStringList::ConstIterator linesIt = lines.begin(); - QStringList::ConstIterator lEnd = lines.end(); + TQStringList::ConstIterator linesIt = lines.begin(); + TQStringList::ConstIterator lEnd = lines.end(); DiffHunkList* hunks = model->hunks(); kdDebug(8101) << "Hunks in hunklist: " << hunks->count() << endl; @@ -1191,8 +1191,8 @@ void KompareModelList::clear() void KompareModelList::swap() { - QString source = m_source; - QString destination = m_destination; + TQString source = m_source; + TQString destination = m_destination; if ( m_info.mode == Kompare::ComparingFiles ) compareFiles( destination, source ); else if ( m_info.mode == Kompare::ComparingDirs ) |