|
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 class is for sms message center view |
|
15 * |
|
16 */ |
|
17 #include <hbaction.h> |
|
18 #include <hbgroupbox.h> |
|
19 #include <QGraphicsLinearLayout> |
|
20 |
|
21 #include "msgsmscenterview.h" |
|
22 #include "msgsmscentersettingsform.h" |
|
23 #include "debugtraces.h" |
|
24 |
|
25 #define LOC_NEW_SMS_CENTRE hbTrId("txt_messaging_title_new_sms_message_centre") |
|
26 #define LOC_EDIT_SMS_CENTRE hbTrId("txt_messaging_title_edit_sms_message_centre") |
|
27 |
|
28 MsgSMSCenterView::MsgSMSCenterView(int view, QGraphicsItem *parent) : |
|
29 MsgBaseView(parent) |
|
30 { |
|
31 // Create parent layout. |
|
32 QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical); |
|
33 mainLayout->setContentsMargins(0, 0, 0, 0); |
|
34 mainLayout->setSpacing(0); |
|
35 |
|
36 // Create view heading. |
|
37 HbGroupBox *viewHeading = new HbGroupBox(); |
|
38 if (view == -1) |
|
39 { |
|
40 viewHeading->setHeading(LOC_NEW_SMS_CENTRE); |
|
41 } |
|
42 else |
|
43 { |
|
44 viewHeading->setHeading(LOC_EDIT_SMS_CENTRE); |
|
45 } |
|
46 |
|
47 mSMSCenterSettingsForm = new MsgSMSCenterSettingsForm(view); |
|
48 |
|
49 HbAction* backAction = new HbAction(Hb::BackNaviAction, this); |
|
50 setNavigationAction(backAction); |
|
51 |
|
52 connect(mSMSCenterSettingsForm, |
|
53 SIGNAL(deleteMessageCentreAndClose()), |
|
54 this, |
|
55 SLOT(onCloseMessageCenterView())); |
|
56 |
|
57 connect(backAction, SIGNAL(triggered()), this, SLOT(onBackAction())); |
|
58 |
|
59 mainLayout->addItem(viewHeading); |
|
60 mainLayout->addItem(mSMSCenterSettingsForm); |
|
61 this->setLayout(mainLayout); |
|
62 } |
|
63 |
|
64 MsgSMSCenterView::~MsgSMSCenterView() |
|
65 { |
|
66 setParent(NULL); |
|
67 } |
|
68 |
|
69 void MsgSMSCenterView::onBackAction() |
|
70 { |
|
71 QDEBUG_WRITE("MsgSMSCenterView::onBackAction"); |
|
72 |
|
73 //commit the change |
|
74 mSMSCenterSettingsForm->commitChanges(); |
|
75 setNavigationAction(NULL); |
|
76 emit smsCenterEditViewClosed(); |
|
77 } |
|
78 |
|
79 void MsgSMSCenterView::onCloseMessageCenterView() |
|
80 { |
|
81 QDEBUG_WRITE("MsgSMSCenterView::onCloseMessageCenterView"); |
|
82 |
|
83 setNavigationAction(NULL); |
|
84 emit smsCenterEditViewClosed(); |
|
85 } |
|
86 |
|
87 //eof |