37 mInboxListModel(NULL), |
37 mInboxListModel(NULL), |
38 mMessageListModel(NULL), |
38 mMessageListModel(NULL), |
39 mMessageSearchListModel(NULL), |
39 mMessageSearchListModel(NULL), |
40 mSendOperation(NULL), |
40 mSendOperation(NULL), |
41 mRemoveDraftOperation(NULL), |
41 mRemoveDraftOperation(NULL), |
42 mSaveDraftOperation(NULL) |
42 mSaveDraftOperation(NULL), |
|
43 mDraftMessage(NULL) |
43 { |
44 { |
44 NM_FUNCTION; |
45 NM_FUNCTION; |
45 |
46 |
46 mPluginFactory = NmDataPluginFactory::instance(); |
47 mPluginFactory = NmDataPluginFactory::instance(); |
47 mDataManager = new NmDataManager(); |
48 mDataManager = new NmDataManager(); |
85 */ |
86 */ |
86 NmUiEngine::~NmUiEngine() |
87 NmUiEngine::~NmUiEngine() |
87 { |
88 { |
88 NM_FUNCTION; |
89 NM_FUNCTION; |
89 |
90 |
|
91 HbIndicator indicator; |
|
92 indicator.deactivate(syncIndicatorName, QVariant()); |
|
93 |
90 if (mMessageSearchListModel) { |
94 if (mMessageSearchListModel) { |
91 delete mMessageSearchListModel; |
95 delete mMessageSearchListModel; |
92 mMessageSearchListModel = NULL; |
96 mMessageSearchListModel = NULL; |
93 } |
97 } |
94 if (mInboxListModel) { |
98 if (mInboxListModel) { |
122 if(mRemoveDraftOperation && mRemoveDraftOperation->isRunning()) { |
126 if(mRemoveDraftOperation && mRemoveDraftOperation->isRunning()) { |
123 mRemoveDraftOperation->cancelOperation(); |
127 mRemoveDraftOperation->cancelOperation(); |
124 } |
128 } |
125 if(mSaveDraftOperation && mSaveDraftOperation->isRunning()) { |
129 if(mSaveDraftOperation && mSaveDraftOperation->isRunning()) { |
126 mSaveDraftOperation->cancelOperation(); |
130 mSaveDraftOperation->cancelOperation(); |
|
131 } |
|
132 if(mDraftMessage) { |
|
133 delete mDraftMessage; |
|
134 mDraftMessage = NULL; |
127 } |
135 } |
128 } |
136 } |
129 |
137 |
130 /*! |
138 /*! |
131 |
139 |
785 // to be on the safer side: |
793 // to be on the safer side: |
786 // we shouldn't even be here if mSaveDraftOperation != NULL |
794 // we shouldn't even be here if mSaveDraftOperation != NULL |
787 if (mSaveDraftOperation && mSaveDraftOperation->isRunning()) { |
795 if (mSaveDraftOperation && mSaveDraftOperation->isRunning()) { |
788 mSaveDraftOperation->cancelOperation(); |
796 mSaveDraftOperation->cancelOperation(); |
789 } |
797 } |
790 // ownership of message changes |
798 |
791 mSaveDraftOperation = plugin->saveMessageWithSubparts(*message); |
799 mSaveDraftOperation = plugin->saveMessageWithSubparts(*message); |
792 // don't put this to mOperations as we need to handle this |
800 |
793 // operation separately |
|
794 if (mSaveDraftOperation) { |
801 if (mSaveDraftOperation) { |
|
802 // Ownership of message changes but saveMessageWithSubparts operation only makes a |
|
803 // copy so we handle the msg object deletion in engine. mDraftMessage is deleted |
|
804 // in handleCompletedSaveDraftOperation once operation finishes. |
|
805 if(mDraftMessage) { |
|
806 delete mDraftMessage; |
|
807 mDraftMessage = NULL; |
|
808 } |
|
809 mDraftMessage = message; |
|
810 message = NULL; |
|
811 |
795 for (int i(0); i < preliminaryOperations.count(); i++ ) { |
812 for (int i(0); i < preliminaryOperations.count(); i++ ) { |
796 QPointer<NmOperation> op = preliminaryOperations[i]; |
813 QPointer<NmOperation> op = preliminaryOperations[i]; |
797 mSaveDraftOperation->addPreliminaryOperation(op); |
814 mSaveDraftOperation->addPreliminaryOperation(op); |
798 } |
815 } |
799 |
816 |
800 connect(mSaveDraftOperation, |
817 connect(mSaveDraftOperation, |
801 SIGNAL(operationCompleted(int)), |
818 SIGNAL(operationCompleted(int)), |
802 this, |
819 this, |
803 SLOT(handleCompletedSaveDraftOperation())); |
820 SLOT(handleCompletedSaveDraftOperation())); |
804 |
821 |
805 // message object is not needed any more, so delete it |
|
806 delete message; |
|
807 message = NULL; |
|
808 } |
822 } |
809 } |
823 } |
810 } |
824 } |
811 } |
825 } |
812 |
826 |