diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2008-12-07 00:18:36 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2008-12-07 00:18:36 +0100 |
commit | c8279e0c4a76db65547e6c711b8e7717e0d28059 (patch) | |
tree | e9e42a5cca514d600094afe8d4c03af2bd82ce23 | |
parent | Fixed crash when closing rekonq with more than one tab (diff) | |
download | rekonq-c8279e0c4a76db65547e6c711b8e7717e0d28059.tar.xz |
No more QmessageBox here..
-rw-r--r-- | src/browsermainwindow.cpp | 24 | ||||
-rw-r--r-- | src/networkaccessmanager.cpp | 11 | ||||
-rw-r--r-- | src/tabwidget.cpp | 18 | ||||
-rw-r--r-- | src/webview.cpp | 5 |
4 files changed, 25 insertions, 33 deletions
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 <KAction> #include <KToggleFullScreenAction> #include <KActionCollection> +#include <KMessageBox> // Qt Includes #include <QDesktopWidget> @@ -49,7 +50,6 @@ #include <QPrintDialog> #include <QPrintPreviewDialog> #include <QPrinter> -#include <QMessageBox> #include <QToolBar> #include <QInputDialog> #include <QWebFrame> @@ -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 <KConfig> +#include <KMessageBox> // Qt Includes #include <QDialog> -#include <QMessageBox> #include <QStyle> #include <QTextDocument> #include <QAuthenticator> @@ -138,11 +139,9 @@ void NetworkAccessManager::sslErrors(QNetworkReply *reply, const QList<QSslError for (int i = 0; i < error.count(); ++i) errorStrings += error.at(i).errorString(); QString errors = errorStrings.join(QLatin1String("\n")); - int ret = QMessageBox::warning(mainWindow, QCoreApplication::applicationName(), - i18n("SSL Errors:\n\n") + reply->url().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 <KShortcut> #include <KStandardShortcut> +#include <KMessageBox> // Qt Includes #include <QtGui> @@ -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 <QClipboard> #include <QMenu> -#include <QMessageBox> #include <QMouseEvent> #include <QWebHitTestResult> -//#include <QUiLoader> #include <QBuffer> @@ -53,7 +51,8 @@ WebPage::WebPage(QObject *parent) BrowserMainWindow *WebPage::mainWindow() { QObject *w = this->parent(); - while (w) { + while (w) + { if (BrowserMainWindow *mw = qobject_cast<BrowserMainWindow*>(w)) return mw; w = w->parent(); |