ui/commandhandlers/commoncommandhandlers/src/glxcommandhandlerrename.cpp
changeset 72 0a8e959402e5
parent 62 36d93b4dc635
equal deleted inserted replaced
71:27f2d7aec52a 72:0a8e959402e5
    98 
    98 
    99             if (!isFileExist)
    99             if (!isFileExist)
   100                 {
   100                 {
   101                 //rename the media
   101                 //rename the media
   102                 TInt error = manager->RenameFile(media.Uri(), *modifiedName);
   102                 TInt error = manager->RenameFile(media.Uri(), *modifiedName);
   103 
   103 				//reset the flag to 'false'!
   104                 if (error == KErrNone)
   104                 iIsCmdActive = false;
       
   105                 
       
   106 				/*
       
   107 				1. Photos renames the file with file system services
       
   108                 2. Photos tries to update the title of the renamed images
       
   109                 -> Image object is opened for modifications
       
   110                 3. MDS gets notification from the file server that the image has been renamed
       
   111                 -> Handling this fails with -22 KErrLocked as the same object is opened
       
   112                 by Photos for changing the title
       
   113                 -> MDS cannot update the the URI or Title for locked object
       
   114                 4. Photos completes updating the title
       
   115                 -> title for xxx.jpg is set as A, but the uri is still xxx.jpg in
       
   116                 MDS DB as MDS could not modify the object--
       
   117 				So Removing the manually changing of the title completely.
       
   118 				As MDS will update the title field automatically if it was originally
       
   119 				populated from the uri, changing the title manually after rename is complitely
       
   120 				unnecessary anyway. So let MDS do the updating by itself as it should,
       
   121 				and you will still get modified event from MDS when the update, including
       
   122 				the title, is complete
       
   123                 */
       
   124 				/*
       
   125 				if (error == KErrNone)
   105                     {
   126                     {
   106                     path = aMediaList.PathLC(
   127                     path = aMediaList.PathLC(
   107                             NGlxListDefs::EPathFocusOrSelection);
   128                             NGlxListDefs::EPathFocusOrSelection);
   108                     command = TGlxCommandFactory::RenameCommandLC(
   129                     command = TGlxCommandFactory::RenameCommandLC(
   109                             *newMediaItemTitle, *path);
   130                             *newMediaItemTitle, *path);
   110                     CleanupStack::Pop(command);
   131                     CleanupStack::Pop(command);
   111                     CleanupStack::PopAndDestroy(path);
   132                     CleanupStack::PopAndDestroy(path);
   112                     }
   133                     }*/
   113                 }
   134                 }
   114             else
   135             else
   115                 {
   136                 {
   116                 //The Name of the file name already exists, display an message .
   137                 //The Name of the file name already exists, display an message .
   117                 HandleErrorL(KErrAlreadyExists);
   138                 HandleErrorL(KErrAlreadyExists);
   130             CleanupStack::Pop(command);
   151             CleanupStack::Pop(command);
   131             CleanupStack::PopAndDestroy(path);
   152             CleanupStack::PopAndDestroy(path);
   132             CleanupStack::PopAndDestroy(newMediaItemTitle);
   153             CleanupStack::PopAndDestroy(newMediaItemTitle);
   133             }
   154             }
   134         }
   155         }
       
   156     else
       
   157         {
       
   158 		// If cancel is pressed, reset the flag!!
       
   159         iIsCmdActive = false;
       
   160         }
   135     return command;
   161     return command;
   136     }
   162     }
   137 
   163 
   138 QString GlxCommandHandlerRename::CompletionTextL() const
   164 QString GlxCommandHandlerRename::CompletionTextL() const
   139     {
   165     {