taskswitcher/server/src/tsscreenshotprovider.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 <s32mem.h>
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    18
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    19
#include "tsscreenshotprovider.h"
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    20
#include "tstaskmonitorglobals.h"
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    21
#include "tsscreenshotmsg.h"
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
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    24
const TUid KPluginUID = {0x200267AE};
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    25
// -----------------------------------------------------------------------------
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    26
//
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    27
// -----------------------------------------------------------------------------
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    28
//
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    29
CTsScreenshotProvider* CTsScreenshotProvider::NewL(MTsDataStorage& storage)
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
    CTsScreenshotProvider *self = new (ELeave)CTsScreenshotProvider(storage);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    32
    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
    33
    self->BaseConstructL(KPluginUID, KNullDesC8);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    34
    CleanupStack::Pop(self);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    35
    return self;
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
// -----------------------------------------------------------------------------
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
// -----------------------------------------------------------------------------
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    41
//
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    42
CTsScreenshotProvider::CTsScreenshotProvider(MTsDataStorage& storage)
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    43
:
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    44
mStorage(storage)
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    45
{}
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    46
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    47
// -----------------------------------------------------------------------------
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    48
//
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
void CTsScreenshotProvider::HandleMessage(const TDesC8& msg)
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
    TRAP_IGNORE(HandleMessageL(msg));
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
// -----------------------------------------------------------------------------
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
// -----------------------------------------------------------------------------
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    59
//
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    60
void CTsScreenshotProvider::HandleMessageL(const TDesC8& msg)
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    61
{
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    62
    RDesReadStream msgStream(msg);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    63
    CleanupClosePushL(msgStream);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    64
    if(RegisterScreenshotMessage != msgStream.ReadInt32L()) {
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    65
        User::Leave(KErrNotSupported);
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
    
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    68
    //parse msg to ACK provider ASAP and be sure that bitmap still exists
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    69
    CTsScreenshotMsg* screenshotMsg = CTsScreenshotMsg::NewLC(msgStream); 
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    70
    SendMessage(msg);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    71
    
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    72
    //reset stream
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    73
    msgStream.Close();
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    74
    msgStream.Open(msg);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    75
    
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    76
    //forward stream to storage
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    77
    mStorage.handleDataL(msgStream.ReadInt32L(), msgStream);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    78
    
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    79
    CleanupStack::PopAndDestroy(screenshotMsg);//
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    80
    CleanupStack::PopAndDestroy(&msgStream);
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    81
}
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    82
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    83
// -----------------------------------------------------------------------------
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    84
//
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    85
// -----------------------------------------------------------------------------
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    86
//
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    87
void CTsScreenshotProvider::OnReplace()
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    88
{
c63ee96dbe5f Missing activityfw and taskswitcher components - fix for Bug 3670
Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
parents:
diff changeset
    89
    //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
    90
}