1
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:
nowrep 2012-01-02 17:23:31 +01:00
parent 66ee47d3cf
commit 8d3c56afe2
12 changed files with 42 additions and 42 deletions

View File

@ -115,8 +115,9 @@ bool QtWin::isRunningWindows7()
{
#ifdef Q_WS_WIN
return QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS7;
#endif
#else
return false;
#endif
}
/*!

View File

@ -81,7 +81,7 @@ QNetworkReply* AdBlockNetwork::block(const QNetworkRequest &request)
if (blockedRule) {
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) {
webPage->addAdBlockRule(blockedRule->filter(), request.url());
}

View File

@ -182,9 +182,9 @@ void AutoFillModel::post(const QNetworkRequest &request, const QByteArray &outgo
m_lastOutgoingData = outgoingData;
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));
WebView* webView = (WebView*)(v.value<void*>());
WebView* webView = static_cast<WebView*> (v.value<void*>());
if (!webPage || !webView) {
return;
}

View File

@ -102,7 +102,7 @@ void BookmarksToolbar::moveRight()
return;
}
ToolButton* button = (ToolButton*) act->data().value<void*>();
ToolButton* button = static_cast<ToolButton*> (act->data().value<void*>());
int index = m_layout->indexOf(button);
if (index == m_layout->count() - 1) {
@ -139,7 +139,7 @@ void BookmarksToolbar::moveLeft()
return;
}
ToolButton* button = (ToolButton*) act->data().value<void*>();
ToolButton* button = static_cast<ToolButton*> (act->data().value<void*>());
int index = m_layout->indexOf(button);
if (index == 0) {
@ -176,7 +176,7 @@ void BookmarksToolbar::removeButton()
return;
}
ToolButton* button = (ToolButton*) act->data().value<void*>();
ToolButton* button = static_cast<ToolButton*> (act->data().value<void*>());
if (!button) {
return;
}

View File

@ -283,32 +283,31 @@ void HistoryManager::refreshTable()
void HistoryManager::search(const QString &searchText)
{
ui->historyTree->filterString(searchText);
return;
if (searchText.isEmpty()) {
refreshTable();
return;
}
// if (searchText.isEmpty()) {
// refreshTable();
// return;
// }
refreshTable();
ui->historyTree->setUpdatesEnabled(false);
// refreshTable();
// 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;
foreach(QTreeWidgetItem * fitem, items) {
if (fitem->text(1).isEmpty()) {
continue;
}
QTreeWidgetItem* item = new QTreeWidgetItem();
item->setText(0, fitem->text(0));
item->setText(1, fitem->text(1));
item->setWhatsThis(1, fitem->whatsThis(1));
item->setIcon(0, _iconForUrl(fitem->text(1)));
foundItems.append(item);
}
ui->historyTree->clear();
ui->historyTree->addTopLevelItems(foundItems);
ui->historyTree->setUpdatesEnabled(true);
// QList<QTreeWidgetItem*> foundItems;
// foreach(QTreeWidgetItem * fitem, items) {
// if (fitem->text(1).isEmpty()) {
// continue;
// }
// QTreeWidgetItem* item = new QTreeWidgetItem();
// item->setText(0, fitem->text(0));
// item->setText(1, fitem->text(1));
// item->setWhatsThis(1, fitem->whatsThis(1));
// item->setIcon(0, _iconForUrl(fitem->text(1)));
// foundItems.append(item);
// }
// ui->historyTree->clear();
// ui->historyTree->addTopLevelItems(foundItems);
// ui->historyTree->setUpdatesEnabled(true);
}
void HistoryManager::optimizeDb()

View File

@ -94,9 +94,9 @@ void NetworkManager::setSSLConfiguration(QNetworkReply* reply)
QNetworkRequest request = reply->request();
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));
WebView* webView = (WebView*)(v.value<void*>());
WebView* webView = static_cast<WebView*> (v.value<void*>());
if (!webPage || !webView) {
return;
}
@ -131,7 +131,7 @@ void NetworkManager::sslError(QNetworkReply* reply, QList<QSslError> errors)
QNetworkRequest request = reply->request();
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) {
return;
}

View File

@ -43,6 +43,7 @@ PageThumbnailer::PageThumbnailer(QObject* parent)
: QObject(parent)
, m_page(new QWebPage(this))
, m_size(QSize(231, 130))
, m_loadTitle(false)
{
NetworkManagerProxy* networkProxy = new NetworkManagerProxy(this);
networkProxy->setPrimaryNetworkAccessManager(mApp->networkManager());

View File

@ -810,7 +810,6 @@ void WebView::load(const QUrl &url)
QUrl WebView::url() const
{
return QWebView::url();
QUrl ur = QWebView::url();
if (ur.isEmpty() && !m_aboutToLoadUrl.isEmpty()) {
return m_aboutToLoadUrl;