|
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: |
|
15 * |
|
16 */ |
|
17 #include <hbaction.h> |
|
18 #include "devicemanagementnotifierutils.h" |
|
19 #include "devicemanagementnotifierwidget_p.h" |
|
20 |
|
21 syncmlConnectNotifier::syncmlConnectNotifier(devicemanagementnotifierwidget* ptr) |
|
22 { |
|
23 iPtr = ptr; |
|
24 qDebug("devicemanagementnotifierutils syncmlConnectNotifier"); |
|
25 QTranslator *translator = new QTranslator(); |
|
26 QString lang = QLocale::system().name(); |
|
27 QString path = "Z:/resource/qt/translations/"; |
|
28 bool fine = translator->load("deviceupdates_" + lang, path); |
|
29 if (fine) |
|
30 qApp->installTranslator(translator); |
|
31 QTranslator *commontranslator = new QTranslator(); |
|
32 fine = commontranslator->load("common_" + lang, path); |
|
33 if (fine) |
|
34 qApp->installTranslator(commontranslator); |
|
35 pDialog = NULL; |
|
36 } |
|
37 |
|
38 void syncmlConnectNotifier::launchDialog(const QVariantMap ¶meters) |
|
39 { |
|
40 qDebug("devicemanagementnotifierutils syncmlConnectNotifier launchDialog"); |
|
41 pDialog = new HbProgressDialog(HbProgressDialog::ProgressDialog); |
|
42 HbAction *action = new HbAction(hbTrId("txt_common_button_cancel"), |
|
43 pDialog); |
|
44 pDialog->setText(hbTrId("txt_device_update_info_connecting")); |
|
45 pDialog->actions().at(0)->setText(hbTrId("txt_common_button_hide")); |
|
46 pDialog->setMaximum(0); |
|
47 pDialog->setMinimum(0); |
|
48 pDialog->addAction(action); |
|
49 pDialog->open(this, SLOT(buttonClicked(HbAction*))); |
|
50 qDebug("devicemanagementnotifierutils syncmlConnectNotifier launchDialog end"); |
|
51 } |
|
52 |
|
53 void syncmlConnectNotifier::buttonClicked(HbAction* action) |
|
54 { |
|
55 // Figure out, what user pressed |
|
56 qDebug("syncmlConnectNotifier::buttonClicked"); |
|
57 if (pDialog->actions().at(0) == action ) { |
|
58 qDebug("Hide was selected"); |
|
59 iPtr->dmDevdialogDismissed(devicemanagementnotifierwidget::EConnectingNote,0); |
|
60 } |
|
61 else if ( pDialog->actions().at(1) == action ) { |
|
62 |
|
63 qDebug("OMADM Cancel was selected"); |
|
64 qDebug("syncmlConnectNotifier::ultimateDialogSlot 1"); |
|
65 iPtr->dmDevdialogDismissed(devicemanagementnotifierwidget::EConnectingNote,-3); |
|
66 } |
|
67 } |
|
68 |
|
69 |
|
70 syncmlConnectNotifier::~syncmlConnectNotifier() |
|
71 { |
|
72 qDebug("syncmlConnectNotifier::~syncmlConnectNotifier"); |
|
73 if(pDialog) |
|
74 { |
|
75 delete pDialog; |
|
76 pDialog = NULL; |
|
77 } |
|
78 qDebug("syncmlConnectNotifier::~syncmlConnectNotifier end"); |
|
79 } |
|
80 |