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