[zypp-devel] New ui::Selectable methods...
JFYI: enum Fate { TO_DELETE = -1, UNMODIFIED = 0, TO_INSTALL = 1 }; /** */ bool setFate( Fate fate_r ); /** Set the item to be installed (new- or re-install). */ bool setToInstall() { return setFate( TO_INSTALL ); } /** Take care the item gets installed if it is not. */ bool setInstalled(); /** Take care the item gets installed if it is not, or is older. */ bool setUpToDate(); /** Set the item to be deleted (must be installed). */ bool setToDelete() { return setFate( TO_DELETE ); } /** Take care the item gets deleted if it is installed. */ bool setDeleted(); /** Set the item to stay unmodified. */ bool unset() { return setFate( UNMODIFIED ); } Some new status methods. They may be sometimes easier to use, as they do not always distinguish whether installed objects are present, like the ui::Staus does. E.g: unset() // thate care the item says as it is. The same with ui::Sataus: setStatus( hasInstalledObj() ? S_KeepInstalled : S_NoInst ) setDeleted() vs. ( ! hasInstalledObj() || setStatus( S_Del ) ) setInstalled() vs. ( hasInstalledObj() || setStatus( S_Install ) ) -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
Ah, cool :) I'll be happy to use those in UI code. Just a few questions:
/** Take care the item gets installed if it is not, or is older. */ bool setUpToDate();
Which current selectable status (S_.*) does this correspond to? Or is it equivalent of 'update this selectable if newer version is available?'
/** Set the item to be deleted (must be installed). */ bool setToDelete() { return setFate( TO_DELETE ); }
... so if I decide to use this method, I have to check whether the selectable is installed by myself ...
/** Take care the item gets deleted if it is installed. */ bool setDeleted();
... and if I don't want to do so, it's better for me to use this method ... ? The same basically with setInstalled, probably B. -- \\\\\ Katarina Machalkova \\\\\\\__o YaST developer __\\\\\\\'/_ & hedgehog painter
On Tue, Aug 12, Katarina Machalkova wrote:
Ah, cool :) I'll be happy to use those in UI code.
Just a few questions:
/** Take care the item gets installed if it is not, or is older. */ bool setUpToDate();
Which current selectable status (S_.*) does this correspond to? Or is it equivalent of 'update this selectable if newer version is available?'
Almost: 'install or update to the latest version' It installs, if uninstalled.
/** Set the item to be deleted (must be installed). */ bool setToDelete() { return setFate( TO_DELETE ); }
... so if I decide to use this method, I have to check whether the selectable is installed by myself ...
If you evaluate the return code, yes.
/** Take care the item gets deleted if it is installed. */ bool setDeleted();
... and if I don't want to do so, it's better for me to use this method ... ?
Yes, it does not treat an uninstalled item as error. It's a relaxed version of 'setToDelete()'.
The same basically with setInstalled, probably
Yes. setToInstall returns false if there is no available item to install. (install unconditionally) setInstalled returns true if the item is already installed, otherwise installs it (install if not present). setUpToDate install or update to the latest version. -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
participants (2)
-
Katarina Machalkova
-
Michael Andres