summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2015-10-29 12:37:11 (GMT)
committerMontel Laurent <montel@kde.org>2015-10-29 12:37:11 (GMT)
commit466eb79615ba313ff6ef418177a15a6961fbfb36 (patch)
tree1f4a663cd8088b732eb89e290d1dadb94663a4f4
parent8805760ccf0b59c50eb64788169cae11e006b087 (diff)
Use QStringLiteral
-rw-r--r--autotests/addremoveannotationtest.cpp12
-rw-r--r--autotests/annotationstest.cpp2
-rw-r--r--autotests/documenttest.cpp2
-rw-r--r--autotests/editannotationcontentstest.cpp100
-rw-r--r--autotests/editformstest.cpp34
-rw-r--r--autotests/mainshelltest.cpp22
-rw-r--r--autotests/modifyannotationpropertiestest.cpp6
-rw-r--r--autotests/parttest.cpp4
-rw-r--r--autotests/shelltest.cpp26
-rw-r--r--autotests/translateannotationtest.cpp2
-rw-r--r--autotests/urldetecttest.cpp32
-rw-r--r--conf/dlgannotations.cpp4
-rw-r--r--conf/dlggeneral.cpp2
-rw-r--r--conf/dlgperformance.cpp2
-rw-r--r--conf/dlgpresentation.cpp4
-rw-r--r--conf/editannottooldialog.cpp226
-rw-r--r--conf/preferencesdialog.cpp16
-rw-r--r--conf/widgetannottools.cpp2
-rw-r--r--core/action.cpp4
-rw-r--r--core/annotations.cpp442
-rw-r--r--core/bookmarkmanager.cpp10
-rw-r--r--core/document.cpp248
-rw-r--r--core/documentcommands.cpp6
-rw-r--r--core/fileprinter.cpp224
-rw-r--r--core/form.cpp2
-rw-r--r--core/generator.cpp14
-rw-r--r--core/movie.cpp2
-rw-r--r--core/page.cpp26
-rw-r--r--core/script/executor_kjs.cpp12
-rw-r--r--core/script/kjs_app.cpp82
-rw-r--r--core/script/kjs_console.cpp8
-rw-r--r--core/script/kjs_data.cpp14
-rw-r--r--core/script/kjs_document.cpp46
-rw-r--r--core/script/kjs_field.cpp26
-rw-r--r--core/script/kjs_fullscreen.cpp6
-rw-r--r--core/script/kjs_spell.cpp2
-rw-r--r--core/script/kjs_util.cpp18
-rw-r--r--core/textdocumentgenerator.cpp18
-rw-r--r--core/textdocumentsettings.cpp2
-rw-r--r--core/texteditors_p.h10
-rw-r--r--core/textpage.cpp12
-rw-r--r--extensions.cpp6
-rw-r--r--generators/chm/generator_chm.cpp28
-rw-r--r--generators/chm/kio-msits/msits.cpp6
-rw-r--r--generators/chm/lib/libchmfile.cpp2
-rw-r--r--generators/chm/lib/libchmfile_search.cpp10
-rw-r--r--generators/chm/lib/libchmfileimpl.cpp346
-rw-r--r--generators/chm/lib/libchmurlfactory.h22
-rw-r--r--generators/comicbook/document.cpp10
-rw-r--r--generators/comicbook/unrar.cpp20
-rw-r--r--generators/comicbook/unrarflavours.cpp6
-rw-r--r--generators/djvu/generator_djvu.cpp44
-rw-r--r--generators/djvu/kdjvu.cpp20
-rw-r--r--generators/dvi/TeXFontDefinition.cpp6
-rw-r--r--generators/dvi/TeXFont_PFB.cpp4
-rw-r--r--generators/dvi/TeXFont_PK.cpp12
-rw-r--r--generators/dvi/dviFile.cpp2
-rw-r--r--generators/dvi/dviRenderer.cpp24
-rw-r--r--generators/dvi/dviRenderer_draw.cpp22
-rw-r--r--generators/dvi/dviRenderer_prescan.cpp86
-rw-r--r--generators/dvi/dviexport.cpp18
-rw-r--r--generators/dvi/dvisourcesplitter.cpp2
-rw-r--r--generators/dvi/fontEncoding.cpp8
-rw-r--r--generators/dvi/fontMap.cpp14
-rw-r--r--generators/dvi/fontpool.cpp26
-rw-r--r--generators/dvi/generator_dvi.cpp22
-rw-r--r--generators/dvi/pageSize.cpp44
-rw-r--r--generators/dvi/psgs.cpp40
-rw-r--r--generators/dvi/special.cpp188
-rw-r--r--generators/dvi/util.cpp4
-rw-r--r--generators/epub/converter.cpp54
-rw-r--r--generators/epub/epubdocument.cpp4
-rw-r--r--generators/epub/generator_epub.cpp10
-rw-r--r--generators/fax/generator_fax.cpp6
-rw-r--r--generators/fictionbook/converter.cpp30
-rw-r--r--generators/fictionbook/document.cpp4
-rw-r--r--generators/fictionbook/generator_fb.cpp4
-rw-r--r--generators/ooo/converter.cpp30
-rw-r--r--generators/ooo/document.cpp38
-rw-r--r--generators/ooo/formatproperty.cpp2
-rw-r--r--generators/ooo/generator_ooo.cpp4
-rw-r--r--generators/ooo/manifest.cpp50
-rw-r--r--generators/ooo/styleinformation.cpp2
-rw-r--r--generators/ooo/styleparser.cpp186
-rw-r--r--generators/plucker/generator_plucker.cpp2
-rw-r--r--generators/plucker/unpluck/qunpluck.cpp40
-rw-r--r--generators/poppler/annots.cpp4
-rw-r--r--generators/poppler/generator_pdf.cpp70
-rw-r--r--generators/spectre/generator_ghostview.cpp20
-rw-r--r--generators/tiff/generator_tiff.cpp4
-rw-r--r--generators/txt/converter.cpp2
-rw-r--r--generators/txt/generator_txt.cpp4
-rw-r--r--generators/xps/generator_xps.cpp228
-rw-r--r--mobile/components/documentitem.cpp14
-rw-r--r--mobile/components/pageitem.cpp10
-rw-r--r--part.cpp294
-rw-r--r--shell/okular_main.cpp18
-rw-r--r--shell/shell.cpp32
-rw-r--r--shell/shellutils.cpp22
-rw-r--r--ui/annotationmodel.cpp4
-rw-r--r--ui/annotationpopup.cpp26
-rw-r--r--ui/annotationproxymodels.cpp32
-rw-r--r--ui/annotationtools.cpp26
-rw-r--r--ui/annotationwidgets.cpp88
-rw-r--r--ui/annotwindow.cpp6
-rw-r--r--ui/bookmarklist.cpp22
-rw-r--r--ui/drawingtoolactions.cpp16
-rw-r--r--ui/embeddedfilesdialog.cpp10
-rw-r--r--ui/fileprinterpreview.cpp6
-rw-r--r--ui/findbar.cpp16
-rw-r--r--ui/formwidgets.cpp140
-rw-r--r--ui/guiutils.cpp12
-rw-r--r--ui/ktreeviewsearchline.cpp6
-rw-r--r--ui/latexrenderer.cpp38
-rw-r--r--ui/layers.cpp6
-rw-r--r--ui/minibar.cpp16
-rw-r--r--ui/pagepainter.cpp2
-rw-r--r--ui/pageview.cpp240
-rw-r--r--ui/pageviewannotator.cpp236
-rw-r--r--ui/pageviewutils.cpp16
-rw-r--r--ui/presentationsearchbar.cpp4
-rw-r--r--ui/presentationwidget.cpp34
-rw-r--r--ui/propertiesdialog.cpp14
-rw-r--r--ui/searchlineedit.cpp6
-rw-r--r--ui/searchwidget.cpp4
-rw-r--r--ui/side_reviews.cpp8
-rw-r--r--ui/snapshottaker.cpp4
-rw-r--r--ui/thumbnaillist.cpp10
-rw-r--r--ui/tocmodel.cpp18
-rw-r--r--ui/toolaction.cpp2
-rw-r--r--ui/url_utils.h8
-rw-r--r--ui/videowidget.cpp8
132 files changed, 2523 insertions, 2523 deletions
diff --git a/autotests/addremoveannotationtest.cpp b/autotests/addremoveannotationtest.cpp
index e0208f9..76d6f13 100644
--- a/autotests/addremoveannotationtest.cpp
+++ b/autotests/addremoveannotationtest.cpp
@@ -33,7 +33,7 @@ private:
void AddRemoveAnnotationTest::initTestCase()
{
- Okular::SettingsCore::instance( "addannotationtest" );
+ Okular::SettingsCore::instance( QStringLiteral("addannotationtest") );
m_document = new Okular::Document( 0 );
}
@@ -59,11 +59,11 @@ void AddRemoveAnnotationTest::testAddAnnotations()
// Create two distinct text annotations
Okular::Annotation *annot1 = new Okular::TextAnnotation();
annot1->setBoundingRectangle( Okular::NormalizedRect( 0.1, 0.1, 0.15, 0.15 ) );
- annot1->setContents( "annot contents" );
+ annot1->setContents( QStringLiteral("annot contents") );
Okular::Annotation *annot2 = new Okular::TextAnnotation();
annot2->setBoundingRectangle( Okular::NormalizedRect( 0.2, 0.2, 0.3, 0.4 ) );
- annot2->setContents( "annot contents" );
+ annot2->setContents( QStringLiteral("annot contents") );
// The two annotations shold have different properties XML strings
QVERIFY( TestingUtils::getAnnotationXml( annot1 ) != TestingUtils::getAnnotationXml( annot2 ) );
@@ -123,7 +123,7 @@ void AddRemoveAnnotationTest::testAddAnnotationUndoWithRotate_Bug318091()
{
Okular::Annotation *annot = new Okular::TextAnnotation();
annot->setBoundingRectangle( Okular::NormalizedRect( 0.1, 0.1, 0.15, 0.15 ) );
- annot->setContents( "annot contents" );
+ annot->setContents( QStringLiteral("annot contents") );
m_document->addPageAnnotation( 0, annot );
QString origAnnotXml = TestingUtils::getAnnotationXml( annot );
@@ -149,11 +149,11 @@ void AddRemoveAnnotationTest::testRemoveAnnotations()
// Create two distinct text annotations
Okular::Annotation *annot1 = new Okular::TextAnnotation();
annot1->setBoundingRectangle( Okular::NormalizedRect( 0.1, 0.1, 0.15, 0.15 ) );
- annot1->setContents( "annot contents" );
+ annot1->setContents( QStringLiteral("annot contents") );
Okular::Annotation *annot2 = new Okular::TextAnnotation();
annot2->setBoundingRectangle( Okular::NormalizedRect( 0.2, 0.2, 0.3, 0.4 ) );
- annot2->setContents( "annot contents" );
+ annot2->setContents( QStringLiteral("annot contents") );
// Add annot1 and annot2 to document
m_document->addPageAnnotation( 0, annot1 );
diff --git a/autotests/annotationstest.cpp b/autotests/annotationstest.cpp
index 83fda9d..1c21d6c 100644
--- a/autotests/annotationstest.cpp
+++ b/autotests/annotationstest.cpp
@@ -38,7 +38,7 @@ private:
void AnnotationTest::initTestCase()
{
- Okular::SettingsCore::instance( "annotationtest" );
+ Okular::SettingsCore::instance( QStringLiteral("annotationtest") );
m_document = new Okular::Document( 0 );
const QString testFile = KDESRCDIR "data/file1.pdf";
QMimeDatabase db;
diff --git a/autotests/documenttest.cpp b/autotests/documenttest.cpp
index 80aa393..6cd8ca8 100644
--- a/autotests/documenttest.cpp
+++ b/autotests/documenttest.cpp
@@ -30,7 +30,7 @@ class DocumentTest
// is enqueued/running
void DocumentTest::testCloseDuringRotationJob()
{
- Okular::SettingsCore::instance( "documenttest" );
+ Okular::SettingsCore::instance( QStringLiteral("documenttest") );
Okular::Document *m_document = new Okular::Document( 0 );
const QString testFile = KDESRCDIR "data/file1.pdf";
QMimeDatabase db;
diff --git a/autotests/editannotationcontentstest.cpp b/autotests/editannotationcontentstest.cpp
index 6eb2ac2..f2399ec 100644
--- a/autotests/editannotationcontentstest.cpp
+++ b/autotests/editannotationcontentstest.cpp
@@ -75,8 +75,8 @@ MockEditor::MockEditor( Okular::Annotation *annot, Okular::Document *doc )
{
m_annot = annot;
m_document = doc;
- connect( m_document, SIGNAL(annotationContentsChangedByUndoRedo(Okular::Annotation*,QString,int,int)),
- this, SLOT(slotAnnotationContentsChangedByUndoRedo(Okular::Annotation*,QString,int,int)));
+ connect( m_document, &Okular::Document::annotationContentsChangedByUndoRedo,
+ this, &MockEditor::slotAnnotationContentsChangedByUndoRedo);
m_cursorPos = 0;
m_anchorPos = 0;
m_contents = annot->contents();
@@ -94,7 +94,7 @@ void MockEditor::slotAnnotationContentsChangedByUndoRedo(Okular::Annotation* ann
void EditAnnotationContentsTest::initTestCase()
{
- Okular::SettingsCore::instance( "editannotationcontentstest" );
+ Okular::SettingsCore::instance( QStringLiteral("editannotationcontentstest") );
m_document = new Okular::Document( 0 );
}
@@ -117,12 +117,12 @@ void EditAnnotationContentsTest::init()
// Create two distinct text annotations
m_annot1 = new Okular::TextAnnotation();
m_annot1->setBoundingRectangle( Okular::NormalizedRect( 0.1, 0.1, 0.15, 0.15 ) );
- m_annot1->setContents( QString( "Hello, World" ) );
+ m_annot1->setContents( QStringLiteral( "Hello, World" ) );
m_document->addPageAnnotation( 0, m_annot1 );
m_annot2 = new Okular::TextAnnotation();
m_annot2->setBoundingRectangle( Okular::NormalizedRect( 0.1, 0.1, 0.15, 0.15 ) );
- m_annot2->setContents( QString( "Hello, World" ) );
+ m_annot2->setContents( QStringLiteral( "Hello, World" ) );
m_document->addPageAnnotation( 0, m_annot2 );
// setup editors
@@ -141,11 +141,11 @@ void EditAnnotationContentsTest::cleanup()
void EditAnnotationContentsTest::testConsecutiveCharBackspacesMerged()
{
// Hello, World| -> Hello, Worl|
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, Worl" ), 11, 12, 12 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Worl" ), 11, 12, 12 );
QCOMPARE( QString( "Hello, Worl" ), m_annot1->contents() );
// Hello, Worl| -> Hello, Wor|
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, Wor" ), 10, 11, 11 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Wor" ), 10, 11, 11 );
QCOMPARE( QString( "Hello, Wor" ), m_annot1->contents() );
// undo and verify that consecutive backspace operations are merged together
@@ -162,15 +162,15 @@ void EditAnnotationContentsTest::testConsecutiveCharBackspacesMerged()
QCOMPARE( 10, m_editor1->anchorPos() );
// Hello, Wor| -> Hello, Wo|
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, Wo" ), 9, 10, 10 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Wo" ), 9, 10, 10 );
QCOMPARE( QString( "Hello, Wo" ), m_annot1->contents() );
// Hello, Wo| -> Hello, W|
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, W" ), 8, 9, 9 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, W" ), 8, 9, 9 );
QCOMPARE( QString( "Hello, W" ), m_annot1->contents() );
// Hello, W| -> Hello, |
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, " ), 7, 8, 8 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, " ), 7, 8, 8 );
QCOMPARE( QString( "Hello, " ), m_annot1->contents() );
// undo and verify that consecutive backspace operations are merged together
@@ -190,23 +190,23 @@ void EditAnnotationContentsTest::testConsecutiveCharBackspacesMerged()
void EditAnnotationContentsTest::testConsecutiveNewlineBackspacesNotMerged()
{
// Set contents to Hello, \n\n|World
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, \n\nWorld" ), 0, 0, 0 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, \n\nWorld" ), 0, 0, 0 );
QCOMPARE( QString( "Hello, \n\nWorld" ), m_annot1->contents() );
// Hello, \n\n|World -> Hello, \n|World
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, \nWorld" ), 8, 9, 9 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, \nWorld" ), 8, 9, 9 );
QCOMPARE( QString( "Hello, \nWorld" ), m_annot1->contents() );
// Hello, \n|World -> Hello, |World
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, World" ), 7, 8, 8 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, World" ), 7, 8, 8 );
QCOMPARE( QString( "Hello, World" ), m_annot1->contents() );
// Hello, |World -> Hello,|World
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello,World" ), 6, 7, 7 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello,World" ), 6, 7, 7 );
QCOMPARE( QString( "Hello,World" ), m_annot1->contents() );
// Hello,|World -> Hello|World
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "HelloWorld" ), 5, 6, 6 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "HelloWorld" ), 5, 6, 6 );
QCOMPARE( QString( "HelloWorld" ), m_annot1->contents() );
// Backspace operations of non-newline characters should be merged
@@ -233,19 +233,19 @@ void EditAnnotationContentsTest::testConsecutiveNewlineBackspacesNotMerged()
void EditAnnotationContentsTest::testConsecutiveCharInsertionsMerged()
{
// Hello, |World -> Hello, B|World
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, BWorld" ), 8, 7, 7 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, BWorld" ), 8, 7, 7 );
QCOMPARE( QString( "Hello, BWorld" ), m_annot1->contents() );
// Hello, l| -> Hello, li|
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, BiWorld" ), 9, 8, 8 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, BiWorld" ), 9, 8, 8 );
QCOMPARE( QString( "Hello, BiWorld" ), m_annot1->contents() );
// Hello, li| -> Hello, lin|
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, BigWorld" ), 10, 9, 9 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, BigWorld" ), 10, 9, 9 );
QCOMPARE( QString( "Hello, BigWorld" ), m_annot1->contents() );
// Hello, lin| -> Hello, line|
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, Big World" ), 11, 10, 10 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Big World" ), 11, 10, 10 );
QCOMPARE( QString( "Hello, Big World" ), m_annot1->contents() );
// Verify undo/redo operations merged
@@ -265,11 +265,11 @@ void EditAnnotationContentsTest::testConsecutiveCharInsertionsMerged()
void EditAnnotationContentsTest::testConsecutiveNewlineInsertionsNotMerged()
{
// Hello, |World -> Hello, \n|World
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, \nWorld" ), 8, 7, 7 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, \nWorld" ), 8, 7, 7 );
QCOMPARE( QString( "Hello, \nWorld" ), m_annot1->contents() );
// Hello, |World -> Hello, \n|World
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, \n\nWorld" ), 9, 8, 8 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, \n\nWorld" ), 9, 8, 8 );
QCOMPARE( QString( "Hello, \n\nWorld" ), m_annot1->contents() );
m_document->undo();
@@ -300,23 +300,23 @@ void EditAnnotationContentsTest::testConsecutiveNewlineInsertionsNotMerged()
void EditAnnotationContentsTest::testConsecutiveCharDeletesMerged()
{
// Hello, |World -> Hello, |orld
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, orld" ), 7, 7, 7 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, orld" ), 7, 7, 7 );
QCOMPARE( QString( "Hello, orld" ), m_annot1->contents() );
// Hello, |orld -> Hello, |rld
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, rld" ), 7, 7, 7 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, rld" ), 7, 7, 7 );
QCOMPARE( QString( "Hello, rld" ), m_annot1->contents() );
// Hello, |rld -> Hello, |ld
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, ld" ), 7, 7, 7 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, ld" ), 7, 7, 7 );
QCOMPARE( QString( "Hello, ld" ), m_annot1->contents() );
// Hello, |ld -> Hello, |d
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, d" ), 7, 7, 7 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, d" ), 7, 7, 7 );
QCOMPARE( QString( "Hello, d" ), m_annot1->contents() );
// Hello, | -> Hello, |
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, " ), 7, 7, 7 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, " ), 7, 7, 7 );
QCOMPARE( QString( "Hello, " ), m_annot1->contents() );
// Verify undo/redo operations merged
@@ -336,35 +336,35 @@ void EditAnnotationContentsTest::testConsecutiveCharDeletesMerged()
void EditAnnotationContentsTest::testConsecutiveNewlineDeletesNotMerged()
{
// Set contents to Hello, \n\n|World
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, \n\nWorld" ), 0, 0, 0 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, \n\nWorld" ), 0, 0, 0 );
QCOMPARE( QString( "Hello, \n\nWorld" ), m_annot1->contents() );
// He|llo, \n\nWorld -> He|lo, \n\nWorld
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Helo, \n\nWorld" ), 2, 2, 2 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Helo, \n\nWorld" ), 2, 2, 2 );
QCOMPARE( QString( "Helo, \n\nWorld" ), m_annot1->contents() );
// He|lo, \n\nWorld -> He|o, \n\nWorld
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Heo, \n\nWorld" ), 2, 2, 2 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Heo, \n\nWorld" ), 2, 2, 2 );
QCOMPARE( QString( "Heo, \n\nWorld" ), m_annot1->contents() );
// He|o, \n\nWorld -> He|, \n\nWorld
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "He, \n\nWorld" ), 2, 2, 2 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "He, \n\nWorld" ), 2, 2, 2 );
QCOMPARE( QString( "He, \n\nWorld" ), m_annot1->contents() );
// He|, \n\nWorld -> He| \n\nWorld
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "He \n\nWorld" ), 2, 2, 2 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "He \n\nWorld" ), 2, 2, 2 );
QCOMPARE( QString( "He \n\nWorld" ), m_annot1->contents() );
// He| \n\nWorld -> He|\n\nWorld
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "He\n\nWorld" ), 2, 2, 2 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "He\n\nWorld" ), 2, 2, 2 );
QCOMPARE( QString( "He\n\nWorld" ), m_annot1->contents() );
// He|\n\nWorld -> He|\nWorld
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "He\nWorld" ), 2, 2, 2 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "He\nWorld" ), 2, 2, 2 );
QCOMPARE( QString( "He\nWorld" ), m_annot1->contents() );
// He|\nWorld -> He|World
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "HeWorld" ), 2, 2, 2 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "HeWorld" ), 2, 2, 2 );
QCOMPARE( QString( "HeWorld" ), m_annot1->contents() );
// Verify that deletions of newlines are not merged, but deletions of other characters are
@@ -390,37 +390,37 @@ void EditAnnotationContentsTest::testConsecutiveNewlineDeletesNotMerged()
void EditAnnotationContentsTest::testConsecutiveEditsNotMergedAcrossDifferentAnnotations()
{
// Annot1: Hello, World| -> Hello, Worl|
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, Worl" ), 11, 12, 12 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Worl" ), 11, 12, 12 );
QCOMPARE( QString( "Hello, Worl" ), m_annot1->contents() );
// Annot1: Hello, Worl| -> Hello, Wor|
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, Wor" ), 10, 11, 11 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Wor" ), 10, 11, 11 );
QCOMPARE( QString( "Hello, Wor" ), m_annot1->contents() );
// Annot2: Hello, World| -> Hello, Worl|
- m_document->editPageAnnotationContents( 0, m_annot2, QString( "Hello, Worl" ), 11, 12, 12 );
+ m_document->editPageAnnotationContents( 0, m_annot2, QStringLiteral( "Hello, Worl" ), 11, 12, 12 );
QCOMPARE( QString( "Hello, Worl" ), m_annot2->contents() );
// Annot2: Hello, Worl| -> Hello, Wor|
- m_document->editPageAnnotationContents( 0, m_annot2, QString( "Hello, Wor" ), 10, 11, 11 );
+ m_document->editPageAnnotationContents( 0, m_annot2, QStringLiteral( "Hello, Wor" ), 10, 11, 11 );
QCOMPARE( QString( "Hello, Wor" ), m_annot2->contents() );
// Annot1: Hello, Wor| -> Hello, Wo|
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, Wo" ), 9, 10, 10 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Wo" ), 9, 10, 10 );
QCOMPARE( QString( "Hello, Wo" ), m_annot1->contents() );
// Annot1: Hello, Wo| -> Hello, W|
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, W" ), 8, 9, 9 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, W" ), 8, 9, 9 );
QCOMPARE( QString( "Hello, W" ), m_annot1->contents() );
// Annot1: Hello, W| -> Hello, |
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, " ), 7, 8, 8 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, " ), 7, 8, 8 );
QCOMPARE( QString( "Hello, " ), m_annot1->contents() );
// Annot2: Hello, Wor| -> Hello, Wo|
- m_document->editPageAnnotationContents( 0, m_annot2, QString( "Hello, Wo" ), 9, 10, 10 );
+ m_document->editPageAnnotationContents( 0, m_annot2, QStringLiteral( "Hello, Wo" ), 9, 10, 10 );
QCOMPARE( QString( "Hello, Wo" ), m_annot2->contents() );
// Annot2: Hello, Wo| -> Hello, W|
- m_document->editPageAnnotationContents( 0, m_annot2, QString( "Hello, W" ), 8, 9, 9 );
+ m_document->editPageAnnotationContents( 0, m_annot2, QStringLiteral( "Hello, W" ), 8, 9, 9 );
QCOMPARE( QString( "Hello, W" ), m_annot2->contents() );
// Annot2: Hello, W| -> Hello, |
- m_document->editPageAnnotationContents( 0, m_annot2, QString( "Hello, " ), 7, 8, 8 );
+ m_document->editPageAnnotationContents( 0, m_annot2, QStringLiteral( "Hello, " ), 7, 8, 8 );
QCOMPARE( QString( "Hello, " ), m_annot2->contents() );
@@ -461,11 +461,11 @@ void EditAnnotationContentsTest::testConsecutiveEditsNotMergedAcrossDifferentAnn
void EditAnnotationContentsTest::testInsertWithSelection()
{
// Annot1: |Hello|, World -> H|, World
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "H, World" ), 1, 0, 5 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "H, World" ), 1, 0, 5 );
QCOMPARE( QString( "H, World" ), m_annot1->contents() );
// Annot1: H|, World -> Hi|, World
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hi, World" ), 2, 1, 1 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hi, World" ), 2, 1, 1 );
QCOMPARE( QString( "Hi, World" ), m_annot1->contents() );
m_document->undo();
@@ -484,19 +484,19 @@ void EditAnnotationContentsTest::testInsertWithSelection()
void EditAnnotationContentsTest::testCombinations()
{
// Annot1: Hello, World| -> Hello, Worl|
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, Worl" ), 11, 12, 12 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Worl" ), 11, 12, 12 );
QCOMPARE( QString( "Hello, Worl" ), m_annot1->contents() );
// Annot1: Hello, Worl| -> Hello, Wor|
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "Hello, Wor" ), 10, 11, 11 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "Hello, Wor" ), 10, 11, 11 );
QCOMPARE( QString( "Hello, Wor" ), m_annot1->contents() );
// Annot1: |He|llo, Wor -> |llo, Wor
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "llo, Wor" ), 0, 2, 0 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "llo, Wor" ), 0, 2, 0 );
QCOMPARE( QString( "llo, Wor" ), m_annot1->contents() );
// Annot1: |llo, Wor -> |lo, Wor
- m_document->editPageAnnotationContents( 0, m_annot1, QString( "lo, Wor" ), 0, 0, 0 );
+ m_document->editPageAnnotationContents( 0, m_annot1, QStringLiteral( "lo, Wor" ), 0, 0, 0 );
QCOMPARE( QString( "lo, Wor" ), m_annot1->contents() );
m_document->undo();
diff --git a/autotests/editformstest.cpp b/autotests/editformstest.cpp
index caaa3b8..314b6e8 100644
--- a/autotests/editformstest.cpp
+++ b/autotests/editformstest.cpp
@@ -54,7 +54,7 @@ private:
void EditFormsTest::initTestCase()
{
- Okular::SettingsCore::instance( "editformstest" );
+ Okular::SettingsCore::instance( QStringLiteral("editformstest") );
m_document = new Okular::Document( 0 );
}
@@ -244,21 +244,21 @@ void EditFormsTest::testComboEditForm()
// Initially no choice is selected
QCOMPARE( m_comboEdit->currentChoices().length(), 0 );
- QCOMPARE( m_comboEdit->editChoice(), QString( "" ) );
+ QCOMPARE( m_comboEdit->editChoice(), QLatin1String( "" ) );
// Select first choice
- m_document->editFormCombo( 0, m_comboEdit, "combo1", 0, 0, 0);
+ m_document->editFormCombo( 0, m_comboEdit, QStringLiteral("combo1"), 0, 0, 0);
QCOMPARE( m_comboEdit->currentChoices().length(), 1 );
QCOMPARE( m_comboEdit->currentChoices()[0], 0 );
- QCOMPARE( m_comboEdit->editChoice(), QString( "" ) );
+ QCOMPARE( m_comboEdit->editChoice(), QLatin1String( "" ) );
QVERIFY( m_document->canUndo() );
QVERIFY( !m_document->canRedo() );
// Select third choice
- m_document->editFormCombo( 0, m_comboEdit, "combo3", 0, 0, 0);
+ m_document->editFormCombo( 0, m_comboEdit, QStringLiteral("combo3"), 0, 0, 0);
QCOMPARE( m_comboEdit->currentChoices().length(), 1 );
QCOMPARE( m_comboEdit->currentChoices()[0], 2 );
- QCOMPARE( m_comboEdit->editChoice(), QString( "" ) );
+ QCOMPARE( m_comboEdit->editChoice(), QLatin1String( "" ) );
QVERIFY( m_document->canUndo() );
QVERIFY( !m_document->canRedo() );
@@ -277,7 +277,7 @@ void EditFormsTest::testComboEditForm()
QVERIFY( !m_document->canRedo() );
// Select a custom choice and verify that no predefined choices are selected
- m_document->editFormCombo( 0, m_comboEdit, "comboEdit", 0, 0, 0);
+ m_document->editFormCombo( 0, m_comboEdit, QStringLiteral("comboEdit"), 0, 0, 0);
QCOMPARE( m_comboEdit->currentChoices().length(), 0 );
QCOMPARE( m_comboEdit->editChoice(), QString( "comboEdit" ) );
QVERIFY( m_document->canUndo() );
@@ -389,17 +389,17 @@ void EditFormsTest::setRadioButtonStates( bool state1, bool state2, bool state3
void EditFormsTest::verifyTextForm( Okular::FormFieldText* form )
{
// Text in form is initially empty
- QCOMPARE( form->text(), QString("") );
+ QCOMPARE( form->text(), QLatin1String("") );
// Insert the string "Hello" into the form
- m_document->editFormText(0, form, QString("Hello"), 5, 0, 0);
+ m_document->editFormText(0, form, QStringLiteral("Hello"), 5, 0, 0);
QCOMPARE( form->text(), QString("Hello") );
QVERIFY( m_document->canUndo() );
QVERIFY( !m_document->canRedo() );
// Undo the insertion and verify that form is empty again
m_document->undo();
- QCOMPARE( form->text(), QString("") );
+ QCOMPARE( form->text(), QLatin1String("") );
QVERIFY( !m_document->canUndo() );
QVERIFY( m_document->canRedo() );
@@ -410,12 +410,12 @@ void EditFormsTest::verifyTextForm( Okular::FormFieldText* form )
QVERIFY( !m_document->canRedo() );
// Type "_World" after "Hello"
- m_document->editFormText(0, form, QString("Hello_"), 6, 5, 5);
- m_document->editFormText(0, form, QString("Hello_W"), 7, 6, 6);
- m_document->editFormText(0, form, QString("Hello_Wo"), 8, 7, 7);
- m_document->editFormText(0, form, QString("Hello_Wor"), 9, 8, 8);
- m_document->editFormText(0, form, QString("Hello_Worl"), 10, 9, 9);
- m_document->editFormText(0, form, QString("Hello_World"), 11, 10, 10);
+ m_document->editFormText(0, form, QStringLiteral("Hello_"), 6, 5, 5);
+ m_document->editFormText(0, form, QStringLiteral("Hello_W"), 7, 6, 6);
+ m_document->editFormText(0, form, QStringLiteral("Hello_Wo"), 8, 7, 7);
+ m_document->editFormText(0, form, QStringLiteral("Hello_Wor"), 9, 8, 8);
+ m_document->editFormText(0, form, QStringLiteral("Hello_Worl"), 10, 9, 9);
+ m_document->editFormText(0, form, QStringLiteral("Hello_World"), 11, 10, 10);
// Verify that character insertion operations were merged together into a single undo command
m_document->undo();
@@ -425,7 +425,7 @@ void EditFormsTest::verifyTextForm( Okular::FormFieldText* form )
// Verify that one more undo gets us back to the original state (empty form)
m_document->undo();
- QCOMPARE( form->text(), QString("") );
+ QCOMPARE( form->text(), QLatin1String("") );
QVERIFY( !m_document->canUndo() );
QVERIFY( m_document->canRedo() );
}
diff --git a/autotests/mainshelltest.cpp b/autotests/mainshelltest.cpp
index cb2f464..118cfbc 100644
--- a/autotests/mainshelltest.cpp
+++ b/autotests/mainshelltest.cpp
@@ -109,7 +109,7 @@ Shell *findShell(Shell *ignore = 0)
void MainShellTest::initTestCase()
{
// Don't pollute people's okular settings
- Okular::Settings::instance( "mainshelltest" );
+ Okular::Settings::instance( QStringLiteral("mainshelltest") );
// Register in bus as okular
QDBusConnectionInterface *bus = QDBusConnection::sessionBus().interface();
@@ -134,9 +134,9 @@ void MainShellTest::init()
// Clean docdatas
QList<QUrl> urls;
- urls << QUrl::fromUserInput("file://" KDESRCDIR "data/file1.pdf");
- urls << QUrl::fromUserInput("file://" KDESRCDIR "data/tocreload.pdf");
- urls << QUrl::fromUserInput("file://" KDESRCDIR "data/contents.epub");
+ urls << QUrl::fromUserInput(QStringLiteral("file://" KDESRCDIR "data/file1.pdf"));
+ urls << QUrl::fromUserInput(QStringLiteral("file://" KDESRCDIR "data/tocreload.pdf"));
+ urls << QUrl::fromUserInput(QStringLiteral("file://" KDESRCDIR "data/contents.epub"));
foreach (const QUrl &url, urls)
{
@@ -176,8 +176,8 @@ void MainShellTest::testShell_data()
file1AndToc << KDESRCDIR "data/tocreload.pdf";
const QString tocReload = KDESRCDIR "data/tocreload.pdf";
- const QString optionsPage2 = ShellUtils::serializeOptions(false, false, false, false, "2");
- const QString optionsPage2Presentation = ShellUtils::serializeOptions(true, false, false, false, "2");
+ const QString optionsPage2 = ShellUtils::serializeOptions(false, false, false, false, QStringLiteral("2"));
+ const QString optionsPage2Presentation = ShellUtils::serializeOptions(true, false, false, false, QStringLiteral("2"));
const QString optionsPrint = ShellUtils::serializeOptions(false, true, false, false, QString());
const QString optionsUnique = ShellUtils::serializeOptions(false, false, true, false, QString());
@@ -289,7 +289,7 @@ void MainShellTest::testShell()
QStringList args;
args << externalProcessPath;
if (unique)
- args << "-unique";
+ args << QStringLiteral("-unique");
if (externalProcessExpectedPage != 0)
args << QStringLiteral("-page") << QString::number(externalProcessExpectedPage + 1);
if (externalProcessExpectPresentation)
@@ -375,7 +375,7 @@ void ClosePrintDialogHelper::closePrintDialog()
Shell *s = findShell();
QPrintDialog *dialog = s->findChild<QPrintDialog*>();
if (!dialog) {
- QTimer::singleShot(0, this, SLOT(closePrintDialog()));
+ QTimer::singleShot(0, this, &ClosePrintDialogHelper::closePrintDialog);
return;
}
QVERIFY(dialog);
@@ -431,7 +431,7 @@ void MainShellTest::testFileRemembersPagePosition()
QStringList args;
args << paths[0];
if (mode == 2)
- args << "-unique";
+ args << QStringLiteral("-unique");
p.start(OKULAR_BINARY, args);
p.waitForStarted();
QCOMPARE(p.state(), QProcess::Running);
@@ -456,7 +456,7 @@ void MainShellTest::test2FilesError_data()
QTest::newRow("startInPresentation") << ShellUtils::serializeOptions(true, false, false, false, QString());
QTest::newRow("showPrintDialog") << ShellUtils::serializeOptions(false, true, false, false, QString());
QTest::newRow("unique") << ShellUtils::serializeOptions(false, false, true, false, QString());
- QTest::newRow("pageNumger") << ShellUtils::serializeOptions(false, false, false, false, "3");
+ QTest::newRow("pageNumger") << ShellUtils::serializeOptions(false, false, false, false, QStringLiteral("3"));
}
void MainShellTest::test2FilesError()
@@ -544,7 +544,7 @@ void MainShellTest::testSessionRestore()
// Wait for shells to delete themselves. QTest::qWait doesn't do deferred
// deletions so we'll set up a full event loop to do that.
QEventLoop eventLoop;
- QTimer::singleShot( 100, &eventLoop, SLOT(quit()) );
+ QTimer::singleShot( 100, &eventLoop, &QEventLoop::quit );
eventLoop.exec( QEventLoop::AllEvents );
shells = getShells();
QVERIFY( shells.isEmpty() );
diff --git a/autotests/modifyannotationpropertiestest.cpp b/autotests/modifyannotationpropertiestest.cpp
index b8ea32a..f12e207 100644
--- a/autotests/modifyannotationpropertiestest.cpp
+++ b/autotests/modifyannotationpropertiestest.cpp
@@ -40,7 +40,7 @@ private:
void ModifyAnnotationPropertiesTest::initTestCase()
{
- Okular::SettingsCore::instance( "editannotationcontentstest" );
+ Okular::SettingsCore::instance( QStringLiteral("editannotationcontentstest") );
m_document = new Okular::Document( 0 );
}
@@ -63,8 +63,8 @@ void ModifyAnnotationPropertiesTest::init()
// Create two distinct text annotations
m_annot1 = new Okular::TextAnnotation();
m_annot1->setBoundingRectangle( Okular::NormalizedRect( 0.1, 0.1, 0.15, 0.15 ) );
- m_annot1->setContents( QString( "Hello, World" ) );
- m_annot1->setAuthor( "Jon Mease" );
+ m_annot1->setContents( QStringLiteral( "Hello, World" ) );
+ m_annot1->setAuthor( QStringLiteral("Jon Mease") );
m_annot1->style().setColor( RED );
m_annot1->style().setWidth( 4.0 );
m_document->addPageAnnotation( 0, m_annot1 );
diff --git a/autotests/parttest.cpp b/autotests/parttest.cpp
index 394b5ee..33042be 100644
--- a/autotests/parttest.cpp
+++ b/autotests/parttest.cpp
@@ -124,14 +124,14 @@ void PartTest::testFowardPDF()
// Create temp dir named like this: ${system temp dir}/${random string}/${dir}
const QTemporaryDir tempDir;
const QDir workDir(QDir(tempDir.path()).filePath(dir));
- workDir.mkpath(".");
+ workDir.mkpath(QStringLiteral("."));
QFile f(KDESRCDIR "data/synctextest.tex");
const QString texDestination = workDir.path() + "/synctextest.tex";
QVERIFY(f.copy(texDestination));
QProcess process;
process.setWorkingDirectory(workDir.path());
- process.start("pdflatex", QStringList() << "-synctex=1" << "-interaction=nonstopmode" << texDestination);
+ process.start(QStringLiteral("pdflatex"), QStringList() << QStringLiteral("-synctex=1") << QStringLiteral("-interaction=nonstopmode") << texDestination);
process.waitForFinished();
const QString pdfResult = workDir.path() + "/synctextest.pdf";
diff --git a/autotests/shelltest.cpp b/autotests/shelltest.cpp
index 6ac8fc1..ba1aada 100644
--- a/autotests/shelltest.cpp
+++ b/autotests/shelltest.cpp
@@ -59,40 +59,40 @@ void ShellTest::testUrlArgs_data()
QTest::newRow( "foo.pdf, exist" )
<< "foo.pdf"
<< true
- << makeUrlFromCwd( "foo.pdf" );
+ << makeUrlFromCwd( QStringLiteral("foo.pdf") );
QTest::newRow( "foo.pdf, !exist" )
<< "foo.pdf"
<< false
- << makeUrlFromCwd( "foo.pdf" );
+ << makeUrlFromCwd( QStringLiteral("foo.pdf") );
QTest::newRow( "foo#bar.pdf, !exist" )
<< "foo#bar.pdf"
<< false
- << makeUrlFromCwd( "foo#bar.pdf" );
+ << makeUrlFromCwd( QStringLiteral("foo#bar.pdf") );
QTest::newRow( "foo.pdf#anchor, !exist" )
<< "foo.pdf#anchor"
<< false
- << makeUrlFromCwd( "foo.pdf", "anchor" );
+ << makeUrlFromCwd( QStringLiteral("foo.pdf"), QStringLiteral("anchor") );
QTest::newRow( "#207461" )
<< "file:///tmp/file%20with%20spaces.pdf"
<< true
- << QUrl( "file:///tmp/file%20with%20spaces.pdf" );
+ << QUrl( QStringLiteral("file:///tmp/file%20with%20spaces.pdf") );
// non-local files
QTest::newRow( "http://kde.org/foo.pdf" )
<< "http://kde.org/foo.pdf"
<< true
- << QUrl( "http://kde.org/foo.pdf" );
+ << QUrl( QStringLiteral("http://kde.org/foo.pdf") );
// make sure we don't have a fragment
- QUrl hashInName( "http://kde.org" );
+ QUrl hashInName( QStringLiteral("http://kde.org") );
QVERIFY( hashInName.path().isEmpty() );
- hashInName.setPath( "/foo#bar.pdf" );
+ hashInName.setPath( QStringLiteral("/foo#bar.pdf") );
QVERIFY( hashInName.fragment().isEmpty() );
QTest::newRow( "http://kde.org/foo#bar.pdf" )
<< "http://kde.org/foo#bar.pdf"
<< true
<< hashInName;
- QUrl withAnchor( "http://kde.org/foo.pdf" );
- withAnchor.setFragment( "anchor" );
+ QUrl withAnchor( QStringLiteral("http://kde.org/foo.pdf") );
+ withAnchor.setFragment( QStringLiteral("anchor") );
QTest::newRow( "http://kde.org/foo.pdf#anchor" )
<< "http://kde.org/foo.pdf#anchor"
<< true
@@ -100,9 +100,9 @@ void ShellTest::testUrlArgs_data()
QTest::newRow( "#207461" )
<< "http://homepages.inf.ed.ac.uk/mef/file%20with%20spaces.pdf"
<< true
- << QUrl( "http://homepages.inf.ed.ac.uk/mef/file%20with%20spaces.pdf" );
- QUrl openOnPage3 = QUrl( "http://itzsimpl.info/lectures/CG/L2-transformations.pdf" );
- openOnPage3.setFragment( "3" );
+ << QUrl( QStringLiteral("http://homepages.inf.ed.ac.uk/mef/file%20with%20spaces.pdf") );
+ QUrl openOnPage3 = QUrl( QStringLiteral("http://itzsimpl.info/lectures/CG/L2-transformations.pdf") );
+ openOnPage3.setFragment( QStringLiteral("3") );
QTest::newRow( "RR124738" )
<< "http://itzsimpl.info/lectures/CG/L2-transformations.pdf#3"
<< true
diff --git a/autotests/translateannotationtest.cpp b/autotests/translateannotationtest.cpp
index bb609d3..4556845 100644
--- a/autotests/translateannotationtest.cpp
+++ b/autotests/translateannotationtest.cpp
@@ -66,7 +66,7 @@ private:
void TranslateAnnotationTest::initTestCase()
{
- Okular::SettingsCore::instance( "editannotationcontentstest" );
+ Okular::SettingsCore::instance( QStringLiteral("editannotationcontentstest") );
m_document = new Okular::Document( 0 );
// translate m_annot1
diff --git a/autotests/urldetecttest.cpp b/autotests/urldetecttest.cpp
index 5cd2f54..578fd15 100644
--- a/autotests/urldetecttest.cpp
+++ b/autotests/urldetecttest.cpp
@@ -32,22 +32,22 @@ void UrlDetectTest::testURL_data()
{
QTest::addColumn<QString>( "selectedText" );
QTest::addColumn<QString>( "url" );
- QTest::newRow( "1" ) << QString( "asdfhttp://okular.org" ) << QString();
- QTest::newRow( "2" ) << QString( "google.com/index.php/" ) << QString();
- QTest::newRow( "3" ) << QString( "http://google.com)" ) << QString();
-
- QTest::newRow( "4" ) << QString( "https://okular.org" ) << QString( "https://okular.org" );
- QTest::newRow( "5" ) << QString( "www.google.com" ) << QString( "http://www.google.com" );
- QTest::newRow( "6" ) << QString( "asdf http://okular.kde.org/" ) << QString( "http://okular.kde.org/" );
- QTest::newRow( "7" ) << QString( "http://www.example.com/wpstyle/?p=364" ) << QString( "http://www.example.com/wpstyle/?p=364" );
- QTest::newRow( "8" ) << QString( "asdf http://okular.org fdsa" ) << QString( "http://okular.org" );
- QTest::newRow( "9" ) << QString( "http://google.com/ø" ) << QString( "http://google.com/ø" );
- QTest::newRow( "10" ) << QString( "http://www.wolframalpha.com/input/?i=Plot[%281%2Be^%28-%282%29v%29%29^%28-2%29+%2B+%282%29+%281%2Be^v%29^%28-2%29%2C+{t%2C-0.5%2C+0.5}]" ) << QString( "http://www.wolframalpha.com/input/?i=Plot[%281%2Be^%28-%282%29v%29%29^%28-2%29+%2B+%282%29+%281%2Be^v%29^%28-2%29%2C+{t%2C-0.5%2C+0.5}]" );
- QTest::newRow( "11" ) << QString( "http://uid:pass@example.com:8080" ) << QString( "http://uid:pass@example.com:8080" );
- QTest::newRow( "12" ) << QString( "www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf" ) << QString( "http://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf" );
- QTest::newRow( "13" ) << QString( "http://IISServer/nwind?template=<ROOTxmlns:sql=\"urn:schemas-microsoft-com:xml-sql\"><sql:query>SELECTTOP2*FROM[OrderDetails]WHEREUnitPrice%26lt;10FORXMLAUTO</sql:query></ROOT>" ) << QString( "http://IISServer/nwind?template=<ROOTxmlns:sql=\"urn:schemas-microsoft-com:xml-sql\"><sql:query>SELECTTOP2*FROM[OrderDetails]WHEREUnitPrice%26lt;10FORXMLAUTO</sql:query></ROOT>" );
- QTest::newRow( "14" ) << QString( "https://www.example.com/foo/?bar=baz&inga=42&quux" ) << QString( "https://www.example.com/foo/?bar=baz&inga=42&quux" );
- QTest::newRow( "15" ) << QString( "http://foo.bar/#tag" ) << QString( "http://foo.bar/#tag" );
+ QTest::newRow( "1" ) << QStringLiteral( "asdfhttp://okular.org" ) << QString();
+ QTest::newRow( "2" ) << QStringLiteral( "google.com/index.php/" ) << QString();
+ QTest::newRow( "3" ) << QStringLiteral( "http://google.com)" ) << QString();
+
+ QTest::newRow( "4" ) << QStringLiteral( "https://okular.org" ) << QStringLiteral( "https://okular.org" );
+ QTest::newRow( "5" ) << QStringLiteral( "www.google.com" ) << QStringLiteral( "http://www.google.com" );
+ QTest::newRow( "6" ) << QStringLiteral( "asdf http://okular.kde.org/" ) << QStringLiteral( "http://okular.kde.org/" );
+ QTest::newRow( "7" ) << QStringLiteral( "http://www.example.com/wpstyle/?p=364" ) << QStringLiteral( "http://www.example.com/wpstyle/?p=364" );
+ QTest::newRow( "8" ) << QStringLiteral( "asdf http://okular.org fdsa" ) << QStringLiteral( "http://okular.org" );
+ QTest::newRow( "9" ) << QStringLiteral( "http://google.com/ø" ) << QStringLiteral( "http://google.com/ø" );
+ QTest::newRow( "10" ) << QStringLiteral( "http://www.wolframalpha.com/input/?i=Plot[%281%2Be^%28-%282%29v%29%29^%28-2%29+%2B+%282%29+%281%2Be^v%29^%28-2%29%2C+{t%2C-0.5%2C+0.5}]" ) << QStringLiteral( "http://www.wolframalpha.com/input/?i=Plot[%281%2Be^%28-%282%29v%29%29^%28-2%29+%2B+%282%29+%281%2Be^v%29^%28-2%29%2C+{t%2C-0.5%2C+0.5}]" );
+ QTest::newRow( "11" ) << QStringLiteral( "http://uid:pass@example.com:8080" ) << QStringLiteral( "http://uid:pass@example.com:8080" );
+ QTest::newRow( "12" ) << QStringLiteral( "www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf" ) << QStringLiteral( "http://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf" );
+ QTest::newRow( "13" ) << QStringLiteral( "http://IISServer/nwind?template=<ROOTxmlns:sql=\"urn:schemas-microsoft-com:xml-sql\"><sql:query>SELECTTOP2*FROM[OrderDetails]WHEREUnitPrice%26lt;10FORXMLAUTO</sql:query></ROOT>" ) << QStringLiteral( "http://IISServer/nwind?template=<ROOTxmlns:sql=\"urn:schemas-microsoft-com:xml-sql\"><sql:query>SELECTTOP2*FROM[OrderDetails]WHEREUnitPrice%26lt;10FORXMLAUTO</sql:query></ROOT>" );
+ QTest::newRow( "14" ) << QStringLiteral( "https://www.example.com/foo/?bar=baz&inga=42&quux" ) << QStringLiteral( "https://www.example.com/foo/?bar=baz&inga=42&quux" );
+ QTest::newRow( "15" ) << QStringLiteral( "http://foo.bar/#tag" ) << QStringLiteral( "http://foo.bar/#tag" );
}
}
diff --git a/conf/dlgannotations.cpp b/conf/dlgannotations.cpp
index b6fc85a..9735502 100644
--- a/conf/dlgannotations.cpp
+++ b/conf/dlgannotations.cpp
@@ -22,7 +22,7 @@ DlgAnnotations::DlgAnnotations( QWidget * parent )
WidgetAnnotTools * kcfg_AnnotationTools = new WidgetAnnotTools( dlg.annotToolsGroup );
dlg.annotToolsPlaceholder->addWidget( kcfg_AnnotationTools );
- kcfg_AnnotationTools->setObjectName( "kcfg_AnnotationTools" );
+ kcfg_AnnotationTools->setObjectName( QStringLiteral("kcfg_AnnotationTools") );
- KConfigDialogManager::changedMap()->insert( "WidgetAnnotTools" , SIGNAL(changed()) );
+ KConfigDialogManager::changedMap()->insert( QStringLiteral("WidgetAnnotTools") , SIGNAL(changed()) );
}
diff --git a/conf/dlggeneral.cpp b/conf/dlggeneral.cpp
index ad389f3..9945522 100644
--- a/conf/dlggeneral.cpp
+++ b/conf/dlggeneral.cpp
@@ -40,7 +40,7 @@ void DlgGeneral::showEvent( QShowEvent * )
#if OKULAR_FORCE_DRM
m_dlg->kcfg_ObeyDRM->hide();
#else
- if ( KAuthorized::authorize( "skip_drm" ) )
+ if ( KAuthorized::authorize( QStringLiteral("skip_drm") ) )
m_dlg->kcfg_ObeyDRM->show();
else
m_dlg->kcfg_ObeyDRM->hide();
diff --git a/conf/dlgperformance.cpp b/conf/dlgperformance.cpp
index 4869b69..557a1ab 100644
--- a/conf/dlgperformance.cpp
+++ b/conf/dlgperformance.cpp
@@ -24,7 +24,7 @@ DlgPerformance::DlgPerformance( QWidget * parent )
labelFont.setBold( true );
m_dlg->descLabel->setFont( labelFont );
- m_dlg->cpuLabel->setPixmap( BarIcon( "cpu", 32 ) );
+ m_dlg->cpuLabel->setPixmap( BarIcon( QStringLiteral("cpu"), 32 ) );
// m_dlg->memoryLabel->setPixmap( BarIcon( "kcmmemory", 32 ) ); // TODO: enable again when proper icon is available
connect(m_dlg->kcfg_MemoryLevel, &KButtonGroup::changed, this, &DlgPerformance::radioGroup_changed);
diff --git a/conf/dlgpresentation.cpp b/conf/dlgpresentation.cpp
index 7d1c04c..ca1d2c3 100644
--- a/conf/dlgpresentation.cpp
+++ b/conf/dlgpresentation.cpp
@@ -27,9 +27,9 @@ DlgPresentation::DlgPresentation( QWidget * parent )
WidgetDrawingTools * kcfg_DrawingTools = new WidgetDrawingTools( m_dlg->annotationToolsGroupBox );
m_dlg->verticalLayout_4->addWidget( kcfg_DrawingTools );
- kcfg_DrawingTools->setObjectName( "kcfg_DrawingTools" );
+ kcfg_DrawingTools->setObjectName( QStringLiteral("kcfg_DrawingTools") );
- KConfigDialogManager::changedMap()->insert( "WidgetDrawingTools", SIGNAL(changed()) );
+ KConfigDialogManager::changedMap()->insert( QStringLiteral("WidgetDrawingTools"), SIGNAL(changed()) );
QStringList choices;
choices.append( i18nc( "@label:listbox The current screen, for the presentation mode", "Current Screen" ) );
diff --git a/conf/editannottooldialog.cpp b/conf/editannottooldialog.cpp
index c633baa..0347010 100644
--- a/conf/editannottooldialog.cpp
+++ b/conf/editannottooldialog.cpp
@@ -117,9 +117,9 @@ QDomDocument EditAnnotToolDialog::toolXml() const
const ToolType toolType = m_type->itemData( m_type->currentIndex() ).value<ToolType>();
QDomDocument doc;
- QDomElement toolElement = doc.createElement( "tool" );
- QDomElement engineElement = doc.createElement( "engine" );
- QDomElement annotationElement = doc.createElement( "annotation" );
+ QDomElement toolElement = doc.createElement( QStringLiteral("tool") );
+ QDomElement engineElement = doc.createElement( QStringLiteral("engine") );
+ QDomElement annotationElement = doc.createElement( QStringLiteral("annotation") );
doc.appendChild( toolElement );
toolElement.appendChild( engineElement );
engineElement.appendChild( annotationElement );
@@ -131,67 +131,67 @@ QDomDocument EditAnnotToolDialog::toolXml() const
if ( toolType == ToolNoteLinked )
{
Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann );
- toolElement.setAttribute( "type", "note-linked" );
- engineElement.setAttribute( "type", "PickPoint" );
- engineElement.setAttribute( "color", color );
- engineElement.setAttribute( "hoverIcon", "tool-note" );
- annotationElement.setAttribute( "type", "Text" );
- annotationElement.setAttribute( "color", color );
- annotationElement.setAttribute( "icon", ta->textIcon() );
+ toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("note-linked") );
+ engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PickPoint") );
+ engineElement.setAttribute( QStringLiteral("color"), color );
+ engineElement.setAttribute( QStringLiteral("hoverIcon"), QStringLiteral("tool-note") );
+ annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Text") );
+ annotationElement.setAttribute( QStringLiteral("color"), color );
+ annotationElement.setAttribute( QStringLiteral("icon"), ta->textIcon() );
}
else if ( toolType == ToolNoteInline )
{
Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann );
- toolElement.setAttribute( "type", "note-inline" );
- engineElement.setAttribute( "type", "PickPoint" );
- engineElement.setAttribute( "color", color );
- engineElement.setAttribute( "hoverIcon", "tool-note-inline" );
- engineElement.setAttribute( "block", "true" );
- annotationElement.setAttribute( "type", "FreeText" );
- annotationElement.setAttribute( "color", color );
+ toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("note-inline") );
+ engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PickPoint") );
+ engineElement.setAttribute( QStringLiteral("color"), color );
+ engineElement.setAttribute( QStringLiteral("hoverIcon"), QStringLiteral("tool-note-inline") );
+ engineElement.setAttribute( QStringLiteral("block"), QStringLiteral("true") );
+ annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("FreeText") );
+ annotationElement.setAttribute( QStringLiteral("color"), color );
if ( ta->inplaceAlignment() != 0 )
- annotationElement.setAttribute( "align", ta->inplaceAlignment() );
+ annotationElement.setAttribute( QStringLiteral("align"), ta->inplaceAlignment() );
if ( ta->textFont() != QApplication::font() )
- annotationElement.setAttribute( "font", ta->textFont().toString() );
+ annotationElement.setAttribute( QStringLiteral("font"), ta->textFont().toString() );
}
else if ( toolType == ToolInk )
{
- toolElement.setAttribute( "type", "ink" );
- engineElement.setAttribute( "type", "SmoothLine" );
- engineElement.setAttribute( "color", color );
- annotationElement.setAttribute( "type", "Ink" );
- annotationElement.setAttribute( "color", color );
- annotationElement.setAttribute( "width", width );
+ toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("ink") );
+ engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("SmoothLine") );
+ engineElement.setAttribute( QStringLiteral("color"), color );
+ annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Ink") );
+ annotationElement.setAttribute( QStringLiteral("color"), color );
+ annotationElement.setAttribute( QStringLiteral("width"), width );
}
else if ( toolType == ToolStraightLine )
{
Okular::LineAnnotation * la = static_cast<Okular::LineAnnotation*>( m_stubann );
- toolElement.setAttribute( "type", "straight-line" );
- engineElement.setAttribute( "type", "PolyLine" );
- engineElement.setAttribute( "color", color );
- engineElement.setAttribute( "points", "2" );
- annotationElement.setAttribute( "type", "Line" );
- annotationElement.setAttribute( "color", color );
- annotationElement.setAttribute( "width", width );
+ toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("straight-line") );
+ engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PolyLine") );
+ engineElement.setAttribute( QStringLiteral("color"), color );
+ engineElement.setAttribute( QStringLiteral("points"), QStringLiteral("2") );
+ annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Line") );
+ annotationElement.setAttribute( QStringLiteral("color"), color );
+ annotationElement.setAttribute( QStringLiteral("width"), width );
if ( la->lineLeadingForwardPoint() != 0 || la->lineLeadingBackwardPoint() != 0 )
{
- annotationElement.setAttribute( "leadFwd", la->lineLeadingForwardPoint() );
- annotationElement.setAttribute( "leadBack", la->lineLeadingBackwardPoint() );
+ annotationElement.setAttribute( QStringLiteral("leadFwd"), la->lineLeadingForwardPoint() );
+ annotationElement.setAttribute( QStringLiteral("leadBack"), la->lineLeadingBackwardPoint() );
}
}
else if ( toolType == ToolPolygon )
{
Okular::LineAnnotation * la = static_cast<Okular::LineAnnotation*>( m_stubann );
- toolElement.setAttribute( "type", "polygon" );
- engineElement.setAttribute( "type", "PolyLine" );
- engineElement.setAttribute( "color", color );
- engineElement.setAttribute( "points", "-1" );
- annotationElement.setAttribute( "type", "Line" );
- annotationElement.setAttribute( "color", color );
- annotationElement.setAttribute( "width", width );
+ toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("polygon") );
+ engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PolyLine") );
+ engineElement.setAttribute( QStringLiteral("color"), color );
+ engineElement.setAttribute( QStringLiteral("points"), QStringLiteral("-1") );
+ annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Line") );
+ annotationElement.setAttribute( QStringLiteral("color"), color );
+ annotationElement.setAttribute( QStringLiteral("width"), width );
if ( la->lineInnerColor().isValid() )
{
- annotationElement.setAttribute( "innerColor", la->lineInnerColor().name() );
+ annotationElement.setAttribute( QStringLiteral("innerColor"), la->lineInnerColor().name() );
}
}
else if ( toolType == ToolTextMarkup )
@@ -201,26 +201,26 @@ QDomDocument EditAnnotToolDialog::toolXml() const
switch ( ha->highlightType() )
{
case Okular::HighlightAnnotation::Highlight:
- toolElement.setAttribute( "type", "highlight" );
- annotationElement.setAttribute( "type", "Highlight" );
+ toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("highlight") );
+ annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Highlight") );
break;
case Okular::HighlightAnnotation::Squiggly:
- toolElement.setAttribute( "type", "squiggly" );
- annotationElement.setAttribute( "type", "Squiggly" );
+ toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("squiggly") );
+ annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Squiggly") );
break;
case Okular::HighlightAnnotation::Underline:
- toolElement.setAttribute( "type", "underline" );
- annotationElement.setAttribute( "type", "Underline" );
+ toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("underline") );
+ annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Underline") );
break;
case Okular::HighlightAnnotation::StrikeOut:
- toolElement.setAttribute( "type", "strikeout" );
- annotationElement.setAttribute( "type", "StrikeOut" );
+ toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("strikeout") );
+ annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("StrikeOut") );
break;
}
- engineElement.setAttribute( "type", "TextSelector" );
- engineElement.setAttribute( "color", color );
- annotationElement.setAttribute( "color", color );
+ engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("TextSelector") );
+ engineElement.setAttribute( QStringLiteral("color"), color );
+ annotationElement.setAttribute( QStringLiteral("color"), color );
}
else if ( toolType == ToolGeometricalShape )
{
@@ -228,38 +228,38 @@ QDomDocument EditAnnotToolDialog::toolXml() const
if ( ga->geometricalType() == Okular::GeomAnnotation::InscribedCircle )
{
- toolElement.setAttribute( "type", "ellipse" );
- annotationElement.setAttribute( "type", "GeomCircle" );
+ toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("ellipse") );
+ annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("GeomCircle") );
}
else
{
- toolElement.setAttribute( "type", "rectangle" );
- annotationElement.setAttribute( "type", "GeomSquare" );
+ toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("rectangle") );
+ annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("GeomSquare") );
}
- engineElement.setAttribute( "type", "PickPoint" );
- engineElement.setAttribute( "color", color );
- engineElement.setAttribute( "block", "true" );
- annotationElement.setAttribute( "color", color );
- annotationElement.setAttribute( "width", width );
+ engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PickPoint") );
+ engineElement.setAttribute( QStringLiteral("color"), color );
+ engineElement.setAttribute( QStringLiteral("block"), QStringLiteral("true") );
+ annotationElement.setAttribute( QStringLiteral("color"), color );
+ annotationElement.setAttribute( QStringLiteral("width"), width );
if ( ga->geometricalInnerColor().isValid() )
- annotationElement.setAttribute( "innerColor", ga->geometricalInnerColor().name() );
+ annotationElement.setAttribute( QStringLiteral("innerColor"), ga->geometricalInnerColor().name() );
}
else if ( toolType == ToolStamp )
{
Okular::StampAnnotation * sa = static_cast<Okular::StampAnnotation*>( m_stubann );
- toolElement.setAttribute( "type", "stamp" );
- engineElement.setAttribute( "type", "PickPoint" );
- engineElement.setAttribute( "hoverIcon", sa->stampIconName() );
- engineElement.setAttribute( "size", "64" );
- engineElement.setAttribute( "block", "true" );
- annotationElement.setAttribute( "type", "Stamp" );
- annotationElement.setAttribute( "icon", sa->stampIconName() );
+ toolElement.setAttribute( QStringLiteral("type"), QStringLiteral("stamp") );
+ engineElement.setAttribute( QStringLiteral("type"), QStringLiteral("PickPoint") );
+ engineElement.setAttribute( QStringLiteral("hoverIcon"), sa->stampIconName() );
+ engineElement.setAttribute( QStringLiteral("size"), QStringLiteral("64") );
+ engineElement.setAttribute( QStringLiteral("block"), QStringLiteral("true") );
+ annotationElement.setAttribute( QStringLiteral("type"), QStringLiteral("Stamp") );
+ annotationElement.setAttribute( QStringLiteral("icon"), sa->stampIconName() );
}
if ( opacity != 1 )
- annotationElement.setAttribute( "opacity", opacity );
+ annotationElement.setAttribute( QStringLiteral("opacity"), opacity );
return doc;
}
@@ -276,7 +276,7 @@ void EditAnnotToolDialog::createStubAnnotation()
{
Okular::TextAnnotation * ta = new Okular::TextAnnotation();
ta->setTextType( Okular::TextAnnotation::Linked );
- ta->setTextIcon( "Note" );
+ ta->setTextIcon( QStringLiteral("Note") );
ta->style().setColor( Qt::yellow );
m_stubann = ta;
}
@@ -329,7 +329,7 @@ void EditAnnotToolDialog::createStubAnnotation()
else if ( toolType == ToolStamp )
{
Okular::StampAnnotation * sa = new Okular::StampAnnotation();
- sa->setStampIconName( "okular" );
+ sa->setStampIconName( QStringLiteral("okular") );
m_stubann = sa;
}
}
@@ -373,90 +373,90 @@ void EditAnnotToolDialog::setToolType( ToolType newType )
void EditAnnotToolDialog::loadTool( const QDomElement &toolElement )
{
- const QDomElement engineElement = toolElement.elementsByTagName( "engine" ).item( 0 ).toElement();
- const QDomElement annotationElement = engineElement.elementsByTagName( "annotation" ).item( 0 ).toElement();
- const QString annotType = toolElement.attribute( "type" );
+ const QDomElement engineElement = toolElement.elementsByTagName( QStringLiteral("engine") ).item( 0 ).toElement();
+ const QDomElement annotationElement = engineElement.elementsByTagName( QStringLiteral("annotation") ).item( 0 ).toElement();
+ const QString annotType = toolElement.attribute( QStringLiteral("type") );
- if ( annotType == "ellipse" )
+ if ( annotType == QLatin1String("ellipse") )
{
setToolType( ToolGeometricalShape );
Okular::GeomAnnotation * ga = static_cast<Okular::GeomAnnotation*>( m_stubann );
ga->setGeometricalType( Okular::GeomAnnotation::InscribedCircle );
- if ( annotationElement.hasAttribute( "innerColor" ) )
- ga->setGeometricalInnerColor( QColor( annotationElement.attribute( "innerColor" ) ) );
+ if ( annotationElement.hasAttribute( QStringLiteral("innerColor") ) )
+ ga->setGeometricalInnerColor( QColor( annotationElement.attribute( QStringLiteral("innerColor") ) ) );
}
- else if ( annotType == "highlight" )
+ else if ( annotType == QLatin1String("highlight") )
{
setToolType( ToolTextMarkup );
Okular::HighlightAnnotation * ha = static_cast<Okular::HighlightAnnotation*>( m_stubann );
ha->setHighlightType( Okular::HighlightAnnotation::Highlight );
}
- else if ( annotType == "ink" )
+ else if ( annotType == QLatin1String("ink") )
{
setToolType( ToolInk );
}
- else if ( annotType == "note-inline" )
+ else if ( annotType == QLatin1String("note-inline") )
{
setToolType( ToolNoteInline );
Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann );
- if ( annotationElement.hasAttribute( "align" ) )
- ta->setInplaceAlignment( annotationElement.attribute( "align" ).toInt() );
- if ( annotationElement.hasAttribute( "font" ) )
+ if ( annotationElement.hasAttribute( QStringLiteral("align") ) )
+ ta->setInplaceAlignment( annotationElement.attribute( QStringLiteral("align") ).toInt() );
+ if ( annotationElement.hasAttribute( QStringLiteral("font") ) )
{
QFont f;
- f.fromString( annotationElement.attribute( "font" ) );
+ f.fromString( annotationElement.attribute( QStringLiteral("font") ) );
ta->setTextFont( f );
}
}
- else if ( annotType == "note-linked" )
+ else if ( annotType == QLatin1String("note-linked") )
{
setToolType( ToolNoteLinked );
Okular::TextAnnotation * ta = static_cast<Okular::TextAnnotation*>( m_stubann );
- ta->setTextIcon( annotationElement.attribute( "icon" ) );
+ ta->setTextIcon( annotationElement.attribute( QStringLiteral("icon") ) );
}
- else if ( annotType == "polygon" )
+ else if ( annotType == QLatin1String("polygon") )
{
setToolType( ToolPolygon );
Okular::LineAnnotation * la = static_cast<Okular::LineAnnotation*>( m_stubann );
- if ( annotationElement.hasAttribute( "innerColor" ) )
- la->setLineInnerColor( QColor( annotationElement.attribute( "innerColor" ) ) );
+ if ( annotationElement.hasAttribute( QStringLiteral("innerColor") ) )
+ la->setLineInnerColor( QColor( annotationElement.attribute( QStringLiteral("innerColor") ) ) );
}
- else if ( annotType == "rectangle" )
+ else if ( annotType == QLatin1String("rectangle") )
{
setToolType( ToolGeometricalShape );
Okular::GeomAnnotation * ga = static_cast<Okular::GeomAnnotation*>( m_stubann );
ga->setGeometricalType( Okular::GeomAnnotation::InscribedSquare );
- if ( annotationElement.hasAttribute( "innerColor" ) )
- ga->setGeometricalInnerColor( QColor( annotationElement.attribute( "innerColor" ) ) );
+ if ( annotationElement.hasAttribute( QStringLiteral("innerColor") ) )
+ ga->setGeometricalInnerColor( QColor( annotationElement.attribute( QStringLiteral("innerColor") ) ) );
}
- else if ( annotType == "squiggly" )
+ else if ( annotType == QLatin1String("squiggly") )
{
setToolType( ToolTextMarkup );
Okular::HighlightAnnotation * ha = static_cast<Okular::HighlightAnnotation*>( m_stubann );
ha->setHighlightType( Okular::HighlightAnnotation::Squiggly );
}
- else if ( annotType == "stamp" )
+ else if ( annotType == QLatin1String("stamp") )
{
setToolType( ToolStamp );
Okular::StampAnnotation * sa = static_cast<Okular::StampAnnotation*>( m_stubann );
- sa->setStampIconName( annotationElement.attribute( "icon" ) );
+ sa->setStampIconName( annotationElement.attribute( QStringLiteral("icon") ) );
}
- else if ( annotType == "straight-line" )
+ else if ( annotType == QLatin1String("straight-line") )
{
setToolType( ToolStraightLine );
Okular::LineAnnotation * la = static_cast<Okular::LineAnnotation*>( m_stubann );
- if ( annotationElement.hasAttribute( "leadFwd" ) )
- la->setLineLeadingForwardPoint( annotationElement.attribute( "leadFwd" ).toDouble() );
- if ( annotationElement.hasAttribute( "leadBack" ) )
- la->setLineLeadingBackwardPoint( annotationElement.attribute( "leadBack" ).toDouble() );
+ if ( annotationElement.hasAttribute( QStringLiteral("leadFwd") ) )
+ la->setLineLeadingForwardPoint( annotationElement.attribute( QStringLiteral("leadFwd") ).toDouble() );
+ if ( annotationElement.hasAttribute( QStringLiteral("leadBack") ) )
+ la->setLineLeadingBackwardPoint( annotationElement.attribute( QStringLiteral("leadBack") ).toDouble() );
}
- else if ( annotType == "strikeout" )
+ else if ( annotType == QLatin1String("strikeout") )
{
setToolType( ToolTextMarkup );
Okular::HighlightAnnotation * ha = static_cast<Okular::HighlightAnnotation*>( m_stubann );
ha->setHighlightType( Okular::HighlightAnnotation::StrikeOut );
}
- else if ( annotType == "underline" )
+ else if ( annotType == QLatin1String("underline") )
{
setToolType( ToolTextMarkup );
Okular::HighlightAnnotation * ha = static_cast<Okular::HighlightAnnotation*>( m_stubann );
@@ -464,15 +464,15 @@ void EditAnnotToolDialog::loadTool( const QDomElement &toolElement )
}
// Common properties
- if ( annotationElement.hasAttribute( "color" ) )
- m_stubann->style().setColor( QColor( annotationElement.attribute( "color" ) ) );
- if ( annotationElement.hasAttribute( "opacity" ) )
- m_stubann->style().setOpacity( annotationElement.attribute( "opacity" ).toDouble() );
- if ( annotationElement.hasAttribute( "width" ) )
- m_stubann->style().setWidth( annotationElement.attribute( "width" ).toDouble() );
-
- if ( toolElement.hasAttribute( "name" ) )
- m_name->setText( toolElement.attribute( "name" ) );
+ if ( annotationElement.hasAttribute( QStringLiteral("color") ) )
+ m_stubann->style().setColor( QColor( annotationElement.attribute( QStringLiteral("color") ) ) );
+ if ( annotationElement.hasAttribute( QStringLiteral("opacity") ) )
+ m_stubann->style().setOpacity( annotationElement.attribute( QStringLiteral("opacity") ).toDouble() );
+ if ( annotationElement.hasAttribute( QStringLiteral("width") ) )
+ m_stubann->style().setWidth( annotationElement.attribute( QStringLiteral("width") ).toDouble() );
+
+ if ( toolElement.hasAttribute( QStringLiteral("name") ) )
+ m_name->setText( toolElement.attribute( QStringLiteral("name") ) );
}
void EditAnnotToolDialog::slotTypeChanged()
diff --git a/conf/preferencesdialog.cpp b/conf/preferencesdialog.cpp
index 1ddb5e6..1be8f71 100644
--- a/conf/preferencesdialog.cpp
+++ b/conf/preferencesdialog.cpp
@@ -22,7 +22,7 @@
#include "dlgdebug.h"
PreferencesDialog::PreferencesDialog( QWidget * parent, KConfigSkeleton * skeleton, Okular::EmbedMode embedMode )
- : KConfigDialog( parent, "preferences", skeleton )
+ : KConfigDialog( parent, QStringLiteral("preferences"), skeleton )
{
setWindowModality( Qt::ApplicationModal );
@@ -37,9 +37,9 @@ PreferencesDialog::PreferencesDialog( QWidget * parent, KConfigSkeleton * skelet
m_debug = new DlgDebug( this );
#endif
- addPage( m_general, i18n("General"), "okular", i18n("General Options") );
- addPage( m_accessibility, i18n("Accessibility"), "preferences-desktop-accessibility", i18n("Accessibility Reading Aids") );
- addPage( m_performance, i18n("Performance"), "preferences-system-performance", i18n("Performance Tuning") );
+ addPage( m_general, i18n("General"), QStringLiteral("okular"), i18n("General Options") );
+ addPage( m_accessibility, i18n("Accessibility"), QStringLiteral("preferences-desktop-accessibility"), i18n("Accessibility Reading Aids") );
+ addPage( m_performance, i18n("Performance"), QStringLiteral("preferences-system-performance"), i18n("Performance Tuning") );
if( embedMode == Okular::ViewerWidgetMode )
{
setWindowTitle( i18n("Configure Viewer") );
@@ -49,16 +49,16 @@ PreferencesDialog::PreferencesDialog( QWidget * parent, KConfigSkeleton * skelet
m_presentation = new DlgPresentation( this );
m_annotations = new DlgAnnotations( this );
m_editor = new DlgEditor( this );
- addPage( m_presentation, i18n("Presentation"), "view-presentation",
+ addPage( m_presentation, i18n("Presentation"), QStringLiteral("view-presentation"),
i18n("Options for Presentation Mode") );
m_annotationsPage = addPage( m_annotations, i18n("Annotations"),
- "draw-freehand", i18n("Annotation Options") );
- addPage( m_editor, i18n("Editor"), "accessories-text-editor", i18n("Editor Options") );
+ QStringLiteral("draw-freehand"), i18n("Annotation Options") );
+ addPage( m_editor, i18n("Editor"), QStringLiteral("accessories-text-editor"), i18n("Editor Options") );
}
#ifdef OKULAR_DEBUG_CONFIGPAGE
addPage( m_debug, "Debug", "system-run", "Debug options" );
#endif
- setHelp("configure", "okular");
+ setHelp(QStringLiteral("configure"), QStringLiteral("okular"));
}
void PreferencesDialog::switchToAnnotationsPage()
diff --git a/conf/widgetannottools.cpp b/conf/widgetannottools.cpp
index 0c2f78b..cbc3206 100644
--- a/conf/widgetannottools.cpp
+++ b/conf/widgetannottools.cpp
@@ -58,7 +58,7 @@ QStringList WidgetAnnotTools::tools() const
// Set id
QDomElement toolElement = doc.documentElement();
- toolElement.setAttribute( "id", i+1 );
+ toolElement.setAttribute( QStringLiteral("id"), i+1 );
// Remove old shortcut, if any
QDomNode oldShortcut = toolElement.elementsByTagName( QStringLiteral("shortcut") ).item( 0 );
diff --git a/core/action.cpp b/core/action.cpp
index b6b1947..c46ba19 100644
--- a/core/action.cpp
+++ b/core/action.cpp
@@ -46,7 +46,7 @@ Action::~Action()
QString Action::actionTip() const
{
- return "";
+ return QLatin1String("");
}
void Action::setNativeId( const QVariant &id )
@@ -103,7 +103,7 @@ Action::ActionType GotoAction::actionType() const
QString GotoAction::actionTip() const
{
Q_D( const GotoAction );
- return d->m_extFileName.isEmpty() ? ( d->m_vp.isValid() ? i18n( "Go to page %1", d->m_vp.pageNumber + 1 ) : "" ) :
+ return d->m_extFileName.isEmpty() ? ( d->m_vp.isValid() ? i18n( "Go to page %1", d->m_vp.pageNumber + 1 ) : QLatin1String("") ) :
i18n("Open external file");
}
diff --git a/core/annotations.cpp b/core/annotations.cpp
index 2461ef2..df52756 100644
--- a/core/annotations.cpp
+++ b/core/annotations.cpp
@@ -90,12 +90,12 @@ static double strokeDistance( double distance, double penWidth )
Annotation * AnnotationUtils::createAnnotation( const QDomElement & annElement )
{
// safety check on annotation element
- if ( !annElement.hasAttribute( "type" ) )
+ if ( !annElement.hasAttribute( QStringLiteral("type") ) )
return 0;
// build annotation of given type
Annotation * annotation = 0;
- int typeNumber = annElement.attribute( "type" ).toInt();
+ int typeNumber = annElement.attribute( QStringLiteral("type") ).toInt();
switch ( typeNumber )
{
case Annotation::AText:
@@ -129,7 +129,7 @@ void AnnotationUtils::storeAnnotation( const Annotation * ann, QDomElement & ann
QDomDocument & document )
{
// save annotation's type as element's attribute
- annElement.setAttribute( "type", (uint)ann->subType() );
+ annElement.setAttribute( QStringLiteral("type"), (uint)ann->subType() );
// append all annotation data as children of this node
ann->store( annElement, document );
@@ -709,73 +709,73 @@ void Annotation::store( QDomNode & annNode, QDomDocument & document ) const
{
Q_D( const Annotation );
// create [base] element of the annotation node
- QDomElement e = document.createElement( "base" );
+ QDomElement e = document.createElement( QStringLiteral("base") );
annNode.appendChild( e );
// store -contents- attributes
if ( !d->m_author.isEmpty() )
- e.setAttribute( "author", d->m_author );
+ e.setAttribute( QStringLiteral("author"), d->m_author );
if ( !d->m_contents.isEmpty() )
- e.setAttribute( "contents", d->m_contents );
+ e.setAttribute( QStringLiteral("contents"), d->m_contents );
if ( !d->m_uniqueName.isEmpty() )
- e.setAttribute( "uniqueName", d->m_uniqueName );
+ e.setAttribute( QStringLiteral("uniqueName"), d->m_uniqueName );
if ( d->m_modifyDate.isValid() )
- e.setAttribute( "modifyDate", d->m_modifyDate.toString(Qt::ISODate) );
+ e.setAttribute( QStringLiteral("modifyDate"), d->m_modifyDate.toString(Qt::ISODate) );
if ( d->m_creationDate.isValid() )
- e.setAttribute( "creationDate", d->m_creationDate.toString(Qt::ISODate) );
+ e.setAttribute( QStringLiteral("creationDate"), d->m_creationDate.toString(Qt::ISODate) );
// store -other- attributes
if ( d->m_flags ) // Strip internal flags
- e.setAttribute( "flags", d->m_flags & ~(External | ExternallyDrawn | BeingMoved) );
+ e.setAttribute( QStringLiteral("flags"), d->m_flags & ~(External | ExternallyDrawn | BeingMoved) );
if ( d->m_style.color().isValid() )
- e.setAttribute( "color", d->m_style.color().name() );
+ e.setAttribute( QStringLiteral("color"), d->m_style.color().name() );
if ( d->m_style.opacity() != 1.0 )
- e.setAttribute( "opacity", QString::number( d->m_style.opacity() ) );
+ e.setAttribute( QStringLiteral("opacity"), QString::number( d->m_style.opacity() ) );
// Sub-Node-1 - boundary
- QDomElement bE = document.createElement( "boundary" );
+ QDomElement bE = document.createElement( QStringLiteral("boundary") );
e.appendChild( bE );
- bE.setAttribute( "l", QString::number( d->m_boundary.left ) );
- bE.setAttribute( "t", QString::number( d->m_boundary.top ) );
- bE.setAttribute( "r", QString::number( d->m_boundary.right ) );
- bE.setAttribute( "b", QString::number( d->m_boundary.bottom ) );
+ bE.setAttribute( QStringLiteral("l"), QString::number( d->m_boundary.left ) );
+ bE.setAttribute( QStringLiteral("t"), QString::number( d->m_boundary.top ) );
+ bE.setAttribute( QStringLiteral("r"), QString::number( d->m_boundary.right ) );
+ bE.setAttribute( QStringLiteral("b"), QString::number( d->m_boundary.bottom ) );
// Sub-Node-2 - penStyle
if ( d->m_style.width() != 1 || d->m_style.lineStyle() != Solid || d->m_style.xCorners() != 0 ||
d->m_style.yCorners() != 0.0 || d->m_style.marks() != 3 || d->m_style.spaces() != 0 )
{
- QDomElement psE = document.createElement( "penStyle" );
+ QDomElement psE = document.createElement( QStringLiteral("penStyle") );
e.appendChild( psE );
- psE.setAttribute( "width", QString::number( d->m_style.width() ) );
- psE.setAttribute( "style", (int)d->m_style.lineStyle() );
- psE.setAttribute( "xcr", QString::number( d->m_style.xCorners() ) );
- psE.setAttribute( "ycr", QString::number( d->m_style.yCorners() ) );
- psE.setAttribute( "marks", d->m_style.marks() );
- psE.setAttribute( "spaces", d->m_style.spaces() );
+ psE.setAttribute( QStringLiteral("width"), QString::number( d->m_style.width() ) );
+ psE.setAttribute( QStringLiteral("style"), (int)d->m_style.lineStyle() );
+ psE.setAttribute( QStringLiteral("xcr"), QString::number( d->m_style.xCorners() ) );
+ psE.setAttribute( QStringLiteral("ycr"), QString::number( d->m_style.yCorners() ) );
+ psE.setAttribute( QStringLiteral("marks"), d->m_style.marks() );
+ psE.setAttribute( QStringLiteral("spaces"), d->m_style.spaces() );
}
// Sub-Node-3 - penEffect
if ( d->m_style.lineEffect() != NoEffect || d->m_style.effectIntensity() != 1.0 )
{
- QDomElement peE = document.createElement( "penEffect" );
+ QDomElement peE = document.createElement( QStringLiteral("penEffect") );
e.appendChild( peE );
- peE.setAttribute( "effect", (int)d->m_style.lineEffect() );
- peE.setAttribute( "intensity", QString::number( d->m_style.effectIntensity() ) );
+ peE.setAttribute( QStringLiteral("effect"), (int)d->m_style.lineEffect() );
+ peE.setAttribute( QStringLiteral("intensity"), QString::number( d->m_style.effectIntensity() ) );
}
// Sub-Node-4 - window
if ( d->m_window.flags() != -1 || !d->m_window.title().isEmpty() ||
!d->m_window.summary().isEmpty() )
{
- QDomElement wE = document.createElement( "window" );
+ QDomElement wE = document.createElement( QStringLiteral("window") );
e.appendChild( wE );
- wE.setAttribute( "flags", d->m_window.flags() );
- wE.setAttribute( "top", QString::number( d->m_window.topLeft().x ) );
- wE.setAttribute( "left", QString::number( d->m_window.topLeft().y ) );
- wE.setAttribute( "width", d->m_window.width() );
- wE.setAttribute( "height", d->m_window.height() );
- wE.setAttribute( "title", d->m_window.title() );
- wE.setAttribute( "summary", d->m_window.summary() );
+ wE.setAttribute( QStringLiteral("flags"), d->m_window.flags() );
+ wE.setAttribute( QStringLiteral("top"), QString::number( d->m_window.topLeft().x ) );
+ wE.setAttribute( QStringLiteral("left"), QString::number( d->m_window.topLeft().y ) );
+ wE.setAttribute( QStringLiteral("width"), d->m_window.width() );
+ wE.setAttribute( QStringLiteral("height"), d->m_window.height() );
+ wE.setAttribute( QStringLiteral("title"), d->m_window.title() );
+ wE.setAttribute( QStringLiteral("summary"), d->m_window.summary() );
}
// create [revision] element of the annotation node (if any)
@@ -788,11 +788,11 @@ void Annotation::store( QDomNode & annNode, QDomDocument & document ) const
{
// create revision element
const Revision & revision = *it;
- QDomElement r = document.createElement( "revision" );
+ QDomElement r = document.createElement( QStringLiteral("revision") );
annNode.appendChild( r );
// set element attributes
- r.setAttribute( "revScope", (int)revision.scope() );
- r.setAttribute( "revType", (int)revision.type() );
+ r.setAttribute( QStringLiteral("revScope"), (int)revision.scope() );
+ r.setAttribute( QStringLiteral("revType"), (int)revision.type() );
// use revision as the annotation element, so fill it up
AnnotationUtils::storeAnnotation( revision.annotation(), r, document );
}
@@ -800,8 +800,8 @@ void Annotation::store( QDomNode & annNode, QDomDocument & document ) const
QDomNode Annotation::getAnnotationPropertiesDomNode() const
{
- QDomDocument doc( "documentInfo" );
- QDomElement node = doc.createElement( "annotation" );
+ QDomDocument doc( QStringLiteral("documentInfo") );
+ QDomElement node = doc.createElement( QStringLiteral("annotation") );
store(node, doc);
return node;
@@ -875,29 +875,29 @@ bool AnnotationPrivate::openDialogAfterCreation() const
void AnnotationPrivate::setAnnotationProperties( const QDomNode& node )
{
// get the [base] element of the annotation node
- QDomElement e = AnnotationUtils::findChildElement( node, "base" );
+ QDomElement e = AnnotationUtils::findChildElement( node, QStringLiteral("base") );
if ( e.isNull() )
return;
// parse -contents- attributes
- if ( e.hasAttribute( "author" ) )
- m_author = e.attribute( "author" );
- if ( e.hasAttribute( "contents" ) )
- m_contents = e.attribute( "contents" );
- if ( e.hasAttribute( "uniqueName" ) )
- m_uniqueName = e.attribute( "uniqueName" );
- if ( e.hasAttribute( "modifyDate" ) )
- m_modifyDate = QDateTime::fromString( e.attribute("modifyDate"), Qt::ISODate );
- if ( e.hasAttribute( "creationDate" ) )
- m_creationDate = QDateTime::fromString( e.attribute("creationDate"), Qt::ISODate );
+ if ( e.hasAttribute( QStringLiteral("author") ) )
+ m_author = e.attribute( QStringLiteral("author") );
+ if ( e.hasAttribute( QStringLiteral("contents") ) )
+ m_contents = e.attribute( QStringLiteral("contents") );
+ if ( e.hasAttribute( QStringLiteral("uniqueName") ) )
+ m_uniqueName = e.attribute( QStringLiteral("uniqueName") );
+ if ( e.hasAttribute( QStringLiteral("modifyDate") ) )
+ m_modifyDate = QDateTime::fromString( e.attribute(QStringLiteral("modifyDate")), Qt::ISODate );
+ if ( e.hasAttribute( QStringLiteral("creationDate") ) )
+ m_creationDate = QDateTime::fromString( e.attribute(QStringLiteral("creationDate")), Qt::ISODate );
// parse -other- attributes
- if ( e.hasAttribute( "flags" ) )
- m_flags = e.attribute( "flags" ).toInt();
- if ( e.hasAttribute( "color" ) )
- m_style.setColor( QColor( e.attribute( "color" ) ) );
- if ( e.hasAttribute( "opacity" ) )
- m_style.setOpacity( e.attribute( "opacity" ).toDouble() );
+ if ( e.hasAttribute( QStringLiteral("flags") ) )
+ m_flags = e.attribute( QStringLiteral("flags") ).toInt();
+ if ( e.hasAttribute( QStringLiteral("color") ) )
+ m_style.setColor( QColor( e.attribute( QStringLiteral("color") ) ) );
+ if ( e.hasAttribute( QStringLiteral("opacity") ) )
+ m_style.setOpacity( e.attribute( QStringLiteral("opacity") ).toDouble() );
// parse -the-subnodes- (describing Style, Window, Revision(s) structures)
// Note: all subnodes if present must be 'attributes complete'
@@ -908,39 +908,39 @@ void AnnotationPrivate::setAnnotationProperties( const QDomNode& node )
eSubNode = eSubNode.nextSibling();
// parse boundary
- if ( ee.tagName() == "boundary" )
+ if ( ee.tagName() == QLatin1String("boundary") )
{
- m_boundary=NormalizedRect(ee.attribute( "l" ).toDouble(),
- ee.attribute( "t" ).toDouble(),
- ee.attribute( "r" ).toDouble(),
- ee.attribute( "b" ).toDouble());
+ m_boundary=NormalizedRect(ee.attribute( QStringLiteral("l") ).toDouble(),
+ ee.attribute( QStringLiteral("t") ).toDouble(),
+ ee.attribute( QStringLiteral("r") ).toDouble(),
+ ee.attribute( QStringLiteral("b") ).toDouble());
}
// parse penStyle if not default
- else if ( ee.tagName() == "penStyle" )
+ else if ( ee.tagName() == QLatin1String("penStyle") )
{
- m_style.setWidth( ee.attribute( "width" ).toDouble() );
- m_style.setLineStyle( (Annotation::LineStyle)ee.attribute( "style" ).toInt() );
- m_style.setXCorners( ee.attribute( "xcr" ).toDouble() );
- m_style.setYCorners( ee.attribute( "ycr" ).toDouble() );
- m_style.setMarks( ee.attribute( "marks" ).toInt() );
- m_style.setSpaces( ee.attribute( "spaces" ).toInt() );
+ m_style.setWidth( ee.attribute( QStringLiteral("width") ).toDouble() );
+ m_style.setLineStyle( (Annotation::LineStyle)ee.attribute( QStringLiteral("style") ).toInt() );
+ m_style.setXCorners( ee.attribute( QStringLiteral("xcr") ).toDouble() );
+ m_style.setYCorners( ee.attribute( QStringLiteral("ycr") ).toDouble() );
+ m_style.setMarks( ee.attribute( QStringLiteral("marks") ).toInt() );
+ m_style.setSpaces( ee.attribute( QStringLiteral("spaces") ).toInt() );
}
// parse effectStyle if not default
- else if ( ee.tagName() == "penEffect" )
+ else if ( ee.tagName() == QLatin1String("penEffect") )
{
- m_style.setLineEffect( (Annotation::LineEffect)ee.attribute( "effect" ).toInt() );
- m_style.setEffectIntensity( ee.attribute( "intensity" ).toDouble() );
+ m_style.setLineEffect( (Annotation::LineEffect)ee.attribute( QStringLiteral("effect") ).toInt() );
+ m_style.setEffectIntensity( ee.attribute( QStringLiteral("intensity") ).toDouble() );
}
// parse window if present
- else if ( ee.tagName() == "window" )
+ else if ( ee.tagName() == QLatin1String("window") )
{
- m_window.setFlags( ee.attribute( "flags" ).toInt() );
- m_window.setTopLeft( NormalizedPoint( ee.attribute( "top" ).toDouble(),
- ee.attribute( "left" ).toDouble() ) );
- m_window.setWidth( ee.attribute( "width" ).toInt() );
- m_window.setHeight( ee.attribute( "height" ).toInt() );
- m_window.setTitle( ee.attribute( "title" ) );
- m_window.setSummary( ee.attribute( "summary" ) );
+ m_window.setFlags( ee.attribute( QStringLiteral("flags") ).toInt() );
+ m_window.setTopLeft( NormalizedPoint( ee.attribute( QStringLiteral("top") ).toDouble(),
+ ee.attribute( QStringLiteral("left") ).toDouble() ) );
+ m_window.setWidth( ee.attribute( QStringLiteral("width") ).toInt() );
+ m_window.setHeight( ee.attribute( QStringLiteral("height") ).toInt() );
+ m_window.setTitle( ee.attribute( QStringLiteral("title") ) );
+ m_window.setSummary( ee.attribute( QStringLiteral("summary") ) );
}
}
@@ -949,13 +949,13 @@ void AnnotationPrivate::setAnnotationProperties( const QDomNode& node )
for ( ; revNode.isElement(); revNode = revNode.nextSibling() )
{
QDomElement revElement = revNode.toElement();
- if ( revElement.tagName() != "revision" )
+ if ( revElement.tagName() != QLatin1String("revision") )
continue;
// compile the Revision structure crating annotation
Annotation::Revision revision;
- revision.setScope( (Annotation::RevisionScope)revElement.attribute( "revScope" ).toInt() );
- revision.setType( (Annotation::RevisionType)revElement.attribute( "revType" ).toInt() );
+ revision.setScope( (Annotation::RevisionScope)revElement.attribute( QStringLiteral("revScope") ).toInt() );
+ revision.setType( (Annotation::RevisionType)revElement.attribute( QStringLiteral("revType") ).toInt() );
revision.setAnnotation( AnnotationUtils::createAnnotation( revElement ) );
// if annotation is valid, add revision to internal list
@@ -976,7 +976,7 @@ class Okular::TextAnnotationPrivate : public Okular::AnnotationPrivate
public:
TextAnnotationPrivate()
: AnnotationPrivate(), m_textType( TextAnnotation::Linked ),
- m_textIcon( "Comment" ), m_inplaceAlign( 0 ),
+ m_textIcon( QStringLiteral("Comment") ), m_inplaceAlign( 0 ),
m_inplaceIntent( TextAnnotation::Unknown )
{
}
@@ -1114,32 +1114,32 @@ void TextAnnotation::store( QDomNode & node, QDomDocument & document ) const
Annotation::store( node, document );
// create [text] element
- QDomElement textElement = document.createElement( "text" );
+ QDomElement textElement = document.createElement( QStringLiteral("text") );
node.appendChild( textElement );
// store the optional attributes
if ( d->m_textType != Linked )
- textElement.setAttribute( "type", (int)d->m_textType );
+ textElement.setAttribute( QStringLiteral("type"), (int)d->m_textType );
if ( !d->m_textIcon.isEmpty() )
- textElement.setAttribute( "icon", d->m_textIcon );
+ textElement.setAttribute( QStringLiteral("icon"), d->m_textIcon );
if ( d->m_textFont != QApplication::font() )
- textElement.setAttribute( "font", d->m_textFont.toString() );
+ textElement.setAttribute( QStringLiteral("font"), d->m_textFont.toString() );
if ( d->m_inplaceAlign )
- textElement.setAttribute( "align", d->m_inplaceAlign );
+ textElement.setAttribute( QStringLiteral("align"), d->m_inplaceAlign );
if ( d->m_inplaceIntent != Unknown )
- textElement.setAttribute( "intent", (int)d->m_inplaceIntent );
+ textElement.setAttribute( QStringLiteral("intent"), (int)d->m_inplaceIntent );
// Sub-Node - callout
if ( d->m_inplaceCallout[0].x != 0.0 )
{
- QDomElement calloutElement = document.createElement( "callout" );
+ QDomElement calloutElement = document.createElement( QStringLiteral("callout") );
textElement.appendChild( calloutElement );
- calloutElement.setAttribute( "ax", QString::number( d->m_inplaceCallout[0].x ) );
- calloutElement.setAttribute( "ay", QString::number( d->m_inplaceCallout[0].y ) );
- calloutElement.setAttribute( "bx", QString::number( d->m_inplaceCallout[1].x ) );
- calloutElement.setAttribute( "by", QString::number( d->m_inplaceCallout[1].y ) );
- calloutElement.setAttribute( "cx", QString::number( d->m_inplaceCallout[2].x ) );
- calloutElement.setAttribute( "cy", QString::number( d->m_inplaceCallout[2].y ) );
+ calloutElement.setAttribute( QStringLiteral("ax"), QString::number( d->m_inplaceCallout[0].x ) );
+ calloutElement.setAttribute( QStringLiteral("ay"), QString::number( d->m_inplaceCallout[0].y ) );
+ calloutElement.setAttribute( QStringLiteral("bx"), QString::number( d->m_inplaceCallout[1].x ) );
+ calloutElement.setAttribute( QStringLiteral("by"), QString::number( d->m_inplaceCallout[1].y ) );
+ calloutElement.setAttribute( QStringLiteral("cx"), QString::number( d->m_inplaceCallout[2].x ) );
+ calloutElement.setAttribute( QStringLiteral("cy"), QString::number( d->m_inplaceCallout[2].y ) );
}
}
@@ -1200,20 +1200,20 @@ void TextAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
{
QDomElement e = subNode.toElement();
subNode = subNode.nextSibling();
- if ( e.tagName() != "text" )
+ if ( e.tagName() != QLatin1String("text") )
continue;
// parse the attributes
- if ( e.hasAttribute( "type" ) )
- m_textType = (TextAnnotation::TextType)e.attribute( "type" ).toInt();
- if ( e.hasAttribute( "icon" ) )
- m_textIcon = e.attribute( "icon" );
- if ( e.hasAttribute( "font" ) )
- m_textFont.fromString( e.attribute( "font" ) );
- if ( e.hasAttribute( "align" ) )
- m_inplaceAlign = e.attribute( "align" ).toInt();
- if ( e.hasAttribute( "intent" ) )
- m_inplaceIntent = (TextAnnotation::InplaceIntent)e.attribute( "intent" ).toInt();
+ if ( e.hasAttribute( QStringLiteral("type") ) )
+ m_textType = (TextAnnotation::TextType)e.attribute( QStringLiteral("type") ).toInt();
+ if ( e.hasAttribute( QStringLiteral("icon") ) )
+ m_textIcon = e.attribute( QStringLiteral("icon") );
+ if ( e.hasAttribute( QStringLiteral("font") ) )
+ m_textFont.fromString( e.attribute( QStringLiteral("font") ) );
+ if ( e.hasAttribute( QStringLiteral("align") ) )
+ m_inplaceAlign = e.attribute( QStringLiteral("align") ).toInt();
+ if ( e.hasAttribute( QStringLiteral("intent") ) )
+ m_inplaceIntent = (TextAnnotation::InplaceIntent)e.attribute( QStringLiteral("intent") ).toInt();
// parse the subnodes
QDomNode eSubNode = e.firstChild();
@@ -1222,18 +1222,18 @@ void TextAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
QDomElement ee = eSubNode.toElement();
eSubNode = eSubNode.nextSibling();
- if ( ee.tagName() == "escapedText" )
+ if ( ee.tagName() == QLatin1String("escapedText") )
{
m_contents = ee.firstChild().toCDATASection().data();
}
- else if ( ee.tagName() == "callout" )
+ else if ( ee.tagName() == QLatin1String("callout") )
{
- m_inplaceCallout[0].x = ee.attribute( "ax" ).toDouble();
- m_inplaceCallout[0].y = ee.attribute( "ay" ).toDouble();
- m_inplaceCallout[1].x = ee.attribute( "bx" ).toDouble();
- m_inplaceCallout[1].y = ee.attribute( "by" ).toDouble();
- m_inplaceCallout[2].x = ee.attribute( "cx" ).toDouble();
- m_inplaceCallout[2].y = ee.attribute( "cy" ).toDouble();
+ m_inplaceCallout[0].x = ee.attribute( QStringLiteral("ax") ).toDouble();
+ m_inplaceCallout[0].y = ee.attribute( QStringLiteral("ay") ).toDouble();
+ m_inplaceCallout[1].x = ee.attribute( QStringLiteral("bx") ).toDouble();
+ m_inplaceCallout[1].y = ee.attribute( QStringLiteral("by") ).toDouble();
+ m_inplaceCallout[2].x = ee.attribute( QStringLiteral("cx") ).toDouble();
+ m_inplaceCallout[2].y = ee.attribute( QStringLiteral("cy") ).toDouble();
}
}
@@ -1423,26 +1423,26 @@ void LineAnnotation::store( QDomNode & node, QDomDocument & document ) const
Annotation::store( node, document );
// create [line] element
- QDomElement lineElement = document.createElement( "line" );
+ QDomElement lineElement = document.createElement( QStringLiteral("line") );
node.appendChild( lineElement );
// store the attributes
if ( d->m_lineStartStyle != None )
- lineElement.setAttribute( "startStyle", (int)d->m_lineStartStyle );
+ lineElement.setAttribute( QStringLiteral("startStyle"), (int)d->m_lineStartStyle );
if ( d->m_lineEndStyle != None )
- lineElement.setAttribute( "endStyle", (int)d->m_lineEndStyle );
+ lineElement.setAttribute( QStringLiteral("endStyle"), (int)d->m_lineEndStyle );
if ( d->m_lineClosed )
- lineElement.setAttribute( "closed", d->m_lineClosed );
+ lineElement.setAttribute( QStringLiteral("closed"), d->m_lineClosed );
if ( d->m_lineInnerColor.isValid() )
- lineElement.setAttribute( "innerColor", d->m_lineInnerColor.name() );
+ lineElement.setAttribute( QStringLiteral("innerColor"), d->m_lineInnerColor.name() );
if ( d->m_lineLeadingFwdPt != 0.0 )
- lineElement.setAttribute( "leadFwd", QString::number( d->m_lineLeadingFwdPt ) );
+ lineElement.setAttribute( QStringLiteral("leadFwd"), QString::number( d->m_lineLeadingFwdPt ) );
if ( d->m_lineLeadingBackPt != 0.0 )
- lineElement.setAttribute( "leadBack", QString::number( d->m_lineLeadingBackPt ) );
+ lineElement.setAttribute( QStringLiteral("leadBack"), QString::number( d->m_lineLeadingBackPt ) );
if ( d->m_lineShowCaption )
- lineElement.setAttribute( "showCaption", d->m_lineShowCaption );
+ lineElement.setAttribute( QStringLiteral("showCaption"), d->m_lineShowCaption );
if ( d->m_lineIntent != Unknown )
- lineElement.setAttribute( "intent", d->m_lineIntent );
+ lineElement.setAttribute( QStringLiteral("intent"), d->m_lineIntent );
// append the list of points
int points = d->m_linePoints.count();
@@ -1452,10 +1452,10 @@ void LineAnnotation::store( QDomNode & node, QDomDocument & document ) const
while ( it != end )
{
const NormalizedPoint & p = *it;
- QDomElement pElement = document.createElement( "point" );
+ QDomElement pElement = document.createElement( QStringLiteral("point") );
lineElement.appendChild( pElement );
- pElement.setAttribute( "x", QString::number( p.x ) );
- pElement.setAttribute( "y", QString::number( p.y ) );
+ pElement.setAttribute( QStringLiteral("x"), QString::number( p.x ) );
+ pElement.setAttribute( QStringLiteral("y"), QString::number( p.y ) );
it++; //to avoid loop
}
}
@@ -1509,26 +1509,26 @@ void LineAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
{
QDomElement e = subNode.toElement();
subNode = subNode.nextSibling();
- if ( e.tagName() != "line" )
+ if ( e.tagName() != QLatin1String("line") )
continue;
// parse the attributes
- if ( e.hasAttribute( "startStyle" ) )
- m_lineStartStyle = (LineAnnotation::TermStyle)e.attribute( "startStyle" ).toInt();
- if ( e.hasAttribute( "endStyle" ) )
- m_lineEndStyle = (LineAnnotation::TermStyle)e.attribute( "endStyle" ).toInt();
- if ( e.hasAttribute( "closed" ) )
- m_lineClosed = e.attribute( "closed" ).toInt();
- if ( e.hasAttribute( "innerColor" ) )
- m_lineInnerColor = QColor( e.attribute( "innerColor" ) );
- if ( e.hasAttribute( "leadFwd" ) )
- m_lineLeadingFwdPt = e.attribute( "leadFwd" ).toDouble();
- if ( e.hasAttribute( "leadBack" ) )
- m_lineLeadingBackPt = e.attribute( "leadBack" ).toDouble();
- if ( e.hasAttribute( "showCaption" ) )
- m_lineShowCaption = e.attribute( "showCaption" ).toInt();
- if ( e.hasAttribute( "intent" ) )
- m_lineIntent = (LineAnnotation::LineIntent)e.attribute( "intent" ).toInt();
+ if ( e.hasAttribute( QStringLiteral("startStyle") ) )
+ m_lineStartStyle = (LineAnnotation::TermStyle)e.attribute( QStringLiteral("startStyle") ).toInt();
+ if ( e.hasAttribute( QStringLiteral("endStyle") ) )
+ m_lineEndStyle = (LineAnnotation::TermStyle)e.attribute( QStringLiteral("endStyle") ).toInt();
+ if ( e.hasAttribute( QStringLiteral("closed") ) )
+ m_lineClosed = e.attribute( QStringLiteral("closed") ).toInt();
+ if ( e.hasAttribute( QStringLiteral("innerColor") ) )
+ m_lineInnerColor = QColor( e.attribute( QStringLiteral("innerColor") ) );
+ if ( e.hasAttribute( QStringLiteral("leadFwd") ) )
+ m_lineLeadingFwdPt = e.attribute( QStringLiteral("leadFwd") ).toDouble();
+ if ( e.hasAttribute( QStringLiteral("leadBack") ) )
+ m_lineLeadingBackPt = e.attribute( QStringLiteral("leadBack") ).toDouble();
+ if ( e.hasAttribute( QStringLiteral("showCaption") ) )
+ m_lineShowCaption = e.attribute( QStringLiteral("showCaption") ).toInt();
+ if ( e.hasAttribute( QStringLiteral("intent") ) )
+ m_lineIntent = (LineAnnotation::LineIntent)e.attribute( QStringLiteral("intent") ).toInt();
// parse all 'point' subnodes
QDomNode pointNode = e.firstChild();
@@ -1537,12 +1537,12 @@ void LineAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
QDomElement pe = pointNode.toElement();
pointNode = pointNode.nextSibling();
- if ( pe.tagName() != "point" )
+ if ( pe.tagName() != QLatin1String("point") )
continue;
NormalizedPoint p;
- p.x = pe.attribute( "x", "0.0" ).toDouble();
- p.y = pe.attribute( "y", "0.0" ).toDouble();
+ p.x = pe.attribute( QStringLiteral("x"), QStringLiteral("0.0") ).toDouble();
+ p.y = pe.attribute( QStringLiteral("y"), QStringLiteral("0.0") ).toDouble();
m_linePoints.append( p );
}
@@ -1646,14 +1646,14 @@ void GeomAnnotation::store( QDomNode & node, QDomDocument & document ) const
Annotation::store( node, document );
// create [geom] element
- QDomElement geomElement = document.createElement( "geom" );
+ QDomElement geomElement = document.createElement( QStringLiteral("geom") );
node.appendChild( geomElement );
// append the optional attributes
if ( d->m_geomType != InscribedSquare )
- geomElement.setAttribute( "type", (int)d->m_geomType );
+ geomElement.setAttribute( QStringLiteral("type"), (int)d->m_geomType );
if ( d->m_geomInnerColor.isValid() )
- geomElement.setAttribute( "color", d->m_geomInnerColor.name() );
+ geomElement.setAttribute( QStringLiteral("color"), d->m_geomInnerColor.name() );
}
void GeomAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
@@ -1665,17 +1665,17 @@ void GeomAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
{
QDomElement e = subNode.toElement();
subNode = subNode.nextSibling();
- if ( e.tagName() != "geom" )
+ if ( e.tagName() != QLatin1String("geom") )
continue;
// parse the attributes
- if ( e.hasAttribute( "type" ) )
- m_geomType = (GeomAnnotation::GeomType)e.attribute( "type" ).toInt();
- if ( e.hasAttribute( "color" ) )
- m_geomInnerColor = QColor( e.attribute( "color" ) );
+ if ( e.hasAttribute( QStringLiteral("type") ) )
+ m_geomType = (GeomAnnotation::GeomType)e.attribute( QStringLiteral("type") ).toInt();
+ if ( e.hasAttribute( QStringLiteral("color") ) )
+ m_geomInnerColor = QColor( e.attribute( QStringLiteral("color") ) );
// compatibility
- if ( e.hasAttribute( "width" ) )
- m_style.setWidth( e.attribute( "width" ).toInt() );
+ if ( e.hasAttribute( QStringLiteral("width") ) )
+ m_style.setWidth( e.attribute( QStringLiteral("width") ).toInt() );
// loading complete
break;
@@ -1916,34 +1916,34 @@ void HighlightAnnotation::store( QDomNode & node, QDomDocument & document ) cons
Annotation::store( node, document );
// create [hl] element
- QDomElement hlElement = document.createElement( "hl" );
+ QDomElement hlElement = document.createElement( QStringLiteral("hl") );
node.appendChild( hlElement );
// append the optional attributes
if ( d->m_highlightType != Highlight )
- hlElement.setAttribute( "type", (int)d->m_highlightType );
+ hlElement.setAttribute( QStringLiteral("type"), (int)d->m_highlightType );
if ( d->m_highlightQuads.count() < 1 )
return;
// append highlight quads, all children describe quads
QList< Quad >::const_iterator it = d->m_highlightQuads.begin(), end = d->m_highlightQuads.end();
for ( ; it != end; ++it )
{
- QDomElement quadElement = document.createElement( "quad" );
+ QDomElement quadElement = document.createElement( QStringLiteral("quad") );
hlElement.appendChild( quadElement );
const Quad & q = *it;
- quadElement.setAttribute( "ax", QString::number( q.point( 0 ).x ) );
- quadElement.setAttribute( "ay", QString::number( q.point( 0 ).y ) );
- quadElement.setAttribute( "bx", QString::number( q.point( 1 ).x ) );
- quadElement.setAttribute( "by", QString::number( q.point( 1 ).y ) );
- quadElement.setAttribute( "cx", QString::number( q.point( 2 ).x ) );
- quadElement.setAttribute( "cy", QString::number( q.point( 2 ).y ) );
- quadElement.setAttribute( "dx", QString::number( q.point( 3 ).x ) );
- quadElement.setAttribute( "dy", QString::number( q.point( 3 ).y ) );
+ quadElement.setAttribute( QStringLiteral("ax"), QString::number( q.point( 0 ).x ) );
+ quadElement.setAttribute( QStringLiteral("ay"), QString::number( q.point( 0 ).y ) );
+ quadElement.setAttribute( QStringLiteral("bx"), QString::number( q.point( 1 ).x ) );
+ quadElement.setAttribute( QStringLiteral("by"), QString::number( q.point( 1 ).y ) );
+ quadElement.setAttribute( QStringLiteral("cx"), QString::number( q.point( 2 ).x ) );
+ quadElement.setAttribute( QStringLiteral("cy"), QString::number( q.point( 2 ).y ) );
+ quadElement.setAttribute( QStringLiteral("dx"), QString::number( q.point( 3 ).x ) );
+ quadElement.setAttribute( QStringLiteral("dy"), QString::number( q.point( 3 ).y ) );
if ( q.capStart() )
- quadElement.setAttribute( "start", 1 );
+ quadElement.setAttribute( QStringLiteral("start"), 1 );
if ( q.capEnd() )
- quadElement.setAttribute( "end", 1 );
- quadElement.setAttribute( "feather", QString::number( q.feather() ) );
+ quadElement.setAttribute( QStringLiteral("end"), 1 );
+ quadElement.setAttribute( QStringLiteral("feather"), QString::number( q.feather() ) );
}
}
@@ -1981,29 +1981,29 @@ void HighlightAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
{
QDomElement e = subNode.toElement();
subNode = subNode.nextSibling();
- if ( e.tagName() != "hl" )
+ if ( e.tagName() != QLatin1String("hl") )
continue;
// parse the attributes
- if ( e.hasAttribute( "type" ) )
- m_highlightType = (HighlightAnnotation::HighlightType)e.attribute( "type" ).toInt();
+ if ( e.hasAttribute( QStringLiteral("type") ) )
+ m_highlightType = (HighlightAnnotation::HighlightType)e.attribute( QStringLiteral("type") ).toInt();
// parse all 'quad' subnodes
QDomNode quadNode = e.firstChild();
for ( ; quadNode.isElement(); quadNode = quadNode.nextSibling() )
{
QDomElement qe = quadNode.toElement();
- if ( qe.tagName() != "quad" )
+ if ( qe.tagName() != QLatin1String("quad") )
continue;
HighlightAnnotation::Quad q;
- q.setPoint( NormalizedPoint( qe.attribute( "ax", "0.0" ).toDouble(), qe.attribute( "ay", "0.0" ).toDouble() ), 0 );
- q.setPoint( NormalizedPoint( qe.attribute( "bx", "0.0" ).toDouble(), qe.attribute( "by", "0.0" ).toDouble() ), 1 );
- q.setPoint( NormalizedPoint( qe.attribute( "cx", "0.0" ).toDouble(), qe.attribute( "cy", "0.0" ).toDouble() ), 2 );
- q.setPoint( NormalizedPoint( qe.attribute( "dx", "0.0" ).toDouble(), qe.attribute( "dy", "0.0" ).toDouble() ), 3 );
- q.setCapStart( qe.hasAttribute( "start" ) );
- q.setCapEnd( qe.hasAttribute( "end" ) );
- q.setFeather( qe.attribute( "feather", "0.1" ).toDouble() );
+ q.setPoint( NormalizedPoint( qe.attribute( QStringLiteral("ax"), QStringLiteral("0.0") ).toDouble(), qe.attribute( QStringLiteral("ay"), QStringLiteral("0.0") ).toDouble() ), 0 );
+ q.setPoint( NormalizedPoint( qe.attribute( QStringLiteral("bx"), QStringLiteral("0.0") ).toDouble(), qe.attribute( QStringLiteral("by"), QStringLiteral("0.0") ).toDouble() ), 1 );
+ q.setPoint( NormalizedPoint( qe.attribute( QStringLiteral("cx"), QStringLiteral("0.0") ).toDouble(), qe.attribute( QStringLiteral("cy"), QStringLiteral("0.0") ).toDouble() ), 2 );
+ q.setPoint( NormalizedPoint( qe.attribute( QStringLiteral("dx"), QStringLiteral("0.0") ).toDouble(), qe.attribute( QStringLiteral("dy"), QStringLiteral("0.0") ).toDouble() ), 3 );
+ q.setCapStart( qe.hasAttribute( QStringLiteral("start") ) );
+ q.setCapEnd( qe.hasAttribute( QStringLiteral("end") ) );
+ q.setFeather( qe.attribute( QStringLiteral("feather"), QStringLiteral("0.1") ).toDouble() );
q.transform( QTransform() );
@@ -2057,7 +2057,7 @@ class Okular::StampAnnotationPrivate : public Okular::AnnotationPrivate
{
public:
StampAnnotationPrivate()
- : AnnotationPrivate(), m_stampIconName( "Draft" )
+ : AnnotationPrivate(), m_stampIconName( QStringLiteral("Draft") )
{
}
virtual void setAnnotationProperties( const QDomNode& node );
@@ -2104,12 +2104,12 @@ void StampAnnotation::store( QDomNode & node, QDomDocument & document ) const
Annotation::store( node, document );
// create [stamp] element
- QDomElement stampElement = document.createElement( "stamp" );
+ QDomElement stampElement = document.createElement( QStringLiteral("stamp") );
node.appendChild( stampElement );
// append the optional attributes
- if ( d->m_stampIconName != "Draft" )
- stampElement.setAttribute( "icon", d->m_stampIconName );
+ if ( d->m_stampIconName != QLatin1String("Draft") )
+ stampElement.setAttribute( QStringLiteral("icon"), d->m_stampIconName );
}
void StampAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
@@ -2122,12 +2122,12 @@ void StampAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
{
QDomElement e = subNode.toElement();
subNode = subNode.nextSibling();
- if ( e.tagName() != "stamp" )
+ if ( e.tagName() != QLatin1String("stamp") )
continue;
// parse the attributes
- if ( e.hasAttribute( "icon" ) )
- m_stampIconName = e.attribute( "icon" );
+ if ( e.hasAttribute( QStringLiteral("icon") ) )
+ m_stampIconName = e.attribute( QStringLiteral("icon") );
// loading complete
break;
@@ -2205,7 +2205,7 @@ void InkAnnotation::store( QDomNode & node, QDomDocument & document ) const
Annotation::store( node, document );
// create [ink] element
- QDomElement inkElement = document.createElement( "ink" );
+ QDomElement inkElement = document.createElement( QStringLiteral("ink") );
node.appendChild( inkElement );
// append the optional attributes
@@ -2215,17 +2215,17 @@ void InkAnnotation::store( QDomNode & node, QDomDocument & document ) const
QList< QLinkedList<NormalizedPoint> >::const_iterator pIt = d->m_inkPaths.begin(), pEnd = d->m_inkPaths.end();
for ( ; pIt != pEnd; ++pIt )
{
- QDomElement pathElement = document.createElement( "path" );
+ QDomElement pathElement = document.createElement( QStringLiteral("path") );
inkElement.appendChild( pathElement );
const QLinkedList<NormalizedPoint> & path = *pIt;
QLinkedList<NormalizedPoint>::const_iterator iIt = path.begin(), iEnd = path.end();
for ( ; iIt != iEnd; ++iIt )
{
const NormalizedPoint & point = *iIt;
- QDomElement pointElement = document.createElement( "point" );
+ QDomElement pointElement = document.createElement( QStringLiteral("point") );
pathElement.appendChild( pointElement );
- pointElement.setAttribute( "x", QString::number( point.x ) );
- pointElement.setAttribute( "y", QString::number( point.y ) );
+ pointElement.setAttribute( QStringLiteral("x"), QString::number( point.x ) );
+ pointElement.setAttribute( QStringLiteral("y"), QString::number( point.y ) );
}
}
}
@@ -2300,7 +2300,7 @@ void InkAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
{
QDomElement e = subNode.toElement();
subNode = subNode.nextSibling();
- if ( e.tagName() != "ink" )
+ if ( e.tagName() != QLatin1String("ink") )
continue;
// parse the 'path' subnodes
@@ -2310,7 +2310,7 @@ void InkAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
QDomElement pathElement = pathNode.toElement();
pathNode = pathNode.nextSibling();
- if ( pathElement.tagName() != "path" )
+ if ( pathElement.tagName() != QLatin1String("path") )
continue;
// build each path parsing 'point' subnodes
@@ -2321,12 +2321,12 @@ void InkAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
QDomElement pointElement = pointNode.toElement();
pointNode = pointNode.nextSibling();
- if ( pointElement.tagName() != "point" )
+ if ( pointElement.tagName() != QLatin1String("point") )
continue;
NormalizedPoint p;
- p.x = pointElement.attribute( "x", "0.0" ).toDouble();
- p.y = pointElement.attribute( "y", "0.0" ).toDouble();
+ p.x = pointElement.attribute( QStringLiteral("x"), QStringLiteral("0.0") ).toDouble();
+ p.y = pointElement.attribute( QStringLiteral("y"), QStringLiteral("0.0") ).toDouble();
path.append( p );
}
@@ -2368,9 +2368,9 @@ static QString caretSymbolToString( CaretAnnotation::CaretSymbol symbol )
switch ( symbol )
{
case CaretAnnotation::None:
- return QString::fromLatin1( "None" );
+ return QStringLiteral( "None" );
case CaretAnnotation::P:
- return QString::fromLatin1( "P" );
+ return QStringLiteral( "P" );
}
return QString();
}
@@ -2394,12 +2394,12 @@ void CaretAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
{
QDomElement e = subNode.toElement();
subNode = subNode.nextSibling();
- if ( e.tagName() != "caret" )
+ if ( e.tagName() != QLatin1String("caret") )
continue;
// parse the attributes
- if ( e.hasAttribute( "symbol" ) )
- m_symbol = caretSymbolFromString( e.attribute( "symbol" ) );
+ if ( e.hasAttribute( QStringLiteral("symbol") ) )
+ m_symbol = caretSymbolFromString( e.attribute( QStringLiteral("symbol") ) );
// loading complete
break;
@@ -2449,12 +2449,12 @@ void CaretAnnotation::store( QDomNode & node, QDomDocument & document ) const
Annotation::store( node, document );
// create [caret] element
- QDomElement caretElement = document.createElement( "caret" );
+ QDomElement caretElement = document.createElement( QStringLiteral("caret") );
node.appendChild( caretElement );
// append the optional attributes
if ( d->m_symbol != None )
- caretElement.setAttribute( "symbol", caretSymbolToString( d->m_symbol ) );
+ caretElement.setAttribute( QStringLiteral("symbol"), caretSymbolToString( d->m_symbol ) );
}
/** FileAttachmentAnnotation [Annotation] */
@@ -2463,7 +2463,7 @@ class Okular::FileAttachmentAnnotationPrivate : public Okular::AnnotationPrivate
{
public:
FileAttachmentAnnotationPrivate()
- : AnnotationPrivate(), icon( "PushPin" ), embfile( 0 )
+ : AnnotationPrivate(), icon( QStringLiteral("PushPin") ), embfile( 0 )
{
}
~FileAttachmentAnnotationPrivate()
@@ -2489,7 +2489,7 @@ void FileAttachmentAnnotationPrivate::setAnnotationProperties( const QDomNode& n
{
QDomElement e = subNode.toElement();
subNode = subNode.nextSibling();
- if ( e.tagName() != "fileattachment" )
+ if ( e.tagName() != QLatin1String("fileattachment") )
continue;
// loading complete
@@ -2522,7 +2522,7 @@ void FileAttachmentAnnotation::store( QDomNode & node, QDomDocument & document )
Annotation::store( node, document );
// create [fileattachment] element
- QDomElement fileAttachmentElement = document.createElement( "fileattachment" );
+ QDomElement fileAttachmentElement = document.createElement( QStringLiteral("fileattachment") );
node.appendChild( fileAttachmentElement );
}
@@ -2562,7 +2562,7 @@ class Okular::SoundAnnotationPrivate : public Okular::AnnotationPrivate
{
public:
SoundAnnotationPrivate()
- : AnnotationPrivate(), icon( "Speaker" ), sound( 0 )
+ : AnnotationPrivate(), icon( QStringLiteral("Speaker") ), sound( 0 )
{
}
~SoundAnnotationPrivate()
@@ -2588,7 +2588,7 @@ void SoundAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
{
QDomElement e = subNode.toElement();
subNode = subNode.nextSibling();
- if ( e.tagName() != "sound" )
+ if ( e.tagName() != QLatin1String("sound") )
continue;
// loading complete
@@ -2621,7 +2621,7 @@ void SoundAnnotation::store( QDomNode & node, QDomDocument & document ) const
Annotation::store( node, document );
// create [sound] element
- QDomElement soundElement = document.createElement( "sound" );
+ QDomElement soundElement = document.createElement( QStringLiteral("sound") );
node.appendChild( soundElement );
}
@@ -2685,7 +2685,7 @@ void MovieAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
{
QDomElement e = subNode.toElement();
subNode = subNode.nextSibling();
- if ( e.tagName() != "movie" )
+ if ( e.tagName() != QLatin1String("movie") )
continue;
// loading complete
@@ -2718,7 +2718,7 @@ void MovieAnnotation::store( QDomNode & node, QDomDocument & document ) const
Annotation::store( node, document );
// create [movie] element
- QDomElement movieElement = document.createElement( "movie" );
+ QDomElement movieElement = document.createElement( QStringLiteral("movie") );
node.appendChild( movieElement );
}
@@ -2775,7 +2775,7 @@ void ScreenAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
{
QDomElement e = subNode.toElement();
subNode = subNode.nextSibling();
- if ( e.tagName() != "screen" )
+ if ( e.tagName() != QLatin1String("screen") )
continue;
// loading complete
@@ -2808,7 +2808,7 @@ void ScreenAnnotation::store( QDomNode & node, QDomDocument & document ) const
Annotation::store( node, document );
// create [screen] element
- QDomElement movieElement = document.createElement( "screen" );
+ QDomElement movieElement = document.createElement( QStringLiteral("screen") );
node.appendChild( movieElement );
}
@@ -2876,7 +2876,7 @@ void WidgetAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
{
QDomElement e = subNode.toElement();
subNode = subNode.nextSibling();
- if ( e.tagName() != "widget" )
+ if ( e.tagName() != QLatin1String("widget") )
continue;
// loading complete
@@ -2909,7 +2909,7 @@ void WidgetAnnotation::store( QDomNode & node, QDomDocument & document ) const
Annotation::store( node, document );
// create [widget] element
- QDomElement movieElement = document.createElement( "widget" );
+ QDomElement movieElement = document.createElement( QStringLiteral("widget") );
node.appendChild( movieElement );
}
@@ -2972,7 +2972,7 @@ void RichMediaAnnotationPrivate::setAnnotationProperties( const QDomNode& node )
{
QDomElement e = subNode.toElement();
subNode = subNode.nextSibling();
- if ( e.tagName() != "richMedia" )
+ if ( e.tagName() != QLatin1String("richMedia") )
continue;
// loading complete
@@ -3005,7 +3005,7 @@ void RichMediaAnnotation::store( QDomNode & node, QDomDocument & document ) cons
Annotation::store( node, document );
// create [richMedia] element
- QDomElement movieElement = document.createElement( "richMedia" );
+ QDomElement movieElement = document.createElement( QStringLiteral("richMedia") );
node.appendChild( movieElement );
}
diff --git a/core/bookmarkmanager.cpp b/core/bookmarkmanager.cpp
index 1d8b71f..72cae55 100644
--- a/core/bookmarkmanager.cpp
+++ b/core/bookmarkmanager.cpp
@@ -136,13 +136,13 @@ static inline QUrl urlForGroup(const KBookmark &group)
BookmarkManager::BookmarkManager( DocumentPrivate * document )
: QObject( document->m_parent ), d( new Private( this ) )
{
- setObjectName( QLatin1String( "Okular::BookmarkManager" ) );
+ setObjectName( QStringLiteral( "Okular::BookmarkManager" ) );
d->document = document;
d->file = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + "okular/bookmarks.xml" ;
- d->manager = KBookmarkManager::managerForFile( d->file, "okular" );
+ d->manager = KBookmarkManager::managerForFile( d->file, QStringLiteral("okular") );
d->manager->setEditorOptions( QGuiApplication::applicationDisplayName(), false );
d->manager->setUpdate( true );
connect( d->manager, SIGNAL(changed(QString,QString)),
@@ -441,9 +441,9 @@ bool BookmarkManager::addBookmark(const QUrl &referurl, const Okular::DocumentVi
// if there's more than one bookmark per page, give the name '#p-n'
// where n is the index of this bookmark among the ones of its page.
if ( count > 0 )
- newtitle = QString( "#%1-%2" ).arg( vp.pageNumber + 1 ).arg( count );
+ newtitle = QStringLiteral( "#%1-%2" ).arg( vp.pageNumber + 1 ).arg( count );
else
- newtitle = QString( "#%1" ).arg( vp.pageNumber + 1 );
+ newtitle = QStringLiteral( "#%1" ).arg( vp.pageNumber + 1 );
}
else
newtitle = title;
@@ -658,7 +658,7 @@ bool BookmarkManager::setPageBookmark( int page )
vp.pageNumber = page;
QUrl newurl = d->url;
newurl.setFragment(vp.toString(), QUrl::DecodedMode);
- thebg.addBookmark( QString::fromLatin1( "#" ) + QString::number( vp.pageNumber + 1 ), newurl, QString() );
+ thebg.addBookmark( QLatin1String( "#" ) + QString::number( vp.pageNumber + 1 ), newurl, QString() );
added = true;
d->manager->emitChanged( thebg );
}
diff --git a/core/document.cpp b/core/document.cpp
index 49ce065..04a29fd 100644
--- a/core/document.cpp
+++ b/core/document.cpp
@@ -476,7 +476,7 @@ qulonglong DocumentPrivate::getTotalMemory()
#if defined(Q_OS_LINUX)
// if /proc/meminfo doesn't exist, return 128MB
- QFile memFile( "/proc/meminfo" );
+ QFile memFile( QStringLiteral("/proc/meminfo") );
if ( !memFile.open( QIODevice::ReadOnly ) )
return (cachedValue = 134217728);
@@ -485,7 +485,7 @@ qulonglong DocumentPrivate::getTotalMemory()
{
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_FREEBSD)
@@ -524,7 +524,7 @@ qulonglong DocumentPrivate::getFreeMemory( qulonglong *freeSwap )
#if defined(Q_OS_LINUX)
// if /proc/meminfo doesn't exist, return MEMORY FULL
- QFile memFile( "/proc/meminfo" );
+ QFile memFile( QStringLiteral("/proc/meminfo") );
if ( !memFile.open( QIODevice::ReadOnly ) )
return 0;
@@ -534,7 +534,7 @@ qulonglong DocumentPrivate::getFreeMemory( qulonglong *freeSwap )
QString entry;
QTextStream readStream( &memFile );
static const int nElems = 5;
- QString names[nElems] = { "MemFree:", "Buffers:", "Cached:", "SwapFree:", "SwapTotal:" };
+ QString names[nElems] = { QStringLiteral("MemFree:"), QStringLiteral("Buffers:"), QStringLiteral("Cached:"), QStringLiteral("SwapFree:"), QStringLiteral("SwapTotal:") };
qulonglong values[nElems] = { 0, 0, 0, 0, 0 };
bool foundValues[nElems] = { false, false, false, false, false };
while ( true )
@@ -628,7 +628,7 @@ void DocumentPrivate::loadDocumentInfo( QFile &infoFile )
return;
// Load DOM from XML file
- QDomDocument doc( "documentInfo" );
+ QDomDocument doc( QStringLiteral("documentInfo") );
if ( !doc.setContent( &infoFile ) )
{
qCDebug(OkularCoreDebug) << "Can't load XML pair! Check for broken xml.";
@@ -638,7 +638,7 @@ void DocumentPrivate::loadDocumentInfo( QFile &infoFile )
infoFile.close();
QDomElement root = doc.documentElement();
- if ( root.tagName() != "documentInfo" )
+ if ( root.tagName() != QLatin1String("documentInfo") )
return;
// Parse the DOM tree
@@ -648,17 +648,17 @@ void DocumentPrivate::loadDocumentInfo( QFile &infoFile )
QString catName = topLevelNode.toElement().tagName();
// Restore page attributes (bookmark, annotations, ...) from the DOM
- if ( catName == "pageList" )
+ if ( catName == QLatin1String("pageList") )
{
QDomNode pageNode = topLevelNode.firstChild();
while ( pageNode.isElement() )
{
QDomElement pageElement = pageNode.toElement();
- if ( pageElement.hasAttribute( "number" ) )
+ if ( pageElement.hasAttribute( QStringLiteral("number") ) )
{
// get page number (node's attribute)
bool ok;
- int pageNumber = pageElement.attribute( "number" ).toInt( &ok );
+ int pageNumber = pageElement.attribute( QStringLiteral("number") ).toInt( &ok );
// pass the domElement to the right page, to read config data from
if ( ok && pageNumber >= 0 && pageNumber < (int)m_pagesVector.count() )
@@ -669,7 +669,7 @@ void DocumentPrivate::loadDocumentInfo( QFile &infoFile )
}
// Restore 'general info' from the DOM
- else if ( catName == "generalInfo" )
+ else if ( catName == QLatin1String("generalInfo") )
{
QDomNode infoNode = topLevelNode.firstChild();
while ( infoNode.isElement() )
@@ -677,7 +677,7 @@ void DocumentPrivate::loadDocumentInfo( QFile &infoFile )
QDomElement infoElement = infoNode.toElement();
// restore viewports history
- if ( infoElement.tagName() == "history" )
+ if ( infoElement.tagName() == QLatin1String("history") )
{
// clear history
m_viewportHistory.clear();
@@ -686,9 +686,9 @@ void DocumentPrivate::loadDocumentInfo( QFile &infoFile )
while ( historyNode.isElement() )
{
QDomElement historyElement = historyNode.toElement();
- if ( historyElement.hasAttribute( "viewport" ) )
+ if ( historyElement.hasAttribute( QStringLiteral("viewport") ) )
{
- QString vpString = historyElement.attribute( "viewport" );
+ QString vpString = historyElement.attribute( QStringLiteral("viewport") );
m_viewportIterator = m_viewportHistory.insert( m_viewportHistory.end(),
DocumentViewport( vpString ) );
}
@@ -698,7 +698,7 @@ void DocumentPrivate::loadDocumentInfo( QFile &infoFile )
if ( m_viewportHistory.isEmpty() )
m_viewportIterator = m_viewportHistory.insert( m_viewportHistory.end(), DocumentViewport() );
}
- else if ( infoElement.tagName() == "rotation" )
+ else if ( infoElement.tagName() == QLatin1String("rotation") )
{
QString str = infoElement.text();
bool ok = true;
@@ -708,15 +708,15 @@ void DocumentPrivate::loadDocumentInfo( QFile &infoFile )
setRotationInternal( newrotation, false );
}
}
- else if ( infoElement.tagName() == "views" )
+ else if ( infoElement.tagName() == QLatin1String("views") )
{
QDomNode viewNode = infoNode.firstChild();
while ( viewNode.isElement() )
{
QDomElement viewElement = viewNode.toElement();
- if ( viewElement.tagName() == "view" )
+ if ( viewElement.tagName() == QLatin1String("view") )
{
- const QString viewName = viewElement.attribute( "name" );
+ const QString viewName = viewElement.attribute( QStringLiteral("name") );
Q_FOREACH ( View * view, m_views )
{
if ( view->name() == viewName )
@@ -744,9 +744,9 @@ void DocumentPrivate::loadViewsInfo( View *view, const QDomElement &e )
{
QDomElement viewElement = viewNode.toElement();
- if ( viewElement.tagName() == "zoom" )
+ if ( viewElement.tagName() == QLatin1String("zoom") )
{
- const QString valueString = viewElement.attribute( "value" );
+ const QString valueString = viewElement.attribute( QStringLiteral("value") );
bool newzoom_ok = true;
const double newzoom = !valueString.isEmpty() ? valueString.toDouble( &newzoom_ok ) : 1.0;
if ( newzoom_ok && newzoom != 0
@@ -755,7 +755,7 @@ void DocumentPrivate::loadViewsInfo( View *view, const QDomElement &e )
{
view->setCapability( View::Zoom, newzoom );
}
- const QString modeString = viewElement.attribute( "mode" );
+ const QString modeString = viewElement.attribute( QStringLiteral("mode") );
bool newmode_ok = true;
const int newmode = !modeString.isEmpty() ? modeString.toInt( &newmode_ok ) : 2;
if ( newmode_ok
@@ -777,18 +777,18 @@ void DocumentPrivate::saveViewsInfo( View *view, QDomElement &e ) const
&& view->supportsCapability( View::ZoomModality )
&& ( view->capabilityFlags( View::ZoomModality ) & ( View::CapabilityRead | View::CapabilitySerializable ) ) )
{
- QDomElement zoomEl = e.ownerDocument().createElement( "zoom" );
+ QDomElement zoomEl = e.ownerDocument().createElement( QStringLiteral("zoom") );
e.appendChild( zoomEl );
bool ok = true;
const double zoom = view->capability( View::Zoom ).toDouble( &ok );
if ( ok && zoom != 0 )
{
- zoomEl.setAttribute( "value", QString::number(zoom) );
+ zoomEl.setAttribute( QStringLiteral("value"), QString::number(zoom) );
}
const int mode = view->capability( View::ZoomModality ).toInt( &ok );
if ( ok )
{
- zoomEl.setAttribute( "mode", mode );
+ zoomEl.setAttribute( QStringLiteral("mode"), mode );
}
}
}
@@ -843,8 +843,8 @@ void DocumentPrivate::loadAllGeneratorLibraries()
m_generatorsLoaded = true;
- QString constraint("([X-KDE-Priority] > 0) and (exist Library)") ;
- KService::List offers = KServiceTypeTrader::self()->query( "okular/Generator", constraint );
+ QString constraint(QStringLiteral("([X-KDE-Priority] > 0) and (exist Library)")) ;
+ KService::List offers = KServiceTypeTrader::self()->query( QStringLiteral("okular/Generator"), constraint );
loadServiceList( offers );
}
@@ -932,9 +932,9 @@ Document::OpenResult DocumentPrivate::openDocumentInternal( const KService::Ptr&
m_generator->d_func()->m_document = this;
// connect error reporting signals
- QObject::connect( m_generator, SIGNAL(error(QString,int)), m_parent, SIGNAL(error(QString,int)) );
- QObject::connect( m_generator, SIGNAL(warning(QString,int)), m_parent, SIGNAL(warning(QString,int)) );
- QObject::connect( m_generator, SIGNAL(notice(QString,int)), m_parent, SIGNAL(notice(QString,int)) );
+ QObject::connect( m_generator, &Generator::error, m_parent, &Document::error );
+ QObject::connect( m_generator, &Generator::warning, m_parent, &Document::warning );
+ QObject::connect( m_generator, &Generator::notice, m_parent, &Document::notice );
QApplication::setOverrideCursor( Qt::WaitCursor );
@@ -1002,15 +1002,15 @@ bool DocumentPrivate::savePageDocumentInfo( QTemporaryFile *infoFile, int what )
if ( infoFile->open() )
{
// 1. Create DOM
- QDomDocument doc( "documentInfo" );
+ QDomDocument doc( QStringLiteral("documentInfo") );
QDomProcessingInstruction xmlPi = doc.createProcessingInstruction(
- QString::fromLatin1( "xml" ), QString::fromLatin1( "version=\"1.0\" encoding=\"utf-8\"" ) );
+ QStringLiteral( "xml" ), QStringLiteral( "version=\"1.0\" encoding=\"utf-8\"" ) );
doc.appendChild( xmlPi );
- QDomElement root = doc.createElement( "documentInfo" );
+ QDomElement root = doc.createElement( QStringLiteral("documentInfo") );
doc.appendChild( root );
// 2.1. Save page attributes (bookmark state, annotations, ... ) to DOM
- QDomElement pageList = doc.createElement( "pageList" );
+ QDomElement pageList = doc.createElement( QStringLiteral("pageList") );
root.appendChild( pageList );
// <page list><page number='x'>.... </page> save pages that hold data
QVector< Page * >::const_iterator pIt = m_pagesVector.constBegin(), pEnd = m_pagesVector.constEnd();
@@ -1032,7 +1032,7 @@ DocumentViewport DocumentPrivate::nextDocumentViewport() const
DocumentViewport ret = m_nextDocumentViewport;
if ( !m_nextDocumentDestination.isEmpty() && m_generator )
{
- DocumentViewport vp( m_parent->metaData( "NamedViewport", m_nextDocumentDestination ).toString() );
+ DocumentViewport vp( m_parent->metaData( QStringLiteral("NamedViewport"), m_nextDocumentDestination ).toString() );
if ( vp.isValid() )
{
ret = vp;
@@ -1051,12 +1051,12 @@ void DocumentPrivate::warnLimitedAnnotSupport()
{
// Shown if the user is editing annotations in a file whose metadata is
// not stored locally (.okular archives belong to this category)
- KMessageBox::information( m_widget, i18n("Your annotation changes will not be saved automatically. Use File -> Save As...\nor your changes will be lost once the document is closed"), QString(), "annotNeedSaveAs" );
+ KMessageBox::information( m_widget, i18n("Your annotation changes will not be saved automatically. Use File -> Save As...\nor your changes will be lost once the document is closed"), QString(), QStringLiteral("annotNeedSaveAs") );
}
else if ( !canAddAnnotationsNatively() )
{
// If the generator doesn't support native annotations
- KMessageBox::information( m_widget, i18n("Your annotations are saved internally by Okular.\nYou can export the annotated document using File -> Export As -> Document Archive"), QString(), "annotExportAsArchive" );
+ KMessageBox::information( m_widget, i18n("Your annotations are saved internally by Okular.\nYou can export the annotated document using File -> Export As -> Document Archive"), QString(), QStringLiteral("annotExportAsArchive") );
}
}
@@ -1220,16 +1220,16 @@ void DocumentPrivate::saveDocumentInfo() const
if (infoFile.open( QIODevice::WriteOnly | QIODevice::Truncate) )
{
// 1. Create DOM
- QDomDocument doc( "documentInfo" );
+ QDomDocument doc( QStringLiteral("documentInfo") );
QDomProcessingInstruction xmlPi = doc.createProcessingInstruction(
- QString::fromLatin1( "xml" ), QString::fromLatin1( "version=\"1.0\" encoding=\"utf-8\"" ) );
+ QStringLiteral( "xml" ), QStringLiteral( "version=\"1.0\" encoding=\"utf-8\"" ) );
doc.appendChild( xmlPi );
- QDomElement root = doc.createElement( "documentInfo" );
- root.setAttribute( "url", m_url.toDisplayString(QUrl::PreferLocalFile) );
+ QDomElement root = doc.createElement( QStringLiteral("documentInfo") );
+ root.setAttribute( QStringLiteral("url"), m_url.toDisplayString(QUrl::PreferLocalFile) );
doc.appendChild( root );
// 2.1. Save page attributes (bookmark state, annotations, ... ) to DOM
- QDomElement pageList = doc.createElement( "pageList" );
+ QDomElement pageList = doc.createElement( QStringLiteral("pageList") );
root.appendChild( pageList );
PageItems saveWhat = AllPageItems;
if ( m_annotationsNeedSaveAs )
@@ -1246,12 +1246,12 @@ void DocumentPrivate::saveDocumentInfo() const
(*pIt)->d->saveLocalContents( pageList, doc, saveWhat );
// 2.2. Save document info (current viewport, history, ... ) to DOM
- QDomElement generalInfo = doc.createElement( "generalInfo" );
+ QDomElement generalInfo = doc.createElement( QStringLiteral("generalInfo") );
root.appendChild( generalInfo );
// create rotation node
if ( m_rotation != Rotation0 )
{
- QDomElement rotationNode = doc.createElement( "rotation" );
+ QDomElement rotationNode = doc.createElement( QStringLiteral("rotation") );
generalInfo.appendChild( rotationNode );
rotationNode.appendChild( doc.createTextNode( QString::number( (int)m_rotation ) ) );
}
@@ -1265,7 +1265,7 @@ void DocumentPrivate::saveDocumentInfo() const
--backIterator;
// create history root node
- QDomElement historyNode = doc.createElement( "history" );
+ QDomElement historyNode = doc.createElement( QStringLiteral("history") );
generalInfo.appendChild( historyNode );
// add old[backIterator] and present[viewportIterator] items
@@ -1275,18 +1275,18 @@ void DocumentPrivate::saveDocumentInfo() const
{
QString name = (backIterator == m_viewportIterator) ? "current" : "oldPage";
QDomElement historyEntry = doc.createElement( name );
- historyEntry.setAttribute( "viewport", (*backIterator).toString() );
+ historyEntry.setAttribute( QStringLiteral("viewport"), (*backIterator).toString() );
historyNode.appendChild( historyEntry );
++backIterator;
}
}
// create views root node
- QDomElement viewsNode = doc.createElement( "views" );
+ QDomElement viewsNode = doc.createElement( QStringLiteral("views") );
generalInfo.appendChild( viewsNode );
Q_FOREACH ( View * view, m_views )
{
- QDomElement viewEntry = doc.createElement( "view" );
- viewEntry.setAttribute( "name", view->name() );
+ QDomElement viewEntry = doc.createElement( QStringLiteral("view") );
+ viewEntry.setAttribute( QStringLiteral("name"), view->name() );
viewsNode.appendChild( viewEntry );
saveViewsInfo( view, viewEntry );
}
@@ -2074,7 +2074,7 @@ void DocumentPrivate::loadSyncFile( const QString & filePath )
const QString coreName = ts.readLine();
// second row: version string, in the form 'Version %u'
QString versionstr = ts.readLine();
- QRegExp versionre( "Version (\\d+)" );
+ QRegExp versionre( QStringLiteral("Version (\\d+)") );
versionre.setCaseSensitivity( Qt::CaseInsensitive );
if ( !versionre.exactMatch( versionstr ) )
return;
@@ -2229,7 +2229,7 @@ public:
return true;
else if (s2->mimeTypes().contains( mimeName ) && !s1->mimeTypes().contains( mimeName ))
return false;
- return s1->property( "X-KDE-Priority" ).toInt() > s2->property( "X-KDE-Priority" ).toInt();
+ return s1->property( QStringLiteral("X-KDE-Priority") ).toInt() > s2->property( QStringLiteral("X-KDE-Priority") ).toInt();
}
private:
@@ -2301,8 +2301,8 @@ Document::OpenResult Document::openDocument(const QString & docFile, const QUrl
// 0. load Generator
// request only valid non-disabled plugins suitable for the mimetype
- QString constraint("([X-KDE-Priority] > 0) and (exist Library)") ;
- KService::List offers = KMimeTypeTrader::self()->query(mime.name(),"okular/Generator",constraint);
+ QString constraint(QStringLiteral("([X-KDE-Priority] > 0) and (exist Library)")) ;
+ KService::List offers = KMimeTypeTrader::self()->query(mime.name(),QStringLiteral("okular/Generator"),constraint);
if ( offers.isEmpty() && !triedMimeFromFileContent )
{
QMimeType newmime = db.mimeTypeForFile(docFile, QMimeDatabase::MatchExtension);
@@ -2310,7 +2310,7 @@ Document::OpenResult Document::openDocument(const QString & docFile, const QUrl
if ( newmime.name() != mime.name() )
{
mime = newmime;
- offers = KMimeTypeTrader::self()->query( mime.name(), "okular/Generator", constraint );
+ offers = KMimeTypeTrader::self()->query( mime.name(), QStringLiteral("okular/Generator"), constraint );
}
if ( offers.isEmpty() )
{
@@ -2323,7 +2323,7 @@ Document::OpenResult Document::openDocument(const QString & docFile, const QUrl
if ( newmime.name() != mime.name() )
{
mime = newmime;
- offers = KMimeTypeTrader::self()->query( mime.name(), "okular/Generator", constraint );
+ offers = KMimeTypeTrader::self()->query( mime.name(), QStringLiteral("okular/Generator"), constraint );
}
}
}
@@ -2368,7 +2368,7 @@ Document::OpenResult Document::openDocument(const QString & docFile, const QUrl
if ( newmime.name() != mime.name() )
{
mime = newmime;
- offers = KMimeTypeTrader::self()->query( mime.name(), "okular/Generator", constraint );
+ offers = KMimeTypeTrader::self()->query( mime.name(), QStringLiteral("okular/Generator"), constraint );
if ( !offers.isEmpty() )
{
offer = offers.first();
@@ -2463,7 +2463,7 @@ Document::OpenResult Document::openDocument(const QString & docFile, const QUrl
AudioPlayer::instance()->d->m_currentDocument = isstdin ? QUrl() : d->m_url;
d->m_docSize = document_size;
- const QStringList docScripts = d->m_generator->metaData( "DocumentScripts", "JavaScript" ).toStringList();
+ const QStringList docScripts = d->m_generator->metaData( QStringLiteral("DocumentScripts"), "JavaScript" ).toStringList();
if ( !docScripts.isEmpty() )
{
d->m_scripter = new Scripter( d );
@@ -2804,7 +2804,7 @@ void Document::startFontReading()
d->m_fontThread = new FontExtractionThread( d->m_generator, pages() );
connect( d->m_fontThread, SIGNAL(gotFont(Okular::FontInfo)), this, SLOT(fontReadingGotFont(Okular::FontInfo)) );
- connect( d->m_fontThread, SIGNAL(progress(int)), this, SLOT(fontReadingProgress(int)) );
+ connect( d->m_fontThread.data(), &FontExtractionThread::progress, this, &Document::fontReadingProgress );
d->m_fontThread->startExtraction( /*d->m_generator->hasFeature( Generator::Threaded )*/true );
}
@@ -2879,7 +2879,7 @@ bool Document::isAllowed( Permission action ) const
return false;
#if !OKULAR_FORCE_DRM
- if ( KAuthorized::authorize( "skip_drm" ) && !SettingsCore::obeyDRM() )
+ if ( KAuthorized::authorize( QStringLiteral("skip_drm") ) && !SettingsCore::obeyDRM() )
return true;
#endif
@@ -2961,8 +2961,8 @@ QVariant Document::metaData( const QString & key, const QVariant & option ) cons
{
// if option starts with "src:" assume that we are handling a
// source reference
- if ( key == "NamedViewport"
- && option.toString().startsWith( "src:", Qt::CaseInsensitive )
+ if ( key == QLatin1String("NamedViewport")
+ && option.toString().startsWith( QLatin1String("src:"), Qt::CaseInsensitive )
&& d->m_synctex_scanner)
{
const QString reference = option.toString();
@@ -3794,7 +3794,7 @@ QString Document::bookmarkedPageRange() const
range += ',';
if ( endId - startId > 0 )
- range += QString( "%1-%2" ).arg( startId + 1 ).arg( endId + 1 );
+ range += QStringLiteral( "%1-%2" ).arg( startId + 1 ).arg( endId + 1 );
else
range += QString::number( startId + 1 );
startId = -1;
@@ -3807,7 +3807,7 @@ QString Document::bookmarkedPageRange() const
range += ',';
if ( endId - startId > 0 )
- range += QString( "%1-%2" ).arg( startId + 1 ).arg( endId + 1 );
+ range += QStringLiteral( "%1-%2" ).arg( startId + 1 ).arg( endId + 1 );
else
range += QString::number( startId + 1 );
}
@@ -3857,7 +3857,7 @@ void Document::processAction( const Action * action )
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;
@@ -3895,7 +3895,7 @@ void Document::processAction( const Action * action )
}
}
- KService::Ptr ptr = KMimeTypeTrader::self()->preferredService( mime.name(), "Application" );
+ KService::Ptr ptr = KMimeTypeTrader::self()->preferredService( mime.name(), QStringLiteral("Application") );
if ( ptr )
{
QList<QUrl> lst;
@@ -3956,7 +3956,7 @@ void Document::processAction( const Action * action )
QString lilySource;
int lilyRow = 0, lilyCol = 0;
// if the url is a mailto one, invoke mailer
- if ( browse->url().scheme().compare("mailto") )
+ if ( browse->url().scheme().compare(QLatin1String("mailto")) )
QDesktopServices::openUrl( browse->url() );
else if ( extractLilyPondSourceReference( browse->url(), &lilySource, &lilyRow, &lilyCol ) )
{
@@ -4193,8 +4193,8 @@ void Document::fillConfigDialog( KConfigDialog * dialog )
return;
// ensure that we have all the generators with settings loaded
- QString constraint( "([X-KDE-Priority] > 0) and (exist Library) and ([X-KDE-okularHasInternalSettings])" );
- KService::List offers = KServiceTypeTrader::self()->query( "okular/Generator", constraint );
+ QString constraint( QStringLiteral("([X-KDE-Priority] > 0) and (exist Library) and ([X-KDE-okularHasInternalSettings])") );
+ KService::List offers = KServiceTypeTrader::self()->query( QStringLiteral("okular/Generator"), constraint );
d->loadServiceList( offers );
bool pagesAdded = false;
@@ -4218,8 +4218,8 @@ void Document::fillConfigDialog( KConfigDialog * dialog )
int Document::configurableGenerators() const
{
- QString constraint( "([X-KDE-Priority] > 0) and (exist Library) and ([X-KDE-okularHasInternalSettings])" );
- KService::List offers = KServiceTypeTrader::self()->query( "okular/Generator", constraint );
+ QString constraint( QStringLiteral("([X-KDE-Priority] > 0) and (exist Library) and ([X-KDE-okularHasInternalSettings])") );
+ KService::List offers = KServiceTypeTrader::self()->query( QStringLiteral("okular/Generator"), constraint );
return offers.count();
}
@@ -4228,7 +4228,7 @@ QStringList Document::supportedMimeTypes() const
if ( !d->m_supportedMimeTypes.isEmpty() )
return d->m_supportedMimeTypes;
- QString constraint( "(Library == 'okularpart')" );
+ QString constraint( QStringLiteral("(Library == 'okularpart')") );
QLatin1String basePartService( "KParts/ReadOnlyPart" );
KService::List offers = KServiceTypeTrader::self()->query( basePartService, constraint );
KService::List::ConstIterator it = offers.constBegin(), itEnd = offers.constEnd();
@@ -4361,7 +4361,7 @@ Document::OpenResult Document::openDocumentArchive( const QString & docFile, con
{
QMimeDatabase db;
const QMimeType mime = db.mimeTypeForFile( docFile, QMimeDatabase::MatchExtension );
- if ( !mime.inherits( "application/vnd.kde.okular-archive" ) )
+ if ( !mime.inherits( QStringLiteral("application/vnd.kde.okular-archive") ) )
return OpenError;
KZip okularArchive( docFile );
@@ -4369,7 +4369,7 @@ Document::OpenResult Document::openDocumentArchive( const QString & docFile, con
return OpenError;
const KArchiveDirectory * mainDir = okularArchive.directory();
- const KArchiveEntry * mainEntry = mainDir->entry( "content.xml" );
+ const KArchiveEntry * mainEntry = mainDir->entry( QStringLiteral("content.xml") );
if ( !mainEntry || !mainEntry->isFile() )
return OpenError;
@@ -4380,7 +4380,7 @@ Document::OpenResult Document::openDocumentArchive( const QString & docFile, con
mainEntryDevice.reset();
QDomElement root = doc.documentElement();
- if ( root.tagName() != "OkularArchive" )
+ if ( root.tagName() != QLatin1String("OkularArchive") )
return OpenError;
QString documentFileName;
@@ -4388,14 +4388,14 @@ Document::OpenResult Document::openDocumentArchive( const QString & docFile, con
QDomElement el = root.firstChild().toElement();
for ( ; !el.isNull(); el = el.nextSibling().toElement() )
{
- if ( el.tagName() == "Files" )
+ if ( el.tagName() == QLatin1String("Files") )
{
QDomElement fileEl = el.firstChild().toElement();
for ( ; !fileEl.isNull(); fileEl = fileEl.nextSibling().toElement() )
{
- if ( fileEl.tagName() == "DocumentFileName" )
+ if ( fileEl.tagName() == QLatin1String("DocumentFileName") )
documentFileName = fileEl.text();
- else if ( fileEl.tagName() == "MetadataFileName" )
+ else if ( fileEl.tagName() == QLatin1String("MetadataFileName") )
metadataFileName = fileEl.text();
}
}
@@ -4477,23 +4477,23 @@ bool Document::saveDocumentArchive( const QString &fileName )
const KUserGroup userGroup( QString( "" ) );
#endif
- QDomDocument contentDoc( "OkularArchive" );
+ QDomDocument contentDoc( QStringLiteral("OkularArchive") );
QDomProcessingInstruction xmlPi = contentDoc.createProcessingInstruction(
- QString::fromLatin1( "xml" ), QString::fromLatin1( "version=\"1.0\" encoding=\"utf-8\"" ) );
+ QStringLiteral( "xml" ), QStringLiteral( "version=\"1.0\" encoding=\"utf-8\"" ) );
contentDoc.appendChild( xmlPi );
- QDomElement root = contentDoc.createElement( "OkularArchive" );
+ QDomElement root = contentDoc.createElement( QStringLiteral("OkularArchive") );
contentDoc.appendChild( root );
- QDomElement filesNode = contentDoc.createElement( "Files" );
+ QDomElement filesNode = contentDoc.createElement( QStringLiteral("Files") );
root.appendChild( filesNode );
- QDomElement fileNameNode = contentDoc.createElement( "DocumentFileName" );
+ QDomElement fileNameNode = contentDoc.createElement( QStringLiteral("DocumentFileName") );
filesNode.appendChild( fileNameNode );
fileNameNode.appendChild( contentDoc.createTextNode( docFileName ) );
- QDomElement metadataFileNameNode = contentDoc.createElement( "MetadataFileName" );
+ QDomElement metadataFileNameNode = contentDoc.createElement( QStringLiteral("MetadataFileName") );
filesNode.appendChild( metadataFileNameNode );
- metadataFileNameNode.appendChild( contentDoc.createTextNode( "metadata.xml" ) );
+ metadataFileNameNode.appendChild( contentDoc.createTextNode( QStringLiteral("metadata.xml") ) );
// If the generator can save annotations natively, do it
QTemporaryFile modifiedFile;
@@ -4524,11 +4524,11 @@ bool Document::saveDocumentArchive( const QString &fileName )
return false;
const QByteArray contentDocXml = contentDoc.toByteArray();
- okularArchive.writeFile( "content.xml", user.loginName(), userGroup.name(),
+ okularArchive.writeFile( QStringLiteral("content.xml"), user.loginName(), userGroup.name(),
contentDocXml.constData(), contentDocXml.length() );
okularArchive.addLocalFile( docPath, docFileName );
- okularArchive.addLocalFile( metadataFile.fileName(), "metadata.xml" );
+ okularArchive.addLocalFile( metadataFile.fileName(), QStringLiteral("metadata.xml") );
if ( !okularArchive.close() )
return false;
@@ -4817,14 +4817,14 @@ DocumentViewport::DocumentViewport( const QString & xmlDesc )
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();
@@ -4832,11 +4832,11 @@ DocumentViewport::DocumentViewport( const QString & xmlDesc )
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";
- autoFit.height = token.section( ':', 2, 2 ) == "T";
+ autoFit.width = token.section( ':', 1, 1 ) == QLatin1String("T");
+ autoFit.height = token.section( ':', 2, 2 ) == QLatin1String("T");
}
// proceed tokenizing string
field++;
@@ -4850,12 +4850,12 @@ QString DocumentViewport::toString() const
QString s = QString::number( pageNumber );
// if has center coordinates, save them on string
if ( rePos.enabled )
- s += QString( ";C2:" ) + QString::number( rePos.normalizedX ) +
+ s += QStringLiteral( ";C2:" ) + QString::number( rePos.normalizedX ) +
':' + QString::number( rePos.normalizedY ) +
':' + QString::number( rePos.pos );
// if has autofit enabled, save its state on string
if ( autoFit.enabled )
- s += QString( ";AF1:" ) + (autoFit.width ? "T" : "F") +
+ s += QStringLiteral( ";AF1:" ) + (autoFit.width ? "T" : "F") +
':' + (autoFit.height ? "T" : "F");
return s;
}
@@ -4956,52 +4956,52 @@ QString DocumentInfo::getKeyString( Key key ) //const
{
switch ( key ) {
case Title:
- return "title";
+ return QStringLiteral("title");
break;
case Subject:
- return "subject";
+ return QStringLiteral("subject");
break;
case Description:
- return "description";
+ return QStringLiteral("description");
break;
case Author:
- return "author";
+ return QStringLiteral("author");
break;
case Creator:
- return "creator";
+ return QStringLiteral("creator");
break;
case Producer:
- return "producer";
+ return QStringLiteral("producer");
break;
case Copyright:
- return "copyright";
+ return QStringLiteral("copyright");
break;
case Pages:
- return "pages";
+ return QStringLiteral("pages");
break;
case CreationDate:
- return "creationDate";
+ return QStringLiteral("creationDate");
break;
case ModificationDate:
- return "modificationDate";
+ return QStringLiteral("modificationDate");
break;
case MimeType:
- return "mimeType";
+ return QStringLiteral("mimeType");
break;
case Category:
- return "category";
+ return QStringLiteral("category");
break;
case Keywords:
- return "keywords";
+ return QStringLiteral("keywords");
break;
case FilePath:
- return "filePath";
+ return QStringLiteral("filePath");
break;
case DocumentSize:
- return "documentSize";
+ return QStringLiteral("documentSize");
break;
case PagesSize:
- return "pageSize";
+ return QStringLiteral("pageSize");
break;
default:
qCWarning(OkularCoreDebug) << "Unknown" << key;
@@ -5012,22 +5012,22 @@ QString DocumentInfo::getKeyString( Key key ) //const
DocumentInfo::Key DocumentInfo::getKeyFromString( const QString &key ) //const
{
- if (key == "title") return Title;
- else if (key == "subject") return Subject;
- else if (key == "description") return Description;
- else if (key == "author") return Author;
- else if (key == "creator") return Creator;
- else if (key == "producer") return Producer;
- else if (key == "copyright") return Copyright;
- else if (key == "pages") return Pages;
- else if (key == "creationDate") return CreationDate;
- else if (key == "modificationDate") return ModificationDate;
- else if (key == "mimeType") return MimeType;
- else if (key == "category") return Category;
- else if (key == "keywords") return Keywords;
- else if (key == "filePath") return FilePath;
- else if (key == "documentSize") return DocumentSize;
- else if (key == "pageSize") return PagesSize;
+ if (key == QLatin1String("title")) return Title;
+ else if (key == QLatin1String("subject")) return Subject;
+ else if (key == QLatin1String("description")) return Description;
+ else if (key == QLatin1String("author")) return Author;
+ else if (key == QLatin1String("creator")) return Creator;
+ else if (key == QLatin1String("producer")) return Producer;
+ else if (key == QLatin1String("copyright")) return Copyright;
+ else if (key == QLatin1String("pages")) return Pages;
+ else if (key == QLatin1String("creationDate")) return CreationDate;
+ else if (key == QLatin1String("modificationDate")) return ModificationDate;
+ else if (key == QLatin1String("mimeType")) return MimeType;
+ else if (key == QLatin1String("category")) return Category;
+ else if (key == QLatin1String("keywords")) return Keywords;
+ else if (key == QLatin1String("filePath")) return FilePath;
+ else if (key == QLatin1String("documentSize")) return DocumentSize;
+ else if (key == QLatin1String("pageSize")) return PagesSize;
else return Invalid;
}
@@ -5101,7 +5101,7 @@ QString DocumentInfo::getKeyTitle( const QString &key ) const
/** DocumentSynopsis **/
DocumentSynopsis::DocumentSynopsis()
- : QDomDocument( "DocumentSynopsis" )
+ : QDomDocument( QStringLiteral("DocumentSynopsis") )
{
// void implementation, only subclassed for naming
}
diff --git a/core/documentcommands.cpp b/core/documentcommands.cpp
index afc32bf..aafc45a 100644
--- a/core/documentcommands.cpp
+++ b/core/documentcommands.cpp
@@ -234,21 +234,21 @@ EditTextCommand::EditTextCommand( const QString & newContents,
}
else if ( newContentsRightOfCursor() == oldContentsRightOfCursor() &&
newContentsLeftOfCursor() == oldContentsLeftOfCursor().left(oldContentsLeftOfCursor().length() - 1) &&
- oldContentsLeftOfCursor().right(1) != "\n" )
+ oldContentsLeftOfCursor().right(1) != QLatin1String("\n") )
{
qCDebug(OkularCoreDebug) << "CharBackspace";
m_editType = CharBackspace;
}
else if ( newContentsLeftOfCursor() == oldContentsLeftOfCursor() &&
newContentsRightOfCursor() == oldContentsRightOfCursor().right(oldContentsRightOfCursor().length() - 1) &&
- oldContentsRightOfCursor().left(1) != "\n" )
+ oldContentsRightOfCursor().left(1) != QLatin1String("\n") )
{
qCDebug(OkularCoreDebug) << "CharDelete";
m_editType = CharDelete;
}
else if ( newContentsRightOfCursor() == oldContentsRightOfCursor() &&
newContentsLeftOfCursor().left( newContentsLeftOfCursor().length() - 1) == oldContentsLeftOfCursor() &&
- newContentsLeftOfCursor().right(1) != "\n" )
+ newContentsLeftOfCursor().right(1) != QLatin1String("\n") )
{
qCDebug(OkularCoreDebug) << "CharInsert";
m_editType = CharInsert;
diff --git a/core/fileprinter.cpp b/core/fileprinter.cpp
index f2371bb..2c8b199 100644
--- a/core/fileprinter.cpp
+++ b/core/fileprinter.cpp
@@ -91,8 +91,8 @@ int FilePrinter::doPrintFiles( QPrinter &printer, QStringList fileList, FileDele
ret = -5;
}
}
- } else if ( inputFileInfo.suffix() == "ps" && printer.outputFormat() == QPrinter::PdfFormat && ps2pdfAvailable() ) {
- exe = "ps2pdf";
+ } else if ( inputFileInfo.suffix() == QLatin1String("ps") && printer.outputFormat() == QPrinter::PdfFormat && ps2pdfAvailable() ) {
+ exe = QStringLiteral("ps2pdf");
argList << fileList[0] << printer.outputFileName();
qCDebug(OkularCoreDebug) << "Executing" << exe << "with arguments" << argList;
ret = KProcess::execute( exe, argList );
@@ -118,14 +118,14 @@ int FilePrinter::doPrintFiles( QPrinter &printer, QStringList fileList, FileDele
//Some distros name the CUPS version of lpr as lpr-cups or lpr.cups so try those first
//before default to lpr, or failing that to lp
- if ( !QStandardPaths::findExecutable("lpr-cups").isEmpty() ) {
- exe = "lpr-cups";
- } else if ( !QStandardPaths::findExecutable("lpr.cups").isEmpty() ) {
- exe = "lpr.cups";
- } else if ( !QStandardPaths::findExecutable("lpr").isEmpty() ) {
- exe = "lpr";
- } else if ( !QStandardPaths::findExecutable("lp").isEmpty() ) {
- exe = "lp";
+ if ( !QStandardPaths::findExecutable(QStringLiteral("lpr-cups")).isEmpty() ) {
+ exe = QStringLiteral("lpr-cups");
+ } else if ( !QStandardPaths::findExecutable(QStringLiteral("lpr.cups")).isEmpty() ) {
+ exe = QStringLiteral("lpr.cups");
+ } else if ( !QStandardPaths::findExecutable(QStringLiteral("lpr")).isEmpty() ) {
+ exe = QStringLiteral("lpr");
+ } else if ( !QStandardPaths::findExecutable(QStringLiteral("lp")).isEmpty() ) {
+ exe = QStringLiteral("lp");
} else {
return -9;
}
@@ -182,10 +182,10 @@ QString FilePrinter::pageRange( QPrinter &printer, int lastPage, const QList<int
}
if ( printer.printRange() == QPrinter::PageRange ) {
- return QString("%1-%2").arg(printer.fromPage()).arg(printer.toPage());
+ return QStringLiteral("%1-%2").arg(printer.fromPage()).arg(printer.toPage());
}
- return QString("1-%2").arg( lastPage );
+ return QStringLiteral("1-%2").arg( lastPage );
}
QString FilePrinter::pageListToPageRange( const QList<int> &pageList )
@@ -209,7 +209,7 @@ QString FilePrinter::pageListToPageRange( const QList<int> &pageList )
if ( seqStart == seqEnd ) {
pageRange.append(pageList[i]);
} else {
- pageRange.append(QString("%1-%2").arg(seqStart).arg(seqEnd));
+ pageRange.append(QStringLiteral("%1-%2").arg(seqStart).arg(seqEnd));
}
seqStart = i + 1;
@@ -223,12 +223,12 @@ QString FilePrinter::pageListToPageRange( const QList<int> &pageList )
bool FilePrinter::ps2pdfAvailable()
{
- return ( !QStandardPaths::findExecutable("ps2pdf").isEmpty() );
+ return ( !QStandardPaths::findExecutable(QStringLiteral("ps2pdf")).isEmpty() );
}
bool FilePrinter::pdf2psAvailable()
{
- return ( !QStandardPaths::findExecutable("pdf2ps").isEmpty() );
+ return ( !QStandardPaths::findExecutable(QStringLiteral("pdf2ps")).isEmpty() );
}
bool FilePrinter::cupsAvailable()
@@ -250,7 +250,7 @@ bool FilePrinter::cupsAvailable()
bool FilePrinter::detectCupsService()
{
QTcpSocket qsock;
- qsock.connectToHost("localhost", 631);
+ qsock.connectToHost(QStringLiteral("localhost"), 631);
bool rtn = qsock.waitForConnected() && qsock.isValid();
qsock.abort();
return rtn;
@@ -258,11 +258,11 @@ bool FilePrinter::detectCupsService()
bool FilePrinter::detectCupsConfig()
{
- if ( QFile::exists("/etc/cups/cupsd.conf") ) return true;
- if ( QFile::exists("/usr/etc/cups/cupsd.conf") ) return true;
- if ( QFile::exists("/usr/local/etc/cups/cupsd.conf") ) return true;
- if ( QFile::exists("/opt/etc/cups/cupsd.conf") ) return true;
- if ( QFile::exists("/opt/local/etc/cups/cupsd.conf") ) return true;
+ if ( QFile::exists(QStringLiteral("/etc/cups/cupsd.conf")) ) return true;
+ if ( QFile::exists(QStringLiteral("/usr/etc/cups/cupsd.conf")) ) return true;
+ if ( QFile::exists(QStringLiteral("/usr/local/etc/cups/cupsd.conf")) ) return true;
+ if ( QFile::exists(QStringLiteral("/opt/etc/cups/cupsd.conf")) ) return true;
+ if ( QFile::exists(QStringLiteral("/opt/local/etc/cups/cupsd.conf")) ) return true;
return false;
}
@@ -384,8 +384,8 @@ QStringList FilePrinter::printArguments( QPrinter &printer, FileDeletePolicy fil
argList << deleteFile( printer, fileDeletePolicy, version );
}
- if ( version == "lp" ) {
- argList << "--";
+ if ( version == QLatin1String("lp") ) {
+ argList << QStringLiteral("--");
}
return argList;
@@ -393,12 +393,12 @@ QStringList FilePrinter::printArguments( QPrinter &printer, FileDeletePolicy fil
QStringList FilePrinter::destination( QPrinter &printer, const QString &version )
{
- if ( version == "lp" ) {
- return QStringList("-d") << printer.printerName();
+ if ( version == QLatin1String("lp") ) {
+ return QStringList(QStringLiteral("-d")) << printer.printerName();
}
- if ( version.startsWith( "lpr" ) ) {
- return QStringList("-P") << printer.printerName();
+ if ( version.startsWith( QLatin1String("lpr") ) ) {
+ return QStringList(QStringLiteral("-P")) << printer.printerName();
}
return QStringList();
@@ -408,12 +408,12 @@ QStringList FilePrinter::copies( QPrinter &printer, const QString &version )
{
int cp = printer.actualNumCopies();
- if ( version == "lp" ) {
- return QStringList("-n") << QString("%1").arg( cp );
+ if ( version == QLatin1String("lp") ) {
+ return QStringList(QStringLiteral("-n")) << QStringLiteral("%1").arg( cp );
}
- if ( version.startsWith( "lpr" ) ) {
- return QStringList() << QString("-#%1").arg( cp );
+ if ( version.startsWith( QLatin1String("lpr") ) ) {
+ return QStringList() << QStringLiteral("-#%1").arg( cp );
}
return QStringList();
@@ -423,13 +423,13 @@ QStringList FilePrinter::jobname( QPrinter &printer, const QString &version )
{
if ( ! printer.docName().isEmpty() ) {
- if ( version == "lp" ) {
- return QStringList("-t") << printer.docName();
+ if ( version == QLatin1String("lp") ) {
+ return QStringList(QStringLiteral("-t")) << printer.docName();
}
- if ( version.startsWith( "lpr" ) ) {
+ if ( version.startsWith( QLatin1String("lpr") ) ) {
const QString shortenedDocName = QString::fromUtf8(printer.docName().toUtf8().left(255));
- return QStringList("-J") << shortenedDocName;
+ return QStringList(QStringLiteral("-J")) << shortenedDocName;
}
}
@@ -438,8 +438,8 @@ QStringList FilePrinter::jobname( QPrinter &printer, const QString &version )
QStringList FilePrinter::deleteFile( QPrinter &, FileDeletePolicy fileDeletePolicy, const QString &version )
{
- if ( fileDeletePolicy == FilePrinter::SystemDeletesFiles && version.startsWith( "lpr" ) ) {
- return QStringList("-r");
+ if ( fileDeletePolicy == FilePrinter::SystemDeletesFiles && version.startsWith( QLatin1String("lpr") ) ) {
+ return QStringList(QStringLiteral("-r"));
}
return QStringList();
@@ -452,25 +452,25 @@ QStringList FilePrinter::pages( QPrinter &printer, PageSelectPolicy pageSelectPo
if ( printer.printRange() == QPrinter::Selection && ! pageRange.isEmpty() ) {
- if ( version == "lp" ) {
- return QStringList("-P") << pageRange ;
+ if ( version == QLatin1String("lp") ) {
+ return QStringList(QStringLiteral("-P")) << pageRange ;
}
- if ( version.startsWith( "lpr" ) && useCupsOptions ) {
- return QStringList("-o") << QString("page-ranges=%1").arg( pageRange );
+ if ( version.startsWith( QLatin1String("lpr") ) && useCupsOptions ) {
+ return QStringList(QStringLiteral("-o")) << QStringLiteral("page-ranges=%1").arg( pageRange );
}
}
if ( printer.printRange() == QPrinter::PageRange ) {
- if ( version == "lp" ) {
- return QStringList("-P") << QString("%1-%2").arg( printer.fromPage() )
+ if ( version == QLatin1String("lp") ) {
+ return QStringList(QStringLiteral("-P")) << QStringLiteral("%1-%2").arg( printer.fromPage() )
.arg( printer.toPage() );
}
- if ( version.startsWith( "lpr" ) && useCupsOptions ) {
- return QStringList("-o") << QString("page-ranges=%1-%2").arg( printer.fromPage() )
+ if ( version.startsWith( QLatin1String("lpr") ) && useCupsOptions ) {
+ return QStringList(QStringLiteral("-o")) << QStringLiteral("page-ranges=%1-%2").arg( printer.fromPage() )
.arg( printer.toPage() );
}
@@ -518,19 +518,19 @@ QStringList FilePrinter::optionMedia( QPrinter &printer )
{
if ( ! mediaPageSize( printer ).isEmpty() &&
! mediaPaperSource( printer ).isEmpty() ) {
- return QStringList("-o") <<
- QString("media=%1,%2").arg( mediaPageSize( printer ) )
+ return QStringList(QStringLiteral("-o")) <<
+ QStringLiteral("media=%1,%2").arg( mediaPageSize( printer ) )
.arg( mediaPaperSource( printer ) );
}
if ( ! mediaPageSize( printer ).isEmpty() ) {
- return QStringList("-o") <<
- QString("media=%1").arg( mediaPageSize( printer ) );
+ return QStringList(QStringLiteral("-o")) <<
+ QStringLiteral("media=%1").arg( mediaPageSize( printer ) );
}
if ( ! mediaPaperSource( printer ).isEmpty() ) {
- return QStringList("-o") <<
- QString("media=%1").arg( mediaPaperSource( printer ) );
+ return QStringList(QStringLiteral("-o")) <<
+ QStringLiteral("media=%1").arg( mediaPaperSource( printer ) );
}
return QStringList();
@@ -539,37 +539,37 @@ QStringList FilePrinter::optionMedia( QPrinter &printer )
QString FilePrinter::mediaPageSize( QPrinter &printer )
{
switch ( printer.pageSize() ) {
- case QPrinter::A0: return "A0";
- case QPrinter::A1: return "A1";
- case QPrinter::A2: return "A2";
- case QPrinter::A3: return "A3";
- case QPrinter::A4: return "A4";
- case QPrinter::A5: return "A5";
- case QPrinter::A6: return "A6";
- case QPrinter::A7: return "A7";
- case QPrinter::A8: return "A8";
- case QPrinter::A9: return "A9";
- case QPrinter::B0: return "B0";
- case QPrinter::B1: return "B1";
- case QPrinter::B10: return "B10";
- case QPrinter::B2: return "B2";
- case QPrinter::B3: return "B3";
- case QPrinter::B4: return "B4";
- case QPrinter::B5: return "B5";
- case QPrinter::B6: return "B6";
- case QPrinter::B7: return "B7";
- case QPrinter::B8: return "B8";
- case QPrinter::B9: return "B9";
- case QPrinter::C5E: return "C5"; //Correct Translation?
- case QPrinter::Comm10E: return "Comm10"; //Correct Translation?
- case QPrinter::DLE: return "DL"; //Correct Translation?
- case QPrinter::Executive: return "Executive";
- case QPrinter::Folio: return "Folio";
- case QPrinter::Ledger: return "Ledger";
- case QPrinter::Legal: return "Legal";
- case QPrinter::Letter: return "Letter";
- case QPrinter::Tabloid: return "Tabloid";
- case QPrinter::Custom: return QString("Custom.%1x%2mm")
+ case QPrinter::A0: return QStringLiteral("A0");
+ case QPrinter::A1: return QStringLiteral("A1");
+ case QPrinter::A2: return QStringLiteral("A2");
+ case QPrinter::A3: return QStringLiteral("A3");
+ case QPrinter::A4: return QStringLiteral("A4");
+ case QPrinter::A5: return QStringLiteral("A5");
+ case QPrinter::A6: return QStringLiteral("A6");
+ case QPrinter::A7: return QStringLiteral("A7");
+ case QPrinter::A8: return QStringLiteral("A8");
+ case QPrinter::A9: return QStringLiteral("A9");
+ case QPrinter::B0: return QStringLiteral("B0");
+ case QPrinter::B1: return QStringLiteral("B1");
+ case QPrinter::B10: return QStringLiteral("B10");
+ case QPrinter::B2: return QStringLiteral("B2");
+ case QPrinter::B3: return QStringLiteral("B3");
+ case QPrinter::B4: return QStringLiteral("B4");
+ case QPrinter::B5: return QStringLiteral("B5");
+ case QPrinter::B6: return QStringLiteral("B6");
+ case QPrinter::B7: return QStringLiteral("B7");
+ case QPrinter::B8: return QStringLiteral("B8");
+ case QPrinter::B9: return QStringLiteral("B9");
+ case QPrinter::C5E: return QStringLiteral("C5"); //Correct Translation?
+ case QPrinter::Comm10E: return QStringLiteral("Comm10"); //Correct Translation?
+ case QPrinter::DLE: return QStringLiteral("DL"); //Correct Translation?
+ case QPrinter::Executive: return QStringLiteral("Executive");
+ case QPrinter::Folio: return QStringLiteral("Folio");
+ case QPrinter::Ledger: return QStringLiteral("Ledger");
+ case QPrinter::Legal: return QStringLiteral("Legal");
+ case QPrinter::Letter: return QStringLiteral("Letter");
+ case QPrinter::Tabloid: return QStringLiteral("Tabloid");
+ case QPrinter::Custom: return QStringLiteral("Custom.%1x%2mm")
.arg( printer.heightMM() )
.arg( printer.widthMM() );
default: return QString();
@@ -581,19 +581,19 @@ QString FilePrinter::mediaPaperSource( QPrinter &printer )
{
switch ( printer.paperSource() ) {
case QPrinter::Auto: return QString();
- case QPrinter::Cassette: return "Cassette";
- case QPrinter::Envelope: return "Envelope";
- case QPrinter::EnvelopeManual: return "EnvelopeManual";
- case QPrinter::FormSource: return "FormSource";
- case QPrinter::LargeCapacity: return "LargeCapacity";
- case QPrinter::LargeFormat: return "LargeFormat";
- case QPrinter::Lower: return "Lower";
- case QPrinter::MaxPageSource: return "MaxPageSource";
- case QPrinter::Middle: return "Middle";
- case QPrinter::Manual: return "Manual";
- case QPrinter::OnlyOne: return "OnlyOne";
- case QPrinter::Tractor: return "Tractor";
- case QPrinter::SmallFormat: return "SmallFormat";
+ case QPrinter::Cassette: return QStringLiteral("Cassette");
+ case QPrinter::Envelope: return QStringLiteral("Envelope");
+ case QPrinter::EnvelopeManual: return QStringLiteral("EnvelopeManual");
+ case QPrinter::FormSource: return QStringLiteral("FormSource");
+ case QPrinter::LargeCapacity: return QStringLiteral("LargeCapacity");
+ case QPrinter::LargeFormat: return QStringLiteral("LargeFormat");
+ case QPrinter::Lower: return QStringLiteral("Lower");
+ case QPrinter::MaxPageSource: return QStringLiteral("MaxPageSource");
+ case QPrinter::Middle: return QStringLiteral("Middle");
+ case QPrinter::Manual: return QStringLiteral("Manual");
+ case QPrinter::OnlyOne: return QStringLiteral("OnlyOne");
+ case QPrinter::Tractor: return QStringLiteral("Tractor");
+ case QPrinter::SmallFormat: return QStringLiteral("SmallFormat");
default: return QString();
}
}
@@ -605,24 +605,24 @@ QStringList FilePrinter::optionOrientation( QPrinter &printer, QPrinter::Orienta
// portrait option so that the document is not rotated additionally
if ( printer.orientation() == documentOrientation ) {
// the user wants the document printed as is
- return QStringList("-o") << "portrait";
+ return QStringList(QStringLiteral("-o")) << QStringLiteral("portrait");
} else {
// the user expects the document being rotated by 90 degrees
- return QStringList("-o") << "landscape";
+ return QStringList(QStringLiteral("-o")) << QStringLiteral("landscape");
}
}
QStringList FilePrinter::optionDoubleSidedPrinting( QPrinter &printer )
{
switch ( printer.duplex() ) {
- case QPrinter::DuplexNone: return QStringList("-o") << "sides=one-sided";
+ case QPrinter::DuplexNone: return QStringList(QStringLiteral("-o")) << QStringLiteral("sides=one-sided");
case QPrinter::DuplexAuto: if ( printer.orientation() == QPrinter::Landscape ) {
- return QStringList("-o") << "sides=two-sided-short-edge";
+ return QStringList(QStringLiteral("-o")) << QStringLiteral("sides=two-sided-short-edge");
} else {
- return QStringList("-o") << "sides=two-sided-long-edge";
+ return QStringList(QStringLiteral("-o")) << QStringLiteral("sides=two-sided-long-edge");
}
- case QPrinter::DuplexLongSide: return QStringList("-o") << "sides=two-sided-long-edge";
- case QPrinter::DuplexShortSide: return QStringList("-o") << "sides=two-sided-short-edge";
+ case QPrinter::DuplexLongSide: return QStringList(QStringLiteral("-o")) << QStringLiteral("sides=two-sided-long-edge");
+ case QPrinter::DuplexShortSide: return QStringList(QStringLiteral("-o")) << QStringLiteral("sides=two-sided-short-edge");
default: return QStringList(); //Use printer default
}
}
@@ -630,17 +630,17 @@ QStringList FilePrinter::optionDoubleSidedPrinting( QPrinter &printer )
QStringList FilePrinter::optionPageOrder( QPrinter &printer )
{
if ( printer.pageOrder() == QPrinter::LastPageFirst ) {
- return QStringList("-o") << "outputorder=reverse";
+ return QStringList(QStringLiteral("-o")) << QStringLiteral("outputorder=reverse");
}
- return QStringList("-o") << "outputorder=normal";
+ return QStringList(QStringLiteral("-o")) << QStringLiteral("outputorder=normal");
}
QStringList FilePrinter::optionCollateCopies( QPrinter &printer )
{
if ( printer.collateCopies() ) {
- return QStringList("-o") << "Collate=True";
+ return QStringList(QStringLiteral("-o")) << QStringLiteral("Collate=True");
}
- return QStringList("-o") << "Collate=False";
+ return QStringList(QStringLiteral("-o")) << QStringLiteral("Collate=False");
}
QStringList FilePrinter::optionPageMargins( QPrinter &printer )
@@ -650,10 +650,10 @@ QStringList FilePrinter::optionPageMargins( QPrinter &printer )
} else {
qreal l, t, r, b;
printer.getPageMargins( &l, &t, &r, &b, QPrinter::Point );
- return QStringList("-o") << QString("page-left=%1").arg(l)
- << "-o" << QString("page-top=%1").arg(t)
- << "-o" << QString("page-right=%1").arg(r)
- << "-o" << QString("page-bottom=%1").arg(b) << "-o" << "fit-to-page";
+ return QStringList(QStringLiteral("-o")) << QStringLiteral("page-left=%1").arg(l)
+ << QStringLiteral("-o") << QStringLiteral("page-top=%1").arg(t)
+ << QStringLiteral("-o") << QStringLiteral("page-right=%1").arg(r)
+ << QStringLiteral("-o") << QStringLiteral("page-bottom=%1").arg(b) << QStringLiteral("-o") << QStringLiteral("fit-to-page");
}
}
@@ -664,9 +664,9 @@ QStringList FilePrinter::optionCupsProperties( QPrinter &printer )
for ( int i = 0; i < dialogOptions.count(); i = i + 2 ) {
if ( dialogOptions[i+1].isEmpty() ) {
- cupsOptions << "-o" << dialogOptions[i];
+ cupsOptions << QStringLiteral("-o") << dialogOptions[i];
} else {
- cupsOptions << "-o" << dialogOptions[i] + '=' + dialogOptions[i+1];
+ cupsOptions << QStringLiteral("-o") << dialogOptions[i] + '=' + dialogOptions[i+1];
}
}
diff --git a/core/form.cpp b/core/form.cpp
index ca8a132..4985504 100644
--- a/core/form.cpp
+++ b/core/form.cpp
@@ -211,7 +211,7 @@ class Okular::FormFieldChoicePrivate : public Okular::FormFieldPrivate
{
list.append( QString::number( c ) );
}
- return list.join( QLatin1String( ";" ) );
+ return list.join( QStringLiteral( ";" ) );
}
};
diff --git a/core/generator.cpp b/core/generator.cpp
index ea3da1c..7f630a1 100644
--- a/core/generator.cpp
+++ b/core/generator.cpp
@@ -362,7 +362,7 @@ void Generator::walletDataForFile( const QString &fileName, QString *walletName,
{
*walletKey = fileName.section('/', -1, -1);
*walletName = KWallet::Wallet::NetworkWallet();
- *walletFolder = "KPdf";
+ *walletFolder = QStringLiteral("KPdf");
}
bool Generator::hasFeature( GeneratorFeature feature ) const
@@ -626,19 +626,19 @@ ExportFormat ExportFormat::standardFormat( StandardExportFormat type )
switch ( type )
{
case PlainText:
- return ExportFormat( QIcon::fromTheme( "text-x-generic" ), i18n( "Plain &Text..." ), db.mimeTypeForName( "text/plain" ) );
+ return ExportFormat( QIcon::fromTheme( QStringLiteral("text-x-generic") ), i18n( "Plain &Text..." ), db.mimeTypeForName( QStringLiteral("text/plain") ) );
break;
case PDF:
- return ExportFormat( QIcon::fromTheme( "application-pdf" ), i18n( "PDF" ), db.mimeTypeForName( "application/pdf" ) );
+ return ExportFormat( QIcon::fromTheme( QStringLiteral("application-pdf") ), i18n( "PDF" ), db.mimeTypeForName( QStringLiteral("application/pdf") ) );
break;
case OpenDocumentText:
return ExportFormat(
- QIcon::fromTheme( "application-vnd.oasis.opendocument.text" ),
+ QIcon::fromTheme( QStringLiteral("application-vnd.oasis.opendocument.text") ),
i18nc( "This is the document format", "OpenDocument Text" ),
- db.mimeTypeForName( "application/vnd.oasis.opendocument.text" ) );
+ db.mimeTypeForName( QStringLiteral("application/vnd.oasis.opendocument.text") ) );
break;
case HTML:
- return ExportFormat( QIcon::fromTheme( "text-html" ), i18nc( "This is the document format", "HTML" ), db.mimeTypeForName( "text/html" ) );
+ return ExportFormat( QIcon::fromTheme( QStringLiteral("text-html") ), i18nc( "This is the document format", "HTML" ), db.mimeTypeForName( QStringLiteral("text/html") ) );
break;
}
return ExportFormat();
@@ -656,7 +656,7 @@ bool ExportFormat::operator!=( const ExportFormat &other ) const
QDebug operator<<( QDebug str, const Okular::PixmapRequest &req )
{
- QString s = QString( "PixmapRequest(#%2, %1, %3x%4, page %6, prio %5)" )
+ QString s = QStringLiteral( "PixmapRequest(#%2, %1, %3x%4, page %6, prio %5)" )
.arg( QString( req.asynchronous() ? "async" : "sync" ) )
.arg( (qulonglong)req.observer() )
.arg( req.width() )
diff --git a/core/movie.cpp b/core/movie.cpp
index 081dd54..b8c5c92 100644
--- a/core/movie.cpp
+++ b/core/movie.cpp
@@ -64,7 +64,7 @@ Movie::Movie( const QString& fileName, const QByteArray &data )
* GStreamer backend). Storing the data in a temporary file works fine
* though, not to mention, it releases much needed memory. (gamaral)
*/
- d->m_tmp = new QTemporaryFile( QString( "%1/okrXXXXXX" ).arg( QDir::tempPath() ) );
+ d->m_tmp = new QTemporaryFile( QStringLiteral( "%1/okrXXXXXX" ).arg( QDir::tempPath() ) );
if ( d->m_tmp->open() ) {
d->m_tmp->write( data );
d->m_tmp->flush();
diff --git a/core/page.cpp b/core/page.cpp
index f43a6c0..6ce247e 100644
--- a/core/page.cpp
+++ b/core/page.cpp
@@ -795,7 +795,7 @@ void PagePrivate::restoreLocalContents( const QDomNode & pageNode )
childNode = childNode.nextSibling();
// parse annotationList child element
- if ( childElement.tagName() == "annotationList" )
+ if ( childElement.tagName() == QLatin1String("annotationList") )
{
#ifdef PAGE_PROFILE
QTime time;
@@ -830,7 +830,7 @@ void PagePrivate::restoreLocalContents( const QDomNode & pageNode )
#endif
}
// parse formList child element
- else if ( childElement.tagName() == "forms" )
+ else if ( childElement.tagName() == QLatin1String("forms") )
{
if ( formfields.isEmpty() )
continue;
@@ -850,11 +850,11 @@ void PagePrivate::restoreLocalContents( const QDomNode & pageNode )
QDomElement formElement = formsNode.toElement();
formsNode = formsNode.nextSibling();
- if ( formElement.tagName() != "form" )
+ if ( formElement.tagName() != QLatin1String("form") )
continue;
bool ok = true;
- int index = formElement.attribute( "id" ).toInt( &ok );
+ int index = formElement.attribute( QStringLiteral("id") ).toInt( &ok );
if ( !ok )
continue;
@@ -862,7 +862,7 @@ void PagePrivate::restoreLocalContents( const QDomNode & pageNode )
if ( wantedIt == hashedforms.constEnd() )
continue;
- QString value = formElement.attribute( "value" );
+ QString value = formElement.attribute( QStringLiteral("value") );
(*wantedIt)->d_ptr->setValue( value );
}
}
@@ -872,8 +872,8 @@ void PagePrivate::restoreLocalContents( const QDomNode & pageNode )
void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & document, PageItems what ) const
{
// create the page node and set the 'number' attribute
- QDomElement pageElement = document.createElement( "page" );
- pageElement.setAttribute( "number", m_number );
+ QDomElement pageElement = document.createElement( QStringLiteral("page") );
+ pageElement.setAttribute( QStringLiteral("number"), m_number );
#if 0
// add bookmark info if is bookmarked
@@ -902,7 +902,7 @@ void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & docum
else if ( ( what & AnnotationPageItems ) && !m_page->m_annotations.isEmpty() )
{
// create the annotationList
- QDomElement annotListElement = document.createElement( "annotationList" );
+ QDomElement annotListElement = document.createElement( QStringLiteral("annotationList") );
// add every annotation to the annotationList
QLinkedList< Annotation * >::const_iterator aIt = m_page->m_annotations.constBegin(), aEnd = m_page->m_annotations.constEnd();
@@ -914,7 +914,7 @@ void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & docum
if ( !(a->flags() & Annotation::External) )
{
// append an filled-up element called 'annotation' to the list
- QDomElement annElement = document.createElement( "annotation" );
+ QDomElement annElement = document.createElement( QStringLiteral("annotation") );
AnnotationUtils::storeAnnotation( a, annElement, document );
annotListElement.appendChild( annElement );
qCDebug(OkularCoreDebug) << "save annotation:" << a->uniqueName();
@@ -930,7 +930,7 @@ void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & docum
if ( ( what & FormFieldPageItems ) && !formfields.isEmpty() )
{
// create the formList
- QDomElement formListElement = document.createElement( "forms" );
+ QDomElement formListElement = document.createElement( QStringLiteral("forms") );
// add every form data to the formList
QLinkedList< FormField * >::const_iterator fIt = formfields.constBegin(), fItEnd = formfields.constEnd();
@@ -944,9 +944,9 @@ void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & docum
continue;
// append an filled-up element called 'annotation' to the list
- QDomElement formElement = document.createElement( "form" );
- formElement.setAttribute( "id", f->id() );
- formElement.setAttribute( "value", newvalue );
+ QDomElement formElement = document.createElement( QStringLiteral("form") );
+ formElement.setAttribute( QStringLiteral("id"), f->id() );
+ formElement.setAttribute( QStringLiteral("value"), newvalue );
formListElement.appendChild( formElement );
}
diff --git a/core/script/executor_kjs.cpp b/core/script/executor_kjs.cpp
index 756888c..b67fec5 100644
--- a/core/script/executor_kjs.cpp
+++ b/core/script/executor_kjs.cpp
@@ -69,11 +69,11 @@ void ExecutorKJSPrivate::initTypes()
JSSpell::initType( ctx );
JSUtil::initType( ctx );
- m_docObject.setProperty( ctx, "app", JSApp::object( ctx, m_doc ) );
- m_docObject.setProperty( ctx, "console", JSConsole::object( ctx ) );
- m_docObject.setProperty( ctx, "Doc", m_docObject );
- m_docObject.setProperty( ctx, "spell", JSSpell::object( ctx ) );
- m_docObject.setProperty( ctx, "util", JSUtil::object( ctx ) );
+ m_docObject.setProperty( ctx, QStringLiteral("app"), JSApp::object( ctx, m_doc ) );
+ m_docObject.setProperty( ctx, QStringLiteral("console"), JSConsole::object( ctx ) );
+ m_docObject.setProperty( ctx, QStringLiteral("Doc"), m_docObject );
+ m_docObject.setProperty( ctx, QStringLiteral("spell"), JSSpell::object( ctx ) );
+ m_docObject.setProperty( ctx, QStringLiteral("util"), JSUtil::object( ctx ) );
}
ExecutorKJS::ExecutorKJS( DocumentPrivate *doc )
@@ -99,7 +99,7 @@ void ExecutorKJS::execute( const QString &script )
}
#endif
- KJSResult result = d->m_interpreter->evaluate( "okular.js", 1,
+ KJSResult result = d->m_interpreter->evaluate( QStringLiteral("okular.js"), 1,
script, &d->m_docObject );
KJSContext* ctx = d->m_interpreter->globalContext();
if ( result.isException() || ctx->hasException() )
diff --git a/core/script/kjs_app.cpp b/core/script/kjs_app.cpp
index a7bba0c..ece8a67 100644
--- a/core/script/kjs_app.cpp
+++ b/core/script/kjs_app.cpp
@@ -57,35 +57,35 @@ static KJSObject appGetLanguage( KJSContext *, void * )
QLocale locale;
QString lang = QLocale::languageToString(locale.language());
QString country = QLocale::countryToString(locale.country());
- QString acroLang = QString::fromLatin1( "ENU" );
+ QString acroLang = QStringLiteral( "ENU" );
if ( lang == QLatin1String( "da" ) )
- acroLang = QString::fromLatin1( "DAN" ); // Danish
+ acroLang = QStringLiteral( "DAN" ); // Danish
else if ( lang == QLatin1String( "de" ) )
- acroLang = QString::fromLatin1( "DEU" ); // German
+ acroLang = QStringLiteral( "DEU" ); // German
else if ( lang == QLatin1String( "en" ) )
- acroLang = QString::fromLatin1( "ENU" ); // English
+ acroLang = QStringLiteral( "ENU" ); // English
else if ( lang == QLatin1String( "es" ) )
- acroLang = QString::fromLatin1( "ESP" ); // Spanish
+ acroLang = QStringLiteral( "ESP" ); // Spanish
else if ( lang == QLatin1String( "fr" ) )
- acroLang = QString::fromLatin1( "FRA" ); // French
+ acroLang = QStringLiteral( "FRA" ); // French
else if ( lang == QLatin1String( "it" ) )
- acroLang = QString::fromLatin1( "ITA" ); // Italian
+ acroLang = QStringLiteral( "ITA" ); // Italian
else if ( lang == QLatin1String( "ko" ) )
- acroLang = QString::fromLatin1( "KOR" ); // Korean
+ acroLang = QStringLiteral( "KOR" ); // Korean
else if ( lang == QLatin1String( "ja" ) )
- acroLang = QString::fromLatin1( "JPN" ); // Japanese
+ acroLang = QStringLiteral( "JPN" ); // Japanese
else if ( lang == QLatin1String( "nl" ) )
- acroLang = QString::fromLatin1( "NLD" ); // Dutch
+ acroLang = QStringLiteral( "NLD" ); // Dutch
else if ( lang == QLatin1String( "pt" ) && country == QLatin1String( "BR" ) )
- acroLang = QString::fromLatin1( "PTB" ); // Brazilian Portuguese
+ acroLang = QStringLiteral( "PTB" ); // Brazilian Portuguese
else if ( lang == QLatin1String( "fi" ) )
- acroLang = QString::fromLatin1( "SUO" ); // Finnish
+ acroLang = QStringLiteral( "SUO" ); // Finnish
else if ( lang == QLatin1String( "sv" ) )
- acroLang = QString::fromLatin1( "SVE" ); // Swedish
+ acroLang = QStringLiteral( "SVE" ); // Swedish
else if ( lang == QLatin1String( "zh" ) && country == QLatin1String( "CN" ) )
- acroLang = QString::fromLatin1( "CHS" ); // Chinese Simplified
+ acroLang = QStringLiteral( "CHS" ); // Chinese Simplified
else if ( lang == QLatin1String( "zh" ) && country == QLatin1String( "TW" ) )
- acroLang = QString::fromLatin1( "CHT" ); // Chinese Traditional
+ acroLang = QStringLiteral( "CHT" ); // Chinese Traditional
return KJSString( acroLang );
}
@@ -101,7 +101,7 @@ static KJSObject appGetPlatform( KJSContext *, void * )
#elif defined(Q_OS_MAC)
return KJSString( QString::fromLatin1( "MAC" ) );
#else
- return KJSString( QString::fromLatin1( "UNIX" ) );
+ return KJSString( QLatin1String( "UNIX" ) );
#endif
}
@@ -112,11 +112,11 @@ static KJSObject appGetPlugIns( KJSContext *context, void * )
{
const FakePluginInfo &info = s_fake_plugins[i];
KJSObject plugin;
- plugin.setProperty( context, "certified", info.certified );
- plugin.setProperty( context, "loaded", info.loaded );
- plugin.setProperty( context, "name", info.name );
- plugin.setProperty( context, "path", info.path );
- plugin.setProperty( context, "version", fake_acroversion );
+ plugin.setProperty( context, QStringLiteral("certified"), info.certified );
+ plugin.setProperty( context, QStringLiteral("loaded"), info.loaded );
+ plugin.setProperty( context, QStringLiteral("name"), info.name );
+ plugin.setProperty( context, QStringLiteral("path"), info.path );
+ plugin.setProperty( context, QStringLiteral("version"), fake_acroversion );
plugins.setProperty( context, QString::number( i ), plugin );
}
return plugins;
@@ -135,13 +135,13 @@ static KJSObject appGetPrinterNames( KJSContext *context, void * )
static KJSObject appGetViewerType( KJSContext *, void * )
{
// faking a bit...
- return KJSString( QString::fromLatin1( "Reader" ) );
+ return KJSString( QLatin1String( "Reader" ) );
}
static KJSObject appGetViewerVariation( KJSContext *, void * )
{
// faking a bit...
- return KJSString( QString::fromLatin1( "Reader" ) );
+ return KJSString( QLatin1String( "Reader" ) );
}
static KJSObject appGetViewerVersion( KJSContext *, void * )
@@ -155,7 +155,7 @@ static KJSObject appBeep( KJSContext *context, void *,
{
if ( arguments.count() < 1 )
{
- return context->throwException( "Missing beep type" );
+ return context->throwException( QStringLiteral("Missing beep type") );
}
QApplication::beep();
return KJSUndefined();
@@ -166,12 +166,12 @@ static KJSObject appGetNthPlugInName( KJSContext *context, void *,
{
if ( arguments.count() < 1 )
{
- return context->throwException( "Missing plugin index" );
+ return context->throwException( QStringLiteral("Missing plugin index") );
}
const int nIndex = arguments.at( 0 ).toInt32( context );
if ( nIndex < 0 || nIndex >= s_num_fake_plugins )
- return context->throwException( "PlugIn index out of bounds" );
+ return context->throwException( QStringLiteral("PlugIn index out of bounds") );
const FakePluginInfo &info = s_fake_plugins[nIndex];
return KJSString( info.name );
@@ -208,21 +208,21 @@ void JSApp::initType( KJSContext *ctx )
g_appProto = new KJSPrototype();
- g_appProto->defineProperty( ctx, "formsVersion", appGetFormsVersion );
- g_appProto->defineProperty( ctx, "language", appGetLanguage );
- g_appProto->defineProperty( ctx, "numPlugIns", appGetNumPlugins );
- g_appProto->defineProperty( ctx, "platform", appGetPlatform );
- g_appProto->defineProperty( ctx, "plugIns", appGetPlugIns );
- g_appProto->defineProperty( ctx, "printColorProfiles", appGetPrintColorProfiles );
- g_appProto->defineProperty( ctx, "printerNames", appGetPrinterNames );
- g_appProto->defineProperty( ctx, "viewerType", appGetViewerType );
- g_appProto->defineProperty( ctx, "viewerVariation", appGetViewerVariation );
- g_appProto->defineProperty( ctx, "viewerVersion", appGetViewerVersion );
-
- g_appProto->defineFunction( ctx, "beep", appBeep );
- g_appProto->defineFunction( ctx, "getNthPlugInName", appGetNthPlugInName );
- g_appProto->defineFunction( ctx, "goBack", appGoBack );
- g_appProto->defineFunction( ctx, "goForward", appGoForward );
+ g_appProto->defineProperty( ctx, QStringLiteral("formsVersion"), appGetFormsVersion );
+ g_appProto->defineProperty( ctx, QStringLiteral("language"), appGetLanguage );
+ g_appProto->defineProperty( ctx, QStringLiteral("numPlugIns"), appGetNumPlugins );
+ g_appProto->defineProperty( ctx, QStringLiteral("platform"), appGetPlatform );
+ g_appProto->defineProperty( ctx, QStringLiteral("plugIns"), appGetPlugIns );
+ g_appProto->defineProperty( ctx, QStringLiteral("printColorProfiles"), appGetPrintColorProfiles );
+ g_appProto->defineProperty( ctx, QStringLiteral("printerNames"), appGetPrinterNames );
+ g_appProto->defineProperty( ctx, QStringLiteral("viewerType"), appGetViewerType );
+ g_appProto->defineProperty( ctx, QStringLiteral("viewerVariation"), appGetViewerVariation );
+ g_appProto->defineProperty( ctx, QStringLiteral("viewerVersion"), appGetViewerVersion );
+
+ g_appProto->defineFunction( ctx, QStringLiteral("beep"), appBeep );
+ g_appProto->defineFunction( ctx, QStringLiteral("getNthPlugInName"), appGetNthPlugInName );
+ g_appProto->defineFunction( ctx, QStringLiteral("goBack"), appGoBack );
+ g_appProto->defineFunction( ctx, QStringLiteral("goForward"), appGoForward );
}
KJSObject JSApp::object( KJSContext *ctx, DocumentPrivate *doc )
diff --git a/core/script/kjs_console.cpp b/core/script/kjs_console.cpp
index 28ca34d..7038ee7 100644
--- a/core/script/kjs_console.cpp
+++ b/core/script/kjs_console.cpp
@@ -138,10 +138,10 @@ void JSConsole::initType( KJSContext *ctx )
g_consoleProto = new KJSPrototype();
- g_consoleProto->defineFunction( ctx, "clear", consoleClear );
- g_consoleProto->defineFunction( ctx, "hide", consoleHide );
- g_consoleProto->defineFunction( ctx, "println", consolePrintln );
- g_consoleProto->defineFunction( ctx, "hide", consoleShow );
+ g_consoleProto->defineFunction( ctx, QStringLiteral("clear"), consoleClear );
+ g_consoleProto->defineFunction( ctx, QStringLiteral("hide"), consoleHide );
+ g_consoleProto->defineFunction( ctx, QStringLiteral("println"), consolePrintln );
+ g_consoleProto->defineFunction( ctx, QStringLiteral("hide"), consoleShow );
}
KJSObject JSConsole::object( KJSContext *ctx )
diff --git a/core/script/kjs_data.cpp b/core/script/kjs_data.cpp
index 30544dc..3a3ee2b 100644
--- a/core/script/kjs_data.cpp
+++ b/core/script/kjs_data.cpp
@@ -75,13 +75,13 @@ void JSData::initType( KJSContext *ctx )
if ( !g_dataProto )
g_dataProto = new KJSPrototype();
- g_dataProto->defineProperty( ctx, "creationDate", dataGetCreationDate );
- g_dataProto->defineProperty( ctx, "description", dataGetDescription );
- g_dataProto->defineProperty( ctx, "MIMEType", dataGetMIMEType );
- g_dataProto->defineProperty( ctx, "modDate", dataGetModDate );
- g_dataProto->defineProperty( ctx, "name", dataGetName );
- g_dataProto->defineProperty( ctx, "path", dataGetPath );
- g_dataProto->defineProperty( ctx, "size", dataGetSize );
+ g_dataProto->defineProperty( ctx, QStringLiteral("creationDate"), dataGetCreationDate );
+ g_dataProto->defineProperty( ctx, QStringLiteral("description"), dataGetDescription );
+ g_dataProto->defineProperty( ctx, QStringLiteral("MIMEType"), dataGetMIMEType );
+ g_dataProto->defineProperty( ctx, QStringLiteral("modDate"), dataGetModDate );
+ g_dataProto->defineProperty( ctx, QStringLiteral("name"), dataGetName );
+ g_dataProto->defineProperty( ctx, QStringLiteral("path"), dataGetPath );
+ g_dataProto->defineProperty( ctx, QStringLiteral("size"), dataGetSize );
}
KJSObject JSData::wrapFile( KJSContext *ctx, EmbeddedFile *f )
diff --git a/core/script/kjs_document.cpp b/core/script/kjs_document.cpp
index 2382887..b16bd12 100644
--- a/core/script/kjs_document.cpp
+++ b/core/script/kjs_document.cpp
@@ -232,7 +232,7 @@ static KJSObject docGotoNamedDest( KJSContext *ctx, void *object,
QString dest = arguments.at( 0 ).toString( ctx );
- DocumentViewport viewport( doc->m_generator->metaData( "NamedViewport", dest ).toString() );
+ DocumentViewport viewport( doc->m_generator->metaData( QStringLiteral("NamedViewport"), dest ).toString() );
if ( !viewport.isValid() )
return KJSUndefined();
@@ -257,30 +257,30 @@ void JSDocument::initType( KJSContext *ctx )
return;
initialized = true;
- g_docProto->defineProperty( ctx, "numPages", docGetNumPages );
- g_docProto->defineProperty( ctx, "pageNum", docGetPageNum, docSetPageNum );
- g_docProto->defineProperty( ctx, "documentFileName", docGetDocumentFileName );
- g_docProto->defineProperty( ctx, "filesize", docGetFilesize );
- g_docProto->defineProperty( ctx, "path", docGetPath );
- g_docProto->defineProperty( ctx, "URL", docGetURL );
- g_docProto->defineProperty( ctx, "permStatusReady", docGetPermStatusReady );
- g_docProto->defineProperty( ctx, "dataObjects", docGetDataObjects );
- g_docProto->defineProperty( ctx, "external", docGetExternal );
+ g_docProto->defineProperty( ctx, QStringLiteral("numPages"), docGetNumPages );
+ g_docProto->defineProperty( ctx, QStringLiteral("pageNum"), docGetPageNum, docSetPageNum );
+ g_docProto->defineProperty( ctx, QStringLiteral("documentFileName"), docGetDocumentFileName );
+ g_docProto->defineProperty( ctx, QStringLiteral("filesize"), docGetFilesize );
+ g_docProto->defineProperty( ctx, QStringLiteral("path"), docGetPath );
+ g_docProto->defineProperty( ctx, QStringLiteral("URL"), docGetURL );
+ g_docProto->defineProperty( ctx, QStringLiteral("permStatusReady"), docGetPermStatusReady );
+ g_docProto->defineProperty( ctx, QStringLiteral("dataObjects"), docGetDataObjects );
+ g_docProto->defineProperty( ctx, QStringLiteral("external"), docGetExternal );
// info properties
- g_docProto->defineProperty( ctx, "info", docGetInfo );
- g_docProto->defineProperty( ctx, "author", docGetAuthor );
- g_docProto->defineProperty( ctx, "creator", docGetCreator );
- g_docProto->defineProperty( ctx, "keywords", docGetKeywords );
- g_docProto->defineProperty( ctx, "producer", docGetProducer );
- g_docProto->defineProperty( ctx, "title", docGetTitle );
- g_docProto->defineProperty( ctx, "subject", docGetSubject );
-
- g_docProto->defineFunction( ctx, "getField", docGetField );
- g_docProto->defineFunction( ctx, "getPageLabel", docGetPageLabel );
- g_docProto->defineFunction( ctx, "getPageRotation", docGetPageRotation );
- g_docProto->defineFunction( ctx, "gotoNamedDest", docGotoNamedDest );
- g_docProto->defineFunction( ctx, "syncAnnotScan", docSyncAnnotScan );
+ g_docProto->defineProperty( ctx, QStringLiteral("info"), docGetInfo );
+ g_docProto->defineProperty( ctx, QStringLiteral("author"), docGetAuthor );
+ g_docProto->defineProperty( ctx, QStringLiteral("creator"), docGetCreator );
+ g_docProto->defineProperty( ctx, QStringLiteral("keywords"), docGetKeywords );
+ g_docProto->defineProperty( ctx, QStringLiteral("producer"), docGetProducer );
+ g_docProto->defineProperty( ctx, QStringLiteral("title"), docGetTitle );
+ g_docProto->defineProperty( ctx, QStringLiteral("subject"), docGetSubject );
+
+ g_docProto->defineFunction( ctx, QStringLiteral("getField"), docGetField );
+ g_docProto->defineFunction( ctx, QStringLiteral("getPageLabel"), docGetPageLabel );
+ g_docProto->defineFunction( ctx, QStringLiteral("getPageRotation"), docGetPageRotation );
+ g_docProto->defineFunction( ctx, QStringLiteral("gotoNamedDest"), docGotoNamedDest );
+ g_docProto->defineFunction( ctx, QStringLiteral("syncAnnotScan"), docSyncAnnotScan );
}
KJSGlobalObject JSDocument::wrapDocument( DocumentPrivate *doc )
diff --git a/core/script/kjs_field.cpp b/core/script/kjs_field.cpp
index b035441..42c1332 100644
--- a/core/script/kjs_field.cpp
+++ b/core/script/kjs_field.cpp
@@ -75,30 +75,30 @@ static QString fieldGetTypeHelper( const FormField *field )
switch ( button->buttonType() )
{
case FormFieldButton::Push:
- return "button";
+ return QStringLiteral("button");
case FormFieldButton::CheckBox:
- return "checkbox";
+ return QStringLiteral("checkbox");
case FormFieldButton::Radio:
- return "radiobutton";
+ return QStringLiteral("radiobutton");
}
break;
}
case FormField::FormText:
- return "text";
+ return QStringLiteral("text");
case FormField::FormChoice:
{
const FormFieldChoice *choice = static_cast< const FormFieldChoice * >( field );
switch ( choice->choiceType() )
{
case FormFieldChoice::ComboBox:
- return "combobox";
+ return QStringLiteral("combobox");
case FormFieldChoice::ListBox:
- return "listbox";
+ return QStringLiteral("listbox");
}
break;
}
case FormField::FormSignature:
- return "signature";
+ return QStringLiteral("signature");
}
return QString();
}
@@ -204,19 +204,19 @@ void JSField::initType( KJSContext *ctx )
if ( !g_fieldProto )
g_fieldProto = new KJSPrototype();
- g_fieldProto->defineProperty( ctx, "doc", fieldGetDoc );
- g_fieldProto->defineProperty( ctx, "name", fieldGetName );
- g_fieldProto->defineProperty( ctx, "readonly",
+ g_fieldProto->defineProperty( ctx, QStringLiteral("doc"), fieldGetDoc );
+ g_fieldProto->defineProperty( ctx, QStringLiteral("name"), fieldGetName );
+ g_fieldProto->defineProperty( ctx, QStringLiteral("readonly"),
fieldGetReadOnly, fieldSetReadOnly );
- g_fieldProto->defineProperty( ctx, "type", fieldGetType );
- g_fieldProto->defineProperty( ctx, "value", fieldGetValue, fieldSetValue );
+ g_fieldProto->defineProperty( ctx, QStringLiteral("type"), fieldGetType );
+ g_fieldProto->defineProperty( ctx, QStringLiteral("value"), fieldGetValue, fieldSetValue );
}
KJSObject JSField::wrapField( KJSContext *ctx, FormField *field, Page *page )
{
// ### cache unique wrapper
KJSObject f = g_fieldProto->constructObject( ctx, field );
- f.setProperty( ctx, "page", page->number() );
+ f.setProperty( ctx, QStringLiteral("page"), page->number() );
return f;
}
diff --git a/core/script/kjs_fullscreen.cpp b/core/script/kjs_fullscreen.cpp
index 2808657..2b444d1 100644
--- a/core/script/kjs_fullscreen.cpp
+++ b/core/script/kjs_fullscreen.cpp
@@ -64,10 +64,10 @@ void JSFullscreen::initType( KJSContext *ctx )
if ( !g_fsProto )
g_fsProto = new KJSPrototype();
- g_fsProto->defineProperty( ctx, "loop", fsGetLoop, fsSetLoop );
- g_fsProto->defineProperty( ctx, "useTimer",
+ g_fsProto->defineProperty( ctx, QStringLiteral("loop"), fsGetLoop, fsSetLoop );
+ g_fsProto->defineProperty( ctx, QStringLiteral("useTimer"),
fsGetUseTimer, fsSetUseTimer );
- g_fsProto->defineProperty( ctx, "timeDelay",
+ g_fsProto->defineProperty( ctx, QStringLiteral("timeDelay"),
fsGetTimeDelay, fsSetTimeDelay );
}
diff --git a/core/script/kjs_spell.cpp b/core/script/kjs_spell.cpp
index ea21d26..a71a82b 100644
--- a/core/script/kjs_spell.cpp
+++ b/core/script/kjs_spell.cpp
@@ -33,7 +33,7 @@ void JSSpell::initType( KJSContext *ctx )
initialized = true;
g_spellProto = new KJSPrototype();
- g_spellProto->defineProperty( ctx, QString( "available" ), spellGetAvailable );
+ g_spellProto->defineProperty( ctx, QStringLiteral( "available" ), spellGetAvailable );
}
KJSObject JSSpell::object( KJSContext *ctx )
diff --git a/core/script/kjs_util.cpp b/core/script/kjs_util.cpp
index 10e2c27..937f4f5 100644
--- a/core/script/kjs_util.cpp
+++ b/core/script/kjs_util.cpp
@@ -25,13 +25,13 @@ static KJSObject crackURL( KJSContext *context, void *,
{
if ( arguments.count() < 1 )
{
- return context->throwException( "Missing URL argument" );
+ return context->throwException( QStringLiteral("Missing URL argument") );
}
QString cURL = arguments.at( 0 ).toString( context );
QUrl url(QUrl::fromLocalFile(cURL) );
if ( !url.isValid() )
{
- return context->throwException( "Invalid URL" );
+ return context->throwException( QStringLiteral("Invalid URL") );
}
if ( url.scheme() != QLatin1String( "file" )
|| url.scheme() != QLatin1String( "http" )
@@ -41,17 +41,17 @@ static KJSObject crackURL( KJSContext *context, void *,
}
KJSObject obj;
- obj.setProperty( context, "cScheme", url.scheme() );
+ obj.setProperty( context, QStringLiteral("cScheme"), url.scheme() );
if ( !url.userName().isEmpty() )
- obj.setProperty( context, "cUser", url.userName() );
+ obj.setProperty( context, QStringLiteral("cUser"), url.userName() );
if ( !url.password().isEmpty() )
- obj.setProperty( context, "cPassword", url.password() );
- obj.setProperty( context, "cHost", url.host() );
- obj.setProperty( context, "nPort", url.port( 80 ) );
+ obj.setProperty( context, QStringLiteral("cPassword"), url.password() );
+ obj.setProperty( context, QStringLiteral("cHost"), url.host() );
+ obj.setProperty( context, QStringLiteral("nPort"), url.port( 80 ) );
// TODO cPath (Optional) The path portion of the URL.
// TODO cParameters (Optional) The parameter string portion of the URL.
if ( url.hasFragment() )
- obj.setProperty( context, "cFragments", url.fragment(QUrl::FullyDecoded) );
+ obj.setProperty( context, QStringLiteral("cFragments"), url.fragment(QUrl::FullyDecoded) );
return obj;
}
@@ -64,7 +64,7 @@ void JSUtil::initType( KJSContext *ctx )
initialized = true;
g_utilProto = new KJSPrototype();
- g_utilProto->defineFunction( ctx, "crackURL", crackURL );
+ g_utilProto->defineFunction( ctx, QStringLiteral("crackURL"), crackURL );
}
KJSObject JSUtil::object( KJSContext *ctx )
diff --git a/core/textdocumentgenerator.cpp b/core/textdocumentgenerator.cpp
index 1fcf50e..88facc0 100644
--- a/core/textdocumentgenerator.cpp
+++ b/core/textdocumentgenerator.cpp
@@ -106,7 +106,7 @@ Okular::TextPage* TextDocumentGeneratorPrivate::createTextPage( int pageNumber )
QRectF rect;
TextDocumentUtils::calculateBoundingRect( mDocument, i, i + 1, rect, pageNumber );
if ( pageNumber == -1 )
- text = "\n";
+ text = QStringLiteral("\n");
textPage->append( text, new Okular::NormalizedRect( rect.left(), rect.top(), rect.right(), rect.bottom() ) );
}
@@ -213,7 +213,7 @@ void TextDocumentGeneratorPrivate::generateTitleInfos()
Okular::DocumentViewport viewport = TextDocumentUtils::calculateViewport( mDocument, position.block );
QDomElement item = mDocumentSynopsis.createElement( position.title );
- item.setAttribute( "Viewport", viewport.toString() );
+ item.setAttribute( QStringLiteral("Viewport"), viewport.toString() );
int headingLevel = position.level;
@@ -264,12 +264,12 @@ void TextDocumentGeneratorPrivate::initializeGenerator()
QObject::connect( mConverter, SIGNAL(addMetaData(DocumentInfo::Key,QString)),
q, SLOT(addMetaData(DocumentInfo::Key,QString)) );
- QObject::connect( mConverter, SIGNAL(error(QString,int)),
- q, SIGNAL(error(QString,int)) );
- QObject::connect( mConverter, SIGNAL(warning(QString,int)),
- q, SIGNAL(warning(QString,int)) );
- QObject::connect( mConverter, SIGNAL(notice(QString,int)),
- q, SIGNAL(notice(QString,int)) );
+ QObject::connect( mConverter, &TextDocumentConverter::error,
+ q, &Generator::error );
+ QObject::connect( mConverter, &TextDocumentConverter::warning,
+ q, &Generator::warning );
+ QObject::connect( mConverter, &TextDocumentConverter::notice,
+ q, &Generator::notice );
}
TextDocumentGenerator::TextDocumentGenerator(TextDocumentConverter *converter, const QString& configName , QObject *parent, const QVariantList &args)
@@ -463,7 +463,7 @@ const Okular::DocumentSynopsis* TextDocumentGenerator::generateDocumentSynopsis(
QVariant TextDocumentGeneratorPrivate::metaData( const QString &key, const QVariant &option ) const
{
Q_UNUSED( option )
- if ( key == "DocumentTitle" )
+ if ( key == QLatin1String("DocumentTitle") )
{
return mDocumentInfo.get( DocumentInfo::Title );
}
diff --git a/core/textdocumentsettings.cpp b/core/textdocumentsettings.cpp
index 00ba3be..b6b4c54 100644
--- a/core/textdocumentsettings.cpp
+++ b/core/textdocumentsettings.cpp
@@ -66,7 +66,7 @@ TextDocumentSettings::TextDocumentSettings( const QString& config, QObject *pare
{
Q_D( TextDocumentSettings );
- addItemFont( "Font", d->mFont );
+ addItemFont( QStringLiteral("Font"), d->mFont );
}
QFont TextDocumentSettings::font() const
diff --git a/core/texteditors_p.h b/core/texteditors_p.h
index e41084d..b3a068e 100644
--- a/core/texteditors_p.h
+++ b/core/texteditors_p.h
@@ -22,15 +22,15 @@ static inline QHash< int, QString > buildEditorsMap()
{
QHash< int, QString > editors;
editors.insert( SettingsCore::EnumExternalEditor::Kate,
- QString::fromLatin1( "kate --line %l --column %c" ) );
+ QStringLiteral( "kate --line %l --column %c" ) );
editors.insert( SettingsCore::EnumExternalEditor::Kile,
- QString::fromLatin1( "kile --line %l" ) );
+ QStringLiteral( "kile --line %l" ) );
editors.insert( SettingsCore::EnumExternalEditor::Scite,
- QString::fromLatin1( "scite %f \"-goto:%l,%c\"" ) );
+ QStringLiteral( "scite %f \"-goto:%l,%c\"" ) );
editors.insert( SettingsCore::EnumExternalEditor::Emacsclient,
- QString::fromLatin1( "emacsclient -a emacs --no-wait +%l %f" ) );
+ QStringLiteral( "emacsclient -a emacs --no-wait +%l %f" ) );
editors.insert( SettingsCore::EnumExternalEditor::Lyxclient,
- QString::fromLatin1( "lyxclient -g %f %l" ) );
+ QStringLiteral( "lyxclient -g %f %l" ) );
return editors;
}
diff --git a/core/textpage.cpp b/core/textpage.cpp
index 46e3758..0784340 100644
--- a/core/textpage.cpp
+++ b/core/textpage.cpp
@@ -810,7 +810,7 @@ static int stringLengthAdaptedWithHyphen(const QString &str, const TextList::Con
}
}
// else if it is the second last entry - for example in pdf format
- else if (str.endsWith("-\n"))
+ else if (str.endsWith(QLatin1String("-\n")))
{
len -= 2;
}
@@ -1838,7 +1838,7 @@ WordsWithCharacters addNecessarySpace(RegionTextList tree, int pageWidth, int pa
const int top = area2.top() < area1.top() ? area2.top() : area1.top();
const int bottom = area2.bottom() > area1.bottom() ? area2.bottom() : area1.bottom();
- const QString spaceStr(" ");
+ const QString spaceStr(QStringLiteral(" "));
const QRect rect(QPoint(left,top),QPoint(right,bottom));
const NormalizedRect entRect(rect,pageWidth,pageHeight);
TinyTextEntity *ent1 = new TinyTextEntity(spaceStr, entRect);
@@ -1981,17 +1981,17 @@ RegularAreaRect * TextPage::wordAt( const NormalizedPoint &p, QString *word ) co
const QString itText = (*posIt)->text();
if ( itText.right(1).at(0).isSpace() )
{
- if (itText.endsWith("-\n"))
+ if (itText.endsWith(QLatin1String("-\n")))
{
// Is an hyphenated word
// continue searching the start of the word back
continue;
}
- if (itText == "\n" && posIt != itBegin )
+ if (itText == QLatin1String("\n") && posIt != itBegin )
{
--posIt;
- if ((*posIt)->text().endsWith("-")) {
+ if ((*posIt)->text().endsWith(QLatin1String("-"))) {
// Is an hyphenated word
// continue searching the start of the word back
continue;
@@ -2016,7 +2016,7 @@ RegularAreaRect * TextPage::wordAt( const NormalizedPoint &p, QString *word ) co
text += (*posIt)->text();
if (itText.right(1).at(0).isSpace())
{
- if (!text.endsWith("-\n"))
+ if (!text.endsWith(QLatin1String("-\n")))
{
break;
}
diff --git a/extensions.cpp b/extensions.cpp
index 6960794..c5c0714 100644
--- a/extensions.cpp
+++ b/extensions.cpp
@@ -97,7 +97,7 @@ QString OkularLiveConnectExtension::eval( const QString &script )
args.append( qMakePair( KParts::LiveConnectExtension::TypeString, script ) );
m_evalRes.clear();
m_inEval = true;
- emit partEvent( 0, "eval", args );
+ emit partEvent( 0, QStringLiteral("eval"), args );
m_inEval = false;
return m_evalRes;
}
@@ -109,10 +109,10 @@ void OkularLiveConnectExtension::postMessage( const QStringList &args )
Q_FOREACH ( const QString &arg, args )
{
QString newarg = arg;
- newarg.replace( '\'', "\\'" );
+ newarg.replace( '\'', QLatin1String("\\'") );
arrayargs.append( "\"" + newarg + "\"" );
}
- const QString arrayarg = '[' + arrayargs.join( ", " ) + ']';
+ const QString arrayarg = '[' + arrayargs.join( QStringLiteral(", ") ) + ']';
eval( "if (this.messageHandler && typeof this.messageHandler.onMessage == 'function') "
"{ this.messageHandler.onMessage(" + arrayarg + ") }" );
}
diff --git a/generators/chm/generator_chm.cpp b/generators/chm/generator_chm.cpp
index ed58c67..5163d5f 100644
--- a/generators/chm/generator_chm.cpp
+++ b/generators/chm/generator_chm.cpp
@@ -32,15 +32,15 @@
static KAboutData createAboutData()
{
KAboutData aboutData(
- "okular_chm",
+ QStringLiteral("okular_chm"),
i18n( "CHM Backend" ),
- "0.1.4",
+ QStringLiteral("0.1.4"),
i18n( "A Microsoft Windows help file renderer" ),
KAboutLicense::GPL,
i18n( "© 2005-2007 Piotr Szymański\n© 2008 Albert Astals Cid" )
);
- aboutData.addAuthor( i18n( "Piotr Szymański" ), QString(), "niedakh@gmail.com" );
- aboutData.addAuthor( i18n( "Albert Astals Cid" ), QString(), "aacid@kde.org" );
+ aboutData.addAuthor( i18n( "Piotr Szymański" ), QString(), QStringLiteral("niedakh@gmail.com") );
+ aboutData.addAuthor( i18n( "Albert Astals Cid" ), QString(), QStringLiteral("aacid@kde.org") );
return aboutData;
}
@@ -102,9 +102,9 @@ bool CHMGenerator::loadDocument( const QString & fileName, QVector< Okular::Page
QString url = e.urls.first();
if (url.contains(QChar::fromLatin1('%')))
url = QString::fromUtf8(QByteArray::fromPercentEncoding(url.toUtf8()));
- item.setAttribute("ViewportName", url);
+ item.setAttribute(QStringLiteral("ViewportName"), url);
}
- item.setAttribute("Icon", e.imageid);
+ item.setAttribute(QStringLiteral("Icon"), e.imageid);
if (e.indent == 0) m_docSyn.appendChild(item);
else lastIndentElement[e.indent - 1].appendChild(item);
lastIndentElement[e.indent] = item;
@@ -153,7 +153,7 @@ bool CHMGenerator::loadDocument( const QString & fileName, QVector< Okular::Page
}
connect( m_syncGen, SIGNAL(completed()), this, SLOT(slotCompleted()) );
- connect( m_syncGen, SIGNAL(canceled(QString)), this, SLOT(slotCompleted()) );
+ connect( m_syncGen, &KParts::ReadOnlyPart::canceled, this, &CHMGenerator::slotCompleted );
return true;
}
@@ -186,7 +186,7 @@ void CHMGenerator::preparePageForSyncOperation( int zoom , const QString & url)
QEventLoop loop;
connect( m_syncGen, SIGNAL(completed()), &loop, SLOT(quit()) );
- connect( m_syncGen, SIGNAL(canceled(QString)), &loop, SLOT(quit()) );
+ connect( m_syncGen, &KParts::ReadOnlyPart::canceled, &loop, &QEventLoop::quit );
// discard any user input, otherwise it breaks the "synchronicity" of this
// function
loop.exec( QEventLoop::ExcludeUserInputEvents );
@@ -234,7 +234,7 @@ Okular::DocumentInfo CHMGenerator::generateDocumentInfo( const QSet<Okular::Docu
{
Okular::DocumentInfo docInfo;
if ( keys.contains( Okular::DocumentInfo::MimeType ) )
- docInfo.set( Okular::DocumentInfo::MimeType, "application/x-chm" );
+ docInfo.set( Okular::DocumentInfo::MimeType, QStringLiteral("application/x-chm") );
if ( keys.contains( Okular::DocumentInfo::Title ) )
docInfo.set( Okular::DocumentInfo::Title, m_file->title() );
return docInfo;
@@ -369,9 +369,9 @@ void CHMGenerator::additionalRequestData()
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 (":"))
+ else if (url.contains (QStringLiteral(":")))
{
objRects.push_back(
new Okular::ObjectRect ( Okular::NormalizedRect(r,xScale,yScale),
@@ -381,7 +381,7 @@ void CHMGenerator::additionalRequestData()
}
else
{
- Okular::DocumentViewport viewport( metaData( "NamedViewport", absolutePath( m_chmUrl, url ) ).toString() );
+ Okular::DocumentViewport viewport( metaData( QStringLiteral("NamedViewport"), absolutePath( m_chmUrl, url ) ).toString() );
objRects.push_back(
new Okular::ObjectRect ( Okular::NormalizedRect(r,xScale,yScale),
false,
@@ -438,7 +438,7 @@ Okular::TextPage* CHMGenerator::textPage( Okular::Page * page )
QVariant CHMGenerator::metaData( const QString &key, const QVariant &option ) const
{
- if ( key == "NamedViewport" && !option.toString().isEmpty() )
+ if ( key == QLatin1String("NamedViewport") && !option.toString().isEmpty() )
{
const int pos = option.toString().indexOf('#');
QString tmpUrl = pos == -1 ? option.toString() : option.toString().left(pos);
@@ -451,7 +451,7 @@ QVariant CHMGenerator::metaData( const QString &key, const QVariant &option ) co
}
}
- else if ( key == "DocumentTitle" )
+ else if ( key == QLatin1String("DocumentTitle") )
{
return m_file->title();
}
diff --git a/generators/chm/kio-msits/msits.cpp b/generators/chm/kio-msits/msits.cpp
index 9fe3d7c..aae3003 100644
--- a/generators/chm/kio-msits/msits.cpp
+++ b/generators/chm/kio-msits/msits.cpp
@@ -41,7 +41,7 @@ extern "C"
qCDebug(KIO_MITS_LOG) << "*** kio_msits Init";
QCoreApplication app(argc, argv);
- app.setApplicationName(QLatin1String("kio_msits"));
+ app.setApplicationName(QStringLiteral("kio_msits"));
if ( argc != 4 )
{
@@ -141,7 +141,7 @@ bool ProtocolMSITS::parseLoadAndLookup ( const QUrl& url, QString& abspath )
{
qCDebug(KIO_MITS_LOG) << "ProtocolMSITS::parseLoadAndLookup (const KUrl&) " << url.path();
- int pos = url.path().indexOf ("::");
+ int pos = url.path().indexOf (QStringLiteral("::"));
if ( pos == -1 )
{
@@ -153,7 +153,7 @@ bool ProtocolMSITS::parseLoadAndLookup ( const QUrl& url, QString& abspath )
abspath = url.path().mid (pos + 2); // skip ::
// Some buggy apps add ms-its:/ to the path as well
- if ( abspath.startsWith( "ms-its:" ) )
+ if ( abspath.startsWith( QLatin1String("ms-its:") ) )
abspath = abspath.mid( 7 );
qCDebug(KIO_MITS_LOG) << "ProtocolMSITS::parseLoadAndLookup: filename " << filename << ", path " << abspath;
diff --git a/generators/chm/lib/libchmfile.cpp b/generators/chm/lib/libchmfile.cpp
index 0620b30..4c56b18 100644
--- a/generators/chm/lib/libchmfile.cpp
+++ b/generators/chm/lib/libchmfile.cpp
@@ -53,7 +53,7 @@ QString LCHMFile::title( ) const
QString LCHMFile::homeUrl( ) const
{
QString url = m_impl->homeUrl();
- return url.isNull() ? "/" : url;
+ return url.isNull() ? QStringLiteral("/") : url;
}
bool LCHMFile::hasTableOfContents( ) const
diff --git a/generators/chm/lib/libchmfile_search.cpp b/generators/chm/lib/libchmfile_search.cpp
index 5e6d67f..7c42951 100644
--- a/generators/chm/lib/libchmfile_search.cpp
+++ b/generators/chm/lib/libchmfile_search.cpp
@@ -30,7 +30,7 @@
static inline void validateWord ( QString & word, bool & query_valid )
{
- QRegExp rxvalid ("[^\\d\\w_\\.]+");
+ QRegExp rxvalid (QStringLiteral("[^\\d\\w_\\.]+"));
QString orig = word;
word.remove ( rxvalid );
@@ -41,7 +41,7 @@ static inline void validateWord ( QString & word, bool & query_valid )
static inline void validateWords ( QStringList & wordlist, bool & query_valid )
{
- QRegExp rxvalid ("[^\\d\\w_\\.]+");
+ QRegExp rxvalid (QStringLiteral("[^\\d\\w_\\.]+"));
for ( int i = 0; i < wordlist.size(); i++ )
validateWord ( wordlist[i], query_valid );
@@ -196,15 +196,15 @@ bool LCHMFile::searchQuery( const QString& inquery, QStringList * searchresults,
* If there is no prefix, the word considered as required.
*/
- QRegExp rxphrase( "\"(.*)\"" );
- QRegExp rxword( "([^\\s]+)" );
+ QRegExp rxphrase( QStringLiteral("\"(.*)\"") );
+ QRegExp rxword( QStringLiteral("([^\\s]+)") );
rxphrase.setMinimal( true );
// First, get the phrase queries
while ( (pos = rxphrase.indexIn (query, 0)) != -1 )
{
// A phrase query found. Locate its boundaries, and parse it.
- QStringList plist = rxphrase.cap ( 1 ).split ( QRegExp ("\\s+") );
+ QStringList plist = rxphrase.cap ( 1 ).split ( QRegExp (QStringLiteral("\\s+")) );
validateWords ( plist, query_valid );
diff --git a/generators/chm/lib/libchmfileimpl.cpp b/generators/chm/lib/libchmfileimpl.cpp
index 76e81b5..6c65a49 100644
--- a/generators/chm/lib/libchmfileimpl.cpp
+++ b/generators/chm/lib/libchmfileimpl.cpp
@@ -77,7 +77,7 @@ bool LCHMFileImpl::loadFile( const QString & archiveName )
QString filename;
// If the file has a file:// prefix, remove it
- if ( archiveName.startsWith( "file://" ) )
+ if ( archiveName.startsWith( QLatin1String("file://") ) )
filename = archiveName.mid( 7 ); // strip it
else
filename = archiveName;
@@ -104,10 +104,10 @@ bool LCHMFileImpl::loadFile( const QString & archiveName )
guessTextEncoding();
// Check whether the search tables are present
- if ( ResolveObject("/#TOPICS", &m_chmTOPICS)
- && ResolveObject("/#STRINGS", &m_chmSTRINGS)
- && ResolveObject("/#URLTBL", &m_chmURLTBL)
- && ResolveObject("/#URLSTR", &m_chmURLSTR) )
+ if ( ResolveObject(QStringLiteral("/#TOPICS"), &m_chmTOPICS)
+ && ResolveObject(QStringLiteral("/#STRINGS"), &m_chmSTRINGS)
+ && ResolveObject(QStringLiteral("/#URLTBL"), &m_chmURLTBL)
+ && ResolveObject(QStringLiteral("/#URLSTR"), &m_chmURLSTR) )
{
m_lookupTablesValid = true;
fillTopicsUrlMap();
@@ -115,7 +115,7 @@ bool LCHMFileImpl::loadFile( const QString & archiveName )
else
m_lookupTablesValid = false;
- if ( m_lookupTablesValid && ResolveObject ("/$FIftiMain", &m_chmFIftiMain) )
+ if ( m_lookupTablesValid && ResolveObject (QStringLiteral("/$FIftiMain"), &m_chmFIftiMain) )
m_searchAvailable = true;
else
m_searchAvailable = false;
@@ -124,10 +124,10 @@ bool LCHMFileImpl::loadFile( const QString & archiveName )
// Some heuristics here.
chmUnitInfo tui;
- if ( m_topicsFile.isEmpty() && ResolveObject("/toc.hhc", &tui) )
+ if ( m_topicsFile.isEmpty() && ResolveObject(QStringLiteral("/toc.hhc"), &tui) )
m_topicsFile = "/toc.hhc";
- if ( m_indexFile.isEmpty() && ResolveObject("/index.hhk", &tui) )
+ if ( m_indexFile.isEmpty() && ResolveObject(QStringLiteral("/index.hhk"), &tui) )
m_indexFile = "/index.hhk";
return true;
@@ -161,170 +161,170 @@ QString LCHMFileImpl::decodeEntity( const QString & entity )
// Set up m_entityDecodeMap characters according to current textCodec
if ( m_entityDecodeMap.isEmpty() )
{
- m_entityDecodeMap["AElig"] = encodeWithCurrentCodec ("\306"); // capital AE diphthong (ligature)
- m_entityDecodeMap["Aacute"] = encodeWithCurrentCodec ("\301"); // capital A, acute accent
- m_entityDecodeMap["Acirc"] = encodeWithCurrentCodec ("\302"); // capital A, circumflex accent
- m_entityDecodeMap["Agrave"] = encodeWithCurrentCodec ("\300"); // capital A, grave accent
- m_entityDecodeMap["Aring"] = encodeWithCurrentCodec ("\305"); // capital A, ring
- m_entityDecodeMap["Atilde"] = encodeWithCurrentCodec ("\303"); // capital A, tilde
- m_entityDecodeMap["Auml"] = encodeWithCurrentCodec ("\304"); // capital A, dieresis or umlaut mark
- m_entityDecodeMap["Ccedil"] = encodeWithCurrentCodec ("\307"); // capital C, cedilla
- m_entityDecodeMap["Dstrok"] = encodeWithCurrentCodec ("\320"); // whatever
- m_entityDecodeMap["ETH"] = encodeWithCurrentCodec ("\320"); // capital Eth, Icelandic
- m_entityDecodeMap["Eacute"] = encodeWithCurrentCodec ("\311"); // capital E, acute accent
- m_entityDecodeMap["Ecirc"] = encodeWithCurrentCodec ("\312"); // capital E, circumflex accent
- m_entityDecodeMap["Egrave"] = encodeWithCurrentCodec ("\310"); // capital E, grave accent
- m_entityDecodeMap["Euml"] = encodeWithCurrentCodec ("\313"); // capital E, dieresis or umlaut mark
- m_entityDecodeMap["Iacute"] = encodeWithCurrentCodec ("\315"); // capital I, acute accent
- m_entityDecodeMap["Icirc"] = encodeWithCurrentCodec ("\316"); // capital I, circumflex accent
- m_entityDecodeMap["Igrave"] = encodeWithCurrentCodec ("\314"); // capital I, grave accent
- m_entityDecodeMap["Iuml"] = encodeWithCurrentCodec ("\317"); // capital I, dieresis or umlaut mark
- m_entityDecodeMap["Ntilde"] = encodeWithCurrentCodec ("\321"); // capital N, tilde
- m_entityDecodeMap["Oacute"] = encodeWithCurrentCodec ("\323"); // capital O, acute accent
- m_entityDecodeMap["Ocirc"] = encodeWithCurrentCodec ("\324"); // capital O, circumflex accent
- m_entityDecodeMap["Ograve"] = encodeWithCurrentCodec ("\322"); // capital O, grave accent
- m_entityDecodeMap["Oslash"] = encodeWithCurrentCodec ("\330"); // capital O, slash
- m_entityDecodeMap["Otilde"] = encodeWithCurrentCodec ("\325"); // capital O, tilde
- m_entityDecodeMap["Ouml"] = encodeWithCurrentCodec ("\326"); // capital O, dieresis or umlaut mark
- m_entityDecodeMap["THORN"] = encodeWithCurrentCodec ("\336"); // capital THORN, Icelandic
- m_entityDecodeMap["Uacute"] = encodeWithCurrentCodec ("\332"); // capital U, acute accent
- m_entityDecodeMap["Ucirc"] = encodeWithCurrentCodec ("\333"); // capital U, circumflex accent
- m_entityDecodeMap["Ugrave"] = encodeWithCurrentCodec ("\331"); // capital U, grave accent
- m_entityDecodeMap["Uuml"] = encodeWithCurrentCodec ("\334"); // capital U, dieresis or umlaut mark
- m_entityDecodeMap["Yacute"] = encodeWithCurrentCodec ("\335"); // capital Y, acute accent
- m_entityDecodeMap["OElig"] = encodeWithCurrentCodec ("\338"); // capital Y, acute accent
- m_entityDecodeMap["oelig"] = encodeWithCurrentCodec ("\339"); // capital Y, acute accent
+ m_entityDecodeMap[QStringLiteral("AElig")] = encodeWithCurrentCodec ("\306"); // capital AE diphthong (ligature)
+ m_entityDecodeMap[QStringLiteral("Aacute")] = encodeWithCurrentCodec ("\301"); // capital A, acute accent
+ m_entityDecodeMap[QStringLiteral("Acirc")] = encodeWithCurrentCodec ("\302"); // capital A, circumflex accent
+ m_entityDecodeMap[QStringLiteral("Agrave")] = encodeWithCurrentCodec ("\300"); // capital A, grave accent
+ m_entityDecodeMap[QStringLiteral("Aring")] = encodeWithCurrentCodec ("\305"); // capital A, ring
+ m_entityDecodeMap[QStringLiteral("Atilde")] = encodeWithCurrentCodec ("\303"); // capital A, tilde
+ m_entityDecodeMap[QStringLiteral("Auml")] = encodeWithCurrentCodec ("\304"); // capital A, dieresis or umlaut mark
+ m_entityDecodeMap[QStringLiteral("Ccedil")] = encodeWithCurrentCodec ("\307"); // capital C, cedilla
+ m_entityDecodeMap[QStringLiteral("Dstrok")] = encodeWithCurrentCodec ("\320"); // whatever
+ m_entityDecodeMap[QStringLiteral("ETH")] = encodeWithCurrentCodec ("\320"); // capital Eth, Icelandic
+ m_entityDecodeMap[QStringLiteral("Eacute")] = encodeWithCurrentCodec ("\311"); // capital E, acute accent
+ m_entityDecodeMap[QStringLiteral("Ecirc")] = encodeWithCurrentCodec ("\312"); // capital E, circumflex accent
+ m_entityDecodeMap[QStringLiteral("Egrave")] = encodeWithCurrentCodec ("\310"); // capital E, grave accent
+ m_entityDecodeMap[QStringLiteral("Euml")] = encodeWithCurrentCodec ("\313"); // capital E, dieresis or umlaut mark
+ m_entityDecodeMap[QStringLiteral("Iacute")] = encodeWithCurrentCodec ("\315"); // capital I, acute accent
+ m_entityDecodeMap[QStringLiteral("Icirc")] = encodeWithCurrentCodec ("\316"); // capital I, circumflex accent
+ m_entityDecodeMap[QStringLiteral("Igrave")] = encodeWithCurrentCodec ("\314"); // capital I, grave accent
+ m_entityDecodeMap[QStringLiteral("Iuml")] = encodeWithCurrentCodec ("\317"); // capital I, dieresis or umlaut mark
+ m_entityDecodeMap[QStringLiteral("Ntilde")] = encodeWithCurrentCodec ("\321"); // capital N, tilde
+ m_entityDecodeMap[QStringLiteral("Oacute")] = encodeWithCurrentCodec ("\323"); // capital O, acute accent
+ m_entityDecodeMap[QStringLiteral("Ocirc")] = encodeWithCurrentCodec ("\324"); // capital O, circumflex accent
+ m_entityDecodeMap[QStringLiteral("Ograve")] = encodeWithCurrentCodec ("\322"); // capital O, grave accent
+ m_entityDecodeMap[QStringLiteral("Oslash")] = encodeWithCurrentCodec ("\330"); // capital O, slash
+ m_entityDecodeMap[QStringLiteral("Otilde")] = encodeWithCurrentCodec ("\325"); // capital O, tilde
+ m_entityDecodeMap[QStringLiteral("Ouml")] = encodeWithCurrentCodec ("\326"); // capital O, dieresis or umlaut mark
+ m_entityDecodeMap[QStringLiteral("THORN")] = encodeWithCurrentCodec ("\336"); // capital THORN, Icelandic
+ m_entityDecodeMap[QStringLiteral("Uacute")] = encodeWithCurrentCodec ("\332"); // capital U, acute accent
+ m_entityDecodeMap[QStringLiteral("Ucirc")] = encodeWithCurrentCodec ("\333"); // capital U, circumflex accent
+ m_entityDecodeMap[QStringLiteral("Ugrave")] = encodeWithCurrentCodec ("\331"); // capital U, grave accent
+ m_entityDecodeMap[QStringLiteral("Uuml")] = encodeWithCurrentCodec ("\334"); // capital U, dieresis or umlaut mark
+ m_entityDecodeMap[QStringLiteral("Yacute")] = encodeWithCurrentCodec ("\335"); // capital Y, acute accent
+ m_entityDecodeMap[QStringLiteral("OElig")] = encodeWithCurrentCodec ("\338"); // capital Y, acute accent
+ m_entityDecodeMap[QStringLiteral("oelig")] = encodeWithCurrentCodec ("\339"); // capital Y, acute accent
- m_entityDecodeMap["aacute"] = encodeWithCurrentCodec ("\341"); // small a, acute accent
- m_entityDecodeMap["acirc"] = encodeWithCurrentCodec ("\342"); // small a, circumflex accent
- m_entityDecodeMap["aelig"] = encodeWithCurrentCodec ("\346"); // small ae diphthong (ligature)
- m_entityDecodeMap["agrave"] = encodeWithCurrentCodec ("\340"); // small a, grave accent
- m_entityDecodeMap["aring"] = encodeWithCurrentCodec ("\345"); // small a, ring
- m_entityDecodeMap["atilde"] = encodeWithCurrentCodec ("\343"); // small a, tilde
- m_entityDecodeMap["auml"] = encodeWithCurrentCodec ("\344"); // small a, dieresis or umlaut mark
- m_entityDecodeMap["ccedil"] = encodeWithCurrentCodec ("\347"); // small c, cedilla
- m_entityDecodeMap["eacute"] = encodeWithCurrentCodec ("\351"); // small e, acute accent
- m_entityDecodeMap["ecirc"] = encodeWithCurrentCodec ("\352"); // small e, circumflex accent
- m_entityDecodeMap["Scaron"] = encodeWithCurrentCodec ("\352"); // small e, circumflex accent
- m_entityDecodeMap["egrave"] = encodeWithCurrentCodec ("\350"); // small e, grave accent
- m_entityDecodeMap["eth"] = encodeWithCurrentCodec ("\360"); // small eth, Icelandic
- m_entityDecodeMap["euml"] = encodeWithCurrentCodec ("\353"); // small e, dieresis or umlaut mark
- m_entityDecodeMap["iacute"] = encodeWithCurrentCodec ("\355"); // small i, acute accent
- m_entityDecodeMap["icirc"] = encodeWithCurrentCodec ("\356"); // small i, circumflex accent
- m_entityDecodeMap["igrave"] = encodeWithCurrentCodec ("\354"); // small i, grave accent
- m_entityDecodeMap["iuml"] = encodeWithCurrentCodec ("\357"); // small i, dieresis or umlaut mark
- m_entityDecodeMap["ntilde"] = encodeWithCurrentCodec ("\361"); // small n, tilde
- m_entityDecodeMap["oacute"] = encodeWithCurrentCodec ("\363"); // small o, acute accent
- m_entityDecodeMap["ocirc"] = encodeWithCurrentCodec ("\364"); // small o, circumflex accent
- m_entityDecodeMap["ograve"] = encodeWithCurrentCodec ("\362"); // small o, grave accent
- m_entityDecodeMap["oslash"] = encodeWithCurrentCodec ("\370"); // small o, slash
- m_entityDecodeMap["otilde"] = encodeWithCurrentCodec ("\365"); // small o, tilde
- m_entityDecodeMap["ouml"] = encodeWithCurrentCodec ("\366"); // small o, dieresis or umlaut mark
- m_entityDecodeMap["szlig"] = encodeWithCurrentCodec ("\337"); // small sharp s, German (sz ligature)
- m_entityDecodeMap["thorn"] = encodeWithCurrentCodec ("\376"); // small thorn, Icelandic
- m_entityDecodeMap["uacute"] = encodeWithCurrentCodec ("\372"); // small u, acute accent
- m_entityDecodeMap["ucirc"] = encodeWithCurrentCodec ("\373"); // small u, circumflex accent
- m_entityDecodeMap["ugrave"] = encodeWithCurrentCodec ("\371"); // small u, grave accent
- m_entityDecodeMap["uuml"] = encodeWithCurrentCodec ("\374"); // small u, dieresis or umlaut mark
- m_entityDecodeMap["yacute"] = encodeWithCurrentCodec ("\375"); // small y, acute accent
- m_entityDecodeMap["yuml"] = encodeWithCurrentCodec ("\377"); // small y, dieresis or umlaut mark
+ m_entityDecodeMap[QStringLiteral("aacute")] = encodeWithCurrentCodec ("\341"); // small a, acute accent
+ m_entityDecodeMap[QStringLiteral("acirc")] = encodeWithCurrentCodec ("\342"); // small a, circumflex accent
+ m_entityDecodeMap[QStringLiteral("aelig")] = encodeWithCurrentCodec ("\346"); // small ae diphthong (ligature)
+ m_entityDecodeMap[QStringLiteral("agrave")] = encodeWithCurrentCodec ("\340"); // small a, grave accent
+ m_entityDecodeMap[QStringLiteral("aring")] = encodeWithCurrentCodec ("\345"); // small a, ring
+ m_entityDecodeMap[QStringLiteral("atilde")] = encodeWithCurrentCodec ("\343"); // small a, tilde
+ m_entityDecodeMap[QStringLiteral("auml")] = encodeWithCurrentCodec ("\344"); // small a, dieresis or umlaut mark
+ m_entityDecodeMap[QStringLiteral("ccedil")] = encodeWithCurrentCodec ("\347"); // small c, cedilla
+ m_entityDecodeMap[QStringLiteral("eacute")] = encodeWithCurrentCodec ("\351"); // small e, acute accent
+ m_entityDecodeMap[QStringLiteral("ecirc")] = encodeWithCurrentCodec ("\352"); // small e, circumflex accent
+ m_entityDecodeMap[QStringLiteral("Scaron")] = encodeWithCurrentCodec ("\352"); // small e, circumflex accent
+ m_entityDecodeMap[QStringLiteral("egrave")] = encodeWithCurrentCodec ("\350"); // small e, grave accent
+ m_entityDecodeMap[QStringLiteral("eth")] = encodeWithCurrentCodec ("\360"); // small eth, Icelandic
+ m_entityDecodeMap[QStringLiteral("euml")] = encodeWithCurrentCodec ("\353"); // small e, dieresis or umlaut mark
+ m_entityDecodeMap[QStringLiteral("iacute")] = encodeWithCurrentCodec ("\355"); // small i, acute accent
+ m_entityDecodeMap[QStringLiteral("icirc")] = encodeWithCurrentCodec ("\356"); // small i, circumflex accent
+ m_entityDecodeMap[QStringLiteral("igrave")] = encodeWithCurrentCodec ("\354"); // small i, grave accent
+ m_entityDecodeMap[QStringLiteral("iuml")] = encodeWithCurrentCodec ("\357"); // small i, dieresis or umlaut mark
+ m_entityDecodeMap[QStringLiteral("ntilde")] = encodeWithCurrentCodec ("\361"); // small n, tilde
+ m_entityDecodeMap[QStringLiteral("oacute")] = encodeWithCurrentCodec ("\363"); // small o, acute accent
+ m_entityDecodeMap[QStringLiteral("ocirc")] = encodeWithCurrentCodec ("\364"); // small o, circumflex accent
+ m_entityDecodeMap[QStringLiteral("ograve")] = encodeWithCurrentCodec ("\362"); // small o, grave accent
+ m_entityDecodeMap[QStringLiteral("oslash")] = encodeWithCurrentCodec ("\370"); // small o, slash
+ m_entityDecodeMap[QStringLiteral("otilde")] = encodeWithCurrentCodec ("\365"); // small o, tilde
+ m_entityDecodeMap[QStringLiteral("ouml")] = encodeWithCurrentCodec ("\366"); // small o, dieresis or umlaut mark
+ m_entityDecodeMap[QStringLiteral("szlig")] = encodeWithCurrentCodec ("\337"); // small sharp s, German (sz ligature)
+ m_entityDecodeMap[QStringLiteral("thorn")] = encodeWithCurrentCodec ("\376"); // small thorn, Icelandic
+ m_entityDecodeMap[QStringLiteral("uacute")] = encodeWithCurrentCodec ("\372"); // small u, acute accent
+ m_entityDecodeMap[QStringLiteral("ucirc")] = encodeWithCurrentCodec ("\373"); // small u, circumflex accent
+ m_entityDecodeMap[QStringLiteral("ugrave")] = encodeWithCurrentCodec ("\371"); // small u, grave accent
+ m_entityDecodeMap[QStringLiteral("uuml")] = encodeWithCurrentCodec ("\374"); // small u, dieresis or umlaut mark
+ m_entityDecodeMap[QStringLiteral("yacute")] = encodeWithCurrentCodec ("\375"); // small y, acute accent
+ m_entityDecodeMap[QStringLiteral("yuml")] = encodeWithCurrentCodec ("\377"); // small y, dieresis or umlaut mark
- m_entityDecodeMap["iexcl"] = encodeWithCurrentCodec ("\241");
- m_entityDecodeMap["cent"] = encodeWithCurrentCodec ("\242");
- m_entityDecodeMap["pound"] = encodeWithCurrentCodec ("\243");
- m_entityDecodeMap["curren"] = encodeWithCurrentCodec ("\244");
- m_entityDecodeMap["yen"] = encodeWithCurrentCodec ("\245");
- m_entityDecodeMap["brvbar"] = encodeWithCurrentCodec ("\246");
- m_entityDecodeMap["sect"] = encodeWithCurrentCodec ("\247");
- m_entityDecodeMap["uml"] = encodeWithCurrentCodec ("\250");
- m_entityDecodeMap["ordf"] = encodeWithCurrentCodec ("\252");
- m_entityDecodeMap["laquo"] = encodeWithCurrentCodec ("\253");
- m_entityDecodeMap["not"] = encodeWithCurrentCodec ("\254");
- m_entityDecodeMap["shy"] = encodeWithCurrentCodec ("\255");
- m_entityDecodeMap["macr"] = encodeWithCurrentCodec ("\257");
- m_entityDecodeMap["deg"] = encodeWithCurrentCodec ("\260");
- m_entityDecodeMap["plusmn"] = encodeWithCurrentCodec ("\261");
- m_entityDecodeMap["sup1"] = encodeWithCurrentCodec ("\271");
- m_entityDecodeMap["sup2"] = encodeWithCurrentCodec ("\262");
- m_entityDecodeMap["sup3"] = encodeWithCurrentCodec ("\263");
- m_entityDecodeMap["acute"] = encodeWithCurrentCodec ("\264");
- m_entityDecodeMap["micro"] = encodeWithCurrentCodec ("\265");
- m_entityDecodeMap["para"] = encodeWithCurrentCodec ("\266");
- m_entityDecodeMap["middot"] = encodeWithCurrentCodec ("\267");
- m_entityDecodeMap["cedil"] = encodeWithCurrentCodec ("\270");
- m_entityDecodeMap["ordm"] = encodeWithCurrentCodec ("\272");
- m_entityDecodeMap["raquo"] = encodeWithCurrentCodec ("\273");
- m_entityDecodeMap["frac14"] = encodeWithCurrentCodec ("\274");
- m_entityDecodeMap["frac12"] = encodeWithCurrentCodec ("\275");
- m_entityDecodeMap["frac34"] = encodeWithCurrentCodec ("\276");
- m_entityDecodeMap["iquest"] = encodeWithCurrentCodec ("\277");
- m_entityDecodeMap["times"] = encodeWithCurrentCodec ("\327");
- m_entityDecodeMap["divide"] = encodeWithCurrentCodec ("\367");
+ m_entityDecodeMap[QStringLiteral("iexcl")] = encodeWithCurrentCodec ("\241");
+ m_entityDecodeMap[QStringLiteral("cent")] = encodeWithCurrentCodec ("\242");
+ m_entityDecodeMap[QStringLiteral("pound")] = encodeWithCurrentCodec ("\243");
+ m_entityDecodeMap[QStringLiteral("curren")] = encodeWithCurrentCodec ("\244");
+ m_entityDecodeMap[QStringLiteral("yen")] = encodeWithCurrentCodec ("\245");
+ m_entityDecodeMap[QStringLiteral("brvbar")] = encodeWithCurrentCodec ("\246");
+ m_entityDecodeMap[QStringLiteral("sect")] = encodeWithCurrentCodec ("\247");
+ m_entityDecodeMap[QStringLiteral("uml")] = encodeWithCurrentCodec ("\250");
+ m_entityDecodeMap[QStringLiteral("ordf")] = encodeWithCurrentCodec ("\252");
+ m_entityDecodeMap[QStringLiteral("laquo")] = encodeWithCurrentCodec ("\253");
+ m_entityDecodeMap[QStringLiteral("not")] = encodeWithCurrentCodec ("\254");
+ m_entityDecodeMap[QStringLiteral("shy")] = encodeWithCurrentCodec ("\255");
+ m_entityDecodeMap[QStringLiteral("macr")] = encodeWithCurrentCodec ("\257");
+ m_entityDecodeMap[QStringLiteral("deg")] = encodeWithCurrentCodec ("\260");
+ m_entityDecodeMap[QStringLiteral("plusmn")] = encodeWithCurrentCodec ("\261");
+ m_entityDecodeMap[QStringLiteral("sup1")] = encodeWithCurrentCodec ("\271");
+ m_entityDecodeMap[QStringLiteral("sup2")] = encodeWithCurrentCodec ("\262");
+ m_entityDecodeMap[QStringLiteral("sup3")] = encodeWithCurrentCodec ("\263");
+ m_entityDecodeMap[QStringLiteral("acute")] = encodeWithCurrentCodec ("\264");
+ m_entityDecodeMap[QStringLiteral("micro")] = encodeWithCurrentCodec ("\265");
+ m_entityDecodeMap[QStringLiteral("para")] = encodeWithCurrentCodec ("\266");
+ m_entityDecodeMap[QStringLiteral("middot")] = encodeWithCurrentCodec ("\267");
+ m_entityDecodeMap[QStringLiteral("cedil")] = encodeWithCurrentCodec ("\270");
+ m_entityDecodeMap[QStringLiteral("ordm")] = encodeWithCurrentCodec ("\272");
+ m_entityDecodeMap[QStringLiteral("raquo")] = encodeWithCurrentCodec ("\273");
+ m_entityDecodeMap[QStringLiteral("frac14")] = encodeWithCurrentCodec ("\274");
+ m_entityDecodeMap[QStringLiteral("frac12")] = encodeWithCurrentCodec ("\275");
+ m_entityDecodeMap[QStringLiteral("frac34")] = encodeWithCurrentCodec ("\276");
+ m_entityDecodeMap[QStringLiteral("iquest")] = encodeWithCurrentCodec ("\277");
+ m_entityDecodeMap[QStringLiteral("times")] = encodeWithCurrentCodec ("\327");
+ m_entityDecodeMap[QStringLiteral("divide")] = encodeWithCurrentCodec ("\367");
- m_entityDecodeMap["copy"] = encodeWithCurrentCodec ("\251"); // copyright sign
- m_entityDecodeMap["reg"] = encodeWithCurrentCodec ("\256"); // registered sign
- m_entityDecodeMap["nbsp"] = encodeWithCurrentCodec ("\240"); // non breaking space
+ m_entityDecodeMap[QStringLiteral("copy")] = encodeWithCurrentCodec ("\251"); // copyright sign
+ m_entityDecodeMap[QStringLiteral("reg")] = encodeWithCurrentCodec ("\256"); // registered sign
+ m_entityDecodeMap[QStringLiteral("nbsp")] = encodeWithCurrentCodec ("\240"); // non breaking space
- m_entityDecodeMap["fnof"] = QChar((unsigned short) 402);
+ m_entityDecodeMap[QStringLiteral("fnof")] = QChar((unsigned short) 402);
- m_entityDecodeMap["Delta"] = QChar((unsigned short) 916);
- m_entityDecodeMap["Pi"] = QChar((unsigned short) 928);
- m_entityDecodeMap["Sigma"] = QChar((unsigned short) 931);
+ m_entityDecodeMap[QStringLiteral("Delta")] = QChar((unsigned short) 916);
+ m_entityDecodeMap[QStringLiteral("Pi")] = QChar((unsigned short) 928);
+ m_entityDecodeMap[QStringLiteral("Sigma")] = QChar((unsigned short) 931);
- m_entityDecodeMap["beta"] = QChar((unsigned short) 946);
- m_entityDecodeMap["gamma"] = QChar((unsigned short) 947);
- m_entityDecodeMap["delta"] = QChar((unsigned short) 948);
- m_entityDecodeMap["eta"] = QChar((unsigned short) 951);
- m_entityDecodeMap["theta"] = QChar((unsigned short) 952);
- m_entityDecodeMap["lambda"] = QChar((unsigned short) 955);
- m_entityDecodeMap["mu"] = QChar((unsigned short) 956);
- m_entityDecodeMap["nu"] = QChar((unsigned short) 957);
- m_entityDecodeMap["pi"] = QChar((unsigned short) 960);
- m_entityDecodeMap["rho"] = QChar((unsigned short) 961);
+ m_entityDecodeMap[QStringLiteral("beta")] = QChar((unsigned short) 946);
+ m_entityDecodeMap[QStringLiteral("gamma")] = QChar((unsigned short) 947);
+ m_entityDecodeMap[QStringLiteral("delta")] = QChar((unsigned short) 948);
+ m_entityDecodeMap[QStringLiteral("eta")] = QChar((unsigned short) 951);
+ m_entityDecodeMap[QStringLiteral("theta")] = QChar((unsigned short) 952);
+ m_entityDecodeMap[QStringLiteral("lambda")] = QChar((unsigned short) 955);
+ m_entityDecodeMap[QStringLiteral("mu")] = QChar((unsigned short) 956);
+ m_entityDecodeMap[QStringLiteral("nu")] = QChar((unsigned short) 957);
+ m_entityDecodeMap[QStringLiteral("pi")] = QChar((unsigned short) 960);
+ m_entityDecodeMap[QStringLiteral("rho")] = QChar((unsigned short) 961);
- m_entityDecodeMap["lsquo"] = QChar((unsigned short) 8216);
- m_entityDecodeMap["rsquo"] = QChar((unsigned short) 8217);
- m_entityDecodeMap["rdquo"] = QChar((unsigned short) 8221);
- m_entityDecodeMap["bdquo"] = QChar((unsigned short) 8222);
- m_entityDecodeMap["trade"] = QChar((unsigned short) 8482);
- m_entityDecodeMap["ldquo"] = QChar((unsigned short) 8220);
- m_entityDecodeMap["ndash"] = QChar((unsigned short) 8211);
- m_entityDecodeMap["mdash"] = QChar((unsigned short) 8212);
- m_entityDecodeMap["bull"] = QChar((unsigned short) 8226);
- m_entityDecodeMap["hellip"] = QChar((unsigned short) 8230);
- m_entityDecodeMap["emsp"] = QChar((unsigned short) 8195);
- m_entityDecodeMap["rarr"] = QChar((unsigned short) 8594);
- m_entityDecodeMap["rArr"] = QChar((unsigned short) 8658);
- m_entityDecodeMap["crarr"] = QChar((unsigned short) 8629);
- m_entityDecodeMap["le"] = QChar((unsigned short) 8804);
- m_entityDecodeMap["ge"] = QChar((unsigned short) 8805);
- m_entityDecodeMap["lte"] = QChar((unsigned short) 8804); // wrong, but used somewhere
- m_entityDecodeMap["gte"] = QChar((unsigned short) 8805); // wrong, but used somewhere
- m_entityDecodeMap["dagger"] = QChar((unsigned short) 8224);
- m_entityDecodeMap["Dagger"] = QChar((unsigned short) 8225);
- m_entityDecodeMap["euro"] = QChar((unsigned short) 8364);
- m_entityDecodeMap["asymp"] = QChar((unsigned short) 8776);
- m_entityDecodeMap["isin"] = QChar((unsigned short) 8712);
- m_entityDecodeMap["notin"] = QChar((unsigned short) 8713);
- m_entityDecodeMap["prod"] = QChar((unsigned short) 8719);
- m_entityDecodeMap["ne"] = QChar((unsigned short) 8800);
+ m_entityDecodeMap[QStringLiteral("lsquo")] = QChar((unsigned short) 8216);
+ m_entityDecodeMap[QStringLiteral("rsquo")] = QChar((unsigned short) 8217);
+ m_entityDecodeMap[QStringLiteral("rdquo")] = QChar((unsigned short) 8221);
+ m_entityDecodeMap[QStringLiteral("bdquo")] = QChar((unsigned short) 8222);
+ m_entityDecodeMap[QStringLiteral("trade")] = QChar((unsigned short) 8482);
+ m_entityDecodeMap[QStringLiteral("ldquo")] = QChar((unsigned short) 8220);
+ m_entityDecodeMap[QStringLiteral("ndash")] = QChar((unsigned short) 8211);
+ m_entityDecodeMap[QStringLiteral("mdash")] = QChar((unsigned short) 8212);
+ m_entityDecodeMap[QStringLiteral("bull")] = QChar((unsigned short) 8226);
+ m_entityDecodeMap[QStringLiteral("hellip")] = QChar((unsigned short) 8230);
+ m_entityDecodeMap[QStringLiteral("emsp")] = QChar((unsigned short) 8195);
+ m_entityDecodeMap[QStringLiteral("rarr")] = QChar((unsigned short) 8594);
+ m_entityDecodeMap[QStringLiteral("rArr")] = QChar((unsigned short) 8658);
+ m_entityDecodeMap[QStringLiteral("crarr")] = QChar((unsigned short) 8629);
+ m_entityDecodeMap[QStringLiteral("le")] = QChar((unsigned short) 8804);
+ m_entityDecodeMap[QStringLiteral("ge")] = QChar((unsigned short) 8805);
+ m_entityDecodeMap[QStringLiteral("lte")] = QChar((unsigned short) 8804); // wrong, but used somewhere
+ m_entityDecodeMap[QStringLiteral("gte")] = QChar((unsigned short) 8805); // wrong, but used somewhere
+ m_entityDecodeMap[QStringLiteral("dagger")] = QChar((unsigned short) 8224);
+ m_entityDecodeMap[QStringLiteral("Dagger")] = QChar((unsigned short) 8225);
+ m_entityDecodeMap[QStringLiteral("euro")] = QChar((unsigned short) 8364);
+ m_entityDecodeMap[QStringLiteral("asymp")] = QChar((unsigned short) 8776);
+ m_entityDecodeMap[QStringLiteral("isin")] = QChar((unsigned short) 8712);
+ m_entityDecodeMap[QStringLiteral("notin")] = QChar((unsigned short) 8713);
+ m_entityDecodeMap[QStringLiteral("prod")] = QChar((unsigned short) 8719);
+ m_entityDecodeMap[QStringLiteral("ne")] = QChar((unsigned short) 8800);
- m_entityDecodeMap["amp"] = "&"; // ampersand
- m_entityDecodeMap["gt"] = ">"; // greater than
- m_entityDecodeMap["lt"] = "<"; // less than
- m_entityDecodeMap["quot"] = "\""; // double quote
- m_entityDecodeMap["apos"] = "'"; // single quote
- m_entityDecodeMap["frasl"] = "/";
- m_entityDecodeMap["minus"] = "-";
- m_entityDecodeMap["oplus"] = "+";
- m_entityDecodeMap["Prime"] = "\"";
+ m_entityDecodeMap[QStringLiteral("amp")] = QStringLiteral("&"); // ampersand
+ m_entityDecodeMap[QStringLiteral("gt")] = QStringLiteral(">"); // greater than
+ m_entityDecodeMap[QStringLiteral("lt")] = QStringLiteral("<"); // less than
+ m_entityDecodeMap[QStringLiteral("quot")] = QStringLiteral("\""); // double quote
+ m_entityDecodeMap[QStringLiteral("apos")] = QStringLiteral("'"); // single quote
+ m_entityDecodeMap[QStringLiteral("frasl")] = QStringLiteral("/");
+ m_entityDecodeMap[QStringLiteral("minus")] = QStringLiteral("-");
+ m_entityDecodeMap[QStringLiteral("oplus")] = QStringLiteral("+");
+ m_entityDecodeMap[QStringLiteral("Prime")] = QStringLiteral("\"");
}
// If entity is an ASCII code like &#12349; - just decode it
if ( entity[0] == '#' )
{
bool valid;
- unsigned int ascode = entity.mid(1).toUInt( &valid );
+ unsigned int ascode = entity.midRef(1).toUInt( &valid );
if ( !valid )
{
@@ -687,7 +687,7 @@ bool LCHMFileImpl::getInfoFromWindows()
chmUnitInfo ui;
long size = 0;
- if ( ResolveObject("/#WINDOWS", &ui) )
+ if ( ResolveObject(QStringLiteral("/#WINDOWS"), &ui) )
{
if ( !RetrieveObject(&ui, buffer, 0, WIN_HEADER_LEN) )
return false;
@@ -701,7 +701,7 @@ bool LCHMFileImpl::getInfoFromWindows()
if ( !RetrieveObject (&ui, raw, 8, entries * entry_size) )
return false;
- if( !ResolveObject ("/#STRINGS", &ui) )
+ if( !ResolveObject (QStringLiteral("/#STRINGS"), &ui) )
return false;
for ( uint32_t i = 0; i < entries; ++i )
@@ -766,7 +766,7 @@ bool LCHMFileImpl::getInfoFromSystem()
// Run the first loop to detect the encoding. We need this, because title could be
// already encoded in user encoding. Same for file names
- if ( !ResolveObject ("/#SYSTEM", &ui) )
+ if ( !ResolveObject (QStringLiteral("/#SYSTEM"), &ui) )
return false;
// Can we pull BUFF_SIZE bytes of the #SYSTEM file?
@@ -829,7 +829,7 @@ bool LCHMFileImpl::getInfoFromSystem()
if ( m_topicsFile.isEmpty() )
{
- QString topicAttempt = "/", tmp;
+ QString topicAttempt = QStringLiteral("/"), tmp;
topicAttempt += QString ((const char*) buffer +index +2);
tmp = topicAttempt + ".hhc";
@@ -1006,9 +1006,9 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QVector< LCHMPar
//qDebug ("tag: '%s', tagword: '%s'\n", qPrintable( tag ), qPrintable( tagword ) );
// <OBJECT type="text/sitemap"> - a topic entry
- if ( tagword == "object" && tag.indexOf ("text/sitemap", 0, Qt::CaseInsensitive ) != -1 )
+ if ( tagword == QLatin1String("object") && tag.indexOf (QStringLiteral("text/sitemap"), 0, Qt::CaseInsensitive ) != -1 )
in_object = true;
- else if ( tagword == "/object" && in_object )
+ else if ( tagword == QLatin1String("/object") && in_object )
{
// a topic entry closed. Add a tree item
if ( !entry.name.isEmpty() )
@@ -1043,11 +1043,11 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QVector< LCHMPar
entry.imageid = defaultimagenum;
in_object = false;
}
- else if ( tagword == "param" && in_object )
+ else if ( tagword == QLatin1String("param") && in_object )
{
// <param name="Name" value="First Page">
int offset; // strlen("param ")
- QString name_pattern = "name=", value_pattern = "value=";
+ QString name_pattern = QStringLiteral("name="), value_pattern = QStringLiteral("value=");
QString pname, pvalue;
if ( (offset = tag.indexOf (name_pattern, 0, Qt::CaseInsensitive )) == -1 )
@@ -1065,13 +1065,13 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QVector< LCHMPar
//qDebug ("<param>: name '%s', value '%s'", qPrintable( pname ), qPrintable( pvalue ));
- if ( pname == "name" )
+ if ( pname == QLatin1String("name") )
{
// Some help files contain duplicate names, where the second name is empty. Work it around by keeping the first one
if ( !pvalue.isEmpty() )
entry.name = pvalue;
}
- else if ( pname == "local" )
+ else if ( pname == QLatin1String("local") )
{
// Check for URL duplication
QString url = LCHMUrlFactory::makeURLabsoluteIfNeeded( pvalue );
@@ -1079,9 +1079,9 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QVector< LCHMPar
if ( !entry.urls.contains( url ) )
entry.urls.push_back( url );
}
- else if ( pname == "see also" && asIndex && entry.name != pvalue )
+ else if ( pname == QLatin1String("see also") && asIndex && entry.name != pvalue )
entry.urls.push_back (":" + pvalue);
- else if ( pname == "imagenumber" )
+ else if ( pname == QLatin1String("imagenumber") )
{
bool bok;
int imgnum = pvalue.toInt (&bok);
@@ -1090,7 +1090,7 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QVector< LCHMPar
entry.imageid = imgnum;
}
}
- else if ( tagword == "ul" ) // increase indent level
+ else if ( tagword == QLatin1String("ul") ) // increase indent level
{
// Fix for buggy help files
if ( ++indent >= MAX_NEST_DEPTH )
@@ -1099,7 +1099,7 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QVector< LCHMPar
// This intended to fix <ul><ul>, which was seen in some buggy chm files,
// and brokes rootentry[indent-1] check
}
- else if ( tagword == "/ul" ) // decrease indent level
+ else if ( tagword == QLatin1String("/ul") ) // decrease indent level
{
if ( --indent < root_indent_offset )
indent = root_indent_offset;
@@ -1271,7 +1271,7 @@ void LCHMFileImpl::fillTopicsUrlMap()
if ( off_title < (uint32_t)strings.size() )
m_url2topics[url] = encodeWithCurrentCodec ( (const char*) strings.data() + off_title );
else
- m_url2topics[url] = "Untitled";
+ m_url2topics[url] = QStringLiteral("Untitled");
}
}
diff --git a/generators/chm/lib/libchmurlfactory.h b/generators/chm/lib/libchmurlfactory.h
index 8681098..59ddaa4 100644
--- a/generators/chm/lib/libchmurlfactory.h
+++ b/generators/chm/lib/libchmurlfactory.h
@@ -29,13 +29,13 @@ namespace LCHMUrlFactory
static inline bool isRemoteURL( const QString & url, QString & protocol )
{
// Check whether the URL is external
- QRegExp uriregex ( "^(\\w+):\\/\\/" );
- QRegExp mailtoregex ( "^(mailto):" );
+ QRegExp uriregex ( QStringLiteral("^(\\w+):\\/\\/") );
+ QRegExp mailtoregex ( QStringLiteral("^(mailto):") );
// mailto: can also have different format, so handle it
- if ( url.startsWith( "mailto:" ) )
+ if ( url.startsWith( QLatin1String("mailto:") ) )
{
- protocol = "mailto";
+ protocol = QStringLiteral("mailto");
return true;
}
else if ( uriregex.indexIn( url ) != -1 )
@@ -43,10 +43,10 @@ static inline bool isRemoteURL( const QString & url, QString & protocol )
QString proto = uriregex.cap ( 1 ).toLower();
// Filter the URLs which need to be opened by a browser
- if ( proto == "http"
- || proto == "ftp"
- || proto == "mailto"
- || proto == "news" )
+ if ( proto == QLatin1String("http")
+ || proto == QLatin1String("ftp")
+ || proto == QLatin1String("mailto")
+ || proto == QLatin1String("news") )
{
protocol = proto;
return true;
@@ -59,13 +59,13 @@ static inline bool isRemoteURL( const QString & url, QString & protocol )
// Some JS urls start with javascript://
static inline bool isJavascriptURL( const QString & url )
{
- return url.startsWith ("javascript://");
+ return url.startsWith (QLatin1String("javascript://"));
}
// Parse urls like "ms-its:file name.chm::/topic.htm"
static inline bool isNewChmURL( const QString & url, QString & chmfile, QString & page )
{
- QRegExp uriregex ( "^ms-its:(.*)::(.*)$" );
+ QRegExp uriregex ( QStringLiteral("^ms-its:(.*)::(.*)$") );
uriregex.setCaseSensitivity( Qt::CaseInsensitive );
if ( uriregex.indexIn ( url ) != -1 )
@@ -103,7 +103,7 @@ static inline QString makeURLabsoluteIfNeeded( const QString & url )
// to regognize our own internal urls, which is necessary to show image-only pages.
static inline QString getInternalUriExtension()
{
- return ".KCHMVIEWER_SPECIAL_HANDLER";
+ return QStringLiteral(".KCHMVIEWER_SPECIAL_HANDLER");
}
diff --git a/generators/comicbook/document.cpp b/generators/comicbook/document.cpp
index 8e27717..ff54f33 100644
--- a/generators/comicbook/document.cpp
+++ b/generators/comicbook/document.cpp
@@ -62,7 +62,7 @@ bool Document::open( const QString &fileName )
/**
* We have a zip archive
*/
- if ( mime.inherits("application/x-cbz" ) || mime.inherits( "application/zip" ) ) {
+ if ( mime.inherits(QStringLiteral("application/x-cbz") ) || mime.inherits( QStringLiteral("application/zip") ) ) {
mArchive = new KZip( fileName );
if ( !processArchive() ) {
@@ -71,14 +71,14 @@ bool Document::open( const QString &fileName )
/**
* We have a TAR archive
*/
- } else if ( mime.inherits( "application/x-cbt" ) || mime.inherits( "application/x-gzip" ) ||
- mime.inherits( "application/x-tar" ) || mime.inherits( "application/x-bzip" ) ) {
+ } else if ( mime.inherits( QStringLiteral("application/x-cbt") ) || mime.inherits( QStringLiteral("application/x-gzip") ) ||
+ mime.inherits( QStringLiteral("application/x-tar") ) || mime.inherits( QStringLiteral("application/x-bzip") ) ) {
mArchive = new KTar( fileName );
if ( !processArchive() ) {
return false;
}
- } else if ( mime.inherits( "application/x-cbr" ) || mime.inherits( "application/x-rar" ) ) {
+ } else if ( mime.inherits( QStringLiteral("application/x-cbr") ) || mime.inherits( QStringLiteral("application/x-rar") ) ) {
if ( !Unrar::isAvailable() ) {
mLastErrorString = i18n( "Cannot open document, unrar was not found." );
return false;
@@ -102,7 +102,7 @@ bool Document::open( const QString &fileName )
}
mEntries = mUnrar->list();
- } else if ( mime.inherits( "inode/directory" ) ) {
+ } else if ( mime.inherits( QStringLiteral("inode/directory") ) ) {
mDirectory = new Directory();
if ( !mDirectory->open( fileName ) ) {
diff --git a/generators/comicbook/unrar.cpp b/generators/comicbook/unrar.cpp
index 1edabbe..6290919 100644
--- a/generators/comicbook/unrar.cpp
+++ b/generators/comicbook/unrar.cpp
@@ -50,11 +50,11 @@ static UnrarFlavour* detectUnrar( const QString &unrarPath, const QString &versi
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;
@@ -63,17 +63,17 @@ static UnrarFlavour* detectUnrar( const QString &unrarPath, const QString &versi
UnrarHelper::UnrarHelper()
: kind( 0 )
{
- QString path = QStandardPaths::findExecutable( "unrar-nonfree" );
+ QString path = QStandardPaths::findExecutable( QStringLiteral("unrar-nonfree") );
if ( path.isEmpty() )
- path = QStandardPaths::findExecutable( "unrar" );
+ path = QStandardPaths::findExecutable( QStringLiteral("unrar") );
if ( path.isEmpty() )
- path = QStandardPaths::findExecutable( "rar" );
+ path = QStandardPaths::findExecutable( QStringLiteral("rar") );
if ( !path.isEmpty() )
- kind = detectUnrar( path, "--version" );
+ kind = detectUnrar( path, QStringLiteral("--version") );
if ( !kind )
- kind = detectUnrar( path, "-v" );
+ kind = detectUnrar( path, QStringLiteral("-v") );
if ( !kind )
{
@@ -119,7 +119,7 @@ bool Unrar::open( const QString &fileName )
mStdOutData.clear();
mStdErrData.clear();
- int ret = startSyncProcess( QStringList() << "e" << mFileName << mTempDir->path() + '/' );
+ int ret = startSyncProcess( QStringList() << QStringLiteral("e") << mFileName << mTempDir->path() + '/' );
bool ok = ret == 0;
return ok;
@@ -133,7 +133,7 @@ QStringList Unrar::list()
if ( !isSuitableVersionAvailable() )
return QStringList();
- startSyncProcess( QStringList() << "lb" << mFileName );
+ startSyncProcess( QStringList() << QStringLiteral("lb") << mFileName );
const QStringList listFiles = helper->kind->processListing( QString::fromLocal8Bit( mStdOutData ).split( '\n', QString::SkipEmptyParts ) );
QStringList newList;
diff --git a/generators/comicbook/unrarflavours.cpp b/generators/comicbook/unrarflavours.cpp
index 7451321..7119a46 100644
--- a/generators/comicbook/unrarflavours.cpp
+++ b/generators/comicbook/unrarflavours.cpp
@@ -44,7 +44,7 @@ QStringList NonFreeUnrarFlavour::processListing( const QStringList &data )
QString NonFreeUnrarFlavour::name() const
{
- return "unrar-nonfree";
+ return QStringLiteral("unrar-nonfree");
}
@@ -55,7 +55,7 @@ FreeUnrarFlavour::FreeUnrarFlavour()
QStringList FreeUnrarFlavour::processListing( const QStringList &data )
{
- QRegExp re( "^ ([^/]+/([^\\s]+))$" );
+ QRegExp re( QStringLiteral("^ ([^/]+/([^\\s]+))$") );
QStringList newdata;
foreach ( const QString &line, data )
@@ -68,6 +68,6 @@ QStringList FreeUnrarFlavour::processListing( const QStringList &data )
QString FreeUnrarFlavour::name() const
{
- return "unrar-free";
+ return QStringLiteral("unrar-free");
}
diff --git a/generators/djvu/generator_djvu.cpp b/generators/djvu/generator_djvu.cpp
index ccd1a90..740e38c 100644
--- a/generators/djvu/generator_djvu.cpp
+++ b/generators/djvu/generator_djvu.cpp
@@ -39,25 +39,25 @@ static void recurseCreateTOC( QDomDocument &maindoc, const QDomNode &parent, QDo
{
QDomElement el = n.toElement();
- QDomElement newel = maindoc.createElement( el.attribute( "title" ) );
+ QDomElement newel = maindoc.createElement( el.attribute( QStringLiteral("title") ) );
parentDestination.appendChild( newel );
QString dest;
- if ( !( dest = el.attribute( "PageNumber" ) ).isEmpty() )
+ if ( !( dest = el.attribute( QStringLiteral("PageNumber") ) ).isEmpty() )
{
Okular::DocumentViewport vp;
vp.pageNumber = dest.toInt() - 1;
- newel.setAttribute( "Viewport", vp.toString() );
+ newel.setAttribute( QStringLiteral("Viewport"), vp.toString() );
}
- else if ( !( dest = el.attribute( "PageName" ) ).isEmpty() )
+ else if ( !( dest = el.attribute( QStringLiteral("PageName") ) ).isEmpty() )
{
Okular::DocumentViewport vp;
vp.pageNumber = djvu->pageNumber( dest );
- newel.setAttribute( "Viewport", vp.toString() );
+ newel.setAttribute( QStringLiteral("Viewport"), vp.toString() );
}
- else if ( !( dest = el.attribute( "URL" ) ).isEmpty() )
+ else if ( !( dest = el.attribute( QStringLiteral("URL") ) ).isEmpty() )
{
- newel.setAttribute( "URL", dest );
+ newel.setAttribute( QStringLiteral("URL"), dest );
}
if ( el.hasChildNodes() )
@@ -77,7 +77,7 @@ static KAboutData createAboutData()
i18n( "DjVu backend based on DjVuLibre." ),
KAboutLicense::GPL,
i18n( "© 2006-2008 Pino Toscano" ));
- aboutData.addAuthor( i18n( "Pino Toscano" ), QString(), QLatin1String("pino@kde.org") );
+ aboutData.addAuthor( i18n( "Pino Toscano" ), QString(), QStringLiteral("pino@kde.org") );
return aboutData;
}
@@ -139,25 +139,25 @@ Okular::DocumentInfo DjVuGenerator::generateDocumentInfo( const QSet<Okular::Doc
Okular::DocumentInfo docInfo;
if ( keys.contains( Okular::DocumentInfo::MimeType ) )
- docInfo.set( Okular::DocumentInfo::MimeType, "image/vnd.djvu" );
+ docInfo.set( Okular::DocumentInfo::MimeType, QStringLiteral("image/vnd.djvu") );
if ( m_djvu )
{
// compile internal structure reading properties from KDjVu
if ( keys.contains( Okular::DocumentInfo::Author ) )
- docInfo.set( Okular::DocumentInfo::Title, m_djvu->metaData( "title" ).toString() );
+ docInfo.set( Okular::DocumentInfo::Title, m_djvu->metaData( QStringLiteral("title") ).toString() );
if ( keys.contains( Okular::DocumentInfo::Author ) )
- docInfo.set( Okular::DocumentInfo::Author, m_djvu->metaData( "author" ).toString() );
+ docInfo.set( Okular::DocumentInfo::Author, m_djvu->metaData( QStringLiteral("author") ).toString() );
if ( keys.contains( Okular::DocumentInfo::CreationDate ) )
- docInfo.set( Okular::DocumentInfo::CreationDate, m_djvu->metaData( "year" ).toString() );
+ docInfo.set( Okular::DocumentInfo::CreationDate, m_djvu->metaData( QStringLiteral("year") ).toString() );
if ( keys.contains( Okular::DocumentInfo::CustomKeys ) )
{
- docInfo.set( "editor", m_djvu->metaData( "editor" ).toString(), i18n( "Editor" ) );
- docInfo.set( "publisher", m_djvu->metaData( "publisher" ).toString(), i18n( "Publisher" ) );
- docInfo.set( "volume", m_djvu->metaData( "volume" ).toString(), i18n( "Volume" ) );
- docInfo.set( "documentType", m_djvu->metaData( "documentType" ).toString(), i18n( "Type of document" ) );
- QVariant numcomponents = m_djvu->metaData( "componentFile" );
- docInfo.set( "componentFile", numcomponents.type() != QVariant::Int ? i18nc( "Unknown number of component files", "Unknown" ) : numcomponents.toString(), i18n( "Component Files" ) );
+ docInfo.set( QStringLiteral("editor"), m_djvu->metaData( QStringLiteral("editor") ).toString(), i18n( "Editor" ) );
+ docInfo.set( QStringLiteral("publisher"), m_djvu->metaData( QStringLiteral("publisher") ).toString(), i18n( "Publisher" ) );
+ docInfo.set( QStringLiteral("volume"), m_djvu->metaData( QStringLiteral("volume") ).toString(), i18n( "Volume" ) );
+ docInfo.set( QStringLiteral("documentType"), m_djvu->metaData( QStringLiteral("documentType") ).toString(), i18n( "Type of document" ) );
+ QVariant numcomponents = m_djvu->metaData( QStringLiteral("componentFile") );
+ docInfo.set( QStringLiteral("componentFile"), numcomponents.type() != QVariant::Int ? i18nc( "Unknown number of component files", "Unknown" ) : numcomponents.toString(), i18n( "Component Files" ) );
}
}
@@ -213,9 +213,9 @@ bool DjVuGenerator::print( QPrinter& printer )
QVariant DjVuGenerator::metaData( const QString &key, const QVariant &option ) const
{
Q_UNUSED( option )
- if ( key == "DocumentTitle" )
+ if ( key == QLatin1String("DocumentTitle") )
{
- return m_djvu->metaData( "title" );
+ return m_djvu->metaData( QStringLiteral("title") );
}
return QVariant();
}
@@ -228,9 +228,9 @@ Okular::TextPage* DjVuGenerator::textPage( Okular::Page *page )
m_djvu->textEntities( page->number(), "char" );
#endif
if ( te.isEmpty() )
- te = m_djvu->textEntities( page->number(), "word" );
+ te = m_djvu->textEntities( page->number(), QStringLiteral("word") );
if ( te.isEmpty() )
- te = m_djvu->textEntities( page->number(), "line" );
+ te = m_djvu->textEntities( page->number(), QStringLiteral("line") );
userMutex()->unlock();
QList<KDjVu::TextEntity>::ConstIterator it = te.constBegin();
QList<KDjVu::TextEntity>::ConstIterator itEnd = te.constEnd();
diff --git a/generators/djvu/kdjvu.cpp b/generators/djvu/kdjvu.cpp
index 09b5335..3a5b29e 100644
--- a/generators/djvu/kdjvu.cpp
+++ b/generators/djvu/kdjvu.cpp
@@ -517,7 +517,7 @@ void KDjVu::Private::readBookmarks()
miniexp_symbolp( miniexp_nth( 0, outline ) ) &&
( QString::fromUtf8( miniexp_to_name( miniexp_nth( 0, outline ) ) ) == QLatin1String( "bookmarks" ) ) )
{
- m_docBookmarks = new QDomDocument( "KDjVuBookmarks" );
+ m_docBookmarks = new QDomDocument( QStringLiteral("KDjVuBookmarks") );
fillBookmarksRecurse( *m_docBookmarks, *m_docBookmarks, outline, 1 );
ddjvu_miniexp_release( m_djvu_document, outline );
}
@@ -539,8 +539,8 @@ void KDjVu::Private::fillBookmarksRecurse( QDomDocument& maindoc, QDomNode& curn
{
QString title = QString::fromUtf8( miniexp_to_str( miniexp_nth( 0, cur ) ) );
QString dest = QString::fromUtf8( miniexp_to_str( miniexp_nth( 1, cur ) ) );
- QDomElement el = maindoc.createElement( "item" );
- el.setAttribute( "title", title );
+ QDomElement el = maindoc.createElement( QStringLiteral("item") );
+ el.setAttribute( QStringLiteral("title"), title );
if ( !dest.isEmpty() )
{
if ( dest.at( 0 ) == QLatin1Char( '#' ) )
@@ -555,21 +555,21 @@ void KDjVu::Private::fillBookmarksRecurse( QDomDocument& maindoc, QDomNode& curn
int pageNo = pageWithName( dest );
if ( pageNo != -1 )
{
- el.setAttribute( "PageNumber", QString::number( pageNo + 1 ) );
+ el.setAttribute( QStringLiteral("PageNumber"), QString::number( pageNo + 1 ) );
}
else
{
- el.setAttribute( "PageNumber", dest );
+ el.setAttribute( QStringLiteral("PageNumber"), dest );
}
}
else
{
- el.setAttribute( "PageName", dest );
+ el.setAttribute( QStringLiteral("PageName"), dest );
}
}
else
{
- el.setAttribute( "URL", dest );
+ el.setAttribute( QStringLiteral("URL"), dest );
}
}
curnode.appendChild( el );
@@ -710,9 +710,9 @@ bool KDjVu::openFile( const QString & fileName )
break;
}
if ( !doctype.isEmpty() )
- d->m_metaData[ "documentType" ] = doctype;
+ d->m_metaData[ QStringLiteral("documentType") ] = doctype;
// get the number of components
- d->m_metaData[ "componentFile" ] = ddjvu_document_get_filenum( d->m_djvu_document );
+ d->m_metaData[ QStringLiteral("componentFile") ] = ddjvu_document_get_filenum( d->m_djvu_document );
// read the pages
for ( int i = 0; i < numofpages; ++i )
@@ -1057,7 +1057,7 @@ bool KDjVu::exportAsPostScript( QFile* file, const QList<int>& pageList ) const
foreach ( int p, pageList )
{
if ( !pl.isEmpty() )
- pl += QString::fromLatin1( "," );
+ pl += QLatin1String( "," );
pl += QString::number( p );
}
pl.prepend( "-page=" );
diff --git a/generators/dvi/TeXFontDefinition.cpp b/generators/dvi/TeXFontDefinition.cpp
index b560297..1cc1a7e 100644
--- a/generators/dvi/TeXFontDefinition.cpp
+++ b/generators/dvi/TeXFontDefinition.cpp
@@ -115,7 +115,7 @@ void TeXFontDefinition::fontNameReceiver(const QString& fname)
set_char_p = &dviRenderer::set_char;
int magic = two(file);
- if (fname.endsWith("pk"))
+ if (fname.endsWith(QLatin1String("pk")))
if (magic == PK_MAGIC) {
fclose(file);
file = 0;
@@ -127,7 +127,7 @@ void TeXFontDefinition::fontNameReceiver(const QString& fname)
return;
}
- if (fname.endsWith(".vf"))
+ if (fname.endsWith(QLatin1String(".vf")))
if (magic == VF_MAGIC) {
read_VF_index();
set_char_p = &dviRenderer::set_vf_char;
@@ -135,7 +135,7 @@ void TeXFontDefinition::fontNameReceiver(const QString& fname)
return;
}
- if (fname.endsWith(".tfm")) {
+ if (fname.endsWith(QLatin1String(".tfm"))) {
fclose(file);
file = 0;
font = new TeXFont_TFM(this);
diff --git a/generators/dvi/TeXFont_PFB.cpp b/generators/dvi/TeXFont_PFB.cpp
index 8693e21..f5c08b8 100644
--- a/generators/dvi/TeXFont_PFB.cpp
+++ b/generators/dvi/TeXFont_PFB.cpp
@@ -74,8 +74,8 @@ TeXFont_PFB::TeXFont_PFB(TeXFontDefinition *parent, fontEncoding *enc, double sl
// TeX is only able to address character codes 0-255 while
// e.g. Type1 fonts may contain several thousands of characters)
if (enc != 0) {
- parent->fullEncodingName = enc->encodingFullName.remove(QString::fromLatin1( "Encoding" ));
- parent->fullEncodingName = enc->encodingFullName.remove(QString::fromLatin1( "encoding" ));
+ parent->fullEncodingName = enc->encodingFullName.remove(QStringLiteral( "Encoding" ));
+ parent->fullEncodingName = enc->encodingFullName.remove(QStringLiteral( "encoding" ));
// An encoding vector is given for this font, i.e. an array of
// character names (such as: 'parenleft' or 'dotlessj'). We use
diff --git a/generators/dvi/TeXFont_PK.cpp b/generators/dvi/TeXFont_PK.cpp
index 2ffd57d..4e80e6f 100644
--- a/generators/dvi/TeXFont_PK.cpp
+++ b/generators/dvi/TeXFont_PK.cpp
@@ -426,7 +426,7 @@ void TeXFont_PK::PK_skip_specials()
#endif
int i,j;
- register FILE *fp = file;
+ FILE *fp = file;
#ifdef DEBUG_PK
if (fp == 0)
@@ -476,8 +476,8 @@ void TeXFont_PK::read_PK_char(unsigned int ch)
int row_bit_pos;
bool paint_switch;
quint32* cp;
- register class glyph *g;
- register FILE *fp = file;
+ class glyph *g;
+ FILE *fp = file;
long fpwidth;
quint32 word = 0;
int word_weight, bytes_wide;
@@ -531,7 +531,7 @@ void TeXFont_PK::read_PK_char(unsigned int ch)
{
/* width must be multiple of 16 bits for raster_op */
characterBitmaps[ch]->bytes_wide = ROUNDUP((int) characterBitmaps[ch]->w, 32) * 4;
- register unsigned int size = characterBitmaps[ch]->bytes_wide * characterBitmaps[ch]->h;
+ unsigned int size = characterBitmaps[ch]->bytes_wide * characterBitmaps[ch]->h;
characterBitmaps[ch]->bits = new char[size != 0 ? size : 1];
}
@@ -628,8 +628,8 @@ void TeXFont_PK::read_PK_char(unsigned int ch)
// The data in the bitmap is now in the processor's bit order,
// that is, big endian. Since XWindows needs little endian, we
// need to change the bit order now.
- register unsigned char* bitmapData = (unsigned char*) characterBitmaps[ch]->bits;
- register unsigned char* endOfData = bitmapData + characterBitmaps[ch]->bytes_wide*characterBitmaps[ch]->h;
+ unsigned char* bitmapData = (unsigned char*) characterBitmaps[ch]->bits;
+ unsigned char* endOfData = bitmapData + characterBitmaps[ch]->bytes_wide*characterBitmaps[ch]->h;
while(bitmapData < endOfData) {
*bitmapData = bitflip[*bitmapData];
bitmapData++;
diff --git a/generators/dvi/dviFile.cpp b/generators/dvi/dviFile.cpp
index cafeb1d..fc5625b 100644
--- a/generators/dvi/dviFile.cpp
+++ b/generators/dvi/dviFile.cpp
@@ -381,7 +381,7 @@ QString dvifile::convertPDFtoPS(const QString &PDFFilename, QString *converrorms
// Use pdf2ps to do the conversion
QProcess pdf2ps;
pdf2ps.setReadChannelMode(QProcess::MergedChannels);
- pdf2ps.start("pdf2ps",
+ pdf2ps.start(QStringLiteral("pdf2ps"),
QStringList() << PDFFilename << convertedFileName,
QIODevice::ReadOnly|QIODevice::Text);
diff --git a/generators/dvi/dviRenderer.cpp b/generators/dvi/dviRenderer.cpp
index dfa6f4d..7570438 100644
--- a/generators/dvi/dviRenderer.cpp
+++ b/generators/dvi/dviRenderer.cpp
@@ -52,7 +52,7 @@ dviRenderer::dviRenderer(bool useFontHinting)
shrinkfactor(3),
source_href(0),
HTML_href(0),
- editorCommand(""),
+ editorCommand(QLatin1String("")),
PostScriptOutPutString(0),
PS_interface(new ghostscript_interface),
_postscript(true),
@@ -604,7 +604,7 @@ Anchor dviRenderer::parseReference(const QString &reference)
// points to line number 1111 in the file "Filename". KDVI then
// looks for source specials of the form "src:xxxxFilename", and
// tries to find the special with the biggest xxxx
- if (reference.indexOf("src:", 0, Qt::CaseInsensitive) == 0) {
+ if (reference.indexOf(QStringLiteral("src:"), 0, Qt::CaseInsensitive) == 0) {
// Extract the file name and the numeral part from the reference string
DVI_SourceFileSplitter splitter(reference, dviFile->filename);
@@ -699,25 +699,25 @@ QString dviRenderer::PDFencodingToQString(const QString& _pdfstring)
// replaces them by UTF8. See Section 3.2.3 of the PDF reference
// guide for information.
QString pdfstring = _pdfstring;
- pdfstring = pdfstring.replace("\\n", "\n");
- pdfstring = pdfstring.replace("\\r", "\n");
- pdfstring = pdfstring.replace("\\t", "\t");
- pdfstring = pdfstring.replace("\\f", "\f");
- pdfstring = pdfstring.replace("\\(", "(");
- pdfstring = pdfstring.replace("\\)", ")");
- pdfstring = pdfstring.replace("\\\\", "\\");
+ pdfstring = pdfstring.replace(QLatin1String("\\n"), QLatin1String("\n"));
+ pdfstring = pdfstring.replace(QLatin1String("\\r"), QLatin1String("\n"));
+ pdfstring = pdfstring.replace(QLatin1String("\\t"), QLatin1String("\t"));
+ pdfstring = pdfstring.replace(QLatin1String("\\f"), QLatin1String("\f"));
+ pdfstring = pdfstring.replace(QLatin1String("\\("), QLatin1String("("));
+ pdfstring = pdfstring.replace(QLatin1String("\\)"), QLatin1String(")"));
+ pdfstring = pdfstring.replace(QLatin1String("\\\\"), QLatin1String("\\"));
// Now replace octal character codes with the characters they encode
int pos;
- QRegExp rx( "(\\\\)(\\d\\d\\d)" ); // matches "\xyz" where x,y,z are numbers
+ QRegExp rx( QStringLiteral("(\\\\)(\\d\\d\\d)") ); // matches "\xyz" where x,y,z are numbers
while((pos = rx.indexIn( pdfstring )) != -1) {
pdfstring = pdfstring.replace(pos, 4, QChar(rx.cap(2).toInt(0,8)));
}
- rx.setPattern( "(\\\\)(\\d\\d)" ); // matches "\xy" where x,y are numbers
+ rx.setPattern( QStringLiteral("(\\\\)(\\d\\d)") ); // matches "\xy" where x,y are numbers
while((pos = rx.indexIn( pdfstring )) != -1) {
pdfstring = pdfstring.replace(pos, 3, QChar(rx.cap(2).toInt(0,8)));
}
- rx.setPattern( "(\\\\)(\\d)" ); // matches "\x" where x is a number
+ rx.setPattern( QStringLiteral("(\\\\)(\\d)") ); // matches "\x" where x is a number
while((pos = rx.indexIn( pdfstring )) != -1) {
pdfstring = pdfstring.replace(pos, 4, QChar(rx.cap(2).toInt(0,8)));
}
diff --git a/generators/dvi/dviRenderer_draw.cpp b/generators/dvi/dviRenderer_draw.cpp
index 0f8079e..e4e4cd7 100644
--- a/generators/dvi/dviRenderer_draw.cpp
+++ b/generators/dvi/dviRenderer_draw.cpp
@@ -132,7 +132,7 @@ void dviRenderer::set_char(unsigned int cmd, unsigned int ch)
if (source_href != NULL)
dhl.linkText = *source_href;
else
- dhl.linkText = "";
+ dhl.linkText = QLatin1String("");
currentDVIPage->sourceHyperLinkList.push_back(dhl);
} else {
QRect dshunion = currentDVIPage->sourceHyperLinkList[currentDVIPage->sourceHyperLinkList.size()-1].box.unite(QRect(x, y, pix.width(), pix.height())) ;
@@ -144,40 +144,40 @@ void dviRenderer::set_char(unsigned int cmd, unsigned int ch)
// search, etc.). Set up the currentlyDrawnPage->textBoxList.
TextBox link;
link.box.setRect(x, y, pix.width(), pix.height());
- link.text = "";
+ link.text = QLatin1String("");
currentlyDrawnPage->textBoxList.push_back(link);
switch(ch) {
case 0x0b:
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += "ff";
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1String("ff");
break;
case 0x0c:
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += "fi";
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1String("fi");
break;
case 0x0d:
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += "fl";
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1String("fl");
break;
case 0x0e:
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += "ffi";
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1String("ffi");
break;
case 0x0f:
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += "ffl";
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1String("ffl");
break;
case 0x7b:
currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '-';
break;
case 0x7c:
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += "---";
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1String("---");
break;
case 0x7d:
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += "\"";
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1String("\"");
break;
case 0x7e:
currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '~';
break;
case 0x7f:
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += "@@"; // @@@ check!
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1String("@@"); // @@@ check!
break;
default:
@@ -596,7 +596,7 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
line_boundary_encountered && word_boundary_encountered) {
if (currentlyDrawnPage->textBoxList.last().text.endsWith('\n'))
currentlyDrawnPage->textBoxList.last().text.chop(1);
- currentlyDrawnPage->textBoxList.last().text += " \n";
+ currentlyDrawnPage->textBoxList.last().text += QLatin1String(" \n");
after_space = false;
}
diff --git a/generators/dvi/dviRenderer_prescan.cpp b/generators/dvi/dviRenderer_prescan.cpp
index a9ddfe8..783c727 100644
--- a/generators/dvi/dviRenderer_prescan.cpp
+++ b/generators/dvi/dviRenderer_prescan.cpp
@@ -76,10 +76,10 @@ void dviRenderer::prescan_embedPS(char *cp, quint8 *beginningOfSpecialCommand)
db.mimeTypeForFile(EPSfilename, QMimeDatabase::MatchContent);
QString const & mime_type_name = mime_type.isValid() ? mime_type.name() : QString();
- bool const is_ps_file = (mime_type_name == "application/postscript" ||
- mime_type_name == "image/x-eps");
+ bool const is_ps_file = (mime_type_name == QLatin1String("application/postscript") ||
+ mime_type_name == QLatin1String("image/x-eps"));
bool const is_pdf_file = (!is_ps_file &&
- mime_type_name == "application/pdf");
+ mime_type_name == QLatin1String("application/pdf"));
if (!(is_ps_file || is_pdf_file))
return;
@@ -128,16 +128,16 @@ void dviRenderer::prescan_embedPS(char *cp, quint8 *beginningOfSpecialCommand)
parse_special_argument(include_command, "rhi=", &rhi);
parse_special_argument(include_command, "angle=", &angle);
- int clip=include_command.indexOf(" clip"); // -1 if clip keyword is not present, >= 0 otherwise
+ int clip=include_command.indexOf(QStringLiteral(" clip")); // -1 if clip keyword is not present, >= 0 otherwise
// Generate the PostScript commands to be included
- QString PS = QString("ps: @beginspecial %1 @llx %2 @lly %3 @urx %4 @ury").arg(llx).arg(lly).arg(urx).arg(ury);
+ QString PS = QStringLiteral("ps: @beginspecial %1 @llx %2 @lly %3 @urx %4 @ury").arg(llx).arg(lly).arg(urx).arg(ury);
if (rwi != 0)
- PS.append( QString(" %1 @rwi").arg(rwi) );
+ PS.append( QStringLiteral(" %1 @rwi").arg(rwi) );
if (rhi != 0)
- PS.append( QString(" %1 @rhi").arg(rhi) );
+ PS.append( QStringLiteral(" %1 @rhi").arg(rhi) );
if (angle != 0)
- PS.append( QString(" %1 @angle").arg(angle) );
+ PS.append( QStringLiteral(" %1 @angle").arg(angle) );
if (clip != -1)
PS.append(" @clip");
PS.append( " @setspecial\n" );
@@ -290,14 +290,14 @@ void dviRenderer::prescan_ParsePSHeaderSpecial(const QString& cp)
if (!QFile::exists(_file)) {
// Otherwise, use kpsewhich to find the eps file.
KProcess proc;
- proc << "kpsewhich" << cp;
+ proc << QStringLiteral("kpsewhich") << cp;
proc.setOutputChannelMode(KProcess::SeparateChannels);
proc.execute();
_file = QString::fromLocal8Bit(proc.readLine().trimmed());
}
if (QFile::exists(_file))
- PS_interface->PostScriptHeaderString->append( QString(" (%1) run\n").arg(_file) );
+ PS_interface->PostScriptHeaderString->append( QStringLiteral(" (%1) run\n").arg(_file) );
}
@@ -321,7 +321,7 @@ void dviRenderer::prescan_ParsePSQuoteSpecial(const QString& cp)
double PS_H = (currinf.data.dvi_h*300.0)/(65536*1200)-300;
double PS_V = (currinf.data.dvi_v*300.0)/1200 - 300;
- PostScriptOutPutString->append( QString(" %1 %2 moveto\n").arg(PS_H).arg(PS_V) );
+ PostScriptOutPutString->append( QStringLiteral(" %1 %2 moveto\n").arg(PS_H).arg(PS_V) );
PostScriptOutPutString->append( " @beginspecial @setspecial \n" );
PostScriptOutPutString->append( cp );
PostScriptOutPutString->append( " @endspecial \n" );
@@ -341,28 +341,28 @@ void dviRenderer::prescan_ParsePSSpecial(const QString& cp)
// interpreter for every page which makes it really slow. This is a
// major nuisance, so that we try to filter and interpret the
// hypertex generated PostScript here.
- if (cp.startsWith("ps:SDict begin")) {
+ if (cp.startsWith(QLatin1String("ps:SDict begin"))) {
// We suspect this may be hyperref generated nonsense. Let's check
// for some known code that hyperref generates.
- if (cp == "ps:SDict begin H.S end")
+ if (cp == QLatin1String("ps:SDict begin H.S end"))
return; // start of hyperref rectangle
- if (cp == "ps:SDict begin H.R end")
+ if (cp == QLatin1String("ps:SDict begin H.R end"))
return; // end of hyperref rectangle
- if (cp.endsWith("H.A end"))
+ if (cp.endsWith(QLatin1String("H.A end")))
return; // end of hyperref anchor
- if (cp.endsWith("H.L end"))
+ if (cp.endsWith(QLatin1String("H.L end")))
return; // end of hyperref link
- if (cp.startsWith("ps:SDict begin /product where{pop product(Distiller)"))
+ if (cp.startsWith(QLatin1String("ps:SDict begin /product where{pop product(Distiller)")))
return; // hyperref tries to work around Distiller bug
- if (cp.startsWith("ps:SDict begin [") && cp.endsWith(" pdfmark end")) { // hyperref definition of link/anchor/bookmark/etc
- if (cp.contains("/DEST")) { // The PostScript code defines an anchor
+ if (cp.startsWith(QLatin1String("ps:SDict begin [")) && cp.endsWith(QLatin1String(" pdfmark end"))) { // hyperref definition of link/anchor/bookmark/etc
+ if (cp.contains(QStringLiteral("/DEST"))) { // The PostScript code defines an anchor
QString anchorName = cp.section('(', 1, 1).section(')', 0, 0);
Length l;
l.setLength_in_inch(currinf.data.dvi_v/(resolutionInDPI*shrinkfactor));
anchorList[anchorName] = Anchor(current_page+1, l);
}
// The PostScript code defines a bookmark
- if (cp.contains("/Dest") && cp.contains("/Title")) {
+ if (cp.contains(QStringLiteral("/Dest")) && cp.contains(QStringLiteral("/Title"))) {
const QString childrenNumberAndMoreStuff = cp.section('-', 1, 1); // Contains from the - symbol to the end of cp, effectively containing the number of children and some stuff after it
int indexOfFirstNonDigit = 0;
foreach(const QChar &c, childrenNumberAndMoreStuff) {
@@ -371,7 +371,7 @@ void dviRenderer::prescan_ParsePSSpecial(const QString& cp)
}
prebookmarks.append(PreBookmark(PDFencodingToQString(cp.section('(', 2, 2).section(')', 0, 0)),
cp.section('(', 1, 1).section(')', 0, 0),
- childrenNumberAndMoreStuff.left(indexOfFirstNonDigit).toUInt()
+ childrenNumberAndMoreStuff.leftRef(indexOfFirstNonDigit).toUInt()
));
}
return;
@@ -381,18 +381,18 @@ void dviRenderer::prescan_ParsePSSpecial(const QString& cp)
double PS_H = (currinf.data.dvi_h*300.0)/(65536*1200)-300;
double PS_V = (currinf.data.dvi_v*300.0)/1200 - 300;
- if (cp.indexOf("ps::[begin]", 0, Qt::CaseInsensitive) == 0) {
- PostScriptOutPutString->append( QString(" %1 %2 moveto\n").arg(PS_H).arg(PS_V) );
- PostScriptOutPutString->append( QString(" %1\n").arg(cp.mid(11)) );
+ if (cp.indexOf(QStringLiteral("ps::[begin]"), 0, Qt::CaseInsensitive) == 0) {
+ PostScriptOutPutString->append( QStringLiteral(" %1 %2 moveto\n").arg(PS_H).arg(PS_V) );
+ PostScriptOutPutString->append( QStringLiteral(" %1\n").arg(cp.mid(11)) );
} else {
- if (cp.indexOf("ps::[end]", 0, Qt::CaseInsensitive) == 0) {
- PostScriptOutPutString->append( QString(" %1\n").arg(cp.mid(9)) );
+ if (cp.indexOf(QStringLiteral("ps::[end]"), 0, Qt::CaseInsensitive) == 0) {
+ PostScriptOutPutString->append( QStringLiteral(" %1\n").arg(cp.mid(9)) );
} else {
- if (cp.indexOf("ps::", 0, Qt::CaseInsensitive) == 0) {
- PostScriptOutPutString->append( QString(" %1\n").arg(cp.mid(4)) );
+ if (cp.indexOf(QStringLiteral("ps::"), 0, Qt::CaseInsensitive) == 0) {
+ PostScriptOutPutString->append( QStringLiteral(" %1\n").arg(cp.mid(4)) );
} else {
- PostScriptOutPutString->append( QString(" %1 %2 moveto\n").arg(PS_H).arg(PS_V) );
- PostScriptOutPutString->append( QString(" %1\n").arg(cp.mid(3)) );
+ PostScriptOutPutString->append( QStringLiteral(" %1 %2 moveto\n").arg(PS_H).arg(PS_V) );
+ PostScriptOutPutString->append( QStringLiteral(" %1\n").arg(cp.mid(3)) );
}
}
}
@@ -426,7 +426,7 @@ void dviRenderer::prescan_ParsePSFileSpecial(const QString& cp)
// If the file name ends in 'png', 'gif', 'jpg' or 'jpeg', we assume
// that this is NOT a PostScript file, and we exit here.
QString ending = EPSfilename.section('.', -1).toLower();
- if ((ending == "png") || (ending == "gif") || (ending == "jpg") || (ending == "jpeg")) {
+ if ((ending == QLatin1String("png")) || (ending == QLatin1String("gif")) || (ending == QLatin1String("jpg")) || (ending == QLatin1String("jpeg"))) {
dviFile->numberOfExternalNONPSFiles++;
return;
}
@@ -438,7 +438,7 @@ void dviRenderer::prescan_ParsePSFileSpecial(const QString& cp)
EPSfilename = ghostscript_interface::locateEPSfile(EPSfilename, baseURL);
// If the EPSfilename really points to a PDF file, convert that file now.
- if (ending == "pdf") {
+ if (ending == QLatin1String("pdf")) {
QString convErrorMsg;
QString oEPSfilename = EPSfilename;
EPSfilename = dviFile->convertPDFtoPS(EPSfilename, &convErrorMsg);
@@ -468,27 +468,27 @@ void dviRenderer::prescan_ParsePSFileSpecial(const QString& cp)
parse_special_argument(include_command, "rhi=", &rhi);
parse_special_argument(include_command, "angle=", &angle);
- int clip=include_command.indexOf(" clip"); // -1 if clip keyword is not present, >= 0 otherwise
+ int clip=include_command.indexOf(QStringLiteral(" clip")); // -1 if clip keyword is not present, >= 0 otherwise
if (QFile::exists(EPSfilename)) {
double PS_H = (currinf.data.dvi_h*300.0)/(65536*1200)-300;
double PS_V = (currinf.data.dvi_v*300.0)/1200 - 300;
- PostScriptOutPutString->append( QString(" %1 %2 moveto\n").arg(PS_H).arg(PS_V) );
+ PostScriptOutPutString->append( QStringLiteral(" %1 %2 moveto\n").arg(PS_H).arg(PS_V) );
PostScriptOutPutString->append( "@beginspecial " );
- PostScriptOutPutString->append( QString(" %1 @llx").arg(llx) );
- PostScriptOutPutString->append( QString(" %1 @lly").arg(lly) );
- PostScriptOutPutString->append( QString(" %1 @urx").arg(urx) );
- PostScriptOutPutString->append( QString(" %1 @ury").arg(ury) );
+ PostScriptOutPutString->append( QStringLiteral(" %1 @llx").arg(llx) );
+ PostScriptOutPutString->append( QStringLiteral(" %1 @lly").arg(lly) );
+ PostScriptOutPutString->append( QStringLiteral(" %1 @urx").arg(urx) );
+ PostScriptOutPutString->append( QStringLiteral(" %1 @ury").arg(ury) );
if (rwi != 0)
- PostScriptOutPutString->append( QString(" %1 @rwi").arg(rwi) );
+ PostScriptOutPutString->append( QStringLiteral(" %1 @rwi").arg(rwi) );
if (rhi != 0)
- PostScriptOutPutString->append( QString(" %1 @rhi").arg(rhi) );
+ PostScriptOutPutString->append( QStringLiteral(" %1 @rhi").arg(rhi) );
if (angle != 0)
- PostScriptOutPutString->append( QString(" %1 @angle").arg(angle) );
+ PostScriptOutPutString->append( QStringLiteral(" %1 @angle").arg(angle) );
if (clip != -1)
PostScriptOutPutString->append(" @clip");
PostScriptOutPutString->append( " @setspecial \n" );
- PostScriptOutPutString->append( QString(" (%1) run\n").arg(EPSfilename) );
+ PostScriptOutPutString->append( QStringLiteral(" (%1) run\n").arg(EPSfilename) );
PostScriptOutPutString->append( "@endspecial \n" );
}
@@ -508,7 +508,7 @@ void dviRenderer::prescan_ParseSourceSpecial(const QString& cp)
for(j=0;j<cp.length();j++)
if (!cp.at(j).isNumber())
break;
- quint32 sourceLineNumber = cp.left(j).toUInt();
+ quint32 sourceLineNumber = cp.leftRef(j).toUInt();
QFileInfo fi1(dviFile->filename);
QString sourceFileName = QFileInfo(fi1.dir(), cp.mid(j).trimmed()).absoluteFilePath();
Length l;
diff --git a/generators/dvi/dviexport.cpp b/generators/dvi/dviexport.cpp
index 53881f8..5d6b56c 100644
--- a/generators/dvi/dviexport.cpp
+++ b/generators/dvi/dviexport.cpp
@@ -45,7 +45,7 @@ DVIExport::DVIExport(dviRenderer& parent)
process_(0),
parent_(&parent)
{
- connect( this, SIGNAL(error(QString,int)), &parent, SIGNAL(error(QString,int)) );
+ connect( this, &DVIExport::error, &parent, &dviRenderer::error );
}
@@ -125,7 +125,7 @@ DVIExportToPDF::DVIExportToPDF(dviRenderer& parent, const QString& output_name)
if (!input.exists() || !input.isReadable())
return;
- if (QStandardPaths::findExecutable("dvipdfm").isEmpty()) {
+ if (QStandardPaths::findExecutable(QStringLiteral("dvipdfm")).isEmpty()) {
emit error(i18n("<qt><p>Okular could not locate the program <em>dvipdfm</em> on your computer. This program is "
"essential for the export function to work. You can, however, convert "
"the DVI-file to PDF using the print function of Okular, but that will often "
@@ -138,12 +138,12 @@ DVIExportToPDF::DVIExportToPDF(dviRenderer& parent, const QString& output_name)
}
// Generate a suggestion for a reasonable file name
- const QString suggested_name = dvi.filename.left(dvi.filename.indexOf(".")) + ".pdf";
+ const QString suggested_name = dvi.filename.left(dvi.filename.indexOf(QStringLiteral("."))) + ".pdf";
if (output_name.isEmpty())
return;
- start("dvipdfm",
- QStringList() << "-o"
+ start(QStringLiteral("dvipdfm"),
+ QStringList() << QStringLiteral("-o")
<< output_name
<< dvi.filename,
QFileInfo(dvi.filename).absolutePath(),
@@ -182,7 +182,7 @@ DVIExportToPS::DVIExportToPS(dviRenderer& parent,
return;
}
- if (QStandardPaths::findExecutable("dvips").isEmpty()) {
+ if (QStandardPaths::findExecutable(QStringLiteral("dvips")).isEmpty()) {
emit error(i18n("<qt><p>Okular could not locate the program <em>dvips</em> on your computer. "
"That program is essential for the export function to work.</p>"
"<p>Hint to the perplexed system administrator: Okular uses the PATH environment "
@@ -268,16 +268,16 @@ DVIExportToPS::DVIExportToPS(dviRenderer& parent,
QStringList args;
if (!printer)
// Export hyperlinks
- args << "-z";
+ args << QStringLiteral("-z");
if (!options.isEmpty())
args += options;
args << input_name
- << "-o"
+ << QStringLiteral("-o")
<< output_name_;
- start("dvips",
+ start(QStringLiteral("dvips"),
args,
QFileInfo(dvi.filename).absolutePath(),
i18n("<qt>The external program 'dvips', which was used to export the file, reported an error. "
diff --git a/generators/dvi/dvisourcesplitter.cpp b/generators/dvi/dvisourcesplitter.cpp
index 51e00d4..10649b3 100644
--- a/generators/dvi/dvisourcesplitter.cpp
+++ b/generators/dvi/dvisourcesplitter.cpp
@@ -30,7 +30,7 @@ DVI_SourceFileSplitter::DVI_SourceFileSplitter(const QString &srclink, const QSt
#endif
//remove src: if necessary
- if ( filepart.left(4) == "src:" ) filepart = srclink.mid(4);
+ if ( filepart.left(4) == QLatin1String("src:") ) filepart = srclink.mid(4);
//split first
quint32 max = filepart.length(), i = 0;
diff --git a/generators/dvi/fontEncoding.cpp b/generators/dvi/fontEncoding.cpp
index f69a150..6293fcc 100644
--- a/generators/dvi/fontEncoding.cpp
+++ b/generators/dvi/fontEncoding.cpp
@@ -32,7 +32,7 @@ fontEncoding::fontEncoding(const QString &encName)
QProcess kpsewhich;
kpsewhich.setReadChannelMode(QProcess::MergedChannels);
- kpsewhich.start("kpsewhich",
+ kpsewhich.start(QStringLiteral("kpsewhich"),
QStringList() << encName,
QIODevice::ReadOnly|QIODevice::Text);
@@ -46,7 +46,7 @@ fontEncoding::fontEncoding(const QString &encName)
const QString encFileName = QString(kpsewhich.readAll()).trimmed();
if (encFileName.isEmpty()) {
- qCCritical(OkularDviDebug) << QString("fontEncoding::fontEncoding(...): The file '%1' could not be found by kpsewhich.").arg(encName) << endl;
+ qCCritical(OkularDviDebug) << QStringLiteral("fontEncoding::fontEncoding(...): The file '%1' could not be found by kpsewhich.").arg(encName) << endl;
return;
}
@@ -84,9 +84,9 @@ fontEncoding::fontEncoding(const QString &encName)
i++;
}
for(; i<256; i++)
- glyphNameVector[i] = ".notdef";
+ glyphNameVector[i] = QStringLiteral(".notdef");
} else {
- qCCritical(OkularDviDebug) << QString("fontEncoding::fontEncoding(...): The file '%1' could not be opened.").arg(encFileName) << endl;
+ qCCritical(OkularDviDebug) << QStringLiteral("fontEncoding::fontEncoding(...): The file '%1' could not be opened.").arg(encFileName) << endl;
return;
}
diff --git a/generators/dvi/fontMap.cpp b/generators/dvi/fontMap.cpp
index e2f2fc9..7e10ba2 100644
--- a/generators/dvi/fontMap.cpp
+++ b/generators/dvi/fontMap.cpp
@@ -36,8 +36,8 @@ fontMap::fontMap()
// other way than to try both options one after another. We use the
// teTeX 3.0 format first.
QProcess kpsewhich;
- kpsewhich.start("kpsewhich",
- QStringList() << "--format=map" << "ps2pk.map",
+ kpsewhich.start(QStringLiteral("kpsewhich"),
+ QStringList() << QStringLiteral("--format=map") << QStringLiteral("ps2pk.map"),
QIODevice::ReadOnly|QIODevice::Text);
if (!kpsewhich.waitForStarted()) {
@@ -52,8 +52,8 @@ fontMap::fontMap()
if (map_fileName.isEmpty()) {
// Map file not found? Then we try the teTeX < 3.0 way of finding
// the file.
- kpsewhich.start("kpsewhich",
- QStringList() << "--format=dvips config" << "ps2pk.map",
+ kpsewhich.start(QStringLiteral("kpsewhich"),
+ QStringList() << QStringLiteral("--format=dvips config") << QStringLiteral("ps2pk.map"),
QIODevice::ReadOnly|QIODevice::Text);
if (!kpsewhich.waitForStarted()) {
qCCritical(OkularDviDebug) << "fontMap::fontMap(): kpsewhich could not be started." << endl;
@@ -89,7 +89,7 @@ fontMap::fontMap()
encodingName = encodingName.mid(1);
double slant = 0.0;
- int i = line.indexOf("SlantFont");
+ int i = line.indexOf(QStringLiteral("SlantFont"));
if (i >= 0) {
bool ok;
slant = line.left(i).section(' ', -1, -1 ,QString::SectionSkipEmpty).toDouble(&ok);
@@ -102,14 +102,14 @@ fontMap::fontMap()
entry.slant = slant;
entry.fontFileName = fontFileName;
entry.fullFontName = FullName;
- if (encodingName.endsWith(".enc"))
+ if (encodingName.endsWith(QLatin1String(".enc")))
entry.fontEncoding = encodingName;
else
entry.fontEncoding.clear();
}
file.close();
} else
- qCCritical(OkularDviDebug) << QString("fontMap::fontMap(): The file '%1' could not be opened.").arg(map_fileName) << endl;
+ qCCritical(OkularDviDebug) << QStringLiteral("fontMap::fontMap(): The file '%1' could not be opened.").arg(map_fileName) << endl;
#ifdef DEBUG_FONTMAP
qCDebug(OkularDviDebug) << "FontMap file parsed. Results:";
diff --git a/generators/dvi/fontpool.cpp b/generators/dvi/fontpool.cpp
index 2b65db5..c326107 100644
--- a/generators/dvi/fontpool.cpp
+++ b/generators/dvi/fontpool.cpp
@@ -39,7 +39,7 @@ fontPool::fontPool(bool useFontHinting)
qCDebug(OkularDviDebug) << "fontPool::fontPool() called";
#endif
- setObjectName( QLatin1String("Font Pool" ));
+ setObjectName( QStringLiteral("Font Pool" ));
displayResolution_in_dpi = 100.0; // A not-too-bad-default
useFontHints = useFontHinting;
@@ -226,11 +226,11 @@ void fontPool::locateFonts(bool makePK, bool locateTFMonly, bool *virtualFontsFo
// Now generate the command line for the kpsewhich
// program. Unfortunately, this can be rather long and involved...
QStringList kpsewhich_args;
- kpsewhich_args << "--dpi" << "1200"
- << "--mode" << "lexmarks";
+ kpsewhich_args << QStringLiteral("--dpi") << QStringLiteral("1200")
+ << QStringLiteral("--mode") << QStringLiteral("lexmarks");
// Disable automatic pk-font generation.
- kpsewhich_args << (makePK ? "--mktex" : "--no-mktex") << "pk";
+ kpsewhich_args << (makePK ? "--mktex" : "--no-mktex") << QStringLiteral("pk");
// Names of fonts that shall be located
quint16 numFontsInJob = 0;
@@ -241,17 +241,17 @@ void fontPool::locateFonts(bool makePK, bool locateTFMonly, bool *virtualFontsFo
numFontsInJob++;
if (locateTFMonly == true)
- kpsewhich_args << QString("%1.tfm").arg(fontp->fontname);
+ kpsewhich_args << QStringLiteral("%1.tfm").arg(fontp->fontname);
else {
#ifdef HAVE_FREETYPE
if (FreeType_could_be_loaded == true) {
const QString &filename = fontsByTeXName.findFileName(fontp->fontname);
if (!filename.isEmpty())
- kpsewhich_args << QString("%1").arg(filename);
+ kpsewhich_args << QStringLiteral("%1").arg(filename);
}
#endif
- kpsewhich_args << QString("%1.vf").arg(fontp->fontname)
- << QString("%1.1200pk").arg(fontp->fontname);
+ kpsewhich_args << QStringLiteral("%1.vf").arg(fontp->fontname)
+ << QStringLiteral("%1.1200pk").arg(fontp->fontname);
}
}
}
@@ -268,9 +268,9 @@ void fontPool::locateFonts(bool makePK, bool locateTFMonly, bool *virtualFontsFo
// Now run... kpsewhich. In case of error, kick up a fuss.
// This string is not going to be quoted, as it might be were it
// a real command line, but who cares?
- const QString kpsewhich_exe = "kpsewhich";
+ const QString kpsewhich_exe = QStringLiteral("kpsewhich");
kpsewhichOutput +=
- "<b>" + kpsewhich_exe + ' ' + kpsewhich_args.join(" ") + "</b>";
+ "<b>" + kpsewhich_exe + ' ' + kpsewhich_args.join(QStringLiteral(" ")) + "</b>";
kpsewhich_->start(kpsewhich_exe, kpsewhich_args,
QIODevice::ReadOnly|QIODevice::Text);
@@ -330,7 +330,7 @@ void fontPool::locateFonts(bool makePK, bool locateTFMonly, bool *virtualFontsFo
QString fname = matchingFiles.first();
fontp->fontNameReceiver(fname);
fontp->flags |= TeXFontDefinition::FONT_KPSE_NAME;
- if (fname.endsWith(".vf")) {
+ if (fname.endsWith(QLatin1String(".vf"))) {
if (virtualFontsFound != 0)
*virtualFontsFound = true;
// Constructing a virtual font will most likely insert other
@@ -459,9 +459,9 @@ void fontPool::mf_output_receiver()
// with "kpathsea:", this means that a new MetaFont-run has been
// started. We filter these lines out and update the display
// accordingly.
- int startlineindex = line.indexOf("kpathsea:");
+ int startlineindex = line.indexOf(QStringLiteral("kpathsea:"));
if (startlineindex != -1) {
- int endstartline = line.indexOf("\n",startlineindex);
+ int endstartline = line.indexOf(QStringLiteral("\n"),startlineindex);
QString startLine = line.mid(startlineindex,endstartline-startlineindex);
// The last word in the startline is the name of the font which we
diff --git a/generators/dvi/generator_dvi.cpp b/generators/dvi/generator_dvi.cpp
index 7a6c4f0..2db4bc4 100644
--- a/generators/dvi/generator_dvi.cpp
+++ b/generators/dvi/generator_dvi.cpp
@@ -73,7 +73,7 @@ bool DviGenerator::loadDocument( const QString & fileName, QVector< Okular::Page
(void)userMutex();
- m_dviRenderer = new dviRenderer(documentMetaData("TextHinting", QVariant()).toBool());
+ m_dviRenderer = new dviRenderer(documentMetaData(QStringLiteral("TextHinting"), QVariant()).toBool());
connect(m_dviRenderer, &dviRenderer::error, this, &DviGenerator::error);
connect(m_dviRenderer, &dviRenderer::warning, this, &DviGenerator::warning);
connect(m_dviRenderer, &dviRenderer::notice, this, &DviGenerator::notice);
@@ -169,7 +169,7 @@ QLinkedList<Okular::ObjectRect*> DviGenerator::generateDviLinks( const dviPageIn
nb = (double)boxArea.bottom() / pageHeight;
QString linkText = dviLink.linkText;
- if ( linkText.startsWith("#") )
+ if ( linkText.startsWith(QLatin1String("#")) )
linkText = linkText.mid( 1 );
Anchor anch = m_dviRenderer->findAnchor( linkText );
@@ -182,7 +182,7 @@ QLinkedList<Okular::ObjectRect*> DviGenerator::generateDviLinks( const dviPageIn
Okular::DocumentViewport vp;
fillViewportFromAnchor( vp, anch, pageWidth, pageHeight );
- okuLink = new Okular::GotoAction( "", vp );
+ okuLink = new Okular::GotoAction( QLatin1String(""), vp );
}
else
{
@@ -326,7 +326,7 @@ Okular::DocumentInfo DviGenerator::generateDocumentInfo( const QSet<Okular::Docu
Okular::DocumentInfo docInfo;
if ( keys.contains( Okular::DocumentInfo::MimeType ) )
- docInfo.set( Okular::DocumentInfo::MimeType, "application/x-dvi" );
+ docInfo.set( Okular::DocumentInfo::MimeType, QStringLiteral("application/x-dvi") );
QMutexLocker lock( userMutex() );
@@ -337,7 +337,7 @@ Okular::DocumentInfo DviGenerator::generateDocumentInfo( const QSet<Okular::Docu
// read properties from dvif
//docInfo.set( "filename", dvif->filename, i18n("Filename") );
if ( keys.contains( Okular::DocumentInfo::CustomKeys ) )
- docInfo.set( "generatorDate", dvif->generatorString, i18n("Generator/Date") );
+ docInfo.set( QStringLiteral("generatorDate"), dvif->generatorString, i18n("Generator/Date") );
if ( keys.contains( Okular::DocumentInfo::Pages ) )
docInfo.set( Okular::DocumentInfo::Pages, QString::number( dvif->total_pages ) );
}
@@ -375,7 +375,7 @@ const Okular::DocumentSynopsis *DviGenerator::generateDocumentSynopsis()
const Okular::Page *p = document()->page( a.page - 1 );
fillViewportFromAnchor( vp, a, (int)p->width(), (int)p->height() );
- domel.setAttribute( "Viewport", vp.toString() );
+ domel.setAttribute( QStringLiteral("Viewport"), vp.toString() );
}
if ( stack.isEmpty() )
m_docSynopsis->appendChild( domel );
@@ -414,13 +414,13 @@ Okular::FontInfo::List DviGenerator::fontsForPage( int page )
#ifdef HAVE_FREETYPE
if ( font->getFullFontName().isEmpty() )
{
- name = QString( "%1, %2%" )
+ name = QStringLiteral( "%1, %2%" )
.arg( font->fontname )
.arg( zoom );
}
else
{
- name = QString( "%1 (%2), %3%" )
+ name = QStringLiteral( "%1 (%2), %3%" )
.arg( font->fontname )
.arg( font->getFullFontName() )
.arg( zoom );
@@ -551,10 +551,10 @@ bool DviGenerator::print( QPrinter& printer )
// List of pages to print.
foreach ( int p, pageList )
{
- pages += QString(",%1").arg(p);
+ pages += QStringLiteral(",%1").arg(p);
}
if ( !pages.isEmpty() )
- printOptions << "-pp" << pages.mid(1);
+ printOptions << QStringLiteral("-pp") << pages.mid(1);
QEventLoop el;
m_dviRenderer->setEventLoop( &el );
@@ -568,7 +568,7 @@ bool DviGenerator::print( QPrinter& printer )
QVariant DviGenerator::metaData( const QString & key, const QVariant & option ) const
{
- if ( key == "NamedViewport" && !option.toString().isEmpty() )
+ if ( key == QLatin1String("NamedViewport") && !option.toString().isEmpty() )
{
const Anchor anchor = m_dviRenderer->parseReference( option.toString() );
if ( anchor.isValid() )
diff --git a/generators/dvi/pageSize.cpp b/generators/dvi/pageSize.cpp
index a9328f5..fefedd5 100644
--- a/generators/dvi/pageSize.cpp
+++ b/generators/dvi/pageSize.cpp
@@ -145,25 +145,25 @@ void pageSize::setPageSize(const QString& width, const QString& _widthUnits, con
double h = height.toFloat();
QString widthUnits = _widthUnits;
- if ((widthUnits != "cm") && (widthUnits != "mm") && (widthUnits != "in")) {
+ if ((widthUnits != QLatin1String("cm")) && (widthUnits != QLatin1String("mm")) && (widthUnits != QLatin1String("in"))) {
qCCritical(OkularDviShellDebug) << "Unrecognized page width unit '" << widthUnits << "'. Assuming mm" << endl;
- widthUnits = "mm";
+ widthUnits = QStringLiteral("mm");
}
pageWidth.setLength_in_mm(w);
- if (widthUnits == "cm")
+ if (widthUnits == QLatin1String("cm"))
pageWidth.setLength_in_cm(w);
- if (widthUnits == "in")
+ if (widthUnits == QLatin1String("in"))
pageWidth.setLength_in_inch(w);
QString heightUnits = _heightUnits;
- if ((heightUnits != "cm") && (heightUnits != "mm") && (heightUnits != "in")) {
+ if ((heightUnits != QLatin1String("cm")) && (heightUnits != QLatin1String("mm")) && (heightUnits != QLatin1String("in"))) {
qCCritical(OkularDviShellDebug) << "Unrecognized page height unit '" << widthUnits << "'. Assuming mm" << endl;
- heightUnits = "mm";
+ heightUnits = QStringLiteral("mm");
}
pageHeight.setLength_in_mm(h);
- if (heightUnits == "cm")
+ if (heightUnits == QLatin1String("cm"))
pageHeight.setLength_in_cm(h);
- if (heightUnits == "in")
+ if (heightUnits == QLatin1String("in"))
pageHeight.setLength_in_inch(h);
rectifySizes();
@@ -210,21 +210,21 @@ QString pageSize::preferredUnit() const
// User-defined size. Give a preferred unit depening on the locale.
if (QLocale::system().measurementSystem() == QLocale::MetricSystem)
- return "mm";
+ return QStringLiteral("mm");
else
- return "in";
+ return QStringLiteral("in");
}
QString pageSize::widthString(const QString& unit) const
{
- QString answer = "--";
+ QString answer = QStringLiteral("--");
- if (unit == "cm")
+ if (unit == QLatin1String("cm"))
answer.setNum(pageWidth.getLength_in_cm());
- if (unit == "mm")
+ if (unit == QLatin1String("mm"))
answer.setNum(pageWidth.getLength_in_mm());
- if (unit == "in")
+ if (unit == QLatin1String("in"))
answer.setNum(pageWidth.getLength_in_inch());
return answer;
@@ -233,13 +233,13 @@ QString pageSize::widthString(const QString& unit) const
QString pageSize::heightString(const QString& unit) const
{
- QString answer = "--";
+ QString answer = QStringLiteral("--");
- if (unit == "cm")
+ if (unit == QLatin1String("cm"))
answer.setNum(pageHeight.getLength_in_cm());
- if (unit == "mm")
+ if (unit == QLatin1String("mm"))
answer.setNum(pageHeight.getLength_in_mm());
- if (unit == "in")
+ if (unit == QLatin1String("in"))
answer.setNum(pageHeight.getLength_in_inch());
return answer;
@@ -303,7 +303,7 @@ QString pageSize::serialize() const
if ((currentSize >= 0) && (fabs(staticList[currentSize].height-pageHeight.getLength_in_mm()) <= 0.5))
return staticList[currentSize].name;
else
- return QString("%1x%2").arg(pageWidth.getLength_in_mm()).arg(pageHeight.getLength_in_mm());
+ return QStringLiteral("%1x%2").arg(pageWidth.getLength_in_mm()).arg(pageHeight.getLength_in_mm());
}
@@ -312,12 +312,12 @@ QString pageSize::description() const
if (!isValid())
return QString();
- QString size = " ";
+ QString size = QStringLiteral(" ");
if (formatNumber() == -1) {
if (QLocale::system().measurementSystem() == QLocale::MetricSystem)
- size += QString("%1x%2 mm").arg(width().getLength_in_mm(), 0, 'f', 0).arg(height().getLength_in_mm(), 0, 'f', 0);
+ size += QStringLiteral("%1x%2 mm").arg(width().getLength_in_mm(), 0, 'f', 0).arg(height().getLength_in_mm(), 0, 'f', 0);
else
- size += QString("%1x%2 in").arg(width().getLength_in_inch(), 0, 'g', 2).arg(height().getLength_in_inch(), 0, 'g', 2);
+ size += QStringLiteral("%1x%2 in").arg(width().getLength_in_inch(), 0, 'g', 2).arg(height().getLength_in_inch(), 0, 'g', 2);
} else {
size += formatName() + '/';
if (getOrientation() == 0)
diff --git a/generators/dvi/psgs.cpp b/generators/dvi/psgs.cpp
index 5081a82..b1eedc4 100644
--- a/generators/dvi/psgs.cpp
+++ b/generators/dvi/psgs.cpp
@@ -51,10 +51,10 @@ ghostscript_interface::ghostscript_interface() {
PostScriptHeaderString = new QString();
- knownDevices.append("png16m");
- knownDevices.append("jpeg");
- knownDevices.append("pnn");
- knownDevices.append("pnnraw");
+ knownDevices.append(QStringLiteral("png16m"));
+ knownDevices.append(QStringLiteral("jpeg"));
+ knownDevices.append(QStringLiteral("pnn"));
+ knownDevices.append(QStringLiteral("pnnraw"));
gsDevice = knownDevices.begin();
}
@@ -83,7 +83,7 @@ void ghostscript_interface::setPostScript(const PageNumber& page, const QString&
void ghostscript_interface::setIncludePath(const QString &_includePath) {
if (_includePath.isEmpty())
- includePath = "*"; // Allow all files
+ includePath = QStringLiteral("*"); // Allow all files
else
includePath = _includePath+"/*";
}
@@ -198,7 +198,7 @@ void ghostscript_interface::gs_generate_graphics_file(const PageNumber& page, co
os << PostScriptHeaderString->toLatin1();
if (info->background != Qt::white) {
- QString colorCommand = QString("gsave %1 %2 %3 setrgbcolor clippath fill grestore\n").
+ QString colorCommand = QStringLiteral("gsave %1 %2 %3 setrgbcolor clippath fill grestore\n").
arg(info->background.red()/255.0).
arg(info->background.green()/255.0).
arg(info->background.blue()/255.0);
@@ -218,16 +218,16 @@ void ghostscript_interface::gs_generate_graphics_file(const PageNumber& page, co
KProcess proc;
proc.setOutputChannelMode(KProcess::SeparateChannels);
QStringList argus;
- argus << "gs";
- argus << "-dSAFER" << "-dPARANOIDSAFER" << "-dDELAYSAFER" << "-dNOPAUSE" << "-dBATCH";
- argus << QString("-sDEVICE=%1").arg(*gsDevice);
- argus << QString("-sOutputFile=%1").arg(filename);
- argus << QString("-sExtraIncludePath=%1").arg(includePath);
- argus << QString("-g%1x%2").arg(pixel_page_w).arg(pixel_page_h); // page size in pixels
- argus << QString("-r%1").arg(resolution); // resolution in dpi
- argus << "-dTextAlphaBits=4 -dGraphicsAlphaBits=2"; // Antialiasing
- argus << "-c" << "<< /PermitFileReading [ ExtraIncludePath ] /PermitFileWriting [] /PermitFileControl [] >> setuserparams .locksafe";
- argus << "-f" << PSfileName;
+ argus << QStringLiteral("gs");
+ argus << QStringLiteral("-dSAFER") << QStringLiteral("-dPARANOIDSAFER") << QStringLiteral("-dDELAYSAFER") << QStringLiteral("-dNOPAUSE") << QStringLiteral("-dBATCH");
+ argus << QStringLiteral("-sDEVICE=%1").arg(*gsDevice);
+ argus << QStringLiteral("-sOutputFile=%1").arg(filename);
+ argus << QStringLiteral("-sExtraIncludePath=%1").arg(includePath);
+ argus << QStringLiteral("-g%1x%2").arg(pixel_page_w).arg(pixel_page_h); // page size in pixels
+ argus << QStringLiteral("-r%1").arg(resolution); // resolution in dpi
+ argus << QStringLiteral("-dTextAlphaBits=4 -dGraphicsAlphaBits=2"); // Antialiasing
+ argus << QStringLiteral("-c") << QStringLiteral("<< /PermitFileReading [ ExtraIncludePath ] /PermitFileWriting [] /PermitFileControl [] >> setuserparams .locksafe");
+ argus << QStringLiteral("-f") << PSfileName;
#ifdef DEBUG_PSGS
qCDebug(OkularDviDebug) << argus.join(" ");
@@ -254,8 +254,8 @@ void ghostscript_interface::gs_generate_graphics_file(const PageNumber& page, co
proc.setReadChannel(QProcess::StandardOutput);
while(proc.canReadLine()) {
GSoutput = QString::fromLocal8Bit(proc.readLine());
- if (GSoutput.contains("Unknown device")) {
- qCDebug(OkularDviDebug) << QString("The version of ghostview installed on this computer does not support "
+ if (GSoutput.contains(QStringLiteral("Unknown device"))) {
+ qCDebug(OkularDviDebug) << QStringLiteral("The version of ghostview installed on this computer does not support "
"the '%1' ghostview device driver.").arg(*gsDevice) << endl;
knownDevices.erase(gsDevice);
gsDevice = knownDevices.begin();
@@ -283,7 +283,7 @@ void ghostscript_interface::gs_generate_graphics_file(const PageNumber& page, co
"</p></qt>"));
#endif
else {
- qCDebug(OkularDviDebug) << QString("Okular will now try to use the '%1' device driver.").arg(*gsDevice);
+ qCDebug(OkularDviDebug) << QStringLiteral("Okular will now try to use the '%1' device driver.").arg(*gsDevice);
gs_generate_graphics_file(page, filename, magnification);
}
return;
@@ -346,7 +346,7 @@ QString ghostscript_interface::locateEPSfile(const QString &filename, const QUrl
// Otherwise, use kpsewhich to find the eps file.
KProcess proc;
- proc << "kpsewhich" << filename;
+ proc << QStringLiteral("kpsewhich") << filename;
proc.execute();
return QString::fromLocal8Bit(proc.readLine().trimmed());
}
diff --git a/generators/dvi/special.cpp b/generators/dvi/special.cpp
index 1d7deda..6a9fe69 100644
--- a/generators/dvi/special.cpp
+++ b/generators/dvi/special.cpp
@@ -45,79 +45,79 @@ QColor dviRenderer::parseColorSpecification(const QString& colorSpec)
{
// Initialize the map of known colors, if that is not done yet.
if (namedColors.isEmpty()) {
- namedColors["Red"] = QColor( (int)(255.0*1), (int)(255.0*0), (int)(255.0*0));
- namedColors["Tan"] = QColor( (int)(255.0*0.86), (int)(255.0*0.58), (int)(255.0*0.44));
- namedColors["Blue"] = QColor( (int)(255.0*0), (int)(255.0*0), (int)(255.0*1));
- namedColors["Cyan"] = QColor( (int)(255.0*0), (int)(255.0*1), (int)(255.0*1));
- namedColors["Gray"] = QColor( (int)(255.0*0.5), (int)(255.0*0.5), (int)(255.0*0.5));
- namedColors["Plum"] = QColor( (int)(255.0*0.5), (int)(255.0*0), (int)(255.0*1));
- namedColors["Black"] = QColor( (int)(255.0*0), (int)(255.0*0), (int)(255.0*0));
- namedColors["Brown"] = QColor( (int)(255.0*0.4), (int)(255.0*0), (int)(255.0*0));
- namedColors["Green"] = QColor( (int)(255.0*0), (int)(255.0*1), (int)(255.0*0));
- namedColors["Melon"] = QColor( (int)(255.0*1), (int)(255.0*0.54), (int)(255.0*0.5));
- namedColors["Peach"] = QColor( (int)(255.0*1), (int)(255.0*0.5), (int)(255.0*0.3));
- namedColors["Sepia"] = QColor( (int)(255.0*0.3), (int)(255.0*0), (int)(255.0*0));
- namedColors["White"] = QColor( (int)(255.0*1), (int)(255.0*1), (int)(255.0*1));
- namedColors["Maroon"] = QColor( (int)(255.0*0.68), (int)(255.0*0), (int)(255.0*0));
- namedColors["Orange"] = QColor( (int)(255.0*1), (int)(255.0*0.39), (int)(255.0*0.13));
- namedColors["Orchid"] = QColor( (int)(255.0*0.68), (int)(255.0*0.36), (int)(255.0*1));
- namedColors["Purple"] = QColor( (int)(255.0*0.55), (int)(255.0*0.14), (int)(255.0*1));
- namedColors["Salmon"] = QColor( (int)(255.0*1), (int)(255.0*0.47), (int)(255.0*0.62));
- namedColors["Violet"] = QColor( (int)(255.0*0.21), (int)(255.0*0.12), (int)(255.0*1));
- namedColors["Yellow"] = QColor( (int)(255.0*1), (int)(255.0*1), (int)(255.0*0));
- namedColors["Apricot"] = QColor( (int)(255.0*1), (int)(255.0*0.68), (int)(255.0*0.48));
- namedColors["Emerald"] = QColor( (int)(255.0*0), (int)(255.0*1), (int)(255.0*0.5));
- namedColors["Fuchsia"] = QColor( (int)(255.0*0.45), (int)(255.0*0.01), (int)(255.0*0.92));
- namedColors["Magenta"] = QColor( (int)(255.0*1), (int)(255.0*0), (int)(255.0*1));
- namedColors["SkyBlue"] = QColor( (int)(255.0*0.38), (int)(255.0*1), (int)(255.0*0.88));
- namedColors["Thistle"] = QColor( (int)(255.0*0.88), (int)(255.0*0.41), (int)(255.0*1));
- namedColors["BrickRed"] = QColor( (int)(255.0*0.72), (int)(255.0*0), (int)(255.0*0));
- namedColors["Cerulean"] = QColor( (int)(255.0*0.06), (int)(255.0*0.89), (int)(255.0*1));
- namedColors["Lavender"] = QColor( (int)(255.0*1), (int)(255.0*0.52), (int)(255.0*1));
- namedColors["Mahogany"] = QColor( (int)(255.0*0.65), (int)(255.0*0), (int)(255.0*0));
- namedColors["Mulberry"] = QColor( (int)(255.0*0.64), (int)(255.0*0.08), (int)(255.0*0.98));
- namedColors["NavyBlue"] = QColor( (int)(255.0*0.06), (int)(255.0*0.46), (int)(255.0*1));
- namedColors["SeaGreen"] = QColor( (int)(255.0*0.31), (int)(255.0*1), (int)(255.0*0.5));
- namedColors["TealBlue"] = QColor( (int)(255.0*0.12), (int)(255.0*0.98), (int)(255.0*0.64));
- namedColors["BlueGreen"] = QColor( (int)(255.0*0.15), (int)(255.0*1), (int)(255.0*0.67));
- namedColors["CadetBlue"] = QColor( (int)(255.0*0.38), (int)(255.0*0.43), (int)(255.0*0.77));
- namedColors["Dandelion"] = QColor( (int)(255.0*1), (int)(255.0*0.71), (int)(255.0*0.16));
- namedColors["Goldenrod"] = QColor( (int)(255.0*1), (int)(255.0*0.9), (int)(255.0*0.16));
- namedColors["LimeGreen"] = QColor( (int)(255.0*0.5), (int)(255.0*1), (int)(255.0*0));
- namedColors["OrangeRed"] = QColor( (int)(255.0*1), (int)(255.0*0), (int)(255.0*0.5));
- namedColors["PineGreen"] = QColor( (int)(255.0*0), (int)(255.0*0.75), (int)(255.0*0.16));
- namedColors["RawSienna"] = QColor( (int)(255.0*0.55), (int)(255.0*0), (int)(255.0*0));
- namedColors["RedOrange"] = QColor( (int)(255.0*1), (int)(255.0*0.23), (int)(255.0*0.13));
- namedColors["RedViolet"] = QColor( (int)(255.0*0.59), (int)(255.0*0), (int)(255.0*0.66));
- namedColors["Rhodamine"] = QColor( (int)(255.0*1), (int)(255.0*0.18), (int)(255.0*1));
- namedColors["RoyalBlue"] = QColor( (int)(255.0*0), (int)(255.0*0.5), (int)(255.0*1));
- namedColors["RubineRed"] = QColor( (int)(255.0*1), (int)(255.0*0), (int)(255.0*0.87));
- namedColors["Turquoise"] = QColor( (int)(255.0*0.15), (int)(255.0*1), (int)(255.0*0.8));
- namedColors["VioletRed"] = QColor( (int)(255.0*1), (int)(255.0*0.19), (int)(255.0*1));
- namedColors["Aquamarine"] = QColor( (int)(255.0*0.18), (int)(255.0*1), (int)(255.0*0.7));
- namedColors["BlueViolet"] = QColor( (int)(255.0*0.1), (int)(255.0*0.05), (int)(255.0*0.96));
- namedColors["DarkOrchid"] = QColor( (int)(255.0*0.6), (int)(255.0*0.2), (int)(255.0*0.8));
- namedColors["OliveGreen"] = QColor( (int)(255.0*0), (int)(255.0*0.6), (int)(255.0*0));
- namedColors["Periwinkle"] = QColor( (int)(255.0*0.43), (int)(255.0*0.45), (int)(255.0*1));
- namedColors["Bittersweet"] = QColor( (int)(255.0*0.76), (int)(255.0*0.01), (int)(255.0*0));
- namedColors["BurntOrange"] = QColor( (int)(255.0*1), (int)(255.0*0.49), (int)(255.0*0));
- namedColors["ForestGreen"] = QColor( (int)(255.0*0), (int)(255.0*0.88), (int)(255.0*0));
- namedColors["GreenYellow"] = QColor( (int)(255.0*0.85), (int)(255.0*1), (int)(255.0*0.31));
- namedColors["JungleGreen"] = QColor( (int)(255.0*0.01), (int)(255.0*1), (int)(255.0*0.48));
- namedColors["ProcessBlue"] = QColor( (int)(255.0*0.04), (int)(255.0*1), (int)(255.0*1));
- namedColors["RoyalPurple"] = QColor( (int)(255.0*0.25), (int)(255.0*0.1), (int)(255.0*1));
- namedColors["SpringGreen"] = QColor( (int)(255.0*0.74), (int)(255.0*1), (int)(255.0*0.24));
- namedColors["YellowGreen"] = QColor( (int)(255.0*0.56), (int)(255.0*1), (int)(255.0*0.26));
- namedColors["MidnightBlue"] = QColor( (int)(255.0*0), (int)(255.0*0.44), (int)(255.0*0.57));
- namedColors["YellowOrange"] = QColor( (int)(255.0*1), (int)(255.0*0.58), (int)(255.0*0));
- namedColors["CarnationPink"] = QColor( (int)(255.0*1), (int)(255.0*0.37), (int)(255.0*1));
- namedColors["CornflowerBlue"] = QColor( (int)(255.0*0.35), (int)(255.0*0.87), (int)(255.0*1));
- namedColors["WildStrawberry"] = QColor( (int)(255.0*1), (int)(255.0*0.04), (int)(255.0*0.61));
+ namedColors[QStringLiteral("Red")] = QColor( (int)(255.0*1), (int)(255.0*0), (int)(255.0*0));
+ namedColors[QStringLiteral("Tan")] = QColor( (int)(255.0*0.86), (int)(255.0*0.58), (int)(255.0*0.44));
+ namedColors[QStringLiteral("Blue")] = QColor( (int)(255.0*0), (int)(255.0*0), (int)(255.0*1));
+ namedColors[QStringLiteral("Cyan")] = QColor( (int)(255.0*0), (int)(255.0*1), (int)(255.0*1));
+ namedColors[QStringLiteral("Gray")] = QColor( (int)(255.0*0.5), (int)(255.0*0.5), (int)(255.0*0.5));
+ namedColors[QStringLiteral("Plum")] = QColor( (int)(255.0*0.5), (int)(255.0*0), (int)(255.0*1));
+ namedColors[QStringLiteral("Black")] = QColor( (int)(255.0*0), (int)(255.0*0), (int)(255.0*0));
+ namedColors[QStringLiteral("Brown")] = QColor( (int)(255.0*0.4), (int)(255.0*0), (int)(255.0*0));
+ namedColors[QStringLiteral("Green")] = QColor( (int)(255.0*0), (int)(255.0*1), (int)(255.0*0));
+ namedColors[QStringLiteral("Melon")] = QColor( (int)(255.0*1), (int)(255.0*0.54), (int)(255.0*0.5));
+ namedColors[QStringLiteral("Peach")] = QColor( (int)(255.0*1), (int)(255.0*0.5), (int)(255.0*0.3));
+ namedColors[QStringLiteral("Sepia")] = QColor( (int)(255.0*0.3), (int)(255.0*0), (int)(255.0*0));
+ namedColors[QStringLiteral("White")] = QColor( (int)(255.0*1), (int)(255.0*1), (int)(255.0*1));
+ namedColors[QStringLiteral("Maroon")] = QColor( (int)(255.0*0.68), (int)(255.0*0), (int)(255.0*0));
+ namedColors[QStringLiteral("Orange")] = QColor( (int)(255.0*1), (int)(255.0*0.39), (int)(255.0*0.13));
+ namedColors[QStringLiteral("Orchid")] = QColor( (int)(255.0*0.68), (int)(255.0*0.36), (int)(255.0*1));
+ namedColors[QStringLiteral("Purple")] = QColor( (int)(255.0*0.55), (int)(255.0*0.14), (int)(255.0*1));
+ namedColors[QStringLiteral("Salmon")] = QColor( (int)(255.0*1), (int)(255.0*0.47), (int)(255.0*0.62));
+ namedColors[QStringLiteral("Violet")] = QColor( (int)(255.0*0.21), (int)(255.0*0.12), (int)(255.0*1));
+ namedColors[QStringLiteral("Yellow")] = QColor( (int)(255.0*1), (int)(255.0*1), (int)(255.0*0));
+ namedColors[QStringLiteral("Apricot")] = QColor( (int)(255.0*1), (int)(255.0*0.68), (int)(255.0*0.48));
+ namedColors[QStringLiteral("Emerald")] = QColor( (int)(255.0*0), (int)(255.0*1), (int)(255.0*0.5));
+ namedColors[QStringLiteral("Fuchsia")] = QColor( (int)(255.0*0.45), (int)(255.0*0.01), (int)(255.0*0.92));
+ namedColors[QStringLiteral("Magenta")] = QColor( (int)(255.0*1), (int)(255.0*0), (int)(255.0*1));
+ namedColors[QStringLiteral("SkyBlue")] = QColor( (int)(255.0*0.38), (int)(255.0*1), (int)(255.0*0.88));
+ namedColors[QStringLiteral("Thistle")] = QColor( (int)(255.0*0.88), (int)(255.0*0.41), (int)(255.0*1));
+ namedColors[QStringLiteral("BrickRed")] = QColor( (int)(255.0*0.72), (int)(255.0*0), (int)(255.0*0));
+ namedColors[QStringLiteral("Cerulean")] = QColor( (int)(255.0*0.06), (int)(255.0*0.89), (int)(255.0*1));
+ namedColors[QStringLiteral("Lavender")] = QColor( (int)(255.0*1), (int)(255.0*0.52), (int)(255.0*1));
+ namedColors[QStringLiteral("Mahogany")] = QColor( (int)(255.0*0.65), (int)(255.0*0), (int)(255.0*0));
+ namedColors[QStringLiteral("Mulberry")] = QColor( (int)(255.0*0.64), (int)(255.0*0.08), (int)(255.0*0.98));
+ namedColors[QStringLiteral("NavyBlue")] = QColor( (int)(255.0*0.06), (int)(255.0*0.46), (int)(255.0*1));
+ namedColors[QStringLiteral("SeaGreen")] = QColor( (int)(255.0*0.31), (int)(255.0*1), (int)(255.0*0.5));
+ namedColors[QStringLiteral("TealBlue")] = QColor( (int)(255.0*0.12), (int)(255.0*0.98), (int)(255.0*0.64));
+ namedColors[QStringLiteral("BlueGreen")] = QColor( (int)(255.0*0.15), (int)(255.0*1), (int)(255.0*0.67));
+ namedColors[QStringLiteral("CadetBlue")] = QColor( (int)(255.0*0.38), (int)(255.0*0.43), (int)(255.0*0.77));
+ namedColors[QStringLiteral("Dandelion")] = QColor( (int)(255.0*1), (int)(255.0*0.71), (int)(255.0*0.16));
+ namedColors[QStringLiteral("Goldenrod")] = QColor( (int)(255.0*1), (int)(255.0*0.9), (int)(255.0*0.16));
+ namedColors[QStringLiteral("LimeGreen")] = QColor( (int)(255.0*0.5), (int)(255.0*1), (int)(255.0*0));
+ namedColors[QStringLiteral("OrangeRed")] = QColor( (int)(255.0*1), (int)(255.0*0), (int)(255.0*0.5));
+ namedColors[QStringLiteral("PineGreen")] = QColor( (int)(255.0*0), (int)(255.0*0.75), (int)(255.0*0.16));
+ namedColors[QStringLiteral("RawSienna")] = QColor( (int)(255.0*0.55), (int)(255.0*0), (int)(255.0*0));
+ namedColors[QStringLiteral("RedOrange")] = QColor( (int)(255.0*1), (int)(255.0*0.23), (int)(255.0*0.13));
+ namedColors[QStringLiteral("RedViolet")] = QColor( (int)(255.0*0.59), (int)(255.0*0), (int)(255.0*0.66));
+ namedColors[QStringLiteral("Rhodamine")] = QColor( (int)(255.0*1), (int)(255.0*0.18), (int)(255.0*1));
+ namedColors[QStringLiteral("RoyalBlue")] = QColor( (int)(255.0*0), (int)(255.0*0.5), (int)(255.0*1));
+ namedColors[QStringLiteral("RubineRed")] = QColor( (int)(255.0*1), (int)(255.0*0), (int)(255.0*0.87));
+ namedColors[QStringLiteral("Turquoise")] = QColor( (int)(255.0*0.15), (int)(255.0*1), (int)(255.0*0.8));
+ namedColors[QStringLiteral("VioletRed")] = QColor( (int)(255.0*1), (int)(255.0*0.19), (int)(255.0*1));
+ namedColors[QStringLiteral("Aquamarine")] = QColor( (int)(255.0*0.18), (int)(255.0*1), (int)(255.0*0.7));
+ namedColors[QStringLiteral("BlueViolet")] = QColor( (int)(255.0*0.1), (int)(255.0*0.05), (int)(255.0*0.96));
+ namedColors[QStringLiteral("DarkOrchid")] = QColor( (int)(255.0*0.6), (int)(255.0*0.2), (int)(255.0*0.8));
+ namedColors[QStringLiteral("OliveGreen")] = QColor( (int)(255.0*0), (int)(255.0*0.6), (int)(255.0*0));
+ namedColors[QStringLiteral("Periwinkle")] = QColor( (int)(255.0*0.43), (int)(255.0*0.45), (int)(255.0*1));
+ namedColors[QStringLiteral("Bittersweet")] = QColor( (int)(255.0*0.76), (int)(255.0*0.01), (int)(255.0*0));
+ namedColors[QStringLiteral("BurntOrange")] = QColor( (int)(255.0*1), (int)(255.0*0.49), (int)(255.0*0));
+ namedColors[QStringLiteral("ForestGreen")] = QColor( (int)(255.0*0), (int)(255.0*0.88), (int)(255.0*0));
+ namedColors[QStringLiteral("GreenYellow")] = QColor( (int)(255.0*0.85), (int)(255.0*1), (int)(255.0*0.31));
+ namedColors[QStringLiteral("JungleGreen")] = QColor( (int)(255.0*0.01), (int)(255.0*1), (int)(255.0*0.48));
+ namedColors[QStringLiteral("ProcessBlue")] = QColor( (int)(255.0*0.04), (int)(255.0*1), (int)(255.0*1));
+ namedColors[QStringLiteral("RoyalPurple")] = QColor( (int)(255.0*0.25), (int)(255.0*0.1), (int)(255.0*1));
+ namedColors[QStringLiteral("SpringGreen")] = QColor( (int)(255.0*0.74), (int)(255.0*1), (int)(255.0*0.24));
+ namedColors[QStringLiteral("YellowGreen")] = QColor( (int)(255.0*0.56), (int)(255.0*1), (int)(255.0*0.26));
+ namedColors[QStringLiteral("MidnightBlue")] = QColor( (int)(255.0*0), (int)(255.0*0.44), (int)(255.0*0.57));
+ namedColors[QStringLiteral("YellowOrange")] = QColor( (int)(255.0*1), (int)(255.0*0.58), (int)(255.0*0));
+ namedColors[QStringLiteral("CarnationPink")] = QColor( (int)(255.0*1), (int)(255.0*0.37), (int)(255.0*1));
+ namedColors[QStringLiteral("CornflowerBlue")] = QColor( (int)(255.0*0.35), (int)(255.0*0.87), (int)(255.0*1));
+ namedColors[QStringLiteral("WildStrawberry")] = QColor( (int)(255.0*1), (int)(255.0*0.04), (int)(255.0*0.61));
}
QString specType = colorSpec.section(' ', 0, 0);
- if (specType.indexOf("rgb", 0, Qt::CaseInsensitive) == 0) {
+ if (specType.indexOf(QStringLiteral("rgb"), 0, Qt::CaseInsensitive) == 0) {
bool ok;
double r = colorSpec.section(' ', 1, 1).toDouble(&ok);
@@ -135,7 +135,7 @@ QColor dviRenderer::parseColorSpecification(const QString& colorSpec)
return QColor((int)(r*255.0+0.5), (int)(g*255.0+0.5), (int)(b*255.0+0.5));
}
- if (specType.indexOf("hsb", 0, Qt::CaseInsensitive) == 0) {
+ if (specType.indexOf(QStringLiteral("hsb"), 0, Qt::CaseInsensitive) == 0) {
bool ok;
double h = colorSpec.section(' ', 1, 1).toDouble(&ok);
@@ -153,7 +153,7 @@ QColor dviRenderer::parseColorSpecification(const QString& colorSpec)
return QColor::fromHsv((int)(h*359.0+0.5), (int)(s*255.0+0.5), (int)(b*255.0+0.5));
}
- if (specType.indexOf("cmyk", 0, Qt::CaseInsensitive) == 0) {
+ if (specType.indexOf(QStringLiteral("cmyk"), 0, Qt::CaseInsensitive) == 0) {
bool ok;
double c = colorSpec.section(' ', 1, 1).toDouble(&ok);
@@ -186,7 +186,7 @@ QColor dviRenderer::parseColorSpecification(const QString& colorSpec)
return QColor((int)(r*255.0+0.5), (int)(g*255.0+0.5), (int)(b*255.0+0.5));
}
- if (specType.indexOf("gray", 0, Qt::CaseInsensitive) == 0) {
+ if (specType.indexOf(QStringLiteral("gray"), 0, Qt::CaseInsensitive) == 0) {
bool ok;
double g = colorSpec.section(' ', 1, 1).toDouble(&ok);
@@ -211,7 +211,7 @@ void dviRenderer::color_special(const QString& _cp)
QString command = cp.section(' ', 0, 0);
- if (command == "pop") {
+ if (command == QLatin1String("pop")) {
// Take color off the stack
if (colorStack.isEmpty())
printErrorMsgForSpecials( i18n("Error in DVIfile '%1', page %2. Color pop command issued when the color stack is empty." ,
@@ -221,7 +221,7 @@ void dviRenderer::color_special(const QString& _cp)
return;
}
- if (command == "push") {
+ if (command == QLatin1String("push")) {
// Get color specification
const QColor col = parseColorSpecification(cp.section(' ', 1));
// Set color
@@ -355,10 +355,10 @@ void dviRenderer::epsf_special(const QString& cp)
QMimeDatabase db;
QMimeType const mime_type = db.mimeTypeForFile(EPSfilename, QMimeDatabase::MatchContent);
QString const & mime_type_name = mime_type.isValid() ? mime_type.name() : QString();
- bool const isGFX = (mime_type_name == "image/png" ||
- mime_type_name == "image/gif" ||
- mime_type_name == "image/jpeg" ||
- mime_type_name == "video/x-mng");
+ bool const isGFX = (mime_type_name == QLatin1String("image/png") ||
+ mime_type_name == QLatin1String("image/gif") ||
+ mime_type_name == QLatin1String("image/jpeg") ||
+ mime_type_name == QLatin1String("video/x-mng"));
// So, if we do not have a PostScript file, but a graphics file, and
// if that file exists, we draw it here.
@@ -447,7 +447,7 @@ void dviRenderer::TPIC_flushPath_special()
#endif
if (number_of_elements_in_path == 0) {
- printErrorMsgForSpecials("TPIC special flushPath called when path was empty.");
+ printErrorMsgForSpecials(QStringLiteral("TPIC special flushPath called when path was empty."));
return;
}
@@ -469,12 +469,12 @@ void dviRenderer::TPIC_addPath_special(const QString& cp)
bool ok;
float xKoord = cp_noWhiteSpace.section(' ', 0, 0).toFloat(&ok);
if (ok == false) {
- printErrorMsgForSpecials( QString("TPIC special; cannot parse first argument in 'pn %1'.").arg(cp) );
+ printErrorMsgForSpecials( QStringLiteral("TPIC special; cannot parse first argument in 'pn %1'.").arg(cp) );
return;
}
float yKoord = cp_noWhiteSpace.section(' ', 1, 1).toFloat(&ok);
if (ok == false) {
- printErrorMsgForSpecials( QString("TPIC special; cannot parse second argument in 'pn %1'.").arg(cp) );
+ printErrorMsgForSpecials( QStringLiteral("TPIC special; cannot parse second argument in 'pn %1'.").arg(cp) );
return;
}
@@ -502,7 +502,7 @@ void dviRenderer::TPIC_setPen_special(const QString& cp)
bool ok;
penWidth_in_mInch = cp.trimmed().toFloat(&ok);
if (ok == false) {
- printErrorMsgForSpecials( QString("TPIC special; cannot parse argument in 'pn %1'.").arg(cp) );
+ printErrorMsgForSpecials( QStringLiteral("TPIC special; cannot parse argument in 'pn %1'.").arg(cp) );
penWidth_in_mInch = 0.0;
return;
}
@@ -567,7 +567,7 @@ void dviRenderer::applicationDoSpecial(char *cp)
// interpreter for every page which makes it really slow. This is a
// major nuisance, so that we try to filter and interpret the
// hypertex generated PostScript here.
- if (special_command.startsWith("ps:SDict begin")) {
+ if (special_command.startsWith(QLatin1String("ps:SDict begin"))) {
// Hyperref: start of hyperref rectangle. At this stage it is not
// yet clear if the rectangle will conain a hyperlink, an anchor,
@@ -583,19 +583,19 @@ void dviRenderer::applicationDoSpecial(char *cp)
// soon as characters are drawn, the drawing routines will
// allocate a Hyperlink and add it to the top of the vector
// currentlyDrawnPage->hyperLinkList.
- if (special_command == "ps:SDict begin H.S end") {
+ if (special_command == QLatin1String("ps:SDict begin H.S end")) {
// At this stage, the vector 'hyperLinkList' should not contain
// links with unspecified destinations (i.e. destination set to
// 'glopglyph'). As a protection against bad DVI files, we make
// sure to remove all link rectangles which point to
// 'glopglyph'.
while (!currentlyDrawnPage->hyperLinkList.isEmpty())
- if (currentlyDrawnPage->hyperLinkList.last().linkText == "glopglyph")
+ if (currentlyDrawnPage->hyperLinkList.last().linkText == QLatin1String("glopglyph"))
currentlyDrawnPage->hyperLinkList.pop_back();
else
break;
- HTML_href = new QString("glopglyph");
+ HTML_href = new QString(QStringLiteral("glopglyph"));
return;
}
@@ -607,7 +607,7 @@ void dviRenderer::applicationDoSpecial(char *cp)
// file, this special command is immediately followed by another
// special, where the destination is specified. This special is
// treated below.
- if ((special_command == "ps:SDict begin H.R end") || special_command.endsWith("H.L end")) {
+ if ((special_command == QLatin1String("ps:SDict begin H.R end")) || special_command.endsWith(QLatin1String("H.L end"))) {
if (HTML_href != NULL) {
delete HTML_href;
HTML_href = NULL;
@@ -626,13 +626,13 @@ void dviRenderer::applicationDoSpecial(char *cp)
// special comes directly after the "H.S" special. A
// hyperlink-anchor rectangle therefore never contains characters,
// so no character will by accidentally underlined in blue.
- if (special_command.endsWith("H.A end")) {
+ if (special_command.endsWith(QLatin1String("H.A end"))) {
if (HTML_href != NULL) {
delete HTML_href;
HTML_href = NULL;
}
while (!currentlyDrawnPage->hyperLinkList.isEmpty())
- if (currentlyDrawnPage->hyperLinkList.last().linkText == "glopglyph")
+ if (currentlyDrawnPage->hyperLinkList.last().linkText == QLatin1String("glopglyph"))
currentlyDrawnPage->hyperLinkList.pop_back();
else
break;
@@ -648,12 +648,12 @@ void dviRenderer::applicationDoSpecial(char *cp)
// drawing routines sometimes split a single hyperlink rectangle
// into several rectangles (e.g. if the font changes, or when a
// line break is encountered)
- if (special_command.startsWith("ps:SDict begin [") && special_command.endsWith(" pdfmark end")) {
+ if (special_command.startsWith(QLatin1String("ps:SDict begin [")) && special_command.endsWith(QLatin1String(" pdfmark end"))) {
if (!currentlyDrawnPage->hyperLinkList.isEmpty()) {
QString targetName = special_command.section('(', 1, 1).section(')', 0, 0);
QVector<Hyperlink>::iterator it;
for( it = currentlyDrawnPage->hyperLinkList.begin(); it != currentlyDrawnPage->hyperLinkList.end(); ++it )
- if (it->linkText == "glopglyph")
+ if (it->linkText == QLatin1String("glopglyph"))
it->linkText = targetName;
}
return; // hyperref definition of link/anchor/bookmark/etc
@@ -664,8 +664,8 @@ void dviRenderer::applicationDoSpecial(char *cp)
// package. If one of these specials is found, the state of the
// painter is saved, and the coordinate system is rotated
// accordingly
- if (special_command.startsWith("ps: gsave currentpoint currentpoint translate ") &&
- special_command.endsWith(" neg rotate neg exch neg exch translate") ) {
+ if (special_command.startsWith(QLatin1String("ps: gsave currentpoint currentpoint translate ")) &&
+ special_command.endsWith(QLatin1String(" neg rotate neg exch neg exch translate")) ) {
bool ok;
double angle = special_command.section(' ', 5, 5).toDouble(&ok);
if (ok == true) {
@@ -684,7 +684,7 @@ void dviRenderer::applicationDoSpecial(char *cp)
// The graphicx package marks the end of rotated text with this
// special. The state of the painter is restored.
- if (special_command == "ps: currentpoint grestore moveto") {
+ if (special_command == QLatin1String("ps: currentpoint grestore moveto")) {
foreGroundPainter->restore();
}
diff --git a/generators/dvi/util.cpp b/generators/dvi/util.cpp
index 50b30cf..47de56d 100644
--- a/generators/dvi/util.cpp
+++ b/generators/dvi/util.cpp
@@ -95,7 +95,7 @@ please report the problem."));
*/
unsigned long num(FILE *fp, int size)
{
- register long x = 0;
+ long x = 0;
while (size--) x = (x << 8) | one(fp);
return x;
@@ -103,7 +103,7 @@ unsigned long num(FILE *fp, int size)
long snum(FILE *fp, int size)
{
- register long x;
+ long x;
#ifdef __STDC__
x = (signed char) getc(fp);
diff --git a/generators/epub/converter.cpp b/generators/epub/converter.cpp
index c7d07b1..16a6b5b 100644
--- a/generators/epub/converter.cpp
+++ b/generators/epub/converter.cpp
@@ -44,7 +44,7 @@ QString _strPack(char **str, int size)
res = QString::fromUtf8(str[0]);
for (int i=1;i<size;i++) {
- res += ", ";
+ res += QLatin1String(", ");
res += QString::fromUtf8(str[i]);
}
@@ -94,7 +94,7 @@ void Converter::_handle_anchors(const QTextBlock &start, const QString &name) {
if (href.isRelative()) { // Inside document link
if(!hrefString.indexOf('#'))
hrefString = name + hrefString;
- else if(QFileInfo(hrefString).path() == "." && curDir != ".")
+ else if(QFileInfo(hrefString).path() == QLatin1String(".") && curDir != QLatin1String("."))
hrefString = curDir + '/' + hrefString;
// QTextCharFormat sometimes splits a link in two
@@ -190,7 +190,7 @@ QTextDocument* Converter::convert( const QString &fileName )
_emitData(Okular::DocumentInfo::CreationDate, EPUB_DATE);
_emitData(Okular::DocumentInfo::Category, EPUB_TYPE);
_emitData(Okular::DocumentInfo::Copyright, EPUB_RIGHTS);
- emit addMetaData( Okular::DocumentInfo::MimeType, "application/epub+zip");
+ emit addMetaData( Okular::DocumentInfo::MimeType, QStringLiteral("application/epub+zip"));
struct eiterator *it;
@@ -212,23 +212,23 @@ QTextDocument* Converter::convert( const QString &fileName )
QString htmlContent = QString::fromUtf8(epub_it_get_curr(it));
// as QTextCharFormat::anchorNames() ignores sections, replace it with <p>
- htmlContent.replace(QRegExp("< *section"),"<p");
- htmlContent.replace(QRegExp("< */ *section"),"</p");
+ htmlContent.replace(QRegExp(QStringLiteral("< *section")),QStringLiteral("<p"));
+ htmlContent.replace(QRegExp(QStringLiteral("< */ *section")),QStringLiteral("</p"));
// convert svg tags to img
const int maxHeight = mTextDocument->maxContentHeight();
const int maxWidth = mTextDocument->maxContentWidth();
QDomDocument dom;
if(dom.setContent(htmlContent)) {
- QDomNodeList svgs = dom.elementsByTagName("svg");
+ QDomNodeList svgs = dom.elementsByTagName(QStringLiteral("svg"));
if(!svgs.isEmpty()) {
QList< QDomNode > imgNodes;
for (int i = 0; i < svgs.length(); ++i) {
- QDomNodeList images = svgs.at(i).toElement().elementsByTagName("image");
+ QDomNodeList images = svgs.at(i).toElement().elementsByTagName(QStringLiteral("image"));
for (int j = 0; j < images.length(); ++j) {
- QString lnk = images.at(i).toElement().attribute("xlink:href");
- int ht = images.at(i).toElement().attribute("height").toInt();
- int wd = images.at(i).toElement().attribute("width").toInt();
+ QString lnk = images.at(i).toElement().attribute(QStringLiteral("xlink:href"));
+ int ht = images.at(i).toElement().attribute(QStringLiteral("height")).toInt();
+ int wd = images.at(i).toElement().attribute(QStringLiteral("width")).toInt();
QImage img = mTextDocument->loadResource(QTextDocument::ImageResource,QUrl(lnk)).value<QImage>();
if(ht == 0) ht = img.height();
if(wd == 0) wd = img.width();
@@ -236,7 +236,7 @@ QTextDocument* Converter::convert( const QString &fileName )
if(wd > maxWidth) wd = maxWidth;
mTextDocument->addResource(QTextDocument::ImageResource,QUrl(lnk),img);
QDomDocument newDoc;
- newDoc.setContent(QString("<img src=\"%1\" height=\"%2\" width=\"%3\" />").arg(lnk).arg(ht).arg(wd));
+ newDoc.setContent(QStringLiteral("<img src=\"%1\" height=\"%2\" width=\"%3\" />").arg(lnk).arg(ht).arg(wd));
imgNodes.append(newDoc.documentElement());
}
foreach (QDomNode nd, imgNodes) {
@@ -246,11 +246,11 @@ QTextDocument* Converter::convert( const QString &fileName )
}
// handle embedded videos
- QDomNodeList videoTags = dom.elementsByTagName("video");
+ QDomNodeList videoTags = dom.elementsByTagName(QStringLiteral("video"));
while(!videoTags.isEmpty()) {
- QDomNodeList sourceTags = videoTags.at(0).toElement().elementsByTagName("source");
+ QDomNodeList sourceTags = videoTags.at(0).toElement().elementsByTagName(QStringLiteral("source"));
if(!sourceTags.isEmpty()) {
- QString lnk = sourceTags.at(0).toElement().attribute("src");
+ QString lnk = sourceTags.at(0).toElement().attribute(QStringLiteral("src"));
Okular::Movie *movie = new Okular::Movie(mTextDocument->loadResource(EpubDocument::MovieResource,QUrl(lnk)).toString());
movie->setSize(videoSize);
@@ -261,17 +261,17 @@ QTextDocument* Converter::convert( const QString &fileName )
movieAnnots.push_back(annot);
QDomDocument tempDoc;
- tempDoc.setContent(QString("<pre>&lt;video&gt;&lt;/video&gt;</pre>"));
+ tempDoc.setContent(QStringLiteral("<pre>&lt;video&gt;&lt;/video&gt;</pre>"));
videoTags.at(0).parentNode().replaceChild(tempDoc.documentElement(),videoTags.at(0));
}
}
//handle embedded audio
- QDomNodeList audioTags = dom.elementsByTagName("audio");
+ QDomNodeList audioTags = dom.elementsByTagName(QStringLiteral("audio"));
while(!audioTags.isEmpty()) {
QDomElement element = audioTags.at(0).toElement();
- bool repeat = element.hasAttribute("loop");
- QString lnk = element.attribute("src");
+ bool repeat = element.hasAttribute(QStringLiteral("loop"));
+ QString lnk = element.attribute(QStringLiteral("src"));
Okular::Sound *sound = new Okular::Sound(mTextDocument->loadResource(
EpubDocument::AudioResource, QUrl(lnk)).toByteArray());
@@ -280,7 +280,7 @@ QTextDocument* Converter::convert( const QString &fileName )
soundActions.push_back(soundAction);
QDomDocument tempDoc;
- tempDoc.setContent(QString("<pre>&lt;audio&gt;&lt;/audio&gt;</pre>"));
+ tempDoc.setContent(QStringLiteral("<pre>&lt;audio&gt;&lt;/audio&gt;</pre>"));
audioTags.at(0).parentNode().replaceChild(tempDoc.documentElement(),audioTags.at(0));
}
htmlContent = dom.toString();
@@ -297,11 +297,11 @@ QTextDocument* Converter::convert( const QString &fileName )
QTextBlock before;
if(firstPage) {
// preHtml & postHtml make it possible to have a margin around the content of the page
- const QString preHtml = QString("<html><head></head><body>"
+ const QString preHtml = QStringLiteral("<html><head></head><body>"
"<table style=\"-qt-table-type: root; margin-top:%1px; margin-bottom:%1px; margin-left:%1px; margin-right:%1px;\">"
"<tr>"
"<td style=\"border: none;\">").arg(mTextDocument->padding);
- const QString postHtml = "</tr></table></body></html>";
+ const QString postHtml = QStringLiteral("</tr></table></body></html>");
mTextDocument->setHtml(preHtml + htmlContent + postHtml);
firstPage = false;
before = mTextDocument->begin();
@@ -316,10 +316,10 @@ QTextDocument* Converter::convert( const QString &fileName )
QTextCursor csr(mTextDocument); // a temporary cursor
csr.movePosition(QTextCursor::Start);
int index = 0;
- while( !(csr = mTextDocument->find("<video></video>",csr)).isNull() ) {
+ while( !(csr = mTextDocument->find(QStringLiteral("<video></video>"),csr)).isNull() ) {
const int posStart = csr.position();
const QPoint startPoint = calculateXYPosition(mTextDocument, posStart);
- QImage img(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "okular/pics/okular-epub-movie.png"));
+ QImage img(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("okular/pics/okular-epub-movie.png")));
img = img.scaled(videoSize);
csr.insertImage(img);
const int posEnd = csr.position();
@@ -331,10 +331,10 @@ QTextDocument* Converter::convert( const QString &fileName )
csr.movePosition(QTextCursor::Start);
index = 0;
- const QString keyToSearch("<audio></audio>");
+ const QString keyToSearch(QStringLiteral("<audio></audio>"));
while( !(csr = mTextDocument->find(keyToSearch, csr)).isNull() ) {
const int posStart = csr.position() - keyToSearch.size();
- const QImage img(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "okular/pics/okular-epub-sound-icon.png"));
+ const QImage img(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("okular/pics/okular-epub-sound-icon.png")));
csr.insertImage(img);
const int posEnd = csr.position();
qDebug() << posStart << posEnd;;
@@ -353,7 +353,7 @@ QTextDocument* Converter::convert( const QString &fileName )
_cursor->insertBlock(QTextBlockFormat());
while(mTextDocument->pageCount() == page)
- _cursor->insertText("\n");
+ _cursor->insertText(QStringLiteral("\n"));
}
} while (epub_it_get_next(it));
@@ -400,7 +400,7 @@ QTextDocument* Converter::convert( const QString &fileName )
// Start new file in a new page
int page = mTextDocument->pageCount();
while(mTextDocument->pageCount() == page)
- _cursor->insertText("\n");
+ _cursor->insertText(QStringLiteral("\n"));
}
free(data);
diff --git a/generators/epub/epubdocument.cpp b/generators/epub/epubdocument.cpp
index 3b0ef56..ac69b74 100644
--- a/generators/epub/epubdocument.cpp
+++ b/generators/epub/epubdocument.cpp
@@ -72,7 +72,7 @@ int EpubDocument::maxContentWidth() const
void EpubDocument::checkCSS(QString &css)
{
// remove paragraph line-heights
- css.remove(QRegExp("line-height\\s*:\\s*[\\w\\.]*;"));
+ css.remove(QRegExp(QStringLiteral("line-height\\s*:\\s*[\\w\\.]*;")));
}
QVariant EpubDocument::loadResource(int type, const QUrl &name)
@@ -105,7 +105,7 @@ QVariant EpubDocument::loadResource(int type, const QUrl &name)
break;
}
case EpubDocument::MovieResource: {
- QTemporaryFile *tmp = new QTemporaryFile(QString("%1/okrXXXXXX").arg(QDir::tempPath()),this);
+ QTemporaryFile *tmp = new QTemporaryFile(QStringLiteral("%1/okrXXXXXX").arg(QDir::tempPath()),this);
if(!tmp->open()) qCWarning(OkularEpuDebug) << "EPUB : error creating temporary video file";
if(tmp->write(data,size) == -1) qCWarning(OkularEpuDebug) << "EPUB : error writing data" << tmp->errorString();
tmp->flush();
diff --git a/generators/epub/generator_epub.cpp b/generators/epub/generator_epub.cpp
index 79c220a..d8d8b07 100644
--- a/generators/epub/generator_epub.cpp
+++ b/generators/epub/generator_epub.cpp
@@ -18,15 +18,15 @@
static KAboutData createAboutData()
{
KAboutData aboutData(
- "okular_epub",
+ QStringLiteral("okular_epub"),
i18n("EPub Backend"),
- "0.2.3",
+ QStringLiteral("0.2.3"),
i18n("An EPub backend"),
KAboutLicense::GPL,
i18n("© 2008 Ely Levy")
);
aboutData.addAuthor(i18n("Ely Levy"), QString(),
- "elylevy@cs.huji.ac.il");
+ QStringLiteral("elylevy@cs.huji.ac.il"));
return aboutData;
}
@@ -34,7 +34,7 @@ static KAboutData createAboutData()
OKULAR_EXPORT_PLUGIN( EPubGenerator, createAboutData() )
EPubGenerator::EPubGenerator( QObject *parent, const QVariantList &args )
-: Okular::TextDocumentGenerator(new Epub::Converter, "okular_epub_generator_settings", parent, args)
+: Okular::TextDocumentGenerator(new Epub::Converter, QStringLiteral("okular_epub_generator_settings"), parent, args)
{
}
@@ -46,7 +46,7 @@ void EPubGenerator::addPages( KConfigDialog* dlg )
{
Okular::TextDocumentSettingsWidget *widget = new Okular::TextDocumentSettingsWidget();
- dlg->addPage( widget, generalSettings(), i18n("EPub"), "application-epub+zip", i18n("EPub Backend Configuration") );
+ dlg->addPage( widget, generalSettings(), i18n("EPub"), QStringLiteral("application-epub+zip"), i18n("EPub Backend Configuration") );
}
#include "generator_epub.moc"
diff --git a/generators/fax/generator_fax.cpp b/generators/fax/generator_fax.cpp
index d6d770d..823db27 100644
--- a/generators/fax/generator_fax.cpp
+++ b/generators/fax/generator_fax.cpp
@@ -49,7 +49,7 @@ FaxGenerator::~FaxGenerator()
bool FaxGenerator::loadDocument( const QString & fileName, QVector<Okular::Page*> & pagesVector )
{
- if ( fileName.toLower().endsWith( ".g3" ) )
+ if ( fileName.toLower().endsWith( QLatin1String(".g3") ) )
m_type = FaxDocument::G3;
else
m_type = FaxDocument::G4;
@@ -96,9 +96,9 @@ Okular::DocumentInfo FaxGenerator::generateDocumentInfo( const QSet<Okular::Docu
if ( keys.contains( Okular::DocumentInfo::MimeType ) )
{
if ( m_type == FaxDocument::G3 )
- docInfo.set( Okular::DocumentInfo::MimeType, "image/fax-g3" );
+ docInfo.set( Okular::DocumentInfo::MimeType, QStringLiteral("image/fax-g3") );
else
- docInfo.set( Okular::DocumentInfo::MimeType, "image/fax-g4" );
+ docInfo.set( Okular::DocumentInfo::MimeType, QStringLiteral("image/fax-g4") );
}
return docInfo;
}
diff --git a/generators/fictionbook/converter.cpp b/generators/fictionbook/converter.cpp
index 707d3bf..86ea25f 100644
--- a/generators/fictionbook/converter.cpp
+++ b/generators/fictionbook/converter.cpp
@@ -274,7 +274,7 @@ bool Converter::convertTitleInfo( const QDomElement &element )
if ( !convertAuthor( child, firstName, middleName, lastName, dummy, dummy ) )
return false;
- mTitleInfo->mAuthor = QString( "%1 %2 %3" ).arg( firstName, middleName, lastName );
+ mTitleInfo->mAuthor = QStringLiteral( "%1 %2 %3" ).arg( firstName, middleName, lastName );
} else if ( child.tagName() == QLatin1String( "book-title" ) ) {
if ( !convertTextNode( child, mTitleInfo->mTitle ) )
return false;
@@ -312,7 +312,7 @@ bool Converter::convertDocumentInfo( const QDomElement &element )
if ( !convertAuthor( child, firstName, middleName, lastName, email, nickname ) )
return false;
- mDocumentInfo->mAuthor = QString( "%1 %2 %3 <%4> (%5)" )
+ mDocumentInfo->mAuthor = QStringLiteral( "%1 %2 %3 <%4> (%5)" )
.arg( firstName ).arg( middleName ).arg( lastName )
.arg( email ).arg( nickname );
} else if ( child.tagName() == QLatin1String( "program-used" ) ) {
@@ -378,16 +378,16 @@ bool Converter::convertTextNode( const QDomElement &element, QString &data )
bool Converter::convertDate( const QDomElement &element, QDate &date )
{
- if ( element.hasAttribute( "value" ) )
- date = QDate::fromString( element.attribute( "value" ), Qt::ISODate );
+ if ( element.hasAttribute( QStringLiteral("value") ) )
+ date = QDate::fromString( element.attribute( QStringLiteral("value") ), Qt::ISODate );
return true;
}
bool Converter::convertSection( const QDomElement &element )
{
- if ( element.hasAttribute( "id" ) )
- mSectionMap.insert( element.attribute( "id" ), mCursor->block() );
+ if ( element.hasAttribute( QStringLiteral("id") ) )
+ mSectionMap.insert( element.attribute( QStringLiteral("id") ), mCursor->block() );
mSectionCounter++;
@@ -576,7 +576,7 @@ bool Converter::convertStyle( const QDomElement &element )
bool Converter::convertBinary( const QDomElement &element )
{
- const QString id = element.attribute( "id" );
+ const QString id = element.attribute( QStringLiteral("id") );
const QDomText textNode = element.firstChild().toText();
QByteArray data = textNode.data().toLatin1();
@@ -604,7 +604,7 @@ bool Converter::convertCover( const QDomElement &element )
bool Converter::convertImage( const QDomElement &element )
{
- QString href = element.attributeNS( "http://www.w3.org/1999/xlink", "href" );
+ QString href = element.attributeNS( QStringLiteral("http://www.w3.org/1999/xlink"), QStringLiteral("href") );
if ( href.startsWith( '#' ) )
href = href.mid( 1 );
@@ -707,17 +707,17 @@ bool Converter::convertCite( const QDomElement &element )
bool Converter::convertEmptyLine( const QDomElement& )
{
- mCursor->insertText( "\n\n" );
+ mCursor->insertText( QStringLiteral("\n\n") );
return true;
}
bool Converter::convertLink( const QDomElement &element )
{
- QString href = element.attributeNS( "http://www.w3.org/1999/xlink", "href" );
- QString type = element.attributeNS( "http://www.w3.org/1999/xlink", "type" );
+ QString href = element.attributeNS( QStringLiteral("http://www.w3.org/1999/xlink"), QStringLiteral("href") );
+ QString type = element.attributeNS( QStringLiteral("http://www.w3.org/1999/xlink"), QStringLiteral("type") );
- if ( type == "note" )
- mCursor->insertText( "[" );
+ if ( type == QLatin1String("note") )
+ mCursor->insertText( QStringLiteral("[") );
int startPosition = mCursor->position();
@@ -755,8 +755,8 @@ bool Converter::convertLink( const QDomElement &element )
int endPosition = mCursor->position();
- if ( type == "note" )
- mCursor->insertText( "]" );
+ if ( type == QLatin1String("note") )
+ mCursor->insertText( QStringLiteral("]") );
if ( href.startsWith( '#' ) ) { // local link
mLocalLinks.insert( href.mid( 1 ), QPair<int, int>( startPosition, endPosition ) );
diff --git a/generators/fictionbook/document.cpp b/generators/fictionbook/document.cpp
index 1da2f51..49c4aaa 100644
--- a/generators/fictionbook/document.cpp
+++ b/generators/fictionbook/document.cpp
@@ -27,7 +27,7 @@ bool Document::open()
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 @@ bool Document::open()
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;
}
diff --git a/generators/fictionbook/generator_fb.cpp b/generators/fictionbook/generator_fb.cpp
index d2550a2..c5d5ddd 100644
--- a/generators/fictionbook/generator_fb.cpp
+++ b/generators/fictionbook/generator_fb.cpp
@@ -33,7 +33,7 @@ static KAboutData createAboutData()
OKULAR_EXPORT_PLUGIN( FictionBookGenerator, createAboutData() )
FictionBookGenerator::FictionBookGenerator( QObject *parent, const QVariantList &args )
- : Okular::TextDocumentGenerator( new FictionBook::Converter, "okular_fictionbook_generator_settings", parent, args )
+ : Okular::TextDocumentGenerator( new FictionBook::Converter, QStringLiteral("okular_fictionbook_generator_settings"), parent, args )
{
}
@@ -41,7 +41,7 @@ void FictionBookGenerator::addPages( KConfigDialog* dlg )
{
Okular::TextDocumentSettingsWidget *widget = new Okular::TextDocumentSettingsWidget();
- dlg->addPage( widget, generalSettings(), i18n("FictionBook"), "okular-fb2", i18n("FictionBook Backend Configuration") );
+ dlg->addPage( widget, generalSettings(), i18n("FictionBook"), QStringLiteral("okular-fb2"), i18n("FictionBook Backend Configuration") );
}
#include "generator_fb.moc"
diff --git a/generators/ooo/converter.cpp b/generators/ooo/converter.cpp
index e34f393..79acdbb 100644
--- a/generators/ooo/converter.cpp
+++ b/generators/ooo/converter.cpp
@@ -225,7 +225,7 @@ bool Converter::convertText( const QDomElement &element )
bool Converter::convertHeader( QTextCursor *cursor, const QDomElement &element )
{
- const QString styleName = element.attribute( "style-name" );
+ const QString styleName = element.attribute( QStringLiteral("style-name") );
const StyleFormatProperty property = mStyleInformation->styleProperty( styleName );
QTextBlockFormat blockFormat;
@@ -252,14 +252,14 @@ bool Converter::convertHeader( QTextCursor *cursor, const QDomElement &element )
child = child.nextSibling();
}
- emit addTitle( element.attribute( "outline-level", 0 ).toInt(), element.text(), cursor->block() );
+ emit addTitle( element.attribute( QStringLiteral("outline-level"), 0 ).toInt(), element.text(), cursor->block() );
return true;
}
bool Converter::convertParagraph( QTextCursor *cursor, const QDomElement &element, const QTextBlockFormat &parentFormat, bool merge )
{
- const QString styleName = element.attribute( "style-name" );
+ const QString styleName = element.attribute( QStringLiteral("style-name") );
const StyleFormatProperty property = mStyleInformation->styleProperty( styleName );
QTextBlockFormat blockFormat( parentFormat );
@@ -280,10 +280,10 @@ bool Converter::convertParagraph( QTextCursor *cursor, const QDomElement &elemen
if ( !convertSpan( cursor, childElement, textFormat ) )
return false;
} else if ( childElement.tagName() == QLatin1String( "tab" ) ) {
- mCursor->insertText( " " );
+ mCursor->insertText( QStringLiteral(" ") );
} else if ( childElement.tagName() == QLatin1String( "s" ) ) {
QString spaces;
- spaces.fill( ' ', childElement.attribute( "c" ).toInt() );
+ spaces.fill( ' ', childElement.attribute( QStringLiteral("c") ).toInt() );
mCursor->insertText( spaces );
} else if ( childElement.tagName() == QLatin1String( "frame" ) ) {
if ( !convertFrame( childElement ) )
@@ -316,7 +316,7 @@ bool Converter::convertTextNode( QTextCursor *cursor, const QDomText &element, c
bool Converter::convertSpan( QTextCursor *cursor, const QDomElement &element, const QTextCharFormat &format )
{
- const QString styleName = element.attribute( "style-name" );
+ const QString styleName = element.attribute( QStringLiteral("style-name") );
const StyleFormatProperty property = mStyleInformation->styleProperty( styleName );
QTextCharFormat textFormat( format );
@@ -338,7 +338,7 @@ bool Converter::convertSpan( QTextCursor *cursor, const QDomElement &element, co
bool Converter::convertList( QTextCursor *cursor, const QDomElement &element )
{
- const QString styleName = element.attribute( "style-name" );
+ const QString styleName = element.attribute( QStringLiteral("style-name") );
const ListFormatProperty property = mStyleInformation->listProperty( styleName );
QTextListFormat format;
@@ -458,7 +458,7 @@ bool Converter::convertTable( const QDomElement &element )
QDomElement columnElement = el.firstChildElement();
while ( !columnElement.isNull() ) {
if ( columnElement.tagName() == QLatin1String( "table-cell" ) ) {
- const StyleFormatProperty property = mStyleInformation->styleProperty( columnElement.attribute( "style-name" ) );
+ const StyleFormatProperty property = mStyleInformation->styleProperty( columnElement.attribute( QStringLiteral("style-name") ) );
QTextBlockFormat format;
property.applyTableCell( &format );
@@ -496,8 +496,8 @@ bool Converter::convertTable( const QDomElement &element )
rowCounter++;
} else if ( el.tagName() == QLatin1String( "table-column" ) ) {
- const StyleFormatProperty property = mStyleInformation->styleProperty( el.attribute( "style-name" ) );
- const QString tableColumnNumColumnsRepeated = el.attribute( "number-columns-repeated", "1" );
+ const StyleFormatProperty property = mStyleInformation->styleProperty( el.attribute( QStringLiteral("style-name") ) );
+ const QString tableColumnNumColumnsRepeated = el.attribute( QStringLiteral("number-columns-repeated"), QStringLiteral("1") );
int numColumnsToApplyTo = tableColumnNumColumnsRepeated.toInt();
for (int i = 0; i < numColumnsToApplyTo; ++i) {
property.applyTableColumn( &tableFormat );
@@ -515,10 +515,10 @@ bool Converter::convertFrame( const QDomElement &element )
QDomElement child = element.firstChildElement();
while ( !child.isNull() ) {
if ( child.tagName() == QLatin1String( "image" ) ) {
- const QString href = child.attribute( "href" );
+ const QString href = child.attribute( QStringLiteral("href") );
QTextImageFormat format;
- format.setWidth( StyleParser::convertUnit( element.attribute( "width" ) ) );
- format.setHeight( StyleParser::convertUnit( element.attribute( "height" ) ) );
+ format.setWidth( StyleParser::convertUnit( element.attribute( QStringLiteral("width") ) ) );
+ format.setHeight( StyleParser::convertUnit( element.attribute( QStringLiteral("height") ) ) );
format.setName( href );
mCursor->insertImage( format );
@@ -553,7 +553,7 @@ bool Converter::convertLink( QTextCursor *cursor, const QDomElement &element, co
int endPosition = cursor->position();
- Okular::Action *action = new Okular::BrowseAction( QUrl(element.attribute( "href" )) );
+ Okular::Action *action = new Okular::BrowseAction( QUrl(element.attribute( QStringLiteral("href") )) );
emit addAction( action, startPosition, endPosition );
return true;
@@ -582,7 +582,7 @@ bool Converter::convertAnnotation( QTextCursor *cursor, const QDomElement &eleme
Okular::TextAnnotation *annotation = new Okular::TextAnnotation;
annotation->setAuthor( creator );
- annotation->setContents( contents.join( "\n" ) );
+ annotation->setContents( contents.join( QStringLiteral("\n") ) );
annotation->setCreationDate( dateTime );
annotation->style().setColor( QColor( "#ffff00" ) );
annotation->style().setOpacity( 0.5 );
diff --git a/generators/ooo/document.cpp b/generators/ooo/document.cpp
index 1a12a45..6dd97c7 100644
--- a/generators/ooo/document.cpp
+++ b/generators/ooo/document.cpp
@@ -37,62 +37,62 @@ bool Document::open( const QString &password )
}
const QStringList entries = directory->entries();
- if ( !entries.contains( "META-INF" ) ) {
+ if ( !entries.contains( QStringLiteral("META-INF") ) ) {
setError( i18n( "Invalid document structure (META-INF directory is missing)" ) );
return false;
}
- const KArchiveDirectory *metaInfDirectory = static_cast<const KArchiveDirectory*>( directory->entry( "META-INF" ) );
- if ( !(metaInfDirectory->entries().contains( "manifest.xml" ) ) ) {
+ const KArchiveDirectory *metaInfDirectory = static_cast<const KArchiveDirectory*>( directory->entry( QStringLiteral("META-INF") ) );
+ if ( !(metaInfDirectory->entries().contains( QStringLiteral("manifest.xml") ) ) ) {
setError( i18n( "Invalid document structure (META-INF/manifest.xml is missing)" ) );
return false;
}
- const KArchiveFile *file = static_cast<const KArchiveFile*>( metaInfDirectory->entry( "manifest.xml" ) );
+ const KArchiveFile *file = static_cast<const KArchiveFile*>( metaInfDirectory->entry( QStringLiteral("manifest.xml") ) );
mManifest = new Manifest( mFileName, file->data(), password );
// we should really get the file names from the manifest, but for now, we only care
// if the manifest says the files are encrypted.
- if ( !entries.contains( "content.xml" ) ) {
+ if ( !entries.contains( QStringLiteral("content.xml") ) ) {
setError( i18n( "Invalid document structure (content.xml is missing)" ) );
return false;
}
- file = static_cast<const KArchiveFile*>( directory->entry( "content.xml" ) );
- if ( mManifest->testIfEncrypted( "content.xml" ) ) {
+ file = static_cast<const KArchiveFile*>( directory->entry( QStringLiteral("content.xml") ) );
+ if ( mManifest->testIfEncrypted( QStringLiteral("content.xml") ) ) {
mAnyEncrypted = true;
- mContent = mManifest->decryptFile( "content.xml", file->data() );
+ mContent = mManifest->decryptFile( QStringLiteral("content.xml"), file->data() );
} else {
mContent = file->data();
}
- if ( entries.contains( "styles.xml" ) ) {
- file = static_cast<const KArchiveFile*>( directory->entry( "styles.xml" ) );
- if ( mManifest->testIfEncrypted( "styles.xml" ) ) {
+ if ( entries.contains( QStringLiteral("styles.xml") ) ) {
+ file = static_cast<const KArchiveFile*>( directory->entry( QStringLiteral("styles.xml") ) );
+ if ( mManifest->testIfEncrypted( QStringLiteral("styles.xml") ) ) {
mAnyEncrypted = true;
- mStyles = mManifest->decryptFile( "styles.xml", file->data() );
+ mStyles = mManifest->decryptFile( QStringLiteral("styles.xml"), file->data() );
} else {
mStyles = file->data();
}
}
- if ( entries.contains( "meta.xml" ) ) {
- file = static_cast<const KArchiveFile*>( directory->entry( "meta.xml" ) );
- if ( mManifest->testIfEncrypted( "meta.xml" ) ) {
+ if ( entries.contains( QStringLiteral("meta.xml") ) ) {
+ file = static_cast<const KArchiveFile*>( directory->entry( QStringLiteral("meta.xml") ) );
+ if ( mManifest->testIfEncrypted( QStringLiteral("meta.xml") ) ) {
mAnyEncrypted = true;
- mMeta = mManifest->decryptFile( "meta.xml", file->data() );
+ mMeta = mManifest->decryptFile( QStringLiteral("meta.xml"), file->data() );
} else {
mMeta = file->data();
}
}
- if ( entries.contains( "Pictures" ) ) {
- const KArchiveDirectory *imagesDirectory = static_cast<const KArchiveDirectory*>( directory->entry( "Pictures" ) );
+ if ( entries.contains( QStringLiteral("Pictures") ) ) {
+ const KArchiveDirectory *imagesDirectory = static_cast<const KArchiveDirectory*>( directory->entry( QStringLiteral("Pictures") ) );
const QStringList imagesEntries = imagesDirectory->entries();
for ( int i = 0; i < imagesEntries.count(); ++i ) {
file = static_cast<const KArchiveFile*>( imagesDirectory->entry( imagesEntries[ i ] ) );
- QString fullPath = QString( "Pictures/%1" ).arg( imagesEntries[ i ] );
+ QString fullPath = QStringLiteral( "Pictures/%1" ).arg( imagesEntries[ i ] );
if ( mManifest->testIfEncrypted( fullPath ) ) {
mAnyEncrypted = true;
mImages.insert( fullPath, mManifest->decryptFile( fullPath, file->data() ) );
diff --git a/generators/ooo/formatproperty.cpp b/generators/ooo/formatproperty.cpp
index f5b7305..1b7edd0 100644
--- a/generators/ooo/formatproperty.cpp
+++ b/generators/ooo/formatproperty.cpp
@@ -16,7 +16,7 @@
using namespace OOO;
FontFormatProperty::FontFormatProperty()
- : mFamily( "Nimbus Sans L" )
+ : mFamily( QStringLiteral("Nimbus Sans L") )
{
}
diff --git a/generators/ooo/generator_ooo.cpp b/generators/ooo/generator_ooo.cpp
index ad09b2f..23708c8 100644
--- a/generators/ooo/generator_ooo.cpp
+++ b/generators/ooo/generator_ooo.cpp
@@ -34,7 +34,7 @@ static KAboutData createAboutData()
OKULAR_EXPORT_PLUGIN( KOOOGenerator, createAboutData() )
KOOOGenerator::KOOOGenerator( QObject *parent, const QVariantList &args )
- : Okular::TextDocumentGenerator( new OOO::Converter, "okular_ooo_generator_settings", parent, args )
+ : Okular::TextDocumentGenerator( new OOO::Converter, QStringLiteral("okular_ooo_generator_settings"), parent, args )
{
}
@@ -42,7 +42,7 @@ void KOOOGenerator::addPages( KConfigDialog* dlg )
{
Okular::TextDocumentSettingsWidget *widget = new Okular::TextDocumentSettingsWidget();
- dlg->addPage( widget, generalSettings(), i18n("OpenDocument Text"), "application-vnd.oasis.opendocument.text", i18n("OpenDocument Text Backend Configuration") );
+ dlg->addPage( widget, generalSettings(), i18n("OpenDocument Text"), QStringLiteral("application-vnd.oasis.opendocument.text"), i18n("OpenDocument Text Backend Configuration") );
}
void KOOOGenerator::walletDataForFile( const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey ) const
diff --git a/generators/ooo/manifest.cpp b/generators/ooo/manifest.cpp
index e166879..b71d8e3 100644
--- a/generators/ooo/manifest.cpp
+++ b/generators/ooo/manifest.cpp
@@ -144,50 +144,50 @@ Manifest::Manifest( const QString &odfFileName, const QByteArray &manifestData,
continue;
}
if (xml.tokenType() == QXmlStreamReader::StartElement) {
- if ( xml.name().toString() == "manifest" ) {
+ if ( xml.name().toString() == QLatin1String("manifest") ) {
continue;
- } else if ( xml.name().toString() == "file-entry" ) {
+ } else if ( xml.name().toString() == QLatin1String("file-entry") ) {
QXmlStreamAttributes attributes = xml.attributes();
if (currentEntry != 0) {
qCWarning(OkularOooDebug) << "Got new StartElement for new file-entry, but haven't finished the last one yet!";
- qCWarning(OkularOooDebug) << "processing" << currentEntry->fileName() << ", got" << attributes.value("manifest:full-path").toString();
+ qCWarning(OkularOooDebug) << "processing" << currentEntry->fileName() << ", got" << attributes.value(QStringLiteral("manifest:full-path")).toString();
}
- currentEntry = new ManifestEntry( attributes.value("manifest:full-path").toString() );
- currentEntry->setMimeType( attributes.value("manifest:media-type").toString() );
- currentEntry->setSize( attributes.value("manifest:size").toString() );
- } else if ( xml.name().toString() == "encryption-data" ) {
+ currentEntry = new ManifestEntry( attributes.value(QStringLiteral("manifest:full-path")).toString() );
+ currentEntry->setMimeType( attributes.value(QStringLiteral("manifest:media-type")).toString() );
+ currentEntry->setSize( attributes.value(QStringLiteral("manifest:size")).toString() );
+ } else if ( xml.name().toString() == QLatin1String("encryption-data") ) {
if (currentEntry == 0) {
qCWarning(OkularOooDebug) << "Got encryption-data without valid file-entry at line" << xml.lineNumber();
continue;
}
QXmlStreamAttributes encryptionAttributes = xml.attributes();
- currentEntry->setChecksumType( encryptionAttributes.value("manifest:checksum-type").toString() );
- currentEntry->setChecksum( encryptionAttributes.value("manifest:checksum").toString() );
- } else if ( xml.name().toString() == "algorithm" ) {
+ currentEntry->setChecksumType( encryptionAttributes.value(QStringLiteral("manifest:checksum-type")).toString() );
+ currentEntry->setChecksum( encryptionAttributes.value(QStringLiteral("manifest:checksum")).toString() );
+ } else if ( xml.name().toString() == QLatin1String("algorithm") ) {
if (currentEntry == 0) {
qCWarning(OkularOooDebug) << "Got algorithm without valid file-entry at line" << xml.lineNumber();
continue;
}
QXmlStreamAttributes algorithmAttributes = xml.attributes();
- currentEntry->setAlgorithm( algorithmAttributes.value("manifest:algorithm-name").toString() );
- currentEntry->setInitialisationVector( algorithmAttributes.value("manifest:initialisation-vector").toString() );
- } else if ( xml.name().toString() == "key-derivation" ) {
+ currentEntry->setAlgorithm( algorithmAttributes.value(QStringLiteral("manifest:algorithm-name")).toString() );
+ currentEntry->setInitialisationVector( algorithmAttributes.value(QStringLiteral("manifest:initialisation-vector")).toString() );
+ } else if ( xml.name().toString() == QLatin1String("key-derivation") ) {
if (currentEntry == 0) {
qCWarning(OkularOooDebug) << "Got key-derivation without valid file-entry at line" << xml.lineNumber();
continue;
}
QXmlStreamAttributes kdfAttributes = xml.attributes();
- currentEntry->setKeyDerivationName( kdfAttributes.value("manifest:key-derivation-name").toString() );
- currentEntry->setIterationCount( kdfAttributes.value("manifest:iteration-count").toString() );
- currentEntry->setSalt( kdfAttributes.value("manifest:salt").toString() );
+ currentEntry->setKeyDerivationName( kdfAttributes.value(QStringLiteral("manifest:key-derivation-name")).toString() );
+ currentEntry->setIterationCount( kdfAttributes.value(QStringLiteral("manifest:iteration-count")).toString() );
+ currentEntry->setSalt( kdfAttributes.value(QStringLiteral("manifest:salt")).toString() );
} else {
// handle other StartDocument types here
qCWarning(OkularOooDebug) << "Unexpected start document type: " << xml.name().toString();
}
} else if ( xml.tokenType() == QXmlStreamReader::EndElement ) {
- if ( xml.name().toString() == "manifest" ) {
+ if ( xml.name().toString() == QLatin1String("manifest") ) {
continue;
- } else if ( xml.name().toString() == "file-entry") {
+ } else if ( xml.name().toString() == QLatin1String("file-entry")) {
if (currentEntry == 0) {
qCWarning(OkularOooDebug) << "Got EndElement for file-entry without valid StartElement at line" << xml.lineNumber();
continue;
@@ -232,21 +232,21 @@ bool Manifest::testIfEncrypted( const QString &filename )
void Manifest::checkPassword( ManifestEntry *entry, const QByteArray &fileData, QByteArray *decryptedData )
{
#ifdef QCA2
- QCA::SymmetricKey key = QCA::PBKDF2( "sha1" ).makeKey( QCA::Hash( "sha1" ).hash( m_password.toLocal8Bit() ),
+ QCA::SymmetricKey key = QCA::PBKDF2( QStringLiteral("sha1") ).makeKey( QCA::Hash( QStringLiteral("sha1") ).hash( m_password.toLocal8Bit() ),
QCA::InitializationVector( entry->salt() ),
16, //128 bit key
entry->iterationCount() );
- QCA::Cipher decoder( "blowfish", QCA::Cipher::CFB, QCA::Cipher::DefaultPadding,
+ QCA::Cipher decoder( QStringLiteral("blowfish"), QCA::Cipher::CFB, QCA::Cipher::DefaultPadding,
QCA::Decode, key, QCA::InitializationVector( entry->initialisationVector() ) );
*decryptedData = decoder.update( QCA::MemoryRegion(fileData) ).toByteArray();
*decryptedData += decoder.final().toByteArray();
QByteArray csum;
- if ( entry->checksumType() == "SHA1/1K" ) {
- csum = QCA::Hash( "sha1").hash( decryptedData->left(1024) ).toByteArray();
- } else if ( entry->checksumType() == "SHA1" ) {
- csum = QCA::Hash( "sha1").hash( *decryptedData ).toByteArray();
+ if ( entry->checksumType() == QLatin1String("SHA1/1K") ) {
+ csum = QCA::Hash( QStringLiteral("sha1")).hash( decryptedData->left(1024) ).toByteArray();
+ } else if ( entry->checksumType() == QLatin1String("SHA1") ) {
+ csum = QCA::Hash( QStringLiteral("sha1")).hash( *decryptedData ).toByteArray();
} else {
qCDebug(OkularOooDebug) << "unknown checksum type: " << entry->checksumType();
// we can only assume it will be OK.
@@ -294,7 +294,7 @@ QByteArray Manifest::decryptFile( const QString &filename, const QByteArray &fil
return QByteArray();
}
- QIODevice *decompresserDevice = KFilterDev::device( new QBuffer( &decryptedData, 0 ), "application/x-gzip", true );
+ QIODevice *decompresserDevice = KFilterDev::device( new QBuffer( &decryptedData, 0 ), QStringLiteral("application/x-gzip"), true );
if( !decompresserDevice ) {
qCDebug(OkularOooDebug) << "Couldn't create decompressor";
// hopefully it isn't compressed then!
diff --git a/generators/ooo/styleinformation.cpp b/generators/ooo/styleinformation.cpp
index f751568..072f36d 100644
--- a/generators/ooo/styleinformation.cpp
+++ b/generators/ooo/styleinformation.cpp
@@ -96,7 +96,7 @@ void StyleInformation::setMasterPageName( const QString &name )
QString StyleInformation::masterPageName() const
{
- return mMasterPageName.isEmpty() ? mMasterLayouts[ "Standard" ] : mMasterLayouts[ mMasterPageName ];
+ return mMasterPageName.isEmpty() ? mMasterLayouts[ QStringLiteral("Standard") ] : mMasterLayouts[ mMasterPageName ];
}
void StyleInformation::addMetaInformation( const QString &key, const QString &value, const QString &title )
diff --git a/generators/ooo/styleparser.cpp b/generators/ooo/styleparser.cpp
index d4a38e8..0547b84 100644
--- a/generators/ooo/styleparser.cpp
+++ b/generators/ooo/styleparser.cpp
@@ -133,18 +133,18 @@ bool StyleParser::parseMetaFile()
QDomElement child = element.firstChildElement();
while ( !child.isNull() ) {
if ( child.tagName() == QLatin1String( "generator" ) ) {
- mStyleInformation->addMetaInformation( "producer", child.text(), i18n( "Producer" ) );
+ mStyleInformation->addMetaInformation( QStringLiteral("producer"), child.text(), i18n( "Producer" ) );
} else if ( child.tagName() == QLatin1String( "creation-date" ) ) {
const QDateTime dateTime = QDateTime::fromString( child.text(), Qt::ISODate );
- mStyleInformation->addMetaInformation( "creationDate", QLocale().toString( dateTime, QLocale::LongFormat ),
+ mStyleInformation->addMetaInformation( QStringLiteral("creationDate"), QLocale().toString( dateTime, QLocale::LongFormat ),
i18n( "Created" ) );
} else if ( child.tagName() == QLatin1String( "initial-creator" ) ) {
- mStyleInformation->addMetaInformation( "creator", child.text(), i18n( "Creator" ) );
+ mStyleInformation->addMetaInformation( QStringLiteral("creator"), child.text(), i18n( "Creator" ) );
} else if ( child.tagName() == QLatin1String( "creator" ) ) {
- mStyleInformation->addMetaInformation( "author", child.text(), i18n( "Author" ) );
+ mStyleInformation->addMetaInformation( QStringLiteral("author"), child.text(), i18n( "Author" ) );
} else if ( child.tagName() == QLatin1String( "date" ) ) {
const QDateTime dateTime = QDateTime::fromString( child.text(), Qt::ISODate );
- mStyleInformation->addMetaInformation( "modificationDate", QLocale().toString( dateTime, QLocale::LongFormat ),
+ mStyleInformation->addMetaInformation( QStringLiteral("modificationDate"), QLocale().toString( dateTime, QLocale::LongFormat ),
i18n( "Modified" ) );
}
@@ -169,9 +169,9 @@ bool StyleParser::parseFontFaceDecls( QDomElement &parent )
while ( !element.isNull() ) {
if ( element.tagName() == QLatin1String( "font-face" ) ) {
FontFormatProperty property;
- property.setFamily( element.attribute( "font-family" ) );
+ property.setFamily( element.attribute( QStringLiteral("font-family") ) );
- mStyleInformation->addFontProperty( element.attribute( "name" ), property );
+ mStyleInformation->addFontProperty( element.attribute( QStringLiteral("name") ), property );
} else {
qDebug( "unknown tag %s", qPrintable( element.tagName() ) );
}
@@ -192,9 +192,9 @@ bool StyleParser::parseMasterStyles( QDomElement &parent )
QDomElement element = parent.firstChildElement();
while ( !element.isNull() ) {
if ( element.tagName() == QLatin1String( "master-page" ) ) {
- mStyleInformation->addMasterLayout( element.attribute( "name" ), element.attribute( "page-layout-name" ) );
+ mStyleInformation->addMasterLayout( element.attribute( QStringLiteral("name") ), element.attribute( QStringLiteral("page-layout-name") ) );
if ( !mMasterPageNameSet ) {
- mStyleInformation->setMasterPageName( element.attribute( "name" ) );
+ mStyleInformation->setMasterPageName( element.attribute( QStringLiteral("name") ) );
mMasterPageNameSet = true;
}
} else {
@@ -213,24 +213,24 @@ bool StyleParser::parseAutomaticStyles( QDomElement &parent )
while ( !element.isNull() ) {
if ( element.tagName() == QLatin1String( "style" ) ) {
const StyleFormatProperty property = parseStyleProperty( element );
- mStyleInformation->addStyleProperty( element.attribute( "name" ), property );
+ mStyleInformation->addStyleProperty( element.attribute( QStringLiteral("name") ), property );
} else if ( element.tagName() == QLatin1String( "page-layout" ) ) {
QDomElement child = element.firstChildElement();
while ( !child.isNull() ) {
if ( child.tagName() == QLatin1String( "page-layout-properties" ) ) {
const PageFormatProperty property = parsePageProperty( child );
- mStyleInformation->addPageProperty( element.attribute( "name" ), property );
+ mStyleInformation->addPageProperty( element.attribute( QStringLiteral("name") ), property );
}
child = child.nextSiblingElement();
}
} else if ( element.tagName() == QLatin1String( "list-style" ) ) {
const ListFormatProperty property = parseListProperty( element );
- mStyleInformation->addListProperty( element.attribute( "name" ), property );
+ mStyleInformation->addListProperty( element.attribute( QStringLiteral("name") ), property );
} else if ( element.tagName() == QLatin1String( "default-style" ) ) {
StyleFormatProperty property = parseStyleProperty( element );
property.setDefaultStyle( true );
- mStyleInformation->addStyleProperty( element.attribute( "family" ), property );
+ mStyleInformation->addStyleProperty( element.attribute( QStringLiteral("family") ), property );
} else {
qDebug( "unknown tag %s", qPrintable( element.tagName() ) );
}
@@ -245,12 +245,12 @@ StyleFormatProperty StyleParser::parseStyleProperty( QDomElement &parent )
{
StyleFormatProperty property( mStyleInformation );
- property.setParentStyleName( parent.attribute( "parent-style-name" ) );
- property.setFamily( parent.attribute( "family" ) );
- if ( parent.hasAttribute( "master-page-name" ) ) {
- property.setMasterPageName( parent.attribute( "master-page-name" ) );
+ property.setParentStyleName( parent.attribute( QStringLiteral("parent-style-name") ) );
+ property.setFamily( parent.attribute( QStringLiteral("family") ) );
+ if ( parent.hasAttribute( QStringLiteral("master-page-name") ) ) {
+ property.setMasterPageName( parent.attribute( QStringLiteral("master-page-name") ) );
if ( !mMasterPageNameSet ) {
- mStyleInformation->setMasterPageName( parent.attribute( "master-page-name" ) );
+ mStyleInformation->setMasterPageName( parent.attribute( QStringLiteral("master-page-name") ) );
mMasterPageNameSet = true;
}
}
@@ -283,47 +283,47 @@ ParagraphFormatProperty StyleParser::parseParagraphProperty( QDomElement &parent
{
ParagraphFormatProperty property;
- property.setPageNumber( parent.attribute( "page-number" ).toInt() );
+ property.setPageNumber( parent.attribute( QStringLiteral("page-number") ).toInt() );
static QMap<QString, ParagraphFormatProperty::WritingMode> map;
if ( map.isEmpty() ) {
- map.insert( "lr-tb", ParagraphFormatProperty::LRTB );
- map.insert( "rl-tb", ParagraphFormatProperty::RLTB );
- map.insert( "tb-rl", ParagraphFormatProperty::TBRL );
- map.insert( "tb-lr", ParagraphFormatProperty::TBLR );
- map.insert( "lr", ParagraphFormatProperty::LR );
- map.insert( "rl", ParagraphFormatProperty::RL );
- map.insert( "tb", ParagraphFormatProperty::TB );
- map.insert( "page", ParagraphFormatProperty::PAGE );
+ map.insert( QStringLiteral("lr-tb"), ParagraphFormatProperty::LRTB );
+ map.insert( QStringLiteral("rl-tb"), ParagraphFormatProperty::RLTB );
+ map.insert( QStringLiteral("tb-rl"), ParagraphFormatProperty::TBRL );
+ map.insert( QStringLiteral("tb-lr"), ParagraphFormatProperty::TBLR );
+ map.insert( QStringLiteral("lr"), ParagraphFormatProperty::LR );
+ map.insert( QStringLiteral("rl"), ParagraphFormatProperty::RL );
+ map.insert( QStringLiteral("tb"), ParagraphFormatProperty::TB );
+ map.insert( QStringLiteral("page"), ParagraphFormatProperty::PAGE );
}
- property.setWritingMode( map[ parent.attribute( "writing-mode" ) ] );
+ property.setWritingMode( map[ parent.attribute( QStringLiteral("writing-mode") ) ] );
static QMap<QString, Qt::Alignment> alignMap;
if ( alignMap.isEmpty() ) {
- alignMap.insert( "center", Qt::AlignCenter );
- alignMap.insert( "left", Qt::AlignLeft );
- alignMap.insert( "right", Qt::AlignRight );
- alignMap.insert( "justify", Qt::AlignJustify );
+ alignMap.insert( QStringLiteral("center"), Qt::AlignCenter );
+ alignMap.insert( QStringLiteral("left"), Qt::AlignLeft );
+ alignMap.insert( QStringLiteral("right"), Qt::AlignRight );
+ alignMap.insert( QStringLiteral("justify"), Qt::AlignJustify );
if ( property.writingModeIsRightToLeft() ) {
- alignMap.insert( "start", Qt::AlignRight );
- alignMap.insert( "end", Qt::AlignLeft );
+ alignMap.insert( QStringLiteral("start"), Qt::AlignRight );
+ alignMap.insert( QStringLiteral("end"), Qt::AlignLeft );
} else {
// not right to left
- alignMap.insert( "start", Qt::AlignLeft );
- alignMap.insert( "end", Qt::AlignRight );
+ alignMap.insert( QStringLiteral("start"), Qt::AlignLeft );
+ alignMap.insert( QStringLiteral("end"), Qt::AlignRight );
}
}
- if ( parent.hasAttribute( "text-align" ) ) {
- property.setTextAlignment( alignMap[ parent.attribute( "text-align", "left" ) ] );
+ if ( parent.hasAttribute( QStringLiteral("text-align") ) ) {
+ property.setTextAlignment( alignMap[ parent.attribute( QStringLiteral("text-align"), QStringLiteral("left") ) ] );
}
- const QString marginLeft = parent.attribute( "margin-left" );
+ const QString marginLeft = parent.attribute( QStringLiteral("margin-left") );
if ( !marginLeft.isEmpty() ) {
qreal leftMargin = qRound( convertUnit( marginLeft ) );
property.setLeftMargin( leftMargin );
}
- const QString colorText = parent.attribute( "background-color" );
+ const QString colorText = parent.attribute( QStringLiteral("background-color") );
if ( !colorText.isEmpty() && colorText != QLatin1String( "transparent" ) ) {
property.setBackgroundColor( QColor( colorText ) );
}
@@ -335,37 +335,37 @@ TextFormatProperty StyleParser::parseTextProperty( QDomElement &parent )
{
TextFormatProperty property;
- const QString fontSize = parent.attribute( "font-size" );
+ const QString fontSize = parent.attribute( QStringLiteral("font-size") );
if ( !fontSize.isEmpty() )
property.setFontSize( qRound( convertUnit( fontSize ) ) );
static QMap<QString, QFont::Weight> weightMap;
if ( weightMap.isEmpty() ) {
- weightMap.insert( "normal", QFont::Normal );
- weightMap.insert( "bold", QFont::Bold );
+ weightMap.insert( QStringLiteral("normal"), QFont::Normal );
+ weightMap.insert( QStringLiteral("bold"), QFont::Bold );
}
- const QString fontWeight = parent.attribute( "font-weight" );
+ const QString fontWeight = parent.attribute( QStringLiteral("font-weight") );
if ( !fontWeight.isEmpty() )
property.setFontWeight( weightMap[ fontWeight ] );
static QMap<QString, QFont::Style> fontStyleMap;
if ( fontStyleMap.isEmpty() ) {
- fontStyleMap.insert( "normal", QFont::StyleNormal );
- fontStyleMap.insert( "italic", QFont::StyleItalic );
- fontStyleMap.insert( "oblique", QFont::StyleOblique );
+ fontStyleMap.insert( QStringLiteral("normal"), QFont::StyleNormal );
+ fontStyleMap.insert( QStringLiteral("italic"), QFont::StyleItalic );
+ fontStyleMap.insert( QStringLiteral("oblique"), QFont::StyleOblique );
}
- const QString fontStyle = parent.attribute( "font-style" );
+ const QString fontStyle = parent.attribute( QStringLiteral("font-style") );
if ( !fontStyle.isEmpty() )
property.setFontStyle( fontStyleMap.value( fontStyle, QFont::StyleNormal ) );
- const QColor color( parent.attribute( "color" ) );
+ const QColor color( parent.attribute( QStringLiteral("color") ) );
if ( color.isValid() ) {
property.setColor( color );
}
- const QString colorText = parent.attribute( "background-color" );
+ const QString colorText = parent.attribute( QStringLiteral("background-color") );
if ( !colorText.isEmpty() && colorText != QLatin1String( "transparent" ) ) {
property.setBackgroundColor( QColor( colorText ) );
}
@@ -377,12 +377,12 @@ PageFormatProperty StyleParser::parsePageProperty( QDomElement &parent )
{
PageFormatProperty property;
- property.setBottomMargin( convertUnit( parent.attribute( "margin-bottom" ) ) );
- property.setLeftMargin( convertUnit( parent.attribute( "margin-left" ) ) );
- property.setTopMargin( convertUnit( parent.attribute( "margin-top" ) ) );
- property.setRightMargin( convertUnit( parent.attribute( "margin-right" ) ) );
- property.setWidth( convertUnit( parent.attribute( "page-width" ) ) );
- property.setHeight( convertUnit( parent.attribute( "page-height" ) ) );
+ property.setBottomMargin( convertUnit( parent.attribute( QStringLiteral("margin-bottom") ) ) );
+ property.setLeftMargin( convertUnit( parent.attribute( QStringLiteral("margin-left") ) ) );
+ property.setTopMargin( convertUnit( parent.attribute( QStringLiteral("margin-top") ) ) );
+ property.setRightMargin( convertUnit( parent.attribute( QStringLiteral("margin-right") ) ) );
+ property.setWidth( convertUnit( parent.attribute( QStringLiteral("page-width") ) ) );
+ property.setHeight( convertUnit( parent.attribute( QStringLiteral("page-height") ) ) );
return property;
}
@@ -399,11 +399,11 @@ ListFormatProperty StyleParser::parseListProperty( QDomElement &parent )
while ( !element.isNull() ) {
if ( element.tagName() == QLatin1String( "list-level-style-number" ) ) {
- int level = element.attribute( "level" ).toInt();
+ int level = element.attribute( QStringLiteral("level") ).toInt();
property.addItem( level, 0.0 );
} else if ( element.tagName() == QLatin1String( "list-level-style-bullet" ) ) {
- int level = element.attribute( "level" ).toInt();
- property.addItem( level, convertUnit( element.attribute( "space-before" ) ) );
+ int level = element.attribute( QStringLiteral("level") ).toInt();
+ property.addItem( level, convertUnit( element.attribute( QStringLiteral("space-before") ) ) );
}
element = element.nextSiblingElement();
@@ -416,7 +416,7 @@ TableColumnFormatProperty StyleParser::parseTableColumnProperty( QDomElement &pa
{
TableColumnFormatProperty property;
- const double width = convertUnit( parent.attribute( "column-width" ) );
+ const double width = convertUnit( parent.attribute( QStringLiteral("column-width") ) );
property.setWidth( width );
return property;
@@ -426,27 +426,27 @@ TableCellFormatProperty StyleParser::parseTableCellProperty( QDomElement &parent
{
TableCellFormatProperty property;
- if ( parent.hasAttribute( "background-color" ) )
- property.setBackgroundColor( QColor( parent.attribute( "background-color" ) ) );
+ if ( parent.hasAttribute( QStringLiteral("background-color") ) )
+ property.setBackgroundColor( QColor( parent.attribute( QStringLiteral("background-color") ) ) );
- property.setPadding( convertUnit( parent.attribute( "padding" ) ) );
+ property.setPadding( convertUnit( parent.attribute( QStringLiteral("padding") ) ) );
static QMap<QString, Qt::Alignment> map;
if ( map.isEmpty() ) {
- map.insert( "top", Qt::AlignTop );
- map.insert( "middle", Qt::AlignVCenter );
- map.insert( "bottom", Qt::AlignBottom );
- map.insert( "left", Qt::AlignLeft );
- map.insert( "right", Qt::AlignRight );
- map.insert( "center", Qt::AlignHCenter );
+ map.insert( QStringLiteral("top"), Qt::AlignTop );
+ map.insert( QStringLiteral("middle"), Qt::AlignVCenter );
+ map.insert( QStringLiteral("bottom"), Qt::AlignBottom );
+ map.insert( QStringLiteral("left"), Qt::AlignLeft );
+ map.insert( QStringLiteral("right"), Qt::AlignRight );
+ map.insert( QStringLiteral("center"), Qt::AlignHCenter );
}
- if ( parent.hasAttribute( "align" ) && parent.hasAttribute( "vertical-align" ) ) {
- property.setAlignment( map[ parent.attribute( "align" ) ] | map[ parent.attribute( "vertical-align" ) ] );
- } else if ( parent.hasAttribute( "align" ) ) {
- property.setAlignment( map[ parent.attribute( "align" ) ] );
- } else if ( parent.hasAttribute( "vertical-align" ) ) {
- property.setAlignment( map[ parent.attribute( "vertical-align" ) ] );
+ if ( parent.hasAttribute( QStringLiteral("align") ) && parent.hasAttribute( QStringLiteral("vertical-align") ) ) {
+ property.setAlignment( map[ parent.attribute( QStringLiteral("align") ) ] | map[ parent.attribute( QStringLiteral("vertical-align") ) ] );
+ } else if ( parent.hasAttribute( QStringLiteral("align") ) ) {
+ property.setAlignment( map[ parent.attribute( QStringLiteral("align") ) ] );
+ } else if ( parent.hasAttribute( QStringLiteral("vertical-align") ) ) {
+ property.setAlignment( map[ parent.attribute( QStringLiteral("vertical-align") ) ] );
}
return property;
@@ -463,31 +463,31 @@ double StyleParser::convertUnit( const QString &data )
#define CC_TO_POINT(cc) ((cc)*12.840103)
double points = 0;
- if ( data.endsWith( "pt" ) ) {
- points = data.left( data.length() - 2 ).toDouble();
- } else if ( data.endsWith( "cm" ) ) {
- double value = data.left( data.length() - 2 ).toDouble();
+ if ( data.endsWith( QLatin1String("pt") ) ) {
+ points = data.leftRef( data.length() - 2 ).toDouble();
+ } else if ( data.endsWith( QLatin1String("cm") ) ) {
+ double value = data.leftRef( data.length() - 2 ).toDouble();
points = CM_TO_POINT( value );
- } else if ( data.endsWith( "mm" ) ) {
- double value = data.left( data.length() - 2 ).toDouble();
+ } else if ( data.endsWith( QLatin1String("mm") ) ) {
+ double value = data.leftRef( data.length() - 2 ).toDouble();
points = MM_TO_POINT( value );
- } else if ( data.endsWith( "dm" ) ) {
- double value = data.left( data.length() - 2 ).toDouble();
+ } else if ( data.endsWith( QLatin1String("dm") ) ) {
+ double value = data.leftRef( data.length() - 2 ).toDouble();
points = DM_TO_POINT( value );
- } else if ( data.endsWith( "in" ) ) {
- double value = data.left( data.length() - 2 ).toDouble();
+ } else if ( data.endsWith( QLatin1String("in") ) ) {
+ double value = data.leftRef( data.length() - 2 ).toDouble();
points = INCH_TO_POINT( value );
- } else if ( data.endsWith( "inch" ) ) {
- double value = data.left( data.length() - 4 ).toDouble();
+ } else if ( data.endsWith( QLatin1String("inch") ) ) {
+ double value = data.leftRef( data.length() - 4 ).toDouble();
points = INCH_TO_POINT( value );
- } else if ( data.endsWith( "pi" ) ) {
- double value = data.left( data.length() - 4 ).toDouble();
+ } else if ( data.endsWith( QLatin1String("pi") ) ) {
+ double value = data.leftRef( data.length() - 4 ).toDouble();
points = PI_TO_POINT( value );
- } else if ( data.endsWith( "dd" ) ) {
- double value = data.left( data.length() - 4 ).toDouble();
+ } else if ( data.endsWith( QLatin1String("dd") ) ) {
+ double value = data.leftRef( data.length() - 4 ).toDouble();
points = DD_TO_POINT( value );
- } else if ( data.endsWith( "cc" ) ) {
- double value = data.left( data.length() - 4 ).toDouble();
+ } else if ( data.endsWith( QLatin1String("cc") ) ) {
+ double value = data.leftRef( data.length() - 4 ).toDouble();
points = CC_TO_POINT( value );
} else {
if ( !data.isEmpty() ) {
diff --git a/generators/plucker/generator_plucker.cpp b/generators/plucker/generator_plucker.cpp
index afb8672..6850036 100644
--- a/generators/plucker/generator_plucker.cpp
+++ b/generators/plucker/generator_plucker.cpp
@@ -90,7 +90,7 @@ bool PluckerGenerator::loadDocument( const QString & fileName, QVector<Okular::P
it.next();
if ( !it.value().isEmpty() ) {
if ( it.key() == QLatin1String( "name" ) )
- mDocumentInfo.set( "name", it.value(), i18n( "Name" ) );
+ mDocumentInfo.set( QStringLiteral("name"), it.value(), i18n( "Name" ) );
else if ( it.key() == QLatin1String( "title" ) )
mDocumentInfo.set( Okular::DocumentInfo::Title, it.value() );
else if ( it.key() == QLatin1String( "author" ) )
diff --git a/generators/plucker/unpluck/qunpluck.cpp b/generators/plucker/unpluck/qunpluck.cpp
index 47e166f..3bebce0 100644
--- a/generators/plucker/unpluck/qunpluck.cpp
+++ b/generators/plucker/unpluck/qunpluck.cpp
@@ -132,10 +132,10 @@ bool QUnpluck::open( const QString &fileName )
bool status = true;
- mInfo.insert( "name", plkr_GetName( mDocument ) );
- mInfo.insert( "title", plkr_GetTitle( mDocument ) );
- mInfo.insert( "author", plkr_GetAuthor( mDocument ) );
- mInfo.insert( "time", QDateTime::fromTime_t( plkr_GetPublicationTime( mDocument ) ).toString() );
+ mInfo.insert( QStringLiteral("name"), plkr_GetName( mDocument ) );
+ mInfo.insert( QStringLiteral("title"), plkr_GetTitle( mDocument ) );
+ mInfo.insert( QStringLiteral("author"), plkr_GetAuthor( mDocument ) );
+ mInfo.insert( QStringLiteral("time"), QDateTime::fromTime_t( plkr_GetPublicationTime( mDocument ) ).toString() );
AddRecord( plkr_GetHomeRecordID( mDocument ) );
@@ -177,7 +177,7 @@ bool QUnpluck::open( const QString &fileName )
for ( int j = 0; j < context->images.count(); ++j ) {
int imgNumber = context->images[ j ];
context->document->addResource( QTextDocument::ImageResource,
- QUrl( QString( "%1.jpg" ).arg( imgNumber ) ),
+ QUrl( QStringLiteral( "%1.jpg" ).arg( imgNumber ) ),
mImages[ imgNumber ] );
}
@@ -189,15 +189,15 @@ bool QUnpluck::open( const QString &fileName )
// convert record_id into page
for ( int i = 0; i < mLinks.count(); ++i ) {
mLinks[ i ].page = pageHash[ mLinks[ i ].page ];
- if ( mLinks[ i ].url.startsWith( "page:" ) ) {
- int page = mLinks[ i ].url.mid( 5 ).toInt();
+ if ( mLinks[ i ].url.startsWith( QLatin1String("page:") ) ) {
+ int page = mLinks[ i ].url.midRef( 5 ).toInt();
Okular::DocumentViewport viewport( pageHash[ page ] );
viewport.rePos.normalizedX = 0;
viewport.rePos.normalizedY = 0;
viewport.rePos.enabled = true;
viewport.rePos.pos = Okular::DocumentViewport::TopLeft;
mLinks[ i ].link = new Okular::GotoAction( QString(), viewport );
- } else if ( mLinks[ i ].url.startsWith( "para:" ) ) {
+ } else if ( mLinks[ i ].url.startsWith( QLatin1String("para:") ) ) {
QPair<int, QTextBlock> data = mNamedTargets[ mLinks[ i ].url ];
QTextDocument *document = mPages[ mLinks[ i ].page ];
@@ -289,7 +289,7 @@ QString QUnpluck::MailtoURLFromBytes( unsigned char* record_data )
int subject_offset = (bytes[4] << 8) + bytes[5];
int body_offset = (bytes[6] << 8) + bytes[7];
- QString url( "mailto:" );
+ QString url( QStringLiteral("mailto:") );
if ( to_offset != 0 )
url += QString::fromLatin1( (char *)(bytes + to_offset) );
@@ -352,7 +352,7 @@ void QUnpluck::DoStyle( Context* context, int style, bool start )
format.setFontWeight( QFont::Bold );
break;
case 8:
- format.setFontFamily( QString::fromLatin1( "Courier New,courier" ) );
+ format.setFontFamily( QStringLiteral( "Courier New,courier" ) );
break;
}
format.setFontPointSize( qMax( pointSize, 1 ) );
@@ -424,7 +424,7 @@ void QUnpluck::ParseText
{
// TODO: remove the setCharFormat when Qt is fixed
QTextCharFormat format( context->cursor->charFormat() );
- context->cursor->insertText( "\n" );
+ context->cursor->insertText( QStringLiteral("\n") );
context->cursor->setCharFormat( format );
ptr += fclen;
break;
@@ -584,7 +584,7 @@ bool QUnpluck::TranscribeTableRecord
*/
if ( (record_id = READ_BIGENDIAN_SHORT (&ptr[3])) ) {
QTextCharFormat format = context->cursor->charFormat();
- context->cursor->insertImage( QString( "%1.jpg" ).arg(record_id) );
+ context->cursor->insertImage( QStringLiteral( "%1.jpg" ).arg(record_id) );
context->cursor->setCharFormat( format );
context->images.append( record_id );
AddRecord (record_id);
@@ -735,7 +735,7 @@ bool QUnpluck::TranscribeTextRecord
context->cursor->insertBlock( blockFormat );
context->cursor->setCharFormat( format );
- mNamedTargets.insert( QString( "para:%1-%2" ).arg( record_index ).arg( para_index ),
+ mNamedTargets.insert( QStringLiteral( "para:%1-%2" ).arg( record_index ).arg( para_index ),
QPair<int, QTextBlock>( GetPageID( record_index ), context->cursor->block() ) );
current_link = false;
@@ -769,7 +769,7 @@ bool QUnpluck::TranscribeTextRecord
if (fctype == PLKR_TFC_NEWLINE) {
// TODO: remove the setCharFormat when Qt is fixed
QTextCharFormat format( context->cursor->charFormat() );
- context->cursor->insertText( "\n" );
+ context->cursor->insertText( QStringLiteral("\n") );
context->cursor->setCharFormat( format );
}
else if (fctype == PLKR_TFC_LINK) {
@@ -831,11 +831,11 @@ bool QUnpluck::TranscribeTextRecord
if (type == PLKR_DRTYPE_IMAGE
|| type == PLKR_DRTYPE_IMAGE_COMPRESSED) {
- context->linkUrl = QString( "%1.jpg" ).arg( record_id );
+ context->linkUrl = QStringLiteral( "%1.jpg" ).arg( record_id );
context->linkStart = context->cursor->position();
}
else {
- context->linkUrl = QString( "page:%1" ).arg( real_record_id );
+ context->linkUrl = QStringLiteral( "page:%1" ).arg( real_record_id );
context->linkStart = context->cursor->position();
}
QTextCharFormat format( context->cursor->charFormat() );
@@ -848,7 +848,7 @@ bool QUnpluck::TranscribeTextRecord
else if (bytes && (fclen == 4)) {
AddRecord (record_id);
- context->linkUrl = QString( "para:%1-%2" ).arg( record_id ).arg( (ptr[2] << 8) + ptr[3] );
+ context->linkUrl = QStringLiteral( "para:%1-%2" ).arg( record_id ).arg( (ptr[2] << 8) + ptr[3] );
context->linkStart = context->cursor->position();
QTextCharFormat format( context->cursor->charFormat() );
@@ -901,7 +901,7 @@ bool QUnpluck::TranscribeTextRecord
format.setFontWeight( QFont::Bold );
}
else if (*ptr == 8) {
- format.setFontFamily( QString::fromLatin1( "Courier New,courier" ) );
+ format.setFontFamily( QStringLiteral( "Courier New,courier" ) );
}
else if (*ptr == 11) {
format.setVerticalAlignment( QTextCharFormat::AlignSuperScript );
@@ -1059,7 +1059,7 @@ bool QUnpluck::TranscribeTextRecord
} else if (fctype == PLKR_TFC_IMAGE || fctype == PLKR_TFC_IMAGE2) {
QTextCharFormat format = context->cursor->charFormat();
- context->cursor->insertImage( QString( "%1.jpg" ).arg( (ptr[0] << 8) + ptr[1] ) );
+ context->cursor->insertImage( QStringLiteral( "%1.jpg" ).arg( (ptr[0] << 8) + ptr[1] ) );
context->images.append( (ptr[0] << 8) + ptr[1] );
context->cursor->setCharFormat( format );
AddRecord ((ptr[0] << 8) + ptr[1]);
@@ -1179,7 +1179,7 @@ bool QUnpluck::TranscribeRecord( int index )
QTextCharFormat charFormat;
charFormat.setFontPointSize( 10 );
- charFormat.setFontFamily( "Helvetica" );
+ charFormat.setFontFamily( QStringLiteral("Helvetica") );
context->cursor->setCharFormat( charFormat );
status = TranscribeTextRecord( mDocument, index, context, data, type );
diff --git a/generators/poppler/annots.cpp b/generators/poppler/annots.cpp
index 9d32022..df67986 100644
--- a/generators/poppler/annots.cpp
+++ b/generators/poppler/annots.cpp
@@ -88,7 +88,7 @@ void PopplerAnnotationProxy::notifyAddition( Okular::Annotation *okl_ann, int pa
{
// Export annotation to DOM
QDomDocument doc;
- QDomElement dom_ann = doc.createElement( "root" );
+ QDomElement dom_ann = doc.createElement( QStringLiteral("root") );
Okular::AnnotationUtils::storeAnnotation( okl_ann, dom_ann, doc );
QMutexLocker ml(mutex);
@@ -359,7 +359,7 @@ Okular::Annotation* createAnnotationFromPopplerAnnotation( Poppler::Annotation *
{
// this is uber ugly but i don't know a better way to do it without introducing a poppler::annotation dependency on core
QDomDocument doc;
- QDomElement root = doc.createElement( "root" );
+ QDomElement root = doc.createElement( QStringLiteral("root") );
doc.appendChild( root );
Poppler::AnnotationUtils::storeAnnotation( ann, root, doc );
annotation = Okular::AnnotationUtils::createAnnotation( root );
diff --git a/generators/poppler/generator_pdf.cpp b/generators/poppler/generator_pdf.cpp
index c2a7aa7..90db80a 100644
--- a/generators/poppler/generator_pdf.cpp
+++ b/generators/poppler/generator_pdf.cpp
@@ -481,14 +481,14 @@ static QLinkedList<Okular::ObjectRect*> generateLinks( const QList<Poppler::Link
static KAboutData createAboutData()
{
- KAboutData aboutData( "okular_poppler",
+ KAboutData aboutData( QStringLiteral("okular_poppler"),
i18n( "PDF Backend" ),
- "0.6.5",
+ QStringLiteral("0.6.5"),
i18n( "A PDF file renderer" ),
KAboutLicense::GPL,
i18n( "© 2005-2008 Albert Astals Cid" )
);
- aboutData.addAuthor( i18n( "Albert Astals Cid" ), QString(), "aacid@kde.org" );
+ aboutData.addAuthor( i18n( "Albert Astals Cid" ), QString(), QStringLiteral("aacid@kde.org") );
return aboutData;
}
@@ -684,7 +684,7 @@ void PDFGenerator::loadPages(QVector<Okular::Page*> &pagesVector, int rotation,
Okular::DocumentInfo PDFGenerator::generateDocumentInfo( const QSet<Okular::DocumentInfo::Key> &keys ) const
{
Okular::DocumentInfo docInfo;
- docInfo.set( Okular::DocumentInfo::MimeType, "application/pdf" );
+ docInfo.set( Okular::DocumentInfo::MimeType, QStringLiteral("application/pdf") );
userMutex()->lock();
@@ -693,28 +693,28 @@ Okular::DocumentInfo PDFGenerator::generateDocumentInfo( const QSet<Okular::Docu
{
// compile internal structure reading properties from PDFDoc
if ( keys.contains( Okular::DocumentInfo::Title ) )
- docInfo.set( Okular::DocumentInfo::Title, pdfdoc->info("Title") );
+ docInfo.set( Okular::DocumentInfo::Title, pdfdoc->info(QStringLiteral("Title")) );
if ( keys.contains( Okular::DocumentInfo::Subject ) )
- docInfo.set( Okular::DocumentInfo::Subject, pdfdoc->info("Subject") );
+ docInfo.set( Okular::DocumentInfo::Subject, pdfdoc->info(QStringLiteral("Subject")) );
if ( keys.contains( Okular::DocumentInfo::Author ) )
- docInfo.set( Okular::DocumentInfo::Author, pdfdoc->info("Author") );
+ docInfo.set( Okular::DocumentInfo::Author, pdfdoc->info(QStringLiteral("Author")) );
if ( keys.contains( Okular::DocumentInfo::Keywords ) )
- docInfo.set( Okular::DocumentInfo::Keywords, pdfdoc->info("Keywords") );
+ docInfo.set( Okular::DocumentInfo::Keywords, pdfdoc->info(QStringLiteral("Keywords")) );
if ( keys.contains( Okular::DocumentInfo::Creator ) )
- docInfo.set( Okular::DocumentInfo::Creator, pdfdoc->info("Creator") );
+ docInfo.set( Okular::DocumentInfo::Creator, pdfdoc->info(QStringLiteral("Creator")) );
if ( keys.contains( Okular::DocumentInfo::Producer ) )
- docInfo.set( Okular::DocumentInfo::Producer, pdfdoc->info("Producer") );
+ docInfo.set( Okular::DocumentInfo::Producer, pdfdoc->info(QStringLiteral("Producer")) );
if ( keys.contains( Okular::DocumentInfo::CreationDate ) )
- docInfo.set( Okular::DocumentInfo::CreationDate, QLocale().toString( pdfdoc->date("CreationDate"), QLocale::LongFormat ) );
+ docInfo.set( Okular::DocumentInfo::CreationDate, QLocale().toString( pdfdoc->date(QStringLiteral("CreationDate")), QLocale::LongFormat ) );
if ( keys.contains( Okular::DocumentInfo::ModificationDate ) )
- docInfo.set( Okular::DocumentInfo::ModificationDate, QLocale().toString( pdfdoc->date("ModDate"), QLocale::LongFormat ) );
+ docInfo.set( Okular::DocumentInfo::ModificationDate, QLocale().toString( pdfdoc->date(QStringLiteral("ModDate")), QLocale::LongFormat ) );
if ( keys.contains( Okular::DocumentInfo::CustomKeys ) )
{
int major, minor;
pdfdoc->getPdfVersion(&major, &minor);
- docInfo.set( "format", i18nc( "PDF v. <version>", "PDF v. %1.%2", major, minor ), i18n( "Format" ) );
- docInfo.set( "encryption", pdfdoc->isEncrypted() ? i18n( "Encrypted" ) : i18n( "Unencrypted" ), i18n("Security") );
- docInfo.set( "optimization", pdfdoc->isLinearized() ? i18n( "Yes" ) : i18n( "No" ), i18n("Optimized") );
+ docInfo.set( QStringLiteral("format"), i18nc( "PDF v. <version>", "PDF v. %1.%2", major, minor ), i18n( "Format" ) );
+ docInfo.set( QStringLiteral("encryption"), pdfdoc->isEncrypted() ? i18n( "Encrypted" ) : i18n( "Unencrypted" ), i18n("Security") );
+ docInfo.set( QStringLiteral("optimization"), pdfdoc->isLinearized() ? i18n( "Yes" ) : i18n( "No" ), i18n("Optimized") );
}
docInfo.set( Okular::DocumentInfo::Pages, QString::number( pdfdoc->numPages() ) );
@@ -1124,7 +1124,7 @@ bool PDFGenerator::print( QPrinter& printer )
tf.setAutoRemove(false);
- QString pstitle = metaData(QLatin1String("Title"), QVariant()).toString();
+ QString pstitle = metaData(QStringLiteral("Title"), QVariant()).toString();
if ( pstitle.trimmed().isEmpty() )
{
pstitle = document()->currentDocument().fileName();
@@ -1187,14 +1187,14 @@ bool PDFGenerator::print( QPrinter& printer )
QVariant PDFGenerator::metaData( const QString & key, const QVariant & option ) const
{
- if ( key == "StartFullScreen" )
+ if ( key == QLatin1String("StartFullScreen") )
{
QMutexLocker ml(userMutex());
// asking for the 'start in fullscreen mode' (pdf property)
if ( pdfdoc->pageMode() == Poppler::Document::FullScreen )
return true;
}
- else if ( key == "NamedViewport" && !option.toString().isEmpty() )
+ else if ( key == QLatin1String("NamedViewport") && !option.toString().isEmpty() )
{
Okular::DocumentViewport viewport;
QString optionString = option.toString();
@@ -1212,25 +1212,25 @@ QVariant PDFGenerator::metaData( const QString & key, const QVariant & option )
if ( viewport.pageNumber >= 0 )
return viewport.toString();
}
- else if ( key == "DocumentTitle" )
+ else if ( key == QLatin1String("DocumentTitle") )
{
userMutex()->lock();
- QString title = pdfdoc->info( "Title" );
+ QString title = pdfdoc->info( QStringLiteral("Title") );
userMutex()->unlock();
return title;
}
- else if ( key == "OpenTOC" )
+ else if ( key == QLatin1String("OpenTOC") )
{
QMutexLocker ml(userMutex());
if ( pdfdoc->pageMode() == Poppler::Document::UseOutlines )
return true;
}
- else if ( key == "DocumentScripts" && option.toString() == "JavaScript" )
+ else if ( key == QLatin1String("DocumentScripts") && option.toString() == QLatin1String("JavaScript") )
{
QMutexLocker ml(userMutex());
return pdfdoc->scripts();
}
- else if ( key == "HasUnsupportedXfaForm" )
+ else if ( key == QLatin1String("HasUnsupportedXfaForm") )
{
QMutexLocker ml(userMutex());
return pdfdoc->formType() == Poppler::Document::XfaForm;
@@ -1245,7 +1245,7 @@ bool PDFGenerator::reparseConfig()
bool somethingchanged = false;
// load paper color
- QColor color = documentMetaData( "PaperColor", true ).value< QColor >();
+ QColor color = documentMetaData( QStringLiteral("PaperColor"), true ).value< QColor >();
// if paper color is changed we have to rebuild every visible pixmap in addition
// to the outputDevice. it's the 'heaviest' case, other effect are just recoloring
// over the page rendered on 'standard' white background.
@@ -1267,7 +1267,7 @@ void PDFGenerator::addPages( KConfigDialog *dlg )
Ui_PDFSettingsWidget pdfsw;
QWidget* w = new QWidget(dlg);
pdfsw.setupUi(w);
- dlg->addPage(w, PDFSettings::self(), i18n("PDF"), "application-pdf", i18n("PDF Backend Configuration") );
+ dlg->addPage(w, PDFSettings::self(), i18n("PDF"), QStringLiteral("application-pdf"), i18n("PDF Backend Configuration") );
#endif
}
@@ -1319,7 +1319,7 @@ Okular::ExportFormat::List PDFGenerator::exportFormats() const
bool PDFGenerator::exportTo( const QString &fileName, const Okular::ExportFormat &format )
{
- if ( format.mimeType().inherits( QLatin1String( "text/plain" ) ) ) {
+ if ( format.mimeType().inherits( QStringLiteral( "text/plain" ) ) ) {
QFile f( fileName );
if ( !f.open( QIODevice::WriteOnly ) )
return false;
@@ -1410,7 +1410,7 @@ Okular::TextPage * PDFGenerator::abstractTextPage(const QList<Poppler::TextBox*>
// vertically or horizontally aligned
QRectF wordBBox = word->boundingBox();
QRectF nextWordBBox = next->boundingBox();
- append(ktp, " ",
+ append(ktp, QStringLiteral(" "),
wordBBox.right()/width,
wordBBox.bottom()/height,
nextWordBBox.left()/width,
@@ -1433,16 +1433,16 @@ void PDFGenerator::addSynopsisChildren( QDomNode * parent, QDomNode * parentDest
QDomElement item = docSyn.createElement( e.tagName() );
parentDestination->appendChild(item);
- if (!e.attribute("ExternalFileName").isNull()) item.setAttribute("ExternalFileName", e.attribute("ExternalFileName"));
- if (!e.attribute("DestinationName").isNull()) item.setAttribute("ViewportName", e.attribute("DestinationName"));
- if (!e.attribute("Destination").isNull())
+ if (!e.attribute(QStringLiteral("ExternalFileName")).isNull()) item.setAttribute(QStringLiteral("ExternalFileName"), e.attribute(QStringLiteral("ExternalFileName")));
+ if (!e.attribute(QStringLiteral("DestinationName")).isNull()) item.setAttribute(QStringLiteral("ViewportName"), e.attribute(QStringLiteral("DestinationName")));
+ if (!e.attribute(QStringLiteral("Destination")).isNull())
{
Okular::DocumentViewport vp;
- fillViewportFromLinkDestination( vp, Poppler::LinkDestination(e.attribute("Destination")) );
- item.setAttribute( "Viewport", vp.toString() );
+ fillViewportFromLinkDestination( vp, Poppler::LinkDestination(e.attribute(QStringLiteral("Destination"))) );
+ item.setAttribute( QStringLiteral("Viewport"), vp.toString() );
}
- if (!e.attribute("Open").isNull()) item.setAttribute("Open", e.attribute("Open"));
- if (!e.attribute("DestinationURI").isNull()) item.setAttribute("URL", e.attribute("DestinationURI"));
+ if (!e.attribute(QStringLiteral("Open")).isNull()) item.setAttribute(QStringLiteral("Open"), e.attribute(QStringLiteral("Open")));
+ if (!e.attribute(QStringLiteral("DestinationURI")).isNull()) item.setAttribute(QStringLiteral("URL"), e.attribute(QStringLiteral("DestinationURI")));
// descend recursively and advance to the next node
if ( e.hasChildNodes() ) addSynopsisChildren( &n, & item );
@@ -1653,7 +1653,7 @@ void PDFGenerator::loadPdfSync( const QString & filePath, QVector<Okular::Page*>
const QString coreName = ts.readLine();
// second row: version string, in the form 'Version %u'
QString versionstr = ts.readLine();
- QRegExp versionre( "Version (\\d+)" );
+ QRegExp versionre( QStringLiteral("Version (\\d+)") );
versionre.setCaseSensitivity( Qt::CaseInsensitive );
if ( !versionre.exactMatch( versionstr ) )
return;
diff --git a/generators/spectre/generator_ghostview.cpp b/generators/spectre/generator_ghostview.cpp
index d2c2d6c..e2275af 100644
--- a/generators/spectre/generator_ghostview.cpp
+++ b/generators/spectre/generator_ghostview.cpp
@@ -48,7 +48,7 @@ static KAboutData createAboutData()
i18n( "© 2007-2008 Albert Astals Cid" ),
i18n( "Based on the Spectre library." )
);
- aboutData.addAuthor( i18n( "Albert Astals Cid" ), QString(), QLatin1String("aacid@kde.org") );
+ aboutData.addAuthor( i18n( "Albert Astals Cid" ), QString(), QStringLiteral("aacid@kde.org") );
return aboutData;
}
@@ -97,7 +97,7 @@ void GSGenerator::addPages( KConfigDialog *dlg )
Ui_GSSettingsWidget gsw;
QWidget* w = new QWidget(dlg);
gsw.setupUi(w);
- dlg->addPage(w, GSSettings::self(), i18n("Ghostscript"), "okular-gv", i18n("Ghostscript Backend Configuration") );
+ dlg->addPage(w, GSSettings::self(), i18n("Ghostscript"), QStringLiteral("okular-gv"), i18n("Ghostscript Backend Configuration") );
}
bool GSGenerator::print( QPrinter& printer )
@@ -115,7 +115,7 @@ bool GSGenerator::print( QPrinter& printer )
// Default to Postscript export, but if printing to PDF use that instead
SpectreExporterFormat exportFormat = SPECTRE_EXPORTER_FORMAT_PS;
- if ( printer.outputFileName().right(3) == "pdf" )
+ if ( printer.outputFileName().right(3) == QLatin1String("pdf") )
{
exportFormat = SPECTRE_EXPORTER_FORMAT_PDF;
tf.setFileTemplate(QDir::tempPath() + QLatin1String("/okular_XXXXXX.pdf"));
@@ -158,8 +158,8 @@ bool GSGenerator::print( QPrinter& printer )
bool GSGenerator::loadDocument( const QString & fileName, QVector< Okular::Page * > & pagesVector )
{
- cache_AAtext = documentMetaData("TextAntialias", true).toBool();
- cache_AAgfx = documentMetaData("GraphicsAntialias", true).toBool();
+ cache_AAtext = documentMetaData(QStringLiteral("TextAntialias"), true).toBool();
+ cache_AAgfx = documentMetaData(QStringLiteral("GraphicsAntialias"), true).toBool();
m_internalDocument = spectre_document_new();
spectre_document_load(m_internalDocument, QFile::encodeName(fileName).constData());
@@ -273,16 +273,16 @@ Okular::DocumentInfo GSGenerator::generateDocumentInfo( const QSet<Okular::Docum
if ( keys.contains( Okular::DocumentInfo::CreationDate ) )
docInfo.set( Okular::DocumentInfo::CreationDate, spectre_document_get_creation_date(m_internalDocument) );
if ( keys.contains( Okular::DocumentInfo::CustomKeys ) )
- docInfo.set( "dscversion", spectre_document_get_format(m_internalDocument), i18n("Document version") );
+ docInfo.set( QStringLiteral("dscversion"), spectre_document_get_format(m_internalDocument), i18n("Document version") );
if ( keys.contains( Okular::DocumentInfo::MimeType ) )
{
int languageLevel = spectre_document_get_language_level(m_internalDocument);
- if (languageLevel > 0) docInfo.set( "langlevel", QString::number(languageLevel), i18n("Language Level") );
+ if (languageLevel > 0) docInfo.set( QStringLiteral("langlevel"), QString::number(languageLevel), i18n("Language Level") );
if (spectre_document_is_eps(m_internalDocument))
- docInfo.set( Okular::DocumentInfo::MimeType, "image/x-eps" );
+ docInfo.set( Okular::DocumentInfo::MimeType, QStringLiteral("image/x-eps") );
else
- docInfo.set( Okular::DocumentInfo::MimeType, "application/postscript" );
+ docInfo.set( Okular::DocumentInfo::MimeType, QStringLiteral("application/postscript") );
}
if ( keys.contains( Okular::DocumentInfo::Pages ) )
@@ -311,7 +311,7 @@ Okular::Rotation GSGenerator::orientation(SpectreOrientation pageOrientation) co
QVariant GSGenerator::metaData(const QString &key, const QVariant &option) const
{
Q_UNUSED(option)
- if (key == "DocumentTitle")
+ if (key == QLatin1String("DocumentTitle"))
{
const char *title = spectre_document_get_title(m_internalDocument);
if (title)
diff --git a/generators/tiff/generator_tiff.cpp b/generators/tiff/generator_tiff.cpp
index dbf1811..cf4f276 100644
--- a/generators/tiff/generator_tiff.cpp
+++ b/generators/tiff/generator_tiff.cpp
@@ -102,7 +102,7 @@ static QDateTime convertTIFFDateTime( const char* tiffdate )
if ( !tiffdate )
return QDateTime();
- return QDateTime::fromString( QString::fromLatin1( tiffdate ), "yyyy:MM:dd HH:mm:ss" );
+ return QDateTime::fromString( QString::fromLatin1( tiffdate ), QStringLiteral("yyyy:MM:dd HH:mm:ss") );
}
static void adaptSizeToResolution( TIFF *tiff, ttag_t whichres, double dpi, uint32 *size )
@@ -306,7 +306,7 @@ Okular::DocumentInfo TIFFGenerator::generateDocumentInfo( const QSet<Okular::Doc
if ( d->tiff )
{
if ( keys.contains( Okular::DocumentInfo::MimeType ) )
- docInfo.set( Okular::DocumentInfo::MimeType, "image/tiff" );
+ docInfo.set( Okular::DocumentInfo::MimeType, QStringLiteral("image/tiff") );
if ( keys.contains( Okular::DocumentInfo::Description ) )
{
diff --git a/generators/txt/converter.cpp b/generators/txt/converter.cpp
index 5c1abfc..1dad8da 100644
--- a/generators/txt/converter.cpp
+++ b/generators/txt/converter.cpp
@@ -35,7 +35,7 @@ QTextDocument* Converter::convert( const QString &fileName )
QTextFrame *rootFrame = textDocument->rootFrame();
rootFrame->setFrameFormat( frameFormat );
- emit addMetaData( Okular::DocumentInfo::MimeType, "text/plain" );
+ emit addMetaData( Okular::DocumentInfo::MimeType, QStringLiteral("text/plain") );
return textDocument;
}
diff --git a/generators/txt/generator_txt.cpp b/generators/txt/generator_txt.cpp
index 9bc3d75..cffe847 100644
--- a/generators/txt/generator_txt.cpp
+++ b/generators/txt/generator_txt.cpp
@@ -32,7 +32,7 @@ static KAboutData createAboutData()
OKULAR_EXPORT_PLUGIN(TxtGenerator, createAboutData())
TxtGenerator::TxtGenerator(QObject *parent, const QVariantList &args)
- : Okular::TextDocumentGenerator(new Txt::Converter, "okular_txt_generator_settings" , parent, args)
+ : Okular::TextDocumentGenerator(new Txt::Converter, QStringLiteral("okular_txt_generator_settings") , parent, args)
{
}
@@ -40,7 +40,7 @@ void TxtGenerator::addPages( KConfigDialog* dlg )
{
Okular::TextDocumentSettingsWidget *widget = new Okular::TextDocumentSettingsWidget();
- dlg->addPage( widget, generalSettings(), i18n("Txt"), "text-plain", i18n("Txt Backend Configuration") );
+ dlg->addPage( widget, generalSettings(), i18n("Txt"), QStringLiteral("text-plain"), i18n("Txt Backend Configuration") );
}
#include "generator_txt.moc"
diff --git a/generators/xps/generator_xps.cpp b/generators/xps/generator_xps.cpp
index 10c26b1..58bf0f6 100644
--- a/generators/xps/generator_xps.cpp
+++ b/generators/xps/generator_xps.cpp
@@ -162,7 +162,7 @@ static bool nextAbbPathToken(AbbPathToken *token)
{
(*curPos)++;
}
- token->number = data.mid(start, *curPos - start).toDouble();
+ token->number = data.midRef(start, *curPos - start).toDouble();
token->type = abtNumber;
} else if (ch == ',')
@@ -466,7 +466,7 @@ static QPainterPath parseRscRefPath( const QString &data )
static QString entryPath( const QString &entry )
{
const int index = entry.lastIndexOf( QChar::fromLatin1( '/' ) );
- QString ret = QString::fromLatin1( "/" ) + entry.mid( 0, index );
+ QString ret = QLatin1String( "/" ) + entry.mid( 0, index );
if ( index > 0 ) {
ret.append( QChar::fromLatin1( '/' ) );
}
@@ -751,7 +751,7 @@ bool XpsHandler::startDocument()
qCWarning(OkularXpsDebug) << "start document" << m_page->m_fileName ;
XpsRenderNode node;
- node.name = "document";
+ node.name = QStringLiteral("document");
m_nodes.push(node);
return true;
@@ -807,15 +807,15 @@ void XpsHandler::processGlyph( XpsRenderNode &node )
// Get font (doesn't work well because qt doesn't allow to load font from file)
// This works despite the fact that font size isn't specified in points as required by qt. It's because I set point size to be equal to drawing unit.
- float fontSize = node.attributes.value("FontRenderingEmSize").toFloat();
+ float fontSize = node.attributes.value(QStringLiteral("FontRenderingEmSize")).toFloat();
// qCWarning(OkularXpsDebug) << "Font Rendering EmSize:" << fontSize;
// a value of 0.0 means the text is not visible (see XPS specs, chapter 12, "Glyphs")
if ( fontSize < 0.1 ) {
m_painter->restore();
return;
}
- QFont font = m_page->m_file->getFontByName( node.attributes.value("FontUri"), fontSize );
- att = node.attributes.value( "StyleSimulations" );
+ QFont font = m_page->m_file->getFontByName( node.attributes.value(QStringLiteral("FontUri")), fontSize );
+ att = node.attributes.value( QStringLiteral("StyleSimulations") );
if ( !att.isEmpty() ) {
if ( att == QLatin1String( "ItalicSimulation" ) ) {
font.setItalic( true );
@@ -829,13 +829,13 @@ void XpsHandler::processGlyph( XpsRenderNode &node )
m_painter->setFont(font);
//Origin
- QPointF origin( node.attributes.value("OriginX").toDouble(), node.attributes.value("OriginY").toDouble() );
+ QPointF origin( node.attributes.value(QStringLiteral("OriginX")).toDouble(), node.attributes.value(QStringLiteral("OriginY")).toDouble() );
//Fill
QBrush brush;
- att = node.attributes.value("Fill");
+ att = node.attributes.value(QStringLiteral("Fill"));
if (att.isEmpty()) {
- QVariant data = node.getChildData( "Glyphs.Fill" );
+ QVariant data = node.getChildData( QStringLiteral("Glyphs.Fill") );
if (data.canConvert<QBrush>()) {
brush = data.value<QBrush>();
} else {
@@ -856,7 +856,7 @@ void XpsHandler::processGlyph( XpsRenderNode &node )
m_painter->setPen( QPen( brush, 0 ) );
// Opacity
- att = node.attributes.value("Opacity");
+ att = node.attributes.value(QStringLiteral("Opacity"));
if (! att.isEmpty()) {
bool ok = true;
double value = att.toDouble( &ok );
@@ -869,13 +869,13 @@ void XpsHandler::processGlyph( XpsRenderNode &node )
}
//RenderTransform
- att = node.attributes.value("RenderTransform");
+ att = node.attributes.value(QStringLiteral("RenderTransform"));
if (!att.isEmpty()) {
m_painter->setWorldTransform( parseRscRefMatrix( att ), true);
}
// Clip
- att = node.attributes.value( "Clip" );
+ att = node.attributes.value( QStringLiteral("Clip") );
if ( !att.isEmpty() ) {
QPainterPath clipPath = parseRscRefPath( att );
if ( !clipPath.isEmpty() ) {
@@ -885,7 +885,7 @@ void XpsHandler::processGlyph( XpsRenderNode &node )
// BiDiLevel - default Left-to-Right
m_painter->setLayoutDirection( Qt::LeftToRight );
- att = node.attributes.value( "BiDiLevel" );
+ att = node.attributes.value( QStringLiteral("BiDiLevel") );
if ( !att.isEmpty() ) {
if ( (att.toInt() % 2) == 1 ) {
// odd BiDiLevel, so Right-to-Left
@@ -894,12 +894,12 @@ void XpsHandler::processGlyph( XpsRenderNode &node )
}
// Indices - partial handling only
- att = node.attributes.value( "Indices" );
+ att = node.attributes.value( QStringLiteral("Indices") );
QList<qreal> advanceWidths;
if ( ! att.isEmpty() ) {
QStringList indicesElements = att.split( ';' );
for( int i = 0; i < indicesElements.size(); ++i ) {
- if ( indicesElements.at(i).contains( "," ) ) {
+ if ( indicesElements.at(i).contains( QStringLiteral(",") ) ) {
QStringList parts = indicesElements.at(i).split( ',' );
if (parts.size() == 2 ) {
// regular advance case, no offsets
@@ -922,7 +922,7 @@ void XpsHandler::processGlyph( XpsRenderNode &node )
}
// UnicodeString
- QString stringToDraw( unicodeString( node.attributes.value( "UnicodeString" ) ) );
+ QString stringToDraw( unicodeString( node.attributes.value( QStringLiteral("UnicodeString") ) ) );
QPointF originAdvance(0, 0);
QFontMetrics metrics = m_painter->fontMetrics();
for ( int i = 0; i < stringToDraw.size(); ++i ) {
@@ -972,9 +972,9 @@ void XpsHandler::processImageBrush( XpsRenderNode &node )
QString att;
QBrush brush;
- QRectF viewport = stringToRectF( node.attributes.value( "Viewport" ) );
- QRectF viewbox = stringToRectF( node.attributes.value( "Viewbox" ) );
- QImage image = m_page->loadImageFromFile( node.attributes.value( "ImageSource" ) );
+ QRectF viewport = stringToRectF( node.attributes.value( QStringLiteral("Viewport") ) );
+ QRectF viewbox = stringToRectF( node.attributes.value( QStringLiteral("Viewbox") ) );
+ QImage image = m_page->loadImageFromFile( node.attributes.value( QStringLiteral("ImageSource") ) );
// Matrix which can transform [0, 0, 1, 1] rectangle to given viewbox
QTransform viewboxMatrix = QTransform( viewbox.width() * image.physicalDpiX() / 96, 0, 0, viewbox.height() * image.physicalDpiY() / 96, viewbox.x(), viewbox.y() );
@@ -982,9 +982,9 @@ void XpsHandler::processImageBrush( XpsRenderNode &node )
// Matrix which can transform [0, 0, 1, 1] rectangle to given viewport
//TODO Take ViewPort into account
QTransform viewportMatrix;
- att = node.attributes.value( "Transform" );
+ att = node.attributes.value( QStringLiteral("Transform") );
if ( att.isEmpty() ) {
- QVariant data = node.getChildData( "ImageBrush.Transform" );
+ QVariant data = node.getChildData( QStringLiteral("ImageBrush.Transform") );
if (data.canConvert<QTransform>()) {
viewportMatrix = data.value<QTransform>();
} else {
@@ -1013,8 +1013,8 @@ void XpsHandler::processPath( XpsRenderNode &node )
QVariant data;
// Get path
- XpsPathGeometry * pathdata = node.getChildData( "Path.Data" ).value< XpsPathGeometry * >();
- att = node.attributes.value( "Data" );
+ XpsPathGeometry * pathdata = node.getChildData( QStringLiteral("Path.Data") ).value< XpsPathGeometry * >();
+ att = node.attributes.value( QStringLiteral("Data") );
if (! att.isEmpty() ) {
QPainterPath path = parseRscRefPath( att );
delete pathdata;
@@ -1028,12 +1028,12 @@ void XpsHandler::processPath( XpsRenderNode &node )
}
// Set Fill
- att = node.attributes.value( "Fill" );
+ att = node.attributes.value( QStringLiteral("Fill") );
QBrush brush;
if (! att.isEmpty() ) {
brush = parseRscRefColorForBrush( att );
} else {
- data = node.getChildData( "Path.Fill" );
+ data = node.getChildData( QStringLiteral("Path.Fill") );
if (data.canConvert<QBrush>()) {
brush = data.value<QBrush>();
}
@@ -1041,24 +1041,24 @@ void XpsHandler::processPath( XpsRenderNode &node )
m_painter->setBrush( brush );
// Stroke (pen)
- att = node.attributes.value( "Stroke" );
+ att = node.attributes.value( QStringLiteral("Stroke") );
QPen pen( Qt::transparent );
if (! att.isEmpty() ) {
pen = parseRscRefColorForPen( att );
} else {
- data = node.getChildData( "Path.Stroke" );
+ data = node.getChildData( QStringLiteral("Path.Stroke") );
if (data.canConvert<QBrush>()) {
pen.setBrush( data.value<QBrush>() );
}
}
- att = node.attributes.value( "StrokeThickness" );
+ att = node.attributes.value( QStringLiteral("StrokeThickness") );
if (! att.isEmpty() ) {
bool ok = false;
int thickness = att.toInt( &ok );
if (ok)
pen.setWidth( thickness );
}
- att = node.attributes.value( "StrokeDashArray" );
+ att = node.attributes.value( QStringLiteral("StrokeDashArray") );
if ( !att.isEmpty() ) {
const QStringList pieces = att.split( QLatin1Char( ' ' ), QString::SkipEmptyParts );
QVector<qreal> dashPattern( pieces.count() );
@@ -1075,14 +1075,14 @@ void XpsHandler::processPath( XpsRenderNode &node )
pen.setDashPattern( dashPattern );
}
}
- att = node.attributes.value( "StrokeDashOffset" );
+ att = node.attributes.value( QStringLiteral("StrokeDashOffset") );
if ( !att.isEmpty() ) {
bool ok = false;
int offset = att.toInt( &ok );
if ( ok )
pen.setDashOffset( offset );
}
- att = node.attributes.value( "StrokeDashCap" );
+ att = node.attributes.value( QStringLiteral("StrokeDashCap") );
if ( !att.isEmpty() ) {
Qt::PenCapStyle cap = Qt::FlatCap;
if ( att == QLatin1String( "Flat" ) ) {
@@ -1095,7 +1095,7 @@ void XpsHandler::processPath( XpsRenderNode &node )
// ### missing "Triangle"
pen.setCapStyle( cap );
}
- att = node.attributes.value( "StrokeLineJoin" );
+ att = node.attributes.value( QStringLiteral("StrokeLineJoin") );
if ( !att.isEmpty() ) {
Qt::PenJoinStyle joinStyle = Qt::MiterJoin;
if ( att == QLatin1String( "Miter" ) ) {
@@ -1107,7 +1107,7 @@ void XpsHandler::processPath( XpsRenderNode &node )
}
pen.setJoinStyle( joinStyle );
}
- att = node.attributes.value( "StrokeMiterLimit" );
+ att = node.attributes.value( QStringLiteral("StrokeMiterLimit") );
if ( !att.isEmpty() ) {
bool ok = false;
double limit = att.toDouble( &ok );
@@ -1120,13 +1120,13 @@ void XpsHandler::processPath( XpsRenderNode &node )
m_painter->setPen( pen );
// Opacity
- att = node.attributes.value("Opacity");
+ att = node.attributes.value(QStringLiteral("Opacity"));
if (! att.isEmpty()) {
m_painter->setOpacity(att.toDouble());
}
// RenderTransform
- att = node.attributes.value( "RenderTransform" );
+ att = node.attributes.value( QStringLiteral("RenderTransform") );
if (! att.isEmpty() ) {
m_painter->setWorldTransform( parseRscRefMatrix( att ), true );
}
@@ -1166,7 +1166,7 @@ void XpsHandler::processPathGeometry( XpsRenderNode &node )
QString att;
- att = node.attributes.value( "Figures" );
+ att = node.attributes.value( QStringLiteral("Figures") );
if ( !att.isEmpty() ) {
QPainterPath path = parseRscRefPath( att );
qDeleteAll( geom->paths );
@@ -1174,13 +1174,13 @@ void XpsHandler::processPathGeometry( XpsRenderNode &node )
geom->paths.append( new XpsPathFigure( path, true ) );
}
- att = node.attributes.value( "FillRule" );
+ att = node.attributes.value( QStringLiteral("FillRule") );
if ( !att.isEmpty() ) {
geom->fillRule = fillRuleFromString( att );
}
// Transform
- att = node.attributes.value( "Transform" );
+ att = node.attributes.value( QStringLiteral("Transform") );
if ( !att.isEmpty() ) {
geom->transform = parseRscRefMatrix( att );
}
@@ -1199,7 +1199,7 @@ void XpsHandler::processPathFigure( XpsRenderNode &node )
QString att;
QPainterPath path;
- att = node.attributes.value( "StartPoint" );
+ att = node.attributes.value( QStringLiteral("StartPoint") );
if ( !att.isEmpty() ) {
QPointF point = getPointFromString( att );
path.moveTo( point );
@@ -1209,7 +1209,7 @@ void XpsHandler::processPathFigure( XpsRenderNode &node )
Q_FOREACH ( const XpsRenderNode &child, node.children ) {
bool isStroked = true;
- att = node.attributes.value( "IsStroked" );
+ att = node.attributes.value( QStringLiteral("IsStroked") );
if ( !att.isEmpty() ) {
isStroked = att == QLatin1String( "true" );
}
@@ -1219,7 +1219,7 @@ void XpsHandler::processPathFigure( XpsRenderNode &node )
// PolyLineSegment
if ( child.name == QLatin1String( "PolyLineSegment" ) ) {
- att = child.attributes.value( "Points" );
+ att = child.attributes.value( QStringLiteral("Points") );
if ( !att.isEmpty() ) {
const QStringList points = att.split( QLatin1Char( ' ' ), QString::SkipEmptyParts );
Q_FOREACH ( const QString &p, points ) {
@@ -1230,7 +1230,7 @@ void XpsHandler::processPathFigure( XpsRenderNode &node )
}
// PolyBezierSegment
else if ( child.name == QLatin1String( "PolyBezierSegment" ) ) {
- att = child.attributes.value( "Points" );
+ att = child.attributes.value( QStringLiteral("Points") );
if ( !att.isEmpty() ) {
const QStringList points = att.split( QLatin1Char( ' ' ), QString::SkipEmptyParts );
if ( points.count() % 3 == 0 ) {
@@ -1245,7 +1245,7 @@ void XpsHandler::processPathFigure( XpsRenderNode &node )
}
// PolyQuadraticBezierSegment
else if ( child.name == QLatin1String( "PolyQuadraticBezierSegment" ) ) {
- att = child.attributes.value( "Points" );
+ att = child.attributes.value( QStringLiteral("Points") );
if ( !att.isEmpty() ) {
const QStringList points = att.split( QLatin1Char( ' ' ), QString::SkipEmptyParts );
if ( points.count() % 2 == 0 ) {
@@ -1260,7 +1260,7 @@ void XpsHandler::processPathFigure( XpsRenderNode &node )
}
bool closePath = false;
- att = node.attributes.value( "IsClosed" );
+ att = node.attributes.value( QStringLiteral("IsClosed") );
if ( !att.isEmpty() ) {
closePath = att == QLatin1String( "true" );
}
@@ -1269,7 +1269,7 @@ void XpsHandler::processPathFigure( XpsRenderNode &node )
}
bool isFilled = true;
- att = node.attributes.value( "IsFilled" );
+ att = node.attributes.value( QStringLiteral("IsFilled") );
if ( !att.isEmpty() ) {
isFilled = att == QLatin1String( "true" );
}
@@ -1281,13 +1281,13 @@ void XpsHandler::processPathFigure( XpsRenderNode &node )
void XpsHandler::processStartElement( XpsRenderNode &node )
{
- if (node.name == "Canvas") {
+ if (node.name == QLatin1String("Canvas")) {
m_painter->save();
- QString att = node.attributes.value( "RenderTransform" );
+ QString att = node.attributes.value( QStringLiteral("RenderTransform") );
if ( !att.isEmpty() ) {
m_painter->setWorldTransform( parseRscRefMatrix( att ), true );
}
- att = node.attributes.value( "Opacity" );
+ att = node.attributes.value( QStringLiteral("Opacity") );
if ( !att.isEmpty() ) {
double value = att.toDouble();
if ( value > 0.0 && value <= 1.0 ) {
@@ -1303,64 +1303,64 @@ void XpsHandler::processStartElement( XpsRenderNode &node )
void XpsHandler::processEndElement( XpsRenderNode &node )
{
- if (node.name == "Glyphs") {
+ if (node.name == QLatin1String("Glyphs")) {
processGlyph( node );
- } else if (node.name == "Path") {
+ } else if (node.name == QLatin1String("Path")) {
processPath( node );
- } else if (node.name == "MatrixTransform") {
+ } else if (node.name == QLatin1String("MatrixTransform")) {
//TODO Ignoring x:key
- node.data = qVariantFromValue( QTransform( attsToMatrix( node.attributes.value( "Matrix" ) ) ) );
- } else if ((node.name == "Canvas.RenderTransform") || (node.name == "Glyphs.RenderTransform") || (node.name == "Path.RenderTransform")) {
- QVariant data = node.getRequiredChildData( "MatrixTransform" );
+ node.data = qVariantFromValue( QTransform( attsToMatrix( node.attributes.value( QStringLiteral("Matrix") ) ) ) );
+ } else if ((node.name == QLatin1String("Canvas.RenderTransform")) || (node.name == QLatin1String("Glyphs.RenderTransform")) || (node.name == QLatin1String("Path.RenderTransform"))) {
+ QVariant data = node.getRequiredChildData( QStringLiteral("MatrixTransform") );
if (data.canConvert<QTransform>()) {
m_painter->setWorldTransform( data.value<QTransform>(), true );
}
- } else if (node.name == "Canvas") {
+ } else if (node.name == QLatin1String("Canvas")) {
m_painter->restore();
- } else if ((node.name == "Path.Fill") || (node.name == "Glyphs.Fill")) {
+ } else if ((node.name == QLatin1String("Path.Fill")) || (node.name == QLatin1String("Glyphs.Fill"))) {
processFill( node );
- } else if (node.name == "Path.Stroke") {
+ } else if (node.name == QLatin1String("Path.Stroke")) {
processStroke( node );
- } else if (node.name == "SolidColorBrush") {
+ } else if (node.name == QLatin1String("SolidColorBrush")) {
//TODO Ignoring opacity, x:key
- node.data = qVariantFromValue( QBrush( QColor( hexToRgba( node.attributes.value( "Color" ).toLatin1() ) ) ) );
- } else if (node.name == "ImageBrush") {
+ node.data = qVariantFromValue( QBrush( QColor( hexToRgba( node.attributes.value( QStringLiteral("Color") ).toLatin1() ) ) ) );
+ } else if (node.name == QLatin1String("ImageBrush")) {
processImageBrush( node );
- } else if (node.name == "ImageBrush.Transform") {
- node.data = node.getRequiredChildData( "MatrixTransform" );
- } else if (node.name == "LinearGradientBrush") {
- XpsRenderNode * gradients = node.findChild( "LinearGradientBrush.GradientStops" );
+ } else if (node.name == QLatin1String("ImageBrush.Transform")) {
+ node.data = node.getRequiredChildData( QStringLiteral("MatrixTransform") );
+ } else if (node.name == QLatin1String("LinearGradientBrush")) {
+ XpsRenderNode * gradients = node.findChild( QStringLiteral("LinearGradientBrush.GradientStops") );
if ( gradients && gradients->data.canConvert< QGradient * >() ) {
- QPointF start = getPointFromString( node.attributes.value( "StartPoint" ) );
- QPointF end = getPointFromString( node.attributes.value( "EndPoint" ) );
+ QPointF start = getPointFromString( node.attributes.value( QStringLiteral("StartPoint") ) );
+ QPointF end = getPointFromString( node.attributes.value( QStringLiteral("EndPoint") ) );
QLinearGradient * qgrad = static_cast< QLinearGradient * >( gradients->data.value< QGradient * >() );
qgrad->setStart( start );
qgrad->setFinalStop( end );
- applySpreadStyleToQGradient( node.attributes.value( "SpreadMethod" ), qgrad );
+ applySpreadStyleToQGradient( node.attributes.value( QStringLiteral("SpreadMethod") ), qgrad );
node.data = qVariantFromValue( QBrush( *qgrad ) );
delete qgrad;
}
- } else if (node.name == "RadialGradientBrush") {
- XpsRenderNode * gradients = node.findChild( "RadialGradientBrush.GradientStops" );
+ } else if (node.name == QLatin1String("RadialGradientBrush")) {
+ XpsRenderNode * gradients = node.findChild( QStringLiteral("RadialGradientBrush.GradientStops") );
if ( gradients && gradients->data.canConvert< QGradient * >() ) {
- QPointF center = getPointFromString( node.attributes.value( "Center" ) );
- QPointF origin = getPointFromString( node.attributes.value( "GradientOrigin" ) );
- double radiusX = node.attributes.value( "RadiusX" ).toDouble();
- double radiusY = node.attributes.value( "RadiusY" ).toDouble();
+ QPointF center = getPointFromString( node.attributes.value( QStringLiteral("Center") ) );
+ QPointF origin = getPointFromString( node.attributes.value( QStringLiteral("GradientOrigin") ) );
+ double radiusX = node.attributes.value( QStringLiteral("RadiusX") ).toDouble();
+ double radiusY = node.attributes.value( QStringLiteral("RadiusY") ).toDouble();
QRadialGradient * qgrad = static_cast< QRadialGradient * >( gradients->data.value< QGradient * >() );
qgrad->setCenter( center );
qgrad->setFocalPoint( origin );
// TODO what in case of different radii?
qgrad->setRadius( qMin( radiusX, radiusY ) );
- applySpreadStyleToQGradient( node.attributes.value( "SpreadMethod" ), qgrad );
+ applySpreadStyleToQGradient( node.attributes.value( QStringLiteral("SpreadMethod") ), qgrad );
node.data = qVariantFromValue( QBrush( *qgrad ) );
delete qgrad;
}
- } else if (node.name == "LinearGradientBrush.GradientStops") {
+ } else if (node.name == QLatin1String("LinearGradientBrush.GradientStops")) {
QList<XpsGradient> gradients;
Q_FOREACH ( const XpsRenderNode &child, node.children ) {
- double offset = child.attributes.value( "Offset" ).toDouble();
- QColor color = hexToRgba( child.attributes.value( "Color" ).toLatin1() );
+ double offset = child.attributes.value( QStringLiteral("Offset") ).toDouble();
+ QColor color = hexToRgba( child.attributes.value( QStringLiteral("Color") ).toLatin1() );
gradients.append( XpsGradient( offset, color ) );
}
preprocessXpsGradients( gradients );
@@ -1369,11 +1369,11 @@ void XpsHandler::processEndElement( XpsRenderNode &node )
addXpsGradientsToQGradient( gradients, qgrad );
node.data = qVariantFromValue< QGradient * >( qgrad );
}
- } else if (node.name == "RadialGradientBrush.GradientStops") {
+ } else if (node.name == QLatin1String("RadialGradientBrush.GradientStops")) {
QList<XpsGradient> gradients;
Q_FOREACH ( const XpsRenderNode &child, node.children ) {
- double offset = child.attributes.value( "Offset" ).toDouble();
- QColor color = hexToRgba( child.attributes.value( "Color" ).toLatin1() );
+ double offset = child.attributes.value( QStringLiteral("Offset") ).toDouble();
+ QColor color = hexToRgba( child.attributes.value( QStringLiteral("Color") ).toLatin1() );
gradients.append( XpsGradient( offset, color ) );
}
preprocessXpsGradients( gradients );
@@ -1382,11 +1382,11 @@ void XpsHandler::processEndElement( XpsRenderNode &node )
addXpsGradientsToQGradient( gradients, qgrad );
node.data = qVariantFromValue< QGradient * >( qgrad );
}
- } else if (node.name == "PathFigure") {
+ } else if (node.name == QLatin1String("PathFigure")) {
processPathFigure( node );
- } else if (node.name == "PathGeometry") {
+ } else if (node.name == QLatin1String("PathGeometry")) {
processPathGeometry( node );
- } else if (node.name == "Path.Data") {
+ } else if (node.name == QLatin1String("Path.Data")) {
processPathData( node );
} else {
//qCWarning(OkularXpsDebug) << "Unknown element: " << node->name;
@@ -1410,8 +1410,8 @@ XpsPage::XpsPage(XpsFile *file, const QString &fileName): m_file( file ),
if ( xml.isStartElement() && ( xml.name() == "FixedPage" ) )
{
QXmlStreamAttributes attributes = xml.attributes();
- m_pageSize.setWidth( attributes.value( "Width" ).toString().toDouble() );
- m_pageSize.setHeight( attributes.value( "Height" ).toString().toDouble() );
+ m_pageSize.setWidth( attributes.value( QStringLiteral("Width") ).toString().toDouble() );
+ m_pageSize.setHeight( attributes.value( QStringLiteral("Height") ).toString().toDouble() );
break;
}
}
@@ -1622,7 +1622,7 @@ Okular::TextPage* XpsPage::textPage()
if ( xml.name() == "Canvas") {
matrices.push(matrix);
- QString att = xml.attributes().value( "RenderTransform" ).toString();
+ QString att = xml.attributes().value( QStringLiteral("RenderTransform") ).toString();
if (!att.isEmpty()) {
matrix = parseRscRefMatrix( att ) * matrix;
}
@@ -1630,7 +1630,7 @@ Okular::TextPage* XpsPage::textPage()
useMatrix = true;
} else if (xml.name() == "MatrixTransform") {
if (useMatrix) {
- matrix = attsToMatrix( xml.attributes().value("Matrix").toString() ) * matrix;
+ matrix = attsToMatrix( xml.attributes().value(QStringLiteral("Matrix")).toString() ) * matrix;
}
} else if (xml.name() == "Glyphs") {
matrices.push( matrix );
@@ -1654,19 +1654,19 @@ Okular::TextPage* XpsPage::textPage()
} else if (xml.name() == "MatrixTransform") {
// not clear if we need to do anything here yet.
} else if (xml.name() == "Glyphs") {
- QString att = glyphsAtts.value( "RenderTransform" ).toString();
+ QString att = glyphsAtts.value( QStringLiteral("RenderTransform") ).toString();
if (!att.isEmpty()) {
matrix = parseRscRefMatrix( att ) * matrix;
}
- QString text = unicodeString( glyphsAtts.value( "UnicodeString" ).toString() );
+ QString text = unicodeString( glyphsAtts.value( QStringLiteral("UnicodeString") ).toString() );
// Get font (doesn't work well because qt doesn't allow to load font from file)
- QFont font = m_file->getFontByName( glyphsAtts.value( "FontUri" ).toString(),
- glyphsAtts.value("FontRenderingEmSize").toString().toFloat() * 72 / 96 );
+ QFont font = m_file->getFontByName( glyphsAtts.value( QStringLiteral("FontUri") ).toString(),
+ glyphsAtts.value(QStringLiteral("FontRenderingEmSize")).toString().toFloat() * 72 / 96 );
QFontMetrics metrics = QFontMetrics( font );
// Origin
- QPointF origin( glyphsAtts.value("OriginX").toString().toDouble(),
- glyphsAtts.value("OriginY").toString().toDouble() );
+ QPointF origin( glyphsAtts.value(QStringLiteral("OriginX")).toString().toDouble(),
+ glyphsAtts.value(QStringLiteral("OriginY")).toString().toDouble() );
int lastWidth = 0;
@@ -1728,17 +1728,17 @@ void XpsDocument::parseDocumentStructure( const QString &documentStructureFileNa
} else if ( xml.name() == "OutlineEntry" ) {
m_haveDocumentStructure = true;
QXmlStreamAttributes attributes = xml.attributes();
- int outlineLevel = attributes.value( "OutlineLevel").toString().toInt();
- QString description = attributes.value("Description").toString();
+ int outlineLevel = attributes.value( QStringLiteral("OutlineLevel")).toString().toInt();
+ QString description = attributes.value(QStringLiteral("Description")).toString();
QDomElement synopsisElement = m_docStructure->createElement( description );
- synopsisElement.setAttribute( "OutlineLevel", outlineLevel );
- QString target = attributes.value("OutlineTarget").toString();
+ synopsisElement.setAttribute( QStringLiteral("OutlineLevel"), outlineLevel );
+ QString target = attributes.value(QStringLiteral("OutlineTarget")).toString();
int hashPosition = target.lastIndexOf( '#' );
target = target.mid( hashPosition + 1 );
// qCWarning(OkularXpsDebug) << "target: " << target;
Okular::DocumentViewport viewport;
viewport.pageNumber = m_docStructurePageMap.value( target );
- synopsisElement.setAttribute( "Viewport", viewport.toString() );
+ synopsisElement.setAttribute( QStringLiteral("Viewport"), viewport.toString() );
if ( outlineLevel == 1 ) {
// qCWarning(OkularXpsDebug) << "Description: "
// << outlineEntryElement.attribute( "Description" ) << endl;
@@ -1749,7 +1749,7 @@ void XpsDocument::parseDocumentStructure( const QString &documentStructureFileNa
QDomNode maybeParentNode = m_docStructure->lastChild();
while ( !maybeParentNode.isNull() )
{
- if ( maybeParentNode.toElement().attribute( "OutlineLevel" ).toInt() == ( outlineLevel - 1 ) ) {
+ if ( maybeParentNode.toElement().attribute( QStringLiteral("OutlineLevel") ).toInt() == ( outlineLevel - 1 ) ) {
// we have the right parent
maybeParentNode.appendChild( synopsisElement );
break;
@@ -1794,14 +1794,14 @@ XpsDocument::XpsDocument(XpsFile *file, const QString &fileName): m_file(file),
docXml.readNext();
if ( docXml.isStartElement() ) {
if ( docXml.name() == "PageContent" ) {
- QString pagePath = docXml.attributes().value("Source").toString();
+ QString pagePath = docXml.attributes().value(QStringLiteral("Source")).toString();
qCWarning(OkularXpsDebug) << "Page Path: " << pagePath;
XpsPage *page = new XpsPage( file, absolutePath( documentFilePath, pagePath ) );
m_pages.append(page);
} else if ( docXml.name() == "PageContent.LinkTargets" ) {
// do nothing - wait for the real LinkTarget elements
} else if ( docXml.name() == "LinkTarget" ) {
- QString targetName = docXml.attributes().value( "Name" ).toString();
+ QString targetName = docXml.attributes().value( QStringLiteral("Name") ).toString();
if ( ! targetName.isEmpty() ) {
m_docStructurePageMap[ targetName ] = m_pages.count() - 1;
}
@@ -1834,12 +1834,12 @@ XpsDocument::XpsDocument(XpsFile *file, const QString &fileName): m_file(file),
xml.readNext();
if ( xml.isStartElement() && ( xml.name() == "Relationship" ) ) {
QXmlStreamAttributes attributes = xml.attributes();
- if ( attributes.value( "Type" ).toString() == "http://schemas.microsoft.com/xps/2005/06/documentstructure" ) {
- documentStructureFile = attributes.value( "Target" ).toString();
+ if ( attributes.value( QStringLiteral("Type") ).toString() == QLatin1String("http://schemas.microsoft.com/xps/2005/06/documentstructure") ) {
+ documentStructureFile = attributes.value( QStringLiteral("Target") ).toString();
} else {
qCWarning(OkularXpsDebug) << "Unknown document relationships element: "
- << attributes.value( "Type" ).toString() << " : "
- << attributes.value( "Target" ).toString() << endl;
+ << attributes.value( QStringLiteral("Type") ).toString() << " : "
+ << attributes.value( QStringLiteral("Target") ).toString() << endl;
}
}
}
@@ -1909,7 +1909,7 @@ bool XpsFile::loadDocument(const QString &filename)
}
// The only fixed entry in XPS is /_rels/.rels
- const KArchiveEntry* relEntry = m_xpsArchive->directory()->entry("_rels/.rels");
+ const KArchiveEntry* relEntry = m_xpsArchive->directory()->entry(QStringLiteral("_rels/.rels"));
if ( !relEntry ) {
// this might occur if we can't read the zip directory, or it doesn't have the relationships entry
return false;
@@ -1926,8 +1926,8 @@ bool XpsFile::loadDocument(const QString &filename)
if ( relXml.isStartElement() ) {
if ( relXml.name() == "Relationship" ) {
QXmlStreamAttributes attributes = relXml.attributes();
- QString type = attributes.value( "Type" ).toString();
- QString target = attributes.value( "Target" ).toString();
+ QString type = attributes.value( QStringLiteral("Type") ).toString();
+ QString target = attributes.value( QStringLiteral("Target") ).toString();
if ( "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail" == type ) {
m_thumbnailFileName = target;
} else if ( "http://schemas.microsoft.com/xps/2005/06/fixedrepresentation" == type ) {
@@ -1967,7 +1967,7 @@ bool XpsFile::loadDocument(const QString &filename)
fixedRepXml.readNext();
if ( fixedRepXml.isStartElement() ) {
if ( fixedRepXml.name() == "DocumentReference" ) {
- const QString source = fixedRepXml.attributes().value("Source").toString();
+ const QString source = fixedRepXml.attributes().value(QStringLiteral("Source")).toString();
XpsDocument *doc = new XpsDocument( this, absolutePath( fixedRepresentationFilePath, source ) );
for (int lv = 0; lv < doc->numPages(); ++lv) {
// our own copy of the pages list
@@ -1993,7 +1993,7 @@ Okular::DocumentInfo XpsFile::generateDocumentInfo() const
{
Okular::DocumentInfo docInfo;
- docInfo.set( Okular::DocumentInfo::MimeType, "application/oxps" );
+ docInfo.set( Okular::DocumentInfo::MimeType, QStringLiteral("application/oxps") );
if ( ! m_corePropertiesFileName.isEmpty() ) {
const KZipFileEntry* corepropsFile = static_cast<const KZipFileEntry *>(m_xpsArchive->directory()->entry(m_corePropertiesFileName));
@@ -2018,15 +2018,15 @@ Okular::DocumentInfo XpsFile::generateDocumentInfo() const
} else if (xml.name() == "category") {
docInfo.set( Okular::DocumentInfo::Category, xml.readElementText() );
} else if (xml.name() == "created") {
- QDateTime createdDate = QDateTime::fromString( xml.readElementText(), "yyyy-MM-ddThh:mm:ssZ" );
+ QDateTime createdDate = QDateTime::fromString( xml.readElementText(), QStringLiteral("yyyy-MM-ddThh:mm:ssZ") );
docInfo.set( Okular::DocumentInfo::CreationDate, QLocale().toString( createdDate, QLocale::LongFormat ) );
} else if (xml.name() == "modified") {
- QDateTime modifiedDate = QDateTime::fromString( xml.readElementText(), "yyyy-MM-ddThh:mm:ssZ" );
+ QDateTime modifiedDate = QDateTime::fromString( xml.readElementText(), QStringLiteral("yyyy-MM-ddThh:mm:ssZ") );
docInfo.set( Okular::DocumentInfo::ModificationDate, QLocale().toString( modifiedDate, QLocale::LongFormat ) );
} else if (xml.name() == "keywords") {
docInfo.set( Okular::DocumentInfo::Keywords, xml.readElementText() );
} else if (xml.name() == "revision") {
- docInfo.set( "revision", xml.readElementText(), i18n( "Revision" ) );
+ docInfo.set( QStringLiteral("revision"), xml.readElementText(), i18n( "Revision" ) );
}
}
}
@@ -2176,7 +2176,7 @@ Okular::ExportFormat::List XpsGenerator::exportFormats() const
bool XpsGenerator::exportTo( const QString &fileName, const Okular::ExportFormat &format )
{
- if ( format.mimeType().inherits( QLatin1String( "text/plain" ) ) ) {
+ if ( format.mimeType().inherits( QStringLiteral( "text/plain" ) ) ) {
QFile f( fileName );
if ( !f.open( QIODevice::WriteOnly ) )
return false;
diff --git a/mobile/components/documentitem.cpp b/mobile/components/documentitem.cpp
index c574290..a867811 100644
--- a/mobile/components/documentitem.cpp
+++ b/mobile/components/documentitem.cpp
@@ -34,17 +34,17 @@ DocumentItem::DocumentItem(QObject *parent)
m_pageviewObserver(0),
m_searchInProgress(false)
{
- qmlRegisterUncreatableType<TOCModel>("org.kde.okular", 1, 0, "TOCModel", QLatin1String("Do not create objects of this type."));
- Okular::Settings::instance("okularproviderrc");
+ qmlRegisterUncreatableType<TOCModel>("org.kde.okular", 1, 0, "TOCModel", QStringLiteral("Do not create objects of this type."));
+ Okular::Settings::instance(QStringLiteral("okularproviderrc"));
m_document = new Okular::Document(0);
m_tocModel = new TOCModel(m_document, this);
connect(m_document, &Okular::Document::searchFinished,
this, &DocumentItem::searchFinished);
- connect(m_document->bookmarkManager(), SIGNAL(bookmarksChanged(QUrl)),
- this, SIGNAL(bookmarkedPagesChanged()));
- connect(m_document->bookmarkManager(), SIGNAL(bookmarksChanged(QUrl)),
- this, SIGNAL(bookmarksChanged()));
+ connect(m_document->bookmarkManager(), &Okular::BookmarkManager::bookmarksChanged,
+ this, &DocumentItem::bookmarkedPagesChanged);
+ connect(m_document->bookmarkManager(), &Okular::BookmarkManager::bookmarksChanged,
+ this, &DocumentItem::bookmarksChanged);
}
@@ -85,7 +85,7 @@ QString DocumentItem::windowTitleForDocument() const
m_document->currentDocument().toDisplayString(QUrl::PreferLocalFile) : m_document->currentDocument().fileName();
if (Okular::Settings::displayDocumentTitle()) {
- const QString docTitle = m_document->metaData( "DocumentTitle" ).toString();
+ const QString docTitle = m_document->metaData( QStringLiteral("DocumentTitle") ).toString();
if (!docTitle.isEmpty() && !docTitle.trimmed().isEmpty()) {
title = docTitle;
diff --git a/mobile/components/pageitem.cpp b/mobile/components/pageitem.cpp
index fe75bc6..cef38ea 100644
--- a/mobile/components/pageitem.cpp
+++ b/mobile/components/pageitem.cpp
@@ -37,7 +37,7 @@
PageItem::PageItem(QQuickItem *parent)
: QQuickPaintedItem(parent),
- Okular::View( QString::fromLatin1( "PageView" ) ),
+ Okular::View( QLatin1String( "PageView" ) ),
m_page(0),
m_smooth(false),
m_intentionalDraw(false),
@@ -112,14 +112,14 @@ void PageItem::setDocument(DocumentItem *doc)
disconnect(doc, 0, this, 0);
m_documentItem = doc;
Observer *observer = m_isThumbnail ? m_documentItem.data()->thumbnailObserver() : m_documentItem.data()->pageviewObserver();
- connect(observer, SIGNAL(pageChanged(int, int)), this, SLOT(pageHasChanged(int, int)));
- connect(doc->document()->bookmarkManager(), SIGNAL(bookmarksChanged(QUrl)),
- this, SLOT(checkBookmarksChanged()));
+ connect(observer, &Observer::pageChanged, this, &PageItem::pageHasChanged);
+ connect(doc->document()->bookmarkManager(), &Okular::BookmarkManager::bookmarksChanged,
+ this, &PageItem::checkBookmarksChanged);
setPageNumber(0);
emit documentChanged();
m_redrawTimer->start();
- connect(doc, SIGNAL(pathChanged()), this, SLOT(documentPathChanged()));
+ connect(doc, &DocumentItem::pathChanged, this, &PageItem::documentPathChanged);
}
int PageItem::pageNumber() const
diff --git a/part.cpp b/part.cpp
index 910e486..4019680 100644
--- a/part.cpp
+++ b/part.cpp
@@ -178,22 +178,22 @@ static QString compressedMimeFor( const QString& mime_to_check )
static QHash< QString, QString > compressedMimeMap;
static bool supportBzip = false;
static bool supportXz = false;
- const QString app_gzip( QString::fromLatin1( "application/x-gzip" ) );
- const QString app_bzip( QString::fromLatin1( "application/x-bzip" ) );
- const QString app_xz( QString::fromLatin1( "application/x-xz" ) );
+ const QString app_gzip( QStringLiteral( "application/x-gzip" ) );
+ const QString app_bzip( QStringLiteral( "application/x-bzip" ) );
+ const QString app_xz( QStringLiteral( "application/x-xz" ) );
if ( compressedMimeMap.isEmpty() )
{
std::unique_ptr< KFilterBase > f;
- compressedMimeMap[ QString::fromLatin1( "image/x-gzeps" ) ] = app_gzip;
+ compressedMimeMap[ QLatin1String( "image/x-gzeps" ) ] = app_gzip;
// check we can read bzip2-compressed files
f.reset( KCompressionDevice::filterForCompressionType( KCompressionDevice::BZip2 ) );
if ( f.get() )
{
supportBzip = true;
- compressedMimeMap[ QString::fromLatin1( "application/x-bzpdf" ) ] = app_bzip;
- compressedMimeMap[ QString::fromLatin1( "application/x-bzpostscript" ) ] = app_bzip;
- compressedMimeMap[ QString::fromLatin1( "application/x-bzdvi" ) ] = app_bzip;
- compressedMimeMap[ QString::fromLatin1( "image/x-bzeps" ) ] = app_bzip;
+ compressedMimeMap[ QLatin1String( "application/x-bzpdf" ) ] = app_bzip;
+ compressedMimeMap[ QLatin1String( "application/x-bzpostscript" ) ] = app_bzip;
+ compressedMimeMap[ QLatin1String( "application/x-bzdvi" ) ] = app_bzip;
+ compressedMimeMap[ QLatin1String( "image/x-bzeps" ) ] = app_bzip;
}
// check if we can read XZ-compressed files
f.reset( KCompressionDevice::filterForCompressionType( KCompressionDevice::Xz ) );
@@ -259,7 +259,7 @@ static QString detectConfigFileName( const QVariantList &args )
if ( arg.type() == QVariant::String )
{
QString argString = arg.toString();
- int separatorIndex = argString.indexOf( "=" );
+ int separatorIndex = argString.indexOf( QStringLiteral("=") );
if ( separatorIndex >= 0 && argString.left( separatorIndex ) == QLatin1String( "ConfigFileName" ) )
{
return argString.mid( separatorIndex + 1 );
@@ -296,11 +296,11 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
QString configFileName = detectConfigFileName( args );
if ( configFileName.isEmpty() )
{
- configFileName = KStandardDirs::locateLocal( "config", "okularpartrc" );
+ configFileName = KStandardDirs::locateLocal( "config", QStringLiteral("okularpartrc") );
// first necessary step: copy the configuration from kpdf, if available
if ( !QFile::exists( configFileName ) )
{
- QString oldkpdfconffile = KStandardDirs::locateLocal( "config", "kpdfpartrc" );
+ QString oldkpdfconffile = KStandardDirs::locateLocal( "config", QStringLiteral("kpdfpartrc") );
if ( QFile::exists( oldkpdfconffile ) )
QFile::copy( oldkpdfconffile, configFileName );
}
@@ -309,18 +309,18 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
numberOfParts++;
if (numberOfParts == 1) {
- QDBusConnection::sessionBus().registerObject("/okular", this, QDBusConnection::ExportScriptableSlots);
+ QDBusConnection::sessionBus().registerObject(QStringLiteral("/okular"), this, QDBusConnection::ExportScriptableSlots);
} else {
- QDBusConnection::sessionBus().registerObject(QString("/okular%1").arg(numberOfParts), this, QDBusConnection::ExportScriptableSlots);
+ QDBusConnection::sessionBus().registerObject(QStringLiteral("/okular%1").arg(numberOfParts), this, QDBusConnection::ExportScriptableSlots);
}
// connect the started signal to tell the job the mimetypes we like,
// and get some more information from it
- connect(this, SIGNAL(started(KIO::Job*)), this, SLOT(slotJobStarted(KIO::Job*)));
+ connect(this, &KParts::ReadOnlyPart::started, this, &Part::slotJobStarted);
// connect the completed signal so we can put the window caption when loading remote files
connect(this, SIGNAL(completed()), this, SLOT(setWindowTitleFromDocument()));
- connect(this, SIGNAL(canceled(QString)), this, SLOT(loadCancelled(QString)));
+ connect(this, &KParts::ReadOnlyPart::canceled, this, &Part::loadCancelled);
// create browser extension (for printing when embedded into browser)
m_bExtension = new BrowserExtension(this);
@@ -335,22 +335,22 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
m_sidebar = new Sidebar( parentWidget );
setWidget( m_sidebar );
- connect( m_sidebar, SIGNAL(urlsDropped(QList<QUrl>)), SLOT(handleDroppedUrls(QList<QUrl>)) );
+ connect( m_sidebar, &Sidebar::urlsDropped, this, &Part::handleDroppedUrls );
// build the document
m_document = new Okular::Document(widget());
- connect( m_document, SIGNAL(linkFind()), this, SLOT(slotFind()) );
- connect( m_document, SIGNAL(linkGoToPage()), this, SLOT(slotGoToPage()) );
- connect( m_document, SIGNAL(linkPresentation()), this, SLOT(slotShowPresentation()) );
- connect( m_document, SIGNAL(linkEndPresentation()), this, SLOT(slotHidePresentation()) );
- connect( m_document, SIGNAL(openUrl(QUrl)), this, SLOT(openUrlFromDocument(QUrl)) );
- connect( m_document->bookmarkManager(), SIGNAL(openUrl(QUrl)), this, SLOT(openUrlFromBookmarks(QUrl)) );
- connect( m_document, SIGNAL(close()), this, SLOT(close()) );
+ connect( m_document, &Document::linkFind, this, &Part::slotFind );
+ connect( m_document, &Document::linkGoToPage, this, &Part::slotGoToPage );
+ connect( m_document, &Document::linkPresentation, this, &Part::slotShowPresentation );
+ connect( m_document, &Document::linkEndPresentation, this, &Part::slotHidePresentation );
+ connect( m_document, &Document::openUrl, this, &Part::openUrlFromDocument );
+ connect( m_document->bookmarkManager(), &BookmarkManager::openUrl, this, &Part::openUrlFromBookmarks );
+ connect( m_document, &Document::close, this, &Part::close );
if ( parent && parent->metaObject()->indexOfSlot( QMetaObject::normalizedSignature( "slotQuit()" ).constData() ) != -1 )
connect( m_document, SIGNAL(quit()), parent, SLOT(slotQuit()) );
else
- connect( m_document, SIGNAL(quit()), this, SLOT(cannotQuit()) );
+ connect( m_document, &Document::quit, this, &Part::cannotQuit );
// widgets: ^searchbar (toolbar containing label and SearchWidget)
// m_searchToolBar = new KToolBar( parentWidget, "searchBar" );
// m_searchToolBar->boxLayout()->setSpacing( KDialog::spacingHint() );
@@ -361,14 +361,14 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
// [left toolbox: Table of Contents] | []
m_toc = new TOC( 0, m_document );
- connect( m_toc, SIGNAL(hasTOC(bool)), this, SLOT(enableTOC(bool)) );
+ connect( m_toc.data(), &TOC::hasTOC, this, &Part::enableTOC );
m_sidebar->addItem( m_toc, QIcon::fromTheme(QApplication::isLeftToRight() ? "format-justify-left" : "format-justify-right"), i18n("Contents") );
enableTOC( false );
// [left toolbox: Layers] | []
m_layers = new Layers( 0, m_document );
- connect( m_layers, SIGNAL(hasLayers(bool)), this, SLOT(enableLayers(bool)) );
- m_sidebar->addItem( m_layers, QIcon::fromTheme( "draw-freehand" ), i18n( "Layers" ) );
+ connect( m_layers.data(), &Layers::hasLayers, this, &Part::enableLayers );
+ m_sidebar->addItem( m_layers, QIcon::fromTheme( QStringLiteral("draw-freehand") ), i18n( "Layers" ) );
enableLayers( false );
// [left toolbox: Thumbnails and Bookmarks] | []
@@ -379,19 +379,19 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
m_thumbnailList = new ThumbnailList( thumbsBox, m_document );
thumbsBox->layout()->addWidget(m_thumbnailList);
// ThumbnailController * m_tc = new ThumbnailController( thumbsBox, m_thumbnailList );
- connect( m_thumbnailList, SIGNAL(rightClick(const Okular::Page*,QPoint)), this, SLOT(slotShowMenu(const Okular::Page*,QPoint)) );
- m_sidebar->addItem( thumbsBox, QIcon::fromTheme( "view-preview" ), i18n("Thumbnails") );
+ connect( m_thumbnailList.data(), &ThumbnailList::rightClick, this, &Part::slotShowMenu );
+ m_sidebar->addItem( thumbsBox, QIcon::fromTheme( QStringLiteral("view-preview") ), i18n("Thumbnails") );
m_sidebar->setCurrentItem( thumbsBox );
// [left toolbox: Reviews] | []
m_reviewsWidget = new Reviews( 0, m_document );
- m_sidebar->addItem( m_reviewsWidget, QIcon::fromTheme("draw-freehand"), i18n("Reviews") );
+ m_sidebar->addItem( m_reviewsWidget, QIcon::fromTheme(QStringLiteral("draw-freehand")), i18n("Reviews") );
m_sidebar->setItemEnabled( m_reviewsWidget, false );
// [left toolbox: Bookmarks] | []
m_bookmarkList = new BookmarkList( m_document, 0 );
- m_sidebar->addItem( m_bookmarkList, QIcon::fromTheme("bookmarks"), i18n("Bookmarks") );
+ m_sidebar->addItem( m_bookmarkList, QIcon::fromTheme(QStringLiteral("bookmarks")), i18n("Bookmarks") );
m_sidebar->setItemEnabled( m_bookmarkList, false );
// widgets: [../miniBarContainer] | []
@@ -426,8 +426,8 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
m_topMessage->setWordWrap( true );
m_topMessage->setMessageType( KMessageWidget::Information );
m_topMessage->setText( i18n( "This document has embedded files. <a href=\"okular:/embeddedfiles\">Click here to see them</a> or go to File -> Embedded Files." ) );
- m_topMessage->setIcon( QIcon::fromTheme( "mail-attachment" ) );
- connect( m_topMessage, SIGNAL(linkActivated(QString)), this, SLOT(slotShowEmbeddedFiles()) );
+ m_topMessage->setIcon( QIcon::fromTheme( QStringLiteral("mail-attachment") ) );
+ connect( m_topMessage, &KMessageWidget::linkActivated, this, &Part::slotShowEmbeddedFiles );
rightLayout->addWidget( m_topMessage );
m_formsMessage = new KMessageWidget( rightContainer );
m_formsMessage->setVisible( false );
@@ -441,16 +441,16 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
rightLayout->addWidget( m_infoMessage );
m_infoTimer = new QTimer();
m_infoTimer->setSingleShot( true );
- connect( m_infoTimer, SIGNAL(timeout()), m_infoMessage, SLOT(animatedHide()) );
+ connect( m_infoTimer, &QTimer::timeout, m_infoMessage, &KMessageWidget::animatedHide );
m_pageView = new PageView( rightContainer, m_document );
QMetaObject::invokeMethod( m_pageView, "setFocus", Qt::QueuedConnection ); //usability setting
// m_splitter->setFocusProxy(m_pageView);
- connect( m_pageView, SIGNAL(rightClick(const Okular::Page*,QPoint)), this, SLOT(slotShowMenu(const Okular::Page*,QPoint)) );
- connect( m_document, SIGNAL(error(QString,int)), this, SLOT(errorMessage(QString,int)) );
- connect( m_document, SIGNAL(warning(QString,int)), this, SLOT(warningMessage(QString,int)) );
- connect( m_document, SIGNAL(notice(QString,int)), this, SLOT(noticeMessage(QString,int)) );
- connect( m_document, SIGNAL(sourceReferenceActivated(const QString&,int,int,bool*)), this, SLOT(slotHandleActivatedSourceReference(const QString&,int,int,bool*)) );
- connect( m_pageView, SIGNAL(fitWindowToPage(QSize,QSize)), this, SIGNAL(fitWindowToPage(QSize,QSize)) );
+ connect( m_pageView.data(), &PageView::rightClick, this, &Part::slotShowMenu );
+ connect( m_document, &Document::error, this, &Part::errorMessage );
+ connect( m_document, &Document::warning, this, &Part::warningMessage );
+ connect( m_document, &Document::notice, this, &Part::noticeMessage );
+ connect( m_document, &Document::sourceReferenceActivated, this, &Part::slotHandleActivatedSourceReference );
+ connect( m_pageView.data(), &PageView::fitWindowToPage, this, &Part::fitWindowToPage );
rightLayout->addWidget( m_pageView );
m_layers->setPageView( m_pageView );
m_findBar = new FindBar( m_document, rightContainer );
@@ -472,11 +472,11 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
connect( m_findBar, SIGNAL(forwardKeyPressEvent(QKeyEvent*)), m_pageView, SLOT(externalKeyPressEvent(QKeyEvent*)));
connect( m_findBar, SIGNAL(onCloseButtonPressed()), m_pageView, SLOT(setFocus()));
connect( m_miniBar, SIGNAL(forwardKeyPressEvent(QKeyEvent*)), m_pageView, SLOT(externalKeyPressEvent(QKeyEvent*)));
- connect( m_pageView, SIGNAL(escPressed()), m_findBar, SLOT(resetSearch()) );
+ connect( m_pageView.data(), &PageView::escPressed, m_findBar, &FindBar::resetSearch );
connect( m_pageNumberTool, SIGNAL(forwardKeyPressEvent(QKeyEvent*)), m_pageView, SLOT(externalKeyPressEvent(QKeyEvent*)));
- connect( m_reviewsWidget, SIGNAL(openAnnotationWindow(Okular::Annotation*,int)),
- m_pageView, SLOT(openAnnotationWindow(Okular::Annotation*,int)) );
+ connect( m_reviewsWidget.data(), &Reviews::openAnnotationWindow,
+ m_pageView.data(), &PageView::openAnnotationWindow );
// add document observers
m_document->addObserver( this );
@@ -492,8 +492,8 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
m_document->addObserver( m_pageSizeLabel );
m_document->addObserver( m_bookmarkList );
- connect( m_document->bookmarkManager(), SIGNAL(saved()),
- this, SLOT(slotRebuildBookmarkMenu()) );
+ connect( m_document->bookmarkManager(), &BookmarkManager::saved,
+ this, &Part::slotRebuildBookmarkMenu );
setupViewerActions();
@@ -508,15 +508,15 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
// document watcher and reloader
m_watcher = new KDirWatch( this );
- connect( m_watcher, SIGNAL(dirty(QString)), this, SLOT(slotFileDirty(QString)) );
+ connect( m_watcher, &KDirWatch::dirty, this, &Part::slotFileDirty );
m_dirtyHandler = new QTimer( this );
m_dirtyHandler->setSingleShot( true );
- connect( m_dirtyHandler, SIGNAL(timeout()),this, SLOT(slotDoFileDirty()) );
+ connect( m_dirtyHandler, &QTimer::timeout,this, &Part::slotDoFileDirty );
slotNewConfig();
// keep us informed when the user changes settings
- connect( Okular::Settings::self(), SIGNAL(configChanged()), this, SLOT(slotNewConfig()) );
+ connect( Okular::Settings::self(), &KCoreConfigSkeleton::configChanged, this, &Part::slotNewConfig );
#ifdef HAVE_SPEECH
// [SPEECH] check for TTS presence and usability
@@ -528,12 +528,12 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
if ( m_embedMode == ViewerWidgetMode ) {
// set the XML-UI resource file for the viewer mode
- setXMLFile("part-viewermode.rc");
+ setXMLFile(QStringLiteral("part-viewermode.rc"));
}
else
{
// set our main XML-UI resource file
- setXMLFile("part.rc");
+ setXMLFile(QStringLiteral("part.rc"));
}
m_pageView->setupBaseActions( actionCollection() );
@@ -573,8 +573,8 @@ void Part::setupViewerActions()
m_gotoPage = KStandardAction::gotoPage( this, SLOT(slotGoToPage()), ac );
ac->setDefaultShortcuts(m_gotoPage, KStandardShortcut::gotoLine());
// dirty way to activate gotopage when pressing miniBar's button
- connect( m_miniBar, SIGNAL(gotoPage()), m_gotoPage, SLOT(trigger()) );
- connect( m_pageNumberTool, SIGNAL(gotoPage()), m_gotoPage, SLOT(trigger()) );
+ connect( m_miniBar.data(), &MiniBar::gotoPage, m_gotoPage, &QAction::trigger );
+ connect( m_pageNumberTool.data(), &MiniBar::gotoPage, m_gotoPage, &QAction::trigger );
m_prevPage = KStandardAction::prior(this, SLOT(slotPreviousPage()), ac);
m_prevPage->setIconText( i18nc( "Previous page", "Previous" ) );
@@ -582,8 +582,8 @@ void Part::setupViewerActions()
m_prevPage->setWhatsThis( i18n( "Moves to the previous page of the document" ) );
ac->setDefaultShortcut(m_prevPage, QKeySequence());
// dirty way to activate prev page when pressing miniBar's button
- connect( m_miniBar, SIGNAL(prevPage()), m_prevPage, SLOT(trigger()) );
- connect( m_pageNumberTool, SIGNAL(prevPage()), m_prevPage, SLOT(trigger()) );
+ connect( m_miniBar.data(), &MiniBar::prevPage, m_prevPage, &QAction::trigger );
+ connect( m_pageNumberTool.data(), &MiniBar::prevPage, m_prevPage, &QAction::trigger );
#ifdef OKULAR_ENABLE_MINIBAR
connect( m_progressWidget, SIGNAL(prevPage()), m_prevPage, SLOT(trigger()) );
#endif
@@ -594,19 +594,19 @@ void Part::setupViewerActions()
m_nextPage->setWhatsThis( i18n( "Moves to the next page of the document" ) );
ac->setDefaultShortcut(m_nextPage, QKeySequence());
// dirty way to activate next page when pressing miniBar's button
- connect( m_miniBar, SIGNAL(nextPage()), m_nextPage, SLOT(trigger()) );
- connect( m_pageNumberTool, SIGNAL(nextPage()), m_nextPage, SLOT(trigger()) );
+ connect( m_miniBar.data(), &MiniBar::nextPage, m_nextPage, &QAction::trigger );
+ connect( m_pageNumberTool.data(), &MiniBar::nextPage, m_nextPage, &QAction::trigger );
#ifdef OKULAR_ENABLE_MINIBAR
connect( m_progressWidget, SIGNAL(nextPage()), m_nextPage, SLOT(trigger()) );
#endif
m_beginningOfDocument = KStandardAction::firstPage( this, SLOT(slotGotoFirst()), ac );
- ac->addAction("first_page", m_beginningOfDocument);
+ ac->addAction(QStringLiteral("first_page"), m_beginningOfDocument);
m_beginningOfDocument->setText(i18n( "Beginning of the document"));
m_beginningOfDocument->setWhatsThis( i18n( "Moves to the beginning of the document" ) );
m_endOfDocument = KStandardAction::lastPage( this, SLOT(slotGotoLast()), ac );
- ac->addAction("last_page",m_endOfDocument);
+ ac->addAction(QStringLiteral("last_page"),m_endOfDocument);
m_endOfDocument->setText(i18n( "End of the document"));
m_endOfDocument->setWhatsThis( i18n( "Moves to the end of the document" ) );
@@ -618,23 +618,23 @@ void Part::setupViewerActions()
m_addBookmarkText = m_addBookmark->text();
m_addBookmarkIcon = m_addBookmark->icon();
- m_renameBookmark = ac->addAction("rename_bookmark");
+ m_renameBookmark = ac->addAction(QStringLiteral("rename_bookmark"));
m_renameBookmark->setText(i18n( "Rename Bookmark" ));
- m_renameBookmark->setIcon(QIcon::fromTheme( "edit-rename" ));
+ m_renameBookmark->setIcon(QIcon::fromTheme( QStringLiteral("edit-rename") ));
m_renameBookmark->setWhatsThis( i18n( "Rename the current bookmark" ) );
- connect( m_renameBookmark, SIGNAL(triggered()), this, SLOT(slotRenameCurrentViewportBookmark()) );
+ connect( m_renameBookmark, &QAction::triggered, this, &Part::slotRenameCurrentViewportBookmark );
- m_prevBookmark = ac->addAction("previous_bookmark");
+ m_prevBookmark = ac->addAction(QStringLiteral("previous_bookmark"));
m_prevBookmark->setText(i18n( "Previous Bookmark" ));
- m_prevBookmark->setIcon(QIcon::fromTheme( "go-up-search" ));
+ m_prevBookmark->setIcon(QIcon::fromTheme( QStringLiteral("go-up-search") ));
m_prevBookmark->setWhatsThis( i18n( "Go to the previous bookmark" ) );
- connect( m_prevBookmark, SIGNAL(triggered()), this, SLOT(slotPreviousBookmark()) );
+ connect( m_prevBookmark, &QAction::triggered, this, &Part::slotPreviousBookmark );
- m_nextBookmark = ac->addAction("next_bookmark");
+ m_nextBookmark = ac->addAction(QStringLiteral("next_bookmark"));
m_nextBookmark->setText(i18n( "Next Bookmark" ));
- m_nextBookmark->setIcon(QIcon::fromTheme( "go-down-search" ));
+ m_nextBookmark->setIcon(QIcon::fromTheme( QStringLiteral("go-down-search") ));
m_nextBookmark->setWhatsThis( i18n( "Go to the next bookmark" ) );
- connect( m_nextBookmark, SIGNAL(triggered()), this, SLOT(slotNextBookmark()) );
+ connect( m_nextBookmark, &QAction::triggered, this, &Part::slotNextBookmark );
m_copy = 0;
@@ -668,7 +668,7 @@ void Part::setupViewerActions()
}
QAction * genPrefs = new QAction( ac );
- ac->addAction("options_configure_generators", genPrefs);
+ ac->addAction(QStringLiteral("options_configure_generators"), genPrefs);
if ( m_embedMode == ViewerWidgetMode )
{
genPrefs->setText( i18n( "Configure Viewer Backends..." ) );
@@ -677,9 +677,9 @@ void Part::setupViewerActions()
{
genPrefs->setText( i18n( "Configure Backends..." ) );
}
- genPrefs->setIcon( QIcon::fromTheme( "configure" ) );
+ genPrefs->setIcon( QIcon::fromTheme( QStringLiteral("configure") ) );
genPrefs->setEnabled( m_document->configurableGenerators() > 0 );
- connect( genPrefs, SIGNAL(triggered(bool)), this, SLOT(slotGeneratorPreferences()) );
+ connect( genPrefs, &QAction::triggered, this, &Part::slotGeneratorPreferences );
m_printPreview = KStandardAction::printPreview( this, SLOT(slotPrintPreview()), ac );
m_printPreview->setEnabled( false );
@@ -687,10 +687,10 @@ void Part::setupViewerActions()
m_showLeftPanel = 0;
m_showBottomBar = 0;
- m_showProperties = ac->addAction("properties");
+ m_showProperties = ac->addAction(QStringLiteral("properties"));
m_showProperties->setText(i18n("&Properties"));
- m_showProperties->setIcon(QIcon::fromTheme("document-properties"));
- connect(m_showProperties, SIGNAL(triggered()), this, SLOT(slotShowProperties()));
+ m_showProperties->setIcon(QIcon::fromTheme(QStringLiteral("document-properties")));
+ connect(m_showProperties, &QAction::triggered, this, &Part::slotShowProperties);
m_showProperties->setEnabled( false );
m_showEmbeddedFiles = 0;
@@ -702,20 +702,20 @@ void Part::setupViewerActions()
m_exportAsDocArchive = 0;
m_presentationDrawingActions = 0;
- m_aboutBackend = ac->addAction("help_about_backend");
+ m_aboutBackend = ac->addAction(QStringLiteral("help_about_backend"));
m_aboutBackend->setText(i18n("About Backend"));
m_aboutBackend->setEnabled( false );
- connect(m_aboutBackend, SIGNAL(triggered()), this, SLOT(slotAboutBackend()));
+ connect(m_aboutBackend, &QAction::triggered, this, &Part::slotAboutBackend);
- QAction *reload = ac->add<QAction>( "file_reload" );
+ QAction *reload = ac->add<QAction>( QStringLiteral("file_reload") );
reload->setText( i18n( "Reloa&d" ) );
- reload->setIcon( QIcon::fromTheme( "view-refresh" ) );
+ reload->setIcon( QIcon::fromTheme( QStringLiteral("view-refresh") ) );
reload->setWhatsThis( i18n( "Reload the current document from disk." ) );
- connect( reload, SIGNAL(triggered()), this, SLOT(slotReload()) );
+ connect( reload, &QAction::triggered, this, &Part::slotReload );
ac->setDefaultShortcuts(reload, KStandardShortcut::reload());
m_reload = reload;
- m_closeFindBar = ac->addAction( "close_find_bar", this, SLOT(slotHideFindBar()) );
+ m_closeFindBar = ac->addAction( QStringLiteral("close_find_bar"), this, SLOT(slotHideFindBar()) );
m_closeFindBar->setText( i18n("Close &Find Bar") );
ac->setDefaultShortcut(m_closeFindBar, QKeySequence(Qt::Key_Escape));
m_closeFindBar->setEnabled( false );
@@ -723,7 +723,7 @@ void Part::setupViewerActions()
QWidgetAction *pageno = new QWidgetAction( ac );
pageno->setText( i18n( "Page Number" ) );
pageno->setDefaultWidget( m_pageNumberTool );
- ac->addAction( "page_number", pageno );
+ ac->addAction( QStringLiteral("page_number"), pageno );
}
void Part::setViewerShortcuts()
@@ -741,7 +741,7 @@ void Part::setViewerShortcuts()
ac->setDefaultShortcut(m_beginningOfDocument, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Home));
ac->setDefaultShortcut(m_endOfDocument, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_End));
- QAction *action = static_cast<QAction*>( ac->action( "file_reload" ) );
+ QAction *action = static_cast<QAction*>( ac->action( QStringLiteral("file_reload") ) );
if (action) {
ac->setDefaultShortcut(action, QKeySequence(Qt::ALT + Qt::Key_F5));
}
@@ -758,7 +758,7 @@ void Part::setupActions()
m_saveCopyAs = KStandardAction::saveAs( this, SLOT(slotSaveCopyAs()), ac );
m_saveCopyAs->setText( i18n( "Save &Copy As..." ) );
- ac->addAction( "file_save_copy", m_saveCopyAs );
+ ac->addAction( QStringLiteral("file_save_copy"), m_saveCopyAs );
ac->setDefaultShortcuts(m_saveCopyAs, KStandardShortcut::shortcut(KStandardShortcut::SaveAs));
m_saveCopyAs->setEnabled( false );
@@ -766,31 +766,31 @@ void Part::setupActions()
ac->setDefaultShortcuts(m_saveAs, KStandardShortcut::shortcut(KStandardShortcut::Save));
m_saveAs->setEnabled( false );
- m_showLeftPanel = ac->add<KToggleAction>("show_leftpanel");
+ m_showLeftPanel = ac->add<KToggleAction>(QStringLiteral("show_leftpanel"));
m_showLeftPanel->setText(i18n( "Show &Navigation Panel"));
- m_showLeftPanel->setIcon(QIcon::fromTheme( "view-sidetree" ));
- connect( m_showLeftPanel, SIGNAL(toggled(bool)), this, SLOT(slotShowLeftPanel()) );
+ m_showLeftPanel->setIcon(QIcon::fromTheme( QStringLiteral("view-sidetree") ));
+ connect( m_showLeftPanel, &QAction::toggled, this, &Part::slotShowLeftPanel );
ac->setDefaultShortcut(m_showLeftPanel, QKeySequence(Qt::Key_F7));
m_showLeftPanel->setChecked( Okular::Settings::showLeftPanel() );
slotShowLeftPanel();
- m_showBottomBar = ac->add<KToggleAction>("show_bottombar");
+ m_showBottomBar = ac->add<KToggleAction>(QStringLiteral("show_bottombar"));
m_showBottomBar->setText(i18n( "Show &Page Bar"));
- connect( m_showBottomBar, SIGNAL(toggled(bool)), this, SLOT(slotShowBottomBar()) );
+ connect( m_showBottomBar, &QAction::toggled, this, &Part::slotShowBottomBar );
m_showBottomBar->setChecked( Okular::Settings::showBottomBar() );
slotShowBottomBar();
- m_showEmbeddedFiles = ac->addAction("embedded_files");
+ m_showEmbeddedFiles = ac->addAction(QStringLiteral("embedded_files"));
m_showEmbeddedFiles->setText(i18n("&Embedded Files"));
- m_showEmbeddedFiles->setIcon( QIcon::fromTheme( "mail-attachment" ) );
- connect(m_showEmbeddedFiles, SIGNAL(triggered()), this, SLOT(slotShowEmbeddedFiles()));
+ m_showEmbeddedFiles->setIcon( QIcon::fromTheme( QStringLiteral("mail-attachment") ) );
+ connect(m_showEmbeddedFiles, &QAction::triggered, this, &Part::slotShowEmbeddedFiles);
m_showEmbeddedFiles->setEnabled( false );
- m_exportAs = ac->addAction("file_export_as");
+ m_exportAs = ac->addAction(QStringLiteral("file_export_as"));
m_exportAs->setText(i18n("E&xport As"));
- m_exportAs->setIcon( QIcon::fromTheme( "document-export" ) );
+ m_exportAs->setIcon( QIcon::fromTheme( QStringLiteral("document-export") ) );
m_exportAsMenu = new QMenu();
- connect(m_exportAsMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotExportAs(QAction*)));
+ connect(m_exportAsMenu, &QMenu::triggered, this, &Part::slotExportAs);
m_exportAs->setMenu( m_exportAsMenu );
m_exportAsText = actionForExportFormat( Okular::ExportFormat::standardFormat( Okular::ExportFormat::PlainText ), m_exportAsMenu );
m_exportAsMenu->addAction( m_exportAsText );
@@ -798,21 +798,21 @@ void Part::setupActions()
m_exportAsText->setEnabled( false );
m_exportAsDocArchive = actionForExportFormat( Okular::ExportFormat(
i18nc( "A document format, Okular-specific", "Document Archive" ),
- db.mimeTypeForName( "application/vnd.kde.okular-archive" ) ), m_exportAsMenu );
+ db.mimeTypeForName( QStringLiteral("application/vnd.kde.okular-archive") ) ), m_exportAsMenu );
m_exportAsMenu->addAction( m_exportAsDocArchive );
m_exportAsDocArchive->setEnabled( false );
- m_showPresentation = ac->addAction("presentation");
+ m_showPresentation = ac->addAction(QStringLiteral("presentation"));
m_showPresentation->setText(i18n("P&resentation"));
- m_showPresentation->setIcon( QIcon::fromTheme( "view-presentation" ) );
- connect(m_showPresentation, SIGNAL(triggered()), this, SLOT(slotShowPresentation()));
+ m_showPresentation->setIcon( QIcon::fromTheme( QStringLiteral("view-presentation") ) );
+ connect(m_showPresentation, &QAction::triggered, this, &Part::slotShowPresentation);
ac->setDefaultShortcut(m_showPresentation, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P));
m_showPresentation->setEnabled( false );
- QAction * importPS = ac->addAction("import_ps");
+ QAction * importPS = ac->addAction(QStringLiteral("import_ps"));
importPS->setText(i18n("&Import PostScript as PDF..."));
- importPS->setIcon(QIcon::fromTheme("document-import"));
- connect(importPS, SIGNAL(triggered()), this, SLOT(slotImportPSFile()));
+ importPS->setIcon(QIcon::fromTheme(QStringLiteral("document-import")));
+ connect(importPS, &QAction::triggered, this, &Part::slotImportPSFile);
#if 0
QAction * ghns = ac->addAction("get_new_stuff");
ghns->setText(i18n("&Get Books From Internet..."));
@@ -821,25 +821,25 @@ void Part::setupActions()
#endif
KToggleAction *blackscreenAction = new KToggleAction( i18n( "Switch Blackscreen Mode" ), ac );
- ac->addAction( "switch_blackscreen_mode", blackscreenAction );
+ ac->addAction( QStringLiteral("switch_blackscreen_mode"), blackscreenAction );
ac->setDefaultShortcut(blackscreenAction, QKeySequence(Qt::Key_B));
- blackscreenAction->setIcon( QIcon::fromTheme( "view-presentation" ) );
+ blackscreenAction->setIcon( QIcon::fromTheme( QStringLiteral("view-presentation") ) );
blackscreenAction->setEnabled( false );
m_presentationDrawingActions = new DrawingToolActions( ac );
QAction *eraseDrawingAction = new QAction( i18n( "Erase Drawings" ), ac );
- ac->addAction( "presentation_erase_drawings", eraseDrawingAction );
- eraseDrawingAction->setIcon( QIcon::fromTheme( "draw-eraser" ) );
+ ac->addAction( QStringLiteral("presentation_erase_drawings"), eraseDrawingAction );
+ eraseDrawingAction->setIcon( QIcon::fromTheme( QStringLiteral("draw-eraser") ) );
eraseDrawingAction->setEnabled( false );
QAction *configureAnnotations = new QAction( i18n( "Configure Annotations..." ), ac );
- ac->addAction( "options_configure_annotations", configureAnnotations );
- configureAnnotations->setIcon( QIcon::fromTheme( "configure" ) );
- connect(configureAnnotations, SIGNAL(triggered()), this, SLOT(slotAnnotationPreferences()));
+ ac->addAction( QStringLiteral("options_configure_annotations"), configureAnnotations );
+ configureAnnotations->setIcon( QIcon::fromTheme( QStringLiteral("configure") ) );
+ connect(configureAnnotations, &QAction::triggered, this, &Part::slotAnnotationPreferences);
QAction *playPauseAction = new QAction( i18n( "Play/Pause Presentation" ), ac );
- ac->addAction( "presentation_play_pause", playPauseAction );
+ ac->addAction( QStringLiteral("presentation_play_pause"), playPauseAction );
playPauseAction->setEnabled( false );
}
@@ -918,7 +918,7 @@ QUrl Part::realUrl() const
void Part::showSourceLocation(const QString& fileName, int line, int column, bool showGraphically)
{
- const QString u = QString( "src:%1 %2" ).arg( line + 1 ).arg( fileName );
+ const QString u = QStringLiteral( "src:%1 %2" ).arg( line + 1 ).arg( fileName );
GotoAction action( QString(), u );
m_document->processAction( &action );
if( showGraphically )
@@ -1024,9 +1024,9 @@ void Part::slotJobStarted(KIO::Job *job)
if (job)
{
QStringList supportedMimeTypes = m_document->supportedMimeTypes();
- job->addMetaData("accept", supportedMimeTypes.join(", ") + ", */*;q=0.5");
+ job->addMetaData(QStringLiteral("accept"), supportedMimeTypes.join(QStringLiteral(", ")) + ", */*;q=0.5");
- connect(job, SIGNAL(result(KJob*)), this, SLOT(slotJobFinished(KJob*)));
+ connect(job, &KJob::result, this, &Part::slotJobFinished);
}
}
@@ -1064,7 +1064,7 @@ void Part::setWindowTitleFromDocument()
if ( Okular::Settings::displayDocumentTitle() )
{
- const QString docTitle = m_document->metaData( "DocumentTitle" ).toString();
+ const QString docTitle = m_document->metaData( QStringLiteral("DocumentTitle") ).toString();
if ( !docTitle.isEmpty() && !docTitle.trimmed().isEmpty() )
{
title = docTitle;
@@ -1077,7 +1077,7 @@ void Part::setWindowTitleFromDocument()
KConfigDialog * Part::slotGeneratorPreferences( )
{
// Create dialog
- KConfigDialog * dialog = new KConfigDialog( m_pageView, "generator_prefs", Okular::Settings::self() );
+ KConfigDialog * dialog = new KConfigDialog( m_pageView, QStringLiteral("generator_prefs"), Okular::Settings::self() );
dialog->setAttribute( Qt::WA_DeleteOnClose );
if( m_embedMode == ViewerWidgetMode )
@@ -1169,7 +1169,7 @@ QString Part::documentMetaData( const QString &metaData ) const
bool Part::slotImportPSFile()
{
- QString app = KStandardDirs::findExe( "ps2pdf" );
+ QString app = KStandardDirs::findExe( QStringLiteral("ps2pdf") );
if ( app.isEmpty() )
{
// TODO point the user to their distro packages?
@@ -1177,7 +1177,7 @@ bool Part::slotImportPSFile()
return false;
}
- QUrl url = KFileDialog::getOpenUrl( QUrl(), "application/postscript", this->widget() );
+ QUrl url = KFileDialog::getOpenUrl( QUrl(), QStringLiteral("application/postscript"), this->widget() );
if ( url.isLocalFile() )
{
QTemporaryFile tf(QDir::tempPath() + QLatin1String("/okular_XXXXXX.pdf"));
@@ -1231,7 +1231,7 @@ Document::OpenResult Part::doOpenFile( const QMimeType &mimeA, const QString &fi
isDocumentArchive = false;
if ( uncompressOk )
{
- if ( mime.inherits( "application/vnd.kde.okular-archive" ) )
+ if ( mime.inherits( QStringLiteral("application/vnd.kde.okular-archive") ) )
{
openResult = m_document->openDocumentArchive( fileNameToOpen, url() );
isDocumentArchive = true;
@@ -1294,7 +1294,7 @@ Document::OpenResult Part::doOpenFile( const QMimeType &mimeA, const QString &fi
}
// 2. reopen the document using the password
- if ( mime.inherits( "application/vnd.kde.okular-archive" ) )
+ if ( mime.inherits( QStringLiteral("application/vnd.kde.okular-archive") ) )
{
openResult = m_document->openDocumentArchive( fileNameToOpen, url(), password );
isDocumentArchive = true;
@@ -1345,7 +1345,7 @@ bool Part::openFile()
mimes << pathMime << argMime;
}
- if (mimes[0].name() == "text/plain") {
+ if (mimes[0].name() == QLatin1String("text/plain")) {
QMimeType contentMime = db.mimeTypeForFile(fileNameToOpen, QMimeDatabase::MatchContent);
mimes.prepend( contentMime );
}
@@ -1382,10 +1382,10 @@ bool Part::openFile()
m_topMessage->setVisible( hasEmbeddedFiles && Okular::Settings::showOSD() );
// Warn the user that XFA forms are not supported yet (NOTE: poppler generator only)
- if ( ok && m_document->metaData( "HasUnsupportedXfaForm" ).toBool() == true )
+ if ( ok && m_document->metaData( QStringLiteral("HasUnsupportedXfaForm") ).toBool() == true )
{
m_formsMessage->setText( i18n( "This document has XFA forms, which are currently <b>unsupported</b>." ) );
- m_formsMessage->setIcon( QIcon::fromTheme( "dialog-warning" ) );
+ m_formsMessage->setIcon( QIcon::fromTheme( QStringLiteral("dialog-warning") ) );
m_formsMessage->setMessageType( KMessageWidget::Warning );
m_formsMessage->setVisible( true );
}
@@ -1449,13 +1449,13 @@ bool Part::openFile()
}
// if the 'OpenTOC' flag is set, open the TOC
- if ( m_document->metaData( "OpenTOC" ).toBool() && m_sidebar->isItemEnabled( m_toc ) && !m_sidebar->isCollapsed() && m_sidebar->currentItem() != m_toc )
+ if ( m_document->metaData( QStringLiteral("OpenTOC") ).toBool() && m_sidebar->isItemEnabled( m_toc ) && !m_sidebar->isCollapsed() && m_sidebar->currentItem() != m_toc )
{
m_sidebar->setCurrentItem( m_toc, Sidebar::DoNotUncollapseIfCollapsed );
}
// if the 'StartFullScreen' flag is set, or the command line flag was
// specified, start presentation
- if ( m_document->metaData( "StartFullScreen" ).toBool() || m_cliPresentation )
+ if ( m_document->metaData( QStringLiteral("StartFullScreen") ).toBool() || m_cliPresentation )
{
bool goAheadWithPresentationMode = true;
if ( !m_cliPresentation )
@@ -1463,8 +1463,8 @@ bool Part::openFile()
const QString text = i18n( "The document requested to be launched in presentation mode.\n"
"Do you want to allow it?" );
const QString caption = i18n( "Presentation Mode" );
- const KGuiItem yesItem = KGuiItem( i18n( "Allow" ), "dialog-ok", i18n( "Allow the presentation mode" ) );
- const KGuiItem noItem = KGuiItem( i18n( "Do Not Allow" ), "process-stop", i18n( "Do not allow the presentation mode" ) );
+ const KGuiItem yesItem = KGuiItem( i18n( "Allow" ), QStringLiteral("dialog-ok"), i18n( "Allow the presentation mode" ) );
+ const KGuiItem noItem = KGuiItem( i18n( "Do Not Allow" ), QStringLiteral("process-stop"), i18n( "Do not allow the presentation mode" ) );
const int result = KMessageBox::questionYesNo( widget(), text, caption, yesItem, noItem );
if ( result == KMessageBox::No )
goAheadWithPresentationMode = false;
@@ -1592,7 +1592,7 @@ bool Part::closeUrl(bool promptToSave)
}
}
if ( m_showPresentation ) m_showPresentation->setEnabled( false );
- emit setWindowCaption("");
+ emit setWindowCaption(QLatin1String(""));
emit enablePrintAction(false);
m_realUrl = QUrl();
if ( url().isLocalFile() )
@@ -1645,13 +1645,13 @@ void Part::close()
{
closeUrl();
}
- else KMessageBox::information( widget(), i18n( "This link points to a close document action that does not work when using the embedded viewer." ), QString(), "warnNoCloseIfNotInOkular" );
+ else KMessageBox::information( widget(), i18n( "This link points to a close document action that does not work when using the embedded viewer." ), QString(), QStringLiteral("warnNoCloseIfNotInOkular") );
}
void Part::cannotQuit()
{
- KMessageBox::information( widget(), i18n( "This link points to a quit application action that does not work when using the embedded viewer." ), QString(), "warnNoQuitIfNotInOkular" );
+ KMessageBox::information( widget(), i18n( "This link points to a quit application action that does not work when using the embedded viewer." ), QString(), QStringLiteral("warnNoQuitIfNotInOkular") );
}
@@ -1875,10 +1875,10 @@ void Part::updateViewActions()
if ( factory() )
{
- QWidget *menu = factory()->container("menu_okular_part_viewer", this);
+ QWidget *menu = factory()->container(QStringLiteral("menu_okular_part_viewer"), this);
if (menu) menu->setEnabled( opened );
- menu = factory()->container("view_orientation", this);
+ menu = factory()->container(QStringLiteral("view_orientation"), this);
if (menu) menu->setEnabled( opened );
}
emit viewerMenuStateChange( opened );
@@ -1896,7 +1896,7 @@ void Part::updateBookmarksActions()
if ( m_document->bookmarkManager()->isBookmarked( m_document->viewport() ) )
{
m_addBookmark->setText( i18n( "Remove Bookmark" ) );
- m_addBookmark->setIcon( QIcon::fromTheme( "edit-delete-bookmark" ) );
+ m_addBookmark->setIcon( QIcon::fromTheme( QStringLiteral("edit-delete-bookmark") ) );
m_renameBookmark->setEnabled( true );
}
else
@@ -2097,7 +2097,7 @@ void Part::slotRenameCurrentViewportBookmark()
void Part::slotAboutToShowContextMenu(QMenu * /*menu*/, QAction *action, QMenu *contextMenu)
{
- const QList<QAction*> actions = contextMenu->findChildren<QAction*>("OkularPrivateRenameBookmarkActions");
+ const QList<QAction*> actions = contextMenu->findChildren<QAction*>(QStringLiteral("OkularPrivateRenameBookmarkActions"));
foreach(QAction *a, actions)
{
contextMenu->removeAction(a);
@@ -2108,10 +2108,10 @@ void Part::slotAboutToShowContextMenu(QMenu * /*menu*/, QAction *action, QMenu *
if (ba != NULL)
{
QAction *separatorAction = contextMenu->addSeparator();
- separatorAction->setObjectName("OkularPrivateRenameBookmarkActions");
- QAction *renameAction = contextMenu->addAction( QIcon::fromTheme( "edit-rename" ), i18n( "Rename this Bookmark" ), this, SLOT(slotRenameBookmarkFromMenu()) );
+ separatorAction->setObjectName(QStringLiteral("OkularPrivateRenameBookmarkActions"));
+ QAction *renameAction = contextMenu->addAction( QIcon::fromTheme( QStringLiteral("edit-rename") ), i18n( "Rename this Bookmark" ), this, SLOT(slotRenameBookmarkFromMenu()) );
renameAction->setData(ba->property("htmlRef").toString());
- renameAction->setObjectName("OkularPrivateRenameBookmarkActions");
+ renameAction->setObjectName(QStringLiteral("OkularPrivateRenameBookmarkActions"));
}
}
@@ -2440,11 +2440,11 @@ void Part::slotShowMenu(const Okular::Page *page, const QPoint &point)
{
ac = clients.at(i)->actionCollection();
// show_menubar
- act = ac->action("options_show_menubar");
+ act = ac->action(QStringLiteral("options_show_menubar"));
if (act && qobject_cast<KToggleAction*>(act))
m_showMenuBarAction = qobject_cast<KToggleAction*>(act);
// fullscreen
- act = ac->action("fullscreen");
+ act = ac->action(QStringLiteral("fullscreen"));
if (act && qobject_cast<KToggleFullScreenAction*>(act))
m_showFullScreenAction = qobject_cast<KToggleFullScreenAction*>(act);
}
@@ -2461,11 +2461,11 @@ void Part::slotShowMenu(const Okular::Page *page, const QPoint &point)
popup->setTitle( i18n( "Page %1", page->number() + 1 ) );
if ( ( !currentPage && m_document->bookmarkManager()->isBookmarked( page->number() ) ) ||
( currentPage && m_document->bookmarkManager()->isBookmarked( m_document->viewport() ) ) )
- removeBookmark = popup->addAction( QIcon::fromTheme("edit-delete-bookmark"), i18n("Remove Bookmark") );
+ removeBookmark = popup->addAction( QIcon::fromTheme(QStringLiteral("edit-delete-bookmark")), i18n("Remove Bookmark") );
else
- addBookmark = popup->addAction( QIcon::fromTheme("bookmark-new"), i18n("Add Bookmark") );
+ addBookmark = popup->addAction( QIcon::fromTheme(QStringLiteral("bookmark-new")), i18n("Add Bookmark") );
if ( m_pageView->canFitPageWidth() )
- fitPageWidth = popup->addAction( QIcon::fromTheme("zoom-fit-best"), i18n("Fit Width") );
+ fitPageWidth = popup->addAction( QIcon::fromTheme(QStringLiteral("zoom-fit-best")), i18n("Fit Width") );
popup->addAction( m_prevBookmark );
popup->addAction( m_nextBookmark );
reallyShow = true;
@@ -2608,10 +2608,10 @@ void Part::slotExportAs(QAction * act)
switch ( id )
{
case 0:
- filter = "text/plain";
+ filter = QStringLiteral("text/plain");
break;
case 1:
- filter = "application/vnd.kde.okular-archive";
+ filter = QStringLiteral("application/vnd.kde.okular-archive");
break;
default:
filter = m_exportFormats.at( id - 2 ).mimeType().name();
@@ -2720,7 +2720,7 @@ void Part::setupPrint( QPrinter &printer )
printer.setOrientation(m_document->orientation());
// title
- QString title = m_document->metaData( "DocumentTitle" ).toString();
+ QString title = m_document->metaData( QStringLiteral("DocumentTitle") ).toString();
if ( title.isEmpty() )
{
title = m_document->currentDocument().fileName();
@@ -2834,11 +2834,11 @@ void Part::unsetDummyMode()
// add back and next in history
m_historyBack = KStandardAction::documentBack( this, SLOT(slotHistoryBack()), actionCollection() );
m_historyBack->setWhatsThis( i18n( "Go to the place you were before" ) );
- connect(m_pageView, SIGNAL(mouseBackButtonClick()), m_historyBack, SLOT(trigger()));
+ connect(m_pageView.data(), &PageView::mouseBackButtonClick, m_historyBack, &QAction::trigger);
m_historyNext = KStandardAction::documentForward( this, SLOT(slotHistoryNext()), actionCollection());
m_historyNext->setWhatsThis( i18n( "Go to the place you were after" ) );
- connect(m_pageView, SIGNAL(mouseForwardButtonClick()), m_historyNext, SLOT(trigger()));
+ connect(m_pageView.data(), &PageView::mouseForwardButtonClick, m_historyNext, &QAction::trigger);
m_pageView->setupActions( actionCollection() );
@@ -2926,7 +2926,7 @@ void Part::rebuildBookmarkMenu( bool unplugActions )
{
if ( unplugActions )
{
- unplugActionList( "bookmarks_currentdocument" );
+ unplugActionList( QStringLiteral("bookmarks_currentdocument") );
qDeleteAll( m_bookmarkActions );
m_bookmarkActions.clear();
}
@@ -2944,7 +2944,7 @@ void Part::rebuildBookmarkMenu( bool unplugActions )
a->setEnabled( false );
m_bookmarkActions.append( a );
}
- plugActionList( "bookmarks_currentdocument", m_bookmarkActions );
+ plugActionList( QStringLiteral("bookmarks_currentdocument"), m_bookmarkActions );
if (factory())
{
@@ -2952,7 +2952,7 @@ void Part::rebuildBookmarkMenu( bool unplugActions )
bool containerFound = false;
for (int i = 0; !containerFound && i < clients.size(); ++i)
{
- QWidget *container = factory()->container("bookmarks", clients[i]);
+ QWidget *container = factory()->container(QStringLiteral("bookmarks"), clients[i]);
if (container && container->actions().contains(m_bookmarkActions.first()))
{
Q_ASSERT(dynamic_cast<QMenu*>(container));
diff --git a/shell/okular_main.cpp b/shell/okular_main.cpp
index 1c988d9..fdee694 100644
--- a/shell/okular_main.cpp
+++ b/shell/okular_main.cpp
@@ -28,14 +28,14 @@ static bool attachUniqueInstance(const QStringList &paths, const QString &serial
if (!ShellUtils::unique(serializedOptions) || paths.count() != 1)
return false;
- QDBusInterface iface("org.kde.okular", "/okularshell", "org.kde.okular");
+ QDBusInterface iface(QStringLiteral("org.kde.okular"), QStringLiteral("/okularshell"), QStringLiteral("org.kde.okular"));
if (!iface.isValid())
return false;
const QString page = ShellUtils::page(serializedOptions);
- iface.call("openDocument", ShellUtils::urlFromArg(paths[0], ShellUtils::qfileExistFunc(), page).url(), serializedOptions);
+ iface.call(QStringLiteral("openDocument"), ShellUtils::urlFromArg(paths[0], ShellUtils::qfileExistFunc(), page).url(), serializedOptions);
if (!ShellUtils::noRaise(serializedOptions)) {
- iface.call("tryRaise");
+ iface.call(QStringLiteral("tryRaise"));
}
return true;
@@ -50,7 +50,7 @@ static bool attachExistingInstance(const QStringList &paths, const QString &seri
const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
// Don't match the service without trailing "-" (unique instance)
- const QString pattern = "org.kde.okular-";
+ const QString pattern = QStringLiteral("org.kde.okular-");
const QString myPid = QString::number( qApp->applicationPid() );
QScopedPointer<QDBusInterface> bestService;
const int desktop = KWindowSystem::currentDesktop();
@@ -60,10 +60,10 @@ static bool attachExistingInstance(const QStringList &paths, const QString &seri
{
if ( service.startsWith(pattern) && !service.endsWith( myPid ) )
{
- bestService.reset( new QDBusInterface(service, "/okularshell", "org.kde.okular") );
+ bestService.reset( new QDBusInterface(service, QStringLiteral("/okularshell"), QStringLiteral("org.kde.okular")) );
// Find a window that can handle our documents
- const QDBusReply<bool> reply = bestService->call( "canOpenDocs", paths.count(), desktop );
+ const QDBusReply<bool> reply = bestService->call( QStringLiteral("canOpenDocs"), paths.count(), desktop );
if( reply.isValid() && reply.value() )
break;
@@ -81,7 +81,7 @@ static bool attachExistingInstance(const QStringList &paths, const QString &seri
// opened. Not sure if this behavior is safe on all platforms.
QScopedPointer<QTemporaryFile> tempFile;
QString path;
- if( arg == "-" )
+ if( arg == QLatin1String("-") )
{
tempFile.reset( new QTemporaryFile );
QFile stdinFile;
@@ -107,12 +107,12 @@ static bool attachExistingInstance(const QStringList &paths, const QString &seri
}
// Returns false if it can't fit another document
- const QDBusReply<bool> reply = bestService->call( "openDocument", path, serializedOptions );
+ const QDBusReply<bool> reply = bestService->call( QStringLiteral("openDocument"), path, serializedOptions );
if( !reply.isValid() || !reply.value() )
return false;
}
- bestService->call( "tryRaise" );
+ bestService->call( QStringLiteral("tryRaise") );
return true;
}
diff --git a/shell/shell.cpp b/shell/shell.cpp
index d0204f9..ce5e76c 100644
--- a/shell/shell.cpp
+++ b/shell/shell.cpp
@@ -63,16 +63,16 @@ Shell::Shell( const QString &serializedOptions )
, m_activityResource(0)
, m_isValid(true)
{
- setObjectName( QLatin1String( "okular::Shell#" ) );
+ setObjectName( QStringLiteral( "okular::Shell#" ) );
setContextMenuPolicy( Qt::NoContextMenu );
// set the shell's ui resource file
- setXMLFile("shell.rc");
+ setXMLFile(QStringLiteral("shell.rc"));
m_fileformatsscanned = false;
m_showMenuBarAction = 0;
// this routine will find and load our Part. it finds the Part by
// name which is a bad idea usually.. but it's alright in this
// case since our Part is made for this Shell
- KPluginLoader loader("okularpart");
+ KPluginLoader loader(QStringLiteral("okularpart"));
m_partFactory = loader.factory();
if (!m_partFactory)
{
@@ -94,17 +94,17 @@ Shell::Shell( const QString &serializedOptions )
m_tabWidget->tabBar()->hide();
m_tabWidget->setDocumentMode( true );
m_tabWidget->setMovable( true );
- connect( m_tabWidget, SIGNAL(currentChanged(int)), SLOT(setActiveTab(int)) );
- connect( m_tabWidget, SIGNAL(tabCloseRequested(int)), SLOT(closeTab(int)) );
+ connect( m_tabWidget, &QTabWidget::currentChanged, this, &Shell::setActiveTab );
+ connect( m_tabWidget, &QTabWidget::tabCloseRequested, this, &Shell::closeTab );
connect( m_tabWidget, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)), SLOT(testTabDrop(const QDragMoveEvent*,bool&)) ); // kf5 FIXME DnD
connect( m_tabWidget, SIGNAL(receivedDropEvent(QDropEvent*)), SLOT(handleTabDrop(QDropEvent*)) ); // kf5 FIXME DnD
- connect( m_tabWidget->tabBar(), SIGNAL(tabMoved(int,int)), SLOT(moveTabData(int,int)) );
+ connect( m_tabWidget->tabBar(), &QTabBar::tabMoved, this, &Shell::moveTabData );
setCentralWidget( m_tabWidget );
// then, setup our actions
setupActions();
- connect( QCoreApplication::instance(), SIGNAL(aboutToQuit()), SLOT(deleteLater()) );
+ connect( QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &QObject::deleteLater );
// and integrate the part's GUI with the shell's
setupGUI(Keys | ToolBar | Save);
createGUI(firstPart);
@@ -118,7 +118,7 @@ Shell::Shell( const QString &serializedOptions )
m_unique = ShellUtils::unique(serializedOptions);
if (m_unique)
{
- m_unique = QDBusConnection::sessionBus().registerService("org.kde.okular");
+ m_unique = QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.okular"));
if (!m_unique)
KMessageBox::information(this, i18n("There is already a unique Okular instance running. This instance won't be the unique one."));
}
@@ -127,7 +127,7 @@ Shell::Shell( const QString &serializedOptions )
setAttribute(Qt::WA_ShowWithoutActivating);
}
- QDBusConnection::sessionBus().registerObject("/okularshell", this, QDBusConnection::ExportScriptableSlots);
+ QDBusConnection::sessionBus().registerObject(QStringLiteral("/okularshell"), this, QDBusConnection::ExportScriptableSlots);
}
else
{
@@ -158,7 +158,7 @@ Shell::~Shell()
m_tabs.clear();
}
if (m_unique)
- QDBusConnection::sessionBus().unregisterService("org.kde.okular");
+ QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.okular"));
}
// Open a new document if we have space for it
@@ -304,17 +304,17 @@ void Shell::setupActions()
m_showMenuBarAction = KStandardAction::showMenubar( this, SLOT(slotShowMenubar()), actionCollection());
m_fullScreenAction = KStandardAction::fullScreen( this, SLOT(slotUpdateFullScreen()), this,actionCollection() );
- m_nextTabAction = actionCollection()->addAction("tab-next");
+ m_nextTabAction = actionCollection()->addAction(QStringLiteral("tab-next"));
m_nextTabAction->setText( i18n("Next Tab") );
actionCollection()->setDefaultShortcuts(m_nextTabAction, KStandardShortcut::tabNext());
m_nextTabAction->setEnabled( false );
- connect( m_nextTabAction, SIGNAL(triggered()), this, SLOT(activateNextTab()) );
+ connect( m_nextTabAction, &QAction::triggered, this, &Shell::activateNextTab );
- m_prevTabAction = actionCollection()->addAction("tab-previous");
+ m_prevTabAction = actionCollection()->addAction(QStringLiteral("tab-previous"));
m_prevTabAction->setText( i18n("Previous Tab") );
actionCollection()->setDefaultShortcuts(m_prevTabAction, KStandardShortcut::tabPrev());
m_prevTabAction->setEnabled( false );
- connect( m_prevTabAction, SIGNAL(triggered()), this, SLOT(activatePrevTab()) );
+ connect( m_prevTabAction, &QAction::triggered, this, &Shell::activatePrevTab );
}
void Shell::saveProperties(KConfigGroup &group)
@@ -353,7 +353,7 @@ QStringList Shell::fileFormats() const
{
QStringList supportedPatterns;
- QString constraint( "(Library == 'okularpart')" );
+ QString constraint( QStringLiteral("(Library == 'okularpart')") );
QLatin1String basePartService( "KParts/ReadOnlyPart" );
KService::List offers = KServiceTypeTrader::self()->query( basePartService, constraint );
KService::List::ConstIterator it = offers.constBegin(), itEnd = offers.constEnd();
@@ -396,7 +396,7 @@ void Shell::fileOpen()
dlg.setOperationMode( KFileDialog::Opening );
// A directory may be a document. E.g. comicbook generator.
- if ( m_fileformats.contains( "inode/directory" ) )
+ if ( m_fileformats.contains( QStringLiteral("inode/directory") ) )
dlg.setMode( dlg.mode() | KFile::Directory );
if ( m_fileformatsscanned && m_fileformats.isEmpty() )
diff --git a/shell/shellutils.cpp b/shell/shellutils.cpp
index a1f4d19..296a758 100644
--- a/shell/shellutils.cpp
+++ b/shell/shellutils.cpp
@@ -79,29 +79,29 @@ QUrl urlFromArg( const QString& _arg, FileExistFunc exist_func, const QString& p
QString serializeOptions(const QCommandLineParser &args)
{
- const bool startInPresentation = args.isSet( "presentation" );
- const bool showPrintDialog = args.isSet( "print" );
- const bool unique = args.isSet("unique") && args.positionalArguments().count() <= 1;
- const bool noRaise = !args.isSet("raise");
- const QString page = args.value("page");
+ const bool startInPresentation = args.isSet( QStringLiteral("presentation") );
+ const bool showPrintDialog = args.isSet( QStringLiteral("print") );
+ const bool unique = args.isSet(QStringLiteral("unique")) && args.positionalArguments().count() <= 1;
+ const bool noRaise = !args.isSet(QStringLiteral("raise"));
+ const QString page = args.value(QStringLiteral("page"));
return serializeOptions(startInPresentation, showPrintDialog, unique, noRaise, page);
}
QString serializeOptions(bool startInPresentation, bool showPrintDialog, bool unique, bool noRaise, const QString &page)
{
- return QString("%1:%2:%3:%4:%5").arg(startInPresentation).arg(showPrintDialog).arg(unique).arg(noRaise).arg(page);
+ return QStringLiteral("%1:%2:%3:%4:%5").arg(startInPresentation).arg(showPrintDialog).arg(unique).arg(noRaise).arg(page);
}
bool unserializeOptions(const QString &serializedOptions, bool *presentation, bool *print, bool *unique, bool *noraise, QString *page)
{
- const QStringList args = serializedOptions.split(":");
+ const QStringList args = serializedOptions.split(QStringLiteral(":"));
if (args.count() == 5)
{
- *presentation = args[0] == "1";
- *print = args[1] == "1";
- *unique = args[2] == "1";
- *noraise = args[3] == "1";
+ *presentation = args[0] == QLatin1String("1");
+ *print = args[1] == QLatin1String("1");
+ *unique = args[2] == QLatin1String("1");
+ *noraise = args[3] == QLatin1String("1");
*page = args[4];
return true;
}
diff --git a/ui/annotationmodel.cpp b/ui/annotationmodel.cpp
index 63eaa71..2ed5e59 100644
--- a/ui/annotationmodel.cpp
+++ b/ui/annotationmodel.cpp
@@ -304,7 +304,7 @@ QVariant AnnotationModel::data( const QModelIndex &index, int role ) const
if ( role == Qt::DisplayRole )
return i18n( "Page %1", item->page + 1 );
else if ( role == Qt::DecorationRole )
- return QIcon::fromTheme( "text-plain" );
+ return QIcon::fromTheme( QStringLiteral("text-plain") );
else if ( role == PageRole )
return item->page;
@@ -316,7 +316,7 @@ QVariant AnnotationModel::data( const QModelIndex &index, int role ) const
return GuiUtils::captionForAnnotation( item->annotation );
break;
case Qt::DecorationRole:
- return QIcon::fromTheme( "okular" );
+ return QIcon::fromTheme( QStringLiteral("okular") );
break;
case Qt::ToolTipRole:
return GuiUtils::prettyToolTip( item->annotation );
diff --git a/ui/annotationpopup.cpp b/ui/annotationpopup.cpp
index da42b6a..d073f21 100644
--- a/ui/annotationpopup.cpp
+++ b/ui/annotationpopup.cpp
@@ -72,11 +72,11 @@ void AnnotationPopup::exec( const QPoint &point )
const char *actionTypeId = "actionType";
- const QString openId = QString::fromLatin1( "open" );
- const QString deleteId = QString::fromLatin1( "delete" );
- const QString deleteAllId = QString::fromLatin1( "deleteAll" );
- const QString propertiesId = QString::fromLatin1( "properties" );
- const QString saveId = QString::fromLatin1( "save" );
+ const QString openId = QStringLiteral( "open" );
+ const QString deleteId = QStringLiteral( "delete" );
+ const QString deleteAllId = QStringLiteral( "deleteAll" );
+ const QString propertiesId = QStringLiteral( "properties" );
+ const QString saveId = QStringLiteral( "save" );
if ( mMenuMode == SingleAnnotationMode )
{
@@ -86,12 +86,12 @@ void AnnotationPopup::exec( const QPoint &point )
menu.setTitle( i18np( "Annotation", "%1 Annotations", mAnnotations.count() ) );
- action = menu.addAction( QIcon::fromTheme( "comment" ), i18n( "&Open Pop-up Note" ) );
+ action = menu.addAction( QIcon::fromTheme( QStringLiteral("comment") ), i18n( "&Open Pop-up Note" ) );
action->setData( QVariant::fromValue( pair ) );
action->setEnabled( onlyOne );
action->setProperty( actionTypeId, openId );
- action = menu.addAction( QIcon::fromTheme( "list-remove" ), i18n( "&Delete" ) );
+ action = menu.addAction( QIcon::fromTheme( QStringLiteral("list-remove") ), i18n( "&Delete" ) );
action->setEnabled( mDocument->isAllowed( Okular::AllowNotes ) );
action->setProperty( actionTypeId, deleteAllId );
@@ -101,7 +101,7 @@ void AnnotationPopup::exec( const QPoint &point )
action->setEnabled( false );
}
- action = menu.addAction( QIcon::fromTheme( "configure" ), i18n( "&Properties" ) );
+ action = menu.addAction( QIcon::fromTheme( QStringLiteral("configure") ), i18n( "&Properties" ) );
action->setData( QVariant::fromValue( pair ) );
action->setEnabled( onlyOne );
action->setProperty( actionTypeId, propertiesId );
@@ -114,7 +114,7 @@ void AnnotationPopup::exec( const QPoint &point )
const QString saveText = i18nc( "%1 is the name of the file to save", "&Save '%1'...", embeddedFile->name() );
menu.addSeparator();
- action = menu.addAction( QIcon::fromTheme( "document-save" ), saveText );
+ action = menu.addAction( QIcon::fromTheme( QStringLiteral("document-save") ), saveText );
action->setData( QVariant::fromValue( pair ) );
action->setProperty( actionTypeId, saveId );
}
@@ -126,17 +126,17 @@ void AnnotationPopup::exec( const QPoint &point )
{
menu.setTitle( GuiUtils::captionForAnnotation( pair.annotation ) );
- action = menu.addAction( QIcon::fromTheme( "comment" ), i18n( "&Open Pop-up Note" ) );
+ action = menu.addAction( QIcon::fromTheme( QStringLiteral("comment") ), i18n( "&Open Pop-up Note" ) );
action->setData( QVariant::fromValue( pair ) );
action->setProperty( actionTypeId, openId );
- action = menu.addAction( QIcon::fromTheme( "list-remove" ), i18n( "&Delete" ) );
+ action = menu.addAction( QIcon::fromTheme( QStringLiteral("list-remove") ), i18n( "&Delete" ) );
action->setEnabled( mDocument->isAllowed( Okular::AllowNotes ) &&
mDocument->canRemovePageAnnotation( pair.annotation ) );
action->setData( QVariant::fromValue( pair ) );
action->setProperty( actionTypeId, deleteId );
- action = menu.addAction( QIcon::fromTheme( "configure" ), i18n( "&Properties" ) );
+ action = menu.addAction( QIcon::fromTheme( QStringLiteral("configure") ), i18n( "&Properties" ) );
action->setData( QVariant::fromValue( pair ) );
action->setProperty( actionTypeId, propertiesId );
@@ -148,7 +148,7 @@ void AnnotationPopup::exec( const QPoint &point )
const QString saveText = i18nc( "%1 is the name of the file to save", "&Save '%1'...", embeddedFile->name() );
menu.addSeparator();
- action = menu.addAction( QIcon::fromTheme( "document-save" ), saveText );
+ action = menu.addAction( QIcon::fromTheme( QStringLiteral("document-save") ), saveText );
action->setData( QVariant::fromValue( pair ) );
action->setProperty( actionTypeId, saveId );
}
diff --git a/ui/annotationproxymodels.cpp b/ui/annotationproxymodels.cpp
index ca25a36..76e4fcb 100644
--- a/ui/annotationproxymodels.cpp
+++ b/ui/annotationproxymodels.cpp
@@ -201,18 +201,18 @@ QModelIndex PageGroupProxyModel::mapToSource( const QModelIndex &proxyIndex ) co
void PageGroupProxyModel::setSourceModel( QAbstractItemModel *model )
{
if ( sourceModel() ) {
- disconnect( sourceModel(), SIGNAL(layoutChanged()), this, SLOT(rebuildIndexes()) );
- disconnect( sourceModel(), SIGNAL(modelReset()), this, SLOT(rebuildIndexes()) );
- disconnect( sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rebuildIndexes()) );
- disconnect( sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rebuildIndexes()) );
+ disconnect( sourceModel(), &QAbstractItemModel::layoutChanged, this, &PageGroupProxyModel::rebuildIndexes );
+ disconnect( sourceModel(), &QAbstractItemModel::modelReset, this, &PageGroupProxyModel::rebuildIndexes );
+ disconnect( sourceModel(), &QAbstractItemModel::rowsInserted, this, &PageGroupProxyModel::rebuildIndexes );
+ disconnect( sourceModel(), &QAbstractItemModel::rowsRemoved, this, &PageGroupProxyModel::rebuildIndexes );
}
QAbstractProxyModel::setSourceModel( model );
- connect( sourceModel(), SIGNAL(layoutChanged()), this, SLOT(rebuildIndexes()) );
- connect( sourceModel(), SIGNAL(modelReset()), this, SLOT(rebuildIndexes()) );
- connect( sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rebuildIndexes()) );
- connect( sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rebuildIndexes()) );
+ connect( sourceModel(), &QAbstractItemModel::layoutChanged, this, &PageGroupProxyModel::rebuildIndexes );
+ connect( sourceModel(), &QAbstractItemModel::modelReset, this, &PageGroupProxyModel::rebuildIndexes );
+ connect( sourceModel(), &QAbstractItemModel::rowsInserted, this, &PageGroupProxyModel::rebuildIndexes );
+ connect( sourceModel(), &QAbstractItemModel::rowsRemoved, this, &PageGroupProxyModel::rebuildIndexes );
rebuildIndexes();
}
@@ -428,18 +428,18 @@ QModelIndex AuthorGroupProxyModel::mapToSource( const QModelIndex &proxyIndex )
void AuthorGroupProxyModel::setSourceModel( QAbstractItemModel *model )
{
if ( sourceModel() ) {
- disconnect( sourceModel(), SIGNAL(layoutChanged()), this, SLOT(rebuildIndexes()) );
- disconnect( sourceModel(), SIGNAL(modelReset()), this, SLOT(rebuildIndexes()) );
- disconnect( sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rebuildIndexes()) );
- disconnect( sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rebuildIndexes()) );
+ disconnect( sourceModel(), &QAbstractItemModel::layoutChanged, this, &AuthorGroupProxyModel::rebuildIndexes );
+ disconnect( sourceModel(), &QAbstractItemModel::modelReset, this, &AuthorGroupProxyModel::rebuildIndexes );
+ disconnect( sourceModel(), &QAbstractItemModel::rowsInserted, this, &AuthorGroupProxyModel::rebuildIndexes );
+ disconnect( sourceModel(), &QAbstractItemModel::rowsRemoved, this, &AuthorGroupProxyModel::rebuildIndexes );
}
QAbstractProxyModel::setSourceModel( model );
- connect( sourceModel(), SIGNAL(layoutChanged()), this, SLOT(rebuildIndexes()) );
- connect( sourceModel(), SIGNAL(modelReset()), this, SLOT(rebuildIndexes()) );
- connect( sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rebuildIndexes()) );
- connect( sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rebuildIndexes()) );
+ connect( sourceModel(), &QAbstractItemModel::layoutChanged, this, &AuthorGroupProxyModel::rebuildIndexes );
+ connect( sourceModel(), &QAbstractItemModel::modelReset, this, &AuthorGroupProxyModel::rebuildIndexes );
+ connect( sourceModel(), &QAbstractItemModel::rowsInserted, this, &AuthorGroupProxyModel::rebuildIndexes );
+ connect( sourceModel(), &QAbstractItemModel::rowsRemoved, this, &AuthorGroupProxyModel::rebuildIndexes );
rebuildIndexes();
}
diff --git a/ui/annotationtools.cpp b/ui/annotationtools.cpp
index 8618bb7..78825dc 100644
--- a/ui/annotationtools.cpp
+++ b/ui/annotationtools.cpp
@@ -22,12 +22,12 @@ AnnotatorEngine::AnnotatorEngine( const QDomElement & engineElement )
: m_engineElement( engineElement ), m_creationCompleted( false ), m_item( 0 )
{
// parse common engine attributes
- if ( engineElement.hasAttribute( "color" ) )
- m_engineColor = QColor( engineElement.attribute( "color" ) );
+ if ( engineElement.hasAttribute( QStringLiteral("color") ) )
+ m_engineColor = QColor( engineElement.attribute( QStringLiteral("color") ) );
// get the annotation element
QDomElement annElement = m_engineElement.firstChild().toElement();
- if ( !annElement.isNull() && annElement.tagName() == "annotation" )
+ if ( !annElement.isNull() && annElement.tagName() == QLatin1String("annotation") )
m_annotElement = annElement;
}
@@ -193,15 +193,15 @@ QList< Okular::Annotation* > SmoothPathEngine::end()
// find out annotation's type
Okular::Annotation * ann = 0;
- QString typeString = m_annotElement.attribute( "type" );
+ QString typeString = m_annotElement.attribute( QStringLiteral("type") );
// create InkAnnotation from path
- if ( typeString == "Ink" )
+ if ( typeString == QLatin1String("Ink") )
{
Okular::InkAnnotation * ia = new Okular::InkAnnotation();
ann = ia;
- if ( m_annotElement.hasAttribute( "width" ) )
- ann->style().setWidth( m_annotElement.attribute( "width" ).toDouble() );
+ if ( m_annotElement.hasAttribute( QStringLiteral("width") ) )
+ ann->style().setWidth( m_annotElement.attribute( QStringLiteral("width") ).toDouble() );
// fill points
QList< QLinkedList<Okular::NormalizedPoint> > list = ia->inkPaths();
list.append( points );
@@ -215,10 +215,10 @@ QList< Okular::Annotation* > SmoothPathEngine::end()
return QList< Okular::Annotation* >();
// set common attributes
- ann->style().setColor( m_annotElement.hasAttribute( "color" ) ?
- m_annotElement.attribute( "color" ) : m_engineColor );
- if ( m_annotElement.hasAttribute( "opacity" ) )
- ann->style().setOpacity( m_annotElement.attribute( "opacity", "1.0" ).toDouble() );
+ ann->style().setColor( m_annotElement.hasAttribute( QStringLiteral("color") ) ?
+ m_annotElement.attribute( QStringLiteral("color") ) : m_engineColor );
+ if ( m_annotElement.hasAttribute( QStringLiteral("opacity") ) )
+ ann->style().setOpacity( m_annotElement.attribute( QStringLiteral("opacity"), QStringLiteral("1.0") ).toDouble() );
// return annotation
return QList< Okular::Annotation* >() << ann;
@@ -228,8 +228,8 @@ SmoothPath SmoothPathEngine::endSmoothPath()
{
m_creationCompleted = false;
- QColor color( m_annotElement.hasAttribute( "color" ) ?
- m_annotElement.attribute( "color" ) : m_engineColor );
+ QColor color( m_annotElement.hasAttribute( QStringLiteral("color") ) ?
+ m_annotElement.attribute( QStringLiteral("color") ) : m_engineColor );
const int width = m_annotElement.attribute( QStringLiteral("width"), QStringLiteral("2") ).toInt();
const qreal opacity = m_annotElement.attribute( QStringLiteral("opacity"), QStringLiteral("1.0") ).toDouble();
diff --git a/ui/annotationwidgets.cpp b/ui/annotationwidgets.cpp
index ba49a2b..4348501 100644
--- a/ui/annotationwidgets.cpp
+++ b/ui/annotationwidgets.cpp
@@ -46,7 +46,7 @@ PixmapPreviewSelector::PixmapPreviewSelector( QWidget * parent )
setPreviewSize( 32 );
connect( m_comboItems, SIGNAL(currentIndexChanged(QString)), this, SLOT(iconComboChanged(QString)) );
- connect( m_comboItems, SIGNAL(editTextChanged(QString)), this, SLOT(iconComboChanged(QString)) );
+ connect( m_comboItems, &QComboBox::editTextChanged, this, &PixmapPreviewSelector::iconComboChanged );
}
PixmapPreviewSelector::~PixmapPreviewSelector()
@@ -221,7 +221,7 @@ QWidget * AnnotationWidget::createAppearanceWidget()
gridlayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ), 3, 0 );
- connect( m_colorBn, SIGNAL(changed(QColor)), this, SIGNAL(dataChanged()) );
+ connect( m_colorBn, &KColorButton::changed, this, &AnnotationWidget::dataChanged );
connect( m_opacity, SIGNAL(valueChanged(int)), this, SIGNAL(dataChanged()) );
return widget;
@@ -259,16 +259,16 @@ QWidget * TextAnnotationWidget::createStyleWidget()
m_pixmapSelector = new PixmapPreviewSelector( gb );
gblay->addWidget( m_pixmapSelector );
- m_pixmapSelector->addItem( i18n( "Comment" ), "Comment" );
- m_pixmapSelector->addItem( i18n( "Help" ), "Help" );
- m_pixmapSelector->addItem( i18n( "Insert" ), "Insert" );
- m_pixmapSelector->addItem( i18n( "Key" ), "Key" );
- m_pixmapSelector->addItem( i18n( "New Paragraph" ), "NewParagraph" );
- m_pixmapSelector->addItem( i18n( "Note" ), "Note" );
- m_pixmapSelector->addItem( i18n( "Paragraph" ), "Paragraph" );
+ m_pixmapSelector->addItem( i18n( "Comment" ), QStringLiteral("Comment") );
+ m_pixmapSelector->addItem( i18n( "Help" ), QStringLiteral("Help") );
+ m_pixmapSelector->addItem( i18n( "Insert" ), QStringLiteral("Insert") );
+ m_pixmapSelector->addItem( i18n( "Key" ), QStringLiteral("Key") );
+ m_pixmapSelector->addItem( i18n( "New Paragraph" ), QStringLiteral("NewParagraph") );
+ m_pixmapSelector->addItem( i18n( "Note" ), QStringLiteral("Note") );
+ m_pixmapSelector->addItem( i18n( "Paragraph" ), QStringLiteral("Paragraph") );
m_pixmapSelector->setIcon( m_textAnn->textIcon() );
- connect( m_pixmapSelector, SIGNAL(iconChanged(QString)), this, SIGNAL(dataChanged()) );
+ connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged );
}
else if ( m_textAnn->textType() == Okular::TextAnnotation::InPlace )
{
@@ -290,7 +290,7 @@ QWidget * TextAnnotationWidget::createStyleWidget()
m_textAlign->addItem( i18n("Right") );
m_textAlign->setCurrentIndex( m_textAnn->inplaceAlignment() );
- connect( m_fontReq, SIGNAL(fontSelected(QFont)), this, SIGNAL(dataChanged()) );
+ connect( m_fontReq, &KFontRequester::fontSelected, this, &AnnotationWidget::dataChanged );
connect( m_textAlign, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dataChanged()) );
}
@@ -331,28 +331,28 @@ QWidget * StampAnnotationWidget::createStyleWidget()
gblay->addWidget( m_pixmapSelector );
m_pixmapSelector->setEditable( true );
- m_pixmapSelector->addItem( i18n( "Okular" ), "okular" );
- m_pixmapSelector->addItem( i18n( "Bookmark" ), "bookmarks" );
- m_pixmapSelector->addItem( i18n( "KDE" ), "kde" );
- m_pixmapSelector->addItem( i18n( "Information" ), "help-about" );
- m_pixmapSelector->addItem( i18n( "Approved" ), "Approved" );
- m_pixmapSelector->addItem( i18n( "As Is" ), "AsIs" );
- m_pixmapSelector->addItem( i18n( "Confidential" ), "Confidential" );
- m_pixmapSelector->addItem( i18n( "Departmental" ), "Departmental" );
- m_pixmapSelector->addItem( i18n( "Draft" ), "Draft" );
- m_pixmapSelector->addItem( i18n( "Experimental" ), "Experimental" );
- m_pixmapSelector->addItem( i18n( "Expired" ), "Expired" );
- m_pixmapSelector->addItem( i18n( "Final" ), "Final" );
- m_pixmapSelector->addItem( i18n( "For Comment" ), "ForComment" );
- m_pixmapSelector->addItem( i18n( "For Public Release" ), "ForPublicRelease" );
- m_pixmapSelector->addItem( i18n( "Not Approved" ), "NotApproved" );
- m_pixmapSelector->addItem( i18n( "Not For Public Release" ), "NotForPublicRelease" );
- m_pixmapSelector->addItem( i18n( "Sold" ), "Sold" );
- m_pixmapSelector->addItem( i18n( "Top Secret" ), "TopSecret" );
+ m_pixmapSelector->addItem( i18n( "Okular" ), QStringLiteral("okular") );
+ m_pixmapSelector->addItem( i18n( "Bookmark" ), QStringLiteral("bookmarks") );
+ m_pixmapSelector->addItem( i18n( "KDE" ), QStringLiteral("kde") );
+ m_pixmapSelector->addItem( i18n( "Information" ), QStringLiteral("help-about") );
+ m_pixmapSelector->addItem( i18n( "Approved" ), QStringLiteral("Approved") );
+ m_pixmapSelector->addItem( i18n( "As Is" ), QStringLiteral("AsIs") );
+ m_pixmapSelector->addItem( i18n( "Confidential" ), QStringLiteral("Confidential") );
+ m_pixmapSelector->addItem( i18n( "Departmental" ), QStringLiteral("Departmental") );
+ m_pixmapSelector->addItem( i18n( "Draft" ), QStringLiteral("Draft") );
+ m_pixmapSelector->addItem( i18n( "Experimental" ), QStringLiteral("Experimental") );
+ m_pixmapSelector->addItem( i18n( "Expired" ), QStringLiteral("Expired") );
+ m_pixmapSelector->addItem( i18n( "Final" ), QStringLiteral("Final") );
+ m_pixmapSelector->addItem( i18n( "For Comment" ), QStringLiteral("ForComment") );
+ m_pixmapSelector->addItem( i18n( "For Public Release" ), QStringLiteral("ForPublicRelease") );
+ m_pixmapSelector->addItem( i18n( "Not Approved" ), QStringLiteral("NotApproved") );
+ m_pixmapSelector->addItem( i18n( "Not For Public Release" ), QStringLiteral("NotForPublicRelease") );
+ m_pixmapSelector->addItem( i18n( "Sold" ), QStringLiteral("Sold") );
+ m_pixmapSelector->addItem( i18n( "Top Secret" ), QStringLiteral("TopSecret") );
m_pixmapSelector->setIcon( m_stampAnn->stampIconName() );
m_pixmapSelector->setPreviewSize( 64 );
- connect( m_pixmapSelector, SIGNAL(iconChanged(QString)), this, SIGNAL(dataChanged()) );
+ connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged );
return widget;
}
@@ -447,8 +447,8 @@ QWidget * LineAnnotationWidget::createStyleWidget()
}
else if ( m_lineType == 1 )
{
- connect( m_innerColor, SIGNAL(changed(QColor)), this, SIGNAL(dataChanged()) );
- connect( m_useColor, SIGNAL(toggled(bool)), this, SIGNAL(dataChanged()) );
+ connect( m_innerColor, &KColorButton::changed, this, &AnnotationWidget::dataChanged );
+ connect( m_useColor, &QAbstractButton::toggled, this, &AnnotationWidget::dataChanged );
connect(m_useColor, &QCheckBox::toggled, m_innerColor, &KColorButton::setEnabled);
}
connect( m_spinSize, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) );
@@ -598,8 +598,8 @@ QWidget * GeomAnnotationWidget::createStyleWidget()
m_spinSize->setValue( m_geomAnn->style().width() );
connect( m_typeCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(dataChanged()) );
- connect( m_innerColor, SIGNAL(changed(QColor)), this, SIGNAL(dataChanged()) );
- connect( m_useColor, SIGNAL(toggled(bool)), this, SIGNAL(dataChanged()) );
+ connect( m_innerColor, &KColorButton::changed, this, &AnnotationWidget::dataChanged );
+ connect( m_useColor, &QAbstractButton::toggled, this, &AnnotationWidget::dataChanged );
connect(m_useColor, &QCheckBox::toggled, m_innerColor, &KColorButton::setEnabled);
connect( m_spinSize, SIGNAL(valueChanged(double)), this, SIGNAL(dataChanged()) );
@@ -642,13 +642,13 @@ QWidget * FileAttachmentAnnotationWidget::createStyleWidget()
gblay->addWidget( m_pixmapSelector );
m_pixmapSelector->setEditable( true );
- m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Graph" ), "graph" );
- m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Push Pin" ), "pushpin" );
- m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Paperclip" ), "paperclip" );
- m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Tag" ), "tag" );
+ m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Graph" ), QStringLiteral("graph") );
+ m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Push Pin" ), QStringLiteral("pushpin") );
+ m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Paperclip" ), QStringLiteral("paperclip") );
+ m_pixmapSelector->addItem( i18nc( "Symbol for file attachment annotations", "Tag" ), QStringLiteral("tag") );
m_pixmapSelector->setIcon( m_attachAnn->fileIconName() );
- connect( m_pixmapSelector, SIGNAL(iconChanged(QString)), this, SIGNAL(dataChanged()) );
+ connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged );
return widget;
}
@@ -710,9 +710,9 @@ static QString caretSymbolToIcon( Okular::CaretAnnotation::CaretSymbol symbol )
switch ( symbol )
{
case Okular::CaretAnnotation::None:
- return QString::fromLatin1( "caret-none" );
+ return QStringLiteral( "caret-none" );
case Okular::CaretAnnotation::P:
- return QString::fromLatin1( "caret-p" );
+ return QStringLiteral( "caret-p" );
}
return QString();
}
@@ -744,11 +744,11 @@ QWidget * CaretAnnotationWidget::createStyleWidget()
m_pixmapSelector = new PixmapPreviewSelector( gb );
gblay->addWidget( m_pixmapSelector );
- m_pixmapSelector->addItem( i18nc( "Symbol for caret annotations", "None" ), "caret-none" );
- m_pixmapSelector->addItem( i18nc( "Symbol for caret annotations", "P" ), "caret-p" );
+ m_pixmapSelector->addItem( i18nc( "Symbol for caret annotations", "None" ), QStringLiteral("caret-none") );
+ m_pixmapSelector->addItem( i18nc( "Symbol for caret annotations", "P" ), QStringLiteral("caret-p") );
m_pixmapSelector->setIcon( caretSymbolToIcon( m_caretAnn->caretSymbol() ) );
- connect( m_pixmapSelector, SIGNAL(iconChanged(QString)), this, SIGNAL(dataChanged()) );
+ connect( m_pixmapSelector, &PixmapPreviewSelector::iconChanged, this, &AnnotationWidget::dataChanged );
return widget;
}
diff --git a/ui/annotwindow.cpp b/ui/annotwindow.cpp
index 59ebfeb..d395405 100644
--- a/ui/annotwindow.cpp
+++ b/ui/annotwindow.cpp
@@ -81,7 +81,7 @@ public:
dateLabel->setCursor( Qt::SizeAllCursor );
buttonlay->addWidget( dateLabel );
CloseButton * close = new CloseButton( this );
- connect( close, SIGNAL(clicked()), parent, SLOT(close()) );
+ connect( close, &QAbstractButton::clicked, parent, &QWidget::close );
buttonlay->addWidget( close );
// option button row
QHBoxLayout * optionlay = new QHBoxLayout();
@@ -149,7 +149,7 @@ public:
void setTitle( const QString& title )
{
- titleLabel->setText( QString( " " ) + title );
+ titleLabel->setText( QStringLiteral( " " ) + title );
}
void setDate( const QDateTime& dt )
@@ -159,7 +159,7 @@ public:
void setAuthor( const QString& author )
{
- authorLabel->setText( QString( " " ) + author );
+ authorLabel->setText( QStringLiteral( " " ) + author );
}
void connectOptionButton( QObject * recv, const char* method )
diff --git a/ui/bookmarklist.cpp b/ui/bookmarklist.cpp
index a627e65..e1acdbb 100644
--- a/ui/bookmarklist.cpp
+++ b/ui/bookmarklist.cpp
@@ -128,7 +128,7 @@ BookmarkList::BookmarkList( Okular::Document *document, QWidget *parent )
m_tree = new QTreeWidget( this );
mainlay->addWidget( m_tree );
QStringList cols;
- cols.append( "Bookmarks" );
+ cols.append( QStringLiteral("Bookmarks") );
m_tree->setContextMenuPolicy( Qt::CustomContextMenu );
m_tree->setHeaderLabels( cols );
m_tree->setSortingEnabled( false );
@@ -144,7 +144,7 @@ BookmarkList::BookmarkList( Okular::Document *document, QWidget *parent )
QToolBar * bookmarkController = new QToolBar( this );
mainlay->addWidget( bookmarkController );
- bookmarkController->setObjectName( QLatin1String( "BookmarkControlBar" ) );
+ bookmarkController->setObjectName( QStringLiteral( "BookmarkControlBar" ) );
// change toolbar appearance
bookmarkController->setIconSize( QSize( 16, 16 ) );
bookmarkController->setMovable( false );
@@ -152,11 +152,11 @@ BookmarkList::BookmarkList( Okular::Document *document, QWidget *parent )
sp.setVerticalPolicy( QSizePolicy::Minimum );
bookmarkController->setSizePolicy( sp );
// insert a togglebutton [show only bookmarks in the current document]
- m_showBoomarkOnlyAction = bookmarkController->addAction( QIcon::fromTheme( "bookmarks" ), i18n( "Current document only" ) );
+ m_showBoomarkOnlyAction = bookmarkController->addAction( QIcon::fromTheme( QStringLiteral("bookmarks") ), i18n( "Current document only" ) );
m_showBoomarkOnlyAction->setCheckable( true );
connect(m_showBoomarkOnlyAction, &QAction::toggled, this, &BookmarkList::slotFilterBookmarks);
- connect( m_document->bookmarkManager(), SIGNAL(bookmarksChanged(QUrl)), this, SLOT(slotBookmarksChanged(QUrl)) );
+ connect( m_document->bookmarkManager(), &Okular::BookmarkManager::bookmarksChanged, this, &BookmarkList::slotBookmarksChanged );
rebuildTree( m_showBoomarkOnlyAction->isChecked() );
}
@@ -189,7 +189,7 @@ void BookmarkList::notifySetup( const QVector< Okular::Page * > & pages, int set
m_currentDocumentItem = itemForUrl( m_document->currentDocument() );
if ( m_currentDocumentItem && m_currentDocumentItem != m_tree->invisibleRootItem() )
{
- m_currentDocumentItem->setIcon( 0, QIcon::fromTheme( "bookmarks" ) );
+ m_currentDocumentItem->setIcon( 0, QIcon::fromTheme( QStringLiteral("bookmarks") ) );
m_currentDocumentItem->setExpanded( true );
}
connect(m_tree, &QTreeWidget::itemChanged, this, &BookmarkList::slotChanged);
@@ -246,8 +246,8 @@ void BookmarkList::contextMenuForBookmarkItem( const QPoint& p, BookmarkItem* bm
QMenu menu( this );
QAction * gotobm = menu.addAction( i18n( "Go to This Bookmark" ) );
- QAction * editbm = menu.addAction( QIcon::fromTheme( "edit-rename" ), i18n( "Rename Bookmark" ) );
- QAction * removebm = menu.addAction( QIcon::fromTheme( "list-remove" ), i18n( "Remove Bookmark" ) );
+ QAction * editbm = menu.addAction( QIcon::fromTheme( QStringLiteral("edit-rename") ), i18n( "Rename Bookmark" ) );
+ QAction * removebm = menu.addAction( QIcon::fromTheme( QStringLiteral("list-remove") ), i18n( "Remove Bookmark" ) );
QAction * res = menu.exec( QCursor::pos() );
if ( !res )
return;
@@ -273,8 +273,8 @@ void BookmarkList::contextMenuForFileItem( const QPoint& p, FileItem* fItem )
QAction * open = 0;
if ( !thisdoc )
open = menu.addAction( i18nc( "Opens the selected document", "Open Document" ) );
- QAction * editbm = menu.addAction( QIcon::fromTheme( "edit-rename" ), i18n( "Rename Bookmark" ) );
- QAction * removebm = menu.addAction( QIcon::fromTheme( "list-remove" ), i18n( "Remove Bookmarks" ) );
+ QAction * editbm = menu.addAction( QIcon::fromTheme( QStringLiteral("edit-rename") ), i18n( "Rename Bookmark" ) );
+ QAction * removebm = menu.addAction( QIcon::fromTheme( QStringLiteral("list-remove") ), i18n( "Remove Bookmarks" ) );
QAction * res = menu.exec( QCursor::pos() );
if ( !res )
return;
@@ -374,7 +374,7 @@ void BookmarkList::rebuildTree( bool filter )
if ( currenturlitem )
{
currenturlitem->setExpanded( true );
- currenturlitem->setIcon( 0, QIcon::fromTheme( "bookmarks" ) );
+ currenturlitem->setIcon( 0, QIcon::fromTheme( QStringLiteral("bookmarks") ) );
m_tree->scrollToItem( currenturlitem, QAbstractItemView::PositionAtTop );
m_currentDocumentItem = currenturlitem;
}
@@ -436,7 +436,7 @@ void BookmarkList::selectiveUrlUpdate( const QUrl& url, QTreeWidgetItem*& item )
}
if ( m_document->isOpened() && url == m_document->currentDocument() )
{
- item->setIcon( 0, QIcon::fromTheme( "bookmarks" ) );
+ item->setIcon( 0, QIcon::fromTheme( QStringLiteral("bookmarks") ) );
item->setExpanded( true );
}
item->addChildren( createItems( url, urlbookmarks ) );
diff --git a/ui/drawingtoolactions.cpp b/ui/drawingtoolactions.cpp
index 39dd60e..58945bd 100644
--- a/ui/drawingtoolactions.cpp
+++ b/ui/drawingtoolactions.cpp
@@ -45,7 +45,7 @@ public:
// draw check mark
const int lightness = ((color.red() * 299) + (color.green() * 587) + (color.blue() * 114)) / 1000;
p.setPen( lightness < 128 ? Qt::white : Qt::black );
- p.drawText( QRect( QPoint( 0, 0 ), pmSel.size() ), Qt::AlignCenter, "\u2713" );
+ p.drawText( QRect( QPoint( 0, 0 ), pmSel.size() ), Qt::AlignCenter, QStringLiteral("\u2713") );
icon.addPixmap( pmSel, QIcon::Normal, QIcon::On );
@@ -101,7 +101,7 @@ void DrawingToolActions::loadTools()
const QStringList drawingTools = Okular::Settings::drawingTools();
QDomDocument doc;
- QDomElement drawingDefinition = doc.createElement( "drawingTools" );
+ QDomElement drawingDefinition = doc.createElement( QStringLiteral("drawingTools") );
foreach ( const QString &drawingXml, drawingTools )
{
QDomDocument entryParser;
@@ -116,7 +116,7 @@ void DrawingToolActions::loadTools()
while ( drawingDescription.isElement() )
{
const QDomElement toolElement = drawingDescription.toElement();
- if ( toolElement.tagName() == "tool" )
+ if ( toolElement.tagName() == QLatin1String("tool") )
{
QString tooltip;
QString width;
@@ -133,7 +133,7 @@ void DrawingToolActions::loadTools()
tooltip = name;
}
- const QDomNodeList engineNodeList = toolElement.elementsByTagName( "engine" );
+ const QDomNodeList engineNodeList = toolElement.elementsByTagName( QStringLiteral("engine") );
if ( engineNodeList.size() > 0 )
{
const QDomElement engineEl = engineNodeList.item( 0 ).toElement();
@@ -142,7 +142,7 @@ void DrawingToolActions::loadTools()
colorStr = engineEl.attribute( QStringLiteral("color") );
}
- const QDomNodeList annotationList = engineEl.elementsByTagName( "annotation" );
+ const QDomNodeList annotationList = engineEl.elementsByTagName( QStringLiteral("annotation") );
if ( annotationList.size() > 0 )
{
const QDomElement annotationEl = annotationList.item( 0 ).toElement();
@@ -190,12 +190,12 @@ void DrawingToolActions::loadTools()
action->setText( i18n("Eraser") );
action->setToolTip( i18n("Eraser") );
action->setCheckable( true );
- action->setIcon( QIcon::fromTheme( "draw-eraser" ) );
+ action->setIcon( QIcon::fromTheme( QStringLiteral("draw-eraser") ) );
action->setProperty( "__document", QVariant::fromValue<QDomElement>( root ) );
m_actions.append( action );
- ac->addAction( QString("presentation_drawing_eraser"), action );
+ ac->addAction( QStringLiteral("presentation_drawing_eraser"), action );
connect( action, &QAction::triggered, this, &DrawingToolActions::actionTriggered );
}
@@ -215,7 +215,7 @@ void DrawingToolActions::createToolAction( const QString &text, const QString &t
m_actions.append( action );
- ac->addAction( QString("presentation_drawing_%1").arg( toolName ), action );
+ ac->addAction( QStringLiteral("presentation_drawing_%1").arg( toolName ), action );
connect( action, &QAction::triggered, this, &DrawingToolActions::actionTriggered );
}
diff --git a/ui/embeddedfilesdialog.cpp b/ui/embeddedfilesdialog.cpp
index d73c2d8..4d17841 100644
--- a/ui/embeddedfilesdialog.cpp
+++ b/ui/embeddedfilesdialog.cpp
@@ -48,8 +48,8 @@ EmbeddedFilesDialog::EmbeddedFilesDialog(QWidget *parent, const Okular::Document
setLayout(mainLayout);
mUser1Button = new QPushButton;
buttonBox->addButton(mUser1Button, QDialogButtonBox::ActionRole);
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
buttonBox->button(QDialogButtonBox::Close)->setDefault(true);
KGuiItem::assign(mUser1Button, KStandardGuiItem::save());
mUser1Button->setEnabled(false);
@@ -95,8 +95,8 @@ EmbeddedFilesDialog::EmbeddedFilesDialog(QWidget *parent, const Okular::Document
m_tw->updateGeometry();
connect(mUser1Button, SIGNAL(clicked()), this, SLOT(saveFile()));
- connect(m_tw, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(attachViewContextMenu(QPoint)));
- connect(m_tw, SIGNAL(itemSelectionChanged()), this, SLOT(updateSaveButton()));
+ connect(m_tw, &QWidget::customContextMenuRequested, this, &EmbeddedFilesDialog::attachViewContextMenu);
+ connect(m_tw, &QTreeWidget::itemSelectionChanged, this, &EmbeddedFilesDialog::updateSaveButton);
}
void EmbeddedFilesDialog::updateSaveButton()
@@ -125,7 +125,7 @@ void EmbeddedFilesDialog::attachViewContextMenu( const QPoint& /*pos*/ )
return;
QMenu menu( this );
- QAction* saveAsAct = menu.addAction( QIcon::fromTheme( "document-save-as" ), i18nc( "@action:inmenu", "&Save As..." ) );
+ QAction* saveAsAct = menu.addAction( QIcon::fromTheme( QStringLiteral("document-save-as") ), i18nc( "@action:inmenu", "&Save As..." ) );
QAction* act = menu.exec( QCursor::pos() );
if ( !act )
diff --git a/ui/fileprinterpreview.cpp b/ui/fileprinterpreview.cpp
index 2a2fb8b..70fd941 100644
--- a/ui/fileprinterpreview.cpp
+++ b/ui/fileprinterpreview.cpp
@@ -42,7 +42,7 @@ public:
, mainWidget(new QWidget(host))
, previewPart(0)
, failMessage(0)
- , config(KSharedConfig::openConfig(QString::fromLatin1("okularrc")))
+ , config(KSharedConfig::openConfig(QStringLiteral("okularrc")))
{
filename = _filename;
@@ -77,8 +77,8 @@ void FilePrinterPreviewPrivate::getPart()
parts are available now; other parts which handles text are not
suitable here (PostScript source code) */
KService::List offers =
- KMimeTypeTrader::self()->query("application/postscript", "KParts/ReadOnlyPart",
- "[DesktopEntryName] == 'okularghostview'");
+ KMimeTypeTrader::self()->query(QStringLiteral("application/postscript"), QStringLiteral("KParts/ReadOnlyPart"),
+ QStringLiteral("[DesktopEntryName] == 'okularghostview'"));
KService::List::ConstIterator it = offers.constBegin();
while (!factory && it != offers.constEnd()) {
diff --git a/ui/findbar.cpp b/ui/findbar.cpp
index 7363532..09201e7 100644
--- a/ui/findbar.cpp
+++ b/ui/findbar.cpp
@@ -32,7 +32,7 @@ FindBar::FindBar( Okular::Document * document, QWidget * parent )
lay->setMargin( 2 );
QToolButton * closeBtn = new QToolButton( this );
- closeBtn->setIcon( QIcon::fromTheme( "dialog-close" ) );
+ closeBtn->setIcon( QIcon::fromTheme( QStringLiteral("dialog-close") ) );
closeBtn->setToolTip( i18n( "Close" ) );
closeBtn->setAutoRaise( true );
lay->addWidget( closeBtn );
@@ -52,11 +52,11 @@ FindBar::FindBar( Okular::Document * document, QWidget * parent )
label->setBuddy( m_search->lineEdit() );
lay->addWidget( m_search );
- QPushButton * findNextBtn = new QPushButton( QIcon::fromTheme( "go-down-search" ), i18nc( "Find and go to the next search match", "Next" ), this );
+ QPushButton * findNextBtn = new QPushButton( QIcon::fromTheme( QStringLiteral("go-down-search") ), i18nc( "Find and go to the next search match", "Next" ), this );
findNextBtn->setToolTip( i18n( "Jump to next match" ) );
lay->addWidget( findNextBtn );
- QPushButton * findPrevBtn = new QPushButton( QIcon::fromTheme( "go-up-search" ), i18nc( "Find and go to the previous search match", "Previous" ), this );
+ QPushButton * findPrevBtn = new QPushButton( QIcon::fromTheme( QStringLiteral("go-up-search") ), i18nc( "Find and go to the previous search match", "Previous" ), this );
findPrevBtn->setToolTip( i18n( "Jump to previous match" ) );
lay->addWidget( findPrevBtn );
@@ -71,11 +71,11 @@ FindBar::FindBar( Okular::Document * document, QWidget * parent )
optionsBtn->setMenu( optionsMenu );
lay->addWidget( optionsBtn );
- connect( closeBtn, SIGNAL(clicked()), this, SLOT(closeAndStopSearch()) );
- connect( findNextBtn, SIGNAL(clicked()), this, SLOT(findNext()) );
- connect( findPrevBtn, SIGNAL(clicked()), this, SLOT(findPrev()) );
- connect( m_caseSensitiveAct, SIGNAL(toggled(bool)), this, SLOT(caseSensitivityChanged()) );
- connect( m_fromCurrentPageAct, SIGNAL(toggled(bool)), this, SLOT(fromCurrentPageChanged()) );
+ connect( closeBtn, &QAbstractButton::clicked, this, &FindBar::closeAndStopSearch );
+ connect( findNextBtn, &QAbstractButton::clicked, this, &FindBar::findNext );
+ connect( findPrevBtn, &QAbstractButton::clicked, this, &FindBar::findPrev );
+ connect( m_caseSensitiveAct, &QAction::toggled, this, &FindBar::caseSensitivityChanged );
+ connect( m_fromCurrentPageAct, &QAction::toggled, this, &FindBar::fromCurrentPageChanged );
m_caseSensitiveAct->setChecked( Okular::Settings::searchCaseSensitive() );
m_fromCurrentPageAct->setChecked( Okular::Settings::searchFromCurrentPage() );
diff --git a/ui/formwidgets.cpp b/ui/formwidgets.cpp
index fab5c85..db95bf0 100644
--- a/ui/formwidgets.cpp
+++ b/ui/formwidgets.cpp
@@ -29,44 +29,44 @@ FormWidgetsController::FormWidgetsController( Okular::Document *doc )
: QObject( doc ), m_doc( doc )
{
// emit changed signal when a form has changed
- connect( this, SIGNAL( formTextChangedByUndoRedo( int, Okular::FormFieldText*, QString, int, int ) ),
- this, SIGNAL( changed( int ) ) );
- connect( this, SIGNAL( formListChangedByUndoRedo(int, Okular::FormFieldChoice*, QList<int> ) ),
- this, SIGNAL( changed( int ) ) );
- connect( this, SIGNAL( formComboChangedByUndoRedo(int, Okular::FormFieldChoice*, QString, int, int ) ),
- this, SIGNAL( changed( int ) ) );
+ connect( this, &FormWidgetsController::formTextChangedByUndoRedo,
+ this, &FormWidgetsController::changed );
+ connect( this, &FormWidgetsController::formListChangedByUndoRedo,
+ this, &FormWidgetsController::changed );
+ connect( this, &FormWidgetsController::formComboChangedByUndoRedo,
+ this, &FormWidgetsController::changed );
// connect form modification signals to and from document
- connect( this, SIGNAL( formTextChangedByWidget( int, Okular::FormFieldText*, QString, int, int, int ) ),
- doc, SLOT( editFormText( int, Okular::FormFieldText*, QString, int, int, int ) ) );
- connect( doc, SIGNAL( formTextChangedByUndoRedo( int, Okular::FormFieldText*, QString, int, int ) ),
- this, SIGNAL( formTextChangedByUndoRedo( int, Okular::FormFieldText*, QString, int, int ) ) );
-
- connect( this, SIGNAL( formListChangedByWidget( int, Okular::FormFieldChoice*, QList<int> ) ),
- doc, SLOT( editFormList( int, Okular::FormFieldChoice*, QList<int> ) ) );
- connect( doc, SIGNAL( formListChangedByUndoRedo( int, Okular::FormFieldChoice*, QList<int> ) ),
- this, SIGNAL( formListChangedByUndoRedo( int,Okular::FormFieldChoice*, QList<int> ) ) );
-
- connect( this, SIGNAL( formComboChangedByWidget( int, Okular::FormFieldChoice*, QString, int, int, int ) ),
- doc, SLOT( editFormCombo( int, Okular::FormFieldChoice*, QString, int, int, int ) ) );
- connect( doc, SIGNAL( formComboChangedByUndoRedo( int, Okular::FormFieldChoice*, QString, int, int ) ),
- this, SIGNAL( formComboChangedByUndoRedo( int, Okular::FormFieldChoice*, QString, int, int ) ) );
-
- connect( this, SIGNAL( formButtonsChangedByWidget( int, QList<Okular::FormFieldButton*>, QList<bool> ) ),
- doc, SLOT( editFormButtons( int, QList<Okular::FormFieldButton*>, QList<bool> ) ) );
- connect( doc, SIGNAL( formButtonsChangedByUndoRedo( int, QList<Okular::FormFieldButton*> ) ),
- this, SLOT( slotFormButtonsChangedByUndoRedo(int,QList<Okular::FormFieldButton*> ) ) );
+ connect( this, &FormWidgetsController::formTextChangedByWidget,
+ doc, &Okular::Document::editFormText );
+ connect( doc, &Okular::Document::formTextChangedByUndoRedo,
+ this, &FormWidgetsController::formTextChangedByUndoRedo );
+
+ connect( this, &FormWidgetsController::formListChangedByWidget,
+ doc, &Okular::Document::editFormList );
+ connect( doc, &Okular::Document::formListChangedByUndoRedo,
+ this, &FormWidgetsController::formListChangedByUndoRedo );
+
+ connect( this, &FormWidgetsController::formComboChangedByWidget,
+ doc, &Okular::Document::editFormCombo );
+ connect( doc, &Okular::Document::formComboChangedByUndoRedo,
+ this, &FormWidgetsController::formComboChangedByUndoRedo );
+
+ connect( this, &FormWidgetsController::formButtonsChangedByWidget,
+ doc, &Okular::Document::editFormButtons );
+ connect( doc, &Okular::Document::formButtonsChangedByUndoRedo,
+ this, &FormWidgetsController::slotFormButtonsChangedByUndoRedo );
// Connect undo/redo signals
- connect( this, SIGNAL( requestUndo() ),
- doc, SLOT( undo() ) );
- connect( this, SIGNAL( requestRedo() ),
- doc, SLOT( redo() ) );
+ connect( this, &FormWidgetsController::requestUndo,
+ doc, &Okular::Document::undo );
+ connect( this, &FormWidgetsController::requestRedo,
+ doc, &Okular::Document::redo );
- connect( doc, SIGNAL( canUndoChanged( bool ) ),
- this, SIGNAL( canUndoChanged( bool ) ) );
- connect( doc, SIGNAL( canRedoChanged( bool ) ),
- this, SIGNAL( canRedoChanged( bool ) ) );
+ connect( doc, &Okular::Document::canUndoChanged,
+ this, &FormWidgetsController::canUndoChanged );
+ connect( doc, &Okular::Document::canRedoChanged,
+ this, &FormWidgetsController::canRedoChanged );
}
FormWidgetsController::~FormWidgetsController()
@@ -320,7 +320,7 @@ PushButtonEdit::PushButtonEdit( Okular::FormFieldButton * button, QWidget * pare
if ( !m_form->isReadOnly() )
{
- connect( this, SIGNAL(clicked()), this, SLOT(slotClicked()) );
+ connect( this, &QAbstractButton::clicked, this, &PushButtonEdit::slotClicked );
}
}
@@ -346,7 +346,7 @@ void CheckBoxEdit::setFormWidgetsController( FormWidgetsController *controller )
FormWidgetIface::setFormWidgetsController( controller );
m_controller->registerRadioButton( button(), m_form );
setChecked( m_form->state() );
- connect( this, SIGNAL(stateChanged(int)), this, SLOT(slotStateChanged(int)) );
+ connect( this, &QCheckBox::stateChanged, this, &CheckBoxEdit::slotStateChanged );
}
QAbstractButton* CheckBoxEdit::button()
@@ -400,8 +400,8 @@ FormLineEdit::FormLineEdit( Okular::FormFieldText * text, QWidget * parent )
if ( !m_form->isReadOnly() )
{
- connect( this, SIGNAL( textEdited( QString ) ), this, SLOT( slotChanged() ) );
- connect( this, SIGNAL( cursorPositionChanged( int, int ) ), this, SLOT( slotChanged() ) );
+ connect( this, &QLineEdit::textEdited, this, &FormLineEdit::slotChanged );
+ connect( this, &QLineEdit::cursorPositionChanged, this, &FormLineEdit::slotChanged );
}
setVisible( m_form->isVisible() );
}
@@ -409,8 +409,8 @@ FormLineEdit::FormLineEdit( Okular::FormFieldText * text, QWidget * parent )
void FormLineEdit::setFormWidgetsController(FormWidgetsController* controller)
{
FormWidgetIface::setFormWidgetsController(controller);
- connect( m_controller, SIGNAL( formTextChangedByUndoRedo( int, Okular::FormFieldText*, QString, int, int ) ),
- this, SLOT( slotHandleTextChangedByUndoRedo( int, Okular::FormFieldText*, QString, int, int ) ) );
+ connect( m_controller, &FormWidgetsController::formTextChangedByUndoRedo,
+ this, &FormLineEdit::slotHandleTextChangedByUndoRedo );
}
bool FormLineEdit::event( QEvent* e )
@@ -441,8 +441,8 @@ void FormLineEdit::contextMenuEvent( QContextMenuEvent* event )
QAction *kundo = KStandardAction::create( KStandardAction::Undo, m_controller, SIGNAL( requestUndo() ), menu );
QAction *kredo = KStandardAction::create( KStandardAction::Redo, m_controller, SIGNAL( requestRedo() ), menu );
- connect( m_controller, SIGNAL( canUndoChanged( bool ) ), kundo, SLOT( setEnabled( bool ) ) );
- connect( m_controller, SIGNAL( canRedoChanged( bool ) ), kredo, SLOT( setEnabled( bool ) ) );
+ connect( m_controller, &FormWidgetsController::canUndoChanged, kundo, &QAction::setEnabled );
+ connect( m_controller, &FormWidgetsController::canRedoChanged, kredo, &QAction::setEnabled );
kundo->setEnabled( m_controller->canUndo() );
kredo->setEnabled( m_controller->canRedo() );
@@ -495,11 +495,11 @@ void FormLineEdit::slotHandleTextChangedByUndoRedo( int pageNumber,
{
return;
}
- disconnect( this, SIGNAL( cursorPositionChanged( int, int ) ), this, SLOT( slotChanged() ) );
+ disconnect( this, &QLineEdit::cursorPositionChanged, this, &FormLineEdit::slotChanged );
setText(contents);
setCursorPosition(anchorPos);
cursorForward( true, cursorPos - anchorPos );
- connect( this, SIGNAL( cursorPositionChanged( int, int ) ), this, SLOT( slotChanged() ) );
+ connect( this, &QLineEdit::cursorPositionChanged, this, &FormLineEdit::slotChanged );
m_prevCursorPos = cursorPos;
m_prevAnchorPos = anchorPos;
setFocus();
@@ -517,10 +517,10 @@ TextAreaEdit::TextAreaEdit( Okular::FormFieldText * text, QWidget * parent )
if ( !m_form->isReadOnly() )
{
- connect( this, SIGNAL( textChanged() ), this, SLOT( slotChanged() ) );
- connect( this, SIGNAL( cursorPositionChanged() ), this, SLOT( slotChanged() ) );
- connect( this, SIGNAL( aboutToShowContextMenu( QMenu* ) ),
- this, SLOT( slotUpdateUndoAndRedoInContextMenu( QMenu* ) ) );
+ connect( this, &QTextEdit::textChanged, this, &TextAreaEdit::slotChanged );
+ connect( this, &QTextEdit::cursorPositionChanged, this, &TextAreaEdit::slotChanged );
+ connect( this, &KTextEdit::aboutToShowContextMenu,
+ this, &TextAreaEdit::slotUpdateUndoAndRedoInContextMenu );
}
m_prevCursorPos = textCursor().position();
m_prevAnchorPos = textCursor().anchor();
@@ -555,8 +555,8 @@ void TextAreaEdit::slotUpdateUndoAndRedoInContextMenu( QMenu* menu )
QAction *kundo = KStandardAction::create( KStandardAction::Undo, m_controller, SIGNAL( requestUndo() ), menu );
QAction *kredo = KStandardAction::create( KStandardAction::Redo, m_controller, SIGNAL( requestRedo() ), menu );
- connect(m_controller, SIGNAL( canUndoChanged( bool ) ), kundo, SLOT( setEnabled( bool ) ) );
- connect(m_controller, SIGNAL( canRedoChanged( bool ) ), kredo, SLOT( setEnabled( bool ) ) );
+ connect(m_controller, &FormWidgetsController::canUndoChanged, kundo, &QAction::setEnabled );
+ connect(m_controller, &FormWidgetsController::canRedoChanged, kredo, &QAction::setEnabled );
kundo->setEnabled( m_controller->canUndo() );
kredo->setEnabled( m_controller->canRedo() );
@@ -574,8 +574,8 @@ void TextAreaEdit::slotUpdateUndoAndRedoInContextMenu( QMenu* menu )
void TextAreaEdit::setFormWidgetsController( FormWidgetsController* controller )
{
FormWidgetIface::setFormWidgetsController( controller );
- connect( m_controller, SIGNAL( formTextChangedByUndoRedo( int, Okular::FormFieldText*, QString, int, int ) ),
- this, SLOT( slotHandleTextChangedByUndoRedo( int, Okular::FormFieldText*, QString, int, int ) ) );
+ connect( m_controller, &FormWidgetsController::formTextChangedByUndoRedo,
+ this, &TextAreaEdit::slotHandleTextChangedByUndoRedo );
}
void TextAreaEdit::slotHandleTextChangedByUndoRedo( int pageNumber,
@@ -630,8 +630,8 @@ FileEdit::FileEdit( Okular::FormFieldText * text, QWidget * parent )
if ( !m_form->isReadOnly() )
{
- connect( this, SIGNAL( textChanged( QString ) ), this, SLOT( slotChanged() ) );
- connect( lineEdit(), SIGNAL( cursorPositionChanged( int, int ) ), this, SLOT( slotChanged() ) );
+ connect( this, &KUrlRequester::textChanged, this, &FileEdit::slotChanged );
+ connect( lineEdit(), &QLineEdit::cursorPositionChanged, this, &FileEdit::slotChanged );
}
setVisible( m_form->isVisible() );
}
@@ -639,8 +639,8 @@ FileEdit::FileEdit( Okular::FormFieldText * text, QWidget * parent )
void FileEdit::setFormWidgetsController( FormWidgetsController* controller )
{
FormWidgetIface::setFormWidgetsController( controller );
- connect( m_controller, SIGNAL( formTextChangedByUndoRedo( int, Okular::FormFieldText*, QString, int, int ) ),
- this, SLOT( slotHandleFileChangedByUndoRedo( int, Okular::FormFieldText*, QString, int, int ) ) );
+ connect( m_controller, &FormWidgetsController::formTextChangedByUndoRedo,
+ this, &FileEdit::slotHandleFileChangedByUndoRedo );
}
bool FileEdit::eventFilter( QObject* obj, QEvent* event )
@@ -671,8 +671,8 @@ bool FileEdit::eventFilter( QObject* obj, QEvent* event )
QAction *kundo = KStandardAction::create( KStandardAction::Undo, m_controller, SIGNAL( requestUndo() ), menu );
QAction *kredo = KStandardAction::create( KStandardAction::Redo, m_controller, SIGNAL( requestRedo() ), menu );
- connect(m_controller, SIGNAL( canUndoChanged( bool ) ), kundo, SLOT( setEnabled( bool ) ) );
- connect(m_controller, SIGNAL( canRedoChanged( bool ) ), kredo, SLOT( setEnabled( bool ) ) );
+ connect(m_controller, &FormWidgetsController::canUndoChanged, kundo, &QAction::setEnabled );
+ connect(m_controller, &FormWidgetsController::canRedoChanged, kredo, &QAction::setEnabled );
kundo->setEnabled( m_controller->canUndo() );
kredo->setEnabled( m_controller->canRedo() );
@@ -768,7 +768,7 @@ ListEdit::ListEdit( Okular::FormFieldChoice * choice, QWidget * parent )
if ( !m_form->isReadOnly() )
{
- connect( this, SIGNAL(itemSelectionChanged()), this, SLOT(slotSelectionChanged()) );
+ connect( this, &QListWidget::itemSelectionChanged, this, &ListEdit::slotSelectionChanged );
}
setVisible( m_form->isVisible() );
setCursor( Qt::ArrowCursor );
@@ -777,8 +777,8 @@ ListEdit::ListEdit( Okular::FormFieldChoice * choice, QWidget * parent )
void ListEdit::setFormWidgetsController( FormWidgetsController* controller )
{
FormWidgetIface::setFormWidgetsController( controller );
- connect( m_controller, SIGNAL( formListChangedByUndoRedo(int, Okular::FormFieldChoice*, QList<int> ) ),
- this, SLOT( slotHandleFormListChangedByUndoRedo( int, Okular::FormFieldChoice*, QList<int> ) ) );
+ connect( m_controller, &FormWidgetsController::formListChangedByUndoRedo,
+ this, &ListEdit::slotHandleFormListChangedByUndoRedo );
}
void ListEdit::slotSelectionChanged()
@@ -803,12 +803,12 @@ void ListEdit::slotHandleFormListChangedByUndoRedo( int pageNumber,
return;
}
- disconnect( this, SIGNAL( itemSelectionChanged() ), this, SLOT( slotSelectionChanged() ) );
+ disconnect( this, &QListWidget::itemSelectionChanged, this, &ListEdit::slotSelectionChanged );
for(int i=0; i < count(); i++)
{
item( i )->setSelected( choices.contains(i) );
}
- connect( this, SIGNAL( itemSelectionChanged() ), this, SLOT( slotSelectionChanged() ) );
+ connect( this, &QListWidget::itemSelectionChanged, this, &ListEdit::slotSelectionChanged );
setFocus();
}
@@ -831,8 +831,8 @@ ComboEdit::ComboEdit( Okular::FormFieldChoice * choice, QWidget * parent )
if ( !m_form->isReadOnly() )
{
connect( this, SIGNAL(currentIndexChanged(int)), this, SLOT(slotValueChanged()) );
- connect( this, SIGNAL(editTextChanged(QString)), this, SLOT(slotValueChanged()) );
- connect( lineEdit(), SIGNAL(cursorPositionChanged(int,int)), this, SLOT(slotValueChanged()) );
+ connect( this, &QComboBox::editTextChanged, this, &ComboEdit::slotValueChanged );
+ connect( lineEdit(), &QLineEdit::cursorPositionChanged, this, &ComboEdit::slotValueChanged );
}
setVisible( m_form->isVisible() );
@@ -844,8 +844,8 @@ ComboEdit::ComboEdit( Okular::FormFieldChoice * choice, QWidget * parent )
void ComboEdit::setFormWidgetsController(FormWidgetsController* controller)
{
FormWidgetIface::setFormWidgetsController(controller);
- connect( m_controller, SIGNAL(formComboChangedByUndoRedo(int,Okular::FormFieldChoice*, QString, int, int )),
- this, SLOT(slotHandleFormComboChangedByUndoRedo(int,Okular::FormFieldChoice*, QString, int, int )));
+ connect( m_controller, &FormWidgetsController::formComboChangedByUndoRedo,
+ this, &ComboEdit::slotHandleFormComboChangedByUndoRedo);
}
@@ -909,7 +909,7 @@ void ComboEdit::slotHandleFormComboChangedByUndoRedo( int pageNumber,
m_prevCursorPos = cursorPos;
m_prevAnchorPos = anchorPos;
- disconnect( lineEdit(), SIGNAL( cursorPositionChanged( int, int ) ), this, SLOT( slotValueChanged() ) );
+ disconnect( lineEdit(), &QLineEdit::cursorPositionChanged, this, &ComboEdit::slotValueChanged );
const bool isCustomValue = index == -1;
if ( isCustomValue )
{
@@ -921,7 +921,7 @@ void ComboEdit::slotHandleFormComboChangedByUndoRedo( int pageNumber,
}
lineEdit()->setCursorPosition( anchorPos );
lineEdit()->cursorForward( true, cursorPos - anchorPos );
- connect( lineEdit(), SIGNAL( cursorPositionChanged( int, int ) ), this, SLOT( slotValueChanged() ) );
+ connect( lineEdit(), &QLineEdit::cursorPositionChanged, this, &ComboEdit::slotValueChanged );
setFocus();
}
@@ -934,8 +934,8 @@ void ComboEdit::contextMenuEvent( QContextMenuEvent* event )
QAction *kundo = KStandardAction::create( KStandardAction::Undo, m_controller, SIGNAL( requestUndo() ), menu );
QAction *kredo = KStandardAction::create( KStandardAction::Redo, m_controller, SIGNAL( requestRedo() ), menu );
- connect( m_controller, SIGNAL( canUndoChanged( bool ) ), kundo, SLOT( setEnabled( bool ) ) );
- connect( m_controller, SIGNAL( canRedoChanged( bool ) ), kredo, SLOT( setEnabled( bool ) ) );
+ connect( m_controller, &FormWidgetsController::canUndoChanged, kundo, &QAction::setEnabled );
+ connect( m_controller, &FormWidgetsController::canRedoChanged, kredo, &QAction::setEnabled );
kundo->setEnabled( m_controller->canUndo() );
kredo->setEnabled( m_controller->canRedo() );
diff --git a/ui/guiutils.cpp b/ui/guiutils.cpp
index 3d7f1d6..379d1e6 100644
--- a/ui/guiutils.cpp
+++ b/ui/guiutils.cpp
@@ -42,7 +42,7 @@ QSvgRenderer* GuiUtilsHelper::svgStamps()
{
if ( !svgStampFile.get() )
{
- const QString stampFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "okular/pics/stamps.svg" );
+ const QString stampFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("okular/pics/stamps.svg") );
if ( !stampFile.isEmpty() )
{
svgStampFile.reset( new QSvgRenderer( stampFile ) );
@@ -141,7 +141,7 @@ QString authorForAnnotation( const Okular::Annotation * ann )
QString contentsHtml( const Okular::Annotation * ann )
{
QString text = ann->contents().toHtmlEscaped();
- text.replace( '\n', "<br>" );
+ text.replace( '\n', QLatin1String("<br>") );
return text;
}
@@ -152,11 +152,11 @@ QString prettyToolTip( const Okular::Annotation * ann )
QString author = authorForAnnotation( ann );
QString contents = contentsHtml( ann );
- QString tooltip = QString( "<qt><b>" ) + i18n( "Author: %1", author ) + QString( "</b>" );
+ QString tooltip = QStringLiteral( "<qt><b>" ) + i18n( "Author: %1", author ) + QStringLiteral( "</b>" );
if ( !contents.isEmpty() )
- tooltip += QString( "<div style=\"font-size: 4px;\"><hr /></div>" ) + contents;
+ tooltip += QStringLiteral( "<div style=\"font-size: 4px;\"><hr /></div>" ) + contents;
- tooltip += "</qt>";
+ tooltip += QLatin1String("</qt>");
return tooltip;
}
@@ -250,7 +250,7 @@ void colorizeImage( QImage & grayImage, const QColor & color, unsigned int destA
blue = color.blue();
int source, sourceSat, sourceAlpha;
- for( register unsigned int i = 0; i < pixels; ++i )
+ for( unsigned int i = 0; i < pixels; ++i )
{ // optimize this loop keeping byte order into account
source = data[i];
sourceSat = qRed( source );
diff --git a/ui/ktreeviewsearchline.cpp b/ui/ktreeviewsearchline.cpp
index 5a9fdd3..ff16487 100644
--- a/ui/ktreeviewsearchline.cpp
+++ b/ui/ktreeviewsearchline.cpp
@@ -325,7 +325,7 @@ void KTreeViewSearchLine::queueSearch( const QString &search )
d->queuedSearches++;
d->search = search;
- QTimer::singleShot( 200, this, SLOT(activateSearch()) );
+ QTimer::singleShot( 200, this, &KTreeViewSearchLine::activateSearch );
}
void KTreeViewSearchLine::activateSearch()
@@ -358,7 +358,7 @@ KTreeViewSearchLineWidget::KTreeViewSearchLineWidget( QWidget *parent, QTreeView
{
d->treeView = treeView;
- QTimer::singleShot( 0, this, SLOT(createWidgets()) );
+ QTimer::singleShot( 0, this, &KTreeViewSearchLineWidget::createWidgets );
}
KTreeViewSearchLineWidget::~KTreeViewSearchLineWidget()
@@ -374,7 +374,7 @@ KTreeViewSearchLine *KTreeViewSearchLineWidget::createSearchLine( QTreeView *tre
void KTreeViewSearchLineWidget::createWidgets()
{
QLabel *label = new QLabel( i18n("S&earch:"), this );
- label->setObjectName( QLatin1String("kde toolbar widget") );
+ label->setObjectName( QStringLiteral("kde toolbar widget") );
searchLine()->show();
diff --git a/ui/latexrenderer.cpp b/ui/latexrenderer.cpp
index 468fa95..8e42a9f 100644
--- a/ui/latexrenderer.cpp
+++ b/ui/latexrenderer.cpp
@@ -43,11 +43,11 @@ LatexRenderer::~LatexRenderer()
LatexRenderer::Error LatexRenderer::renderLatexInHtml( QString& html, const QColor& textColor, int fontSize, int resolution, QString& latexOutput )
{
- if( !html.contains("$$"))
+ if( !html.contains(QStringLiteral("$$")))
return NoError;
// this searches for $$formula$$
- QRegExp rg("\\$\\$.+\\$\\$");
+ QRegExp rg(QStringLiteral("\\$\\$.+\\$\\$"));
rg.setMinimal(true);
int pos = 0;
@@ -64,14 +64,14 @@ LatexRenderer::Error LatexRenderer::renderLatexInHtml( QString& html, const QCol
QString formul=match;
// first remove the $$ delimiters on start and end
- formul.remove("$$");
+ formul.remove(QStringLiteral("$$"));
// then trim the result, so we can skip totally empty/whitespace-only formulas
formul = formul.trimmed();
if (formul.isEmpty() || !securityCheck(formul))
continue;
//unescape formula
- formul.replace("&gt;",">").replace("&lt;","<").replace("&amp;","&").replace("&quot;","\"").replace("&apos;","\'").replace("<br>"," ");
+ formul.replace(QLatin1String("&gt;"),QLatin1String(">")).replace(QLatin1String("&lt;"),QLatin1String("<")).replace(QLatin1String("&amp;"),QLatin1String("&")).replace(QLatin1String("&quot;"),QLatin1String("\"")).replace(QLatin1String("&apos;"),QLatin1String("\'")).replace(QLatin1String("<br>"),QLatin1String(" "));
QString fileName;
Error returnCode = handleLatex(fileName, formul, textColor, fontSize, resolution, latexOutput);
@@ -93,7 +93,7 @@ LatexRenderer::Error LatexRenderer::renderLatexInHtml( QString& html, const QCol
continue;
imagePxWidth = theImage.width();
imagePxHeight = theImage.height();
- QString escapedLATEX=it.key().toHtmlEscaped().replace('\"',"&quot;"); //we need the escape quotes because that string will be in a title="" argument, but not the \n
+ QString escapedLATEX=it.key().toHtmlEscaped().replace('\"',QLatin1String("&quot;")); //we need the escape quotes because that string will be in a title="" argument, but not the \n
html.replace(it.key(), " <img width=\"" + QString::number(imagePxWidth) + "\" height=\"" + QString::number(imagePxHeight) + "\" align=\"middle\" src=\"" + (*it) + "\" alt=\"" + escapedLATEX +"\" title=\"" + escapedLATEX +"\" /> ");
}
return NoError;
@@ -101,11 +101,11 @@ LatexRenderer::Error LatexRenderer::renderLatexInHtml( QString& html, const QCol
bool LatexRenderer::mightContainLatex (const QString& text)
{
- if( !text.contains("$$"))
+ if( !text.contains(QStringLiteral("$$")))
return false;
// this searches for $$formula$$
- QRegExp rg("\\$\\$.+\\$\\$");
+ QRegExp rg(QStringLiteral("\\$\\$.+\\$\\$"));
rg.setMinimal(true);
if( rg.lastIndexIn(text) == -1 )
return false;
@@ -140,7 +140,7 @@ LatexRenderer::Error LatexRenderer::handleLatex( QString& fileName, const QStrin
\\end{document}";
tempFile->close();
- QString latexExecutable = QStandardPaths::findExecutable("latex");
+ QString latexExecutable = QStandardPaths::findExecutable(QStringLiteral("latex"));
if (latexExecutable.isEmpty())
{
qCDebug(OkularUiDebug) << "Could not find latex!";
@@ -148,23 +148,23 @@ LatexRenderer::Error LatexRenderer::handleLatex( QString& fileName, const QStrin
fileName = QString();
return LatexNotFound;
}
- latexProc << latexExecutable << "-interaction=nonstopmode" << "-halt-on-error" << QString("-output-directory=%1").arg(tempFilePath) << tempFile->fileName();
+ latexProc << latexExecutable << QStringLiteral("-interaction=nonstopmode") << QStringLiteral("-halt-on-error") << QStringLiteral("-output-directory=%1").arg(tempFilePath) << tempFile->fileName();
latexProc.setOutputChannelMode( KProcess::MergedChannels );
latexProc.execute();
latexOutput = latexProc.readAll();
tempFile->remove();
- QFile::remove(tempFileNameNS + QString(".log"));
- QFile::remove(tempFileNameNS + QString(".aux"));
+ QFile::remove(tempFileNameNS + QStringLiteral(".log"));
+ QFile::remove(tempFileNameNS + QStringLiteral(".aux"));
delete tempFile;
- if (!QFile::exists(tempFileNameNS + QString(".dvi")))
+ if (!QFile::exists(tempFileNameNS + QStringLiteral(".dvi")))
{
fileName = QString();
return LatexFailed;
}
- QString dvipngExecutable = QStandardPaths::findExecutable("dvipng");
+ QString dvipngExecutable = QStandardPaths::findExecutable(QStringLiteral("dvipng"));
if (dvipngExecutable.isEmpty())
{
qCDebug(OkularUiDebug) << "Could not find dvipng!";
@@ -172,29 +172,29 @@ LatexRenderer::Error LatexRenderer::handleLatex( QString& fileName, const QStrin
return DvipngNotFound;
}
- dvipngProc << dvipngExecutable << QString("-o%1").arg(tempFileNameNS + QString(".png")) << "-Ttight" << "-bgTransparent" << QString("-D %1").arg(resolution) << QString("%1").arg(tempFileNameNS + QString(".dvi"));
+ dvipngProc << dvipngExecutable << QStringLiteral("-o%1").arg(tempFileNameNS + QStringLiteral(".png")) << QStringLiteral("-Ttight") << QStringLiteral("-bgTransparent") << QStringLiteral("-D %1").arg(resolution) << QStringLiteral("%1").arg(tempFileNameNS + QStringLiteral(".dvi"));
dvipngProc.setOutputChannelMode( KProcess::MergedChannels );
dvipngProc.execute();
- QFile::remove(tempFileNameNS + QString(".dvi"));
+ QFile::remove(tempFileNameNS + QStringLiteral(".dvi"));
- if (!QFile::exists(tempFileNameNS + QString(".png")))
+ if (!QFile::exists(tempFileNameNS + QStringLiteral(".png")))
{
fileName = QString();
return DvipngFailed;
}
- fileName = tempFileNameNS + QString(".png");
+ fileName = tempFileNameNS + QStringLiteral(".png");
m_fileList << fileName;
return NoError;
}
bool LatexRenderer::securityCheck( const QString &latexFormula )
{
- return !latexFormula.contains(QRegExp("\\\\(def|let|futurelet|newcommand|renewcommand|else|fi|write|input|include"
+ return !latexFormula.contains(QRegExp(QStringLiteral("\\\\(def|let|futurelet|newcommand|renewcommand|else|fi|write|input|include"
"|chardef|catcode|makeatletter|noexpand|toksdef|every|errhelp|errorstopmode|scrollmode|nonstopmode|batchmode"
"|read|csname|newhelp|relax|afterground|afterassignment|expandafter|noexpand|special|command|loop|repeat|toks"
- "|output|line|mathcode|name|item|section|mbox|DeclareRobustCommand)[^a-zA-Z]"));
+ "|output|line|mathcode|name|item|section|mbox|DeclareRobustCommand)[^a-zA-Z]")));
}
}
diff --git a/ui/layers.cpp b/ui/layers.cpp
index fe75168..8268156 100644
--- a/ui/layers.cpp
+++ b/ui/layers.cpp
@@ -32,7 +32,7 @@ Layers::Layers(QWidget *parent, Okular::Document *document) : QWidget(parent), m
mainlay->addWidget( m_searchLine );
m_searchLine->setCaseSensitivity( Okular::Settings::self()->layersSearchCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive );
m_searchLine->setRegularExpression( Okular::Settings::self()->layersSearchRegularExpression() );
- connect( m_searchLine, SIGNAL(searchOptionsChanged()), this, SLOT(saveSearchOptions()) );
+ connect( m_searchLine, &KTreeViewSearchLine::searchOptionsChanged, this, &Layers::saveSearchOptions );
m_treeView = new QTreeView( this );
mainlay->addWidget( m_treeView );
@@ -58,8 +58,8 @@ void Layers::notifySetup( const QVector< Okular::Page * > & /*pages*/, int /*set
m_treeView->setModel( layersModel );
m_searchLine->setTreeView( m_treeView );
emit hasLayers( true );
- connect( layersModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), m_document, SLOT(reloadDocument()) );
- connect( layersModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), m_pageView, SLOT(reloadForms()) );
+ connect( layersModel, &QAbstractItemModel::dataChanged, m_document, &Okular::Document::reloadDocument );
+ connect( layersModel, &QAbstractItemModel::dataChanged, m_pageView, &PageView::reloadForms );
}
else
{
diff --git a/ui/minibar.cpp b/ui/minibar.cpp
index 0286434..ce805be 100644
--- a/ui/minibar.cpp
+++ b/ui/minibar.cpp
@@ -155,7 +155,7 @@ MiniBar::MiniBar( QWidget * parent, MiniBarLogic * miniBarLogic )
, m_miniBarLogic( miniBarLogic )
, m_oldToobarParent( 0 )
{
- setObjectName( QLatin1String( "miniBar" ) );
+ setObjectName( QStringLiteral( "miniBar" ) );
m_miniBarLogic->addMiniBar( this );
@@ -205,9 +205,9 @@ MiniBar::MiniBar( QWidget * parent, MiniBarLogic * miniBarLogic )
// connect signals from child widgets to internal handlers / signals bouncers
connect( m_pageNumberEdit, SIGNAL(returnPressed()), this, SLOT(slotChangePage()) );
connect( m_pageLabelEdit, SIGNAL(pageNumberChosen(int)), this, SLOT(slotChangePage(int)) );
- connect( m_pagesButton, SIGNAL(clicked()), this, SIGNAL(gotoPage()) );
- connect( m_prevButton, SIGNAL(clicked()), this, SIGNAL(prevPage()) );
- connect( m_nextButton, SIGNAL(clicked()), this, SIGNAL(nextPage()) );
+ connect( m_pagesButton, &QAbstractButton::clicked, this, &MiniBar::gotoPage );
+ connect( m_prevButton, &QAbstractButton::clicked, this, &MiniBar::prevPage );
+ connect( m_nextButton, &QAbstractButton::clicked, this, &MiniBar::nextPage );
resize( minimumSizeHint() );
@@ -229,12 +229,12 @@ void MiniBar::changeEvent( QEvent * event )
{
if ( m_oldToobarParent )
{
- disconnect( m_oldToobarParent, SIGNAL(iconSizeChanged(QSize)), this, SLOT(slotToolBarIconSizeChanged()));
+ disconnect( m_oldToobarParent, &QToolBar::iconSizeChanged, this, &MiniBar::slotToolBarIconSizeChanged);
}
m_oldToobarParent = tb;
if ( tb )
{
- connect( tb, SIGNAL(iconSizeChanged(QSize)), this, SLOT(slotToolBarIconSizeChanged()));
+ connect( tb, &QToolBar::iconSizeChanged, this, &MiniBar::slotToolBarIconSizeChanged);
slotToolBarIconSizeChanged();
}
}
@@ -321,7 +321,7 @@ ProgressWidget::ProgressWidget( QWidget * parent, Okular::Document * document )
: QWidget( parent ), m_document( document ),
m_progressPercentage( -1 )
{
- setObjectName( QLatin1String( "progress" ) );
+ setObjectName( QStringLiteral( "progress" ) );
setAttribute( Qt::WA_OpaquePaintEvent, true );
setFixedHeight( 4 );
setMouseTracking( true );
@@ -496,7 +496,7 @@ PagesEdit::PagesEdit( MiniBar * parent )
QFocusEvent fe( QEvent::FocusOut );
QApplication::sendEvent( this, &fe );
- connect( KGlobalSettings::self(), SIGNAL(appearanceChanged()), this, SLOT(updatePalette()) );
+ connect( KGlobalSettings::self(), &KGlobalSettings::appearanceChanged, this, &PagesEdit::updatePalette );
}
void PagesEdit::setText( const QString & newText )
diff --git a/ui/pagepainter.cpp b/ui/pagepainter.cpp
index 7c834e1..0c8443c 100644
--- a/ui/pagepainter.cpp
+++ b/ui/pagepainter.cpp
@@ -920,7 +920,7 @@ void PagePainter::changeImageAlpha( QImage & image, unsigned int destAlpha )
unsigned int pixels = image.width() * image.height();
int source, sourceAlpha;
- for( register unsigned int i = 0; i < pixels; ++i )
+ for( unsigned int i = 0; i < pixels; ++i )
{ // optimize this loop keeping byte order into account
source = data[i];
if ( (sourceAlpha = qAlpha( source )) == 255 )
diff --git a/ui/pageview.cpp b/ui/pageview.cpp
index 6f329ae..13727e4 100644
--- a/ui/pageview.cpp
+++ b/ui/pageview.cpp
@@ -267,8 +267,8 @@ OkularTTS* PageViewPrivate::tts()
m_tts = new OkularTTS( q );
if ( aSpeakStop )
{
- QObject::connect( m_tts, SIGNAL(isSpeaking(bool)),
- aSpeakStop, SLOT(setEnabled(bool)) );
+ QObject::connect( m_tts, &OkularTTS::isSpeaking,
+ aSpeakStop, &QAction::setEnabled );
}
}
@@ -289,7 +289,7 @@ OkularTTS* PageViewPrivate::tts()
*/
PageView::PageView( QWidget *parent, Okular::Document *document )
: QAbstractScrollArea( parent )
- , Okular::View( QString::fromLatin1( "PageView" ) )
+ , Okular::View( QLatin1String( "PageView" ) )
{
// create and initialize private storage structure
d = new PageViewPrivate( this );
@@ -382,13 +382,13 @@ PageView::PageView( QWidget *parent, Okular::Document *document )
d->delayResizeEventTimer = new QTimer( this );
d->delayResizeEventTimer->setSingleShot( true );
- connect( d->delayResizeEventTimer, SIGNAL(timeout()), this, SLOT(delayedResizeEvent()) );
+ connect( d->delayResizeEventTimer, &QTimer::timeout, this, &PageView::delayedResizeEvent );
setFrameStyle(QFrame::NoFrame);
setAttribute( Qt::WA_StaticContents );
- setObjectName( QLatin1String( "okular::pageView" ) );
+ setObjectName( QStringLiteral( "okular::pageView" ) );
// viewport setup: setup focus, and track mouse
viewport()->setFocusProxy( this );
@@ -402,12 +402,12 @@ PageView::PageView( QWidget *parent, Okular::Document *document )
horizontalScrollBar()->setSingleStep( 20 );
// conntect the padding of the viewport to pixmaps requests
- connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(slotRequestVisiblePixmaps(int)));
- connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(slotRequestVisiblePixmaps(int)));
- connect( &d->dragScrollTimer, SIGNAL(timeout()), this, SLOT(slotDragScroll()) );
+ connect(horizontalScrollBar(), &QAbstractSlider::valueChanged, this, &PageView::slotRequestVisiblePixmaps);
+ connect(verticalScrollBar(), &QAbstractSlider::valueChanged, this, &PageView::slotRequestVisiblePixmaps);
+ connect( &d->dragScrollTimer, &QTimer::timeout, this, &PageView::slotDragScroll );
d->leftClickTimer.setSingleShot( true );
- connect( &d->leftClickTimer, SIGNAL(timeout()), this, SLOT(slotShowSizeAllCursor()) );
+ connect( &d->leftClickTimer, &QTimer::timeout, this, &PageView::slotShowSizeAllCursor );
// set a corner button to resize the view to the page size
// QPushButton * resizeButton = new QPushButton( viewport() );
@@ -421,8 +421,8 @@ PageView::PageView( QWidget *parent, Okular::Document *document )
d->magnifierView->hide();
d->magnifierView->setGeometry(0, 0, 351, 201); // TODO: more dynamic?
- connect(document, SIGNAL(processMovieAction(const Okular::MovieAction*)), this, SLOT(slotProcessMovieAction(const Okular::MovieAction*)));
- connect(document, SIGNAL(processRenditionAction(const Okular::RenditionAction*)), this, SLOT(slotProcessRenditionAction(const Okular::RenditionAction*)));
+ connect(document, &Okular::Document::processMovieAction, this, &PageView::slotProcessMovieAction);
+ connect(document, &Okular::Document::processRenditionAction, this, &PageView::slotProcessRenditionAction);
// schedule the welcome message
QMetaObject::invokeMethod(this, "slotShowWelcome", Qt::QueuedConnection);
@@ -457,8 +457,8 @@ void PageView::setupBaseActions( KActionCollection * ac )
d->actionCollection = ac;
// Zoom actions ( higher scales takes lots of memory! )
- d->aZoom = new KSelectAction(QIcon::fromTheme( "page-zoom" ), i18n("Zoom"), this);
- ac->addAction("zoom_to", d->aZoom );
+ d->aZoom = new KSelectAction(QIcon::fromTheme( QStringLiteral("page-zoom") ), i18n("Zoom"), this);
+ ac->addAction(QStringLiteral("zoom_to"), d->aZoom );
d->aZoom->setEditable( true );
d->aZoom->setMaxComboViewCount( 14 );
connect( d->aZoom, SIGNAL(triggered(QAction*)), this, SLOT(slotZoom()) );
@@ -477,23 +477,23 @@ void PageView::setupViewerActions( KActionCollection * ac )
ac->setDefaultShortcut(d->aZoomOut, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Minus));
// orientation menu actions
- d->aRotateClockwise = new QAction( QIcon::fromTheme( "object-rotate-right" ), i18n( "Rotate &Right" ), this );
+ d->aRotateClockwise = new QAction( QIcon::fromTheme( QStringLiteral("object-rotate-right") ), i18n( "Rotate &Right" ), this );
d->aRotateClockwise->setIconText( i18nc( "Rotate right", "Right" ) );
- ac->addAction( "view_orientation_rotate_cw", d->aRotateClockwise );
+ ac->addAction( QStringLiteral("view_orientation_rotate_cw"), d->aRotateClockwise );
d->aRotateClockwise->setEnabled( false );
- connect( d->aRotateClockwise, SIGNAL(triggered()), this, SLOT(slotRotateClockwise()) );
- d->aRotateCounterClockwise = new QAction( QIcon::fromTheme( "object-rotate-left" ), i18n( "Rotate &Left" ), this );
+ connect( d->aRotateClockwise, &QAction::triggered, this, &PageView::slotRotateClockwise );
+ d->aRotateCounterClockwise = new QAction( QIcon::fromTheme( QStringLiteral("object-rotate-left") ), i18n( "Rotate &Left" ), this );
d->aRotateCounterClockwise->setIconText( i18nc( "Rotate left", "Left" ) );
- ac->addAction( "view_orientation_rotate_ccw", d->aRotateCounterClockwise );
+ ac->addAction( QStringLiteral("view_orientation_rotate_ccw"), d->aRotateCounterClockwise );
d->aRotateCounterClockwise->setEnabled( false );
- connect( d->aRotateCounterClockwise, SIGNAL(triggered()), this, SLOT(slotRotateCounterClockwise()) );
+ connect( d->aRotateCounterClockwise, &QAction::triggered, this, &PageView::slotRotateCounterClockwise );
d->aRotateOriginal = new QAction( i18n( "Original Orientation" ), this );
- ac->addAction( "view_orientation_original", d->aRotateOriginal );
+ ac->addAction( QStringLiteral("view_orientation_original"), d->aRotateOriginal );
d->aRotateOriginal->setEnabled( false );
- connect( d->aRotateOriginal, SIGNAL(triggered()), this, SLOT(slotRotateOriginal()) );
+ connect( d->aRotateOriginal, &QAction::triggered, this, &PageView::slotRotateOriginal );
d->aPageSizes = new KSelectAction(i18n("&Page Size"), this);
- ac->addAction("view_pagesizes", d->aPageSizes);
+ ac->addAction(QStringLiteral("view_pagesizes"), d->aPageSizes);
d->aPageSizes->setEnabled( false );
connect( d->aPageSizes , SIGNAL(triggered(int)),
@@ -502,41 +502,41 @@ void PageView::setupViewerActions( KActionCollection * ac )
// Trim View actions
d->aTrimMode = new KActionMenu(i18n( "&Trim View" ), this );
d->aTrimMode->setDelayed( false );
- ac->addAction("view_trim_mode", d->aTrimMode );
+ ac->addAction(QStringLiteral("view_trim_mode"), d->aTrimMode );
d->aTrimMargins = new KToggleAction( i18n( "&Trim Margins" ), d->aTrimMode->menu() );
d->aTrimMode->addAction( d->aTrimMargins );
- ac->addAction( "view_trim_margins", d->aTrimMargins );
+ ac->addAction( QStringLiteral("view_trim_margins"), d->aTrimMargins );
d->aTrimMargins->setData( qVariantFromValue( (int)Okular::Settings::EnumTrimMode::Margins ) );
- connect( d->aTrimMargins, SIGNAL(toggled(bool)), SLOT(slotTrimMarginsToggled(bool)) );
+ connect( d->aTrimMargins, &QAction::toggled, this, &PageView::slotTrimMarginsToggled );
d->aTrimMargins->setChecked( Okular::Settings::trimMargins() );
d->aTrimToSelection = new KToggleAction( i18n( "Trim To &Selection" ), d->aTrimMode->menu() );
d->aTrimMode->addAction( d->aTrimToSelection);
- ac->addAction( "view_trim_selection", d->aTrimToSelection);
+ ac->addAction( QStringLiteral("view_trim_selection"), d->aTrimToSelection);
d->aTrimToSelection->setData( qVariantFromValue( (int)Okular::Settings::EnumTrimMode::Selection ) );
- connect( d->aTrimToSelection, SIGNAL(toggled(bool)), SLOT(slotTrimToSelectionToggled(bool)) );
+ connect( d->aTrimToSelection, &QAction::toggled, this, &PageView::slotTrimToSelectionToggled );
- d->aZoomFitWidth = new KToggleAction(QIcon::fromTheme( "zoom-fit-width" ), i18n("Fit &Width"), this);
- ac->addAction("view_fit_to_width", d->aZoomFitWidth );
- connect( d->aZoomFitWidth, SIGNAL(toggled(bool)), SLOT(slotFitToWidthToggled(bool)) );
+ d->aZoomFitWidth = new KToggleAction(QIcon::fromTheme( QStringLiteral("zoom-fit-width") ), i18n("Fit &Width"), this);
+ ac->addAction(QStringLiteral("view_fit_to_width"), d->aZoomFitWidth );
+ connect( d->aZoomFitWidth, &QAction::toggled, this, &PageView::slotFitToWidthToggled );
- d->aZoomFitPage = new KToggleAction(QIcon::fromTheme( "zoom-fit-best" ), i18n("Fit &Page"), this);
- ac->addAction("view_fit_to_page", d->aZoomFitPage );
- connect( d->aZoomFitPage, SIGNAL(toggled(bool)), SLOT(slotFitToPageToggled(bool)) );
+ d->aZoomFitPage = new KToggleAction(QIcon::fromTheme( QStringLiteral("zoom-fit-best") ), i18n("Fit &Page"), this);
+ ac->addAction(QStringLiteral("view_fit_to_page"), d->aZoomFitPage );
+ connect( d->aZoomFitPage, &QAction::toggled, this, &PageView::slotFitToPageToggled );
- d->aZoomAutoFit = new KToggleAction(QIcon::fromTheme( "zoom-fit-best" ), i18n("&Auto Fit"), this);
- ac->addAction("view_auto_fit", d->aZoomAutoFit );
- connect( d->aZoomAutoFit, SIGNAL(toggled(bool)), SLOT(slotAutoFitToggled(bool)) );
+ d->aZoomAutoFit = new KToggleAction(QIcon::fromTheme( QStringLiteral("zoom-fit-best") ), i18n("&Auto Fit"), this);
+ ac->addAction(QStringLiteral("view_auto_fit"), d->aZoomAutoFit );
+ connect( d->aZoomAutoFit, &QAction::toggled, this, &PageView::slotAutoFitToggled );
- d->aFitWindowToPage = new QAction(QIcon::fromTheme( "zoom-fit-width" ), i18n("Fit Wi&ndow to Page"), this);
+ d->aFitWindowToPage = new QAction(QIcon::fromTheme( QStringLiteral("zoom-fit-width") ), i18n("Fit Wi&ndow to Page"), this);
d->aFitWindowToPage->setEnabled( Okular::Settings::viewMode() == (int)Okular::Settings::EnumViewMode::Single );
ac->setDefaultShortcut(d->aFitWindowToPage, QKeySequence(Qt::CTRL + Qt::Key_J) );
- ac->addAction( "fit_window_to_page", d->aFitWindowToPage );
- connect( d->aFitWindowToPage, SIGNAL(triggered()), this, SLOT(slotFitWindowToPage()) );
+ ac->addAction( QStringLiteral("fit_window_to_page"), d->aFitWindowToPage );
+ connect( d->aFitWindowToPage, &QAction::triggered, this, &PageView::slotFitWindowToPage );
// View-Layout actions
- d->aViewMode = new KActionMenu( QIcon::fromTheme( "view-split-left-right" ), i18n( "&View Mode" ), this );
+ d->aViewMode = new KActionMenu( QIcon::fromTheme( QStringLiteral("view-split-left-right") ), i18n( "&View Mode" ), this );
d->aViewMode->setDelayed( false );
#define ADD_VIEWMODE_ACTION( text, name, id ) \
do { \
@@ -547,7 +547,7 @@ do { \
ac->addAction( name, vm ); \
vmGroup->addAction( vm ); \
} while( 0 )
- ac->addAction("view_render_mode", d->aViewMode );
+ ac->addAction(QStringLiteral("view_render_mode"), d->aViewMode );
QActionGroup *vmGroup = new QActionGroup( this ); //d->aViewMode->menu() );
ADD_VIEWMODE_ACTION( i18n( "Single Page" ), "view_render_mode_single", (int)Okular::Settings::EnumViewMode::Single );
ADD_VIEWMODE_ACTION( i18n( "Facing Pages" ), "view_render_mode_facing", (int)Okular::Settings::EnumViewMode::Facing );
@@ -561,29 +561,29 @@ do { \
viewModeAction->setChecked( true );
}
}
- connect( vmGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotViewMode(QAction*)) );
+ connect( vmGroup, &QActionGroup::triggered, this, &PageView::slotViewMode );
#undef ADD_VIEWMODE_ACTION
- d->aViewContinuous = new KToggleAction(QIcon::fromTheme( "view-list-text" ), i18n("&Continuous"), this);
- ac->addAction("view_continuous", d->aViewContinuous );
- connect( d->aViewContinuous, SIGNAL(toggled(bool)), SLOT(slotContinuousToggled(bool)) );
+ d->aViewContinuous = new KToggleAction(QIcon::fromTheme( QStringLiteral("view-list-text") ), i18n("&Continuous"), this);
+ ac->addAction(QStringLiteral("view_continuous"), d->aViewContinuous );
+ connect( d->aViewContinuous, &QAction::toggled, this, &PageView::slotContinuousToggled );
d->aViewContinuous->setChecked( Okular::Settings::viewContinuous() );
// Mouse mode actions for viewer mode
d->mouseModeActionGroup = new QActionGroup( this );
d->mouseModeActionGroup->setExclusive( true );
- d->aMouseNormal = new QAction( QIcon::fromTheme( "input-mouse" ), i18n( "&Browse Tool" ), this );
- ac->addAction("mouse_drag", d->aMouseNormal );
- connect( d->aMouseNormal, SIGNAL(triggered()), this, SLOT(slotSetMouseNormal()) );
+ d->aMouseNormal = new QAction( QIcon::fromTheme( QStringLiteral("input-mouse") ), i18n( "&Browse Tool" ), this );
+ ac->addAction(QStringLiteral("mouse_drag"), d->aMouseNormal );
+ connect( d->aMouseNormal, &QAction::triggered, this, &PageView::slotSetMouseNormal );
d->aMouseNormal->setIconText( i18nc( "Browse Tool", "Browse" ) );
d->aMouseNormal->setCheckable( true );
ac->setDefaultShortcut(d->aMouseNormal, QKeySequence(Qt::CTRL + Qt::Key_1));
d->aMouseNormal->setActionGroup( d->mouseModeActionGroup );
d->aMouseNormal->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::Browse );
- QAction * mz = new QAction(QIcon::fromTheme( "page-zoom" ), i18n("&Zoom Tool"), this);
- ac->addAction("mouse_zoom", mz );
- connect( mz, SIGNAL(triggered()), this, SLOT(slotSetMouseZoom()) );
+ QAction * mz = new QAction(QIcon::fromTheme( QStringLiteral("page-zoom") ), i18n("&Zoom Tool"), this);
+ ac->addAction(QStringLiteral("mouse_zoom"), mz );
+ connect( mz, &QAction::triggered, this, &PageView::slotSetMouseZoom );
mz->setIconText( i18nc( "Zoom Tool", "Zoom" ) );
mz->setCheckable( true );
ac->setDefaultShortcut(mz, QKeySequence(Qt::CTRL + Qt::Key_2));
@@ -591,8 +591,8 @@ do { \
mz->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::Zoom );
QAction * aToggleChangeColors = new QAction(i18n("&Toggle Change Colors"), this);
- ac->addAction("toggle_change_colors", aToggleChangeColors );
- connect( aToggleChangeColors, SIGNAL(triggered()), this, SLOT(slotToggleChangeColors()) );
+ ac->addAction(QStringLiteral("toggle_change_colors"), aToggleChangeColors );
+ connect( aToggleChangeColors, &QAction::triggered, this, &PageView::slotToggleChangeColors );
}
// WARNING: 'setupViewerActions' must have been called before this method
@@ -604,9 +604,9 @@ void PageView::setupActions( KActionCollection * ac )
ac->setDefaultShortcuts(d->aZoomOut, KStandardShortcut::zoomOut());
// Mouse-Mode actions
- d->aMouseSelect = new QAction(QIcon::fromTheme( "select-rectangular" ), i18n("&Selection Tool"), this);
- ac->addAction("mouse_select", d->aMouseSelect );
- connect( d->aMouseSelect, SIGNAL(triggered()), this, SLOT(slotSetMouseSelect()) );
+ d->aMouseSelect = new QAction(QIcon::fromTheme( QStringLiteral("select-rectangular") ), i18n("&Selection Tool"), this);
+ ac->addAction(QStringLiteral("mouse_select"), d->aMouseSelect );
+ connect( d->aMouseSelect, &QAction::triggered, this, &PageView::slotSetMouseSelect );
d->aMouseSelect->setIconText( i18nc( "Select Tool", "Selection" ) );
d->aMouseSelect->setCheckable( true );
ac->setDefaultShortcut(d->aMouseSelect, Qt::CTRL + Qt::Key_3);
@@ -614,61 +614,61 @@ void PageView::setupActions( KActionCollection * ac )
d->aMouseSelect->setActionGroup( d->mouseModeActionGroup );
d->aMouseSelect->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::RectSelect );
- d->aMouseTextSelect = new QAction(QIcon::fromTheme( "draw-text" ), i18n("&Text Selection Tool"), this);
- ac->addAction("mouse_textselect", d->aMouseTextSelect );
- connect( d->aMouseTextSelect, SIGNAL(triggered()), this, SLOT(slotSetMouseTextSelect()) );
+ d->aMouseTextSelect = new QAction(QIcon::fromTheme( QStringLiteral("draw-text") ), i18n("&Text Selection Tool"), this);
+ ac->addAction(QStringLiteral("mouse_textselect"), d->aMouseTextSelect );
+ connect( d->aMouseTextSelect, &QAction::triggered, this, &PageView::slotSetMouseTextSelect );
d->aMouseTextSelect->setIconText( i18nc( "Text Selection Tool", "Text Selection" ) );
d->aMouseTextSelect->setCheckable( true );
ac->setDefaultShortcut(d->aMouseTextSelect, Qt::CTRL + Qt::Key_4);
d->aMouseTextSelect->setActionGroup( d->mouseModeActionGroup );
d->aMouseTextSelect->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::TextSelect );
- d->aMouseTableSelect = new QAction(QIcon::fromTheme( "table" ), i18n("T&able Selection Tool"), this);
- ac->addAction("mouse_tableselect", d->aMouseTableSelect );
- connect( d->aMouseTableSelect, SIGNAL( triggered() ), this, SLOT( slotSetMouseTableSelect() ) );
+ d->aMouseTableSelect = new QAction(QIcon::fromTheme( QStringLiteral("table") ), i18n("T&able Selection Tool"), this);
+ ac->addAction(QStringLiteral("mouse_tableselect"), d->aMouseTableSelect );
+ connect( d->aMouseTableSelect, &QAction::triggered, this, &PageView::slotSetMouseTableSelect );
d->aMouseTableSelect->setIconText( i18nc( "Table Selection Tool", "Table Selection" ) );
d->aMouseTableSelect->setCheckable( true );
ac->setDefaultShortcut(d->aMouseTableSelect, Qt::CTRL + Qt::Key_5);
d->aMouseTableSelect->setActionGroup( d->mouseModeActionGroup );
d->aMouseTableSelect->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::TableSelect );
- d->aMouseMagnifier = new QAction(QIcon::fromTheme( "document-preview" ), i18n("&Magnifier"), this);
- ac->addAction("mouse_magnifier", d->aMouseMagnifier );
- connect( d->aMouseMagnifier, SIGNAL(triggered()), this, SLOT(slotSetMouseMagnifier()) );
+ d->aMouseMagnifier = new QAction(QIcon::fromTheme( QStringLiteral("document-preview") ), i18n("&Magnifier"), this);
+ ac->addAction(QStringLiteral("mouse_magnifier"), d->aMouseMagnifier );
+ connect( d->aMouseMagnifier, &QAction::triggered, this, &PageView::slotSetMouseMagnifier );
d->aMouseMagnifier->setIconText( i18nc( "Magnifier Tool", "Magnifier" ) );
d->aMouseMagnifier->setCheckable( true );
ac->setDefaultShortcut(d->aMouseMagnifier, Qt::CTRL + Qt::Key_6);
d->aMouseMagnifier->setActionGroup( d->mouseModeActionGroup );
d->aMouseMagnifier->setChecked( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::Magnifier );
- d->aToggleAnnotator = new KToggleAction(QIcon::fromTheme( "draw-freehand" ), i18n("&Review"), this);
- ac->addAction("mouse_toggle_annotate", d->aToggleAnnotator );
+ d->aToggleAnnotator = new KToggleAction(QIcon::fromTheme( QStringLiteral("draw-freehand") ), i18n("&Review"), this);
+ ac->addAction(QStringLiteral("mouse_toggle_annotate"), d->aToggleAnnotator );
d->aToggleAnnotator->setCheckable( true );
- connect( d->aToggleAnnotator, SIGNAL(toggled(bool)), SLOT(slotToggleAnnotator(bool)) );
+ connect( d->aToggleAnnotator, &QAction::toggled, this, &PageView::slotToggleAnnotator );
ac->setDefaultShortcut(d->aToggleAnnotator, Qt::Key_F6);
ToolAction *ta = new ToolAction( this );
- ac->addAction( "mouse_selecttools", ta );
+ ac->addAction( QStringLiteral("mouse_selecttools"), ta );
ta->addAction( d->aMouseSelect );
ta->addAction( d->aMouseTextSelect );
ta->addAction( d->aMouseTableSelect );
// speak actions
#ifdef HAVE_SPEECH
- d->aSpeakDoc = new QAction( QIcon::fromTheme( "text-speak" ), i18n( "Speak Whole Document" ), this );
- ac->addAction( "speak_document", d->aSpeakDoc );
+ d->aSpeakDoc = new QAction( QIcon::fromTheme( QStringLiteral("text-speak") ), i18n( "Speak Whole Document" ), this );
+ ac->addAction( QStringLiteral("speak_document"), d->aSpeakDoc );
d->aSpeakDoc->setEnabled( false );
- connect( d->aSpeakDoc, SIGNAL(triggered()), SLOT(slotSpeakDocument()) );
+ connect( d->aSpeakDoc, &QAction::triggered, this, &PageView::slotSpeakDocument );
- d->aSpeakPage = new QAction( QIcon::fromTheme( "text-speak" ), i18n( "Speak Current Page" ), this );
- ac->addAction( "speak_current_page", d->aSpeakPage );
+ d->aSpeakPage = new QAction( QIcon::fromTheme( QStringLiteral("text-speak") ), i18n( "Speak Current Page" ), this );
+ ac->addAction( QStringLiteral("speak_current_page"), d->aSpeakPage );
d->aSpeakPage->setEnabled( false );
- connect( d->aSpeakPage, SIGNAL(triggered()), SLOT(slotSpeakCurrentPage()) );
+ connect( d->aSpeakPage, &QAction::triggered, this, &PageView::slotSpeakCurrentPage );
- d->aSpeakStop = new QAction( QIcon::fromTheme( "media-playback-stop" ), i18n( "Stop Speaking" ), this );
- ac->addAction( "speak_stop_all", d->aSpeakStop );
+ d->aSpeakStop = new QAction( QIcon::fromTheme( QStringLiteral("media-playback-stop") ), i18n( "Stop Speaking" ), this );
+ ac->addAction( QStringLiteral("speak_stop_all"), d->aSpeakStop );
d->aSpeakStop->setEnabled( false );
- connect( d->aSpeakStop, SIGNAL(triggered()), SLOT(slotStopSpeaks()) );
+ connect( d->aSpeakStop, &QAction::triggered, this, &PageView::slotStopSpeaks );
#else
d->aSpeakDoc = 0;
d->aSpeakPage = 0;
@@ -677,40 +677,40 @@ void PageView::setupActions( KActionCollection * ac )
// Other actions
QAction * su = new QAction(i18n("Scroll Up"), this);
- ac->addAction("view_scroll_up", su );
- connect( su, SIGNAL(triggered()), this, SLOT(slotAutoScrollUp()) );
+ ac->addAction(QStringLiteral("view_scroll_up"), su );
+ connect( su, &QAction::triggered, this, &PageView::slotAutoScrollUp );
ac->setDefaultShortcut(su, QKeySequence(Qt::SHIFT + Qt::Key_Up));
addAction(su);
QAction * sd = new QAction(i18n("Scroll Down"), this);
- ac->addAction("view_scroll_down", sd );
- connect( sd, SIGNAL(triggered()), this, SLOT(slotAutoScrollDown()) );
+ ac->addAction(QStringLiteral("view_scroll_down"), sd );
+ connect( sd, &QAction::triggered, this, &PageView::slotAutoScrollDown );
ac->setDefaultShortcut(sd, QKeySequence(Qt::SHIFT + Qt::Key_Down));
addAction(sd);
QAction * spu = new QAction(i18n("Scroll Page Up"), this);
- ac->addAction( "view_scroll_page_up", spu );
- connect( spu, SIGNAL(triggered()), this, SLOT(slotScrollUp()) );
+ ac->addAction( QStringLiteral("view_scroll_page_up"), spu );
+ connect( spu, &QAction::triggered, this, &PageView::slotScrollUp );
ac->setDefaultShortcut(spu, QKeySequence(Qt::SHIFT + Qt::Key_Space));
addAction( spu );
QAction * spd = new QAction(i18n("Scroll Page Down"), this);
- ac->addAction( "view_scroll_page_down", spd );
- connect( spd, SIGNAL(triggered()), this, SLOT(slotScrollDown()) );
+ ac->addAction( QStringLiteral("view_scroll_page_down"), spd );
+ connect( spd, &QAction::triggered, this, &PageView::slotScrollDown );
ac->setDefaultShortcut(spd, QKeySequence(Qt::Key_Space));
addAction( spd );
d->aToggleForms = new QAction( this );
- ac->addAction( "view_toggle_forms", d->aToggleForms );
- connect( d->aToggleForms, SIGNAL(triggered()), this, SLOT(slotToggleForms()) );
+ ac->addAction( QStringLiteral("view_toggle_forms"), d->aToggleForms );
+ connect( d->aToggleForms, &QAction::triggered, this, &PageView::slotToggleForms );
d->aToggleForms->setEnabled( false );
toggleFormWidgets( false );
// Setup undo and redo actions
QAction *kundo = KStandardAction::create( KStandardAction::Undo, d->document, SLOT(undo()), ac );
QAction *kredo = KStandardAction::create( KStandardAction::Redo, d->document, SLOT(redo()), ac );
- connect(d->document, SIGNAL(canUndoChanged(bool)), kundo, SLOT(setEnabled(bool)));
- connect(d->document, SIGNAL(canRedoChanged(bool)), kredo, SLOT(setEnabled(bool)));
+ connect(d->document, &Okular::Document::canUndoChanged, kundo, &QAction::setEnabled);
+ connect(d->document, &Okular::Document::canRedoChanged, kredo, &QAction::setEnabled);
kundo->setEnabled(false);
kredo->setEnabled(false);
}
@@ -753,7 +753,7 @@ void PageView::openAnnotationWindow( Okular::Annotation * annotation, int pageNu
if ( existWindow == 0 )
{
existWindow = new AnnotWindow( this, annotation, d->document, pageNumber );
- connect(existWindow, SIGNAL(destroyed(QObject*)), this, SLOT(slotAnnotationWindowDestroyed(QObject*)));
+ connect(existWindow, &QObject::destroyed, this, &PageView::slotAnnotationWindowDestroyed);
d->m_annowindows.insert( annotation, existWindow );
}
@@ -1255,8 +1255,8 @@ void PageView::slotRealNotifyViewportChanged( bool smoothMove )
if ( !d->viewportMoveTimer )
{
d->viewportMoveTimer = new QTimer( this );
- connect( d->viewportMoveTimer, SIGNAL(timeout()),
- this, SLOT(slotMoveViewport()) );
+ connect( d->viewportMoveTimer, &QTimer::timeout,
+ this, &PageView::slotMoveViewport );
}
d->viewportMoveTimer->start( 25 );
verticalScrollBar()->setEnabled( false );
@@ -2215,8 +2215,8 @@ void PageView::mousePressEvent( QMouseEvent * e )
}
- connect( &popup, SIGNAL(openAnnotationWindow(Okular::Annotation*,int)),
- this, SLOT(openAnnotationWindow(Okular::Annotation*,int)) );
+ connect( &popup, &AnnotationPopup::openAnnotationWindow,
+ this, &PageView::openAnnotationWindow );
popup.exec( e->globalPos() );
}
@@ -2517,7 +2517,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
}
QAction * actCopyLinkLocation = 0;
if ( dynamic_cast< const Okular::BrowseAction * >( link ) )
- actCopyLinkLocation = menu.addAction( QIcon::fromTheme( "edit-copy" ), i18n( "Copy Link Address" ) );
+ actCopyLinkLocation = menu.addAction( QIcon::fromTheme( QStringLiteral("edit-copy") ), i18n( "Copy Link Address" ) );
QAction * res = menu.exec( e->globalPos() );
if ( res )
{
@@ -2720,7 +2720,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
if ( d->document->supportsSearching() && !selectedText.isEmpty() )
{
menu.setTitle( i18np( "Text (1 character)", "Text (%1 characters)", selectedText.length() ) );
- textToClipboard = menu.addAction( QIcon::fromTheme("edit-copy"), i18n( "Copy to Clipboard" ) );
+ textToClipboard = menu.addAction( QIcon::fromTheme(QStringLiteral("edit-copy")), i18n( "Copy to Clipboard" ) );
bool copyAllowed = d->document->isAllowed( Okular::AllowCopy );
if ( !copyAllowed )
{
@@ -2729,7 +2729,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
}
#ifdef HAVE_SPEECH
if ( Okular::Settings::useTTS() )
- speakText = menu.addAction( QIcon::fromTheme("text-speak"), i18n( "Speak Text" ) );
+ speakText = menu.addAction( QIcon::fromTheme(QStringLiteral("text-speak")), i18n( "Speak Text" ) );
#endif
if ( copyAllowed )
{
@@ -2737,8 +2737,8 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
}
}
menu.setTitle( i18n( "Image (%1 by %2 pixels)", selectionRect.width(), selectionRect.height() ) );
- imageToClipboard = menu.addAction( QIcon::fromTheme("image-x-generic"), i18n( "Copy to Clipboard" ) );
- imageToFile = menu.addAction( QIcon::fromTheme("document-save"), i18n( "Save to File..." ) );
+ imageToClipboard = menu.addAction( QIcon::fromTheme(QStringLiteral("image-x-generic")), i18n( "Copy to Clipboard" ) );
+ imageToFile = menu.addAction( QIcon::fromTheme(QStringLiteral("document-save")), i18n( "Save to File..." ) );
QAction *choice = menu.exec( e->globalPos() );
// check if the user really selected an action
if ( choice )
@@ -2765,7 +2765,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
else if ( choice == imageToFile )
{
// [3] save pixmap to file
- QString fileName = KFileDialog::getSaveFileName( QUrl(), "image/png image/jpeg", this, QString(),
+ QString fileName = KFileDialog::getSaveFileName( QUrl(), QStringLiteral("image/png image/jpeg"), this, QString(),
KFileDialog::ConfirmOverwrite );
if ( fileName.isEmpty() )
d->messageWindow->display( i18n( "File not saved." ), QString(), PageViewMessage::Warning );
@@ -2775,7 +2775,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
QMimeType mime = db.mimeTypeForUrl( QUrl::fromLocalFile(fileName) );
QString type;
if ( !mime.isDefault() )
- type = "PNG";
+ type = QStringLiteral("PNG");
else
type = mime.name().section( '/', -1 ).toUpper();
copyPix.save( fileName, qPrintable( type ) );
@@ -2893,11 +2893,11 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
xs.append(1.0);
ys.prepend(0.0);
ys.append(1.0);
- selHtml = "<html><head>"
+ selHtml = QStringLiteral("<html><head>"
"<meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\">"
- "</head><body><table>";
+ "</head><body><table>");
for (int r=0; r+1<ys.length(); r++) {
- selHtml += "<tr>";
+ selHtml += QLatin1String("<tr>");
for (int c=0; c+1<xs.length(); c++) {
Okular::NormalizedRect cell(xs[c], ys[r], xs[c+1], ys[r+1]);
if (c) selText += '\t';
@@ -2935,16 +2935,16 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
}
QString html = txt;
selText += txt.replace('\n', ' ');
- html.replace('&', "&amp;").replace('<', "&lt;").replace('>', "&gt;");
+ html.replace('&', QLatin1String("&amp;")).replace('<', QLatin1String("&lt;")).replace('>', QLatin1String("&gt;"));
// Remove newlines, do not turn them into <br>, because
// Excel interprets <br> within cell as new cell...
- html.replace('\n', " ");
+ html.replace('\n', QLatin1String(" "));
selHtml += "<td>"+html+"</td>";
}
selText += '\n';
- selHtml += "</tr>\n";
+ selHtml += QLatin1String("</tr>\n");
}
- selHtml += "</table></body></html>\n";
+ selHtml += QLatin1String("</table></body></html>\n");
QClipboard *cb = QApplication::clipboard();
@@ -2980,12 +2980,12 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
if (item && (page = item->page())->textSelection())
{
QMenu menu( this );
- QAction *textToClipboard = menu.addAction( QIcon::fromTheme( "edit-copy" ), i18n( "Copy Text" ) );
+ QAction *textToClipboard = menu.addAction( QIcon::fromTheme( QStringLiteral("edit-copy") ), i18n( "Copy Text" ) );
QAction *httpLink = 0;
#ifdef HAVE_SPEECH
QAction *speakText = 0;
if ( Okular::Settings::useTTS() )
- speakText = menu.addAction( QIcon::fromTheme( "text-speak" ), i18n( "Speak Text" ) );
+ speakText = menu.addAction( QIcon::fromTheme( QStringLiteral("text-speak") ), i18n( "Speak Text" ) );
#endif
if ( !d->document->isAllowed( Okular::AllowCopy ) )
{
@@ -3939,7 +3939,7 @@ void PageView::updateZoomText()
// remove a trailing zero in numbers like 66.70
if ( localValue.right( 1 ) == QLatin1String( "0" ) && localValue.indexOf( QLocale().decimalPoint() ) > -1 )
localValue.chop( 1 );
- translated << QString( "%1%" ).arg( localValue );
+ translated << QStringLiteral( "%1%" ).arg( localValue );
}
d->aZoom->setItems( translated );
@@ -4231,7 +4231,7 @@ void PageView::addWebShortcutsMenu( QMenu * menu, const QString & text )
if ( !searchProviders.isEmpty() )
{
QMenu *webShortcutsMenu = new QMenu( menu );
- webShortcutsMenu->setIcon( QIcon::fromTheme( "preferences-web-browser-shortcuts" ) );
+ webShortcutsMenu->setIcon( QIcon::fromTheme( QStringLiteral("preferences-web-browser-shortcuts") ) );
const QString squeezedText = KStringHandler::rsqueeze( searchText, 21 );
webShortcutsMenu->setTitle( i18n( "Search for '%1' with", squeezedText ) );
@@ -4243,15 +4243,15 @@ void PageView::addWebShortcutsMenu( QMenu * menu, const QString & text )
action = new QAction( searchProvider, webShortcutsMenu );
action->setIcon( QIcon::fromTheme( filterData.iconNameForPreferredSearchProvider( searchProvider ) ) );
action->setData( filterData.queryForPreferredSearchProvider( searchProvider ) );
- connect( action, SIGNAL(triggered()), this, SLOT(slotHandleWebShortcutAction()) );
+ connect( action, &QAction::triggered, this, &PageView::slotHandleWebShortcutAction );
webShortcutsMenu->addAction( action );
}
webShortcutsMenu->addSeparator();
action = new QAction( i18n( "Configure Web Shortcuts..." ), webShortcutsMenu );
- action->setIcon( QIcon::fromTheme( "configure" ) );
- connect( action, SIGNAL(triggered()), this, SLOT(slotConfigureWebShortcuts()) );
+ action->setIcon( QIcon::fromTheme( QStringLiteral("configure") ) );
+ connect( action, &QAction::triggered, this, &PageView::slotConfigureWebShortcuts );
webShortcutsMenu->addAction( action );
menu->addMenu(webShortcutsMenu);
@@ -4713,7 +4713,7 @@ void PageView::slotAutoScoll()
{
d->autoScrollTimer = new QTimer( this );
d->autoScrollTimer->setSingleShot( true );
- connect( d->autoScrollTimer, SIGNAL(timeout()), this, SLOT(slotAutoScoll()) );
+ connect( d->autoScrollTimer, &QTimer::timeout, this, &PageView::slotAutoScoll );
}
// if scrollIncrement is zero, stop the timer
@@ -4769,7 +4769,7 @@ void PageView::slotHandleWebShortcutAction()
void PageView::slotConfigureWebShortcuts()
{
- KToolInvocation::kdeinitExec( "kcmshell4", QStringList() << "ebrowsing" );
+ KToolInvocation::kdeinitExec( QStringLiteral("kcmshell4"), QStringList() << QStringLiteral("ebrowsing") );
}
void PageView::slotZoom()
@@ -5155,8 +5155,8 @@ void PageView::slotFormChanged( int pageNumber )
{
d->refreshTimer = new QTimer( this );
d->refreshTimer->setSingleShot( true );
- connect( d->refreshTimer, SIGNAL( timeout() ),
- this, SLOT( slotRefreshPage() ) );
+ connect( d->refreshTimer, &QTimer::timeout,
+ this, &PageView::slotRefreshPage );
}
d->refreshPage = pageNumber;
int delay = 0;
diff --git a/ui/pageviewannotator.cpp b/ui/pageviewannotator.cpp
index ead7bfb..df41dd4 100644
--- a/ui/pageviewannotator.cpp
+++ b/ui/pageviewannotator.cpp
@@ -51,16 +51,16 @@ class PickPointEngine : public AnnotatorEngine
xscale( 1.0 ), yscale( 1.0 )
{
// parse engine specific attributes
- hoverIconName = engineElement.attribute( "hoverIcon" );
- iconName = m_annotElement.attribute( "icon" );
- if ( m_annotElement.attribute( "type" ) == "Stamp" && !iconName.simplified().isEmpty() )
+ hoverIconName = engineElement.attribute( QStringLiteral("hoverIcon") );
+ iconName = m_annotElement.attribute( QStringLiteral("icon") );
+ if ( m_annotElement.attribute( QStringLiteral("type") ) == QLatin1String("Stamp") && !iconName.simplified().isEmpty() )
hoverIconName = iconName;
- center = QVariant( engineElement.attribute( "center" ) ).toBool();
+ center = QVariant( engineElement.attribute( QStringLiteral("center") ) ).toBool();
bool ok = true;
- size = engineElement.attribute( "size", "32" ).toInt( &ok );
+ size = engineElement.attribute( QStringLiteral("size"), QStringLiteral("32") ).toInt( &ok );
if ( !ok )
size = 32;
- m_block = QVariant( engineElement.attribute( "block" ) ).toBool();
+ m_block = QVariant( engineElement.attribute( QStringLiteral("block") ) ).toBool();
// create engine objects
if ( !hoverIconName.simplified().isEmpty() )
@@ -157,9 +157,9 @@ class PickPointEngine : public AnnotatorEngine
// find out annotation's type
Okular::Annotation * ann = 0;
- const QString typeString = m_annotElement.attribute( "type" );
+ const QString typeString = m_annotElement.attribute( QStringLiteral("type") );
// create TextAnnotation from path
- if ( typeString == "FreeText") //<annotation type="Text"
+ if ( typeString == QLatin1String("FreeText")) //<annotation type="Text"
{
//note dialog
const QString prompt = i18n( "Text of the new note:" );
@@ -174,13 +174,13 @@ class PickPointEngine : public AnnotatorEngine
ta->setContents( note );
ta->setTextType( Okular::TextAnnotation::InPlace );
//set alignment
- if ( m_annotElement.hasAttribute( "align" ) )
- ta->setInplaceAlignment( m_annotElement.attribute( "align" ).toInt() );
+ if ( m_annotElement.hasAttribute( QStringLiteral("align") ) )
+ ta->setInplaceAlignment( m_annotElement.attribute( QStringLiteral("align") ).toInt() );
//set font
- if ( m_annotElement.hasAttribute( "font" ) )
+ if ( m_annotElement.hasAttribute( QStringLiteral("font") ) )
{
QFont f;
- f.fromString( m_annotElement.attribute( "font" ) );
+ f.fromString( m_annotElement.attribute( QStringLiteral("font") ) );
ta->setTextFont( f );
}
//set boundary
@@ -198,7 +198,7 @@ class PickPointEngine : public AnnotatorEngine
ta->window().setSummary( i18n( "Inline Note" ) );
}
}
- else if ( typeString == "Text")
+ else if ( typeString == QLatin1String("Text"))
{
Okular::TextAnnotation * ta = new Okular::TextAnnotation();
ann = ta;
@@ -213,7 +213,7 @@ class PickPointEngine : public AnnotatorEngine
ta->window().setSummary( i18n( "Pop-up Note" ) );
}
// create StampAnnotation from path
- else if ( typeString == "Stamp" )
+ else if ( typeString == QLatin1String("Stamp") )
{
Okular::StampAnnotation * sa = new Okular::StampAnnotation();
ann = sa;
@@ -244,19 +244,19 @@ class PickPointEngine : public AnnotatorEngine
}
}
// create GeomAnnotation
- else if ( typeString == "GeomSquare" || typeString == "GeomCircle" )
+ else if ( typeString == QLatin1String("GeomSquare") || typeString == QLatin1String("GeomCircle") )
{
Okular::GeomAnnotation * ga = new Okular::GeomAnnotation();
ann = ga;
// set the type
- if ( typeString == "GeomSquare" )
+ if ( typeString == QLatin1String("GeomSquare") )
ga->setGeometricalType( Okular::GeomAnnotation::InscribedSquare );
else
ga->setGeometricalType( Okular::GeomAnnotation::InscribedCircle );
- if ( m_annotElement.hasAttribute( "width" ) )
- ann->style().setWidth( m_annotElement.attribute( "width" ).toDouble() );
- if ( m_annotElement.hasAttribute( "innerColor" ) )
- ga->setGeometricalInnerColor( QColor( m_annotElement.attribute( "innerColor" ) ) );
+ if ( m_annotElement.hasAttribute( QStringLiteral("width") ) )
+ ann->style().setWidth( m_annotElement.attribute( QStringLiteral("width") ).toDouble() );
+ if ( m_annotElement.hasAttribute( QStringLiteral("innerColor") ) )
+ ga->setGeometricalInnerColor( QColor( m_annotElement.attribute( QStringLiteral("innerColor") ) ) );
//set boundary
rect.left = qMin( startpoint.x, point.x );
rect.top = qMin( startpoint.y, point.y );
@@ -272,10 +272,10 @@ class PickPointEngine : public AnnotatorEngine
return QList< Okular::Annotation* >();
// set common attributes
- ann->style().setColor( m_annotElement.hasAttribute( "color" ) ?
- m_annotElement.attribute( "color" ) : m_engineColor );
- if ( m_annotElement.hasAttribute( "opacity" ) )
- ann->style().setOpacity( m_annotElement.attribute( "opacity", "1.0" ).toDouble() );
+ ann->style().setColor( m_annotElement.hasAttribute( QStringLiteral("color") ) ?
+ m_annotElement.attribute( QStringLiteral("color") ) : m_engineColor );
+ if ( m_annotElement.hasAttribute( QStringLiteral("opacity") ) )
+ ann->style().setOpacity( m_annotElement.attribute( QStringLiteral("opacity"), QStringLiteral("1.0") ).toDouble() );
// set the bounding rectangle, and make sure that the newly created
// annotation lies within the page by translating it if necessary
@@ -317,14 +317,14 @@ class PolyLineEngine : public AnnotatorEngine
: AnnotatorEngine( engineElement ), last( false )
{
// parse engine specific attributes
- m_block = engineElement.attribute( "block" ) == "true";
+ m_block = engineElement.attribute( QStringLiteral("block") ) == QLatin1String("true");
bool ok = true;
// numofpoints represents the max number of points for the current
// polygon/polyline, with a pair of exceptions:
// -1 means: the polyline must close on the first point (polygon)
// 0 means: construct as many points as you want, right-click
// to construct the last point
- numofpoints = engineElement.attribute( "points" ).toInt( &ok );
+ numofpoints = engineElement.attribute( QStringLiteral("points") ).toInt( &ok );
if ( !ok )
numofpoints = -1;
}
@@ -416,10 +416,10 @@ class PolyLineEngine : public AnnotatorEngine
// find out annotation's type
Okular::Annotation * ann = 0;
- const QString typeString = m_annotElement.attribute( "type" );
+ const QString typeString = m_annotElement.attribute( QStringLiteral("type") );
// create LineAnnotation from path
- if ( typeString == "Line" || typeString == "Polyline" || typeString == "Polygon" )
+ if ( typeString == QLatin1String("Line") || typeString == QLatin1String("Polyline") || typeString == QLatin1String("Polygon") )
{
if ( points.count() < 2 )
return QList< Okular::Annotation* >();
@@ -436,15 +436,15 @@ class PolyLineEngine : public AnnotatorEngine
if ( numofpoints == -1 )
{
la->setLineClosed( true );
- if ( m_annotElement.hasAttribute( "innerColor" ) )
- la->setLineInnerColor( QColor( m_annotElement.attribute( "innerColor" ) ) );
+ if ( m_annotElement.hasAttribute( QStringLiteral("innerColor") ) )
+ la->setLineInnerColor( QColor( m_annotElement.attribute( QStringLiteral("innerColor") ) ) );
}
else if ( numofpoints == 2 )
{
- if ( m_annotElement.hasAttribute( "leadFwd" ) )
- la->setLineLeadingForwardPoint( m_annotElement.attribute( "leadFwd" ).toDouble() );
- if ( m_annotElement.hasAttribute( "leadBack" ) )
- la->setLineLeadingBackwardPoint( m_annotElement.attribute( "leadBack" ).toDouble() );
+ if ( m_annotElement.hasAttribute( QStringLiteral("leadFwd") ) )
+ la->setLineLeadingForwardPoint( m_annotElement.attribute( QStringLiteral("leadFwd") ).toDouble() );
+ if ( m_annotElement.hasAttribute( QStringLiteral("leadBack") ) )
+ la->setLineLeadingBackwardPoint( m_annotElement.attribute( QStringLiteral("leadBack") ).toDouble() );
}
la->setBoundingRectangle( normRect );
@@ -455,14 +455,14 @@ class PolyLineEngine : public AnnotatorEngine
if ( !ann )
return QList< Okular::Annotation* >();
- if ( m_annotElement.hasAttribute( "width" ) )
- ann->style().setWidth( m_annotElement.attribute( "width" ).toDouble() );
+ if ( m_annotElement.hasAttribute( QStringLiteral("width") ) )
+ ann->style().setWidth( m_annotElement.attribute( QStringLiteral("width") ).toDouble() );
// set common attributes
- ann->style().setColor( m_annotElement.hasAttribute( "color" ) ?
- m_annotElement.attribute( "color" ) : m_engineColor );
- if ( m_annotElement.hasAttribute( "opacity" ) )
- ann->style().setOpacity( m_annotElement.attribute( "opacity", "1.0" ).toDouble() );
+ ann->style().setColor( m_annotElement.hasAttribute( QStringLiteral("color") ) ?
+ m_annotElement.attribute( QStringLiteral("color") ) : m_engineColor );
+ if ( m_annotElement.hasAttribute( QStringLiteral("opacity") ) )
+ ann->style().setOpacity( m_annotElement.attribute( QStringLiteral("opacity"), QStringLiteral("1.0") ).toDouble() );
// return annotation
return QList< Okular::Annotation* >() << ann;
@@ -571,27 +571,27 @@ class TextSelectorEngine : public AnnotatorEngine
// find out annotation's type
Okular::Annotation * ann = 0;
- const QString typeString = m_annotElement.attribute( "type" );
+ const QString typeString = m_annotElement.attribute( QStringLiteral("type") );
Okular::HighlightAnnotation::HighlightType type = Okular::HighlightAnnotation::Highlight;
bool typevalid = false;
// create HighlightAnnotation's from the selected area
- if ( typeString == "Highlight" )
+ if ( typeString == QLatin1String("Highlight") )
{
type = Okular::HighlightAnnotation::Highlight;
typevalid = true;
}
- else if ( typeString == "Squiggly" )
+ else if ( typeString == QLatin1String("Squiggly") )
{
type = Okular::HighlightAnnotation::Squiggly;
typevalid = true;
}
- else if ( typeString == "Underline" )
+ else if ( typeString == QLatin1String("Underline") )
{
type = Okular::HighlightAnnotation::Underline;
typevalid = true;
}
- else if ( typeString == "StrikeOut" )
+ else if ( typeString == QLatin1String("StrikeOut") )
{
type = Okular::HighlightAnnotation::StrikeOut;
typevalid = true;
@@ -624,10 +624,10 @@ class TextSelectorEngine : public AnnotatorEngine
return QList< Okular::Annotation* >();
// set common attributes
- ann->style().setColor( m_annotElement.hasAttribute( "color" ) ?
- m_annotElement.attribute( "color" ) : m_engineColor );
- if ( m_annotElement.hasAttribute( "opacity" ) )
- ann->style().setOpacity( m_annotElement.attribute( "opacity", "1.0" ).toDouble() );
+ ann->style().setColor( m_annotElement.hasAttribute( QStringLiteral("color") ) ?
+ m_annotElement.attribute( QStringLiteral("color") ) : m_engineColor );
+ if ( m_annotElement.hasAttribute( QStringLiteral("opacity") ) )
+ ann->style().setOpacity( m_annotElement.attribute( QStringLiteral("opacity"), QStringLiteral("1.0") ).toDouble() );
// return annotations
return QList< Okular::Annotation* >() << ann;
@@ -667,7 +667,7 @@ void PageViewAnnotator::reparseConfig()
// Populate m_toolsDefinition
QDomDocument doc;
- m_toolsDefinition = doc.createElement( "annotatingTools" );
+ m_toolsDefinition = doc.createElement( QStringLiteral("annotatingTools") );
foreach ( const QString &toolXml, userTools )
{
QDomDocument entryParser;
@@ -682,24 +682,24 @@ void PageViewAnnotator::reparseConfig()
while ( toolDescription.isElement() )
{
QDomElement toolElement = toolDescription.toElement();
- if ( toolElement.tagName() == "tool" )
+ if ( toolElement.tagName() == QLatin1String("tool") )
{
AnnotationToolItem item;
- item.id = toolElement.attribute("id").toInt();
- if ( toolElement.hasAttribute( "name" ) )
- item.text = toolElement.attribute( "name" );
+ item.id = toolElement.attribute(QStringLiteral("id")).toInt();
+ if ( toolElement.hasAttribute( QStringLiteral("name") ) )
+ item.text = toolElement.attribute( QStringLiteral("name") );
else
item.text = defaultToolName( toolElement );
item.pixmap = makeToolPixmap( toolElement );
- QDomNode shortcutNode = toolElement.elementsByTagName( "shortcut" ).item( 0 );
+ QDomNode shortcutNode = toolElement.elementsByTagName( QStringLiteral("shortcut") ).item( 0 );
if ( shortcutNode.isElement() )
item.shortcut = shortcutNode.toElement().text();
- QDomNodeList engineNodeList = toolElement.elementsByTagName( "engine" );
+ QDomNodeList engineNodeList = toolElement.elementsByTagName( QStringLiteral("engine") );
if ( engineNodeList.size() > 0 )
{
QDomElement engineEl = engineNodeList.item( 0 ).toElement();
- if ( !engineEl.isNull() && engineEl.hasAttribute( "type" ) )
- item.isText = engineEl.attribute( "type" ) == QLatin1String( "TextSelector" );
+ if ( !engineEl.isNull() && engineEl.hasAttribute( QStringLiteral("type") ) )
+ item.isText = engineEl.attribute( QStringLiteral("type") ) == QLatin1String( "TextSelector" );
}
m_items.push_back( item );
}
@@ -985,7 +985,7 @@ void PageViewAnnotator::slotToolSelected( int toolID )
toolNode = toolNode.nextSibling();
// only find out the element describing selected tool
- if ( toolElement.tagName() != "tool" || toolElement.attribute("id").toInt() != toolID )
+ if ( toolElement.tagName() != QLatin1String("tool") || toolElement.attribute(QStringLiteral("id")).toInt() != toolID )
continue;
// parse tool properties
@@ -996,48 +996,48 @@ void PageViewAnnotator::slotToolSelected( int toolID )
toolSubNode = toolSubNode.nextSibling();
// create the AnnotatorEngine
- if ( toolSubElement.tagName() == "engine" )
+ if ( toolSubElement.tagName() == QLatin1String("engine") )
{
- QString type = toolSubElement.attribute( "type" );
- if ( type == "SmoothLine" )
+ QString type = toolSubElement.attribute( QStringLiteral("type") );
+ if ( type == QLatin1String("SmoothLine") )
m_engine = new SmoothPathEngine( toolSubElement );
- else if ( type == "PickPoint" )
+ else if ( type == QLatin1String("PickPoint") )
m_engine = new PickPointEngine( toolSubElement );
- else if ( type == "PolyLine" )
+ else if ( type == QLatin1String("PolyLine") )
m_engine = new PolyLineEngine( toolSubElement );
- else if ( type == "TextSelector" )
+ else if ( type == QLatin1String("TextSelector") )
m_engine = new TextSelectorEngine( toolSubElement, m_pageView );
else
qCWarning(OkularUiDebug).nospace() << "tools.xml: engine type:'" << type << "' is not defined!";
}
// display the tooltip
- const QString annotType = toolElement.attribute( "type" );
+ const QString annotType = toolElement.attribute( QStringLiteral("type") );
QString tip;
- if ( annotType == "ellipse" )
+ if ( annotType == QLatin1String("ellipse") )
tip = i18nc( "Annotation tool", "Draw an ellipse (drag to select a zone)" );
- else if ( annotType == "highlight" )
+ else if ( annotType == QLatin1String("highlight") )
tip = i18nc( "Annotation tool", "Highlight text" );
- else if ( annotType == "ink" )
+ else if ( annotType == QLatin1String("ink") )
tip = i18nc( "Annotation tool", "Draw a freehand line" );
- else if ( annotType == "note-inline" )
+ else if ( annotType == QLatin1String("note-inline") )
tip = i18nc( "Annotation tool", "Inline Text Annotation (drag to select a zone)" );
- else if ( annotType == "note-linked" )
+ else if ( annotType == QLatin1String("note-linked") )
tip = i18nc( "Annotation tool", "Put a pop-up note" );
- else if ( annotType == "polygon" )
+ else if ( annotType == QLatin1String("polygon") )
tip = i18nc( "Annotation tool", "Draw a polygon (click on the first point to close it)" );
- else if ( annotType == "rectangle" )
+ else if ( annotType == QLatin1String("rectangle") )
tip = i18nc( "Annotation tool", "Draw a rectangle" );
- else if ( annotType == "squiggly" )
+ else if ( annotType == QLatin1String("squiggly") )
tip = i18nc( "Annotation tool", "Squiggle text" );
- else if ( annotType == "stamp" )
+ else if ( annotType == QLatin1String("stamp") )
tip = i18nc( "Annotation tool", "Put a stamp symbol" );
- else if ( annotType == "straight-line" )
+ else if ( annotType == QLatin1String("straight-line") )
tip = i18nc( "Annotation tool", "Draw a straight line" );
- else if ( annotType == "strikeout" )
+ else if ( annotType == QLatin1String("strikeout") )
tip = i18nc( "Annotation tool", "Strike out text" );
- else if ( annotType == "underline" )
+ else if ( annotType == QLatin1String("underline") )
tip = i18nc( "Annotation tool", "Underline text" );
if ( !tip.isEmpty() && !m_continuousMode )
@@ -1074,31 +1074,31 @@ void PageViewAnnotator::detachAnnotation()
QString PageViewAnnotator::defaultToolName( const QDomElement &toolElement )
{
- const QString annotType = toolElement.attribute( "type" );
+ const QString annotType = toolElement.attribute( QStringLiteral("type") );
- if ( annotType == "ellipse" )
+ if ( annotType == QLatin1String("ellipse") )
return i18n( "Ellipse" );
- else if ( annotType == "highlight" )
+ else if ( annotType == QLatin1String("highlight") )
return i18n( "Highlighter" );
- else if ( annotType == "ink" )
+ else if ( annotType == QLatin1String("ink") )
return i18n( "Freehand Line" );
- else if ( annotType == "note-inline" )
+ else if ( annotType == QLatin1String("note-inline") )
return i18n( "Inline Note" );
- else if ( annotType == "note-linked" )
+ else if ( annotType == QLatin1String("note-linked") )
return i18n( "Pop-up Note" );
- else if ( annotType == "polygon" )
+ else if ( annotType == QLatin1String("polygon") )
return i18n( "Polygon" );
- else if ( annotType == "rectangle" )
+ else if ( annotType == QLatin1String("rectangle") )
return i18n( "Rectangle" );
- else if ( annotType == "squiggly" )
+ else if ( annotType == QLatin1String("squiggly") )
return i18n( "Squiggle" );
- else if ( annotType == "stamp" )
+ else if ( annotType == QLatin1String("stamp") )
return i18n( "Stamp" );
- else if ( annotType == "straight-line" )
+ else if ( annotType == QLatin1String("straight-line") )
return i18n( "Straight Line" );
- else if ( annotType == "strikeout" )
+ else if ( annotType == QLatin1String("strikeout") )
return i18n( "Strike out" );
- else if ( annotType == "underline" )
+ else if ( annotType == QLatin1String("underline") )
return i18n( "Underline" );
else
return QString();
@@ -1107,34 +1107,34 @@ QString PageViewAnnotator::defaultToolName( const QDomElement &toolElement )
QPixmap PageViewAnnotator::makeToolPixmap( const QDomElement &toolElement )
{
QPixmap pixmap( 32, 32 );
- const QString annotType = toolElement.attribute( "type" );
+ const QString annotType = toolElement.attribute( QStringLiteral("type") );
// Load base pixmap. We'll draw on top of it
- pixmap.load( QStandardPaths::locate(QStandardPaths::GenericDataLocation, "okular/pics/tool-base-okular.png" ) );
+ pixmap.load( QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("okular/pics/tool-base-okular.png") ) );
/* Parse color, innerColor and icon (if present) */
QColor engineColor, innerColor;
QString icon;
- QDomNodeList engineNodeList = toolElement.elementsByTagName( "engine" );
+ QDomNodeList engineNodeList = toolElement.elementsByTagName( QStringLiteral("engine") );
if ( engineNodeList.size() > 0 )
{
QDomElement engineEl = engineNodeList.item( 0 ).toElement();
- if ( !engineEl.isNull() && engineEl.hasAttribute( "color" ) )
- engineColor = QColor( engineEl.attribute( "color" ) );
+ if ( !engineEl.isNull() && engineEl.hasAttribute( QStringLiteral("color") ) )
+ engineColor = QColor( engineEl.attribute( QStringLiteral("color") ) );
}
- QDomNodeList annotationNodeList = toolElement.elementsByTagName( "annotation" );
+ QDomNodeList annotationNodeList = toolElement.elementsByTagName( QStringLiteral("annotation") );
if ( annotationNodeList.size() > 0 )
{
QDomElement annotationEl = annotationNodeList.item( 0 ).toElement();
- if ( !annotationEl.isNull() && annotationEl.hasAttribute( "innerColor" ) )
- innerColor = QColor( annotationEl.attribute( "innerColor" ) );
- if ( !annotationEl.isNull() && annotationEl.hasAttribute( "icon" ) )
- icon = annotationEl.attribute( "icon" );
+ if ( !annotationEl.isNull() && annotationEl.hasAttribute( QStringLiteral("innerColor") ) )
+ innerColor = QColor( annotationEl.attribute( QStringLiteral("innerColor") ) );
+ if ( !annotationEl.isNull() && annotationEl.hasAttribute( QStringLiteral("icon") ) )
+ icon = annotationEl.attribute( QStringLiteral("icon") );
}
QPainter p( &pixmap );
- if ( annotType == "ellipse" )
+ if ( annotType == QLatin1String("ellipse") )
{
p.setRenderHint( QPainter::Antialiasing );
if ( innerColor.isValid() )
@@ -1142,9 +1142,9 @@ QPixmap PageViewAnnotator::makeToolPixmap( const QDomElement &toolElement )
p.setPen( QPen( engineColor, 2 ) );
p.drawEllipse( 2, 7, 21, 14 );
}
- else if ( annotType == "highlight" )
+ else if ( annotType == QLatin1String("highlight") )
{
- QImage overlay( QStandardPaths::locate(QStandardPaths::GenericDataLocation, "okular/pics/tool-highlighter-okular-colorizable.png" ) );
+ QImage overlay( QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("okular/pics/tool-highlighter-okular-colorizable.png") ) );
QImage colorizedOverlay = overlay;
GuiUtils::colorizeImage( colorizedOverlay, engineColor );
@@ -1152,9 +1152,9 @@ QPixmap PageViewAnnotator::makeToolPixmap( const QDomElement &toolElement )
p.drawImage( QPoint(0,-32), overlay ); // Text + Shadow (uncolorized)
p.drawImage( QPoint(0,-64), colorizedOverlay ); // Pen
}
- else if ( annotType == "ink" )
+ else if ( annotType == QLatin1String("ink") )
{
- QImage overlay( QStandardPaths::locate(QStandardPaths::GenericDataLocation, "okular/pics/tool-ink-okular-colorizable.png" ) );
+ QImage overlay( QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("okular/pics/tool-ink-okular-colorizable.png") ) );
QImage colorizedOverlay = overlay;
GuiUtils::colorizeImage( colorizedOverlay, engineColor );
@@ -1162,19 +1162,19 @@ QPixmap PageViewAnnotator::makeToolPixmap( const QDomElement &toolElement )
p.drawImage( QPoint(0,-32), overlay ); // Shadow (uncolorized)
p.drawImage( QPoint(0,-64), colorizedOverlay ); // Pen
}
- else if ( annotType == "note-inline" )
+ else if ( annotType == QLatin1String("note-inline") )
{
- QImage overlay( QStandardPaths::locate(QStandardPaths::GenericDataLocation, "okular/pics/tool-note-inline-okular-colorizable.png" ) );
+ QImage overlay( QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("okular/pics/tool-note-inline-okular-colorizable.png") ) );
GuiUtils::colorizeImage( overlay, engineColor );
p.drawImage( QPoint(0,0), overlay );
}
- else if ( annotType == "note-linked" )
+ else if ( annotType == QLatin1String("note-linked") )
{
- QImage overlay( QStandardPaths::locate(QStandardPaths::GenericDataLocation, "okular/pics/tool-note-okular-colorizable.png" ) );
+ QImage overlay( QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("okular/pics/tool-note-okular-colorizable.png") ) );
GuiUtils::colorizeImage( overlay, engineColor );
p.drawImage( QPoint(0,0), overlay );
}
- else if ( annotType == "polygon" )
+ else if ( annotType == QLatin1String("polygon") )
{
QPainterPath path;
path.moveTo( 0, 7 );
@@ -1188,7 +1188,7 @@ QPixmap PageViewAnnotator::makeToolPixmap( const QDomElement &toolElement )
p.setPen( QPen( engineColor, 1 ) );
p.drawPath( path );
}
- else if ( annotType == "rectangle" )
+ else if ( annotType == QLatin1String("rectangle") )
{
p.setRenderHint( QPainter::Antialiasing );
if ( innerColor.isValid() )
@@ -1196,7 +1196,7 @@ QPixmap PageViewAnnotator::makeToolPixmap( const QDomElement &toolElement )
p.setPen( QPen( engineColor, 2 ) );
p.drawRect( 2, 7, 21, 14 );
}
- else if ( annotType == "squiggly" )
+ else if ( annotType == QLatin1String("squiggly") )
{
QPen pen( engineColor, 1 );
pen.setDashPattern( QVector<qreal>() << 1 << 1 );
@@ -1206,13 +1206,13 @@ QPixmap PageViewAnnotator::makeToolPixmap( const QDomElement &toolElement )
p.drawLine( 0, 20, 19, 20 );
p.drawLine( 1, 21, 18, 21 );
}
- else if ( annotType == "stamp" )
+ else if ( annotType == QLatin1String("stamp") )
{
QPixmap stamp = GuiUtils::loadStamp( icon, QSize( 16, 16 ) );
p.setRenderHint( QPainter::Antialiasing );
p.drawPixmap( 16, 14, stamp );
}
- else if ( annotType == "straight-line" )
+ else if ( annotType == QLatin1String("straight-line") )
{
QPainterPath path;
path.moveTo( 1, 8 );