mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 22:09:52 +08:00
bug-fix: add attachment name check
This commit is contained in:
parent
04fa3654a4
commit
37058b04df
@ -378,6 +378,22 @@ void VAttachmentList::handleListItemCommitData(QWidget *p_itemEdit)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool legalName = true;
|
||||||
|
if (text.isEmpty()) {
|
||||||
|
legalName = false;
|
||||||
|
} else {
|
||||||
|
QRegExp reg(VUtils::c_fileNameRegExp);
|
||||||
|
if (!reg.exactMatch(text)) {
|
||||||
|
legalName = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!legalName) {
|
||||||
|
// Recover to old name.
|
||||||
|
item->setText(oldText);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(oldText.toLower() == text.toLower())
|
if (!(oldText.toLower() == text.toLower())
|
||||||
&& m_file->findAttachment(text, false) > -1) {
|
&& m_file->findAttachment(text, false) > -1) {
|
||||||
// Name conflict.
|
// Name conflict.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user