taskswitcher/server/inc/tsdatalist.h
changeset 117 c63ee96dbe5f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/server/inc/tsdatalist.h	Thu Sep 16 12:11:40 2010 +0100
@@ -0,0 +1,116 @@
+/*
+* 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