1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

fixed code

This commit is contained in:
Anmol Gautam 2018-08-04 09:34:54 +05:30
parent caec5838b9
commit de0cb89dda
8 changed files with 17 additions and 12 deletions

View File

@ -65,7 +65,7 @@ BookmarkItem *QmlBookmarks::getBookmarkItem(QmlBookmarkTreeNode *treeNode) const
items = bookmarks->searchBookmarks(QUrl::fromEncoded(treeNode->url().toUtf8())); items = bookmarks->searchBookmarks(QUrl::fromEncoded(treeNode->url().toUtf8()));
} }
for (auto item : items) { for (const auto item : qAsConst(items)) {
if (isTreeNodeEqualsItem(treeNode, item)) { if (isTreeNodeEqualsItem(treeNode, item)) {
return item; return item;
} }
@ -242,7 +242,7 @@ QList<QObject*> QmlBookmarks::search(const QVariantMap &map) const
items = mApp->bookmarks()->searchBookmarks(QUrl::fromEncoded(urlString.toUtf8())); items = mApp->bookmarks()->searchBookmarks(QUrl::fromEncoded(urlString.toUtf8()));
} }
QList<QObject*> ret; QList<QObject*> ret;
for (auto item : items) { for (auto item : qAsConst(items)) {
ret.append(bookmarkTreeNodeData->get(item)); ret.append(bookmarkTreeNodeData->get(item));
} }
return ret; return ret;
@ -308,7 +308,7 @@ bool QmlBookmarks::update(QObject *object, const QVariantMap &changes) const
QmlBookmarkTreeNode *QmlBookmarks::get(const QString &string) const QmlBookmarkTreeNode *QmlBookmarks::get(const QString &string) const
{ {
auto items = mApp->bookmarks()->searchBookmarks(QUrl(string)); auto items = mApp->bookmarks()->searchBookmarks(QUrl(string));
for (auto item : items) { for (const auto item : qAsConst(items)) {
if (item->urlString() == string) { if (item->urlString() == string) {
return bookmarkTreeNodeData->get(item); return bookmarkTreeNodeData->get(item);
} }
@ -334,7 +334,7 @@ QList<QObject*> QmlBookmarks::getChildren(QObject *object) const
} }
auto items = bookmarkItem->children(); auto items = bookmarkItem->children();
for (auto item : items) { for (auto item : qAsConst(items)) {
ret.append(bookmarkTreeNodeData->get(item)); ret.append(bookmarkTreeNodeData->get(item));
} }

View File

@ -116,7 +116,7 @@ QList<QObject*> QmlBookmarkTreeNode::children() const
{ {
const auto items = m_item->children(); const auto items = m_item->children();
QList<QObject*> ret; QList<QObject*> ret;
for (const auto &item : items) { for (const auto &item : qAsConst(items)) {
ret.append(bookmarkTreeNodeData->get(item)); ret.append(bookmarkTreeNodeData->get(item));
} }
return ret; return ret;

View File

@ -27,7 +27,7 @@ QmlFileUtils::QmlFileUtils(QString filePath, QObject *parent)
// Get the plugin root directory - of the form // Get the plugin root directory - of the form
// some-path-in-plugin-paths/qml/plugin-directory // some-path-in-plugin-paths/qml/plugin-directory
const QStringList dirs = DataPaths::allPaths(DataPaths::Plugins); const QStringList dirs = DataPaths::allPaths(DataPaths::Plugins);
for (QString path : dirs) { for (QString path : qAsConst(dirs)) {
path.append(QSL("/qml/")); path.append(QSL("/qml/"));
if (filePath.contains(path)) { if (filePath.contains(path)) {
m_path = path; m_path = path;

View File

@ -46,7 +46,7 @@ QList<QObject*> QmlHistory::search(const QString &text)
QList<QObject*> list; QList<QObject*> list;
QList<HistoryEntry*> result = mApp->history()->searchHistoryEntry(text); QList<HistoryEntry*> result = mApp->history()->searchHistoryEntry(text);
foreach(auto entry, result) { for (const auto entry : qAsConst(result)) {
auto item = historyItemData->get(entry); auto item = historyItemData->get(entry);
list.append(item); list.append(item);
} }

View File

@ -32,7 +32,10 @@ void QmlAction::setProperties(const QVariantMap &map)
return; return;
} }
for (const QString &key : map.keys()) { QMapIterator<QString, QVariant> it(map);
while (it.hasNext()) {
it.next();
const QString key = it.key();
if (key == QSL("icon")) { if (key == QSL("icon")) {
QString iconPath = map.value(key).toString(); QString iconPath = map.value(key).toString();
QIcon icon; QIcon icon;

View File

@ -64,7 +64,9 @@ QmlMenu *QmlMenu::addMenu(const QVariantMap &map)
} }
QMenu *newMenu = new QMenu(); QMenu *newMenu = new QMenu();
for (const QString &key : map.keys()) { QMapIterator<QString, QVariant> it(map);
while (it.hasNext()) {
const QString key = it.key();
if (key == QSL("icon")) { if (key == QSL("icon")) {
QString iconPath = map.value(key).toString(); QString iconPath = map.value(key).toString();
QIcon icon; QIcon icon;

View File

@ -460,7 +460,7 @@ BrowserWindow *QmlTabs::getWindow(int windowId) const
return mApp->getWindow(); return mApp->getWindow();
} }
for(BrowserWindow *window : mApp->windowIdHash().keys()) { for (BrowserWindow *window : mApp->windowIdHash().keys()) {
if (mApp->windowIdHash().value(window) == windowId) { if (mApp->windowIdHash().value(window) == windowId) {
return window; return window;
} }

View File

@ -28,7 +28,7 @@ QmlUserScripts::QmlUserScripts(QObject *parent)
QmlUserScripts::~QmlUserScripts() QmlUserScripts::~QmlUserScripts()
{ {
// remove scripts added by the plugin // remove scripts added by the plugin
for (const QWebEngineScript &webEngineScript : m_webEngineScripts) { for (const QWebEngineScript &webEngineScript : qAsConst(m_webEngineScripts)) {
mApp->webProfile()->scripts()->remove(webEngineScript); mApp->webProfile()->scripts()->remove(webEngineScript);
} }
} }
@ -51,7 +51,7 @@ bool QmlUserScripts::empty() const
QList<QObject *> QmlUserScripts::toQObjectList(QList<QWebEngineScript> list) const QList<QObject *> QmlUserScripts::toQObjectList(QList<QWebEngineScript> list) const
{ {
QList<QObject *> userScriptList; QList<QObject *> userScriptList;
for (const QWebEngineScript &script : list) { for (const QWebEngineScript &script : qAsConst(list)) {
QmlUserScript *userScript = new QmlUserScript(); QmlUserScript *userScript = new QmlUserScript();
userScript->setWebEngineScript(script); userScript->setWebEngineScript(script);
userScriptList.append(userScript); userScriptList.append(userScript);