[yast-commit] r60398 - in /trunk/storage: ./ bindings/src/ package/ storage/src/ storage/src/modules/
Author: aschnell Date: Fri Jan 15 14:00:10 2010 New Revision: 60398 URL: http://svn.opensuse.org/viewcvs/yast?rev=60398&view=rev Log: - implemented popup to query user whether to ignore failures during commit (fate #304500) Modified: trunk/storage/bindings/src/StorageCallbacks.cc trunk/storage/bindings/src/StorageCallbacks.h trunk/storage/package/yast2-storage.changes trunk/storage/storage/src/inst_prepdisk.ycp trunk/storage/storage/src/modules/StorageClients.ycp trunk/storage/yast2-storage.spec.in Modified: trunk/storage/bindings/src/StorageCallbacks.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/bindings/src/StorageCallbacks.cc?rev=60398&r1=60397&r2=60398&view=diff ============================================================================== --- trunk/storage/bindings/src/StorageCallbacks.cc (original) +++ trunk/storage/bindings/src/StorageCallbacks.cc Fri Jan 15 14:00:10 2010 @@ -46,7 +46,8 @@ extern CallbackProgressBar progress_bar_cb_ycp; extern CallbackShowInstallInfo install_info_cb_ycp; extern CallbackInfoPopup info_popup_cb_ycp; - extern CallbackYesNoPopup yesno_popup_cb_ycp; + extern CallbackYesNoPopup yesno_popup_cb_ycp; + extern CallbackCommitErrorPopup commit_error_popup_cb_ycp; extern CallbackPasswordPopup password_popup_cb_ycp; } @@ -212,6 +213,7 @@ static Y2Function* show_install_info = NULL; static Y2Function* info_popup = NULL; static Y2Function* yesno_popup = NULL; +static Y2Function* commit_error_popup = NULL; static Y2Function* password_popup = NULL; void progress_bar_callback( const string& id, unsigned cur, unsigned max ) @@ -268,6 +270,27 @@ } +bool commit_error_popup_callback(int error, const string& last_action, const string& extended_message) +{ + bool ret = false; + + if (commit_error_popup) + { + commit_error_popup->reset(); + commit_error_popup->appendParameter(YCPInteger(error)); + commit_error_popup->appendParameter(YCPString(last_action)); + commit_error_popup->appendParameter(YCPString(extended_message)); + commit_error_popup->finishParameters(); + + YCPValue tmp = commit_error_popup->evaluateCall(); + if (tmp->isBoolean()) + ret = tmp->asBoolean()->value(); + } + + return ret; +} + + bool password_popup_callback(const string& device, int attempts, string& password) { bool ret = false; @@ -477,6 +500,53 @@ YCPValue +StorageCallbacks::CommitErrorPopup(const YCPString& callback) +{ + string name_r = callback->value(); + + y2debug("Registering callback %s", name_r.c_str()); + string::size_type colonpos = name_r.find("::"); + + if (colonpos == string::npos) + { + ycp2error ("Specify namespace and the fuction name for a callback"); + return YCPVoid (); + } + + string module = name_r.substr(0, colonpos); + string name = name_r.substr(colonpos + 2); + + Y2Component* c = Y2ComponentBroker::getNamespaceComponent(module.c_str()); + if (c == NULL) + { + ycp2error("No component can provide namespace %s for a callback of %s", + module.c_str(), name.c_str()); + return YCPVoid(); + } + + Y2Namespace* ns = c->import(module.c_str()); + if (ns == NULL) + { + y2error("No namespace %s for a callback of %s", module.c_str(), + name.c_str()); + return YCPVoid(); + } + + commit_error_popup = ns->createFunctionCall(name, Type::Unspec); + if (commit_error_popup == NULL) + { + ycp2error("Cannot find function %s in module %s as a callback", + name.c_str(), module.c_str()); + return YCPVoid(); + } + + storage::commit_error_popup_cb_ycp = commit_error_popup_callback; + + return YCPVoid(); +} + + +YCPValue StorageCallbacks::PasswordPopup (const YCPString & callback) { string name_r = callback->value (); Modified: trunk/storage/bindings/src/StorageCallbacks.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/bindings/src/StorageCallbacks.h?rev=60398&r1=60397&r2=60398&view=diff ============================================================================== --- trunk/storage/bindings/src/StorageCallbacks.h (original) +++ trunk/storage/bindings/src/StorageCallbacks.h Fri Jan 15 14:00:10 2010 @@ -58,6 +58,8 @@ /* TYPEINFO: void(string) */ YCPValue YesNoPopup (const YCPString& func); /* TYPEINFO: void(string) */ + YCPValue CommitErrorPopup (const YCPString& func); + /* TYPEINFO: void(string) */ YCPValue PasswordPopup (const YCPString& func); /** Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=60398&r1=60397&r2=60398&view=diff ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Fri Jan 15 14:00:10 2010 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Fri Jan 15 11:42:55 CET 2010 - aschnell@suse.de + +- implemented popup to query user whether to ignore failures during + commit (fate #304500) + +------------------------------------------------------------------- Wed Jan 13 18:56:03 CET 2010 - kmachalkova@suse.cz - Adjusted .desktop file(s) to wrap /sbin/yast2/ calls in xdg-su Modified: trunk/storage/storage/src/inst_prepdisk.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/inst_prepdisk.ycp?rev=60398&r1=60397&r2=60398&view=diff ============================================================================== --- trunk/storage/storage/src/inst_prepdisk.ycp (original) +++ trunk/storage/storage/src/inst_prepdisk.ycp Fri Jan 15 14:00:10 2010 @@ -118,20 +118,7 @@ integer ret = Storage::CommitChanges(); y2milestone( "CommitChanges ret:%1", ret ); if( ret!=0 ) - { - string txt = sformat(_("Failure occurred during following action: -%2 - -System error code was: %1 -"), ret, Storage::LastAction() ); - string ext = Storage::ExtendedErrorMsg(); - if( size(ext)>0 ) - { - txt = txt + "\n\n" + ext; - } - Popup::Error( txt ); ret_val = `abort; - } //mount proc and usbfs during installation if( Stage::initial() ) Modified: trunk/storage/storage/src/modules/StorageClients.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/StorageClients.ycp?rev=60398&r1=60397&r2=60398&view=diff ============================================================================== --- trunk/storage/storage/src/modules/StorageClients.ycp (original) +++ trunk/storage/storage/src/modules/StorageClients.ycp Fri Jan 15 14:00:10 2010 @@ -77,6 +77,27 @@ } + global boolean CommitErrorPopup(integer error, string last_action, string extended_message) + { + y2milestone("CommitErrorPopup error%1 last_action%2 extended_message:%3", error, + last_action, extended_message); + + string text = _("Failure occurred during following action:") + "\n" + last_action + "\n\n"; + + text = text + sformat(_("System error code was: %1"), error) + "\n\n"; + + if (!isempty(extended_message)) + { + text = text + extended_message + "\n\n"; + } + + text = text + _("Continue despite the error?"); + + return Report::ErrorAnyQuestion(Popup::NoHeadline(), text, Label::ContinueButton(), + Label::AbortButton(), `focus_no); + } + + global list<any> PasswordPopup(string device, integer attempts, string password) { y2milestone("PasswordPopup device:%1 attempts:%2", device, attempts); @@ -117,6 +138,7 @@ StorageCallbacks::ShowInstallInfo("StorageClients::ShowInstallInfo"); StorageCallbacks::InfoPopup("StorageClients::InfoPopup"); StorageCallbacks::YesNoPopup("StorageClients::YesNoPopup"); + StorageCallbacks::CommitErrorPopup("StorageClients::CommitErrorPopup"); StorageCallbacks::PasswordPopup("StorageClients::PasswordPopup"); } Modified: trunk/storage/yast2-storage.spec.in URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/yast2-storage.spec.in?rev=60398&r1=60397&r2=60398&view=diff ============================================================================== --- trunk/storage/yast2-storage.spec.in (original) +++ trunk/storage/yast2-storage.spec.in Fri Jan 15 14:00:10 2010 @@ -5,10 +5,10 @@ License: GPL v2 or later BuildRequires: blocxx-devel boost-devel gcc-c++ libxcrypt-devel openssl-devel sablot swig BuildRequires: docbook-xsl-stylesheets doxygen libxslt perl-XML-Writer sgml-skel update-desktop-files -BuildRequires: libstorage-devel >= 2.19.5 yast2 >= 2.18.19 yast2-core-devel >= 2.18.1 yast2-devtools +BuildRequires: libstorage-devel >= 2.19.5 yast2 >= 2.19.4 yast2-core-devel >= 2.18.1 yast2-devtools BuildRequires: yast2-testsuite >= 2.19.0 yast2-perl-bindings Requires: libstorage = %(echo `rpm -q --queryformat '%{VERSION}' libstorage`) -Requires: yast2-perl-bindings yast2-core >= 2.18.3 yast2 >= 2.18.19 yast2-libyui >= 2.18.7 +Requires: yast2-perl-bindings yast2-core >= 2.18.3 yast2 >= 2.19.4 yast2-libyui >= 2.18.7 Requires: yast2-dbus-client %ifarch s390 s390x Requires: yast2-s390 -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
aschnell@svn.opensuse.org