mirror of https://github.com/KLayout/klayout.git
WIP: Don't allow to edit downloaded packages.
This commit is contained in:
parent
42756a76f6
commit
1f92b89e16
|
|
@ -337,7 +337,9 @@ SaltGrain::xml_struct ()
|
|||
bool
|
||||
SaltGrain::is_readonly () const
|
||||
{
|
||||
return !QFileInfo (tl::to_qstring (path ())).isWritable ();
|
||||
// A grain is readonly if the directory is not writable or there is a download URL
|
||||
// (this means the grain has been installed from an URL).
|
||||
return !QFileInfo (tl::to_qstring (path ())).isWritable () || !m_url.empty ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -512,7 +512,10 @@ SaltManagerDialog::edit_properties ()
|
|||
{
|
||||
SaltGrain *g = current_grain ();
|
||||
if (g) {
|
||||
if (mp_properties_dialog->exec_dialog (g, mp_salt)) {
|
||||
if (g->is_readonly ()) {
|
||||
QMessageBox::critical (this, tr ("Package is not Editable"),
|
||||
tr ("This package cannot be edited.\n\nEither you don't have write permissions on the directory or the package was installed from a repository."));
|
||||
} else if (mp_properties_dialog->exec_dialog (g, mp_salt)) {
|
||||
current_changed ();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue