diff --git a/src/gui-qml/src/components/FavoritesScreen.qml b/src/gui-qml/src/components/FavoritesScreen.qml new file mode 100644 index 000000000..e04a21fe9 --- /dev/null +++ b/src/gui-qml/src/components/FavoritesScreen.qml @@ -0,0 +1,41 @@ +import QtQuick 2.12 +import QtQuick.Controls 2.5 +import QtQuick.Layouts 1.12 + +Page { + id: root + + signal openFavorite(string favorite) + + property var favorites + + header: ToolBar { + RowLayout { + anchors.fill: parent + + ToolButton { + icon.source: "/images/icons/menu.png" + onClicked: drawer.open() + } + + Label { + text: qsTr("Favorites") + elide: Label.ElideRight + verticalAlignment: Qt.AlignVCenter + Layout.fillWidth: true + } + } + } + + ListView { + anchors.fill: parent + model: favorites + + delegate: ItemDelegate { + width: parent.width + text: modelData + + onClicked: root.openFavorite(modelData) + } + } +} diff --git a/src/gui-qml/src/components/MainDrawer.qml b/src/gui-qml/src/components/MainDrawer.qml index 842fc0e7e..34a7ca5c9 100644 --- a/src/gui-qml/src/components/MainDrawer.qml +++ b/src/gui-qml/src/components/MainDrawer.qml @@ -110,7 +110,7 @@ Drawer { page: "favorites" name: qsTr("Favorites") icon: "/images/icons/favorites.png" - enabled: false + enabled: true } ListElement { page: "log" diff --git a/src/gui-qml/src/main-screen.qml b/src/gui-qml/src/main-screen.qml index 8e8a31388..fbd2b2e5f 100644 --- a/src/gui-qml/src/main-screen.qml +++ b/src/gui-qml/src/main-screen.qml @@ -77,6 +77,7 @@ ApplicationWindow { id: mainScreen SearchScreen { + id: searchScreen visible: currentPage == "search" anchors.fill: parent site: window.site @@ -86,6 +87,18 @@ ApplicationWindow { onOpenSources: mainStackView.push(sourcesScreen) } + FavoritesScreen { + id: favoritesScreen + visible: currentPage == "favorites" + anchors.fill: parent + favorites: backend.favorites + + onOpenFavorite: { + searchScreen.load(favorite) + currentPage = "search" + } + } + LogScreen { id: logScreen visible: currentPage == "log" diff --git a/src/gui-qml/src/qml.qrc b/src/gui-qml/src/qml.qrc index 362a46f07..a6ee84a1b 100644 --- a/src/gui-qml/src/qml.qrc +++ b/src/gui-qml/src/qml.qrc @@ -36,5 +36,6 @@ components/ResultsView.qml components/settings/pages/SourcesSettingsPage.qml components/SearchEdit.qml + components/FavoritesScreen.qml