[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdesdk/kompare/libdiff2
From: Ramon Zarazua <killerfox512 () gmail ! com>
Date: 2009-07-30 19:20:54
Message-ID: 1248981654.358960.19608.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1004738 by rzarazua:
Comparison of a file and a string works.
M +9 -7 kompareprocess.cpp
M +1 -0 kompareprocess.h
--- trunk/KDE/kdesdk/kompare/libdiff2/kompareprocess.cpp #1004737:1004738
@@ -29,6 +29,7 @@
#include <kglobal.h>
#include "diffsettings.h"
+#include <KTemporaryFile>
KompareProcess::KompareProcess( DiffSettings* diffSettings, Kompare::DiffMode \
diffMode, const QString & source, const QString & destination, QString dir, \
Kompare::Mode mode ) : KProcess(),
@@ -64,7 +65,7 @@
//Add the option for diff to read from stdin(QIODevice::write), and save a pointer \
to the string if(mode == Kompare::ComparingFileString)
{
- *this << "- ";
+ *this << "-";
m_customString = &destination;
}
else
@@ -222,14 +223,14 @@
}
else
{
- QTextCodec* textCodec = KGlobal::charsets()->codecForName( encoding.latin1() );
- if ( textCodec )
- m_textDecoder = textCodec->makeDecoder();
+ m_codec = KGlobal::charsets()->codecForName( encoding.latin1() );
+ if ( m_codec )
+ m_textDecoder = m_codec->makeDecoder();
else
{
kDebug(8101) << "Using locale codec as backup..." << endl;
- textCodec = QTextCodec::codecForLocale();
- m_textDecoder = textCodec->makeDecoder();
+ m_codec = QTextCodec::codecForLocale();
+ m_textDecoder = m_codec->makeDecoder();
}
}
}
@@ -245,11 +246,12 @@
kDebug(8101) << cmdLine << endl;
#endif
setOutputChannelMode( SeparateChannels );
+ setNextOpenMode(QIODevice::ReadWrite);
KProcess::start();
//If we have a string to compare against input it now
if(m_customString)
- kDebug() << "Bytes written into diff process stream" << \
write(m_customString->toAscii()); + write(m_codec->fromUnicode(*m_customString));
closeWriteChannel();
}
--- trunk/KDE/kdesdk/kompare/libdiff2/kompareprocess.h #1004737:1004738
@@ -61,6 +61,7 @@
QString m_stdout;
QString m_stderr;
QTextDecoder* m_textDecoder;
+ QTextCodec * m_codec;
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic