1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-19 10:16:34 +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);
}

View File

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

View File

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

View File

@ -58,7 +58,7 @@ private:
bool isDefaultEngine(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 reloadEngines();

View File

@ -33,7 +33,7 @@ QmlCookies::QmlCookies(QObject *parent)
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);
QVariantMap map;
map.insert(QSL("cookie"), QVariant::fromValue(cookie));

View File

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

View File

@ -26,7 +26,7 @@ class QmlFileUtils : public QObject
{
Q_OBJECT
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.
* If the filePath provided is resolved to be outside the plugin

View File

@ -25,12 +25,12 @@
QmlHistory::QmlHistory(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);
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);
emit visitRemoved(historyItem);
});

View File

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

View File

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

View File

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

View File

@ -52,7 +52,7 @@ public:
static QmlStaticData &instance();
QmlBookmarkTreeNode *getBookmarkTreeNode(BookmarkItem *item);
QmlCookie *getCookie(const QNetworkCookie &cookie);
QmlHistoryItem *getHistoryItem(HistoryEntry entry);
QmlHistoryItem *getHistoryItem(const HistoryEntry &entry);
QmlTab *getTab(WebTab *webTab);
QmlMostVisitedUrl *getMostVisitedUrl(const QString &title = QString(), const QString &url = QString());
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('.');
}
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()))
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 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 cpuArchitecture();

View File

@ -57,7 +57,7 @@ public:
Q_SIGNALS:
void wantsCloseTab(int);
void ipChanged(QString);
void ipChanged(const QString&);
public Q_SLOTS:
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);
if (!solFile.open(QFile::ReadOnly)) {

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ public:
Qt::DropActions supportedDropActions() 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);
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);
}
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()) {
return;

View File

@ -65,7 +65,7 @@ private:
void initView();
DelegateButton buttonAt(const QPoint &pos, const QModelIndex &index) const;
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 unloadTree(const QModelIndex &root);