wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistwidget.cpp
author hgs
Thu, 24 Jun 2010 10:49:51 +0300
changeset 39 7b3e49e4608a
parent 31 e8f4211554fb
child 58 301aeb18ae47
permissions -rw-r--r--
201025
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description: 
hgs
parents:
diff changeset
    15
* WLAN Sniffer list widget class.
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
// System includes
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
#include <QSharedPointer>
hgs
parents:
diff changeset
    21
#include <HbListWidget>
hgs
parents:
diff changeset
    22
#include <HbListWidgetItem>
hgs
parents:
diff changeset
    23
#include <HbAbstractViewItem>
hgs
parents:
diff changeset
    24
#include <HbStringUtil>
hgs
parents:
diff changeset
    25
#include <cmmanagerdefines_shim.h>
hgs
parents:
diff changeset
    26
hgs
parents:
diff changeset
    27
// User includes
hgs
parents:
diff changeset
    28
hgs
parents:
diff changeset
    29
#include "wlanqtutils.h"
hgs
parents:
diff changeset
    30
#include "wlanqtutilsap.h"
hgs
parents:
diff changeset
    31
#include "wlanqtutilsiap.h"
hgs
parents:
diff changeset
    32
hgs
parents:
diff changeset
    33
#include "wlansniffer.h"
hgs
parents:
diff changeset
    34
#include "wlansnifferlistitem.h"
hgs
parents:
diff changeset
    35
#include "wlansnifferlistwidget.h"
hgs
parents:
diff changeset
    36
hgs
parents:
diff changeset
    37
#include "OstTraceDefinitions.h"
hgs
parents:
diff changeset
    38
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents:
diff changeset
    39
#include "wlansnifferlistwidgetTraces.h"
hgs
parents:
diff changeset
    40
#endif
hgs
parents:
diff changeset
    41
hgs
parents:
diff changeset
    42
/*!
hgs
parents:
diff changeset
    43
    \class WlanSnifferListWidget
hgs
parents:
diff changeset
    44
    \brief WLAN Sniffer Custom List Widget implementation. 
hgs
parents:
diff changeset
    45
*/
hgs
parents:
diff changeset
    46
hgs
parents:
diff changeset
    47
// External function prototypes
hgs
parents:
diff changeset
    48
hgs
parents:
diff changeset
    49
// Local constants
hgs
parents:
diff changeset
    50
39
hgs
parents: 31
diff changeset
    51
// ======== LOCAL FUNCTIONS ========
hgs
parents: 31
diff changeset
    52
hgs
parents: 31
diff changeset
    53
/*!
hgs
parents: 31
diff changeset
    54
    String comparator for list view. Used for locale-aware SSID comparison
hgs
parents: 31
diff changeset
    55
    in list view.
hgs
parents: 31
diff changeset
    56
    
hgs
parents: 31
diff changeset
    57
    @param [in] string1 String #1 to compare.
hgs
parents: 31
diff changeset
    58
    @param [in] string2 String #2 to compare.
31
hgs
parents:
diff changeset
    59
39
hgs
parents: 31
diff changeset
    60
    @return Zero (0), if strings are considered to be same,
hgs
parents: 31
diff changeset
    61
            Positive (>0) if string1 is considered to be "greater than" string2. 
hgs
parents: 31
diff changeset
    62
            Negative (<0) if string1 is considered to be "less than" string2. 
hgs
parents: 31
diff changeset
    63
*/
hgs
parents: 31
diff changeset
    64
hgs
parents: 31
diff changeset
    65
static int WlanSsidStringComparator(
hgs
parents: 31
diff changeset
    66
    const QString &string1,
hgs
parents: 31
diff changeset
    67
    const QString &string2)
hgs
parents: 31
diff changeset
    68
{
hgs
parents: 31
diff changeset
    69
    return HbStringUtil::compareC(string1, string2);    
hgs
parents: 31
diff changeset
    70
}
31
hgs
parents:
diff changeset
    71
hgs
parents:
diff changeset
    72
// ======== MEMBER FUNCTIONS ========
hgs
parents:
diff changeset
    73
hgs
parents:
diff changeset
    74
/*!
hgs
parents:
diff changeset
    75
    Constructor.
hgs
parents:
diff changeset
    76
    
hgs
parents:
diff changeset
    77
    @param [in] listWidget List Widget created to customize.
hgs
parents:
diff changeset
    78
*/
hgs
parents:
diff changeset
    79
hgs
parents:
diff changeset
    80
WlanSnifferListWidget::WlanSnifferListWidget(HbListWidget *listWidget) :
hgs
parents:
diff changeset
    81
    mListWidget(listWidget)
hgs
parents:
diff changeset
    82
{
hgs
parents:
diff changeset
    83
    OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_WLANSNIFFERLISTWIDGET_ENTRY);
hgs
parents:
diff changeset
    84
    
hgs
parents:
diff changeset
    85
    // Set custom WLAN list item layout
hgs
parents:
diff changeset
    86
    mListWidget->setLayoutName("wlanlistitem");
39
hgs
parents: 31
diff changeset
    87
31
hgs
parents:
diff changeset
    88
    OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_WLANSNIFFERLISTWIDGET_EXIT);
hgs
parents:
diff changeset
    89
}
hgs
parents:
diff changeset
    90
hgs
parents:
diff changeset
    91
/*!
hgs
parents:
diff changeset
    92
    Destructor.
hgs
parents:
diff changeset
    93
*/
hgs
parents:
diff changeset
    94
hgs
parents:
diff changeset
    95
WlanSnifferListWidget::~WlanSnifferListWidget()
hgs
parents:
diff changeset
    96
{
hgs
parents:
diff changeset
    97
    OstTraceFunctionEntry0(DUP1_WLANSNIFFERLISTWIDGET_WLANSNIFFERLISTWIDGET_ENTRY);
hgs
parents:
diff changeset
    98
    OstTraceFunctionExit0(DUP1_WLANSNIFFERLISTWIDGET_WLANSNIFFERLISTWIDGET_EXIT);
hgs
parents:
diff changeset
    99
}
hgs
parents:
diff changeset
   100
hgs
parents:
diff changeset
   101
/*!
hgs
parents:
diff changeset
   102
    Updates the list widget content with the given IAPs and APs.
hgs
parents:
diff changeset
   103
    
hgs
parents:
diff changeset
   104
    @param [in] iaps New WLAN IAP list.
hgs
parents:
diff changeset
   105
    @param [in] aps New WLAN AP list.
hgs
parents:
diff changeset
   106
    @param [in] connectedIapId IAP ID of the connected WLAN or
hgs
parents:
diff changeset
   107
                IapIdNone if not connected.
hgs
parents:
diff changeset
   108
 */
hgs
parents:
diff changeset
   109
hgs
parents:
diff changeset
   110
void WlanSnifferListWidget::updateContent(
hgs
parents:
diff changeset
   111
    QList< QSharedPointer<WlanQtUtilsIap> > &iaps,
hgs
parents:
diff changeset
   112
    QList< QSharedPointer<WlanQtUtilsAp> > &aps,
hgs
parents:
diff changeset
   113
    int connectedIapId)
hgs
parents:
diff changeset
   114
{
hgs
parents:
diff changeset
   115
    OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_UPDATESCANSTATUS_ENTRY);
hgs
parents:
diff changeset
   116
    
hgs
parents:
diff changeset
   117
    traceListContent();
hgs
parents:
diff changeset
   118
    
hgs
parents:
diff changeset
   119
    // Sort the scan result lists
hgs
parents:
diff changeset
   120
    sortIaps(iaps, connectedIapId);
hgs
parents:
diff changeset
   121
    sortAps(aps);
hgs
parents:
diff changeset
   122
    
hgs
parents:
diff changeset
   123
    // Remove items, which are not present in new IAP or AP lists
hgs
parents:
diff changeset
   124
    removeLostItems(iaps, aps);
hgs
parents:
diff changeset
   125
hgs
parents:
diff changeset
   126
    // Add items, which are only found in the new IAP and AP lists.
hgs
parents:
diff changeset
   127
    // Also update the icons of existing items (connection mode and
hgs
parents:
diff changeset
   128
    // signal strength may have changed)
hgs
parents:
diff changeset
   129
    addDiscoveredItemsAndUpdateRest(iaps, aps, connectedIapId);
hgs
parents:
diff changeset
   130
hgs
parents:
diff changeset
   131
    traceListContent();
hgs
parents:
diff changeset
   132
    
hgs
parents:
diff changeset
   133
    OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_UPDATESCANSTATUS_EXIT);
hgs
parents:
diff changeset
   134
}
hgs
parents:
diff changeset
   135
hgs
parents:
diff changeset
   136
/*!
hgs
parents:
diff changeset
   137
    Scroll the list widget to given row.
hgs
parents:
diff changeset
   138
    
hgs
parents:
diff changeset
   139
    @param [in] row Row to scroll to. Indexing starts from zero. 
hgs
parents:
diff changeset
   140
 */
hgs
parents:
diff changeset
   141
hgs
parents:
diff changeset
   142
void WlanSnifferListWidget::scrollTo(int row)
hgs
parents:
diff changeset
   143
{
hgs
parents:
diff changeset
   144
    OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_SCROLLTO_ENTRY);
hgs
parents:
diff changeset
   145
hgs
parents:
diff changeset
   146
    OstTrace1(
hgs
parents:
diff changeset
   147
        TRACE_NORMAL,
hgs
parents:
diff changeset
   148
        WLANSNIFFERLISTWIDGET_SCROLLTO,
hgs
parents:
diff changeset
   149
        "WlanSnifferListWidget::scrollTo;row=%d",
hgs
parents:
diff changeset
   150
        row);
hgs
parents:
diff changeset
   151
hgs
parents:
diff changeset
   152
    // Check that the row exists
hgs
parents:
diff changeset
   153
    if (row < mListWidget->count()) {
hgs
parents:
diff changeset
   154
        // Do the scrolling
hgs
parents:
diff changeset
   155
        QModelIndex index = mListWidget->model()->index(row, 0);
hgs
parents:
diff changeset
   156
        mListWidget->scrollTo(index);
hgs
parents:
diff changeset
   157
    }
hgs
parents:
diff changeset
   158
hgs
parents:
diff changeset
   159
    OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_SCROLLTO_EXIT);
hgs
parents:
diff changeset
   160
}
hgs
parents:
diff changeset
   161
hgs
parents:
diff changeset
   162
/*!
hgs
parents:
diff changeset
   163
    IAP list sorting. Sorts IAPs into alphabetical order taking localization
hgs
parents:
diff changeset
   164
    into account.
hgs
parents:
diff changeset
   165
    
hgs
parents:
diff changeset
   166
    @param [in,out] iaps WLAN IAP list.
hgs
parents:
diff changeset
   167
    @param [in] connectedIapId IAP ID of the connected WLAN or
hgs
parents:
diff changeset
   168
                IapIdNone if not connected.
hgs
parents:
diff changeset
   169
*/
hgs
parents:
diff changeset
   170
hgs
parents:
diff changeset
   171
void WlanSnifferListWidget::sortIaps(
hgs
parents:
diff changeset
   172
    QList< QSharedPointer<WlanQtUtilsIap> > &iaps,
hgs
parents:
diff changeset
   173
    int connectedIapId)
hgs
parents:
diff changeset
   174
{
hgs
parents:
diff changeset
   175
    OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_SORTIAPS_ENTRY);
hgs
parents:
diff changeset
   176
    
hgs
parents:
diff changeset
   177
    // Order the list by IAP name
hgs
parents:
diff changeset
   178
    qSort(
hgs
parents:
diff changeset
   179
        iaps.begin(),
hgs
parents:
diff changeset
   180
        iaps.end(),
hgs
parents:
diff changeset
   181
        WlanSnifferListWidget::iapLessThan);
