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