View | Details | Raw Unified | Return to bug 386384
Collapse All | Expand All

(-)packager/src/clients/repositories.ycp (-5 / +59 lines)
Lines 813-823 Link Here
813
    // sort the maps by "repos" key (in ascending order)
813
    // sort the maps by "repos" key (in ascending order)
814
    list<map<string,any> > ret = sort(map<string,any> repo1, map<string,any> repo2, repos, {return repo1["priority"]:default_priority < repo2["priority"]:default_priority;});
814
    list<map<string,any> > ret = sort(map<string,any> repo1, map<string,any> repo2, repos, {return repo1["priority"]:default_priority < repo2["priority"]:default_priority;});
815
815
816
    y2internal("SortReposByPriority: %1 -> %2", repos, ret);
816
    y2milestone("SortReposByPriority: %1 -> %2", repos, ret);
817
817
818
    return ret;
818
    return ret;
819
}
819
}
820
820
821
// remember the original selected URL scheme
822
string selected_url_scheme = "";
823
824
symbol StartTypeDialog()
825
{
826
    string seturl = selected_url_scheme;
827
828
    if (seturl != nil && seturl != "")
829
    {
830
	seturl = selected_url_scheme + "://";
831
    }
832
833
    symbol ret = TypeDialogOpts(true, seturl);
834
835
    if (ret == `back)
836
    {
837
	selected_url_scheme = "";
838
    }
839
    else
840
    {
841
	selected_url_scheme = URL::Parse(SourceDialogs::GetURL())["scheme"]:"";
842
	y2milestone("Selected URL scheme: %1", selected_url_scheme);
843
844
	if (selected_url_scheme == nil || selected_url_scheme == "")
845
	{
846
	    selected_url_scheme = "url";
847
	}
848
    }
849
850
    return ret;
851
}
852
853
symbol StartEditDialog()
854
{
855
    y2milestone("Edit URL with protocol %1", selected_url_scheme);
856
    symbol ret = SourceDialogs::EditDialogProtocol(selected_url_scheme);
857
    y2milestone("Result: %1", ret);
858
859
    return ret;
860
}
861
862
symbol StartStoreSource()
863
{
864
    symbol ret = StoreSource();
865
866
    if (ret == `next || ret == `abort || ret == `close)
867
    {
868
	y2milestone("Resetting selected URL scheme");
869
	selected_url_scheme = "";
870
    }
871
872
    return ret;
873
}
874
821
// main function - start the workflow
875
// main function - start the workflow
822
symbol StartInstSource()
876
symbol StartInstSource()
823
{
877
{
Lines 871-879 Link Here
871
925
872
    map<string,any> aliases = $[
926
    map<string,any> aliases = $[
873
	"summary" : ``(SummaryDialog ()),
927
	"summary" : ``(SummaryDialog ()),
874
	"type" : ``(TypeDialog()),
928
	"type" : ``(StartTypeDialog()),
875
	"edit" : ``(EditDialog ()),
929
	"edit" : ``(StartEditDialog ()),
876
	"store" : ``(StoreSource ()),
930
	"store" : ``(StartStoreSource ()),
877
	"keymgr" : [``(RunGPGKeyMgmt(false)), true]
931
	"keymgr" : [``(RunGPGKeyMgmt(false)), true]
878
    ];
932
    ];
879
933
Lines 921-927 Link Here
921
975
922
if (WFM::Args() == [ `sw_single_mode ])
976
if (WFM::Args() == [ `sw_single_mode ])
923
{
977
{
924
    y2internal("Started from sw_single, switching the mode");
978
    y2milestone("Started from sw_single, switching the mode");
925
979
926
    full_mode = true;
980
    full_mode = true;
927
    any ret = StartInstSource();
981
    any ret = StartInstSource();
(-)packager/src/include/repositories_include.ycp (-4 / +15 lines)
Lines 248-253 Link Here
248
                return `ok;
248
                return `ok;
249
            }
249
            }
250
        }
250
        }
251
	else
