Commit cb691f70 authored by Laurent Montel's avatar Laurent Montel 😁

Fix some clazy warning

Summary: fix clazy warning

Reviewers: aacid

Reviewed By: aacid

Subscribers: nicolasfella, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D20832
parent b1c30cd0
......@@ -73,7 +73,7 @@ void DocumentTest::testCloseDuringRotationJob()
// the document without migrating and that it does get wiped out after migrating
void DocumentTest::testDocdataMigration()
{
Okular::SettingsCore::instance( "documenttest" );
Okular::SettingsCore::instance( QStringLiteral("documenttest") );
const QUrl testFileUrl = QUrl::fromLocalFile(KDESRCDIR "data/file1.pdf");
const QString testFilePath = testFileUrl.toLocalFile();
......@@ -106,7 +106,7 @@ void DocumentTest::testDocdataMigration()
QCOMPARE( m_document->isDocdataMigrationNeeded(), true );
// Do the migration
QTemporaryFile migratedSaveFile( QString( "%1/okrXXXXXX.pdf" ).arg( QDir::tempPath() ) );
QTemporaryFile migratedSaveFile( QStringLiteral( "%1/okrXXXXXX.pdf" ).arg( QDir::tempPath() ) );
QVERIFY( migratedSaveFile.open() );
migratedSaveFile.close();
QVERIFY( m_document->saveChanges( migratedSaveFile.fileName() ) );
......
......@@ -203,7 +203,7 @@ void MainShellTest::testShell_data()
QTest::newRow("two files sequence with tabs") << file1 << QString() << true << tocReload << 0u << false << false << false << 0u << false << false << QString();
QTest::newRow("open file page number") << contentsEpub << optionsPage2 << false << QString() << 1u << false << false << false << 0u << false << false << QString();
QTest::newRow("open file page number and presentation") << contentsEpub << optionsPage2Presentation << false << QString() << 1u << true << false << false << 0u << false << false << QString();
QTest::newRow("open file find") << file1 << optionsFind << false << QString() << 0u << false << false << false << 0u << false << false << QString("si:next-testing parameters!");
QTest::newRow("open file find") << file1 << optionsFind << false << QString() << 0u << false << false << false << 0u << false << false << QStringLiteral("si:next-testing parameters!");
QTest::newRow("open file print") << file1 << optionsPrint << false << QString() << 0u << false << true << false << 0u << false << false << QString();
QTest::newRow("open two files unique") << file1 << optionsUnique << false << tocReload << 0u << false << false << true << 0u << false << false << QString();
QTest::newRow("open two files unique tabs") << file1 << optionsUnique << true << tocReload << 0u << false << false << true << 0u << false << false << QString();
......
This diff is collapsed.
......@@ -168,7 +168,7 @@ void SearchTest::test311232()
{
Okular::Document d(nullptr);
SearchFinishedReceiver receiver;
QSignalSpy spy(&d, SIGNAL(searchFinished(int,Okular::Document::SearchStatus)));
QSignalSpy spy(&d, &Okular::Document::searchFinished);
QObject::connect(&d, SIGNAL(searchFinished(int,Okular::Document::SearchStatus)), &receiver, SLOT(searchFinished(int,Okular::Document::SearchStatus)));
......@@ -243,14 +243,14 @@ void SearchTest::testDottedI()
//the Unicode case-folding rules http://www.unicode.org/Public/6.2.0/ucd/CaseFolding.txt).
QVector<QString> text;
text << QString::fromUtf8("İ");
text << QStringLiteral("İ");
QVector<Okular::NormalizedRect> rect;
rect << Okular::NormalizedRect(1, 2, 3, 4);
CREATE_PAGE;
Okular::RegularAreaRect* result = tp->findText(0, QString::fromUtf8("İ"), Okular::FromTop, Qt::CaseInsensitive, nullptr);
Okular::RegularAreaRect* result = tp->findText(0, QStringLiteral("İ"), Okular::FromTop, Qt::CaseInsensitive, nullptr);
QVERIFY(result);
delete result;
......
......@@ -122,7 +122,7 @@ void VisibilityTest::testSaveLoad()
verifyTargetStates( false );
// Save the changed states
QTemporaryFile saveFile( QString( "%1/okrXXXXXX.pdf" ).arg( QDir::tempPath() ) );
QTemporaryFile saveFile( QStringLiteral( "%1/okrXXXXXX.pdf" ).arg( QDir::tempPath() ) );
QVERIFY( saveFile.open() );
saveFile.close();
......
......@@ -1113,7 +1113,7 @@ void DocumentPrivate::performSetAnnotationContents( const QString & newContents,
void DocumentPrivate::recalculateForms()
{
const QVariant fco = m_parent->metaData(QLatin1String("FormCalculateOrder"));
const QVariant fco = m_parent->metaData(QStringLiteral("FormCalculateOrder"));
const QVector<int> formCalculateOrder = fco.value<QVector<int>>();
foreach(int formId, formCalculateOrder) {
for ( uint pageIdx = 0; pageIdx < m_parent->pages(); pageIdx++ )
......@@ -1196,7 +1196,7 @@ void DocumentPrivate::saveDocumentInfo() const
// -> do this if there are not-yet-migrated annots or forms in docdata/
if ( m_docdataMigrationNeeded )
{
QDomElement pageList = doc.createElement( "pageList" );
QDomElement pageList = doc.createElement( QStringLiteral("pageList") );
root.appendChild( pageList );
// OriginalAnnotationPageItems and OriginalFormFieldPageItems tell to
// store the same unmodified annotation list and form contents that we
......@@ -2281,7 +2281,7 @@ QVector<KPluginMetaData> DocumentPrivate::availableGenerators()
static QVector<KPluginMetaData> result;
if (result.isEmpty())
{
result = KPluginLoader::findPlugins( QLatin1String ( "okular/generators" ) );
result = KPluginLoader::findPlugins( QStringLiteral ( "okular/generators" ) );
}
return result;
}
......@@ -2365,7 +2365,7 @@ Document::OpenResult Document::openDocument(const QString & docFile, const QUrl
if (url.scheme() == QLatin1String("fd"))
{
bool ok;
fd = url.path().mid(1).toInt(&ok);
fd = url.path().midRef(1).toInt(&ok);
if (!ok)
{
return OpenError;
......@@ -4230,7 +4230,7 @@ void Document::processAction( const Action * action )
const QUrl url = browse->url();
// fix for #100366, documents with relative links that are the form of http:foo.pdf
if ((url.scheme() == "http") && url.host().isEmpty() && url.fileName().endsWith("pdf"))
if ((url.scheme() == QLatin1String("http")) && url.host().isEmpty() && url.fileName().endsWith(QLatin1String("pdf")))
{
d->openRelativeFile(url.fileName());
break;
......
......@@ -156,8 +156,8 @@ bool RemoveAnnotationCommand::refreshInternalPageReferences( const QVector< Okul
ModifyAnnotationPropertiesCommand::ModifyAnnotationPropertiesCommand( DocumentPrivate* docPriv,
Annotation* annotation,
int pageNumber,
QDomNode oldProperties,
QDomNode newProperties )
const QDomNode &oldProperties,
const QDomNode &newProperties )
: m_docPriv( docPriv ),
m_annotation( annotation ),
m_pageNumber( pageNumber ),
......
......@@ -76,8 +76,8 @@ class ModifyAnnotationPropertiesCommand : public OkularUndoCommand
public:
ModifyAnnotationPropertiesCommand( Okular::DocumentPrivate* docPriv, Okular::Annotation* annotation,
int pageNumber,
QDomNode oldProperties,
QDomNode newProperties );
const QDomNode &oldProperties,
const QDomNode &newProperties );
void undo() override;
void redo() override;
......
......@@ -31,7 +31,7 @@
using namespace Okular;
int FilePrinter::printFile( QPrinter &printer, const QString file,
int FilePrinter::printFile(QPrinter &printer, const QString file,
QPrinter::Orientation documentOrientation, FileDeletePolicy fileDeletePolicy,
PageSelectPolicy pageSelectPolicy, const QString &pageRange )
{
......@@ -39,7 +39,7 @@ int FilePrinter::printFile( QPrinter &printer, const QString file,
pageSelectPolicy, pageRange, ScaleMode::FitToPrintArea );
}
int FilePrinter::printFile( QPrinter &printer, const QString file,
int FilePrinter::printFile(QPrinter &printer, const QString file,
QPrinter::Orientation documentOrientation,
FileDeletePolicy fileDeletePolicy, PageSelectPolicy pageSelectPolicy,
const QString &pageRange, ScaleMode scaleMode )
......@@ -49,7 +49,7 @@ int FilePrinter::printFile( QPrinter &printer, const QString file,
documentOrientation, scaleMode );
}
int FilePrinter::doPrintFiles( QPrinter &printer, QStringList fileList, FileDeletePolicy fileDeletePolicy,
int FilePrinter::doPrintFiles(QPrinter &printer, const QStringList fileList, FileDeletePolicy fileDeletePolicy,
PageSelectPolicy pageSelectPolicy, const QString &pageRange,
QPrinter::Orientation documentOrientation )
{
......@@ -113,8 +113,8 @@ int FilePrinter::doPrintFiles( QPrinter &printer, QStringList fileList, FileDele
argList << fileList[0] << printer.outputFileName();
qCDebug(OkularCoreDebug) << "Executing" << exe << "with arguments" << argList;
ret = KProcess::execute( exe, argList );
} else if ( inputFileInfo.suffix() == "pdf" && printer.outputFormat() == QPrinter::NativeFormat && pdf2psAvailable() ) {
exe = "pdf2ps";
} else if ( inputFileInfo.suffix() == QLatin1String("pdf") && printer.outputFormat() == QPrinter::NativeFormat && pdf2psAvailable() ) {
exe = QStringLiteral("pdf2ps");
argList << fileList[0] << printer.outputFileName();
qCDebug(OkularCoreDebug) << "Executing" << exe << "with arguments" << argList;
ret = KProcess::execute( exe, argList );
......
......@@ -101,7 +101,7 @@ static KJSObject appGetPlatform( KJSContext *, void * )
#elif defined(Q_OS_MAC)
return KJSString( QString::fromLatin1( "MAC" ) );
#else
return KJSString( QLatin1String( "UNIX" ) );
return KJSString( QStringLiteral( "UNIX" ) );
#endif
}
......@@ -135,13 +135,13 @@ static KJSObject appGetPrinterNames( KJSContext *context, void * )
static KJSObject appGetViewerType( KJSContext *, void * )
{
// faking a bit...
return KJSString( QLatin1String( "Reader" ) );
return KJSString( QStringLiteral( "Reader" ) );
}
static KJSObject appGetViewerVariation( KJSContext *, void * )
{
// faking a bit...
return KJSString( QLatin1String( "Reader" ) );
return KJSString( QStringLiteral( "Reader" ) );
}
static KJSObject appGetViewerVersion( KJSContext *, void * )
......
......@@ -59,7 +59,7 @@ QString Scripter::execute( ScriptType type, const QString &script )
static QString builtInScript;
if ( builtInScript.isNull() )
{
QFile builtInResource ( ":/script/builtin.js" );
QFile builtInResource ( QStringLiteral(":/script/builtin.js") );
if (!builtInResource.open( QIODevice::ReadOnly ))
{
qCDebug(OkularCoreDebug) << "failed to load builtin script";
......
......@@ -381,7 +381,7 @@ QTextDocument* Converter::convert( const QString &fileName )
} else { // load missing resource
char *data = 0;
//epub_get_data can't handle whitespace url encodings
QByteArray ba = link.replace("%20", " ").toLatin1();
QByteArray ba = link.replace(QLatin1String("%20"), QLatin1String(" ")).toLatin1();
const char *clinkClean = ba.data();
int size = epub_get_data(mTextDocument->getEpub(), clinkClean, &data);
......
......@@ -28,7 +28,7 @@ MarkdownGenerator::MarkdownGenerator( QObject *parent, const QVariantList &args
{
Okular::TextDocumentSettings *mdSettings = generalSettings();
mdSettings->addItemBool( "SmartyPants", s_isFancyPantsEnabled, true );
mdSettings->addItemBool( QStringLiteral("SmartyPants"), s_isFancyPantsEnabled, true );
mdSettings->load();
s_wasFancyPantsEnabled = s_isFancyPantsEnabled;
}
......@@ -55,7 +55,7 @@ void MarkdownGenerator::addPages( KConfigDialog* dlg )
Okular::TextDocumentSettingsWidget *widget = new Okular::TextDocumentSettingsWidget();
QCheckBox *enableSmartyPants = new QCheckBox( dlg );
enableSmartyPants->setObjectName( QString::fromUtf8( "kcfg_SmartyPants" ) );
enableSmartyPants->setObjectName( QStringLiteral( "kcfg_SmartyPants" ) );
widget->addRow( i18n("Enable SmartyPants formatting"), enableSmartyPants );
dlg->addPage( widget, generalSettings(), i18n("Markdown"), QStringLiteral("text-markdown"), i18n("Markdown Backend Configuration") );
......
......@@ -55,7 +55,7 @@ QVariant MobiDocument::loadResource(int type, const QUrl &name)
{
if (type!=QTextDocument::ImageResource || name.scheme()!=QString(QStringLiteral("pdbrec"))) return QVariant();
bool ok;
quint16 recnum=name.path().mid(1).toUShort(&ok);
quint16 recnum=name.path().midRef(1).toUShort(&ok);
if (!ok || recnum>=doc->imageCount()) return QVariant();
QVariant resource;
......
......@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
paths[QStringLiteral("home")] = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
engine.rootContext()->setContextProperty(QStringLiteral("userPaths"), paths);
engine.setBaseUrl(QUrl("qrc:/package/contents/ui/"));
engine.load(QUrl("qrc:/package/contents/ui/main.qml"));
engine.setBaseUrl(QUrl(QStringLiteral("qrc:/package/contents/ui/")));
engine.load(QUrl(QStringLiteral("qrc:/package/contents/ui/main.qml")));
return app.exec();
}
......@@ -59,7 +59,7 @@ void DocumentItem::setUrl(const QUrl & url)
//TODO: password
QMimeDatabase db;
const QString path = url.isLocalFile() ? url.toLocalFile() : QLatin1String("-");
const QString path = url.isLocalFile() ? url.toLocalFile() : QStringLiteral("-");
m_document->openDocument(path, url, db.mimeTypeForUrl(url));
......
......@@ -39,7 +39,7 @@
PageItem::PageItem(QQuickItem *parent)
: QQuickItem(parent),
Okular::View( QLatin1String( "PageView" ) ),
Okular::View( QStringLiteral( "PageView" ) ),
m_page(nullptr),
m_smooth(false),
m_bookmarked(false),
......
......@@ -204,16 +204,16 @@ static KFilterDev::CompressionType compressionTypeFor( const QString& mime_to_ch
if ( compressedMimeMap.isEmpty() )
{
std::unique_ptr< KFilterBase > f;
compressedMimeMap[ QLatin1String( "image/x-gzeps" ) ] = KFilterDev::GZip;
compressedMimeMap[ QStringLiteral( "image/x-gzeps" ) ] = KFilterDev::GZip;
// check we can read bzip2-compressed files
f.reset( KCompressionDevice::filterForCompressionType( KCompressionDevice::BZip2 ) );
if ( f.get() )
{
supportBzip = true;
compressedMimeMap[ QLatin1String( "application/x-bzpdf" ) ] = KFilterDev::BZip2;
compressedMimeMap[ QLatin1String( "application/x-bzpostscript" ) ] = KFilterDev::BZip2;
compressedMimeMap[ QLatin1String( "application/x-bzdvi" ) ] = KFilterDev::BZip2;
compressedMimeMap[ QLatin1String( "image/x-bzeps" ) ] = KFilterDev::BZip2;
compressedMimeMap[ QStringLiteral( "application/x-bzpdf" ) ] = KFilterDev::BZip2;
compressedMimeMap[ QStringLiteral( "application/x-bzpostscript" ) ] = KFilterDev::BZip2;
compressedMimeMap[ QStringLiteral( "application/x-bzdvi" ) ] = KFilterDev::BZip2;
compressedMimeMap[ QStringLiteral( "image/x-bzeps" ) ] = KFilterDev::BZip2;
}
// check if we can read XZ-compressed files
f.reset( KCompressionDevice::filterForCompressionType( KCompressionDevice::Xz ) );
......@@ -1566,8 +1566,8 @@ bool Part::openFile()
m_find->setEnabled( ok && canSearch );
m_findNext->setEnabled( ok && canSearch );
m_findPrev->setEnabled( ok && canSearch );
if( m_save ) m_save->setEnabled( ok && !( isstdin || mime.inherits( "inode/directory" ) ) );
if( m_saveAs ) m_saveAs->setEnabled( ok && !( isstdin || mime.inherits( "inode/directory" ) ) );
if( m_save ) m_save->setEnabled( ok && !( isstdin || mime.inherits( QStringLiteral("inode/directory") ) ) );
if( m_saveAs ) m_saveAs->setEnabled( ok && !( isstdin || mime.inherits( QStringLiteral("inode/directory") ) ) );
emit enablePrintAction( ok && m_document->printingSupport() != Okular::Document::NoPrinting );
m_printPreview->setEnabled( ok && m_document->printingSupport() != Okular::Document::NoPrinting );
m_showProperties->setEnabled( ok );
......@@ -2439,10 +2439,10 @@ bool Part::aboutToShowContextMenu(QMenu * /*menu*/, QAction *action, QMenu *cont
{
QAction *separatorAction = contextMenu->addSeparator();
separatorAction->setObjectName(QStringLiteral("OkularPrivateRenameBookmarkActions"));
QAction *renameAction = contextMenu->addAction( QIcon::fromTheme( QStringLiteral("edit-rename") ), i18n( "Rename this Bookmark" ), this, SLOT(slotRenameBookmarkFromMenu()) );
QAction *renameAction = contextMenu->addAction( QIcon::fromTheme( QStringLiteral("edit-rename") ), i18n( "Rename this Bookmark" ), this, &Part::slotRenameBookmarkFromMenu );
renameAction->setData(ba->property("htmlRef").toString());
renameAction->setObjectName(QStringLiteral("OkularPrivateRenameBookmarkActions"));
QAction *deleteAction = contextMenu->addAction( QIcon::fromTheme( QStringLiteral("list-remove") ), i18n("Remove this Bookmark"), this, SLOT(slotRemoveBookmarkFromMenu()));
QAction *deleteAction = contextMenu->addAction( QIcon::fromTheme( QStringLiteral("list-remove") ), i18n("Remove this Bookmark"), this, &Part::slotRemoveBookmarkFromMenu);
deleteAction->setData(ba->property("htmlRef").toString());
deleteAction->setObjectName(QStringLiteral("OkularPrivateRenameBookmarkActions"));
}
......@@ -2667,7 +2667,7 @@ bool Part::saveAs( const QUrl & saveUrl, SaveAsFlags flags )
const int result = KMessageBox::warningYesNoList( widget(),
warningMessage,
listOfwontSaves, i18n( "Warning" ),
KGuiItem( i18n( "Save as Okular document archive..." ), "document-save-as" ), // <- KMessageBox::Yes
KGuiItem( i18n( "Save as Okular document archive..." ), QStringLiteral("document-save-as") ), // <- KMessageBox::Yes
KStandardGuiItem::cancel() );
switch (result)
......@@ -2690,8 +2690,8 @@ bool Part::saveAs( const QUrl & saveUrl, SaveAsFlags flags )
const int result = KMessageBox::warningYesNoCancelList( widget(),
warningMessage,
listOfwontSaves, i18n( "Warning" ),
KGuiItem( i18n( "Save as Okular document archive..." ), "document-save-as" ), // <- KMessageBox::Yes
KGuiItem( continueMessage, "arrow-right" ) ); // <- KMessageBox::NO
KGuiItem( i18n( "Save as Okular document archive..." ), QStringLiteral("document-save-as") ), // <- KMessageBox::Yes
KGuiItem( continueMessage, QStringLiteral("arrow-right") ) ); // <- KMessageBox::NO
switch (result)
{
......@@ -3675,7 +3675,7 @@ void Part::slotShareActionFinished(const QJsonObject &output, int error, const Q
KMessageBox::error(widget(), i18n("There was a problem sharing the document: %1", message),
i18n("Share"));
} else {
const QString url = output["url"].toString();
const QString url = output[QStringLiteral("url")].toString();
if (url.isEmpty()) {
m_pageView->displayMessage(i18n("Document shared successfully"));
} else {
......
......@@ -572,7 +572,7 @@ bool Shell::queryClose()
{
if (m_tabs.count() > 1)
{
const QString dontAskAgainName = "ShowTabWarning";
const QString dontAskAgainName = QStringLiteral("ShowTabWarning");
KMessageBox::ButtonCode dummy;
if (shouldBeShownYesNo(dontAskAgainName, dummy))
{
......@@ -581,7 +581,7 @@ bool Shell::queryClose()
QDialogButtonBox *buttonBox = new QDialogButtonBox(dialog);
buttonBox->setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
KGuiItem::assign(buttonBox->button(QDialogButtonBox::Yes), KGuiItem(i18n("Close Tabs"), "tab-close"));
KGuiItem::assign(buttonBox->button(QDialogButtonBox::Yes), KGuiItem(i18n("Close Tabs"), QStringLiteral("tab-close")));
KGuiItem::assign(buttonBox->button(QDialogButtonBox::No), KStandardGuiItem::cancel());
......
......@@ -198,7 +198,7 @@ AnnotWindow::AnnotWindow( QWidget * parent, Okular::Annotation * annot, Okular::
setAutoFillBackground( true );
setFrameStyle( Panel | Raised );
setAttribute( Qt::WA_DeleteOnClose );
setObjectName("AnnotWindow");
setObjectName(QStringLiteral("AnnotWindow"));
const bool canEditAnnotation = m_document->canModifyPageAnnotation( annot );
......@@ -421,7 +421,7 @@ void AnnotWindow::renderLatex( bool render )
}
}
void AnnotWindow::slotHandleContentsChangedByUndoRedo(Okular::Annotation* annot, QString contents, int cursorPos, int anchorPos)
void AnnotWindow::slotHandleContentsChangedByUndoRedo(Okular::Annotation* annot, const QString &contents, int cursorPos, int anchorPos)
{
if ( annot != m_annot )
{
......
......@@ -64,7 +64,7 @@ class AnnotWindow : public QFrame
void slotOptionBtn();
void slotsaveWindowText();
void renderLatex( bool render );
void slotHandleContentsChangedByUndoRedo( Okular::Annotation* annot, QString contents, int cursorPos, int anchorPos);
void slotHandleContentsChangedByUndoRedo( Okular::Annotation* annot, const QString &contents, int cursorPos, int anchorPos);
Q_SIGNALS:
void containsLatex( bool );
......
......@@ -63,7 +63,7 @@ static QString splitDNAttributes(const QStringList &text)
{
for ( const QString &attribute : attributes )
{
const QRegularExpression re( QString( "(.*),\\s*(%1=.*)" ).arg( attribute ), QRegularExpression::DotMatchesEverythingOption );
const QRegularExpression re( QStringLiteral( "(.*),\\s*(%1=.*)" ).arg( attribute ), QRegularExpression::DotMatchesEverythingOption );
const QRegularExpressionMatch match = re.match( t );
if ( match.hasMatch() )
{
......@@ -81,7 +81,7 @@ static QString splitDNAttributes(const QStringList &text)
QStringList result = text;
for ( QString &t : result )
{
t.replace( "\\,", "," );
t.replace( QLatin1String("\\,"), QLatin1String(",") );
}
// Clean up quoted attributes
......@@ -89,7 +89,7 @@ static QString splitDNAttributes(const QStringList &text)
{
for ( const QString &attribute : attributes )
{
const QRegularExpression re( QString( "%1=\"(.*)\"" ).arg( attribute ) );
const QRegularExpression re( QStringLiteral( "%1=\"(.*)\"" ).arg( attribute ) );
const QRegularExpressionMatch match = re.match( t );
if ( match.hasMatch() )
{
......
......@@ -60,7 +60,7 @@ EmbeddedFilesDialog::EmbeddedFilesDialog(QWidget *parent, const Okular::Document
mUser2Button = new QPushButton;
buttonBox->addButton(mUser2Button, QDialogButtonBox::ActionRole);
KGuiItem::assign(mUser2Button, KGuiItem(i18nc("@action:button", "View"), "document-open"));
KGuiItem::assign(mUser2Button, KGuiItem(i18nc("@action:button", "View"), QStringLiteral("document-open")));
mUser2Button->setEnabled(false);
m_tw = new QTreeWidget(this);
......@@ -183,7 +183,7 @@ void EmbeddedFilesDialog::viewFile( Okular::EmbeddedFile* ef )
+ QDir::separator()
+ fileInfo.baseName()
+ ".XXXXXX"
+ (fileInfo.completeSuffix().isEmpty() ? QString("") : "." + fileInfo.completeSuffix()) // krazy:exclude=doublequote_chars
+ (fileInfo.completeSuffix().isEmpty() ? QStringLiteral("") : "." + fileInfo.completeSuffix()) // krazy:exclude=doublequote_chars
);
GuiUtils::writeEmbeddedFile( ef, this, *tmpFile );
......
......@@ -91,7 +91,7 @@ void FilePrinterPreviewPrivate::getPart()
QStringLiteral("KParts/ReadOnlyPart"),
QStringLiteral("[DesktopEntryName] == 'okularghostview'"));
} else {
offers = KMimeTypeTrader::self()->query("application/pdf", "KParts/ReadOnlyPart");
offers = KMimeTypeTrader::self()->query(QStringLiteral("application/pdf"), QStringLiteral("KParts/ReadOnlyPart"));
}
KService::List::ConstIterator it = offers.constBegin();
......
......@@ -299,7 +299,7 @@ OkularTTS* PageViewPrivate::tts()
*/
PageView::PageView( QWidget *parent, Okular::Document *document )
: QAbstractScrollArea( parent )
, Okular::View( QLatin1String( "PageView" ) )
, Okular::View( QStringLiteral( "PageView" ) )
{
// create and initialize private storage structure
d = new PageViewPrivate( this );
......@@ -2776,7 +2776,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
// popup that ask to copy:text and copy/save:image
QMenu menu( this );
menu.setObjectName("PopupMenu");
menu.setObjectName(QStringLiteral("PopupMenu"));
QAction *textToClipboard = nullptr;
#ifdef HAVE_SPEECH
QAction *speakText = nullptr;
......@@ -2787,7 +2787,7 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
{
menu.addAction( new OKMenuTitle( &menu, i18np( "Text (1 character)", "Text (%1 characters)", selectedText.length() ) ) );
textToClipboard = menu.addAction( QIcon::fromTheme(QStringLiteral("edit-copy")), i18n( "Copy to Clipboard" ) );
textToClipboard->setObjectName("CopyTextToClipboard");
textToClipboard->setObjectName(QStringLiteral("CopyTextToClipboard"));
bool copyAllowed = d->document->isAllowed( Okular::AllowCopy );
if ( !copyAllowed )
{
......@@ -3094,13 +3094,13 @@ void PageView::mouseReleaseEvent( QMouseEvent * e )
{
const QString squeezedText = KStringHandler::rsqueeze( url, 30 );
httpLink = menu->addAction( i18n( "Go to '%1'", squeezedText ) );
httpLink->setObjectName("GoToAction");
httpLink->setObjectName(QStringLiteral("GoToAction"));
}
}
}
if ( menu ) {
menu->setObjectName("PopupMenu");
menu->setObjectName(QStringLiteral("PopupMenu"));
QAction *choice = menu->exec( e->globalPos() );
// check if the user really selected an action
......@@ -4411,7 +4411,7 @@ QMenu* PageView::createProcessLinkMenu(PageViewItem *item, const QPoint &eventPo
const Okular::Action * link = static_cast< const Okular::Action * >( rect->object() );
// creating the menu and its actions
QAction * processLink = menu->addAction( i18n( "Follow This Link" ) );
processLink->setObjectName("ProcessLinkAction");
processLink->setObjectName(QStringLiteral("ProcessLinkAction"));
if ( link->actionType() == Okular::Action::Sound ) {
processLink->setText( i18n( "Play this Sound" ) );
if ( Okular::AudioPlayer::instance()->state() == Okular::AudioPlayer::PlayingState ) {
......@@ -4426,7 +4426,7 @@ QMenu* PageView::createProcessLinkMenu(PageViewItem *item, const QPoint &eventPo
if ( dynamic_cast< const Okular::BrowseAction * >( link ) )
{
QAction * actCopyLinkLocation = menu->addAction( QIcon::fromTheme( QStringLiteral("edit-copy") ), i18n( "Copy Link Address" ) );
actCopyLinkLocation->setObjectName("CopyLinkLocationAction");
actCopyLinkLocation->setObjectName(QStringLiteral("CopyLinkLocationAction"));
connect( actCopyLinkLocation, &QAction::triggered, [ link ]() {
const Okular::BrowseAction * browseLink = static_cast< const Okular::BrowseAction * >( link );
QClipboard *cb = QApplication::clipboard();
......
......@@ -141,7 +141,7 @@ class PickPointEngine : public AnnotatorEngine
}
}
void addInPlaceTextAnnotation( Okular::Annotation * &ann, const QString summary, const QString content, Okular::TextAnnotation::InplaceIntent inplaceIntent )
void addInPlaceTextAnnotation( Okular::Annotation * &ann, const QString &summary, const QString &content, Okular::TextAnnotation::InplaceIntent inplaceIntent )
{
Okular::TextAnnotation * ta = new Okular::TextAnnotation();
ann = ta;
......@@ -1126,7 +1126,7 @@ QPixmap PageViewAnnotator::makeToolPixmap( const QDomElement &toolElement )
// Load HiDPI variant on HiDPI screen
QString imageVariant;
if ( qApp->devicePixelRatio() > 1.05 ) {
imageVariant = "@2x";
imageVariant = QStringLiteral("@2x");
}
// Load base pixmap. We'll draw on top of it
......
......@@ -1754,8 +1754,8 @@ void PresentationWidget::inhibitPowerManagement()
QString reason = i18nc( "Reason for inhibiting the screensaver activation, when the presentation mode is active", "Giving a presentation" );
if (!m_screenInhibitCookie) {
QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.ScreenSaver", "/ScreenSaver",
"org.freedesktop.ScreenSaver", "Inhibit");
QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.ScreenSaver"), QStringLiteral("/ScreenSaver"),
QStringLiteral("org.freedesktop.ScreenSaver"), QStringLiteral("Inhibit"));
message << QCoreApplication::applicationName();
message << reason;
......@@ -1800,8 +1800,8 @@ void PresentationWidget::allowPowerManagement()
}
if (m_screenInhibitCookie) {
QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.ScreenSaver", "/ScreenSaver",
"org.freedesktop.ScreenSaver", "UnInhibit");
QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.ScreenSaver"), QStringLiteral("/ScreenSaver"),
QStringLiteral("org.freedesktop.ScreenSaver"), QStringLiteral("UnInhibit"));
message << m_screenInhibitCookie;
QDBusPendingReply<uint> reply = QDBusConnection::sessionBus().asyncCall(message);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment