Fixed Nabi Issues
authorVinay Sachdeva <v.sachdeva@samsung.com>
Tue, 23 Apr 2013 18:57:21 +0000 (00:27 +0530)
committerVinay Sachdeva <v.sachdeva@samsung.com>
Tue, 23 Apr 2013 18:57:21 +0000 (00:27 +0530)
Change-Id: Ifc504c40c137b16b7c0faf45c415524a3502e279
Signed-off-by: Vinay Sachdeva <v.sachdeva@samsung.com>
inc/IntBookmarkPresentationModel.h
inc/IntHistoryListForm.h
src/IntBookmarkListForm.cpp
src/IntBookmarkPresentationModel.cpp
src/IntEditHomePageForm.cpp
src/IntHistoryListForm.cpp
src/IntMainForm.cpp
src/IntSharePopup.cpp

index 9481338..68df46c 100644 (file)
@@ -142,6 +142,8 @@ public:
        result GetBookmark(const Tizen::Base::String& parentID, const int startIndex, const int limit, Tizen::Base::Collection::ArrayList& bookmarkList);
 
 
+       result GetBookmarkForHistory(int startIndex, Tizen::Base::Collection::ArrayList& bookmarkList);
+
        /**
         * This function returns the no of bookmarks
         *
index 96ff8a1..6d779b2 100644 (file)
@@ -121,6 +121,7 @@ protected:
 
 private:
        bool __isNoHistoryPresent;
+       Tizen::Base::Collection::ArrayList*     __pBookmarkList;
        Tizen::Base::Collection::ArrayList* __pGroupData;
        Tizen::Ui::Controls::GroupedListView* __pGroupedListView; // The GroupedListView which contains the history lists
        Tizen::Ui::Controls::SearchBar* __pSearchBar;
index 8316545..7ebc99f 100644 (file)
@@ -1012,7 +1012,7 @@ BookmarkListForm::OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source,
                Invalidate(true);
                __searchBookmark = false;
                r = __pListview->UpdateList();
-               __pSearchListView->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height -__pSearchBar->GetHeight());
+//             __pSearchListView->SetBounds(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height -__pSearchBar->GetHeight());
                __pSearchBar->SetContentAreaSize(Dimension(__pSearchListView->GetWidth(), __pSearchListView->GetHeight()));
                TryCatch( !IsFailed(r),,"BookmarkListForm::OnSearchBarModeChanged Update list failed %s",GetErrorMessage(r));
                CATCH:return;
@@ -1049,6 +1049,7 @@ void
 BookmarkListForm::OnKeypadOpened(Tizen::Ui::Control& source)
 {
        GetFooter()->SetShowState(false);
+       __pSearchListView->SetBounds(__pSearchListView->GetX(), __pSearchListView->GetY(), __pSearchListView->GetWidth(), GetClientAreaBounds().height - __pSearchBar->GetHeight());
        __pSearchListView->UpdateList();
        Invalidate(true);
 }
index 3de32ef..f200f3e 100644 (file)
@@ -635,6 +635,26 @@ BookmarkPresentationModel::GetBookmark(const String& parentID, int startIndex, i
        CATCH: return r;
 }
 
+result BookmarkPresentationModel::GetBookmarkForHistory(int startIndex, Tizen::Base::Collection::ArrayList& pBookmarkList)
+{
+       int count = -1;
+       String query;
+       String bookmarkTable(BOOKMARK_URL_TABLE);
+       result r = E_FAILURE;
+
+       query.Append(L"SELECT * FROM ");
+       query.Append(bookmarkTable);
+       query.Append(" WHERE ADDRESS != ''");
+
+       r = PresentationModelBase::ExecuteQuery(query, count);
+       TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::GetBookmark query failed  %s",GetErrorMessage(r));
+
+       r = CreateBookmarkList(count, pBookmarkList);
+       TryCatch( r == E_SUCCESS,,"BookmarkPresentationModel::CreateBookmarkList failed  %s",GetErrorMessage(r));
+
+       CATCH: return r;
+}
+
 result
 BookmarkPresentationModel::GetFolder(const String& parentID, int startIndex, int limit, ArrayList& folderList)
 {
index 96cdcf7..56d13fb 100644 (file)
@@ -140,16 +140,16 @@ EditHomePageForm::OnActionPerformed(const Control& source, int actionId)
                bool ret = false;
                bool flag = false;
                String firstPattern(L"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)");
-               String secondPattern(L"^[A-Za-z0-9\.\+-:#@%/;$~?]+\\.[A-Za-z0-9\+-=:#@%/;$~()_?\\\.&]{2,}$");   // URL of type  abc.com (i.e without protocol in front of it)
+               String secondPattern(L"^[A-Za-z0-9\.\+-:#@%/;$~?]+\\.[A-Za-z0-9!\+-=:#@%/;$~()_?\\\.&]{2,}$");   // URL of type  abc.com (i.e without protocol in front of it)
                RegularExpression firstRegex;
                RegularExpression secondRegex;
 
                firstRegex.Construct(firstPattern, REGEX_CASELESS);
                secondRegex.Construct(secondPattern, REGEX_CASELESS);
 
-               Uri uri;
-               uri.SetUri(urlText);
-               urlText = uri.GetEncodedString();
+//             Uri uri;
+//             uri.SetUri(urlText);
+//             urlText = uri.GetEncodedString();
 
                // Match
                ret = firstRegex.Match(urlText, false); // This returns true value
index b230b3b..d718994 100644 (file)
@@ -59,6 +59,7 @@ const int HistoryListForm::IDA_FORMAT_BOOKMARK = 107;
 
 HistoryListForm::HistoryListForm(void)
 {
+       __pBookmarkList = null;
        __pGroupedListView =null;
        __pSearchListView = null;
        __pSearchBar = null;
@@ -77,6 +78,11 @@ HistoryListForm::~HistoryListForm(void)
                __pGroupData->RemoveAll(false);
                delete __pGroupData;
        }
+       if(__pBookmarkList != null)
+       {
+               __pBookmarkList->RemoveAll(false);
+               delete __pBookmarkList;
+       }
 }
 
 bool
@@ -211,6 +217,9 @@ HistoryListForm::OnInitializing(void)
                }
        }
 
+       __pBookmarkList = new(std::nothrow) Collection::ArrayList();
+       __pBookmarkList->Construct();
+       BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
        return r;
 }
 
@@ -476,6 +485,7 @@ HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
        result r = E_FAILURE;
        History* pHistory = null;
        Bitmap* pBitmap = null;
+       Bitmap* pBookmarkBitmap = null;
        GroupItemClass* pGroupItemClass = null;
        CustomItem* pItem = new(std::nothrow) CustomItem();
        int bookmarkBtnWidth = 0;
@@ -534,14 +544,32 @@ HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                        return null;
                }
        }
-//     if (pHistory->GetBookmarkId().GetLength()>0)
-//     {
-//             pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
-//     }
-//     else
-//     {
-//             pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
-//     }
+       bool urlFoundInBookmark = false;
+
+       if(__pBookmarkList != null)
+       {
+               for (int i = 0; i < __pBookmarkList->GetCount();i++)
+               {
+                       BookmarkData* pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
+                       if(pHistory->GetHistoryUrl().CompareTo(pBookMark->GetUrl()) == 0)
+                       {
+                               urlFoundInBookmark = true;
+                               break;
+                       }
+                       else
+                       {
+                               pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
+                       }
+               }
+       }
+       if (urlFoundInBookmark == true)
+       {
+               pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_ON_TEMP);
+       }
+       else
+       {
+               pBookmarkBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ICON_BOOKMARK_OFF_TEMP);
+       }
        bookmarkBtnWidth = 64;
 
 
@@ -553,12 +581,12 @@ HistoryListForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
        else
                r = pItem->AddElement(Rectangle(104, 70, GetClientAreaBounds().width - 108 - 32 - bookmarkBtnWidth - 32, 48), IDA_FORMAT_URL, pHistory->GetHistoryUrl(),32,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY,true);
        TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
-//     if ( pBookmarkBitmap != null)
-//     {
-//             r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
-//             TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
-//             delete pBookmarkBitmap;
-//     }
+       if ( pBookmarkBitmap != null)
+       {
+               r = pItem->AddElement(Rectangle(GetClientAreaBounds().width - bookmarkBtnWidth - 16, (128 - pBookmarkBitmap->GetHeight())/2, bookmarkBtnWidth, bookmarkBtnWidth), IDA_FORMAT_BOOKMARK, *pBookmarkBitmap);
+               TryCatch(!IsFailed(r), "CreateItem failed with %s",GetErrorMessage(r));
+               delete pBookmarkBitmap;
+       }
        return pItem;
 
        CATCH:
@@ -782,6 +810,13 @@ HistoryListForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId
                return;
        }
 
+       if(__pBookmarkList != null)
+       {
+               __pBookmarkList->RemoveAll(false);
+       }
+
+       BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
+
        Invalidate(true);
 
 }
@@ -822,77 +857,24 @@ HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, in
                toggledUrl = pHistory->GetHistoryUrl();
 
                AppLog("History's Bookmark ID %ls ToggledUrl %ls",pHistory->GetBookmarkId().GetPointer(),toggledUrl.GetPointer());
-               if (pHistory->GetBookmarkId().GetLength() > 0)
-               {
-                       AppLog("Already added to bookmark so will be removed");
-                       String bookmarkId = L"";
-                       int id = 0;
 
-                       bookmarkId = pHistory->GetBookmarkId();
-                       Integer::Parse(bookmarkId,id);
-                       BookmarkPresentationModel::GetInstance()->DeleteBookmark(id);
-                       pHistory->SetBookmarkId(L"");
-                       //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
-
-                       for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
+               bool bookmarkFound = false;
+               BookmarkData* pBookMark = null;
+               if(__pBookmarkList != null)
+               {
+                       for (int i = 0; i < __pBookmarkList->GetCount(); i++)
                        {
-                               pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
-                               if (pGroupItemClass == null)
+                               pBookMark = dynamic_cast< BookmarkData* >(__pBookmarkList->GetAt(i));
+                               if (toggledUrl.CompareTo(pBookMark->GetUrl()) == 0)
                                {
-                                       continue;
-                               }
-                               for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
-                               {
-                                       pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
-                                       if (pHistory == null)
-                                       {
-                                               continue;
-                                       }
-                                       if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
-                                       {
-                                               pHistory->SetBookmarkId(L"");
-                                               AppLog("Already added to bookmark so will be removed");
-                                               String bookmarkId = L"";
-                                               int id = 0;
-
-                                               bookmarkId = pHistory->GetBookmarkId();
-                                               Integer::Parse(bookmarkId,id);
-                                               BookmarkPresentationModel::GetInstance()->DeleteBookmark(id);
-                                               pHistory->SetBookmarkId(L"");
-                                               //listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
-
-                                               for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
-                                               {
-                                                       pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
-                                                       if (pGroupItemClass == null)
-                                                       {
-                                                               continue;
-                                                       }
-                                                       for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
-                                                       {
-                                                               pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
-                                                               if (pHistory == null)
-                                                               {
-                                                                       continue;
-                                                               }
-                                                               if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
-                                                               {
-                                                                       pHistory->SetBookmarkId(L"");
-                                                                       //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
-                                                               }
-                                                       }
-                                               }
-
-                                               //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
-                                       }
+                                       bookmarkFound = true;
+                                       break;
                                }
                        }
-                       listView.UpdateList();
-
                }
-               else
+               if(bookmarkFound == false)
                {
-                       AppLog("Adding history to bookmark");
+                       // Add the history in bookmark database
                        result r = E_FAILURE;
                        BookmarkData pBookmark;
 
@@ -903,41 +885,23 @@ HistoryListForm::OnGroupedListViewItemStateChanged(GroupedListView& listView, in
                        pBookmark.SetFaviconId(pHistory->GetFaviconId());
 
                        r = BookmarkPresentationModel::GetInstance()->SaveBookmark(pBookmark);
-                       if (!IsFailed(r))
-                       {
-                               AppLog("History added to bookmark with ID %ls",pBookmark.GetBookmarkId().GetPointer());
-                               pHistory->SetBookmarkId(pBookmark.GetBookmarkId());
-                       }
-
-                       listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
+               }
+               else
+               {
+                       // remove the history from bookmark database
+                       BookmarkPresentationModel::GetInstance()->DeleteBookmark(toggledUrl);
+               }
 
-                       for(int grindex = 0 ; grindex < __pGroupData->GetCount() ; grindex++)
-                       {
-                               pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(grindex));
-                               if (pGroupItemClass == null)
-                               {
-                                       continue;
-                               }
-                               for(int index = 0 ; index < pGroupItemClass->GetHistoryData()->GetCount() ; index++)
-                               {
-                                       pHistory = dynamic_cast< History* >(pGroupItemClass->GetHistoryData()->GetAt(index));
-                                       if (pHistory == null)
-                                       {
-                                               continue;
-                                       }
-                                       if (toggledUrl.CompareTo(pHistory->GetHistoryUrl()) == 0)
-                                       {
-                                               pHistory->SetBookmarkId(pBookmark.GetBookmarkId());
-                                               //listView.RefreshList(grindex,index,LIST_REFRESH_TYPE_ITEM_MODIFY);
-                                       }
-                               }
-                       }
-                       listView.UpdateList();
+               if(__pBookmarkList != null)
+               {
+                       __pBookmarkList->RemoveAll(false);
+                       BookmarkPresentationModel::GetInstance()->GetBookmarkForHistory(0,*__pBookmarkList);
                }
+               listView.RefreshList(groupIndex,itemIndex,LIST_REFRESH_TYPE_ITEM_MODIFY);
+               listView.UpdateList();
        }
        else
        {
-
                pGroupItemClass = dynamic_cast< GroupItemClass* >(__pGroupData->GetAt(groupIndex));
                if (pGroupItemClass == null)
                {
index c37f428..cdbfc4a 100644 (file)
@@ -784,15 +784,16 @@ result MainForm::InitImageContextMenu(Tizen::Graphics::Point p)
                __pImageMenu = null;
        }
 
-       p.y = p.y + __pAddressbar->GetHeight() + 12;
-       if(p.y < 100)
-       {
-               direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
-       }
-       else
-       {
-               direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
-       }
+//     p.y = p.y + __pAddressbar->GetHeight() + 12;
+//     AppLog("vinaypy %d",p.y);
+//     if(p.y < 100)
+//     {
+//             direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
+//     }
+//     else
+//     {
+//             direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
+//     }
        __pImageMenu = new (std::nothrow) ContextMenu();
        r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
        TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
@@ -3250,9 +3251,10 @@ MainForm::OnLoadingRequested(const Tizen::Base::String& url,
                }
        }
 
-       if ( __pAddressbar != null)
+       if ( __pAddressbar != null && __pAddressbar->GetShowState() == true)
        {
                __pAddressbar->SetShowState(false);
+               OnAddressCancelledClicked(*__pAddressbar);
                __pAddressbar->Invalidate(true);
        }
        return false;
index e12cae2..65618aa 100644 (file)
@@ -352,9 +352,10 @@ SharePopup::StartEmailAppControl(void)
    extraData.Add(&toKey, &toVal);
    extraData.Add(&ccKey, &ccVal);
    extraData.Add(&bccKey, &bccVal);
-   //extraData.Add(&attachKey, &attachVal);
-   extraData.Add(&attachKey, pDataList);
-
+   if(attachVal.GetLength() > 0)
+   {
+          extraData.Add(&attachKey, pDataList);
+   }
    AppControl* pAc = AppManager::FindAppControlN(L"tizen.email", L"http://tizen.org/appcontrol/operation/compose");
    if (pAc)
    {