kleopatra
readerstatus.cpp
Go to the documentation of this file.
175 static QDebug operator<<( QDebug s, const std::vector< std::pair<std::string,std::string> > & v ) {
179 s << "status(" << QString::fromStdString( p.first ) << ") =" << QString::fromStdString( p.second ) << endl;
229 static std::auto_ptr<DefaultAssuanTransaction> gpgagent_transact( shared_ptr<Context> & gpgAgent, const char * command, Error & err ) {
239 kDebug() << "gpgagent_transact(" << command << "):" << QString::fromLocal8Bit( err.asString() );
251 // returns const std::string so template deduction in boost::split works, and we don't need a temporary
252 static const std::string scd_getattr_status( shared_ptr<Context> & gpgAgent, const char * what, Error & err ) {
255 const std::auto_ptr<DefaultAssuanTransaction> t = gpgagent_transact( gpgAgent, cmd.c_str(), err );
274 const std::auto_ptr<DefaultAssuanTransaction> t = gpgagent_transact( gpgAgent, "GETEVENTCOUNTER", err );
288 // returns const std::string so template deduction in boost::split works, and we don't need a temporary
289 static const std::string gpgagent_data( shared_ptr<Context> & gpgAgent, const char * what, Error & err ) {
314 kDebug() << "parse_keypairinfo_and_lookup_key: e=" << e.code() << "; key.isNull()" << key.isNull();
318 static CardInfo get_card_status( const QString & fileName, unsigned int idx, shared_ptr<Context> & gpg_agent ) {
354 for ( std::string::size_type b = 0, e = scd_getattr_status( gpg_agent, "CHV-STATUS", err ).find( ' \t', 0 ) ; e != std::string::npos ; b = e+1, e = scd_getattr_status( gpg_agent, "CHV-STATUS", err ).find( ' \t', b ) )
358 split( chvStatus, scd_getattr_status( gpg_agent, "CHV-STATUS", err ), is_any_of( " \t" ), token_compress_on );
372 const std::auto_ptr<DefaultAssuanTransaction> result = gpgagent_transact( gpg_agent, "SCD LEARN --keypairinfo", err );
385 if ( kdtools::any( keyPairInfos, !boost::bind( &parse_keypairinfo_and_lookup_key, klc.get(), _1 ) ) )
395 static std::vector<CardInfo> update_cardinfo( const QString & gnupgHomePath, shared_ptr<Context> & gpgAgent ) {
403 const CardInfo ci = get_card_status( gnupgHome.absoluteFilePath( QLatin1String( "reader_0.status" ) ), 0, gpgAgent );
410 static bool check_event_counter_changed( shared_ptr<Context> & gpg_agent, unsigned int & counter ) {
494 QStringList files = gnupgHome.entryList( QStringList( QLatin1String( "reader_*.status" ) ), QDir::Files, QDir::Name );
496 kdtools::sort( files, boost::bind( parseFileName, _1, dummy ) < boost::bind( parseFileName, _2, dummy ) );
529 QMetaObject::invokeMethod( t.receiver, t.slot, Qt::DirectConnection, Q_ARG( GpgME::Error, t.error ) );
582 kDebug() << "ReaderStatusThread[2nd]: new iteration command=" << command << " ; nullSlot=" << nullSlot;
592 if ( nullSlot && command == checkTransaction.command && !check_event_counter_changed( gpgAgent, eventCounter ) )
615 kDebug() << "ReaderStatusThread[2nd]: slot" << idx << ":" << prettyFlags[oit->status] << "->" << prettyFlags[nit->status];
765 void ReaderStatus::startSimpleTransaction( const QByteArray & command, QObject * receiver, const char * slot ) {
static unsigned int parse_event_counter(const std::string &str)
Definition: readerstatus.cpp:265
static ReaderStatus * mutableInstance()
Definition: readerstatus.cpp:736
void anyCardCanLearnKeysChanged(bool)
void startMonitoring()
Definition: readerstatus.cpp:731
static bool check_event_counter_changed(shared_ptr< Context > &gpg_agent, unsigned int &counter)
Definition: readerstatus.cpp:410
static unsigned int parseFileName(const QString &fileName, bool *ok)
Definition: readerstatus.cpp:147
ReaderStatus(QObject *parent=0)
Definition: readerstatus.cpp:722
static std::string parse_keypairinfo(const std::string &kpi)
Definition: readerstatus.cpp:297
static std::auto_ptr< DefaultAssuanTransaction > gpgagent_transact(shared_ptr< Context > &gpgAgent, const char *command, Error &err)
Definition: readerstatus.cpp:229
static const std::string scd_getattr_status(shared_ptr< Context > &gpgAgent, const char *what, Error &err)
Definition: readerstatus.cpp:252
bool anyCardCanLearnKeys() const
Definition: readerstatus.cpp:753
static bool parse_keypairinfo_and_lookup_key(Context *ctx, const std::string &kpi)
Definition: readerstatus.cpp:302
Definition: filesystemwatcher.h:45
void startSimpleTransaction(const QByteArray &cmd, QObject *receiver, const char *slot)
Definition: readerstatus.cpp:765
static ReaderStatus::AppType parse_app_type(const std::string &s)
Definition: readerstatus.cpp:194
Definition: classify.h:48
Status cardStatus(unsigned int slot) const
Definition: readerstatus.cpp:745
static const ReaderStatus * instance()
Definition: readerstatus.cpp:741
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:289
Definition: readerstatus.h:46
bool anyCardHasNullPin() const
Definition: readerstatus.cpp:749
static ReaderStatus::PinState parse_pin_state(const std::string &s)
Definition: readerstatus.cpp:215
void anyCardHasNullPinChanged(bool)
static CardInfo get_card_status(const QString &fileName, unsigned int idx, shared_ptr< Context > &gpg_agent)
Definition: readerstatus.cpp:318
void cardStatusChanged(unsigned int slot, Kleo::SmartCard::ReaderStatus::Status status)
static std::vector< CardInfo > update_cardinfo(const QString &gnupgHomePath, shared_ptr< Context > &gpgAgent)
Definition: readerstatus.cpp:395
std::vector< PinState > pinStates(unsigned int slot) const
Definition: readerstatus.cpp:757
static unsigned int get_event_counter(shared_ptr< Context > &gpgAgent)
Definition: readerstatus.cpp:272
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.