hgs
parents:
diff changeset
   182
hgs
parents:
diff changeset
   183
    // Find the possible connected IAP
hgs
parents:
diff changeset
   184
    int connectedIndex = 0;
hgs
parents:
diff changeset
   185
    for (int i = 0; i < iaps.size(); i++) {
hgs
parents:
diff changeset
   186
        if (iaps[i]->value(WlanQtUtilsIap::ConfIdIapId).toInt() == connectedIapId) {
hgs
parents:
diff changeset
   187
            connectedIndex = i;
hgs
parents:
diff changeset
   188
            break;
hgs
parents:
diff changeset
   189
        }
hgs
parents:
diff changeset
   190
    }
hgs
parents:
diff changeset
   191
hgs
parents:
diff changeset
   192
    // Move the possible connected IAP to the beginning
hgs
parents:
diff changeset
   193
    if (connectedIndex) {
hgs
parents:
diff changeset
   194
        OstTraceExt2(
hgs
parents:
diff changeset
   195
            TRACE_NORMAL,
hgs
parents:
diff changeset
   196
            WLANSNIFFERLISTWIDGET_SORTIAPS_MOVE_CONNECTED,
hgs
parents:
diff changeset
   197
            "WlanSnifferListWidget::sortIaps Moving connected IAP to top;connectedIapId=%d;connectedIndex=%d",
hgs
parents:
diff changeset
   198
            connectedIapId,
hgs
parents:
diff changeset
   199
            connectedIndex);
hgs
parents:
diff changeset
   200
        
hgs
parents:
diff changeset
   201
        iaps.move(connectedIndex, 0);
hgs
parents:
diff changeset
   202
    }
hgs
parents:
diff changeset
   203
hgs
parents:
diff changeset
   204
    OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_SORTIAPS_EXIT);
hgs
parents:
diff changeset
   205
}
hgs
parents:
diff changeset
   206
hgs
parents:
diff changeset
   207
/*!
hgs
parents:
diff changeset
   208
    AP list sorting. Sorts APs into alphabetical order taking localization
hgs
parents:
diff changeset
   209
    into account.
hgs
parents:
diff changeset
   210
    
hgs
parents:
diff changeset
   211
    @param [in,out] aps WLAN AP list.
hgs
parents:
diff changeset
   212
*/
hgs
parents:
diff changeset
   213
hgs
parents:
diff changeset
   214
void WlanSnifferListWidget::sortAps(
hgs
parents:
diff changeset
   215
    QList< QSharedPointer<WlanQtUtilsAp> > &aps)
hgs
parents:
diff changeset
   216
{
hgs
parents:
diff changeset
   217
    OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_SORTAPS_ENTRY);
hgs
parents:
diff changeset
   218
    
hgs
parents:
diff changeset
   219
    // Order the list by AP SSID
hgs
parents:
diff changeset
   220
    qSort(
hgs
parents:
diff changeset
   221
        aps.begin(),
hgs
parents:
diff changeset
   222
        aps.end(),
hgs
parents:
diff changeset
   223
        WlanSnifferListWidget::apLessThan);
hgs
parents:
diff changeset
   224
hgs
parents:
diff changeset
   225
    OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_SORTAPS_EXIT);
hgs
parents:
diff changeset
   226
}
hgs
parents:
diff changeset
   227
hgs
parents:
diff changeset
   228
/*!
hgs
parents:
diff changeset
   229
    Compares two WLAN IAPs. Comparison is done with the IAP name.
hgs
parents:
diff changeset
   230
    
hgs
parents:
diff changeset
   231
    @param[in] iap1 IAP to compare with.
hgs
parents:
diff changeset
   232
    @param[in] iap2 IAP to compare.
hgs
parents:
diff changeset
   233
    
hgs
parents:
diff changeset
   234
    @return Returns true if the first iap is "less than" the second one.
hgs
parents:
diff changeset
   235
 */
hgs
parents:
diff changeset
   236
hgs
parents:
diff changeset
   237
bool WlanSnifferListWidget::iapLessThan(
hgs
parents:
diff changeset
   238
    const QSharedPointer<WlanQtUtilsIap> iap1,
hgs
parents:
diff changeset
   239
    const QSharedPointer<WlanQtUtilsIap> iap2)
hgs
parents:
diff changeset
   240
{
hgs
parents:
diff changeset
   241
    // Primary comparison is based on the name
hgs
parents:
diff changeset
   242
    int result = HbStringUtil::compareC(
hgs
parents:
diff changeset
   243
        iap1->value(WlanQtUtilsIap::ConfIdName).toString(),
hgs
parents:
diff changeset
   244
        iap2->value(WlanQtUtilsIap::ConfIdName).toString());
39
hgs
parents: 31
diff changeset
   245
31
hgs
parents:
diff changeset
   246
    return (result < 0) ? true : false;
hgs
parents:
diff changeset
   247
}
hgs
parents:
diff changeset
   248
hgs
parents:
diff changeset
   249
/*!
hgs
parents:
diff changeset
   250
    Compares two WLAN APs. Comparison is done with the AP SSID.
hgs
parents:
diff changeset
   251
    
hgs
parents:
diff changeset
   252
    @param[in] ap1 AP to compare with.
hgs
parents:
diff changeset
   253
    @param[in] ap2 AP to compare.
hgs
parents:
diff changeset
   254
    
hgs
parents:
diff changeset
   255
    @return Returns true if the first ap is "less than" the second one.
hgs
parents:
diff changeset
   256
 */
hgs
parents:
diff changeset
   257
hgs
parents:
diff changeset
   258
bool WlanSnifferListWidget::apLessThan(
hgs
parents:
diff changeset
   259
    const QSharedPointer<WlanQtUtilsAp> ap1,
hgs
parents:
diff changeset
   260
    const QSharedPointer<WlanQtUtilsAp> ap2)
