diff options
author | Arno <am@disconnect.de> | 2012-03-02 20:42:44 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2012-03-02 20:42:44 +0100 |
commit | 6e03469151a2a3eae6e54dd1e138a2628d51eab3 (patch) | |
tree | 463daa331ece28f282ff6296649aa814004d1e84 /mappingtreemodel.cpp | |
parent | ee29bb41dc9c4d4dd6fc9bfd3fb9ad5cc3bd1569 (diff) | |
download | SheMov-6e03469151a2a3eae6e54dd1e138a2628d51eab3.tar.gz SheMov-6e03469151a2a3eae6e54dd1e138a2628d51eab3.tar.bz2 SheMov-6e03469151a2a3eae6e54dd1e138a2628d51eab3.zip |
Prevent usage of "/" in MappingTreeModel
Since "/" is used as path separator, reject any SmTreeModel::Name
containing it.
Diffstat (limited to 'mappingtreemodel.cpp')
-rw-r--r-- | mappingtreemodel.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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){ |