| 1 |
import QtQuick 2.4 |
| 2 |
import QtQuick.Window 2.1 |
| 3 |
import QuickFlux 1.0 |
| 4 |
import PlugMan 1.0 |
| 5 |
import Dekko.Mail.API 1.0 |
| 6 |
import Dekko.Mail.Stores.Mail 1.0 |
| 7 |
|
| 8 |
Item { |
| 9 |
id: root |
| 10 |
|
| 11 |
AppListener { |
| 12 |
enabled: true |
| 13 |
|
| 14 |
Filter { |
| 15 |
type: ViewKeys.openComposer |
| 16 |
onDispatched: { |
| 17 |
|
| 18 |
if (d.composeWindow === null) { |
| 19 |
var comp = d.getComponent("Dekko::Mail::Composer") |
| 20 |
if (comp !== null) { |
| 21 |
d.composeWindow = comp.createObject(root) |
| 22 |
d.composeWindow.setVisible(true) |
| 23 |
MailStore.disableMsgListUpdates = true; |
| 24 |
} |
| 25 |
} else { |
| 26 |
d.composeWindow.raise() |
| 27 |
// Raise current compose window |
| 28 |
// show message about composition already in progress |
| 29 |
// do they want to save draft etc. |
| 30 |
} |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
Filter { |
| 35 |
type: ViewKeys.closeComposer |
| 36 |
onDispatched: { |
| 37 |
if (d.composeWindow !== null) { |
| 38 |
d.composeWindow.destroy() |
| 39 |
} |
| 40 |
MailStore.disableMsgListUpdates = false; |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
Filter { |
| 45 |
type: ViewKeys.openSettings |
| 46 |
onDispatched: { |
| 47 |
console.log("Open Settings") |
| 48 |
if (d.settingsWindow === null) { |
| 49 |
var comp = d.getComponent("Dekko::Mail::Settings") |
| 50 |
if (comp !== null) { |
| 51 |
d.settingsWindow = comp.createObject(root) |
| 52 |
d.settingsWindow.setVisible(true) |
| 53 |
} |
| 54 |
} else { |
| 55 |
d.settingsWindow.raise() |
| 56 |
} |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
Filter { |
| 61 |
type: ViewKeys.closeSettings |
| 62 |
onDispatched: { |
| 63 |
if (d.settingsWindow !== null) { |
| 64 |
d.settingsWindow.destroy() |
| 65 |
} |
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
Filter { |
| 70 |
type: ViewKeys.runSetupWizard |
| 71 |
onDispatched: { |
| 72 |
console.log("Open Mail Setup Wizard") |
| 73 |
if (d.setupWizard === null) { |
| 74 |
var comp = d.getComponent("Dekko::Mail::SetupWizard") |
| 75 |
if (comp !== null) { |
| 76 |
d.setupWizard = comp.createObject(root) |
| 77 |
d.setupWizard.setVisible(true) |
| 78 |
} |
| 79 |
} else { |
| 80 |
d.setupWizard.raise() |
| 81 |
} |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
Filter { |
| 86 |
type: ViewKeys.closeSetupWizard |
| 87 |
onDispatched: { |
| 88 |
console.log("Closing setup wizard") |
| 89 |
if (d.setupWizard !== null) { |
| 90 |
d.setupWizard.destroy() |
| 91 |
} |
| 92 |
} |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
ItemRegistry { |
| 97 |
id: registry |
| 98 |
asynchronous: true |
| 99 |
target: root |
| 100 |
location: "Dekko::Mail" |
| 101 |
loadMode: ItemRegistry.LoadFirstEnabled |
| 102 |
} |
| 103 |
|
| 104 |
QtObject { |
| 105 |
id: d |
| 106 |
property Window settingsWindow: null |
| 107 |
property Window composeWindow: null |
| 108 |
property Window setupWizard: null |
| 109 |
|
| 110 |
function getComponent(location) { |
| 111 |
var src = registry.findFirstEnabled(location) |
| 112 |
if (src) { |
| 113 |
var comp = Qt.createComponent(Qt.resolvedUrl("file:///" + src)) |
| 114 |
if (comp.status === Component.Error) { |
| 115 |
console.log("Failed to create component: ", comp.errorString()) |
| 116 |
return null |
| 117 |
} |
| 118 |
return comp |
| 119 |
} |
| 120 |
} |
| 121 |
} |
| 122 |
} |