remove libstatus browser references
This commit is contained in:
parent
eab9d68aff
commit
6e99b769be
|
@ -1,6 +1,5 @@
|
||||||
import NimQml, json, chronicles
|
import NimQml, json, chronicles
|
||||||
import ../../status/status
|
import ../../status/[status, browser]
|
||||||
import ../../status/libstatus/browser as status_browser
|
|
||||||
import ../../status/types
|
import ../../status/types
|
||||||
import views/bookmark_list
|
import views/bookmark_list
|
||||||
|
|
||||||
|
@ -25,7 +24,7 @@ QtObject:
|
||||||
proc init*(self: BrowserView) =
|
proc init*(self: BrowserView) =
|
||||||
var bookmarks: seq[Bookmark] = @[]
|
var bookmarks: seq[Bookmark] = @[]
|
||||||
try:
|
try:
|
||||||
let responseResult = status_browser.getBookmarks().parseJson["result"]
|
let responseResult = self.status.browser.getBookmarks().parseJson["result"]
|
||||||
if responseResult.kind != JNull:
|
if responseResult.kind != JNull:
|
||||||
for bookmark in responseResult:
|
for bookmark in responseResult:
|
||||||
bookmarks.add(Bookmark(url: bookmark["url"].getStr, name: bookmark["name"].getStr, imageUrl: bookmark["imageUrl"].getStr))
|
bookmarks.add(Bookmark(url: bookmark["url"].getStr, name: bookmark["name"].getStr, imageUrl: bookmark["imageUrl"].getStr))
|
||||||
|
@ -44,7 +43,7 @@ QtObject:
|
||||||
notify = bookmarksChanged
|
notify = bookmarksChanged
|
||||||
|
|
||||||
proc addBookmark*(self: BrowserView, url: string, name: string) {.slot.} =
|
proc addBookmark*(self: BrowserView, url: string, name: string) {.slot.} =
|
||||||
let bookmark = status_browser.storeBookmark(url, name)
|
let bookmark = self.status.browser.storeBookmark(url, name)
|
||||||
self.bookmarks.addBookmarkItemToList(bookmark)
|
self.bookmarks.addBookmarkItemToList(bookmark)
|
||||||
self.bookmarksChanged()
|
self.bookmarksChanged()
|
||||||
|
|
||||||
|
@ -53,7 +52,7 @@ QtObject:
|
||||||
if index == -1:
|
if index == -1:
|
||||||
return
|
return
|
||||||
self.bookmarks.removeBookmarkItemFromList(index)
|
self.bookmarks.removeBookmarkItemFromList(index)
|
||||||
status_browser.deleteBookmark(url)
|
self.status.browser.deleteBookmark(url)
|
||||||
self.bookmarksChanged()
|
self.bookmarksChanged()
|
||||||
|
|
||||||
proc modifyBookmark*(self: BrowserView, ogUrl: string, newUrl: string, newName: string) {.slot.} =
|
proc modifyBookmark*(self: BrowserView, ogUrl: string, newUrl: string, newName: string) {.slot.} =
|
||||||
|
@ -63,5 +62,5 @@ QtObject:
|
||||||
self.addBookmark(newUrl, newName)
|
self.addBookmark(newUrl, newName)
|
||||||
return
|
return
|
||||||
self.bookmarks.modifyBookmarkItemFromList(index, newUrl, newName)
|
self.bookmarks.modifyBookmarkItemFromList(index, newUrl, newName)
|
||||||
status_browser.updateBookmark(ogUrl, newUrl, newName)
|
self.status.browser.updateBookmark(ogUrl, newUrl, newName)
|
||||||
self.bookmarksChanged()
|
self.bookmarksChanged()
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import json, json_serialization
|
||||||
|
|
||||||
|
import
|
||||||
|
sugar, sequtils, strutils, atomics
|
||||||
|
|
||||||
|
import libstatus/browser as status_browser
|
||||||
|
import ../eventemitter
|
||||||
|
import signals/types
|
||||||
|
|
||||||
|
#TODO: temporary?
|
||||||
|
import types as LibStatusTypes
|
||||||
|
|
||||||
|
type
|
||||||
|
BrowserModel* = ref object
|
||||||
|
events*: EventEmitter
|
||||||
|
|
||||||
|
proc newBrowserModel*(events: EventEmitter): BrowserModel =
|
||||||
|
result = BrowserModel()
|
||||||
|
result.events = events
|
||||||
|
|
||||||
|
proc storeBookmark*(self: BrowserModel, url: string, name: string): Bookmark =
|
||||||
|
result = status_browser.storeBookmark(url, name)
|
||||||
|
|
||||||
|
proc updateBookmark*(self: BrowserModel, ogUrl: string, url: string, name: string) =
|
||||||
|
status_browser.updateBookmark(ogUrl, url, name)
|
||||||
|
|
||||||
|
proc getBookmarks*(self: BrowserModel): string =
|
||||||
|
result = status_browser.getBookmarks()
|
||||||
|
|
||||||
|
proc deleteBookmark*(self: BrowserModel, url: string) =
|
||||||
|
status_browser.deleteBookmark(url)
|
|
@ -2,7 +2,7 @@ import libstatus/accounts as libstatus_accounts
|
||||||
import libstatus/core as libstatus_core
|
import libstatus/core as libstatus_core
|
||||||
import libstatus/settings as libstatus_settings
|
import libstatus/settings as libstatus_settings
|
||||||
import types as libstatus_types
|
import types as libstatus_types
|
||||||
import chat, accounts, wallet, node, network, messages, contacts, profile, stickers, permissions, fleet, settings, mailservers
|
import chat, accounts, wallet, node, network, messages, contacts, profile, stickers, permissions, fleet, settings, mailservers, browser
|
||||||
import ../eventemitter
|
import ../eventemitter
|
||||||
import ./tasks/task_runner_impl
|
import ./tasks/task_runner_impl
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ type Status* = ref object
|
||||||
tasks*: TaskRunner
|
tasks*: TaskRunner
|
||||||
settings*: SettingsModel
|
settings*: SettingsModel
|
||||||
mailservers*: MailserversModel
|
mailservers*: MailserversModel
|
||||||
|
browser*: BrowserModel
|
||||||
|
|
||||||
proc newStatusInstance*(fleetConfig: string): Status =
|
proc newStatusInstance*(fleetConfig: string): Status =
|
||||||
result = Status()
|
result = Status()
|
||||||
|
@ -43,6 +44,7 @@ proc newStatusInstance*(fleetConfig: string): Status =
|
||||||
result.permissions = permissions.newPermissionsModel(result.events)
|
result.permissions = permissions.newPermissionsModel(result.events)
|
||||||
result.settings = settings.newSettingsModel(result.events)
|
result.settings = settings.newSettingsModel(result.events)
|
||||||
result.mailservers = mailservers.newMailserversModel(result.events)
|
result.mailservers = mailservers.newMailserversModel(result.events)
|
||||||
|
result.browser = browser.newBrowserModel(result.events)
|
||||||
|
|
||||||
proc initNode*(self: Status) =
|
proc initNode*(self: Status) =
|
||||||
self.tasks.init()
|
self.tasks.init()
|
||||||
|
|
Loading…
Reference in New Issue