diff options
| author | Kevin Smith <git@kismith.co.uk> | 2010-12-05 15:01:39 (GMT) | 
|---|---|---|
| committer | Kevin Smith <git@kismith.co.uk> | 2010-12-05 15:01:39 (GMT) | 
| commit | f39fa5f0c71a1b04997005f54e33d162c82528de (patch) | |
| tree | 013bb061e13477e0b5260f8d9fe23f16e670a611 | |
| parent | ec923326d40708e2ef639bf191126ecb197c4c30 (diff) | |
| download | swift-f39fa5f0c71a1b04997005f54e33d162c82528de.zip swift-f39fa5f0c71a1b04997005f54e33d162c82528de.tar.bz2 | |
Ask for confirmation before clearing chat windows.
Resolves: #702
Release-Notes: You'll now be asked for confirmation before clearing the chat window history.
| -rw-r--r-- | Swift/QtUI/QtChatView.cpp | 15 | ||||
| -rw-r--r-- | Swift/QtUI/QtChatView.h | 1 | 
2 files changed, 15 insertions, 1 deletions
| diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index 4738da3..9646afb 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -15,6 +15,7 @@  #include <QKeyEvent>  #include <QStackedWidget>  #include <QTimer> +#include <QMessageBox>  #include "QtWebView.h"  #include "QtChatTheme.h" @@ -32,7 +33,7 @@ QtChatView::QtChatView(QtChatTheme* theme, QWidget* parent) : QWidget(parent) {  	connect(webView_, SIGNAL(linkClicked(const QUrl&)), SLOT(handleLinkClicked(const QUrl&)));  	connect(webView_, SIGNAL(loadFinished(bool)), SLOT(handleViewLoadFinished(bool)));  	connect(webView_, SIGNAL(gotFocus()), SIGNAL(gotFocus())); -	connect(webView_, SIGNAL(clearRequested()), SLOT(resetView())); +	connect(webView_, SIGNAL(clearRequested()), SLOT(handleClearRequested()));  #ifdef Q_WS_X11  	/* To give a border on Linux, where it looks bad without */  	QStackedWidget* stack = new QStackedWidget(this); @@ -54,6 +55,18 @@ QtChatView::QtChatView(QtChatTheme* theme, QWidget* parent) : QWidget(parent) {  	resetView();  } +void QtChatView::handleClearRequested() { +	QMessageBox messageBox(this); +	messageBox.setText("Clear log."); +	messageBox.setInformativeText("Are you sure you want to clear your chat log?"); +	messageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); +	messageBox.setDefaultButton(QMessageBox::Yes); +	int button = messageBox.exec(); +	if (button == QMessageBox::Yes) { +		resetView(); +	} +} +  void QtChatView::handleKeyPressEvent(QKeyEvent* event) {  	webView_->keyPressEvent(event);  } diff --git a/Swift/QtUI/QtChatView.h b/Swift/QtUI/QtChatView.h index 84738d4..58b33df 100644 --- a/Swift/QtUI/QtChatView.h +++ b/Swift/QtUI/QtChatView.h @@ -46,6 +46,7 @@ namespace Swift {  		private slots:  			void handleViewLoadFinished(bool);  			void handleFrameSizeChanged(); +			void handleClearRequested();  		private:  			void headerEncode(); | 
 Swift
 Swift