252
	{
253
	    y2error(-1, "Empty URL! Backtrace:");
254
	    return `again;
255
	}
251
    }
256
    }
252
257
253
symbol StoreSource () {
258
symbol StoreSource () {
Lines 306-316 Link Here
306
    return `next;
311
    return `next;
307
}
312
}
308
313
309
symbol TypeDialog()
314
symbol TypeDialogOpts(boolean download, string url)
310
{
315
{
311
    SourceDialogs::SetDownloadOption(true);
316
    SourceDialogs::SetDownloadOption(download);
312
    // reset the stored URL
317
    SourceDialogs::SetURL(url);
313
    SourceDialogs::SetURL("");
318
314
    map<string,any> td = SourceDialogs::TypeDialogDownloadOpt();
319
    map<string,any> td = SourceDialogs::TypeDialogDownloadOpt();
315
320
316
    symbol ret = td["ui"]:`next;
321
    symbol ret = td["ui"]:`next;
Lines 318-323 Link Here
318
    return ret;
323
    return ret;
319
}
324
}
320
325
326
symbol TypeDialog()
327
{
328
    // download metadata, reset the stored URL
329
    return TypeDialogOpts(true, "");
330
}
331
321
symbol EditDialog()
332
symbol EditDialog()
322
{
333
{
323
    symbol ret = SourceDialogs::EditDialog ();
334
    symbol ret = SourceDialogs::EditDialog ();
(-)packager/src/modules/SourceDialogs.ycp (-10 / +32 lines)
Lines 1220-1226 Link Here
1220
    else if (type != `ftp)
1220
    else if (type != `ftp)
1221
    // FTP needs to distinguish absolute and relative path
1221
    // FTP needs to distinguish absolute and relative path
1222
    {
1222
    {
1223
	directory = Slashed (directory);
1223
	// do not add the slash if host and directory is empty
1224
	// (avoid e.g. http:// -> http:/// when switching from the parts to the complete view)
1225
	if (host != "" || directory != "")
1226
	    directory = Slashed (directory);
1224
    }
1227
    }
1225
    if (UI::WidgetExists (`id (`workgroup)))
1228
    if (UI::WidgetExists (`id (`workgroup)))
1226
    {
1229
    {
Lines 1252-1257 Link Here
1252
    _url = (string)UI::QueryWidget(`id(`complete_url), `Value);
1255
    _url = (string)UI::QueryWidget(`id(`complete_url), `Value);
1253
}
1256
}
1254
1257
1258
// use selected editing URL part, remember the value in case the URL is wrong
1259
// and the dialog needs to displayed again
1260
boolean editing_parts = true;
1261
1255
/**
1262
/**
1256
 * Handle function of a widget
1263
 * Handle function of a widget
1257
 * @param key string widget key
1264
 * @param key string widget key
Lines 1377-1382 Link Here
1377
	    ServerStoreParts();
1384
	    ServerStoreParts();
1378
	}
1385
	}
1379
1386
1387
	editing_parts  = (id == `edit_url_parts);
1388
1380
	// reinitialize the dialog (set the current values)
1389
	// reinitialize the dialog (set the current values)
1381
	ServerInit(nil);
1390
	ServerInit(nil);
1382
    }
1391
    }
Lines 1387-1395 Link Here
1387
 * @param key string widget key
1396
 * @param key string widget key
1388
 */
1397
 */
1389
void ServerInit (string key) {
1398
void ServerInit (string key) {
1399
    // check the current edit type
1400
    symbol current_type = editing_parts ? `edit_url_parts : `edit_complete_url;
1390
1401
1391
    // check the current edit type
1402
    // set the stored value
1392
    symbol current_type = (symbol)UI::QueryWidget(`id(`edit_type), `Value);
1403
    UI::ChangeWidget(`id(`edit_type), `Value, current_type);
1404
1393
    y2debug("Current edit type: %1", current_type);
1405
    y2debug("Current edit type: %1", current_type);
1394
1406
1395
    UI::ReplaceWidget(`id(`edit_content), (current_type == `edit_url_parts) ? details_content : complete_content);
1407
    UI::ReplaceWidget(`id(`edit_content), (current_type == `edit_url_parts) ? details_content : complete_content);
Lines 1522-1528 Link Here
1522
    symbol current_type = (symbol)UI::QueryWidget(`id(`edit_type), `Value);
1534
    symbol current_type = (symbol)UI::QueryWidget(`id(`edit_type), `Value);
1523
    y2debug("Current edit type: %1", current_type);
1535
    y2debug("Current edit type: %1", current_type);
1524
1536
1525
    if (current_type == `edit_url_parts)
1537
    editing_parts = (current_type == `edit_url_parts);
1538
1539
    if (editing_parts)
1526
    {
1540
    {
1527
	ServerStoreParts();
1541
	ServerStoreParts();
1528
    }
1542
    }
Lines 1532-1538 Link Here
1532
    }
1546
    }
