Commit 3910ea7e authored by Laurent Montel's avatar Laurent Montel 😁

Fix clazy warning

parent afdbd550
......@@ -3,11 +3,11 @@ cmake_minimum_required(VERSION 2.8.12)
project(keditbookmarks)
# ECM setup
set(KF5_MIN_VERSION "5.24.0")
set(KF5_MIN_VERSION "5.28.0")
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
set(QT_MIN_VERSION "5.4.0")
set(QT_MIN_VERSION "5.6.0")
include(ECMOptionalAddSubdirectory)
include(ECMInstallIcons)
......
This diff is collapsed.
......@@ -107,18 +107,18 @@ void BookmarkInfoWidget::updateStatus()
{
//FIXME we don't want every metadata element, but only that with owner "http://www.kde.org"
QString visitDate =
GlobalBookmarkManager::makeTimeStr(m_bk.metaDataItem("time_visited"));
GlobalBookmarkManager::makeTimeStr(m_bk.metaDataItem(QStringLiteral("time_visited")));
m_visitdate_le->setReadOnly(true);
m_visitdate_le->setText(visitDate);
QString creationDate =
GlobalBookmarkManager::makeTimeStr(m_bk.metaDataItem("time_added"));
GlobalBookmarkManager::makeTimeStr(m_bk.metaDataItem(QStringLiteral("time_added")));
m_credate_le->setReadOnly(true);
m_credate_le->setText(creationDate);
// TODO - get the actual field name from the spec if it exists, else copy galeon
m_visitcount_le->setReadOnly(true);
m_visitcount_le->setText(m_bk.metaDataItem("visit_count"));
m_visitcount_le->setText(m_bk.metaDataItem(QStringLiteral("visit_count")));
}
void BookmarkInfoWidget::commitChanges()
......
......@@ -46,7 +46,7 @@ FavIconsItr::~FavIconsItr()
void FavIconsItr::setStatus(const QString & status)
{
currentBookmark().setMetaDataItem("favstate", status);
currentBookmark().setMetaDataItem(QStringLiteral("favstate"), status);
model()->emitDataChanged(currentBookmark());
}
......@@ -62,13 +62,13 @@ bool FavIconsItr::isApplicable(const KBookmark &bk) const
{
if (bk.isGroup() || bk.isSeparator())
return false;
return bk.url().scheme().startsWith("http");
return bk.url().scheme().startsWith(QLatin1String("http"));
}
void FavIconsItr::doAction()
{
// //qDebug() << "FavIconsItr::doAction()";
m_oldStatus = currentBookmark().metaDataItem("favstate");
m_oldStatus = currentBookmark().metaDataItem(QStringLiteral("favstate"));
setStatus(i18n("Updating favicon..."));
if (!m_updater) {
m_updater = new FavIconUpdater(this);
......
......@@ -78,7 +78,7 @@ void FavIconUpdater::downloadIconUsingWebBrowser(const KBookmark &bk, const QStr
if (!m_part) {
QString partLoadingError;
KParts::ReadOnlyPart *part
= KMimeTypeTrader::createPartInstanceFromQuery<KParts::ReadOnlyPart>("text/html", 0, this, QString(), QVariantList(), &partLoadingError);
= KMimeTypeTrader::createPartInstanceFromQuery<KParts::ReadOnlyPart>(QStringLiteral("text/html"), 0, this, QString(), QVariantList(), &partLoadingError);
if (!part) {
emit done(false, i18n("%1; no HTML component found (%2)", currentError, partLoadingError));
return;
......@@ -157,8 +157,8 @@ FavIconWebGrabber::FavIconWebGrabber(KParts::ReadOnlyPart *part, const QUrl &url
//qDebug() << "starting KIO::get() on" << m_url;
KIO::Job *job = KIO::get(m_url, KIO::NoReload, KIO::HideProgressInfo);
job->addMetaData( QString("cookies"), QString("none") );
job->addMetaData( QString("errorPage"), QString("false") );
job->addMetaData( QStringLiteral("cookies"), QStringLiteral("none") );
job->addMetaData( QStringLiteral("errorPage"), QStringLiteral("false") );
connect(job, SIGNAL(result(KJob*)),
this, SLOT(slotFinished(KJob*)));
connect(job, SIGNAL(mimetype(KIO::Job*,QString)),
......
......@@ -63,13 +63,13 @@ QString ImportCommand::folder() const {
ImportCommand* ImportCommand::importerFactory(KBookmarkModel* model, const QString &type)
{
if (type == "Galeon") return new GaleonImportCommand(model);
else if (type == "IE") return new IEImportCommand(model);
else if (type == "KDE2") return new KDE2ImportCommand(model);
else if (type == "Opera") return new OperaImportCommand(model);
if (type == QLatin1String("Galeon")) return new GaleonImportCommand(model);
else if (type == QLatin1String("IE")) return new IEImportCommand(model);
else if (type == QLatin1String("KDE2")) return new KDE2ImportCommand(model);
else if (type == QLatin1String("Opera")) return new OperaImportCommand(model);
//else if (type == "Crashes") return new CrashesImportCommand();
else if (type == "Moz") return new MozImportCommand(model);
else if (type == "NS") return new NSImportCommand(model);
else if (type == QLatin1String("Moz")) return new MozImportCommand(model);
else if (type == QLatin1String("NS")) return new NSImportCommand(model);
else {
qCritical() << "ImportCommand::importerFactory() - invalid type (" << type << ")!" << endl;
return 0;
......@@ -128,7 +128,7 @@ void ImportCommand::redo()
m_cleanUpCmd->redo();
// import at the root
m_group = "";
m_group = QLatin1String("");
}
doExecute(bkGroup);
......@@ -251,17 +251,17 @@ void XBELImportCommand::doExecute(const KBookmarkGroup &/*bkGroup*/) {
QDomDocument doc = GlobalBookmarkManager::self()->mgr()->internalDocument();
// get the xbel
QDomNode subDoc = pManager->internalDocument().namedItem("xbel").cloneNode();
QDomNode subDoc = pManager->internalDocument().namedItem(QStringLiteral("xbel")).cloneNode();
if (subDoc.isProcessingInstruction())
subDoc = subDoc.nextSibling();
if (subDoc.isDocumentType())
subDoc = subDoc.nextSibling();
if (subDoc.nodeName() != "xbel")
if (subDoc.nodeName() != QLatin1String("xbel"))
return;
if (!folder().isEmpty()) {
// transform into folder
subDoc.toElement().setTagName("folder");
subDoc.toElement().setTagName(QStringLiteral("folder"));
// clear attributes
QStringList tags;
......@@ -270,10 +270,10 @@ void XBELImportCommand::doExecute(const KBookmarkGroup &/*bkGroup*/) {
for (QStringList::const_iterator it = tags.constBegin(); it != tags.constEnd(); ++it)
subDoc.attributes().removeNamedItem((*it));
subDoc.toElement().setAttribute("icon", m_icon);
subDoc.toElement().setAttribute(QStringLiteral("icon"), m_icon);
// give the folder a name
QDomElement textElem = doc.createElement("title");
QDomElement textElem = doc.createElement(QStringLiteral("title"));
subDoc.insertBefore(textElem, subDoc.firstChild());
textElem.appendChild(doc.createTextNode(folder()));
}
......
......@@ -101,7 +101,7 @@ class GaleonImportCommand : public XBELImportCommand
public:
GaleonImportCommand(KBookmarkModel* model) : XBELImportCommand(model) { setVisibleName(i18n("Galeon")); }
void import(const QString &fileName, bool folder) Q_DECL_OVERRIDE {
init(fileName, folder, "", false);
init(fileName, folder, QLatin1String(""), false);
}
QString requestFilename() const Q_DECL_OVERRIDE;
};
......@@ -111,7 +111,7 @@ class KDE2ImportCommand : public XBELImportCommand
public:
KDE2ImportCommand(KBookmarkModel* model) : XBELImportCommand(model) { setVisibleName(i18n("KDE")); }
void import(const QString &fileName, bool folder) Q_DECL_OVERRIDE {
init(fileName, folder, "", false);
init(fileName, folder, QLatin1String(""), false);
}
QString requestFilename() const Q_DECL_OVERRIDE;
};
......@@ -132,7 +132,7 @@ class NSImportCommand : public HTMLImportCommand
public:
NSImportCommand(KBookmarkModel* model) : HTMLImportCommand(model) { setVisibleName(i18n("Netscape")); }
void import(const QString &fileName, bool folder) Q_DECL_OVERRIDE {
init(fileName, folder, "netscape", false);
init(fileName, folder, QStringLiteral("netscape"), false);
}
QString requestFilename() const Q_DECL_OVERRIDE;
};
......@@ -142,7 +142,7 @@ class MozImportCommand : public HTMLImportCommand
public:
MozImportCommand(KBookmarkModel* model) : HTMLImportCommand(model) { setVisibleName(i18n("Mozilla")); }
void import(const QString &fileName, bool folder) Q_DECL_OVERRIDE {
init(fileName, folder, "mozilla", true);
init(fileName, folder, QStringLiteral("mozilla"), true);
}
QString requestFilename() const Q_DECL_OVERRIDE;
};
......@@ -152,7 +152,7 @@ class IEImportCommand : public ImportCommand
public:
IEImportCommand(KBookmarkModel* model) : ImportCommand(model) { setVisibleName(i18n("IE")); }
void import(const QString &fileName, bool folder) Q_DECL_OVERRIDE {
init(fileName, folder, "", false);
init(fileName, folder, QLatin1String(""), false);
}
QString requestFilename() const Q_DECL_OVERRIDE;
private:
......@@ -164,7 +164,7 @@ class OperaImportCommand : public ImportCommand
public:
OperaImportCommand(KBookmarkModel* model) : ImportCommand(model) { setVisibleName(i18n("Opera")); }
void import(const QString &fileName, bool folder) Q_DECL_OVERRIDE {
init(fileName, folder, "opera", false);
init(fileName, folder, QStringLiteral("opera"), false);
}
QString requestFilename() const Q_DECL_OVERRIDE;
private:
......
......@@ -55,7 +55,7 @@ int main( int argc, char**argv )
KAboutData::setApplicationData(aboutData);
QCommandLineParser parser;
parser.addPositionalArgument(QLatin1String("directory"), i18n( "Directory to scan for extra bookmarks" ));
parser.addPositionalArgument(QStringLiteral("directory"), i18n( "Directory to scan for extra bookmarks" ));
aboutData.setupCommandLine(&parser);
parser.process(app);
......@@ -75,7 +75,7 @@ int main( int argc, char**argv )
continue;
}
QString mergedFrom = bm.metaDataItem( "merged_from" );
QString mergedFrom = bm.metaDataItem( QStringLiteral("merged_from") );
if ( !mergedFrom.isNull() ) {
mergedFiles << mergedFrom;
}
......@@ -85,7 +85,7 @@ int main( int argc, char**argv )
bool didMergeBookmark = false;
QString extraBookmarksDirName = parser.positionalArguments().at(0);
QDir extraBookmarksDir( extraBookmarksDirName, "*.xml" );
QDir extraBookmarksDir( extraBookmarksDirName, QStringLiteral("*.xml") );
if ( !extraBookmarksDir.isReadable() ) {
qCritical() << "Failed to read files in directory " << extraBookmarksDirName << endl;
return 1;
......@@ -104,7 +104,7 @@ int main( int argc, char**argv )
if ( bm.isGroup() ) {
continue;
}
bm.setMetaDataItem( "merged_from", fileName );
bm.setMetaDataItem( QStringLiteral("merged_from"), fileName );
konqBookmarks->root().addBookmark( bm );
didMergeBookmark = true;
}
......
......@@ -118,7 +118,7 @@ void CreateCommand::redo()
} else if (m_group) {
Q_ASSERT(!m_text.isEmpty());
bk = parentGroup.createNewFolder(m_text);
bk.internalElement().setAttribute("folded", (m_open ? "no" : "yes"));
bk.internalElement().setAttribute(QStringLiteral("folded"), (m_open ? "no" : "yes"));
if (!m_iconPath.isEmpty()) {
bk.setIcon(m_iconPath);
}
......@@ -138,7 +138,7 @@ void CreateCommand::redo()
if (!(text().isEmpty()) && !parentAddress.isEmpty() ) {
// open the parent (useful if it was empty) - only for manual commands
Q_ASSERT( parentGroup.internalElement().tagName() != "xbel" );
parentGroup.internalElement().setAttribute("folded", "no");
parentGroup.internalElement().setAttribute(QStringLiteral("folded"), QStringLiteral("no"));
}
Q_ASSERT(bk.address() == m_to);
......@@ -198,8 +198,8 @@ void EditCommand::redo()
if(mCol==-2)
{
if (mOldValue.isEmpty())
mOldValue = bk.internalElement().attribute("toolbar");
bk.internalElement().setAttribute("toolbar", mNewValue);
mOldValue = bk.internalElement().attribute(QStringLiteral("toolbar"));
bk.internalElement().setAttribute(QStringLiteral("toolbar"), mNewValue);
}
else if(mCol==-1)
{
......@@ -237,7 +237,7 @@ void EditCommand::undo()
KBookmark bk = m_model->bookmarkManager()->findByAddress(mAddress);
if(mCol==-2)
{
bk.internalElement().setAttribute("toolbar", mOldValue);
bk.internalElement().setAttribute(QStringLiteral("toolbar"), mOldValue);
}
else if(mCol==-1)
{
......@@ -309,7 +309,7 @@ void DeleteCommand::redo()
if (bk.isGroup()) {
m_cmd = new CreateCommand(m_model,
m_from, bk.fullText(), bk.icon(),
bk.internalElement().attribute("folded") == "no");
bk.internalElement().attribute(QStringLiteral("folded")) == QLatin1String("no"));
m_subCmd = deleteAll(m_model, bk.toGroup());
m_subCmd->redo();
......@@ -489,12 +489,12 @@ KEBMacroCommand* CmdGen::setAsToolbar(KBookmarkModel* model, const KBookmark &bk
KBookmarkGroup oldToolbar = model->bookmarkManager()->toolbar();
if (!oldToolbar.isNull())
{
new EditCommand(model, oldToolbar.address(), -2, "no", mcmd); //toolbar
new EditCommand(model, oldToolbar.address(), -1, "", mcmd); //icon
new EditCommand(model, oldToolbar.address(), -2, QStringLiteral("no"), mcmd); //toolbar
new EditCommand(model, oldToolbar.address(), -1, QLatin1String(""), mcmd); //icon
}
new EditCommand(model, bk.address(), -2, "yes", mcmd);
new EditCommand(model, bk.address(), -1, "bookmark-toolbar", mcmd);
new EditCommand(model, bk.address(), -2, QStringLiteral("yes"), mcmd);
new EditCommand(model, bk.address(), -1, QStringLiteral("bookmark-toolbar"), mcmd);
return mcmd;
}
......
......@@ -125,8 +125,8 @@ QVariant KBookmarkModel::data(const QModelIndex &index, int role) const
case CommentColumnId:
return bk.description();
case StatusColumnId: {
QString text1 = bk.metaDataItem("favstate"); // favicon state
QString text2 = bk.metaDataItem("linkstate");
QString text1 = bk.metaDataItem(QStringLiteral("favstate")); // favicon state
QString text2 = bk.metaDataItem(QStringLiteral("linkstate"));
if (text1.isEmpty() || text2.isEmpty())
return QVariant( text1 + text2 );
else
......@@ -141,7 +141,7 @@ QVariant KBookmarkModel::data(const QModelIndex &index, int role) const
if (role == Qt::DecorationRole && index.column() == NameColumnId) {
KBookmark bk = bookmarkForIndex(index);
if (bk.address().isEmpty())
return QIcon::fromTheme("bookmarks");
return QIcon::fromTheme(QStringLiteral("bookmarks"));
return QIcon::fromTheme(bk.icon());
}
......@@ -356,7 +356,7 @@ bool KBookmarkModel::dropMimeData(const QMimeData * data, Qt::DropAction action,
QString addr = dropDestBookmark.address();
if (dropDestBookmark.isGroup() && !isInsertBetweenOp) {
addr += "/0";
addr += QLatin1String("/0");
}
// bookmarkForIndex(...) does not distinguish between the last item in the folder
// and the point *after* the last item in the folder (and its hard to see how to
......@@ -368,7 +368,7 @@ bool KBookmarkModel::dropMimeData(const QMimeData * data, Qt::DropAction action,
}
if (action == Qt::CopyAction) {
KEBMacroCommand * cmd = CmdGen::insertMimeSource(this, "Copy", data, addr);
KEBMacroCommand * cmd = CmdGen::insertMimeSource(this, QStringLiteral("Copy"), data, addr);
d->mCommandHistory->addCommand(cmd);
} else if (action == Qt::MoveAction) {
if (data->hasFormat(s_mime_bookmark_addresses)) {
......@@ -385,7 +385,7 @@ bool KBookmarkModel::dropMimeData(const QMimeData * data, Qt::DropAction action,
d->mCommandHistory->addCommand(cmd);
} else {
qDebug()<<"NO FORMAT";
KEBMacroCommand * cmd = CmdGen::insertMimeSource(this, "Copy", data, addr);
KEBMacroCommand * cmd = CmdGen::insertMimeSource(this, QStringLiteral("Copy"), data, addr);
d->mCommandHistory->addCommand(cmd);
}
}
......
......@@ -93,7 +93,7 @@ private Q_SLOTS:
// The commands modify the model, so the test code uses the commands
void testAddBookmark()
{
CreateCommand* cmd = new CreateCommand(m_model, "/0", "test_bk", "www", QUrl("http://www.kde.org"));
CreateCommand* cmd = new CreateCommand(m_model, QStringLiteral("/0"), QStringLiteral("test_bk"), QStringLiteral("www"), QUrl(QStringLiteral("http://www.kde.org")));
cmd->redo();
QCOMPARE(BookmarkLister::addressList(m_bookmarkManager), QStringList() << "/0");
QCOMPARE(BookmarkLister::urlList(m_bookmarkManager), QStringList() << "http://www.kde.org");
......@@ -106,10 +106,10 @@ private Q_SLOTS:
void testDeleteBookmark()
{
CreateCommand* cmd = new CreateCommand(m_model, "/0", "test_bk", "www", QUrl("http://www.kde.org"));
CreateCommand* cmd = new CreateCommand(m_model, QStringLiteral("/0"), QStringLiteral("test_bk"), QStringLiteral("www"), QUrl(QStringLiteral("http://www.kde.org")));
cmd->redo();
QCOMPARE(BookmarkLister::addressList(m_bookmarkManager), QStringList() << "/0");
DeleteCommand* deleteCmd = new DeleteCommand(m_model, "/0");
DeleteCommand* deleteCmd = new DeleteCommand(m_model, QStringLiteral("/0"));
deleteCmd->redo();
QCOMPARE(BookmarkLister::addressList(m_bookmarkManager), QStringList());
deleteCmd->undo();
......@@ -123,24 +123,24 @@ private Q_SLOTS:
void testCreateFolder() // and test moving stuff around
{
CreateCommand* folderCmd = new CreateCommand(m_model, "/0", "folder", "folder", true /*open*/);
CreateCommand* folderCmd = new CreateCommand(m_model, QStringLiteral("/0"), QStringLiteral("folder"), QStringLiteral("folder"), true /*open*/);
m_cmdHistory->addCommand(folderCmd); // calls redo
QCOMPARE(BookmarkLister::addressList(m_bookmarkManager), QStringList() << "/0/");
QCOMPARE(m_model->rowCount(m_rootIndex), 1);
const QString kde = "http://www.kde.org";
CreateCommand* cmd = new CreateCommand(m_model, "/0/0", "test_bk", "www", QUrl(kde));
const QString kde = QStringLiteral("http://www.kde.org");
CreateCommand* cmd = new CreateCommand(m_model, QStringLiteral("/0/0"), QStringLiteral("test_bk"), QStringLiteral("www"), QUrl(kde));
m_cmdHistory->addCommand(cmd); // calls redo
QCOMPARE(BookmarkLister::addressList(m_bookmarkManager), QStringList() << "/0/" << "/0/0");
// Insert before this bookmark
const QString first = "http://first.example.com";
m_cmdHistory->addCommand(new CreateCommand(m_model, "/0/0", "first_bk", "www", QUrl(first)));
const QString first = QStringLiteral("http://first.example.com");
m_cmdHistory->addCommand(new CreateCommand(m_model, QStringLiteral("/0/0"), QStringLiteral("first_bk"), QStringLiteral("www"), QUrl(first)));
QCOMPARE(BookmarkLister::addressList(m_bookmarkManager), QStringList() << "/0/" << "/0/0" << "/0/1");
QCOMPARE(BookmarkLister::urlList(m_bookmarkManager), QStringList() << first << kde);
// Move the kde bookmark before the first bookmark
KBookmark kdeBookmark = m_bookmarkManager->findByAddress("/0/1");
KBookmark kdeBookmark = m_bookmarkManager->findByAddress(QStringLiteral("/0/1"));
QCOMPARE(kdeBookmark.url().url(), kde);
QModelIndex kdeIndex = m_model->indexForBookmark(kdeBookmark);
QCOMPARE(kdeIndex.row(), 1);
......@@ -154,7 +154,7 @@ private Q_SLOTS:
delete mimeData;
// Move the kde bookmark after the bookmark called 'first'
kdeBookmark = m_bookmarkManager->findByAddress("/0/0");
kdeBookmark = m_bookmarkManager->findByAddress(QStringLiteral("/0/0"));
kdeIndex = m_model->indexForBookmark(kdeBookmark);
QCOMPARE(kdeIndex.row(), 0);
mimeData = m_model->mimeData(QModelIndexList() << kdeIndex);
......@@ -164,22 +164,22 @@ private Q_SLOTS:
delete mimeData;
// Create new folder, then move both bookmarks into it (#287038)
m_cmdHistory->addCommand(new CreateCommand(m_model, "/1", "folder2", "folder2", true));
m_cmdHistory->addCommand(new CreateCommand(m_model, QStringLiteral("/1"), QStringLiteral("folder2"), QStringLiteral("folder2"), true));
QCOMPARE(BookmarkLister::addressList(m_bookmarkManager), QStringList() << "/0/" << "/0/0" << "/0/1" << "/1/");
QCOMPARE(m_model->rowCount(m_rootIndex), 2);
moveTwoBookmarks("/0/0", "/0/1", "/1");
moveTwoBookmarks(QStringLiteral("/0/0"), QStringLiteral("/0/1"), QStringLiteral("/1"));
QCOMPARE(BookmarkLister::addressList(m_bookmarkManager), QStringList() << "/0/" << "/1/" << "/1/0" << "/1/1");
QCOMPARE(BookmarkLister::urlList(m_bookmarkManager), QStringList() << kde << first);
// Move bookmarks from /1 into subfolder /1/2 (which will become /1/0)
m_cmdHistory->addCommand(new CreateCommand(m_model, "/1/2", "subfolder", "subfolder", true));
m_cmdHistory->addCommand(new CreateCommand(m_model, QStringLiteral("/1/2"), QStringLiteral("subfolder"), QStringLiteral("subfolder"), true));
QCOMPARE(BookmarkLister::addressList(m_bookmarkManager), QStringList() << "/0/" << "/1/" << "/1/0" << "/1/1" << "/1/2/");
moveTwoBookmarks("/1/0", "/1/1", "/1/2");
moveTwoBookmarks(QStringLiteral("/1/0"), QStringLiteral("/1/1"), QStringLiteral("/1/2"));
QCOMPARE(BookmarkLister::addressList(m_bookmarkManager), QStringList() << "/0/" << "/1/" << "/1/0/" << "/1/0/0" << "/1/0/1");
// Move them up again
moveTwoBookmarks("/1/0/0", "/1/0/1", "/1");
moveTwoBookmarks(QStringLiteral("/1/0/0"), QStringLiteral("/1/0/1"), QStringLiteral("/1"));
QCOMPARE(BookmarkLister::addressList(m_bookmarkManager), QStringList() << "/0/" << "/1/" << "/1/0" << "/1/1" << "/1/2/");
undoAll();
......@@ -188,23 +188,23 @@ private Q_SLOTS:
void testSort()
{
QCOMPARE(BookmarkLister::addressList(m_bookmarkManager), QStringList());
CreateCommand* folderCmd = new CreateCommand(m_model, "/0", "folder", "folder", true /*open*/);
CreateCommand* folderCmd = new CreateCommand(m_model, QStringLiteral("/0"), QStringLiteral("folder"), QStringLiteral("folder"), true /*open*/);
m_cmdHistory->addCommand(folderCmd); // calls redo
const QString kde = "http://www.kde.org";
const QString kde = QStringLiteral("http://www.kde.org");
QStringList bookmarks;
bookmarks << "Faure" << "Web" << "Kde" << "Avatar" << "David";
bookmarks << QStringLiteral("Faure") << QStringLiteral("Web") << QStringLiteral("Kde") << QStringLiteral("Avatar") << QStringLiteral("David");
for (int i = 0; i < bookmarks.count(); ++i) {
m_cmdHistory->addCommand(new CreateCommand(m_model, "/0/" + QString::number(i), bookmarks[i], "www", QUrl(kde)));
m_cmdHistory->addCommand(new CreateCommand(m_model, "/0/" + QString::number(i), bookmarks[i], QStringLiteral("www"), QUrl(kde)));
}
const QStringList addresses = BookmarkLister::addressList(m_bookmarkManager);
//kDebug() << addresses;
const QStringList origTitleList = BookmarkLister::titleList(m_bookmarkManager);
QCOMPARE(addresses.count(), bookmarks.count() + 1 /* parent folder */);
SortCommand* sortCmd = new SortCommand(m_model, "Sort", "/0");
SortCommand* sortCmd = new SortCommand(m_model, QStringLiteral("Sort"), QStringLiteral("/0"));
m_cmdHistory->addCommand(sortCmd);
QStringList expectedTitleList = bookmarks;
expectedTitleList.sort();
expectedTitleList.prepend("folder");
expectedTitleList.prepend(QStringLiteral("folder"));
const QStringList sortedTitles = BookmarkLister::titleList(m_bookmarkManager);
//kDebug() << sortedTitles;
QCOMPARE(sortedTitles, expectedTitleList);
......@@ -243,7 +243,7 @@ private Q_SLOTS:
QCOMPARE(model->rowCount(), 1); // the toplevel "Bookmarks" toplevel item
// When sorting
SortCommand* sortCmd = new SortCommand(model, "Sort", "/0");
SortCommand* sortCmd = new SortCommand(model, QStringLiteral("Sort"), QStringLiteral("/0"));
cmdHistory.addCommand(sortCmd);
// Then the contents should be correctly sorted
......
......@@ -61,7 +61,7 @@ void KBookmarkView::slotExpanded(const QModelIndex& index)
{
if (!m_loadingState) {
KBookmark bk = bookmarkForIndex(index);
bk.internalElement().setAttribute("folded", "no");
bk.internalElement().setAttribute(QStringLiteral("folded"), QStringLiteral("no"));
}
}
......@@ -69,7 +69,7 @@ void KBookmarkView::slotCollapsed(const QModelIndex& index)
{
if (!m_loadingState) {
KBookmark bk = bookmarkForIndex(index);
bk.internalElement().setAttribute("folded", "yes");
bk.internalElement().setAttribute(QStringLiteral("folded"), QStringLiteral("yes"));
}
}
......
......@@ -674,7 +674,7 @@ void KViewSearchLineWidget::createWidgets()
d->layout->setMargin(0);
QLabel *label = new QLabel(i18n("S&earch:"));
label->setObjectName( QLatin1String("kde toolbar widget" ));
label->setObjectName( QStringLiteral("kde toolbar widget" ));
d->layout->addWidget(label);
d->searchLine = createSearchLine(d->view);
......
This diff is collapsed.
......@@ -53,7 +53,7 @@ TestLinkItr::~TestLinkItr()
void TestLinkItr::setStatus(const QString & text)
{
currentBookmark().setMetaDataItem("linkstate", text);
currentBookmark().setMetaDataItem(QStringLiteral("linkstate"), text);
model()->emitDataChanged(currentBookmark());
}
......@@ -66,12 +66,12 @@ void TestLinkItr::doAction()
{
//qDebug();
m_job = KIO::get(currentBookmark().url(), KIO::Reload, KIO::HideProgressInfo);
m_job->addMetaData( QString("cookies"), QString("none") );
m_job->addMetaData( QString("errorPage"), QString("false") );
m_job->addMetaData( QStringLiteral("cookies"), QStringLiteral("none") );
m_job->addMetaData( QStringLiteral("errorPage"), QStringLiteral("false") );
connect(m_job, &KIO::TransferJob::result, this, &TestLinkItr::slotJobResult);
m_oldStatus = currentBookmark().metaDataItem("linkstate");
m_oldStatus = currentBookmark().metaDataItem(QStringLiteral("linkstate"));
setStatus(i18n("Checking..."));
}
......@@ -81,13 +81,13 @@ void TestLinkItr::slotJobResult(KJob *job)
m_job = 0;
KIO::TransferJob *transfer = static_cast<KIO::TransferJob *>(job);
const QString modDate = transfer->queryMetaData("modified");
const QString modDate = transfer->queryMetaData(QStringLiteral("modified"));
if (transfer->error() || transfer->isErrorPage()) {
//qDebug()<<"***********"<<transfer->error()<<" "<<transfer->isErrorPage()<<endl;
// can we assume that errorString will contain no entities?
QString err = transfer->errorString();
err.replace("\n", " ");
err.replace(QLatin1String("\n"), QLatin1String(" "));
setStatus(err);
} else {
if (!modDate.isEmpty())
......
......@@ -61,7 +61,7 @@ KEBApp::KEBApp(
m_caption(caption),
m_dbusObjectName(dbusObjectName), m_readOnly(readonly),m_browser(browser)
{
QDBusConnection::sessionBus().registerObject("/keditbookmarks", this, QDBusConnection::ExportScriptableSlots);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/keditbookmarks"), this, QDBusConnection::ExportScriptableSlots);
Q_UNUSED(address);//FIXME sets the current item
m_cmdHistory = new CommandHistory(this);
......@@ -76,7 +76,7 @@ KEBApp::KEBApp(
if (m_browser)
createGUI();
else
createGUI("keditbookmarks-genui.rc");
createGUI(QStringLiteral("keditbookmarks-genui.rc"));
connect(qApp->clipboard(), SIGNAL(dataChanged()),
SLOT(slotClipboardDataChanged()));
......@@ -159,7 +159,7 @@ void KEBApp::startEdit( Column c )
end = list.constEnd();
for(it = list.constBegin(); it != end; ++it)
if( (*it).column() == int(c) && (mBookmarkListView->model()->flags(*it) & Qt::ItemIsEditable) )
return mBookmarkListView->edit( *it );
mBookmarkListView->edit( *it );
}
//FIXME clean up and remove unneeded things
......@@ -226,35 +226,35 @@ void KEBApp::setActionsEnabled(SelcAbilities sa) {
QStringList toEnable;
if (sa.multiSelect || (sa.singleSelect && !sa.root))
toEnable << "edit_copy";
toEnable << QStringLiteral("edit_copy");
if (sa.multiSelect || (sa.singleSelect && !sa.root && !sa.urlIsEmpty && !sa.group && !sa.separator))
toEnable << "openlink";
toEnable << QStringLiteral("openlink");
if (!m_readOnly) {
if (sa.notEmpty)
toEnable << "testall" << "updateallfavicons";
toEnable << QStringLiteral("testall") << QStringLiteral("updateallfavicons");
if ( sa.deleteEnabled && (sa.multiSelect || (sa.singleSelect && !sa.root)) )
toEnable << "delete" << "edit_cut";
toEnable << QStringLiteral("delete") << QStringLiteral("edit_cut");
if( sa.singleSelect)
if (m_canPaste)
toEnable << "edit_paste";
toEnable << QStringLiteral("edit_paste");
if( sa.multiSelect || (sa.singleSelect && !sa.root && !sa.urlIsEmpty && !sa.group && !sa.separator))
toEnable << "testlink" << "updatefavicon";
toEnable << QStringLiteral("testlink") << QStringLiteral("updatefavicon");
if (sa.singleSelect && !sa.root && !sa.separator) {
toEnable << "rename" << "changeicon" << "changecomment";
toEnable << QStringLiteral("rename") << QStringLiteral("changeicon") << QStringLiteral("changecomment");
if (!sa.group)
toEnable << "changeurl";
toEnable << QStringLiteral("changeurl");
}
if (sa.singleSelect) {
toEnable << "newfolder" << "newbookmark" << "insertseparator";
toEnable << QStringLiteral("newfolder") << QStringLiteral("newbookmark") << QStringLiteral("insertseparator");
if (sa.group)
toEnable << "sort" << "recursivesort" << "setastoolbar";