summaryrefslogtreecommitdiffstats
path: root/HTML/index-zh_TW.html
blob: cd1cbf63bd19ccece10a66704d4392c335b7d118 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<html>
<head>
<title>&gt; Mandrake Linux &lt;</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK REL="STYLESHEET" TYPE="text/css" HREF="style-zh_TW.css">
<link rel="shortcut icon" href="favicon.png">
</head>

<body bgcolor="#FFFFFF" TOPMARGIN="0" LEFTMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">

<table cellspacing="0" cellpadding="0" width="100%" border="0">
  <tr bgcolor="#eeeeee"> 
    <td valign="top" align="left" nowrap>&nbsp;

<img src="fleche-s.png" alt=">" width="7" height="10">&nbsp;

<a class="top" href="http://www.mandrakelinux.com" title="關於 Mandrake Linux 的資訊">Mandrake Linux</a>&nbsp;
<img src="carre-gris.png" alt="*" width="7" height="10" align="MIDDLE" >&nbsp; 
<a class="top" href="http://www.mandrakestore.com">MandrakeStore</a>&nbsp;
<img src="carre-gris.png" alt="*" width="7" height="10" align="MIDDLE" >&nbsp; 
<a class="top" href="http://www.mandrakeclub.com">MandrakeClub</a>&nbsp;
<img src="carre-gris.png" alt="*" width="7" height="10" align="MIDDLE" >&nbsp; 
<a class="top" href="http://www.mandrakeexpert.com">MandrakeExpert</a>&nbsp;
<img src="carre-gris.png" alt="*" width="7" height="10" align="MIDDLE" >&nbsp; 
<a class="top" href="http://www.mandrakecampus.com" title="從使用 Mandrake 中學習 Linux">MandrakeCampus</a>&nbsp;
<img src="carre-gris.png" alt="*" width="7" height="10" align="MIDDLE" >&nbsp; 
<a href="http://www.mandrakebizcases.com" class="top">MandrakeBizcases</a>&nbsp;
<img src="carre-gris.png" alt="*" width="7" height="10" align="MIDDLE" >&nbsp; 
<a class="top" href="http://www.mandrakeforum.com">MandrakeForum</a>&nbsp;
<img src="carre-gris.png" alt="*" width="7" height="10" align="MIDDLE" >&nbsp; 
<a class="top" href="http://www.mandrakeuser.org">MandrakeUser</a>&nbsp;
<img src="carre-gris.png" alt="*" width="7" height="10" align="MIDDLE" >&nbsp; 
<a class="top" href="http://www.mandrakesecure.net">MandrakeSecure</a>&nbsp;
<img src="carre-gris.png" alt="*" width="7" height="10" align="MIDDLE" >&nbsp; 
<a class="top" href="http://www.mandrakeonline.net">MandrakeOnline</a>&nbsp;
<!--
<img src="carre-gris.png" alt="*" width="7" height="10" align="MIDDLE" >&nbsp; 
<a href="http://www.mandrakebizcases.com" class="top">MarketPlace</a>
-->
</td>
  </tr>
</table>



<p align="center">
    <img src="_welcome.png" width="272" height="57" alt="歡迎使用 Mandrake Linux">
</p>


<table width="90%" border="0" cellpadding="0" align="center">
  <tr align="left" valign="top"> 
    <td class="text">
      <p>
        歡迎使用 Mandrake Linux,一個適合初學及進階使用者的理想作業系統。
        我們希望它能帶給您完全的滿足感。記得在這裡 <a href="http://www.mandrakelinux.com/doc.php3">閱讀</a> 更多有關 Mandrake Linux 的文件,以及在這裡 <a href="http://www.mandrakelinux.com/en/security/">安全更新</a> 您的系統。使到您的系統時常都可以保持在最階狀態。
</p>

<b>MandrakeOnline</b>: 使用 MandrakeSoft 最新的 <a href="http://www.mandrakesoft.com/products/mandrakeonline/">在線服務</a>,輕鬆愉快地將您的系統保持在最新及最安全的狀態。

    </td>
  </tr>
</table>

<table width="100%" border="0" background="dazibao.jpg">
  <tr align="left" valign="top"> 
    <td>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
    </td>
  </tr>
</table>

<hr>

<table width="90%" border="0" align="center">
  <tr> 
    <td width="31%" align="center">

<b>Mandrake 常用網頁</b>

    </td>
    <td width="10">&nbsp;</td>
    <td width="31%" align="center">

<b>資訊</b>

    </td>
    <td width="10">&nbsp;</td>
    <td width="31%" align="center">

<b>常用網址</b>

    </td>

  </tr>
<tr>
<td><br></td>
</tr>
  <tr> 
    <td valign="top" width="31%">
