Hey,
Here's the start of a few of krazy fixes.
This one passes QLatin1String's to QString::startsWith() and endsWith()
methods.
Index: okular/core/fileprinter.cpp
===================================================================
--- okular/core/fileprinter.cpp (revision 1109126)
+++ okular/core/fileprinter.cpp (working copy)
@@ -342,7 +342,7 @@
return QStringList("-d") << printer.printerName();
}
- if ( version.startsWith( "lpr" ) ) {
+ if ( version.startsWith( QLatin1String("lpr") ) ) {
return QStringList("-P") << printer.printerName();
}
@@ -357,7 +357,7 @@
return QStringList("-n") << QString("%1").arg( cp );
}
- if ( version.startsWith( "lpr" ) ) {
+ if ( version.startsWith( QLatin1String("lpr") ) ) {
return QStringList() << QString("-#%1").arg( cp );
}
@@ -372,7 +372,7 @@
return QStringList("-t") << printer.docName();
}
- if ( version.startsWith( "lpr" ) ) {
+ if ( version.startsWith( QLatin1String("lpr") ) ) {
return QStringList("-J") << printer.docName();
}
}
@@ -382,7 +382,7 @@
QStringList FilePrinter::deleteFile( QPrinter &printer, FileDeletePolicy fileDeletePolicy, const QString &version )
{
- if ( fileDeletePolicy == FilePrinter::SystemDeletesFiles && version.startsWith( "lpr" ) ) {
+ if ( fileDeletePolicy == FilePrinter::SystemDeletesFiles && version.startsWith( QLatin1String("lpr") ) ) {
return QStringList("-r");
}
@@ -400,7 +400,7 @@
return QStringList("-P") << pageRange ;
}
- if ( version.startsWith( "lpr" ) && useCupsOptions ) {
+ if ( version.startsWith( QLatin1String("lpr") ) && useCupsOptions ) {
return QStringList("-o") << QString("page-ranges=%1").arg( pageRange );
}
@@ -413,7 +413,7 @@
.arg( printer.toPage() );
}
- if ( version.startsWith( "lpr" ) && useCupsOptions ) {
+ if ( version.startsWith( QLatin1String("lpr") ) && useCupsOptions ) {
return QStringList("-o") << QString("page-ranges=%1-%2").arg( printer.fromPage() )
.arg( printer.toPage() );
}
Index: okular/core/document.cpp
===================================================================
--- okular/core/document.cpp (revision 1109126)
+++ okular/core/document.cpp (working copy)
@@ -245,7 +245,7 @@
{
QString entry = readStream.readLine();
if ( entry.isNull() ) break;
- if ( entry.startsWith( "MemTotal:" ) )
+ if ( entry.startsWith( QLatin1String("MemTotal:") ) )
return (cachedValue = (Q_UINT64_C(1024) * entry.section( ' ', -2, -2 ).toULongLong()));
}
#elif defined(Q_OS_WIN)
@@ -281,12 +281,12 @@
{
entry = readStream.readLine();
if ( entry.isNull() ) break;
- if ( entry.startsWith( "MemFree:" ) ||
- entry.startsWith( "Buffers:" ) ||
- entry.startsWith( "Cached:" ) ||
- entry.startsWith( "SwapFree:" ) )
+ if ( entry.startsWith( QLatin1String("MemFree:") ) ||
+ entry.startsWith( QLatin1String("Buffers:") ) ||
+ entry.startsWith( QLatin1String("Cached:") ) ||
+ entry.startsWith( QLatin1String("SwapFree:") ) )
memoryFree += entry.section( ' ', -2, -2 ).toULongLong();
- if ( entry.startsWith( "SwapTotal:" ) )
+ if ( entry.startsWith( QLatin1String("SwapTotal:") ) )
memoryFree -= entry.section( ' ', -2, -2 ).toULongLong();
}
memFile.close();
@@ -2860,7 +2860,7 @@
case Action::Execute: {
const ExecuteAction * exe = static_cast< const ExecuteAction * >( action );
QString fileName = exe->fileName();
- if ( fileName.endsWith( ".pdf" ) || fileName.endsWith( ".PDF" ) )
+ if ( fileName.endsWith( QLatin1String(".pdf") ) || fileName.endsWith( QLatin1String(".PDF") ) )
{
d->openRelativeFile( fileName );
return;
@@ -2956,7 +2956,7 @@
QString lilySource;
int lilyRow = 0, lilyCol = 0;
// if the url is a mailto one, invoke mailer
- if ( browse->url().startsWith( "mailto:", Qt::CaseInsensitive ) )
+ if ( browse->url().startsWith( QLatin1String("mailto:"), Qt::CaseInsensitive ) )
KToolInvocation::invokeMailer( browse->url() );
else if ( extractLilyPondSourceReference( browse->url(), &lilySource, &lilyRow, &lilyCol ) )
{
@@ -3651,14 +3651,14 @@
if ( !ok )
return;
}
- else if ( token.startsWith( "C1" ) )
+ else if ( token.startsWith( QLatin1String("C1") ) )
{
rePos.enabled = true;
rePos.normalizedX = token.section( ':', 1, 1 ).toDouble();
rePos.normalizedY = token.section( ':', 2, 2 ).toDouble();
rePos.pos = Center;
}
- else if ( token.startsWith( "C2" ) )
+ else if ( token.startsWith( QLatin1String("C2") ) )
{
rePos.enabled = true;
rePos.normalizedX = token.section( ':', 1, 1 ).toDouble();
@@ -3666,7 +3666,7 @@
if (token.section( ':', 3, 3 ).toInt() == 1) rePos.pos = Center;
else rePos.pos = TopLeft;
}
- else if ( token.startsWith( "AF1" ) )
+ else if ( token.startsWith( QLatin1String("AF1") ) )
{
autoFit.enabled = true;
autoFit.width = token.section( ':', 1, 1 ) == "T";
Index: okular/generators/poppler/generator_pdf.cpp
===================================================================
--- okular/generators/poppler/generator_pdf.cpp (revision 1109126)
+++ okular/generators/poppler/generator_pdf.cpp (working copy)
@@ -963,7 +963,7 @@
// if option starts with "src:" assume that we are handling a
// source reference
- if ( optionString.startsWith( "src:", Qt::CaseInsensitive ) )
+ if ( optionString.startsWith( QLatin1String("src:"), Qt::CaseInsensitive ) )
{
fillViewportFromSourceReference( viewport, optionString );
}
Index: okular/generators/ooo/styleparser.cpp
===================================================================
--- okular/generators/ooo/styleparser.cpp (revision 1109126)
+++ okular/generators/ooo/styleparser.cpp (working copy)
@@ -457,30 +457,30 @@
#define CC_TO_POINT(cc) ((cc)*12.840103)
double points = 0;
- if ( data.endsWith( "pt" ) ) {
+ if ( data.endsWith( QLatin1String("pt") ) ) {
points = data.left( data.length() - 2 ).toDouble();
- } else if ( data.endsWith( "cm" ) ) {
+ } else if ( data.endsWith( QLatin1String("cm") ) ) {
double value = data.left( data.length() - 2 ).toDouble();
points = CM_TO_POINT( value );
- } else if ( data.endsWith( "mm" ) ) {
+ } else if ( data.endsWith( QLatin1String("mm") ) ) {
double value = data.left( data.length() - 2 ).toDouble();
points = MM_TO_POINT( value );
- } else if ( data.endsWith( "dm" ) ) {
+ } else if ( data.endsWith( QLatin1String("dm") ) ) {
double value = data.left( data.length() - 2 ).toDouble();
points = DM_TO_POINT( value );
- } else if ( data.endsWith( "in" ) ) {
+ } else if ( data.endsWith( QLatin1String("in") ) ) {
double value = data.left( data.length() - 2 ).toDouble();
points = INCH_TO_POINT( value );
- } else if ( data.endsWith( "inch" ) ) {
+ } else if ( data.endsWith( QLatin1String("inch") ) ) {
double value = data.left( data.length() - 4 ).toDouble();
points = INCH_TO_POINT( value );
- } else if ( data.endsWith( "pi" ) ) {
+ } else if ( data.endsWith( QLatin1String("pi") ) ) {
double value = data.left( data.length() - 4 ).toDouble();
points = PI_TO_POINT( value );
- } else if ( data.endsWith( "dd" ) ) {
+ } else if ( data.endsWith( QLatin1String("dd") ) ) {
double value = data.left( data.length() - 4 ).toDouble();
points = DD_TO_POINT( value );
- } else if ( data.endsWith( "cc" ) ) {
+ } else if ( data.endsWith( QLatin1String("cc") ) ) {
double value = data.left( data.length() - 4 ).toDouble();
points = CC_TO_POINT( value );
} else {
Index: okular/generators/comicbook/document.cpp
===================================================================
--- okular/generators/comicbook/document.cpp (revision 1109126)
+++ okular/generators/comicbook/document.cpp (working copy)
@@ -151,12 +151,12 @@
for ( int i = 0; i < files.count(); ++i ) {
const QString lowerFile = files[ i ].toLower();
- if ( lowerFile.endsWith( ".gif" ) ||
- lowerFile.endsWith( ".jpg" ) ||
- lowerFile.endsWith( ".jpeg" ) ||
- lowerFile.endsWith( ".png" ) ||
- lowerFile.endsWith( ".tif" ) ||
- lowerFile.endsWith( ".tiff" ) )
+ if ( lowerFile.endsWith( QLatin1String(".gif") ) ||
+ lowerFile.endsWith( QLatin1String(".jpg") ) ||
+ lowerFile.endsWith( QLatin1String(".jpeg") ) ||
+ lowerFile.endsWith( QLatin1String(".png") ) ||
+ lowerFile.endsWith( QLatin1String(".tif") ) ||
+ lowerFile.endsWith( QLatin1String(".tiff") ) )
mPageMap.append( files[ i ] );
}
}
Index: okular/generators/comicbook/unrar.cpp
===================================================================
--- okular/generators/comicbook/unrar.cpp (revision 1109126)
+++ okular/generators/comicbook/unrar.cpp (working copy)
@@ -49,11 +49,11 @@
const QStringList lines = QString::fromLocal8Bit( proc.readAllStandardOutput() ).split( "\n", QString::SkipEmptyParts );
if ( !lines.isEmpty() )
{
- if ( lines.first().startsWith( "UNRAR " ) )
+ if ( lines.first().startsWith( QLatin1String("UNRAR ") ) )
kind = new NonFreeUnrarFlavour();
- else if ( lines.first().startsWith( "RAR " ) )
+ else if ( lines.first().startsWith( QLatin1String("RAR ") ) )
kind = new NonFreeUnrarFlavour();
- else if ( lines.first().startsWith( "unrar " ) )
+ else if ( lines.first().startsWith( QLatin1String("unrar ") ) )
kind = new FreeUnrarFlavour();
}
return kind;
Index: okular/generators/fictionbook/document.cpp
===================================================================
--- okular/generators/fictionbook/document.cpp (revision 1109126)
+++ okular/generators/fictionbook/document.cpp (working copy)
@@ -27,7 +27,7 @@
QFile file( mFileName );
KZip zip( mFileName );
- if ( mFileName.endsWith( ".fb" ) || mFileName.endsWith( ".fb2" ) ) {
+ if ( mFileName.endsWith( QLatin1String(".fb") ) || mFileName.endsWith( QLatin1String(".fb2") ) ) {
if ( !file.open( QIODevice::ReadOnly ) ) {
setError( i18n( "Unable to open document: %1", file.errorString() ) );
return false;
@@ -50,7 +50,7 @@
QString documentFile;
for ( int i = 0; i < entries.count(); ++i ) {
- if ( entries[ i ].endsWith( ".fb2" ) ) {
+ if ( entries[ i ].endsWith( QLatin1String(".fb2") ) ) {
documentFile = entries[ i ];
break;
}
Index: okular/generators/chm/generator_chm.cpp
===================================================================
--- okular/generators/chm/generator_chm.cpp (revision 1109126)
+++ okular/generators/chm/generator_chm.cpp (working copy)
@@ -374,7 +374,7 @@
QString url = n.attributes().getNamedItem("href").nodeValue().string();
r=n.getRect();
// there is no way for us to support javascript properly
- if (url.startsWith("JavaScript:"), Qt::CaseInsensitive)
+ if (url.startsWith(QLatin1String("JavaScript:"), Qt::CaseInsensitive))
continue;
else if (url.contains (":"))
{
Index: okular/generators/fax/generator_fax.cpp
===================================================================
--- okular/generators/fax/generator_fax.cpp (revision 1109126)
+++ okular/generators/fax/generator_fax.cpp (working copy)
@@ -53,7 +53,7 @@
bool FaxGenerator::loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector )
{
FaxDocument::DocumentType type;
- if ( fileName.toLower().endsWith( ".g3" ) )
+ if ( fileName.toLower().endsWith( QLatin1String(".g3") ) )
type = FaxDocument::G3;
else
type = FaxDocument::G4;
_______________________________________________
Okular-devel mailing list
Okular-devel@kde.org
https://mail.kde.org/mailman/listinfo/okular-devel