Author: lslezak
Date: Wed Apr 29 17:20:09 2009
New Revision: 57036
URL: http://svn.opensuse.org/viewcvs/yast?rev=57036&view=rev
Log:
- confirm adding of an already known repository (URL) (bnc#471054)
Modified:
trunk/packager/package/yast2-packager.changes
trunk/packager/src/clients/repositories.ycp
Modified: trunk/packager/package/yast2-packager.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.changes?rev=57036&r1=57035&r2=57036&view=diff
==============================================================================
--- trunk/packager/package/yast2-packager.changes (original)
+++ trunk/packager/package/yast2-packager.changes Wed Apr 29 17:20:09 2009
@@ -7,6 +7,7 @@
- preserve repository priority when changing URL
- open create repository dialog in a new window, fixes broken UI
caused by the previous fix (bnc#269034)
+- confirm adding of an already known repository (URL) (bnc#471054)
-------------------------------------------------------------------
Tue Apr 28 16:33:41 CEST 2009 - lslezak@suse.cz
Modified: trunk/packager/src/clients/repositories.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/clients/repositories.ycp?rev=57036&r1=57035&r2=57036&view=diff
==============================================================================
--- trunk/packager/src/clients/repositories.ycp (original)
+++ trunk/packager/src/clients/repositories.ycp Wed Apr 29 17:20:09 2009
@@ -455,7 +455,7 @@
}
);
- y2milestone("New service config: %1", sourceStatesOut);
+ y2milestone("New service config: %1", serviceStatesOut);
foreach(map s, serviceStatesOut,
{
string alias = s["alias"]:"";
@@ -1034,6 +1034,8 @@
// replace the data
sourceStatesOut[global_current] = addedSource;
+ // remove the duplicate at the end
+ sourceStatesOut = remove(sourceStatesOut, idx);
// refresh only the name and URL in the table
UI::ChangeWidget(`id(`table), `Cell( global_current, 3), addedSource["name"]:"");
@@ -1473,10 +1475,72 @@
return ret;
}
+boolean KnownURL(string url)
+{
+ string scheme = tolower(URL::Parse(url)["scheme"]:"");
+
+ // alway create CD/DVD repository
+ if (scheme == "cd" || scheme == "dvd")
+ {
+ return false;
+ }
+
+ boolean ret = false;
+
+ foreach (map src, sourceStatesOut,
+ {
+ integer src_id = tointeger(src["SrcId"]:nil);
+ map generalData = Pkg::SourceGeneralData(src_id);
+ string src_url = generalData["url"]:"";
+
+ if (src_url == url)
+ {
+ ret = true;
+ }
+ }
+ );
+
+ y2milestone("URL exists: %1", ret);
+
+ return ret;
+}
+
symbol StartEditDialog()
{
y2milestone("Edit URL with protocol %1", selected_url_scheme);
- symbol ret = SourceDialogs::EditDialogProtocol(selected_url_scheme);
+ symbol ret = nil;
+
+ do
+ {
+ ret = SourceDialogs::EditDialogProtocol(selected_url_scheme);
+
+ if (ret == `next)
+ {
+ string url = SourceDialogs::GetURL();
+ boolean known_url = KnownURL(url);
+
+ if (known_url)
+ {
+ // popup question, %1 is repository URL
+ if (!Popup::AnyQuestion("",
+ sformat(_("Repository %1
+has been already added. Each repository should be added only once.
+
+Really add the repository again?"), URL::HidePassword(url)),
+ Label::YesButton(),
+ Label::NoButton(),
+ `focus_no
+ )
+ )
+ {
+ // add URL again
+ ret = nil;
+ }
+ }
+ }
+ }
+ while (ret == nil);
+
y2milestone("Result: %1", ret);
return ret;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org