| 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 |
import QtQuick 2.4 |
| 19 |
import Lomiri.Components 1.3 |
| 20 |
import Lomiri.Components.Popups 1.3 |
| 21 |
import PlugMan 1.0 |
| 22 |
|
| 23 |
import Dekko.Mail.API 1.0 |
| 24 |
import Dekko.Mail.Settings 1.0 |
| 25 |
import Dekko.Mail.Stores.Views 1.0 |
| 26 |
import Dekko.Mail.Stores.Composer 1.0 |
| 27 |
import Dekko.Mail.Workers 1.0 |
| 28 |
|
| 29 |
import Dekko.Lomiri.Components 1.0 |
| 30 |
import Dekko.Lomiri.Dialogs 1.0 |
| 31 |
import Dekko.Lomiri.Helpers 1.0 |
| 32 |
|
| 33 |
import "./workers" |
| 34 |
|
| 35 |
ViewState { |
| 36 |
id: dekko |
| 37 |
|
| 38 |
anchors.fill: parent |
| 39 |
onStateChanged: { |
| 40 |
var ignore = ComposerStore.listenerId |
| 41 |
ignore = PolicyManager.objectName |
| 42 |
ViewStore.formFactor = state |
| 43 |
Log.logStatus("ViewState::stateChanged", state) |
| 44 |
} |
| 45 |
|
| 46 |
Item { |
| 47 |
id: dekkoContainer |
| 48 |
anchors { |
| 49 |
left: parent.left |
| 50 |
top: parent.top |
| 51 |
right: parent.right |
| 52 |
// anchor to the top of KeyboardRectangle |
| 53 |
// this ensures pages are always above the OSK |
| 54 |
// Basically the same as anchorToKeyboard |
| 55 |
bottom: kbdRect.top |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
ItemRegistry { |
| 60 |
id: itemRegistry |
| 61 |
asynchronous: false |
| 62 |
location: "Dekko::Stage::Main" |
| 63 |
target: dekkoContainer |
| 64 |
loadMode: ItemRegistry.LoadFirstEnabled |
| 65 |
} |
| 66 |
|
| 67 |
DialogWorker { |
| 68 |
name: PopupKeys.popupMainWindow |
| 69 |
dlgTarget: dekkoContainer |
| 70 |
noticePopup: Component { |
| 71 |
NoticePopup{} |
| 72 |
} |
| 73 |
confirmationPopup: Component { |
| 74 |
ConfirmationDialog{} |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
ToastWorker { |
| 79 |
name: ViewKeys.toastMainWindow |
| 80 |
target: dekkoContainer |
| 81 |
toastSource: Qt.resolvedUrl("./views/toasts/SimpleToast.qml") |
| 82 |
} |
| 83 |
|
| 84 |
Loader { |
| 85 |
id: workerLoader |
| 86 |
asynchronous: true |
| 87 |
sourceComponent: ListenerRegistry { |
| 88 |
defaultListeners: [ |
| 89 |
AccountsWorker {}, |
| 90 |
MailboxWorker { |
| 91 |
mailboxPickerUrl: itemRegistry.findFirstEnabled("Dekko::Mail::FolderPicker") |
| 92 |
}, |
| 93 |
SettingsWorker { |
| 94 |
mailboxPickerUrl: itemRegistry.findFirstEnabled("Dekko::Mail::FolderPicker") |
| 95 |
}, |
| 96 |
UriWorker {}, |
| 97 |
ErrorsWorker {} |
| 98 |
] |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
// Workers we need straight away |
| 103 |
QtObject { |
| 104 |
id: d |
| 105 |
property MailWorker mailWorker: MailWorker {} |
| 106 |
property ComposerWorker composeWorker: ComposerWorker {} |
| 107 |
property ContentWorker contentWorker: ContentWorker {} |
| 108 |
property Logger logger: Logger { |
| 109 |
devLoggingEnabled: devModeEnabled |
| 110 |
} |
| 111 |
} |
| 112 |
|
| 113 |
KeyboardRectangle { |
| 114 |
id: kbdRect |
| 115 |
anchors.left: parent.left |
| 116 |
anchors.right: parent.right |
| 117 |
anchors.bottom: parent.bottom |
| 118 |
} |
| 119 |
|
| 120 |
Connections { |
| 121 |
target: UriHandler |
| 122 |
onOpened: { |
| 123 |
Log.logInfo("UriListener::UriHandler::onOpened", "We got uris to handle: " + uris) |
| 124 |
ViewActions.openUris(uris) |
| 125 |
} |
| 126 |
} |
| 127 |
|
| 128 |
} |
| 129 |
|