<p class="text">
<a href="http://www.mandrakeexpert.com/index1.php">MandrakeExpert</a> 求助有門</p>
<p class="text">
學習 Linux <a href="http://www.mandrakecampus.com">MandrakeCampus</a>
</p>
<p class="text">
最新產品情報 <a href="http://www.mandrakestore.com">MandrakeStore</a></font>
</p>
<p class="text">
<a href="http://www.mandrakebizcases.com">Mandrake 商務經驗分享</a>
</p>
<p class="text">
<a href="http://www.mandrakeclub.com">MandrakeClub</a>
</p>
<p class="text">
<a href="http://www.mandrakesoft.com/company/investors/trade">投資</a> MandrakeSoft 股票
</p>

    </td>
    <td width="10">&nbsp;</td>
    <td  valign="top" width="31%"> 
<p class="text">
<a href="http://www.mandrakesoft.com/company/news">MandrakeSoft 新聞</a>
</p>
<p class="text">
郵件論壇 <a href="http://www.mandrakeforum.com">MandrakeForum</a>
</p>
<p class="text">
關於最新的 <a href="http://www.mandrakesoft.com/products/news">Mandrake 產品</a>
</p>
<p class="text">
<a href="http://www.slashdot.org">Slashdot</a>
</p>
<p class="text">
<a href="http://www.linuxtoday.com">Linux 每日新聞</a>
</p>
<p class="text">
<a href="http://www.lwn.net">Linux 每週新聞</a>
</p>
    </td>
    <td width="10">&nbsp;</td>
    <td  valign="top" width="31%"> 
<p class="text">
<form method=GET action="http://www.google.com/search">
<img src="arrow.png" valign="center"> 熱門搜尋:<br>
<input type=text name=q size=15 value="">
<input type=hidden name=hl value="zh-TW">
<input type=submit name=sa VALUE="Google">
</form>
</p>
<p class="text">
軟件專利 <a href="http://petition.eurolinux.org/reference/">資訊</a>
</p>
    </td>

  </tr>
</table>

<hr>
<table border=0 width=100%>
<tr>
<td bgcolor="#eeeeee" > 
<font size=-1 face="helvetica">

<a href="index-af.html"><img src=flag-af.png width="30" height="16"
 alt="Afrikaans" border=0></a>
<a href="index-sq.html"><img src=flag-sq.png width="30" height="16"
 alt="Albanian" border=0></a>
<a href="index-ar.html"><img src=flag-ar.png width="30" height="16"
 alt="Arabic" border=0></a>
<a href="index-az.html"><img src=flag-az.png width="30" height="16"
 alt="Azeri" border=0></a>
<a href="index-bs.html"><img src=flag-bs.png width="30" height="16"
 alt="Bosnian" border=0></a>
<a href="index-br.html"><img src=flag-br.png width="30" height="16"
 alt="Brezhoneg" border=0></a>
<a href="index-bg.html"><img src=flag-bg.png width="30" height="16"
 alt="Bulgarian" border=0></a>
<a href="index-ca.html"><img src=flag-ca.png width="30" height="16"
 alt="Catalan" border=0></a>
<a href="index-zh_CN.html"><img src=flag-zh_CN.png width="30" height="16"
 alt="Chinese (Simplified)" border=0></a>
<a href="index-zh_TW.html"><img src=flag-zh_TW.png width="30" height="16"
 alt="Chinese (Traditional)" border=0></a>
<a href="index-hr.html"><img src=flag-hr.png width="30" height="16"
 alt="Croatian" border=0></a>
<a href="index-cy.html"><img src=flag-cy.png width="30" height="16"
 alt="Cymraeg" border=0></a>
<a href="index-cs.html"><img src=flag-cs.png width="30" height="16"
 alt="Czech" border=0></a>
<a href="index-da.html"><img src=flag-da.png width="30" height="16"
 alt="Danish" border=0></a>
<a href="index-nl.html"><img src=flag-nl.png width="30" height="16"
 alt="Dutch" border=0></a>
<a href="index-en.html"><img src=flag-en.png width="30" height="16"
 alt="English" border=0></a>
<a href="index-eo.html"><img src=flag-eo.png width="30" height="16"
 alt="Esperanto" border=0></a>
<a href="index-et.html"><img src=flag-et.png width="30" height="16"
 alt="Estonian" border=0></a>
<a href="index-eu.html"><img src=flag-eu.png width="30" height="16"
 alt="Euskara [Basque]" border=0></a>
<a href="index-fi.html"><img src=flag-fi.png width="30" height="16"
 alt="Finnish" border=0></a>
<a href="index-fr.html"><img src=flag-fr.png width="30" height="16"
 alt="French" border=0></a>
<a href="index-ga.html"><img src=flag-ga.png width="30" height="16"
 alt="Gaeilge" border=0></a>
