From c8279e0c4a76db65547e6c711b8e7717e0d28059 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 7 Dec 2008 00:18:36 +0100 Subject: No more QmessageBox here.. --- src/browsermainwindow.cpp | 24 ++++++++++-------------- src/networkaccessmanager.cpp | 11 +++++------ src/tabwidget.cpp | 18 ++++++++---------- src/webview.cpp | 5 ++--- 4 files changed, 25 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/browsermainwindow.cpp b/src/browsermainwindow.cpp index 4f242225..6ca9c256 100644 --- a/src/browsermainwindow.cpp +++ b/src/browsermainwindow.cpp @@ -41,6 +41,7 @@ #include #include #include +#include // Qt Includes #include @@ -49,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -593,10 +593,8 @@ void BrowserMainWindow::slotPrivateBrowsing() " Until you close the window, you can still click the Back and Forward buttons" \ " to return to the webpages you have opened."); - QMessageBox::StandardButton button = QMessageBox::question(this, QString(), text, - QMessageBox::Ok | QMessageBox::Cancel, - QMessageBox::Ok); - if (button == QMessageBox::Ok) + int button = KMessageBox::questionYesNo( this, text, title ); + if (button == KMessageBox::Ok) { settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); } @@ -620,12 +618,10 @@ void BrowserMainWindow::closeEvent(QCloseEvent *event) { if (m_tabWidget->count() > 1) { - int ret = QMessageBox::warning(this, QString(), - i18n("Are you sure you want to close the window?" - " There are %1 tab open" , m_tabWidget->count() ) , - QMessageBox::Yes | QMessageBox::No, - QMessageBox::No); - if (ret == QMessageBox::No) + int ret = KMessageBox::warningYesNo(this, + i18n("Are you sure you want to close the window?" " There are %1 tab open" , m_tabWidget->count() ) , + QString() ); + if (ret == KMessageBox::No) { event->ignore(); return; @@ -730,11 +726,11 @@ void BrowserMainWindow::slotToggleInspector(bool enable) QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, enable); if (enable) { - int result = QMessageBox::question(this, i18n("Web Inspector"), + int result = KMessageBox::questionYesNo(this, i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n" "Do you want to reload all pages?"), - QMessageBox::Yes | QMessageBox::No); - if (result == QMessageBox::Yes) + i18n("Web Inspector") ); + if (result == KMessageBox::Yes) { m_tabWidget->reloadAllTabs(); } diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp index 79549d25..c5967d2a 100644 --- a/src/networkaccessmanager.cpp +++ b/src/networkaccessmanager.cpp @@ -23,15 +23,16 @@ #include "networkaccessmanager.h" #include "browserapplication.h" #include "browsermainwindow.h" + #include "ui_passworddialog.h" #include "ui_proxy.h" // KDE Includes #include +#include // Qt Includes #include -#include #include #include #include @@ -138,11 +139,9 @@ void NetworkAccessManager::sslErrors(QNetworkReply *reply, const QListurl().toString() + "\n\n" + QString(errors) + "\n\n", - QMessageBox::Yes | QMessageBox::No, - QMessageBox::No); - if (ret == QMessageBox::Yes) + int ret = KMessageBox::warningYesNo( mainWindow, + i18n("SSL Errors:\n\n") + reply->url().toString() + "\n\n" + QString(errors) + "\n\n"); + if (ret == KMessageBox::Yes) reply->ignoreSslErrors(); } #endif diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp index b8e9c748..01f9bd6c 100644 --- a/src/tabwidget.cpp +++ b/src/tabwidget.cpp @@ -31,6 +31,7 @@ // KDE Includes #include #include +#include // Qt Includes #include @@ -334,6 +335,7 @@ void TabWidget::currentChanged(int index) if (!webView) return; +// FIXME Q_ASSERT( m_lineEdits->count() == count() ); WebView *oldWebView = this->webView(m_lineEdits->currentIndex()); @@ -601,16 +603,12 @@ void TabWidget::closeTab(int index) { if (tab->isModified()) { - QMessageBox closeConfirmation(tab); - closeConfirmation.setWindowFlags(Qt::Sheet); - closeConfirmation.setWindowTitle(i18n("Do you really want to close this page?")); - closeConfirmation.setInformativeText(i18n("You have modified this page and when closing it you would lose the modification.\n" - "Do you really want to close this page?\n")); - closeConfirmation.setIcon(QMessageBox::Question); - closeConfirmation.addButton(QMessageBox::Yes); - closeConfirmation.addButton(QMessageBox::No); - closeConfirmation.setEscapeButton(QMessageBox::No); - if (closeConfirmation.exec() == QMessageBox::No) + int risp = KMessageBox::questionYesNo( this , + i18n("You have modified this page and when closing it you would lose the modification.\n" + "Do you really want to close this page?\n"), + i18n("Do you really want to close this page?"), + KStandardGuiItem::no() ); + if( risp == KMessageBox::No ) return; } hasFocus = tab->hasFocus(); diff --git a/src/webview.cpp b/src/webview.cpp index 2e97c486..b14b4936 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -32,10 +32,8 @@ #include #include -#include #include #include -//#include #include @@ -53,7 +51,8 @@ WebPage::WebPage(QObject *parent) BrowserMainWindow *WebPage::mainWindow() { QObject *w = this->parent(); - while (w) { + while (w) + { if (BrowserMainWindow *mw = qobject_cast(w)) return mw; w = w->parent(); -- cgit v1.2.1