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>
|
|
20 |
|
|
21 |
#include "msgsettingsview.h"
|
|
22 |
#include "msgsettingsform.h"
|
|
23 |
#include "msgsmscenterview.h"
|
|
24 |
#include "debugtraces.h"
|
|
25 |
|
|
26 |
//LOCALAIZED CONSTANTS
|
|
27 |
#define LOC_MESSAGE_SETTINGS_HEADING hbTrId("txt_messaging_title_messaging_settings")
|
|
28 |
|
|
29 |
MsgSettingsView::MsgSettingsView(SettingsView settingsView,
|
|
30 |
QGraphicsItem *parent) :
|
|
31 |
MsgBaseView(parent), mSMSCenterView(0), mSettingsForm(0)
|
|
32 |
{
|
|
33 |
mMainWindow = this->mainWindow();
|
|
34 |
|
|
35 |
// Create parent layout.
|
|
36 |
QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
|
|
37 |
mainLayout->setContentsMargins(0, 0, 0, 0);
|
|
38 |
mainLayout->setSpacing(0);
|
|
39 |
|
|
40 |
// Create view heading.
|
|
41 |
HbGroupBox *viewHeading = new HbGroupBox();
|
|
42 |
viewHeading->setHeading(LOC_MESSAGE_SETTINGS_HEADING);
|
|
43 |
|
|
44 |
mSettingsForm = new MsgSettingsForm(settingsView);
|
|
45 |
|
|
46 |
connect(mSettingsForm,
|
|
47 |
SIGNAL(newSMSCCenterClicked(int)),
|
|
48 |
this,
|
|
49 |
SLOT(onNewSMSCCenterClicked(int)));
|
|
50 |
|
|
51 |
mainLayout->addItem(viewHeading);
|
|
52 |
mainLayout->addItem(mSettingsForm);
|
|
53 |
|
|
54 |
this->setLayout(mainLayout);
|
|
55 |
}
|
|
56 |
|
|
57 |
MsgSettingsView::~MsgSettingsView()
|
|
58 |
{
|
|
59 |
delete mSMSCenterView;
|
|
60 |
}
|
|
61 |
|
|
62 |
void MsgSettingsView::onNewSMSCCenterClicked(int index)
|
|
63 |
{
|
|
64 |
//open the sms center views
|
|
65 |
if (mSMSCenterView)
|
|
66 |
{
|
|
67 |
delete mSMSCenterView;
|
|
68 |
mSMSCenterView = NULL;
|
|
69 |
}
|
|
70 |
|
|
71 |
mSMSCenterView = new MsgSMSCenterView(index);
|
|
72 |
|
|
73 |
connect(mSMSCenterView,
|
|
74 |
SIGNAL(smsCenterEditViewClosed()),
|
|
75 |
this,
|
|
76 |
SLOT(onSmsCenterEditViewClosed()));
|
|
77 |
|
|
78 |
mMainWindow->addView(mSMSCenterView);
|
|
79 |
mMainWindow->setCurrentView(mSMSCenterView);
|
|
80 |
}
|
|
81 |
|
|
82 |
void MsgSettingsView::onSmsCenterEditViewClosed()
|
|
83 |
{
|
|
84 |
//remove the view
|
|
85 |
mMainWindow->removeView(mSMSCenterView);
|
|
86 |
|
|
87 |
//refresh the form
|
|
88 |
mSettingsForm->refreshViewForm();
|
|
89 |
|
|
90 |
//add the current view on top
|
|
91 |
mMainWindow->setCurrentView(this);
|
|
92 |
}
|
|
93 |
|
|
94 |
//eof
|
|
95 |
|