1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description:This is the manager class for managing multiple views |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "msgsettingsviewmanager.h" |
|
19 #include "msgadvancedsettingsview.h" |
|
20 #include "msgsmscenterview.h" |
|
21 |
|
22 #include <hbinstance.h> |
|
23 #include <hbaction.h> |
|
24 |
|
25 MsgSettingsViewManager::MsgSettingsViewManager(QObject* parent) : |
|
26 QObject(parent), mAdvancedSettingsView(NULL), |
|
27 mSMSCenterView(NULL), |
|
28 mMessageCenterView(NULL), |
|
29 mBackAction(NULL) |
|
30 { |
|
31 //do nothing |
|
32 } |
|
33 |
|
34 MsgSettingsViewManager::~MsgSettingsViewManager() |
|
35 { |
|
36 if (mAdvancedSettingsView) |
|
37 { |
|
38 mAdvancedSettingsView->setParent(NULL); |
|
39 delete mAdvancedSettingsView; |
|
40 } |
|
41 |
|
42 if (mSMSCenterView) |
|
43 { |
|
44 mSMSCenterView->setParent(NULL); |
|
45 delete mSMSCenterView; |
|
46 } |
|
47 } |
|
48 |
|
49 void MsgSettingsViewManager::openAdvancedView() |
|
50 { |
|
51 mAdvancedSettingsView = new MsgAdvancedSettingsView(); |
|
52 |
|
53 HbMainWindow* mainWindow = hbInstance->allMainWindows().at(0); |
|
54 |
|
55 mainWindow->addView(mAdvancedSettingsView); |
|
56 mainWindow->setCurrentView(mAdvancedSettingsView); |
|
57 |
|
58 //take back action from controlpanel main window. |
|
59 mBackAction = mainWindow->softKeyAction(Hb::SecondarySoftKey); |
|
60 |
|
61 connect(mBackAction, SIGNAL(triggered()), this, SLOT(closeAdvancedSettingsView())); |
|
62 |
|
63 connect(mAdvancedSettingsView, SIGNAL(newSMSCCenterClicked(int)), this, SLOT(openSmsCenterView(int))); |
|
64 } |
|
65 |
|
66 void MsgSettingsViewManager::closeAdvancedSettingsView() |
|
67 { |
|
68 disconnect(mBackAction, SIGNAL(triggered()), this, SLOT(closeAdvancedSettingsView())); |
|
69 |
|
70 mAdvancedSettingsView->commitEmailChanges(); |
|
71 |
|
72 HbMainWindow* mainWindow = hbInstance->allMainWindows().at(0); |
|
73 mainWindow->removeView(mAdvancedSettingsView); |
|
74 |
|
75 mAdvancedSettingsView->setParent(NULL); |
|
76 delete mAdvancedSettingsView; |
|
77 mAdvancedSettingsView = NULL; |
|
78 } |
|
79 |
|
80 void MsgSettingsViewManager::openSmsCenterView(int mode) |
|
81 { |
|
82 HbMainWindow* mainWindow = hbInstance->allMainWindows().at(0); |
|
83 mSMSCenterView = new MsgSMSCenterView(mode); |
|
84 mainWindow->addView(mSMSCenterView); |
|
85 mainWindow->setCurrentView(mSMSCenterView); |
|
86 |
|
87 //take back action from controlpanel main window. |
|
88 mBackAction2 = mainWindow->softKeyAction(Hb::SecondarySoftKey); |
|
89 |
|
90 connect(mBackAction2, SIGNAL(triggered()), this, SLOT(closeSMSCCenterView())); |
|
91 } |
|
92 |
|
93 void MsgSettingsViewManager::closeSMSCCenterView() |
|
94 { |
|
95 disconnect(mBackAction2, SIGNAL(triggered()), this, SLOT(closeSMSCCenterView())); |
|
96 |
|
97 mSMSCenterView->commitChanges(); |
|
98 mAdvancedSettingsView->refreshView(); |
|
99 |
|
100 HbMainWindow* mainWindow = hbInstance->allMainWindows().at(0); |
|
101 mainWindow->removeView(mSMSCenterView); |
|
102 |
|
103 mSMSCenterView->setParent(NULL); |
|
104 delete mSMSCenterView; |
|
105 mSMSCenterView = NULL; |
|
106 } |
|