summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtAvatarWidget.cpp')
-rw-r--r--Swift/QtUI/QtAvatarWidget.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/Swift/QtUI/QtAvatarWidget.cpp b/Swift/QtUI/QtAvatarWidget.cpp
index f0bdf3c..fa08c27 100644
--- a/Swift/QtUI/QtAvatarWidget.cpp
+++ b/Swift/QtUI/QtAvatarWidget.cpp
@@ -1,8 +1,10 @@
/*
- * Copyright (c) 2011 Remko Tronçon
+ * Copyright (c) 2011-2014 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
+
+
#include "QtAvatarWidget.h"
@@ -20,8 +22,9 @@
#include <QtSwiftUtil.h>
+#include <Swiften/Base/Path.h>
namespace Swift {
-QtAvatarWidget::QtAvatarWidget(QWidget* parent) : QWidget(parent) {
+QtAvatarWidget::QtAvatarWidget(QWidget* parent) : QWidget(parent), editable(false) {
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setContentsMargins(0,0,0,0);
@@ -69,4 +72,7 @@ void QtAvatarWidget::setAvatar(const ByteArray& data, const std::string& type) {
void QtAvatarWidget::mousePressEvent(QMouseEvent* event) {
+ if (!editable) {
+ return;
+ }
QMenu menu;
@@ -82,5 +88,5 @@ void QtAvatarWidget::mousePressEvent(QMouseEvent* event) {
if (!fileName.isEmpty()) {
ByteArray data;
- readByteArrayFromFile(data, Q2PSTRING(fileName));
+ readByteArrayFromFile(data, stringToPath(Q2PSTRING(fileName)));
QBuffer buffer;