File indexing completed on 2023-10-03 04:18:00
0001 /* 0002 * Copyright (C) 2011 Daniele E. Domenichelli <daniele.domenichelli@gmail.com> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public 0015 * License along with this library; if not, write to the Free Software 0016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 0017 */ 0018 0019 #ifndef X_TELEPATHY_PASSWORD_AUTH_OPERATION_H 0020 #define X_TELEPATHY_PASSWORD_AUTH_OPERATION_H 0021 0022 #include <TelepathyQt/PendingOperation> 0023 #include <TelepathyQt/Types> 0024 #include "x-telepathy-password-prompt.h" 0025 0026 #include <KConfigGroup> 0027 #include <KSharedConfig> 0028 0029 class XTelepathyPasswordAuthOperation : public Tp::PendingOperation 0030 { 0031 Q_OBJECT 0032 Q_DISABLE_COPY(XTelepathyPasswordAuthOperation) 0033 0034 public: 0035 explicit XTelepathyPasswordAuthOperation( 0036 const Tp::AccountPtr &account, 0037 int accountStorageId, 0038 Tp::Client::ChannelInterfaceSASLAuthenticationInterface *saslIface, 0039 bool canTryAgain); 0040 ~XTelepathyPasswordAuthOperation(); 0041 0042 private Q_SLOTS: 0043 void onSASLStatusChanged(uint status, const QString &reason, const QVariantMap &details); 0044 void onDialogFinished(int result); 0045 0046 private: 0047 void promptUser(); 0048 void storeCredentials(const QString &secret); 0049 0050 Tp::AccountPtr m_account; 0051 Tp::Client::ChannelInterfaceSASLAuthenticationInterface *m_saslIface; 0052 KSharedConfigPtr m_config; 0053 KConfigGroup m_lastLoginFailedConfig; 0054 int m_accountStorageId; 0055 bool m_canTryAgain; 0056 bool m_canFinish; 0057 QPointer<XTelepathyPasswordPrompt> m_dialog; 0058 0059 friend class SaslAuthOp; 0060 }; 0061 0062 0063 #endif // X_TELEPATHY_PASSWORD_AUTH_OPERATION_H