Commit 5fad746a authored by Laurent Montel's avatar Laurent Montel 😁

Fix some clazy warning

parent 085c72be
......@@ -82,13 +82,13 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
//qDebug() << "kfmclient starting" << QTime::currentTime();
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("noninteractive"), i18n("Non interactive use: no message boxes")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("noninteractive"), i18n("Non interactive use: no message boxes")));
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("commands"), i18n("Show available commands")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("commands"), i18n("Show available commands")));
parser.addPositionalArgument(QLatin1String("command"), i18n("Command (see --commands)"));
parser.addPositionalArgument(QStringLiteral("command"), i18n("Command (see --commands)"));
parser.addPositionalArgument(QLatin1String("[URL(s)]"), i18n("Arguments for command"));
parser.addPositionalArgument(QStringLiteral("[URL(s)]"), i18n("Arguments for command"));
parser.addOption(QCommandLineOption(QStringList{"tempfile"}, i18n("The files/URLs opened by the application will be deleted after use")));
......@@ -97,7 +97,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
const QStringList args = parser.positionalArguments();
if (args.isEmpty() || parser.isSet("commands")) {
if (args.isEmpty() || parser.isSet(QStringLiteral("commands"))) {
puts(i18n("\nSyntax:\n").toLocal8Bit());
puts(i18n(" kfmclient openURL 'url' ['mimetype']\n"
" # Opens a window showing 'url'.\n"
......@@ -237,14 +237,14 @@ bool ClientApp::doIt(const QCommandLineParser &parser)
int argc = args.count();
checkArgumentCount(argc, 1, 0);
if (!parser.isSet("noninteractive")) {
if (!parser.isSet(QStringLiteral("noninteractive"))) {
m_interactive = false;
}
QString command = args.at(0);
if (command == QLatin1String("openURL") || command == QLatin1String("newTab")) {
checkArgumentCount(argc, 1, 3);
const bool tempFile = parser.isSet("tempfile");
const bool tempFile = parser.isSet(QStringLiteral("tempfile"));
if (argc == 1) {
return createNewWindow(QUrl::fromLocalFile(QDir::homePath()), command == QLatin1String("newTab"), tempFile);
}
......
......@@ -221,7 +221,7 @@ void PluginBabelFish::slotEnableMenu()
if (part && textExt) {
const QString scheme = part->url().scheme(); // always lower case
if ((scheme == "http") || (scheme == "https")) {
if ((scheme == QLatin1String("http")) || (scheme == QLatin1String("https"))) {
if (KParts::BrowserExtension::childObject(part)) {
m_menu->setEnabled(true);
return;
......@@ -272,7 +272,7 @@ void PluginBabelFish::translateURL(QAction *action)
}
const QString urlForQuery = QLatin1String(QUrl::toPercentEncoding(url.url()));
if (url.scheme() == "https") {
if (url.scheme() == QLatin1String("https")) {
if (KMessageBox::warningContinueCancel(part->widget(),
xi18nc("@info", "\
You are viewing this page over a secure connection.<nl/><nl/>\
......@@ -281,7 +281,7 @@ which may fetch the insecure version of the page."),
i18nc("@title:window", "Security Warning"),
KStandardGuiItem::cont(),
KStandardGuiItem::cancel(),
QLatin1String("insecureTranslate")) != KMessageBox::Continue) {
QStringLiteral("insecureTranslate")) != KMessageBox::Continue) {
return;
}
}
......@@ -325,17 +325,17 @@ which may fetch the insecure version of the page."),
}
if (hasSelection) {
// ## does not work
result = QUrl("http://ets.freetranslation.com");
result = QUrl(QStringLiteral("http://ets.freetranslation.com"));
query += QLatin1String("&mode=html&template=results_en-us.htm&srctext=");
query += textForQuery;
} else {
result = QUrl("http://www.freetranslation.com/web.asp");
result = QUrl(QStringLiteral("http://www.freetranslation.com/web.asp"));
query += QLatin1String("&url=");
query += urlForQuery;
}
} else if (engine == QLatin1String("parsit")) {
// Does only English -> Thai
result = QUrl("http://c3po.links.nectec.or.th/cgi-bin/Parsitcgi.exe");
result = QUrl(QStringLiteral("http://c3po.links.nectec.or.th/cgi-bin/Parsitcgi.exe"));
query = QStringLiteral("mode=test&inputtype=");
if (hasSelection) {
query += QLatin1String("text&TxtEng=");
......@@ -345,7 +345,7 @@ which may fetch the insecure version of the page."),
query += urlForQuery;
}
} else if (engine == QLatin1String("reverso")) {
result = QUrl("http://www.reverso.net/url/frame.asp");
result = QUrl(QStringLiteral("http://www.reverso.net/url/frame.asp"));
query = QStringLiteral("autotranslate=on&templates=0&x=0&y=0&directions=");
if (language == QStringLiteral("de_fr")) {
query += QLatin1String("524292");
......@@ -369,7 +369,7 @@ which may fetch the insecure version of the page."),
query += QLatin1String("&url=");
query += urlForQuery;
} else if (engine == QLatin1String("tsail")) {
result = QUrl("http://www.t-mail.com/cgi-bin/tsail");
result = QUrl(QStringLiteral("http://www.t-mail.com/cgi-bin/tsail"));
query = QStringLiteral("sail=full&lp=");
if (language == QStringLiteral("zhTW_en")) {
query += QLatin1String("tw-en");
......@@ -381,7 +381,7 @@ which may fetch the insecure version of the page."),
}
query += urlForQuery;
} else if (engine == QLatin1String("voila")) {
result = QUrl("http://tr.voila.fr/traduire-une-page-web-frame.php");
result = QUrl(QStringLiteral("http://tr.voila.fr/traduire-une-page-web-frame.php"));
const QStringList parts = language.split('_');
if (parts.count() == 2) {
// The translation direction is "first letter of source, first letter of dest"
......@@ -408,7 +408,7 @@ which may fetch the insecure version of the page."),
query += "|" + textForQuery;
result = QUrl(query);
} else { //http://translate.google.com/translate?hl=en&sl=en&tl=de&u=http%3A%2F%2Fkde.org%2F%2F
result = QUrl("http://translate.google.com/translate");
result = QUrl(QStringLiteral("http://translate.google.com/translate"));
query = QStringLiteral("ie=UTF-8");
if (parts.count() == 2) {
query += "&sl=" + parts[0] + "&tl=" + parts[1];
......
......@@ -1336,7 +1336,7 @@ bool ArchiveDialog::urlCheckFailed(KHTMLPart *part, const KUrl &fullURL)
return false;
}
QString ArchiveDialog::escapeHTML(QString in)
QString ArchiveDialog::escapeHTML(const QString &in)
{
return in.toHtmlEscaped().replace('"', QLatin1String("&quot;"));
}
......
......@@ -224,7 +224,7 @@ private:
/**
* Escapes HTML characters. Does not forget " as @ref Qt::escape() does.
*/
QString escapeHTML(QString in);
QString escapeHTML(const QString &in);
/**
* Adds a suffix that hints at the mimetypes if such a suffix is not
......
......@@ -239,7 +239,7 @@ void KKonqGeneralOptions::save()
const QString preferredWebEngine = m_webEngineCombo->itemData(m_webEngineCombo->currentIndex()).toString();
//qDebug() << "preferredWebEngine=" << preferredWebEngine;
KSharedConfig::Ptr profile = KSharedConfig::openConfig("mimeapps.list", KConfig::NoGlobals, QStandardPaths::ConfigLocation);
KSharedConfig::Ptr profile = KSharedConfig::openConfig(QStringLiteral("mimeapps.list"), KConfig::NoGlobals, QStandardPaths::ConfigLocation);
KConfigGroup addedServices(profile, "Added KDE Service Associations");
Q_FOREACH (const QString &mimeType, QStringList() << "text/html" << "application/xhtml+xml" << "application/xml") {
QStringList services = addedServices.readXdgListEntry(mimeType);
......
......@@ -43,7 +43,7 @@
// == class JavaPolicies =====
JavaPolicies::JavaPolicies(KSharedConfig::Ptr config, const QString &group, bool global,
JavaPolicies::JavaPolicies(const KSharedConfig::Ptr &config, const QString &group, bool global,
const QString &domain) :
Policies(config, group, global, domain, QStringLiteral("java."), QStringLiteral("EnableJava"))
{
......@@ -61,7 +61,7 @@ JavaPolicies::~JavaPolicies()
// == class KJavaOptions =====
KJavaOptions::KJavaOptions(KSharedConfig::Ptr config, const QString &group,
KJavaOptions::KJavaOptions(const KSharedConfig::Ptr &config, const QString &group,
QWidget *parent)
: KCModule(parent),
_removeJavaScriptDomainAdvice(false),
......
......@@ -40,7 +40,7 @@ public:
* @param domain name of the domain this instance is used to configure the
* policies for (case insensitive, ignored if global == true)
*/
JavaPolicies(KSharedConfig::Ptr config, const QString &group, bool global,
JavaPolicies(const KSharedConfig::Ptr &config, const QString &group, bool global,
const QString &domain = QString());
/** empty constructur to make QMap happy
......@@ -82,7 +82,7 @@ class KJavaOptions : public KCModule
Q_OBJECT
public:
KJavaOptions(KSharedConfig::Ptr config, const QString &group, QWidget *parent);
KJavaOptions(const KSharedConfig::Ptr &config, const QString &group, QWidget *parent);
void load() Q_DECL_OVERRIDE;
void save() Q_DECL_OVERRIDE;
......
......@@ -241,7 +241,7 @@ QUrl KonqHistoryView::urlForIndex(const QModelIndex &index) const
return QUrl();
}
return index.data(KonqHistory::UrlRole).value<QUrl>();
return index.data(KonqHistory::UrlRole).toUrl();
}
// Code taken from KHTMLPopupGUIClient::slotCopyLinkLocation
......
......@@ -199,7 +199,7 @@ public:
void setCaption(const QString &caption, bool modified) Q_DECL_OVERRIDE
{
Q_UNUSED(modified);
return setCaption(caption);
setCaption(caption);
}
/**
......
......@@ -1187,7 +1187,7 @@ void KonqViewManager::loadItem(const KConfigGroup &cfg, KonqFrameContainerBase *
if (cfg.hasKey(urlKey)) {
url = QUrl(cfg.readPathEntry(urlKey, QStringLiteral("about:blank")));
} else if (urlKey == QLatin1String("empty_URL")) { // old stuff, not in use anymore
url = QUrl(QLatin1String("about:blank"));
url = QUrl(QStringLiteral("about:blank"));
} else {
url = defaultURL;
}
......
......@@ -716,8 +716,8 @@ void WebEngineBrowserExtension::slotSpellCheckSelection()
view()->page()->runJavaScript(QL1S("this.selectionStart + ' ' + this.selectionEnd"), [this, text](const QVariant &value) {
const QString values = value.toString();
const int pos = values.indexOf(' ');
m_spellTextSelectionStart = qMax(0, values.left(pos).toInt());
m_spellTextSelectionEnd = qMax(0, values.mid(pos + 1).toInt());
m_spellTextSelectionStart = qMax(0, values.leftRef(pos).toInt());
m_spellTextSelectionEnd = qMax(0, values.midRef(pos + 1).toInt());
// kDebug() << "selection start:" << m_spellTextSelectionStart << "end:" << m_spellTextSelectionEnd;
Sonnet::BackgroundChecker *backgroundSpellCheck = new Sonnet::BackgroundChecker;
......
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