kleopatra
readerstatus.cpp
Go to the documentation of this file.
174 static QDebug operator<<( QDebug s, const std::vector< std::pair<std::string,std::string> > & v ) {
178 s << "status(" << QString::fromStdString( p.first ) << ") =" << QString::fromStdString( p.second ) << endl;
220 static std::auto_ptr<DefaultAssuanTransaction> gpgagent_transact( shared_ptr<Context> & gpgAgent, const char * command, Error & err ) {
230 kDebug() << "gpgagent_transact(" << command << "):" << QString::fromLocal8Bit( err.asString() );
242 // returns const std::string so template deduction in boost::split works, and we don't need a temporary
243 static const std::string scd_getattr_status( shared_ptr<Context> & gpgAgent, const char * what, Error & err ) {
246 const std::auto_ptr<DefaultAssuanTransaction> t = gpgagent_transact( gpgAgent, cmd.c_str(), err );
265 const std::auto_ptr<DefaultAssuanTransaction> t = gpgagent_transact( gpgAgent, "GETEVENTCOUNTER", err );
279 // returns const std::string so template deduction in boost::split works, and we don't need a temporary
280 static const std::string gpgagent_data( shared_ptr<Context> & gpgAgent, const char * what, Error & err ) {
305 kDebug() << "parse_keypairinfo_and_lookup_key: e=" << e.code() << "; key.isNull()" << key.isNull();
309 static CardInfo get_card_status( const QString & fileName, unsigned int idx, shared_ptr<Context> & gpg_agent ) {
344 split( chvStatus, scd_getattr_status( gpg_agent, "CHV-STATUS", err ), is_any_of( " \t" ), token_compress_on );
357 const std::auto_ptr<DefaultAssuanTransaction> result = gpgagent_transact( gpg_agent, "SCD LEARN --keypairinfo", err );
370 if ( kdtools::any( keyPairInfos, !boost::bind( &parse_keypairinfo_and_lookup_key, klc.get(), _1 ) ) )
380 static std::vector<CardInfo> update_cardinfo( const QString & gnupgHomePath, shared_ptr<Context> & gpgAgent ) {
388 const CardInfo ci = get_card_status( gnupgHome.absoluteFilePath( QLatin1String( "reader_0.status" ) ), 0, gpgAgent );
395 static bool check_event_counter_changed( shared_ptr<Context> & gpg_agent, unsigned int & counter ) {
479 QStringList files = gnupgHome.entryList( QStringList( QLatin1String( "reader_*.status" ) ), QDir::Files, QDir::Name );
481 kdtools::sort( files, boost::bind( parseFileName, _1, dummy ) < boost::bind( parseFileName, _2, dummy ) );
514 QMetaObject::invokeMethod( t.receiver, t.slot, Qt::DirectConnection, Q_ARG( GpgME::Error, t.error ) );
567 kDebug() << "ReaderStatusThread[2nd]: new iteration command=" << command << " ; nullSlot=" << nullSlot;
577 if ( nullSlot && command == checkTransaction.command && !check_event_counter_changed( gpgAgent, eventCounter ) )
600 kDebug() << "ReaderStatusThread[2nd]: slot" << idx << ":" << prettyFlags[oit->status] << "->" << prettyFlags[nit->status];
750 void ReaderStatus::startSimpleTransaction( const QByteArray & command, QObject * receiver, const char * slot ) {
static unsigned int parse_event_counter(const std::string &str)
Definition: readerstatus.cpp:256
QString cap(int nth) const
static ReaderStatus * mutableInstance()
Definition: readerstatus.cpp:721
void sleep(unsigned long secs)
QByteArray trimmed() const
void anyCardCanLearnKeysChanged(bool)
QString errorString() const
void startMonitoring()
Definition: readerstatus.cpp:716
static bool check_event_counter_changed(shared_ptr< Context > &gpg_agent, unsigned int &counter)
Definition: readerstatus.cpp:395
static unsigned int parseFileName(const QString &fileName, bool *ok)
Definition: readerstatus.cpp:146
bool exists() const
ReaderStatus(QObject *parent=0)
Definition: readerstatus.cpp:707
static std::string parse_keypairinfo(const std::string &kpi)
Definition: readerstatus.cpp:288
static std::auto_ptr< DefaultAssuanTransaction > gpgagent_transact(shared_ptr< Context > &gpgAgent, const char *command, Error &err)
Definition: readerstatus.cpp:220
void resize(int size)
QString fromLocal8Bit(const char *str, int size)
bool exists() const
QString fromStdString(const std::string &str)
static const std::string scd_getattr_status(shared_ptr< Context > &gpgAgent, const char *what, Error &err)
Definition: readerstatus.cpp:243
bool anyCardCanLearnKeys() const
Definition: readerstatus.cpp:738
static bool parse_keypairinfo_and_lookup_key(Context *ctx, const std::string &kpi)
Definition: readerstatus.cpp:293
Definition: filesystemwatcher.h:45
void startSimpleTransaction(const QByteArray &cmd, QObject *receiver, const char *slot)
Definition: readerstatus.cpp:750
const char * constData() const
QByteArray readAll()
static ReaderStatus::AppType parse_app_type(const std::string &s)
Definition: readerstatus.cpp:193
Definition: classify.h:48
Status cardStatus(unsigned int slot) const
Definition: readerstatus.cpp:730
static const ReaderStatus * instance()
Definition: readerstatus.cpp:726
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
BOOST_STATIC_ASSERT((sizeof flags/sizeof *flags==ReaderStatus::_NumScdStates))
static const std::string gpgagent_data(shared_ptr< Context > &gpgAgent, const char *what, Error &err)
Definition: readerstatus.cpp:280
Definition: readerstatus.h:46
bool anyCardHasNullPin() const
Definition: readerstatus.cpp:734
QString absoluteFilePath(const QString &fileName) const
static ReaderStatus::PinState parse_pin_state(const std::string &s)
Definition: readerstatus.cpp:206
void anyCardHasNullPinChanged(bool)
static CardInfo get_card_status(const QString &fileName, unsigned int idx, shared_ptr< Context > &gpg_agent)
Definition: readerstatus.cpp:309
void cardStatusChanged(unsigned int slot, Kleo::SmartCard::ReaderStatus::Status status)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * parent() const
static std::vector< CardInfo > update_cardinfo(const QString &gnupgHomePath, shared_ptr< Context > &gpgAgent)
Definition: readerstatus.cpp:380
bool exactMatch(const QString &str) const
std::vector< PinState > pinStates(unsigned int slot) const
Definition: readerstatus.cpp:742
uint toUInt(bool *ok, int base) const
static unsigned int get_event_counter(shared_ptr< Context > &gpgAgent)
Definition: readerstatus.cpp:263
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:33:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:33:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.