<a href="index-gl.html"><img src=flag-gl.png width="30" height="16"
 alt="Galician" border=0></a>
<a href="index-ka.html"><img src=flag-ka.png width="30" height="16"
 alt="Georgian" border=0></a>
<a href="index-de.html"><img src=flag-de.png width="30" height="16"
 alt="German" border=0></a>
<a href="index-el.html"><img src=flag-el.png width="30" height="16"
 alt="Greek" border=0></a>
<a href="index-he.html"><img src=flag-he.png width="30" height="16"
 alt="Hebrew" border=0></a>
<a href="index-hu.html"><img src=flag-hu.png width="30" height="16"
 alt="Hungarian" border=0></a>
<a href="index-is.html"><img src=flag-is.png width="30" height="16"
 alt="Icelandic" border=0></a>
<a href="index-id.html"><img src=flag-id.png width="30" height="16"
 alt="Indonesian" border=0></a>
<a href="index-it.html"><img src=flag-it.png width="30" height="16"
 alt="Italian" border=0></a>
<a href="index-ja.html"><img src=flag-ja.png width="30" height="16"
 alt="Japanese" border=0></a>
<a href="index-ko.html"><img src=flag-ko.png width="30" height="16"
 alt="Korean" border=0></a>
<a href="index-lv.html"><img src=flag-lv.png width="30" height="16"
 alt="Latvian" border=0></a>
<a href="index-lt.html"><img src=flag-lt.png width="30" height="16"
 alt="Lithuanian" border=0></a>
<a href="index-mk.html"><img src=flag-mk.png width="30" height="16"
 alt="Macedonian" border=0></a>
<a href="index-ms.html"><img src=flag-ms.png width="30" height="16"
 alt="Malay" border=0></a>
<a href="index-mt.html"><img src=flag-mt.png width="30" height="16"
 alt="Maltese" border=0></a>
<a href="index-no.html"><img src=flag-no.png width="30" height="16"
 alt="Norwegian Bokmaal" border=0></a>
<a href="index-nn.html"><img src=flag-no.png width="30" height="16"
 alt="Norwegian Nynorsk" border=0></a>
<a href="index-pl.html"><img src=flag-pl.png width="30" height="16"
 alt="Polish" border=0></a>
<a href="index-pt_BR.html"><img src=flag-pt_BR.png width="30" height="16"
 alt="Portuguese (Brazil)" border=0></a>
<a href="index-pt.html"><img src=flag-pt.png width="30" height="16"
 alt="Portuguese" border=0></a>
<a href="index-ro.html"><img src=flag-ro.png width="30" height="16"
 alt="Romanian" border=0></a>
<a href="index-ru.html"><img src=flag-ru.png width="30" height="16"
 alt="Russian" border=0></a>
<a href="index-sp.html"><img src=flag-sp.png width="30" height="16"
 alt="Serbian (Cyrillic)" border=0></a>
<a href="index-sr.html"><img src=flag-sr.png width="30" height="16"
 alt="Serbian (Latin-2)" border=0></a>
<a href="index-sk.html"><img src=flag-sk.png width="30" height="16"
 alt="Slovakian" border=0></a>
<a href="index-sl.html"><img src=flag-sl.png width="30" height="16"
 alt="Slovenian" border=0></a>
<a href="index-es.html"><img src=flag-es.png width="30" height="16"
 alt="Spanish" border=0></a>
<a href="index-sv.html"><img src=flag-sv.png width="30" height="16"
 alt="Swedish" border=0></a>
<a href="index-tg.html"><img src=flag-tg.png width="30" height="16"
 alt="Tajiki" border=0></a>
<a href="index-ta.html"><img src=flag-ta.png width="30" height="16"
 alt="Tamil" border=0></a>
<a href="index-tr.html"><img src=flag-tr.png width="30" height="16"
 alt="Turkish" border=0></a>
<a href="index-uk.html"><img src=flag-uk.png width="30" height="16"
 alt="Ukrainian" border=0></a>
<a href="index-uz.html"><img src=flag-uz.png width="30" height="16"
 alt="Uzbekian" border=0></a>
<a href="index-vi.html"><img src=flag-vi.png width="30" height="16"
 alt="Vietnamese" border=0></a>
<a href="index-wa.html"><img src=flag-wa.png width="30" height="16"
 alt="Walloon" border=0></a>

</font>
</td>
</tr>
</table>
<hr>


