taskswitcher/server/inc/tsdatalist.h
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

/*
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Non-closeable app list class
 *
*/


#ifndef TSDATALIST_H
#define TSDATALIST_H

#include <e32base.h>
#include <tswindowgroupsobserver.h>
#include "tsentry.h"
#include "tsdatastorage.h"
#include "tsdataobserver.h"
#include <HbIcon>

class CApaWindowGroupName;
class CFbsBitmap;

NONSHARABLE_CLASS( CTsDataList ) : public CTsWindowGroupsObserver,
                                   public MTsDataStorage
    {
public:
    static CTsDataList* NewL(MTsResourceManager& resources, 
                             MTsWindowGroupsMonitor &monitor, 
                             MTsDataObserver& observer);

    ~CTsDataList();

private:
    CTsDataList(MTsResourceManager& resources,
                MTsWindowGroupsMonitor &monitor, 
                MTsDataObserver& observer);

    void ConstructL();

public:
    const RTsFswArray& Data() const;

    void HandleWindowGroupChanged(MTsResourceManager &,
                                  const TArray<RWsSession::TWindowGroupChainInfo> &);

    TBool IsHiddenUid( TUid uid );

    TBool isSupported(TInt function) const;
    void handleDataL(TInt function,RReadStream& dataStream);

private:
    void registerScreenshotL(RReadStream& dataStream);
    void unregisterScreenshotL(RReadStream& dataStream);
    void changeVisibilityL(RReadStream& dataStream);
    void CollectAppsL(RTsFswArray& appsList,
                      const TArray<RWsSession::TWindowGroupChainInfo> &wgList);

    void AddEntryL(const TTsEntryKey& key, 
                   const TUid& appUid,
                   CApaWindowGroupName* wgName,
                   RTsFswArray& newList );

    TBool ConsiderOldDataL( const TTsEntryKey& key );

    HBufC* FindAppNameLC(CApaWindowGroupName* windowName,
                         const TUid& appUid,
                         TInt wgId );

    void FitDataToList( RTsFswArray& listToFit);

    TBool CheckIfExists(const CTsEntry& entry,
                        const RTsFswArray& newList) const;

    CFbsBitmap* GetAppIconL(const TUid& aAppUid);

    TInt FindEntry(const RTsFswArray& list, const TTsEntryKey& key ) const;

    TBool EstablishOrder(const RArray<TTsEntryKey>& keyList);

    TTsEntryKey GenerateKeyL(TInt);
    
    void HideEntryIfNotAllowed(CTsEntry* entry);
    
    TBool UpdateEntryData(const RTsFswArray& list);

    void RebuildVisibleDataListL();
    
    CFbsBitmap* HbIcon2CFbsBitmapL(const HbIcon& icon);
private:
    /**
     * Resource manager. Not own
     */
    MTsResourceManager& mResources;
    
    MTsDataObserver &mObserver;
    
    RTsFswArray mData; // current fsw content, i.e. the task list
    RTsFswArray mVisibleData;

    // list of hidden uids
    RArray<TUid> mHiddenUids;
    
    // default icon
    CFbsBitmap* mDefaultIcon;
    };

#endif //TSDATALIST_H