mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-06 03:33:32 +00:00
a6c897929a
- Some NIM's models define additional (not part of the QAbstractModelItem API) method rowData to allow access to model's data on UI side - The same job can be done relying fully on public QAbstractModelItem API using ModelUtils utility. It gives full transparency if we need nim's model or other like ListModel replacement in tests/storybook - propagate `tokensStore` to unbreak the Browser's wallet menu Fixes #14805
50 lines
1019 B
QML
50 lines
1019 B
QML
pragma Singleton
|
|
|
|
import QtQuick 2.15
|
|
|
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
|
|
|
QtObject {
|
|
id: root
|
|
|
|
property var bookmarksModel: bookmarkModule.model
|
|
|
|
function addBookmark(url, name)
|
|
{
|
|
bookmarkModule.addBookmark(url, name)
|
|
}
|
|
|
|
function deleteBookmark(url)
|
|
{
|
|
bookmarkModule.deleteBookmark(url)
|
|
}
|
|
|
|
function updateBookmark(originalUrl, newUrl, newName)
|
|
{
|
|
bookmarkModule.updateBookmark(originalUrl, newUrl, newName)
|
|
}
|
|
|
|
function getBookmarkIndexByUrl(url)
|
|
{
|
|
return bookmarkModule.model.getBookmarkIndexByUrl(url)
|
|
}
|
|
|
|
function getCurrentFavorite(url) {
|
|
if (!url) {
|
|
return null
|
|
}
|
|
const index = bookmarkModule.model.getBookmarkIndexByUrl(url)
|
|
if (index === -1) {
|
|
return null
|
|
}
|
|
|
|
const item = SQUtils.ModelUtils.get(bookmarkModule.model, index)
|
|
|
|
return {
|
|
url: url,
|
|
name: item.name,
|
|
image: item.imageUrl
|
|
}
|
|
}
|
|
}
|