Fixed Nabi issues N_SE-45388, N_Se-45329, N_SE-44967
[apps/osp/Internet.git] / src / IntBookmarkListForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16
17 //!Internet
18 /*@file:    IntBookmarkListForm
19  *@brief:       This class defines BookmarkListForm
20  *
21  */
22
23 #include <FApp.h>
24 #include "IntBookmarkData.h"
25 #include "IntBookmarkListForm.h"
26 #include "IntBookmarkPresentationModel.h"
27 #include "IntCommonLib.h"
28 #include "IntConfirmationPopup.h"
29 #include "IntFaviconManager.h"
30 #include "IntMultipleWindowPresentationModel.h"
31 #include "IntSceneRegister.h"
32 #include "IntTypes.h"
33
34
35 using namespace Tizen::App;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Base::Runtime;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Ui;
41 using namespace Tizen::Ui::Controls;
42 using namespace Tizen::Ui::Scenes;
43 using namespace Tizen::Media;
44
45 const wchar_t* DEFAULT_VALUE_PARENTID = L"0";
46 static const wchar_t* IDB_TAB_ICON_BOOKMARK = L"I01_tab_icon_bookmarks.png";
47 static const wchar_t* IDB_TAB_ICON_HISTORY = L"I01_tab_icon_history.png";
48 static const wchar_t* IDB_NO_CONTENT_BOOKMARK = L"I01_Nocontents_Bookmarks.png";
49 static const wchar_t* IDB_ICON_FOLDER_OPEN = L"I01_icon_folder_open.png";
50
51 const int BookmarkListForm::IDA_TABBAR_ITEM_1 = 101;
52 const int BookmarkListForm::IDA_TABBAR_ITEM_2 = 102;
53 const int BookmarkListForm::IDA_FOOTER_ITEM1 = 103;
54 const int BookmarkListForm::IDA_FOOTER_ITEM2 = 104;
55 const int BookmarkListForm::IDA_FOOTER_ITEM_ADDBOOKMARK = 105;
56 const int BookmarkListForm::IDA_FORMAT_FOLDER = 106;
57 const int BookmarkListForm::IDA_FORMAT_SITE = 107;
58 const int BookmarkListForm::IDA_CONTEXT_ITEM_FOLDER_EDIT = 108;
59 const int BookmarkListForm::IDA_CONTEXT_ITEM_FOLDER_DELETE = 109;
60 const int BookmarkListForm::IDA_CONTEXT_ITEM_EDIT = 110;
61 const int BookmarkListForm::IDA_CONTEXT_ITEM_SHARE = 111;
62 const int BookmarkListForm::IDA_CONTEXT_ITEM_DELETE = 112;
63 const int BookmarkListForm::IDA_FORMAT_ICON = 113;
64 const int BookmarkListForm::IDA_FORMAT_URL = 114;
65
66 //const int BookmarkListForm::IDA_CONFIRMATION_NO = 1000;
67 //const int BookmarkListForm::IDA_CONFIRMATION_YES = 1001;
68
69 BookmarkListForm::BookmarkListForm(void)
70 {
71         __pItemContextFolder = null ;
72         __pItemContextSite = null ;
73         __pListview = null;
74         __pData = null;
75         __pSearchListView = null;
76         __pSearchBar = null;
77         __searchBookmark = false;
78         __parentID = DEFAULT_VALUE_PARENTID;
79         __noBookmarks = true;
80         __selectedindex = 0;
81         __searchText = L"";
82         __previousSceneId = L"";
83         __fontSize = 44;
84 }
85
86 BookmarkListForm::~BookmarkListForm(void)
87 {
88
89         if (__pData != null)
90         {
91                 __pData->RemoveAll(true);
92                 delete __pData;
93                 __pData = NULL;
94         }
95
96         if (__pItemContextFolder != null)
97         {
98                 delete __pItemContextFolder;
99                 __pItemContextFolder = null;
100         }
101
102         if (__pItemContextSite != null)
103         {
104                 delete __pItemContextSite;
105                 __pItemContextSite = null;
106         }
107 }
108
109 result
110 BookmarkListForm::OnTerminating(void)
111 {
112         result r = E_SUCCESS;
113
114         if (__pData != null)
115         {
116                 __pData->RemoveAll(true);
117                 delete __pData;
118                 __pData = NULL;
119         }
120
121         return r;
122 }
123
124
125 bool
126 BookmarkListForm::Initialize(void)
127 {
128         Construct(L"IDL_BOOKMARK_LIST");
129         return true;
130 }
131
132 result
133 BookmarkListForm::OnInitializing(void)
134 {
135         result r = E_SUCCESS;
136         HeaderItem bookmark;
137         HeaderItem history;
138         Header *pHeader = GetHeader();
139         Bitmap *pIconBitmap = null;
140         AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
141         int bookmarkCount = 0;
142         const int WIDTH_CONTEXT_MENU_TWO_BUTTON = 336;
143         const int WIDTH_CONTEXT_MENU_THREE_BUTTON = 160;
144         const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
145
146
147         // Setup back event listener
148         SetFormBackEventListener(this);
149         AddOrientationEventListener(*this);
150
151         SceneManager::GetInstance()->AddSceneEventListener(IDSCN_BOOKMARK_VIEW, *this);
152         GetHeader()->AddActionEventListener(*this);
153         GetFooter()->AddActionEventListener(*this);
154
155         if ( pAppResource == NULL )
156         {
157                 return E_FAILURE;
158         }
159
160         __fontSize = CommonUtil::GetFontSize();
161         __pItemContextFolder = new(std::nothrow) ListContextItem();
162         __pItemContextFolder->Construct();
163         __pItemContextFolder->AddElement(IDA_CONTEXT_ITEM_FOLDER_EDIT, CommonUtil::GetString(L"IDS_BR_SK_EDIT"));
164
165         __pItemContextFolder->AddElement(IDA_CONTEXT_ITEM_FOLDER_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"), true);
166         __pItemContextFolder->SetElementBackgroundColor(IDA_CONTEXT_ITEM_FOLDER_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL , CONTEXT_ITEM_DELETE_COLOR);
167         __pItemContextFolder->SetElementBackgroundColor(IDA_CONTEXT_ITEM_FOLDER_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_HIGHLIGHTED , CONTEXT_ITEM_DELETE_COLOR);
168         __pItemContextFolder->SetElementBackgroundColor(IDA_CONTEXT_ITEM_FOLDER_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_PRESSED , CONTEXT_ITEM_DELETE_COLOR);
169
170         __pItemContextSite = new(std::nothrow) ListContextItem();
171         __pItemContextSite->Construct();
172         __pItemContextSite->AddElement(IDA_CONTEXT_ITEM_EDIT, CommonUtil::GetString(L"IDS_BR_SK_EDIT"));
173         __pItemContextSite->AddElement(IDA_CONTEXT_ITEM_SHARE, CommonUtil::GetString(L"IDS_BR_OPT_SHARE"));
174
175         __pItemContextSite->AddElement(IDA_CONTEXT_ITEM_DELETE, CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB"), true);
176         __pItemContextSite->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_NORMAL , CONTEXT_ITEM_DELETE_COLOR);
177         __pItemContextSite->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_HIGHLIGHTED , CONTEXT_ITEM_DELETE_COLOR);
178         __pItemContextSite->SetElementBackgroundColor(IDA_CONTEXT_ITEM_DELETE,LIST_CONTEXT_ITEM_ELEMENT_STATUS_PRESSED , CONTEXT_ITEM_DELETE_COLOR);
179
180         __pListview = static_cast< ListView* >(GetControl("IDC_LISTVIEW1"));
181
182         if (__pListview == null)
183         {
184                 return E_FAILURE;
185         }
186         __pSearchBar = static_cast< SearchBar* >(GetControl(L"IDC_SEARCHBAR1"));
187
188         if (__pSearchBar == null)
189         {
190                 return E_FAILURE;
191         }
192
193         __pSearchBar->AddFocusEventListener(*this);
194         if (__pListview != null)
195         {
196                 __pListview->SetBackgroundColor(GetBackgroundColor());
197                 //              __pListview->SetBounds(__pListview->GetX(), __pListview->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height);
198                 __pListview->AddFastScrollListener(*this);
199                 __pListview->AddListViewItemEventListener(*this);
200                 __pListview->SetItemProvider(*this);
201                 __pListview->UpdateList();
202         }
203
204         __pPopUp = new(std::nothrow) SharePopup();
205
206         if (__pPopUp != null)
207         {
208                 __pPopUp->Initialize();
209                 AddControl(__pPopUp);
210         }
211
212         __pSearchListView = new(std::nothrow) ListView();
213
214         if (__pSearchListView == null)
215         {
216                 return E_FAILURE;
217         }
218
219         r = __pSearchListView->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height -72), true, false);
220         TryCatch( !IsFailed(r),,"BookmarkListForm::OnSearchBarModeChanged Update list failed %s",GetErrorMessage(r));
221
222         __pSearchListView->SetBackgroundColor(GetBackgroundColor());
223         __pSearchListView->SetItemProvider(*this);
224         __pSearchListView->SetTextOfEmptyList(CommonUtil::GetString(L"IDS_BR_BODY_NO_RESULTS_FOUND"));
225         __pSearchListView->SetTextColorOfEmptyList(Color::GetColor(COLOR_ID_BLACK));
226         __pSearchListView->SetShowState(false);
227         __pSearchListView->AddListViewItemEventListener(*this);
228
229         __pSearchBar->AddSearchBarEventListener(*this);
230         __pSearchBar->AddKeypadEventListener(*this);
231         __pSearchBar->SetContent(__pSearchListView);
232
233         BookmarkPresentationModel::GetInstance()->GetFolderBookmarkCount(__parentID, bookmarkCount);
234         if(bookmarkCount <= 0)
235         {
236                 __pSearchBar->SetShowState(false);
237                 //__pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetY(),__pSearchBar->GetWidth(),GetClientAreaBounds().height - __pSearchBar->GetPosition().y);
238                 __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetY(),__pListview->GetWidth(),GetClientAreaBounds().height);
239         }
240         else
241         {
242                 __pSearchBar->SetShowState(true);
243         }
244
245
246         if (pHeader != null)
247         {
248                 pHeader->SetStyle(HEADER_STYLE_TAB);
249                 bookmark.Construct(IDA_TABBAR_ITEM_1);
250                 String strbookmark;
251                 pAppResource->GetString(L"IDS_BR_TAB_BOOKMARKS", strbookmark);
252                 bookmark.SetText(strbookmark);
253                 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_BOOKMARK);
254                 bookmark.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
255                 bookmark.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
256                 pHeader->AddItem(bookmark);
257
258                 if (pIconBitmap != NULL)
259                 {
260                         delete pIconBitmap;
261                 }
262
263                 history.Construct(IDA_TABBAR_ITEM_2);
264                 String strhistory;
265                 pAppResource->GetString(L"IDS_BR_TAB_HISTORY", strhistory);
266                 history.SetText(strhistory);
267                 pIconBitmap = pAppResource->GetBitmapN(IDB_TAB_ICON_HISTORY);
268                 history.SetIcon(HEADER_ITEM_STATUS_NORMAL, pIconBitmap);
269                 history.SetIcon(HEADER_ITEM_STATUS_PRESSED, pIconBitmap);
270                 pHeader->AddItem(history);
271                 pHeader->SetItemSelected(0);
272                 pHeader->SetTabEditModeEnabled(false);
273
274                 if (pIconBitmap != NULL)
275                 {
276                         delete pIconBitmap;
277                 }
278         }
279
280
281         CATCH:return r;
282 }
283
284 void
285 BookmarkListForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
286 {
287         AppLogDebug("BookmarkListForm::OnActionPerformed actionId = %d",actionId);
288         String bookmarkId;
289         int id = 0;
290         BookmarkData* pBookMark = null;
291
292         switch (actionId)
293         {
294         case IDA_FOOTER_ITEM1:
295         {
296                 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
297                 GetHeader()->SetItemSelected(0);
298                 GetHeader()->Invalidate(true);
299                 SceneManager* pSceneManager = SceneManager::GetInstance();
300                 pBookMark = dynamic_cast< BookmarkData* >(__pData->GetAt(__selectedindex));
301
302                 if ( pBookMark == NULL )
303                 {
304                         return;
305                 }
306
307                 ArrayList* pArgList = null;
308                 pArgList = new(std::nothrow) ArrayList();
309                 if (pArgList != null)
310                 {
311                         pArgList->Construct();
312                         pArgList->Add(*new(std::nothrow) String(pBookMark->GetParentId()));
313                 }
314                 //pArgList->Add(*new(std::nothrow) String(pBookmark->);
315                 if (pSceneManager != null)
316                 {
317                         if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_EDIT_BOOKMARK_LIST),pArgList) != E_SUCCESS)
318                         {
319                                 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
320                                 pArgList->RemoveAll(true);
321                                 delete pArgList;
322                                 pArgList = null;
323                                 return;
324                         }
325                 }
326
327                 if ( pArgList != NULL)
328                 {
329                         pArgList->RemoveAll(true);
330                         delete pArgList;
331                 }
332         }
333
334         break;
335         case IDA_TABBAR_ITEM_2:
336         {
337         //      GetHeader()->SetItemSelected(0);
338         //      GetHeader()->Invalidate(true);
339
340                 SceneManager* pSceneManager = SceneManager::GetInstance();
341
342                 if (pSceneManager != null)
343                 {
344                         if(__previousSceneId.CompareTo(IDSCN_HISTORY_LIST) != 0)
345                         {
346                                 if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_HISTORY_LIST, SCENE_TRANSITION_ANIMATION_TYPE_LEFT)) != E_SUCCESS)
347                                 {
348                                         AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
349                                         return;
350                                 }
351                         }
352                         else
353                         {
354
355                                 if(pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_RIGHT))!= E_SUCCESS)
356                                 {
357                                         AppLogDebug("BookmarkListForm::OnActionPerformed GoBackward failed");
358                                         return;
359                                 }
360
361                         }
362                 }
363         }
364         break;
365         case IDA_FOOTER_ITEM2:
366         {
367                 SceneManager* pSceneManager = SceneManager::GetInstance();
368
369                 if (pSceneManager)
370                 {
371                         if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_BOOKMARK_FOLDER)) != E_SUCCESS)
372                         {
373                                 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
374                                 return;
375                         }
376                 }
377         }
378         break;
379         case IDA_FOOTER_ITEM_ADDBOOKMARK:
380         {
381                 SceneManager* pSceneManager = SceneManager::GetInstance();
382
383                 // send array list 0-for add, 1 for edit with parent ID
384                 ArrayList* pArgList = null;
385                 pArgList = new(std::nothrow) ArrayList();
386                 if (pArgList != null)
387                 {
388                         pArgList->Construct();
389                         pArgList->Add(*new(std::nothrow) String(L"0"));
390                         pArgList->Add(*new(std::nothrow) String(__parentID));
391                 }
392
393                 if (pSceneManager)
394                 {
395                         if(pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ADD_BOOKMARK),pArgList) != E_SUCCESS)
396                         {
397                                 AppLogDebug("BookmarkListForm::OnActionPerformed GoForward failed");
398                                 pArgList->RemoveAll(true);
399                                 delete pArgList;
400                                 return;
401                         }
402                 }
403
404                 if (pArgList != null)
405                 {
406                         pArgList->RemoveAll(true);
407                         delete pArgList;
408                 }
409
410         }
411         break;
412         case IDA_BUTTON_NO:
413                 __pConfirmationPopup->SetShowState(false);
414                 __pConfirmationPopup->Show();
415                 break;
416         case IDA_BUTTON_YES:
417                 pBookMark = dynamic_cast< BookmarkData* >(__pData->GetAt(__selectedindex));
418                 if ( pBookMark== null)
419                         return;
420                 bookmarkId=pBookMark->GetBookmarkId();
421                 Integer::Parse(bookmarkId,id);
422                 if (pBookMark->GetBookmarkType() == BOOKMARK_TYPE_FOLDER)
423                         BookmarkPresentationModel::GetInstance()->DeleteFolder(id);
424                 else
425                         BookmarkPresentationModel::GetInstance()->DeleteBookmark(id);
426                 if (__pListview == null)
427                 {
428                         return;
429                 }
430                 AppLogDebug("__pListview GetBounds %d,%d,%d,%d",__pListview->GetBounds().x,__pListview->GetBounds().y,__pListview->GetBounds().width,__pListview->GetBounds().height);
431                 __pSearchListView->UpdateList();
432                 __pListview->UpdateList();
433
434                 if (__pListview->GetItemCount() == 0)
435                 {
436                         GetFooter()->SetItemEnabled(1,false);
437                         __pSearchBar->SetShowState(false);
438                         __pSearchBar->Invalidate(true);
439                 }
440
441                 if (__noBookmarks == true)
442                 {
443                         Bitmap* emptyListBmp = AppResource::GetInstance()->GetBitmapN(IDB_NO_CONTENT_BOOKMARK);
444                         GetFooter()->SetItemEnabled(1,false);
445                         __pSearchBar->SetShowState(false);
446                         __pSearchBar->Invalidate(true);
447                         //                      __pListview->SetBounds(__pSearchBar->GetPosition().x,__pSearchBar->GetPosition().y,__pSearchBar->GetWidth() ,GetClientAreaBounds().height);
448                         __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetPosition().y,__pSearchBar->GetWidth() ,GetClientAreaBounds().height);
449                         __pListview->SetBitmapOfEmptyList(emptyListBmp);
450                         if (emptyListBmp)
451                         {
452                                 delete emptyListBmp;
453                                 emptyListBmp = null;
454                         }
455                         __pListview->UpdateList();
456
457                 }
458                 else
459                 {
460                         GetFooter()->SetItemEnabled(1,true);
461
462                         if (__parentID.CompareTo(L"0") == 0)
463                         {
464                                 __pSearchBar->SetShowState(true);
465                                 __pSearchBar->Invalidate(true);
466                         }
467                 }
468
469                 GetFooter()->Invalidate(true);
470                 __pConfirmationPopup->SetShowState(false);
471                 __pConfirmationPopup->Show();
472                 __selectedindex = 0;
473
474                 break;
475         default:
476                 break;
477         }
478 }
479
480 void
481 BookmarkListForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
482 {
483         AppLogDebug("BrowserApplicationForm::OnFormBackRequested");
484
485         UiApp* pApp = UiApp::GetInstance();
486         if      (pApp == null)
487         {
488                 return;
489         }
490
491         if (__parentID != DEFAULT_VALUE_PARENTID)
492         {
493                 __parentID = DEFAULT_VALUE_PARENTID;
494                 __pSearchBar->SetShowState(true);
495                 __pListview->SetBounds(__pListview->GetX() ,__pSearchBar->GetPosition().y + __pSearchBar->GetHeight(),__pListview->GetWidth(),GetClientAreaBounds().height - (__pSearchBar->GetY() + __pSearchBar->GetHeight()));
496                 __pListview->UpdateList();
497                 __pFooter = GetFooter();
498                 GetFooter()->SetItemEnabled(2,true);
499                 GetFooter()->Invalidate(true);
500         }
501         else
502         {
503                 SceneManager* pSceneManager = SceneManager::GetInstance();
504                 if (pSceneManager != null)
505                 {
506                         if(__previousSceneId.CompareTo(IDSCN_HISTORY_LIST) != 0)
507                         {
508                                 pSceneManager->GoBackward(BackwardSceneTransition());
509                         }
510                         else
511                         {
512                                 pSceneManager->GoBackward(BackwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_LEFT));
513                         }
514                 }
515         }
516
517         if (__noBookmarks == true)
518         {
519                 GetFooter()->SetItemEnabled(1,false);
520         }
521         else
522         {
523                 GetFooter()->SetItemEnabled(1,true);
524         }
525 }
526
527 Tizen::Ui::Controls::ListItemBase*
528 BookmarkListForm::CreateItem(int index, int itemWidth)
529 {
530
531         AppLog("BookmarkListForm::CreateItem index %d , itemWidth %d",index, itemWidth);
532         AppLog("listviewwidth %d",__pListview->GetWidth());
533         result r = E_FAILURE;
534         ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
535         if(__pData == null)
536         {
537                 return null;
538         }
539         CustomItem* pItem = new(std::nothrow) CustomItem();
540
541         BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pData->GetAt(index));
542         Bitmap* pBitmap = null;
543         Dimension dim;
544
545         Image* pImage = null;
546         pImage = new Image();
547         pImage->Construct();
548
549         const int x_Margin_Icon = 16;                 // local as there used only in this function
550         const int y_Margin_Icon = 28;
551         const int height_Icon = 72;
552         const int width_Icon = 72 ;
553         const int x_Margin_Title = 104 ;
554         const int y_Margin_Title = 10;
555         const int width_Title = GetClientAreaBounds().width - 108 - 52 - 30;
556         const int x_Margin_Url = 104 ;
557         const int y_Margin_Url = 70 ;
558         const int width_Url = GetClientAreaBounds().width - 108 - 52 ;
559         const int height_Url = 48;
560         const int itemHeight = 128;
561         const int textSize = 32;
562         String bitmapId;
563
564         if( pBookMark == NULL )
565         {
566                 delete pItem;
567                 pItem = null;
568                 delete pImage;
569                 pImage = null;
570                 return NULL;
571         }
572         if ( pBookMark->GetBookmarkType() == BOOKMARK_TYPE_FOLDER )
573         {
574                 r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth,112 - 44 + __fontSize), LIST_ANNEX_STYLE_DETAILED);
575                 TryCatch(!IsFailed(r),,"BookmarkListForm::CreateItem Construct failed %s",GetErrorMessage(r));
576
577                 pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_FOLDER_OPEN);
578                 if (pBitmap != null)
579                 {
580                         pItem->AddElement(Rectangle(x_Margin_Icon, 20+(__fontSize - 44)/2, width_Icon, height_Icon), IDA_FORMAT_ICON, *pBitmap, null);
581                         delete pBitmap;
582                 }
583
584                 pItem->AddElement(Rectangle(x_Margin_Title, 26, width_Title, 60 + (__fontSize - 44) ), IDA_FORMAT_FOLDER, pBookMark->GetBookmarkTitle(),__fontSize, CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true);
585
586                 if ( __pItemContextFolder != NULL)
587                 {
588                         pItem->SetContextItem(__pItemContextFolder);
589                 }
590         }
591         else
592         {
593                 r = pItem->Construct(Tizen::Graphics::Dimension(itemWidth, itemHeight - 44 + __fontSize), style);
594                 TryCatch( !IsFailed(r),,"BookmarkListForm::CreateItem Construct failed %s",GetErrorMessage(r));
595
596                 AppLogDebug("BookmarkListForm::faviconid %ls",pBookMark->GetFaviconId().GetPointer());
597                 bitmapId = pBookMark->GetFaviconId();
598
599                 dim = Dimension(pBookMark->GetFavIconWidth(), pBookMark->GetFavIconHeight());
600
601                 AppLog("BookmarkListForm::CreateItem check 0");
602
603                 // get fav icon bitmap
604                 ByteBuffer* pFavIconBuffer = null;
605                 pFavIconBuffer = pBookMark->GetFavIconBuffer();
606
607                 AppLog("BookmarkListForm::CreateItem check 0");
608
609                 if (pFavIconBuffer != null)
610                 {
611                         AppLog("BookmarkListForm::CreateItem pFavIconBuffer is not null");
612                 }
613                 else
614                 {
615                         AppLog("BookmarkListForm::CreateItem pFavIconBuffer is null");
616                 }
617
618                 pBitmap = pImage->DecodeN(*pFavIconBuffer, IMG_FORMAT_PNG, BITMAP_PIXEL_FORMAT_ARGB8888);
619
620                 AppLog("BookmarkListForm::CreateItem check 1");
621
622                 if (pBitmap != null)
623                 {
624                         AppLog("rahul bitmap is not null");
625                         int width = pBitmap->GetWidth();
626                         int height = pBitmap->GetHeight();
627                         AppLog("rahul bitmap width is %d", width);
628                         AppLog("rahul bitmap height is %d", height);
629                         AppLog("rahul favicon width is %d", pBookMark->GetFavIconWidth());
630                         AppLog("rahul favicon height is %d", pBookMark->GetFavIconHeight());
631                 }
632                 else
633                 {
634                         AppLog("rahul bitmap is null");
635                 }
636
637                 if (pBitmap == null)
638                 {
639                         AppLogDebug("BookmarkListForm::CreateItem bitmap is null");
640                         pBitmap = FaviconManager::GetInstance()->GetDefaultFaviconN();
641                 }
642                 pItem->AddElement(Rectangle(x_Margin_Icon, y_Margin_Icon +(__fontSize - 44)/2, width_Icon, height_Icon), IDA_FORMAT_ICON, *pBitmap, null);
643                 pItem->AddElement(Rectangle(x_Margin_Title, 0, width_Title, itemHeight - height_Url - 44 + __fontSize), IDA_FORMAT_SITE, pBookMark->GetBookmarkTitle(),__fontSize,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true);
644 //              if(__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
645 //                      pItem->AddElement(Rectangle(x_Margin_Url, y_Margin_Url, width_Url, height_Url), IDA_FORMAT_URL, pBookMark->GetUrl(),textSize,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,CUSTOM_COLOR_TRANSPARENT,true);
646 //              else
647                         pItem->AddElement(Rectangle(x_Margin_Url, y_Margin_Url - 44 + __fontSize, width_Url, height_Url), IDA_FORMAT_URL, pBookMark->GetUrl(),textSize,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true);
648
649                 if (pBitmap != null)
650                 {
651                         delete pBitmap;
652                 }
653                 if ( __pItemContextSite != NULL)
654                 {
655                         pItem->SetContextItem(__pItemContextSite);
656                 }
657         }
658
659         delete pImage;
660         return pItem;
661
662         CATCH:
663
664         delete pImage;
665         delete pItem;
666         pItem = null;
667         return null;
668
669 }
670
671 bool
672 BookmarkListForm::DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth)
673 {
674         delete pItem;
675         pItem = null;
676         return true;
677 }
678
679 int
680 BookmarkListForm::GetItemCount(void)
681 {
682         int count = 0;
683
684         if (__pData != NULL )
685         {
686                 __pData->RemoveAll(true);
687                 delete __pData;
688                 __pData = null;
689         }
690         __pData = new(std::nothrow) Collection::ArrayList();
691         __pData->Construct();
692
693         if (__searchBookmark == false)
694         {
695                 BookmarkPresentationModel::GetInstance()->GetFolderBookmarkCount(__parentID, count);
696                 BookmarkPresentationModel::GetInstance()->GetFoldersBookmarks(__parentID, 0, count, *__pData);
697         }
698         else
699         {
700                 if (__searchText.GetLength() > 0)
701                 {
702                         __searchText.Replace(L"%", L"/%");
703                         __searchText.Replace(L"_", L"/_");
704                 }
705                 BookmarkPresentationModel::GetInstance()->GetSearchFolderBookmarkCount(count,__searchText);
706                 BookmarkPresentationModel::GetInstance()->GetSearchFoldersBookmarks(0, count, *__pData, __searchText);
707         }
708
709         AppLogDebug("Count = %d parentId = %ls __searchText %ls", count, __parentID.GetPointer() , __searchText.GetPointer());
710
711         if (count <= 0)
712         {
713                 __noBookmarks = true;
714                 GetFooter()->SetItemEnabled(1,false);
715         }
716         else
717         {
718                 __noBookmarks = false;
719                 GetFooter()->SetItemEnabled(1,true);
720         }
721
722         AppLogDebug("Result: %s", GetErrorMessage(GetLastResult()));
723         GetFooter()->Invalidate(true);
724         if (__pData != null && __pData->GetCount() >= 1)
725         {
726                 //              __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
727                 __pSearchBar->SetShowState(true);
728                 __pSearchBar->Invalidate(true);
729         }
730         else if (__searchBookmark == false)
731         {
732                 __pSearchBar->SetShowState(false);
733                 __pSearchBar->Invalidate(true);
734         }
735
736         if (__parentID.CompareTo(L"0") != 0)
737         {
738                 __pSearchBar->SetShowState(false);
739                 __pSearchBar->Invalidate(true);
740         }
741         if (__noBookmarks == true)
742         {
743                 __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetPosition().y,__pSearchBar->GetWidth() ,GetClientAreaBounds().height);
744                 Bitmap* pBitmap = AppResource::GetInstance()->GetBitmapN(IDB_NO_CONTENT_BOOKMARK);
745
746                 if ( pBitmap != NULL)
747                 {
748                         __pListview->SetBitmapOfEmptyList(pBitmap);
749                         delete pBitmap;
750                 }
751         }
752         else
753         {
754                 if (__parentID.CompareTo(L"0") == 0)
755                 {
756                         __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetHeight(),GetClientAreaBounds().width ,GetClientAreaBounds().height - __pSearchBar->GetY() - __pSearchBar->GetHeight());
757                 }
758                 else
759                 {
760                         __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetY(),__pSearchBar->GetWidth() ,GetClientAreaBounds().height);
761
762                 }
763
764         }
765         __pListview->Invalidate(true);
766         return count;
767
768 }
769
770 void
771 BookmarkListForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus status)
772 {
773         AppLogDebug("BookmarkListForm::OnListViewContextItemStateChanged int index %d, int elementId %d, Tizen::Ui::Controls::ListContextItemStatus status %d",index,elementId,status);
774
775         String deleteText = CommonUtil::GetString(L"IDS_BR_SK_DELETE_ABB");
776         deleteText.Append(L"? ");
777         int timeOut = 25000;
778         result r = E_SUCCESS;
779
780         switch(elementId)
781         {
782         case IDA_CONTEXT_ITEM_FOLDER_EDIT:
783         {
784                 ArrayList* pArgList = null;
785                 String* pEdit = null;
786
787                 SceneManager* pSceneManager = SceneManager::GetInstance();
788                 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pData->GetAt(index));
789                 if (pBookMark != null && pBookMark->GetBookmarkType() == BOOKMARK_TYPE_FOLDER)
790                 {
791                         pArgList = new(std::nothrow) ArrayList();
792                         if (pArgList != null)
793                         {
794                                 pEdit= new(std::nothrow) String(CommonUtil::GetString(L"IDS_BR_SK_EDIT"));
795                                 pArgList->Construct();
796                                 pArgList->Add(*new(std::nothrow) BookmarkData(*pBookMark));
797                                 pArgList->Add(*pEdit);
798                                 if (    pSceneManager != null)
799                                 {
800                                         result r;
801                                         r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_CREATE_BOOKMARK_FOLDER), pArgList);
802                                 }
803
804                                 if (pArgList != null)
805                                 {
806                                         delete pArgList;
807                                         pArgList = null;
808                                 }
809                                 if(IsFailed(r))
810                                 {
811                                         AppLogDebug("BookmarkListForm::OnListViewContextItemStateChanged GoForward failed %s",GetErrorMessage(r));
812                                         return;
813                                 }
814                         }
815                 }
816
817         }
818         break;
819
820         case IDA_CONTEXT_ITEM_FOLDER_DELETE:
821         case IDA_CONTEXT_ITEM_DELETE:
822         {
823                 __pConfirmationPopup = new(std::nothrow) ConfirmationPopup();
824                 __pConfirmationPopup->Initialize();
825                 __pConfirmationPopup->RemoveActionListener(*this);
826                 __pConfirmationPopup->AddActionListener(*this);
827                 __pConfirmationPopup->setMessage(deleteText);
828                 __pConfirmationPopup->Show();
829                 __selectedindex = index;
830         }
831         break;
832
833         case IDA_CONTEXT_ITEM_EDIT:
834         {
835                 ArrayList* pArgList = null;
836                 SceneManager* pSceneManager = SceneManager::GetInstance();
837                 BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pData->GetAt(index));
838                 if (pBookMark!= null && pBookMark->GetBookmarkType() == BOOKMARK_TYPE_URL)
839                 {
840                         AppLogDebug("ID_CONTEXT_ITEM_SITE_1 BOOKMARK_TYPE_URL");
841                         pArgList = new(std::nothrow) ArrayList();
842                         if (pArgList != null)
843                         {
844                                 pArgList->Construct();
845                                 pArgList->Add(*new(std::nothrow) String(L"1"));
846                                 pArgList->Add(*new(std::nothrow) BookmarkData(*pBookMark));
847                                 if (    pSceneManager != null)
848                                 {
849                                         result r;
850                                         r = pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ADD_BOOKMARK), pArgList);
851                                         if (pArgList != null)
852                                         {
853                                                 delete pArgList;
854                                                 pArgList = null;
855                                         }
856                                         if(IsFailed(r))
857                                         {
858                                                 AppLogDebug("BookmarkListForm::OnListViewContextItemStateChanged GoForward failed %s",GetErrorMessage(r));
859                                                 return;
860                                         }
861                                 }
862                         }
863                 }
864         }
865         break;
866         case IDA_CONTEXT_ITEM_SHARE:
867         {
868                 AppLogDebug("OnListViewContextItemStateChanged Share");
869
870                 BookmarkData* pBookmark = dynamic_cast<BookmarkData*>(__pData->GetAt(index));
871                 if (pBookmark != null)
872                 {
873                         ShareInfo* pShareInfo = new(std::nothrow) ShareInfo();
874                         pShareInfo->SetPageTitle(pBookmark->GetBookmarkTitle());
875                         pShareInfo->SetPageUrl(pBookmark->GetUrl());
876                         pShareInfo->SetImageAttached(false);
877                         __pPopUp->RemoveAllShareInfo();
878                         __pPopUp->AddShareInfo(pShareInfo);
879                 }
880
881                 if (__pPopUp != null)
882                 {
883                         __pPopUp->SetShowState(true);
884                         __pPopUp->Show();
885                 }
886         }
887         break;
888         default:
889                 break;
890         }
891
892 }
893
894 void
895 BookmarkListForm::OnListViewItemLongPressed(Tizen::Ui::Controls::ListView& listView, int index, int elementId, bool& invokeListViewItemCallback)
896 {
897
898 }
899
900 void
901 BookmarkListForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
902 {
903         AppLogDebug("BookmarkListForm::OnListViewItemStateChanged");
904
905         result r = E_FAILURE;
906         ArrayList *pArgList = null;
907         SceneManager* pSceneManager = SceneManager::GetInstance();
908         BookmarkData* pBookmark = dynamic_cast< BookmarkData* >(__pData->GetAt(index));
909
910         if ( pBookmark == NULL )
911         {
912                 return;
913         }
914
915         switch (pBookmark->GetBookmarkType())
916         {
917         case BOOKMARK_TYPE_FOLDER:
918
919                 __parentID = pBookmark->GetBookmarkId();
920                 AppLogDebug("BOOKMARK_TYPE_FOLDER parent ID is %ls",__parentID.GetPointer());
921
922                 listView.UpdateList();
923                 if (listView.GetItemCount() == 0)
924                 {
925                         GetFooter()->SetItemEnabled(1,false);
926                 }
927                 else
928                 {
929                         GetFooter()->SetItemEnabled(1,true);
930                 }
931                 GetFooter()->SetItemEnabled(2,false);
932                 GetFooter()->Invalidate(true);
933                 __pSearchBar->HideKeypad();
934                 __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
935                 __pSearchBar->SetShowState(false);
936                 __pSearchBar->Invalidate(true);
937                 __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetY(),__pListview->GetWidth() ,GetClientAreaBounds().height);
938                 break;
939
940         case BOOKMARK_TYPE_URL:
941
942                 pArgList = new(std::nothrow) ArrayList();
943                 if (pArgList != null)
944                 {
945                         r = pArgList->Construct();
946                         TryCatch(!IsFailed(r), L"BookmarkListForm::OnListViewItemStateChanged pArgList Construct failed %s", GetErrorMessage(r));
947
948                         AppLogDebug("bookmark url = %ls",pBookmark->GetUrl().GetPointer());
949                         r = pArgList->Add(*MultipleWindowPresentationModel::GetInstance()->GetActiveWindowInfo());
950                         pArgList->Add(*new(std::nothrow) String(pBookmark->GetUrl()));
951
952                         if (pSceneManager != null)
953                         {
954                                 AppLogDebug("pSceneManager exists");
955                                 String prevSceneId;
956                                 MultipleWindowPresentationModel::GetInstance()->GetCurrentSceneId(prevSceneId);
957                                 r = pSceneManager->GoBackward(BackwardSceneTransition(prevSceneId), pArgList);
958                                 TryCatch(!IsFailed(r), L"BookmarkListForm::OnListViewItemStateChanged pArgList Construct failed %s", GetErrorMessage(r));
959                         }
960                         delete pArgList;
961                 }
962                 break;
963
964         default:
965                 break;
966         }
967
968         return;
969         CATCH:
970         if(pArgList)
971         {
972                 pArgList->RemoveAll(true);
973                 delete pArgList;
974         }
975
976 }
977
978 void
979 BookmarkListForm::OnListViewItemSwept(Tizen::Ui::Controls::ListView& listView, int index, Tizen::Ui::Controls::SweepDirection direction)
980 {
981
982
983 }
984
985 void
986 BookmarkListForm::OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index)
987 {
988
989 }
990
991 void
992 BookmarkListForm::OnFocusGained(const Tizen::Ui::Control& source)
993 {
994         __pSearchListView->SetEnabled(false);
995 }
996
997 void
998 BookmarkListForm::OnFocusLost(const Tizen::Ui::Control& source)
999 {
1000         __pSearchListView->SetEnabled(true);
1001         __searchBookmark = false;
1002 }
1003
1004 void
1005 BookmarkListForm::OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen::Ui::Controls::SearchBarMode mode)
1006 {
1007         result r = E_FAILURE;
1008         AppLog("ABCD::BookmarkListForm::OnSearchBarModeChanged");
1009
1010         if (mode == SEARCH_BAR_MODE_NORMAL)
1011         {
1012                 __pSearchListView->SetShowState(false);
1013                 __pSearchListView->UpdateList();
1014                 __pListview->SetShowState(true);
1015                 Invalidate(true);
1016                 __searchBookmark = false;
1017                 r = __pListview->UpdateList();
1018 //              __pSearchListView->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height -__pSearchBar->GetHeight());
1019                 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1020                 TryCatch( !IsFailed(r),,"BookmarkListForm::OnSearchBarModeChanged Update list failed %s",GetErrorMessage(r));
1021                 CATCH:return;
1022         }
1023         else
1024         {
1025                 __pSearchListView->SetShowState(true);
1026                 __pSearchListView->SetEnabled(false);
1027                 __pListview->SetShowState(false);
1028
1029                 if(__pSearchBar)
1030                 {
1031                         r = __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1032                         __pSearchBar->SetText(L"");
1033                 }
1034                 AppLog("OnSearchBarModeChanged SetContentAreaSize heihgt %d, %d",__pSearchListView->GetHeight() , GetClientAreaBounds().height - __pSearchBar->GetHeight());
1035                  __pListview->UpdateList();
1036                 __pSearchListView->UpdateList();
1037         }
1038 }
1039
1040 void
1041 BookmarkListForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
1042 {
1043         AppLog("ABCD::BookmarkListForm::OnKeypadWillOpen");
1044         GetFooter()->SetShowState(false);
1045         __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1046         __pSearchListView->SetEnabled(false);
1047         __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1048         Invalidate(true);
1049 }
1050
1051 void
1052 BookmarkListForm::OnKeypadOpened(Tizen::Ui::Control& source)
1053 {
1054         AppLog("ABCD::BookmarkListForm::OnKeypadOpened");
1055         GetFooter()->SetShowState(false);
1056         AppLog("ABCD::BookmarkListForm::OnKeypadOpened");
1057         __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1058         __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1059         Invalidate(true);
1060 }
1061
1062 void
1063 BookmarkListForm::OnKeypadClosed(Tizen::Ui::Control& source)
1064 {
1065         AppLog("ABCD::BookmarkListForm::OnKeypadClosed");
1066         AppLog("jahsjkdad %d",Clipboard::GetInstance()->IsPopupVisible());
1067         if(Clipboard::GetInstance()->IsPopupVisible() == true)
1068         {
1069                 return;
1070         }
1071         GetFooter()->SetShowState(true);
1072         __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
1073         __pSearchListView->Invalidate(false);
1074         __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1075         __pListview->SetBounds(0, __pSearchBar->GetY() + __pSearchBar->GetHeight(), GetClientAreaBounds().width, GetClientAreaBounds().height - __pSearchBar->GetHeight());
1076         Invalidate(true);
1077 }
1078
1079 void
1080 BookmarkListForm::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
1081 {
1082         AppLog("BookmarkListForm::OnKeypadActionPerformed %d",keypadAction);
1083
1084         if (__pSearchBar != null)
1085         {
1086                 __pSearchBar->HideKeypad();
1087         }
1088         if ( __pSearchBar != null && keypadAction == KEYPAD_ACTION_SEARCH)
1089         {
1090 //              if (__pSearchBar->GetText().GetLength() == 0)
1091 //              {
1092 //                      return;
1093 //              }
1094
1095                 if (__pSearchBar != null)
1096                 {
1097                         __pSearchBar->HideKeypad();
1098                 }
1099
1100                 __searchText = __pSearchBar->GetText();
1101                 AppLog("SearchbarGettext result %s %ls",GetErrorMessage(GetLastResult()),__searchText.GetPointer());
1102                 __searchBookmark = true;
1103                 __pListview->SetShowState(false);
1104                 __pSearchListView->SetEnabled(true);
1105                 __pSearchListView->SetShowState(true);
1106                 __pSearchListView->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height -__pSearchBar->GetHeight());
1107                 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
1108                 __pSearchListView->UpdateList();
1109
1110         }
1111         Invalidate(true);
1112 }
1113
1114 void
1115 BookmarkListForm::OnKeypadBoundsChanged(Tizen::Ui::Control& source)
1116 {
1117         FloatRectangle clientRect;
1118         clientRect = GetClientAreaBoundsF();
1119         AppLogDebug("SearchBarForm::OnKeypadBoundsChanged ClientBounds(%f, %f, %f, %f)",clientRect.x, clientRect.y, clientRect.width, clientRect.height);
1120         __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1121         __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1122         __pListview->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1123 //      __pListview->SetEnabled(false);
1124         Invalidate(true);
1125 }
1126
1127 void
1128 BookmarkListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
1129 {
1130         AppLogDebug("BookmarkListForm::OnSceneActivatedN called");
1131         ArrayListT<String> * pList = dynamic_cast<ArrayListT<String>* >(SceneManager::GetInstance()->GetSceneHistoryN());
1132         if(pList != null)
1133         {
1134                 pList->GetAt(pList->GetCount()-1,__previousSceneId);
1135         }
1136
1137         __searchBookmark = false;
1138         GetFooter()->SetShowState(true);
1139         GetFooter()->Invalidate(true);
1140         GetHeader()->SetItemSelected(0);
1141         GetHeader()->Invalidate(true);
1142
1143         /*      if (previousSceneId != IDSCN_HISTORY_LIST && previousSceneId != IDSCN_CREATE_BOOKMARK_FOLDER && previousSceneId != IDSCN_EDIT_BOOKMARK_LIST)
1144         {
1145                 __previousSceneId = previousSceneId;
1146         }*/
1147
1148         if (pList)
1149         {
1150                 delete pList;
1151                 pList = null;
1152         }
1153
1154         if (__pListview != null)
1155         {
1156                 __pListview->UpdateList();
1157         }
1158
1159         return;
1160 }
1161
1162 void
1163 BookmarkListForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
1164 {
1165         AppLog("BookmarkListForm::OnOrientationChanged start");
1166         __pListview->SetBackgroundColor(GetBackgroundColor());
1167         __pSearchListView->SetBackgroundColor(GetBackgroundColor());
1168         if (__pListview)
1169         {
1170                 if(__pSearchBar->GetShowState())
1171                 {
1172                         __pListview->SetBounds(__pListview->GetX(),__pSearchBar->GetHeight(),GetClientAreaBounds().width ,GetClientAreaBounds().height - __pSearchBar->GetY() - __pSearchBar->GetHeight());
1173                 }
1174                 else
1175                 {
1176                         __pListview->SetBounds(__pListview->GetX(),0,GetClientAreaBounds().width ,GetClientAreaBounds().height);
1177                 }
1178                 __pListview->UpdateList();
1179         }
1180
1181         if (__pSearchListView && __pListview)
1182         {
1183                 AppLog("__pListview->GetBounds() %d, %d, %d, %d",__pListview->GetBounds().x,__pListview->GetBounds().y,__pListview->GetBounds().width,__pListview->GetBounds().height);
1184                 __pSearchListView->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height -__pSearchBar->GetHeight());
1185
1186                 __pSearchListView->UpdateList();
1187         }
1188
1189         if (__pSearchListView && __pData != null )
1190         {
1191                 if (__parentID != DEFAULT_VALUE_PARENTID)
1192                 {
1193                         AppLog("BookmarkListForm::OnOrientationChanged parent id true");
1194                         __pSearchBar->SetShowState(false);
1195                         __pSearchBar->Invalidate(true);
1196                 }
1197
1198                 __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight()));
1199         }
1200
1201 //
1202 //
1203 //
1204 //      FloatRectangle clientRect;
1205 //      clientRect = GetClientAreaBoundsF();
1206 //
1207 //      __pSearchBar->SetContentAreaSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1208 //      __pListview->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1209 //      __pSearchListView->SetSize(FloatDimension(clientRect.width, clientRect.height - __pSearchBar->GetHeightF()));
1210 //      Invalidate(true);
1211 //
1212
1213         Invalidate(true);
1214 }
1215
1216 void
1217 BookmarkListForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
1218 {
1219         __pSearchBar->SetMode(SEARCH_BAR_MODE_NORMAL);
1220         return;
1221 }
1222