</body>
</html>
d='n1824' href='#n1824'>1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243
# vim: set et ts=4 sw=4:
package ManaTools::Rpmdragora::edit_urpm_sources;
#*****************************************************************************
#
#  Copyright (c) 2002 Guillaume Cottenceau
#  Copyright (c) 2002-2007 Thierry Vignaud <tvignaud@mandriva.com>
#  Copyright (c) 2002-2007 Mandriva Linux
#  Copyright (c) 2014-2016 Angelo Naselli <anaselli@linux.it>
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License version 2, as
#  published by the Free Software Foundation.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#*****************************************************************************
#
# $Id: edit_urpm_sources.pm 266598 2010-03-03 12:00:58Z tv $


use strict;
use File::ShareDir ':ALL';
use File::HomeDir qw(home);

use MDK::Common::Func qw(if_ each_index);
use MDK::Common::Math qw(max);
use MDK::Common::File qw(cat_ output);
use MDK::Common::DataStructure qw(member put_in_hash uniq);
use MDK::Common::Various qw(to_bool);

use ManaTools::Shared;
use ManaTools::Shared::Locales;
use ManaTools::rpmdragora;
use ManaTools::Rpmdragora::init;
use ManaTools::Rpmdragora::open_db;
use ManaTools::Rpmdragora::formatting;
use ManaTools::Shared::GUI;
use URPM::Signature;
use urpm::media;
use urpm::download;
use urpm::lock;

use Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(run);


my $urpm;
my ($mainw, $list_tv, $something_changed);

my %col = (
    mainw => {
        is_enabled => 0,
        is_update  => 1,
        type       => 2,
        name       => 3,
        activatable => 4
    },
);

my $loc = ManaTools::rpmdragora::locale();

sub get_medium_type {
    my ($medium) = @_;
    my %medium_type = (
        cdrom     => $loc->N("CD-ROM"),
        ftp       => $loc->N("FTP"),
        file      => $loc->N("Local"),
        http      => $loc->N("HTTP"),
        https     => $loc->N("HTTPS"),
        nfs       => $loc->N("NFS"),
        removable => $loc->N("Removable"),
        rsync     => $loc->N("rsync"),
        ssh       => $loc->N("NFS"),
    );
    return $loc->N("Mirror list") if $medium->{mirrorlist};
    return $medium_type{$1} if $medium->{url} =~ m!^([^:]*)://!;
    return $loc->N("Local");
}

sub selrow {
    my ($o_list_tv) = @_;
    defined $o_list_tv or $o_list_tv = $list_tv;
    my ($model, $iter) = $o_list_tv->get_selection->get_selected;
    $model && $iter or return -1;
    my $path = $model->get_path($iter);
    my $row = $path->to_string;
    return $row;
}

sub selected_rows {
    my ($o_list_tv) = @_;
    defined $o_list_tv or $o_list_tv = $list_tv;
    my (@rows) = $o_list_tv->get_selection->get_selected_rows;
    return -1 if @rows == 0;
    map { $_->to_string } @rows;
}

sub remove_row {
    my ($model, $path_str) = @_;
    my $iter = $model->get_iter_from_string($path_str);
    $iter or return;
    $model->remove($iter);
}

sub remove_from_list {
    my ($list, $list_ref, $model) = @_;
    my $row = selrow($list);
    if ($row != -1) {
        splice @$list_ref, $row, 1;
        remove_row($model, $row);
    }

}

sub _want_base_distro() {
    $::expert && distro_type(0) eq 'updates' ? interactive_msg(
        $loc->N("Choose media type"),
        $loc->N("In order to keep your system secure and stable, you must at a minimum set up
sources for official security and stability updates. You can also choose to set
up a fuller set of sources which includes the complete official Mageia
repositories, giving you access to more software than can fit on the Mageia
discs. Please choose whether to configure update sources only, or the full set
of sources."
        ),
        transient => $::main_window,
        yesno => 1, text => { yes => $loc->N("Full set of sources"), no => $loc->N("Update sources only") },
    ) : 1;
}

