70
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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: BtDeviceDialogWaitingWidget class declaration.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "btdevicedialogwaitingwidget.h"
|
|
20 |
#include "bluetoothdevicedialogs.h"
|
|
21 |
#include "btdevicedialogpluginerrors.h"
|
|
22 |
#include <hblabel.h>
|
|
23 |
#include <hbprogressbar.h>
|
|
24 |
|
|
25 |
const char* DOCML_BT_WAITING_DIALOG = ":/docml/bt-waiting-dialog.docml";
|
|
26 |
|
|
27 |
|
|
28 |
BtDeviceDialogWaitingWidget::BtDeviceDialogWaitingWidget(const QVariantMap ¶meters)
|
|
29 |
:mLoader(0),mDialog(0),mLastError(NoError)
|
|
30 |
{
|
|
31 |
constructDialog(parameters);
|
|
32 |
}
|
|
33 |
|
|
34 |
BtDeviceDialogWaitingWidget::~BtDeviceDialogWaitingWidget()
|
|
35 |
{
|
|
36 |
delete mLoader;
|
|
37 |
}
|
|
38 |
|
|
39 |
bool BtDeviceDialogWaitingWidget::setDeviceDialogParameters(const QVariantMap ¶meters)
|
|
40 |
{
|
|
41 |
Q_UNUSED(parameters);
|
|
42 |
return true;
|
|
43 |
}
|
|
44 |
|
|
45 |
int BtDeviceDialogWaitingWidget::deviceDialogError() const
|
|
46 |
{
|
|
47 |
return mLastError;
|
|
48 |
}
|
|
49 |
|
|
50 |
void BtDeviceDialogWaitingWidget::closeDeviceDialog(bool byClient)
|
|
51 |
{
|
|
52 |
Q_UNUSED(byClient);
|
|
53 |
mDialog->close();
|
|
54 |
emit deviceDialogClosed();
|
|
55 |
}
|
|
56 |
|
|
57 |
HbPopup* BtDeviceDialogWaitingWidget::deviceDialogWidget() const
|
|
58 |
{
|
|
59 |
return mDialog;
|
|
60 |
}
|
|
61 |
|
|
62 |
QObject* BtDeviceDialogWaitingWidget::signalSender() const
|
|
63 |
{
|
|
64 |
return const_cast<BtDeviceDialogWaitingWidget*>(this);
|
|
65 |
}
|
|
66 |
|
|
67 |
bool BtDeviceDialogWaitingWidget::constructDialog(const QVariantMap ¶meters)
|
|
68 |
{
|
|
69 |
Q_UNUSED(parameters);
|
|
70 |
HbLabel *heading;
|
|
71 |
HbProgressBar* progressBar;
|
|
72 |
mLoader = new HbDocumentLoader();
|
|
73 |
bool ok = false;
|
|
74 |
|
|
75 |
mLoader->load(DOCML_BT_WAITING_DIALOG, &ok);
|
|
76 |
if(ok)
|
|
77 |
{
|
|
78 |
mDialog = qobject_cast<HbDialog *>( mLoader->findWidget( "dialog" ) );
|
|
79 |
if(mDialog == 0)
|
|
80 |
{
|
|
81 |
mLastError = UnknownDeviceDialogError;
|
|
82 |
return false;
|
|
83 |
}
|
|
84 |
heading = qobject_cast<HbLabel *>( mLoader->findWidget( "heading" ) );
|
|
85 |
if(heading == 0)
|
|
86 |
{
|
|
87 |
mLastError = UnknownDeviceDialogError;
|
|
88 |
return false;
|
|
89 |
}
|
|
90 |
progressBar = qobject_cast<HbProgressBar *>( mLoader->findWidget( "progressBar" ) );
|
|
91 |
if(progressBar == 0)
|
|
92 |
{
|
|
93 |
mLastError = UnknownDeviceDialogError;
|
|
94 |
return false;
|
|
95 |
}
|
|
96 |
|
|
97 |
progressBar->setRange(0,0);
|
|
98 |
heading->setPlainText(hbTrId("txt_bt_info_entering_sim_access_profile"));
|
|
99 |
|
|
100 |
mDialog->setBackgroundFaded(false);
|
|
101 |
mDialog->setDismissPolicy(HbPopup::NoDismiss);
|
|
102 |
mDialog->setTimeout(HbPopup::NoTimeout);
|
|
103 |
return true;
|
|
104 |
}
|
|
105 |
else
|
|
106 |
{
|
|
107 |
mLastError = DocMLLoadingError;
|
|
108 |
return false;
|
|
109 |
}
|
|
110 |
}
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|