kleopatra
keylistmodel.cpp
Go to the documentation of this file.
184 result.erase( std::unique( result.begin(), result.end(), _detail::ByFingerprint<std::equal_to>() ), result.end() );
200 //bind( static_cast<QModelIndex(AbstractKeyListModel::*)(const Key&,int)const>( &AbstractKeyListModel::index ), this, _1, 0 ) );
320 return KeyFilterManager::instance()->font( key, ( column == ShortKeyID ) ? QFont( QLatin1String("courier") ) : QFont() );
323 return column == Icon ? returnIfValid( KeyFilterManager::instance()->icon( key ) ) : QVariant() ;
342 /* reimp */ QModelIndex index( int row, int column, const QModelIndex & pidx=QModelIndex() ) const {
343 return this->hasIndex( row, column, pidx ) ? this->createIndex( row, column, 0 ) : QModelIndex() ;
349 return ( pidx.model() == this || !pidx.isValid() ) && this->rowCount( pidx ) > 0 && this->columnCount( pidx ) > 0 ;
365 /* reimp */ int rowCount( const QModelIndex & pidx ) const { return pidx.isValid() ? 0 : mKeysByFingerprint.size() ; }
439 if ( static_cast<unsigned>( idx.row() ) < mKeysByFingerprint.size() && idx.column() < NumColumns )
458 assert( __gnu_cxx::is_sorted( keys.begin(), keys.end(), _detail::ByFingerprint<std::less>() ) );
463 for ( std::vector<Key>::const_iterator it = keys.begin(), end = keys.end() ; it != end ; ++it ) {
466 const std::vector<Key>::iterator pos = std::upper_bound( mKeysByFingerprint.begin(), mKeysByFingerprint.end(), *it, _detail::ByFingerprint<std::less>() );
469 if ( idx > 0 && qstrcmp( mKeysByFingerprint[idx-1].primaryFingerprint(), it->primaryFingerprint() ) == 0 ) {
537 QModelIndex HierarchicalKeyListModel::index( int row, int col, const QModelIndex & pidx ) const {
588 if ( it == mKeysByExistingParent.end() || static_cast<unsigned>( idx.row() ) >= it->second.size() )
628 const std::vector<Key>::iterator it = std::lower_bound( subjects.begin(), subjects.end(), key, _detail::ByFingerprint<std::less>() );
631 if ( it != subjects.end() && qstricmp( it->primaryFingerprint(), key.primaryFingerprint() ) == 0 ) {
634 emit dataChanged( createIndex( row, 0, const_cast<char*>( issuer_fpr ) ), createIndex( row, NumColumns-1, const_cast<char*>( issuer_fpr ) ) );
637 const std::vector<Key>::const_iterator pos = qBinaryFind( mKeysByFingerprint.begin(), mKeysByFingerprint.end(), issuer_fpr, _detail::ByFingerprint<std::less>() );
645 void HierarchicalKeyListModel::addKeyWithoutParent( const char * issuer_fpr, const Key & key ) {
652 const std::vector<Key>::iterator it = std::lower_bound( subjects.begin(), subjects.end(), key, _detail::ByFingerprint<std::less>() );
654 if ( it != subjects.end() && qstricmp( it->primaryFingerprint(), key.primaryFingerprint() ) == 0 )
667 const std::vector<Key>::iterator it = std::lower_bound( mTopLevels.begin(), mTopLevels.end(), key, _detail::ByFingerprint<std::less>() );
670 if ( it != mTopLevels.end() && qstricmp( it->primaryFingerprint(), key.primaryFingerprint() ) == 0 ) {
715 assert( __gnu_cxx::is_sorted( keys.begin(), keys.end(), _detail::ByFingerprint<std::less>() ) );
740 const bool keyAlreadyExisted = qBinaryFind( oldKeys.begin(), oldKeys.end(), key, _detail::ByFingerprint<std::less>() ) != oldKeys.end();
743 const std::vector<Key> children = it != mKeysByNonExistingParent.end() ? it->second : std::vector<Key>();
758 lastFP = qBinaryFind( lastFP, mKeysByFingerprint.end(), k, _detail::ByFingerprint<std::less>() );
774 else if ( std::binary_search( mKeysByFingerprint.begin(), mKeysByFingerprint.end(), issuer_fpr, _detail::ByFingerprint<std::less>() ) )
799 //emit dataChanged for all parents with new children. This triggers KeyListSortFilterProxyModel to
823 // FIXME for simplicity, we just clear the model and re-add all keys minus the removed one. This is suboptimal,
832 const std::vector<Key>::iterator it = qBinaryFind( mKeysByFingerprint.begin(), mKeysByFingerprint.end(),
844 const std::vector<Key>::iterator tlIt = qBinaryFind( mTopLevels.begin(), mTopLevels.end(), key, _detail::ByFingerprint<std::less>() );
851 const std::vector<Key>::iterator eit = qBinaryFind( nexIt->second.begin(), nexIt->second.end(), key, _detail::ByFingerprint<std::less>() );
860 const std::vector<Key>::iterator eit = qBinaryFind( exIt->second.begin(), exIt->second.end(), key, _detail::ByFingerprint<std::less>() );
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: keylistmodel.cpp:274
QModelIndex addKey(const GpgME::Key &key)
Definition: keylistmodel.cpp:210
int columnCount(const QModelIndex &pidx) const
Definition: keylistmodel.cpp:239
QString type(const GpgME::Key &key)
void reserve(int alloc)
QString creationDateString(const GpgME::Key &key)
QList< QModelIndex > indexes(const std::vector< GpgME::Key > &keys) const
Definition: keylistmodel.cpp:195
QString toolTip(const GpgME::Key &key, int opts)
void setToolTipOptions(int opts)
Definition: keylistmodel.cpp:161
QString expirationDateString(const GpgME::Key &key)
int size() const
~AbstractKeyListModel()
Definition: keylistmodel.cpp:159
static AbstractKeyListModel * createHierarchicalKeyListModel(QObject *parent=0)
Definition: keylistmodel.cpp:880
QString formatForComboBox(const GpgME::Key &key)
Definition: formatting.cpp:497
void reset()
bool isValid() const
bool empty() const
QModelIndex index(const GpgME::Key &key) const
Definition: keylistmodel.h:62
static std::vector< Key > topological_sort(const std::vector< Key > &keys)
Definition: keylistmodel.cpp:684
int row() const
QDate expirationDate(const GpgME::Key &key)
void * internalPointer() const
T & front()
Definition: commands/command.h:46
QModelIndex parent() const
QList< QModelIndex > addKeys(const std::vector< GpgME::Key > &keys)
Definition: keylistmodel.cpp:223
QString prettyEMail(const char *email, const char *id)
Definition: formatting.cpp:184
Definition: keylistmodel.h:49
iterator end()
int toolTipOptions() const
defines which information is displayed in tooltips see Kleo::Formatting::ToolTipOption ...
Definition: keylistmodel.cpp:166
const QAbstractItemModel * model() const
QDate creationDate(const GpgME::Key &key)
QVariant headerData(int section, Qt::Orientation o, int role=Qt::DisplayRole) const
Definition: keylistmodel.cpp:243
Definition: modeltest.h:31
bool isNull() const
QModelIndex sibling(int row, int column) const
GpgME::Key key(const QModelIndex &idx) const
Definition: keylistmodel.cpp:171
std::vector< GpgME::Key > keys(const QList< QModelIndex > &indexes) const
Definition: keylistmodel.cpp:178
QString prettyName(int proto, const char *id, const char *name, const char *comment)
Definition: formatting.cpp:64
static AbstractKeyListModel * createFlatKeyListModel(QObject *parent=0)
Definition: keylistmodel.cpp:871
static const int FingerprintRole
Definition: keylistmodelinterface.h:51
void removeKey(const GpgME::Key &key)
Definition: keylistmodel.cpp:216
int column() const
Definition: formatting.h:69
QString fromLatin1(const char *str, int size)
void setKeys(const std::vector< GpgME::Key > &keys)
Definition: keylistmodel.cpp:205
iterator begin()
bool isValid() const
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.