hgs
parents:
diff changeset
   261
{
39
hgs
parents: 31
diff changeset
   262
    // Use AP comparison function with localized SSID comparison
hgs
parents: 31
diff changeset
   263
    int result = WlanQtUtilsAp::compare(
hgs
parents: 31
diff changeset
   264
        ap1.data(),
hgs
parents: 31
diff changeset
   265
        ap2.data(),
hgs
parents: 31
diff changeset
   266
        WlanSsidStringComparator);
hgs
parents: 31
diff changeset
   267
        
31
hgs
parents:
diff changeset
   268
    return (result < 0) ? true : false;
hgs
parents:
diff changeset
   269
}
hgs
parents:
diff changeset
   270
hgs
parents:
diff changeset
   271
/*!
hgs
parents:
diff changeset
   272
    Function for finding the given IAP from the old Wlan list.
hgs
parents:
diff changeset
   273
    
hgs
parents:
diff changeset
   274
    @param [in] iap IAP to find.
hgs
parents:
diff changeset
   275
    
hgs
parents:
diff changeset
   276
    @return Found WLAN List Widget item, 0 if not found.
hgs
parents:
diff changeset
   277
*/
hgs
parents:
diff changeset
   278
hgs
parents:
diff changeset
   279
WlanSnifferListItem *WlanSnifferListWidget::findFromOldList(
hgs
parents:
diff changeset
   280
    QSharedPointer<WlanQtUtilsIap> iap)
hgs
parents:
diff changeset
   281
{
hgs
parents:
diff changeset
   282
    OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_FINDFROMOLDLIST_IAP_ENTRY);
hgs
parents:
diff changeset
   283
hgs
parents:
diff changeset
   284
    WlanSnifferListItem *result = NULL;
hgs
parents:
diff changeset
   285
    QVariant iapData = iap->value(WlanQtUtilsIap::ConfIdIapId);
hgs
parents:
diff changeset
   286
    for (int row = 0; row < mListWidget->count(); row++) {
hgs
parents:
diff changeset
   287
        HbListWidgetItem *item = mListWidget->item(row);
hgs
parents:
diff changeset
   288
        if (item->data() == iapData) {
hgs
parents:
diff changeset
   289
            result = static_cast<WlanSnifferListItem *>(item);
hgs
parents:
diff changeset
   290
            break;
hgs
parents:
diff changeset
   291
        }
hgs
parents:
diff changeset
   292
    }
hgs
parents:
diff changeset
   293
hgs
parents:
diff changeset
   294
    OstTraceExt2(
hgs
parents:
diff changeset
   295
        TRACE_DUMP,
hgs
parents:
diff changeset
   296
        WLANSNIFFERLISTWIDGET_FINDFROMOLDLIST_IAP,
hgs
parents:
diff changeset
   297
        "WlanSnifferListWidget::findFromOldList;iapId=%d;found=%hhu",
hgs
parents:
diff changeset
   298
        iapData.toInt(),
hgs
parents:
diff changeset
   299
        (result != NULL) ? true : false);
hgs
parents:
diff changeset
   300
    
hgs
parents:
diff changeset
   301
    OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_FINDFROMOLDLIST_IAP_EXIT);
hgs
parents:
diff changeset
   302
    return result;
hgs
parents:
diff changeset
   303
}
hgs
parents:
diff changeset
   304
hgs
parents:
diff changeset
   305
/*!
hgs
parents:
diff changeset
   306
    Function for finding the given AP from the old Wlan list.
hgs
parents:
diff changeset
   307
    
hgs
parents:
diff changeset
   308
    @param [in] ap AP to find. 
hgs
parents:
diff changeset
   309
    
hgs
parents:
diff changeset
   310
    @return Found WLAN List Widget item, 0 if not found.
hgs
parents:
diff changeset
   311
*/
hgs
parents:
diff changeset
   312
hgs
parents:
diff changeset
   313
WlanSnifferListItem *WlanSnifferListWidget::findFromOldList(
hgs
parents:
diff changeset
   314
    QSharedPointer<WlanQtUtilsAp> ap)
hgs
parents:
diff changeset
   315
{
hgs
parents:
diff changeset
   316
    OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_FINDFROMOLDLIST_AP_ENTRY);
hgs
parents:
diff changeset
   317
    
hgs
parents:
diff changeset
   318
    WlanSnifferListItem *result = NULL;
hgs
parents:
diff changeset
   319
    for (int row = 0; row < mListWidget->count(); row++) {
hgs
parents:
diff changeset
   320
        HbListWidgetItem *item = mListWidget->item(row);
hgs
parents:
diff changeset
   321
        if (item->data().canConvert<WlanQtUtilsAp>()) {
hgs
parents:
diff changeset
   322
            WlanQtUtilsAp oldAp = item->data().value<WlanQtUtilsAp>();
39
hgs
parents: 31
diff changeset
   323
            if (WlanQtUtilsAp::compare(ap.data(), &oldAp) == 0) {
31
hgs
parents:
diff changeset
   324
                result = static_cast<WlanSnifferListItem *>(item);
hgs
parents:
diff changeset
   325
                break;
hgs
parents:
diff changeset
   326
            }
hgs
parents:
diff changeset
   327
        }
hgs
parents:
diff changeset
   328
    }
hgs
parents:
diff changeset
   329
    
hgs
parents:
diff changeset
   330
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents:
diff changeset
   331
    QString tmp(ap.data()->value(WlanQtUtilsAp::ConfIdSsid).toString());
hgs
parents:
diff changeset
   332
    TPtrC16 ssid(tmp.utf16(), tmp.length());
hgs
parents:
diff changeset
   333
    OstTraceExt2(
hgs
parents:
diff changeset
   334
        TRACE_NORMAL,
hgs
parents:
diff changeset
   335
        WLANSNIFFERLISTWIDGET_FINDFROMOLDLIST_AP,
hgs
parents:
diff changeset
   336
        "WlanSnifferListWidget::findFromOldList;found=%hhu;ssid=%S",
hgs
parents:
diff changeset
   337
        (result != NULL) ? true : false,
hgs
parents:
diff changeset
   338
        ssid);
