2
* Copyright 2013 Canonical Ltd.
4
* This file is part of webbrowser-app.
6
* webbrowser-app is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 3.
10
* webbrowser-app is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
import Ubuntu.Components 0.1
21
import Ubuntu.Components.ListItems 0.1 as ListItem
26
property alias model: listview.model
28
signal newTabClicked()
29
signal switchToTabClicked(int index)
30
signal tabRemoved(int index)
42
// TRANSLATORS: %1 refers to the number of open tabs
43
text: i18n.tr("Open pages %1").arg(listview.count)
57
objectName: "newTabDelegate"
66
anchors.centerIn: parent
72
onClicked: newTabClicked()
80
left: newTabDelegate.right
81
leftMargin: units.gu(1)
87
orientation: ListView.Horizontal
91
currentIndex: model.currentIndex
93
delegate: ListItem.Empty {
98
// FIXME: http://pad.lv/1187476 makes it impossible to swipe a
99
// delegate up/down to remove it from an horizontal listview.
101
onItemRemoved: tabRemoved(index)
105
color: (index == listview.currentIndex) ? "#2C001E" : "white"
109
onClicked: switchToTabClicked(index)