summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-05-19 18:12:23 (GMT)
committerSwift Review <review@swift.im>2014-05-29 18:31:43 (GMT)
commit6ce9e6bfa735ebeb577a308a1dd51a3424f5f0fe (patch)
treee8a5918f40fd3862da79546a1ee3d4cbd32217d4 /Swift/QtUI/QtChatWindow.cpp
parentb70a50f11da1ea57a0e89ff14882eed03944eb2a (diff)
downloadswift-contrib-6ce9e6bfa735ebeb577a308a1dd51a3424f5f0fe.zip
swift-contrib-6ce9e6bfa735ebeb577a308a1dd51a3424f5f0fe.tar.bz2
Check if contact supports file transfer before sending
Change-Id: Iadb580ad8b3f258d49b7c1b8713f0f92009e022e
Diffstat (limited to 'Swift/QtUI/QtChatWindow.cpp')
-rw-r--r--Swift/QtUI/QtChatWindow.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index f58c11b..f0d2038 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -61,18 +61,19 @@ QtChatWindow::QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventSt
settings_ = settings;
unreadCount_ = 0;
inputEnabled_ = true;
completer_ = NULL;
affiliationEditor_ = NULL;
theme_ = theme;
isCorrection_ = false;
labelModel_ = NULL;
correctionEnabled_ = Maybe;
+ fileTransferEnabled_ = Maybe;
updateTitleWithUnreadCount();
#ifdef SWIFT_EXPERIMENTAL_FT
setAcceptDrops(true);
#endif
alertStyleSheet_ = "background: rgb(255, 255, 153); color: black";
QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, this);
@@ -380,18 +381,22 @@ void QtChatWindow::setSecurityLabelsEnabled(bool enabled) {
} else {
labelsWidget_->hide();
}
}
void QtChatWindow::setCorrectionEnabled(Tristate enabled) {
correctionEnabled_ = enabled;
}
+void QtChatWindow::setFileTransferEnabled(Tristate enabled) {
+ fileTransferEnabled_ = enabled;
+}
+
SecurityLabelsCatalog::Item QtChatWindow::getSelectedSecurityLabel() {
assert(labelsWidget_->isEnabled());
assert(labelsWidget_->currentIndex() >= 0 && static_cast<size_t>(labelsWidget_->currentIndex()) < labelModel_->availableLabels_.size());
return labelModel_->availableLabels_[labelsWidget_->currentIndex()];
}
void QtChatWindow::closeEvent(QCloseEvent* event) {
event->accept();
emit windowClosing();
@@ -544,19 +549,19 @@ void QtChatWindow::dragEnterEvent(QDragEnterEvent *event) {
}
} else if (event->mimeData()->hasFormat("application/vnd.swift.contact-jid-list")) {
if (isMUC_ || supportsImpromptuChat_) {
event->acceptProposedAction();
}
}
}
void QtChatWindow::dropEvent(QDropEvent *event) {
- if (event->mimeData()->hasUrls()) {
+ if (fileTransferEnabled_ == ChatWindow::Yes && event->mimeData()->hasUrls()) {
if (event->mimeData()->urls().size() == 1) {
onSendFileRequest(Q2PSTRING(event->mimeData()->urls().at(0).toLocalFile()));
} else {
std::string messageText(Q2PSTRING(tr("Sending of multiple files at once isn't supported at this time.")));
ChatMessage message;
message.append(boost::make_shared<ChatTextMessagePart>(messageText));
addSystemMessage(message, DefaultDirection);
}
} else if (event->mimeData()->hasFormat("application/vnd.swift.contact-jid-list")) {