File indexing completed on 2024-04-21 05:50:42
0001 /* 0002 SPDX-FileCopyrightText: 2009-2022 Rolf Eike Beer <kde@opensource.sf-tec.de> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #include "kgpgkeyservergettransaction.h" 0007 0008 #include "gpgproc.h" 0009 0010 KGpgKeyserverGetTransaction::KGpgKeyserverGetTransaction(QObject *parent, const QString &keyserver, const QStringList &keys, const bool withProgress, const QString &proxy) 0011 : KGpgKeyserverTransaction(parent, keyserver, withProgress, proxy) 0012 { 0013 m_cmdpos = addArgument(QString()); 0014 setKeyIds(keys); 0015 } 0016 0017 bool 0018 KGpgKeyserverGetTransaction::preStart() 0019 { 0020 GPGProc *proc = getProcess(); 0021 QStringList args(proc->program()); 0022 0023 int num = args.count(); 0024 while (num > m_cmdpos) 0025 args.removeAt(--num); 0026 0027 args << getGpgCommand() << m_keys; 0028 0029 proc->setProgram(args); 0030 0031 setSuccess(TS_MSG_SEQUENCE); 0032 0033 return KGpgKeyserverTransaction::preStart(); 0034 } 0035 0036 bool 0037 KGpgKeyserverGetTransaction::nextLine(const QString &line) 0038 { 0039 m_log.append(line); 0040 0041 setSuccess(TS_OK); 0042 0043 return false; 0044 } 0045 0046 const QStringList & 0047 KGpgKeyserverGetTransaction::getLog() const 0048 { 0049 return m_log; 0050 } 0051 0052 void 0053 KGpgKeyserverGetTransaction::setKeyIds(const QStringList &keys) 0054 { 0055 m_keys = keys; 0056 } 0057 0058 KGpgReceiveKeys::KGpgReceiveKeys(QObject *parent, const QString &keyserver, const QStringList &keys, const bool withProgress, const QString &proxy) 0059 : KGpgKeyserverGetTransaction(parent, keyserver, keys, withProgress, proxy) 0060 { 0061 } 0062 0063 QString 0064 KGpgReceiveKeys::getGpgCommand() const 0065 { 0066 return QLatin1String( "--recv-keys" ); 0067 } 0068 0069 KGpgRefreshKeys::KGpgRefreshKeys(QObject *parent, const QString &keyserver, const QStringList &keys, const bool withProgress, const QString &proxy) 0070 : KGpgKeyserverGetTransaction(parent, keyserver, keys, withProgress, proxy) 0071 { 0072 } 0073 0074 QString 0075 KGpgRefreshKeys::getGpgCommand() const 0076 { 0077 return QLatin1String( "--refresh-keys" ); 0078 }