diff options
Diffstat (limited to 'Swift/QtUI/QtJoinMUCWindow.h')
-rw-r--r-- | Swift/QtUI/QtJoinMUCWindow.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Swift/QtUI/QtJoinMUCWindow.h b/Swift/QtUI/QtJoinMUCWindow.h index 90b4f3f..c7e2d74 100644 --- a/Swift/QtUI/QtJoinMUCWindow.h +++ b/Swift/QtUI/QtJoinMUCWindow.h @@ -6,12 +6,29 @@ #pragma once +#include <QValidator> #include <string> +#include "QtSwiftUtil.h" #include <Swift/Controllers/UIInterfaces/JoinMUCWindow.h> #include <Swift/QtUI/ui_QtJoinMUCWindow.h> namespace Swift { class UIEventStream; + class NickValidator : public QValidator { + Q_OBJECT + public: + NickValidator(QObject* parent) : QValidator(parent) { + } + + virtual QValidator::State validate(QString& input, int& /*pos*/) const { + if (input.isEmpty()) { + return QValidator::Acceptable; + } + JID test("alice", "wonderland.lit", Q2PSTRING(input)); + + return test.isValid() ? QValidator::Acceptable : QValidator::Invalid; + } + }; class QtJoinMUCWindow : public QWidget, public JoinMUCWindow { Q_OBJECT public: |