1533
}
1547
}
1534
1548
1535
1536
/**
1549
/**
1537
 * Get widget description map
1550
 * Get widget description map
1538
 * @return widget description map
1551
 * @return widget description map
Lines 1543-1551 Link Here
1543
	"custom_widget" : `VBox (
1556
	"custom_widget" : `VBox (
1544
	    `RadioButtonGroup (`id (`edit_type),
1557
	    `RadioButtonGroup (`id (`edit_type),
1545
		`HBox (
1558
		`HBox (
1546
		    `RadioButton(`id(`edit_url_parts), `opt(`notify), _("Edit Parts of the URL"), true),
1559
		    `RadioButton(`id(`edit_url_parts), `opt(`notify), _("Edit Parts of the URL"), editing_parts),
1547
		    `HSpacing(2),
1560
		    `HSpacing(2),
1548
		    `RadioButton(`id(`edit_complete_url), `opt(`notify), _("Edit Complete URL"))
1561
		    `RadioButton(`id(`edit_complete_url), `opt(`notify), _("Edit Complete URL"), !editing_parts)
1549
		)
1562
		)
1550
	    ),
1563
	    ),
1551
	    `VSpacing(0.3),
1564
	    `VSpacing(0.3),
Lines 1782-1788 Link Here
1782
    symbol selected = (symbol)UI::QueryWidget (`id (`type), `CurrentButton);
1795
    symbol selected = (symbol)UI::QueryWidget (`id (`type), `CurrentButton);
1783
1796
1784
    if (contains ([`ftp, `http, `https, `samba, `nfs, `cd, `dvd, `usb, `hd,
1797
    if (contains ([`ftp, `http, `https, `samba, `nfs, `cd, `dvd, `usb, `hd,
1785
	`local_dir, `specify__url, `slp, `local_iso, `comm_repos], selected))
1798
	`local_dir, `specify_url, `slp, `local_iso, `comm_repos], selected))
1786
    {
1799
    {
1787
	if ( selected == `ftp ) _url = "ftp://";
1800
	if ( selected == `ftp ) _url = "ftp://";
1788
	else if ( selected == `http ) _url = "http://";
1801
	else if ( selected == `http ) _url = "http://";
Lines 2030-2037 Link Here
2030
 * Sample implementation of URL selection dialog
2043
 * Sample implementation of URL selection dialog
2031
 * @return symbol for wizard sequencer
2044
 * @return symbol for wizard sequencer
2032
 */
2045
 */
2033
global symbol EditDialog () {
2046
global symbol EditDialogProtocol(string proto)
2034
    string proto = URLScheme (_url);
2047
{
2035
    y2milestone ("Displaying dialog for protocol %1", proto);
2048
    y2milestone ("Displaying dialog for protocol %1", proto);
2036
    string caption = _caption[proto]:"";
2049
    string caption = _caption[proto]:"";
2037
2050
Lines 2045-2051 Link Here
2045
	"fallback_functions" : $[]
2058
	"fallback_functions" : $[]
2046
    ]);
2059
    ]);
2047
}
2060
}
2061
/**
2062
 * Sample implementation of URL selection dialog
2063
 * @return symbol for wizard sequencer
2064
 */
2065
global symbol EditDialog () {
2066
    string proto = URLScheme (_url);
2048
2067
2068
    return EditDialogProtocol(proto);
2069
}
2070
2049
/**
2071
/**
2050
 * URL editation popup with the HTTPS option
2072
 * URL editation popup with the HTTPS option
2051
 * @return string modified URL or empty string if canceled
2073
 * @return string modified URL or empty string if canceled

Return to bug 386384