summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtLoginWindow.cpp')
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index 7d17f88..d028253 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -22,8 +22,10 @@
#include <QHBoxLayout>
#include <qdebug.h>
#include <QCloseEvent>
+#include <QCursor>
#include <QMessageBox>
-
+#include <QKeyEvent>
+
#include "Swift/Controllers/UIEvents/UIEventStream.h"
#include "Swift/Controllers/UIEvents/RequestXMLConsoleUIEvent.h"
#include "Swift/Controllers/UIEvents/ToggleSoundsUIEvent.h"
@@ -83,6 +85,7 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream) : QMainWindow() {
username_->setEditable(true);
username_->setWhatsThis("User address - looks like someuser@someserver.com");
username_->setToolTip("User address - looks like someuser@someserver.com");
+ username_->view()->installEventFilter(this);
layout->addWidget(username_);
QLabel* jidHintLabel = new QLabel(this);
jidHintLabel->setText("<font size='-1' color='grey' >Example: alice@wonderland.lit</font>");
@@ -186,6 +189,18 @@ QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream) : QMainWindow() {
this->show();
}
+bool QtLoginWindow::eventFilter(QObject *obj, QEvent *event) {
+ if (obj == username_->view() && event->type() == QEvent::KeyPress) {
+ QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
+ if(keyEvent->key() == Qt::Key_Delete || Qt::Key_Backspace) {
+ QMessageBox::information(this, "Delete this login data?", "Remove the save login data regarding the jid: " + username_->view()->currentIndex().data().toString());
+ return true;
+ }
+ }
+ // standard event processing
+ return QObject::eventFilter(obj, event);
+}
+
void QtLoginWindow::handleUIEvent(boost::shared_ptr<UIEvent> event) {
boost::shared_ptr<ToggleSoundsUIEvent> soundEvent = boost::dynamic_pointer_cast<ToggleSoundsUIEvent>(event);
if (soundEvent) {