mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 10:30:53 +01:00
The title block template editor now opens templates as read-only if needed.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1476 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -119,7 +119,7 @@ bool QETTitleBlockTemplateEditor::edit(const TitleBlockTemplateLocation &locatio
|
|||||||
|
|
||||||
opened_from_file_ = false;
|
opened_from_file_ = false;
|
||||||
location_ = location;
|
location_ = location;
|
||||||
updateEditorTitle();
|
setReadOnly(location.isReadOnly());
|
||||||
editCopyOf(tb_template_orig);
|
editCopyOf(tb_template_orig);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ bool QETTitleBlockTemplateEditor::edit(QETProject *project, const QString &templ
|
|||||||
opened_from_file_ = false;
|
opened_from_file_ = false;
|
||||||
location_.setParentCollection(project -> embeddedTitleBlockTemplatesCollection());
|
location_.setParentCollection(project -> embeddedTitleBlockTemplatesCollection());
|
||||||
location_.setName(template_name);
|
location_.setName(template_name);
|
||||||
updateEditorTitle();
|
setReadOnly(project -> isReadOnly());
|
||||||
return(editCopyOf(tb_template_orig));
|
return(editCopyOf(tb_template_orig));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,10 +175,10 @@ bool QETTitleBlockTemplateEditor::edit(const QString &file_path) {
|
|||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QFileInfo file_path_info(file_path);
|
||||||
filepath_ = file_path;
|
filepath_ = file_path;
|
||||||
opened_from_file_ = true;
|
opened_from_file_ = true;
|
||||||
updateEditorTitle();
|
setReadOnly(!file_path_info.isWritable());
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,6 +509,7 @@ void QETTitleBlockTemplateEditor::updateEditorTitle() {
|
|||||||
*/
|
*/
|
||||||
void QETTitleBlockTemplateEditor::updateActions() {
|
void QETTitleBlockTemplateEditor::updateActions() {
|
||||||
/// TODO complete this method
|
/// TODO complete this method
|
||||||
|
save_ -> setEnabled(!read_only_);
|
||||||
merge_cells_ -> setEnabled(!read_only_);
|
merge_cells_ -> setEnabled(!read_only_);
|
||||||
split_cell_ -> setEnabled(!read_only_);
|
split_cell_ -> setEnabled(!read_only_);
|
||||||
}
|
}
|
||||||
@@ -533,7 +534,7 @@ bool QETTitleBlockTemplateEditor::saveAs(const TitleBlockTemplateLocation &locat
|
|||||||
opened_from_file_ = false;
|
opened_from_file_ = false;
|
||||||
location_ = location;
|
location_ = location;
|
||||||
undo_stack_ -> setClean();
|
undo_stack_ -> setClean();
|
||||||
updateEditorTitle();
|
setReadOnly(false);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,7 +550,7 @@ bool QETTitleBlockTemplateEditor::saveAs(const QString &filepath) {
|
|||||||
opened_from_file_ = true;
|
opened_from_file_ = true;
|
||||||
filepath_ = filepath;
|
filepath_ = filepath;
|
||||||
undo_stack_ -> setClean();
|
undo_stack_ -> setClean();
|
||||||
updateEditorTitle();
|
setReadOnly(false);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,18 +599,19 @@ void QETTitleBlockTemplateEditor::openFromFile() {
|
|||||||
bool QETTitleBlockTemplateEditor::save() {
|
bool QETTitleBlockTemplateEditor::save() {
|
||||||
if (opened_from_file_) {
|
if (opened_from_file_) {
|
||||||
if (!filepath_.isEmpty()) {
|
if (!filepath_.isEmpty()) {
|
||||||
return(saveAs(filepath_));
|
QFileInfo file_path_info(filepath_);
|
||||||
} else {
|
if (file_path_info.isWritable()) {
|
||||||
// Actually, this should never happen since opened_from_file_ is always set
|
return(saveAs(filepath_));
|
||||||
// along with a valid path. There is a dedicated menu item to call this.s
|
}
|
||||||
return(saveAsFile());
|
|
||||||
}
|
}
|
||||||
|
return(saveAsFile());
|
||||||
} else {
|
} else {
|
||||||
if (location_.isValid()) {
|
if (location_.isValid()) {
|
||||||
return(saveAs(location_));
|
if (!location_.isReadOnly()) {
|
||||||
} else {
|
return(saveAs(location_));
|
||||||
return(saveAs());
|
}
|
||||||
}
|
}
|
||||||
|
return(saveAs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user