summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Burgess <pete.burgess@isode.com>2018-04-20 15:18:20 (GMT)
committerPeter Burgess <pete.burgess@isode.com>2018-07-24 15:05:11 (GMT)
commitd3bbd300be4480c0a3b7285c91b3b27e82ca9c2f (patch)
treea86f47b56647363141523a7182cd84cd2551ef62 /Swift/QtUI/QtFdpFormSubmitWindow.h
parent5b4a0ba19ae6994db6a193a231fd2486bff6f0ec (diff)
downloadswift-d3bbd300be4480c0a3b7285c91b3b27e82ca9c2f.zip
swift-d3bbd300be4480c0a3b7285c91b3b27e82ca9c2f.tar.bz2
Add a XEP-346 FDP Form Submission Dialog
A new form submission dialog that will discover nodes containing fdp form templates in a given pubsub domain, and will present the form to the user ready to be filled out and submitted. Test-Infomation: Personally tested the request for all node items, loading the latest form from one of the discovered nodes, submitting a form and checking it turns up on my mlink server using mlc, checked that the submitted infomation is correct, what happens when an incorrect domain is queried, what happens when a valid domain is queried but it has no fdp nodes, and what happens when a form is requested from an invalid node. Unit tests written to test success and failure of the three controller functions requestPubSubNodeData(), requestTemplateForm() and testSubmitForm(). Change-Id: If8c57bb4e3120dd44d52f7332069eb18a14cb385
Diffstat (limited to 'Swift/QtUI/QtFdpFormSubmitWindow.h')
-rw-r--r--Swift/QtUI/QtFdpFormSubmitWindow.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/Swift/QtUI/QtFdpFormSubmitWindow.h b/Swift/QtUI/QtFdpFormSubmitWindow.h
new file mode 100644
index 0000000..c178a5b
--- /dev/null
+++ b/Swift/QtUI/QtFdpFormSubmitWindow.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2018 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <memory>
+
+#include <QDialog>
+
+#include <Swift/Controllers/UIInterfaces/FdpFormSubmitWindow.h>
+
+class QHBoxLayout;
+class QLabel;
+class QLineEdit;
+class QListWidgetItem;
+class QPushButton;
+class QTextEdit;
+class QVBoxLayout;
+
+namespace Swift {
+
+ class Form;
+ class QtFormWidget;
+ class QtListWidget;
+ class QtPubSubNodeController;
+
+ class QtFdpFormSubmitWindow : public QDialog, public FdpFormSubmitWindow {
+ Q_OBJECT
+
+ public:
+ QtFdpFormSubmitWindow(QWidget* parent = nullptr);
+ virtual ~QtFdpFormSubmitWindow();
+
+ protected:
+ virtual void closeEvent(QCloseEvent* event) override;
+
+ private:
+ void initNodeViewLayout();
+ void initFormLayout();
+ virtual void show() override;
+ virtual void raise() override;
+ virtual void addNode(const std::string& node, const std::string& nodeName) override;
+ virtual void clearNodeData() override;
+ virtual void setFormData(const std::shared_ptr<Form>& form) override;
+ virtual void showNodePlaceholder(NodeError nodeError) override;
+ virtual void showFormPlaceholder(TemplateError templateError) override;
+ virtual void handleSubmitServerResponse(bool submissionSuccess) override;
+
+ private slots:
+ void handleLoadDomainButtonClicked();
+ void handlePubSubListViewTemplateSelected(const std::string& nodeName);
+ void handlePubSubNodeViewItemDoubleClicked(QListWidgetItem* item);
+ void handleSubmitClicked();
+ void handleNodeListResize();
+
+ private:
+ QVBoxLayout* layout_;
+ QHBoxLayout* subLayout_;
+ QHBoxLayout* buttonLayout_;
+ QVBoxLayout* nodeViewLayout_;
+ QVBoxLayout* formLayout_;
+ QLineEdit* pubSubDomainEdit_;
+ QPushButton* loadDomainButton_;
+ QtListWidget* pubSubNodeView_;
+ QLabel* formPlaceholder_;
+ QTextEdit* nodePlaceholderTextEdit_ = nullptr;
+ QtFormWidget* formWidget_ = nullptr;
+ QPushButton* cancelButton_;
+ QPushButton* submitButton_ = nullptr;
+ QPushButton* okButton_ = nullptr;
+ };
+}