hgs
parents:
diff changeset
   339
#endif
hgs
parents:
diff changeset
   340
    
hgs
parents:
diff changeset
   341
    OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_FINDFROMOLDLIST_AP_EXIT);
hgs
parents:
diff changeset
   342
    return result;
hgs
parents:
diff changeset
   343
}
hgs
parents:
diff changeset
   344
hgs
parents:
diff changeset
   345
/*!
hgs
parents:
diff changeset
   346
    Function for creating a new list item from the given IAP.
hgs
parents:
diff changeset
   347
    
hgs
parents:
diff changeset
   348
    @param [in] iap WLAN IAP to create.
hgs
parents:
diff changeset
   349
    @param [in] connectedIapId IAP ID of the connected WLAN or
hgs
parents:
diff changeset
   350
                IapIdNone if not connected.
hgs
parents:
diff changeset
   351
    
hgs
parents:
diff changeset
   352
    @return New WLAN List Widget item.
hgs
parents:
diff changeset
   353
*/
hgs
parents:
diff changeset
   354
hgs
parents:
diff changeset
   355
HbListWidgetItem *WlanSnifferListWidget::listItemCreate(
hgs
parents:
diff changeset
   356
    QSharedPointer<WlanQtUtilsIap> iap,
hgs
parents:
diff changeset
   357
    int connectedIapId)
hgs
parents:
diff changeset
   358
{
hgs
parents:
diff changeset
   359
    OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_LISTITEMCREATE_IAP_ENTRY);
hgs
parents:
diff changeset
   360
    
hgs
parents:
diff changeset
   361
    WlanSnifferListItem *item = new WlanSnifferListItem();
hgs
parents:
diff changeset
   362
    item->setNetworkName(iap->value(WlanQtUtilsIap::ConfIdName).toString());
39
hgs
parents: 31
diff changeset
   363
    // Note: WPS icon is needed only in IAP setup, no longer here
31
hgs
parents:
diff changeset
   364
    if (iap->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt() !=
hgs
parents:
diff changeset
   365
        CMManagerShim::WlanSecModeOpen) {
39
hgs
parents: 31
diff changeset
   366
        item->setSecureIcon("qtg_small_lock");
31
hgs
parents:
diff changeset
   367
    }
hgs
parents:
diff changeset
   368
hgs
parents:
diff changeset
   369
    item->setLeftIcon(
hgs
parents:
diff changeset
   370
        leftIconChoose(
hgs
parents:
diff changeset
   371
            iap->value(WlanQtUtilsIap::ConfIdIapId).toInt(),
hgs
parents:
diff changeset
   372
            connectedIapId));
hgs
parents:
diff changeset
   373
    item->setSignalIcon(
hgs
parents:
diff changeset
   374
        signalStrengthIconChoose(
hgs
parents:
diff changeset
   375
            iap->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt()));
hgs
parents:
diff changeset
   376
    
hgs
parents:
diff changeset
   377
    item->setData(iap->value(WlanQtUtilsIap::ConfIdIapId));
hgs
parents:
diff changeset
   378
    
hgs
parents:
diff changeset
   379
    OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_LISTITEMCREATE_IAP_EXIT);
hgs
parents:
diff changeset
   380
    return item;
hgs
parents:
diff changeset
   381
}
hgs
parents:
diff changeset
   382
hgs
parents:
diff changeset
   383
/*!
hgs
parents:
diff changeset
   384
    Function for creating a new list item from the given AP.
hgs
parents:
diff changeset
   385
    
hgs
parents:
diff changeset
   386
    @param [in] ap WLAN AP to create.
hgs
parents:
diff changeset
   387
    
hgs
parents:
diff changeset
   388
    @return New WLAN List Widget item.
hgs
parents:
diff changeset
   389
*/
hgs
parents:
diff changeset
   390
hgs
parents:
diff changeset
   391
HbListWidgetItem *WlanSnifferListWidget::listItemCreate(
hgs
parents:
diff changeset
   392
    QSharedPointer<WlanQtUtilsAp> ap)
hgs
parents:
diff changeset
   393
{
hgs
parents:
diff changeset
   394
    OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_LISTITEMCREATE_AP_ENTRY);
hgs
parents:
diff changeset
   395
    
hgs
parents:
diff changeset
   396
    WlanSnifferListItem *item = new WlanSnifferListItem();
hgs
parents:
diff changeset
   397
    item->setNetworkName(ap->value(WlanQtUtilsAp::ConfIdSsid).toString());
39
hgs
parents: 31
diff changeset
   398
    if (ap->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool()) {
hgs
parents: 31
diff changeset
   399
        // WPS is supported, use a dedicated security icon
hgs
parents: 31
diff changeset
   400
        item->setSecureIcon("qtg_small_wifi");
hgs
parents: 31
diff changeset
   401
    } else if (ap->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt() 
31
hgs
parents:
diff changeset
   402
        != CMManagerShim::WlanSecModeOpen) {
39
hgs
parents: 31
diff changeset
   403
        // Other secure networks
hgs
parents: 31
diff changeset
   404
        item->setSecureIcon("qtg_small_lock");
31
hgs
parents:
diff changeset
   405
    }
hgs
parents:
diff changeset
   406
    item->setSignalIcon(
hgs
parents:
diff changeset
   407
        signalStrengthIconChoose(
hgs
parents:
diff changeset
   408
            ap->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt()));
hgs
parents:
diff changeset
   409
    
hgs
parents:
diff changeset
   410
    QVariant data;
hgs
parents:
diff changeset
   411
    data.setValue(*ap);
hgs
parents:
diff changeset
   412
    item->setData(data);
hgs
parents:
diff changeset
   413
    
hgs
parents:
diff changeset
   414
    OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_LISTITEMCREATE_AP_EXIT);
hgs
parents:
diff changeset
   415
    return item;
