ZYpp::LocaleSet ZYpp::getRequestedLocales() const
{ return _pimpl->getRequestedLocales(); }
+ void ZYpp::setPossibleLocales( const LocaleSet & locales_r )
+ { _pimpl->setPossibleLocales( locales_r ); }
+
+ ZYpp::LocaleSet ZYpp::getPossibleLocales() const
+ { return _pimpl->getPossibleLocales(); }
+
Arch ZYpp::architecture() const
{ return _pimpl->architecture(); }
void ZYpp::setArchitecture( const Arch & arch )
/** */
LocaleSet getRequestedLocales() const;
+ /** Set the available locales.
+ * Languages to be available for selection
+ */
+ void setPossibleLocales( const LocaleSet & locales_r );
+ /** */
+ LocaleSet getPossibleLocales() const;
+
public:
/** Get the path where zypp related plugins store persistent data and caches */
Pathname homePath() const;
//#include "zypp/base/Logger.h"
#include "zypp/zypp_detail/ZYppImpl.h"
+#include "zypp/detail/LanguageImpl.h"
+#include "zypp/detail/ResImplTraits.h"
+#include "zypp/NVRAD.h"
+#include "zypp/Language.h"
using std::endl;
{
}
+ //------------------------------------------------------------------------
+ // add/remove resolvables
+
void ZYppImpl::addResolvables (const ResStore& store, bool installed)
{
_pool.insert(store.begin(), store.end(), installed);
}
}
+ //------------------------------------------------------------------------
+ // target
+
Target_Ptr ZYppImpl::target() const
{
if (! _target)
_target = 0;
}
+ //------------------------------------------------------------------------
+ // commit
+
/** \todo Remove workflow from target, lot's of it could be done here,
* and target used for transact. */
ZYpp::CommitResult ZYppImpl::commit( int medianr_r )
}
+ //------------------------------------------------------------------------
+ // locales
+
+ /** */
+ void ZYppImpl::setPossibleLocales( const LocaleSet & locales_r )
+ {
+ removeResolvables( _possible_locales );
+ _possible_locales.clear();
+
+ for (LocaleSet::const_iterator it = locales_r.begin(); it != locales_r.end(); ++it) {
+ NVRA nvra( it->code(), Edition(), Arch_noarch );
+ NVRAD ldata( nvra, Dependencies() );
+ detail::ResImplTraits<detail::LanguageImpl>::Ptr limpl = new detail::LanguageImpl();
+ Language::Ptr language = detail::makeResolvableFromImpl( ldata, limpl );
+ _possible_locales.insert( language );
+ }
+ addResolvables( _possible_locales, false );
+ }
+
+ /** */
+ ZYppImpl::LocaleSet ZYppImpl::getPossibleLocales() const
+ {
+ LocaleSet lset;
+ for (ResStore::const_iterator it = _possible_locales.begin(); it != _possible_locales.end(); ++it) {
+ lset.insert( Locale( (*it)->name() ) );
+ }
+ return lset;
+ }
+
+ //------------------------------------------------------------------------
+ // architecture
+
void ZYppImpl::setArchitecture( const Arch & arch )
{
_architecture = arch;
if (_resolver) _resolver->setArchitecture( arch );
}
+ //------------------------------------------------------------------------
+ // target store path
+
Pathname ZYppImpl::homePath() const
{ return _home_path.empty() ? Pathname("/var/lib/zypp") : _home_path; }
+
void ZYppImpl::setHomePath( const Pathname & path )
{ _home_path = path; }
typedef std::set<Locale> LocaleSet;
/** */
void setRequestedLocales( const LocaleSet & locales_r )
- {}
+ { _requested_locales = locales_r; }
/** */
LocaleSet getRequestedLocales() const
- { return LocaleSet(); }
+ { return _requested_locales; }
+
+ /** */
+ void setPossibleLocales( const LocaleSet & locales_r );
+ /** */
+ LocaleSet getPossibleLocales() const;
public:
/** Get the system architecture. */
Resolver_Ptr _resolver;
/** */
Arch _architecture;
+ /** */
Pathname _home_path;
+ /** this is what the user wants. */
+ LocaleSet _requested_locales;
+ /** this is what is possible. */
+ ResStore _possible_locales;
};
///////////////////////////////////////////////////////////////////