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 #include "msgbaseview.h" |
|
22 |
|
23 #include <hbinstance.h> |
|
24 #include <hbaction.h> |
|
25 |
|
26 MsgSettingsViewManager::MsgSettingsViewManager(QObject* parent) : |
|
27 QObject(parent), mAdvancedSettingsView(NULL), |
|
28 mSMSCenterView(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 mBackAction = new HbAction(Hb::BackAction, this); |
|
59 mAdvancedSettingsView->setNavigationAction(mBackAction); |
|
60 //mBackAction = mainWindow->softKeyAction(Hb::SecondarySoftKey); |
|
61 |
|
62 connect(mBackAction, SIGNAL(triggered()), this, SLOT(closeAdvancedSettingsView())); |
|
63 |
|
64 connect(mAdvancedSettingsView, SIGNAL(newSMSCCenterClicked(int)), this, SLOT(openSmsCenterView(int))); |
|
65 } |
|
66 |
|
67 void MsgSettingsViewManager::closeAdvancedSettingsView() |
|
68 { |
|
69 disconnect(mBackAction, SIGNAL(triggered()), this, SLOT(closeAdvancedSettingsView())); |
|
70 |
|
71 mAdvancedSettingsView->commitEmailChanges(); |
|
72 |
|
73 HbMainWindow* mainWindow = hbInstance->allMainWindows().at(0); |
|
74 mainWindow->removeView(mAdvancedSettingsView); |
|
75 |
|
76 mAdvancedSettingsView->setParent(NULL); |
|
77 delete mAdvancedSettingsView; |
|
78 mAdvancedSettingsView = NULL; |
|
79 |
|
80 emit advancedSettingsViewClosed(); |
|
81 } |
|
82 |
|
83 void MsgSettingsViewManager::openSmsCenterView(int mode) |
|
84 { |
|
85 HbMainWindow* mainWindow = hbInstance->allMainWindows().at(0); |
|
86 mSMSCenterView = new MsgSMSCenterView(mode); |
|
87 mainWindow->addView(mSMSCenterView); |
|
88 mainWindow->setCurrentView(mSMSCenterView); |
|
89 mSMSCenterView->setNavigationAction(mBackAction); |
|
90 disconnect(mBackAction, SIGNAL(triggered()), this, SLOT(closeAdvancedSettingsView())); |
|
91 connect(mBackAction, SIGNAL(triggered()), this, SLOT(closeSMSCCenterView())); |
|
92 } |
|
93 |
|
94 void MsgSettingsViewManager::closeSMSCCenterView() |
|
95 { |
|
96 disconnect(mBackAction, SIGNAL(triggered()), this, SLOT(closeSMSCCenterView())); |
|
97 connect(mBackAction, SIGNAL(triggered()), this, SLOT(closeAdvancedSettingsView())); |
|
98 |
|
99 mSMSCenterView->commitChanges(); |
|
100 //mAdvancedSettingsView->refreshView(); |
|
101 |
|
102 HbMainWindow* mainWindow = hbInstance->allMainWindows().at(0); |
|
103 mainWindow->removeView(mSMSCenterView); |
|
104 |
|
105 mSMSCenterView->setParent(NULL); |
|
106 delete mSMSCenterView; |
|
107 mSMSCenterView = NULL; |
|
108 } |
|