hgcacheproxymodel/src/hgcacheproxymodel.cpp
changeset 2 49c70dcc3f17
parent 1 e48454f237ca
child 3 c863538fcbb6
equal deleted inserted replaced
1:e48454f237ca 2:49c70dcc3f17
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 *  Version     : %version: 2 %
    16 *  Version     : %version: 7 %
    17 */
    17 */
    18 #include <QList>
    18 #include <QList>
    19 #include <QAbstractItemModel>
    19 #include <QAbstractItemModel>
    20 
    20 
    21 #include <hgwidgets/hgcacheproxymodel.h>
    21 #include <hgwidgets/hgcacheproxymodel.h>
    25 
    25 
    26 
    26 
    27 
    27 
    28 
    28 
    29 
    29 
    30 Q_DECL_EXPORT HgCacheProxyModel::HgCacheProxyModel(QObject *parent):
    30 HgCacheProxyModel::HgCacheProxyModel(QObject *parent):
    31 QAbstractItemModel(parent),
    31     QAbstractItemModel(parent),
    32 mBufferManager(0),
    32     mBufferManager(0),
    33 mSortFilterProxyModel(new QSortFilterProxyModel(this)),
    33     mSortFilterProxyModel(new QSortFilterProxyModel(this)),
    34 mDataProviderModel(0),
    34     mDataProviderModel(0),
    35 mResetNeeded(false),
    35     mSupressBM(false),
    36 mSupressBM(false),
    36     mCurrentPos(0)//,
    37 mSortParameterChanged(true),
    37 //    mSortParameterChanged(true)
    38 mFilterParameterChanged(true)
    38 {
    39 {
    39     TX_ENTRY
    40     connect(mSortFilterProxyModel, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),
    40     connect(mSortFilterProxyModel, SIGNAL(columnsAboutToBeInserted(const QModelIndex&, int, int)),
    41             this, SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)));
    41             this, SLOT(sourceColumnsAboutToBeInserted(const QModelIndex&, int, int)));
       
    42     connect(mSortFilterProxyModel, SIGNAL(columnsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int)),
       
    43             this, SLOT(sourceColumnsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int)));
       
    44     connect(mSortFilterProxyModel, SIGNAL(columnsAboutToBeRemoved(const QModelIndex&, int, int)),
       
    45             this, SLOT(sourceColumnsAboutToBeRemoved(const QModelIndex&, int, int)));
    42     
    46     
    43     connect(mSortFilterProxyModel, SIGNAL(columnsAboutToBeMoved(QModelIndex, int, int, QModelIndex, int)),
    47     connect(mSortFilterProxyModel, SIGNAL(columnsInserted(const QModelIndex&, int, int)),
    44             this, SIGNAL(columnsAboutToBeMoved(QModelIndex, int, int, QModelIndex, int)));    
    48             this, SLOT(sourceColumnsInserted(const QModelIndex&, int, int)));
    45     
    49     connect(mSortFilterProxyModel, SIGNAL(columnsMoved(const QModelIndex&, int, int, const QModelIndex&, int)),
    46     connect(mSortFilterProxyModel, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
    50             this, SLOT(sourceColumnsMoved(const QModelIndex&, int, int, const QModelIndex&, int)));
    47             this, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)));    
    51     connect(mSortFilterProxyModel, SIGNAL(columnsRemoved(const QModelIndex&, int, int )),
    48     
    52             this, SLOT(sourceColumnsRemoved(const QModelIndex&, int, int )));
    49     connect(mSortFilterProxyModel, SIGNAL(columnsInserted(QModelIndex,int,int)),
    53     connect(mSortFilterProxyModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
    50             this, SIGNAL(columnsInserted(QModelIndex,int,int)));
    54             this, SLOT(sourceDataChanged(const QModelIndex&, const QModelIndex&)));
    51     
    55     connect(mSortFilterProxyModel, SIGNAL(headerDataChanged(Qt::Orientation, int, int)),
    52     connect(mSortFilterProxyModel, SIGNAL(columnsMoved(QModelIndex, int, int, QModelIndex, int)),
    56             this, SLOT(sourceHeaderDataChanged(Qt::Orientation, int, int)));
    53             this, SIGNAL(columnsMoved(QModelIndex, int, int, QModelIndex, int)));
       
    54     
       
    55     connect(mSortFilterProxyModel, SIGNAL(columnsRemoved(QModelIndex,int,int)),
       
    56             this, SIGNAL(columnsRemoved(QModelIndex,int,int)));
       
    57     
       
    58     connect(mSortFilterProxyModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
       
    59             this, SLOT(dataUpdated(QModelIndex,QModelIndex)));
       
    60     
       
    61     connect(mSortFilterProxyModel, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
       
    62             this, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
       
    63     
       
    64     connect(mSortFilterProxyModel, SIGNAL(layoutAboutToBeChanged()),
    57     connect(mSortFilterProxyModel, SIGNAL(layoutAboutToBeChanged()),
    65             this, SIGNAL(layoutAboutToBeChanged()));
    58             this, SLOT(sourceLayoutAboutToBeChanged()));
    66     
    59     connect(mSortFilterProxyModel, SIGNAL(layoutChanged()),
    67     connect(mSortFilterProxyModel, SIGNAL(layoutChanged()), 
    60             this, SLOT(sourceLayoutChanged()));
    68             this, SIGNAL(layoutChanged()));
    61     connect(mSortFilterProxyModel, SIGNAL(modelAboutToBeReset()),
    69     
    62             this, SLOT(sourceModelAboutToBeReset()));
    70     connect(mSortFilterProxyModel, SIGNAL(modelAboutToBeReset()), 
    63     connect(mSortFilterProxyModel, SIGNAL(modelReset()),
    71             this, SLOT(sourceAboutToBeReset()));
    64             this, SLOT(sourceModelReset()));
    72     
    65     connect(mSortFilterProxyModel, SIGNAL(rowsAboutToBeInserted(const QModelIndex&, int, int)),
    73     connect(mSortFilterProxyModel, SIGNAL(modelReset()), 
    66             this, SLOT(sourceRowsAboutToBeInserted(const QModelIndex&, int, int)));
    74             this, SLOT(sourceReset()));    
    67     connect(mSortFilterProxyModel, SIGNAL(rowsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int)),
    75     
    68             this, SLOT(sourceRowsAboutToBeMoved(const QModelIndex&, int, int, const QModelIndex&, int)));
    76     connect(mSortFilterProxyModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
    69     connect(mSortFilterProxyModel, SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)),
    77             this, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
    70             this, SLOT(sourceRowsAboutToBeRemoved(const QModelIndex&, int, int)));
    78     
    71     connect(mSortFilterProxyModel, SIGNAL(rowsInserted(const QModelIndex &, int , int)),
    79     connect(mSortFilterProxyModel, SIGNAL(rowsAboutToBeMoved(QModelIndex, int, int, QModelIndex, int)),
    72             this, SLOT(sourceRowsInserted(const QModelIndex &, int , int)));
    80             this, SIGNAL(rowsAboutToBeMoved(QModelIndex, int, int, QModelIndex, int)));
    73     connect(mSortFilterProxyModel, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex&, int)),
    81     
    74             this, SLOT(sourceRowsMoved(const QModelIndex &, int, int, const QModelIndex&, int)));
    82     connect(mSortFilterProxyModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
    75     connect(mSortFilterProxyModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
    83             this, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)));
    76             this, SLOT(sourceRowsRemoved(const QModelIndex&, int, int)));
    84     
    77 
    85     connect(mSortFilterProxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
    78     TX_EXIT
    86             this, SIGNAL(rowsInserted(QModelIndex,int,int)));
    79 }
    87     
    80 
    88     connect(mSortFilterProxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
    81 HgCacheProxyModel::~HgCacheProxyModel()
    89             this, SLOT(sourceRowsInserted(QModelIndex,int,int)));
    82 {
    90     
    83     TX_ENTRY
    91     connect(mSortFilterProxyModel, SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)),
       
    92             this, SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)));
       
    93     
       
    94     connect(mSortFilterProxyModel, SIGNAL(rowsRemoved(QModelIndex,int,int)),
       
    95             this, SIGNAL(rowsRemoved(QModelIndex,int,int)));
       
    96     
       
    97     connect(mSortFilterProxyModel, SIGNAL(rowsRemoved(QModelIndex,int,int)),
       
    98             this, SLOT(sourceRowsRemoved(QModelIndex,int,int)));
       
    99 }
       
   100 
       
   101 Q_DECL_EXPORT HgCacheProxyModel::~HgCacheProxyModel()
       
   102 {
       
   103     delete mBufferManager;
    84     delete mBufferManager;
   104 }
    85     TX_EXIT    
   105 
    86 }
   106 Q_DECL_EXPORT void HgCacheProxyModel::setDataProvider(HgDataProviderModel *dataProvider, int cacheSize, int cacheTreshold)
    87 
       
    88 void HgCacheProxyModel::setDataProvider(HgDataProviderModel *dataProvider, int cacheSize, int cacheTreshold)
   107 {
    89 {
   108     TX_ENTRY
    90     TX_ENTRY
   109     mDataProviderModel = dataProvider;
    91     mDataProviderModel = dataProvider;
   110     mSortFilterProxyModel->setSourceModel(mDataProviderModel);
    92     mSortFilterProxyModel->setSourceModel(mDataProviderModel);
   111     if (mDataProviderModel){
    93     if (mDataProviderModel){
   112         mDataProviderModel->registerObserver(this);
    94         mDataProviderModel->registerObserver(this);
   113         mDataProviderModel->resizeQPixmapPool(cacheSize);
    95 
   114 
    96         mSupressBM = true;
   115         delete mBufferManager;
    97         resizeCache(cacheSize, cacheTreshold);
   116         mBufferManager = NULL;
    98         mSupressBM = false;
   117         mBufferManager = new HgBufferManager(this, cacheSize, cacheTreshold, 0, count() );
    99 
       
   100         if (mBufferManager == NULL){
       
   101             mBufferManager = new HgBufferManager(this, cacheSize, cacheTreshold, 0, count() );
       
   102         } else {
       
   103             mBufferManager->resetBuffer(0, count());
       
   104         }
       
   105         
       
   106 
   118     }
   107     }
   119     TX_EXIT    
   108     TX_EXIT    
   120 }
   109 }
   121 
   110 
   122 Q_DECL_EXPORT HgDataProviderModel* HgCacheProxyModel::DataProvider()
   111 HgDataProviderModel* HgCacheProxyModel::DataProvider()
   123 {
   112 {
   124     return mDataProviderModel;
   113     return mDataProviderModel;
   125 }
   114 }
   126 
   115 
   127 Q_DECL_EXPORT void HgCacheProxyModel::resizeCache(int newSize, int newTreshold)
   116 void HgCacheProxyModel::resizeCache(int newSize, int newTreshold)
   128 {
   117 {
   129     TX_ENTRY
   118     TX_ENTRY
   130     if (mDataProviderModel)
   119     if (mDataProviderModel)
   131         mDataProviderModel->resizeQPixmapPool(newSize);
   120         mDataProviderModel->resizeQPixmapPool(newSize);
   132     if (mBufferManager)
   121     if (mBufferManager)
   133         mBufferManager->resizeCache( newSize, newTreshold );
   122         mBufferManager->resizeCache( newSize, newTreshold );
   134     TX_EXIT    
   123     TX_EXIT    
   135 }
   124 }
   136 
   125 
   137 Q_DECL_EXPORT QModelIndex HgCacheProxyModel::index(int row, int column, const QModelIndex &parent) const
   126 QModelIndex HgCacheProxyModel::index(int row, int column, const QModelIndex &parent) const
   138 {
   127 {
   139     Q_UNUSED(parent);
   128     Q_UNUSED(parent);
   140     if (  row >= rowCount() ){
   129     if (  row >= rowCount() ){
   141         row = -1;
   130         row = -1;
   142     }
   131     }
   145     }
   134     }
   146     
   135     
   147     return QAbstractItemModel::createIndex(row, column); 
   136     return QAbstractItemModel::createIndex(row, column); 
   148 }
   137 }
   149 
   138 
   150 Q_DECL_EXPORT QModelIndex HgCacheProxyModel::parent(const QModelIndex &child) const
   139 QModelIndex HgCacheProxyModel::parent(const QModelIndex &child) const
   151 {
   140 {
   152     return mSortFilterProxyModel->parent(mapToSource(child));
   141     return mSortFilterProxyModel->parent(mapToSource(child));
   153 }
   142 }
   154 
   143 
   155 Q_DECL_EXPORT int HgCacheProxyModel::rowCount(const QModelIndex &parent) const
   144 int HgCacheProxyModel::rowCount(const QModelIndex &parent) const
   156 {
   145 {
   157     return mSortFilterProxyModel->rowCount(mapToSource(parent));
   146     return mSortFilterProxyModel->rowCount(mapToSource(parent));
   158 }
   147 }
   159 
   148 
   160 Q_DECL_EXPORT int HgCacheProxyModel::columnCount(const QModelIndex &parent) const
   149 int HgCacheProxyModel::columnCount(const QModelIndex &parent) const
   161 {
   150 {
   162     return mSortFilterProxyModel->columnCount(mapToSource(parent));
   151     return mSortFilterProxyModel->columnCount(mapToSource(parent));
   163 }
   152 }
   164 
   153 
   165 Q_DECL_EXPORT bool HgCacheProxyModel::hasChildren(const QModelIndex &parent) const
   154 bool HgCacheProxyModel::hasChildren(const QModelIndex &parent) const
   166 {
   155 {
   167     return mSortFilterProxyModel->hasChildren(mapToSource(parent));
   156     return mSortFilterProxyModel->hasChildren(mapToSource(parent));
   168 }
   157 }
   169 
   158 
   170 Q_DECL_EXPORT QVariant HgCacheProxyModel::data(const QModelIndex &index, int role) const
   159 QVariant HgCacheProxyModel::data(const QModelIndex &index, int role) const
   171 {    
   160 {    
   172     setBufferPosition(index.row());
   161     setBufferPosition(index.row());
   173     QVariant res = mSortFilterProxyModel->data(mapToSource(index), role);
   162     QVariant res = mSortFilterProxyModel->data(mapToSource(index), role);
   174     return res;
   163     return res;
   175 }
   164 }
   176 
   165 
   177 Q_DECL_EXPORT bool HgCacheProxyModel::setData(const QModelIndex &index, const QVariant &value, int role)
   166 bool HgCacheProxyModel::setData(const QModelIndex &index, const QVariant &value, int role)
   178 {
   167 {
   179     return mSortFilterProxyModel->setData(mapToSource(index), value, role);
   168     return mSortFilterProxyModel->setData(mapToSource(index), value, role);
   180 }
   169 }
   181 
   170 
   182 Q_DECL_EXPORT QVariant HgCacheProxyModel::headerData(int section, Qt::Orientation orientation, int role) const
   171 QVariant HgCacheProxyModel::headerData(int section, Qt::Orientation orientation, int role) const
   183 {
   172 {
   184     return mSortFilterProxyModel->headerData(section, orientation, role);
   173     return mSortFilterProxyModel->headerData(section, orientation, role);
   185 }
   174 }
   186 
   175 
   187 Q_DECL_EXPORT bool HgCacheProxyModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role)
   176 bool HgCacheProxyModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role)
   188 {
   177 {
   189     return mSortFilterProxyModel->setHeaderData(section, orientation, value, role);
   178     return mSortFilterProxyModel->setHeaderData(section, orientation, value, role);
   190 }
   179 }
   191 
   180 
   192 Q_DECL_EXPORT QMap<int, QVariant> HgCacheProxyModel::itemData(const QModelIndex &index) const
   181 QMap<int, QVariant> HgCacheProxyModel::itemData(const QModelIndex &index) const
   193 {
   182 {
   194     setBufferPosition(index.row());
   183     setBufferPosition(index.row());
   195     return mSortFilterProxyModel->itemData(mapToSource(index));
   184     return mSortFilterProxyModel->itemData(mapToSource(index));
   196 }
   185 }
   197 
   186 
   198 Q_DECL_EXPORT bool HgCacheProxyModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles)
   187 bool HgCacheProxyModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles)
   199 {
   188 {
   200     return mSortFilterProxyModel->setItemData(mapToSource(index), roles);
   189     return mSortFilterProxyModel->setItemData(mapToSource(index), roles);
   201 }
   190 }
   202 
   191 
   203 Q_DECL_EXPORT QStringList HgCacheProxyModel::mimeTypes() const
   192 QStringList HgCacheProxyModel::mimeTypes() const
   204 {
   193 {
   205     return mSortFilterProxyModel->mimeTypes();
   194     return mSortFilterProxyModel->mimeTypes();
   206 }
   195 }
   207 
   196 
   208 Q_DECL_EXPORT QMimeData *HgCacheProxyModel::mimeData(const QModelIndexList &indexes) const
   197 QMimeData *HgCacheProxyModel::mimeData(const QModelIndexList &indexes) const
   209 {
   198 {
   210     QModelIndexList list;
   199     QModelIndexList list;
   211     for ( int i=0; i < indexes.count(); i++){
   200     for ( int i=0; i < indexes.count(); i++){
   212         list.append(mapToSource(indexes[i]));
   201         list.append(mapToSource(indexes[i]));
   213     }
   202     }
   214     return mSortFilterProxyModel->mimeData(list);
   203     return mSortFilterProxyModel->mimeData(list);
   215 }
   204 }
   216 
   205 
   217 Q_DECL_EXPORT bool HgCacheProxyModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
   206 bool HgCacheProxyModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
   218 {
   207 {
   219     return mSortFilterProxyModel->dropMimeData(data, action, row, column, mapToSource(parent));
   208     return mSortFilterProxyModel->dropMimeData(data, action, row, column, mapToSource(parent));
   220 }
   209 }
   221 
   210 
   222 Q_DECL_EXPORT Qt::DropActions HgCacheProxyModel::supportedDropActions() const
   211 Qt::DropActions HgCacheProxyModel::supportedDropActions() const
   223 {
   212 {
   224     return mSortFilterProxyModel->supportedDropActions();
   213     return mSortFilterProxyModel->supportedDropActions();
   225 }
   214 }
   226 
   215 
   227 Q_DECL_EXPORT bool HgCacheProxyModel::insertRows(int row, int count, const QModelIndex &parent)
   216 bool HgCacheProxyModel::insertRows(int row, int count, const QModelIndex &parent)
   228 {
   217 {
   229     return mSortFilterProxyModel->insertRows(row, count, mapToSource(parent));
   218     return mSortFilterProxyModel->insertRows(row, count, mapToSource(parent));
   230 }
   219 }
   231 
   220 
   232 Q_DECL_EXPORT bool HgCacheProxyModel::insertColumns(int column, int count, const QModelIndex &parent)
   221 bool HgCacheProxyModel::insertColumns(int column, int count, const QModelIndex &parent)
   233 {
   222 {
   234     return mSortFilterProxyModel->insertColumns(column, count, mapToSource(parent));
   223     return mSortFilterProxyModel->insertColumns(column, count, mapToSource(parent));
   235 }
   224 }
   236 
   225 
   237 Q_DECL_EXPORT bool HgCacheProxyModel::removeRows(int row, int count, const QModelIndex &parent)
   226 bool HgCacheProxyModel::removeRows(int row, int count, const QModelIndex &parent)
   238 {
   227 {
   239     return mSortFilterProxyModel->removeRows(row, count, mapToSource(parent));
   228     return mSortFilterProxyModel->removeRows(row, count, mapToSource(parent));
   240 }
   229 }
   241 
   230 
   242 Q_DECL_EXPORT bool HgCacheProxyModel::removeColumns(int column, int count, const QModelIndex &parent)
   231 bool HgCacheProxyModel::removeColumns(int column, int count, const QModelIndex &parent)
   243 {
   232 {
   244     return mSortFilterProxyModel->removeColumns(column, count, mapToSource(parent));
   233     return mSortFilterProxyModel->removeColumns(column, count, mapToSource(parent));
   245 }
   234 }
   246 
   235 
   247 Q_DECL_EXPORT void HgCacheProxyModel::fetchMore(const QModelIndex &parent)
   236 void HgCacheProxyModel::fetchMore(const QModelIndex &parent)
   248 {
   237 {
   249     mSortFilterProxyModel->fetchMore(mapToSource(parent));
   238     mSortFilterProxyModel->fetchMore(mapToSource(parent));
   250 }
   239 }
   251 
   240 
   252 Q_DECL_EXPORT bool HgCacheProxyModel::canFetchMore(const QModelIndex &parent) const
   241 bool HgCacheProxyModel::canFetchMore(const QModelIndex &parent) const
   253 {
   242 {
   254     return mSortFilterProxyModel->canFetchMore(mapToSource(parent));
   243     return mSortFilterProxyModel->canFetchMore(mapToSource(parent));
   255 }        
   244 }        
   256 
   245 
   257 Q_DECL_EXPORT Qt::ItemFlags HgCacheProxyModel::flags(const QModelIndex &index) const
   246 Qt::ItemFlags HgCacheProxyModel::flags(const QModelIndex &index) const
   258 {
   247 {
   259     return mSortFilterProxyModel->flags(mapToSource(index));
   248     return mSortFilterProxyModel->flags(mapToSource(index));
   260 }
   249 }
   261 
   250 
   262 Q_DECL_EXPORT void HgCacheProxyModel::sort(int column, Qt::SortOrder order)
   251 void HgCacheProxyModel::sort(int column, Qt::SortOrder order)
   263 {
   252 {
   264     if ( mSortParameterChanged || (sortColumn() != column) || (sortOrder() != order) ){
   253     mSupressBM = true;
   265         mSortParameterChanged = false;
   254     cleanupForBMReset();
   266         mResetNeeded = true;
   255     mSortFilterProxyModel->sort(column, order);
   267         cleanupForBMResetIfNeeded();
   256     resetBM();
   268         mSortFilterProxyModel->sort(column, order);
   257 }
   269         resetBMIfNeeded();
   258 
   270     }
   259 QModelIndex HgCacheProxyModel::buddy(const QModelIndex &index) const
   271 }
       
   272 
       
   273 Q_DECL_EXPORT QModelIndex HgCacheProxyModel::buddy(const QModelIndex &index) const
       
   274 {
   260 {
   275     return mSortFilterProxyModel->buddy(mapToSource(index));
   261     return mSortFilterProxyModel->buddy(mapToSource(index));
   276 }
   262 }
   277 
   263 
   278 Q_DECL_EXPORT QModelIndexList HgCacheProxyModel::match(const QModelIndex &start, int role,
   264 QModelIndexList HgCacheProxyModel::match(const QModelIndex &start, int role,
   279                               const QVariant &value, int hits,
   265                               const QVariant &value, int hits,
   280                               Qt::MatchFlags flags) const
   266                               Qt::MatchFlags flags) const
   281 {
   267 {
   282     return mSortFilterProxyModel->match(mapToSource(start), role, value, hits, flags);
   268     return mSortFilterProxyModel->match(mapToSource(start), role, value, hits, flags);
   283 }
   269 }
   284 
   270 
   285 Q_DECL_EXPORT QSize HgCacheProxyModel::span(const QModelIndex &index) const
   271 QSize HgCacheProxyModel::span(const QModelIndex &index) const
   286 {
   272 {
   287     return mSortFilterProxyModel->span(mapToSource(index));
   273     return mSortFilterProxyModel->span(mapToSource(index));
   288 }
   274 }
   289 
   275 
   290 Q_DECL_EXPORT Qt::CaseSensitivity HgCacheProxyModel::sortCaseSensitivity() const
   276 Qt::CaseSensitivity HgCacheProxyModel::sortCaseSensitivity() const
   291 {
   277 {
   292     return mSortFilterProxyModel->sortCaseSensitivity();
   278     return mSortFilterProxyModel->sortCaseSensitivity();
   293 }
   279 }
   294 
   280 
   295 Q_DECL_EXPORT void HgCacheProxyModel::setSortCaseSensitivity(Qt::CaseSensitivity cs)
   281 void HgCacheProxyModel::setSortCaseSensitivity(Qt::CaseSensitivity cs)
   296 {
   282 {
   297     if (sortCaseSensitivity() != cs){
   283     if (sortCaseSensitivity() != cs){
   298         mSortParameterChanged = true;
   284         mSupressBM = true;
   299         cleanupForBMResetIfNeeded();
   285         cleanupForBMReset();
   300         mSortFilterProxyModel->setSortCaseSensitivity(cs);
   286         mSortFilterProxyModel->setSortCaseSensitivity(cs);
   301         resetBMIfNeeded();    
   287         resetBM();    
   302     }
   288     }
   303 }
   289 }
   304 
   290 
   305 Q_DECL_EXPORT bool HgCacheProxyModel::isSortLocaleAware() const
   291 bool HgCacheProxyModel::isSortLocaleAware() const
   306 {
   292 {
   307     return mSortFilterProxyModel->isSortLocaleAware();
   293     return mSortFilterProxyModel->isSortLocaleAware();
   308 }
   294 }
   309 
   295 
   310 Q_DECL_EXPORT void HgCacheProxyModel::setSortLocaleAware(bool on)
   296 void HgCacheProxyModel::setSortLocaleAware(bool on)
   311 {
   297 {
   312     if (isSortLocaleAware() != on){
   298     if (isSortLocaleAware() != on){
   313         mSortParameterChanged = true;    
   299         mSupressBM = true;    
   314         cleanupForBMResetIfNeeded();
   300         cleanupForBMReset();
   315         mSortFilterProxyModel->setSortLocaleAware(on);
   301         mSortFilterProxyModel->setSortLocaleAware(on);
   316         resetBMIfNeeded();    
   302         resetBM();    
   317     }
   303     }
   318 }
   304 }
   319 
   305 
   320 Q_DECL_EXPORT int HgCacheProxyModel::sortColumn() const
   306 int HgCacheProxyModel::sortColumn() const
   321 {
   307 {
   322     return mSortFilterProxyModel->sortColumn();
   308     return mSortFilterProxyModel->sortColumn();
   323 }
   309 }
   324 
   310 
   325 Q_DECL_EXPORT Qt::SortOrder HgCacheProxyModel::sortOrder() const
   311 Qt::SortOrder HgCacheProxyModel::sortOrder() const
   326 {
   312 {
   327     return mSortFilterProxyModel->sortOrder();
   313     return mSortFilterProxyModel->sortOrder();
   328 }
   314 }
   329 
   315 
   330 Q_DECL_EXPORT bool HgCacheProxyModel::dynamicSortFilter() const
   316 bool HgCacheProxyModel::dynamicSortFilter() const
   331 {
   317 {
   332     return mSortFilterProxyModel->dynamicSortFilter();
   318     return mSortFilterProxyModel->dynamicSortFilter();
   333 }
   319 }
   334 
   320 
   335 Q_DECL_EXPORT void HgCacheProxyModel::setDynamicSortFilter(bool enable)
   321 void HgCacheProxyModel::setDynamicSortFilter(bool enable)
   336 {
   322 {
   337     if (dynamicSortFilter() != enable){
   323     if (dynamicSortFilter() != enable){
   338         mSortParameterChanged = true;   
   324         mSupressBM = true;   
   339         mFilterParameterChanged = true;
   325         cleanupForBMReset();
   340         cleanupForBMResetIfNeeded();
       
   341         mSortFilterProxyModel->setDynamicSortFilter(enable);
   326         mSortFilterProxyModel->setDynamicSortFilter(enable);
   342         resetBMIfNeeded();
   327         resetBM();
   343     }
   328     }
   344 }
   329 }
   345 
   330 
   346 Q_DECL_EXPORT int HgCacheProxyModel::sortRole() const
   331 int HgCacheProxyModel::sortRole() const
   347 {
   332 {
   348     return mSortFilterProxyModel->sortRole();
   333     return mSortFilterProxyModel->sortRole();
   349 }
   334 }
   350 
   335 
   351 Q_DECL_EXPORT void HgCacheProxyModel::setSortRole(int role)
   336 void HgCacheProxyModel::setSortRole(int role)
   352 {
   337 {
   353     if (sortRole() != role){
   338     if (sortRole() != role){
   354         mSortParameterChanged = true;   
   339         mSupressBM = true;
   355         cleanupForBMResetIfNeeded();
   340         cleanupForBMReset();
   356         mSortFilterProxyModel->setSortRole(role);
   341         mSortFilterProxyModel->setSortRole(role);
   357         resetBMIfNeeded();    
   342         resetBM();    
   358     }
   343     }
   359 }
   344 }
   360 
   345 
   361 //Q_DECL_EXPORT QRegExp HgCacheProxyModel::filterRegExp() const
   346 QRegExp HgCacheProxyModel::filterRegExp() const
   362 //{
   347 {
   363 //    return mSortFilterProxyModel->filterRegExp();
   348     return mSortFilterProxyModel->filterRegExp();
   364 //}
   349 }
   365 //
   350 
   366 //Q_DECL_EXPORT void HgCacheProxyModel::setFilterRegExp(const QRegExp &regExp)
   351 void HgCacheProxyModel::setFilterRegExp(const QRegExp &regExp)
   367 //{
   352 {
   368 //    if (filterRegExp() != regExp){   
   353     if (filterRegExp() != regExp){
   369 //        mFilterParameterChanged = true;
   354         mSupressBM = true;
   370 //        cleanupForBMResetIfNeeded();
   355         cleanupForBMReset();
   371 //        mSortFilterProxyModel->setFilterRegExp(regExp);
   356         mSortFilterProxyModel->setFilterRegExp(regExp);
   372 //        resetBMIfNeeded();    
   357         resetBM();    
   373 //    }
   358     }
   374 //}
   359 }
   375 //
   360 
   376 //Q_DECL_EXPORT int HgCacheProxyModel::filterKeyColumn() const
   361 int HgCacheProxyModel::filterKeyColumn() const
   377 //{
   362 {
   378 //    return mSortFilterProxyModel->filterKeyColumn();
   363     return mSortFilterProxyModel->filterKeyColumn();
   379 //}
   364 }
   380 //
   365 
   381 //Q_DECL_EXPORT void HgCacheProxyModel::setFilterKeyColumn(int column)
   366 void HgCacheProxyModel::setFilterKeyColumn(int column)
   382 //{
   367 {
   383 //    if (filterKeyColumn() != column){   
   368     if (filterKeyColumn() != column){   
   384 //        mFilterParameterChanged = true;
   369         mSupressBM = true;
   385 //        cleanupForBMResetIfNeeded();
   370         cleanupForBMReset();
   386 //        mSortFilterProxyModel->setFilterKeyColumn(column);
   371         mSortFilterProxyModel->setFilterKeyColumn(column);
   387 //        resetBMIfNeeded();    
   372         resetBM();    
   388 //    }
   373     }
   389 //}
   374 }
   390 //
   375 
   391 //Q_DECL_EXPORT Qt::CaseSensitivity HgCacheProxyModel::filterCaseSensitivity() const
   376 Qt::CaseSensitivity HgCacheProxyModel::filterCaseSensitivity() const
   392 //{
   377 {
   393 //    return mSortFilterProxyModel->filterCaseSensitivity();
   378     return mSortFilterProxyModel->filterCaseSensitivity();
   394 //}
   379 }
   395 //
   380 
   396 //Q_DECL_EXPORT void HgCacheProxyModel::setFilterCaseSensitivity(Qt::CaseSensitivity cs)
   381 void HgCacheProxyModel::setFilterCaseSensitivity(Qt::CaseSensitivity cs)
   397 //{
   382 {
   398 //    if ( filterCaseSensitivity() != cs){   
   383     if ( filterCaseSensitivity() != cs){   
   399 //        mFilterParameterChanged = true;
   384         mSupressBM = true;
   400 //        cleanupForBMResetIfNeeded();
   385         cleanupForBMReset();
   401 //        mSortFilterProxyModel->setFilterCaseSensitivity(cs);
   386         mSortFilterProxyModel->setFilterCaseSensitivity(cs);
   402 //        resetBMIfNeeded();    
   387         resetBM();    
   403 //    }
   388     }
   404 //}
   389 }
   405 //
   390 
   406 //Q_DECL_EXPORT int HgCacheProxyModel::filterRole() const
   391 int HgCacheProxyModel::filterRole() const
   407 //{
   392 {
   408 //    return mSortFilterProxyModel->filterRole();
   393     return mSortFilterProxyModel->filterRole();
   409 //}
   394 }
   410 //
   395 
   411 //Q_DECL_EXPORT void HgCacheProxyModel::setFilterRole(int role)
   396 void HgCacheProxyModel::setFilterRole(int role)
   412 //{
   397 {
   413 //    if ( mFilterParameterChanged || (filterRole() != role)){   
   398     if ( filterRole() != role ){   
   414 //        mFilterParameterChanged = false;
   399         mSupressBM = true;
   415 //        mResetNeeded = true;
   400         cleanupForBMReset();
   416 //        cleanupForBMResetIfNeeded();
   401         mSortFilterProxyModel->setFilterRole(role);
   417 //        mSortFilterProxyModel->setFilterRole(role);
   402         resetBM();
   418 //        resetBMIfNeeded();
   403     }
   419 //    }
   404 }
   420 //}
   405 
   421 
   406 bool HgCacheProxyModel::submit()
   422 Q_DECL_EXPORT bool HgCacheProxyModel::submit()
       
   423 {
   407 {
   424     return mSortFilterProxyModel->submit();
   408     return mSortFilterProxyModel->submit();
   425 }
   409 }
   426 
   410 
   427 Q_DECL_EXPORT void HgCacheProxyModel::revert()
   411 void HgCacheProxyModel::revert()
   428 {
   412 {
   429     mSortFilterProxyModel->revert();
   413     mSortFilterProxyModel->revert();
   430 }
   414 }
   431 
   415 
   432 Q_DECL_EXPORT void HgCacheProxyModel::release(int start, int end)
   416 void HgCacheProxyModel::release(int start, int end)
   433 {
   417 {
   434     TX_ENTRY_ARGS( QString("%0-%1").arg(start).arg(end));   
   418     TX_ENTRY_ARGS( QString("%0-%1").arg(start).arg(end));   
   435     QList<int> list;
   419     QList<int> list;
   436     int idx = 0;
   420     int idx = 0;
   437     if ( start > end){
   421     if ( start > end){
   445         if ( idx >=0)
   429         if ( idx >=0)
   446             list.append(idx);
   430             list.append(idx);
   447     }
   431     }
   448     if (mDataProviderModel)
   432     if (mDataProviderModel)
   449         mDataProviderModel->release(list, true);
   433         mDataProviderModel->release(list, true);
   450     TX_EXIT    
   434     TX_EXIT
   451 }
   435 }
   452 
   436 
   453 Q_DECL_EXPORT void HgCacheProxyModel::request(int start, int end, HgRequestOrder order)
   437 void HgCacheProxyModel::request(int start, int end, HgRequestOrder order)
   454 {
   438 {
   455     TX_ENTRY_ARGS( QString("%0-%1").arg(start).arg(end));   
   439     TX_ENTRY_ARGS( QString("%0-%1").arg(start).arg(end));   
   456     QList<int> list;
   440     QList<int> list;
   457     int idx;
   441     int idx;
   458     if (order == HgRequestOrderAscending){
   442     if (order == HgRequestOrderAscending){
   496 int HgCacheProxyModel::mapFromDataProviderIndex(int myIndex) const
   480 int HgCacheProxyModel::mapFromDataProviderIndex(int myIndex) const
   497 {
   481 {
   498     return mSortFilterProxyModel->mapFromSource( mDataProviderModel->index(myIndex, 0) ).row();
   482     return mSortFilterProxyModel->mapFromSource( mDataProviderModel->index(myIndex, 0) ).row();
   499 }
   483 }
   500 
   484 
   501 void HgCacheProxyModel::cleanupForBMResetIfNeeded()
   485 void HgCacheProxyModel::cleanupForBMReset()
   502 {
   486 {
   503     if (mResetNeeded || mSortFilterProxyModel->dynamicSortFilter()==true){
   487     releaseAll();
   504         TX_LOG
   488 }
   505         mSupressBM = true;
   489 
   506         mResetNeeded = true;
   490 void HgCacheProxyModel::resetBM()
   507         beginResetModel();
   491 {
   508         releaseAll();
   492     if (mBufferManager){
   509     }
   493         mCurrentPos = 0;
   510 }
   494         mBufferManager->resetBuffer( mCurrentPos, count() );
   511 
   495     }
   512 void HgCacheProxyModel::resetBMIfNeeded()
   496     mSupressBM = false;
   513 {
       
   514     if ( mResetNeeded ){
       
   515         if (mBufferManager)
       
   516             mBufferManager->resetBuffer( mCurrentPos, count() );
       
   517         mSupressBM = false;
       
   518         mResetNeeded = false;
       
   519         endResetModel();
       
   520     }
       
   521     mResetNeeded = false;
       
   522 }
   497 }
   523 
   498 
   524 void HgCacheProxyModel::releaseAll()
   499 void HgCacheProxyModel::releaseAll()
   525 {
   500 {
   526     if ( mDataProviderModel ){
   501     if ( mDataProviderModel ){
   527         QList<int> list;
   502         QList<int> list;
   528         for ( int i=0; i<mDataProviderModel->rowCount(); i++){
   503         for ( int i=0; i<mDataProviderModel->rowCount(); i++){
   529             list.append(i);
   504             list.append(i);
   530         }
   505         }
   531         mDataProviderModel->release(list, true); //will quietly replace all icons with default ones,
   506         mDataProviderModel->release(list, true);
   532     }
   507     }
   533 }
   508 }
   534 
   509 
   535 void HgCacheProxyModel::setBufferPosition(int pos) const
   510 void HgCacheProxyModel::setBufferPosition(int pos) const
   536 {
   511 {
   537     if (!mSupressBM && mBufferManager){
   512     if (mBufferManager && !mSupressBM){
   538         TX_LOG_ARGS(QString("idx:%1 ").arg(pos) );
       
   539         if (mCurrentPos!=pos){
   513         if (mCurrentPos!=pos){
       
   514 //            TX_LOG_ARGS(QString("pos:%1 ").arg(pos) );
   540             mCurrentPos = pos;
   515             mCurrentPos = pos;
   541             mBufferManager->setPosition(mCurrentPos);
   516             mBufferManager->setPosition(mCurrentPos);
   542         }
   517         }
   543     }
   518     }
   544 }
   519 }
   545 
   520 
   546 void HgCacheProxyModel::sourceReset()
   521 void HgCacheProxyModel::sourceColumnsAboutToBeInserted( const QModelIndex & parent, int start, int end)
   547 {
   522 {
       
   523     TX_ENTRY
       
   524     beginInsertColumns(parent, start, end);
       
   525     TX_EXIT
       
   526 }
       
   527 
       
   528 void HgCacheProxyModel::sourceColumnsAboutToBeMoved( const QModelIndex & sourceParent, int sourceStart, 
       
   529     int sourceEnd, const QModelIndex & destinationParent, int destinationColumn )
       
   530 {
       
   531     TX_ENTRY
       
   532     beginMoveColumns(sourceParent, sourceStart, sourceEnd, destinationParent, destinationColumn);
       
   533     TX_EXIT
       
   534 }
       
   535 
       
   536 void HgCacheProxyModel::sourceColumnsAboutToBeRemoved( const QModelIndex & parent, int start, int end)
       
   537 {
       
   538     TX_ENTRY
       
   539     beginRemoveColumns(parent, start, end);
       
   540     TX_EXIT
       
   541 }
       
   542 
       
   543 void HgCacheProxyModel::sourceColumnsInserted( const QModelIndex & parent, int start, int end )
       
   544 {
       
   545     TX_ENTRY
       
   546     Q_UNUSED(parent);
       
   547     Q_UNUSED(start);
       
   548     Q_UNUSED(end);
       
   549     endInsertColumns();
       
   550     TX_EXIT
       
   551 }
       
   552 
       
   553 void HgCacheProxyModel::sourceColumnsMoved( const QModelIndex & sourceParent, int sourceStart, 
       
   554         int sourceEnd, const QModelIndex & destinationParent, int destinationColumn )
       
   555 {
       
   556     TX_ENTRY
       
   557     Q_UNUSED(sourceParent);
       
   558     Q_UNUSED(sourceStart);
       
   559     Q_UNUSED(sourceEnd);
       
   560     Q_UNUSED(destinationParent);
       
   561     Q_UNUSED(destinationColumn);
       
   562     endMoveColumns();
       
   563     TX_EXIT
       
   564 }
       
   565 
       
   566 void HgCacheProxyModel::sourceColumnsRemoved( const QModelIndex & parent, int start, int end )
       
   567 {
       
   568     TX_ENTRY
       
   569     Q_UNUSED(parent);
       
   570     Q_UNUSED(start);
       
   571     Q_UNUSED(end);
       
   572     endRemoveColumns();
       
   573     TX_EXIT
       
   574 }
       
   575 
       
   576 void HgCacheProxyModel::sourceDataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight )
       
   577 {
       
   578     TX_ENTRY_ARGS(QString("from:%1 to:%2").arg( topLeft.row() ).arg( bottomRight.row() ) );
       
   579     QModelIndex begin = index( topLeft.row(), topLeft.column() );
       
   580     QModelIndex end = index( bottomRight.row(), bottomRight.column() );
       
   581     
       
   582     if (begin.isValid() && end.isValid() && !mSupressBM)
       
   583         emit dataChanged(begin, end);
       
   584     TX_EXIT
       
   585 }
       
   586 
       
   587 void HgCacheProxyModel::sourceHeaderDataChanged( Qt::Orientation orientation, int first, int last )
       
   588 {
       
   589     TX_ENTRY
       
   590     emit headerDataChanged( orientation, first, last );
       
   591     TX_EXIT
       
   592 }
       
   593 
       
   594 void HgCacheProxyModel::sourceLayoutAboutToBeChanged()
       
   595 {
       
   596     TX_ENTRY
       
   597     emit layoutAboutToBeChanged();
   548     mSupressBM = true;
   598     mSupressBM = true;
   549     mResetNeeded = true;
       
   550     releaseAll();
   599     releaseAll();
   551     if (mBufferManager)
   600     TX_EXIT
   552         mBufferManager->resetBuffer( 0, count() );
   601 }
       
   602 
       
   603 void HgCacheProxyModel::sourceLayoutChanged()
       
   604 {
       
   605     TX_ENTRY
       
   606     mSupressBM = true;
       
   607     if (mBufferManager){
       
   608         mCurrentPos = 0;
       
   609         mBufferManager->resetBuffer( mCurrentPos, count() );
       
   610     }
   553     mSupressBM = false;
   611     mSupressBM = false;
   554     mResetNeeded = false;
   612     emit layoutChanged();
       
   613     TX_EXIT    
       
   614 }
       
   615 
       
   616 void HgCacheProxyModel::sourceModelAboutToBeReset()
       
   617 {
       
   618     TX_ENTRY
       
   619     beginResetModel();
       
   620     mSupressBM = true;
       
   621     releaseAll();
       
   622     TX_EXIT
       
   623 }
       
   624 
       
   625 void HgCacheProxyModel::sourceModelReset()
       
   626 {
       
   627     TX_ENTRY
       
   628     mSupressBM = true;
       
   629     if (mBufferManager){
       
   630         mCurrentPos = 0;
       
   631         mBufferManager->resetBuffer( mCurrentPos, count() );
       
   632     }
       
   633     mSupressBM = false;
   555     endResetModel();
   634     endResetModel();
   556 }
   635     TX_EXIT
   557 
   636 }
   558 void HgCacheProxyModel::sourceAboutToBeReset()
   637 
   559 {
   638 void HgCacheProxyModel::sourceRowsAboutToBeInserted( const QModelIndex & parent, int start, int end )
   560     mSupressBM = true;
   639 {
   561     mResetNeeded = true;
   640     TX_ENTRY
   562     beginResetModel();
   641     if (mBufferManager && !mSupressBM){
   563 }
   642         beginInsertRows(parent, start, end);
   564 
   643 //        mBufferManager->aboutToInsertItems(start, end);    
   565 void HgCacheProxyModel::sourceRowsInserted(const QModelIndex &source_parent, int start, int end)
   644     }
   566 {
   645     TX_EXIT
   567     Q_UNUSED(source_parent);
   646 }
       
   647 
       
   648 void HgCacheProxyModel::sourceRowsAboutToBeMoved( const QModelIndex & sourceParent, int sourceStart, 
       
   649         int sourceEnd, const QModelIndex & destinationParent, int destinationRow )
       
   650 {
       
   651     TX_ENTRY
       
   652     beginMoveRows(sourceParent, sourceStart, sourceEnd, destinationParent, destinationRow);
       
   653     TX_EXIT
       
   654 }
       
   655 
       
   656 void HgCacheProxyModel::sourceRowsAboutToBeRemoved( const QModelIndex & parent, int start, int end )
       
   657 {
       
   658     TX_ENTRY
       
   659     if (mBufferManager && !mSupressBM){
       
   660         beginRemoveRows(parent, start, end);
       
   661 //        mBufferManager->aboutToRemoveItems(start, end);    
       
   662     }
       
   663     TX_EXIT
       
   664 }
       
   665 
       
   666 void HgCacheProxyModel::sourceRowsInserted( const QModelIndex & parent, int start, int end )
       
   667 {
       
   668     TX_ENTRY
       
   669     Q_UNUSED(parent);
   568     Q_UNUSED(end);
   670     Q_UNUSED(end);
   569     if (mBufferManager)
   671     if (mBufferManager && !mSupressBM){
   570         mBufferManager->itemCountChanged(start, false, count());
   672         mBufferManager->itemCountChanged(start, false, count());
   571 }
   673         endInsertRows();
   572 
   674     }
   573 void HgCacheProxyModel::sourceRowsRemoved(const QModelIndex &source_parent, int start, int end)
   675     TX_EXIT    
   574 {
   676 }
   575     Q_UNUSED(source_parent);
   677 
   576     Q_UNUSED(end);    
   678 void HgCacheProxyModel::sourceRowsMoved( const QModelIndex & sourceParent, int sourceStart, 
   577     if (mBufferManager)
   679         int sourceEnd, const QModelIndex & destinationParent, int destinationRow )
   578         mBufferManager->itemCountChanged(start, true, count());   
   680 {
   579 }
   681     TX_ENTRY
   580 
   682     Q_UNUSED(sourceParent);
   581 void HgCacheProxyModel::dataUpdated(QModelIndex from, QModelIndex to)
   683     Q_UNUSED(sourceStart);
   582 {
   684     Q_UNUSED(sourceEnd);
   583     dataUpdated(from.row(), to.row());
   685     Q_UNUSED(destinationParent);
   584 }
   686     Q_UNUSED(destinationRow);
   585 
   687     endMoveRows();
   586 Q_DECL_EXPORT void HgCacheProxyModel::dataUpdated(int from, int to)
   688     TX_EXIT
       
   689 }
       
   690 
       
   691 void HgCacheProxyModel::sourceRowsRemoved( const QModelIndex & parent, int start, int end )
       
   692 {
       
   693     TX_ENTRY
       
   694     Q_UNUSED(parent);
       
   695     Q_UNUSED(end);
       
   696     if (mBufferManager && !mSupressBM){
       
   697         mBufferManager->itemCountChanged(start, true, count());
       
   698         endRemoveRows();
       
   699     }
       
   700     TX_EXIT
       
   701 }
       
   702 
       
   703 void HgCacheProxyModel::dataUpdated(int from, int to)
   587 {
   704 {
   588     TX_LOG_ARGS(QString("from:%1 to:%2").arg(from).arg(to));
   705     TX_LOG_ARGS(QString("from:%1 to:%2").arg(from).arg(to));
   589     emit dataChanged(index(mapFromDataProviderIndex(from),0), index ( mapFromDataProviderIndex(to),0) );
   706     QModelIndex begin;
   590 }
   707     QModelIndex end;
       
   708     begin = index(mapFromDataProviderIndex(from),0);
       
   709     
       
   710     if ( from == to ){
       
   711         end = begin;
       
   712     } else {
       
   713         end = index(mapFromDataProviderIndex(to),0);
       
   714     }
       
   715     
       
   716     if (begin.isValid() && end.isValid() && !mSupressBM)
       
   717         emit dataChanged(begin, end );
       
   718 }
       
   719 
   591 //eof
   720 //eof