deviceupdatesui/devicemanagementnotifiersplugin/devicemanagementnotifierutils.cpp
author hgs
Sun, 21 Mar 2010 15:34:22 +0530
changeset 36 9eefb50e711a
parent 33 7464c1e21dae
child 43 88e14c3d4c4f
permissions -rw-r--r--
201011
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     1
/*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     3
* All rights reserved.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     8
*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
     9
* Initial Contributors:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    11
*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    12
* Contributors:
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    13
*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    14
* Description: 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    15
*
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    16
*/
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    17
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    18
#include <hbdocumentloader.h>
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    19
#include <hbdialog.h>
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    20
#include <hblabel.h>
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    21
#include <hbmessagebox.h>
36
hgs
parents: 33
diff changeset
    22
#include <hbaction.h>
hgs
parents: 33
diff changeset
    23
#include <e32property.h>
hgs
parents: 33
diff changeset
    24
#include <qdebug.h>
hgs
parents: 33
diff changeset
    25
#include "SyncMLNotifierParams.h"
33
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    26
#include "PnpUtilLogger.h"
36
hgs
parents: 33
diff changeset
    27
#include "devicemanagementnotifierutils.h"
33
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    28
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    29
 enum TSyncmlHbNotifierKeys 
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    30
		{
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    31
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    32
     EHbSOSNotifierKeyStatus = 11, // status set will complete the client subscribe
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    33
     EHbSOSNotifierKeyStatusReturn = 12, // Return the content of actual status value accepted from UI
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    34
     
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    35
     EHbDMSyncNotifierKeyStatus = 13,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    36
     EHbDMSyncNotifierKeyStatusReturn = 14
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    37
		};
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    38
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    39
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    40
devicemanagementnotifierutils::devicemanagementnotifierutils(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    41
        const QVariantMap &parameters)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    42
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    43
	qDebug("devicemanagementnotifierutils");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    44
    syncmlnotifier* notifier = new syncmlnotifier();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    45
    notifier->launchDialog(parameters);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    46
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    47
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    48
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    49
syncmlnotifier::syncmlnotifier()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    50
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    51
    qDebug("devicemanagementnotifierutils syncmlnotifier");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    52
    QTranslator *translator = new QTranslator();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    53
    QString lang = QLocale::system().name();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    54
    QString path = "Z:/resource/qt/translations/";
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    55
    bool fine = translator->load("deviceupdates_en.qm", path);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    56
    if (fine)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    57
        qApp->installTranslator(translator);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    58
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    59
    QTranslator *commontranslator = new QTranslator();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    60
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    61
    fine = commontranslator->load("common_" + lang, path);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    62
    if (fine)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    63
        qApp->installTranslator(commontranslator);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    64
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    65
    msymnotifier = new syncmlnotifierprivate();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    66
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    67
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    68
void syncmlnotifier::launchDialog(const QVariantMap &parameters)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    69
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    70
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    71
    QVariantMap::const_iterator i = parameters.constBegin();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    72
    qDebug("devicemanagementnotifierutils syncmlnotifier launchDialog");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    73
    //i++;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    74
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    75
    bool profileidenabled = false;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    76
    bool uiserverinteraction = false;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    77
    bool serverpushinformativeenabled = false;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    78
    bool serverpushinteractiveenabled = false;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    79
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    80
    int profileid = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    81
    int uimode = 0;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    82
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    83
    QString serverpushinformmessage;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    84
    QString serverpushconfirmmessage;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    85
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    86
    QString serverdispname;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    87
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    88
    while (i != parameters.constEnd())
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    89
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    90
        if (i.key().toAscii() == "profileid")
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    91
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    92
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    93
            profileid = i.value().toInt();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    94
            profileidenabled = true;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    95
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    96
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    97
        if (i.key().toAscii() == "uimode")
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    98
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
    99
            uiserverinteraction = true;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   100
            uimode = i.value().toInt();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   101
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   102
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   103
        if (i.key().toAscii() == "serverpushinformative")
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   104
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   105
			qDebug("server push informative enabled");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   106
            serverpushinformativeenabled = true;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   107
            serverpushinformmessage = i.value().toString();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   108
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   109
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   110
        if (i.key().toAscii() == "serverpushconfirmative")
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   111
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   112
		    LOGSTRING("Server Push Confirmative");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   113
            serverpushinteractiveenabled = true;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   114
            serverpushconfirmmessage = i.value().toString();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   115
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   116
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   117
        if (i.key().toAscii() == "serverdisplayname")
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   118
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   119
            serverdispname = i.value().toString();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   120
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   121
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   122
        ++i;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   123
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   124
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   125
    if (profileidenabled && uiserverinteraction)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   126
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   127
        qDebug("server interaction packet 0 enabled ");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   128
        qDebug()<<EHbSOSNotifierKeyStatus;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   129
        msymnotifier->setnotifierorigin(EHbSOSNotifierKeyStatus);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   130
        createserverinitnotifier(profileid, uimode, serverdispname);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   131
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   132
    else if (serverpushinformativeenabled)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   133
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   134
        qDebug("server push informative enabled ");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   135
        qDebug()<<EHbDMSyncNotifierKeyStatus;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   136
        msymnotifier->setnotifierorigin(EHbDMSyncNotifierKeyStatus);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   137
        createserveralertinformative(serverpushinformmessage);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   138
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   139
    else if (serverpushinteractiveenabled)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   140
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   141
        qDebug("server push informative enabled ");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   142
        qDebug()<<EHbDMSyncNotifierKeyStatus;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   143
         msymnotifier->setnotifierorigin(EHbDMSyncNotifierKeyStatus);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   144
        createserveralertconfirmative(serverpushconfirmmessage);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   145
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   146
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   147
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   148
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   149
void syncmlnotifier::createserverinitnotifier(int profileid, int uimode,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   150
        QString& servername)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   151
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   152
    
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   153
    int inittype = msymnotifier->serverinittype(uimode);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   154
    qDebug("Notification type");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   155
    qDebug()<<inittype;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   156
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   157
	LOGSTRING2("Init value = %d", inittype);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   158
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   159
    /*For testing purpose*/
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   160
    //inittype = ESANUserInteractive;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   161
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   162
    if (inittype == ESANUserInteractive)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   163
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   164
        HbDocumentLoader loader;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   165
        bool ok = false;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   166
        loader.load(":/xml/dialog.docml", &ok);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   167
        if (!ok)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   168
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   169
            return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   170
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   171
        HbDialog *dialog = qobject_cast<HbDialog *> (loader.findWidget(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   172
                "dialog"));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   173
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   174
        //set heading content
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   175
        HbLabel *contentheading = qobject_cast<HbLabel *> (loader.findWidget(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   176
                "qtl_dialog_pri_heading"));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   177
        QString heading = hbTrId("txt_device_update_title_update_available");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   178
        contentheading->setPlainText(heading);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   179
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   180
        //set body content
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   181
        HbLabel *contentbody = qobject_cast<HbLabel *> (loader.findWidget(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   182
                "qtl_dialog_pri5"));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   183
        QString serverinitmessage = hbTrId(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   184
                "txt_device_update_info_recommended_update_is_avail").arg(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   185
                servername);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   186
        contentbody->setPlainText(serverinitmessage);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   187
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   188
        //set softkeys
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   189
        HbAction *primaryAction = dialog->primaryAction();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   190
        QString softkeyok = hbTrId("txt_common_button_ok");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   191
        primaryAction->setText(softkeyok);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   192
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   193
        HbAction *secondaryAction = dialog->secondaryAction();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   194
        QString softkeyCancel = hbTrId("txt_common_button_cancel");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   195
        secondaryAction->setText(softkeyCancel);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   196
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   197
        //set dialog properties
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   198
        dialog->setTimeout(HbPopup::NoTimeout);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   199
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   200
        //load appropriate icon from svg file
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   201
        HbLabel* label1 = qobject_cast<HbLabel*> (loader.findWidget("icon"));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   202
        HbIcon* icon1 = new HbIcon(":/devman_icon/iconnotifier.svg");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   203
        label1->setIcon(*icon1);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   204
        //label1->setMode(QIcon::Normal);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   205
        //label1->setState(QIcon::Off);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   206
        label1->setToolTip("Mode=Normal, State=Off");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   207
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   208
        QObject::connect(primaryAction, SIGNAL(triggered()), this,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   209
                SLOT(okSelected()));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   210
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   211
        QObject::connect(secondaryAction, SIGNAL(triggered()), this,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   212
                SLOT(cancelSelected()));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   213
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   214
        if (dialog)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   215
            dialog->show();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   216
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   217
    else if (inittype == ESANUserInformative)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   218
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   219
        HbDocumentLoader loader;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   220
        bool ok = false;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   221
        loader.load(":/xml/dialoginformative.docml", &ok);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   222
        if (!ok)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   223
            {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   224
            return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   225
            }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   226
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   227
        //hbTrId("qtl_dialog_pri_heading");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   228
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   229
        HbDialog *dialog = qobject_cast<HbDialog *> (loader.findWidget(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   230
                "dialog"));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   231
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   232
        HbLabel *content = qobject_cast<HbLabel *> (loader.findWidget(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   233
                "qtl_dialog_pri5"));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   234
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   235
        QString serverinitmessage = hbTrId(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   236
                "txt_device_update_info_update_serverpush_informative").arg(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   237
                servername);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   238
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   239
        //getserverspecifictexttodisplay(profileid, uimode, serverinitmessage);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   240
        content->setPlainText(serverinitmessage);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   241
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   242
        //get string here /*TODO*/ /*QTranslations*/
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   243
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   244
        dialog->setTimeout(3000);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   245
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   246
        //msymnotifier->setstatus(0);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   247
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   248
        if (dialog)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   249
            dialog->show();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   250
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   251
        QObject::connect(dialog, SIGNAL(aboutToClose()), this,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   252
                SLOT(okSelected()));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   253
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   254
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   255
    else if (inittype == ESANSilent)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   256
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   257
        msymnotifier->setstatus(0);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   258
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   259
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   260
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   261
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   262
void syncmlnotifier::createserveralertinformative(const QString &string)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   263
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   264
    qDebug("createserveralertinformative start");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   265
		LOGSTRING("createserveralertinformative start");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   266
    HbDocumentLoader loader;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   267
    bool ok = false;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   268
    loader.load(":/xml/dialoginformative.docml", &ok);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   269
    if (!ok)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   270
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   271
        return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   272
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   273
    HbDialog *dialog = qobject_cast<HbDialog *> (loader.findWidget("dialog"));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   274
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   275
    HbLabel *content = qobject_cast<HbLabel *> (loader.findWidget(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   276
            "qtl_dialog_pri5"));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   277
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   278
    // No translations required
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   279
    content->setPlainText(string);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   280
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   281
    dialog->setTimeout(3000);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   282
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   283
    if (dialog)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   284
        dialog->show();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   285
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   286
    QObject::connect(dialog, SIGNAL(aboutToClose()), this, SLOT(okSelected()));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   287
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   288
	qDebug("createserveralertinformative end");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   289
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   290
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   291
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   292
void syncmlnotifier::createserveralertconfirmative(const QString &string)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   293
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   294
    HbDocumentLoader loader;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   295
    bool ok = false;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   296
    loader.load(":/xml/dialogserverpushconfirm.docml", &ok);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   297
    if (!ok)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   298
        {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   299
        return;
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   300
        }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   301
    HbDialog *dialog = qobject_cast<HbDialog *> (loader.findWidget("dialog"));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   302
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   303
    //set heading content
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   304
    HbLabel *contentheading = qobject_cast<HbLabel *> (loader.findWidget(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   305
            "qtl_dialog_pri_heading"));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   306
    QString heading = hbTrId("txt_device_update_title_server_message");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   307
    contentheading->setPlainText(heading);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   308
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   309
    //set body content
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   310
    HbLabel *contentbody = qobject_cast<HbLabel *> (loader.findWidget(
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   311
            "qtl_dialog_pri5"));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   312
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   313
    contentbody->setPlainText(string);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   314
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   315
    //set softkeys
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   316
    HbAction *primaryAction = dialog->primaryAction();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   317
    QString softkeyok = hbTrId("txt_common_button_yes");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   318
    primaryAction->setText(softkeyok);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   319
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   320
    HbAction *secondaryAction = dialog->secondaryAction();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   321
    QString softkeyCancel = hbTrId("txt_common_button_no");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   322
    secondaryAction->setText(softkeyCancel);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   323
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   324
    dialog->setTimeout(HbPopup::NoTimeout);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   325
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   326
    QObject::connect(primaryAction, SIGNAL(triggered()), this,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   327
            SLOT(okSelected()));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   328
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   329
    QObject::connect(secondaryAction, SIGNAL(triggered()), this,
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   330
            SLOT(cancelSelected()));
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   331
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   332
    if (dialog)
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   333
        dialog->show();
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   334
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   335
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   336
void syncmlnotifier::okSelected()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   337
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   338
    qDebug("ok selected");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   339
    msymnotifier->setstatus(0);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   340
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   341
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   342
void syncmlnotifier::cancelSelected()
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   343
    {
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   344
    qDebug("cancel selected");
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   345
    msymnotifier->setstatus(-3);
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   346
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   347
    }
7464c1e21dae 201008_internal
hgs
parents:
diff changeset
   348