From 6e03469151a2a3eae6e54dd1e138a2628d51eab3 Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 2 Mar 2012 20:42:44 +0100 Subject: Prevent usage of "/" in MappingTreeModel Since "/" is used as path separator, reject any SmTreeModel::Name containing it. --- mappingtreemodel.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mappingtreemodel.cpp b/mappingtreemodel.cpp index 2dec7fa..3dabe16 100644 --- a/mappingtreemodel.cpp +++ b/mappingtreemodel.cpp @@ -128,6 +128,11 @@ bool MappingTreeModel::setData(const QModelIndex &index, const QVariant &value, } SmTreeItem *item = itemAt(index); if(role == Qt::EditRole){ + if(index.column() == Name){ + if(value.toString().contains("/")){ + return false; + } + } mDb.transaction(); QSqlQuery *q = 0; if(item == root()){ @@ -146,6 +151,9 @@ bool MappingTreeModel::setData(const QModelIndex &index, const QVariant &value, mDb.rollback(); } if(role == NameRole){ + if(value.toString().contains("/")){ + return false; + } item->setData(Name, value); } if(role == IdRole){ -- cgit v1.2.3-70-g09d2