summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-02-07 13:03:53 (GMT)
committerTobias Markmann <tm@ayena.de>2017-02-10 09:39:53 (GMT)
commit72824c12ab6c15501e6e17c15465d9b27c6f7e1b (patch)
tree9035caf97724f42c8917b0e4cbd50cbe9d948f87 /Swift/QtUI
parentd81f9e750627a83c12afeb4718eb12bbb53f5270 (diff)
downloadswift-72824c12ab6c15501e6e17c15465d9b27c6f7e1b.zip
swift-72824c12ab6c15501e6e17c15465d9b27c6f7e1b.tar.bz2
Display error message in profile window if vCard request failed
Also fixed an typo error in GConfProxyProvider.cpp that prevented compilation on Linux. Test-Information: Tested with an XMPP server with vCard support disabled and also with vCard support enabled. Tested profile window and profile editor window. The profile window will show cached vCard data if present and the error message. The profile editor window will only show the error message in case of an error. Tested profile window and profile editor window in a scenario where vCard support is first enabled in the server, then disabled, and finally enabled again, and opening the editors in between. Potential error messages were always correctly cleared before showing the dialog. Tested on macOS 10.12.3 with Qt 5.7.1. Change-Id: I3958c35286f6f0096d1605c29816f666530aae03
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtProfileWindow.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Swift/QtUI/QtProfileWindow.cpp b/Swift/QtUI/QtProfileWindow.cpp
index 80e275b..10326bb 100644
--- a/Swift/QtUI/QtProfileWindow.cpp
+++ b/Swift/QtUI/QtProfileWindow.cpp
@@ -1,32 +1,32 @@
/*
- * Copyright (c) 2011-2016 Isode Limited.
+ * Copyright (c) 2011-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
/*
* Copyright (c) 2012 Tobias Markmann
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#include <Swift/QtUI/QtProfileWindow.h>
#include <QCloseEvent>
#include <QMovie>
#include <QShortcut>
#include <QTextDocument>
#include <QTimer>
#include <Swift/QtUI/QtSwiftUtil.h>
#include <Swift/QtUI/QtUtilities.h>
#include <Swift/QtUI/ui_QtProfileWindow.h>
namespace Swift {
QtProfileWindow::QtProfileWindow() :
QWidget(),
ui(new Ui::QtProfileWindow) {
ui->setupUi(this);
ui->statusLabel->setText(tr("Retrieving profile information for this user."));
@@ -47,89 +47,89 @@ QtProfileWindow::QtProfileWindow() :
}
QtProfileWindow::~QtProfileWindow() {
delete ui;
}
void QtProfileWindow::setJID(const JID& jid) {
this->jid = jid;
updateTitle();
}
void QtProfileWindow::setVCard(VCard::ref vcard) {
ui->vcard->setVCard(vcard);
if (vcard->isEmpty()) {
ui->vcard->setVisible(false);
ui->emptyLabel->setVisible(true);
} else {
ui->vcard->setVisible(true);
ui->emptyLabel->setVisible(false);
}
updateWindowSize();
}
void QtProfileWindow::setEnabled(bool b) {
ui->vcard->setEnabled(b);
ui->savePushButton->setEnabled(b);
}
void QtProfileWindow::setEditable(bool b) {
ui->throbberLabel->setVisible(b);
- ui->errorLabel->setVisible(b);
ui->savePushButton->setVisible(b);
ui->vcard->setEditable(b);
updateTitle();
updateWindowSize();
}
void QtProfileWindow::setProcessing(bool processing) {
if (processing) {
ui->throbberLabel->movie()->start();
ui->throbberLabel->show();
ui->statusLabel->setVisible(true);
ui->vcard->setVisible(false);
}
else {
ui->throbberLabel->hide();
ui->throbberLabel->movie()->stop();
ui->statusLabel->setVisible(false);
ui->vcard->setVisible(true);
}
}
void QtProfileWindow::setError(const std::string& error) {
if (!error.empty()) {
ui->errorLabel->setText("<font color='red'>" + QtUtilities::htmlEscape(P2QSTRING(error)) + "</font>");
}
else {
ui->errorLabel->setText("");
}
+ ui->errorLabel->setVisible(!error.empty());
}
void QtProfileWindow::show() {
QWidget::showNormal();
QWidget::activateWindow();
QWidget::raise();
}
void QtProfileWindow::hide() {
QWidget::hide();
}
QSize QtProfileWindow::sizeHint() const {
return QWidget::sizeHint();
}
void QtProfileWindow::updateTitle() {
QString jidString;
if (jid.isValid()) {
jidString = QString(" ( %1 )").arg(P2QSTRING(jid.toString()));
}
if (ui->vcard->isEditable()) {
setWindowTitle(tr("Edit Profile") + jidString);
} else {
setWindowTitle(tr("Show Profile") + jidString);
}
}
void QtProfileWindow::updateWindowSize() {