Class SetupEmailDialogController
java.lang.Object
page.codeberg.friedolyn.gui.controllers.Controller<Configuration>
page.codeberg.friedolyn.gui.controllers.DialogController<Configuration,EMailNotifier>
page.codeberg.friedolyn.gui.controllers.SetupEmailDialogController
- All Implemented Interfaces:
javafx.fxml.Initializable
,Preparable<Configuration>
Specifies the behaviour of the
GUI.Window.SETUP_EMAIL_DIALOG
dialog.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javafx.scene.layout.BorderPane
private javafx.scene.control.CheckBox
private EMailNotifier
TheEMailNotifier
that is being set up by the user.private static final @NonNull URL
The Evolution website.private javafx.scene.control.Label
private javafx.scene.control.Label
private javafx.scene.control.Hyperlink
private javafx.scene.control.Label
private static final @NonNull URL
The K-9 Mail website.private @NonNull ResourceBundle
Contains the translations for the dialog's text elements and popups.private Boolean
The result of the dialog.private javafx.scene.control.TextArea
private static final @NonNull URL
The Thunderbird website. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Makes the dialog disappear from the user's screen.void
confirm()
The user confirms their input in order to close the dialog.@NonNull Optional
<EMailNotifier> @NonNull FuzzyBoolean
void
initialize
(URL location, ResourceBundle resources) It is required to callprepare(page.codeberg.friedolyn.configuration.Configuration)
immediately after this method.void
void
Opens
theK-9 Mail website
in the user's default web browser.void
Opens
theThunderbird website
in the user's default web browser.void
prepare
(@NonNull Configuration configuration) Uses the givenConfiguration
to insert the user's current e-mail setup into the dialog.void
Sends a test notification to the user's e-mail address to verify that the setup is correct.private void
toggleHidePgpTextArea
(boolean hide) Switches the visibility of the PGP public key text area.private boolean
validate()
Validates the user's input and updates theemailNotifier
accordingly.
-
Field Details
-
K9_WEBSITE
-
THUNDERBIRD_WEBSITE
The Thunderbird website. -
EVOLUTION_WEBSITE
-
resourceBundle
Contains the translations for the dialog's text elements and popups. -
emailNotifier
TheEMailNotifier
that is being set up by the user. -
result
The result of the dialog.true
if the user confirmed the dialog,false
if the user cancelled it,null
if the dialog is still open. -
borderPane
private javafx.scene.layout.BorderPane borderPane -
hyperlinkK9Mail
private javafx.scene.control.Label hyperlinkK9Mail -
hyperlinkThunderbird
private javafx.scene.control.Label hyperlinkThunderbird -
hyperlinkEvolution
private javafx.scene.control.Label hyperlinkEvolution -
checkBoxPGP
private javafx.scene.control.CheckBox checkBoxPGP -
textAreaPgpPaste
private javafx.scene.control.TextArea textAreaPgpPaste -
hyperlinkTest
private javafx.scene.control.Hyperlink hyperlinkTest
-
-
Constructor Details
-
SetupEmailDialogController
public SetupEmailDialogController()
-
-
Method Details
-
initialize
It is required to callprepare(page.codeberg.friedolyn.configuration.Configuration)
immediately after this method.- Parameters:
location
- SeeInitializable.initialize(java.net.URL, java.util.ResourceBundle)
.resources
- SeeInitializable.initialize(java.net.URL, java.util.ResourceBundle)
.
-
toggleHidePgpTextArea
private void toggleHidePgpTextArea(boolean hide) Switches the visibility of the PGP public key text area.- Parameters:
hide
-true
to visually remove the text area from the dialog,false
to make it re-appear.
-
prepare
Uses the givenConfiguration
to insert the user's current e-mail setup into the dialog. It is required to call this method beforeinitialize(java.net.URL, java.util.ResourceBundle)
.- Specified by:
prepare
in interfacePreparable<Configuration>
- Overrides:
prepare
in classController<Configuration>
- Parameters:
configuration
- TheConfiguration
to use for the setup.Configuration.getEmail()
andConfiguration.getUser()
must not be empty.- Throws:
IllegalArgumentException
- If the configuration does not contain an e-mail address or no user.- See Also:
-
openK9Website
public void openK9Website()Opens
theK-9 Mail website
in the user's default web browser. -
openThunderbirdWebsite
public void openThunderbirdWebsite()Opens
theThunderbird website
in the user's default web browser. -
openEvolutionWebsite
public void openEvolutionWebsite() -
validate
private boolean validate()Validates the user's input and updates theemailNotifier
accordingly.- Returns:
true
if the user's PGP is unset or valid,false
if it's invalid.
-
testSetup
public void testSetup()Sends a test notification to the user's e-mail address to verify that the setup is correct. -
confirm
public void confirm()The user confirms their input in order to close the dialog.Validates
the user's input before proceeding.- Specified by:
confirm
in classDialogController<Configuration,
EMailNotifier>
-
getSuccess
- Overrides:
getSuccess
in classController<Configuration>
- Returns:
-
FuzzyBoolean.TRUE
iff the user has entered valid data and closed the window or dialog. -
If
FuzzyBoolean.FALSE
is returned, it means the user has entered invalid data and closed the window or dialog. -
If
FuzzyBoolean.MAYBE
is returned if the window/dialog is still open or if it is unclear whether the user has entered valid data.
-
-
getResult
- Specified by:
getResult
in classDialogController<Configuration,
EMailNotifier> - Returns:
- The result of the dialog. May contain nonsensical data if the dialog has not been closed yet.
-
close
public void close()Makes the dialog disappear from the user's screen.- Specified by:
close
in classController<Configuration>
-