summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/UIInterfaces')
-rw-r--r--Swift/Controllers/UIInterfaces/ChatListWindow.h8
-rw-r--r--Swift/Controllers/UIInterfaces/ChatWindow.h13
-rw-r--r--Swift/Controllers/UIInterfaces/FdpFormSubmitWindow.cpp32
-rw-r--r--Swift/Controllers/UIInterfaces/FdpFormSubmitWindow.h54
-rw-r--r--Swift/Controllers/UIInterfaces/FdpFormSubmitWindowFactory.h19
-rw-r--r--Swift/Controllers/UIInterfaces/MainWindow.h4
-rw-r--r--Swift/Controllers/UIInterfaces/MainWindowFactory.h14
-rw-r--r--Swift/Controllers/UIInterfaces/UIFactory.h6
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
@@ -24,11 +24,11 @@ namespace Swift {
class ChatListWindow {
public:
class Chat {
public:
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) {}
/** Assume that nicks and other transient features aren't important for equality */
bool operator==(const Chat& other) const {
if (impromptuJIDs.empty()) {
return jid.toBare() == other.jid.toBare()
@@ -51,11 +51,11 @@ namespace Swift {
}
}
return key_compare(inviteesNames, other.inviteesNames);
}
}
- void setUnreadCount(int unread) {
+ void setUnreadCount(size_t unread) {
unreadCount = unread;
}
void setStatusType(StatusShow::Type type) {
statusType = type;
}
@@ -91,11 +91,11 @@ namespace Swift {
std::string activity;
StatusShow::Type statusType;
bool isMUC;
std::string nick;
boost::optional<std::string> password;
- int unreadCount;
+ size_t unreadCount;
boost::filesystem::path avatarPath;
std::map<std::string, JID> impromptuJIDs;
std::map<JID, std::string> inviteesNames;
bool isPrivateMessage;
};
@@ -105,11 +105,11 @@ namespace Swift {
virtual void addMUCBookmark(const MUCBookmark& bookmark) = 0;
virtual void addWhiteboardSession(const ChatListWindow::Chat& chat) = 0;
virtual void removeWhiteboardSession(const JID& jid) = 0;
virtual void removeMUCBookmark(const MUCBookmark& bookmark) = 0;
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;
virtual void setOnline(bool isOnline) = 0;
boost::signals2::signal<void (const MUCBookmark&)> onMUCBookmarkActivated;
boost::signals2::signal<void (const Chat&)> onRecentActivated;
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,7 +1,7 @@
/*
- * Copyright (c) 2010-2017 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
@@ -31,10 +31,12 @@ namespace Swift {
class TabComplete;
class RosterItem;
class ContactRosterItem;
class FileTransferController;
class UserSearchWindow;
+ class DiscoInfo;
+ class ErrorPayload;
class ChatWindow {
public:
class ChatMessagePart {
@@ -137,11 +139,11 @@ namespace Swift {
enum AckState {Pending, Received, Failed};
enum ReceiptState {ReceiptRequested, ReceiptReceived, ReceiptFailed};
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 {
Initialisation, ///< Collecting information required for sending the request out.
WaitingForAccept, ///< The file transfer request was send out.
Negotiating, ///< The other party accepted the file transfer request and a suitable transfer method is negotiated.
Transferring, ///< The negotiation was successful and the file is currently transferred.
@@ -198,11 +200,11 @@ namespace Swift {
virtual void activate() = 0;
virtual void setAvailableSecurityLabels(const std::vector<SecurityLabelsCatalog::Item>& labels) = 0;
virtual void setSecurityLabelsEnabled(bool enabled) = 0;
virtual void setCorrectionEnabled(Tristate enabled) = 0;
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;
// virtual TreeWidget *getTreeWidget() = 0;
virtual void setSecurityLabelsError() = 0;
virtual SecurityLabelsCatalog::Item getSelectedSecurityLabel() = 0;
virtual void setOnline(bool online) = 0;
@@ -217,10 +219,13 @@ namespace Swift {
virtual void setBlockingState(BlockingState state) = 0;
virtual void setCanInitiateImpromptuChats(bool supportsImpromptu) = 0;
virtual void showBookmarkWindow(const MUCBookmark& bookmark) = 0;
virtual void setBookmarkState(RoomBookmarkState bookmarkState) = 0;
+ virtual void setChatSecurityMarking(const std::string& markingValue, const std::string& markingForegroundColorValue, const std::string& markingBackgroundColorValue) = 0;
+ virtual void removeChatSecurityMarking() = 0;
+
/**
* A handle that uniquely identities an alert message.
*/
typedef int AlertID;
/**
@@ -247,10 +252,11 @@ namespace Swift {
virtual void showRoomConfigurationForm(Form::ref) = 0;
boost::signals2::signal<void ()> onClosed;
boost::signals2::signal<void ()> onAllMessagesRead;
boost::signals2::signal<void (const std::string&, bool isCorrection)> onSendMessageRequest;
+ boost::signals2::signal<void (const std::string&)> onResendMessageRequest;
boost::signals2::signal<void ()> onSendCorrectionMessageRequest;
boost::signals2::signal<void ()> onUserTyping;
boost::signals2::signal<void ()> onUserCancelsTyping;
boost::signals2::signal<void ()> onAlertButtonClicked;
boost::signals2::signal<void (ContactRosterItem*)> onOccupantSelectionChanged;
@@ -280,6 +286,5 @@ namespace Swift {
// Blocking Command related
boost::signals2::signal<void ()> onBlockUserRequest;
boost::signals2::signal<void ()> onUnblockUserRequest;
};
}
-
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,7 +1,7 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
@@ -11,16 +11,16 @@
#include <boost/signals2.hpp>
#include <Swiften/Elements/DiscoItems.h>
#include <Swiften/Elements/StatusShow.h>
-#include <Swiften/JID/JID.h>
#include <Swiften/TLS/Certificate.h>
#include <Swift/Controllers/Roster/ContactRosterItem.h>
namespace Swift {
+ class JID;
class Roster;
class MainWindow {
public:
MainWindow(bool candelete = true) : canDelete_(candelete) {}
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,27 +1,23 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
-#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;
class MainWindowFactory {
public:
virtual ~MainWindowFactory() {}
/**
* Transfers ownership of result.
*/
- virtual MainWindow* createMainWindow(UIEventStream* eventStream) = 0;
+ virtual MainWindow* createMainWindow(Chattables&, UIEventStream*) = 0;
};
}
-#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,7 +1,7 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
@@ -10,10 +10,11 @@
#include <Swift/Controllers/UIInterfaces/BlockListEditorWidgetFactory.h>
#include <Swift/Controllers/UIInterfaces/ChatListWindowFactory.h>
#include <Swift/Controllers/UIInterfaces/ChatWindowFactory.h>
#include <Swift/Controllers/UIInterfaces/ContactEditWindowFactory.h>
#include <Swift/Controllers/UIInterfaces/EventWindowFactory.h>
+#include <Swift/Controllers/UIInterfaces/FdpFormSubmitWindowFactory.h>
#include <Swift/Controllers/UIInterfaces/FileTransferListWidgetFactory.h>
#include <Swift/Controllers/UIInterfaces/HighlightEditorWindowFactory.h>
#include <Swift/Controllers/UIInterfaces/HistoryWindowFactory.h>
#include <Swift/Controllers/UIInterfaces/JoinMUCWindowFactory.h>
#include <Swift/Controllers/UIInterfaces/LoginWindowFactory.h>
@@ -40,10 +41,11 @@ namespace Swift {
public ContactEditWindowFactory,
public AdHocCommandWindowFactory,
public FileTransferListWidgetFactory,
public WhiteboardWindowFactory,
public HighlightEditorWindowFactory,
- public BlockListEditorWidgetFactory {
+ public BlockListEditorWidgetFactory,
+ public FdpFormSubmitWindowFactory {
public:
virtual ~UIFactory() {}
};
}