hgs
parents:
diff changeset
   416
}
hgs
parents:
diff changeset
   417
hgs
parents:
diff changeset
   418
/*!
hgs
parents:
diff changeset
   419
    Function for selecting the correct signal strength icon.
hgs
parents:
diff changeset
   420
    
hgs
parents:
diff changeset
   421
    @param [in] signalStrength Signal strength.
hgs
parents:
diff changeset
   422
    
hgs
parents:
diff changeset
   423
    @return Signal strength icon logical name.
hgs
parents:
diff changeset
   424
*/
hgs
parents:
diff changeset
   425
hgs
parents:
diff changeset
   426
QString WlanSnifferListWidget::signalStrengthIconChoose(int signalStrength)
hgs
parents:
diff changeset
   427
{
hgs
parents:
diff changeset
   428
    OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_SIGNALSTRENGTHICONCHOOSE_ENTRY);
hgs
parents:
diff changeset
   429
    
hgs
parents:
diff changeset
   430
    QString iconName;
hgs
parents:
diff changeset
   431
    if (signalStrength <= SignalStrengthHigh) {
hgs
parents:
diff changeset
   432
        iconName = "qtg_small_signal_good";
hgs
parents:
diff changeset
   433
    } else if (signalStrength <= SignalStrengthMedium) {
hgs
parents:
diff changeset
   434
        iconName = "qtg_small_signal_medium";
hgs
parents:
diff changeset
   435
    } else {
hgs
parents:
diff changeset
   436
        iconName = "qtg_small_signal_low";
hgs
parents:
diff changeset
   437
    }
hgs
parents:
diff changeset
   438
    
hgs
parents:
diff changeset
   439
    OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_SIGNALSTRENGTHICONCHOOSE_EXIT);
hgs
parents:
diff changeset
   440
    return iconName;
hgs
parents:
diff changeset
   441
}
hgs
parents:
diff changeset
   442
hgs
parents:
diff changeset
   443
/*!
hgs
parents:
diff changeset
   444
    Function for selecting the correct "left" icon, which is different for
hgs
parents:
diff changeset
   445
    connected and not connected IAPs.
hgs
parents:
diff changeset
   446
    
hgs
parents:
diff changeset
   447
    @param [in] iapId IAP ID of the WLAN IAP.
hgs
parents:
diff changeset
   448
    @param [in] connectedIapId IAP ID of the connected WLAN or
hgs
parents:
diff changeset
   449
                IapIdNone if not connected.
hgs
parents:
diff changeset
   450
                
hgs
parents:
diff changeset
   451
    @return Icon logical name of the "left" icon.
hgs
parents:
diff changeset
   452
*/
hgs
parents:
diff changeset
   453
hgs
parents:
diff changeset
   454
QString WlanSnifferListWidget::leftIconChoose(
hgs
parents:
diff changeset
   455
    int iapId,
hgs
parents:
diff changeset
   456
    int connectedIapId)
hgs
parents:
diff changeset
   457
{
hgs
parents:
diff changeset
   458
    OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_LEFTICONCHOOSE_ENTRY);
hgs
parents:
diff changeset
   459
    
hgs
parents:
diff changeset
   460
    QString iconName;
hgs
parents:
diff changeset
   461
    if (iapId == connectedIapId) {
hgs
parents:
diff changeset
   462
        iconName = "qtg_small_connection";
hgs
parents:
diff changeset
   463
    } else {
hgs
parents:
diff changeset
   464
        iconName = "qtg_small_wlan";
hgs
parents:
diff changeset
   465
    }
hgs
parents:
diff changeset
   466
    
hgs
parents:
diff changeset
   467
    OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_LEFTICONCHOOSE_EXIT);
hgs
parents:
diff changeset
   468
    return iconName;
hgs
parents:
diff changeset
   469
}
hgs
parents:
diff changeset
   470
hgs
parents:
diff changeset
   471
/*!
hgs
parents:
diff changeset
   472
    Function for removing from the old Wlan list those items, which are
hgs
parents:
diff changeset
   473
    not present in the given new lists.
hgs
parents:
diff changeset
   474
    
hgs
parents:
diff changeset
   475
    @param [in] iaps New WLAN IAP list.
hgs
parents:
diff changeset
   476
    @param [in] aps New WLAN AP list.
hgs
parents:
diff changeset
   477
*/
hgs
parents:
diff changeset
   478
hgs
parents:
diff changeset
   479
void WlanSnifferListWidget::removeLostItems(
hgs
parents:
diff changeset
   480
    const QList< QSharedPointer<WlanQtUtilsIap> > &iaps,
hgs
parents:
diff changeset
   481
    const QList< QSharedPointer<WlanQtUtilsAp> > &aps)
hgs
parents:
diff changeset
   482
{
hgs
parents:
diff changeset
   483
    OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_REMOVELOSTITEMS_ENTRY);
hgs
parents:
diff changeset
   484
    
hgs
parents:
diff changeset
   485
    int row = 0;
hgs
parents:
diff changeset
   486
    // Loop through all rows in the current list and try to find the items from
hgs
parents:
diff changeset
   487
    // the new lists
