summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-02-11 11:25:42 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-02-11 11:25:42 (GMT)
commitb8a73b1d16afd4f3aa0e8e39447024ec541df4c8 (patch)
tree503acb56c355ac0cca5dc13d89a9e4a3804ab813 /Swift/QtUI/QtLoginWindow.cpp
parent4dde3a55c46c95d89a7564738e132ad23bc946ee (diff)
downloadswift-b8a73b1d16afd4f3aa0e8e39447024ec541df4c8.zip
swift-b8a73b1d16afd4f3aa0e8e39447024ec541df4c8.tar.bz2
Allow deletion of items from login list.
Resolves: #711 Release-Notes: Highlighting an item in the login account list and pressing detele will now prompt you to remove the cached credentials for that account.
Diffstat (limited to 'Swift/QtUI/QtLoginWindow.cpp')
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index a3e52dc..c3fdac2 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -193,7 +193,11 @@ 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 || keyEvent->key() == Qt::Key_Backspace) {
- QMessageBox::information(this, "Remove profile", "Remove the profile '" + username_->view()->currentIndex().data().toString() + "'?");
+ QString jid(username_->view()->currentIndex().data().toString());
+ int result = QMessageBox::question(this, "Remove profile", "Remove the profile '" + jid + "'?", QMessageBox::Yes | QMessageBox::No);
+ if (result == QMessageBox::Yes) {
+ onPurgeSavedLoginRequest(Q2PSTRING(jid));
+ }
return true;
}
}
@@ -221,6 +225,22 @@ void QtLoginWindow::selectUser(const String& username) {
}
}
+void QtLoginWindow::removeAvailableAccount(const String& jid) {
+ QString username = P2QSTRING(jid);
+ int index = -1;
+ for (int i = 0; i < usernames_.count(); i++) {
+ if (username == usernames_[i]) {
+ index = i;
+ }
+ }
+ if (index >= 0) {
+ usernames_.removeAt(index);
+ passwords_.removeAt(index);
+ certificateFiles_.removeAt(index);
+ username_->removeItem(index);
+ }
+}
+
void QtLoginWindow::addAvailableAccount(const String& defaultJID, const String& defaultPassword, const String& defaultCertificate) {
QString username = P2QSTRING(defaultJID);
int index = -1;