[SCM] ktp-auth-handler packaging branch, master, updated. debian/15.12.1-2-282-g080758e

Maximiliano Curia maxy at moszumanska.debian.org
Fri May 27 23:58:44 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-auth-handler.git;a=commitdiff;h=93b104a

The following commit has been merged in the master branch:
commit 93b104aede8a7e9b46967f25f49868c24df3db74
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Tue May 15 01:27:43 2012 +0100

    Updated to new wallet interface
    
    REVIEW: 104952
---
 x-messenger-oauth2-auth-operation.cpp   | 13 +++++--------
 x-telepathy-password-auth-operation.cpp | 17 +++++++----------
 x-telepathy-password-prompt.cpp         |  8 +++-----
 3 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/x-messenger-oauth2-auth-operation.cpp b/x-messenger-oauth2-auth-operation.cpp
index 3959263..e4aa800 100644
--- a/x-messenger-oauth2-auth-operation.cpp
+++ b/x-messenger-oauth2-auth-operation.cpp
@@ -45,13 +45,11 @@ XMessengerOAuth2AuthOperation::~XMessengerOAuth2AuthOperation()
 void XMessengerOAuth2AuthOperation::onSASLStatusChanged(uint status, const QString &reason,
         const QVariantMap &details)
 {
-    KTp::WalletInterface wallet(0);
-
     switch (status) {
     case Tp::SASLStatusNotStarted :
-        if (wallet.hasEntry(m_account, XMessengerOAuth2TokenWalletEntry)) {
+        if (KTp::WalletInterface::hasEntry(m_account, XMessengerOAuth2TokenWalletEntry)) {
             m_saslIface->StartMechanismWithData(QLatin1String("X-MESSENGER-OAUTH2"),
-                                                QByteArray::fromBase64(wallet.entry(m_account, XMessengerOAuth2TokenWalletEntry).toLatin1()));
+                                                QByteArray::fromBase64(KTp::WalletInterface::entry(m_account, XMessengerOAuth2TokenWalletEntry).toLatin1()));
             return;
         }
 
@@ -81,7 +79,7 @@ void XMessengerOAuth2AuthOperation::onSASLStatusChanged(uint status, const QStri
     case Tp::SASLStatusServerFailed:
     {
         kDebug() << "Error authenticating - reason:" << reason << "- details:" << details;
-        if (wallet.hasEntry(m_account, XMessengerOAuth2TokenWalletEntry)) {
+        if (KTp::WalletInterface::hasEntry(m_account, XMessengerOAuth2TokenWalletEntry)) {
             // We cannot try again (TODO canTryAgain seems to be always false for
             // X-MESSENGER-OAUTH but we should insert a check here)
             // but we can remove the token and request again to set the account
@@ -90,7 +88,7 @@ void XMessengerOAuth2AuthOperation::onSASLStatusChanged(uint status, const QStri
             // next time we will prompt for password and the user won't see any
             // difference except for an authentication error notification
             // TODO There should be a way to renew the token if it is expired.
-            wallet.removeEntry(m_account, XMessengerOAuth2TokenWalletEntry);
+            KTp::WalletInterface::removeEntry(m_account, XMessengerOAuth2TokenWalletEntry);
             Tp::Presence requestedPresence = m_account->requestedPresence();
             m_account->setRequestedPresence(requestedPresence);
         }
@@ -107,7 +105,6 @@ void XMessengerOAuth2AuthOperation::onSASLStatusChanged(uint status, const QStri
 
 void XMessengerOAuth2AuthOperation::onDialogFinished(int result)
 {
-    KTp::WalletInterface wallet(0);
     switch (result) {
     case QDialog::Rejected:
         kDebug() << "Authentication cancelled";
@@ -119,7 +116,7 @@ void XMessengerOAuth2AuthOperation::onDialogFinished(int result)
         return;
     case QDialog::Accepted:
         kDebug() << QLatin1String(m_dialog.data()->accessToken());
-        wallet.setEntry(m_account, XMessengerOAuth2TokenWalletEntry, QLatin1String(m_dialog.data()->accessToken().toBase64()));
+        KTp::WalletInterface::setEntry(m_account, XMessengerOAuth2TokenWalletEntry, QLatin1String(m_dialog.data()->accessToken().toBase64()));
         m_saslIface->StartMechanismWithData(QLatin1String("X-MESSENGER-OAUTH2"), m_dialog.data()->accessToken());
         if (!m_dialog.isNull()) {
             m_dialog.data()->deleteLater();
diff --git a/x-telepathy-password-auth-operation.cpp b/x-telepathy-password-auth-operation.cpp
index 0564afa..47fa630 100644
--- a/x-telepathy-password-auth-operation.cpp
+++ b/x-telepathy-password-auth-operation.cpp
@@ -48,17 +48,16 @@ XTelepathyPasswordAuthOperation::~XTelepathyPasswordAuthOperation()
 void XTelepathyPasswordAuthOperation::onSASLStatusChanged(uint status, const QString &reason,
         const QVariantMap &details)
 {
-    KTp::WalletInterface wallet(0);
     if (status == Tp::SASLStatusNotStarted) {
         kDebug() << "Requesting password";
-        promptUser(m_canTryAgain || !wallet.hasEntry(m_account, QLatin1String("lastLoginFailed")));
+        promptUser(m_canTryAgain || !KTp::WalletInterface::hasEntry(m_account, QLatin1String("lastLoginFailed")));
     } else if (status == Tp::SASLStatusServerSucceeded) {
         kDebug() << "Authentication handshake";
         m_saslIface->AcceptSASL();
     } else if (status == Tp::SASLStatusSucceeded) {
         kDebug() << "Authentication succeeded";
-        if (wallet.hasEntry(m_account, QLatin1String("lastLoginFailed"))) {
-            wallet.removeEntry(m_account, QLatin1String("lastLoginFailed"));
+        if (KTp::WalletInterface::hasEntry(m_account, QLatin1String("lastLoginFailed"))) {
+            KTp::WalletInterface::removeEntry(m_account, QLatin1String("lastLoginFailed"));
         }
         setFinished();
     } else if (status == Tp::SASLStatusInProgress) {
@@ -71,7 +70,7 @@ void XTelepathyPasswordAuthOperation::onSASLStatusChanged(uint status, const QSt
             promptUser(false);
         } else {
             kWarning() << "Authentication failed and cannot try again";
-            wallet.setEntry(m_account, QLatin1String("lastLoginFailed"), QLatin1String("true"));
+            KTp::WalletInterface::setEntry(m_account, QLatin1String("lastLoginFailed"), QLatin1String("true"));
             // We cannot try again, but we can request again to set the account
             // online. A new channel will be created, but since we set the
             // lastLoginFailed entry, next time we will prompt for password
@@ -87,10 +86,9 @@ void XTelepathyPasswordAuthOperation::onSASLStatusChanged(uint status, const QSt
 
 void XTelepathyPasswordAuthOperation::promptUser(bool isFirstRun)
 {
-    KTp::WalletInterface wallet(0);
-    if (wallet.hasPassword(m_account) && isFirstRun) {
+    if (KTp::WalletInterface::hasPassword(m_account) && isFirstRun) {
         m_saslIface->StartMechanismWithData(QLatin1String("X-TELEPATHY-PASSWORD"),
-                                            wallet.password(m_account).toUtf8());
+                                            KTp::WalletInterface::password(m_account).toUtf8());
     } else {
         m_dialog = new XTelepathyPasswordPrompt(m_account);
         connect(m_dialog.data(),
@@ -102,7 +100,6 @@ void XTelepathyPasswordAuthOperation::promptUser(bool isFirstRun)
 
 void XTelepathyPasswordAuthOperation::onDialogFinished(int result)
 {
-    KTp::WalletInterface wallet(0);
     switch (result) {
     case QDialog::Rejected:
         kDebug() << "Authentication cancelled";
@@ -117,7 +114,7 @@ void XTelepathyPasswordAuthOperation::onDialogFinished(int result)
         if (!m_dialog.isNull()) {
             if (m_dialog.data()->savePassword()) {
                 kDebug() << "Saving password in wallet";
-                wallet.setPassword(m_account, m_dialog.data()->password());
+                KTp::WalletInterface::setPassword(m_account, m_dialog.data()->password());
             }
             m_saslIface->StartMechanismWithData(QLatin1String("X-TELEPATHY-PASSWORD"), m_dialog.data()->password().toUtf8());
             m_dialog.data()->deleteLater();
diff --git a/x-telepathy-password-prompt.cpp b/x-telepathy-password-prompt.cpp
index f0ce5dc..c24079c 100644
--- a/x-telepathy-password-prompt.cpp
+++ b/x-telepathy-password-prompt.cpp
@@ -36,12 +36,10 @@ XTelepathyPasswordPrompt::XTelepathyPasswordPrompt(const Tp::AccountPtr &account
     ui->accountIcon->setPixmap(KIcon(QLatin1String("dialog-password")).pixmap(60, 60));
     ui->title->setPixmap(KIcon(account->iconName()).pixmap(22, 22));
 
-    KTp::WalletInterface wallet(this->effectiveWinId());
-
-    if (wallet.isOpen()) {
+    if (KTp::WalletInterface::isOpen()) {
         ui->savePassword->setChecked(true);
-        if (wallet.hasPassword(account)) {
-            ui->passwordLineEdit->setText(wallet.password(account));
+        if (KTp::WalletInterface::hasPassword(account)) {
+            ui->passwordLineEdit->setText(KTp::WalletInterface::password(account));
         }
     } else {
         ui->savePassword->setDisabled(true);

-- 
ktp-auth-handler packaging



More information about the pkg-kde-commits mailing list