commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp
changeset 23 493788a4a8a4
parent 0 95b198f216e5
child 29 3bdc3b853094
--- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp	Tue Feb 02 00:21:44 2010 +0200
+++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrAppUi.cpp	Fri Apr 16 15:14:55 2010 +0300
@@ -17,19 +17,19 @@
 
 
 // INCLUDE FILES
-#include <dcfrep.h>
-#include <dcfentry.h>
-#include <drmcommon.h>
-#include <dcfcommon.h>
+#include <DcfRep.h>
+#include <DcfEntry.h>
+#include <DRMCommon.h>
+#include <DcfCommon.h>
 #include <wmdrmagent.h> // for WMDRM file details view
 
-#include <drmrightsmanager.rsg>
+#include <DRMRightsManager.rsg>
 
-#include <aknwaitdialog.h>
+#include <AknWaitDialog.h>
 #include <aknlistquerydialog.h>
-#include <stringloader.h>
+#include <StringLoader.h>
 #include <aknnavide.h>
-#include <akndef.h>
+#include <AknDef.h>
 #include <barsread.h>  // for resource reader
 #include <centralrepository.h>
 #include <coeutils.h>
@@ -43,16 +43,16 @@
 #include <caf/data.h>
 #include <caf/caftypes.h>
 
-#include "drmrightsmgrappui.h"
-#include "drmrightsmgrdetailsview.h"
-#include "drmrightsmgrdocument.h"
-#include "drmcommonutilities.h"
-#include "drmuilogger.h"
-#include "drmrightsmanagerprivatecrkeys.h"
-#include "drmclockclient.h"
+#include "DRMRightsMgrAppUi.h"
+#include "DRMRightsMgrDetailsView.h"
+#include "DRMRightsMgrDocument.h"
+#include "DRMCommonUtilities.h"
+#include "DRMUILogger.h"
+#include "DRMRightsManagerPrivateCRKeys.h"
+#include "DRMClockClient.h"
 #include "drmutilityinternaltypes.h"
 
-#include "oma1dcf.h"
+#include "Oma1Dcf.h"
 #include "oma2dcf.h"
 // CONSTANTS
 _LIT8( Kflk, "flk:" );
@@ -83,13 +83,13 @@
 void CDRMRightsMgrAppUi::ConstructL()
     {
     CLOG_WRITE( "-->ConstructL" );
-    
+
     iCoeEnv->AddForegroundObserverL( *this );
-    
+
     CDRMRightsMgrDetailsView* detailsView( NULL );
 
-    BaseConstructL( EAknEnableSkin | EAppOrientationAutomatic | 
-    	EAknEnableMSK | EAknSingleClickCompatible  );
+    BaseConstructL( EAknEnableSkin | EAppOrientationAutomatic |
+        EAknEnableMSK | EAknSingleClickCompatible  );
 
     User::LeaveIfError( iRightsClient.Connect() );
     iDRMCommon = DRMCommon::NewL();
@@ -121,9 +121,9 @@
 //
 CDRMRightsMgrAppUi::~CDRMRightsMgrAppUi()
     {
-    
+
     iCoeEnv->RemoveForegroundObserver( *this );
-    
+
     delete iWaitDialog;
 
     delete iDRMCommon;
@@ -134,12 +134,12 @@
         {
         iDoorObserver->NotifyExit( MApaEmbeddedDocObserver::ENoChanges );
         }
-        
+
     if ( iContentURI )
         {
         delete iContentURI;
         }
-        
+
     }
 
 
@@ -200,7 +200,7 @@
                                                const TInt aDrmScheme )
     {
 
-    // Store the content related information when the details view 
+    // Store the content related information when the details view
     // is to be shown for the first time so that the information will be
     // available for details view refreshing in the future.
     if ( !iContentURI )
@@ -209,7 +209,7 @@
         iLocalID = aLocalID;
         iContentURI = aContentURI.AllocL();
         }
-    
+
     // For storing WM DRM rights information
     ContentAccess::RStreamablePtrArray<ContentAccess::CRightsInfo> array;
     CleanupClosePushL( array );
