chxavfileui.h
上传用户:zhongxx05
上传日期:2007-06-06
资源大小:33641k
文件大小:6k
- /************************************************************************
- * chxavfileui.h
- * -------------
- *
- * Synopsis:
- *
- *
- * Target:
- * Symbian OS
- *
- *
- * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
- *
- ************************************************************************/
- #ifndef _chxavfileui_h_
- #define _chxavfileui_h_
- // Symbian includes...
- // Helix includes...
- #include "hxstring.h"
- // Includes from this project...
- #include "chxavnamedisplaytrait.h"
- #include "chxavfilestore.h"
- #include "chxavrefptr.h"
- #include "chxavwaitnote.h"
- // forward decl
- class CHXAvPlayerUI;
- // class CHXAvFileUI
- class CHXAvFileUI
- : public CHXBody
- , private CHXAvNameDisplayTrait
- , public FileStoreOperationObserver
- {
- public:
- // ctor and dtor
- CHXAvFileUI(bool bHideExtensions = true);
- virtual ~CHXAvFileUI();
- void ConstructL(CHXAvPlayerUI* playerUI, const CHXAvFileStorePtr& spStore);
- void SetHideExtensions(bool bHide);
- CHXAvFileStorePtr GetStore();
-
- const TDesC& GetLastNewItemName() const;
- // ui interactions for file
- TInt DoNewFolderL(TInt resIdPrompt);
- TInt DoMoveItemL(TInt idxItem,
- TInt resIdPrompt);
- TInt DoMoveItemsL(const CArrayFix<TInt>& items,
- TInt resIdPrompt);
- TInt DoDeleteItemL(TInt idxItem);
- TInt DoDeleteItemsL(const CArrayFix<TInt>& items);
- TInt DoRenameL(TInt idxItem, TInt resIdPrompt);
- TInt DoCreateLinkL(const CHXString& url, const TDesC& defaultName);
- TInt DoSavePlaylistL(const TDesC& fullPathSource, const TDesC& defaultName);
- TInt DoSaveClipL(const TDesC& fullPathSource, const TDesC& defaultName);
- #if(0)
- TInt DoCopyItemL(TInt idxItem,
- TInt resIdPrompt);
- TInt DoCopyItemsL(const CArrayFix<TInt>& items,
- TInt resIdPrompt);
- #endif
-
- protected:
- // FileStoreOperationObserver
- void OnFileOpStart(FileStoreOperationObserver::OperationType type, const TDesC& source, const TDesC& target);
- bool OnFileOpTick(FileStoreOperationObserver::OperationType type, const TDesC& source, const TDesC& target, TInt64 cbCopied);
- void OnFileOpEnd(FileStoreOperationObserver::OperationType type, TInt err, const TDesC& source, const TDesC& target);
- // for CopyFileL()
- struct CopyFileResourceIds
- {
- TInt idPromptTargetName;
- TInt idPromptTargetPath;
- TInt idPromptTargetPathSelectButtonText;
- TInt idInfoNowCopying;
- TInt idInfoConfirmCopy;
- TInt idInfoCopyFailed;
- };
- protected:
- // implementation helpers
- enum QueryTargetNameFlags
- {
- fWantFolder = 0x01,
- fSuggestUniqueDefaultName = 0x02,
- fDisallowFileOverwrite = 0x04
- //fCancelIfSameName = 0x08
- };
- enum QueryTargetNameResult
- {
- qtrPathTooLong,
- qtrAbort,
- qtrUnique,
- qtrOverwrite
- };
-
- TInt DoCopyFileL(const TDesC& fullPathSource, const CopyFileResourceIds& resIds, const TDesC& targetName);
- TInt DoCopyFileL(const TDesC& pathDest, const TDesC& fullPathSource, const CopyFileResourceIds& resIds, const TDesC& targetName);
- TInt DoCopyFileHelperL(const TDesC& pathDest,
- const TDesC& fullPathSource,
- const CopyFileResourceIds& resIds,bool bAllowOverwrite);
- bool DoGetTargetFolderPathL(TInt resIdPrompt, TInt resIdSelectButton);
- TInt DoMoveItemL(const TDesC& pathDest, TInt idxItem);
- TInt DoMoveItemsL(const TDesC& pathDest, const CArrayFix<TInt>& items);
- TInt DoCreateLinkL(const TDesC& folder, const CHXString& url, const TDesC& defaultName);
- QueryTargetNameResult QueryTargetNameL(const TDesC& prompt,const TDesC& pathDest, const TDesC& defaultName,TUint flags);
- TFileName* AllocSuggestedFileNameL(const TDesC& pathDest, const TDesC& defaultName, TUint flags );
- void HandleDiskFullCase(TInt err);
- protected:
- // disallow copy
- CHXAvFileUI& operator=(const CHXAvFileUI& other);
- CHXAvFileUI(const CHXAvFileUI& other);
- // implementation helpers
- TPtrC NameFromIndex(TInt idxItem);
- TInt MoveItemHelperL(const TDesC& pathDest, TInt idxItem);
- TInt DoOverwriteMoveItemHelperL(const TDesC& pathDest, TInt idxItem);
- TInt DoPromptMoveItemHelperL(const TDesC& pathDest, TInt idxItem);
- void InitNameBufWithSuggestionL(const TDesC& pathDest, const TDesC& fileName, TUint flags);
- void EnableWaitNoteCancelButtonL(bool bEnable);
- void UserCancelPendingFileOp();
- private:
-
- CCoeEnv* m_pCone;
- CHXAvPlayerUI* m_playerUI;
- CHXAvFileStorePtr m_spStore;
- // working buffers
- TFileName m_targetFolderPath;
- TFileName m_nameBuf;
- refptr<HBufC> m_spLastUniqueName;
- CHXAvWaitNotePtr m_spWaitNote;
- bool m_bIsCancelOpPending;
- };
- typedef CHXSmartPtr<CHXAvFileUI> CHXAvFileUIPtr;
- ////////////////////////////////////////////////////////////
- //
- inline
- void CHXAvFileUI::SetHideExtensions(bool bHide)
- {
- CHXAvNameDisplayTrait::SetHideExtensions(bHide);
- }
- ////////////////////////////////////////////////////////////
- //
- inline
- CHXAvFileStorePtr CHXAvFileUI::GetStore()
- {
- return m_spStore;
- }
- ////////////////////////////////////////////////////////////
- // after certain operations this contains the user-supplied
- // folder/file name applying to the operation
- //
- // name includes extension if relevant, e.g., 'foo.rm'
- //
- // *** only valid after rename or create folder
- //
- // name is full significant name (without path)
- //
- // e.g.: 'foo.rm', 'myfolder'
- //
- // XXXLCM consider fixing rename, new folder and do away with this
- //
- inline
- const TDesC& CHXAvFileUI::GetLastNewItemName() const
- {
- return *m_spLastUniqueName;
- }
- #endif //_chxavfileui_h_