author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 09:45:25 +0300 | |
changeset 52 | 12db4185673b |
parent 31 | ebfee66fde93 |
child 70 | a15d9966050f |
permissions | -rw-r--r-- |
31 | 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 first view for msgsettings plugin |
|
15 |
* |
|
16 |
*/ |
|
17 |
#include <hbmainwindow.h> |
|
18 |
#include <hbgroupbox.h> |
|
19 |
#include <QGraphicsLinearLayout> |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
20 |
#include <HbAction> |
31 | 21 |
|
22 |
#include "msgsettingsview.h" |
|
23 |
#include "msgsettingsform.h" |
|
24 |
#include "msgsmscenterview.h" |
|
25 |
#include "debugtraces.h" |
|
26 |
||
27 |
//LOCALAIZED CONSTANTS |
|
28 |
#define LOC_MESSAGE_SETTINGS_HEADING hbTrId("txt_messaging_title_messaging_settings") |
|
29 |
||
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
30 |
MsgSettingsView::MsgSettingsView(SettingsView settingsView,QGraphicsItem *parent): |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
31 |
MsgBaseView(parent), |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
32 |
mSMSCenterView(0), |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
33 |
mSettingsForm(0), |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
34 |
mCurrentView(settingsView) |
31 | 35 |
{ |
36 |
mMainWindow = this->mainWindow(); |
|
37 |
||
38 |
// Create parent layout. |
|
39 |
QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical); |
|
40 |
mainLayout->setContentsMargins(0, 0, 0, 0); |
|
41 |
mainLayout->setSpacing(0); |
|
42 |
||
43 |
// Create view heading. |
|
44 |
HbGroupBox *viewHeading = new HbGroupBox(); |
|
45 |
viewHeading->setHeading(LOC_MESSAGE_SETTINGS_HEADING); |
|
46 |
||
47 |
mSettingsForm = new MsgSettingsForm(settingsView); |
|
48 |
||
49 |
connect(mSettingsForm, |
|
50 |
SIGNAL(newSMSCCenterClicked(int)), |
|
51 |
this, |
|
52 |
SLOT(onNewSMSCCenterClicked(int))); |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
53 |
|
31 | 54 |
|
55 |
mainLayout->addItem(viewHeading); |
|
56 |
mainLayout->addItem(mSettingsForm); |
|
57 |
||
58 |
this->setLayout(mainLayout); |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
59 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
60 |
//sms settings need to be created so launch MsgSMSCenterView in edit mode. |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
61 |
if(settingsView == SMSView) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
62 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
63 |
onNewSMSCCenterClicked(-1); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
64 |
} |
31 | 65 |
} |
66 |
||
67 |
MsgSettingsView::~MsgSettingsView() |
|
68 |
{ |
|
69 |
delete mSMSCenterView; |
|
70 |
} |
|
71 |
||
72 |
void MsgSettingsView::onNewSMSCCenterClicked(int index) |
|
73 |
{ |
|
74 |
//open the sms center views |
|
75 |
if (mSMSCenterView) |
|
76 |
{ |
|
77 |
delete mSMSCenterView; |
|
78 |
mSMSCenterView = NULL; |
|
79 |
} |
|
80 |
||
81 |
mSMSCenterView = new MsgSMSCenterView(index); |
|
82 |
||
83 |
connect(mSMSCenterView, |
|
84 |
SIGNAL(smsCenterEditViewClosed()), |
|
85 |
this, |
|
86 |
SLOT(onSmsCenterEditViewClosed())); |
|
87 |
||
88 |
mMainWindow->addView(mSMSCenterView); |
|
89 |
mMainWindow->setCurrentView(mSMSCenterView); |
|
90 |
} |
|
91 |
||
92 |
void MsgSettingsView::onSmsCenterEditViewClosed() |
|
93 |
{ |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
94 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
95 |
//sms center view was directly launched, no need to go back to settings view. |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
96 |
if(mCurrentView == SMSView) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
97 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
98 |
this->navigationAction()->trigger(); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
99 |
return; |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
100 |
} |
31 | 101 |
//remove the view |
102 |
mMainWindow->removeView(mSMSCenterView); |
|
52
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
103 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
104 |
// This check is needed in case when smsc center view is |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
105 |
// launched directly |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
106 |
if(mMainWindow->views().count() > 0) |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
107 |
{ |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
108 |
QCRITICAL_WRITE("MsgViewManager::onSmsCenterEditViewClosed count>0"); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
109 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
110 |
//refresh the form |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
111 |
mSettingsForm->refreshViewForm(); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
112 |
|
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
113 |
//add the current view on top |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
114 |
mMainWindow->setCurrentView(this); |
12db4185673b
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
115 |
} |
31 | 116 |
} |
117 |
||
118 |
//eof |
|
119 |