23 // USER INCLUDES |
23 // USER INCLUDES |
24 #include "msgaudiofetcherview.h" |
24 #include "msgaudiofetcherview.h" |
25 #include "msgaudiofetcherwidget.h" |
25 #include "msgaudiofetcherwidget.h" |
26 #include "convergedmessage.h" |
26 #include "convergedmessage.h" |
27 |
27 |
28 MsgAudioFetcherView::MsgAudioFetcherView() |
28 MsgAudioFetcherView::MsgAudioFetcherView(const QVariantList& data) : |
|
29 message(NULL) |
29 { |
30 { |
|
31 message = new ConvergedMessage; |
|
32 if(data.length() > 0) |
|
33 { |
|
34 QByteArray dataArray = data.at(0).toByteArray(); |
|
35 QDataStream stream(&dataArray, QIODevice::ReadOnly); |
|
36 message->deserialize(stream); |
|
37 } |
30 initToolBar(); |
38 initToolBar(); |
31 initMainWidget(); |
39 initMainWidget(); |
32 QMetaObject::connectSlotsByName(this); |
40 QMetaObject::connectSlotsByName(this); |
33 } |
41 } |
34 |
42 |
35 MsgAudioFetcherView::~MsgAudioFetcherView() |
43 MsgAudioFetcherView::~MsgAudioFetcherView() |
36 { |
44 { |
|
45 if(message != NULL) |
|
46 { |
|
47 delete message; |
|
48 message = NULL; |
|
49 } |
37 removeToolBarAction(); |
50 removeToolBarAction(); |
38 } |
51 } |
39 |
52 |
40 void MsgAudioFetcherView::initMainWidget() |
53 void MsgAudioFetcherView::initMainWidget() |
41 { |
54 { |
82 QVariantList params; |
95 QVariantList params; |
83 QByteArray dataArray; |
96 QByteArray dataArray; |
84 QDataStream messageStream |
97 QDataStream messageStream |
85 (&dataArray, QIODevice::WriteOnly | QIODevice::Append); |
98 (&dataArray, QIODevice::WriteOnly | QIODevice::Append); |
86 |
99 |
87 ConvergedMessage message; |
|
88 QString filepath(mWidget->getCurrentItemPath()); |
100 QString filepath(mWidget->getCurrentItemPath()); |
89 ConvergedMessageAttachment* attachment = |
101 ConvergedMessageAttachment* attachment = |
90 new ConvergedMessageAttachment(filepath); |
102 new ConvergedMessageAttachment(filepath); |
91 ConvergedMessageAttachmentList attachmentList; |
103 ConvergedMessageAttachmentList attachmentList; |
92 attachmentList.append(attachment); |
104 attachmentList.append(attachment); |
93 message.addAttachments(attachmentList); |
105 message->addAttachments(attachmentList); |
94 |
106 |
95 message.serialize(messageStream); |
107 message->serialize(messageStream); |
96 params << MsgBaseView::UNIEDITOR; |
108 params << MsgBaseView::UNIEDITOR; |
97 params << MsgBaseView::AUDIOFETCHER; |
109 params << MsgBaseView::AUDIOFETCHER; |
98 params << dataArray; |
110 params << dataArray; |
99 params << MsgBaseView::ADD_AUDIO; |
111 params << MsgBaseView::ADD_AUDIO; |
100 emit switchView(params); |
112 emit switchView(params); |