Commit 05f29058 authored by Laurent Montel's avatar Laurent Montel 😁

Use clazy to add QStringLiteral and others fixes

parent a676a828
This diff is collapsed.
......@@ -91,9 +91,9 @@ void HistoryManagerTest::testAddHistoryEntry()
qRegisterMetaType<KonqHistoryEntry>("KonqHistoryEntry");
QSignalSpy addedSpy(&mgr, SIGNAL(entryAdded(KonqHistoryEntry)));
QSignalSpy removedSpy(&mgr, SIGNAL(entryRemoved(KonqHistoryEntry)));
const QUrl url("http://user@historymgrtest.org/");
const QString typedUrl = "http://www.example.net";
const QString title = "The Title";
const QUrl url(QStringLiteral("http://user@historymgrtest.org/"));
const QString typedUrl = QStringLiteral("http://www.example.net");
const QString title = QStringLiteral("The Title");
mgr.addPending(url, typedUrl, title);
waitForAddedSignal(&mgr);
......
......@@ -53,11 +53,11 @@ private Q_SLOTS:
// Ensure the tests use webenginepart, not KHTML or kwebkitpart
// This code is inspired by settings/konqhtml/generalopts.cpp
bool needsUpdate = false;
KSharedConfig::Ptr profile = KSharedConfig::openConfig("mimeapps.list", KConfig::NoGlobals, QStandardPaths::ApplicationsLocation);
KSharedConfig::Ptr profile = KSharedConfig::openConfig(QStringLiteral("mimeapps.list"), KConfig::NoGlobals, QStandardPaths::ApplicationsLocation);
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);
const QString wanted = "webenginepart.desktop";
const QString wanted = QStringLiteral("webenginepart.desktop");
if (services.isEmpty() || services.at(0) != wanted) {
services.removeAll(wanted);
services.prepend(wanted); // make it the preferred one
......@@ -80,7 +80,7 @@ private Q_SLOTS:
{
KonqMainWindow mainWindow;
// we specify the mimetype so that we don't have to wait for a KonqRun
mainWindow.openUrl(0, QUrl("data:text/html, <p>Hello World</p>"), "text/html");
mainWindow.openUrl(0, QUrl(QStringLiteral("data:text/html, <p>Hello World</p>")), QStringLiteral("text/html"));
KonqView *view = mainWindow.currentView();
QVERIFY(view);
QVERIFY(view->part());
......@@ -95,7 +95,7 @@ private Q_SLOTS:
{
KonqMainWindow mainWindow;
const QUrl url = QUrl::fromLocalFile(QDir::homePath());
mainWindow.openUrl(0, url, "text/html");
mainWindow.openUrl(0, url, QStringLiteral("text/html"));
KonqView *view = mainWindow.currentView();
qDebug() << "Waiting for first completed signal";
QSignalSpy spyCompleted(view, SIGNAL(viewCompleted(KonqView*)));
......@@ -119,7 +119,7 @@ private Q_SLOTS:
"data:text/html, <script type=\"text/javascript\">"
"function closeMe() { window.close(); } "
"document.onmousedown = closeMe; "
"</script>"), QString("text/html"));
"</script>"), QStringLiteral("text/html"));
QPointer<KonqView> view = mainWindow->currentView();
QVERIFY(view);
QSignalSpy spyCompleted(view, SIGNAL(viewCompleted(KonqView*)));
......@@ -194,7 +194,7 @@ private Q_SLOTS:
// would lead to double deletion (#228255)
QPointer<KonqMainWindow> mainWindow = new KonqMainWindow;
// we specify the mimetype so that we don't have to wait for a KonqRun
mainWindow->openUrl(0, QUrl("data:text/html, <script>window.foo=bar</script><p>Hello World</p>"), "text/html");
mainWindow->openUrl(0, QUrl(QStringLiteral("data:text/html, <script>window.foo=bar</script><p>Hello World</p>")), QStringLiteral("text/html"));
KonqView *view = mainWindow->currentView();
QVERIFY(view);
QVERIFY(view->part());
......
......@@ -162,12 +162,12 @@ public:
}
virtual bool visit(KonqFrameContainer *)
{
m_output += "C(";
m_output += QLatin1String("C(");
return true;
}
virtual bool visit(KonqFrameTabs *)
{
m_output += "T[";
m_output += QLatin1String("T[");
return true;
}
virtual bool visit(KonqMainWindow *)
......@@ -196,7 +196,7 @@ public:
DebugFrameVisitor dfv;
bool ok = mainWindow->accept(&dfv);
if (!ok) {
return QString("ERROR: visitor returned false");
return QStringLiteral("ERROR: visitor returned false");
}
return dfv.output();
}
......@@ -215,7 +215,7 @@ void ViewMgrTest::initTestCase()
// Ensure the tests use webenginepart (not khtml or webkit)
// This code is inspired by settings/konqhtml/generalopts.cpp
KSharedConfig::Ptr profile = KSharedConfig::openConfig("mimeapps.list", KConfig::NoGlobals, QStandardPaths::ApplicationsLocation);
KSharedConfig::Ptr profile = KSharedConfig::openConfig(QStringLiteral("mimeapps.list"), KConfig::NoGlobals, QStandardPaths::ApplicationsLocation);
KConfigGroup addedServices(profile, "Added KDE Service Associations");
bool needsUpdate = false;
Q_FOREACH (const QString &mimeType, QStringList() << "text/html" << "application/xhtml+xml" << "application/xml") {
......@@ -223,7 +223,7 @@ void ViewMgrTest::initTestCase()
#ifdef TEST_KHTML
const QString wanted = "khtml.desktop";
#else
const QString wanted = "webenginepart.desktop";
const QString wanted = QStringLiteral("webenginepart.desktop");
#endif
if (services.isEmpty() || services.at(0) != wanted) {
services.removeAll(wanted);
......@@ -251,7 +251,7 @@ void ViewMgrTest::testCreateFirstView()
{
MyKonqMainWindow mainWindow;
KonqViewManager *viewManager = mainWindow.viewManager();
KonqView *view = viewManager->createFirstView("KonqAboutPage", "konq_aboutpage");
KonqView *view = viewManager->createFirstView(QStringLiteral("KonqAboutPage"), QStringLiteral("konq_aboutpage"));
QVERIFY(view);
QVERIFY(viewManager->tabContainer());
......@@ -306,7 +306,7 @@ void ViewMgrTest::testRemoveFirstView()
{
MyKonqMainWindow mainWindow;
KonqViewManager *viewManager = mainWindow.viewManager();
KonqView *view = viewManager->createFirstView("KonqAboutPage", "konq_aboutpage");
KonqView *view = viewManager->createFirstView(QStringLiteral("KonqAboutPage"), QStringLiteral("konq_aboutpage"));
QCOMPARE(DebugFrameVisitor::inspect(&mainWindow), QString("MT[F].")); // mainWindow, tab widget, one frame
viewManager->removeView(view);
QCOMPARE(DebugFrameVisitor::inspect(&mainWindow), QString("MT[F].")); // removing not allowed
......@@ -317,7 +317,7 @@ void ViewMgrTest::testSplitView()
{
MyKonqMainWindow mainWindow;
KonqViewManager *viewManager = mainWindow.viewManager();
KonqView *view = viewManager->createFirstView("KonqAboutPage", "konq_aboutpage");
KonqView *view = viewManager->createFirstView(QStringLiteral("KonqAboutPage"), QStringLiteral("konq_aboutpage"));
QCOMPARE(DebugFrameVisitor::inspect(&mainWindow), QString("MT[F].")); // mainWindow, tab widget, one frame
KonqView *view2 = viewManager->splitView(view, Qt::Horizontal);
......@@ -401,10 +401,10 @@ void ViewMgrTest::testSplitMainContainer()
{
MyKonqMainWindow mainWindow;
KonqViewManager *viewManager = mainWindow.viewManager();
KonqView *view = viewManager->createFirstView("KonqAboutPage", "konq_aboutpage");
KonqView *view = viewManager->createFirstView(QStringLiteral("KonqAboutPage"), QStringLiteral("konq_aboutpage"));
QCOMPARE(DebugFrameVisitor::inspect(&mainWindow), QString("MT[F].")); // mainWindow, tab widget, one frame
KonqFrameContainerBase *tabContainer = view->frame()->parentContainer();
KonqView *view2 = viewManager->splitMainContainer(view, Qt::Horizontal, "KonqAboutPage", "konq_aboutpage", true);
KonqView *view2 = viewManager->splitMainContainer(view, Qt::Horizontal, QStringLiteral("KonqAboutPage"), QStringLiteral("konq_aboutpage"), true);
QVERIFY(view2);
QCOMPARE(DebugFrameVisitor::inspect(&mainWindow), QString("MC(FT[F]).")); // mainWindow, splitter, frame, tab widget, one frame
......@@ -442,7 +442,7 @@ static void openHtmlWithLink(KonqMainWindow &mainWindow)
{
// Much like KonqHtmlTest::loadSimpleHtml.
// We use text/plain as the linked file, in order to test #67956 (switching parts in new tab)
mainWindow.openUrl(0, QUrl("data:text/html, <a href=\"data:text/plain, Link target\" id=\"linkid\">Click me</a>"), "text/html");
mainWindow.openUrl(0, QUrl(QStringLiteral("data:text/html, <a href=\"data:text/plain, Link target\" id=\"linkid\">Click me</a>")), QStringLiteral("text/html"));
KonqView *view = mainWindow.currentView();
QVERIFY(view);
QSignalSpy spyCompleted(view, SIGNAL(viewCompleted(KonqView*)));
......@@ -490,7 +490,7 @@ void ViewMgrTest::testLinkedViews()
QTest::qWait(0);
#else
QTest::mouseClick(part->view()->focusProxy(), Qt::LeftButton, Qt::KeyboardModifiers(),
elementCenter(part->view()->page(), "linkid"));
elementCenter(part->view()->page(), QStringLiteral("linkid")));
// Check that the link opened in the 2nd view, not the first one
#endif
......@@ -507,7 +507,7 @@ void ViewMgrTest::testPopupNewTab() // RMB, "Open in new tab"
openHtmlWithLink(mainWindow);
KonqFrameTabs *tabs = mainWindow.viewManager()->tabContainer();
QCOMPARE(tabs->currentIndex(), 0);
KFileItem item(QUrl("data:text/html, hello"), "text/html", S_IFREG);
KFileItem item(QUrl(QStringLiteral("data:text/html, hello")), QStringLiteral("text/html"), S_IFREG);
mainWindow.prepareForPopupMenu(KFileItemList() << item, KParts::OpenUrlArguments(), KParts::BrowserArguments());
QMetaObject::invokeMethod(&mainWindow, "slotPopupNewTab");
QTest::qWait(1000);
......@@ -544,7 +544,7 @@ void ViewMgrTest::testPopupNewWindow() // RMB, "Open new window"
{
MyKonqMainWindow mainWindow;
openHtmlWithLink(mainWindow);
KFileItem item(QUrl("data:text/html, hello"), "text/html", S_IFREG);
KFileItem item(QUrl(QStringLiteral("data:text/html, hello")), QStringLiteral("text/html"), S_IFREG);
mainWindow.prepareForPopupMenu(KFileItemList() << item, KParts::OpenUrlArguments(), KParts::BrowserArguments());
QMetaObject::invokeMethod(&mainWindow, "slotPopupNewWindow");
QTest::qWait(100);
......@@ -610,14 +610,14 @@ void ViewMgrTest::sameTestsWithMmbOpenTabsFalse()
static void openTabWithTitle(KonqMainWindow &mainWindow, const QString &title, KonqView *&view)
{
KonqViewManager *viewManager = mainWindow.viewManager();
view = viewManager->addTab("text/html");
view = viewManager->addTab(QStringLiteral("text/html"));
QVERIFY(view);
QVERIFY(view->supportsMimeType("text/html"));
QVERIFY(!view->supportsMimeType("text/plain"));
// correct since it's a subclass of text/html, khtml can display it
QVERIFY(view->supportsMimeType("application/x-netscape-bookmarks"));
// Tab caption test
view->openUrl(QUrl("data:text/html, <title>" + title.toUtf8() + "</title>"), QString("http://loc.bar.url"));
view->openUrl(QUrl("data:text/html, <title>" + title.toUtf8() + "</title>"), QStringLiteral("http://loc.bar.url"));
QSignalSpy spyCompleted(view, SIGNAL(viewCompleted(KonqView*)));
QVERIFY(spyCompleted.wait(10000));
QCOMPARE(view->caption(), title);
......@@ -629,7 +629,7 @@ void ViewMgrTest::testAddTabs()
MyKonqMainWindow mainWindow;
KonqViewManager *viewManager = mainWindow.viewManager();
KonqView *view = viewManager->createFirstView("KonqAboutPage", "konq_aboutpage");
KonqView *view = viewManager->createFirstView(QStringLiteral("KonqAboutPage"), QStringLiteral("konq_aboutpage"));
QVERIFY(view);
// The testcase was "konqueror www.kde.org www.google.fr bugs.kde.org www.cuil.com www.davidfaure.fr"
const QStringList titles {
......@@ -683,7 +683,7 @@ void ViewMgrTest::testDuplicateTab()
{
MyKonqMainWindow mainWindow;
KonqViewManager *viewManager = mainWindow.viewManager();
/*KonqView* view =*/ viewManager->createFirstView("KonqAboutPage", "konq_aboutpage");
/*KonqView* view =*/ viewManager->createFirstView(QStringLiteral("KonqAboutPage"), QStringLiteral("konq_aboutpage"));
viewManager->duplicateTab(0); // should return a KonqFrameBase?
QCOMPARE(DebugFrameVisitor::inspect(&mainWindow), QString("MT[FF].")); // mainWindow, tab widget, two tabs
......@@ -694,7 +694,7 @@ void ViewMgrTest::testDuplicateSplittedTab()
{
MyKonqMainWindow mainWindow;
KonqViewManager *viewManager = mainWindow.viewManager();
KonqView *view = viewManager->createFirstView("KonqAboutPage", "konq_aboutpage");
KonqView *view = viewManager->createFirstView(QStringLiteral("KonqAboutPage"), QStringLiteral("konq_aboutpage"));
KonqView *view2 = viewManager->splitView(view, Qt::Vertical);
QVERIFY(view2);
QCOMPARE(DebugFrameVisitor::inspect(&mainWindow), QString("MT[C(FF)].")); // mainWindow, tab widget, one splitter, two frames
......@@ -751,11 +751,11 @@ void ViewMgrTest::testDeletePartInTab()
QPointer<MyKonqMainWindow> mainWindow = new MyKonqMainWindow;
QVERIFY(mainWindow->testAttribute(Qt::WA_DeleteOnClose));
KonqViewManager *viewManager = mainWindow->viewManager();
QPointer<KonqView> view = viewManager->createFirstView("KonqAboutPage", "konq_aboutpage");
QPointer<KonqView> view = viewManager->createFirstView(QStringLiteral("KonqAboutPage"), QStringLiteral("konq_aboutpage"));
QVERIFY(!view.isNull());
QPointer<QWidget> partWidget = view->part()->widget();
QPointer<KonqView> viewTab2 = viewManager->addTab("text/html");
QPointer<KonqView> viewTab2 = viewManager->addTab(QStringLiteral("text/html"));
QPointer<QWidget> partWidget2 = viewTab2->part()->widget();
QVERIFY(!viewTab2.isNull());
QCOMPARE(DebugFrameVisitor::inspect(mainWindow), QString("MT[FF].")); // mainWindow, tab widget, two tabs
......@@ -775,12 +775,12 @@ void ViewMgrTest::testDeletePartInTab()
void ViewMgrTest::testSaveProfile()
{
MyKonqMainWindow mainWindow;
const QUrl url("data:text/html, <p>Hello World</p>");
mainWindow.openUrl(0, url, "text/html");
const QUrl url(QStringLiteral("data:text/html, <p>Hello World</p>"));
mainWindow.openUrl(0, url, QStringLiteral("text/html"));
KonqViewManager *viewManager = mainWindow.viewManager();
KonqView *view2 = viewManager->addTab("text/html");
const QUrl url2("data:text/html, <p>view2</p>");
view2->openUrl(url2, "2");
KonqView *view2 = viewManager->addTab(QStringLiteral("text/html"));
const QUrl url2(QStringLiteral("data:text/html, <p>view2</p>"));
view2->openUrl(url2, QStringLiteral("2"));
QTabWidget *tabWidget = mainWindow.findChild<QTabWidget *>();
QVERIFY(tabWidget);
......@@ -817,9 +817,9 @@ void ViewMgrTest::testSaveProfile()
void ViewMgrTest::testDuplicateWindow()
{
MyKonqMainWindow mainWindow;
mainWindow.openUrl(0, QUrl("data:text/html, <p>Hello World</p>"), "text/html");
mainWindow.openUrl(0, QUrl(QStringLiteral("data:text/html, <p>Hello World</p>")), QStringLiteral("text/html"));
KonqViewManager *viewManager = mainWindow.viewManager();
KonqView *viewTab2 = viewManager->addTab("text/html");
KonqView *viewTab2 = viewManager->addTab(QStringLiteral("text/html"));
KonqView *splitted = viewManager->splitView(viewTab2, Qt::Horizontal);
Q_UNUSED(splitted);
QCOMPARE(DebugFrameVisitor::inspect(&mainWindow), QString("MT[FC(FF)].")); // mainWindow, tab widget, first tab = one frame, second tab = splitter with two frames
......@@ -830,16 +830,16 @@ void ViewMgrTest::testDuplicateWindow()
void ViewMgrTest::testCloseOtherTabs()
{
MyKonqMainWindow mainWindow;
mainWindow.openUrl(0, QUrl("data:text/html, <p>Hello World</p>"), "text/html");
mainWindow.openUrl(0, QUrl(QStringLiteral("data:text/html, <p>Hello World</p>")), QStringLiteral("text/html"));
KonqViewManager *viewManager = mainWindow.viewManager();
QTabWidget *tabWidget = mainWindow.findChild<QTabWidget *>();
QVERIFY(tabWidget);
QVERIFY(tabWidget->focusWidget());
QCOMPARE(mainWindow.focusWidget()->metaObject()->className(), tabWidget->focusWidget()->metaObject()->className());
viewManager->addTab("text/html");
KonqView *viewTab2 = viewManager->addTab("text/html");
viewManager->addTab(QStringLiteral("text/html"));
KonqView *viewTab2 = viewManager->addTab(QStringLiteral("text/html"));
viewManager->splitView(viewTab2, Qt::Horizontal);
viewManager->addTab("text/html");
viewManager->addTab(QStringLiteral("text/html"));
QCOMPARE(DebugFrameVisitor::inspect(&mainWindow), QString("MT[FFC(FF)F].")); // mainWindow, tab widget, first tab = one frame, second tab = one frame, third tab = splitter with two frames, fourth tab = one frame
QCOMPARE(tabWidget->count(), 4);
tabWidget->setCurrentIndex(2);
......@@ -857,10 +857,10 @@ void ViewMgrTest::testCloseOtherTabs()
void ViewMgrTest::testCloseTabsFast() // #210551/#150162
{
MyKonqMainWindow mainWindow;
mainWindow.openUrl(0, QUrl("data:text/html, <p>Hello World</p>"), "text/html");
mainWindow.openUrl(0, QUrl(QStringLiteral("data:text/html, <p>Hello World</p>")), QStringLiteral("text/html"));
KonqViewManager *viewManager = mainWindow.viewManager();
viewManager->addTab("text/html");
viewManager->addTab("text/html");
viewManager->addTab(QStringLiteral("text/html"));
viewManager->addTab(QStringLiteral("text/html"));
QCOMPARE(DebugFrameVisitor::inspect(&mainWindow), QString("MT[FFF].")); // mainWindow, tab widget, 3 simple tabs
QTabWidget *tabWidget = mainWindow.findChild<QTabWidget *>();
tabWidget->setCurrentIndex(2);
......@@ -875,14 +875,14 @@ void ViewMgrTest::testCloseTabsFast() // #210551/#150162
void ViewMgrTest::testBrowserArgumentsNewTab()
{
MyKonqMainWindow mainWindow;
mainWindow.openUrl(0, QUrl("data:text/html, <p>Hello World</p>"), "text/html");
mainWindow.openUrl(0, QUrl(QStringLiteral("data:text/html, <p>Hello World</p>")), QStringLiteral("text/html"));
KParts::OpenUrlArguments urlArgs;
KParts::BrowserArguments browserArgs;
browserArgs.setNewTab(true);
KonqView *view = mainWindow.currentView();
KParts::BrowserExtension *ext = view->browserExtension();
QVERIFY(ext);
emit ext->openUrlRequest(QUrl("data:text/html, <p>Second tab test</p>"), urlArgs, browserArgs);
emit ext->openUrlRequest(QUrl(QStringLiteral("data:text/html, <p>Second tab test</p>")), urlArgs, browserArgs);
QTest::qWait(5000);
QCOMPARE(DebugFrameVisitor::inspect(&mainWindow), QString("MT[FF].")); // mainWindow, tab widget, two tabs
QCOMPARE(view->url(), QUrl("data:text/html, <p>Hello World</p>"));
......@@ -895,7 +895,7 @@ void ViewMgrTest::testBreakOffTab()
{
MyKonqMainWindow mainWindow;
KonqViewManager *viewManager = mainWindow.viewManager();
/*KonqView* firstView =*/ viewManager->createFirstView("KonqAboutPage", "konq_aboutpage");
/*KonqView* firstView =*/ viewManager->createFirstView(QStringLiteral("KonqAboutPage"), QStringLiteral("konq_aboutpage"));
//KonqFrameBase* tab = firstView->frame();
viewManager->duplicateTab(0);
......@@ -935,12 +935,12 @@ void ViewMgrTest::testBreakOffTab()
void ViewMgrTest::moveTabLeft()
{
MyKonqMainWindow mainWindow;
mainWindow.openUrl(0, QUrl("data:text/html, <p>Hello World</p>"), "text/html");
mainWindow.openUrl(0, QUrl(QStringLiteral("data:text/html, <p>Hello World</p>")), QStringLiteral("text/html"));
KonqViewManager *viewManager = mainWindow.viewManager();
KonqView *view1 = viewManager->addTab("text/html");
view1->openUrl(QUrl("data:text/html, <p>view1</p>"), "1");
KonqView *view2 = viewManager->addTab("text/html");
view2->openUrl(QUrl("data:text/html, <p>view2</p>"), "2");
KonqView *view1 = viewManager->addTab(QStringLiteral("text/html"));
view1->openUrl(QUrl(QStringLiteral("data:text/html, <p>view1</p>")), QStringLiteral("1"));
KonqView *view2 = viewManager->addTab(QStringLiteral("text/html"));
view2->openUrl(QUrl(QStringLiteral("data:text/html, <p>view2</p>")), QStringLiteral("2"));
QCOMPARE(DebugFrameVisitor::inspect(&mainWindow), QString("MT[FFF].")); // mainWindow, tab widget, 3 simple tabs
QTabWidget *tabWidget = mainWindow.findChild<QTabWidget *>();
tabWidget->setCurrentIndex(2);
......
......@@ -38,7 +38,7 @@ private Q_SLOTS:
KonqMainWindow mainWindow;
// we specify the mimetype so that we don't have to wait for a KonqRun
KonqOpenURLRequest req; req.forceAutoEmbed = true;
mainWindow.openUrl(0, QUrl("data:text/plain, Hello World"), "text/plain", req);
mainWindow.openUrl(0, QUrl(QStringLiteral("data:text/plain, Hello World")), QStringLiteral("text/plain"), req);
KonqView *view = mainWindow.currentView();
QVERIFY(view);
QVERIFY(view->part());
......@@ -50,8 +50,8 @@ private Q_SLOTS:
QVERIFY(view->supportsMimeType("text/html")); // it does, since that's a mimetype subclass
// Now open HTML, as if we typed a URL in the location bar.
KonqOpenURLRequest req2; req2.typedUrl = "http://www.kde.org";
mainWindow.openUrl(0, QUrl("data:text/html, <p>Hello World</p>"), "text/html", req2);
KonqOpenURLRequest req2; req2.typedUrl = QStringLiteral("http://www.kde.org");
mainWindow.openUrl(0, QUrl(QStringLiteral("data:text/html, <p>Hello World</p>")), QStringLiteral("text/html"), req2);
qDebug() << view->service()->entryPath();
QVERIFY(view->service()->entryPath() != firstService);
}
......@@ -69,10 +69,10 @@ private Q_SLOTS:
QVERIFY(spyCompleted.wait(10000));
QCOMPARE(view->serviceType(), QString("inode/directory"));
qDebug() << view->internalViewMode();
view->setInternalViewMode("details");
view->setInternalViewMode(QStringLiteral("details"));
QCOMPARE(view->internalViewMode(), QString("details"));
mainWindow.openUrl(0, QUrl("applications:/"));
mainWindow.openUrl(0, QUrl(QStringLiteral("applications:/")));
QCOMPARE(static_cast<KParts::ReadOnlyPart *>(part), view->part());
QCOMPARE(view->internalViewMode(), QString("details"));
}
......
......@@ -53,7 +53,7 @@ void UndoManagerTest::testAddClosedTabItem()
{
KonqUndoManager manager(0);
QVERIFY(!manager.undoAvailable());
KonqClosedTabItem *item = new KonqClosedTabItem("url", "title", 0, manager.newCommandSerialNumber());
KonqClosedTabItem *item = new KonqClosedTabItem(QStringLiteral("url"), QStringLiteral("title"), 0, manager.newCommandSerialNumber());
QCOMPARE(item->url(), QString("url"));
QCOMPARE(item->serialNumber(), quint64(1001));
QCOMPARE(item->pos(), 0);
......
......@@ -109,7 +109,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
}
// Use kfmclient from the session KDE version
if ((args->arg(0) == "openURL" || args->arg(0) == "newTab")
if ((args->arg(0) == QLatin1String("openURL") || args->arg(0) == QLatin1String("newTab"))
&& qEnvironmentVariableIsSet("KDE_FULL_SESSION")) {
int version = KCOREADDONS_VERSION_MAJOR;
if (!qEnvironmentVariableIsSet("KDE_SESSION_VERSION")) { // this is KDE3
......@@ -190,10 +190,10 @@ bool ClientApp::createNewWindow(const QUrl &url, bool newTab, bool tempFile, con
Q_ASSERT(qApp);
if (url.scheme().startsWith(QLatin1String("http"))) {
KConfig config(QLatin1String("kfmclientrc"));
KConfig config(QStringLiteral("kfmclientrc"));
KConfigGroup generalGroup(&config, "General");
const QString browserApp = generalGroup.readEntry("BrowserApplication");
if (!browserApp.isEmpty() && !browserApp.startsWith("!kfmclient")
if (!browserApp.isEmpty() && !browserApp.startsWith(QLatin1String("!kfmclient"))
&& (browserApp.startsWith('!') || KService::serviceByStorageId(browserApp))) {
qDebug() << "Using external browser" << browserApp;
KStartupInfo::appStarted();
......@@ -211,7 +211,7 @@ bool ClientApp::createNewWindow(const QUrl &url, bool newTab, bool tempFile, con
needDBus();
QDBusConnection dbus = QDBusConnection::sessionBus();
KConfig cfg(QLatin1String("konquerorrc"));
KConfig cfg(QStringLiteral("konquerorrc"));
KConfigGroup fmSettings = cfg.group("FMSettings");
if (newTab || fmSettings.readEntry("KonquerorTabforExternalURL", false)) {
......@@ -222,13 +222,13 @@ bool ClientApp::createNewWindow(const QUrl &url, bool newTab, bool tempFile, con
const QStringList allServices = reply;
for (QStringList::const_iterator it = allServices.begin(), end = allServices.end(); it != end; ++it) {
const QString service = *it;
if (service.startsWith("org.kde.konqueror")) {
org::kde::Konqueror::Main konq(service, "/KonqMain", dbus);
if (service.startsWith(QLatin1String("org.kde.konqueror"))) {
org::kde::Konqueror::Main konq(service, QStringLiteral("/KonqMain"), dbus);
QDBusReply<QDBusObjectPath> windowReply = konq.windowForTab();
if (windowReply.isValid()) {
QDBusObjectPath path = windowReply;
// "/" is the indicator for "no object found", since we can't use an empty path
if (path.path() != "/") {
if (path.path() != QLatin1String("/")) {
foundApp = service;
foundObj = path;
}
......@@ -248,7 +248,7 @@ bool ClientApp::createNewWindow(const QUrl &url, bool newTab, bool tempFile, con
}
const QString appId = QString::fromLatin1(s_preloadDBusName);
org::kde::Konqueror::Main konq(appId, "/KonqMain", dbus);
org::kde::Konqueror::Main konq(appId, QStringLiteral("/KonqMain"), dbus);
QDBusReply<QDBusObjectPath> reply = konq.createNewWindow(url.url(), mimetype, startup_id_str, tempFile);
if (reply.isValid()) {
sendASNChange();
......@@ -259,18 +259,18 @@ bool ClientApp::createNewWindow(const QUrl &url, bool newTab, bool tempFile, con
id.initId(startup_id_str);
id.setupStartupEnv();
QStringList args;
args << QLatin1String("konqueror");
args << QStringLiteral("konqueror");
if (!mimetype.isEmpty()) {
args << "-mimetype" << mimetype;
args << QStringLiteral("-mimetype") << mimetype;
}
if (tempFile) {
args << "-tempfile";
args << QStringLiteral("-tempfile");
}
args << url.url();
#ifdef Q_OS_WIN
const int pid = KProcess::startDetached(QLatin1String("kwrapper5"), args);
#else
const int pid = KProcess::startDetached(QLatin1String("kshell5"), args);
const int pid = KProcess::startDetached(QStringLiteral("kshell5"), args);
#endif
KStartupInfo::resetStartupEnv();
qDebug() << "ClientApp::createNewWindow KProcess started, pid=" << pid;
......@@ -326,37 +326,37 @@ bool ClientApp::doIt()
char *(fake_argv[]) = {"kfmclient"};
ClientApp app(fake_argc, fake_argv);
if (command == "openURL" || command == "newTab") {
if (command == QLatin1String("openURL") || command == QLatin1String("newTab")) {
checkArgumentCount(argc, 1, 3);
bool tempFile = KCmdLineArgs::isTempFileSet();
if (argc == 1) {
return createNewWindow(QUrl::fromLocalFile(QDir::homePath()), command == "newTab", tempFile);
return createNewWindow(QUrl::fromLocalFile(QDir::homePath()), command == QLatin1String("newTab"), tempFile);
}
if (argc == 2) {
return createNewWindow(filteredUrl(args), command == "newTab", tempFile);
return createNewWindow(filteredUrl(args), command == QLatin1String("newTab"), tempFile);
}
if (argc == 3) {
return createNewWindow(filteredUrl(args), command == "newTab", tempFile, args->arg(2));
return createNewWindow(filteredUrl(args), command == QLatin1String("newTab"), tempFile, args->arg(2));
}
} else if (command == "openProfile") { // deprecated command, kept for compat
} else if (command == QLatin1String("openProfile")) { // deprecated command, kept for compat
checkArgumentCount(argc, 2, 3);
QUrl url;
if (argc == 3) {
url = args->url(2);
}
return openProfile(args->arg(1), url);
} else if (command == "exec" && argc >= 2) {
} else if (command == QLatin1String("exec") && argc >= 2) {
// compatibility with KDE 3 and xdg-open
QStringList kioclientArgs;
if (!s_interactive) {
kioclientArgs << QLatin1String("--noninteractive");
kioclientArgs << QStringLiteral("--noninteractive");
}
kioclientArgs << "exec" << args->arg(1);
kioclientArgs << QStringLiteral("exec") << args->arg(1);
if (argc == 3) {
kioclientArgs << args->arg(2);
}
int ret = KProcess::execute("kioclient5", kioclientArgs);
int ret = KProcess::execute(QStringLiteral("kioclient5"), kioclientArgs);
return ret == 0;
} else {
fprintf(stderr, "%s: %s", programName, i18n("Syntax error, unknown command '%1'\n", command).toLocal8Bit().data());
......
......@@ -51,7 +51,7 @@ static QStringList extractActionNames(QMenu &menu)
foreach (const QAction *action, menu.actions()) {
if (action->isSeparator()) {
if (!lastIsSeparator) { // Qt gets rid of duplicate separators, so we should too
ret.append("separator");
ret.append(QStringLiteral("separator"));
}
lastIsSeparator = true;
} else {
......@@ -60,16 +60,16 @@ static QStringList extractActionNames(QMenu &menu)
const QString objectName = action->objectName();
if (objectName.isEmpty()) {
if (action->menu()) { // if this fails, then we have an unnamed action somewhere...
ret.append("submenu");
ret.append(QStringLiteral("submenu"));
} else {
ret.append("UNNAMED " + action->text());
}
} else {
if (objectName == "menuaction" // a single service-menu action, or a service-menu submenu: skip; too variable.
|| objectName == "actions_submenu") {
} else if (objectName == "openWith_submenu") {
ret.append("openwith");
} else if (objectName == "openwith_browse" && lastObjectName == "openwith") {
if (objectName == QLatin1String("menuaction") // a single service-menu action, or a service-menu submenu: skip; too variable.
|| objectName == QLatin1String("actions_submenu")) {
} else if (objectName == QLatin1String("openWith_submenu")) {
ret.append(QStringLiteral("openwith"));
} else if (objectName == QLatin1String("openwith_browse") && lastObjectName == QLatin1String("openwith")) {
// We had "open with foo" followed by openwith_browse, all is well.
// The expected lists only say "openwith" so that they work in both cases
// -> skip the browse action.
......@@ -88,55 +88,55 @@ void KonqPopupMenuTest::initTestCase()
{
QStandardPaths::setTestModeEnabled(true);