Commit 937cb97a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use QStringLiteral and co. + Add missing i18n

parent 1c1cf47c
......@@ -58,6 +58,14 @@ set_package_properties(LibXml2 PROPERTIES
TYPE REQUIRED)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
#add_definitions(
# -DQT_USE_QSTRINGBUILDER
# -DQT_NO_CAST_TO_ASCII
# -DQT_NO_CAST_FROM_ASCII
# -DQT_NO_URL_CAST_FROM_STRING
# -DQT_NO_CAST_FROM_BYTEARRAY
# -DQT_NO_SIGNALS_SLOTS_KEYWORDS
#)
add_subdirectory( plugins )
add_subdirectory( searchhandlers )
......
......@@ -40,7 +40,7 @@ Application::Application(int& argc, char** argv)
{
setAttribute(Qt::AA_UseHighDpiPixmaps);
mCmdParser.addPositionalArgument( "url", i18n( "Documentation to open" ) );
mCmdParser.addPositionalArgument( QStringLiteral("url"), i18n( "Documentation to open" ) );
mCmdParser.addHelpOption();
mCmdParser.addVersionOption();
......@@ -89,20 +89,20 @@ extern "C" int Q_DECL_EXPORT kdemain( int argc, char **argv )
{
KHC::Application app(argc, argv);
KLocalizedString::setApplicationDomain("khelpcenter5");
KAboutData aboutData( "khelpcenter", i18n("Help Center"),
PROJECT_VERSION,
KAboutData aboutData( QStringLiteral("khelpcenter"), i18n("Help Center"),
QLatin1String(PROJECT_VERSION),
i18n("Help Center"),
KAboutLicense::GPL,
i18n("(c) 1999-2018, The KHelpCenter developers") );
aboutData.addAuthor( "Luigi Toscano", QString("Current maintainer"), "luigi.toscano@tiscali.it" );
aboutData.addAuthor( "Pino Toscano", QString("Xapian-based search, lot of bugfixes"), "pino@kde.org" );
aboutData.addAuthor( "Cornelius Schumacher", QString("Former maintainer"), "schumacher@kde.org" );
aboutData.addAuthor( "Frerich Raabe", QString(), "raabe@kde.org" );
aboutData.addAuthor( "Matthias Elter", i18n("Original Author"), "me@kde.org" );
aboutData.addAuthor( "Wojciech Smigaj", i18n("Info page support"), "achu@klub.chip.pl" );
app.setWindowIcon( QIcon::fromTheme("help-browser") );
aboutData.setDesktopFileName ( "org.kde.Help" );
aboutData.addAuthor( QStringLiteral("Luigi Toscano"), i18n("Current maintainer"), QStringLiteral("luigi.toscano@tiscali.it") );
aboutData.addAuthor( QStringLiteral("Pino Toscano"), i18n("Xapian-based search, lot of bugfixes"), QStringLiteral("pino@kde.org") );
aboutData.addAuthor( QStringLiteral("Cornelius Schumacher"), i18n("Former maintainer"), QStringLiteral("schumacher@kde.org") );
aboutData.addAuthor( QStringLiteral("Frerich Raabe"), QString(), QStringLiteral("raabe@kde.org") );
aboutData.addAuthor( QStringLiteral("Matthias Elter"), i18n("Original Author"), QStringLiteral("me@kde.org") );
aboutData.addAuthor( QStringLiteral("Wojciech Smigaj"), i18n("Info page support"), QStringLiteral("achu@klub.chip.pl") );
app.setWindowIcon( QIcon::fromTheme(QStringLiteral("help-browser")) );
aboutData.setDesktopFileName ( QStringLiteral("org.kde.Help") );
KAboutData::setApplicationData(aboutData);
QCommandLineParser *cmd = app.cmdParser();
......
......@@ -38,7 +38,7 @@ namespace KHC {
QCommandLineParser *cmdParser();
public slots:
public Q_SLOTS:
void activate(const QStringList& args, const QString &workingDirectory);
private:
......
......@@ -66,7 +66,7 @@ QString DocEntry::icon() const
if ( !docExists() ) return QLatin1String("unknown");
if ( isDirectory() ) return QLatin1String("help-contents");
else return "text-plain";
else return QStringLiteral("text-plain");
}
void DocEntry::setUrl( const QString &url )
......@@ -79,7 +79,7 @@ QString DocEntry::url() const
if ( !mUrl.isEmpty() ) return mUrl;
if ( identifier().isEmpty() ) return QString();
return "khelpcenter:" + identifier();
return QStringLiteral("khelpcenter:") + identifier();
}
void DocEntry::setInfo( const QString &info )
......@@ -219,7 +219,7 @@ bool DocEntry::readFromFile( const QFileInfo &fileInfo )
mIdentifier = fileInfo.completeBaseName();
}
mIndexer = desktopGroup.readEntry( "X-DOC-Indexer" );
mIndexer.replace( "%f", fileInfo.absoluteFilePath() );
mIndexer.replace( QStringLiteral("%f"), fileInfo.absoluteFilePath() );
mIndexTestFile = desktopGroup.readEntry( "X-DOC-IndexTestFile" );
mSearchEnabledDefault = desktopGroup.readEntry( "X-DOC-SearchEnabledDefault",
false );
......
......@@ -70,7 +70,7 @@ DocEntry *DocMetaInfo::addDocEntry( const QFileInfo &fi )
if ( !fi.exists() ) return nullptr;
QString extension = fi.completeSuffix();
QStringList extensions = extension.split( '.');
QStringList extensions = extension.split( QLatin1Char('.'));
QString lang;
if ( extensions.count() >= 2 )
{
......@@ -100,7 +100,7 @@ DocEntry *DocMetaInfo::addDocEntry( const QFileInfo &fi )
*it ) );
}
QString indexer = entry->indexer();
indexer.replace( "%f", fi.absoluteFilePath() );
indexer.replace( QStringLiteral("%f"), fi.absoluteFilePath() );
entry->setIndexer( indexer );
addDocEntry( entry );
return entry;
......@@ -130,7 +130,7 @@ DocEntry::List DocMetaInfo::searchEntries() const
QString DocMetaInfo::languageName( const QString &langcode )
{
if ( langcode == "en" )
if ( langcode == QLatin1String("en") )
return i18nc("Describes documentation entries that are in English", "English");
QString cfgfile = QStandardPaths::locate( QStandardPaths::GenericDataLocation, QStringLiteral( "locale/%1/kf5_entry.desktop" ).arg( langcode ) );
......@@ -156,7 +156,7 @@ void DocMetaInfo::scanMetaInfo( bool force )
if ( metaInfos.isEmpty() )
{
metaInfos = QStandardPaths::locateAll(QStandardPaths::DataLocation, "plugins", QStandardPaths::LocateDirectory);
metaInfos = QStandardPaths::locateAll(QStandardPaths::DataLocation, QStringLiteral("plugins"), QStandardPaths::LocateDirectory);
}
for( it = metaInfos.constBegin(); it != metaInfos.constEnd(); ++it)
{
......
......@@ -49,7 +49,7 @@ class SectionItem : public QTreeWidgetItem
: QTreeWidgetItem( parent )
{
setText(0,text);
setIcon(0,QIcon::fromTheme( "help-contents" ));
setIcon(0,QIcon::fromTheme( QStringLiteral("help-contents") ));
}
};
......@@ -84,16 +84,16 @@ Glossary::Glossary( QWidget *parent ) : QTreeWidget( parent )
m_byTopicItem = new QTreeWidgetItem( this );
m_byTopicItem->setText( 0, i18n( "By Topic" ) );
m_byTopicItem->setIcon( 0, QIcon::fromTheme( "help-contents" ) );
m_byTopicItem->setIcon( 0, QIcon::fromTheme( QStringLiteral("help-contents") ) );
m_alphabItem = new QTreeWidgetItem( this );
m_alphabItem->setText( 0, i18n( "Alphabetically" ) );
m_alphabItem->setIcon( 0, QIcon::fromTheme( "character-set" ) );
m_alphabItem->setIcon( 0, QIcon::fromTheme( QStringLiteral("character-set") ) );
m_cacheFile = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/') + "help/glossary.xml" ;
m_cacheFile = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/') + QStringLiteral("help/glossary.xml");
QDir().mkpath( QFileInfo( m_cacheFile ).absolutePath() );
m_sourceFile = View::langLookup( QLatin1String( "khelpcenter/glossary/index.docbook" ) );
m_sourceFile = View::langLookup( QStringLiteral( "khelpcenter/glossary/index.docbook" ) );
}
......
......@@ -80,7 +80,7 @@ GrantleeFormatter::GrantleeFormatter()
: d( new Private )
{
QSharedPointer< Grantlee::FileSystemTemplateLoader > loader( new Grantlee::FileSystemTemplateLoader );
loader->setTemplateDirs( QStandardPaths::locateAll( QStandardPaths::DataLocation, "templates", QStandardPaths::LocateDirectory ) );
loader->setTemplateDirs( QStandardPaths::locateAll( QStandardPaths::DataLocation, QStringLiteral("templates"), QStandardPaths::LocateDirectory ) );
d->engine.addTemplateLoader( loader );
}
......@@ -91,19 +91,19 @@ GrantleeFormatter::~GrantleeFormatter()
QString GrantleeFormatter::formatOverview( const QString& title, const QString& name, const QString& content )
{
Grantlee::Template t = d->engine.loadByName( "index.html" );
Grantlee::Template t = d->engine.loadByName( QStringLiteral("index.html") );
Grantlee::Context ctx;
ctx.insert( "title", title );
ctx.insert( "name", name );
ctx.insert( "content", content );
ctx.insert( QStringLiteral("title"), title );
ctx.insert( QStringLiteral("name"), name );
ctx.insert( QStringLiteral("content"), content );
return d->format( t, &ctx );
}
QString GrantleeFormatter::formatGlossaryEntry( const GlossaryEntry& entry )
{
Grantlee::Template t = d->engine.loadByName( "glossary.html" );
Grantlee::Template t = d->engine.loadByName( QStringLiteral("glossary.html") );
const GlossaryEntryXRef::List entrySeeAlso = entry.seeAlso();
QStringList seeAlso;
......@@ -114,19 +114,19 @@ QString GrantleeFormatter::formatGlossaryEntry( const GlossaryEntry& entry )
}
Grantlee::Context ctx;
ctx.insert( "htmltitle", i18nc( "%1 is a glossary term", "KDE Glossary: %1", entry.term() ) );
ctx.insert( "title", i18n( "KDE Glossary" ) );
ctx.insert( "term", entry.term() );
ctx.insert( "definition", entry.definition() );
ctx.insert( "seeAlsoCount", seeAlso.count() );
ctx.insert( "seeAlso", i18n( "See also: %1", seeAlso.join( ", " ) ) );
ctx.insert( QStringLiteral("htmltitle"), i18nc( "%1 is a glossary term", "KDE Glossary: %1", entry.term() ) );
ctx.insert( QStringLiteral("title"), i18n( "KDE Glossary" ) );
ctx.insert( QStringLiteral("term"), entry.term() );
ctx.insert( QStringLiteral("definition"), entry.definition() );
ctx.insert( QStringLiteral("seeAlsoCount"), seeAlso.count() );
ctx.insert( QStringLiteral("seeAlso"), i18n( "See also: %1", seeAlso.join( QStringLiteral(", ") ) ) );
return d->format( t, &ctx );
}
QString GrantleeFormatter::formatSearchResults( const QString& words, const QList<QPair<DocEntry *, QString> >& results )
{
Grantlee::Template t = d->engine.loadByName( "search.html" );
Grantlee::Template t = d->engine.loadByName( QStringLiteral("search.html") );
typedef QPair<DocEntry *, QString> Iter;
QVariantList list;
......@@ -134,15 +134,15 @@ QString GrantleeFormatter::formatSearchResults( const QString& words, const QLis
foreach ( const Iter& it, results )
{
QVariantHash h;
h.insert( "title", it.first->name() );
h.insert( "content", it.second );
h.insert( QStringLiteral("title"), it.first->name() );
h.insert( QStringLiteral("content"), it.second );
list += h;
}
Grantlee::Context ctx;
ctx.insert( "htmltitle", i18n( "Search Results" ) );
ctx.insert( "title", i18n( "Search Results for '%1':", words.toHtmlEscaped() ) );
ctx.insert( "results", list );
ctx.insert( QStringLiteral("htmltitle"), i18n( "Search Results" ) );
ctx.insert( QStringLiteral("title"), i18n( "Search Results for '%1':", words.toHtmlEscaped() ) );
ctx.insert( QStringLiteral("results"), list );
return d->format( t, &ctx );
}
......@@ -65,7 +65,7 @@ void History::setupActions( KActionCollection *coll )
QPair<KGuiItem, KGuiItem> backForward = KStandardGuiItem::backAndForward();
m_backAction = new KToolBarPopupAction( QIcon::fromTheme( backForward.first.iconName() ), backForward.first.text(), this );
coll->addAction( "back", m_backAction );
coll->addAction( QStringLiteral("back"), m_backAction );
coll->setDefaultShortcuts(m_backAction, KStandardShortcut::back());
connect(m_backAction, &KToolBarPopupAction::triggered, this, &History::back);
......@@ -345,7 +345,7 @@ void History::fillHistoryPopup( QMenu *popup, bool onlyBack, bool onlyForward, b
{
QString text = (*it)->title;
text = KStringHandler::csqueeze(text, 50); //CT: squeeze
text.replace( '&', "&&" );
text.replace( QLatin1Char('&'), QStringLiteral("&&") );
QAction *action = popup->addAction( text );
action->setData( i );
if ( checkCurrentItem && *it == current )
......
......@@ -53,7 +53,7 @@ InfoCategoryItem::InfoCategoryItem( NavigatorItem *parent, const QString &text )
{
setAutoDeleteDocEntry( true );
setExpanded( false );
setIcon( 0, QIcon::fromTheme( "help-contents" ) );
setIcon( 0, QIcon::fromTheme( QStringLiteral("help-contents") ) );
// qCDebug(KHC_LOG) << "Got category: " << text;
}
......@@ -61,9 +61,9 @@ void InfoCategoryItem::itemExpanded( bool open )
{
NavigatorItem::itemExpanded( open );
if ( open && childCount() > 0 ) setIcon( 0, QIcon::fromTheme( "help-contents" ) );
if ( open && childCount() > 0 ) setIcon( 0, QIcon::fromTheme( QStringLiteral("help-contents") ) );
// TODO: was contents2 -> needs to be changed to help-contents-alternate or similar
else setIcon( 0, QIcon::fromTheme( "help-contents" ) );
else setIcon( 0, QIcon::fromTheme( QStringLiteral("help-contents") ) );
}
InfoNodeItem::InfoNodeItem( InfoCategoryItem *parent, const QString &text )
......@@ -96,12 +96,12 @@ void InfoTree::build( NavigatorItem *parent )
const QString infoPath = QFile::decodeName( qgetenv( "INFOPATH" ) );
if ( !infoPath.isEmpty() )
infoDirFiles += infoPath.split( ':');
infoDirFiles += infoPath.split( QLatin1Char(':'));
QStringList::ConstIterator it = infoDirFiles.constBegin();
QStringList::ConstIterator end = infoDirFiles.constEnd();
for ( ; it != end; ++it ) {
QString infoDirFileName = *it + "/dir";
QString infoDirFileName = *it + QStringLiteral("/dir");
if ( QFile::exists( infoDirFileName ) )
parseInfoDirFile( infoDirFileName );
}
......@@ -142,7 +142,7 @@ void InfoTree::parseInfoDirFile( const QString &infoDirFileName )
const int dot = s.indexOf( QLatin1Char( '.' ), closeBrace );
QString appName = s.mid( 2, colon - 2 );
QString url = "info:/" + s.mid( openBrace + 1, closeBrace - openBrace - 1 );
QString url = QStringLiteral("info:/") + s.mid( openBrace + 1, closeBrace - openBrace - 1 );
if ( dot - closeBrace > 1 )
url += QLatin1Char('/') + s.mid( closeBrace + 1, dot - closeBrace - 1 );
else
......
......@@ -68,7 +68,7 @@ using namespace KHC;
class LogDialog : public QDialog
{
public:
LogDialog( QWidget *parent = 0 )
explicit LogDialog( QWidget *parent = nullptr )
: QDialog( parent )
{
setWindowTitle( i18n("Search Error Log") );
......@@ -111,7 +111,7 @@ MainWindow::MainWindow()
{
setObjectName( QLatin1String( "MainWindow" ) );
QDBusConnection::sessionBus().registerObject("/KHelpCenter", this, QDBusConnection::ExportScriptableSlots);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/KHelpCenter"), this, QDBusConnection::ExportScriptableSlots);
mSplitter = new QSplitter( this );
mDoc = new View( mSplitter, this, KHTMLPart::DefaultGUI, actionCollection() );
......@@ -140,7 +140,7 @@ MainWindow::MainWindow()
const KParts::OpenUrlArguments &, const KParts::BrowserArguments & ) ) );
mNavigator = new Navigator( mDoc, mSplitter );
mNavigator->setObjectName( "nav" );
mNavigator->setObjectName( QStringLiteral("nav") );
connect( mNavigator, SIGNAL( itemSelected( const QString & ) ),
SLOT( viewUrl( const QString & ) ) );
connect( mNavigator, SIGNAL( glossSelected( const GlossaryEntry & ) ),
......@@ -157,7 +157,7 @@ MainWindow::MainWindow()
{
if ( Prefs::useKonqSettings() ) {
KConfig konqCfg( "konquerorrc" );
KConfig konqCfg( QStringLiteral("konquerorrc") );
const_cast<KHTMLSettings *>( mDoc->settings() )->init( &konqCfg );
}
const int fontScaleFactor = Prefs::fontzoomfactor();
......@@ -231,13 +231,13 @@ void MainWindow::setupActions()
actionCollection()->addAction( KStandardAction::Quit, this, SLOT( close() ) );
actionCollection()->addAction( KStandardAction::Print, this, SLOT( print() ) );
QAction *prevPage = actionCollection()->addAction( "prevPage" );
QAction *prevPage = actionCollection()->addAction( QStringLiteral("prevPage") );
prevPage->setText( i18n( "Previous Page" ) );
actionCollection()->setDefaultShortcut(prevPage, Qt::CTRL+Qt::Key_PageUp );
prevPage->setWhatsThis( i18n( "Moves to the previous page of the document" ) );
connect( prevPage, SIGNAL( triggered() ), mDoc, SLOT( prevPage() ) );
QAction *nextPage = actionCollection()->addAction( "nextPage" );
QAction *nextPage = actionCollection()->addAction( QStringLiteral("nextPage") );
nextPage->setText( i18n( "Next Page" ) );
actionCollection()->setDefaultShortcut(nextPage, Qt::CTRL + Qt::Key_PageDown );
nextPage->setWhatsThis( i18n( "Moves to the next page of the document" ) );
......@@ -250,7 +250,7 @@ void MainWindow::setupActions()
home->setWhatsThis(i18n("Go back to the table of contents"));
mCopyText = KStandardAction::copy( this, SLOT(slotCopySelectedText()), this );
actionCollection()->addAction( "copy_text", mCopyText );
actionCollection()->addAction( QStringLiteral("copy_text"), mCopyText );
mLastSearchAction = actionCollection()->addAction( QLatin1String("lastsearch") );
mLastSearchAction->setText( i18n("&Last Search Result") );
......@@ -347,7 +347,7 @@ void MainWindow::viewUrl( const QUrl &url, const KParts::OpenUrlArguments &args,
QString proto = url.scheme().toLower();
if ( proto == "khelpcenter" ) {
if ( proto == QLatin1String("khelpcenter") ) {
History::self().createEntry();
mNavigator->openInternalUrl( url );
return;
......@@ -366,7 +366,7 @@ void MainWindow::viewUrl( const QUrl &url, const KParts::OpenUrlArguments &args,
else if ( url.isLocalFile() ) {
QMimeDatabase db;
QMimeType mime = db.mimeTypeForUrl( url );
if ( mime.inherits("text/html") )
if ( mime.inherits(QStringLiteral("text/html")) )
own = true;
}
......@@ -436,7 +436,7 @@ void MainWindow::slotGlossSelected(const GlossaryEntry &entry)
{
stop();
History::self().createEntry();
mDoc->begin( QUrl( "glossentry:" + entry.id() ) );
mDoc->begin( QUrl( QStringLiteral("glossentry:") + entry.id() ) );
mDoc->write( mDoc->grantleeFormatter()->formatGlossaryEntry( entry ) );
mDoc->end();
}
......
......@@ -189,17 +189,17 @@ void Navigator::insertParentAppDocs( const QString &name, NavigatorItem *topItem
void Navigator::insertKCMDocs( const QString &name, NavigatorItem *topItem, const QString &type )
{
qCDebug(KHC_LOG) << "Requested KCM documents for ID" << name;
QString systemsettingskontrolconstraint = "[X-KDE-System-Settings-Parent-Category] != ''";
QString konquerorcontrolconstraint = "[X-KDE-PluginKeyword] == 'khtml_general'\
QString systemsettingskontrolconstraint = QStringLiteral("[X-KDE-System-Settings-Parent-Category] != ''");
QString konquerorcontrolconstraint = QStringLiteral("[X-KDE-PluginKeyword] == 'khtml_general'\
or [X-KDE-PluginKeyword] == 'performance'\
or [X-KDE-PluginKeyword] == 'bookmarks'";
QString filemanagercontrolconstraint = "[X-KDE-PluginKeyword] == 'behavior'\
or [X-KDE-PluginKeyword] == 'bookmarks'");
QString filemanagercontrolconstraint = QStringLiteral("[X-KDE-PluginKeyword] == 'behavior'\
or [X-KDE-PluginKeyword] == 'dolphinviewmodes'\
or [X-KDE-PluginKeyword] == 'dolphinnavigation'\
or [X-KDE-PluginKeyword] == 'dolphinservices'\
or [X-KDE-PluginKeyword] == 'dolphingeneral'\
or [X-KDE-PluginKeyword] == 'trash'";
QString browsercontrolconstraint = "[X-KDE-PluginKeyword] == 'khtml_behavior'\
or [X-KDE-PluginKeyword] == 'trash'");
QString browsercontrolconstraint = QStringLiteral("[X-KDE-PluginKeyword] == 'khtml_behavior'\
or [X-KDE-PluginKeyword] == 'proxy'\
or [X-KDE-PluginKeyword] == 'khtml_appearance'\
or [X-KDE-PluginKeyword] == 'khtml_filter'\
......@@ -207,26 +207,26 @@ void Navigator::insertKCMDocs( const QString &name, NavigatorItem *topItem, cons
or [X-KDE-PluginKeyword] == 'cookie'\
or [X-KDE-PluginKeyword] == 'useragent'\
or [X-KDE-PluginKeyword] == 'khtml_java_js'\
or [X-KDE-PluginKeyword] == 'khtml_plugins'";
or [X-KDE-PluginKeyword] == 'khtml_plugins'");
/* missing in browsercontrolconstraint
History no X-KDE-PluginKeyword in kcmhistory.desktop
*/
QString othercontrolconstraint = "[X-KDE-PluginKeyword] == 'cgi'";
QString othercontrolconstraint = QStringLiteral("[X-KDE-PluginKeyword] == 'cgi'");
KService::List list;
if ( type == QString("kcontrol") ) {
list = KServiceTypeTrader::self()->query( "KCModule", systemsettingskontrolconstraint );
} else if ( type == QString("konquerorcontrol") ) {
list = KServiceTypeTrader::self()->query( "KCModule", konquerorcontrolconstraint );
} else if ( type == QString("browsercontrol") ) {
list = KServiceTypeTrader::self()->query( "KCModule", browsercontrolconstraint );
} else if ( type == QString("filemanagercontrol") ) {
list = KServiceTypeTrader::self()->query( "KCModule", filemanagercontrolconstraint );
} else if ( type == QString("othercontrol") ) {
list = KServiceTypeTrader::self()->query( "KCModule", othercontrolconstraint );
} else if ( type == QString("kinfocenter") ) {
list = KServiceTypeTrader::self()->query( "KCModule", "[X-KDE-ParentApp] == 'kinfocenter'" );
if ( type == QLatin1String("kcontrol") ) {
list = KServiceTypeTrader::self()->query( QStringLiteral("KCModule"), systemsettingskontrolconstraint );
} else if ( type == QLatin1String("konquerorcontrol") ) {
list = KServiceTypeTrader::self()->query( QStringLiteral("KCModule"), konquerorcontrolconstraint );
} else if ( type == QLatin1String("browsercontrol") ) {
list = KServiceTypeTrader::self()->query( QStringLiteral("KCModule"), browsercontrolconstraint );
} else if ( type == QLatin1String("filemanagercontrol") ) {
list = KServiceTypeTrader::self()->query( QStringLiteral("KCModule"), filemanagercontrolconstraint );
} else if ( type == QLatin1String("othercontrol") ) {
list = KServiceTypeTrader::self()->query( QStringLiteral("KCModule"), othercontrolconstraint );
} else if ( type == QLatin1String("kinfocenter") ) {
list = KServiceTypeTrader::self()->query( QStringLiteral("KCModule"), QStringLiteral("[X-KDE-ParentApp] == 'kinfocenter'") );
}
for ( KService::List::const_iterator it = list.constBegin(); it != list.constEnd(); ++it )
......@@ -254,7 +254,7 @@ void Navigator::insertIOSlaveDocs( const QString &name, NavigatorItem *topItem )
// First parameter is ignored if second is an absolute path
QUrl url(QStringLiteral("help:/") + docPath);
QString icon = KProtocolInfo::icon(*it);
if ( icon.isEmpty() ) icon = "text-plain";
if ( icon.isEmpty() ) icon = QStringLiteral("text-plain");
DocEntry *entry = new DocEntry( *it, url.url(), icon );
NavigatorItem *item = new NavigatorAppItem( entry, topItem, prevItem );
prevItem = item;
......@@ -272,7 +272,7 @@ void Navigator::createItemFromDesktopFile( NavigatorItem *topItem,
// First parameter is ignored if second is an absolute path
QUrl url(QStringLiteral("help:/") + docPath);
QString icon = desktopFile.readIcon();
if ( icon.isEmpty() ) icon = "text-plain";
if ( icon.isEmpty() ) icon = QStringLiteral("text-plain");
DocEntry *entry = new DocEntry( desktopFile.readName(), url.url(), icon );
NavigatorItem *item = new NavigatorAppItem( entry, topItem );
item->setAutoDeleteDocEntry( true );
......@@ -295,7 +295,7 @@ void Navigator::selectItem( const QUrl &url )
{
qCDebug(KHC_LOG) << "Navigator::selectItem(): " << url.url();
if ( url.url() == "khelpcenter:home" ) {
if ( url.url() == QLatin1String("khelpcenter:home") ) {
clearSelection();
return;
}
......@@ -306,7 +306,7 @@ void Navigator::selectItem( const QUrl &url )
QUrl alternativeURL = url;
if (url.hasFragment())
{
alternativeURL.setQuery("anchor="+url.fragment());
alternativeURL.setQuery(QStringLiteral("anchor=")+url.fragment());
alternativeURL.setFragment(QString());
}
......@@ -375,7 +375,7 @@ void Navigator::slotItemSelected( QTreeWidgetItem *currentItem )
if ( url.scheme() == "khelpcenter" ) {
if ( url.scheme() == QLatin1String("khelpcenter") ) {
mView->closeUrl();
History::self().updateCurrentEntry( mView );
History::self().createEntry();
......@@ -400,7 +400,7 @@ void Navigator::slotItemCollapsed( QTreeWidgetItem *item )
void Navigator::openInternalUrl( const QUrl &url )
{
if ( url.url() == "khelpcenter:home" ) {
if ( url.url() == QLatin1String("khelpcenter:home") ) {
clearSelection();
showOverview( nullptr, url );
return;
......@@ -523,7 +523,7 @@ void Navigator::slotSearch()
void Navigator::slotShowSearchResult( const QString &url )
{
QString u = url;
u.replace( "%k", mSearchEdit->text() );
u.replace( QStringLiteral("%k"), mSearchEdit->text() );
emit itemSelected( u );
}
......
......@@ -112,9 +112,9 @@ void NavigatorAppGroupItem::populate( bool recursive )
case KST_KServiceGroup:
{
const KServiceGroup::Ptr g(static_cast<KServiceGroup*>(e.data()));
if ( ( g->childCount() == 0 ) || g->name().startsWith( '.' ) )
if ( ( g->childCount() == 0 ) || g->name().startsWith( QLatin1Char('.') ) )
continue;
DocEntry *entry = new DocEntry( g->caption(), "", g->icon() );
DocEntry *entry = new DocEntry( g->caption(), QString(), g->icon() );
NavigatorAppGroupItem *appItem;
appItem = new NavigatorAppGroupItem( entry, this, g->relPath() );
appItem->setAutoDeleteDocEntry( true );
......
......@@ -69,7 +69,7 @@ void PluginTraverser::process( DocEntry *entry )
mCurrentItem = new NavigatorAppItem( entry, mParentItem, mCurrentItem );
} else if ( entry->khelpcenterSpecial() == QLatin1String("apps") ) {
NavigatorAppGroupItem *appItem;
entry->setIcon( "kde" );
entry->setIcon( QStringLiteral("kde") );
if ( mListView )
appItem = new NavigatorAppGroupItem( entry, mListView, mCurrentItem );
else
......@@ -85,17 +85,17 @@ void PluginTraverser::process( DocEntry *entry )
if ( entry->khelpcenterSpecial() == QLatin1String("konqueror") ) {
mNavigator->insertParentAppDocs( entry->khelpcenterSpecial(), mCurrentItem );
} else if ( entry->khelpcenterSpecial() == QLatin1String("kcontrol") ) {
mNavigator->insertKCMDocs( entry->khelpcenterSpecial(), mCurrentItem, QString("kcontrol") );
mNavigator->insertKCMDocs( entry->khelpcenterSpecial(), mCurrentItem, QStringLiteral("kcontrol") );
} else if ( entry->khelpcenterSpecial() == QLatin1String("konquerorcontrol") ) {
mNavigator->insertKCMDocs( entry->khelpcenterSpecial(), mCurrentItem, QString("konquerorcontrol") );
mNavigator->insertKCMDocs( entry->khelpcenterSpecial(), mCurrentItem, QStringLiteral("konquerorcontrol") );
} else if ( entry->khelpcenterSpecial() == QLatin1String("filemanagercontrol") ) {
mNavigator->insertKCMDocs( entry->khelpcenterSpecial(), mCurrentItem, QString("filemanagercontrol") );
mNavigator->insertKCMDocs( entry->khelpcenterSpecial(), mCurrentItem, QStringLiteral("filemanagercontrol") );
} else if ( entry->khelpcenterSpecial() == QLatin1String("browsercontrol") ) {
mNavigator->insertKCMDocs( entry->khelpcenterSpecial(), mCurrentItem, QString("browsercontrol") );
mNavigator->insertKCMDocs( entry->khelpcenterSpecial(), mCurrentItem, QStringLiteral("browsercontrol") );
} else if ( entry->khelpcenterSpecial() == QLatin1String("othercontrol") ) {
mNavigator->insertKCMDocs( entry->khelpcenterSpecial(), mCurrentItem, QString("othercontrol") );
mNavigator->insertKCMDocs( entry->khelpcenterSpecial(), mCurrentItem, QStringLiteral("othercontrol") );
} else if ( entry->khelpcenterSpecial() == QLatin1String("kinfocenter") ) {
mNavigator->insertKCMDocs( entry->khelpcenterSpecial(), mCurrentItem, QString("kinfocenter") );
mNavigator->insertKCMDocs( entry->khelpcenterSpecial(), mCurrentItem, QStringLiteral("kinfocenter") );
} else if ( entry->khelpcenterSpecial() == QLatin1String("kioslave") ) {
mNavigator->insertIOSlaveDocs( entry->khelpcenterSpecial(), mCurrentItem );
} else if ( entry->khelpcenterSpecial() == QLatin1String("info") ) {
......
......@@ -67,7 +67,7 @@ void ScrollKeeperTreeBuilder::build( NavigatorItem *parent )
qCWarning(KHC_LOG) << "Could not execute scrollkeeper-get-content-list";
return;
}
mContentsList = proc.readAllStandardOutput().trimmed();
mContentsList =QString::fromUtf8( proc.readAllStandardOutput().trimmed());
if (!QFile::exists(mContentsList)) {
qCWarning(KHC_LOG) << "Scrollkeeper contents file" << mContentsList
......@@ -75,7 +75,7 @@ void ScrollKeeperTreeBuilder::build( NavigatorItem *parent )
return;
}
QDomDocument doc("ScrollKeeperContentsList");
QDomDocument doc(QStringLiteral("ScrollKeeperContentsList"));
QFile f(mContentsList);
if ( !f.open( QIODevice::ReadOnly ) )
return;
......@@ -94,7 +94,7 @@ void ScrollKeeperTreeBuilder::build( NavigatorItem *parent )
while( !n.isNull() ) {
QDomElement e = n.toElement();
if( !e.isNull() ) {
if (e.tagName() == "sect") {
if (e.tagName() == QLatin1String("sect")) {
NavigatorItem *createdItem;
insertSection( parent, e, createdItem );
}
......@@ -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( "", "", "help-contents" );
DocEntry *entry = new DocEntry( QString(), QString(), QLatin1String("help-contents") );
sectItem = new NavigatorItem( entry, parent );
sectItem->setAutoDeleteDocEntry( true );