summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-05-20 22:15:32 (GMT)
committerTobias Markmann <tm@ayena.de>2015-05-20 22:20:00 (GMT)
commitd1823afd38df62887b0c5e9f1f01a50ab84f77ba (patch)
tree9c79c6474d5b54b7d89fc72008599e886fd46476 /Swift/QtUI/QtJoinMUCWindow.h
parent79af3d5aed669839a916f8973953b608e4177e9b (diff)
downloadswift-d1823afd38df62887b0c5e9f1f01a50ab84f77ba.zip
swift-d1823afd38df62887b0c5e9f1f01a50ab84f77ba.tar.bz2
Usability improvements to "Enter Room" dialog
Require valid room JID to proceed with entering a room. Provide user feedback via tooltips on invalid input in the room and nickname field. Test-Information: Tested with invalid room JID and empty nickanme on OS X 10.9.5 and Qt 5.4.0. Change-Id: I8d8c75f5712f27cc72cce2d6dd16dbbea4fb504a
Diffstat (limited to 'Swift/QtUI/QtJoinMUCWindow.h')
-rw-r--r--Swift/QtUI/QtJoinMUCWindow.h35
1 files changed, 30 insertions, 5 deletions
diff --git a/Swift/QtUI/QtJoinMUCWindow.h b/Swift/QtUI/QtJoinMUCWindow.h
index ba12b86..92580ff 100644
--- a/Swift/QtUI/QtJoinMUCWindow.h
+++ b/Swift/QtUI/QtJoinMUCWindow.h
@@ -1,16 +1,20 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
-#include <QValidator>
+#include <Swift/QtUI/ui_QtJoinMUCWindow.h>
+
#include <string>
-#include "QtSwiftUtil.h"
+
+#include <QValidator>
+
#include <Swift/Controllers/UIInterfaces/JoinMUCWindow.h>
-#include <Swift/QtUI/ui_QtJoinMUCWindow.h>
+
+#include <Swift/QtUI/QtSwiftUtil.h>
namespace Swift {
class UIEventStream;
@@ -22,13 +26,34 @@ namespace Swift {
virtual QValidator::State validate(QString& input, int& /*pos*/) const {
if (input.isEmpty()) {
- return QValidator::Acceptable;
+ return QValidator::Intermediate;
}
JID test("alice", "wonderland.lit", Q2PSTRING(input));
return test.isValid() ? QValidator::Acceptable : QValidator::Invalid;
}
};
+
+ class RoomJIDValidator : public QValidator {
+ Q_OBJECT
+ public:
+ RoomJIDValidator(QObject* parent) : QValidator(parent) {
+ }
+
+ virtual QValidator::State validate(QString& input, int& /*pos*/) const {
+ if (input.isEmpty()) {
+ return QValidator::Intermediate;
+ }
+ JID roomJID(Q2PSTRING(input));
+
+ if (roomJID.getNode().empty() || roomJID.getDomain().empty()) {
+ return QValidator::Intermediate;
+ }
+
+ return (roomJID.getResource().empty() && !roomJID.getNode().empty() && !roomJID.getDomain().empty() && roomJID.isValid()) ? QValidator::Acceptable : QValidator::Invalid;
+ }
+ };
+
class QtJoinMUCWindow : public QWidget, public JoinMUCWindow {
Q_OBJECT
public: