summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-02-10 19:25:21 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-02-15 12:31:10 (GMT)
commitca226e7bb019308db4bfc818d7e04422d9d28106 (patch)
tree9f7ef065f20db3e04eb08560674eed16d10e95e5 /Swift/QtUI/QtWebKitChatView.h
parent431eb62386101dc8fc1e7d346c49bd0d81fda70e (diff)
downloadswift-ca226e7bb019308db4bfc818d7e04422d9d28106.zip
swift-ca226e7bb019308db4bfc818d7e04422d9d28106.tar.bz2
Fix crash when saving a received file to non-writable location
WriteBytestream::write(…) now returns a boolean indicating its success state (false in case of an error). Adjusted FileWriteBytestream accordingly. The QtWebKitChatView will test if the file path selected by the user is writable before accepting it and starting the transfer. If it is not writable a red warning message will be added to the file-transfer element in the chat view. Test-Information: Added an integration test that tests the new behavior for the FileWriteBytestream class. Tested two file transfers on OS X 10.11.3, one to a write protected location and another to /tmp. The first is not accepted by the UI, and without the UI sanity check it results in a file-transfer error. The second succeeds as expected. Change-Id: I5aa0c617423073feb371365a23a294c149c88036
Diffstat (limited to 'Swift/QtUI/QtWebKitChatView.h')
-rw-r--r--Swift/QtUI/QtWebKitChatView.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Swift/QtUI/QtWebKitChatView.h b/Swift/QtUI/QtWebKitChatView.h
index 99375f7..173a05b 100644
--- a/Swift/QtUI/QtWebKitChatView.h
+++ b/Swift/QtUI/QtWebKitChatView.h
@@ -1,32 +1,32 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
#include <boost/shared_ptr.hpp>
#include <QList>
#include <QString>
#include <QWebElement>
#include <QWidget>
#include <Swiften/Base/Override.h>
#include <Swift/Controllers/UIInterfaces/ChatWindow.h>
#include <Swift/QtUI/ChatSnippet.h>
#include <Swift/QtUI/QtChatView.h>
class QWebPage;
class QUrl;
class QDate;
namespace Swift {
class QtWebView;
class QtChatTheme;
class QtChatWindowJSBridge;
class UIEventStream;
class QtChatWindow;
@@ -68,60 +68,62 @@ namespace Swift {
virtual std::string addFileTransfer(const std::string& senderName, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes, const std::string& description) SWIFTEN_OVERRIDE;
virtual void setFileTransferProgress(std::string, const int percentageDone) SWIFTEN_OVERRIDE;
virtual void setFileTransferStatus(std::string, const ChatWindow::FileTransferState state, const std::string& msg = "") SWIFTEN_OVERRIDE;
virtual void addMUCInvitation(const std::string& senderName, const JID& jid, const std::string& reason, const std::string& password, bool direct, bool isImpromptu, bool isContinuation) SWIFTEN_OVERRIDE;
virtual std::string addWhiteboardRequest(const QString& contact, bool senderIsSelf) SWIFTEN_OVERRIDE;
virtual void setWhiteboardSessionStatus(const std::string& id, const ChatWindow::WhiteboardSessionState state) SWIFTEN_OVERRIDE;
virtual void setMessageReceiptState(const std::string& id, ChatWindow::ReceiptState state) SWIFTEN_OVERRIDE;
virtual void showEmoticons(bool show) SWIFTEN_OVERRIDE;
void addMessageTop(boost::shared_ptr<ChatSnippet> snippet);
void addMessageBottom(boost::shared_ptr<ChatSnippet> snippet);
int getSnippetPositionByDate(const QDate& date); // FIXME : This probably shouldn't have been public
virtual void addLastSeenLine() SWIFTEN_OVERRIDE;
private: // previously public, now private
void replaceLastMessage(const QString& newMessage, const ChatWindow::TimestampBehaviour timestampBehaviour);
void replaceLastMessage(const QString& newMessage, const QString& note);
void replaceMessage(const QString& newMessage, const QString& id, const QDateTime& time);
void replaceSystemMessage(const QString& newMessage, const QString&id, const ChatWindow::TimestampBehaviour timestampBehaviour);
void rememberScrolledToBottom();
void setAckXML(const QString& id, const QString& xml);
void setReceiptXML(const QString& id, const QString& xml);
void displayReceiptInfo(const QString& id, bool showIt);
QString getLastSentMessage();
void addToJSEnvironment(const QString&, QObject*);
void setFileTransferProgress(QString id, const int percentageDone);
void setFileTransferStatus(QString id, const ChatWindow::FileTransferState state, const QString& msg);
+ void setFileTransferWarning(QString id, QString warningText);
+ void removeFileTransferWarning(QString id);
void setWhiteboardSessionStatus(QString id, const ChatWindow::WhiteboardSessionState state);
void setMUCInvitationJoined(QString id);
void askDesktopToOpenFile(const QString& filename);
signals:
void gotFocus();
void fontResized(int);
void logCleared();
void scrollRequested(int pos);
void scrollReachedTop();
void scrollReachedBottom();
public slots:
void copySelectionToClipboard();
void handleLinkClicked(const QUrl&);
void resetView();
void resetTopInsertPoint();
void increaseFontSize(int numSteps = 1);
void decreaseFontSize();
virtual void resizeFont(int fontSizeSteps) SWIFTEN_OVERRIDE;
virtual void scrollToBottom() SWIFTEN_OVERRIDE;
virtual void handleKeyPressEvent(QKeyEvent* event) SWIFTEN_OVERRIDE;
private slots:
void handleViewLoadFinished(bool);
void handleFrameSizeChanged();
void handleClearRequested();
void handleScrollRequested(int dx, int dy, const QRect& rectToScroll);
void handleHTMLButtonClicked(QString id, QString arg1, QString arg2, QString arg3, QString arg4, QString arg5);