2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef URLHISTORYLIST_H_
18 #define URLHISTORYLIST_H_
23 #include "services/HistoryService/HistoryItem.h"
24 #include <boost/signals2/signal.hpp>
28 namespace tizen_browser {
33 typedef shared_ptr<GenlistManager> GenlistManagerPtr;
35 enum class EditedUrlState
37 // url was edited by a user (by typing)
39 // url was edited in other way than typing (but for the first time after previous user edition)
41 // url was edited in other way than typing (and previously was not edited by the user)
42 EDITED_OTHER_MANY_TIMES
46 * Needed to indicate who did the last url entry edition (user/other/other many times). Used
47 * to indicate when widget can be hidden in a pretty way or an instant way.
49 class EditedUrlStatesHelper
52 EditedUrlStatesHelper()
55 void changeState(bool editedByUser)
58 currentState = EditedUrlState::EDITED_BY_USER;
60 if (currentState == EditedUrlState::EDITED_BY_USER) {
61 currentState = EditedUrlState::EDITED_OTHER_FIRST;
63 currentState = EditedUrlState::EDITED_OTHER_MANY_TIMES;
67 EditedUrlState getCurrentState()
72 EditedUrlState currentState = EditedUrlState::EDITED_BY_USER;
76 * Manages list of url matches (URL from history). Manages top layout, creates
77 * widget displaying url items.
82 UrlHistoryList(QuickAccess* quickAccess);
83 virtual ~UrlHistoryList();
84 void createLayout(Evas_Object* parentLayout);
85 Evas_Object* getLayout();
87 // // on uri entry widget "changed,user" signal
88 void onURLEntryEditedByUser(const string& editedUrl,
89 shared_ptr<services::HistoryItemVector> matchedEntries);
90 // on uri entry widget "changed" signal
91 void onURLEntryEdited();
95 boost::signals2::signal<void(shared_ptr<services::HistoryItem>, bool)> openURLInNewTab;
97 int getVisibleItemsMax() const
99 return VISIBLE_ITEMS_MAX;
102 int getMinKeywordLength() const
104 return MIN_KEYWORD_LENGTH;
108 void onListItemSelect(std::string content);
109 void onListWidgetFocused();
110 void onListWidgetUnfocused();
112 EditedUrlStatesHelper editedUrlStatesHelper;
114 // the maximum items number on a list
115 const int VISIBLE_ITEMS_MAX = 12;
116 // the minimum length of the keyword used to search matches
117 const int MIN_KEYWORD_LENGTH = 3;
118 Evas_Object* m_layout;
119 string m_edjFilePath;
121 GenlistManagerPtr m_genlistListManager = nullptr;
122 QuickAccess* m_quickAccess;
126 } /* namespace base_ui */
127 } /* namespace tizen_browser */
129 #endif /* URLHISTORYLIST_H_ */