diff options
Diffstat (limited to 'archivemodel.cpp')
-rw-r--r-- | archivemodel.cpp | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/archivemodel.cpp b/archivemodel.cpp index 0f266ca..212c60d 100644 --- a/archivemodel.cpp +++ b/archivemodel.cpp @@ -163,38 +163,6 @@ bool ArchiveModel::setData(const QModelIndex &idx, const QVariant &value, int ro return false; } -bool ArchiveModel::matchRecursive(const QModelIndex &parent, const QRegExp ®ex, int column) const { - if(!parent.isValid()){ - return false; - } - // first try the parent itself - QString value = parent.data().toString(); - if(value.isEmpty()){ - return false; - } - if(value.contains(regex)){ - return true; - } - - // no match, check for children - SmTreeItem *item = static_cast<SmTreeItem*>(parent.internalPointer()); - if(!item->childCount()){ - //leaf, chech parents - return checkParents(item, regex, column); - } - - // we have children, traverse them - bool retval = false; - for(int i = 0; i < item->childCount(); ++i){ - QModelIndex newIdx = createIndex(i, column, item->child(i)); - retval = matchRecursive(newIdx, regex, column); - if(retval){ - break; - } - } - return retval; -} - bool ArchiveModel::removeNode(const QModelIndex &idx){ if(!idx.isValid()){ return false; @@ -619,17 +587,6 @@ void ArchiveModel::collectorFinished(QObject *thread){ emit message(msg); } -bool ArchiveModel::checkParents(const SmTreeItem *item, const QRegExp ®ex, int column) const { - while(item != root()){ - QString value = item->data(column).toString(); - if(value.contains(regex)){ - return true; - } - item = item->parent(); - } - return false; -} - void ArchiveModel::emitDatabaseError(const QSqlError &e){ QString databaseText = e.databaseText().isEmpty() ? tr("(none)") : e.databaseText(); QString driverText = e.driverText().isEmpty() ? tr("(none)") : e.driverText(); |