@@ -231,7 +231,7 @@
         {
         case EDrmSchemeOmaDrm:
             CheckOmaDrmRightsL( aContentURI, aLocalID, rights, status );
-            if ( status ) 
+            if ( status < 0 )
                 {
                 rights = NULL;
                 }
@@ -331,6 +331,7 @@
                                        const TBool aIsGroup )
     {
     CDcfCommon* dcf = NULL;
+    HBufC8* buffer( NULL );
     TBool getName = ETrue;
     TParse parse;
 
@@ -356,19 +357,52 @@
 
         if ( err == KErrNotFound || itemNameBuf->Length() == 0 )
             {
-            if ( aIsGroup )
+            // Do not show name if group rights or forward lock
+            if ( !aIsGroup )
                 {
-                aItemName = aFullName;
-                }
-            else
-                {
-                parse.Set( aFullName, NULL, NULL );
-                aItemName = parse.NameAndExt();
+                if ( ( iRightsClient.ForwardLockURI( buffer ) ==
+                        KErrNone ) && buffer )
+                    {
+
+                    // Not forward lock
+                    if ( aID.Compare( *buffer ) != 0 )
+                        {
+                        parse.Set( aFullName, NULL, NULL );
+                        aItemName = parse.NameAndExt();
+                        }
+                    delete buffer;
+                    buffer = NULL;
+
+                    }
+                else
+                    {
+                    parse.Set( aFullName, NULL, NULL );
+                    aItemName = parse.NameAndExt();
+                    }
                 }
             }
         else if ( err == KErrNone )
             {
-            aItemName = *itemNameBuf;
+            // Forward lock or combined delivery
+            // If forward lock, do not show name
+            if ( iRightsClient.ForwardLockURI( buffer ) == KErrNone &&
+                    buffer )
+                {
+                if ( aID.Compare( *buffer ) != 0 )
+                    {
+                    // Combined delivery
+                    aItemName = *itemNameBuf;
+                    }
+                delete buffer;
+                }
+            else
+                {
+                // Do not show name if having group rights
+                if ( !aIsGroup )
+                    {
+                    aItemName = *itemNameBuf;
+                    }
+                }
             }
         else
             {
@@ -523,7 +557,7 @@
     // from the background to the foreground.
     if ( iForegroundHasBeenActive && iContentURI )
         {
-        StartOnlyForDetailsL( iContentURI->Des(), iLocalID, 
+        StartOnlyForDetailsL( iContentURI->Des(), iLocalID,
             iStartEmbedded, iDrmScheme );
         }
     }
@@ -720,11 +754,21 @@
             if ( entry )
                 {
                 fullName = entry->FileName();
-                delete entry;
                 SetSelectedItemFullName( fullName );
 
                 TFileName itemName;
-                GetItemNameL( fullName, itemName, aContentURI, EFalse );
+
+                if ( entry->GroupId().Length() > 0 )
+                    {
+                    GetItemNameL( fullName, itemName, aContentURI, ETrue );
+                    }
+                else
+                    {
+                    GetItemNameL( fullName, itemName, aContentURI, EFalse );
+                    }
+
+                delete entry;
+
                 SetSelectedItemName( itemName );
 
                 if ( GetItemDataL( fullName, aContentURI, listable,
@@ -738,6 +782,7 @@
             {
             SetSelectedItemFullName( KNullDesC );
             TFileName itemName;
+            // Treat in GetItemNameL as if having group rights
             GetItemNameL( KNullDesC, itemName, aContentURI, ETrue );
             SetSelectedItemName( itemName );
 
@@ -753,15 +798,15 @@
         {
         aStatus = iDRMCommon->GetSingleRightsObject( aContentURI,
             aLocalID, aRights );
+        if ( aStatus )
+            {
+            aRights = NULL;
+            }
         }
-        else
+    else
         {
         aStatus = iDRMCommon->GetActiveRights( aContentURI, 0, aRights );
         }
-    if ( aStatus )
-        {
-        aRights = NULL;
-        }
 
     CheckIndividualConstraint( aContentURI, individualConstraint, usageAllowed );
     SetSelectedIndividualConstraint( individualConstraint );