[kde-doc-english] [trojita] src/Gui: GUI: propagate signals from nested envelopes to the topmost MessageView
Jan Kundrát
jkt at flaska.net
Fri May 24 15:35:37 UTC 2013
Git commit 82711287d2338b5e200a2cd59996de4a61fd6b04 by Jan Kundrát.
Committed on 24/05/2013 at 13:42.
Pushed by jkt into branch 'master'.
GUI: propagate signals from nested envelopes to the topmost MessageView
M +6 -0 src/Gui/EnvelopeView.cpp
M +4 -0 src/Gui/EnvelopeView.h
M +2 -2 src/Gui/MessageView.cpp
M +2 -0 src/Gui/PartWidget.cpp
M +8 -2 src/Gui/PartWidgetFactory.cpp
M +6 -1 src/Gui/PartWidgetFactory.h
http://commits.kde.org/trojita/82711287d2338b5e200a2cd59996de4a61fd6b04
diff --git a/src/Gui/EnvelopeView.cpp b/src/Gui/EnvelopeView.cpp
index 4322deb..c88ac82 100644
--- a/src/Gui/EnvelopeView.cpp
+++ b/src/Gui/EnvelopeView.cpp
@@ -26,6 +26,7 @@
#else
# include <QUrlQuery>
#endif
+#include "MessageView.h"
#include "Imap/Model/ItemRoles.h"
#include "Imap/Model/MailboxTree.h"
#include "Imap/Model/Model.h"
@@ -136,4 +137,9 @@ void EnvelopeView::onLinkHovered(const QString &target)
#endif
}
+void EnvelopeView::connectWithMessageView(MessageView *messageView)
+{
+ connect(this, SIGNAL(linkActivated(QString)), messageView, SLOT(headerLinkActivated(QString)));
+}
+
}
diff --git a/src/Gui/EnvelopeView.h b/src/Gui/EnvelopeView.h
index 699825b..142eb81 100644
--- a/src/Gui/EnvelopeView.h
+++ b/src/Gui/EnvelopeView.h
@@ -27,6 +27,8 @@
namespace Gui {
+class MessageView;
+
/** @short Widget displaying the message envelope */
class EnvelopeView : public QLabel
{
@@ -36,6 +38,8 @@ public:
void setMessage(const QModelIndex &index);
+ void connectWithMessageView(MessageView *messageView);
+
private slots:
void onLinkHovered(const QString &target);
diff --git a/src/Gui/MessageView.cpp b/src/Gui/MessageView.cpp
index 5e827f9..4383bc8 100644
--- a/src/Gui/MessageView.cpp
+++ b/src/Gui/MessageView.cpp
@@ -63,7 +63,7 @@ MessageView::MessageView(QWidget *parent): QWidget(parent)
setFocusPolicy(Qt::StrongFocus); // not by the wheel
netAccess = new Imap::Network::MsgPartNetAccessManager(this);
connect(netAccess, SIGNAL(requestingExternal(QUrl)), this, SLOT(externalsRequested(QUrl)));
- factory = new PartWidgetFactory(netAccess, this, this);
+ factory = new PartWidgetFactory(netAccess, this, this, this);
emptyView = new EmbeddedWebView(this, new QNetworkAccessManager(this));
emptyView->setFixedSize(450,300);
@@ -90,7 +90,7 @@ MessageView::MessageView(QWidget *parent): QWidget(parent)
// the actual mail header
m_envelope = new EnvelopeView(headerSection);
- connect(m_envelope, SIGNAL(linkActivated(QString)), this, SLOT(headerLinkActivated(QString)));
+ m_envelope->connectWithMessageView(this);
// the tag bar
tags = new TagListWidget(headerSection);
diff --git a/src/Gui/PartWidget.cpp b/src/Gui/PartWidget.cpp
index f1d88ed..523fd97 100644
--- a/src/Gui/PartWidget.cpp
+++ b/src/Gui/PartWidget.cpp
@@ -27,6 +27,7 @@
#include <QTabBar>
#include "EnvelopeView.h"
+#include "MessageView.h"
#include "PartWidgetFactory.h"
#include "Imap/Model/ItemRoles.h"
#include "Imap/Model/MailboxTree.h"
@@ -175,6 +176,7 @@ Message822Widget::Message822Widget(QWidget *parent,
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setSpacing(0);
EnvelopeView *envelope = new EnvelopeView(0);
+ envelope->connectWithMessageView(factory->messageView());
envelope->setMessage(partIndex);
layout->addWidget(envelope);
for (int i = 0; i < partIndex.model()->rowCount(partIndex); ++i) {
diff --git a/src/Gui/PartWidgetFactory.cpp b/src/Gui/PartWidgetFactory.cpp
index e21f241..42498bc 100644
--- a/src/Gui/PartWidgetFactory.cpp
+++ b/src/Gui/PartWidgetFactory.cpp
@@ -41,8 +41,9 @@
namespace Gui
{
-PartWidgetFactory::PartWidgetFactory(Imap::Network::MsgPartNetAccessManager *manager, QObject *wheelEventFilter, QObject *guiInteractionTarget):
- manager(manager), wheelEventFilter(wheelEventFilter), guiInteractionTarget(guiInteractionTarget)
+PartWidgetFactory::PartWidgetFactory(Imap::Network::MsgPartNetAccessManager *manager, QObject *wheelEventFilter,
+ QObject *guiInteractionTarget, MessageView *messageView):
+ manager(manager), wheelEventFilter(wheelEventFilter), guiInteractionTarget(guiInteractionTarget), m_messageView(messageView)
{
}
@@ -173,4 +174,9 @@ QWidget *PartWidgetFactory::create(const QModelIndex &partIndex, int recursionDe
return lbl;
}
+MessageView *PartWidgetFactory::messageView() const
+{
+ return m_messageView;
+}
+
}
diff --git a/src/Gui/PartWidgetFactory.h b/src/Gui/PartWidgetFactory.h
index 85ef633..de20cb0 100644
--- a/src/Gui/PartWidgetFactory.h
+++ b/src/Gui/PartWidgetFactory.h
@@ -31,6 +31,8 @@ class QModelIndex;
namespace Gui
{
+class MessageView;
+
class PartWidgetFactory
{
Q_DECLARE_TR_FUNCTIONS(PartWidgetFactory)
@@ -42,13 +44,16 @@ public:
LOAD_ON_SHOW /**< @short Load the parts only after they have been shown to the user */
} PartLoadingMode;
- PartWidgetFactory(Imap::Network::MsgPartNetAccessManager *manager, QObject *wheelEventFilter, QObject *guiInteractionTarget);
+ PartWidgetFactory(Imap::Network::MsgPartNetAccessManager *manager, QObject *wheelEventFilter, QObject *guiInteractionTarget,
+ MessageView *messageView);
QWidget *create(const QModelIndex &partIndex);
QWidget *create(const QModelIndex &partIndex, int recursionDepth, const PartLoadingMode loadingMode = LOAD_IMMEDIATELY);
+ MessageView *messageView() const;
private:
Imap::Network::MsgPartNetAccessManager *manager;
QObject *wheelEventFilter;
QObject *guiInteractionTarget;
+ MessageView *m_messageView;
PartWidgetFactory(const PartWidgetFactory &); // don't implement
PartWidgetFactory &operator=(const PartWidgetFactory &); // don't implement
More information about the kde-doc-english
mailing list