1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +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

@ -1039,7 +1039,7 @@ void QupZilla::showPreferences()
prefs->show();
}
void QupZilla::showSource(QWebFrame *frame, const QString &selectedHtml)
void QupZilla::showSource(QWebFrame* frame, const QString &selectedHtml)
{
if (!frame) {
frame = weView()->page()->mainFrame();
@ -1285,7 +1285,7 @@ void QupZilla::sendLink()
QDesktopServices::openUrl(url);
}
void QupZilla::printPage(QWebFrame *frame)
void QupZilla::printPage(QWebFrame* frame)
{
QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this);
@ -1340,7 +1340,7 @@ void QupZilla::startPrivate(bool state)
mApp->togglePrivateBrowsingMode(state);
}
void QupZilla::resizeEvent(QResizeEvent *event)
void QupZilla::resizeEvent(QResizeEvent* event)
{
m_bookmarksToolbar->setMaximumWidth(width());

View File

@ -201,7 +201,7 @@ private slots:
bool quitApp();
private:
void resizeEvent(QResizeEvent *event);
void resizeEvent(QResizeEvent* event);
void keyPressEvent(QKeyEvent* event);
void mousePressEvent(QMouseEvent* event);
void closeEvent(QCloseEvent* event);

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

@ -313,7 +313,7 @@ int TabBar::normalTabsCount()
return count() - m_pinnedTabsCount;
}
void TabBar::mousePressEvent(QMouseEvent *event)
void TabBar::mousePressEvent(QMouseEvent* event)
{
if (event->buttons() & Qt::LeftButton && tabAt(event->pos()) != -1) {
m_dragStartPosition = mapFromGlobal(event->globalPos());
@ -325,7 +325,7 @@ void TabBar::mousePressEvent(QMouseEvent *event)
QTabBar::mousePressEvent(event);
}
void TabBar::mouseMoveEvent(QMouseEvent *event)
void TabBar::mouseMoveEvent(QMouseEvent* event)
{
if (!m_dragStartPosition.isNull() && m_tabWidget->buttonAddTab()->isVisible()) {
int manhattanLength = (event->pos() - m_dragStartPosition).manhattanLength();

View File

@ -80,8 +80,8 @@ private slots:
void closeCurrentTab();
private:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void mouseDoubleClickEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
QSize tabSizeHint(int index) const;

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;