diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-27 05:58:16 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-27 05:58:16 +0000 |
commit | f636ba5ba2df9d34d56b1c85f24c6598fa1cb645 (patch) | |
tree | 5365045e6bce685a7cbaeb81b4797a719e86089f /src/kdiff3_part.cpp | |
parent | 63862fdfcb61f302ef69e86d40772bb1318d3763 (diff) | |
download | kdiff3-f636ba5ba2df9d34d56b1c85f24c6598fa1cb645.tar.gz kdiff3-f636ba5ba2df9d34d56b1c85f24c6598fa1cb645.zip |
TQt4 port kdiff3
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdiff3@1238464 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kdiff3_part.cpp')
-rw-r--r-- | src/kdiff3_part.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/kdiff3_part.cpp b/src/kdiff3_part.cpp index 799673e..4e0a9c3 100644 --- a/src/kdiff3_part.cpp +++ b/src/kdiff3_part.cpp @@ -24,8 +24,8 @@ #include <kstdaction.h> #include <kfiledialog.h> -#include <qfile.h> -#include <qtextstream.h> +#include <tqfile.h> +#include <tqtextstream.h> #include "kdiff3.h" #include "fileaccess.h" @@ -35,26 +35,26 @@ #include "version.h" -KDiff3Part::KDiff3Part( QWidget *parentWidget, const char *widgetName, - QObject *parent, const char *name ) - : KParts::ReadOnlyPart(parent, name) +KDiff3Part::KDiff3Part( TQWidget *tqparentWidget, const char *widgetName, + TQObject *tqparent, const char *name ) + : KParts::ReadOnlyPart(tqparent, name) { // we need an instance setInstance( KDiff3PartFactory::instance() ); // this should be your custom internal widget - m_widget = new KDiff3App( parentWidget, widgetName, this ); + m_widget = new KDiff3App( tqparentWidget, widgetName, this ); // This hack is necessary to avoid a crash when the program terminates. - m_bIsShell = dynamic_cast<KParts::MainWindow*>(parentWidget)!=0; + m_bIsShell = dynamic_cast<KParts::MainWindow*>(tqparentWidget)!=0; // notify the part that this is our internal widget setWidget(m_widget); // create our actions - //KStdAction::open(this, SLOT(fileOpen()), actionCollection()); - //KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection()); - //KStdAction::save(this, SLOT(save()), actionCollection()); + //KStdAction::open(this, TQT_SLOT(fileOpen()), actionCollection()); + //KStdAction::saveAs(this, TQT_SLOT(fileSaveAs()), actionCollection()); + //KStdAction::save(this, TQT_SLOT(save()), actionCollection()); setXMLFile("kdiff3_part.rc"); @@ -93,12 +93,12 @@ void KDiff3Part::setModified(bool /*modified*/) else save->setEnabled(false); - // in any event, we want our parent to do it's thing + // in any event, we want our tqparent to do it's thing ReadWritePart::setModified(modified); */ } -static void getNameAndVersion( const QString& str, const QString& lineStart, QString& fileName, QString& version ) +static void getNameAndVersion( const TQString& str, const TQString& lineStart, TQString& fileName, TQString& version ) { if ( str.left( lineStart.length() )==lineStart && fileName.isEmpty() ) { @@ -114,7 +114,7 @@ static void getNameAndVersion( const QString& str, const QString& lineStart, QSt --pos2; } - int vpos = str.findRev("\t", -1); + int vpos = str.tqfindRev("\t", -1); if ( vpos>0 && vpos>(int)pos2 ) { version = str.mid( vpos+1 ); @@ -127,20 +127,20 @@ static void getNameAndVersion( const QString& str, const QString& lineStart, QSt bool KDiff3Part::openFile() { - // m_file is always local so we can use QFile on it + // m_file is always local so we can use TQFile on it std::cerr << "KDiff3: " << m_file.latin1() << std::endl; - QFile file(m_file); + TQFile file(m_file); if (file.open(IO_ReadOnly) == false) return false; - // our example widget is text-based, so we use QTextStream instead - // of a raw QDataStream - QTextStream stream(&file); - QString str; - QString fileName1; - QString fileName2; - QString version1; - QString version2; + // our example widget is text-based, so we use TQTextStream instead + // of a raw TQDataStream + TQTextStream stream(&file); + TQString str; + TQString fileName1; + TQString fileName2; + TQString version1; + TQString version2; while (!stream.eof() && (fileName1.isEmpty() || fileName2.isEmpty()) ) { str = stream.readLine() + "\n"; @@ -168,8 +168,8 @@ bool KDiff3Part::openFile() { // Normal patch // patch -f -u --ignore-whitespace -i [inputfile] -o [outfile] [patchfile] - QString tempFileName = FileAccess::tempFileName(); - QString cmd = "patch -f -u --ignore-whitespace -i \"" + m_file + + TQString tempFileName = FileAccess::tempFileName(); + TQString cmd = "patch -f -u --ignore-whitespace -i \"" + m_file + "\" -o \""+tempFileName + "\" \"" + fileName1+ "\""; ::system( cmd.ascii() ); @@ -183,8 +183,8 @@ bool KDiff3Part::openFile() { // Reverse patch // patch -f -u -R --ignore-whitespace -i [inputfile] -o [outfile] [patchfile] - QString tempFileName = FileAccess::tempFileName(); - QString cmd = "patch -f -u -R --ignore-whitespace -i \"" + m_file + + TQString tempFileName = FileAccess::tempFileName(); + TQString cmd = "patch -f -u -R --ignore-whitespace -i \"" + m_file + "\" -o \""+tempFileName + "\" \"" + fileName2+"\""; ::system( cmd.ascii() ); @@ -200,12 +200,12 @@ bool KDiff3Part::openFile() // Assuming that files are on CVS: Try to get them // cvs update -p -r [REV] [FILE] > [OUTPUTFILE] - QString tempFileName1 = FileAccess::tempFileName(); - QString cmd1 = "cvs update -p -r " + version1 + " \"" + fileName1 + "\" >\""+tempFileName1+"\""; + TQString tempFileName1 = FileAccess::tempFileName(); + TQString cmd1 = "cvs update -p -r " + version1 + " \"" + fileName1 + "\" >\""+tempFileName1+"\""; ::system( cmd1.ascii() ); - QString tempFileName2 = FileAccess::tempFileName(); - QString cmd2 = "cvs update -p -r " + version2 + " \"" + fileName2 + "\" >\""+tempFileName2+"\""; + TQString tempFileName2 = FileAccess::tempFileName(); + TQString cmd2 = "cvs update -p -r " + version2 + " \"" + fileName2 + "\" >\""+tempFileName2+"\""; ::system( cmd2.ascii() ); m_widget->slotFileOpen2( tempFileName1, tempFileName2, "", "", @@ -233,13 +233,13 @@ bool KDiff3Part::saveFile() if (isReadWrite() == false) return false; - // m_file is always local, so we use QFile - QFile file(m_file); + // m_file is always local, so we use TQFile + TQFile file(m_file); if (file.open(IO_WriteOnly) == false) return false; - // use QTextStream to dump the text to the file - QTextStream stream(&file); + // use TQTextStream to dump the text to the file + TQTextStream stream(&file); //stream << m_widget->text(); file.close(); @@ -270,15 +270,15 @@ KDiff3PartFactory::~KDiff3PartFactory() s_instance = 0L; } -KParts::Part* KDiff3PartFactory::createPartObject( QWidget *parentWidget, const char *widgetName, - QObject *parent, const char *name, - const char *classname, const QStringList&/*args*/ ) +KParts::Part* KDiff3PartFactory::createPartObject( TQWidget *tqparentWidget, const char *widgetName, + TQObject *tqparent, const char *name, + const char *classname, const TQStringList&/*args*/ ) { // Create an instance of our Part - KDiff3Part* obj = new KDiff3Part( parentWidget, widgetName, parent, name ); + KDiff3Part* obj = new KDiff3Part( tqparentWidget, widgetName, tqparent, name ); // See if we are to be read-write or not - if (QCString(classname) == "KParts::ReadOnlyPart") + if (TQCString(classname) == "KParts::ReadOnlyPart") obj->setReadWrite(false); return obj; |