taskswitcher/server/src/tsservicesproviderconfig.cpp
author Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
Thu, 16 Sep 2010 12:11:40 +0100
changeset 117 c63ee96dbe5f
permissions -rw-r--r--
Missing activityfw and taskswitcher components - fix for Bug 3670
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
117
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
     1
/*
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
     8
*
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    11
*
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    12
* Contributors:
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    13
*
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    14
* Description:
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    15
*
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    16
*/
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    17
#include <xqconversions.h>
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    18
#include <qservicemanager.h>
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    19
#include "tsservicesproviderconfig.h"
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    20
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    21
const char ServicesInterface [] = "com.nokia.qt.taskswitcher.dataprovider";
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    22
// -----------------------------------------------------------------------------
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    23
CTsServiceProviderConfig* CTsServiceProviderConfig::NewLC()
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    24
{
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    25
    CTsServiceProviderConfig *self = new (ELeave)CTsServiceProviderConfig();
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    26
    CleanupStack::PushL(self);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    27
    self->ConstructL();
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    28
    return self;
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    29
}
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    30
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    31
// -----------------------------------------------------------------------------
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    32
CTsServiceProviderConfig::CTsServiceProviderConfig()
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    33
{
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    34
    //No implementation required
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    35
}
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    36
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    37
// -----------------------------------------------------------------------------
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    38
void CTsServiceProviderConfig::ConstructL()
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    39
{
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    40
    QTM_NAMESPACE::QServiceInterfaceDescriptor *ptr(0);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    41
    //QT_TRYCATCH_LEAVING(
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    42
       QTM_NAMESPACE::QServiceManager serviceManager;
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    43
       const QList<QTM_NAMESPACE::QServiceInterfaceDescriptor> serivces(serviceManager.findInterfaces(QTM_NAMESPACE::QServiceFilter(ServicesInterface)));
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    44
       foreach(QTM_NAMESPACE::QServiceInterfaceDescriptor serviceImplementation, serivces) {
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    45
           ptr = new QTM_NAMESPACE::QServiceInterfaceDescriptor(serviceImplementation);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    46
           if(0 != ptr) {
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    47
               if(KErrNone != mServices.Append(ptr)) {
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    48
                   delete ptr;
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    49
               }
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    50
           }
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    51
       }
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    52
   //)
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    53
}
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    54
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    55
// -----------------------------------------------------------------------------
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    56
CTsServiceProviderConfig::~CTsServiceProviderConfig()
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    57
{
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    58
    for(TInt iter(0); iter < mServices.Count(); ++iter){
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    59
        delete static_cast<QTM_NAMESPACE::QServiceInterfaceDescriptor *>(mServices[iter]);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    60
    }
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    61
    mServices.Close();
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    62
}
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    63
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    64
// -----------------------------------------------------------------------------
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    65
TInt CTsServiceProviderConfig::count() const
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    66
{
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    67
    return mServices.Count();
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    68
}
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    69
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    70
// -----------------------------------------------------------------------------
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    71
QObject* CTsServiceProviderConfig::loadL(TInt offset)const
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    72
{
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    73
    const QTM_NAMESPACE::QServiceInterfaceDescriptor *service
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    74
        = static_cast<QTM_NAMESPACE::QServiceInterfaceDescriptor *>(mServices[offset]);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    75
    QObject *retVal(0);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    76
    QT_TRYCATCH_LEAVING(
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    77
    QTM_NAMESPACE::QServiceManager serviceManager;
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    78
    retVal = serviceManager.loadInterface(*service);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    79
     );
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    80
    User::LeaveIfNull(retVal);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    81
    return retVal;
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    82
}