File indexing completed on 2023-12-03 05:01:58

0001 /*
0002  * Copyright (C) 2012 David Edmundson <kde@davidedmundson.co.uk>
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 #include "pending-wallet.h"
0020 
0021 #include "wallet-interface.h"
0022 
0023 namespace KTp {
0024 class PendingWalletPrivate {
0025 public:
0026     KTp::WalletInterface *walletInterface;
0027 };
0028 }
0029 
0030 KTp::PendingWallet::PendingWallet(KTp::WalletInterface* walletInterface)
0031     :Tp::PendingOperation(Tp::SharedPtr<Tp::RefCounted>(nullptr)),
0032       d( new KTp::PendingWalletPrivate())
0033 {
0034     d->walletInterface = walletInterface;
0035 
0036     //if wallet is not enabled, or wallet is already opened, setFinished() immediately
0037     if (!walletInterface->wallet() || walletInterface->isOpen()) {
0038         setFinished();
0039     } else {
0040         connect(walletInterface->wallet(), SIGNAL(walletOpened(bool)), SLOT(setFinished()));
0041     }
0042 }
0043 
0044 KTp::PendingWallet::~PendingWallet()
0045 {
0046     delete d;
0047 }
0048 
0049 KTp::WalletInterface *KTp::PendingWallet::walletInterface() const
0050 {
0051     return d->walletInterface;
0052 }
0053