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

Fix clazy warning

parent 9f5fe6d3
......@@ -46,11 +46,11 @@ Application::Application(int& argc, char** argv)
mCmdParser.addVersionOption();
// allow redirecting from internal pages to known protocols
KUrlAuthorized::allowUrlAction( QLatin1Literal( "redirect" ), QUrl( QLatin1Literal( "khelpcenter:" ) ), QUrl( QLatin1Literal( "ghelp:" ) ) );
KUrlAuthorized::allowUrlAction( QLatin1Literal( "redirect" ), QUrl( QLatin1Literal( "khelpcenter:" ) ), QUrl( QLatin1Literal( "help:" ) ) );
KUrlAuthorized::allowUrlAction( QLatin1Literal( "redirect" ), QUrl( QLatin1Literal( "khelpcenter:" ) ), QUrl( QLatin1Literal( "info:" ) ) );
KUrlAuthorized::allowUrlAction( QLatin1Literal( "redirect" ), QUrl( QLatin1Literal( "khelpcenter:" ) ), QUrl( QLatin1Literal( "man:" ) ) );
KUrlAuthorized::allowUrlAction( QLatin1Literal( "redirect" ), QUrl( QLatin1Literal( "glossentry:" ) ), QUrl( QLatin1Literal( "help:" ) ) );
KUrlAuthorized::allowUrlAction( QStringLiteral( "redirect" ), QUrl( QStringLiteral( "khelpcenter:" ) ), QUrl( QStringLiteral( "ghelp:" ) ) );
KUrlAuthorized::allowUrlAction( QStringLiteral( "redirect" ), QUrl( QStringLiteral( "khelpcenter:" ) ), QUrl( QStringLiteral( "help:" ) ) );
KUrlAuthorized::allowUrlAction( QStringLiteral( "redirect" ), QUrl( QStringLiteral( "khelpcenter:" ) ), QUrl( QStringLiteral( "info:" ) ) );
KUrlAuthorized::allowUrlAction( QStringLiteral( "redirect" ), QUrl( QStringLiteral( "khelpcenter:" ) ), QUrl( QStringLiteral( "man:" ) ) );
KUrlAuthorized::allowUrlAction( QStringLiteral( "redirect" ), QUrl( QStringLiteral( "glossentry:" ) ), QUrl( QStringLiteral( "help:" ) ) );
// registration of meta types
qRegisterMetaType<const QTreeWidgetItem *>();
......@@ -91,7 +91,7 @@ extern "C" int Q_DECL_EXPORT kdemain( int argc, char **argv )
KHC::Application app(argc, argv);
KLocalizedString::setApplicationDomain("khelpcenter5");
KAboutData aboutData( QStringLiteral("khelpcenter"), i18n("Help Center"),
QLatin1String(PROJECT_VERSION),
QStringLiteral(PROJECT_VERSION),
i18n("Help Center"),
KAboutLicense::GPL,
i18n("(c) 1999-2018, The KHelpCenter developers") );
......
......@@ -84,8 +84,8 @@ void DocEntry::setIcon( const QString &icon )
QString DocEntry::icon() const
{
if ( !mIcon.isEmpty() ) return mIcon;
if ( !docExists() ) return QLatin1String("unknown");
if ( isDirectory() ) return QLatin1String("help-contents");
if ( !docExists() ) return QStringLiteral("unknown");
if ( isDirectory() ) return QStringLiteral("help-contents");
else return QStringLiteral("text-plain");
}
......
......@@ -193,7 +193,7 @@ DocEntry *DocMetaInfo::scanMetaInfoDir( const QString &dirName,
DocEntry *DocMetaInfo::addDirEntry( const QDir &dir, DocEntry *parent )
{
DocEntry *dirEntry = addDocEntry( dir.absoluteFilePath( QLatin1String(".directory") ) );
DocEntry *dirEntry = addDocEntry( dir.absoluteFilePath( QStringLiteral(".directory") ) );
if ( !dirEntry )
{
......
......@@ -183,10 +183,10 @@ void FontDialog::load()
if ( fonts.isEmpty() ) {
fonts << QFontDatabase::systemFont(QFontDatabase::GeneralFont).family()
<< QFontDatabase::systemFont(QFontDatabase::FixedFont).family()
<< QLatin1String(HTML_DEFAULT_VIEW_SERIF_FONT)
<< QLatin1String(HTML_DEFAULT_VIEW_SANSSERIF_FONT)
<< QLatin1String(HTML_DEFAULT_VIEW_CURSIVE_FONT)
<< QLatin1String(HTML_DEFAULT_VIEW_FANTASY_FONT)
<< QStringLiteral(HTML_DEFAULT_VIEW_SERIF_FONT)
<< QStringLiteral(HTML_DEFAULT_VIEW_SANSSERIF_FONT)
<< QStringLiteral(HTML_DEFAULT_VIEW_CURSIVE_FONT)
<< QStringLiteral(HTML_DEFAULT_VIEW_FANTASY_FONT)
<< QString();
}
......
......@@ -147,9 +147,9 @@ void Glossary::rebuildGlossaryCache()
connect(meinproc, QOverload<int, QProcess::ExitStatus>::of(&KProcess::finished), this, &Glossary::meinprocFinished);
*meinproc << QStandardPaths::findExecutable(QStringLiteral( "meinproc5" ) );
*meinproc << QLatin1String( "--output" ) << m_cacheFile;
*meinproc << QLatin1String( "--stylesheet" )
<< QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String( "khelpcenter/glossary.xslt" ) );
*meinproc << QStringLiteral( "--output" ) << m_cacheFile;
*meinproc << QStringLiteral( "--stylesheet" )
<< QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral( "khelpcenter/glossary.xslt" ) );
*meinproc << m_sourceFile;
meinproc->setOutputChannelMode(KProcess::OnlyStderrChannel);
......@@ -214,23 +214,23 @@ void Glossary::buildGlossaryTree()
QHash< QChar, SectionItem * > alphabSections;
QDomNodeList sectionNodes = doc.documentElement().elementsByTagName( QLatin1String( "section" ) );
QDomNodeList sectionNodes = doc.documentElement().elementsByTagName( QStringLiteral( "section" ) );
for ( int i = 0; i < sectionNodes.count(); i++ )
{
QDomElement sectionElement = sectionNodes.item( i ).toElement();
QString title = sectionElement.attribute( QLatin1String( "title" ) );
QString title = sectionElement.attribute( QStringLiteral( "title" ) );
SectionItem *topicSection = new SectionItem( m_byTopicItem, title );
QDomNodeList entryNodes = sectionElement.elementsByTagName( QLatin1String( "entry" ) );
QDomNodeList entryNodes = sectionElement.elementsByTagName( QStringLiteral( "entry" ) );
for ( int j = 0; j < entryNodes.count(); j++ )
{
QDomElement entryElement = entryNodes.item( j ).toElement();
QString entryId = entryElement.attribute( QLatin1String( "id" ) );
QString entryId = entryElement.attribute( QStringLiteral( "id" ) );
if ( entryId.isNull() )
continue;
QDomElement termElement = childElement( entryElement, QLatin1String( "term" ) );
QDomElement termElement = childElement( entryElement, QStringLiteral( "term" ) );
QString term = termElement.text().simplified();
EntryItem *entry = new EntryItem(topicSection, term, entryId );
......@@ -247,20 +247,20 @@ void Glossary::buildGlossaryTree()
new EntryItem( alphabSection, term, entryId );
QDomElement definitionElement = childElement( entryElement, QLatin1String( "definition" ) );
QDomElement definitionElement = childElement( entryElement, QStringLiteral( "definition" ) );
QString definition = definitionElement.text().simplified();
GlossaryEntryXRef::List seeAlso;
QDomElement referencesElement = childElement( entryElement, QLatin1String( "references" ) );
QDomNodeList referenceNodes = referencesElement.elementsByTagName( QLatin1String( "reference" ) );
QDomElement referencesElement = childElement( entryElement, QStringLiteral( "references" ) );
QDomNodeList referenceNodes = referencesElement.elementsByTagName( QStringLiteral( "reference" ) );
if ( referenceNodes.count() > 0 )
for ( int k = 0; k < referenceNodes.count(); k++ )
{
QDomElement referenceElement = referenceNodes.item( k ).toElement();
QString term = referenceElement.attribute( QLatin1String( "term" ) );
QString id = referenceElement.attribute( QLatin1String( "id" ) );
QString term = referenceElement.attribute( QStringLiteral( "term" ) );
QString id = referenceElement.attribute( QStringLiteral( "id" ) );
seeAlso += GlossaryEntryXRef( term, id );
}
......
......@@ -110,7 +110,7 @@ QString GrantleeFormatter::formatGlossaryEntry( const GlossaryEntry& entry )
seeAlso.reserve( entrySeeAlso.count() );
foreach ( const GlossaryEntryXRef &xref, entrySeeAlso )
{
seeAlso += QString::fromLatin1( "<a href=\"glossentry:%1\">%2</a>" ).arg( xref.id(), xref.term() );
seeAlso += QStringLiteral( "<a href=\"glossentry:%1\">%2</a>" ).arg( xref.id(), xref.term() );
}
Grantlee::Context ctx;
......
......@@ -76,7 +76,7 @@ void History::setupActions( KActionCollection *coll )
m_backAction->setEnabled( false );
m_forwardAction = new KToolBarPopupAction( QIcon::fromTheme( backForward.second.iconName() ), backForward.second.text(), this );
coll->addAction( QLatin1String("forward"), m_forwardAction );
coll->addAction( QStringLiteral("forward"), m_forwardAction );
coll->setDefaultShortcuts(m_forwardAction, KStandardShortcut::forward());
connect(m_forwardAction, &KToolBarPopupAction::triggered, this, &History::forward);
......@@ -91,7 +91,7 @@ void History::setupActions( KActionCollection *coll )
void History::installMenuBarHook( KXmlGuiWindow *mainWindow )
{
QMenu *goMenu = dynamic_cast<QMenu *>(
mainWindow->guiFactory()->container( QLatin1String("go_web"), mainWindow ) );
mainWindow->guiFactory()->container( QStringLiteral("go_web"), mainWindow ) );
if ( goMenu )
{
connect(goMenu, &QMenu::aboutToShow, this, &History::fillGoMenu);
......@@ -187,7 +187,7 @@ void History::goHistoryActivated( int steps )
if ( m_goBuffer )
return;
m_goBuffer = steps;
QTimer::singleShot( 0, this, SLOT(goHistoryDelayed()) );
QTimer::singleShot( 0, this, &History::goHistoryDelayed );
}
void History::goHistoryDelayed()
......@@ -268,7 +268,7 @@ void History::fillForwardMenu()
void History::fillGoMenu()
{
KXmlGuiWindow *mainWindow = static_cast<KXmlGuiWindow *>( qApp->activeWindow() );
QMenu *goMenu = dynamic_cast<QMenu *>( mainWindow->guiFactory()->container( QLatin1String( "go" ), mainWindow ) );
QMenu *goMenu = dynamic_cast<QMenu *>( mainWindow->guiFactory()->container( QStringLiteral( "go" ), mainWindow ) );
if ( !goMenu || m_goMenuIndex == -1 )
return;
......@@ -301,7 +301,7 @@ void History::fillGoMenu()
void History::goMenuActivated( QAction* action )
{
KXmlGuiWindow *mainWindow = static_cast<KXmlGuiWindow *>( qApp->activeWindow() );
QMenu *goMenu = dynamic_cast<QMenu *>( mainWindow->guiFactory()->container( QLatin1String( "go" ), mainWindow ) );
QMenu *goMenu = dynamic_cast<QMenu *>( mainWindow->guiFactory()->container( QStringLiteral( "go" ), mainWindow ) );
if ( !goMenu )
return;
......
......@@ -108,7 +108,7 @@ MainWindow::MainWindow()
: KXmlGuiWindow(nullptr),
mLogDialog( nullptr )
{
setObjectName( QLatin1String( "MainWindow" ) );
setObjectName( QStringLiteral( "MainWindow" ) );
QDBusConnection::sessionBus().registerObject(QStringLiteral("/KHelpCenter"), this, QDBusConnection::ExportScriptableSlots);
mSplitter = new QSplitter( this );
......@@ -235,7 +235,7 @@ void MainWindow::setupActions()
mCopyText = KStandardAction::copy( this, SLOT(slotCopySelectedText()), this );
actionCollection()->addAction( QStringLiteral("copy_text"), mCopyText );
mLastSearchAction = actionCollection()->addAction( QLatin1String("lastsearch") );
mLastSearchAction = actionCollection()->addAction( QStringLiteral("lastsearch") );
mLastSearchAction->setText( i18n("&Last Search Result") );
mLastSearchAction->setEnabled( false );
connect( mLastSearchAction, &QAction::triggered, this, &MainWindow::slotLastSearch );
......@@ -253,18 +253,18 @@ void MainWindow::setupActions()
*/
History::self().setupActions( actionCollection() );
QAction *action = actionCollection()->addAction(QLatin1String("configure_fonts" ));
QAction *action = actionCollection()->addAction(QStringLiteral("configure_fonts" ));
action->setText( i18n( "Configure Fonts..." ) );
connect( action, &QAction::triggered, this, &MainWindow::slotConfigureFonts );
action = actionCollection()->addAction(QLatin1String("incFontSizes"));
action = actionCollection()->addAction(QStringLiteral("incFontSizes"));
action->setText( i18n( "Increase Font Sizes" ) );
action->setIcon( QIcon::fromTheme( QLatin1String("zoom-in") ) );
action->setIcon( QIcon::fromTheme( QStringLiteral("zoom-in") ) );
connect( action, &QAction::triggered, this, &MainWindow::slotIncFontSizes );
action = actionCollection()->addAction(QLatin1String("decFontSizes"));
action = actionCollection()->addAction(QStringLiteral("decFontSizes"));
action->setText( i18n( "Decrease Font Sizes" ) );
action->setIcon( QIcon::fromTheme( QLatin1String("zoom-out") ) );
action->setIcon( QIcon::fromTheme( QStringLiteral("zoom-out") ) );
connect( action, &QAction::triggered, this, &MainWindow::slotDecFontSizes );
}
......@@ -482,8 +482,8 @@ void MainWindow::slotDecFontSizes()
void MainWindow::updateFontScaleActions()
{
actionCollection()->action( QLatin1String("incFontSizes") )->setEnabled( mDoc->fontScaleFactor() + mDoc->fontScaleStepping() <= 300 );
actionCollection()->action( QLatin1String("decFontSizes") )->setEnabled( mDoc->fontScaleFactor() - mDoc->fontScaleStepping() >= 20 );
actionCollection()->action( QStringLiteral("incFontSizes") )->setEnabled( mDoc->fontScaleFactor() + mDoc->fontScaleStepping() <= 300 );
actionCollection()->action( QStringLiteral("decFontSizes") )->setEnabled( mDoc->fontScaleFactor() - mDoc->fontScaleStepping() >= 20 );
Prefs::setFontzoomfactor( mDoc->fontScaleFactor() );
Prefs::self()->save();
......
......@@ -562,7 +562,7 @@ QUrl Navigator::homeURL()
// We have to reparse the configuration here in order to get a
// language-specific StartUrl, e.g. "StartUrl[de]".
cfg->reparseConfiguration();
mHomeUrl = QUrl(cfg->group("General").readPathEntry( "StartUrl", QLatin1String("khelpcenter:home") ));
mHomeUrl = QUrl(cfg->group("General").readPathEntry( "StartUrl", QStringLiteral("khelpcenter:home") ));
return mHomeUrl;
}
......
......@@ -113,7 +113,7 @@ void NavigatorAppItem::scheduleTOCBuild()
if ( !doc.isNull() ) {
int pos = doc.indexOf( QLatin1String( ".html" ) );
if ( pos >= 0 ) {
doc.replace( pos, 5, QLatin1String( ".docbook" ) );
doc.replace( pos, 5, QStringLiteral( ".docbook" ) );
}
qCDebug(KHC_LOG) << "doc =" << doc;
......
......@@ -106,7 +106,7 @@ void PluginTraverser::process( DocEntry *entry )
return;
}
// TODO: was contents2 -> needs to be changed to help-contents-alternate or similar
mCurrentItem->setIcon( 0, QIcon::fromTheme( QLatin1String("help-contents") ) );
mCurrentItem->setIcon( 0, QIcon::fromTheme( QStringLiteral("help-contents") ) );
}
}
......
......@@ -51,7 +51,7 @@ void ScrollKeeperTreeBuilder::build( NavigatorItem *parent )
qCDebug(KHC_LOG) << "ScrollKeeper language: " << lang;
const QString exePath = QStandardPaths::findExecutable( QLatin1Literal( "scrollkeeper-get-content-list" ) );
const QString exePath = QStandardPaths::findExecutable( QStringLiteral( "scrollkeeper-get-content-list" ) );
if ( exePath.isEmpty() ) {
qCDebug(KHC_LOG) << "scrollkeeper-get-content-list is not available, skipping";
return;
......@@ -108,7 +108,7 @@ int ScrollKeeperTreeBuilder::insertSection( NavigatorItem *parent,
NavigatorItem *&sectItem )
{
// TODO: was contents2 -> needs to be changed to help-contents-alternate or similar
DocEntry *entry = new DocEntry( QString(), QString(), QLatin1String("help-contents") );
DocEntry *entry = new DocEntry( QString(), QString(), QStringLiteral("help-contents") );
sectItem = new NavigatorItem( entry, parent );
sectItem->setAutoDeleteDocEntry( true );
mItems.append( sectItem );
......@@ -145,7 +145,7 @@ int ScrollKeeperTreeBuilder::insertSection( NavigatorItem *parent,
void ScrollKeeperTreeBuilder::insertDoc( NavigatorItem *parent,
const QDomNode &docNode )
{
DocEntry *entry = new DocEntry( QString(), QString(), QLatin1String("text-plain") );
DocEntry *entry = new DocEntry( QString(), QString(), QStringLiteral("text-plain") );
NavigatorItem *docItem = new NavigatorItem( entry, parent );
docItem->setAutoDeleteDocEntry( true );
mItems.append( docItem );
......
......@@ -65,11 +65,11 @@ SearchWidget::SearchWidget( SearchEngine *engine, QWidget *parent )
topLayout->addLayout( hLayout );
mPagesCombo = new QComboBox( this );
mPagesCombo->addItem( QLatin1String("5") );
mPagesCombo->addItem( QLatin1String("10") );
mPagesCombo->addItem( QLatin1String("25") );
mPagesCombo->addItem( QLatin1String("50") );
mPagesCombo->addItem( QLatin1String("1000") );
mPagesCombo->addItem( QStringLiteral("5") );
mPagesCombo->addItem( QStringLiteral("10") );
mPagesCombo->addItem( QStringLiteral("25") );
mPagesCombo->addItem( QStringLiteral("50") );
mPagesCombo->addItem( QStringLiteral("1000") );
l = new QLabel( i18n("Max. &results:"), this );
l->setBuddy( mPagesCombo );
......
......@@ -229,9 +229,9 @@ void TOC::fillTree()
QDomNodeList chapters = doc.documentElement().elementsByTagName( QStringLiteral("chapter") );
for ( int chapterCount = 0; chapterCount < chapters.count(); chapterCount++ ) {
QDomElement chapElem = chapters.item( chapterCount ).toElement();
QDomElement chapTitleElem = childElement( chapElem, QLatin1String( "title" ) );
QDomElement chapTitleElem = childElement( chapElem, QStringLiteral( "title" ) );
QString chapTitle = chapTitleElem.text().simplified();
QDomElement chapRefElem = childElement( chapElem, QLatin1String( "anchor" ) );
QDomElement chapRefElem = childElement( chapElem, QStringLiteral( "anchor" ) );
QString chapRef = chapRefElem.text().trimmed();
chapItem = new TOCChapterItem( this, m_parentItem, chapItem, chapTitle, chapRef );
......@@ -240,9 +240,9 @@ void TOC::fillTree()
QDomNodeList sections = chapElem.elementsByTagName( QStringLiteral("section") );
for ( int sectCount = 0; sectCount < sections.count(); sectCount++ ) {
QDomElement sectElem = sections.item( sectCount ).toElement();
QDomElement sectTitleElem = childElement( sectElem, QLatin1String( "title" ) );
QDomElement sectTitleElem = childElement( sectElem, QStringLiteral( "title" ) );
QString sectTitle = sectTitleElem.text().simplified();
QDomElement sectRefElem = childElement( sectElem, QLatin1String( "anchor" ) );
QDomElement sectRefElem = childElement( sectElem, QStringLiteral( "anchor" ) );
QString sectRef = sectRefElem.text().trimmed();
sectItem = new TOCSectionItem( this, chapItem, sectItem, sectTitle, sectRef );
......
......@@ -163,7 +163,7 @@ void View::beginSearchResult()
{
mState = Search;
begin( QUrl( QLatin1Literal( "khelpcenter:search/result" ) ) );
begin( QUrl( QStringLiteral( "khelpcenter:search/result" ) ) );
mSearchResult = QString();
}
......@@ -196,7 +196,7 @@ void View::lastSearch()
mState = Search;
begin( QUrl( QLatin1Literal( "khelpcenter:search/last" ) ) );
begin( QUrl( QStringLiteral( "khelpcenter:search/last" ) ) );
write( mSearchResult );
end();
}
......
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