summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThilo Cestonaro <thilo@cestona.ro>2010-12-13 10:28:19 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-02-07 21:44:54 (GMT)
commitfd7a668326dde86c11dd57c2c2e201fd959b02f5 (patch)
treebb625c00944d9756b7dd667f7dea86e0f48ad655 /Swift/QtUI/QtLoginWindow.cpp
parent686b4c2e8036954ea2a188afc27972587894059e (diff)
downloadswift-fd7a668326dde86c11dd57c2c2e201fd959b02f5.zip
swift-fd7a668326dde86c11dd57c2c2e201fd959b02f5.tar.bz2
Identify the marked jid and recognize del or backspace
License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
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) {