|
|
@ -165,7 +165,7 @@ int Catalog::indexForMsgid(const TQString& id) const
|
|
|
|
int i=0;
|
|
|
|
int i=0;
|
|
|
|
TQValueVector<CatalogItem>::ConstIterator it = d->_entries.begin();
|
|
|
|
TQValueVector<CatalogItem>::ConstIterator it = d->_entries.begin();
|
|
|
|
|
|
|
|
|
|
|
|
while(it != d->_entries.end() && !((*it).msgid(true).tqcontains(id)))
|
|
|
|
while(it != d->_entries.end() && !((*it).msgid(true).contains(id)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
++it;
|
|
|
|
++it;
|
|
|
|
i++;
|
|
|
|
i++;
|
|
|
@ -290,8 +290,8 @@ bool Catalog::setHeader(CatalogItem newHeader)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// normalize the values - ensure every key:value pair is only on a single line
|
|
|
|
// normalize the values - ensure every key:value pair is only on a single line
|
|
|
|
TQString values = newHeader.msgstr().first();
|
|
|
|
TQString values = newHeader.msgstr().first();
|
|
|
|
values.tqreplace ("\n", "");
|
|
|
|
values.replace ("\n", "");
|
|
|
|
values.tqreplace ("\\n", "\\n\n");
|
|
|
|
values.replace ("\\n", "\\n\n");
|
|
|
|
|
|
|
|
|
|
|
|
kdDebug () << "Normalized header: " << values << endl;
|
|
|
|
kdDebug () << "Normalized header: " << values << endl;
|
|
|
|
|
|
|
|
|
|
|
@ -343,7 +343,7 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
temp+="\\n";
|
|
|
|
temp+="\\n";
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if((*it).tqcontains(TQRegExp("^ *Last-Translator:.*")))
|
|
|
|
if((*it).contains(TQRegExp("^ *Last-Translator:.*")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
(*it) = temp;
|
|
|
|
(*it) = temp;
|
|
|
|
found=true;
|
|
|
|
found=true;
|
|
|
@ -363,7 +363,7 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
|
|
|
|
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if((*it).tqcontains(TQRegExp("^ *PO-Revision-Date:.*")))
|
|
|
|
if((*it).contains(TQRegExp("^ *PO-Revision-Date:.*")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
(*it) = temp;
|
|
|
|
(*it) = temp;
|
|
|
|
found=true;
|
|
|
|
found=true;
|
|
|
@ -380,11 +380,11 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
found=false;
|
|
|
|
found=false;
|
|
|
|
|
|
|
|
|
|
|
|
temp="Project-Id-Version: "+saveOptions.projectString+"\\n";
|
|
|
|
temp="Project-Id-Version: "+saveOptions.projectString+"\\n";
|
|
|
|
temp.tqreplace( "@PACKAGE@", packageName());
|
|
|
|
temp.replace( "@PACKAGE@", packageName());
|
|
|
|
|
|
|
|
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if((*it).tqcontains(TQRegExp("^ *Project-Id-Version:.*")))
|
|
|
|
if((*it).contains(TQRegExp("^ *Project-Id-Version:.*")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
(*it) = temp;
|
|
|
|
(*it) = temp;
|
|
|
|
found=true;
|
|
|
|
found=true;
|
|
|
@ -408,7 +408,7 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
temp+="\\n";
|
|
|
|
temp+="\\n";
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if((*it).tqcontains(TQRegExp("^ *Language-Team:.*")))
|
|
|
|
if((*it).contains(TQRegExp("^ *Language-Team:.*")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
(*it) = temp;
|
|
|
|
(*it) = temp;
|
|
|
|
found=true;
|
|
|
|
found=true;
|
|
|
@ -440,7 +440,7 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
it = headerList.begin();
|
|
|
|
it = headerList.begin();
|
|
|
|
while( it != headerList.end() )
|
|
|
|
while( it != headerList.end() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( (*it).tqfind( TQRegExp( "^ *Content-Type:.*" ) ) != -1 )
|
|
|
|
if( (*it).find( TQRegExp( "^ *Content-Type:.*" ) ) != -1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( found )
|
|
|
|
if ( found )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -483,7 +483,7 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
|
|
|
|
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if((*it).tqcontains(TQRegExp("^ *Content-Transfer-Encoding:.*")))
|
|
|
|
if((*it).contains(TQRegExp("^ *Content-Transfer-Encoding:.*")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
(*it) = temp;
|
|
|
|
(*it) = temp;
|
|
|
|
found=true;
|
|
|
|
found=true;
|
|
|
@ -502,7 +502,7 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
|
|
|
|
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if((*it).tqcontains(TQRegExp("^ *X-Generator:.*")))
|
|
|
|
if((*it).contains(TQRegExp("^ *X-Generator:.*")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
(*it) = temp;
|
|
|
|
(*it) = temp;
|
|
|
|
found=true;
|
|
|
|
found=true;
|
|
|
@ -519,7 +519,7 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
found=false;
|
|
|
|
found=false;
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if((*it).tqcontains(TQRegExp("^ *MIME-Version:")))
|
|
|
|
if((*it).contains(TQRegExp("^ *MIME-Version:")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
(*it) = temp;
|
|
|
|
(*it) = temp;
|
|
|
|
found=true;
|
|
|
|
found=true;
|
|
|
@ -541,7 +541,7 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
for( it = headerList.begin(); it != headerList.end(); ++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if((*it).tqcontains(TQRegExp("^ *Plural-Forms:")))
|
|
|
|
if((*it).contains(TQRegExp("^ *Plural-Forms:")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
(*it) = temp;
|
|
|
|
(*it) = temp;
|
|
|
|
found=true;
|
|
|
|
found=true;
|
|
|
@ -564,7 +564,7 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
for( it = commentList.begin(); it != commentList.end(); ++it )
|
|
|
|
for( it = commentList.begin(); it != commentList.end(); ++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// U+00A9 is the Copyright sign
|
|
|
|
// U+00A9 is the Copyright sign
|
|
|
|
if ( (*it).tqfind( TQRegExp("^# *Copyright (\\(C\\)|\\x00a9).*Free Software Foundation, Inc") ) != -1 )
|
|
|
|
if ( (*it).find( TQRegExp("^# *Copyright (\\(C\\)|\\x00a9).*Free Software Foundation, Inc") ) != -1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
found=true;
|
|
|
|
found=true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -572,21 +572,21 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(found)
|
|
|
|
if(found)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( (*it).tqfind( TQRegExp("^# *Copyright (\\(C\\)|\\x00a9) YEAR Free Software Foundation, Inc\\.") ) != -1 )
|
|
|
|
if ( (*it).find( TQRegExp("^# *Copyright (\\(C\\)|\\x00a9) YEAR Free Software Foundation, Inc\\.") ) != -1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//template string
|
|
|
|
//template string
|
|
|
|
if( saveOptions.FSFCopyright == ProjectSettingsBase::Remove)
|
|
|
|
if( saveOptions.FSFCopyright == ProjectSettingsBase::Remove)
|
|
|
|
(*it).remove(" YEAR Free Software Foundation, Inc");
|
|
|
|
(*it).remove(" YEAR Free Software Foundation, Inc");
|
|
|
|
else
|
|
|
|
else
|
|
|
|
(*it).tqreplace("YEAR", TQDate::tqcurrentDate().toString("yyyy"));
|
|
|
|
(*it).replace("YEAR", TQDate::tqcurrentDate().toString("yyyy"));
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
if( saveOptions.FSFCopyright == ProjectSettingsBase::Update )
|
|
|
|
if( saveOptions.FSFCopyright == ProjectSettingsBase::Update )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//update years
|
|
|
|
//update years
|
|
|
|
TQString cy = TQDate::tqcurrentDate().toString("yyyy");
|
|
|
|
TQString cy = TQDate::tqcurrentDate().toString("yyyy");
|
|
|
|
if( !(*it).tqcontains( TQRegExp(cy)) ) // is the year already included?
|
|
|
|
if( !(*it).contains( TQRegExp(cy)) ) // is the year already included?
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int index = (*it).tqfindRev( TQRegExp("[\\d]+[\\d\\-, ]*") );
|
|
|
|
int index = (*it).findRev( TQRegExp("[\\d]+[\\d\\-, ]*") );
|
|
|
|
if( index == -1 )
|
|
|
|
if( index == -1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KMessageBox::information(0,i18n("Free Software Foundation Copyright does not contain any year. "
|
|
|
|
KMessageBox::information(0,i18n("Free Software Foundation Copyright does not contain any year. "
|
|
|
@ -603,14 +603,14 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
&& ( !saveOptions.descriptionString.isEmpty() ) )
|
|
|
|
&& ( !saveOptions.descriptionString.isEmpty() ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
temp = "# "+saveOptions.descriptionString;
|
|
|
|
temp = "# "+saveOptions.descriptionString;
|
|
|
|
temp.tqreplace( "@PACKAGE@", packageName());
|
|
|
|
temp.replace( "@PACKAGE@", packageName());
|
|
|
|
temp.tqreplace( "@LANGUAGE@", identityOptions.languageName);
|
|
|
|
temp.replace( "@LANGUAGE@", identityOptions.languageName);
|
|
|
|
temp = temp.stripWhiteSpace();
|
|
|
|
temp = temp.stripWhiteSpace();
|
|
|
|
|
|
|
|
|
|
|
|
// The description strings has often buggy variants already in the file, these must be removed
|
|
|
|
// The description strings has often buggy variants already in the file, these must be removed
|
|
|
|
TQString regexpstr = "^#\\s+" + TQRegExp::escape( saveOptions.descriptionString.stripWhiteSpace() ) + "\\s*$";
|
|
|
|
TQString regexpstr = "^#\\s+" + TQRegExp::escape( saveOptions.descriptionString.stripWhiteSpace() ) + "\\s*$";
|
|
|
|
regexpstr.tqreplace( "@PACKAGE@", ".*" );
|
|
|
|
regexpstr.replace( "@PACKAGE@", ".*" );
|
|
|
|
regexpstr.tqreplace( "@LANGUAGE@", ".*" );
|
|
|
|
regexpstr.replace( "@LANGUAGE@", ".*" );
|
|
|
|
//kdDebug() << "REGEXPSTR: " << regexpstr << endl;
|
|
|
|
//kdDebug() << "REGEXPSTR: " << regexpstr << endl;
|
|
|
|
TQRegExp regexp ( regexpstr );
|
|
|
|
TQRegExp regexp ( regexpstr );
|
|
|
|
|
|
|
|
|
|
|
@ -683,11 +683,11 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
while ( it != commentList.end() )
|
|
|
|
while ( it != commentList.end() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool deleteItem = false;
|
|
|
|
bool deleteItem = false;
|
|
|
|
if ( (*it).tqfind ( "copyright", 0, false ) != -1 )
|
|
|
|
if ( (*it).find ( "copyright", 0, false ) != -1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// We have a line with a copyright. It should not be moved.
|
|
|
|
// We have a line with a copyright. It should not be moved.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( (*it).tqfind ( regexpYearAlone ) != -1 )
|
|
|
|
else if ( (*it).find ( regexpYearAlone ) != -1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// We have found a year number that is preceeded by a comma.
|
|
|
|
// We have found a year number that is preceeded by a comma.
|
|
|
|
// That is typical of KBabel 1.10 (and earlier?) when there is neither an author name nor an email
|
|
|
|
// That is typical of KBabel 1.10 (and earlier?) when there is neither an author name nor an email
|
|
|
@ -699,9 +699,9 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
// Typical placeholder, remove it.
|
|
|
|
// Typical placeholder, remove it.
|
|
|
|
deleteItem = true;
|
|
|
|
deleteItem = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( (*it).tqfind ( regexpAuthorYear ) != -1 ) // email address followed by year
|
|
|
|
else if ( (*it).find ( regexpAuthorYear ) != -1 ) // email address followed by year
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( foundAuthors.tqfind( (*it) ) == foundAuthors.end() )
|
|
|
|
if ( foundAuthors.find( (*it) ) == foundAuthors.end() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// The author line is new (and not a duplicate), so add it to the author line list
|
|
|
|
// The author line is new (and not a duplicate), so add it to the author line list
|
|
|
|
foundAuthors.append( (*it) );
|
|
|
|
foundAuthors.append( (*it) );
|
|
|
@ -726,12 +726,12 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
ait = foundAuthors.end();
|
|
|
|
ait = foundAuthors.end();
|
|
|
|
for( it = foundAuthors.begin() ; it!=foundAuthors.end(); ++it )
|
|
|
|
for( it = foundAuthors.begin() ; it!=foundAuthors.end(); ++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( (*it).tqfind( TQRegExp(
|
|
|
|
if ( (*it).find( TQRegExp(
|
|
|
|
TQRegExp::escape( identityOptions.authorName )+".*"
|
|
|
|
TQRegExp::escape( identityOptions.authorName )+".*"
|
|
|
|
+ TQRegExp::escape( identityOptions.authorEmail ) ) ) != -1 )
|
|
|
|
+ TQRegExp::escape( identityOptions.authorEmail ) ) ) != -1 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foundAuthor = true;
|
|
|
|
foundAuthor = true;
|
|
|
|
if( (*it).tqfind( cy ) != -1 )
|
|
|
|
if( (*it).find( cy ) != -1 )
|
|
|
|
found = true;
|
|
|
|
found = true;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
ait = it;
|
|
|
|
ait = it;
|
|
|
@ -744,7 +744,7 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
else if ( ait != foundAuthors.end() )
|
|
|
|
else if ( ait != foundAuthors.end() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//update years
|
|
|
|
//update years
|
|
|
|
const int index = (*ait).tqfindRev( TQRegExp("[\\d]+[\\d\\-, ]*") );
|
|
|
|
const int index = (*ait).findRev( TQRegExp("[\\d]+[\\d\\-, ]*") );
|
|
|
|
if ( index == -1 )
|
|
|
|
if ( index == -1 )
|
|
|
|
(*ait)+=", "+cy;
|
|
|
|
(*ait)+=", "+cy;
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -760,7 +760,7 @@ CatalogItem Catalog::updatedHeader(CatalogItem oldHeader, bool usePrefs) const
|
|
|
|
it=commentList.end();
|
|
|
|
it=commentList.end();
|
|
|
|
do
|
|
|
|
do
|
|
|
|
--it;
|
|
|
|
--it;
|
|
|
|
while( ( it != commentList.begin() ) && ( (*it).tqfind( TQRegExp( "^#(\\s*$|[:,\\.])" ) ) == -1 ) );
|
|
|
|
while( ( it != commentList.begin() ) && ( (*it).find( TQRegExp( "^#(\\s*$|[:,\\.])" ) ) == -1 ) );
|
|
|
|
++it;
|
|
|
|
++it;
|
|
|
|
for( ait = foundAuthors.begin() ; ait != foundAuthors.end() ; ++ait )
|
|
|
|
for( ait = foundAuthors.begin() ; ait != foundAuthors.end() ; ++ait )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -838,7 +838,7 @@ TQString Catalog::packageName() const
|
|
|
|
|
|
|
|
|
|
|
|
TQString package=d->_url.fileName();
|
|
|
|
TQString package=d->_url.fileName();
|
|
|
|
|
|
|
|
|
|
|
|
int index=package.tqfind(TQRegExp("(\\."+identitySettings().languageCode+")?\\.pot?$"));
|
|
|
|
int index=package.find(TQRegExp("(\\."+identitySettings().languageCode+")?\\.pot?$"));
|
|
|
|
|
|
|
|
|
|
|
|
if(index>0)
|
|
|
|
if(index>0)
|
|
|
|
package=package.left(index);
|
|
|
|
package=package.left(index);
|
|
|
@ -848,7 +848,7 @@ TQString Catalog::packageName() const
|
|
|
|
|
|
|
|
|
|
|
|
void Catalog::setPackage(const TQString& package )
|
|
|
|
void Catalog::setPackage(const TQString& package )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const int pos = package.tqfindRev( '/' );
|
|
|
|
const int pos = package.findRev( '/' );
|
|
|
|
if( pos < 0 )
|
|
|
|
if( pos < 0 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->_packageDir = TQString();
|
|
|
|
d->_packageDir = TQString();
|
|
|
@ -1095,7 +1095,7 @@ ConversiontqStatus Catalog::openURL(const KURL& openUrl, const KURL& saveURL, co
|
|
|
|
|
|
|
|
|
|
|
|
Msgfmt::tqStatus Catalog::checkSyntax(TQString& output, bool clearErrors)
|
|
|
|
Msgfmt::tqStatus Catalog::checkSyntax(TQString& output, bool clearErrors)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( !d->_mimeTypes.tqcontains( "application/x-gettext" ) )
|
|
|
|
if( !d->_mimeTypes.contains( "application/x-gettext" ) )
|
|
|
|
return Msgfmt::Unsupported;
|
|
|
|
return Msgfmt::Unsupported;
|
|
|
|
|
|
|
|
|
|
|
|
TQString filename;
|
|
|
|
TQString filename;
|
|
|
@ -1128,10 +1128,10 @@ Msgfmt::tqStatus Catalog::checkSyntax(TQString& output, bool clearErrors)
|
|
|
|
const TQStringList lines = TQStringList::split("\n",output);
|
|
|
|
const TQStringList lines = TQStringList::split("\n",output);
|
|
|
|
for ( TQStringList::const_iterator it = lines.constBegin(); it != lines.constEnd(); ++it )
|
|
|
|
for ( TQStringList::const_iterator it = lines.constBegin(); it != lines.constEnd(); ++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( (*it).tqfind(TQRegExp("^.+:\\d+:")) >= 0 )
|
|
|
|
if( (*it).find(TQRegExp("^.+:\\d+:")) >= 0 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const int begin=(*it).tqfind(":",0)+1;
|
|
|
|
const int begin=(*it).find(":",0)+1;
|
|
|
|
const int end=(*it).tqfind(":",begin);
|
|
|
|
const int end=(*it).find(":",begin);
|
|
|
|
|
|
|
|
|
|
|
|
const TQString line=(*it).mid(begin,end-begin);
|
|
|
|
const TQString line=(*it).mid(begin,end-begin);
|
|
|
|
|
|
|
|
|
|
|
@ -1148,7 +1148,7 @@ Msgfmt::tqStatus Catalog::checkSyntax(TQString& output, bool clearErrors)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( !d->_errorIndex.tqcontains(currentIndex) )
|
|
|
|
if( !d->_errorIndex.contains(currentIndex) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->_errorIndex.append(currentIndex);
|
|
|
|
d->_errorIndex.append(currentIndex);
|
|
|
|
d->_entries[currentIndex].setSyntaxError(true);
|
|
|
|
d->_entries[currentIndex].setSyntaxError(true);
|
|
|
@ -1177,7 +1177,7 @@ void Catalog::clearErrorList()
|
|
|
|
|
|
|
|
|
|
|
|
void Catalog::removeFromErrorList(uint index)
|
|
|
|
void Catalog::removeFromErrorList(uint index)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(d->_errorIndex.tqcontains(index))
|
|
|
|
if(d->_errorIndex.contains(index))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->_errorIndex.remove(index);
|
|
|
|
d->_errorIndex.remove(index);
|
|
|
|
d->_entries[index].setSyntaxError(false);
|
|
|
|
d->_entries[index].setSyntaxError(false);
|
|
|
@ -1241,7 +1241,7 @@ bool Catalog::checkUsingTool(KDataTool* tool, bool clearErrors)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( !tool->run( "validate", (void*)(&(*it)), "CatalogItem", "application/x-kbabel-catalogitem" ))
|
|
|
|
if( !tool->run( "validate", (void*)(&(*it)), "CatalogItem", "application/x-kbabel-catalogitem" ))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( !d->_errorIndex.tqcontains(index) )
|
|
|
|
if( !d->_errorIndex.contains(index) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->_errorIndex.append(index);
|
|
|
|
d->_errorIndex.append(index);
|
|
|
|
hasErrors=true;
|
|
|
|
hasErrors=true;
|
|
|
@ -1461,7 +1461,7 @@ bool Catalog::isUntranslated(uint index) const
|
|
|
|
|
|
|
|
|
|
|
|
bool Catalog::hasError(uint index, DocPosition& pos) const
|
|
|
|
bool Catalog::hasError(uint index, DocPosition& pos) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( d->_errorIndex.tqcontains(index) )
|
|
|
|
if( d->_errorIndex.contains(index) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pos.item=index;
|
|
|
|
pos.item=index;
|
|
|
|
pos.form=0;
|
|
|
|
pos.form=0;
|
|
|
@ -1541,7 +1541,7 @@ int Catalog::prevError(uint startIndex, DocPosition& pos) const
|
|
|
|
|
|
|
|
|
|
|
|
void Catalog::registerView(CatalogView* view)
|
|
|
|
void Catalog::registerView(CatalogView* view)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(d->_views.tqcontainsRef(view)==0)
|
|
|
|
if(d->_views.containsRef(view)==0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->_views.append(view);
|
|
|
|
d->_views.append(view);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1734,7 +1734,7 @@ int Catalog::findNextInList(const TQValueList<uint>& list,uint index) const
|
|
|
|
int nextIndex=-1;
|
|
|
|
int nextIndex=-1;
|
|
|
|
|
|
|
|
|
|
|
|
// find index in List
|
|
|
|
// find index in List
|
|
|
|
it=list.tqfind(index);
|
|
|
|
it=list.find(index);
|
|
|
|
|
|
|
|
|
|
|
|
// if the given index is found in the list and not the last entry
|
|
|
|
// if the given index is found in the list and not the last entry
|
|
|
|
// in the list, return the next listentry
|
|
|
|
// in the list, return the next listentry
|
|
|
@ -1765,7 +1765,7 @@ int Catalog::findPrevInList(const TQValueList<uint>& list,uint index) const
|
|
|
|
|
|
|
|
|
|
|
|
int prevIndex=-1;
|
|
|
|
int prevIndex=-1;
|
|
|
|
|
|
|
|
|
|
|
|
it=list.tqfind(index);
|
|
|
|
it=list.find(index);
|
|
|
|
|
|
|
|
|
|
|
|
// if the given index is found in the list and not the last entry
|
|
|
|
// if the given index is found in the list and not the last entry
|
|
|
|
// in the list, return the next listentry
|
|
|
|
// in the list, return the next listentry
|
|
|
@ -1831,49 +1831,49 @@ TQString Catalog::dateTime() const
|
|
|
|
const TQTime time = dt.time();
|
|
|
|
const TQTime time = dt.time();
|
|
|
|
|
|
|
|
|
|
|
|
// the year
|
|
|
|
// the year
|
|
|
|
dateTimeString.tqreplace( "%Y", TQString::number( date.year() ) );
|
|
|
|
dateTimeString.replace( "%Y", TQString::number( date.year() ) );
|
|
|
|
dateTimeString.tqreplace( "%y", TQString::number( date.year() ).right(2) );
|
|
|
|
dateTimeString.replace( "%y", TQString::number( date.year() ).right(2) );
|
|
|
|
|
|
|
|
|
|
|
|
// the month
|
|
|
|
// the month
|
|
|
|
if(date.month()<10)
|
|
|
|
if(date.month()<10)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dateTimeString.tqreplace( "%m", "0"+TQString::number( date.month() ) );
|
|
|
|
dateTimeString.replace( "%m", "0"+TQString::number( date.month() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dateTimeString.tqreplace( "%m", TQString::number( date.month() ) );
|
|
|
|
dateTimeString.replace( "%m", TQString::number( date.month() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dateTimeString.tqreplace( "%f", TQString::number( date.month() ) );
|
|
|
|
dateTimeString.replace( "%f", TQString::number( date.month() ) );
|
|
|
|
|
|
|
|
|
|
|
|
dateTimeString.tqreplace( "%b", date.longMonthName(date.month()) );
|
|
|
|
dateTimeString.replace( "%b", date.longMonthName(date.month()) );
|
|
|
|
dateTimeString.tqreplace( "%h", date.longMonthName(date.month()) );
|
|
|
|
dateTimeString.replace( "%h", date.longMonthName(date.month()) );
|
|
|
|
|
|
|
|
|
|
|
|
// the day
|
|
|
|
// the day
|
|
|
|
dateTimeString.tqreplace( "%j", TQString::number( date.dayOfYear() ) );
|
|
|
|
dateTimeString.replace( "%j", TQString::number( date.dayOfYear() ) );
|
|
|
|
dateTimeString.tqreplace( "%e", TQString::number( date.day() ) );
|
|
|
|
dateTimeString.replace( "%e", TQString::number( date.day() ) );
|
|
|
|
if(date.day() < 10)
|
|
|
|
if(date.day() < 10)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dateTimeString.tqreplace( "%d", "0"+TQString::number( date.day() ) );
|
|
|
|
dateTimeString.replace( "%d", "0"+TQString::number( date.day() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dateTimeString.tqreplace( "%d", TQString::number( date.day() ) );
|
|
|
|
dateTimeString.replace( "%d", TQString::number( date.day() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dateTimeString.tqreplace( "%a", date.longDayName( date.dayOfWeek() ) );
|
|
|
|
dateTimeString.replace( "%a", date.longDayName( date.dayOfWeek() ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// hour
|
|
|
|
// hour
|
|
|
|
dateTimeString.tqreplace( "%k", TQString::number( time.hour() ) );
|
|
|
|
dateTimeString.replace( "%k", TQString::number( time.hour() ) );
|
|
|
|
|
|
|
|
|
|
|
|
if(time.hour() < 10)
|
|
|
|
if(time.hour() < 10)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dateTimeString.tqreplace( "%H", "0"+TQString::number( time.hour() ) );
|
|
|
|
dateTimeString.replace( "%H", "0"+TQString::number( time.hour() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dateTimeString.tqreplace( "%H", TQString::number( time.hour() ) );
|
|
|
|
dateTimeString.replace( "%H", TQString::number( time.hour() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString zone; // AM or PM
|
|
|
|
TQString zone; // AM or PM
|
|
|
@ -1888,46 +1888,46 @@ TQString Catalog::dateTime() const
|
|
|
|
zone="AM";
|
|
|
|
zone="AM";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dateTimeString.tqreplace( "%I", TQString::number( hour ) );
|
|
|
|
dateTimeString.replace( "%I", TQString::number( hour ) );
|
|
|
|
|
|
|
|
|
|
|
|
if(hour < 10)
|
|
|
|
if(hour < 10)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dateTimeString.tqreplace( "%i", "0"+TQString::number( hour ) );
|
|
|
|
dateTimeString.replace( "%i", "0"+TQString::number( hour ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dateTimeString.tqreplace( "%i", TQString::number( hour ) );
|
|
|
|
dateTimeString.replace( "%i", TQString::number( hour ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dateTimeString.tqreplace( "%p", zone );
|
|
|
|
dateTimeString.replace( "%p", zone );
|
|
|
|
|
|
|
|
|
|
|
|
// minutes
|
|
|
|
// minutes
|
|
|
|
if(time.minute() < 10)
|
|
|
|
if(time.minute() < 10)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dateTimeString.tqreplace( "%M", "0"+TQString::number( time.minute() ) );
|
|
|
|
dateTimeString.replace( "%M", "0"+TQString::number( time.minute() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dateTimeString.tqreplace( "%M", TQString::number( time.minute() ) );
|
|
|
|
dateTimeString.replace( "%M", TQString::number( time.minute() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// seconds
|
|
|
|
// seconds
|
|
|
|
if(time.second() < 10)
|
|
|
|
if(time.second() < 10)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dateTimeString.tqreplace( "%S", "0"+TQString::number( time.second() ) );
|
|
|
|
dateTimeString.replace( "%S", "0"+TQString::number( time.second() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dateTimeString.tqreplace( "%S", TQString::number( time.second() ) );
|
|
|
|
dateTimeString.replace( "%S", TQString::number( time.second() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// timezone
|
|
|
|
// timezone
|
|
|
|
dateTimeString.tqreplace( "%Z", d->_project->identitySettings().timeZone );
|
|
|
|
dateTimeString.replace( "%Z", d->_project->identitySettings().timeZone );
|
|
|
|
TQTime t;
|
|
|
|
TQTime t;
|
|
|
|
const int offset = KRFCDate::localUTCOffset();
|
|
|
|
const int offset = KRFCDate::localUTCOffset();
|
|
|
|
const int correction = offset < 0 ? -60 : 60;
|
|
|
|
const int correction = offset < 0 ? -60 : 60;
|
|
|
|
t = t.addSecs( offset * correction );
|
|
|
|
t = t.addSecs( offset * correction );
|
|
|
|
dateTimeString.tqreplace( "%z", ( offset < 0 ? "-" : "+" ) + t.toString("hhmm") );
|
|
|
|
dateTimeString.replace( "%z", ( offset < 0 ? "-" : "+" ) + t.toString("hhmm") );
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2179,72 +2179,72 @@ PoInfo Catalog::headerInfo(const CatalogItem headerItem)
|
|
|
|
// extract information from the header
|
|
|
|
// extract information from the header
|
|
|
|
for(it=header.begin();it!=header.end();++it)
|
|
|
|
for(it=header.begin();it!=header.end();++it)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if((*it).tqcontains(TQRegExp("^\\s*Project-Id-Version\\s*:\\s*.+\\s*$")))
|
|
|
|
if((*it).contains(TQRegExp("^\\s*Project-Id-Version\\s*:\\s*.+\\s*$")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
info.project=(*it).tqreplace(TQRegExp("^\\s*Project-Id-Version\\s*:\\s*"),"");
|
|
|
|
info.project=(*it).replace(TQRegExp("^\\s*Project-Id-Version\\s*:\\s*"),"");
|
|
|
|
|
|
|
|
|
|
|
|
if(info.project.right(2)=="\\n")
|
|
|
|
if(info.project.right(2)=="\\n")
|
|
|
|
info.project.remove(info.project.length()-2,2);
|
|
|
|
info.project.remove(info.project.length()-2,2);
|
|
|
|
|
|
|
|
|
|
|
|
info.project=info.project.simplifyWhiteSpace();
|
|
|
|
info.project=info.project.simplifyWhiteSpace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if((*it).tqcontains(TQRegExp("^\\s*POT-Creation-Date\\s*:\\s*.+\\s*$")))
|
|
|
|
else if((*it).contains(TQRegExp("^\\s*POT-Creation-Date\\s*:\\s*.+\\s*$")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
info.creation=(*it).tqreplace(TQRegExp("^\\s*POT-Creation-Date\\s*:\\s*"),"");
|
|
|
|
info.creation=(*it).replace(TQRegExp("^\\s*POT-Creation-Date\\s*:\\s*"),"");
|
|
|
|
|
|
|
|
|
|
|
|
if(info.creation.right(2)=="\\n")
|
|
|
|
if(info.creation.right(2)=="\\n")
|
|
|
|
info.creation.remove(info.creation.length()-2,2);
|
|
|
|
info.creation.remove(info.creation.length()-2,2);
|
|
|
|
|
|
|
|
|
|
|
|
info.creation=info.creation.simplifyWhiteSpace();
|
|
|
|
info.creation=info.creation.simplifyWhiteSpace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if((*it).tqcontains(TQRegExp("^\\s*PO-Revision-Date\\s*:\\s*.+\\s*$")))
|
|
|
|
else if((*it).contains(TQRegExp("^\\s*PO-Revision-Date\\s*:\\s*.+\\s*$")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
info.revision=(*it).tqreplace(TQRegExp("^\\s*PO-Revision-Date\\s*:\\s*"),"");
|
|
|
|
info.revision=(*it).replace(TQRegExp("^\\s*PO-Revision-Date\\s*:\\s*"),"");
|
|
|
|
|
|
|
|
|
|
|
|
if(info.revision.right(2)=="\\n")
|
|
|
|
if(info.revision.right(2)=="\\n")
|
|
|
|
info.revision.remove(info.revision.length()-2,2);
|
|
|
|
info.revision.remove(info.revision.length()-2,2);
|
|
|
|
|
|
|
|
|
|
|
|
info.revision=info.revision.simplifyWhiteSpace();
|
|
|
|
info.revision=info.revision.simplifyWhiteSpace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if((*it).tqcontains(TQRegExp("^\\s*Last-Translator\\s*:\\s*.+\\s*$")))
|
|
|
|
else if((*it).contains(TQRegExp("^\\s*Last-Translator\\s*:\\s*.+\\s*$")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
info.lastTranslator=(*it).tqreplace(TQRegExp("^\\s*Last-Translator\\s*:\\s*"),"");
|
|
|
|
info.lastTranslator=(*it).replace(TQRegExp("^\\s*Last-Translator\\s*:\\s*"),"");
|
|
|
|
|
|
|
|
|
|
|
|
if(info.lastTranslator.right(2)=="\\n")
|
|
|
|
if(info.lastTranslator.right(2)=="\\n")
|
|
|
|
info.lastTranslator.remove(info.lastTranslator.length()-2,2);
|
|
|
|
info.lastTranslator.remove(info.lastTranslator.length()-2,2);
|
|
|
|
|
|
|
|
|
|
|
|
info.lastTranslator=info.lastTranslator.simplifyWhiteSpace();
|
|
|
|
info.lastTranslator=info.lastTranslator.simplifyWhiteSpace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if((*it).tqcontains(TQRegExp("^\\s*Language-Team\\s*:\\s*.+\\s*")))
|
|
|
|
else if((*it).contains(TQRegExp("^\\s*Language-Team\\s*:\\s*.+\\s*")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
info.languageTeam=(*it).tqreplace(TQRegExp("^\\s*Language-Team\\s*:\\s*"),"");
|
|
|
|
info.languageTeam=(*it).replace(TQRegExp("^\\s*Language-Team\\s*:\\s*"),"");
|
|
|
|
|
|
|
|
|
|
|
|
if(info.languageTeam.right(2)=="\\n")
|
|
|
|
if(info.languageTeam.right(2)=="\\n")
|
|
|
|
info.languageTeam.remove(info.languageTeam.length()-2,2);
|
|
|
|
info.languageTeam.remove(info.languageTeam.length()-2,2);
|
|
|
|
|
|
|
|
|
|
|
|
info.languageTeam=info.languageTeam.simplifyWhiteSpace();
|
|
|
|
info.languageTeam=info.languageTeam.simplifyWhiteSpace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if((*it).tqcontains(TQRegExp("^\\s*MIME-Version\\s*:\\s*.+\\s*")))
|
|
|
|
else if((*it).contains(TQRegExp("^\\s*MIME-Version\\s*:\\s*.+\\s*")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
info.mimeVersion=(*it).tqreplace(TQRegExp("^\\s*MIME-Version\\s*:\\s*"),"");
|
|
|
|
info.mimeVersion=(*it).replace(TQRegExp("^\\s*MIME-Version\\s*:\\s*"),"");
|
|
|
|
|
|
|
|
|
|
|
|
if(info.mimeVersion.right(2)=="\\n")
|
|
|
|
if(info.mimeVersion.right(2)=="\\n")
|
|
|
|
info.mimeVersion.remove(info.mimeVersion.length()-2,2);
|
|
|
|
info.mimeVersion.remove(info.mimeVersion.length()-2,2);
|
|
|
|
|
|
|
|
|
|
|
|
info.mimeVersion=info.mimeVersion.simplifyWhiteSpace();
|
|
|
|
info.mimeVersion=info.mimeVersion.simplifyWhiteSpace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if((*it).tqcontains(TQRegExp("^\\s*Content-Type\\s*:\\s*.+\\s*")))
|
|
|
|
else if((*it).contains(TQRegExp("^\\s*Content-Type\\s*:\\s*.+\\s*")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
info.contentType=(*it).tqreplace(TQRegExp("^\\s*Content-Type\\s*:\\s*"),"");
|
|
|
|
info.contentType=(*it).replace(TQRegExp("^\\s*Content-Type\\s*:\\s*"),"");
|
|
|
|
|
|
|
|
|
|
|
|
if(info.contentType.right(2)=="\\n")
|
|
|
|
if(info.contentType.right(2)=="\\n")
|
|
|
|
info.contentType.remove(info.contentType.length()-2,2);
|
|
|
|
info.contentType.remove(info.contentType.length()-2,2);
|
|
|
|
|
|
|
|
|
|
|
|
info.contentType=info.contentType.simplifyWhiteSpace();
|
|
|
|
info.contentType=info.contentType.simplifyWhiteSpace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if((*it).tqcontains(TQRegExp("^\\s*Content-Transfer-Encoding\\s*:\\s*.+\\s*")))
|
|
|
|
else if((*it).contains(TQRegExp("^\\s*Content-Transfer-Encoding\\s*:\\s*.+\\s*")))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
info.encoding=(*it).tqreplace(TQRegExp("^\\s*Content-Transfer-Encoding\\s*:\\s*"),"");
|
|
|
|
info.encoding=(*it).replace(TQRegExp("^\\s*Content-Transfer-Encoding\\s*:\\s*"),"");
|
|
|
|
|
|
|
|
|
|
|
|
if(info.encoding.right(2)=="\\n")
|
|
|
|
if(info.encoding.right(2)=="\\n")
|
|
|
|
info.encoding.remove(info.encoding.length()-2,2);
|
|
|
|
info.encoding.remove(info.encoding.length()-2,2);
|
|
|
@ -2590,9 +2590,9 @@ bool Catalog::findNext(const FindOptions* findOpts, DocPosition& docPos, int& le
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(findOpts->ignoreAccelMarker
|
|
|
|
if(findOpts->ignoreAccelMarker
|
|
|
|
&& targetStr.tqcontains(miscOptions.accelMarker))
|
|
|
|
&& targetStr.contains(miscOptions.accelMarker))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
accelMarkerPos = targetStr.tqfind(miscOptions.accelMarker);
|
|
|
|
accelMarkerPos = targetStr.find(miscOptions.accelMarker);
|
|
|
|
targetStr.remove(accelMarkerPos,1);
|
|
|
|
targetStr.remove(accelMarkerPos,1);
|
|
|
|
|
|
|
|
|
|
|
|
if(docPos.offset > (uint)accelMarkerPos)
|
|
|
|
if(docPos.offset > (uint)accelMarkerPos)
|
|
|
@ -2605,7 +2605,7 @@ bool Catalog::findNext(const FindOptions* findOpts, DocPosition& docPos, int& le
|
|
|
|
if(findOpts->wholeWords) {
|
|
|
|
if(findOpts->wholeWords) {
|
|
|
|
TQString pre=targetStr.mid(pos-1,1);
|
|
|
|
TQString pre=targetStr.mid(pos-1,1);
|
|
|
|
TQString post=targetStr.mid(pos+len,1);
|
|
|
|
TQString post=targetStr.mid(pos+len,1);
|
|
|
|
if(!pre.tqcontains(TQRegExp("[a-zA-Z0-9]")) && !post.tqcontains(TQRegExp("[a-zA-Z0-9]")) ){
|
|
|
|
if(!pre.contains(TQRegExp("[a-zA-Z0-9]")) && !post.contains(TQRegExp("[a-zA-Z0-9]")) ){
|
|
|
|
success=true;
|
|
|
|
success=true;
|
|
|
|
docPos.offset=pos;
|
|
|
|
docPos.offset=pos;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2617,13 +2617,13 @@ bool Catalog::findNext(const FindOptions* findOpts, DocPosition& docPos, int& le
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
if( (pos=targetStr.tqfind(searchStr,docPos.offset,findOpts->caseSensitive)) >= 0 ) {
|
|
|
|
if( (pos=targetStr.find(searchStr,docPos.offset,findOpts->caseSensitive)) >= 0 ) {
|
|
|
|
len=searchStr.length();
|
|
|
|
len=searchStr.length();
|
|
|
|
|
|
|
|
|
|
|
|
if(findOpts->wholeWords) {
|
|
|
|
if(findOpts->wholeWords) {
|
|
|
|
TQString pre=targetStr.mid(pos-1,1);
|
|
|
|
TQString pre=targetStr.mid(pos-1,1);
|
|
|
|
TQString post=targetStr.mid(pos+len,1);
|
|
|
|
TQString post=targetStr.mid(pos+len,1);
|
|
|
|
if(!pre.tqcontains(TQRegExp("[a-zA-Z0-9]")) && !post.tqcontains(TQRegExp("[a-zA-Z0-9]")) ){
|
|
|
|
if(!pre.contains(TQRegExp("[a-zA-Z0-9]")) && !post.contains(TQRegExp("[a-zA-Z0-9]")) ){
|
|
|
|
success=true;
|
|
|
|
success=true;
|
|
|
|
docPos.offset=pos;
|
|
|
|
docPos.offset=pos;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2839,9 +2839,9 @@ bool Catalog::findPrev(const FindOptions* findOpts, DocPosition& docPos, int& le
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(findOpts->ignoreAccelMarker
|
|
|
|
if(findOpts->ignoreAccelMarker
|
|
|
|
&& targetStr.tqcontains(miscOptions.accelMarker))
|
|
|
|
&& targetStr.contains(miscOptions.accelMarker))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
accelMarkerPos = targetStr.tqfind(miscOptions.accelMarker);
|
|
|
|
accelMarkerPos = targetStr.find(miscOptions.accelMarker);
|
|
|
|
targetStr.remove(accelMarkerPos,1);
|
|
|
|
targetStr.remove(accelMarkerPos,1);
|
|
|
|
|
|
|
|
|
|
|
|
if(docPos.offset > (uint)accelMarkerPos)
|
|
|
|
if(docPos.offset > (uint)accelMarkerPos)
|
|
|
@ -2854,7 +2854,7 @@ bool Catalog::findPrev(const FindOptions* findOpts, DocPosition& docPos, int& le
|
|
|
|
else if( findOpts->isRegExp ) {
|
|
|
|
else if( findOpts->isRegExp ) {
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
don't work!?
|
|
|
|
don't work!?
|
|
|
|
if((pos=targetStr.tqfindRev(regexp,docPos.offset)) >= 0 ) {
|
|
|
|
if((pos=targetStr.findRev(regexp,docPos.offset)) >= 0 ) {
|
|
|
|
regexp.match(targetStr,pos,&len); // to get the length of the string
|
|
|
|
regexp.match(targetStr,pos,&len); // to get the length of the string
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool found=false;
|
|
|
|
bool found=false;
|
|
|
@ -2871,7 +2871,7 @@ bool Catalog::findPrev(const FindOptions* findOpts, DocPosition& docPos, int& le
|
|
|
|
if(findOpts->wholeWords) {
|
|
|
|
if(findOpts->wholeWords) {
|
|
|
|
TQString pre=targetStr.mid(pos-1,1);
|
|
|
|
TQString pre=targetStr.mid(pos-1,1);
|
|
|
|
TQString post=targetStr.mid(pos+len,1);
|
|
|
|
TQString post=targetStr.mid(pos+len,1);
|
|
|
|
if(!pre.tqcontains(TQRegExp("[a-zA-Z0-9]")) && !post.tqcontains(TQRegExp("[a-zA-Z0-9]")) ){
|
|
|
|
if(!pre.contains(TQRegExp("[a-zA-Z0-9]")) && !post.contains(TQRegExp("[a-zA-Z0-9]")) ){
|
|
|
|
success=true;
|
|
|
|
success=true;
|
|
|
|
docPos.offset=pos;
|
|
|
|
docPos.offset=pos;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2882,13 +2882,13 @@ bool Catalog::findPrev(const FindOptions* findOpts, DocPosition& docPos, int& le
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if( (pos=targetStr.tqfindRev(searchStr,docPos.offset-1,findOpts->caseSensitive)) >= 0
|
|
|
|
else if( (pos=targetStr.findRev(searchStr,docPos.offset-1,findOpts->caseSensitive)) >= 0
|
|
|
|
&& (uint)pos < docPos.offset) {
|
|
|
|
&& (uint)pos < docPos.offset) {
|
|
|
|
len=searchStr.length();
|
|
|
|
len=searchStr.length();
|
|
|
|
if(findOpts->wholeWords) {
|
|
|
|
if(findOpts->wholeWords) {
|
|
|
|
TQString pre=targetStr.mid(pos-1,1);
|
|
|
|
TQString pre=targetStr.mid(pos-1,1);
|
|
|
|
TQString post=targetStr.mid(pos+len,1);
|
|
|
|
TQString post=targetStr.mid(pos+len,1);
|
|
|
|
if(!pre.tqcontains(TQRegExp("[a-zA-Z0-9]")) && !post.tqcontains(TQRegExp("[a-zA-Z0-9]")) ){
|
|
|
|
if(!pre.contains(TQRegExp("[a-zA-Z0-9]")) && !post.contains(TQRegExp("[a-zA-Z0-9]")) ){
|
|
|
|
success=true;
|
|
|
|
success=true;
|
|
|
|
docPos.offset=pos;
|
|
|
|
docPos.offset=pos;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -3071,8 +3071,8 @@ Catalog::DiffResult Catalog::diff(uint entry, TQString *result)
|
|
|
|
// then look if the same msgid is contained in the diff file
|
|
|
|
// then look if the same msgid is contained in the diff file
|
|
|
|
// FIXME: should care about plural forms in msgid
|
|
|
|
// FIXME: should care about plural forms in msgid
|
|
|
|
TQString id = msgid(entry).first();
|
|
|
|
TQString id = msgid(entry).first();
|
|
|
|
id.tqreplace( "\n","");
|
|
|
|
id.replace( "\n","");
|
|
|
|
if(d->msgidDiffList.tqcontains(id))
|
|
|
|
if(d->msgidDiffList.contains(id))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// FIXME:: should care about plural forms in msgid
|
|
|
|
// FIXME:: should care about plural forms in msgid
|
|
|
|
*result = msgid(entry).first();
|
|
|
|
*result = msgid(entry).first();
|
|
|
@ -3091,8 +3091,8 @@ Catalog::DiffResult Catalog::diff(uint entry, TQString *result)
|
|
|
|
// then look if there are entries with the same translation
|
|
|
|
// then look if there are entries with the same translation
|
|
|
|
kdWarning() << "Diff feature (2) does not work with plural forms" << endl;
|
|
|
|
kdWarning() << "Diff feature (2) does not work with plural forms" << endl;
|
|
|
|
TQString str = msgstr(entry).first();
|
|
|
|
TQString str = msgstr(entry).first();
|
|
|
|
str.tqreplace("\n","");
|
|
|
|
str.replace("\n","");
|
|
|
|
if(d->msgstr2MsgidDiffList.tqcontains(str))
|
|
|
|
if(d->msgstr2MsgidDiffList.contains(str))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList list = d->msgstr2MsgidDiffList[str];
|
|
|
|
TQStringList list = d->msgstr2MsgidDiffList[str];
|
|
|
|
|
|
|
|
|
|
|
@ -3193,7 +3193,7 @@ Catalog::DiffResult Catalog::diff(uint entry, TQString *result)
|
|
|
|
TQString r = wordDiff(idForDiff,id);
|
|
|
|
TQString r = wordDiff(idForDiff,id);
|
|
|
|
|
|
|
|
|
|
|
|
//esp for plural forms
|
|
|
|
//esp for plural forms
|
|
|
|
*result = r.tqreplace("\\n<KBABELADD>" + TQString(TQChar(0x00B6)) + "</KBABELADD>", "\\n\n");
|
|
|
|
*result = r.replace("\\n<KBABELADD>" + TQString(TQChar(0x00B6)) + "</KBABELADD>", "\\n\n");
|
|
|
|
|
|
|
|
|
|
|
|
s = new TQString(*result);
|
|
|
|
s = new TQString(*result);
|
|
|
|
if( !d->diffCache.insert(entry,s) )
|
|
|
|
if( !d->diffCache.insert(entry,s) )
|
|
|
@ -3236,14 +3236,14 @@ void Catalog::setDiffList( const TQValueList<DiffEntry>& list)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString id = (*it).msgid;
|
|
|
|
TQString id = (*it).msgid;
|
|
|
|
id.tqreplace("\n","");
|
|
|
|
id.replace("\n","");
|
|
|
|
TQString str = (*it).msgstr;
|
|
|
|
TQString str = (*it).msgstr;
|
|
|
|
str.tqreplace("\n","");
|
|
|
|
str.replace("\n","");
|
|
|
|
d->msgidDiffList.append(id);
|
|
|
|
d->msgidDiffList.append(id);
|
|
|
|
|
|
|
|
|
|
|
|
if(!str.isEmpty())
|
|
|
|
if(!str.isEmpty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(d->msgstr2MsgidDiffList.tqcontains(str))
|
|
|
|
if(d->msgstr2MsgidDiffList.contains(str))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList sl = d->msgstr2MsgidDiffList[str];
|
|
|
|
TQStringList sl = d->msgstr2MsgidDiffList[str];
|
|
|
|
sl.append(id);
|
|
|
|
sl.append(id);
|
|
|
@ -3506,4 +3506,4 @@ void Catalog::wordCount (uint &total, uint &fuzzy, uint &untranslated) const
|
|
|
|
|
|
|
|
|
|
|
|
#include "catalog.moc"
|
|
|
|
#include "catalog.moc"
|
|
|
|
|
|
|
|
|
|
|
|
// kate: space-indent on; indent-width 4; tqreplace-tabs on;
|
|
|
|
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
|