summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Klapetek <[email protected]>2015-05-20 17:54:59 +0200
committerMartin Klapetek <[email protected]>2015-05-20 17:54:59 +0200
commita634d6d7291d712f8491332d4a2dc68edc80bdf4 (patch)
tree4f5dd5311e078ee0c3296b6d61f2c6bb05a2a032
parent536ed3cfe4cffdadffd9acd5bd6927d1d1ef792a (diff)
Don't create the Tp account itself
This is now handled by the Mission Control plugin instead
-rw-r--r--plugins/kaccounts/kaccounts-ui-provider.cpp89
-rw-r--r--plugins/kaccounts/kaccounts-ui-provider.h2
2 files changed, 47 insertions, 44 deletions
diff --git a/plugins/kaccounts/kaccounts-ui-provider.cpp b/plugins/kaccounts/kaccounts-ui-provider.cpp
index 54f4802..c6e6213 100644
--- a/plugins/kaccounts/kaccounts-ui-provider.cpp
+++ b/plugins/kaccounts/kaccounts-ui-provider.cpp
@@ -40,6 +40,7 @@
#include <TelepathyQt/PendingAccount>
#include <TelepathyQt/ProfileManager>
#include <TelepathyQt/PendingStringList>
+#include <TelepathyQt/AccountSet>
#include <KLocalizedString>
#include <KSharedConfig>
@@ -203,17 +204,17 @@ void KAccountsUiProvider::showNewAccountDialog()
void KAccountsUiProvider::showConfigureAccountDialog(const quint32 accountId)
{
- KSharedConfigPtr kaccountsConfig = KSharedConfig::openConfig(QStringLiteral("kaccounts-ktprc"));
- KConfigGroup ktpKaccountsGroup = kaccountsConfig->group(QStringLiteral("kaccounts-ktp"));
- QString accountUid = ktpKaccountsGroup.readEntry(QString::number(accountId));
+ Q_FOREACH (const Tp::AccountPtr &account, d->accountManager->validAccounts()->accounts()) {
+ if (account->uniqueIdentifier().endsWith(QString::number(accountId))) {
+ d->account = account;
+ }
+ }
- if (accountUid.isEmpty()) {
- qWarning() << "Empty accountUid, returning...";
+ if (!d->account) {
+ qWarning() << "Couldn't find account for" << accountId;
return;
}
- d->account = d->accountManager->accountForObjectPath(accountUid);
-
// Get the protocol's parameters and values.
Tp::ProtocolInfo protocolInfo = d->account->protocolInfo();
Tp::ProtocolParameterList parameters = protocolInfo.parameters();
@@ -300,16 +301,18 @@ void KAccountsUiProvider::onCreateAccountDialogAccepted()
values.remove(QLatin1String("password"));
}
- d->accountEditWidget->updateDisplayName();
- Tp::PendingAccount *pa = d->accountManager->createAccount(d->profile->cmName(),
- d->profile->protocolName(),
- d->accountEditWidget->displayName(),
- values,
- properties);
-
- connect(pa,
- SIGNAL(finished(Tp::PendingOperation*)),
- SLOT(onAccountCreated(Tp::PendingOperation*)));
+ onAccountCreated(values);
+
+// d->accountEditWidget->updateDisplayName();
+// Tp::PendingAccount *pa = d->accountManager->createAccount(d->profile->cmName(),
+// d->profile->protocolName(),
+// d->accountEditWidget->displayName(),
+// values,
+// properties);
+//
+// connect(pa,
+// SIGNAL(finished(Tp::PendingOperation*)),
+// SLOT(onAccountCreated(Tp::PendingOperation*)));
}
void KAccountsUiProvider::onCreateAccountDialogRejected()
@@ -317,33 +320,33 @@ void KAccountsUiProvider::onCreateAccountDialogRejected()
Q_EMIT error(QString());
}
-void KAccountsUiProvider::onAccountCreated(Tp::PendingOperation *op)
+void KAccountsUiProvider::onAccountCreated(const QVariantMap &data)
{
- if (op->isError()) {
- Q_EMIT feedbackMessage(i18n("Failed to create account"),
- i18n("Possibly not all required fields are valid"),
- KMessageWidget::Error);
- qWarning() << "Adding Account failed:" << op->errorName() << op->errorMessage();
- Q_EMIT error(op->errorMessage());
- return;
- }
-
- // Get the PendingAccount.
- Tp::PendingAccount *pendingAccount = qobject_cast<Tp::PendingAccount*>(op);
- if (!pendingAccount) {
- Q_EMIT feedbackMessage(i18n("Something went wrong with Telepathy"),
- QString(),
- KMessageWidget::Error);
- qWarning() << "Method called with wrong type.";
- Q_EMIT error(QStringLiteral("Something went wrong with Telepathy"));
- return;
- }
-
- Tp::AccountPtr account = pendingAccount->account();
- account->setServiceName(d->profile->serviceName());
- if (d->accountEditWidget->connectOnAdd()) {
- account->setRequestedPresence(Tp::Presence::available());
- }
+// if (op->isError()) {
+// Q_EMIT feedbackMessage(i18n("Failed to create account"),
+// i18n("Possibly not all required fields are valid"),
+// KMessageWidget::Error);
+// qWarning() << "Adding Account failed:" << op->errorName() << op->errorMessage();
+// Q_EMIT error(op->errorMessage());
+// return;
+// }
+//
+// // Get the PendingAccount.
+// Tp::PendingAccount *pendingAccount = qobject_cast<Tp::PendingAccount*>(op);
+// if (!pendingAccount) {
+// Q_EMIT feedbackMessage(i18n("Something went wrong with Telepathy"),
+// QString(),
+// KMessageWidget::Error);
+// qWarning() << "Method called with wrong type.";
+// Q_EMIT error(QStringLiteral("Something went wrong with Telepathy"));
+// return;
+// }
+//
+// Tp::AccountPtr account = pendingAccount->account();
+// account->setServiceName(d->profile->serviceName());
+// if (d->accountEditWidget->connectOnAdd()) {
+// account->setRequestedPresence(Tp::Presence::available());
+// }
QVariantMap values = d->accountEditWidget->parametersSet();
diff --git a/plugins/kaccounts/kaccounts-ui-provider.h b/plugins/kaccounts/kaccounts-ui-provider.h
index 88386cd..709f08c 100644
--- a/plugins/kaccounts/kaccounts-ui-provider.h
+++ b/plugins/kaccounts/kaccounts-ui-provider.h
@@ -52,7 +52,7 @@ Q_SIGNALS:
private Q_SLOTS:
void onProfileManagerReady(Tp::PendingOperation*);
void onConnectionManagerReady(Tp::PendingOperation*);
- void onAccountCreated(Tp::PendingOperation*);
+ void onAccountCreated(const QVariantMap &data);
void onCreateAccountDialogAccepted();
void onCreateAccountDialogRejected();
void onConfigureAccountDialogAccepted();