Version: (using KDE KDE 3.5.0) Installed from: Ubuntu Packages To be compatible across platforms I'd like KBabel to support backslashes also for "#: REFERENCE" comments. In https://bugs.kde.org/show_bug.cgi?id=114041#c6 Nicolas Goutte says that QFileInfo is being used. I hope this can quite easily be done.
SVN commit 491448 by goutte: - replace backslashes in source references' paths into slahes (support for MS Windows' paths in PO files; bug #116393) - fix a typo of the name extractattr in a comment - use cont_iterator in the loop processing each comment line. BUG:116393 M +8 -4 context.cpp --- branches/KDE/3.5/kdesdk/kbabel/commonui/context.cpp #491447:491448 @@ -143,10 +143,9 @@ //kdDebug() << "PO FILE DIR: " << poDir << endl; QStringList prefixes; - QStringList paths = _project->settings()->paths(); + const QStringList paths = _project->settings()->paths(); - for( QStringList::Iterator it = paths.begin() - ; it!=paths.end() ; ++it) + for( QStringList::const_iterator it = paths.constBegin(); it!=paths.constEnd() ; ++it ) { QString pref = (*it); @@ -165,7 +164,7 @@ QValueList<ContextInfo> rawRefList; // raw references QRegExp re("^\\s*(.+):(\\d+)\\s*$"); // Reg. exp. for Gettext references - QRegExp rex( "^#. i18n: file (.+) line (\\d+)\\s*$" ); //Reg. exp. for KDE extractrc/etxractattr references + QRegExp rex( "^#. i18n: file (.+) line (\\d+)\\s*$" ); //Reg. exp. for KDE extractrc/extractattr references QRegExp res( "^# [Ff]ile: (.+), line(?: number)?: (\\d+)\\s*$"); // Reg. exp. for "strict" PO format const QStringList lines = QStringList::split( "\n", gettextComment ); for ( QStringList::const_iterator it = lines.constBegin() ; it != lines.constEnd() ; ++it) @@ -182,6 +181,8 @@ ContextInfo ref; ref.line = re.cap(2).toInt(); ref.path = re.cap(1); + // ### TODO KDE4: perhaps we should not do the replace if compiled for Windows + ref.path.replace( QChar( '\\' ), QChar( '/' ) ); rawRefList.append( ref ); } } @@ -200,6 +201,7 @@ ContextInfo ref; ref.line = rex.cap(2).toInt(); ref.path = rex.cap(1); + // KDE is not extracted on Windows, so no backslash conversion is needed. rawRefList.append( ref ); } } @@ -211,6 +213,8 @@ ContextInfo ref; ref.line = res.cap(2).toInt(); ref.path = res.cap(1); + // ### TODO KDE4: perhaps we should not do the replace if compiled for Windows + ref.path.replace( QChar( '\\' ), QChar( '/' ) ); rawRefList.append( ref ); } }