devicemgmtdialogsplugin/src/syncmlconnectnotifier.cpp
changeset 45 0f9fc722d255
child 42 aa33c2cb9a50
equal deleted inserted replaced
44:137912d1a556 45:0f9fc722d255
       
     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_en.qm", path);
       
    29     if (fine)
       
    30         qApp->installTranslator(translator);
       
    31 
       
    32     QTranslator *commontranslator = new QTranslator();
       
    33 
       
    34     fine = commontranslator->load("common_" + lang, path);
       
    35     if (fine)
       
    36         qApp->installTranslator(commontranslator);   
       
    37     pDialog = NULL;
       
    38     }
       
    39 
       
    40 void syncmlConnectNotifier::launchDialog(const QVariantMap &parameters)
       
    41     {    
       
    42     qDebug("devicemanagementnotifierutils syncmlConnectNotifier launchDialog");        
       
    43     pDialog = new HbProgressDialog(HbProgressDialog::ProgressDialog);
       
    44        HbAction *action = new HbAction(pDialog->tr("Cancel"), pDialog);
       
    45        pDialog->setText("Connecting");
       
    46        pDialog->actions().at(0)->setText(pDialog->tr("Hide"));
       
    47        pDialog->setMaximum(0);
       
    48        pDialog->setMinimum(0);    
       
    49        pDialog->addAction(action);
       
    50        pDialog->open(this, SLOT(buttonClicked(HbAction*)));
       
    51     qDebug("devicemanagementnotifierutils syncmlConnectNotifier launchDialog end");
       
    52     }
       
    53 
       
    54 void syncmlConnectNotifier::buttonClicked(HbAction* action)
       
    55 {
       
    56     // Figure out, what user pressed 
       
    57     qDebug("syncmlConnectNotifier::buttonClicked");    
       
    58         if (pDialog->actions().at(0) == action ) {
       
    59                qDebug("Hide was selected");              
       
    60                iPtr->dmDevdialogDismissed(devicemanagementnotifierwidget::EConnectingNote,0);
       
    61            } 
       
    62         else if ( pDialog->actions().at(1) == action  ) {
       
    63 
       
    64            qDebug("OMADM Cancel was selected");           
       
    65            qDebug("syncmlConnectNotifier::ultimateDialogSlot 1");
       
    66            iPtr->dmDevdialogDismissed(devicemanagementnotifierwidget::EConnectingNote,-3);                  
       
    67            }
       
    68     }
       
    69 
       
    70 
       
    71 syncmlConnectNotifier::~syncmlConnectNotifier()
       
    72     {
       
    73     qDebug("syncmlConnectNotifier::~syncmlConnectNotifier");
       
    74    if(pDialog)
       
    75    	{
       
    76        delete pDialog;
       
    77        pDialog = NULL;
       
    78      }
       
    79     qDebug("syncmlConnectNotifier::~syncmlConnectNotifier end");
       
    80     }
       
    81