From: chitta.rs Date: Fri, 3 May 2013 11:36:58 +0000 (+0530) Subject: NABI_SE issues resolved X-Git-Tag: submit/tizen_2.1/20130514.051252~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f6c7d7740ad7ffdcaa4baf8d41b8dfa277b7f68;p=apps%2Fosp%2FMyFiles.git NABI_SE issues resolved Change-Id: Ic3bc8ef0ef0a31554f0568ba77889db869c78bd1 --- diff --git a/inc/MfMyFilesApp.h b/inc/MfMyFilesApp.h index 20a20ee..7acbeba 100644 --- a/inc/MfMyFilesApp.h +++ b/inc/MfMyFilesApp.h @@ -1,163 +1,163 @@ -// -// Copyright (c) 2012 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.1 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/** - * @file: MfMyFilesApp.h - * @brief: This file contains the declaration of MyFilesApp Class, which provides basic features necessary to define an UiApp. - */ - -#ifndef _MY_FILES_H_ -#define _MY_FILES_H_ - -#include -#include -#include -#include -#include - -#include "MfIListViewStateChangeListener.h" -#include "MfIAudioNotificationListener.h" -#include "MfINotificationListener.h" -#include "MfFolderEntryEditorPresentationModel.h" -#include "MfTypes.h" - -class MyFilesApp - : public Tizen::App::IAppControlProviderEventListener - , public Tizen::App::UiApp - , public Tizen::System::IScreenEventListener - , public Tizen::System::ISettingEventListener -{ -public: - //! Constructor of the class. - /*!@fn MyFilesApp() - * @brief A public member taking no arguments which initializes the member variables of the class. - * @param Takes no parameters - * @return No value returned */ - MyFilesApp(void); - - //! Destructor of the class. - /*!@fn ~MyFilesApp() - * @brief A public virtual member taking no arguments, frees the memory allocated to the member variables. - * @param Takes no parameters - * @return No value returned - * */ - virtual ~MyFilesApp(void); - -public: - void AddAppControlResult(Tizen::App::AppCtrlResult result); - - Tizen::Base::String ExtractType(Tizen::Base::String& inputType); - - FileType GetCurrentFileType(void); - - MyFilesApp* GetCurrentInstance(void); - - SelectionMode GetCurrentSelectionMode(void); - - AppControlView GetCurrentView(void); - - AppControlState GetCurrentState(void); - - ExportFileType GetCurrentExportFileType(void); - - IListViewStateChangeListener* GetCurrentViewToUpdate(void); - - bool IsImageAppControlLanched(void); - - void LaunchCacheManager(void); - - void SetAppControlSelected(void); - - result SetCurrentView(IListViewStateChangeListener* pListToUpdate); - - void SetImageAppControlLanched(bool bAppControlLaunched); - - void SetNotifyListener(INotificationListener* listener); - - // Called when the UiApp is initializing. - bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry); - - // Called when the UiApp initializing is finished. - bool OnAppInitialized(void); - - // Called when the UiApp is requested to terminate. - bool OnAppWillTerminate(void); - - // Called when the UiApp is terminating. - bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false); - - // Called when the UiApp's frame moves to the top of the screen. - void OnForeground(void); - - // Called when this UiApp's frame is moved from top of the screen to the background. - void OnBackground(void); - - // Called when the system memory is not sufficient to run the UiApp any further. - void OnLowMemory(void); - - // Called when the battery level changes. - void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel); - - // Called when the screen turns on. - void OnScreenOn(void); - - // Called when the screen turns off. - void OnScreenOff(void); - - virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs); - - virtual void OnAppControlRequestReceivedN(RequestId reqId, const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, const Tizen::Base::String& category, const Tizen::Base::String* pDataType, const Tizen::Base::String* pUriScheme, Tizen::Base::Collection::IList* pArgs); - - virtual void OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData); - - virtual void OnSettingChanged(Tizen::Base::String& key) ; - void InitializeListeners(void); - bool IsAppControlMode(void); - void SetAudioNotificationListener(IAudioNotificationListener* listener); - -public: - /** - * [Test] UiApp must have a factory method that creates an instance of itself. - */ - static Tizen::App::UiApp* CreateInstance(void); - -private: - bool __bAppControlEnabled; - bool __bImgAppControlLaunched; - - bool __bAppControlMode; - Tizen::Base::String __currentDisplayLanguage; - - RequestId __currentRequestId; - Tizen::App::AppCtrlResult __currentAppControlResult; - - Tizen::Base::Collection::HashMap* __pResultList; - Tizen::Base::String __operationId; - Tizen::Base::String __mimeType; - - IListViewStateChangeListener* __pCurrentListToUpdate; - INotificationListener* __pNotificationListener; - IAudioNotificationListener* __pAudioNotificationListener; - - AppControlState __inputSource; - AppControlView __currentView; - - FileType __currentFileType; - SelectionMode __currentSelectionMode; - ExportFileType __currentExportFileType; -}; - -#endif //_MY_FILES_H_ +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://floralicense.org/license/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file: MfMyFilesApp.h + * @brief: This file contains the declaration of MyFilesApp Class, which provides basic features necessary to define an UiApp. + */ + +#ifndef _MY_FILES_H_ +#define _MY_FILES_H_ + +#include +#include +#include +#include +#include + +#include "MfIListViewStateChangeListener.h" +#include "MfIAudioNotificationListener.h" +#include "MfINotificationListener.h" +#include "MfFolderEntryEditorPresentationModel.h" +#include "MfTypes.h" + +class MyFilesApp + : public Tizen::App::IAppControlProviderEventListener + , public Tizen::App::UiApp + , public Tizen::System::IScreenEventListener + , public Tizen::System::ISettingEventListener +{ +public: + //! Constructor of the class. + /*!@fn MyFilesApp() + * @brief A public member taking no arguments which initializes the member variables of the class. + * @param Takes no parameters + * @return No value returned */ + MyFilesApp(void); + + //! Destructor of the class. + /*!@fn ~MyFilesApp() + * @brief A public virtual member taking no arguments, frees the memory allocated to the member variables. + * @param Takes no parameters + * @return No value returned + * */ + virtual ~MyFilesApp(void); + +public: + void AddAppControlResult(Tizen::App::AppCtrlResult result); + + Tizen::Base::String ExtractType(Tizen::Base::String& inputType); + + FileType GetCurrentFileType(void); + + MyFilesApp* GetCurrentInstance(void); + + SelectionMode GetCurrentSelectionMode(void); + + AppControlView GetCurrentView(void); + + AppControlState GetCurrentState(void); + + ExportFileType GetCurrentExportFileType(void); + + IListViewStateChangeListener* GetCurrentViewToUpdate(void); + + bool IsImageAppControlLanched(void); + + void LaunchCacheManager(void); + + void SetAppControlSelected(void); + + result SetCurrentView(IListViewStateChangeListener* pListToUpdate); + + void SetImageAppControlLanched(bool bAppControlLaunched); + + void SetNotifyListener(INotificationListener* listener); + + // Called when the UiApp is initializing. + bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry); + + // Called when the UiApp initializing is finished. + bool OnAppInitialized(void); + + // Called when the UiApp is requested to terminate. + bool OnAppWillTerminate(void); + + // Called when the UiApp is terminating. + bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false); + + // Called when the UiApp's frame moves to the top of the screen. + void OnForeground(void); + + // Called when this UiApp's frame is moved from top of the screen to the background. + void OnBackground(void); + + // Called when the system memory is not sufficient to run the UiApp any further. + void OnLowMemory(void); + + // Called when the battery level changes. + void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel); + + // Called when the screen turns on. + void OnScreenOn(void); + + // Called when the screen turns off. + void OnScreenOff(void); + + virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs); + + virtual void OnAppControlRequestReceivedN(RequestId reqId, const Tizen::Base::String& providerId, const Tizen::Base::String& operationId, const Tizen::Base::String& category, const Tizen::Base::String* pDataType, const Tizen::Base::String* pUriScheme, Tizen::Base::Collection::IList* pArgs); + + virtual void OnAppControlRequestReceived(RequestId reqId, const Tizen::Base::String& operationId, const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType, const Tizen::Base::Collection::IMap* pExtraData); + + virtual void OnSettingChanged(Tizen::Base::String& key) ; + void InitializeListeners(void); + bool IsAppControlMode(void); + void SetAudioNotificationListener(IAudioNotificationListener* listener); + +public: + /** + * [Test] UiApp must have a factory method that creates an instance of itself. + */ + static Tizen::App::UiApp* CreateInstance(void); + +private: + bool __bAppControlEnabled; + bool __bImgAppControlLaunched; + + bool __bAppControlMode; + Tizen::Base::String __currentDisplayLanguage; + + RequestId __currentRequestId; + Tizen::App::AppCtrlResult __currentAppControlResult; + + Tizen::Base::Collection::HashMap* __pResultList; + Tizen::Base::String __operationId; + Tizen::Base::String __mimeType; + + IListViewStateChangeListener* __pCurrentListToUpdate; + INotificationListener* __pNotificationListener; + IAudioNotificationListener* __pAudioNotificationListener; + + AppControlState __inputSource; + AppControlView __currentView; + + FileType __currentFileType; + SelectionMode __currentSelectionMode; + ExportFileType __currentExportFileType; +}; + +#endif //_MY_FILES_H_ diff --git a/inc/MfSubBaseSelectionForm.h b/inc/MfSubBaseSelectionForm.h index cb90ab0..3c5cbdc 100644 --- a/inc/MfSubBaseSelectionForm.h +++ b/inc/MfSubBaseSelectionForm.h @@ -24,6 +24,7 @@ #define _MF_SUB_BASE_SELECTION_FORM #include +#include #include "MfBaseForm.h" #include "MfContentListItem.h" @@ -32,6 +33,7 @@ class SubBaseSelection : public BaseForm , public Tizen::Media::IPlayerEventListener + , public Tizen::Telephony::ITelephonyCallEventListener { public: //! Constructor of the class. @@ -72,6 +74,9 @@ public: virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source); + //ITelephonyCallEventListener + virtual void OnTelephonyCallStatusChangedN(Tizen::Telephony::CallStatus callStatus, Tizen::Telephony::CallInfo * pCallInfo); + //IListViewItemProvider virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth); virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); @@ -222,7 +227,9 @@ protected: FolderEntryEditorPresentationModel* _pFileManager; FolderEntryPresentationModel* _pFolderEntryPM; ThumbnailManager* _pThumbnailManager; - Tizen::Graphics::Rectangle __defaultListViewBounds; + Tizen::Graphics::Rectangle _defaultListViewBounds; + + Tizen::Telephony::CallManager* _pCallManager; }; #endif diff --git a/inc/MfSubFolderSelection.h b/inc/MfSubFolderSelection.h index 9351154..e171903 100644 --- a/inc/MfSubFolderSelection.h +++ b/inc/MfSubFolderSelection.h @@ -1,218 +1,218 @@ -// -// Copyright (c) 2012 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.1 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/** - * @file: MfSubFolderSelection.h - * @brief: This file contains the declaration of SubFolderSelection class, - * which acts an AppControl for the SubDirectories. - */ - -#ifndef _MF_SUB_FOLDER_FILE_SELECTION_H_ -#define _MF_SUB_FOLDER_FILE_SELECTION_H_ - -#include "MfSubBaseSelectionForm.h" -#include "MfIAudioNotificationListener.h" - -class SubFolderSelection - : public SubBaseSelection - , public Tizen::Io::IFileEventListener - , public Tizen::Ui::IDataBindingListener - , public IAudioNotificationListener -{ -public: - //Default constructor for the class - /*! - * @fn FileListSelectionForm() - * @param Takes no parameters - * @return No value returned - */ - SubFolderSelection(void); - - //Default Destructor for the class - /*! - * @fn ~FileListSelectionForm() - * @param Takes no parameters - * @return No value returned - */ - virtual ~SubFolderSelection(void); - - /*! - * @fn Initialize() - * @param Takes no parameters - * @return bool value - */ - bool Initialize(void); - - //Initialises all the members of the class - /*! - * @fn OnInitializing() - * @param Takes no parameters - * @return result value - */ - result OnInitializing(void); - - /*! - * @fn OnTerminating() - * @param Takes no parameters - * @return result value - */ - result OnTerminating(void); - - //IPlayerEventListener - virtual void OnPlayerEndOfClip(void); - virtual void OnPlayerAudioFocusChanged (void); - - //IDeviceEventListener - virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state); - - //!IActionEventListener - /*! @fn OnActionPerformed(const Tizen::Ui::Control& source, int actionId) - * @brief Called when an action event occurs on the source control. - */ - virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); - - //IListViewItemEventListener - virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status); - - virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback); - virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status); - virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction); - - //! IDataBindingEventListener - /*! @fn OnDataBindingSourceUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName) - * @brief Called when the data transfer for source is completed by the data binding. - */ - virtual void OnDataBindingSourceUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName - , const Tizen::Base::String& propertyName); - - /*! @fn OnDataBindingTargetUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName) - * @brief Called when the data transfer for target is completed by the data binding. - */ - virtual void OnDataBindingTargetUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName - , const Tizen::Base::String& propertyName); - - /*! @fn OnDataBindingValidationFailed(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName, Tizen::Ui::DataBindingDestinationType destType) - * @brief Called when a validation has failed during data transfer. - */ - virtual void OnDataBindingValidationFailed(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName - , const Tizen::Base::String& propertyName, Tizen::Ui::DataBindingDestinationType destType); - - //! ISceneEventListener - /*! @fn OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs) - * @brief Called after setting as current scene. - */ - virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); - - /*! @fn OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId) - * @brief Called when the current scene is deactivated. - */ - virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); - - /*!IDeviceNotificationListener - * A public callback from the IDeviceNotificationListener taking deviceType and state as argument and returning nothing - * @fn OnDeviceChange - * @brief Used to handle device event changes. When memory card is inserted, removed then this method will be called - * @param ComponentType, String - * @return no return value - */ - - //ISceneManagerEventListener - virtual void OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId &previousSceneId, const Tizen::Ui::Scenes::SceneId ¤tSceneId); - virtual void OnSceneTransitionStarted (const Tizen::Ui::Scenes::SceneId ¤tSceneId, const Tizen::Ui::Scenes::SceneId &nextSceneId); - - void OnDeviceChange(ComponentType deviceType, const Tizen::Base::String& state); - - //IFileEventListener - virtual void OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId); - - virtual void OnAudioNotificationReceived(void); - -private: - /* - * A private member function returning no arguments. - * @fn SetHeaderTitleText(Tizen::Base::String& fileName) - * @brief Called to set the title text of the header within the form. - * @param [String&] fileName, filename of the current Directory. - * @return Void return type - */ - void SetHeaderTitleText(Tizen::Base::String& filePath); - - /* - * A private member function taking and returning no arguments. - * @fn SetNextDisplayPath - * @brief Called OnListItemStateChanged to change the path displayed in the label. - * @param No parameters. - * @return Void return type. - */ - void SetNextDisplayPath(void); - - /* - * A private member function taking and returning no arguments. - * @fn SetParentDisplayPath - * @brief Called within ShowParentDirectoryView() to change the path displayed on the display label. - * @param No parameters. - * @return Void return type - */ - void SetParentDisplayPath(void); - - /* - * A private member function taking and returning no arguments. - * @fn ShowParentDirectoryView - * @brief Called during OnActionPerformed() on Up HeaderItem, refreshes the view to the - * list of files within the parent directory - * @param No parameters - * @return Void return type - */ - void ShowParentDirectoryView(void); - - // Copy Constructor of the class. - /*@fn SubFolderSelection(const SubFolderSelection&) - * @brief Copy Constructor - * @param Takes Reference of the class - * @return No value returned - * */ - SubFolderSelection(const SubFolderSelection&); - - // Assignment operator of the class. - /*@fn SubFolderSelection& operator = (const SubFolderSelection& pSubFolderSelection) - * @brief Assignment operator of the class. - * @param Takes Reference of the class - * @return No value returned - * */ - SubFolderSelection& operator =(const SubFolderSelection& pSubFolderSelection); - -public: - Tizen::Base::String text; - -private: - static const int IDA_BTN_HOME = 200; - static const int IDA_BTN_UP = 201; - - Tizen::Base::String __displayPath; - //Tizen::Base::String __currentDirectoryPath; - Tizen::Base::String __tabSelected; - Tizen::Base::String* __pReceivedFilename; - - Tizen::Ui::Controls::ButtonItem* __pHomeButton; - Tizen::Ui::Controls::ButtonItem* __pUpButton; - Tizen::Ui::Controls::ContextMenu* __pMoreContextMenu; - Tizen::Ui::Controls::Label* __pLabelDisplayPath; - - //FileEventManager - Tizen::Io::FileEventManager* __pFileEventManager; -}; - -#endif +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://floralicense.org/license/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file: MfSubFolderSelection.h + * @brief: This file contains the declaration of SubFolderSelection class, + * which acts an AppControl for the SubDirectories. + */ + +#ifndef _MF_SUB_FOLDER_FILE_SELECTION_H_ +#define _MF_SUB_FOLDER_FILE_SELECTION_H_ + +#include "MfSubBaseSelectionForm.h" +#include "MfIAudioNotificationListener.h" + +class SubFolderSelection + : public SubBaseSelection + , public Tizen::Io::IFileEventListener + , public Tizen::Ui::IDataBindingListener + , public IAudioNotificationListener +{ +public: + //Default constructor for the class + /*! + * @fn FileListSelectionForm() + * @param Takes no parameters + * @return No value returned + */ + SubFolderSelection(void); + + //Default Destructor for the class + /*! + * @fn ~FileListSelectionForm() + * @param Takes no parameters + * @return No value returned + */ + virtual ~SubFolderSelection(void); + + /*! + * @fn Initialize() + * @param Takes no parameters + * @return bool value + */ + bool Initialize(void); + + //Initialises all the members of the class + /*! + * @fn OnInitializing() + * @param Takes no parameters + * @return result value + */ + result OnInitializing(void); + + /*! + * @fn OnTerminating() + * @param Takes no parameters + * @return result value + */ + result OnTerminating(void); + + //IPlayerEventListener + virtual void OnPlayerEndOfClip(void); + virtual void OnPlayerAudioFocusChanged (void); + + //IDeviceEventListener + virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state); + + //!IActionEventListener + /*! @fn OnActionPerformed(const Tizen::Ui::Control& source, int actionId) + * @brief Called when an action event occurs on the source control. + */ + virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId); + + //IListViewItemEventListener + virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status); + + virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback); + virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status); + virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction); + + //! IDataBindingEventListener + /*! @fn OnDataBindingSourceUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName) + * @brief Called when the data transfer for source is completed by the data binding. + */ + virtual void OnDataBindingSourceUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName + , const Tizen::Base::String& propertyName); + + /*! @fn OnDataBindingTargetUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName) + * @brief Called when the data transfer for target is completed by the data binding. + */ + virtual void OnDataBindingTargetUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName + , const Tizen::Base::String& propertyName); + + /*! @fn OnDataBindingValidationFailed(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName, Tizen::Ui::DataBindingDestinationType destType) + * @brief Called when a validation has failed during data transfer. + */ + virtual void OnDataBindingValidationFailed(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName + , const Tizen::Base::String& propertyName, Tizen::Ui::DataBindingDestinationType destType); + + //! ISceneEventListener + /*! @fn OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs) + * @brief Called after setting as current scene. + */ + virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs); + + /*! @fn OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId) + * @brief Called when the current scene is deactivated. + */ + virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId); + + /*!IDeviceNotificationListener + * A public callback from the IDeviceNotificationListener taking deviceType and state as argument and returning nothing + * @fn OnDeviceChange + * @brief Used to handle device event changes. When memory card is inserted, removed then this method will be called + * @param ComponentType, String + * @return no return value + */ + + //ISceneManagerEventListener + virtual void OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId &previousSceneId, const Tizen::Ui::Scenes::SceneId ¤tSceneId); + virtual void OnSceneTransitionStarted (const Tizen::Ui::Scenes::SceneId ¤tSceneId, const Tizen::Ui::Scenes::SceneId &nextSceneId); + + void OnDeviceChange(ComponentType deviceType, const Tizen::Base::String& state); + + //IFileEventListener + virtual void OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId); + + virtual void OnAudioNotificationReceived(void); + +private: + /* + * A private member function returning no arguments. + * @fn SetHeaderTitleText(Tizen::Base::String& fileName) + * @brief Called to set the title text of the header within the form. + * @param [String&] fileName, filename of the current Directory. + * @return Void return type + */ + void SetHeaderTitleText(Tizen::Base::String& filePath); + + /* + * A private member function taking and returning no arguments. + * @fn SetNextDisplayPath + * @brief Called OnListItemStateChanged to change the path displayed in the label. + * @param No parameters. + * @return Void return type. + */ + void SetNextDisplayPath(void); + + /* + * A private member function taking and returning no arguments. + * @fn SetParentDisplayPath + * @brief Called within ShowParentDirectoryView() to change the path displayed on the display label. + * @param No parameters. + * @return Void return type + */ + void SetParentDisplayPath(void); + + /* + * A private member function taking and returning no arguments. + * @fn ShowParentDirectoryView + * @brief Called during OnActionPerformed() on Up HeaderItem, refreshes the view to the + * list of files within the parent directory + * @param No parameters + * @return Void return type + */ + void ShowParentDirectoryView(void); + + // Copy Constructor of the class. + /*@fn SubFolderSelection(const SubFolderSelection&) + * @brief Copy Constructor + * @param Takes Reference of the class + * @return No value returned + * */ + SubFolderSelection(const SubFolderSelection&); + + // Assignment operator of the class. + /*@fn SubFolderSelection& operator = (const SubFolderSelection& pSubFolderSelection) + * @brief Assignment operator of the class. + * @param Takes Reference of the class + * @return No value returned + * */ + SubFolderSelection& operator =(const SubFolderSelection& pSubFolderSelection); + +public: + Tizen::Base::String text; + +private: + static const int IDA_BTN_HOME = 200; + static const int IDA_BTN_UP = 201; + + Tizen::Base::String __displayPath; + //Tizen::Base::String __currentDirectoryPath; + Tizen::Base::String __tabSelected; + Tizen::Base::String* __pReceivedFilename; + + Tizen::Ui::Controls::ButtonItem* __pHomeButton; + Tizen::Ui::Controls::ButtonItem* __pUpButton; + Tizen::Ui::Controls::ContextMenu* __pMoreContextMenu; + Tizen::Ui::Controls::Label* __pLabelDisplayPath; + + //FileEventManager + Tizen::Io::FileEventManager* __pFileEventManager; +}; + +#endif diff --git a/src/MfCategorySearch.cpp b/src/MfCategorySearch.cpp index a7b5ba2..49d2fb9 100644 --- a/src/MfCategorySearch.cpp +++ b/src/MfCategorySearch.cpp @@ -441,7 +441,7 @@ CategorySearch::OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId &pr _bIsDirectoryEmpty = false; SetFooterItemsVisibility(ENABLE_FOOTER_ITEM); - + _pLongPressGestureDetector->AddLongPressGestureEventListener(*this); if (_pIconListView != null && _pIconListView->IsVisible()) { _pIconListView->AddGestureDetector(*_pLongPressGestureDetector); @@ -843,6 +843,7 @@ CategorySearch::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const void CategorySearch::OnDeviceChange(ComponentType deviceType, const Tizen::Base::String& state) { + AppLogDebug("CategorySearch::OnDeviceChange"); if (_pFolderEntryPM != null) { _pFolderEntryPM->CreateTraversalTree(); @@ -853,10 +854,12 @@ CategorySearch::OnDeviceChange(ComponentType deviceType, const Tizen::Base::Stri { if (_pFilenames->GetCount() == 0) { + _bIsDirectoryEmpty = true; SetFooterItemsVisibility(DISABLE_FOOTER_ITEM); } else { + _bIsDirectoryEmpty = false; SetFooterItemsVisibility(ENABLE_FOOTER_ITEM); } } @@ -867,6 +870,12 @@ CategorySearch::OnDeviceChange(ComponentType deviceType, const Tizen::Base::Stri _pListView->Invalidate(true); } + if (_pIconListView != null && _pIconListView->IsVisible()) + { + _pIconListView->UpdateList(); + _pIconListView->Invalidate(true); + } + if (_pFolderEntryPM != null) { _pFolderEntryPM->InitThumbnailManager(); diff --git a/src/MfSubBaseSelectionForm.cpp b/src/MfSubBaseSelectionForm.cpp index 17e951f..4879419 100644 --- a/src/MfSubBaseSelectionForm.cpp +++ b/src/MfSubBaseSelectionForm.cpp @@ -34,6 +34,7 @@ using namespace Tizen::Io; using namespace Tizen::Locales; using namespace Tizen::Media; using namespace Tizen::System; +using namespace Tizen::Telephony; using namespace Tizen::Ui; using namespace Tizen::Ui::Controls; using namespace Tizen::Ui::Scenes; @@ -58,6 +59,7 @@ SubBaseSelection::SubBaseSelection(void) , _pFileManager(null) , _pFolderEntryPM(null) , _pThumbnailManager(null) +, _pCallManager(null) { //,_listAnnexStyle(null) _selectionMode = SELECTION_MODE_MULTIPLE; @@ -70,16 +72,11 @@ SubBaseSelection::SubBaseSelection(void) _annexStyle = ANNEX_STYLE_NORMAL; _storageType = MEMORY_TYPE_PHONE; _currentAudioPlayIndex = -1; - __defaultListViewBounds = Rectangle(0,0,0,0); + _defaultListViewBounds = Rectangle(0,0,0,0); } SubBaseSelection::~SubBaseSelection(void) { -/* if (_pCancel != null) - { - delete _pCancel; - }*/ - if (_pAttach != null) { delete _pAttach; @@ -134,6 +131,12 @@ SubBaseSelection::~SubBaseSelection(void) { delete _pDummyImage; } + + if (_pCallManager != null) + { + delete _pCallManager; + _pCallManager = null; + } } SubBaseSelection& @@ -249,7 +252,7 @@ SubBaseSelection::GetItemCount(void) if (_selectionMode == SELECTION_MODE_MULTIPLE) { - _pListView->SetSize(__defaultListViewBounds.width, __defaultListViewBounds.height); + _pListView->SetSize(_defaultListViewBounds.width, _defaultListViewBounds.height); _pListView->Invalidate(true); } } @@ -263,7 +266,7 @@ SubBaseSelection::GetItemCount(void) if (_selectionMode == SELECTION_MODE_MULTIPLE) { - _pListView->SetSize(__defaultListViewBounds.width, __defaultListViewBounds.height - _pLabelNumberOfItems->GetHeight()); + _pListView->SetSize(_defaultListViewBounds.width, _defaultListViewBounds.height - _pLabelNumberOfItems->GetHeight()); _pListView->Invalidate(true); } _itemSelectedCount.Clear(); @@ -298,6 +301,7 @@ SubBaseSelection::CreateDefaultContentItem(int index, int itemWidth) String cacheImagePath; PlayerState audioPlayerStatus; + CallStatus callStatus; ContentType contentType = CONTENT_TYPE_UNKNOWN; ContentListItem* pCustomItem = null; @@ -345,7 +349,6 @@ SubBaseSelection::CreateDefaultContentItem(int index, int itemWidth) if (pFileDetails != null) { cacheImagePath = pFileDetails->GetFullFilePath(); - AppLogDebug("cache path is %S",cacheImagePath.GetPointer()); } if ((pCacheList->GetValue(cacheImagePath)) != null) @@ -356,7 +359,6 @@ SubBaseSelection::CreateDefaultContentItem(int index, int itemWidth) if (pFetchedCacheImage != null) { - AppLogDebug("image taken from cachemanager"); pThumbnailImage = CacheManager::GetInstance()->GetCacheBitmapN(cacheImagePath); pCustomItem->SetThumbnail(pThumbnailImage); } @@ -364,7 +366,6 @@ SubBaseSelection::CreateDefaultContentItem(int index, int itemWidth) { pFileDetails->SetDummy(true); pCustomItem->SetThumbnail(_pDummyImage); - AppLogDebug("call to thumbnail manager"); } //r = _pFolderEntryPM->InitThumbnailManager(index); @@ -390,24 +391,36 @@ SubBaseSelection::CreateDefaultContentItem(int index, int itemWidth) pCustomItem->SetListAnnexStyle(_annexStyle); } + if (contentType == CONTENT_TYPE_AUDIO) { - if (_pAudioPlayer != null) + callStatus = _pCallManager->GetCurrentCallStatus(); + if (callStatus != CALL_STATUS_UNDEFINED && callStatus == CALL_STATUS_IDLE) { - audioPlayerStatus = _pAudioPlayer->GetState(); - - if (audioPlayerStatus == PLAYER_STATE_CLOSED) + InitializePlayer(); + if (_pAudioPlayer != null) { - pCustomItem->SetAudioBitmap(_pAudioPlay, null); - } + audioPlayerStatus = _pAudioPlayer->GetState(); + AppLogDebug("SubBaseSelection::CreateDefaultContentItem:%d", audioPlayerStatus); - if (_currentAudioPlayIndex == index) - { - if (audioPlayerStatus == PLAYER_STATE_PLAYING) + + if (audioPlayerStatus == PLAYER_STATE_CLOSED) + { + pCustomItem->SetAudioBitmap(_pAudioPlay, null); + } + + if (_currentAudioPlayIndex == index) { - pCustomItem->SetAudioBitmap(null, _pAudioPause); + if (audioPlayerStatus == PLAYER_STATE_PLAYING) + { + pCustomItem->SetAudioBitmap(null, _pAudioPause); + } + //else if (audioPlayerStatus == PLAYER_STATE_PAUSED || audioPlayerStatus == PLAYER_STATE_ENDOFCLIP) + else + { + pCustomItem->SetAudioBitmap(_pAudioPlay, null); + } } - //else if (audioPlayerStatus == PLAYER_STATE_PAUSED || audioPlayerStatus == PLAYER_STATE_ENDOFCLIP) else { pCustomItem->SetAudioBitmap(_pAudioPlay, null); @@ -417,10 +430,7 @@ SubBaseSelection::CreateDefaultContentItem(int index, int itemWidth) { pCustomItem->SetAudioBitmap(_pAudioPlay, null); } - } - else - { - pCustomItem->SetAudioBitmap(_pAudioPlay, null); + } } } @@ -507,17 +517,22 @@ SubBaseSelection::OnListViewItemStateChangedNotify(ViewType viewType) void SubBaseSelection::InitializePlayer(void) { - _pAudioPlayer = new (std::nothrow) Player(); - - if (_pAudioPlayer != null) + AppLogDebug("SubFolderSelection::OnListViewItemStateChanged"); + if (_pAudioPlayer == null) { - _pAudioPlayer->Construct(*this); + _pAudioPlayer = new (std::nothrow) Player(); + + if (_pAudioPlayer != null) + { + _pAudioPlayer->Construct(*this); + } } } void SubBaseSelection::LoadMusicPlayer(const Tizen::Base::String& mediaFilepath, Tizen::Media::PlayerState PlayerCurrentState) { + AppLogDebug("SubFolderSelection::OnListViewItemStateChanged"); result r = E_SUCCESS; if (_pAudioPlayer != null && mediaFilepath.IsEmpty() == false) { @@ -922,3 +937,10 @@ CATCH: } return null; } + +void +SubBaseSelection::OnTelephonyCallStatusChangedN (CallStatus callStatus, CallInfo * pCallInfo) +{ + AppLogDebug("SubBaseSelection::OnTelephonyCallStatusChangedN"); + _pListView->UpdateList(); +} diff --git a/src/MfSubFolderFileListForm.cpp b/src/MfSubFolderFileListForm.cpp index f85f35f..8a65d10 100644 --- a/src/MfSubFolderFileListForm.cpp +++ b/src/MfSubFolderFileListForm.cpp @@ -100,8 +100,6 @@ SubFolderFileListForm::OnInitializing(void) String ThumbnailProviderPath; String rootParentPath; String displayPath; - //String buttonHome; - //String buttonUp; String extensionVisibility; SceneId currentSceneId; @@ -111,8 +109,6 @@ SubFolderFileListForm::OnInitializing(void) Bitmap* pBitmapHomeButtonPress = null; Bitmap* pBitmapUpButtonPress = null; - //AddOrientationEventListener(*this); - //SetOrientation(ORIENTATION_AUTOMATIC_FOUR_DIRECTION); String SubDirectorySceneOne(L"ScnSubDirectoryForm"), SubDirecorySceneTwo(L"ScnSubDirectoryForm1"); @@ -136,10 +132,6 @@ SubFolderFileListForm::OnInitializing(void) //Set FormBackEvent Listener SetFormBackEventListener(this); - //Set Orientation Event Listener - // AddOrientationEventListener(*this); - // SetOrientation(ORIENTATION_AUTOMATIC_FOUR_DIRECTION); - //Get the label control from IDL_SUB_DIRECTORY _pLabelDisplayPath = static_cast< Label* >(GetControl("IDC_LABEL_DISPLAY_PATH")); TryCatch(_pLabelDisplayPath != null, , "Label is Null"); diff --git a/src/MfSubFolderSelection.cpp b/src/MfSubFolderSelection.cpp index 56d02f7..873835c 100644 --- a/src/MfSubFolderSelection.cpp +++ b/src/MfSubFolderSelection.cpp @@ -1,1317 +1,1324 @@ -// -// Copyright (c) 2012 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.1 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/** - * @file: MfSubFolderSelection.cpp - * @brief: This file contains the implementation of SubFolderSelection class, - * which acts an AppControl for the SubDirectories. - */ - -#include "MfMyFilesApp.h" -#include "MfSubFolderSelection.h" -#include "MfSceneRegister.h" -#include "MfUtility.h" - -using namespace Tizen::App; -using namespace Tizen::Base; -using namespace Tizen::Base::Collection; -using namespace Tizen::Base::Utility; -using namespace Tizen::Content; -using namespace Tizen::Graphics; -using namespace Tizen::Locales; -using namespace Tizen::Media; -using namespace Tizen::System; -using namespace Tizen::Ui; -using namespace Tizen::Ui::Controls; -using namespace Tizen::Ui::Scenes; -using namespace Tizen::Io; - -SubFolderSelection::SubFolderSelection(void) - : __pReceivedFilename(null) - , __pHomeButton(null) - , __pUpButton(null) - , __pMoreContextMenu(null) - , __pLabelDisplayPath(null) - , __pFileEventManager(null) -{ - //Do Nothing -} - -SubFolderSelection::~SubFolderSelection(void) -{ - if (__pHomeButton != null) - { - delete __pHomeButton; - } - - if (__pUpButton != null) - { - delete __pUpButton; - } - if (__pMoreContextMenu != null) - { - delete __pMoreContextMenu; - } - if (__pFileEventManager != null) - { - delete __pFileEventManager; - } -} - -SubFolderSelection& -SubFolderSelection::operator =(const SubFolderSelection& pSubFolderSelection) -{ - return *this; -} - -SubFolderSelection::SubFolderSelection(const SubFolderSelection& pSubFolderSelection) -{ - //Do Nothing -} - - -bool -SubFolderSelection::Initialize(void) -{ - AppLogDebug("Entry"); - Form::Construct(L"IDL_SUB_FOLDER_FILE_SELECTION"); - AppLogDebug("Exit"); - return true; -} - -result -SubFolderSelection::OnInitializing(void) -{ - AppLogDebug("Entry"); - result r = E_SUCCESS; - String buttonCancel; - String buttonAttach; - String buttonCreate; - String buttonFolder; - String buttonHome; - String buttonUp; - String buttonExport; - String buttonHere; - String buttonExportHere; - String displayPath; - ButtonItem footerItemMenu; - int xPos = 0, yPos = 0; - - CreateItemSource createitemsource = CREATE_ITEM_SOURCE_SUB_FOLDER_SELECTION; - - AppResource* pAppResource = null; - Bitmap* pBitmapHomeButton = null; - Bitmap* pBitmapUpButton = null; - Bitmap* pBitmapHomeButtonPress = null; - Bitmap* pBitmapUpButtonPress = null; - Bitmap* pBitmap = null; - Bitmap* pBitmapPress = null; - Bitmap* pBitmapDisabled = null; - - __pReceivedFilename = new (std::nothrow) String(); - - _pListView = static_cast< ListView* >(GetControl("IDC_SUB_FOLDER_SELECTION_LISTVIEW")); - TryCatch(_pListView != null, , "Failed to get list view control"); - - _pListView->AddListViewItemEventListener(*this); - _pListView->SetItemProvider(*this); - _pListView->SetShowState(false); - - _selectionMode = ((MyFilesApp*) Application::GetInstance())->GetCurrentSelectionMode(); - _currentFileType = ((MyFilesApp*) Application::GetInstance())->GetCurrentFileType(); - _currentViewStyle = ((MyFilesApp*) Application::GetInstance())->GetCurrentView(); - _currentExportFileType = ((MyFilesApp*) Application::GetInstance())->GetCurrentExportFileType(); - - __pLabelDisplayPath = static_cast< Label* >(GetControl("IDC_SUB_FOLDER_SELECTION_LABEL_DISPLAY_PATH")); - TryCatch(__pLabelDisplayPath != null, , "Label is Null"); - - pAppResource = UiApp::GetInstance()->GetAppResource(); - TryCatch(pAppResource != null, , "Resource manager not found!"); - - displayPath = defaultPhoneBody; - displayPath.Append("/"); - - //pAppResource->GetString(L"IDS_MF_BUTTON_HOME", buttonHome); - pAppResource->GetString(L"IDS_COM_POP_ATTACH", buttonAttach); - pAppResource->GetString(L"IDS_COM_POP_CANCEL", buttonCancel); - pAppResource->GetString(L"IDS_EXPORT_HERE", buttonExportHere); - //pAppResource->GetString(L"IDS_MF_TAB_UP", buttonUp); - pBitmap = pAppResource->GetBitmapN(IDB_MORE, BITMAP_PIXEL_FORMAT_ARGB8888); - pBitmapPress = pAppResource->GetBitmapN(IDB_MORE_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888); - pBitmapDisabled = pAppResource->GetBitmapN(IDB_MORE_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888); - pBitmapHomeButton = pAppResource->GetBitmapN(IDB_HOME_BUTTON_ICON, BITMAP_PIXEL_FORMAT_ARGB8888); - pBitmapUpButton = pAppResource->GetBitmapN(IDB_UP_BUTTON_ICON, BITMAP_PIXEL_FORMAT_ARGB8888); - pBitmapHomeButtonPress = pAppResource->GetBitmapN(IDB_HOME_BUTTON_ICON_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888); - pBitmapUpButtonPress = pAppResource->GetBitmapN(IDB_UP_BUTTON_ICON_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888); - - __displayPath = displayPath; - - _pFolderBitmap = pAppResource->GetBitmapN(IDB_FOLDER, BITMAP_PIXEL_FORMAT_ARGB8888); - _pDummyImage = pAppResource->GetBitmapN(IDB_DUMMY_IMG, BITMAP_PIXEL_FORMAT_ARGB8888); - - _pAudioPlay = MfUtility::MergeBitmapN(IDB_PLAY_OUTER_CIRCLE, IDB_PLAY, 64, 64); - _pAudioPause = MfUtility::MergeBitmapN(IDB_PLAY_OUTER_CIRCLE, IDB_PAUSE, 64, 64); - - _pFooter = GetFooter(); - - if (_currentViewStyle == APPCONTROL_VIEW_EXPORT) - { - pAppResource->GetString(L"IDS_EXPORT", buttonExport); - - footerItemMenu.Construct(BUTTON_ITEM_STYLE_ICON, IDA_BTN_MORE); - if (pBitmap != null) - { - pBitmap->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE)); - footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmap); - } - if (pBitmapPress != null) - { - pBitmapPress->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE)); - footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapPress); - } - if (pBitmapDisabled != null) - { - pBitmapDisabled->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE)); - footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapDisabled); - } - if (_pFooter != null) - { - _pFooter->GetPosition(xPos, yPos); - } - __pMoreContextMenu = new (std::nothrow) ContextMenu(); - __pMoreContextMenu->Construct(Point(0 , yPos), CONTEXT_MENU_STYLE_LIST); - __pMoreContextMenu->AddActionEventListener(*this); - __pMoreContextMenu->SetShowState(true); - } - - _pHeader = GetHeader(); - TryCatch(_pHeader != null, , "Header is Null"); - - __pHomeButton = new (std::nothrow) ButtonItem(); - __pHomeButton->Construct(BUTTON_ITEM_STYLE_TEXT, IDA_BTN_HOME); - __pHomeButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, pBitmapHomeButton); - __pHomeButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, pBitmapHomeButtonPress); - - __pUpButton = new (std::nothrow) ButtonItem(); - __pUpButton->Construct(BUTTON_ITEM_STYLE_TEXT, IDA_BTN_UP); - __pUpButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, pBitmapUpButton); - __pUpButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, pBitmapUpButtonPress); - - _pHeader->SetButton(BUTTON_POSITION_LEFT, *__pHomeButton); - _pHeader->SetButton(BUTTON_POSITION_RIGHT, *__pUpButton); - _pHeader->AddActionEventListener(*this); - - if (_currentViewStyle == APPCONTROL_VIEW_EXPORT) - { - _pExport = new (std::nothrow) FooterItem(); - r = _pExport->Construct(IDA_BTN_EXPORT); - _pExport->SetText(buttonExportHere); - - } - else - { - _pAttach = new (std::nothrow) FooterItem(); - r = _pAttach->Construct(IDA_BTN_ATTACH); - _pAttach->SetText(buttonAttach); - } - - TryCatch(_pFooter != null, , "Footer is Null"); - - if (_pFooter != null) - { - _pFooter->RemoveAllButtons(); - _pFooter->RemoveAllItems(); - _pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT); - - if (_currentViewStyle == APPCONTROL_VIEW_EXPORT) - { - _pFooter->AddItem(*_pExport); - _pFooter->SetButton(BUTTON_POSITION_LEFT, footerItemMenu); - //_pFooter->AddItem(*_pCreateFolder); - } - else - { - _pFooter->AddItem(*_pAttach); - } - - //_pFooter->AddItem(*_pCancel); - _pFooter->AddActionEventListener(*this); - _pFooter->SetBackButton(); - SetFormBackEventListener(this); - if (_currentViewStyle != APPCONTROL_VIEW_EXPORT) - { - _pFooter->SetItemEnabled(0, false); - } - _pFooter->Invalidate(true); - } - - CreateLabelControl(); - - __defaultListViewBounds = _pListView->GetBounds(); - - _pFolderEntryPM = new (std::nothrow) FolderEntryPresentationModel(); - TryCatch(_pFolderEntryPM != null, , "Failed to allocate memory"); - _pFolderEntryPM->Construct(); - _pFolderEntryPM->SetSourceForm(createitemsource); - - _rootMediaPath = FolderNavigationPresentationModel::GetCurrentPath(); - _rootStoragePath = BasePresentationModel::GetSdCardPath(); - - if (_currentViewStyle != APPCONTROL_VIEW_EXPORT) - { - _pFolderEntryPM->SetFolderEntryType(_currentFileType); - _pFolderEntryPM->SetFolderEntryPath(_rootMediaPath); - _pFilenames = _pFolderEntryPM->GetFolderEntryList(); - TryCatch(_pFilenames != null, , "MfMyFilesApp::Failed to allocate Memory to Filenames ArrayList"); - } - - _pThumbnailManager = ThumbnailManager::GetInstance(); - TryCatch(_pThumbnailManager != null, , "Thumbnail Manager not found!"); - - _pFileManager = FolderEntryEditorPresentationModel::GetInstance(); - TryCatch(_pFileManager != null, , "File Manager not found!"); - - InitializeAppRegistry(); - - if (_currentViewStyle == APPCONTROL_VIEW_EXPORT) - { - __pLabelDisplayPath->SetShowState(true); - _pLabelNumberOfItems->SetShowState(false); - } - - AppLogDebug("Exit %s", GetErrorMessage(r)); - -#if 0 - DataBindingContext* pContext = null; - - pContext = GetDataBindingContextN(); - TryCatch(pContext != null, , "Failed to Fetch the DataBinding Context"); - - pContext->Bind(L"ID_APPCONTROL_DISPLAY_PATH", L"IDC_SUB_FOLDER_SELECTION_LABEL_DISPLAY_PATH", L"text", __displayPath, DATA_BINDING_DATA_TYPE_STRING, DATA_BINDING_FLOW_TWO_WAY, DATA_BINDING_TRIGGER_EXPLICIT, null, null, null); - - delete pContext; - -#endif - - delete pBitmapHomeButton; - delete pBitmapUpButton; - delete pBitmapHomeButtonPress; - delete pBitmapUpButtonPress; - delete pBitmapDisabled; - delete pBitmap; - delete pBitmapPress; - AppLogDebug("Exit: %s", GetErrorMessage(r)); - return r; - -CATCH: - if (pBitmapHomeButton != null) - { - delete pBitmapHomeButton; - pBitmapHomeButton = null; - } - - if (pBitmapUpButton != null) - { - delete pBitmapUpButton; - pBitmapUpButton = null; - } - if (pBitmapHomeButtonPress != null) - { - delete pBitmapHomeButtonPress; - pBitmapHomeButtonPress = null; - } - if (pBitmapUpButtonPress != null) - { - delete pBitmapUpButtonPress; - pBitmapUpButtonPress = null; - } - r = E_FAILURE; - AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); - return r; -} - -result -SubFolderSelection::OnTerminating(void) -{ - result r = E_SUCCESS; - - _pHeader = GetHeader(); - if (_pHeader != null) - { - _pHeader->RemoveAllButtons(); - _pHeader->RemoveAllItems(); - } - - _pFooter = GetFooter(); - if (_pFooter != null) - { - _pFooter->RemoveAllButtons(); - _pFooter->RemoveAllItems(); - } - - return r; -} - -void -SubFolderSelection::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status) -{ - //empty implementation -} - -void -SubFolderSelection::OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback) -{ - //empty implementation -} - -void -SubFolderSelection::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status) -{ - AppLogDebug("Entry"); - result r = E_SUCCESS; - String selectFiles; - String selectedCount; - String selectedRootMediaPath; - DirectoryEntry* pDirStr = null; - String nextFilename; - int selectedItemsCount = 0; - int itemcount = 0; - AppResource* pAppResource = null; - SceneManager* pSceneManager = null; - ArrayList* pArgs = null; - bool itemStatus = false; - Integer currentIndex = index; - RelativeLayout* pLayout = null; - - pArgs = new (std::nothrow) ArrayList(); - pArgs->Construct(); - - pSceneManager = SceneManager::GetInstance(); - pAppResource = Application::GetInstance()->GetAppResource(); - TryCatch(pAppResource != null, , "Resource manager not found!"); - - pAppResource->GetString(L"IDS_SELECT_FILES", selectFiles); - pAppResource->GetString(L"IDS_COM_BODY_SELECTED", selectedCount); - - itemStatus = _pFileManager->GetCheckedList()->ContainsKey(currentIndex /*,itemStatus*/); - - if (elementId == CONTENT_LIST_ITEM_TYPE_PLAY || elementId == CONTENT_LIST_ITEM_TYPE_PAUSE) - { - pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index)); - TryCatch(pDirStr != null, , "pDirStr is null"); - - if (!itemStatus) - { - listView.SetItemChecked(index, false); - } - else - { - listView.SetItemChecked(index, true); - } - - if (_pAudioPlayer == null) - { - InitializePlayer(); - LoadMusicPlayer(pDirStr->GetFullFilePath(), PLAYER_STATE_INITIALIZED); - _previousAudioSelected = index; - _currentAudioPlayIndex = index; - _pListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); - - return; - } - - if (_previousAudioSelected == index) - { - if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING) - { - _pAudioPlayer->Pause(); - } - else - { - LoadMusicPlayer(pDirStr->GetFullFilePath(), PLAYER_STATE_INITIALIZED); - } - } - else - { - _pAudioPlayer->Stop(); - _pAudioPlayer->Close(); - _pListView->RefreshList(_previousAudioSelected, LIST_REFRESH_TYPE_ITEM_MODIFY); - _previousAudioSelected = index; - - LoadMusicPlayer(pDirStr->GetFullFilePath(), PLAYER_STATE_STOPPED); - } - _currentAudioPlayIndex = index; - _pListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); - //listView.SetItemChecked(index, false); - return; - } - - if (_pFilenames != null) //start of FILENAME check if - { - pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index)); - - if (pDirStr != null) //start of NULL check if - { - if (pDirStr->IsDirectory()) // start of DIRECTORY CHECK if - { - selectedRootMediaPath = pDirStr->GetFullFilePath(); - nextFilename = pDirStr->GetFileName(); - - if (_rootMediaPath != null) - { - _rootMediaPath.Clear(); - _rootMediaPath.Append(selectedRootMediaPath); - } - - if (_pAudioPlayer != null) - { - if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING || _pAudioPlayer->GetState() == PLAYER_STATE_PAUSED) - { - _pAudioPlayer->Stop(); - _pAudioPlayer->Close(); - } - } - FolderNavigationPresentationModel::SetCurrentFilePath(_rootMediaPath); - - pArgs->Add(&nextFilename); - pArgs->Add(&_rootMediaPath); - ClearSelectedItems(listView); - pSceneManager->GoForward(ForwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs); - } // end of DIRECTORY CHECK if - else //start of FILE CHECK else - { - if (listView.IsItemChecked(index) == true) - { - _pFileManager->AddCheckedListEntry(index, pDirStr); - } - else - { - _pFileManager->RemoveCheckedListEntry(index); - } - - if (_selectionMode == SELECTION_MODE_SINGE) - { - if (listView.IsItemChecked(_storePreviousIndex) == true && _storePreviousIndex != index) - { - listView.SetItemChecked(_storePreviousIndex, false); - _pListView->RefreshList(_storePreviousIndex, LIST_REFRESH_TYPE_ITEM_MODIFY); - _pFileManager->RemoveCheckedListEntry(_storePreviousIndex); - } - _storePreviousIndex = index; - } - } //end of FILE CHECK else - } //end of NULL check if - - for (itemcount = 0; itemcount <= GetItemCount(); itemcount++) - { - if (listView.IsItemChecked(itemcount) == true) - { - selectedItemsCount++; - } - } - - if (selectedItemsCount != 0) - { - r = _pFooter->SetItemEnabled(0, true); - } - else - { - if (_currentViewStyle != APPCONTROL_VIEW_EXPORT) - { - _pFooter->SetItemEnabled(0, false); - } - } - - if (_selectionMode == SELECTION_MODE_MULTIPLE) // start of MULTIPLE_MODE_SELECTION if - { - - pLayout = dynamic_cast (Form::GetLayoutN()); - if (pLayout != null) - { - pLayout->SetRelation(*_pListView, _pLabelNumberOfItems,RECT_EDGE_RELATION_BOTTOM_TO_TOP); - } - - if (selectedItemsCount > 0) - { - _itemSelectedCount.Clear(); - _itemSelectedCount.Append(selectedCount); - _itemSelectedCount.Append(L"\x200E"); - _itemSelectedCount.Append(L"("); - _itemSelectedCount.Append(selectedItemsCount); - _itemSelectedCount.Append(L")"); - _itemSelectedCount.Append(L"\x200E"); - _pLabelNumberOfItems->SetText(_itemSelectedCount); - } - else - { - _itemSelectedCount.Clear(); - _itemSelectedCount.Append(selectFiles); - _pLabelNumberOfItems->SetText(_itemSelectedCount); - } - - _pLabelNumberOfItems->Invalidate(true); - - delete pLayout; - } - } //end of FILENAME check if - - _pFooter->Invalidate(true); - - AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); - return; -CATCH: - r = GetLastResult(); - if (_pFolderEntryPM != null) - { - delete _pFolderEntryPM; - _pFolderEntryPM = null; - } - AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); -} - -void -SubFolderSelection::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction) -{ - //empty implementation -} - -void -SubFolderSelection::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, - const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs) -{ - - RelativeLayout* pLayout = null; - - SceneManager::GetInstance()->AddSceneManagerEventListener(*this); - - ((MyFilesApp*) Application::GetInstance())->SetAudioNotificationListener(this); - _itemSelectedCount.Clear(); - - if (_pFileManager != null) - { - if (!_pFileManager->IsCheckedListNull()) - { - _pFileManager->ClearCheckedList(); - } - } - if (_selectionMode == SELECTION_MODE_SINGE) // start of MULTIPLE_MODE_SELECTION if - { - pLayout = dynamic_cast (Form::GetLayoutN()); - if (pLayout != null) - { - pLayout->SetRelation(*_pListView, this ,RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM); - } - - delete pLayout; - - } - if (pArgs != null) - { - __pReceivedFilename->Clear(); - __pReceivedFilename->Append(*static_cast(pArgs->GetAt(0))); - } - else - { - if (_currentViewStyle == APPCONTROL_VIEW_EXPORT) - { - String headerDisplayPath = FolderNavigationPresentationModel::GetCurrentPath(); - SetHeaderTitleText(headerDisplayPath); - __pReceivedFilename->Clear(); - } - } - - ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this); - - if (pArgs != null) - { - pArgs->RemoveAll(false); - delete pArgs; - } -} - -void -SubFolderSelection::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, - const Tizen::Ui::Scenes::SceneId& nextSceneId) -{ - DeviceManager::RemoveAllDeviceEventListeners(); - ((MyFilesApp*)Application::GetInstance())->SetCurrentView(null); - ((MyFilesApp*) Application::GetInstance())->SetAudioNotificationListener(null); - _pFolderEntryPM->StopThumbnailManager(true); - - if(__pFileEventManager != null) - { - __pFileEventManager->RemovePath(_rootMediaPath); - } -} - -void -SubFolderSelection::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) -{ - AppLogDebug("Entry"); - - String createFolder; - Bitmap* pBitmapCreateFolder = null; - AppResource* pAppResource = null; - pAppResource = UiApp::GetInstance()->GetAppResource(); - if (pAppResource != null) - { - pAppResource->GetString(L"IDS_COM_BODY_CREATE_FOLDER", createFolder); - pBitmapCreateFolder = pAppResource->GetBitmapN(IDB_POPUP_CREATE_FOLDER_ICON, BITMAP_PIXEL_FORMAT_ARGB8888); - } - - switch (actionId) - { - case IDA_BTN_HOME: - { - ShowHomeView(); - _pFolderEntryPM->InitThumbnailManager(); - } - break; - - case IDA_BTN_UP: - { - ShowParentDirectoryView(); - _pFolderEntryPM->InitThumbnailManager(); - } - break; - - case IDA_BTN_MORE: - { - __pMoreContextMenu->RemoveAllItems(); - __pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE)); - __pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE)); - __pMoreContextMenu->AddItem(createFolder, IDA_BTN_CREATE_FOLDER, *pBitmapCreateFolder, null, null); - __pMoreContextMenu->SetShowState(true); - __pMoreContextMenu->Show(); - } - break; - - default: - { - SubBaseOnActionPerformed(source, actionId); - } - break; - } - AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); -} - -void -SubFolderSelection::ShowParentDirectoryView(void) -{ - AppLogDebug("Entry"); - result r = E_SUCCESS; - String displayPath; - String ParentPath; - - displayPath = defaultPhoneBody; - displayPath.Append("/"); - - ParentPath = FolderNavigationPresentationModel::GetParentPath(); - //_pFileManager->ClearCheckedList(); - - if (FolderNavigationPresentationModel::GetCurrentPath() == BasePresentationModel::GetMediaPath() || FolderNavigationPresentationModel::GetCurrentPath() == BasePresentationModel::GetSdCardPath()) - { - _pFileManager->ClearCheckedList(); - ShowHomeView(); - } - else - { - if (_currentViewStyle != APPCONTROL_VIEW_EXPORT) - { - ResetFooter(); - } - - if (_pAudioPlayer != null) - { - if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING || _pAudioPlayer->GetState() == PLAYER_STATE_PAUSED) - { - _pAudioPlayer->Stop(); - _pAudioPlayer->Close(); - } - } - _rootMediaPath.Clear(); - _rootMediaPath.Append(ParentPath); - - FolderNavigationPresentationModel::SetCurrentFilePath(_rootMediaPath); - - SetParentDisplayPath(); - SetHeaderTitleText(ParentPath); - - //Remove the current files from the filenames list - if (_pFolderEntryPM != null) - { - _pFolderEntryPM->SetFolderEntryPath(ParentPath); - //Get the files in the parent path of the current view - _pFilenames = _pFolderEntryPM->GetFolderEntryList(); - TryCatch(_pFilenames != null, , "Failed to fetch ArrayList from the ContentBrowser!"); - } - - if (_pListView != null) - { - _pListView->UpdateList(); - _storePreviousIndex = 0; - } - } - - AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); - return; -CATCH: - r = E_FAILURE; - if (_pFolderEntryPM != null) - { - delete _pFolderEntryPM; - _pFolderEntryPM = null; - } - AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); -} - -void -SubFolderSelection::SetParentDisplayPath(void) -{ - String dislayPath; - String delim(L"/"); - String parentDisplayPath; - String token; - -#if 0 - DataBindingContext* pContext = null; - pContext = GetDataBindingContextN(); - - if (pContext != null) - { - //Update binding on the source to fetch the current display path. - pContext->UpdateBinding(L"ID_APPCONTROL_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_SOURCE); - } -#endif - - StringTokenizer tokenizer(__displayPath, delim); - - //Use a string tokenizer to get the filepath until it's the last token, break the loop when - //it is the last token - while (tokenizer.HasMoreTokens()) - { - int tokenCount = tokenizer.GetTokenCount(); - - if (tokenCount != 1) - { - tokenizer.GetNextToken(token); - parentDisplayPath.Append(token); - parentDisplayPath.Append(L"/"); - } - else - { - break; - } - } - - //Set the display path to that of the generated filepath from the tokenizer - __displayPath = parentDisplayPath; - -#if 0 - if (pContext != null) - { - //Update Binding on the Target control to display the currently constructed path. - pContext->UpdateBinding(L"ID_APPCONTROL_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_TARGET); - } - - if (pContext != null) - { - delete pContext; - } -#endif - - if (__pLabelDisplayPath != null) - { - __pLabelDisplayPath->SetText(__displayPath); - __pLabelDisplayPath->Invalidate(true); - } -} - -void -SubFolderSelection::SetHeaderTitleText(Tizen::Base::String& filePath) -{ - String token; - String parentFileName; - String delimiter(L"/"); - StringTokenizer tokenizer(filePath, delimiter); - - AppResource* pAppResource = null; - - pAppResource = UiApp::App::GetInstance()->GetAppResource(); - - if (filePath == BasePresentationModel::GetMediaPath()) - { - if (pAppResource != null) - { - pAppResource->GetString(L"IDS_MF_TAB_PHONE", parentFileName); - } - } - else if (filePath == BasePresentationModel::GetSdCardPath()) - { - if (pAppResource != null) - { - pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", parentFileName); - } - } - else - { - while (tokenizer.HasMoreTokens()) - { - int tokenCount = tokenizer.GetTokenCount(); - - if (tokenCount == 1) - { - tokenizer.GetNextToken(parentFileName); - } - else - { - tokenizer.GetNextToken(token); - } - } - } - - if (_pHeader != null) - { - if (!parentFileName.IsEmpty()) - { - _pHeader->SetTitleText(parentFileName); - _pHeader->Invalidate(true); - } - } -} - -void -SubFolderSelection::SetNextDisplayPath(void) -{ - String displayPath; - String delim(L"/"); - String token; - String fullPath; -#if 0 - DataBindingContext* pContext = null; - pContext = GetDataBindingContextN(); -#endif - - fullPath = FolderNavigationPresentationModel::GetCurrentPath(); - //fullPath = __rootMediaPath; - - StringTokenizer tokenizer(fullPath, delim); - - int Counter = 0; - switch (_storageType) - { - case MEMORY_TYPE_PHONE: - { - Counter = 3; - } - break; - - case MEMORY_TYPE_SD_CARD: - { - Counter = 3; - } - break; - - default: - //Do Nothing. - break; - } - - //Use a string tokenizer to get the filepath until it's the last token, break the loop when - //it is the last token - while (tokenizer.HasMoreTokens()) - { - if (Counter > 0) - { - Counter--; - tokenizer.GetNextToken(token); - } - else - { - tokenizer.GetNextToken(token); - //dislayPath.Append(L"/"); - displayPath.Append(token); - displayPath.Append(L"/"); - } - } - - if (__pLabelDisplayPath != null) - { - __displayPath.Append(displayPath); - __pLabelDisplayPath->SetText(__displayPath); - __pLabelDisplayPath->Invalidate(true); - } - - -#if 0 - if (pContext != null) - { - //UpdateBinding on the target label control. - pContext->UpdateBinding(L"ID_APPCONTROL_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_TARGET); - } - - if (pContext != null) - { - delete pContext; - } -#endif -} - -void -SubFolderSelection::OnDataBindingSourceUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName) -{ - //Empty Implementation. -} - -void -SubFolderSelection::OnDataBindingTargetUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName) -{ - //Empty Implementation. -} - -void -SubFolderSelection::OnDataBindingValidationFailed(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName, Tizen::Ui::DataBindingDestinationType destType) -{ - //Empty Implementation. -} - -void -SubFolderSelection::OnDeviceChange(ComponentType deviceType, const Tizen::Base::String& state) -{ - bool setMediaPath = false; - MemoryType currentMemoryType = MEMORY_TYPE_PHONE; - String unmounted = sdCardStatusUnmounted; - String removed = usbDeviceStatusRemoved; - String currentPath; - IList* pArgs = null; - - SceneManager* pSceneManager = null; - - if (state == unmounted || state == removed) - { - currentPath = FolderNavigationPresentationModel::GetCurrentPath(); - if (state == unmounted) - { - if (currentPath.Contains(BasePresentationModel::GetSdCardPath())) - { - FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetMediaPath()); - FolderNavigationPresentationModel::SetStorageType(currentMemoryType); - setMediaPath = true; - } - } - - if (state == removed) - { - if (currentPath.Contains(BasePresentationModel::GetUsbPath())) - { - FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetMediaPath()); - FolderNavigationPresentationModel::SetStorageType(currentMemoryType); - setMediaPath = true; - } - } - - if (setMediaPath) - { - pSceneManager = SceneManager::GetInstance(); - pArgs = new (std::nothrow) ArrayList(); - pArgs->Add(new (std::nothrow) Integer(APPCONTROL_STATE_SELECTED)); - - if (pSceneManager != null) - { - pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_DESTROY_OPTION_DESTROY), pArgs); - } - } - } -} - -void -SubFolderSelection::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state) -{ - - ComponentType currentDeviceType; - switch (deviceType) - { - case StorageCard: - { - currentDeviceType = COMPONENT_TYPE_STORAGE_CARD; - } - break; - - case UsbClient: - { - currentDeviceType = COMPONENT_TYPE_USB; - } - break; - - default: - { - //Do Nothing. - } - break; - } - OnDeviceChange(currentDeviceType, state); -} - -void -SubFolderSelection::OnPlayerEndOfClip(void) -{ - if (_pListView != null) - { - _pListView->RefreshList(_currentAudioPlayIndex, LIST_REFRESH_TYPE_ITEM_MODIFY); - } -} - - -void -SubFolderSelection::OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId &previousSceneId, const Tizen::Ui::Scenes::SceneId ¤tSceneId) -{ - AppLogDebug("ENTER"); - SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this); - AppResource* pAppResource = null; - String importText; - String displayPath; - String phone; - String sdCard; - String external; - String received_Filepath; - int receivedStorageType = -1; - Tizen::Base::String parentPath; - result r = E_SUCCESS; - pAppResource = Application::GetInstance()->GetAppResource(); - TryCatch(pAppResource != null, , "Resource manager not found!"); - - pAppResource->GetString(L"IDS_COM_OPT_IMPORT", importText); - pAppResource->GetString(L"IDS_MF_TAB_PHONE", phone); - pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", sdCard); - pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", external); - phone.Append(L"/"); - sdCard.Append(L"/"); - external.Append(L"/"); - - if (_pListView != null) - { - _pListView->SetShowState(true); - } - - if (__pFileEventManager != null) - { - delete __pFileEventManager; - __pFileEventManager = null; - - } - __pFileEventManager = new (std::nothrow)FileEventManager(); - __pFileEventManager->Construct(*this); - - r = __pFileEventManager->AddPath(_rootMediaPath, FILE_EVENT_TYPE_ATTRIBUTE | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_DELETE ); - AppLogDebug("Result is %s",GetErrorMessage(r)); - -#if 0 - if (_currentViewStyle == APPCONTROL_VIEW_EXPORT || _currentViewStyle == APPCONTROL_VIEW_IMPORT) - { - AppLogDebug("inside view check"); - String backupPath; - String backupCalendarpath; - String backupContactpath; - backupPath = BasePresentationModel::GetMediaPath(); - backupPath.Append("Backup"); - if (!File::IsFileExist(backupPath)) - { - Directory::Create(backupPath, true); - } - - if ((_currentViewStyle == APPCONTROL_VIEW_IMPORT && _currentFileType == FILE_TYPE_CALENDER_TYPE) - || (_currentViewStyle == APPCONTROL_VIEW_EXPORT && _currentExportFileType == EXPORT_TYPE_CALENDAR)) - { - backupCalendarpath.Append(backupPath); - backupCalendarpath.Append("/"); - backupCalendarpath.Append("Calendar"); - if (!File::IsFileExist(backupCalendarpath)) - { - r = Directory::Create(backupCalendarpath, true); - AppLogDebug("Result is %s",GetErrorMessage(r)); - } - } - if ((_currentViewStyle == APPCONTROL_VIEW_IMPORT && _currentFileType == FILE_TYPE_CONTACTS_TYPE) - || (_currentViewStyle == APPCONTROL_VIEW_EXPORT && _currentExportFileType == EXPORT_TYPE_CONTACTS)) - { - backupContactpath.Append(backupPath); - backupContactpath.Append("/"); - backupContactpath.Append("Contacts"); - if (!File::IsFileExist(backupContactpath)) - { - r = Directory::Create(backupContactpath, true); - AppLogDebug("Result is %s",GetErrorMessage(r)); - } - } - - /*_pFolderEntryPM->SetFolderEntryType(_currentFileType); - _pFolderEntryPM->SetFolderEntryPath(_rootMediaPath); - _pFilenames = _pFolderEntryPM->GetFolderEntryList(); - */ - } -#endif - if (__pReceivedFilename != null) - { - //pReceived_Filename = static_cast< String* >(pArgs->GetAt(0)); - received_Filepath = FolderNavigationPresentationModel::GetCurrentPath(); - receivedStorageType = FolderNavigationPresentationModel::GetStorageType(); - - if (__pReceivedFilename != null && !__pReceivedFilename->IsEmpty()) - { - _pHeader = GetHeader(); - if (_pHeader != null) - { - _pHeader->SetTitleText(*__pReceivedFilename); - _pHeader->Invalidate(true); - } - } - if (received_Filepath != null) - { - - //Clear the rootMediaPath and set it to the received filepath. - //if (_rootMediaPath != null) - { - _rootMediaPath.Clear(); - _rootMediaPath.Append(received_Filepath); - } - - if (__pLabelDisplayPath != null) - { - switch (receivedStorageType) - { - case MEMORY_TYPE_PHONE: - { - __displayPath = phone; - _storageType = MEMORY_TYPE_PHONE; - //AppResource::GetInstance()->GetString(L"IDS_MF_TAB_PHONE", __tabSelected); - } - break; - - case MEMORY_TYPE_SD_CARD: - { - __displayPath = sdCard; - _storageType = MEMORY_TYPE_SD_CARD; - //AppResource::GetInstance()->GetString(L"IDS_SD_CARD", __tabSelected); - } - break; - - case MEMORY_TYPE_EXTERNAL: - { - __displayPath = external; - _storageType = MEMORY_TYPE_EXTERNAL; - } - break; - - default: - { - //Empty Implementation. - } - break; - } - - //Call the function to set the DisplayPath of the label. - SetNextDisplayPath(); - } - - } - } - else - { - _rootMediaPath = FolderNavigationPresentationModel::GetCurrentPath(); - } - - parentPath.Append(_rootMediaPath); - - if (_pFolderEntryPM != null) - { - _pFolderEntryPM->SetFolderEntryPath(parentPath); - _pFilenames = _pFolderEntryPM->GetFolderEntryList(); - TryCatch(_pFilenames != null, , "Failed to allocate Memory to Filenames ArrayList"); - _pFolderEntryPM->InitThumbnailManager(); - } - - if (_pListView != null) - { - _pListView->UpdateList(); - } - - DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); - AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); - return; -CATCH: - AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); -} - -void -SubFolderSelection::OnSceneTransitionStarted (const Tizen::Ui::Scenes::SceneId ¤tSceneId, const Tizen::Ui::Scenes::SceneId &nextSceneId) -{ - -} -void SubFolderSelection::OnPlayerAudioFocusChanged (void) -{ - int AudioPlayerState = _pAudioPlayer->GetState(); - - AppLogDebug("SubFolderSelectionForm %d ++", AudioPlayerState); - if (AudioPlayerState == PLAYER_STATE_PAUSED) - { - AppLogDebug("Pause"); - AppLogDebug("Refreshing %d", _currentAudioPlayIndex); - _pListView->RefreshList(_currentAudioPlayIndex, LIST_REFRESH_TYPE_ITEM_MODIFY); - } - - AppLogDebug("SubFolderSelectionForm--"); -} - -void -SubFolderSelection::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId) -{ - AppLogDebug("SubFolderSelection::OnFileEventOccured:%S", path.GetPointer()); - - if ((events & FILE_EVENT_TYPE_ATTRIBUTE) || (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_TO )) - { - if (_pFolderEntryPM!=null) - { - _pFolderEntryPM->RefreshFolderEntries(); - } - - if (_pListView != null && _pListView->IsVisible()) - { - _pListView->UpdateList(); - } - - if (_pFolderEntryPM!=null) - { - AppLogDebug("inside file event"); - _pFolderEntryPM->InitThumbnailManager(); - } - } -} - -void -SubFolderSelection::OnAudioNotificationReceived(void) -{ - int AudioPlayerState; - - if (_pAudioPlayer != null) - { - AudioPlayerState = _pAudioPlayer->GetState(); - if (AudioPlayerState == PLAYER_STATE_PLAYING) - { - _pAudioPlayer->Pause(); - _pListView->RefreshList(_currentAudioPlayIndex, LIST_REFRESH_TYPE_ITEM_MODIFY); - } - } -} +// +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.1 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://floralicense.org/license/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an AS IS BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file: MfSubFolderSelection.cpp + * @brief: This file contains the implementation of SubFolderSelection class, + * which acts an AppControl for the SubDirectories. + */ + +#include "MfMyFilesApp.h" +#include "MfSubFolderSelection.h" +#include "MfSceneRegister.h" +#include "MfUtility.h" + +using namespace Tizen::App; +using namespace Tizen::Base; +using namespace Tizen::Base::Collection; +using namespace Tizen::Base::Utility; +using namespace Tizen::Content; +using namespace Tizen::Graphics; +using namespace Tizen::Io; +using namespace Tizen::Locales; +using namespace Tizen::Media; +using namespace Tizen::System; +using namespace Tizen::Telephony; +using namespace Tizen::Ui; +using namespace Tizen::Ui::Controls; +using namespace Tizen::Ui::Scenes; + + +SubFolderSelection::SubFolderSelection(void) + : __pReceivedFilename(null) + , __pHomeButton(null) + , __pUpButton(null) + , __pMoreContextMenu(null) + , __pLabelDisplayPath(null) + , __pFileEventManager(null) +{ + //Do Nothing +} + +SubFolderSelection::~SubFolderSelection(void) +{ + if (__pHomeButton != null) + { + delete __pHomeButton; + } + + if (__pUpButton != null) + { + delete __pUpButton; + } + if (__pMoreContextMenu != null) + { + delete __pMoreContextMenu; + } + if (__pFileEventManager != null) + { + delete __pFileEventManager; + } +} + +SubFolderSelection& +SubFolderSelection::operator =(const SubFolderSelection& pSubFolderSelection) +{ + return *this; +} + +SubFolderSelection::SubFolderSelection(const SubFolderSelection& pSubFolderSelection) +{ + //Do Nothing +} + + +bool +SubFolderSelection::Initialize(void) +{ + AppLogDebug("Entry"); + Form::Construct(L"IDL_SUB_FOLDER_FILE_SELECTION"); + AppLogDebug("Exit"); + return true; +} + +result +SubFolderSelection::OnInitializing(void) +{ + AppLogDebug("Entry"); + result r = E_SUCCESS; + String buttonCancel; + String buttonAttach; + String buttonCreate; + String buttonFolder; + String buttonHome; + String buttonUp; + String buttonExport; + String buttonHere; + String buttonExportHere; + String displayPath; + ButtonItem footerItemMenu; + int xPos = 0, yPos = 0; + + CreateItemSource createitemsource = CREATE_ITEM_SOURCE_SUB_FOLDER_SELECTION; + + AppResource* pAppResource = null; + Bitmap* pBitmapHomeButton = null; + Bitmap* pBitmapUpButton = null; + Bitmap* pBitmapHomeButtonPress = null; + Bitmap* pBitmapUpButtonPress = null; + Bitmap* pBitmap = null; + Bitmap* pBitmapPress = null; + Bitmap* pBitmapDisabled = null; + + __pReceivedFilename = new (std::nothrow) String(); + + _pListView = static_cast< ListView* >(GetControl("IDC_SUB_FOLDER_SELECTION_LISTVIEW")); + TryCatch(_pListView != null, , "Failed to get list view control"); + + _pListView->AddListViewItemEventListener(*this); + _pListView->SetItemProvider(*this); + _pListView->SetShowState(false); + + _selectionMode = ((MyFilesApp*) Application::GetInstance())->GetCurrentSelectionMode(); + _currentFileType = ((MyFilesApp*) Application::GetInstance())->GetCurrentFileType(); + _currentViewStyle = ((MyFilesApp*) Application::GetInstance())->GetCurrentView(); + _currentExportFileType = ((MyFilesApp*) Application::GetInstance())->GetCurrentExportFileType(); + + __pLabelDisplayPath = static_cast< Label* >(GetControl("IDC_SUB_FOLDER_SELECTION_LABEL_DISPLAY_PATH")); + TryCatch(__pLabelDisplayPath != null, , "Label is Null"); + + pAppResource = UiApp::GetInstance()->GetAppResource(); + TryCatch(pAppResource != null, , "Resource manager not found!"); + + displayPath = defaultPhoneBody; + displayPath.Append("/"); + + //pAppResource->GetString(L"IDS_MF_BUTTON_HOME", buttonHome); + pAppResource->GetString(L"IDS_COM_POP_ATTACH", buttonAttach); + pAppResource->GetString(L"IDS_COM_POP_CANCEL", buttonCancel); + pAppResource->GetString(L"IDS_EXPORT_HERE", buttonExportHere); + //pAppResource->GetString(L"IDS_MF_TAB_UP", buttonUp); + pBitmap = pAppResource->GetBitmapN(IDB_MORE, BITMAP_PIXEL_FORMAT_ARGB8888); + pBitmapPress = pAppResource->GetBitmapN(IDB_MORE_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888); + pBitmapDisabled = pAppResource->GetBitmapN(IDB_MORE_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888); + pBitmapHomeButton = pAppResource->GetBitmapN(IDB_HOME_BUTTON_ICON, BITMAP_PIXEL_FORMAT_ARGB8888); + pBitmapUpButton = pAppResource->GetBitmapN(IDB_UP_BUTTON_ICON, BITMAP_PIXEL_FORMAT_ARGB8888); + pBitmapHomeButtonPress = pAppResource->GetBitmapN(IDB_HOME_BUTTON_ICON_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888); + pBitmapUpButtonPress = pAppResource->GetBitmapN(IDB_UP_BUTTON_ICON_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888); + + __displayPath = displayPath; + + _pFolderBitmap = pAppResource->GetBitmapN(IDB_FOLDER, BITMAP_PIXEL_FORMAT_ARGB8888); + _pDummyImage = pAppResource->GetBitmapN(IDB_DUMMY_IMG, BITMAP_PIXEL_FORMAT_ARGB8888); + + _pAudioPlay = MfUtility::MergeBitmapN(IDB_PLAY_OUTER_CIRCLE, IDB_PLAY, 64, 64); + _pAudioPause = MfUtility::MergeBitmapN(IDB_PLAY_OUTER_CIRCLE, IDB_PAUSE, 64, 64); + + _pFooter = GetFooter(); + + if (_currentViewStyle == APPCONTROL_VIEW_EXPORT) + { + pAppResource->GetString(L"IDS_EXPORT", buttonExport); + + footerItemMenu.Construct(BUTTON_ITEM_STYLE_ICON, IDA_BTN_MORE); + if (pBitmap != null) + { + pBitmap->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE)); + footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmap); + } + if (pBitmapPress != null) + { + pBitmapPress->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE)); + footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapPress); + } + if (pBitmapDisabled != null) + { + pBitmapDisabled->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE)); + footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapDisabled); + } + if (_pFooter != null) + { + _pFooter->GetPosition(xPos, yPos); + } + __pMoreContextMenu = new (std::nothrow) ContextMenu(); + __pMoreContextMenu->Construct(Point(0 , yPos), CONTEXT_MENU_STYLE_LIST); + __pMoreContextMenu->AddActionEventListener(*this); + __pMoreContextMenu->SetShowState(true); + } + + _pHeader = GetHeader(); + TryCatch(_pHeader != null, , "Header is Null"); + + __pHomeButton = new (std::nothrow) ButtonItem(); + __pHomeButton->Construct(BUTTON_ITEM_STYLE_TEXT, IDA_BTN_HOME); + __pHomeButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, pBitmapHomeButton); + __pHomeButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, pBitmapHomeButtonPress); + + __pUpButton = new (std::nothrow) ButtonItem(); + __pUpButton->Construct(BUTTON_ITEM_STYLE_TEXT, IDA_BTN_UP); + __pUpButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, pBitmapUpButton); + __pUpButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, pBitmapUpButtonPress); + + _pHeader->SetButton(BUTTON_POSITION_LEFT, *__pHomeButton); + _pHeader->SetButton(BUTTON_POSITION_RIGHT, *__pUpButton); + _pHeader->AddActionEventListener(*this); + + if (_currentViewStyle == APPCONTROL_VIEW_EXPORT) + { + _pExport = new (std::nothrow) FooterItem(); + r = _pExport->Construct(IDA_BTN_EXPORT); + _pExport->SetText(buttonExportHere); + + } + else + { + _pAttach = new (std::nothrow) FooterItem(); + r = _pAttach->Construct(IDA_BTN_ATTACH); + _pAttach->SetText(buttonAttach); + } + + TryCatch(_pFooter != null, , "Footer is Null"); + + if (_pFooter != null) + { + _pFooter->RemoveAllButtons(); + _pFooter->RemoveAllItems(); + _pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT); + + if (_currentViewStyle == APPCONTROL_VIEW_EXPORT) + { + _pFooter->AddItem(*_pExport); + _pFooter->SetButton(BUTTON_POSITION_LEFT, footerItemMenu); + //_pFooter->AddItem(*_pCreateFolder); + } + else + { + _pFooter->AddItem(*_pAttach); + } + + //_pFooter->AddItem(*_pCancel); + _pFooter->AddActionEventListener(*this); + _pFooter->SetBackButton(); + SetFormBackEventListener(this); + if (_currentViewStyle != APPCONTROL_VIEW_EXPORT) + { + _pFooter->SetItemEnabled(0, false); + } + _pFooter->Invalidate(true); + } + + CreateLabelControl(); + + _defaultListViewBounds = _pListView->GetBounds(); + + _pFolderEntryPM = new (std::nothrow) FolderEntryPresentationModel(); + TryCatch(_pFolderEntryPM != null, , "Failed to allocate memory"); + _pFolderEntryPM->Construct(); + _pFolderEntryPM->SetSourceForm(createitemsource); + + _rootMediaPath = FolderNavigationPresentationModel::GetCurrentPath(); + _rootStoragePath = BasePresentationModel::GetSdCardPath(); + + if (_currentViewStyle != APPCONTROL_VIEW_EXPORT) + { + _pFolderEntryPM->SetFolderEntryType(_currentFileType); + _pFolderEntryPM->SetFolderEntryPath(_rootMediaPath); + _pFilenames = _pFolderEntryPM->GetFolderEntryList(); + TryCatch(_pFilenames != null, , "MfMyFilesApp::Failed to allocate Memory to Filenames ArrayList"); + } + + _pThumbnailManager = ThumbnailManager::GetInstance(); + TryCatch(_pThumbnailManager != null, , "Thumbnail Manager not found!"); + + _pFileManager = FolderEntryEditorPresentationModel::GetInstance(); + TryCatch(_pFileManager != null, , "File Manager not found!"); + + InitializeAppRegistry(); + + if (_currentViewStyle == APPCONTROL_VIEW_EXPORT) + { + __pLabelDisplayPath->SetShowState(true); + _pLabelNumberOfItems->SetShowState(false); + } + + _pCallManager = new (std::nothrow) CallManager(); + + r = _pCallManager->Construct(*this); + TryCatch(r == E_SUCCESS, , "Failed to Construct CallManager"); + + AppLogDebug("Exit %s", GetErrorMessage(r)); + +#if 0 + DataBindingContext* pContext = null; + + pContext = GetDataBindingContextN(); + TryCatch(pContext != null, , "Failed to Fetch the DataBinding Context"); + + pContext->Bind(L"ID_APPCONTROL_DISPLAY_PATH", L"IDC_SUB_FOLDER_SELECTION_LABEL_DISPLAY_PATH", L"text", __displayPath, DATA_BINDING_DATA_TYPE_STRING, DATA_BINDING_FLOW_TWO_WAY, DATA_BINDING_TRIGGER_EXPLICIT, null, null, null); + + delete pContext; + +#endif + + delete pBitmapHomeButton; + delete pBitmapUpButton; + delete pBitmapHomeButtonPress; + delete pBitmapUpButtonPress; + delete pBitmapDisabled; + delete pBitmap; + delete pBitmapPress; + AppLogDebug("Exit: %s", GetErrorMessage(r)); + return r; + +CATCH: + if (pBitmapHomeButton != null) + { + delete pBitmapHomeButton; + pBitmapHomeButton = null; + } + + if (pBitmapUpButton != null) + { + delete pBitmapUpButton; + pBitmapUpButton = null; + } + if (pBitmapHomeButtonPress != null) + { + delete pBitmapHomeButtonPress; + pBitmapHomeButtonPress = null; + } + if (pBitmapUpButtonPress != null) + { + delete pBitmapUpButtonPress; + pBitmapUpButtonPress = null; + } + r = E_FAILURE; + AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); + return r; +} + +result +SubFolderSelection::OnTerminating(void) +{ + result r = E_SUCCESS; + + _pHeader = GetHeader(); + if (_pHeader != null) + { + _pHeader->RemoveAllButtons(); + _pHeader->RemoveAllItems(); + } + + _pFooter = GetFooter(); + if (_pFooter != null) + { + _pFooter->RemoveAllButtons(); + _pFooter->RemoveAllItems(); + } + + return r; +} + +void +SubFolderSelection::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status) +{ + //empty implementation +} + +void +SubFolderSelection::OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback) +{ + //empty implementation +} + +void +SubFolderSelection::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status) +{ + AppLogDebug("Entry"); + result r = E_SUCCESS; + String selectFiles; + String selectedCount; + String selectedRootMediaPath; + DirectoryEntry* pDirStr = null; + String nextFilename; + int selectedItemsCount = 0; + int itemcount = 0; + AppResource* pAppResource = null; + SceneManager* pSceneManager = null; + ArrayList* pArgs = null; + bool itemStatus = false; + Integer currentIndex = index; + RelativeLayout* pLayout = null; + + pArgs = new (std::nothrow) ArrayList(); + pArgs->Construct(); + + pSceneManager = SceneManager::GetInstance(); + pAppResource = Application::GetInstance()->GetAppResource(); + TryCatch(pAppResource != null, , "Resource manager not found!"); + + pAppResource->GetString(L"IDS_SELECT_FILES", selectFiles); + pAppResource->GetString(L"IDS_COM_BODY_SELECTED", selectedCount); + + itemStatus = _pFileManager->GetCheckedList()->ContainsKey(currentIndex /*,itemStatus*/); + + if (elementId == CONTENT_LIST_ITEM_TYPE_PLAY || elementId == CONTENT_LIST_ITEM_TYPE_PAUSE) + { + pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index)); + TryCatch(pDirStr != null, , "pDirStr is null"); + + if (!itemStatus) + { + listView.SetItemChecked(index, false); + } + else + { + listView.SetItemChecked(index, true); + } + + if (_pAudioPlayer == null) + { + InitializePlayer(); + LoadMusicPlayer(pDirStr->GetFullFilePath(), PLAYER_STATE_INITIALIZED); + _previousAudioSelected = index; + _currentAudioPlayIndex = index; + _pListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + + return; + } + + if (_previousAudioSelected == index) + { + if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING) + { + _pAudioPlayer->Pause(); + } + else + { + LoadMusicPlayer(pDirStr->GetFullFilePath(), PLAYER_STATE_INITIALIZED); + } + } + else + { + _pAudioPlayer->Stop(); + _pAudioPlayer->Close(); + _pListView->RefreshList(_previousAudioSelected, LIST_REFRESH_TYPE_ITEM_MODIFY); + _previousAudioSelected = index; + + LoadMusicPlayer(pDirStr->GetFullFilePath(), PLAYER_STATE_STOPPED); + } + _currentAudioPlayIndex = index; + _pListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY); + //listView.SetItemChecked(index, false); + return; + } + + if (_pFilenames != null) //start of FILENAME check if + { + pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index)); + + if (pDirStr != null) //start of NULL check if + { + if (pDirStr->IsDirectory()) // start of DIRECTORY CHECK if + { + selectedRootMediaPath = pDirStr->GetFullFilePath(); + nextFilename = pDirStr->GetFileName(); + + if (_rootMediaPath != null) + { + _rootMediaPath.Clear(); + _rootMediaPath.Append(selectedRootMediaPath); + } + + if (_pAudioPlayer != null) + { + if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING || _pAudioPlayer->GetState() == PLAYER_STATE_PAUSED) + { + _pAudioPlayer->Stop(); + _pAudioPlayer->Close(); + } + } + FolderNavigationPresentationModel::SetCurrentFilePath(_rootMediaPath); + + pArgs->Add(&nextFilename); + pArgs->Add(&_rootMediaPath); + ClearSelectedItems(listView); + pSceneManager->GoForward(ForwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs); + } // end of DIRECTORY CHECK if + else //start of FILE CHECK else + { + if (listView.IsItemChecked(index) == true) + { + _pFileManager->AddCheckedListEntry(index, pDirStr); + } + else + { + _pFileManager->RemoveCheckedListEntry(index); + } + + if (_selectionMode == SELECTION_MODE_SINGE) + { + if (listView.IsItemChecked(_storePreviousIndex) == true && _storePreviousIndex != index) + { + listView.SetItemChecked(_storePreviousIndex, false); + _pListView->RefreshList(_storePreviousIndex, LIST_REFRESH_TYPE_ITEM_MODIFY); + _pFileManager->RemoveCheckedListEntry(_storePreviousIndex); + } + _storePreviousIndex = index; + } + } //end of FILE CHECK else + } //end of NULL check if + + for (itemcount = 0; itemcount <= GetItemCount(); itemcount++) + { + if (listView.IsItemChecked(itemcount) == true) + { + selectedItemsCount++; + } + } + + if (selectedItemsCount != 0) + { + r = _pFooter->SetItemEnabled(0, true); + } + else + { + if (_currentViewStyle != APPCONTROL_VIEW_EXPORT) + { + _pFooter->SetItemEnabled(0, false); + } + } + + if (_selectionMode == SELECTION_MODE_MULTIPLE) // start of MULTIPLE_MODE_SELECTION if + { + + pLayout = dynamic_cast (Form::GetLayoutN()); + if (pLayout != null) + { + pLayout->SetRelation(*_pListView, _pLabelNumberOfItems,RECT_EDGE_RELATION_BOTTOM_TO_TOP); + } + + if (selectedItemsCount > 0) + { + _itemSelectedCount.Clear(); + _itemSelectedCount.Append(selectedCount); + _itemSelectedCount.Append(L"\x200E"); + _itemSelectedCount.Append(L"("); + _itemSelectedCount.Append(selectedItemsCount); + _itemSelectedCount.Append(L")"); + _itemSelectedCount.Append(L"\x200E"); + _pLabelNumberOfItems->SetText(_itemSelectedCount); + } + else + { + _itemSelectedCount.Clear(); + _itemSelectedCount.Append(selectFiles); + _pLabelNumberOfItems->SetText(_itemSelectedCount); + } + + _pLabelNumberOfItems->Invalidate(true); + + delete pLayout; + } + } //end of FILENAME check if + + _pFooter->Invalidate(true); + + AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); + return; +CATCH: + r = GetLastResult(); + if (_pFolderEntryPM != null) + { + delete _pFolderEntryPM; + _pFolderEntryPM = null; + } + AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); +} + +void +SubFolderSelection::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction) +{ + //empty implementation +} + +void +SubFolderSelection::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, + const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs) +{ + + RelativeLayout* pLayout = null; + + SceneManager::GetInstance()->AddSceneManagerEventListener(*this); + + ((MyFilesApp*) Application::GetInstance())->SetAudioNotificationListener(this); + _itemSelectedCount.Clear(); + + if (_pFileManager != null) + { + if (!_pFileManager->IsCheckedListNull()) + { + _pFileManager->ClearCheckedList(); + } + } + if (_selectionMode == SELECTION_MODE_SINGE) // start of MULTIPLE_MODE_SELECTION if + { + pLayout = dynamic_cast (Form::GetLayoutN()); + if (pLayout != null) + { + pLayout->SetRelation(*_pListView, this ,RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM); + } + + delete pLayout; + + } + if (pArgs != null) + { + __pReceivedFilename->Clear(); + __pReceivedFilename->Append(*static_cast(pArgs->GetAt(0))); + } + else + { + if (_currentViewStyle == APPCONTROL_VIEW_EXPORT) + { + String headerDisplayPath = FolderNavigationPresentationModel::GetCurrentPath(); + SetHeaderTitleText(headerDisplayPath); + __pReceivedFilename->Clear(); + } + } + + ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this); + + if (pArgs != null) + { + pArgs->RemoveAll(false); + delete pArgs; + } +} + +void +SubFolderSelection::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, + const Tizen::Ui::Scenes::SceneId& nextSceneId) +{ + DeviceManager::RemoveAllDeviceEventListeners(); + ((MyFilesApp*)Application::GetInstance())->SetCurrentView(null); + ((MyFilesApp*) Application::GetInstance())->SetAudioNotificationListener(null); + _pFolderEntryPM->StopThumbnailManager(true); + + if(__pFileEventManager != null) + { + __pFileEventManager->RemovePath(_rootMediaPath); + } +} + +void +SubFolderSelection::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) +{ + AppLogDebug("Entry"); + + String createFolder; + Bitmap* pBitmapCreateFolder = null; + AppResource* pAppResource = null; + pAppResource = UiApp::GetInstance()->GetAppResource(); + if (pAppResource != null) + { + pAppResource->GetString(L"IDS_COM_BODY_CREATE_FOLDER", createFolder); + pBitmapCreateFolder = pAppResource->GetBitmapN(IDB_POPUP_CREATE_FOLDER_ICON, BITMAP_PIXEL_FORMAT_ARGB8888); + } + + switch (actionId) + { + case IDA_BTN_HOME: + { + ShowHomeView(); + _pFolderEntryPM->InitThumbnailManager(); + } + break; + + case IDA_BTN_UP: + { + ShowParentDirectoryView(); + _pFolderEntryPM->InitThumbnailManager(); + } + break; + + case IDA_BTN_MORE: + { + __pMoreContextMenu->RemoveAllItems(); + __pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE)); + __pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE)); + __pMoreContextMenu->AddItem(createFolder, IDA_BTN_CREATE_FOLDER, *pBitmapCreateFolder, null, null); + __pMoreContextMenu->SetShowState(true); + __pMoreContextMenu->Show(); + } + break; + + default: + { + SubBaseOnActionPerformed(source, actionId); + } + break; + } + AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); +} + +void +SubFolderSelection::ShowParentDirectoryView(void) +{ + AppLogDebug("Entry"); + result r = E_SUCCESS; + String displayPath; + String ParentPath; + + displayPath = defaultPhoneBody; + displayPath.Append("/"); + + ParentPath = FolderNavigationPresentationModel::GetParentPath(); + //_pFileManager->ClearCheckedList(); + + if (FolderNavigationPresentationModel::GetCurrentPath() == BasePresentationModel::GetMediaPath() || FolderNavigationPresentationModel::GetCurrentPath() == BasePresentationModel::GetSdCardPath()) + { + _pFileManager->ClearCheckedList(); + ShowHomeView(); + } + else + { + if (_currentViewStyle != APPCONTROL_VIEW_EXPORT) + { + ResetFooter(); + } + + if (_pAudioPlayer != null) + { + if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING || _pAudioPlayer->GetState() == PLAYER_STATE_PAUSED) + { + _pAudioPlayer->Stop(); + _pAudioPlayer->Close(); + } + } + _rootMediaPath.Clear(); + _rootMediaPath.Append(ParentPath); + + FolderNavigationPresentationModel::SetCurrentFilePath(_rootMediaPath); + + SetParentDisplayPath(); + SetHeaderTitleText(ParentPath); + + //Remove the current files from the filenames list + if (_pFolderEntryPM != null) + { + _pFolderEntryPM->SetFolderEntryPath(ParentPath); + //Get the files in the parent path of the current view + _pFilenames = _pFolderEntryPM->GetFolderEntryList(); + TryCatch(_pFilenames != null, , "Failed to fetch ArrayList from the ContentBrowser!"); + } + + if (_pListView != null) + { + _pListView->UpdateList(); + _storePreviousIndex = 0; + } + } + + AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); + return; +CATCH: + r = E_FAILURE; + if (_pFolderEntryPM != null) + { + delete _pFolderEntryPM; + _pFolderEntryPM = null; + } + AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); +} + +void +SubFolderSelection::SetParentDisplayPath(void) +{ + String dislayPath; + String delim(L"/"); + String parentDisplayPath; + String token; + +#if 0 + DataBindingContext* pContext = null; + pContext = GetDataBindingContextN(); + + if (pContext != null) + { + //Update binding on the source to fetch the current display path. + pContext->UpdateBinding(L"ID_APPCONTROL_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_SOURCE); + } +#endif + + StringTokenizer tokenizer(__displayPath, delim); + + //Use a string tokenizer to get the filepath until it's the last token, break the loop when + //it is the last token + while (tokenizer.HasMoreTokens()) + { + int tokenCount = tokenizer.GetTokenCount(); + + if (tokenCount != 1) + { + tokenizer.GetNextToken(token); + parentDisplayPath.Append(token); + parentDisplayPath.Append(L"/"); + } + else + { + break; + } + } + + //Set the display path to that of the generated filepath from the tokenizer + __displayPath = parentDisplayPath; + +#if 0 + if (pContext != null) + { + //Update Binding on the Target control to display the currently constructed path. + pContext->UpdateBinding(L"ID_APPCONTROL_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_TARGET); + } + + if (pContext != null) + { + delete pContext; + } +#endif + + if (__pLabelDisplayPath != null) + { + __pLabelDisplayPath->SetText(__displayPath); + __pLabelDisplayPath->Invalidate(true); + } +} + +void +SubFolderSelection::SetHeaderTitleText(Tizen::Base::String& filePath) +{ + String token; + String parentFileName; + String delimiter(L"/"); + StringTokenizer tokenizer(filePath, delimiter); + + AppResource* pAppResource = null; + + pAppResource = UiApp::App::GetInstance()->GetAppResource(); + + if (filePath == BasePresentationModel::GetMediaPath()) + { + if (pAppResource != null) + { + pAppResource->GetString(L"IDS_MF_TAB_PHONE", parentFileName); + } + } + else if (filePath == BasePresentationModel::GetSdCardPath()) + { + if (pAppResource != null) + { + pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", parentFileName); + } + } + else + { + while (tokenizer.HasMoreTokens()) + { + int tokenCount = tokenizer.GetTokenCount(); + + if (tokenCount == 1) + { + tokenizer.GetNextToken(parentFileName); + } + else + { + tokenizer.GetNextToken(token); + } + } + } + + if (_pHeader != null) + { + if (!parentFileName.IsEmpty()) + { + _pHeader->SetTitleText(parentFileName); + _pHeader->Invalidate(true); + } + } +} + +void +SubFolderSelection::SetNextDisplayPath(void) +{ + String displayPath; + String delim(L"/"); + String token; + String fullPath; +#if 0 + DataBindingContext* pContext = null; + pContext = GetDataBindingContextN(); +#endif + + fullPath = FolderNavigationPresentationModel::GetCurrentPath(); + //fullPath = __rootMediaPath; + + StringTokenizer tokenizer(fullPath, delim); + + int Counter = 0; + switch (_storageType) + { + case MEMORY_TYPE_PHONE: + { + Counter = 3; + } + break; + + case MEMORY_TYPE_SD_CARD: + { + Counter = 3; + } + break; + + default: + //Do Nothing. + break; + } + + //Use a string tokenizer to get the filepath until it's the last token, break the loop when + //it is the last token + while (tokenizer.HasMoreTokens()) + { + if (Counter > 0) + { + Counter--; + tokenizer.GetNextToken(token); + } + else + { + tokenizer.GetNextToken(token); + //dislayPath.Append(L"/"); + displayPath.Append(token); + displayPath.Append(L"/"); + } + } + + if (__pLabelDisplayPath != null) + { + __displayPath.Append(displayPath); + __pLabelDisplayPath->SetText(__displayPath); + __pLabelDisplayPath->Invalidate(true); + } + + +#if 0 + if (pContext != null) + { + //UpdateBinding on the target label control. + pContext->UpdateBinding(L"ID_APPCONTROL_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_TARGET); + } + + if (pContext != null) + { + delete pContext; + } +#endif +} + +void +SubFolderSelection::OnDataBindingSourceUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName) +{ + //Empty Implementation. +} + +void +SubFolderSelection::OnDataBindingTargetUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName) +{ + //Empty Implementation. +} + +void +SubFolderSelection::OnDataBindingValidationFailed(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName, Tizen::Ui::DataBindingDestinationType destType) +{ + //Empty Implementation. +} + +void +SubFolderSelection::OnDeviceChange(ComponentType deviceType, const Tizen::Base::String& state) +{ + bool setMediaPath = false; + MemoryType currentMemoryType = MEMORY_TYPE_PHONE; + String unmounted = sdCardStatusUnmounted; + String removed = usbDeviceStatusRemoved; + String currentPath; + IList* pArgs = null; + + SceneManager* pSceneManager = null; + + if (state == unmounted || state == removed) + { + currentPath = FolderNavigationPresentationModel::GetCurrentPath(); + if (state == unmounted) + { + if (currentPath.Contains(BasePresentationModel::GetSdCardPath())) + { + FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetMediaPath()); + FolderNavigationPresentationModel::SetStorageType(currentMemoryType); + setMediaPath = true; + } + } + + if (state == removed) + { + if (currentPath.Contains(BasePresentationModel::GetUsbPath())) + { + FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetMediaPath()); + FolderNavigationPresentationModel::SetStorageType(currentMemoryType); + setMediaPath = true; + } + } + + if (setMediaPath) + { + pSceneManager = SceneManager::GetInstance(); + pArgs = new (std::nothrow) ArrayList(); + pArgs->Add(new (std::nothrow) Integer(APPCONTROL_STATE_SELECTED)); + + if (pSceneManager != null) + { + pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_DESTROY_OPTION_DESTROY), pArgs); + } + } + } +} + +void +SubFolderSelection::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state) +{ + + ComponentType currentDeviceType; + switch (deviceType) + { + case StorageCard: + { + currentDeviceType = COMPONENT_TYPE_STORAGE_CARD; + } + break; + + case UsbClient: + { + currentDeviceType = COMPONENT_TYPE_USB; + } + break; + + default: + { + //Do Nothing. + } + break; + } + OnDeviceChange(currentDeviceType, state); +} + +void +SubFolderSelection::OnPlayerEndOfClip(void) +{ + if (_pListView != null) + { + _pListView->RefreshList(_currentAudioPlayIndex, LIST_REFRESH_TYPE_ITEM_MODIFY); + } +} + + +void +SubFolderSelection::OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId &previousSceneId, const Tizen::Ui::Scenes::SceneId ¤tSceneId) +{ + AppLogDebug("ENTER"); + SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this); + AppResource* pAppResource = null; + String importText; + String displayPath; + String phone; + String sdCard; + String external; + String received_Filepath; + int receivedStorageType = -1; + Tizen::Base::String parentPath; + result r = E_SUCCESS; + pAppResource = Application::GetInstance()->GetAppResource(); + TryCatch(pAppResource != null, , "Resource manager not found!"); + + pAppResource->GetString(L"IDS_COM_OPT_IMPORT", importText); + pAppResource->GetString(L"IDS_MF_TAB_PHONE", phone); + pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", sdCard); + pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", external); + phone.Append(L"/"); + sdCard.Append(L"/"); + external.Append(L"/"); + + if (_pListView != null) + { + _pListView->SetShowState(true); + } + + if (__pFileEventManager != null) + { + delete __pFileEventManager; + __pFileEventManager = null; + + } + __pFileEventManager = new (std::nothrow)FileEventManager(); + __pFileEventManager->Construct(*this); + + r = __pFileEventManager->AddPath(_rootMediaPath, FILE_EVENT_TYPE_ATTRIBUTE | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_DELETE ); + AppLogDebug("Result is %s",GetErrorMessage(r)); + +#if 0 + if (_currentViewStyle == APPCONTROL_VIEW_EXPORT || _currentViewStyle == APPCONTROL_VIEW_IMPORT) + { + AppLogDebug("inside view check"); + String backupPath; + String backupCalendarpath; + String backupContactpath; + backupPath = BasePresentationModel::GetMediaPath(); + backupPath.Append("Backup"); + if (!File::IsFileExist(backupPath)) + { + Directory::Create(backupPath, true); + } + + if ((_currentViewStyle == APPCONTROL_VIEW_IMPORT && _currentFileType == FILE_TYPE_CALENDER_TYPE) + || (_currentViewStyle == APPCONTROL_VIEW_EXPORT && _currentExportFileType == EXPORT_TYPE_CALENDAR)) + { + backupCalendarpath.Append(backupPath); + backupCalendarpath.Append("/"); + backupCalendarpath.Append("Calendar"); + if (!File::IsFileExist(backupCalendarpath)) + { + r = Directory::Create(backupCalendarpath, true); + AppLogDebug("Result is %s",GetErrorMessage(r)); + } + } + if ((_currentViewStyle == APPCONTROL_VIEW_IMPORT && _currentFileType == FILE_TYPE_CONTACTS_TYPE) + || (_currentViewStyle == APPCONTROL_VIEW_EXPORT && _currentExportFileType == EXPORT_TYPE_CONTACTS)) + { + backupContactpath.Append(backupPath); + backupContactpath.Append("/"); + backupContactpath.Append("Contacts"); + if (!File::IsFileExist(backupContactpath)) + { + r = Directory::Create(backupContactpath, true); + AppLogDebug("Result is %s",GetErrorMessage(r)); + } + } + + /*_pFolderEntryPM->SetFolderEntryType(_currentFileType); + _pFolderEntryPM->SetFolderEntryPath(_rootMediaPath); + _pFilenames = _pFolderEntryPM->GetFolderEntryList(); + */ + } +#endif + if (__pReceivedFilename != null) + { + //pReceived_Filename = static_cast< String* >(pArgs->GetAt(0)); + received_Filepath = FolderNavigationPresentationModel::GetCurrentPath(); + receivedStorageType = FolderNavigationPresentationModel::GetStorageType(); + + if (__pReceivedFilename != null && !__pReceivedFilename->IsEmpty()) + { + _pHeader = GetHeader(); + if (_pHeader != null) + { + _pHeader->SetTitleText(*__pReceivedFilename); + _pHeader->Invalidate(true); + } + } + if (received_Filepath != null) + { + + //Clear the rootMediaPath and set it to the received filepath. + //if (_rootMediaPath != null) + { + _rootMediaPath.Clear(); + _rootMediaPath.Append(received_Filepath); + } + + if (__pLabelDisplayPath != null) + { + switch (receivedStorageType) + { + case MEMORY_TYPE_PHONE: + { + __displayPath = phone; + _storageType = MEMORY_TYPE_PHONE; + //AppResource::GetInstance()->GetString(L"IDS_MF_TAB_PHONE", __tabSelected); + } + break; + + case MEMORY_TYPE_SD_CARD: + { + __displayPath = sdCard; + _storageType = MEMORY_TYPE_SD_CARD; + //AppResource::GetInstance()->GetString(L"IDS_SD_CARD", __tabSelected); + } + break; + + case MEMORY_TYPE_EXTERNAL: + { + __displayPath = external; + _storageType = MEMORY_TYPE_EXTERNAL; + } + break; + + default: + { + //Empty Implementation. + } + break; + } + + //Call the function to set the DisplayPath of the label. + SetNextDisplayPath(); + } + + } + } + else + { + _rootMediaPath = FolderNavigationPresentationModel::GetCurrentPath(); + } + + parentPath.Append(_rootMediaPath); + + if (_pFolderEntryPM != null) + { + _pFolderEntryPM->SetFolderEntryPath(parentPath); + _pFilenames = _pFolderEntryPM->GetFolderEntryList(); + TryCatch(_pFilenames != null, , "Failed to allocate Memory to Filenames ArrayList"); + _pFolderEntryPM->InitThumbnailManager(); + } + + if (_pListView != null) + { + _pListView->UpdateList(); + } + + DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this); + AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); + return; +CATCH: + AppLogDebug("Exit %s", GetErrorMessage(GetLastResult())); +} + +void +SubFolderSelection::OnSceneTransitionStarted (const Tizen::Ui::Scenes::SceneId ¤tSceneId, const Tizen::Ui::Scenes::SceneId &nextSceneId) +{ + +} +void SubFolderSelection::OnPlayerAudioFocusChanged (void) +{ + int AudioPlayerState = _pAudioPlayer->GetState(); + + AppLogDebug("SubFolderSelectionForm %d ++", AudioPlayerState); + if (AudioPlayerState == PLAYER_STATE_PAUSED) + { + AppLogDebug("Pause"); + AppLogDebug("Refreshing %d", _currentAudioPlayIndex); + _pListView->RefreshList(_currentAudioPlayIndex, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + + AppLogDebug("SubFolderSelectionForm--"); +} + +void +SubFolderSelection::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId) +{ + AppLogDebug("SubFolderSelection::OnFileEventOccured:%S", path.GetPointer()); + + if ((events & FILE_EVENT_TYPE_ATTRIBUTE) || (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_TO )) + { + if (_pFolderEntryPM!=null) + { + _pFolderEntryPM->RefreshFolderEntries(); + } + + if (_pListView != null && _pListView->IsVisible()) + { + _pListView->UpdateList(); + } + + if (_pFolderEntryPM!=null) + { + AppLogDebug("inside file event"); + _pFolderEntryPM->InitThumbnailManager(); + } + } +} + +void +SubFolderSelection::OnAudioNotificationReceived(void) +{ + int AudioPlayerState; + + if (_pAudioPlayer != null) + { + AudioPlayerState = _pAudioPlayer->GetState(); + if (AudioPlayerState == PLAYER_STATE_PLAYING) + { + _pAudioPlayer->Pause(); + _pListView->RefreshList(_currentAudioPlayIndex, LIST_REFRESH_TYPE_ITEM_MODIFY); + } + } +} diff --git a/src/MfTopMostFileSelectionForm.cpp b/src/MfTopMostFileSelectionForm.cpp index 93d07ee..4d9f0d0 100644 --- a/src/MfTopMostFileSelectionForm.cpp +++ b/src/MfTopMostFileSelectionForm.cpp @@ -37,6 +37,7 @@ using namespace Tizen::System; using namespace Tizen::Ui; using namespace Tizen::Ui::Controls; using namespace Tizen::Ui::Scenes; +using namespace Tizen::Telephony; TopMostFileSelectionForm::TopMostFileSelectionForm(void) : __pMoreContextMenu(null) @@ -268,7 +269,7 @@ TopMostFileSelectionForm::OnInitializing(void) CreateLabelControl(); } - __defaultListViewBounds = _pListView->GetBounds(); + _defaultListViewBounds = _pListView->GetBounds(); _pFolderEntryPM = new (std::nothrow) FolderEntryPresentationModel(); TryCatch(_pFolderEntryPM != null, r = E_FAILURE, "Failed to allocate memory"); @@ -309,6 +310,11 @@ TopMostFileSelectionForm::OnInitializing(void) _pLabelNumberOfItems->SetShowState(false); } + _pCallManager = new (std::nothrow) CallManager(); + r = _pCallManager->Construct(*this); + TryCatch(r == E_SUCCESS, , "Failed to Construct CallManager"); + + delete pBitmap; delete pBitmapPress; delete pBitmapHomeButton;