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();