From dbd57ffd259b9dba6990de0b02b450fa2a59a563 Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Fri, 29 Jul 2016 16:46:41 +0200
Subject: Fix notice sometimes showing empty popup dialog on activation

Test-Information:

Tried editing a contact on a server prohibiting contact
editing. Previously the first double-click on the notice
showed an empty popup. Now the correct popup text is shown.

Change-Id: I996cf5b654e866ec6dd3f5198b694ae564018695

diff --git a/Swift/QtUI/EventViewer/QtEventWindow.cpp b/Swift/QtUI/EventViewer/QtEventWindow.cpp
index e77699b..c8d1f0c 100644
--- a/Swift/QtUI/EventViewer/QtEventWindow.cpp
+++ b/Swift/QtUI/EventViewer/QtEventWindow.cpp
@@ -9,12 +9,13 @@
 #include <QBoxLayout>
 #include <QMessageBox>
 #include <QPushButton>
-#include <QtDebug>
+#include <QTreeView>
 
 #include <Swiften/Base/Platform.h>
 
 #include <Swift/Controllers/UIEvents/JoinMUCUIEvent.h>
 #include <Swift/Controllers/UIEvents/RequestChatUIEvent.h>
+#include <Swift/Controllers/UIEvents/UIEventStream.h>
 #include <Swift/Controllers/XMPPEvents/ErrorEvent.h>
 #include <Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h>
 #include <Swift/Controllers/XMPPEvents/MUCInviteEvent.h>
@@ -99,7 +100,7 @@ void QtEventWindow::handleItemActivated(const QModelIndex& item) {
             errorEvent->conclude();
         }
         QMessageBox msgBox;
-        msgBox.setText(model_->data(item, Qt::DisplayRole).toString());
+        msgBox.setText(event->data(Qt::DisplayRole).toString());
         msgBox.exec();
     }
 
diff --git a/Swift/QtUI/EventViewer/QtEventWindow.h b/Swift/QtUI/EventViewer/QtEventWindow.h
index bad20e4..7ae33ec 100644
--- a/Swift/QtUI/EventViewer/QtEventWindow.h
+++ b/Swift/QtUI/EventViewer/QtEventWindow.h
@@ -8,9 +8,6 @@
 
 #include <memory>
 
-#include <QTreeView>
-
-#include <Swift/Controllers/UIEvents/UIEventStream.h>
 #include <Swift/Controllers/UIInterfaces/EventWindow.h>
 
 #include <Swift/QtUI/EventViewer/EventDelegate.h>
@@ -18,8 +15,11 @@
 #include <Swift/QtUI/EventViewer/EventView.h>
 
 class QPushButton;
+class QTreeView;
 
 namespace Swift {
+    class UIEventStream;
+
     class QtEventWindow : public QWidget, public EventWindow {
         Q_OBJECT
         public:
@@ -27,12 +27,15 @@ namespace Swift {
             ~QtEventWindow();
             void addEvent(std::shared_ptr<StanzaEvent> event, bool active);
             void removeEvent(std::shared_ptr<StanzaEvent> event);
+
         signals:
             void onNewEventCountUpdated(int count);
+
         private slots:
             void handleItemActivated(const QModelIndex& item);
             void handleItemClicked(const QModelIndex& item);
             void handleReadClicked();
+
         private:
             EventModel* model_;
             EventDelegate* delegate_;
-- 
cgit v0.10.2-6-g49f6