policymanagement/policyengine/policyengineui/src/PolicyEngineUi.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 16:04:06 +0300
branchRCL_3
changeset 61 b183ec05bd8c
parent 58 4af31167ea77
child 62 19bba8228ff0
permissions -rw-r--r--
Revision: 201033 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
     2
* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies). 
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    14
* Description: Implementation of policymanagement components
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    18
#include "PolicyEngineUI.h"
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    19
#include <hbpopup.h>
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    20
#include <hbinputdialog.h>
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    21
#include <hbdocumentloader.h>
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    22
#include <hbdialog.h>
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    23
#include <hblabel.h>
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    24
#include <hbaction.h>
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    25
#include <hbnotificationdialog.h>
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    26
#include <hbmessagebox.h>
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    27
#include <hbdevicenotificationdialog.h>
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    28
#include "Logger.h"
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    30
const int KMaxTries = 4;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    31
const int KMaxCodeLength = 4;
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    34
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    35
// PolicyEngineUI::PolicyEngineUI()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    36
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    37
PolicyEngineUI::PolicyEngineUI(const QVariantMap& parameters)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    38
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    39
    estbTrustCount = KMaxTries;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    40
    DisplayNotificationDialog(parameters);
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
    }
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    44
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    45
// PolicyEngineUI::~PolicyEngineUI()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    46
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    47
PolicyEngineUI::~PolicyEngineUI()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    48
    {
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    50
    }
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    53
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    54
// PolicyEngineUI::DisplayNotificationDialog()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    55
// Read the parameters sent from client
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    56
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    57
void PolicyEngineUI::DisplayNotificationDialog(const QVariantMap& parameters)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    58
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    59
    LOGSTRING( "+ DisplayNotificationDialog +" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    60
    QVariantMap::const_iterator i = parameters.constBegin();
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    62
    while (i != parameters.constEnd())
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    63
        {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    64
        if (i.key().toAscii() == "serverdisplayname")
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    65
            {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    66
            iServerName = i.value().toString();
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    67
            }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    68
        else if (i.key().toAscii() == "fingerprint")
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    69
            {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    70
            iFingerprint = i.value().toString();
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    71
            }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    72
        ++i;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    73
        }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    74
    
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    75
    TBuf<50> server(iServerName.utf16());
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    76
    TBuf<10> buffer(iFingerprint.utf16());
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    78
    LOGSTRING2( "serverdisplayname %S", &server );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    79
    LOGSTRING2( "fingerprint %S", &buffer );
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    81
    ShowInputDialog();
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    82
    LOGSTRING( "- DisplayNotificationDialog -" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    83
    }
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    86
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    87
// PolicyEngineUI::ShowInputDialog()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    88
// Show the accept control dialog
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    89
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    90
void PolicyEngineUI::ShowInputDialog()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    91
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    92
    LOGSTRING( "+ ShowInputDialog +" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    93
    HbDocumentLoader loader;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    94
    bool ok = false;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    95
    loader.load(":/xml/dialog.docml", &ok);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    96
    if (!ok)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    97
        {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    98
        return;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
    99
        }
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   101
    HbDialog *dialog1 =
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   102
            qobject_cast<HbDialog *> (loader.findWidget("dialog"));
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   104
    //set heading content
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   105
    HbLabel *contentheading = qobject_cast<HbLabel *> (loader.findWidget(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   106
            "qtl_dialog_pri_heading"));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   107
    QString heading(hbTrId("txt_device_update_title_security_information"));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   108
    contentheading->setPlainText(heading);
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   110
    //set body content
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   111
    HbLabel *contentbody = qobject_cast<HbLabel *> (loader.findWidget(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   112
            "qtl_dialog_pri5"));
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   114
    QString body(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   115
            (hbTrId("txt_device_update_info_1_server_wants_to_contro").arg(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   116
                    iServerName)));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   117
    contentbody->setTextWrapping(Hb::TextWordWrap);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   118
    contentbody->setPlainText(body);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   119
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   120
    HbAction *primaryAction = qobject_cast<HbAction *> (
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   121
            dialog1->actions().at(0));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   122
    HbAction *secondaryAction = qobject_cast<HbAction *> (
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   123
            dialog1->actions().at(1));
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   125
    //set dialog properties
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   126
    dialog1->setTimeout(HbPopup::NoTimeout);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   127
    dialog1->setDismissPolicy(HbPopup::NoDismiss);
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   129
    QObject::connect(primaryAction, SIGNAL(triggered()), this,
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   130
            SLOT(onOKSelected()));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   131
    QObject::connect(secondaryAction, SIGNAL(triggered()), this,
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   132
            SLOT(onCancelSelected()));
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   134
    if (dialog1)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   135
        dialog1->show();
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   136
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   137
    LOGSTRING( "- ShowInputDialog -" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   138
    }
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   141
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   142
// PolicyEngineUI::onOKSelected()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   143
// Show the user input dialog once control is accepted
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   144
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   145
void PolicyEngineUI::onOKSelected()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   146
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   147
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   148
    LOGSTRING( "+ onOKSelected +" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   149
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   150
    HbDocumentLoader loader;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   151
    bool ok = false;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   152
    loader.load(":/xml/InputDialog.docml", &ok);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   153
    if (!ok)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   154
        {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   155
        return;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   156
        }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   157
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   158
    mdialog = qobject_cast<HbDialog *> (loader.findWidget("dialog"));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   159
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   160
    //set heading content
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   161
    HbLabel *contentheading = qobject_cast<HbLabel *> (loader.findWidget(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   162
            "qtl_dialog_pri_heading"));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   163
    QString heading(hbTrId("txt_device_update_title_security_information"));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   164
    contentheading->setPlainText(heading);
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   166
    //set label
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   167
    HbLabel *contentlabel = qobject_cast<HbLabel *> (loader.findWidget(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   168
            "HeadingLabel"));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   169
    contentlabel->setTextWrapping(Hb::TextWordWrap);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   170
    QString label(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   171
                (hbTrId("txt_device_update_info_enter_first_4_characters_of").arg(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   172
                        iServerName)));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   173
    contentlabel ->setPlainText(label);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   174
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   175
    //set length for editline
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   176
    mContentEdit = qobject_cast<HbLineEdit*> (loader.findWidget("InputLine"));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   177
    mContentEdit->setMaxLength(KMaxCodeLength);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   178
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   179
    //set dialog properties
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   180
    mdialog->setTimeout(HbPopup::NoTimeout);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   181
    mdialog->setDismissPolicy(HbPopup::NoDismiss);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   182
    
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   183
    HbAction* primaryAction = (HbAction*) (mdialog->actions().at(0));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   184
    HbAction *secondaryAction = (HbAction*) (mdialog->actions().at(1));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   185
    primaryAction->setEnabled(false);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   186
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   187
    QObject::connect(primaryAction, SIGNAL(triggered()), this,
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   188
            SLOT(establishTrust()));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   189
    QObject::connect(secondaryAction, SIGNAL(triggered()), this,
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   190
            SLOT(cancelTrust()));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   191
    QObject::connect(mContentEdit, SIGNAL(contentsChanged()), this,
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   192
            SLOT(codeTextChanged()));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   193
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   194
    if (mdialog)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   195
        mdialog->show();
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   196
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   197
    LOGSTRING( "- onOKSelected -" );
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
    }
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   201
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   202
// PolicyEngineUI::onCancelSelected()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   203
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   204
void PolicyEngineUI::onCancelSelected()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   205
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   206
    LOGSTRING( "+ onCancelSelected +" );
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   208
    QVariantMap result;
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   210
    result.insert("keyResponse", -1);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   211
    emit
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   212
    deviceDialogData(result);
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   214
    emit
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   215
    deviceDialogClosed();
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   217
    LOGSTRING( "- onCancelSelected -" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   218
    }
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   221
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   222
// PolicyEngineUI::onTrustCreation()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   223
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   224
void PolicyEngineUI::onTrustCreation()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   225
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   226
    LOGSTRING( "+ onTrustCreation +" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   227
    QVariantMap result;
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   229
    result.insert("keyResponse", 0);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   230
    emit
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   231
    deviceDialogData(result);
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   233
    emit
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   234
    deviceDialogClosed();
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   236
    LOGSTRING( "- onTrustCreation -" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   237
    }
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   240
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   241
// PolicyEngineUI::establishTrust()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   242
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   243
void PolicyEngineUI::establishTrust()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   244
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   245
    LOGSTRING( "+ establishTrust +" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   246
    bool retVal; // return value from code verification API.
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   247
    estbTrustCount--;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   248
    retVal = verifyFingerPrint();
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   249
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   250
    if (retVal)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   251
        {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   252
        LOGSTRING( "Trust Created" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   253
        //Reset the counter.
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   254
        estbTrustCount = 0;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   255
        onTrustCreation();
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   257
        }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   258
    else
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   259
        {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   260
        //check the number of tries.
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   261
        if (estbTrustCount == 0)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   262
            {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   263
            //Access denied.
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   264
            LOGSTRING( "Access Denied" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   265
            HbMessageBox *msgBox = new HbMessageBox();
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   266
            msgBox->setHeadingWidget(new HbLabel(hbTrId(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   267
                    "txt_device_update_title_security_information")));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   268
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   269
            msgBox->setText(hbTrId(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   270
                    "txt_device_update_info_security_info_access_denied"));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   271
            msgBox->setTimeout(HbDialog::NoTimeout);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   272
            msgBox->setDismissPolicy(HbDialog::NoDismiss);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   273
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   274
            HbAction *action = (HbAction*) (msgBox->actions().at(0));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   275
            QObject::connect(action, SIGNAL(triggered()), this,
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   276
                    SLOT(onCancelSelected()));
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   278
            msgBox->show();
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   279
            }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   280
        else
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   281
            {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   282
            LOGSTRING2( "tries left %i", estbTrustCount );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   283
            //Code didnot match.
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   284
            HbDocumentLoader loader;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   285
            bool ok = false;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   286
            loader.load(":/xml/InputDialog.docml", &ok);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   287
            if (!ok)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   288
                {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   289
                return;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   290
                }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   291
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   292
            mdialog = qobject_cast<HbDialog *> (loader.findWidget("dialog"));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   293
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   294
            //set heading content
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   295
            HbLabel *contentheading = qobject_cast<HbLabel *> (
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   296
                    loader.findWidget("qtl_dialog_pri_heading"));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   297
            contentheading->setTextWrapping(Hb::TextWordWrap);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   298
            QString heading(hbTrId(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   299
                    "txt_device_update_title_security_information"));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   300
            contentheading->setPlainText(heading);
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   302
            //set label
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   303
            HbLabel *contentlabel = qobject_cast<HbLabel *> (
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   304
                    loader.findWidget("HeadingLabel"));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   305
            QString
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   306
                    label(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   307
                            (hbTrId(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   308
                                    "txt_device_update_info_security_information_did_no").arg(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   309
                                    estbTrustCount)));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   310
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   311
            contentlabel->setTextWrapping(Hb::TextWordWrap);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   312
            contentlabel->setPlainText(label);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   313
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   314
            mContentEdit = qobject_cast<HbLineEdit*> (loader.findWidget(
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   315
                    "InputLine"));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   316
            mContentEdit->setMaxLength(KMaxCodeLength);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   317
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   318
            mdialog->setTimeout(HbPopup::NoTimeout);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   319
            mdialog->setDismissPolicy(HbPopup::NoDismiss);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   320
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   321
            HbAction* primaryAction = qobject_cast<HbAction*> (
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   322
                    mdialog->actions().at(0));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   323
            HbAction *secondaryAction = qobject_cast<HbAction*> (
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   324
                    mdialog->actions().at(1));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   325
            primaryAction->setEnabled(false);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   326
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   327
            QObject::connect(primaryAction, SIGNAL(triggered()), this,
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   328
                    SLOT(establishTrust()));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   329
            QObject::connect(secondaryAction, SIGNAL(triggered()), this,
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   330
                    SLOT(cancelTrust()));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   331
            QObject::connect(mContentEdit, SIGNAL(contentsChanged()), this,
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   332
                    SLOT(codeTextChanged()));
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   333
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   334
            if (mdialog)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   335
                mdialog->show();
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   336
            }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   337
        }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   338
    LOGSTRING( "- establishTrust -" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   339
    }
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   341
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   342
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   343
// PolicyEngineUI::cancelTrust()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   344
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   345
void PolicyEngineUI::cancelTrust()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   346
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   347
    LOGSTRING( "+ cancelTrust +" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   348
    //Reset the counter.
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   349
    estbTrustCount = 0;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   350
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   351
    QVariantMap result;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   352
    result.insert("keyResponse", -1);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   353
    emit
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   354
    deviceDialogData(result);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   355
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   356
    emit
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   357
    deviceDialogClosed();
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   358
    LOGSTRING( "- cancelTrust -" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   359
    }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   360
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   361
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   362
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   363
// PolicyEngineUI::setDeviceDialogParameters()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   364
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   365
bool PolicyEngineUI::setDeviceDialogParameters(const QVariantMap &parameters)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   366
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   367
	Q_UNUSED(parameters);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   368
    LOGSTRING( "+ setDeviceDialogParameters +" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   369
    return true;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   370
    }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   371
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   372
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   373
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   374
// PolicyEngineUI::deviceDialogError()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   375
// Get error
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   376
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   377
int PolicyEngineUI::deviceDialogError() const
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   378
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   379
    LOGSTRING( "+ deviceDialogError +" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   380
    return 0;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   381
    }
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   382
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   383
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   384
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   385
// PolicyEngineUI::PolicyEngineUI()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   386
// Close device dialog
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   387
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   388
void PolicyEngineUI::closeDeviceDialog(bool byClient)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   389
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   390
	Q_UNUSED(byClient);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   391
    LOGSTRING( "+ closeDeviceDialog +" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   392
    close();
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   393
    }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   394
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   395
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   396
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   397
// PolicyEngineUI::PolicyEngineUI()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   398
// Return display widget
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   399
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   400
HbDialog *PolicyEngineUI::deviceDialogWidget() const
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   401
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   402
    LOGSTRING( "+ deviceDialogWidget +" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   403
    return const_cast<PolicyEngineUI*> (this);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   404
    }
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   405
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   406
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   407
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   408
// PolicyEngineUI::PolicyEngineUI()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   409
// Verify the user entered code
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   410
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   411
bool PolicyEngineUI::verifyFingerPrint()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   412
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   413
    LOGSTRING( "+ verifyFingerPrint +" );
0
b497e44ab2fc Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   414
61
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   415
    QString enteredCode = mContentEdit->text();
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   416
    TBuf<10> buffer(enteredCode.utf16());
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   417
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   418
    LOGSTRING2( "User entered code %i", &buffer);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   419
    LOGSTRING2( "User entered code %S", &buffer);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   420
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   421
    if (enteredCode.compare(iFingerprint, Qt::CaseInsensitive) == 0)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   422
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   423
        LOGSTRING( "+ fingerprint MATCH !!!! +" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   424
        return true;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   425
    }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   426
    else
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   427
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   428
        LOGSTRING( "+  fingerprint DOESNOT MATCH  +" );
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   429
        return false;
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   430
    }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   431
    }
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   432
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   433
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   434
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   435
// PolicyEngineUI::codeTextChanged()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   436
// checks the entered text length and enables the OK option accordingly.
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   437
// -----------------------------------------------------------------------------
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   438
void PolicyEngineUI::codeTextChanged()
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   439
    {
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   440
    QString str = mContentEdit->text();
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   441
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   442
    if (str.length() >= KMaxCodeLength)
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   443
        mdialog->actions().at(0)->setEnabled(true);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   444
    else
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   445
        mdialog->actions().at(0)->setEnabled(false);
b183ec05bd8c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 58
diff changeset
   446
    }