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