mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Client settings can be stored at the user and and the collective. The settings used in the application are merged from these two settings, where any user setting takes precedence. The form can now manage both variants. Refs: #838
69 lines
1.4 KiB
Elm
69 lines
1.4 KiB
Elm
{-
|
|
Copyright 2020 Eike K. & Contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
-}
|
|
|
|
|
|
port module Ports exposing
|
|
( checkSearchQueryString
|
|
, initClipboard
|
|
, printElement
|
|
, receiveCheckQueryResult
|
|
, receiveServerEvent
|
|
, removeAccount
|
|
, setAccount
|
|
, setUiTheme
|
|
)
|
|
|
|
import Api.Model.AuthResult exposing (AuthResult)
|
|
import Data.QueryParseResult exposing (QueryParseResult)
|
|
import Data.ServerEvent exposing (ServerEvent)
|
|
import Data.UiTheme exposing (UiTheme)
|
|
import Json.Decode as D
|
|
|
|
|
|
{-| Save the result of authentication to local storage.
|
|
-}
|
|
port setAccount : AuthResult -> Cmd msg
|
|
|
|
|
|
port removeAccount : () -> Cmd msg
|
|
|
|
|
|
port internalSetUiTheme : String -> Cmd msg
|
|
|
|
|
|
port checkSearchQueryString : String -> Cmd msg
|
|
|
|
|
|
port receiveCheckQueryResult : (QueryParseResult -> msg) -> Sub msg
|
|
|
|
|
|
port initClipboard : ( String, String ) -> Cmd msg
|
|
|
|
|
|
{-| Creates a new window/tab, writes the contents of the given element
|
|
and calls the print dialog.
|
|
-}
|
|
port printElement : String -> Cmd msg
|
|
|
|
|
|
{-| Receives messages from the websocket.
|
|
-}
|
|
port receiveWsMessage : (D.Value -> msg) -> Sub msg
|
|
|
|
|
|
|
|
--- Higher level functions based on ports
|
|
|
|
|
|
setUiTheme : UiTheme -> Cmd msg
|
|
setUiTheme theme =
|
|
internalSetUiTheme (Data.UiTheme.toString theme)
|
|
|
|
|
|
receiveServerEvent : (Result String ServerEvent -> msg) -> Sub msg
|
|
receiveServerEvent tagger =
|
|
receiveWsMessage (Data.ServerEvent.decode >> tagger)
|