sub easy_add_callback_with_mirror() {
    # when called on early init by rpmdragora
    $urpm ||= fast_open_urpmi_db();

    #- cooker and community don't have update sources
    my $want_base_distro = _want_base_distro();
    defined $want_base_distro or return 0;
    my $distro = $ManaTools::rpmdragora::mageia_release;
    my ($mirror) = choose_mirror($urpm, message =>
        $loc->N("This will attempt to install all official sources corresponding to your
distribution (%s).\n
I need to contact the Mageia website to get the mirror list.
Please check that your network is currently running.\n
Is it ok to continue?", $distro),
        transient => $::main_window,
    ) or return 0;
    ref $mirror or return 0;
    my $wait = wait_msg($loc->N("Please wait, adding media..."));
    add_distrib_update_media($urpm, $mirror, if_(!$want_base_distro, only_updates => 1));
    $offered_to_add_sources->[0] = 1;
    remove_wait_msg($wait);
    return 1;
}

sub easy_add_callback() {
    # when called on early init by rpmdragora
    $urpm ||= fast_open_urpmi_db();

    #- cooker and community don't have update sources
    my $want_base_distro = _want_base_distro();
    defined $want_base_distro or return 0;
    warn_for_network_need(undef, transient => $::main_window) or return 0;
    my $wait = wait_msg($loc->N("Please wait, adding media..."));
    add_distrib_update_media($urpm, undef, if_(!$want_base_distro, only_updates => 1));
    $offered_to_add_sources->[0] = 1;
    remove_wait_msg($wait);
    return 1;
}

## Internal routine that builds input fields needed to manage
## the selected media type to be added
## return HASH reference with the added widgets
sub _build_add_dialog  {
    my $options = shift;

    die "replace point is needed" if !defined ($options->{replace_pnt});
    die "dialog is needed" if !defined ($options->{dialog});
    die "selected item is needed" if !defined ($options->{selected});
    die "media info is needed" if !defined ($options->{info});

    my %widgets;
    my $factory  = yui::YUI::widgetFactory;

    $options->{dialog}->startMultipleChanges();
    $options->{replace_pnt}->deleteChildren();

    # replace widgets
    my $vbox    = $factory->createVBox( $options->{replace_pnt} );
    my $hbox           = $factory->createHBox($vbox);
    $factory->createHSpacing($hbox, 1.0);
    my $label          = $factory->createLabel($hbox,
        $options->{info}->{$options->{selected}}->{url}
    );

    $factory->createHSpacing($hbox, 3.0);
    $widgets{url}   = $factory->createInputField($hbox, "", 0);
    $widgets{url}->setWeight($yui::YD_HORIZ, 2);
    if (defined($options->{info}->{$options->{selected}}->{dirsel})) {
        $widgets{dirsel} = $factory->createPushButton($hbox, $loc->N("Browse..."));
    }
    elsif (defined($options->{info}->{$options->{selected}}->{loginpass})) {
        $hbox           = $factory->createHBox($vbox);
        $factory->createHSpacing($hbox, 1.0);
        $label          = $factory->createLabel($hbox, $loc->N("Login:") );
        $factory->createHSpacing($hbox, 1.0);
        $widgets{login} = $factory->createInputField($hbox, "", 0);
        $label->setWeight($yui::YD_HORIZ, 1);
        $widgets{login}->setWeight($yui::YD_HORIZ, 3);
        $hbox           = $factory->createHBox($vbox);
        $factory->createHSpacing($hbox, 1.0);
        $label          = $factory->createLabel($hbox, $loc->N("Password:") );
        $factory->createHSpacing($hbox, 1.0);
        $widgets{pass}  = $factory->createInputField($hbox, "", 1);
        $label->setWeight($yui::YD_HORIZ, 1);
        $widgets{pass}->setWeight($yui::YD_HORIZ, 3);

    }
    # recalc layout
    $options->{replace_pnt}->showChild();
    $options->{dialog}->recalcLayout();
    $options->{dialog}->doneMultipleChanges();

    return \%widgets;
}

sub add_callback() {

    my $retVal = 0;

    my $appTitle = yui::YUI::app()->applicationTitle();
    ## set new title to get it in dialog
    yui::YUI::app()->setApplicationTitle($loc->N("Add a medium"));

    my $factory      = yui::YUI::widgetFactory;

    my $dialog  = $factory->createPopupDialog();
    my $minSize = $factory->createMinSize( $dialog, 60, 5 );
    my $vbox    = $factory->createVBox( $minSize );

    $factory->createVSpacing($vbox, 0.5);

    my $hbox    = $factory->createHBox( $factory->createLeft($vbox) );
    $factory->createHeading($hbox, $loc->N("Adding a medium:"));
    $factory->createVSpacing($vbox, 0.5);

    $hbox    = $factory->createHBox($vbox);
    $factory->createHSpacing($hbox, 1.0);
    my $label         = $factory->createLabel($hbox, $loc->N("Type of medium:") );
    my $media_type = $factory->createComboBox($hbox, "", 0);
    $media_type->setWeight($yui::YD_HORIZ, 2);

    my %radios_infos = (
            local => { name => $loc->N("Local files"),  url => $loc->N("Medium path:"), dirsel => 1 },
            ftp   => { name => $loc->N("FTP server"),   url => $loc->N("URL:"), loginpass => 1 },
            rsync => { name => $loc->N("RSYNC server"), url => $loc->N("URL:") },
            http  => { name => $loc->N("HTTP server"),  url => $loc->N("URL:") },
        removable => { name => $loc->N("Removable device (CD-ROM, DVD, ...)"),
                       url  => $loc->N("Path or mount point:"), dirsel => 1 },
    );
    my @radios_names_ordered = qw(local ftp rsync http removable);

    my $itemColl = new yui::YItemCollection;
    foreach my $elem (@radios_names_ordered) {
        my $it = new yui::YItem($radios_infos{$elem}->{'name'}, 0);
        if ($elem eq $radios_names_ordered[0])  {
            $it->setSelected(1);
        }
        $itemColl->push($it);
        $it->DISOWN();
    }
    $media_type->addItems($itemColl);
    $media_type->setNotify(1);

    $hbox           = $factory->createHBox($vbox);
    $factory->createHSpacing($hbox, 1.0);
    $label          = $factory->createLabel($hbox, $loc->N("Medium name:") );
    $factory->createHSpacing($hbox, 1.0);
    my $media_name = $factory->createInputField($hbox, "", 0);
    $media_name->setWeight($yui::YD_HORIZ, 2);

    # per function layout (replace point)
    my $align       = $factory->createLeft($vbox);
    my $replace_pnt = $factory->createReplacePoint($align);

    my $add_widgets = _build_add_dialog({replace_pnt => $replace_pnt, dialog => $dialog,
                                     info => \%radios_infos, selected => $radios_names_ordered[0]}
    );
    # check-boxes
    $hbox    = $factory->createHBox($factory->createLeft($vbox));
    $factory->createHSpacing($hbox, 1.3);
    my $dist_media   = $factory->createCheckBox($hbox, $loc->N("Create media for a whole distribution"), 0);
    $hbox    = $factory->createHBox($factory->createLeft($vbox));
    $factory->createHSpacing($hbox, 1.3);
    my $update_media = $factory->createCheckBox($hbox, $loc->N("Tag this medium as an update medium"),   0);
    $dist_media->setNotify(1);

    # Last line buttons
    $factory->createVSpacing($vbox, 0.5);
    $hbox            = $factory->createHBox($vbox);
    my $cancelButton = $factory->createPushButton($hbox,  $loc->N("&Cancel"));
    $factory->createHSpacing($hbox, 3.0);
    my $okButton   = $factory->createPushButton($hbox,  $loc->N("&Ok"));

    $cancelButton->setDefaultButton(1);

    # dialog event loop
    while(1) {
        my $event     = $dialog->waitForEvent();
        my $eventType = $event->eventType();

        #event type checking
        if ($eventType == $yui::YEvent::CancelEvent) {
            last;
        }
        elsif ($eventType == $yui::YEvent::WidgetEvent) {
            ### widget
            my $widget = $event->widget();
            if ($widget == $cancelButton) {
                last;
            }
            elsif ($widget == $media_type) {
                my $item = $media_type->selectedItem();
                my $sel = $item ? $item->index() : 0 ;
                $add_widgets = _build_add_dialog({replace_pnt => $replace_pnt, dialog => $dialog,
                                     info => \%radios_infos, selected => $radios_names_ordered[$sel]}
                );
            }
            elsif ($widget == $dist_media) {
                $update_media->setEnabled(!$dist_media->value());
            }
            elsif ($widget == $okButton) {
                my $item = $media_type->selectedItem();
                my $sel = $item ? $item->index() : 0 ;
                my $info = $radios_infos{$radios_names_ordered[$sel]};
                my $name = $media_name->value();
                my $url  = $add_widgets->{url}->value();
                $name eq '' || $url eq '' and interactive_msg('rpmdragora', $loc->N("You need to fill up at least the two first entries.")), next;
                if (member($name, map { $_->{name} } @{$urpm->{media}})) {
                    interactive_msg('rpmdragora',
                                    $loc->N("There is already a medium called <%s>,\ndo you really want to replace it?", $name),
                                    yesno => 1) or next;
                }

                my %i = (
                    name    => $name,
                    url     => $url,
                    distrib => $dist_media->value()   ? 1 : 0,
                    update  => $update_media->value() ? 1 : undef,
                );
                my %make_url = (
                    local => "file:/$i{url}",
                    http => $i{url},
                    rsync => $i{url},
                    removable => "removable:/$i{url}",
                );
                $i{url} =~ s|^ftp://||;
                $make_url{ftp} = sprintf "ftp://%s%s",
                        defined($add_widgets->{login})
                        ?
                            $add_widgets->{login}->value() . ':' . ( $add_widgets->{pass}->value() ?
                                                                     $add_widgets->{pass}->value() :
                                                                     '')
                        :
                            '',
                        $i{url};

                if ($i{distrib}) {
                    add_medium_and_check(
                        $urpm,
                        { nolock => 1, distrib => 1 },
                        $i{name}, $make_url{$radios_names_ordered[$sel]}, probe_with => 'synthesis', update => $i{update},
                    );
                } else {
                    if (member($i{name}, map { $_->{name} } @{$urpm->{media}})) {
                        urpm::media::select_media($urpm, $i{name});
                        urpm::media::remove_selected_media($urpm);
                    }
                    add_medium_and_check(
                        $urpm,
                        { nolock => 1 },
                        $i{name}, $make_url{$radios_names_ordered[$sel]}, $i{hdlist}, update => $i{update},
                    );
                }

                $retVal = 1;
                last;
            }
            else {
                my $item = $media_type->selectedItem();
                my $sel = $item ? $item->index() : 0 ;
                if (defined($radios_infos{$radios_names_ordered[$sel]}->{dirsel}) &&
                    defined($add_widgets->{dirsel}) ) {
                    if ($widget == $add_widgets->{dirsel}) {
                        my $dir = yui::YUI::app()->askForExistingDirectory(home(),
                                          $radios_infos{$radios_names_ordered[$sel]}->{url}
                        );
                        $add_widgets->{url}->setValue($dir) if ($dir);
                    }
                }
            }
        }
    }
### End ###

    $dialog->destroy();

    #restore old application title
    yui::YUI::app()->setApplicationTitle($appTitle) if $appTitle;

    return $retVal;

}

sub options_callback() {

    my $appTitle = yui::YUI::app()->applicationTitle();
    ## set new title to get it in dialog
    yui::YUI::app()->setApplicationTitle($loc->N("Global options for package installation"));

    my $factory      = yui::YUI::widgetFactory;

    my $dialog  = $factory->createPopupDialog();
    my $minSize = $factory->createMinSize( $dialog, 50, 5 );
    my $vbox    = $factory->createVBox( $minSize );

    my $hbox    = $factory->createHBox($vbox);
    $factory->createHSpacing($hbox, 1.0);
    my $label        = $factory->createLabel($hbox, $loc->N("Verify RPMs to be installed:") );
    $factory->createHSpacing($hbox, 3.5);
    my $verify_rpm   = $factory->createComboBox($hbox, "", 0);
    $verify_rpm->setWeight($yui::YD_HORIZ, 2);
    my @verif = ($loc->N("never"), $loc->N("always"));
    my $verify_rpm_value = $urpm->{global_config}{'verify-rpm'} || 0;

    my $itemColl = new yui::YItemCollection;
    my $cnt = 0;
    foreach my $elem (@verif) {
        my $it = new yui::YItem($elem, 0);
        if ($cnt == $verify_rpm_value) {
            $it->setSelected(1);
        }
        $itemColl->push($it);
        $it->DISOWN();
        $cnt++;
    }
    $verify_rpm->addItems($itemColl);

    $hbox    = $factory->createHBox($vbox);
    $factory->createHSpacing($hbox, 1.0);
    $label        = $factory->createLabel($hbox, $loc->N("Download program to use:") );
    $factory->createHSpacing($hbox, 4.0);
    my $downloader_entry   = $factory->createComboBox($hbox, "", 0);
    $downloader_entry->setWeight($yui::YD_HORIZ, 2);

    my @comboList =  urpm::download::available_ftp_http_downloaders() ;
    my $downloader = $urpm->{global_config}{downloader} || $comboList[0];

    if (scalar(@comboList) > 0) {
        $itemColl = new yui::YItemCollection;
        foreach my $elem (@comboList) {
            my $it = new yui::YItem($elem, 0);
            if ($elem eq $downloader) {
                $it->setSelected(1);
            }
            $itemColl->push($it);
            $it->DISOWN();
        }
        $downloader_entry->addItems($itemColl);
    }

    $hbox    = $factory->createHBox($vbox);
    $factory->createHSpacing($hbox, 1.0);
    $label        = $factory->createLabel($hbox, $loc->N("XML meta-data download policy:") );
    my $xml_info_policy   = $factory->createComboBox($hbox, "", 0);
    $xml_info_policy->setWeight($yui::YD_HORIZ, 2);

    my @xml_info_policies   = ('',   'never',    'on-demand',    'update-only',    'always');
    my @xml_info_policiesL  = ('', $loc->N("Never"), $loc->N("On-demand"), $loc->N("Update-only"), $loc->N("Always"));
    my $xml_info_policy_value = $urpm->{global_config}{'xml-info'};

    $itemColl = new yui::YItemCollection;
    $cnt = 0;
    foreach my $elem (@xml_info_policiesL) {
        my $it = new yui::YItem($elem, 0);
        if ($xml_info_policy_value && $xml_info_policy_value eq $xml_info_policies[$cnt]) {
            $it->setSelected(1);
        }
        $itemColl->push($it);
        $it->DISOWN();
        $cnt++;
    }
    $xml_info_policy->addItems($itemColl);

    ### TODO tips ###
    #tip =>
    #join("\n",
    #$loc->N("For remote media, specify when XML meta-data (file lists, changelogs & information) are downloaded."),
    #'',
    #$loc->N("Never"),
    #$loc->N("For remote media, XML meta-data are never downloaded."),
    #'',
    #$loc->N("On-demand"),
    #$loc->N("(This is the default)"),
    #$loc->N("The specific XML info file is downloaded when clicking on package."),
    #'',
    #$loc->N("Update-only"),
    #$loc->N("Updating media implies updating XML info files already required at least once."),
    #'',
    #$loc->N("Always"),
    #$loc->N("All XML info files are downloaded when adding or updating media."),

    $factory->createVSpacing($vbox, 0.5);


    ### last line buttons
    $factory->createVSpacing($vbox, 0.5);
    $hbox            = $factory->createHBox($vbox);
    my $cancelButton = $factory->createPushButton($hbox,  $loc->N("&Cancel"));
    $factory->createHSpacing($hbox, 3.0);
    my $okButton   = $factory->createPushButton($hbox,  $loc->N("&Ok"));

    $cancelButton->setDefaultButton(1);

    # dialog event loop
    while(1) {
        my $event     = $dialog->waitForEvent();
        my $eventType = $event->eventType();

        #event type checking
        if ($eventType == $yui::YEvent::CancelEvent) {
            last;
        }
        elsif ($eventType == $yui::YEvent::WidgetEvent) {
            ### widget
            my $widget = $event->widget();
            if ($widget == $cancelButton) {
                last;
            }
            elsif ($widget == $okButton) {
                my $changed = 0;
                my $item = $verify_rpm->selectedItem();
                if ($item->index() != $verify_rpm_value) {
                    $changed = 1;
                    $urpm->{global_config}{'verify-rpm'} = $item->index();
                }
                $item = $downloader_entry->selectedItem();
                if ($item->label() ne $downloader) {
                    $changed = 1;
                    $urpm->{global_config}{downloader} = $item->label();
                }
                $item = $xml_info_policy->selectedItem();
                if ($xml_info_policies[$item->index()] ne $xml_info_policy_value) {
                    $changed = 1;
                    $urpm->{global_config}{'xml-info'} = $xml_info_policies[$item->index()];
                }
                if ($changed) {
                    urpm::media::write_config($urpm);
                    $urpm = fast_open_urpmi_db();
                }

                last;
            }
        }
    }

    ### End ###

    $dialog->destroy();

    #restore old application title
    yui::YUI::app()->setApplicationTitle($appTitle) if $appTitle;

}

#=============================================================

=head2 remove_callback

=head3 INPUT

$selection: YItemCollection (selected items)


=head3 DESCRIPTION

Remove the selected medias

=cut

#=============================================================

sub remove_callback {
    my $selection = shift;

    my @rows;
    for (my $it = 0; $it < $selection->size(); $it++) {
        my $item = $selection->get($it);
        push @rows, $item->index();
    }
    @rows == 0 and return 0;
    interactive_msg(
        $loc->N("Source Removal"),
        @rows == 1 ?
            $loc->N("Are you sure you want to remove source \"%s\"?", $urpm->{media}[$rows[0]]{name}) :
            $loc->N("Are you sure you want to remove the following sources?") . "\n\n" .
                format_list(map { $urpm->{media}[$_]{name} } @rows),
        yesno => 1, scroll => 1,
    ) or return 0;

    my $wait = wait_msg($loc->N("Please wait, removing medium..."));
    foreach my $row (reverse(@rows)) {
        $something_changed = 1;
        urpm::media::remove_media($urpm, [ $urpm->{media}[$row] ]);
    }
    urpm::media::write_urpmi_cfg($urpm);
    remove_wait_msg($wait);

    return 1;
}


#=============================================================

=head2 upwards_callback

=head3 INPUT

$table: Mirror table (YTable)

=head3 DESCRIPTION

Move selected item to high priority level

=cut

#=============================================================
sub upwards_callback {
    my $table = shift;

    ## get the first
    my $item = $table->selectedItem();
    !$item and return 0;
    return 0 if ($item->index() == 0);
    my $row = $item->index();
    my @media = ( $urpm->{media}[$row-1], $urpm->{media}[$row]);
    $urpm->{media}[$row] = $media[0];
    $urpm->{media}[$row-1] = $media[1];

    urpm::media::write_config($urpm);
    $urpm = fast_open_urpmi_db();
    return $row - 1;
}

#=============================================================

=head2 downwards_callback

=head3 INPUT

$table: Mirror table (YTable)

=head3 DESCRIPTION

Move selected item to low priority level

=cut

#=============================================================
sub downwards_callback {
    my $table = shift;

    ## get the first
    my $item = $table->selectedItem();
    !$item and return 0;
    my $row = $item->index();
    return $row if ($row >= $table->itemsCount()-1);

    my @media = ( $urpm->{media}[$row], $urpm->{media}[$row+1]);