21 Constructor |
21 Constructor |
22 */ |
22 */ |
23 NmMailViewerWK::NmMailViewerWK() |
23 NmMailViewerWK::NmMailViewerWK() |
24 :QGraphicsWebView() |
24 :QGraphicsWebView() |
25 { |
25 { |
|
26 NM_FUNCTION; |
26 } |
27 } |
27 |
28 |
28 /*! |
29 /*! |
29 Destructor |
30 Destructor |
30 */ |
31 */ |
31 NmMailViewerWK::~NmMailViewerWK() |
32 NmMailViewerWK::~NmMailViewerWK() |
32 { |
33 { |
|
34 NM_FUNCTION; |
|
35 |
33 mContent.clear(); |
36 mContent.clear(); |
34 } |
37 } |
35 |
38 |
36 /*! |
39 /*! |
37 |
40 |
38 */ |
41 */ |
39 void NmMailViewerWK::setParentView(NmViewerView *parentView) |
42 void NmMailViewerWK::setParentView(NmViewerView *parentView) |
40 { |
43 { |
|
44 NM_FUNCTION; |
|
45 |
41 mParentView = parentView; |
46 mParentView = parentView; |
42 } |
47 } |
43 |
48 |
44 /*! |
49 /*! |
45 addContent. Function adds content into web view. |
50 addContent. Function adds content into web view. |
46 */ |
51 */ |
47 void NmMailViewerWK::addContent(QString key, QVariant val) { |
52 void NmMailViewerWK::addContent(QString key, QVariant val, NmId partId, bool isFetched) |
48 mContent[key] = val; |
53 { |
|
54 NM_FUNCTION; |
|
55 |
|
56 mContent[key] = NmMailViewerWkContentItem(val, partId, isFetched); |
49 } |
57 } |
50 |
58 |
51 /*! |
59 /*! |
52 loadResource. Function returns resource from added content (added with addContent) |
60 loadResource. Function returns resource from added content (added with addContent) |
53 */ |
61 */ |
54 QVariant NmMailViewerWK::loadResource(int type, const QUrl &name) |
62 QVariant NmMailViewerWK::loadResource(int type, const QUrl &name, NmId &partId, bool &isFetched) |
55 { |
63 { |
|
64 NM_FUNCTION; |
|
65 |
56 if (type == QTextDocument::ImageResource) { |
66 if (type == QTextDocument::ImageResource) { |
57 QString key = '<' + name.path() + '>'; |
67 QString key = '<' + name.path() + '>'; |
58 if (!mContent.contains(key)) { |
68 if (!mContent.contains(key)) { |
59 key = name.path(); |
69 key = name.path(); |
60 } |
70 } |
61 if (mContent.contains(key)) { |
71 if (mContent.contains(key)) { |
62 return mContent[key]; |
72 partId = mContent[key].mPartId; |
|
73 isFetched = mContent[key].mIsFetched; |
|
74 return mContent[key].mData; |
63 } |
75 } |
64 return 0; |
76 return 0; |
65 } |
77 } |
66 return 0; |
78 return 0; |
67 } |
79 } |
69 /*! |
81 /*! |
70 sendMousePressEvent. Function is used to relay mouse event to base class |
82 sendMousePressEvent. Function is used to relay mouse event to base class |
71 */ |
83 */ |
72 void NmMailViewerWK::sendMousePressEvent(QGraphicsSceneMouseEvent *event) |
84 void NmMailViewerWK::sendMousePressEvent(QGraphicsSceneMouseEvent *event) |
73 { |
85 { |
|
86 NM_FUNCTION; |
|
87 |
74 if (event){ |
88 if (event){ |
75 QGraphicsWebView::mousePressEvent(event); |
89 QGraphicsWebView::mousePressEvent(event); |
76 } |
90 } |
77 } |
91 } |
78 |
92 |
79 /*! |
93 /*! |
80 sendMouseReleaseEvent. Function is used to relay mouse event to base class |
94 sendMouseReleaseEvent. Function is used to relay mouse event to base class |
81 */ |
95 */ |
82 void NmMailViewerWK::sendMouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
96 void NmMailViewerWK::sendMouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
83 { |
97 { |
|
98 NM_FUNCTION; |
|
99 |
84 if (event) { |
100 if (event) { |
85 QGraphicsWebView::mouseReleaseEvent(event); |
101 QGraphicsWebView::mouseReleaseEvent(event); |
86 } |
102 } |
87 } |
103 } |
88 |
104 |