Add new checkbox to scan mailbox form

This commit is contained in:
eikek 2021-08-21 13:48:57 +02:00
parent 751fa3da5a
commit 0a0dd80bdc
2 changed files with 29 additions and 0 deletions

View File

@ -83,6 +83,7 @@ type alias Model =
, language : Maybe Language
, postHandleAll : Bool
, summary : Maybe String
, attachmentsOnly : Bool
, openTabs : Set String
}
@ -166,6 +167,7 @@ type Msg
| TogglePostHandleAll
| ToggleAkkordionTab String
| SetSummary String
| ToggleAttachmentsOnly
initWith : Flags -> ScanMailboxSettings -> ( Model, Cmd Msg )
@ -212,6 +214,7 @@ initWith flags s =
Comp.FixedDropdown.init Data.Language.all
, language = Maybe.andThen Data.Language.fromString s.language
, postHandleAll = Maybe.withDefault False s.postHandleAll
, attachmentsOnly = Maybe.withDefault False s.attachmentsOnly
, summary = s.summary
}
, Cmd.batch
@ -260,6 +263,7 @@ init flags =
, language = Nothing
, postHandleAll = False
, summary = Nothing
, attachmentsOnly = False
, openTabs = Set.singleton (tabName TabGeneral)
}
, Cmd.batch
@ -327,6 +331,7 @@ makeSettings model =
, language = Maybe.map Data.Language.toIso3 model.language
, postHandleAll = Just model.postHandleAll
, summary = model.summary
, attachmentsOnly = Just model.attachmentsOnly
}
in
Result.map3 make conn schedule_ infolders
@ -697,6 +702,12 @@ update flags msg model =
, Cmd.none
)
ToggleAttachmentsOnly ->
( { model | attachmentsOnly = not model.attachmentsOnly }
, NoAction
, Cmd.none
)
ToggleAkkordionTab name ->
let
tabs =
@ -994,6 +1005,18 @@ viewAdditionalFilter2 texts model =
[ Markdown.toHtml [] texts.fileFilterInfo
]
]
, div [ class "mb-4" ]
[ MB.viewItem <|
MB.Checkbox
{ id = "scanmail-attachments-only"
, value = model.attachmentsOnly
, label = texts.attachmentsOnlyLabel
, tagger = \_ -> ToggleAttachmentsOnly
}
, span [ class "opacity-50 text-sm mt-1" ]
[ Markdown.toHtml [] texts.attachmentsOnlyInfo
]
]
, div
[ class "mb-4"
]

View File

@ -70,6 +70,8 @@ type alias Texts =
, connectionMissing : String
, noProcessingFolders : String
, invalidCalEvent : String
, attachmentsOnlyLabel : String
, attachmentsOnlyInfo : String
}
@ -149,6 +151,8 @@ gb =
, connectionMissing = "No E-Mail connections configured. Goto E-Mail Settings to add one."
, noProcessingFolders = "No processing folders given."
, invalidCalEvent = "The calendar event is not valid."
, attachmentsOnlyLabel = "Only import e-mail attachments"
, attachmentsOnlyInfo = "Discards the e-mail body and only imports the attachments."
}
@ -223,4 +227,6 @@ kann hier ein Wert für alle festgelegt werden. Bei 'Automatisch' wird auf den S
, connectionMissing = "Keine E-Mail-Verbindung definiert. Gehe zu den E-Mail-Einstellungen und füge eine hinzu."
, noProcessingFolders = "Keine Postfachordner ausgewählt."
, invalidCalEvent = "Das Kalenderereignis ist ungültig."
, attachmentsOnlyLabel = "Nur Anhänge importieren"
, attachmentsOnlyInfo = "Verwirft den E-Mail Text und importiert nur die Anhänge."
}