[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/kleopatra/models
From:       Marc Mutz <mutz () kde ! org>
Date:       2008-04-21 15:07:24
Message-ID: 1208790444.060066.6114.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 799441 by mutz:

Split KeyListSortFilterProxyModel -> {Abstract,}KeySortFilterProxyModel

 M  +39 -30    keylistsortfilterproxymodel.cpp  
 M  +13 -6     keylistsortfilterproxymodel.h  


--- trunk/KDE/kdepim/kleopatra/models/keylistsortfilterproxymodel.cpp #799440:799441
@@ -49,20 +49,8 @@
 using namespace boost;
 using namespace GpgME;
 
-class KeyListSortFilterProxyModel::Private {
-    friend class ::Kleo::KeyListSortFilterProxyModel;
-public:
-    explicit Private()
-        : keyFilter() {}
-    ~Private() {}
-
-private:
-    shared_ptr<const KeyFilter> keyFilter;
-};
-
-
-KeyListSortFilterProxyModel::KeyListSortFilterProxyModel( QObject * p )
-    : QSortFilterProxyModel( p ), KeyListModelInterface(), d( new Private )
+AbstractKeyListSortFilterProxyModel::AbstractKeyListSortFilterProxyModel( QObject * \
p ) +    : QSortFilterProxyModel( p ), KeyListModelInterface()
 {
     setDynamicSortFilter( true );
     setSortRole( Qt::EditRole );  // EditRole can be expected to be in a less \
formatted way, better for sorting @@ -70,20 +58,9 @@
     setFilterCaseSensitivity( Qt::CaseInsensitive );
 }
 
-KeyListSortFilterProxyModel::~KeyListSortFilterProxyModel() {}
+AbstractKeyListSortFilterProxyModel::~AbstractKeyListSortFilterProxyModel() {}
 
-shared_ptr<const KeyFilter> KeyListSortFilterProxyModel::keyFilter() const {
-    return d->keyFilter;
-}
-
-void KeyListSortFilterProxyModel::setKeyFilter( const shared_ptr<const KeyFilter> & \
                kf ) {
-    if ( kf == d->keyFilter )
-        return;
-    d->keyFilter = kf;
-    invalidateFilter();
-}
-
-Key KeyListSortFilterProxyModel::key( const QModelIndex & idx ) const {
+Key AbstractKeyListSortFilterProxyModel::key( const QModelIndex & idx ) const {
     const KeyListModelInterface * const klmi = dynamic_cast<KeyListModelInterface*>( \
sourceModel() );  if ( !klmi ) {
         static Key null;
@@ -92,7 +69,7 @@
     return klmi->key( mapToSource( idx ) );
 }
 
-std::vector<Key> KeyListSortFilterProxyModel::keys( const QList<QModelIndex> & \
indexes ) const { +std::vector<Key> AbstractKeyListSortFilterProxyModel::keys( const \
                QList<QModelIndex> & indexes ) const {
     const KeyListModelInterface * const klmi = dynamic_cast<KeyListModelInterface*>( \
sourceModel() );  if ( !klmi )
         return std::vector<Key>();
@@ -103,14 +80,14 @@
     return klmi->keys( mapped );
 }
 
-QModelIndex KeyListSortFilterProxyModel::index( const Key & key ) const {
+QModelIndex AbstractKeyListSortFilterProxyModel::index( const Key & key ) const {
     if ( const KeyListModelInterface * const klmi = \
dynamic_cast<KeyListModelInterface*>( sourceModel() ) )  return mapFromSource( \
klmi->index( key ) );  else
         return QModelIndex();
 }
 
-QList<QModelIndex> KeyListSortFilterProxyModel::indexes( const std::vector<Key> & \
keys ) const { +QList<QModelIndex> AbstractKeyListSortFilterProxyModel::indexes( \
                const std::vector<Key> & keys ) const {
     if ( const KeyListModelInterface * const klmi = \
dynamic_cast<KeyListModelInterface*>( sourceModel() ) ) {  const QList<QModelIndex> \
source = klmi->indexes( keys );  QList<QModelIndex> mapped;
@@ -123,6 +100,38 @@
     }
 }
 
+
+class KeyListSortFilterProxyModel::Private {
+    friend class ::Kleo::KeyListSortFilterProxyModel;
+public:
+    explicit Private()
+        : keyFilter() {}
+    ~Private() {}
+
+private:
+    shared_ptr<const KeyFilter> keyFilter;
+};
+
+
+KeyListSortFilterProxyModel::KeyListSortFilterProxyModel( QObject * p )
+    : AbstractKeyListSortFilterProxyModel( p ), d( new Private )
+{
+
+}
+
+KeyListSortFilterProxyModel::~KeyListSortFilterProxyModel() {}
+
+shared_ptr<const KeyFilter> KeyListSortFilterProxyModel::keyFilter() const {
+    return d->keyFilter;
+}
+
+void KeyListSortFilterProxyModel::setKeyFilter( const shared_ptr<const KeyFilter> & \
kf ) { +    if ( kf == d->keyFilter )
+        return;
+    d->keyFilter = kf;
+    invalidateFilter();
+}
+
 bool KeyListSortFilterProxyModel::filterAcceptsRow( int source_row, const \
QModelIndex & source_parent ) const {  
     //
--- trunk/KDE/kdepim/kleopatra/models/keylistsortfilterproxymodel.h #799440:799441
@@ -48,22 +48,29 @@
     class AbstractKeyListModel;
     class KeyFilter;
 
-    class KeyListSortFilterProxyModel : public QSortFilterProxyModel, public \
KeyListModelInterface { +    class AbstractKeyListSortFilterProxyModel : public \
QSortFilterProxyModel, public KeyListModelInterface {  Q_OBJECT
     public:
-	explicit KeyListSortFilterProxyModel( QObject * parent=0 );
-	~KeyListSortFilterProxyModel();
+	explicit AbstractKeyListSortFilterProxyModel( QObject * parent=0 );
+	~AbstractKeyListSortFilterProxyModel() = 0;
 
-	boost::shared_ptr<const KeyFilter> keyFilter() const;
-	void setKeyFilter( const boost::shared_ptr<const KeyFilter> & kf );
-	
         /* reimp */ GpgME::Key key( const QModelIndex & idx ) const;
         /* reimp */ std::vector<GpgME::Key> keys( const QList<QModelIndex> & indexes \
) const;  
         using QAbstractItemModel::index;
         /* reimp */ QModelIndex index( const GpgME::Key & key ) const;
         /* reimp */ QList<QModelIndex> indexes( const std::vector<GpgME::Key> & keys \
) const; +    };
 
+    class KeyListSortFilterProxyModel : public AbstractKeyListSortFilterProxyModel {
+	Q_OBJECT
+    public:
+	explicit KeyListSortFilterProxyModel( QObject * parent=0 );
+	~KeyListSortFilterProxyModel();
+
+	boost::shared_ptr<const KeyFilter> keyFilter() const;
+	void setKeyFilter( const boost::shared_ptr<const KeyFilter> & kf );
+	
     protected:
 	/* reimp */ bool filterAcceptsRow( int source_row, const QModelIndex & \
source_parent ) const;  


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic