|
|
@ -98,7 +98,7 @@ void KDiff3Part::setModified(bool /*modified*/)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void getNameAndVersion( const TQString& str, const TQString& lineStart, TQString& fileName, TQString& version )
|
|
|
|
static void getNameAndVersion( const TQString& workingDir, const TQString& str, const TQString& lineStart, TQString& fileName, TQString& version )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( str.left( lineStart.length() )==lineStart && fileName.isEmpty() )
|
|
|
|
if ( str.left( lineStart.length() )==lineStart && fileName.isEmpty() )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -110,7 +110,12 @@ static void getNameAndVersion( const TQString& str, const TQString& lineStart, T
|
|
|
|
while (pos2>pos && str[pos2]!=' ' && str[pos2]!='\t') --pos2;
|
|
|
|
while (pos2>pos && str[pos2]!=' ' && str[pos2]!='\t') --pos2;
|
|
|
|
fileName = str.mid( pos, pos2-pos );
|
|
|
|
fileName = str.mid( pos, pos2-pos );
|
|
|
|
std::cerr << "KDiff3: " << fileName.latin1() << std::endl;
|
|
|
|
std::cerr << "KDiff3: " << fileName.latin1() << std::endl;
|
|
|
|
if ( FileAccess(fileName).exists() ) break;
|
|
|
|
FileAccess fa(workingDir, fileName);
|
|
|
|
|
|
|
|
if (fa.exists())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fileName = fa.absFilePath();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
--pos2;
|
|
|
|
--pos2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -135,6 +140,8 @@ bool KDiff3Part::openFile()
|
|
|
|
|
|
|
|
|
|
|
|
// our example widget is text-based, so we use TQTextStream instead
|
|
|
|
// our example widget is text-based, so we use TQTextStream instead
|
|
|
|
// of a raw TQDataStream
|
|
|
|
// of a raw TQDataStream
|
|
|
|
|
|
|
|
TQFileInfo fileinfo(m_file);
|
|
|
|
|
|
|
|
TQString workingDir = fileinfo.dirPath(true);
|
|
|
|
TQTextStream stream(&file);
|
|
|
|
TQTextStream stream(&file);
|
|
|
|
TQString str;
|
|
|
|
TQString str;
|
|
|
|
TQString fileName1;
|
|
|
|
TQString fileName1;
|
|
|
@ -144,8 +151,8 @@ bool KDiff3Part::openFile()
|
|
|
|
while (!stream.eof() && (fileName1.isEmpty() || fileName2.isEmpty()) )
|
|
|
|
while (!stream.eof() && (fileName1.isEmpty() || fileName2.isEmpty()) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
str = stream.readLine() + "\n";
|
|
|
|
str = stream.readLine() + "\n";
|
|
|
|
getNameAndVersion( str, "---", fileName1, version1 );
|
|
|
|
getNameAndVersion( workingDir, str, "---", fileName1, version1 );
|
|
|
|
getNameAndVersion( str, "+++", fileName2, version2 );
|
|
|
|
getNameAndVersion( workingDir, str, "+++", fileName2, version2 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
file.close();
|
|
|
|
file.close();
|
|
|
@ -156,8 +163,8 @@ bool KDiff3Part::openFile()
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FileAccess f1(fileName1);
|
|
|
|
FileAccess f1(workingDir, fileName1);
|
|
|
|
FileAccess f2(fileName2);
|
|
|
|
FileAccess f2(workingDir, fileName2);
|
|
|
|
|
|
|
|
|
|
|
|
if ( f1.exists() && f2.exists() && fileName1!=fileName2 )
|
|
|
|
if ( f1.exists() && f2.exists() && fileName1!=fileName2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|