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