mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Code style + fixed cppcheck warnings.
- using static_cast rather than C-style casting
This commit is contained in:
parent
66ee47d3cf
commit
8d3c56afe2
3
src/3rdparty/qtwin.cpp
vendored
3
src/3rdparty/qtwin.cpp
vendored
@ -115,8 +115,9 @@ bool QtWin::isRunningWindows7()
|
|||||||
{
|
{
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
return QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS7;
|
return QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS7;
|
||||||
#endif
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -81,7 +81,7 @@ QNetworkReply* AdBlockNetwork::block(const QNetworkRequest &request)
|
|||||||
|
|
||||||
if (blockedRule) {
|
if (blockedRule) {
|
||||||
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
|
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
|
||||||
WebPage* webPage = (WebPage*)(v.value<void*>());
|
WebPage* webPage = static_cast<WebPage*> (v.value<void*>());
|
||||||
if (webPage) {
|
if (webPage) {
|
||||||
webPage->addAdBlockRule(blockedRule->filter(), request.url());
|
webPage->addAdBlockRule(blockedRule->filter(), request.url());
|
||||||
}
|
}
|
||||||
|
@ -1039,7 +1039,7 @@ void QupZilla::showPreferences()
|
|||||||
prefs->show();
|
prefs->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QupZilla::showSource(QWebFrame *frame, const QString &selectedHtml)
|
void QupZilla::showSource(QWebFrame* frame, const QString &selectedHtml)
|
||||||
{
|
{
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
frame = weView()->page()->mainFrame();
|
frame = weView()->page()->mainFrame();
|
||||||
@ -1285,7 +1285,7 @@ void QupZilla::sendLink()
|
|||||||
QDesktopServices::openUrl(url);
|
QDesktopServices::openUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QupZilla::printPage(QWebFrame *frame)
|
void QupZilla::printPage(QWebFrame* frame)
|
||||||
{
|
{
|
||||||
QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this);
|
QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this);
|
||||||
|
|
||||||
@ -1340,7 +1340,7 @@ void QupZilla::startPrivate(bool state)
|
|||||||
mApp->togglePrivateBrowsingMode(state);
|
mApp->togglePrivateBrowsingMode(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QupZilla::resizeEvent(QResizeEvent *event)
|
void QupZilla::resizeEvent(QResizeEvent* event)
|
||||||
{
|
{
|
||||||
m_bookmarksToolbar->setMaximumWidth(width());
|
m_bookmarksToolbar->setMaximumWidth(width());
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ private slots:
|
|||||||
bool quitApp();
|
bool quitApp();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent* event);
|
||||||
void keyPressEvent(QKeyEvent* event);
|
void keyPressEvent(QKeyEvent* event);
|
||||||
void mousePressEvent(QMouseEvent* event);
|
void mousePressEvent(QMouseEvent* event);
|
||||||
void closeEvent(QCloseEvent* event);
|
void closeEvent(QCloseEvent* event);
|
||||||
|
@ -182,9 +182,9 @@ void AutoFillModel::post(const QNetworkRequest &request, const QByteArray &outgo
|
|||||||
m_lastOutgoingData = outgoingData;
|
m_lastOutgoingData = outgoingData;
|
||||||
|
|
||||||
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
|
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
|
||||||
QWebPage* webPage = (QWebPage*)(v.value<void*>());
|
QWebPage* webPage = static_cast<QWebPage*> (v.value<void*>());
|
||||||
v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 102));
|
v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 102));
|
||||||
WebView* webView = (WebView*)(v.value<void*>());
|
WebView* webView = static_cast<WebView*> (v.value<void*>());
|
||||||
if (!webPage || !webView) {
|
if (!webPage || !webView) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ void BookmarksToolbar::moveRight()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolButton* button = (ToolButton*) act->data().value<void*>();
|
ToolButton* button = static_cast<ToolButton*> (act->data().value<void*>());
|
||||||
|
|
||||||
int index = m_layout->indexOf(button);
|
int index = m_layout->indexOf(button);
|
||||||
if (index == m_layout->count() - 1) {
|
if (index == m_layout->count() - 1) {
|
||||||
@ -139,7 +139,7 @@ void BookmarksToolbar::moveLeft()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolButton* button = (ToolButton*) act->data().value<void*>();
|
ToolButton* button = static_cast<ToolButton*> (act->data().value<void*>());
|
||||||
|
|
||||||
int index = m_layout->indexOf(button);
|
int index = m_layout->indexOf(button);
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
@ -176,7 +176,7 @@ void BookmarksToolbar::removeButton()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolButton* button = (ToolButton*) act->data().value<void*>();
|
ToolButton* button = static_cast<ToolButton*> (act->data().value<void*>());
|
||||||
if (!button) {
|
if (!button) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -283,32 +283,31 @@ void HistoryManager::refreshTable()
|
|||||||
void HistoryManager::search(const QString &searchText)
|
void HistoryManager::search(const QString &searchText)
|
||||||
{
|
{
|
||||||
ui->historyTree->filterString(searchText);
|
ui->historyTree->filterString(searchText);
|
||||||
return;
|
// if (searchText.isEmpty()) {
|
||||||
if (searchText.isEmpty()) {
|
// refreshTable();
|
||||||
refreshTable();
|
// return;
|
||||||
return;
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
refreshTable();
|
// refreshTable();
|
||||||
ui->historyTree->setUpdatesEnabled(false);
|
// ui->historyTree->setUpdatesEnabled(false);
|
||||||
|
|
||||||
QList<QTreeWidgetItem*> items = ui->historyTree->findItems("*" + searchText + "*", Qt::MatchRecursive | Qt::MatchWildcard);
|
// QList<QTreeWidgetItem*> items = ui->historyTree->findItems("*" + searchText + "*", Qt::MatchRecursive | Qt::MatchWildcard);
|
||||||
|
|
||||||
QList<QTreeWidgetItem*> foundItems;
|
// QList<QTreeWidgetItem*> foundItems;
|
||||||
foreach(QTreeWidgetItem * fitem, items) {
|
// foreach(QTreeWidgetItem * fitem, items) {
|
||||||
if (fitem->text(1).isEmpty()) {
|
// if (fitem->text(1).isEmpty()) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
// QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||||
item->setText(0, fitem->text(0));
|
// item->setText(0, fitem->text(0));
|
||||||
item->setText(1, fitem->text(1));
|
// item->setText(1, fitem->text(1));
|
||||||
item->setWhatsThis(1, fitem->whatsThis(1));
|
// item->setWhatsThis(1, fitem->whatsThis(1));
|
||||||
item->setIcon(0, _iconForUrl(fitem->text(1)));
|
// item->setIcon(0, _iconForUrl(fitem->text(1)));
|
||||||
foundItems.append(item);
|
// foundItems.append(item);
|
||||||
}
|
// }
|
||||||
ui->historyTree->clear();
|
// ui->historyTree->clear();
|
||||||
ui->historyTree->addTopLevelItems(foundItems);
|
// ui->historyTree->addTopLevelItems(foundItems);
|
||||||
ui->historyTree->setUpdatesEnabled(true);
|
// ui->historyTree->setUpdatesEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryManager::optimizeDb()
|
void HistoryManager::optimizeDb()
|
||||||
|
@ -94,9 +94,9 @@ void NetworkManager::setSSLConfiguration(QNetworkReply* reply)
|
|||||||
|
|
||||||
QNetworkRequest request = reply->request();
|
QNetworkRequest request = reply->request();
|
||||||
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
|
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
|
||||||
WebPage* webPage = (WebPage*)(v.value<void*>());
|
WebPage* webPage = static_cast<WebPage*> (v.value<void*>());
|
||||||
v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 102));
|
v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 102));
|
||||||
WebView* webView = (WebView*)(v.value<void*>());
|
WebView* webView = static_cast<WebView*> (v.value<void*>());
|
||||||
if (!webPage || !webView) {
|
if (!webPage || !webView) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ void NetworkManager::sslError(QNetworkReply* reply, QList<QSslError> errors)
|
|||||||
|
|
||||||
QNetworkRequest request = reply->request();
|
QNetworkRequest request = reply->request();
|
||||||
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
|
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
|
||||||
WebPage* webPage = (WebPage*)(v.value<void*>());
|
WebPage* webPage = static_cast<WebPage*> (v.value<void*>());
|
||||||
if (!webPage) {
|
if (!webPage) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ PageThumbnailer::PageThumbnailer(QObject* parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_page(new QWebPage(this))
|
, m_page(new QWebPage(this))
|
||||||
, m_size(QSize(231, 130))
|
, m_size(QSize(231, 130))
|
||||||
|
, m_loadTitle(false)
|
||||||
{
|
{
|
||||||
NetworkManagerProxy* networkProxy = new NetworkManagerProxy(this);
|
NetworkManagerProxy* networkProxy = new NetworkManagerProxy(this);
|
||||||
networkProxy->setPrimaryNetworkAccessManager(mApp->networkManager());
|
networkProxy->setPrimaryNetworkAccessManager(mApp->networkManager());
|
||||||
|
@ -313,7 +313,7 @@ int TabBar::normalTabsCount()
|
|||||||
return count() - m_pinnedTabsCount;
|
return count() - m_pinnedTabsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabBar::mousePressEvent(QMouseEvent *event)
|
void TabBar::mousePressEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
if (event->buttons() & Qt::LeftButton && tabAt(event->pos()) != -1) {
|
if (event->buttons() & Qt::LeftButton && tabAt(event->pos()) != -1) {
|
||||||
m_dragStartPosition = mapFromGlobal(event->globalPos());
|
m_dragStartPosition = mapFromGlobal(event->globalPos());
|
||||||
@ -325,7 +325,7 @@ void TabBar::mousePressEvent(QMouseEvent *event)
|
|||||||
QTabBar::mousePressEvent(event);
|
QTabBar::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabBar::mouseMoveEvent(QMouseEvent *event)
|
void TabBar::mouseMoveEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
if (!m_dragStartPosition.isNull() && m_tabWidget->buttonAddTab()->isVisible()) {
|
if (!m_dragStartPosition.isNull() && m_tabWidget->buttonAddTab()->isVisible()) {
|
||||||
int manhattanLength = (event->pos() - m_dragStartPosition).manhattanLength();
|
int manhattanLength = (event->pos() - m_dragStartPosition).manhattanLength();
|
||||||
|
@ -80,8 +80,8 @@ private slots:
|
|||||||
void closeCurrentTab();
|
void closeCurrentTab();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent* event);
|
||||||
void mouseMoveEvent(QMouseEvent *event);
|
void mouseMoveEvent(QMouseEvent* event);
|
||||||
void mouseDoubleClickEvent(QMouseEvent* event);
|
void mouseDoubleClickEvent(QMouseEvent* event);
|
||||||
void mouseReleaseEvent(QMouseEvent* event);
|
void mouseReleaseEvent(QMouseEvent* event);
|
||||||
QSize tabSizeHint(int index) const;
|
QSize tabSizeHint(int index) const;
|
||||||
|
@ -810,7 +810,6 @@ void WebView::load(const QUrl &url)
|
|||||||
|
|
||||||
QUrl WebView::url() const
|
QUrl WebView::url() const
|
||||||
{
|
{
|
||||||
return QWebView::url();
|
|
||||||
QUrl ur = QWebView::url();
|
QUrl ur = QWebView::url();
|
||||||
if (ur.isEmpty() && !m_aboutToLoadUrl.isEmpty()) {
|
if (ur.isEmpty() && !m_aboutToLoadUrl.isEmpty()) {
|
||||||
return m_aboutToLoadUrl;
|
return m_aboutToLoadUrl;
|
||||||
|
Loading…
Reference in New Issue
Block a user