2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file GlGalleryApp.cpp
19 * @brief This is the implementation file for GalleryApp class.
23 #include "GlAlbumListPresentationModel.h"
24 #include "GlContentUpdateEventListener.h"
\r
25 #include "GlFileListPresentationModel.h"
26 #include "GlGalleryApp.h"
27 #include "GlMainFrame.h"
28 #include "GlSettingPresentationModel.h"
31 using namespace Tizen::App;
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34 using namespace Tizen::Base::Runtime;
35 using namespace Tizen::Base::Utility;
36 using namespace Tizen::System;
37 using namespace Tizen::Ui;
38 using namespace Tizen::Ui::Controls;
39 using namespace Tizen::Ui::Scenes;
41 GalleryApp::GalleryApp(void)
44 , __appControlResult(APP_CTRL_RESULT_SUCCEEDED)
47 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
50 GalleryApp::~GalleryApp(void)
53 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
57 GalleryApp::CreateInstance(void)
60 UiApp* pUiApp = new (std::nothrow) GalleryApp();
61 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
67 GalleryApp::GetAppControlOperationId(void) const
70 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
76 GalleryApp::GetMimeType(void) const
79 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
84 GalleryApp::GetAppControlArguments(void) const
87 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
93 GalleryApp::SendAppControlResult(const AppCtrlResult appControlResult, const IMap* pExtraData)
96 AppControlProviderManager* pAppManager = AppControlProviderManager::GetInstance();
97 result r = pAppManager->SendAppControlResult(__requestId, appControlResult, pExtraData);
98 if (r == E_MAX_EXCEEDED)
100 MessageBox messageBox;
101 messageBox.Construct(L"", ResourceManager::GetString(L"IDS_RCS_BODY_MAXIMUM_NUMBER_OF_FILES_EXCEEDED"),
102 MSGBOX_STYLE_NONE, 3000);
104 messageBox.ShowAndWait(modalResult);
107 AppLogDebug("appControlResult is %d", appControlResult);
108 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
112 GalleryApp::OnAppInitializing(AppRegistry& appRegistry)
114 AppLogDebug("ENTER");
115 AppControlProviderManager::GetInstance()->SetAppControlProviderEventListener(this);
116 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
122 GalleryApp::OnAppInitialized(void)
124 AppLogDebug("ENTER");
125 MainFrame* pMainFrame = new (std::nothrow) MainFrame();
126 pMainFrame->Construct();
127 AddFrame(*pMainFrame);
129 SettingInfo::AddSettingEventListener(*this);
130 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
136 GalleryApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
138 AppLogDebug("ENTER");
\r
139 ContentUpdateEventListener* pContentListener = ContentUpdateEventListener::GetInstance();
\r
140 if (pContentListener)
\r
142 pContentListener->RemoveContentListener();
\r
144 AlbumListPresentationModel* pAlbumListPresentationModel = AlbumListPresentationModel::GetInstance();
145 if (pAlbumListPresentationModel != null)
147 pAlbumListPresentationModel->ClearThumbnailRequests(true);
149 FileListPresentationModel* pFileListPresentationModel = FileListPresentationModel::GetInstance();
150 if (pFileListPresentationModel != null)
152 pFileListPresentationModel->ClearThumbnailRequests(true);
158 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
164 GalleryApp::OnForeground(void)
166 AppLogDebug("ENTER");
167 static bool bFirst = true;
174 MainFrame* pMainFrame = dynamic_cast<MainFrame*>(GetFrameAt(0));
177 pMainFrame->SetEnabled(true);
178 pMainFrame->Invalidate(true);
181 ContentUpdateEventListener* pContentListener = ContentUpdateEventListener::GetInstance();
182 if (pContentListener->GetChangeNotificationStatus() == true)
184 pContentListener->ResumeOperation();
186 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
190 GalleryApp::OnAppControlRequestReceived(RequestId reqId, const String& operationId,
191 const String* pUriData, const String* pMimeType, const IMap* pExtraData)
193 AppLogDebug("ENTER");
195 __operationId = operationId;
197 if (pMimeType != null)
199 __mimeType = *pMimeType;
201 if (pExtraData != null)
203 HashMap* pArguments = new (std::nothrow) HashMap(SingleObjectDeleter);
204 pArguments->Construct();
206 const String* pKey = null;
207 const String* pValue = null;
208 IList* pKeyList = pExtraData->GetKeysN();
210 int loopCount = pKeyList->GetCount();
211 for (int i = 0; i < loopCount; ++i)
213 pKey = static_cast<const String*>(pKeyList->GetAt(i));
214 pValue = static_cast<const String*>(pExtraData->GetValue(*pKey));
216 pArguments->Add(new (std::nothrow) String(*pKey), new (std::nothrow) String(*pValue));
218 __pArguments = pArguments;
221 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
225 GalleryApp::OnSettingChanged(String& key)
227 AppLogDebug("ENTER key(%ls)", key.GetPointer());
228 if (key.CompareTo(SETTING_KEY_LANGUAGE) == 0 || key.CompareTo(SETTING_KEY_FONT_SIZE) == 0)
230 UiApp::GetInstance()->Terminate();
232 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
236 GalleryApp::SetFrameEnabled(const bool enabled)
238 MainFrame* pMainFrame = dynamic_cast<MainFrame*>(GetFrameAt(0));
241 pMainFrame->SetEnabled(enabled);
246 GalleryApp::IsHwKeySupported(void)
248 AppLogDebug("ENTER");
250 bool isHwKeyExist = false;
251 Tizen::System::SystemInfo::GetValue(L"http://tizen.org/feature/input.keys.back", isHwKeyExist);
253 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));