hgs
parents:
diff changeset
   488
    while (row < mListWidget->count()) {
hgs
parents:
diff changeset
   489
        bool found = false;
hgs
parents:
diff changeset
   490
        const HbListWidgetItem *item = mListWidget->item(row);
hgs
parents:
diff changeset
   491
        if (item->data().canConvert<int>()) {
hgs
parents:
diff changeset
   492
            // Item was an IAP, try to find it from the new IAP list
hgs
parents:
diff changeset
   493
            foreach (QSharedPointer<WlanQtUtilsIap> iap, iaps) {
hgs
parents:
diff changeset
   494
                if (iap->value(WlanQtUtilsIap::ConfIdIapId) == 
hgs
parents:
diff changeset
   495
                    item->data()) {
hgs
parents:
diff changeset
   496
                    found = true;
hgs
parents:
diff changeset
   497
                    break;
hgs
parents:
diff changeset
   498
                }
hgs
parents:
diff changeset
   499
            }
hgs
parents:
diff changeset
   500
        } else {
hgs
parents:
diff changeset
   501
            // Item has to be an AP, try to find it from the new AP list
hgs
parents:
diff changeset
   502
            Q_ASSERT(item->data().canConvert<WlanQtUtilsAp>());
hgs
parents:
diff changeset
   503
            WlanQtUtilsAp oldAp = item->data().value<WlanQtUtilsAp>();
hgs
parents:
diff changeset
   504
            foreach (QSharedPointer<WlanQtUtilsAp> newAp, aps) {
39
hgs
parents: 31
diff changeset
   505
                if (WlanQtUtilsAp::compare(newAp.data(), &oldAp) == 0) {
31
hgs
parents:
diff changeset
   506
                    found = true;
hgs
parents:
diff changeset
   507
                    break;
hgs
parents:
diff changeset
   508
                }
hgs
parents:
diff changeset
   509
            }
hgs
parents:
diff changeset
   510
        }
hgs
parents:
diff changeset
   511
        if (found == false) {
hgs
parents:
diff changeset
   512
            // Item was lost. Remove this row and delete it. Don't increment
hgs
parents:
diff changeset
   513
            // row index, because the next item now has the same row index
hgs
parents:
diff changeset
   514
            // as this one had
hgs
parents:
diff changeset
   515
            delete mListWidget->takeItem(row);
hgs
parents:
diff changeset
   516
hgs
parents:
diff changeset
   517
            OstTrace1(
hgs
parents:
diff changeset
   518
                TRACE_NORMAL,
hgs
parents:
diff changeset
   519
                WLANSNIFFERLISTWIDGET_REMOVELOSTITEMS,
hgs
parents:
diff changeset
   520
                "WlanSnifferListWidget::removeLostItems Removed;row=%d",
hgs
parents:
diff changeset
   521
                row);
hgs
parents:
diff changeset
   522
        } else {
hgs
parents:
diff changeset
   523
            // Item still exists, move on to next row
hgs
parents:
diff changeset
   524
            row++;
hgs
parents:
diff changeset
   525
        }
hgs
parents:
diff changeset
   526
    }
39
hgs
parents: 31
diff changeset
   527
31
hgs
parents:
diff changeset
   528
    OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_REMOVELOSTITEMS_EXIT);
hgs
parents:
diff changeset
   529
}
hgs
parents:
diff changeset
   530
hgs
parents:
diff changeset
   531
/*!
hgs
parents:
diff changeset
   532
    Function for adding to the Wlan list those items, which are new
hgs
parents:
diff changeset
   533
    in the given new lists. Also, icons and order of the existing list
hgs
parents:
diff changeset
   534
    items are updated.
hgs
parents:
diff changeset
   535
    
hgs
parents:
diff changeset
   536
    @param [in] iaps New WLAN IAP list.
hgs
parents:
diff changeset
   537
    @param [in] aps New WLAN AP list.
hgs
parents:
diff changeset
   538
    @param [in] connectedIapId IAP ID of the connected WLAN or
hgs
parents:
diff changeset
   539
                IapIdNone if not connected.
hgs
parents:
diff changeset
   540
*/
hgs
parents:
diff changeset
   541
hgs
parents:
diff changeset
   542
void WlanSnifferListWidget::addDiscoveredItemsAndUpdateRest(
hgs
parents:
diff changeset
   543
    const QList< QSharedPointer<WlanQtUtilsIap> > &iaps,
hgs
parents:
diff changeset
   544
    const QList< QSharedPointer<WlanQtUtilsAp> > &aps,
hgs
parents:
diff changeset
   545
    int connectedIapId)
