diff options
Diffstat (limited to 'framework/domain/accountfactory.cpp')
-rw-r--r-- | framework/domain/accountfactory.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/framework/domain/accountfactory.cpp b/framework/domain/accountfactory.cpp index af37710a..ab1a09e5 100644 --- a/framework/domain/accountfactory.cpp +++ b/framework/domain/accountfactory.cpp | |||
@@ -24,28 +24,30 @@ | |||
24 | #include <KPackage/Package> | 24 | #include <KPackage/Package> |
25 | #include <KPluginMetaData> | 25 | #include <KPluginMetaData> |
26 | 26 | ||
27 | #include "settings/settings.h" | ||
28 | |||
27 | AccountFactory::AccountFactory(QObject *parent) | 29 | AccountFactory::AccountFactory(QObject *parent) |
28 | : QObject(parent) | 30 | : QObject(parent) |
29 | { | 31 | { |
30 | |||
31 | } | 32 | } |
32 | 33 | ||
33 | void AccountFactory::setAccountId(const QString &accountId) | 34 | void AccountFactory::setAccountId(const QString &accountId) |
34 | { | 35 | { |
35 | qWarning() << "setting account id: " << accountId; | ||
36 | mAccountId = accountId; | 36 | mAccountId = accountId; |
37 | loadPackage(); | ||
38 | } | ||
39 | 37 | ||
40 | QByteArray AccountFactory::getAccountType() const | 38 | Kube::Account account(mAccountId.toUtf8()); |
41 | { | 39 | mAccountType = account.type(); |
42 | return "maildir"; | 40 | |
41 | loadPackage(); | ||
43 | } | 42 | } |
44 | 43 | ||
45 | void AccountFactory::loadPackage() | 44 | void AccountFactory::loadPackage() |
46 | { | 45 | { |
47 | auto accountType = getAccountType(); | 46 | auto package = KPackage::PackageLoader::self()->loadPackage("KPackage/GenericQML", "org.kube.accounts." + mAccountType); |
48 | auto package = KPackage::PackageLoader::self()->loadPackage("KPackage/GenericQML", "org.kube.accounts." + accountType); | 47 | if (!package.isValid()) { |
48 | qWarning() << "Failed to load account package: " << "org.kube.accounts." + mAccountType; | ||
49 | return; | ||
50 | } | ||
49 | Q_ASSERT(package.isValid()); | 51 | Q_ASSERT(package.isValid()); |
50 | mUiPath = package.filePath("mainscript"); | 52 | mUiPath = package.filePath("mainscript"); |
51 | mName = package.metadata().name(); | 53 | mName = package.metadata().name(); |