1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Const'ify

This commit is contained in:
Laurent Montel 2019-01-11 07:40:51 +01:00
parent 4de3e4c703
commit 4c9d503699
22 changed files with 23 additions and 23 deletions

View File

@ -30,7 +30,7 @@ public:
{ {
} }
bool matchDomain(QString cookieDomain, QString siteDomain) const bool matchDomain(const QString &cookieDomain, const QString &siteDomain) const
{ {
return CookieJar::matchDomain(cookieDomain, siteDomain); return CookieJar::matchDomain(cookieDomain, siteDomain);
} }

View File

@ -64,7 +64,7 @@ Q_SIGNALS:
// Context menu signal with point mapped to global // Context menu signal with point mapped to global
void contextMenuRequested(const QPoint &point); void contextMenuRequested(const QPoint &point);
// If all bookmarks have been deselected, items is empty // If all bookmarks have been deselected, items is empty
void bookmarksSelected(QList<BookmarkItem*> items); void bookmarksSelected(const QList<BookmarkItem*> &items);
private Q_SLOTS: private Q_SLOTS:
void indexExpanded(const QModelIndex &parent); void indexExpanded(const QModelIndex &parent);

View File

@ -170,7 +170,7 @@ SearchEngine SearchEnginesDialog::getEngine(QTreeWidgetItem* item)
return item->data(0, EngineRole).value<SearchEngine>(); return item->data(0, EngineRole).value<SearchEngine>();
} }
void SearchEnginesDialog::setEngine(QTreeWidgetItem* item, SearchEngine engine) void SearchEnginesDialog::setEngine(QTreeWidgetItem* item, const SearchEngine &engine)
{ {
QVariant v; QVariant v;
v.setValue<SearchEngine>(engine); v.setValue<SearchEngine>(engine);

View File

@ -58,7 +58,7 @@ private:
bool isDefaultEngine(QTreeWidgetItem* item); bool isDefaultEngine(QTreeWidgetItem* item);
SearchEngine getEngine(QTreeWidgetItem* item); SearchEngine getEngine(QTreeWidgetItem* item);
void setEngine(QTreeWidgetItem* item, SearchEngine engine); void setEngine(QTreeWidgetItem* item, const SearchEngine &engine);
void changeItemToDefault(QTreeWidgetItem* item, bool isDefault); void changeItemToDefault(QTreeWidgetItem* item, bool isDefault);
void reloadEngines(); void reloadEngines();

View File

@ -33,7 +33,7 @@ QmlCookies::QmlCookies(QObject *parent)
emit changed(map); emit changed(map);
}); });
connect(mApp->cookieJar(), &CookieJar::cookieRemoved, this, [this](QNetworkCookie network_cookie){ connect(mApp->cookieJar(), &CookieJar::cookieRemoved, this, [this](const QNetworkCookie &network_cookie){
QmlCookie *cookie = QmlStaticData::instance().getCookie(network_cookie); QmlCookie *cookie = QmlStaticData::instance().getCookie(network_cookie);
QVariantMap map; QVariantMap map;
map.insert(QSL("cookie"), QVariant::fromValue(cookie)); map.insert(QSL("cookie"), QVariant::fromValue(cookie));

View File

@ -22,7 +22,7 @@
#include <QDebug> #include <QDebug>
#include <QQmlEngine> #include <QQmlEngine>
QmlFileUtils::QmlFileUtils(QString filePath, QObject *parent) QmlFileUtils::QmlFileUtils(const QString &filePath, QObject *parent)
: QObject(parent) : QObject(parent)
{ {
m_path = filePath; m_path = filePath;

View File

@ -26,7 +26,7 @@ class QmlFileUtils : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit QmlFileUtils(QString filePath, QObject *parent = nullptr); explicit QmlFileUtils(const QString &filePath, QObject *parent = nullptr);
/** /**
* @brief Get the path of the file within the plugin directory. * @brief Get the path of the file within the plugin directory.
* If the filePath provided is resolved to be outside the plugin * If the filePath provided is resolved to be outside the plugin

View File

@ -25,12 +25,12 @@
QmlHistory::QmlHistory(QObject *parent) QmlHistory::QmlHistory(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
connect(mApp->history(), &History::historyEntryAdded, this, [this](HistoryEntry entry){ connect(mApp->history(), &History::historyEntryAdded, this, [this](const HistoryEntry &entry){
QmlHistoryItem *historyItem = QmlStaticData::instance().getHistoryItem(entry); QmlHistoryItem *historyItem = QmlStaticData::instance().getHistoryItem(entry);
emit visited(historyItem); emit visited(historyItem);
}); });
connect(mApp->history(), &History::historyEntryDeleted, this, [this](HistoryEntry entry){ connect(mApp->history(), &History::historyEntryDeleted, this, [this](const HistoryEntry &entry){
QmlHistoryItem *historyItem = QmlStaticData::instance().getHistoryItem(entry); QmlHistoryItem *historyItem = QmlStaticData::instance().getHistoryItem(entry);
emit visitRemoved(historyItem); emit visitRemoved(historyItem);
}); });

View File

@ -18,7 +18,7 @@
#include "qmlhistoryitem.h" #include "qmlhistoryitem.h"
#include <QQmlEngine> #include <QQmlEngine>
QmlHistoryItem::QmlHistoryItem(HistoryEntry entry, QObject *parent) QmlHistoryItem::QmlHistoryItem(const HistoryEntry &entry, QObject *parent)
: QObject(parent) : QObject(parent)
, m_entry(entry) , m_entry(entry)
{ {

View File

@ -52,7 +52,7 @@ class QmlHistoryItem : public QObject
*/ */
Q_PROPERTY(QDateTime lastVisitTime READ lastVisitTime CONSTANT) Q_PROPERTY(QDateTime lastVisitTime READ lastVisitTime CONSTANT)
public: public:
explicit QmlHistoryItem(HistoryEntry entry, QObject *parent = nullptr); explicit QmlHistoryItem(const HistoryEntry &entry, QObject *parent = nullptr);
private: private:
HistoryEntry m_entry; HistoryEntry m_entry;

View File

@ -78,7 +78,7 @@ QmlCookie *QmlStaticData::getCookie(const QNetworkCookie &cookie)
return qmlCookie; return qmlCookie;
} }
QmlHistoryItem *QmlStaticData::getHistoryItem(HistoryEntry entry) QmlHistoryItem *QmlStaticData::getHistoryItem(const HistoryEntry &entry)
{ {
QmlHistoryItem *item = m_historyItems.value(entry); QmlHistoryItem *item = m_historyItems.value(entry);
if (!item) { if (!item) {

View File

@ -52,7 +52,7 @@ public:
static QmlStaticData &instance(); static QmlStaticData &instance();
QmlBookmarkTreeNode *getBookmarkTreeNode(BookmarkItem *item); QmlBookmarkTreeNode *getBookmarkTreeNode(BookmarkItem *item);
QmlCookie *getCookie(const QNetworkCookie &cookie); QmlCookie *getCookie(const QNetworkCookie &cookie);
QmlHistoryItem *getHistoryItem(HistoryEntry entry); QmlHistoryItem *getHistoryItem(const HistoryEntry &entry);
QmlTab *getTab(WebTab *webTab); QmlTab *getTab(WebTab *webTab);
QmlMostVisitedUrl *getMostVisitedUrl(const QString &title = QString(), const QString &url = QString()); QmlMostVisitedUrl *getMostVisitedUrl(const QString &title = QString(), const QString &url = QString());
QmlWindow *getWindow(BrowserWindow *window); QmlWindow *getWindow(BrowserWindow *window);

View File

@ -745,7 +745,7 @@ bool QzTools::matchDomain(const QString &pattern, const QString &domain)
return index > 0 && domain[index - 1] == QLatin1Char('.'); return index > 0 && domain[index - 1] == QLatin1Char('.');
} }
QKeySequence QzTools::actionShortcut(QKeySequence shortcut, QKeySequence fallBack, QKeySequence shortcutRtl, QKeySequence fallbackRtl) QKeySequence QzTools::actionShortcut(const QKeySequence &shortcut, const QKeySequence &fallBack, const QKeySequence &shortcutRtl, const QKeySequence &fallbackRtl)
{ {
if (QApplication::isRightToLeft() && (!shortcutRtl.isEmpty() || !fallbackRtl.isEmpty())) if (QApplication::isRightToLeft() && (!shortcutRtl.isEmpty() || !fallbackRtl.isEmpty()))
return shortcutRtl.isEmpty() ? fallbackRtl : shortcutRtl; return shortcutRtl.isEmpty() ? fallbackRtl : shortcutRtl;

View File

@ -83,7 +83,7 @@ public:
static QString getSaveFileName(const QString &name, QWidget* parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString* selectedFilter = 0, QFileDialog::Options options = 0); static QString getSaveFileName(const QString &name, QWidget* parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString* selectedFilter = 0, QFileDialog::Options options = 0);
static bool matchDomain(const QString &pattern, const QString &domain); static bool matchDomain(const QString &pattern, const QString &domain);
static QKeySequence actionShortcut(QKeySequence shortcut, QKeySequence fallBack, QKeySequence shortcutRtl = QKeySequence(), QKeySequence fallbackRtl = QKeySequence()); static QKeySequence actionShortcut(const QKeySequence &shortcut, const QKeySequence &fallBack, const QKeySequence &shortcutRtl = QKeySequence(), const QKeySequence &fallbackRtl = QKeySequence());
static QString operatingSystem(); static QString operatingSystem();
static QString cpuArchitecture(); static QString cpuArchitecture();

View File

@ -57,7 +57,7 @@ public:
Q_SIGNALS: Q_SIGNALS:
void wantsCloseTab(int); void wantsCloseTab(int);
void ipChanged(QString); void ipChanged(const QString&);
public Q_SLOTS: public Q_SLOTS:
void setAsCurrentTab(); void setAsCurrentTab();

View File

@ -398,7 +398,7 @@ void FCM_Plugin::loadFlashCookies(QString path)
} }
} }
void FCM_Plugin::insertFlashCookie(QString path) void FCM_Plugin::insertFlashCookie(const QString &path)
{ {
QFile solFile(path); QFile solFile(path);
if (!solFile.open(QFile::ReadOnly)) { if (!solFile.open(QFile::ReadOnly)) {

View File

@ -81,7 +81,7 @@ private:
AbstractButtonInterface* createStatusBarIcon(BrowserWindow* mainWindow); AbstractButtonInterface* createStatusBarIcon(BrowserWindow* mainWindow);
void loadFlashCookies(); void loadFlashCookies();
void loadFlashCookies(QString path); void loadFlashCookies(QString path);
void insertFlashCookie(QString path); void insertFlashCookie(const QString &path);
QString extractOriginFrom(const QString &path); QString extractOriginFrom(const QString &path);
bool isBlacklisted(const FlashCookie &flashCookie); bool isBlacklisted(const FlashCookie &flashCookie);
bool isWhitelisted(const FlashCookie &flashCookie); bool isWhitelisted(const FlashCookie &flashCookie);

View File

@ -116,7 +116,7 @@ void RealTimeMouseGestureRecognizer::addPoint(int x, int y)
} }
struct DirectionSort { struct DirectionSort {
bool operator()(GestureDefinition a, GestureDefinition b) { bool operator()(const GestureDefinition &a, const GestureDefinition &b) {
return a.directions.size() > b.directions.size(); return a.directions.size() > b.directions.size();
} }
}; };

View File

@ -880,7 +880,7 @@ QStringList TabTreeWidget::mimeTypes() const
return types; return types;
} }
QMimeData *TabTreeWidget::mimeData(const QList<QTreeWidgetItem*> items) const QMimeData *TabTreeWidget::mimeData(const QList<QTreeWidgetItem*> &items) const
{ {
QMimeData* mimeData = new QMimeData(); QMimeData* mimeData = new QMimeData();
QByteArray encodedData; QByteArray encodedData;

View File

@ -44,7 +44,7 @@ public:
Qt::DropActions supportedDropActions() const; Qt::DropActions supportedDropActions() const;
QStringList mimeTypes() const; QStringList mimeTypes() const;
QMimeData* mimeData(const QList<QTreeWidgetItem*> items) const; QMimeData* mimeData(const QList<QTreeWidgetItem*> &items) const;
bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action); bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action);
void setEnableDragTabs(bool enable); void setEnableDragTabs(bool enable);

View File

@ -391,7 +391,7 @@ void TabTreeView::addMenuActions(QMenu *menu, const QModelIndex &index)
m->addAction(tr("Collapse All"), this, &TabTreeView::collapseAll); m->addAction(tr("Collapse All"), this, &TabTreeView::collapseAll);
} }
void TabTreeView::reverseTraverse(const QModelIndex &root, std::function<void(const QModelIndex&)> callback) const void TabTreeView::reverseTraverse(const QModelIndex &root, const std::function<void(const QModelIndex&)> &callback) const
{ {
if (!root.isValid()) { if (!root.isValid()) {
return; return;

View File

@ -65,7 +65,7 @@ private:
void initView(); void initView();
DelegateButton buttonAt(const QPoint &pos, const QModelIndex &index) const; DelegateButton buttonAt(const QPoint &pos, const QModelIndex &index) const;
void addMenuActions(QMenu *menu, const QModelIndex &index); void addMenuActions(QMenu *menu, const QModelIndex &index);
void reverseTraverse(const QModelIndex &root, std::function<void(const QModelIndex&)> callback) const; void reverseTraverse(const QModelIndex &root, const std::function<void(const QModelIndex&)> &callback) const;
void closeTree(const QModelIndex &root); void closeTree(const QModelIndex &root);
void unloadTree(const QModelIndex &root); void unloadTree(const QModelIndex &root);