| 1 |
/* Copyright (C) 2016 - 2017 Dan Chapman <[email protected]> |
| 2 |
|
| 3 |
This file is part of Dekko email client for Ubuntu devices |
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or |
| 6 |
modify it under the terms of the GNU General Public License as |
| 7 |
published by the Free Software Foundation; either version 2 of |
| 8 |
the License or (at your option) version 3 |
| 9 |
|
| 10 |
This program is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
GNU General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU General Public License |
| 16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
pragma Singleton |
| 19 |
import QtQuick 2.4 |
| 20 |
import QuickFlux 1.0 |
| 21 |
|
| 22 |
/*! |
| 23 |
* |
| 24 |
* WizardActions API of the setup wizard process |
| 25 |
* |
| 26 |
* WizardActions can only be used while the SetupWizard is visible. |
| 27 |
* The AccountSetup AppListener is disabled and will not process disaptched events |
| 28 |
* when the setupwizard is closed |
| 29 |
* |
| 30 |
* @ingroup qml_actions |
| 31 |
*/ |
| 32 |
ActionCreator { |
| 33 |
|
| 34 |
/*! |
| 35 |
* Sets the new account type |
| 36 |
* @param description The description of the new account. e.g "GMail" "Yahoo!" etc... |
| 37 |
* @param type The type of account to create. options are AccountConfig.IMAP/POP3/SMTP |
| 38 |
*/ |
| 39 |
signal setNewAccountType(string description, int type) |
| 40 |
|
| 41 |
/*! |
| 42 |
* Set the basic user details |
| 43 |
* @param details Takes an object in the format { "name": "", "email": "", "password": "", "nickname": ""} |
| 44 |
*/ |
| 45 |
signal setUserDetails(var details) |
| 46 |
/*! |
| 47 |
* Validate the set user details |
| 48 |
* |
| 49 |
* Ensure the WizardActions::setUserDetails(details) has been called before this |
| 50 |
*/ |
| 51 |
signal validateUserDetails() |
| 52 |
|
| 53 |
/*! |
| 54 |
* Validate the configured user details |
| 55 |
* |
| 56 |
* Note: This is dispatched by validateUserDetails so you don't need to call this directly |
| 57 |
*/ |
| 58 |
signal validateUser(var user) |
| 59 |
|
| 60 |
/*! |
| 61 |
* Dispatched when user validation succeeded |
| 62 |
*/ |
| 63 |
signal userDetailsValid() |
| 64 |
|
| 65 |
/*! |
| 66 |
* Dispatched when user validation failed |
| 67 |
* @param result An array indicating which data fields were invalid. |
| 68 |
* i.e Array("name", "password") would mean these two fields were invalid |
| 69 |
*/ |
| 70 |
signal userDetailsInvalid(var result) |
| 71 |
/*! |
| 72 |
* Dispatched when no password has been set in the userDetails. |
| 73 |
* |
| 74 |
* A prompt should be shown to the user to allow proceeding with no password |
| 75 |
*/ |
| 76 |
signal noPasswordSet() |
| 77 |
|
| 78 |
/*! |
| 79 |
* Dispatched when no password has been set for a specific server configuration. |
| 80 |
* |
| 81 |
* A prompt should be shown to the user to allow proceeding with no password |
| 82 |
*/ |
| 83 |
signal noServerPasswordSet() |
| 84 |
|
| 85 |
/*! |
| 86 |
* Dispatch acceptance of using an empty password |
| 87 |
*/ |
| 88 |
signal setNoPasswordAllowed() |
| 89 |
|
| 90 |
/*! |
| 91 |
* Set a servers config details |
| 92 |
* @param details Object of configuration returned by ServerDetails.toMap() |
| 93 |
* |
| 94 |
* Example object: |
| 95 |
* ``` |
| 96 |
* { |
| 97 |
* "servicetype" : "imap", |
| 98 |
* "hostname" : "imap.example.com", |
| 99 |
* "port": 993, |
| 100 |
* "encryption": AccountConfig.SSL, |
| 101 |
* "username": "[email protected]", |
| 102 |
* "password": "password", |
| 103 |
* "authentication": AccountConfig.CRAM_MD5, |
| 104 |
* "allowUntrusted": false |
| 105 |
* } |
| 106 |
* ``` |
| 107 |
*/ |
| 108 |
signal setServerDetails(var details) |
| 109 |
|
| 110 |
/*! |
| 111 |
* Navigate to the next view of the setup wizard |
| 112 |
* @param view url/qresource of the view to navigate to |
| 113 |
* @param properties The properties to be applied to view during creation |
| 114 |
* |
| 115 |
* ```qml |
| 116 |
* Button { |
| 117 |
* onClicked: { |
| 118 |
* WizardActions.wizardNavigateTo("qrc://qml/views/nextview.qml", {title: "Next view"}) |
| 119 |
* } |
| 120 |
* } |
| 121 |
* ``` |
| 122 |
*/ |
| 123 |
signal wizardNavigateTo(var view, var properties) |
| 124 |
|
| 125 |
/*! |
| 126 |
* Navigate to the previous step of the setup wizard |
| 127 |
*/ |
| 128 |
signal wizardStepBack() |
| 129 |
|
| 130 |
/*! |
| 131 |
* Navigate to the next step of the setup wizard |
| 132 |
*/ |
| 133 |
signal wizardStepForward() |
| 134 |
|
| 135 |
/*! |
| 136 |
* Reset's the NewAccount object of the AccountSetup store |
| 137 |
* |
| 138 |
* Call this when you are resetting the setup wizard. |
| 139 |
*/ |
| 140 |
signal wizardResetAccount() |
| 141 |
|
| 142 |
/*! |
| 143 |
* Setup the NewAccount to use one of the PresetProviders |
| 144 |
* @param config The configuration provided by the PresetProvider from the PresetProviderModel |
| 145 |
* |
| 146 |
* ```QML |
| 147 |
* import Dekko.Accounts 1.0 |
| 148 |
* |
| 149 |
* ListView { |
| 150 |
* model: PresetProviderModel {} |
| 151 |
* delegate: ListItem { |
| 152 |
* property var provider: model.qtObject |
| 153 |
* onClicked: WizardActions.wizardSetAccountPreset(provider) |
| 154 |
* } |
| 155 |
* } |
| 156 |
* ``` |
| 157 |
*/ |
| 158 |
signal wizardSetAccountPreset(var config) |
| 159 |
|
| 160 |
/*! |
| 161 |
* Look for the users server configuration via AutoDiscover. |
| 162 |
*/ |
| 163 |
signal lookForServerDetails() |
| 164 |
|
| 165 |
/*! |
| 166 |
* Dispatch when AutoDiscover finds a server configuration |
| 167 |
*/ |
| 168 |
signal serverDetailsFound() |
| 169 |
|
| 170 |
/*! |
| 171 |
* Dispatch when AutoDiscover fails to find a server configuration |
| 172 |
*/ |
| 173 |
signal noServerDetailsFound() |
| 174 |
|
| 175 |
/*! |
| 176 |
* Checks the server configuration is usable for the selected account type |
| 177 |
* |
| 178 |
* We may end up in a situation where the user asked for IMAP but we only found a POP3 configuration |
| 179 |
* Calling this will do a sanity check and dispatch a relevent action to present to the user if things don't add up. |
| 180 |
*/ |
| 181 |
signal checkProviderForAccountType() |
| 182 |
/*! |
| 183 |
* Dispatched when the user has selected a POP3 account but we have a usable IMAp configuration |
| 184 |
* |
| 185 |
* We dispatch this because IMAP is far superior and the user maybe unaware their service provides IMAP |
| 186 |
*/ |
| 187 |
signal askAboutImapInstead() |
| 188 |
|
| 189 |
/*! |
| 190 |
* Validate the users credentials |
| 191 |
*/ |
| 192 |
signal validateCredentials() |
| 193 |
/*! |
| 194 |
* Iterate over server configurations and find one that works |
| 195 |
*/ |
| 196 |
signal validateConfigToUse() |
| 197 |
|
| 198 |
/*! |
| 199 |
* Validate the user has provided enough info to proceed |
| 200 |
*/ |
| 201 |
signal validateIfAccountHasEnoughCredentials() |
| 202 |
|
| 203 |
/*! |
| 204 |
* User needs to input details manually. |
| 205 |
* |
| 206 |
* Either AutoDiscover failed or there was an issue validating the account. |
| 207 |
*/ |
| 208 |
signal requestManualInput() |
| 209 |
|
| 210 |
/*! |
| 211 |
* Show a dialog to the user about using IMAP instead |
| 212 |
* |
| 213 |
* This should be called as a result of receiving the askAboutImapInstead event |
| 214 |
*/ |
| 215 |
signal showUseImapDialog() |
| 216 |
/*! |
| 217 |
* Use imap instead |
| 218 |
*/ |
| 219 |
signal useImapInstead() |
| 220 |
/*! |
| 221 |
* Strick with pop |
| 222 |
*/ |
| 223 |
signal stickWithPop() |
| 224 |
|
| 225 |
|
| 226 |
signal noValidConfigs() |
| 227 |
signal runAccountValidation() |
| 228 |
signal syncNewAccount() |
| 229 |
signal accountSynced() |
| 230 |
signal accountSyncFailed() |
| 231 |
signal validateServerConfiguration() |
| 232 |
signal validateServer(var config) |
| 233 |
signal serverConfigValid(string serviceType) |
| 234 |
signal invalidServerConfig(string serviceType, var result) |
| 235 |
signal applyServerConfig(var config) |
| 236 |
signal addAnotherAccount() |
| 237 |
signal endSetup() |
| 238 |
signal removeNewAccount() |
| 239 |
signal setDefaultIdentity() |
| 240 |
} |