devicemgmtdialogsplugin/src/syncmlconnectnotifier.cpp
author hgs
Fri, 17 Sep 2010 19:58:05 +0530
changeset 62 03849bd79877
parent 47 d316aecb87fd
permissions -rw-r--r--
201037
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45
0f9fc722d255 201021_01
hgs
parents:
diff changeset
     1
/*
0f9fc722d255 201021_01
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
0f9fc722d255 201021_01
hgs
parents:
diff changeset
     3
* All rights reserved.
0f9fc722d255 201021_01
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
0f9fc722d255 201021_01
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
0f9fc722d255 201021_01
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
0f9fc722d255 201021_01
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
0f9fc722d255 201021_01
hgs
parents:
diff changeset
     8
*
0f9fc722d255 201021_01
hgs
parents:
diff changeset
     9
* Initial Contributors:
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    11
*
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    12
* Contributors:
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    13
*
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    14
* Description: 
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    15
*
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    16
*/
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    17
#include <hbaction.h>
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    18
#include "devicemanagementnotifierutils.h"
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    19
#include "devicemanagementnotifierwidget_p.h"
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    20
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    21
syncmlConnectNotifier::syncmlConnectNotifier(devicemanagementnotifierwidget* ptr)
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    22
    {
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    23
    iPtr = ptr;
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    24
    qDebug("devicemanagementnotifierutils syncmlConnectNotifier");
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    25
    QTranslator *translator = new QTranslator();
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    26
    QString lang = QLocale::system().name();
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    27
    QString path = "Z:/resource/qt/translations/";
47
d316aecb87fd 201025_02
hgs
parents: 45
diff changeset
    28
    bool fine = translator->load("deviceupdates_" + lang, path);
45
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    29
    if (fine)
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    30
        qApp->installTranslator(translator);
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    31
    QTranslator *commontranslator = new QTranslator();
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    32
    fine = commontranslator->load("common_" + lang, path);
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    33
    if (fine)
47
d316aecb87fd 201025_02
hgs
parents: 45
diff changeset
    34
        qApp->installTranslator(commontranslator);
45
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    35
    pDialog = NULL;
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    36
    }
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    37
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    38
void syncmlConnectNotifier::launchDialog(const QVariantMap &parameters)
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    39
    {    
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    40
    qDebug("devicemanagementnotifierutils syncmlConnectNotifier launchDialog");        
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    41
    pDialog = new HbProgressDialog(HbProgressDialog::ProgressDialog);
47
d316aecb87fd 201025_02
hgs
parents: 45
diff changeset
    42
       HbAction *action = new HbAction(hbTrId("txt_common_button_cancel"),
d316aecb87fd 201025_02
hgs
parents: 45
diff changeset
    43
       												 pDialog);
d316aecb87fd 201025_02
hgs
parents: 45
diff changeset
    44
       pDialog->setText(hbTrId("txt_device_update_info_connecting"));
d316aecb87fd 201025_02
hgs
parents: 45
diff changeset
    45
       pDialog->actions().at(0)->setText(hbTrId("txt_common_button_hide"));
45
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    46
       pDialog->setMaximum(0);
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    47
       pDialog->setMinimum(0);    
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    48
       pDialog->addAction(action);
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    49
       pDialog->open(this, SLOT(buttonClicked(HbAction*)));
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    50
    qDebug("devicemanagementnotifierutils syncmlConnectNotifier launchDialog end");
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    51
    }
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    52
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    53
void syncmlConnectNotifier::buttonClicked(HbAction* action)
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    54
{
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    55
    // Figure out, what user pressed 
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    56
    qDebug("syncmlConnectNotifier::buttonClicked");    
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    57
        if (pDialog->actions().at(0) == action ) {
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    58
               qDebug("Hide was selected");              
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    59
               iPtr->dmDevdialogDismissed(devicemanagementnotifierwidget::EConnectingNote,0);
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    60
           } 
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    61
        else if ( pDialog->actions().at(1) == action  ) {
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    62
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    63
           qDebug("OMADM Cancel was selected");           
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    64
           qDebug("syncmlConnectNotifier::ultimateDialogSlot 1");
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    65
           iPtr->dmDevdialogDismissed(devicemanagementnotifierwidget::EConnectingNote,-3);                  
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    66
           }
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    67
    }
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    68
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    69
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    70
syncmlConnectNotifier::~syncmlConnectNotifier()
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    71
    {
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    72
    qDebug("syncmlConnectNotifier::~syncmlConnectNotifier");
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    73
   if(pDialog)
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    74
   	{
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    75
       delete pDialog;
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    76
       pDialog = NULL;
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    77
     }
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    78
    qDebug("syncmlConnectNotifier::~syncmlConnectNotifier end");
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    79
    }
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    80