-//\r
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
-//\r
-// Licensed under the Flora License, Version 1.1 (the License);\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-// http://floralicense.org/license/\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an AS IS BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-\r
-/**\r
- * @file: MfSubFolderSelection.h\r
- * @brief: This file contains the declaration of SubFolderSelection class,\r
- * which acts an AppControl for the SubDirectories.\r
- */\r
-\r
-#ifndef _MF_SUB_FOLDER_FILE_SELECTION_H_\r
-#define _MF_SUB_FOLDER_FILE_SELECTION_H_\r
-\r
-#include "MfSubBaseSelectionForm.h"\r
-#include "MfIAudioNotificationListener.h"\r
-\r
-class SubFolderSelection\r
- : public SubBaseSelection\r
- , public Tizen::Io::IFileEventListener\r
- , public Tizen::Ui::IDataBindingListener\r
- , public IAudioNotificationListener\r
-{\r
-public:\r
- //Default constructor for the class\r
- /*!\r
- * @fn FileListSelectionForm()\r
- * @param Takes no parameters\r
- * @return No value returned\r
- */\r
- SubFolderSelection(void);\r
-\r
- //Default Destructor for the class\r
- /*!\r
- * @fn ~FileListSelectionForm()\r
- * @param Takes no parameters\r
- * @return No value returned\r
- */\r
- virtual ~SubFolderSelection(void);\r
-\r
- /*!\r
- * @fn Initialize()\r
- * @param Takes no parameters\r
- * @return bool value\r
- */\r
- bool Initialize(void);\r
-\r
- //Initialises all the members of the class\r
- /*!\r
- * @fn OnInitializing()\r
- * @param Takes no parameters\r
- * @return result value\r
- */\r
- result OnInitializing(void);\r
-\r
- /*!\r
- * @fn OnTerminating()\r
- * @param Takes no parameters\r
- * @return result value\r
- */\r
- result OnTerminating(void);\r
-\r
- //IPlayerEventListener\r
- virtual void OnPlayerEndOfClip(void);\r
- virtual void OnPlayerAudioFocusChanged (void);\r
-\r
- //IDeviceEventListener\r
- virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state);\r
-\r
- //!IActionEventListener\r
- /*! @fn OnActionPerformed(const Tizen::Ui::Control& source, int actionId)\r
- * @brief Called when an action event occurs on the source control.\r
- */\r
- virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);\r
-\r
- //IListViewItemEventListener\r
- virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status);\r
-\r
- virtual void OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback);\r
- virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status);\r
- virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction);\r
-\r
- //! IDataBindingEventListener\r
- /*! @fn OnDataBindingSourceUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName)\r
- * @brief Called when the data transfer for source is completed by the data binding.\r
- */\r
- virtual void OnDataBindingSourceUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName\r
- , const Tizen::Base::String& propertyName);\r
-\r
- /*! @fn OnDataBindingTargetUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName)\r
- * @brief Called when the data transfer for target is completed by the data binding.\r
- */\r
- virtual void OnDataBindingTargetUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName\r
- , const Tizen::Base::String& propertyName);\r
-\r
- /*! @fn OnDataBindingValidationFailed(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName, Tizen::Ui::DataBindingDestinationType destType)\r
- * @brief Called when a validation has failed during data transfer.\r
- */\r
- virtual void OnDataBindingValidationFailed(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName\r
- , const Tizen::Base::String& propertyName, Tizen::Ui::DataBindingDestinationType destType);\r
-\r
- //! ISceneEventListener\r
- /*! @fn OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)\r
- * @brief Called after setting as current scene.\r
- */\r
- virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);\r
-\r
- /*! @fn OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId)\r
- * @brief Called when the current scene is deactivated.\r
- */\r
- virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId, const Tizen::Ui::Scenes::SceneId& nextSceneId);\r
-\r
- /*!IDeviceNotificationListener\r
- * A public callback from the IDeviceNotificationListener taking deviceType and state as argument and returning nothing\r
- * @fn OnDeviceChange\r
- * @brief Used to handle device event changes. When memory card is inserted, removed then this method will be called\r
- * @param ComponentType, String\r
- * @return no return value\r
- */\r
-\r
- //ISceneManagerEventListener\r
- virtual void OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId &previousSceneId, const Tizen::Ui::Scenes::SceneId ¤tSceneId);\r
- virtual void OnSceneTransitionStarted (const Tizen::Ui::Scenes::SceneId ¤tSceneId, const Tizen::Ui::Scenes::SceneId &nextSceneId);\r
-\r
- void OnDeviceChange(ComponentType deviceType, const Tizen::Base::String& state);\r
-\r
- //IFileEventListener\r
- virtual void OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId);\r
-\r
- virtual void OnAudioNotificationReceived(void);\r
-\r
-private:\r
- /*\r
- * A private member function returning no arguments.\r
- * @fn SetHeaderTitleText(Tizen::Base::String& fileName)\r
- * @brief Called to set the title text of the header within the form.\r
- * @param [String&] fileName, filename of the current Directory.\r
- * @return Void return type\r
- */\r
- void SetHeaderTitleText(Tizen::Base::String& filePath);\r
-\r
- /*\r
- * A private member function taking and returning no arguments.\r
- * @fn SetNextDisplayPath\r
- * @brief Called OnListItemStateChanged to change the path displayed in the label.\r
- * @param No parameters.\r
- * @return Void return type.\r
- */\r
- void SetNextDisplayPath(void);\r
-\r
- /*\r
- * A private member function taking and returning no arguments.\r
- * @fn SetParentDisplayPath\r
- * @brief Called within ShowParentDirectoryView() to change the path displayed on the display label.\r
- * @param No parameters.\r
- * @return Void return type\r
- */\r
- void SetParentDisplayPath(void);\r
-\r
- /*\r
- * A private member function taking and returning no arguments.\r
- * @fn ShowParentDirectoryView\r
- * @brief Called during OnActionPerformed() on Up HeaderItem, refreshes the view to the\r
- * list of files within the parent directory\r
- * @param No parameters\r
- * @return Void return type\r
- */\r
- void ShowParentDirectoryView(void);\r
-\r
- // Copy Constructor of the class.\r
- /*@fn SubFolderSelection(const SubFolderSelection&)\r
- * @brief Copy Constructor\r
- * @param Takes Reference of the class\r
- * @return No value returned\r
- * */\r
- SubFolderSelection(const SubFolderSelection&);\r
-\r
- // Assignment operator of the class.\r
- /*@fn SubFolderSelection& operator = (const SubFolderSelection& pSubFolderSelection)\r
- * @brief Assignment operator of the class.\r
- * @param Takes Reference of the class\r
- * @return No value returned\r
- * */\r
- SubFolderSelection& operator =(const SubFolderSelection& pSubFolderSelection);\r
-\r
-public:\r
- Tizen::Base::String text;\r
-\r
-private:\r
- static const int IDA_BTN_HOME = 200;\r
- static const int IDA_BTN_UP = 201;\r
-\r
- Tizen::Base::String __displayPath;\r
- //Tizen::Base::String __currentDirectoryPath;\r
- Tizen::Base::String __tabSelected;\r
- Tizen::Base::String* __pReceivedFilename;\r
-\r
- Tizen::Ui::Controls::ButtonItem* __pHomeButton;\r
- Tizen::Ui::Controls::ButtonItem* __pUpButton;\r
- Tizen::Ui::Controls::ContextMenu* __pMoreContextMenu;\r
- Tizen::Ui::Controls::Label* __pLabelDisplayPath;\r
-\r
- //FileEventManager\r
- Tizen::Io::FileEventManager* __pFileEventManager;\r
-};\r
-\r
-#endif\r
+//
+// 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
-//\r
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
-//\r
-// Licensed under the Flora License, Version 1.1 (the License);\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-// http://floralicense.org/license/\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an AS IS BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-\r
-/**\r
- * @file: MfSubFolderSelection.cpp\r
- * @brief: This file contains the implementation of SubFolderSelection class,\r
- * which acts an AppControl for the SubDirectories.\r
- */\r
-\r
-#include "MfMyFilesApp.h"\r
-#include "MfSubFolderSelection.h"\r
-#include "MfSceneRegister.h"\r
-#include "MfUtility.h"\r
-\r
-using namespace Tizen::App;\r
-using namespace Tizen::Base;\r
-using namespace Tizen::Base::Collection;\r
-using namespace Tizen::Base::Utility;\r
-using namespace Tizen::Content;\r
-using namespace Tizen::Graphics;\r
-using namespace Tizen::Locales;\r
-using namespace Tizen::Media;\r
-using namespace Tizen::System;\r
-using namespace Tizen::Ui;\r
-using namespace Tizen::Ui::Controls;\r
-using namespace Tizen::Ui::Scenes;\r
-using namespace Tizen::Io;\r
-\r
-SubFolderSelection::SubFolderSelection(void)\r
- : __pReceivedFilename(null)\r
- , __pHomeButton(null)\r
- , __pUpButton(null)\r
- , __pMoreContextMenu(null)\r
- , __pLabelDisplayPath(null)\r
- , __pFileEventManager(null)\r
-{\r
- //Do Nothing\r
-}\r
-\r
-SubFolderSelection::~SubFolderSelection(void)\r
-{\r
- if (__pHomeButton != null)\r
- {\r
- delete __pHomeButton;\r
- }\r
-\r
- if (__pUpButton != null)\r
- {\r
- delete __pUpButton;\r
- }\r
- if (__pMoreContextMenu != null)\r
- {\r
- delete __pMoreContextMenu;\r
- }\r
- if (__pFileEventManager != null)\r
- {\r
- delete __pFileEventManager;\r
- }\r
-}\r
-\r
-SubFolderSelection&\r
-SubFolderSelection::operator =(const SubFolderSelection& pSubFolderSelection)\r
-{\r
- return *this;\r
-}\r
-\r
-SubFolderSelection::SubFolderSelection(const SubFolderSelection& pSubFolderSelection)\r
-{\r
- //Do Nothing\r
-}\r
-\r
-\r
-bool\r
-SubFolderSelection::Initialize(void)\r
-{\r
- AppLogDebug("Entry");\r
- Form::Construct(L"IDL_SUB_FOLDER_FILE_SELECTION");\r
- AppLogDebug("Exit");\r
- return true;\r
-}\r
-\r
-result\r
-SubFolderSelection::OnInitializing(void)\r
-{\r
- AppLogDebug("Entry");\r
- result r = E_SUCCESS;\r
- String buttonCancel;\r
- String buttonAttach;\r
- String buttonCreate;\r
- String buttonFolder;\r
- String buttonHome;\r
- String buttonUp;\r
- String buttonExport;\r
- String buttonHere;\r
- String buttonExportHere;\r
- String displayPath;\r
- ButtonItem footerItemMenu;\r
- int xPos = 0, yPos = 0;\r
-\r
- CreateItemSource createitemsource = CREATE_ITEM_SOURCE_SUB_FOLDER_SELECTION;\r
-\r
- AppResource* pAppResource = null;\r
- Bitmap* pBitmapHomeButton = null;\r
- Bitmap* pBitmapUpButton = null;\r
- Bitmap* pBitmapHomeButtonPress = null;\r
- Bitmap* pBitmapUpButtonPress = null;\r
- Bitmap* pBitmap = null;\r
- Bitmap* pBitmapPress = null;\r
- Bitmap* pBitmapDisabled = null;\r
-\r
- __pReceivedFilename = new (std::nothrow) String();\r
-\r
- _pListView = static_cast< ListView* >(GetControl("IDC_SUB_FOLDER_SELECTION_LISTVIEW"));\r
- TryCatch(_pListView != null, , "Failed to get list view control");\r
-\r
- _pListView->AddListViewItemEventListener(*this);\r
- _pListView->SetItemProvider(*this);\r
- _pListView->SetShowState(false);\r
-\r
- _selectionMode = ((MyFilesApp*) Application::GetInstance())->GetCurrentSelectionMode();\r
- _currentFileType = ((MyFilesApp*) Application::GetInstance())->GetCurrentFileType();\r
- _currentViewStyle = ((MyFilesApp*) Application::GetInstance())->GetCurrentView();\r
- _currentExportFileType = ((MyFilesApp*) Application::GetInstance())->GetCurrentExportFileType();\r
-\r
- __pLabelDisplayPath = static_cast< Label* >(GetControl("IDC_SUB_FOLDER_SELECTION_LABEL_DISPLAY_PATH"));\r
- TryCatch(__pLabelDisplayPath != null, , "Label is Null");\r
-\r
- pAppResource = UiApp::GetInstance()->GetAppResource();\r
- TryCatch(pAppResource != null, , "Resource manager not found!");\r
-\r
- displayPath = defaultPhoneBody;\r
- displayPath.Append("/");\r
-\r
- //pAppResource->GetString(L"IDS_MF_BUTTON_HOME", buttonHome);\r
- pAppResource->GetString(L"IDS_COM_POP_ATTACH", buttonAttach);\r
- pAppResource->GetString(L"IDS_COM_POP_CANCEL", buttonCancel);\r
- pAppResource->GetString(L"IDS_EXPORT_HERE", buttonExportHere);\r
- //pAppResource->GetString(L"IDS_MF_TAB_UP", buttonUp);\r
- pBitmap = pAppResource->GetBitmapN(IDB_MORE, BITMAP_PIXEL_FORMAT_ARGB8888);\r
- pBitmapPress = pAppResource->GetBitmapN(IDB_MORE_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);\r
- pBitmapDisabled = pAppResource->GetBitmapN(IDB_MORE_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888);\r
- pBitmapHomeButton = pAppResource->GetBitmapN(IDB_HOME_BUTTON_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);\r
- pBitmapUpButton = pAppResource->GetBitmapN(IDB_UP_BUTTON_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);\r
- pBitmapHomeButtonPress = pAppResource->GetBitmapN(IDB_HOME_BUTTON_ICON_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);\r
- pBitmapUpButtonPress = pAppResource->GetBitmapN(IDB_UP_BUTTON_ICON_PRESS, BITMAP_PIXEL_FORMAT_ARGB8888);\r
-\r
- __displayPath = displayPath;\r
-\r
- _pFolderBitmap = pAppResource->GetBitmapN(IDB_FOLDER, BITMAP_PIXEL_FORMAT_ARGB8888);\r
- _pDummyImage = pAppResource->GetBitmapN(IDB_DUMMY_IMG, BITMAP_PIXEL_FORMAT_ARGB8888);\r
-\r
- _pAudioPlay = MfUtility::MergeBitmapN(IDB_PLAY_OUTER_CIRCLE, IDB_PLAY, 64, 64);\r
- _pAudioPause = MfUtility::MergeBitmapN(IDB_PLAY_OUTER_CIRCLE, IDB_PAUSE, 64, 64);\r
-\r
- _pFooter = GetFooter();\r
-\r
- if (_currentViewStyle == APPCONTROL_VIEW_EXPORT)\r
- {\r
- pAppResource->GetString(L"IDS_EXPORT", buttonExport);\r
-\r
- footerItemMenu.Construct(BUTTON_ITEM_STYLE_ICON, IDA_BTN_MORE);\r
- if (pBitmap != null)\r
- {\r
- pBitmap->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));\r
- footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_NORMAL, pBitmap);\r
- }\r
- if (pBitmapPress != null)\r
- {\r
- pBitmapPress->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));\r
- footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_PRESSED, pBitmapPress);\r
- }\r
- if (pBitmapDisabled != null)\r
- {\r
- pBitmapDisabled->Scale(Dimension(H_FOOTER_BUTTON_MORE, W_FOOTER_BUTTON_MORE));\r
- footerItemMenu.SetIcon(BUTTON_ITEM_STATUS_DISABLED, pBitmapDisabled);\r
- }\r
- if (_pFooter != null)\r
- {\r
- _pFooter->GetPosition(xPos, yPos);\r
- }\r
- __pMoreContextMenu = new (std::nothrow) ContextMenu();\r
- __pMoreContextMenu->Construct(Point(0 , yPos), CONTEXT_MENU_STYLE_LIST);\r
- __pMoreContextMenu->AddActionEventListener(*this);\r
- __pMoreContextMenu->SetShowState(true);\r
- }\r
-\r
- _pHeader = GetHeader();\r
- TryCatch(_pHeader != null, , "Header is Null");\r
-\r
- __pHomeButton = new (std::nothrow) ButtonItem();\r
- __pHomeButton->Construct(BUTTON_ITEM_STYLE_TEXT, IDA_BTN_HOME);\r
- __pHomeButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, pBitmapHomeButton);\r
- __pHomeButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, pBitmapHomeButtonPress);\r
-\r
- __pUpButton = new (std::nothrow) ButtonItem();\r
- __pUpButton->Construct(BUTTON_ITEM_STYLE_TEXT, IDA_BTN_UP);\r
- __pUpButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_NORMAL, pBitmapUpButton);\r
- __pUpButton->SetBackgroundBitmap(BUTTON_ITEM_STATUS_PRESSED, pBitmapUpButtonPress);\r
-\r
- _pHeader->SetButton(BUTTON_POSITION_LEFT, *__pHomeButton);\r
- _pHeader->SetButton(BUTTON_POSITION_RIGHT, *__pUpButton);\r
- _pHeader->AddActionEventListener(*this);\r
-\r
- if (_currentViewStyle == APPCONTROL_VIEW_EXPORT)\r
- {\r
- _pExport = new (std::nothrow) FooterItem();\r
- r = _pExport->Construct(IDA_BTN_EXPORT);\r
- _pExport->SetText(buttonExportHere);\r
-\r
- }\r
- else\r
- {\r
- _pAttach = new (std::nothrow) FooterItem();\r
- r = _pAttach->Construct(IDA_BTN_ATTACH);\r
- _pAttach->SetText(buttonAttach);\r
- }\r
-\r
- TryCatch(_pFooter != null, , "Footer is Null");\r
-\r
- if (_pFooter != null)\r
- {\r
- _pFooter->RemoveAllButtons();\r
- _pFooter->RemoveAllItems();\r
- _pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);\r
-\r
- if (_currentViewStyle == APPCONTROL_VIEW_EXPORT)\r
- {\r
- _pFooter->AddItem(*_pExport);\r
- _pFooter->SetButton(BUTTON_POSITION_LEFT, footerItemMenu);\r
- //_pFooter->AddItem(*_pCreateFolder);\r
- }\r
- else\r
- {\r
- _pFooter->AddItem(*_pAttach);\r
- }\r
-\r
- //_pFooter->AddItem(*_pCancel);\r
- _pFooter->AddActionEventListener(*this);\r
- _pFooter->SetBackButton();\r
- SetFormBackEventListener(this);\r
- if (_currentViewStyle != APPCONTROL_VIEW_EXPORT)\r
- {\r
- _pFooter->SetItemEnabled(0, false);\r
- }\r
- _pFooter->Invalidate(true);\r
- }\r
-\r
- CreateLabelControl();\r
-\r
- __defaultListViewBounds = _pListView->GetBounds();\r
-\r
- _pFolderEntryPM = new (std::nothrow) FolderEntryPresentationModel();\r
- TryCatch(_pFolderEntryPM != null, , "Failed to allocate memory");\r
- _pFolderEntryPM->Construct();\r
- _pFolderEntryPM->SetSourceForm(createitemsource);\r
-\r
- _rootMediaPath = FolderNavigationPresentationModel::GetCurrentPath();\r
- _rootStoragePath = BasePresentationModel::GetSdCardPath();\r
-\r
- if (_currentViewStyle != APPCONTROL_VIEW_EXPORT)\r
- {\r
- _pFolderEntryPM->SetFolderEntryType(_currentFileType);\r
- _pFolderEntryPM->SetFolderEntryPath(_rootMediaPath);\r
- _pFilenames = _pFolderEntryPM->GetFolderEntryList();\r
- TryCatch(_pFilenames != null, , "MfMyFilesApp::Failed to allocate Memory to Filenames ArrayList");\r
- }\r
-\r
- _pThumbnailManager = ThumbnailManager::GetInstance();\r
- TryCatch(_pThumbnailManager != null, , "Thumbnail Manager not found!");\r
-\r
- _pFileManager = FolderEntryEditorPresentationModel::GetInstance();\r
- TryCatch(_pFileManager != null, , "File Manager not found!");\r
-\r
- InitializeAppRegistry();\r
-\r
- if (_currentViewStyle == APPCONTROL_VIEW_EXPORT)\r
- {\r
- __pLabelDisplayPath->SetShowState(true);\r
- _pLabelNumberOfItems->SetShowState(false);\r
- }\r
-\r
- AppLogDebug("Exit %s", GetErrorMessage(r));\r
-\r
-#if 0\r
- DataBindingContext* pContext = null;\r
-\r
- pContext = GetDataBindingContextN();\r
- TryCatch(pContext != null, , "Failed to Fetch the DataBinding Context");\r
-\r
- 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);\r
-\r
- delete pContext;\r
-\r
-#endif\r
-\r
- delete pBitmapHomeButton;\r
- delete pBitmapUpButton;\r
- delete pBitmapHomeButtonPress;\r
- delete pBitmapUpButtonPress;\r
- delete pBitmapDisabled;\r
- delete pBitmap;\r
- delete pBitmapPress;\r
- AppLogDebug("Exit: %s", GetErrorMessage(r));\r
- return r;\r
-\r
-CATCH:\r
- if (pBitmapHomeButton != null)\r
- {\r
- delete pBitmapHomeButton;\r
- pBitmapHomeButton = null;\r
- }\r
-\r
- if (pBitmapUpButton != null)\r
- {\r
- delete pBitmapUpButton;\r
- pBitmapUpButton = null;\r
- }\r
- if (pBitmapHomeButtonPress != null)\r
- {\r
- delete pBitmapHomeButtonPress;\r
- pBitmapHomeButtonPress = null;\r
- }\r
- if (pBitmapUpButtonPress != null)\r
- {\r
- delete pBitmapUpButtonPress;\r
- pBitmapUpButtonPress = null;\r
- }\r
- r = E_FAILURE;\r
- AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));\r
- return r;\r
-}\r
-\r
-result\r
-SubFolderSelection::OnTerminating(void)\r
-{\r
- result r = E_SUCCESS;\r
-\r
- _pHeader = GetHeader();\r
- if (_pHeader != null)\r
- {\r
- _pHeader->RemoveAllButtons();\r
- _pHeader->RemoveAllItems();\r
- }\r
-\r
- _pFooter = GetFooter();\r
- if (_pFooter != null)\r
- {\r
- _pFooter->RemoveAllButtons();\r
- _pFooter->RemoveAllItems();\r
- }\r
-\r
- return r;\r
-}\r
-\r
-void\r
-SubFolderSelection::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)\r
-{\r
- //empty implementation\r
-}\r
-\r
-void\r
-SubFolderSelection::OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)\r
-{\r
- //empty implementation\r
-}\r
-\r
-void\r
-SubFolderSelection::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)\r
-{\r
- AppLogDebug("Entry");\r
- result r = E_SUCCESS;\r
- String selectFiles;\r
- String selectedCount;\r
- String selectedRootMediaPath;\r
- DirectoryEntry* pDirStr = null;\r
- String nextFilename;\r
- int selectedItemsCount = 0;\r
- int itemcount = 0;\r
- AppResource* pAppResource = null;\r
- SceneManager* pSceneManager = null;\r
- ArrayList* pArgs = null;\r
- bool itemStatus = false;\r
- Integer currentIndex = index;\r
- RelativeLayout* pLayout = null;\r
-\r
- pArgs = new (std::nothrow) ArrayList();\r
- pArgs->Construct();\r
-\r
- pSceneManager = SceneManager::GetInstance();\r
- pAppResource = Application::GetInstance()->GetAppResource();\r
- TryCatch(pAppResource != null, , "Resource manager not found!");\r
-\r
- pAppResource->GetString(L"IDS_SELECT_FILES", selectFiles);\r
- pAppResource->GetString(L"IDS_COM_BODY_SELECTED", selectedCount);\r
-\r
- itemStatus = _pFileManager->GetCheckedList()->ContainsKey(currentIndex /*,itemStatus*/);\r
-\r
- if (elementId == CONTENT_LIST_ITEM_TYPE_PLAY || elementId == CONTENT_LIST_ITEM_TYPE_PAUSE)\r
- {\r
- pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));\r
- TryCatch(pDirStr != null, , "pDirStr is null");\r
-\r
- if (!itemStatus)\r
- {\r
- listView.SetItemChecked(index, false);\r
- }\r
- else\r
- {\r
- listView.SetItemChecked(index, true);\r
- }\r
-\r
- if (_pAudioPlayer == null)\r
- {\r
- InitializePlayer();\r
- LoadMusicPlayer(pDirStr->GetFullFilePath(), PLAYER_STATE_INITIALIZED);\r
- _previousAudioSelected = index;\r
- _currentAudioPlayIndex = index;\r
- _pListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);\r
-\r
- return;\r
- }\r
-\r
- if (_previousAudioSelected == index)\r
- {\r
- if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING)\r
- {\r
- _pAudioPlayer->Pause();\r
- }\r
- else\r
- {\r
- LoadMusicPlayer(pDirStr->GetFullFilePath(), PLAYER_STATE_INITIALIZED);\r
- }\r
- }\r
- else\r
- {\r
- _pAudioPlayer->Stop();\r
- _pAudioPlayer->Close();\r
- _pListView->RefreshList(_previousAudioSelected, LIST_REFRESH_TYPE_ITEM_MODIFY);\r
- _previousAudioSelected = index;\r
-\r
- LoadMusicPlayer(pDirStr->GetFullFilePath(), PLAYER_STATE_STOPPED);\r
- }\r
- _currentAudioPlayIndex = index;\r
- _pListView->RefreshList(index, LIST_REFRESH_TYPE_ITEM_MODIFY);\r
- //listView.SetItemChecked(index, false);\r
- return;\r
- }\r
-\r
- if (_pFilenames != null) //start of FILENAME check if\r
- {\r
- pDirStr = static_cast< DirectoryEntry* >(_pFilenames->GetAt(index));\r
-\r
- if (pDirStr != null) //start of NULL check if\r
- {\r
- if (pDirStr->IsDirectory()) // start of DIRECTORY CHECK if\r
- {\r
- selectedRootMediaPath = pDirStr->GetFullFilePath();\r
- nextFilename = pDirStr->GetFileName();\r
-\r
- if (_rootMediaPath != null)\r
- {\r
- _rootMediaPath.Clear();\r
- _rootMediaPath.Append(selectedRootMediaPath);\r
- }\r
-\r
- if (_pAudioPlayer != null)\r
- {\r
- if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING || _pAudioPlayer->GetState() == PLAYER_STATE_PAUSED)\r
- {\r
- _pAudioPlayer->Stop();\r
- _pAudioPlayer->Close();\r
- }\r
- }\r
- FolderNavigationPresentationModel::SetCurrentFilePath(_rootMediaPath);\r
-\r
- pArgs->Add(&nextFilename);\r
- pArgs->Add(&_rootMediaPath);\r
- ClearSelectedItems(listView);\r
- pSceneManager->GoForward(ForwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_LEFT), pArgs);\r
- } // end of DIRECTORY CHECK if\r
- else //start of FILE CHECK else\r
- {\r
- if (listView.IsItemChecked(index) == true)\r
- {\r
- _pFileManager->AddCheckedListEntry(index, pDirStr);\r
- }\r
- else\r
- {\r
- _pFileManager->RemoveCheckedListEntry(index);\r
- }\r
-\r
- if (_selectionMode == SELECTION_MODE_SINGE)\r
- {\r
- if (listView.IsItemChecked(_storePreviousIndex) == true && _storePreviousIndex != index)\r
- {\r
- listView.SetItemChecked(_storePreviousIndex, false);\r
- _pListView->RefreshList(_storePreviousIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);\r
- _pFileManager->RemoveCheckedListEntry(_storePreviousIndex);\r
- }\r
- _storePreviousIndex = index;\r
- }\r
- } //end of FILE CHECK else\r
- } //end of NULL check if\r
-\r
- for (itemcount = 0; itemcount <= GetItemCount(); itemcount++)\r
- {\r
- if (listView.IsItemChecked(itemcount) == true)\r
- {\r
- selectedItemsCount++;\r
- }\r
- }\r
-\r
- if (selectedItemsCount != 0)\r
- {\r
- r = _pFooter->SetItemEnabled(0, true);\r
- }\r
- else\r
- {\r
- if (_currentViewStyle != APPCONTROL_VIEW_EXPORT)\r
- {\r
- _pFooter->SetItemEnabled(0, false);\r
- }\r
- }\r
-\r
- if (_selectionMode == SELECTION_MODE_MULTIPLE) // start of MULTIPLE_MODE_SELECTION if\r
- {\r
-\r
- pLayout = dynamic_cast <RelativeLayout*> (Form::GetLayoutN());\r
- if (pLayout != null)\r
- {\r
- pLayout->SetRelation(*_pListView, _pLabelNumberOfItems,RECT_EDGE_RELATION_BOTTOM_TO_TOP);\r
- }\r
-\r
- if (selectedItemsCount > 0)\r
- {\r
- _itemSelectedCount.Clear();\r
- _itemSelectedCount.Append(selectedCount);\r
- _itemSelectedCount.Append(L"\x200E");\r
- _itemSelectedCount.Append(L"(");\r
- _itemSelectedCount.Append(selectedItemsCount);\r
- _itemSelectedCount.Append(L")");\r
- _itemSelectedCount.Append(L"\x200E");\r
- _pLabelNumberOfItems->SetText(_itemSelectedCount);\r
- }\r
- else\r
- {\r
- _itemSelectedCount.Clear();\r
- _itemSelectedCount.Append(selectFiles);\r
- _pLabelNumberOfItems->SetText(_itemSelectedCount);\r
- }\r
-\r
- _pLabelNumberOfItems->Invalidate(true);\r
-\r
- delete pLayout;\r
- }\r
- } //end of FILENAME check if\r
-\r
- _pFooter->Invalidate(true);\r
-\r
- AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));\r
- return;\r
-CATCH:\r
- r = GetLastResult();\r
- if (_pFolderEntryPM != null)\r
- {\r
- delete _pFolderEntryPM;\r
- _pFolderEntryPM = null;\r
- }\r
- AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));\r
-}\r
-\r
-void\r
-SubFolderSelection::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)\r
-{\r
- //empty implementation\r
-}\r
-\r
-void\r
-SubFolderSelection::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,\r
- const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs)\r
-{\r
-\r
- RelativeLayout* pLayout = null;\r
-\r
- SceneManager::GetInstance()->AddSceneManagerEventListener(*this);\r
-\r
- ((MyFilesApp*) Application::GetInstance())->SetAudioNotificationListener(this);\r
- _itemSelectedCount.Clear();\r
-\r
- if (_pFileManager != null)\r
- {\r
- if (!_pFileManager->IsCheckedListNull())\r
- {\r
- _pFileManager->ClearCheckedList();\r
- }\r
- }\r
- if (_selectionMode == SELECTION_MODE_SINGE) // start of MULTIPLE_MODE_SELECTION if\r
- {\r
- pLayout = dynamic_cast <RelativeLayout*> (Form::GetLayoutN());\r
- if (pLayout != null)\r
- {\r
- pLayout->SetRelation(*_pListView, this ,RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);\r
- }\r
-\r
- delete pLayout;\r
-\r
- }\r
- if (pArgs != null)\r
- {\r
- __pReceivedFilename->Clear();\r
- __pReceivedFilename->Append(*static_cast<String*>(pArgs->GetAt(0)));\r
- }\r
- else\r
- {\r
- if (_currentViewStyle == APPCONTROL_VIEW_EXPORT)\r
- {\r
- String headerDisplayPath = FolderNavigationPresentationModel::GetCurrentPath();\r
- SetHeaderTitleText(headerDisplayPath);\r
- __pReceivedFilename->Clear();\r
- }\r
- }\r
-\r
- ((MyFilesApp*) Application::GetInstance())->SetCurrentView(this);\r
-\r
- if (pArgs != null)\r
- {\r
- pArgs->RemoveAll(false);\r
- delete pArgs;\r
- }\r
-}\r
-\r
-void\r
-SubFolderSelection::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,\r
- const Tizen::Ui::Scenes::SceneId& nextSceneId)\r
-{\r
- DeviceManager::RemoveAllDeviceEventListeners();\r
- ((MyFilesApp*)Application::GetInstance())->SetCurrentView(null);\r
- ((MyFilesApp*) Application::GetInstance())->SetAudioNotificationListener(null);\r
- _pFolderEntryPM->StopThumbnailManager(true);\r
-\r
- if(__pFileEventManager != null)\r
- {\r
- __pFileEventManager->RemovePath(_rootMediaPath);\r
- }\r
-}\r
-\r
-void\r
-SubFolderSelection::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)\r
-{\r
- AppLogDebug("Entry");\r
-\r
- String createFolder;\r
- Bitmap* pBitmapCreateFolder = null;\r
- AppResource* pAppResource = null;\r
- pAppResource = UiApp::GetInstance()->GetAppResource();\r
- if (pAppResource != null)\r
- {\r
- pAppResource->GetString(L"IDS_COM_BODY_CREATE_FOLDER", createFolder);\r
- pBitmapCreateFolder = pAppResource->GetBitmapN(IDB_POPUP_CREATE_FOLDER_ICON, BITMAP_PIXEL_FORMAT_ARGB8888);\r
- }\r
-\r
- switch (actionId)\r
- {\r
- case IDA_BTN_HOME:\r
- {\r
- ShowHomeView();\r
- _pFolderEntryPM->InitThumbnailManager();\r
- }\r
- break;\r
-\r
- case IDA_BTN_UP:\r
- {\r
- ShowParentDirectoryView();\r
- _pFolderEntryPM->InitThumbnailManager();\r
- }\r
- break;\r
-\r
- case IDA_BTN_MORE:\r
- {\r
- __pMoreContextMenu->RemoveAllItems();\r
- __pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_NORMAL, Color::GetColor(COLOR_ID_WHITE));\r
- __pMoreContextMenu->SetItemTextColor(CONTEXT_MENU_ITEM_STATUS_PRESSED, Color::GetColor(COLOR_ID_WHITE));\r
- __pMoreContextMenu->AddItem(createFolder, IDA_BTN_CREATE_FOLDER, *pBitmapCreateFolder, null, null);\r
- __pMoreContextMenu->SetShowState(true);\r
- __pMoreContextMenu->Show();\r
- }\r
- break;\r
-\r
- default:\r
- {\r
- SubBaseOnActionPerformed(source, actionId);\r
- }\r
- break;\r
- }\r
- AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));\r
-}\r
-\r
-void\r
-SubFolderSelection::ShowParentDirectoryView(void)\r
-{\r
- AppLogDebug("Entry");\r
- result r = E_SUCCESS;\r
- String displayPath;\r
- String ParentPath;\r
-\r
- displayPath = defaultPhoneBody;\r
- displayPath.Append("/");\r
-\r
- ParentPath = FolderNavigationPresentationModel::GetParentPath();\r
- //_pFileManager->ClearCheckedList();\r
-\r
- if (FolderNavigationPresentationModel::GetCurrentPath() == BasePresentationModel::GetMediaPath() || FolderNavigationPresentationModel::GetCurrentPath() == BasePresentationModel::GetSdCardPath())\r
- {\r
- _pFileManager->ClearCheckedList();\r
- ShowHomeView();\r
- }\r
- else\r
- {\r
- if (_currentViewStyle != APPCONTROL_VIEW_EXPORT)\r
- {\r
- ResetFooter();\r
- }\r
-\r
- if (_pAudioPlayer != null)\r
- {\r
- if (_pAudioPlayer->GetState() == PLAYER_STATE_PLAYING || _pAudioPlayer->GetState() == PLAYER_STATE_PAUSED)\r
- {\r
- _pAudioPlayer->Stop();\r
- _pAudioPlayer->Close();\r
- }\r
- }\r
- _rootMediaPath.Clear();\r
- _rootMediaPath.Append(ParentPath);\r
-\r
- FolderNavigationPresentationModel::SetCurrentFilePath(_rootMediaPath);\r
-\r
- SetParentDisplayPath();\r
- SetHeaderTitleText(ParentPath);\r
-\r
- //Remove the current files from the filenames list\r
- if (_pFolderEntryPM != null)\r
- {\r
- _pFolderEntryPM->SetFolderEntryPath(ParentPath);\r
- //Get the files in the parent path of the current view\r
- _pFilenames = _pFolderEntryPM->GetFolderEntryList();\r
- TryCatch(_pFilenames != null, , "Failed to fetch ArrayList from the ContentBrowser!");\r
- }\r
-\r
- if (_pListView != null)\r
- {\r
- _pListView->UpdateList();\r
- _storePreviousIndex = 0;\r
- }\r
- }\r
-\r
- AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));\r
- return;\r
-CATCH:\r
- r = E_FAILURE;\r
- if (_pFolderEntryPM != null)\r
- {\r
- delete _pFolderEntryPM;\r
- _pFolderEntryPM = null;\r
- }\r
- AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));\r
-}\r
-\r
-void\r
-SubFolderSelection::SetParentDisplayPath(void)\r
-{\r
- String dislayPath;\r
- String delim(L"/");\r
- String parentDisplayPath;\r
- String token;\r
-\r
-#if 0\r
- DataBindingContext* pContext = null;\r
- pContext = GetDataBindingContextN();\r
-\r
- if (pContext != null)\r
- {\r
- //Update binding on the source to fetch the current display path.\r
- pContext->UpdateBinding(L"ID_APPCONTROL_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_SOURCE);\r
- }\r
-#endif\r
-\r
- StringTokenizer tokenizer(__displayPath, delim);\r
-\r
- //Use a string tokenizer to get the filepath until it's the last token, break the loop when\r
- //it is the last token\r
- while (tokenizer.HasMoreTokens())\r
- {\r
- int tokenCount = tokenizer.GetTokenCount();\r
-\r
- if (tokenCount != 1)\r
- {\r
- tokenizer.GetNextToken(token);\r
- parentDisplayPath.Append(token);\r
- parentDisplayPath.Append(L"/");\r
- }\r
- else\r
- {\r
- break;\r
- }\r
- }\r
-\r
- //Set the display path to that of the generated filepath from the tokenizer\r
- __displayPath = parentDisplayPath;\r
-\r
-#if 0\r
- if (pContext != null)\r
- {\r
- //Update Binding on the Target control to display the currently constructed path.\r
- pContext->UpdateBinding(L"ID_APPCONTROL_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_TARGET);\r
- }\r
-\r
- if (pContext != null)\r
- {\r
- delete pContext;\r
- }\r
-#endif\r
-\r
- if (__pLabelDisplayPath != null)\r
- {\r
- __pLabelDisplayPath->SetText(__displayPath);\r
- __pLabelDisplayPath->Invalidate(true);\r
- }\r
-}\r
-\r
-void\r
-SubFolderSelection::SetHeaderTitleText(Tizen::Base::String& filePath)\r
-{\r
- String token;\r
- String parentFileName;\r
- String delimiter(L"/");\r
- StringTokenizer tokenizer(filePath, delimiter);\r
-\r
- AppResource* pAppResource = null;\r
-\r
- pAppResource = UiApp::App::GetInstance()->GetAppResource();\r
-\r
- if (filePath == BasePresentationModel::GetMediaPath())\r
- {\r
- if (pAppResource != null)\r
- {\r
- pAppResource->GetString(L"IDS_MF_TAB_PHONE", parentFileName);\r
- }\r
- }\r
- else if (filePath == BasePresentationModel::GetSdCardPath())\r
- {\r
- if (pAppResource != null)\r
- {\r
- pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", parentFileName);\r
- }\r
- }\r
- else\r
- {\r
- while (tokenizer.HasMoreTokens())\r
- {\r
- int tokenCount = tokenizer.GetTokenCount();\r
-\r
- if (tokenCount == 1)\r
- {\r
- tokenizer.GetNextToken(parentFileName);\r
- }\r
- else\r
- {\r
- tokenizer.GetNextToken(token);\r
- }\r
- }\r
- }\r
-\r
- if (_pHeader != null)\r
- {\r
- if (!parentFileName.IsEmpty())\r
- {\r
- _pHeader->SetTitleText(parentFileName);\r
- _pHeader->Invalidate(true);\r
- }\r
- }\r
-}\r
-\r
-void\r
-SubFolderSelection::SetNextDisplayPath(void)\r
-{\r
- String displayPath;\r
- String delim(L"/");\r
- String token;\r
- String fullPath;\r
-#if 0\r
- DataBindingContext* pContext = null;\r
- pContext = GetDataBindingContextN();\r
-#endif\r
-\r
- fullPath = FolderNavigationPresentationModel::GetCurrentPath();\r
- //fullPath = __rootMediaPath;\r
-\r
- StringTokenizer tokenizer(fullPath, delim);\r
-\r
- int Counter = 0;\r
- switch (_storageType)\r
- {\r
- case MEMORY_TYPE_PHONE:\r
- {\r
- Counter = 3;\r
- }\r
- break;\r
-\r
- case MEMORY_TYPE_SD_CARD:\r
- {\r
- Counter = 3;\r
- }\r
- break;\r
-\r
- default:\r
- //Do Nothing.\r
- break;\r
- }\r
-\r
- //Use a string tokenizer to get the filepath until it's the last token, break the loop when\r
- //it is the last token\r
- while (tokenizer.HasMoreTokens())\r
- {\r
- if (Counter > 0)\r
- {\r
- Counter--;\r
- tokenizer.GetNextToken(token);\r
- }\r
- else\r
- {\r
- tokenizer.GetNextToken(token);\r
- //dislayPath.Append(L"/");\r
- displayPath.Append(token);\r
- displayPath.Append(L"/");\r
- }\r
- }\r
-\r
- if (__pLabelDisplayPath != null)\r
- {\r
- __displayPath.Append(displayPath);\r
- __pLabelDisplayPath->SetText(__displayPath);\r
- __pLabelDisplayPath->Invalidate(true);\r
- }\r
-\r
-\r
-#if 0\r
- if (pContext != null)\r
- {\r
- //UpdateBinding on the target label control.\r
- pContext->UpdateBinding(L"ID_APPCONTROL_DISPLAY_PATH", DATA_BINDING_DESTINATION_TYPE_TARGET);\r
- }\r
-\r
- if (pContext != null)\r
- {\r
- delete pContext;\r
- }\r
-#endif\r
-}\r
-\r
-void\r
-SubFolderSelection::OnDataBindingSourceUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName)\r
-{\r
- //Empty Implementation.\r
-}\r
-\r
-void\r
-SubFolderSelection::OnDataBindingTargetUpdated(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName)\r
-{\r
- //Empty Implementation.\r
-}\r
-\r
-void\r
-SubFolderSelection::OnDataBindingValidationFailed(const Tizen::Base::String& bindingId, const Tizen::Base::String& controlName, const Tizen::Base::String& propertyName, Tizen::Ui::DataBindingDestinationType destType)\r
-{\r
- //Empty Implementation.\r
-}\r
-\r
-void\r
-SubFolderSelection::OnDeviceChange(ComponentType deviceType, const Tizen::Base::String& state)\r
-{\r
- bool setMediaPath = false;\r
- MemoryType currentMemoryType = MEMORY_TYPE_PHONE;\r
- String unmounted = sdCardStatusUnmounted;\r
- String removed = usbDeviceStatusRemoved;\r
- String currentPath;\r
- IList* pArgs = null;\r
-\r
- SceneManager* pSceneManager = null;\r
-\r
- if (state == unmounted || state == removed)\r
- {\r
- currentPath = FolderNavigationPresentationModel::GetCurrentPath();\r
- if (state == unmounted)\r
- {\r
- if (currentPath.Contains(BasePresentationModel::GetSdCardPath()))\r
- {\r
- FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetMediaPath());\r
- FolderNavigationPresentationModel::SetStorageType(currentMemoryType);\r
- setMediaPath = true;\r
- }\r
- }\r
-\r
- if (state == removed)\r
- {\r
- if (currentPath.Contains(BasePresentationModel::GetUsbPath()))\r
- {\r
- FolderNavigationPresentationModel::SetCurrentFilePath(BasePresentationModel::GetMediaPath());\r
- FolderNavigationPresentationModel::SetStorageType(currentMemoryType);\r
- setMediaPath = true;\r
- }\r
- }\r
-\r
- if (setMediaPath)\r
- {\r
- pSceneManager = SceneManager::GetInstance();\r
- pArgs = new (std::nothrow) ArrayList();\r
- pArgs->Add(new (std::nothrow) Integer(APPCONTROL_STATE_SELECTED));\r
-\r
- if (pSceneManager != null)\r
- {\r
- pSceneManager->GoBackward(BackwardSceneTransition(IDSCN_TOP_LEVEL_DIRECTORY_FORM, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT, SCENE_DESTROY_OPTION_DESTROY), pArgs);\r
- }\r
- }\r
- }\r
-}\r
-\r
-void\r
-SubFolderSelection::OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state)\r
-{\r
-\r
- ComponentType currentDeviceType;\r
- switch (deviceType)\r
- {\r
- case StorageCard:\r
- {\r
- currentDeviceType = COMPONENT_TYPE_STORAGE_CARD;\r
- }\r
- break;\r
-\r
- case UsbClient:\r
- {\r
- currentDeviceType = COMPONENT_TYPE_USB;\r
- }\r
- break;\r
-\r
- default:\r
- {\r
- //Do Nothing.\r
- }\r
- break;\r
- }\r
- OnDeviceChange(currentDeviceType, state);\r
-}\r
-\r
-void\r
-SubFolderSelection::OnPlayerEndOfClip(void)\r
-{\r
- if (_pListView != null)\r
- {\r
- _pListView->RefreshList(_currentAudioPlayIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);\r
- }\r
-}\r
-\r
-\r
-void\r
-SubFolderSelection::OnSceneTransitionCompleted (const Tizen::Ui::Scenes::SceneId &previousSceneId, const Tizen::Ui::Scenes::SceneId ¤tSceneId)\r
-{\r
- AppLogDebug("ENTER");\r
- SceneManager::GetInstance()->RemoveSceneManagerEventListener(*this);\r
- AppResource* pAppResource = null;\r
- String importText;\r
- String displayPath;\r
- String phone;\r
- String sdCard;\r
- String external;\r
- String received_Filepath;\r
- int receivedStorageType = -1;\r
- Tizen::Base::String parentPath;\r
- result r = E_SUCCESS;\r
- pAppResource = Application::GetInstance()->GetAppResource();\r
- TryCatch(pAppResource != null, , "Resource manager not found!");\r
-\r
- pAppResource->GetString(L"IDS_COM_OPT_IMPORT", importText);\r
- pAppResource->GetString(L"IDS_MF_TAB_PHONE", phone);\r
- pAppResource->GetString(L"IDS_MF_TAB_MEMORY_CARD", sdCard);\r
- pAppResource->GetString(L"IDS_MF_TAB_EXTERNAL_STORAGE", external);\r
- phone.Append(L"/");\r
- sdCard.Append(L"/");\r
- external.Append(L"/");\r
-\r
- if (_pListView != null)\r
- {\r
- _pListView->SetShowState(true);\r
- }\r
-\r
- if (__pFileEventManager != null)\r
- {\r
- delete __pFileEventManager;\r
- __pFileEventManager = null;\r
-\r
- }\r
- __pFileEventManager = new (std::nothrow)FileEventManager();\r
- __pFileEventManager->Construct(*this);\r
-\r
- r = __pFileEventManager->AddPath(_rootMediaPath, FILE_EVENT_TYPE_ATTRIBUTE | FILE_EVENT_TYPE_MOVED_TO | FILE_EVENT_TYPE_DELETE );\r
- AppLogDebug("Result is %s",GetErrorMessage(r));\r
-\r
-#if 0\r
- if (_currentViewStyle == APPCONTROL_VIEW_EXPORT || _currentViewStyle == APPCONTROL_VIEW_IMPORT)\r
- {\r
- AppLogDebug("inside view check");\r
- String backupPath;\r
- String backupCalendarpath;\r
- String backupContactpath;\r
- backupPath = BasePresentationModel::GetMediaPath();\r
- backupPath.Append("Backup");\r
- if (!File::IsFileExist(backupPath))\r
- {\r
- Directory::Create(backupPath, true);\r
- }\r
-\r
- if ((_currentViewStyle == APPCONTROL_VIEW_IMPORT && _currentFileType == FILE_TYPE_CALENDER_TYPE)\r
- || (_currentViewStyle == APPCONTROL_VIEW_EXPORT && _currentExportFileType == EXPORT_TYPE_CALENDAR))\r
- {\r
- backupCalendarpath.Append(backupPath);\r
- backupCalendarpath.Append("/");\r
- backupCalendarpath.Append("Calendar");\r
- if (!File::IsFileExist(backupCalendarpath))\r
- {\r
- r = Directory::Create(backupCalendarpath, true);\r
- AppLogDebug("Result is %s",GetErrorMessage(r));\r
- }\r
- }\r
- if ((_currentViewStyle == APPCONTROL_VIEW_IMPORT && _currentFileType == FILE_TYPE_CONTACTS_TYPE)\r
- || (_currentViewStyle == APPCONTROL_VIEW_EXPORT && _currentExportFileType == EXPORT_TYPE_CONTACTS))\r
- {\r
- backupContactpath.Append(backupPath);\r
- backupContactpath.Append("/");\r
- backupContactpath.Append("Contacts");\r
- if (!File::IsFileExist(backupContactpath))\r
- {\r
- r = Directory::Create(backupContactpath, true);\r
- AppLogDebug("Result is %s",GetErrorMessage(r));\r
- }\r
- }\r
-\r
- /*_pFolderEntryPM->SetFolderEntryType(_currentFileType);\r
- _pFolderEntryPM->SetFolderEntryPath(_rootMediaPath);\r
- _pFilenames = _pFolderEntryPM->GetFolderEntryList();\r
- */\r
- }\r
-#endif\r
- if (__pReceivedFilename != null)\r
- {\r
- //pReceived_Filename = static_cast< String* >(pArgs->GetAt(0));\r
- received_Filepath = FolderNavigationPresentationModel::GetCurrentPath();\r
- receivedStorageType = FolderNavigationPresentationModel::GetStorageType();\r
-\r
- if (__pReceivedFilename != null && !__pReceivedFilename->IsEmpty())\r
- {\r
- _pHeader = GetHeader();\r
- if (_pHeader != null)\r
- {\r
- _pHeader->SetTitleText(*__pReceivedFilename);\r
- _pHeader->Invalidate(true);\r
- }\r
- }\r
- if (received_Filepath != null)\r
- {\r
-\r
- //Clear the rootMediaPath and set it to the received filepath.\r
- //if (_rootMediaPath != null)\r
- {\r
- _rootMediaPath.Clear();\r
- _rootMediaPath.Append(received_Filepath);\r
- }\r
-\r
- if (__pLabelDisplayPath != null)\r
- {\r
- switch (receivedStorageType)\r
- {\r
- case MEMORY_TYPE_PHONE:\r
- {\r
- __displayPath = phone;\r
- _storageType = MEMORY_TYPE_PHONE;\r
- //AppResource::GetInstance()->GetString(L"IDS_MF_TAB_PHONE", __tabSelected);\r
- }\r
- break;\r
-\r
- case MEMORY_TYPE_SD_CARD:\r
- {\r
- __displayPath = sdCard;\r
- _storageType = MEMORY_TYPE_SD_CARD;\r
- //AppResource::GetInstance()->GetString(L"IDS_SD_CARD", __tabSelected);\r
- }\r
- break;\r
-\r
- case MEMORY_TYPE_EXTERNAL:\r
- {\r
- __displayPath = external;\r
- _storageType = MEMORY_TYPE_EXTERNAL;\r
- }\r
- break;\r
-\r
- default:\r
- {\r
- //Empty Implementation.\r
- }\r
- break;\r
- }\r
-\r
- //Call the function to set the DisplayPath of the label.\r
- SetNextDisplayPath();\r
- }\r
-\r
- }\r
- }\r
- else\r
- {\r
- _rootMediaPath = FolderNavigationPresentationModel::GetCurrentPath();\r
- }\r
-\r
- parentPath.Append(_rootMediaPath);\r
-\r
- if (_pFolderEntryPM != null)\r
- {\r
- _pFolderEntryPM->SetFolderEntryPath(parentPath);\r
- _pFilenames = _pFolderEntryPM->GetFolderEntryList();\r
- TryCatch(_pFilenames != null, , "Failed to allocate Memory to Filenames ArrayList");\r
- _pFolderEntryPM->InitThumbnailManager();\r
- }\r
-\r
- if (_pListView != null)\r
- {\r
- _pListView->UpdateList();\r
- }\r
-\r
- DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);\r
- AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));\r
- return;\r
-CATCH:\r
- AppLogDebug("Exit %s", GetErrorMessage(GetLastResult()));\r
-}\r
-\r
-void\r
-SubFolderSelection::OnSceneTransitionStarted (const Tizen::Ui::Scenes::SceneId ¤tSceneId, const Tizen::Ui::Scenes::SceneId &nextSceneId)\r
-{\r
-\r
-}\r
-void SubFolderSelection::OnPlayerAudioFocusChanged (void)\r
-{\r
- int AudioPlayerState = _pAudioPlayer->GetState();\r
-\r
- AppLogDebug("SubFolderSelectionForm %d ++", AudioPlayerState);\r
- if (AudioPlayerState == PLAYER_STATE_PAUSED)\r
- {\r
- AppLogDebug("Pause");\r
- AppLogDebug("Refreshing %d", _currentAudioPlayIndex);\r
- _pListView->RefreshList(_currentAudioPlayIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);\r
- }\r
-\r
- AppLogDebug("SubFolderSelectionForm--");\r
-}\r
-\r
-void\r
-SubFolderSelection::OnFileEventOccured(const unsigned long events,const Tizen::Base::String & path, const unsigned int eventId)\r
-{\r
- AppLogDebug("SubFolderSelection::OnFileEventOccured:%S", path.GetPointer());\r
-\r
- if ((events & FILE_EVENT_TYPE_ATTRIBUTE) || (events & FILE_EVENT_TYPE_DELETE) || (events & FILE_EVENT_TYPE_MOVED_TO ))\r
- {\r
- if (_pFolderEntryPM!=null)\r
- {\r
- _pFolderEntryPM->RefreshFolderEntries();\r
- }\r
-\r
- if (_pListView != null && _pListView->IsVisible())\r
- {\r
- _pListView->UpdateList();\r
- }\r
-\r
- if (_pFolderEntryPM!=null)\r
- {\r
- AppLogDebug("inside file event");\r
- _pFolderEntryPM->InitThumbnailManager();\r
- }\r
- }\r
-}\r
-\r
-void\r
-SubFolderSelection::OnAudioNotificationReceived(void)\r
-{\r
- int AudioPlayerState;\r
-\r
- if (_pAudioPlayer != null)\r
- {\r
- AudioPlayerState = _pAudioPlayer->GetState();\r
- if (AudioPlayerState == PLAYER_STATE_PLAYING)\r
- {\r
- _pAudioPlayer->Pause();\r
- _pListView->RefreshList(_currentAudioPlayIndex, LIST_REFRESH_TYPE_ITEM_MODIFY);\r
- }\r
- }\r
-}\r
+//
+// 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 <RelativeLayout*> (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 <RelativeLayout*> (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<String*>(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);
+ }
+ }
+}