Advertisement
Guest User

Untitled

a guest
Mar 30th, 2010
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 12.64 KB | None | 0 0
  1. Index: okular/core/fileprinter.cpp
  2. ===================================================================
  3. --- okular/core/fileprinter.cpp (revision 1109126)
  4. +++ okular/core/fileprinter.cpp (working copy)
  5. @@ -342,7 +342,7 @@
  6.          return QStringList("-d") << printer.printerName();
  7.      }
  8.  
  9. -    if ( version.startsWith( "lpr" ) ) {
  10. +    if ( version.startsWith( QLatin1String("lpr") ) ) {
  11.          return QStringList("-P") << printer.printerName();
  12.      }
  13.  
  14. @@ -357,7 +357,7 @@
  15.          return QStringList("-n") << QString("%1").arg( cp );
  16.      }
  17.  
  18. -    if ( version.startsWith( "lpr" ) ) {
  19. +    if ( version.startsWith( QLatin1String("lpr") ) ) {
  20.          return QStringList() << QString("-#%1").arg( cp );
  21.      }
  22.  
  23. @@ -372,7 +372,7 @@
  24.              return QStringList("-t") << printer.docName();
  25.          }
  26.  
  27. -        if ( version.startsWith( "lpr" ) ) {
  28. +        if ( version.startsWith( QLatin1String("lpr") ) ) {
  29.              return QStringList("-J") << printer.docName();
  30.          }
  31.      }
  32. @@ -382,7 +382,7 @@
  33.  
  34.  QStringList FilePrinter::deleteFile( QPrinter &printer, FileDeletePolicy fileDeletePolicy, const QString &version )
  35.  {
  36. -    if ( fileDeletePolicy == FilePrinter::SystemDeletesFiles && version.startsWith( "lpr" ) ) {
  37. +    if ( fileDeletePolicy == FilePrinter::SystemDeletesFiles && version.startsWith( QLatin1String("lpr") ) ) {
  38.          return QStringList("-r");
  39.      }
  40.  
  41. @@ -400,7 +400,7 @@
  42.                  return QStringList("-P") << pageRange ;
  43.              }
  44.  
  45. -            if ( version.startsWith( "lpr" ) && useCupsOptions ) {
  46. +            if ( version.startsWith( QLatin1String("lpr") ) && useCupsOptions ) {
  47.                  return QStringList("-o") << QString("page-ranges=%1").arg( pageRange );
  48.              }
  49.  
  50. @@ -413,7 +413,7 @@
  51.                                                              .arg( printer.toPage() );
  52.              }
  53.  
  54. -            if ( version.startsWith( "lpr" ) && useCupsOptions ) {
  55. +            if ( version.startsWith( QLatin1String("lpr") ) && useCupsOptions ) {
  56.                  return QStringList("-o") << QString("page-ranges=%1-%2").arg( printer.fromPage() )
  57.                                                                          .arg( printer.toPage() );
  58.              }
  59. Index: okular/core/document.cpp
  60. ===================================================================
  61. --- okular/core/document.cpp    (revision 1109126)
  62. +++ okular/core/document.cpp    (working copy)
  63. @@ -245,7 +245,7 @@
  64.      {
  65.          QString entry = readStream.readLine();
  66.          if ( entry.isNull() ) break;
  67. -        if ( entry.startsWith( "MemTotal:" ) )
  68. +        if ( entry.startsWith( QLatin1String("MemTotal:") ) )
  69.              return (cachedValue = (Q_UINT64_C(1024) * entry.section( ' ', -2, -2 ).toULongLong()));
  70.      }
  71.  #elif defined(Q_OS_WIN)
  72. @@ -281,12 +281,12 @@
  73.      {
  74.          entry = readStream.readLine();
  75.          if ( entry.isNull() ) break;
  76. -        if ( entry.startsWith( "MemFree:" ) ||
  77. -                entry.startsWith( "Buffers:" ) ||
  78. -                entry.startsWith( "Cached:" ) ||
  79. -                entry.startsWith( "SwapFree:" ) )
  80. +        if ( entry.startsWith( QLatin1String("MemFree:") ) ||
  81. +                entry.startsWith( QLatin1String("Buffers:") ) ||
  82. +                entry.startsWith( QLatin1String("Cached:") ) ||
  83. +                entry.startsWith( QLatin1String("SwapFree:") ) )
  84.              memoryFree += entry.section( ' ', -2, -2 ).toULongLong();
  85. -        if ( entry.startsWith( "SwapTotal:" ) )
  86. +        if ( entry.startsWith( QLatin1String("SwapTotal:") ) )
  87.              memoryFree -= entry.section( ' ', -2, -2 ).toULongLong();
  88.      }
  89.      memFile.close();
  90. @@ -2860,7 +2860,7 @@
  91.          case Action::Execute: {
  92.              const ExecuteAction * exe  = static_cast< const ExecuteAction * >( action );
  93.              QString fileName = exe->fileName();
  94. -            if ( fileName.endsWith( ".pdf" ) || fileName.endsWith( ".PDF" ) )
  95. +            if ( fileName.endsWith( QLatin1String(".pdf") ) || fileName.endsWith( QLatin1String(".PDF") ) )
  96.              {
  97.                  d->openRelativeFile( fileName );
  98.                  return;
  99. @@ -2956,7 +2956,7 @@
  100.              QString lilySource;
  101.              int lilyRow = 0, lilyCol = 0;
  102.              // if the url is a mailto one, invoke mailer
  103. -            if ( browse->url().startsWith( "mailto:", Qt::CaseInsensitive ) )
  104. +            if ( browse->url().startsWith( QLatin1String("mailto:"), Qt::CaseInsensitive ) )
  105.                  KToolInvocation::invokeMailer( browse->url() );
  106.              else if ( extractLilyPondSourceReference( browse->url(), &lilySource, &lilyRow, &lilyCol ) )
  107.              {
  108. @@ -3651,14 +3651,14 @@
  109.              if ( !ok )
  110.                  return;
  111.          }
  112. -        else if ( token.startsWith( "C1" ) )
  113. +        else if ( token.startsWith( QLatin1String("C1") ) )
  114.          {
  115.              rePos.enabled = true;
  116.              rePos.normalizedX = token.section( ':', 1, 1 ).toDouble();
  117.              rePos.normalizedY = token.section( ':', 2, 2 ).toDouble();
  118.              rePos.pos = Center;
  119.          }
  120. -        else if ( token.startsWith( "C2" ) )
  121. +        else if ( token.startsWith( QLatin1String("C2") ) )
  122.          {
  123.              rePos.enabled = true;
  124.              rePos.normalizedX = token.section( ':', 1, 1 ).toDouble();
  125. @@ -3666,7 +3666,7 @@
  126.              if (token.section( ':', 3, 3 ).toInt() == 1) rePos.pos = Center;
  127.              else rePos.pos = TopLeft;
  128.          }
  129. -        else if ( token.startsWith( "AF1" ) )
  130. +        else if ( token.startsWith( QLatin1String("AF1") ) )
  131.          {
  132.              autoFit.enabled = true;
  133.              autoFit.width = token.section( ':', 1, 1 ) == "T";
  134. Index: okular/generators/poppler/generator_pdf.cpp
  135. ===================================================================
  136. --- okular/generators/poppler/generator_pdf.cpp (revision 1109126)
  137. +++ okular/generators/poppler/generator_pdf.cpp (working copy)
  138. @@ -963,7 +963,7 @@
  139.  
  140.          // if option starts with "src:" assume that we are handling a
  141.          // source reference
  142. -        if ( optionString.startsWith( "src:", Qt::CaseInsensitive ) )
  143. +        if ( optionString.startsWith( QLatin1String("src:"), Qt::CaseInsensitive ) )
  144.          {
  145.              fillViewportFromSourceReference( viewport, optionString );
  146.          }
  147. Index: okular/generators/ooo/styleparser.cpp
  148. ===================================================================
  149. --- okular/generators/ooo/styleparser.cpp   (revision 1109126)
  150. +++ okular/generators/ooo/styleparser.cpp   (working copy)
  151. @@ -457,30 +457,30 @@
  152.    #define CC_TO_POINT(cc) ((cc)*12.840103)
  153.  
  154.    double points = 0;
  155. -  if ( data.endsWith( "pt" ) ) {
  156. +  if ( data.endsWith( QLatin1String("pt") ) ) {
  157.      points = data.left( data.length() - 2 ).toDouble();
  158. -  } else if ( data.endsWith( "cm" ) ) {
  159. +  } else if ( data.endsWith( QLatin1String("cm") ) ) {
  160.      double value = data.left( data.length() - 2 ).toDouble();
  161.      points = CM_TO_POINT( value );
  162. -  } else if ( data.endsWith( "mm" ) ) {
  163. +  } else if ( data.endsWith( QLatin1String("mm") ) ) {
  164.      double value = data.left( data.length() - 2 ).toDouble();
  165.      points = MM_TO_POINT( value );
  166. -  } else if ( data.endsWith( "dm" ) ) {
  167. +  } else if ( data.endsWith( QLatin1String("dm") ) ) {
  168.      double value = data.left( data.length() - 2 ).toDouble();
  169.      points = DM_TO_POINT( value );
  170. -  } else if ( data.endsWith( "in" ) ) {
  171. +  } else if ( data.endsWith( QLatin1String("in") ) ) {
  172.      double value = data.left( data.length() - 2 ).toDouble();
  173.      points = INCH_TO_POINT( value );
  174. -  } else if ( data.endsWith( "inch" ) ) {
  175. +  } else if ( data.endsWith( QLatin1String("inch") ) ) {
  176.      double value = data.left( data.length() - 4 ).toDouble();
  177.      points = INCH_TO_POINT( value );
  178. -  } else if ( data.endsWith( "pi" ) ) {
  179. +  } else if ( data.endsWith( QLatin1String("pi") ) ) {
  180.      double value = data.left( data.length() - 4 ).toDouble();
  181.      points = PI_TO_POINT( value );
  182. -  } else if ( data.endsWith( "dd" ) ) {
  183. +  } else if ( data.endsWith( QLatin1String("dd") ) ) {
  184.      double value = data.left( data.length() - 4 ).toDouble();
  185.      points = DD_TO_POINT( value );
  186. -  } else if ( data.endsWith( "cc" ) ) {
  187. +  } else if ( data.endsWith( QLatin1String("cc") ) ) {
  188.      double value = data.left( data.length() - 4 ).toDouble();
  189.      points = CC_TO_POINT( value );
  190.    } else {
  191. Index: okular/generators/comicbook/document.cpp
  192. ===================================================================
  193. --- okular/generators/comicbook/document.cpp    (revision 1109126)
  194. +++ okular/generators/comicbook/document.cpp    (working copy)
  195. @@ -151,12 +151,12 @@
  196.      for ( int i = 0; i < files.count(); ++i ) {
  197.          const QString lowerFile = files[ i ].toLower();
  198.  
  199. -        if ( lowerFile.endsWith( ".gif" ) ||
  200. -             lowerFile.endsWith( ".jpg" ) ||
  201. -             lowerFile.endsWith( ".jpeg" ) ||
  202. -             lowerFile.endsWith( ".png" ) ||
  203. -             lowerFile.endsWith( ".tif" ) ||
  204. -             lowerFile.endsWith( ".tiff" ) )
  205. +        if ( lowerFile.endsWith( QLatin1String(".gif") ) ||
  206. +             lowerFile.endsWith( QLatin1String(".jpg") ) ||
  207. +             lowerFile.endsWith( QLatin1String(".jpeg") ) ||
  208. +             lowerFile.endsWith( QLatin1String(".png") ) ||
  209. +             lowerFile.endsWith( QLatin1String(".tif") ) ||
  210. +             lowerFile.endsWith( QLatin1String(".tiff") ) )
  211.              mPageMap.append( files[ i ] );
  212.      }
  213.  }
  214. Index: okular/generators/comicbook/unrar.cpp
  215. ===================================================================
  216. --- okular/generators/comicbook/unrar.cpp   (revision 1109126)
  217. +++ okular/generators/comicbook/unrar.cpp   (working copy)
  218. @@ -49,11 +49,11 @@
  219.      const QStringList lines = QString::fromLocal8Bit( proc.readAllStandardOutput() ).split( "\n", QString::SkipEmptyParts );
  220.      if ( !lines.isEmpty() )
  221.      {
  222. -        if ( lines.first().startsWith( "UNRAR " ) )
  223. +        if ( lines.first().startsWith( QLatin1String("UNRAR ") ) )
  224.              kind = new NonFreeUnrarFlavour();
  225. -        else if ( lines.first().startsWith( "RAR " ) )
  226. +        else if ( lines.first().startsWith( QLatin1String("RAR ") ) )
  227.              kind = new NonFreeUnrarFlavour();
  228. -        else if ( lines.first().startsWith( "unrar " ) )
  229. +        else if ( lines.first().startsWith( QLatin1String("unrar ") ) )
  230.              kind = new FreeUnrarFlavour();
  231.      }
  232.      return kind;
  233. Index: okular/generators/fictionbook/document.cpp
  234. ===================================================================
  235. --- okular/generators/fictionbook/document.cpp  (revision 1109126)
  236. +++ okular/generators/fictionbook/document.cpp  (working copy)
  237. @@ -27,7 +27,7 @@
  238.  
  239.      QFile file( mFileName );
  240.      KZip zip( mFileName );
  241. -    if ( mFileName.endsWith( ".fb" ) || mFileName.endsWith( ".fb2" ) ) {
  242. +    if ( mFileName.endsWith( QLatin1String(".fb") ) || mFileName.endsWith( QLatin1String(".fb2") ) ) {
  243.          if ( !file.open( QIODevice::ReadOnly ) ) {
  244.              setError( i18n( "Unable to open document: %1", file.errorString() ) );
  245.              return false;
  246. @@ -50,7 +50,7 @@
  247.  
  248.          QString documentFile;
  249.          for ( int i = 0; i < entries.count(); ++i ) {
  250. -            if ( entries[ i ].endsWith( ".fb2" ) ) {
  251. +            if ( entries[ i ].endsWith( QLatin1String(".fb2") ) ) {
  252.                  documentFile = entries[ i ];
  253.                  break;
  254.              }
  255. Index: okular/generators/chm/generator_chm.cpp
  256. ===================================================================
  257. --- okular/generators/chm/generator_chm.cpp (revision 1109126)
  258. +++ okular/generators/chm/generator_chm.cpp (working copy)
  259. @@ -374,7 +374,7 @@
  260.                          QString url = n.attributes().getNamedItem("href").nodeValue().string();
  261.                          r=n.getRect();
  262.                          // there is no way for us to support javascript properly
  263. -                        if (url.startsWith("JavaScript:"), Qt::CaseInsensitive)
  264. +                        if (url.startsWith(QLatin1String("JavaScript:"), Qt::CaseInsensitive))
  265.                              continue;
  266.                          else if (url.contains (":"))
  267.                          {
  268. Index: okular/generators/fax/generator_fax.cpp
  269. ===================================================================
  270. --- okular/generators/fax/generator_fax.cpp (revision 1109126)
  271. +++ okular/generators/fax/generator_fax.cpp (working copy)
  272. @@ -53,7 +53,7 @@
  273.  bool FaxGenerator::loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector )
  274.  {
  275.      FaxDocument::DocumentType type;
  276. -    if ( fileName.toLower().endsWith( ".g3" ) )
  277. +    if ( fileName.toLower().endsWith( QLatin1String(".g3") ) )
  278.          type = FaxDocument::G3;
  279.      else
  280.          type = FaxDocument::G4;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement