We must read settings from /etc/gs.upp/*.upp file, not from
/etc/gs.upp/*.yast2. Then we will reflect user settings. But there can
be a problem with depended options.:
Option PrinterType
Name="Epson", Value=""
Suboption Resolution for Epson
Name="720x720 DPI", Value="720x720 DPI"
Name="1440x1440 DPI", Value="1440x1440 DPI"
Name="Canon", Value=""
Suboption Resolution for Canon
Name="720x720 DPI", Value="720x720 DPI"
Name="1440x1440 DPI", Value="1440x1440 DPI"
If "720x720 DPI" is selected, noone knows if it was for Canon or Epson. The
possibilities are:
- Take the first matching: bad, because it can destroy also user's settings
made in YaST2.
- Save the last selected "path", look at pre-selected items, if not found,
take first matching.
Another problem: the option user changed need not to be in option list for that
printer. Solution: Show warning that options were edited. Show options that were
not-found in separate window.
Another problem: User can choose options that would cause showing of two
concurent subtrees.
Ultimate solution: When some conflict was found, show window that options are
not editable by YaST2, offer [reset] [let them as they are].
- Set "found"=0 for each option->value.
- For each option found in printer.upp: try to found it in options,
if found, increase "found" in all nodes of path to found option.
- For each option->value check if "found" is not > 1. Otherwise there
can be conflict (if "found" is > 1 in leaf, it is quite OK, one value was 2x
in .upp file).
- For each option, check if there are not two values with "found" != 0.
Otherwise there is conflict.
Most ultimate solution:
If printconf finds that user edited upp file, it
does not allow editing. It offers reset. Maybe it will be necessarry because
finding if upp is edited consistently with yast2 is almost impossible. But it is
not big problem, because user will not be asked in each save, but only if he
will try to edit printer.
ls -l --full-time /etc/gs.upp/file.upp | cut -b44-67 gives file-time.
We can add this time to /etc/gs.upp/file.yast2.