From a934072cf9695e46e793898102590322f43c0733 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 28 Mar 2009 15:53:26 +0100 Subject: astyle. First round.. --- src/webview.cpp | 94 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'src/webview.cpp') diff --git a/src/webview.cpp b/src/webview.cpp index 947b08cd..239a5f5a 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -46,12 +46,12 @@ WebPage::WebPage(QObject *parent) - : QWebPage(parent) - , m_keyboardModifiers(Qt::NoModifier) - , m_pressedButtons(Qt::NoButton) - , m_openInNewTab(false) + : QWebPage(parent) + , m_keyboardModifiers(Qt::NoModifier) + , m_pressedButtons(Qt::NoButton) + , m_openInNewTab(false) { - setNetworkAccessManager( Application::networkAccessManager() ); + setNetworkAccessManager(Application::networkAccessManager()); connect(this, SIGNAL(unsupportedContent(QNetworkReply *)), this, SLOT(handleUnsupportedContent(QNetworkReply *))); } @@ -65,7 +65,7 @@ WebPage::~WebPage() MainWindow *WebPage::mainWindow() { QObject *w = this->parent(); - while (w) + while (w) { if (MainWindow *mw = qobject_cast(w)) return mw; @@ -81,8 +81,8 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r // ctrl open in new tab and select // ctrl-alt open in new window - if ( type == QWebPage::NavigationTypeLinkClicked && (m_keyboardModifiers & Qt::ControlModifier - || m_pressedButtons == Qt::MidButton) ) + if (type == QWebPage::NavigationTypeLinkClicked && (m_keyboardModifiers & Qt::ControlModifier + || m_pressedButtons == Qt::MidButton)) { WebView *webView = Application::instance()->newTab(); webView->setFocus(); @@ -91,7 +91,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r m_pressedButtons = Qt::NoButton; return false; } - if ( frame == mainFrame() ) + if (frame == mainFrame()) { m_loadingUrl = request.url(); emit loadingUrl(m_loadingUrl); @@ -108,7 +108,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r QWebPage *WebPage::createWindow(QWebPage::WebWindowType type) { // added to manage web modal dialogs - if(type == QWebPage::WebModalDialog) + if (type == QWebPage::WebModalDialog) { WebView *w = new WebView; return w->page(); @@ -118,8 +118,8 @@ QWebPage *WebPage::createWindow(QWebPage::WebWindowType type) { m_openInNewTab = true; } - - if (m_openInNewTab) + + if (m_openInNewTab) { m_openInNewTab = false; return mainWindow()->mainView()->newTab()->page(); @@ -145,45 +145,45 @@ QObject *WebPage::createPlugin(const QString &classId, const QUrl &url, const QS void WebPage::handleUnsupportedContent(QNetworkReply *reply) { - if (reply->error() == QNetworkReply::NoError) + if (reply->error() == QNetworkReply::NoError) { KUrl srcUrl = reply->url(); QString path = ReKonfig::downloadDir() + QString("/") + srcUrl.fileName(); KUrl destUrl = KUrl(path); - Application::instance()->downloadUrl( srcUrl, destUrl ); + Application::instance()->downloadUrl(srcUrl, destUrl); return; } QString myfilestr = KStandardDirs::locate("data", "rekonq/htmls/notfound.html"); - QFile file( myfilestr ); + QFile file(myfilestr); bool isOpened = file.open(QIODevice::ReadOnly); Q_ASSERT(isOpened); QString title = i18n("Error loading page: ") + reply->url().toString(); - QString imagePath = KIconLoader::global()->iconPath( "rekonq", KIconLoader::NoGroup, false); + QString imagePath = KIconLoader::global()->iconPath("rekonq", KIconLoader::NoGroup, false); QString html = QString(QLatin1String(file.readAll())) - .arg(title) - .arg("file://" + imagePath) - .arg(reply->errorString()) - .arg(reply->url().toString()); + .arg(title) + .arg("file://" + imagePath) + .arg(reply->errorString()) + .arg(reply->url().toString()); QList frames; frames.append(mainFrame()); - while (!frames.isEmpty()) + while (!frames.isEmpty()) { QWebFrame *frame = frames.takeFirst(); - if (frame->url() == reply->url()) + if (frame->url() == reply->url()) { frame->setHtml(html, reply->url()); return; } QList children = frame->childFrames(); foreach(QWebFrame *frame, children) - frames.append(frame); + frames.append(frame); } - if (m_loadingUrl == reply->url()) + if (m_loadingUrl == reply->url()) { mainFrame()->setHtml(html, reply->url()); } @@ -194,9 +194,9 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) WebView::WebView(QWidget* parent) - : QWebView(parent) - , m_progress(0) - , m_page(new WebPage(this)) + : QWebView(parent) + , m_progress(0) + , m_page(new WebPage(this)) { setPage(m_page); connect(page(), SIGNAL(statusBarMessage(const QString&)), this, SLOT(setStatusBarText(const QString&))); @@ -214,18 +214,18 @@ WebView::WebView(QWidget* parent) void WebView::contextMenuEvent(QContextMenuEvent *event) { QWebHitTestResult r = page()->mainFrame()->hitTestContent(event->pos()); - if (!r.linkUrl().isEmpty()) + if (!r.linkUrl().isEmpty()) { KMenu menu(this); - KAction *a = new KAction( KIcon("tab-new"), i18n("Open in New Tab"), this); - connect( a, SIGNAL( triggered() ), this , SLOT( openLinkInNewTab() ) ); + KAction *a = new KAction(KIcon("tab-new"), i18n("Open in New Tab"), this); + connect(a, SIGNAL(triggered()), this , SLOT(openLinkInNewTab())); menu.addAction(a); menu.addSeparator(); - menu.addAction( pageAction(QWebPage::DownloadLinkToDisk) ); + menu.addAction(pageAction(QWebPage::DownloadLinkToDisk)); // Add link to bookmarks... menu.addSeparator(); - menu.addAction( pageAction(QWebPage::CopyLinkToClipboard) ); - if ( page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled) ) + menu.addAction(pageAction(QWebPage::CopyLinkToClipboard)); + if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled)) { menu.addAction(pageAction(QWebPage::InspectElement)); } @@ -238,7 +238,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) void WebView::wheelEvent(QWheelEvent *event) { - if (QApplication::keyboardModifiers() & Qt::ControlModifier) + if (QApplication::keyboardModifiers() & Qt::ControlModifier) { int numDegrees = event->delta() / 8; int numSteps = numDegrees / 15; @@ -265,10 +265,10 @@ void WebView::setProgress(int progress) void WebView::loadFinished() { - if (m_progress != 100) + if (m_progress != 100) { kWarning() << "Recieved finished signal while progress is still:" << progress() - << "Url:" << url(); + << "Url:" << url(); } m_progress = 0; } @@ -279,12 +279,12 @@ void WebView::loadUrl(const KUrl &url) { m_initialUrl = url; - if( m_initialUrl.isRelative() ) + if (m_initialUrl.isRelative()) { kWarning() << "1: " << m_initialUrl.url(); - QString fn = m_initialUrl.url( KUrl::RemoveTrailingSlash ); + QString fn = m_initialUrl.url(KUrl::RemoveTrailingSlash); kWarning() << "2: " << fn; - m_initialUrl.setUrl( "//" + fn ); + m_initialUrl.setUrl("//" + fn); m_initialUrl.setScheme("http"); kWarning() << "3: " << m_initialUrl.url(); } @@ -302,7 +302,7 @@ QString WebView::lastStatusBarText() const KUrl WebView::url() const { KUrl url = QWebView::url(); - if ( !url.isEmpty() ) + if (!url.isEmpty()) { return url; } @@ -321,10 +321,10 @@ void WebView::mousePressEvent(QMouseEvent *event) void WebView::mouseReleaseEvent(QMouseEvent *event) { QWebView::mouseReleaseEvent(event); - if (!event->isAccepted() && (m_page->m_pressedButtons & Qt::MidButton)) + if (!event->isAccepted() && (m_page->m_pressedButtons & Qt::MidButton)) { - KUrl url( QApplication::clipboard()->text(QClipboard::Selection) ); - if (!url.isEmpty() && url.isValid() && !url.scheme().isEmpty()) + KUrl url(QApplication::clipboard()->text(QClipboard::Selection)); + if (!url.isEmpty() && url.isValid() && !url.scheme().isEmpty()) { setUrl(url); } @@ -343,24 +343,24 @@ void WebView::downloadRequested(const QNetworkRequest &request) KUrl srcUrl = request.url(); QString path = ReKonfig::downloadDir() + QString("/") + srcUrl.fileName(); KUrl destUrl = KUrl(path); - Application::instance()->downloadUrl( srcUrl, destUrl ); + Application::instance()->downloadUrl(srcUrl, destUrl); } void WebView::keyPressEvent(QKeyEvent *event) { - if ( (event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_Tab) ) + if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_Tab)) { emit ctrlTabPressed(); return; } - if( (event->modifiers() == Qt::ControlModifier + Qt::ShiftModifier) && (event->key() == Qt::Key_Backtab) ) + if ((event->modifiers() == Qt::ControlModifier + Qt::ShiftModifier) && (event->key() == Qt::Key_Backtab)) { emit shiftCtrlTabPressed(); return; } - QWebView::keyPressEvent( event ); + QWebView::keyPressEvent(event); } -- cgit v1.2.1