devicemgmtdialogsplugin/src/devicemanagementnotifierwidget.cpp
author hgs
Tue, 13 Jul 2010 03:48:30 +0530
changeset 45 0f9fc722d255
child 67 fdbfe0a95492
permissions -rw-r--r--
201021_01
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
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    18
#include <hbaction.h>
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    19
#include <hbdialog.h>
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    20
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    21
#include "devicemanagementnotifierwidget_p.h"
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    22
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    23
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    24
// Constructor
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    25
devicemanagementnotifierwidget::devicemanagementnotifierwidget(const QVariantMap &parameters):devicemanagementnotifierutils(this, parameters)
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    26
{
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    27
    // Do translation
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    28
    QTranslator *translator = new QTranslator();
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    29
    QString lang = QLocale::system().name();
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    30
    QString path = "Z:/resource/qt/translations/";
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    31
    bool fine = translator->load("deviceupdates_en.qm", path);
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    32
    if (fine)
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    33
        qApp->installTranslator(translator);
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    34
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    35
    QTranslator *commontranslator = new QTranslator();
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    36
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    37
    fine = commontranslator->load("common_" + lang, path);
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    38
    if (fine)
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    39
        qApp->installTranslator(commontranslator);
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    40
    
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    41
}
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    42
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    43
// Set parameters
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    44
bool devicemanagementnotifierwidget::setDeviceDialogParameters(
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    45
    const QVariantMap &parameters)
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    46
{
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    47
    
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    48
    return true;
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    49
}
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    50
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    51
// Get error
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    52
int devicemanagementnotifierwidget::deviceDialogError() const
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    53
{
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    54
    
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    55
    return 0;
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    56
}
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    57
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    58
// Close device dialog
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    59
void devicemanagementnotifierwidget::closeDeviceDialog(bool byClient)
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    60
{
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    61
    close();
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    62
    //emit deviceDialogClosed();
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    63
    
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    64
}
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    65
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    66
// Return display widget
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    67
HbDialog *devicemanagementnotifierwidget::deviceDialogWidget() const
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    68
{
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    69
   
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    70
    return const_cast<devicemanagementnotifierwidget*>(this);
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    71
}
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    72
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    73
devicemanagementnotifierwidget::~devicemanagementnotifierwidget()
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    74
    {
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    75
    qDebug("devicemanagementnotifierutils::~devicemanagementnotifierutils");
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    76
    }
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    77
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    78
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    79
void devicemanagementnotifierwidget::dmDevdialogDismissed(ENotfierType notifiertype, int response)
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    80
    {
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    81
    QVariantMap resultMap;
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    82
    resultMap.insert("notifiertype",notifiertype);
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    83
    resultMap.insert("keypress", response);
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    84
    emit deviceDialogData(resultMap);    
0f9fc722d255 201021_01
hgs
parents:
diff changeset
    85
    }