Improved isReadOnly() methods for templates collections.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1474 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2012-01-23 07:20:07 +00:00
parent 21c8ffbd7b
commit 3fc9409559
4 changed files with 29 additions and 9 deletions

View File

@@ -257,9 +257,12 @@ TitleBlockTemplateLocation TitleBlockTemplatesProjectCollection::location(const
}
/**
@return true if this collection is read only
@param template_name Either an empty QString to know whether the collection
itself is read only, or a specific template name.
@return true if the specified template is read only, false otherwise
*/
bool TitleBlockTemplatesProjectCollection::isReadOnly() const {
bool TitleBlockTemplatesProjectCollection::isReadOnly(const QString &template_name) const {
Q_UNUSED(template_name)
if (project_) {
return(project_ -> isReadOnly());
}
@@ -431,11 +434,18 @@ TitleBlockTemplateLocation TitleBlockTemplatesFilesCollection::location(const QS
}
/**
@return true if this collection is read only, false otherwise
@param template_name Either an empty QString to know whether the collection
itself is read only, or a specific template name.
@return true if the specified template is read only, false otherwise
*/
bool TitleBlockTemplatesFilesCollection::isReadOnly() const {
QFileInfo info(dir_.canonicalPath());
return(!info.isWritable());
bool TitleBlockTemplatesFilesCollection::isReadOnly(const QString &template_name) const {
if (template_name.isEmpty()) {
QFileInfo info(dir_.canonicalPath());
return(!info.isWritable());
} else {
QFileInfo info(dir_.absoluteFilePath(toFileName(template_name)));
return(!info.isWritable());
}
}
/**