diff options
Diffstat (limited to 'Swift/Controllers/UIInterfaces')
-rw-r--r-- | Swift/Controllers/UIInterfaces/ChatListWindow.h | 8 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/ChatWindow.h | 13 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/FdpFormSubmitWindow.cpp | 32 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/FdpFormSubmitWindow.h | 54 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/FdpFormSubmitWindowFactory.h | 19 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/MainWindow.h | 4 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/MainWindowFactory.h | 14 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/UIFactory.h | 6 |
8 files changed, 129 insertions, 21 deletions
diff --git a/Swift/Controllers/UIInterfaces/ChatListWindow.h b/Swift/Controllers/UIInterfaces/ChatListWindow.h index 29097e9..6aa729b 100644 --- a/Swift/Controllers/UIInterfaces/ChatListWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatListWindow.h @@ -28,3 +28,3 @@ namespace Swift { Chat() : statusType(StatusShow::None), isMUC(false), unreadCount(0), isPrivateMessage(false) {} - Chat(const JID& jid, const std::string& chatName, const std::string& activity, int unreadCount, StatusShow::Type statusType, const boost::filesystem::path& avatarPath, bool isMUC, bool isPrivateMessage = false, const std::string& nick = "", const boost::optional<std::string> password = boost::optional<std::string>()) + Chat(const JID& jid, const std::string& chatName, const std::string& activity, size_t unreadCount, StatusShow::Type statusType, const boost::filesystem::path& avatarPath, bool isMUC, bool isPrivateMessage = false, const std::string& nick = "", const boost::optional<std::string> password = boost::optional<std::string>()) : jid(jid), chatName(chatName), activity(activity), statusType(statusType), isMUC(isMUC), nick(nick), password(password), unreadCount(unreadCount), avatarPath(avatarPath), isPrivateMessage(isPrivateMessage) {} @@ -55,3 +55,3 @@ namespace Swift { } - void setUnreadCount(int unread) { + void setUnreadCount(size_t unread) { unreadCount = unread; @@ -95,3 +95,3 @@ namespace Swift { boost::optional<std::string> password; - int unreadCount; + size_t unreadCount; boost::filesystem::path avatarPath; @@ -109,3 +109,3 @@ namespace Swift { virtual void setRecents(const std::list<Chat>& recents) = 0; - virtual void setUnreadCount(int unread) = 0; + virtual void setUnreadCount(size_t unread) = 0; virtual void clearBookmarks() = 0; diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h index 8273802..1c36ffc 100644 --- a/Swift/Controllers/UIInterfaces/ChatWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatWindow.h @@ -1,3 +1,3 @@ /* - * Copyright (c) 2010-2017 Isode Limited. + * Copyright (c) 2010-2018 Isode Limited. * All rights reserved. @@ -35,2 +35,4 @@ namespace Swift { class UserSearchWindow; + class DiscoInfo; + class ErrorPayload; @@ -141,3 +143,3 @@ namespace Swift { enum OccupantAction {Kick, Ban, MakeModerator, MakeParticipant, MakeVisitor, AddContact, ShowProfile}; - enum RoomAction {ChangeSubject, Configure, Affiliations, Destroy, Invite}; + enum RoomAction {ChangeSubject, Configure, Affiliations, Destroy, Invite, Leave}; enum FileTransferState { @@ -202,3 +204,3 @@ namespace Swift { virtual void setFileTransferEnabled(Tristate enabled) = 0; - virtual void setUnreadMessageCount(int count) = 0; + virtual void setUnreadMessageCount(size_t count) = 0; virtual void convertToMUC(MUCType mucType) = 0; @@ -221,2 +223,5 @@ namespace Swift { + virtual void setChatSecurityMarking(const std::string& markingValue, const std::string& markingForegroundColorValue, const std::string& markingBackgroundColorValue) = 0; + virtual void removeChatSecurityMarking() = 0; + /** @@ -251,2 +256,3 @@ namespace Swift { boost::signals2::signal<void (const std::string&, bool isCorrection)> onSendMessageRequest; + boost::signals2::signal<void (const std::string&)> onResendMessageRequest; boost::signals2::signal<void ()> onSendCorrectionMessageRequest; @@ -284,2 +290 @@ namespace Swift { } - diff --git a/Swift/Controllers/UIInterfaces/FdpFormSubmitWindow.cpp b/Swift/Controllers/UIInterfaces/FdpFormSubmitWindow.cpp new file mode 100644 index 0000000..47ef9cd --- /dev/null +++ b/Swift/Controllers/UIInterfaces/FdpFormSubmitWindow.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2018 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + +#include <Swift/Controllers/UIInterfaces/FdpFormSubmitWindow.h> + +#include <Swift/Controllers/Intl.h> + +namespace Swift { + +std::string FdpFormSubmitWindow::getNodeErrorText(NodeError nodeError) const { + switch(nodeError) { + case NodeError::DomainNotFound: return QT_TRANSLATE_NOOP("", "Error: No pubsub domain found"); + case NodeError::NoFdpNodesInDomain: return QT_TRANSLATE_NOOP("", "Error: Domain does not contain an FDP template node"); + case NodeError::NoError: return ""; + } + return ""; +} + +std::string FdpFormSubmitWindow::getTemplateErrorText(TemplateError templateError) const { + switch(templateError) { + case TemplateError::CannotLocateForm: return QT_TRANSLATE_NOOP("", "Error: Could not locate template form"); + case TemplateError::InvalidPayload: return QT_TRANSLATE_NOOP("", "Error: Invalid payload returned from node"); + case TemplateError::RequestFailed: return QT_TRANSLATE_NOOP("", "Error: Pubsub request failed"); + case TemplateError::NoError: return ""; + } + return ""; +} + +} diff --git a/Swift/Controllers/UIInterfaces/FdpFormSubmitWindow.h b/Swift/Controllers/UIInterfaces/FdpFormSubmitWindow.h new file mode 100644 index 0000000..572f910 --- /dev/null +++ b/Swift/Controllers/UIInterfaces/FdpFormSubmitWindow.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2018 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + +#pragma once + +#include <memory> +#include <string> + +#include <boost/signals2.hpp> + +namespace Swift { + + class Form; + + class FdpFormSubmitWindow { + + public: + enum class NodeError { + DomainNotFound, + NoFdpNodesInDomain, + NoError, + }; + enum class TemplateError { + CannotLocateForm, + InvalidPayload, + RequestFailed, + NoError, + }; + + virtual ~FdpFormSubmitWindow() {} + + virtual void show() = 0; + virtual void raise() = 0; + virtual void addNode(const std::string& node, const std::string& nodeName) = 0; + virtual void clearNodeData() = 0; + virtual void setFormData(const std::shared_ptr<Form>& form) = 0; + virtual void showNodePlaceholder(NodeError nodeError) = 0; + virtual void showFormPlaceholder(TemplateError templateError) = 0; + virtual void handleSubmitServerResponse(bool submissionSuccess) = 0; + + boost::signals2::signal<void ()> onCloseEvent; + boost::signals2::signal<void (const std::string&)> onRequestPubSubNodeData; + boost::signals2::signal<void (const std::string&)> onRequestTemplateForm; + boost::signals2::signal<void (const std::shared_ptr<Form>&)> onSubmitForm; + + protected: + + std::string getNodeErrorText(NodeError nodeError) const; + std::string getTemplateErrorText(TemplateError templateError) const; + }; +} diff --git a/Swift/Controllers/UIInterfaces/FdpFormSubmitWindowFactory.h b/Swift/Controllers/UIInterfaces/FdpFormSubmitWindowFactory.h new file mode 100644 index 0000000..ef11eaf --- /dev/null +++ b/Swift/Controllers/UIInterfaces/FdpFormSubmitWindowFactory.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2018 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + +#pragma once + +#include <memory> + +namespace Swift { + class FdpFormSubmitWindow; + + class FdpFormSubmitWindowFactory { + public: + virtual ~FdpFormSubmitWindowFactory() {} + virtual std::unique_ptr<FdpFormSubmitWindow> createFdpFormSubmitWindow() = 0; + }; +} diff --git a/Swift/Controllers/UIInterfaces/MainWindow.h b/Swift/Controllers/UIInterfaces/MainWindow.h index bfd8c67..e4b4657 100644 --- a/Swift/Controllers/UIInterfaces/MainWindow.h +++ b/Swift/Controllers/UIInterfaces/MainWindow.h @@ -1,3 +1,3 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2018 Isode Limited. * All rights reserved. @@ -15,3 +15,2 @@ #include <Swiften/Elements/StatusShow.h> -#include <Swiften/JID/JID.h> #include <Swiften/TLS/Certificate.h> @@ -21,2 +20,3 @@ namespace Swift { + class JID; class Roster; diff --git a/Swift/Controllers/UIInterfaces/MainWindowFactory.h b/Swift/Controllers/UIInterfaces/MainWindowFactory.h index c0110cf..af924e2 100644 --- a/Swift/Controllers/UIInterfaces/MainWindowFactory.h +++ b/Swift/Controllers/UIInterfaces/MainWindowFactory.h @@ -1,3 +1,3 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2018 Isode Limited. * All rights reserved. @@ -6,10 +6,8 @@ -#ifndef SWIFTEN_MainWindowFactory_H -#define SWIFTEN_MainWindowFactory_H - -#include "Swiften/JID/JID.h" -#include "Swift/Controllers/UIEvents/UIEventStream.h" +#pragma once namespace Swift { + class Chattables; class MainWindow; + class UIEventStream; @@ -21,3 +19,3 @@ namespace Swift { */ - virtual MainWindow* createMainWindow(UIEventStream* eventStream) = 0; + virtual MainWindow* createMainWindow(Chattables&, UIEventStream*) = 0; @@ -25,3 +23 @@ namespace Swift { } -#endif - diff --git a/Swift/Controllers/UIInterfaces/UIFactory.h b/Swift/Controllers/UIInterfaces/UIFactory.h index a0976dc..c49364a 100644 --- a/Swift/Controllers/UIInterfaces/UIFactory.h +++ b/Swift/Controllers/UIInterfaces/UIFactory.h @@ -1,3 +1,3 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2018 Isode Limited. * All rights reserved. @@ -14,2 +14,3 @@ #include <Swift/Controllers/UIInterfaces/EventWindowFactory.h> +#include <Swift/Controllers/UIInterfaces/FdpFormSubmitWindowFactory.h> #include <Swift/Controllers/UIInterfaces/FileTransferListWidgetFactory.h> @@ -44,3 +45,4 @@ namespace Swift { public HighlightEditorWindowFactory, - public BlockListEditorWidgetFactory { + public BlockListEditorWidgetFactory, + public FdpFormSubmitWindowFactory { public: |