summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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;