hgs
parents:
diff changeset
   546
{
hgs
parents:
diff changeset
   547
    OstTraceFunctionEntry0(WLANSNIFFERLISTWIDGET_ADDDISCOVEREDITEMSANDUPDATEREST_ENTRY);
hgs
parents:
diff changeset
   548
    
hgs
parents:
diff changeset
   549
    int row = 0;
hgs
parents:
diff changeset
   550
    // Loop through new IAPs and try to find them from the old list
hgs
parents:
diff changeset
   551
    foreach (QSharedPointer<WlanQtUtilsIap> newIap, iaps) {
hgs
parents:
diff changeset
   552
        WlanSnifferListItem *oldItem = findFromOldList(newIap);
hgs
parents:
diff changeset
   553
        if (oldItem != NULL) {
hgs
parents:
diff changeset
   554
            // Match found, update icons
hgs
parents:
diff changeset
   555
            oldItem->setLeftIcon(
hgs
parents:
diff changeset
   556
                leftIconChoose(
hgs
parents:
diff changeset
   557
                    newIap->value(WlanQtUtilsIap::ConfIdIapId).toInt(),
hgs
parents:
diff changeset
   558
                    connectedIapId));
hgs
parents:
diff changeset
   559
            oldItem->setSignalIcon(
hgs
parents:
diff changeset
   560
                signalStrengthIconChoose(
hgs
parents:
diff changeset
   561
                    newIap->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt()));
hgs
parents:
diff changeset
   562
            // Also move the IAP to new row, if necessary (IAP order changes
hgs
parents:
diff changeset
   563
            // when IAPs are connected/disconnected)
hgs
parents:
diff changeset
   564
            int oldRow = mListWidget->row(oldItem);
hgs
parents:
diff changeset
   565
            if (row != oldRow) {
hgs
parents:
diff changeset
   566
                OstTraceExt2(
hgs
parents:
diff changeset
   567
                    TRACE_NORMAL,
hgs
parents:
diff changeset
   568
                    WLANSNIFFERLISTWIDGET_ADDDISCOVEREDITEMSANDUPDATEREST_MOVE,
hgs
parents:
diff changeset
   569
                    "WlanSnifferListWidget::addDiscoveredItemsAndUpdateRest Moved;oldRow=%d;row=%d",
hgs
parents:
diff changeset
   570
                    oldRow,
hgs
parents:
diff changeset
   571
                    row);
hgs
parents:
diff changeset
   572
                mListWidget->takeItem(oldRow);
hgs
parents:
diff changeset
   573
                mListWidget->insertItem(row, oldItem);
hgs
parents:
diff changeset
   574
            }
hgs
parents:
diff changeset
   575
        } else {
hgs
parents:
diff changeset
   576
            // New item discovered, add it to the list. Row is the same as the
hgs
parents:
diff changeset
   577
            // index of the item in the new scan list
hgs
parents:
diff changeset
   578
            OstTrace1(
hgs
parents:
diff changeset
   579
                TRACE_NORMAL,
hgs
parents:
diff changeset
   580
                WLANSNIFFERLISTWIDGET_ADDDISCOVEREDITEMSANDUPDATEREST_ADD_IAP,
hgs
parents:
diff changeset
   581
                "WlanSnifferListWidget::addDiscoveredItemsAndUpdateRest Added IAP;row=%d",
hgs
parents:
diff changeset
   582
                row);
hgs
parents:
diff changeset
   583
            mListWidget->insertItem(row, listItemCreate(newIap, connectedIapId));
hgs
parents:
diff changeset
   584
        }
hgs
parents:
diff changeset
   585
        // Move to next row
hgs
parents:
diff changeset
   586
        row++;
hgs
parents:
diff changeset
   587
    }
hgs
parents:
diff changeset
   588
    // Repeat the same for new APs. Notice that row index continues from
hgs
parents:
diff changeset
   589
    // previous loop
hgs
parents:
diff changeset
   590
    foreach (QSharedPointer<WlanQtUtilsAp> newAp, aps) {
hgs
parents:
diff changeset
   591
        WlanSnifferListItem *oldItem = findFromOldList(newAp);
hgs
parents:
diff changeset
   592
        if (oldItem != NULL) {
hgs
parents:
diff changeset
   593
            oldItem->setSignalIcon(
hgs
parents:
diff changeset
   594
                signalStrengthIconChoose(
hgs
parents:
diff changeset
   595
                    newAp->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt()));
hgs
parents:
diff changeset
   596
            // Notice that AP order may not change, they are always in
hgs
parents:
diff changeset
   597
            // alphabetical order
hgs
parents:
diff changeset
   598
        } else {
hgs
parents:
diff changeset
   599
            OstTrace1(
hgs
parents:
diff changeset
   600
                TRACE_NORMAL,
hgs
parents:
diff changeset
   601
                WLANSNIFFERLISTWIDGET_ADDDISCOVEREDITEMSANDUPDATEREST_ADD_AP,
hgs
parents:
diff changeset
   602
                "WlanSnifferListWidget::addDiscoveredItemsAndUpdateRest Added AP;row=%d",
hgs
parents:
diff changeset
   603
                row);
hgs
parents:
diff changeset
   604
            mListWidget->insertItem(row, listItemCreate(newAp));
hgs
parents:
diff changeset
   605
        }
hgs
parents:
diff changeset
   606
        row++;
hgs
parents:
diff changeset
   607
    }
hgs
parents:
diff changeset
   608
    
hgs
parents:
diff changeset
   609
    OstTraceFunctionExit0(WLANSNIFFERLISTWIDGET_ADDDISCOVEREDITEMSANDUPDATEREST_EXIT);
hgs
parents:
diff changeset
   610
}
hgs
parents:
diff changeset
   611
hgs
parents:
diff changeset
   612
/*!
hgs
parents:
diff changeset
   613
    This function traces the contents of the list.
hgs
parents:
diff changeset
   614
*/
hgs
parents:
diff changeset
   615
hgs
parents:
diff changeset
   616
void WlanSnifferListWidget::traceListContent() const
hgs
parents:
diff changeset
   617
{
hgs
parents:
diff changeset
   618
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents:
diff changeset
   619
    for (int row = 0; row < mListWidget->count(); row++) {
hgs
parents:
diff changeset
   620
        HbListWidgetItem *item = mListWidget->item(row);
hgs
parents:
diff changeset
   621
        if (item->data().canConvert<int>()) {
hgs
parents:
diff changeset
   622
            OstTraceExt2(
hgs
parents:
diff changeset
   623
                TRACE_DUMP,
hgs
parents:
diff changeset
   624
                WLANSNIFFERLISTWIDGET_TRACELISTCONTENT_IAP,
hgs
parents:
diff changeset
   625
                "WlanSnifferListWidget::traceListContent IAP;row=%d;id=%d",
hgs
parents:
diff changeset
   626
                row,
hgs
parents:
diff changeset
   627
                item->data().toInt());
hgs
parents:
diff changeset
   628
        } else {
hgs
parents:
diff changeset
   629
            Q_ASSERT(item->data().canConvert<WlanQtUtilsAp>());
hgs
parents:
diff changeset
   630
            WlanQtUtilsAp ap = item->data().value<WlanQtUtilsAp>();
hgs
parents:
diff changeset
   631
            QString tmp(ap.value(WlanQtUtilsAp::ConfIdSsid).toString());
hgs
parents:
diff changeset
   632
            TPtrC16 ssid(tmp.utf16(), tmp.length());
hgs
parents:
diff changeset
   633
            OstTraceExt2(
hgs
parents:
diff changeset
   634
                TRACE_DUMP,
hgs
parents:
diff changeset
   635
                WLANSNIFFERLISTWIDGET_TRACELISTCONTENT_AP,
hgs
parents:
diff changeset
   636
                "WlanSnifferListWidget::traceListContent AP;row=%d;ssid=%S",
hgs
parents:
diff changeset
   637
                row,
hgs
parents:
diff changeset
   638
                ssid);
hgs
parents:
diff changeset
   639
        }
hgs
parents:
diff changeset
   640
    }
hgs
parents:
diff changeset
   641
#endif
hgs
parents:
diff changeset
   642
}