]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/pkg/YQPackageSelectorHelp.cc
picking up branches/tmp/sh/qt4-port/, merging it with trunk
[duncan/yast2-qt4.git] / src / pkg / YQPackageSelectorHelp.cc
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQPackageSelectorHelp.cc
14   See also:   YQPackageSelector.cc
15
16   Author:     Stefan Hundhammer <sh@suse.de>
17
18   Textdomain "packages-qt"
19
20 /-*/
21
22 #include <qstring.h>
23
24 #define y2log_component "qt-pkg"
25 #include <ycp/y2log.h>
26
27 #include "YQPackageSelector.h"
28 #include "YQPkgTextDialog.h"
29
30 #include "utf8.h"
31 #include "YQi18n.h"
32
33
34 void
35 YQPackageSelector::help()
36 {
37     // Translators: Headline for help about the package manager in general
38
39     QString html = YQPkgTextDialog::htmlHeading( _( "The YaST2 Package Manager" ) );
40
41     // Translators: Automatic word-wrapping.
42     html += para( _( "<b>Note:</b> This is a just a short  overview."
43                      " Refer to the manual for details." ) );
44
45     if ( onlineUpdateMode() )
46     {
47         // Help specific to online update mode
48
49         html += para( _( "In this dialog, select patches to download and install." ) );
50         html += para( _( "The list on the left side contains available patches"
51                          " along with the respective patch kind (security, recommended, or optional)"
52                          " and the (estimated) download size." ) );
53         html += para( _( "This list normally contains only those patches that are not installed on your system yet."
54                          " You can change that with the <b>Include Installed Patches</b> check box below the list." ) );
55         html += para( _( "The <b>Patch Description</b> field contains a longer explanation of the currently"
56                          " selected patch. Click a patch in the list to view its description here." ) );
57         html += para( _( "The package list on the right side shows the contents of the currently selected patch, i.e.,"
58                          " the packages it contains. You cannot install or delete individual packages from a patch,"
59                          " only the patch as a whole. This is intentional to avoid system inconsistencies." ) );
60
61         // Translators: Please keep the reference to "filter views" to distinguish between "filter views" that
62         // affect the amount of visible packages in the package list and "details views" ( below the package list )
63         // that show details about the ( one ) currently selected package in the package list.
64
65         html += para( _( "In addition to <b>Patches</b>, you can also select one of the other filter views"
66                          " from <b>Filter</b> at the upper left:" ) );
67         html += "<ul>";
68     }
69     else // ! _onlineUpdateMode
70     {
71         // Help specific to normal (non-online-update) mode
72
73         html += para( _( "In this dialog, select which packages to install, update, or delete."
74                          " You can select individual packages or entire package \"selections\"." ) );
75         html += para( _( "Click the status icon for a package or selection to change the status"
76                          " or right-click it to open a context menu." ) );
77         html += para( _( "Use the <b>Check Dependencies</b> button to resolve package dependencies."
78                          " Some packages require other packages to be installed."
79                          " Some packages can only be installed if certain other packages are not installed, too."
80                          " This check will automatically mark required packages for installation"
81                          " and it will warn you if there are dependency conflicts." ) );
82         html += para( _( "When you leave this dialog with <b>Accept</b>, this check will automatically be performed." ) );
83
84         // Translators: Please keep the reference to "filter views" to distinguish between "filter views" that
85         // affect the amount of visible packages in the package list and "details views" (below the package list)
86         // that show details about the (one) currently selected package in the package list.
87
88         html += para( _( "Select one of the available filter views with the <b>Filter</b> combo-box"
89                          " at the upper left:" ) );
90         html += "<ul>";
91
92         html += listItem( para( _( "<b>Selections</b> shows some predefined sets of packages that logically belong together." ) ) +
93                           para( _( "Use the check box next to the selection to select it as a whole."
94                                    " You can also select or deselect individual packages in the package list at the right." ) ) );
95
96     }
97
98     // Help common to all modes: Description of the various filter views
99
100
101     html += listItem( para( _( "<b>Package Groups</b> shows packages by category. You can expand and collapse tree items"
102                                " to refine or generalize categories. Click any category to display the packages"
103                                " in that category in the package list on the right side." ) ) +
104                       para( _( " <b>Hint:</b> There is a \"zzz All\" entry at the very end of the list that will show"
105                                " all packages. This may take a few seconds on slow machines." ) ) );
106
107     html += listItem( para( _( "<b>Search</b> allows you to search for packages that meet various criteria."
108                                " This is usually the easiest way to find a package if you know its name." ) )+
109                       para( _( "<b>Hint:</b> You can also use this to find out what package contains a certain library. "
110                                " Search in the <b>Provides</b> RPM field." ) ) );
111
112     html += listItem( para( _( "<b>Installation Summary</b> by default shows the changes to your system -- what packages"
113                                " will be installed, deleted, or updated." ) ) +
114                       para( _( "It is generally a good idea to use <b>Check Dependencies</b> then switch to"
115                                " <b>Installation Summary</b> before clicking <b>Accept</b>. This way you can see"
116                                " all changes that will be made to your system." ) ) +
117                       para( _( "You can also explicitly select what packages with what status to see here;"
118                                " use the check boxes at the left side." ) ) +
119                       para( _( "<b>Hint:</b> You can also reverse the effect of this filter."
120                                " You can see what packages remain the same on your system. Simply check <b>Keep</b>"
121                                " and uncheck everything else." ) ) );
122
123     html += "</ul>";
124
125     YQPkgTextDialog::showText( this, html );
126 }
127
128
129 void
130 YQPackageSelector::symbolHelp()
131 {
132     // Make sure all images used here are specified in
133     // helpimages_DATA in include/Makefile.am !
134
135     // Translators: Headline for help about package status icons
136     QString html = YQPkgTextDialog::htmlHeading( _( "Symbols Overview" ) );
137
138     html += "<br>";
139     html += "<table border=1>";
140
141     html += symHelp( "noinst.xpm",
142                      // Translators: Package status short ( ! ) description
143                      _( "Do not install" ),
144                      // Translators: Automatic word-wrapping.
145                      _( "This package is not installed and it will not be installed." ) );
146
147     html += symHelp( "install.xpm",
148                      // Translators: Package status short ( ! ) description
149                      _( "Install" ),
150                      // Translators: Automatic word-wrapping.
151                      _( "This package will be installed. It is not installed yet." ) );
152
153     html += symHelp( "keepinstalled.xpm",
154                      // Translators: Package status short ( ! ) description
155                      _( "Keep" ),
156                      // Translators: Automatic word-wrapping.
157                      _( "This package is already installed. Leave it untouched." ) );
158
159     html += symHelp( "update.xpm",
160                      // Translators: Package status short ( ! ) description
161                      _( "Update" ),
162                      // Translators: Automatic word-wrapping.
163                      _( "This package is already installed. Update it or reinstall it"
164                         " (if the versions are the same)." ) );
165
166     html += symHelp( "del.xpm",
167                      // Translators: Package status short ( ! ) description
168                      _( "Delete" ),
169                      // Translators: Automatic word-wrapping.
170                      _( "This package is already installed. Delete it." ) );
171
172     html += symHelp( "taboo.xpm",
173                      // Translators: Package status short ( ! ) description
174                      _( "Taboo" ),
175                      // Translators: Automatic word-wrapping.
176                      _( "This package is not installed and should not be installed under any circumstances, "
177                         " especially not because of unresolved dependencies that other packages"
178                         " might have or get." )
179                      + " "
180                      + _( "Packages set to \"taboo\" are treated as if they did not exist on any installation media." ) );
181
182     html += symHelp( "protected.xpm",
183                      // Translators: Package status short ( ! ) description
184                      _( "Protected" ),
185                      // Translators: Automatic word-wrapping.
186                      _( "This package is installed and should not be modified, "
187                         " especially not because of unresolved dependencies that other packages"
188                         " might have or get." )
189                      + " "
190                      + _( "Use this status for third-party packages that should not be overwritten by newer versions"
191                           " that may come with the distribution." ) );
192
193     html += symHelp( "autoinstall.xpm",
194                      // Translators: Package status short ( ! ) description
195                      _( "Autoinstall" ),
196                      // Translators: Automatic word-wrapping.
197                      _( "This package will be installed automatically because some other package needs it." )
198                      + " "
199                      + _( "<b>Hint:</b> You may have to use \"taboo\" to get rid of such a package." ) );
200
201     html += symHelp( "autoupdate.xpm",
202                      // Translators: Package status short ( ! ) description
203                      _( "Autoupdate" ),
204                      // Translators: Automatic word-wrapping.
205                      _( "This package is already installed, but some other package"
206                         " needs a newer version, so it will automatically be updated." ) );
207
208     html += symHelp( "autodel.xpm",
209                      // Translators: Package status short ( ! ) description
210                      _( "Autodelete" ),
211                      // Translators: Automatic word-wrapping.
212                      _( "This package is already installed, but package dependencies require that it is deleted." )
213                      + _( "This can happen, for example, if some other package obsoletes this one." ) );
214
215     // Translators: This is added to the explanation of a status. Use of
216     // "non-breakable space" ( HTML &nbsp; ) is recommended ( if the line doesn't
217     // get too long ) to avoid line-break in the middle of this explanaton.
218     QString bySelection = " " + _( "(by&nbsp;selection)" );
219
220     html += symHelp( "sel_autoinstall.xpm",
221                      // Translators: Package status short ( ! ) description
222                      _( "Autoinstall" ) + bySelection,
223                      // Translators: Automatic word-wrapping.
224                      _( "This package will be installed automatically because it is contained in a"
225                         " predefined software selection (e.g., \"Multimedia\", \"Development\")." ) );
226
227     html += symHelp( "sel_autoupdate.xpm",
228                      // Translators: Package status short ( ! ) description
229                      _( "Autoupdate" ) + bySelection,
230                      // Translators: Automatic word-wrapping.
231                      _( "This package is already installed, but there is a newer version."
232                         " It is contained in a predefined software selection (e.g., \"Multimedia\","
233                         " \"Development\") that you requested to update, so this package will"
234                         " automatically be updated." ) );
235
236     html += symHelp( "sel_autodel.xpm",
237                      // Translators: Package status short ( ! ) description
238                      _( "Autodelete" ) + bySelection,
239                      // Translators: Automatic word-wrapping.
240                      _( "This package is already installed, but some predefined software selection"
241                         " (e.g., \"Multimedia\", \"Development\") requires that it is deleted." ) );
242
243     html += "/<table>";
244
245     YQPkgTextDialog::showText( this, html );
246 }
247
248
249 QString
250 YQPackageSelector::symHelp( const QString & imgFileName,
251                             const QString & summary,
252                             const QString & explanation         )
253 {
254     QString imgPath = HELPIMAGEDIR;
255     QString html = "<tr valign=top>";
256     html += "<td><img src=\"" + imgPath + "/" + imgFileName + "\"></td>"
257         + "<td>" + summary      + "</td>"
258         + "<td>" + explanation  + "</td>"
259         + "</tr>";
260
261     return html;
262 }
263
264
265 void
266 YQPackageSelector::keyboardHelp()
267 {
268     // Translators: Headline for help about "magic keys" in the package manager
269     QString html = YQPkgTextDialog::htmlHeading( _( "Special Keys Overview" ) );
270
271     // Translators: Additional hint that will be added to any of the following keyboard actions.
272     // Automatic word wrapping.
273     QString goto_next = "<br>" + _( "In any case, go to the next list item." );
274
275     html += "<br>";
276     html += "<table border=1>";
277
278     html += keyHelp( "+",
279                      // Translators: Keyboard action short ( ! ) description
280                      _( "Add" ),
281                      // Translators: Automatic word-wrapping.
282                      _( "Get this package. Install it if it is not installed yet."
283                         " Update it to the latest version if it is installed "
284                         " and there is a newer version." )
285                      + goto_next );
286
287     html += keyHelp( "-",
288                      // Translators: Keyboard action short ( ! ) description
289                      _( "Remove" ),
290                      // Translators: Automatic word-wrapping.
291                      _( "Get rid of this package. Mark it as \"do not install\" "
292                         "if it is not installed yet. Delete it if it is installed." )
293                      + goto_next );
294
295     html += keyHelp( "&gt;",
296                      // Translators: Keyboard action short ( ! ) description
297                      _( "Update" ),
298                      // Translators: Automatic word-wrapping.
299                      _( "Update this package if it is installed and there is a newer version."
300                         " Ignore packages that are not installed." )
301                      + goto_next );
302
303
304     html += keyHelp( "&lt;",
305                      // Translators: Keyboard action short ( ! ) description
306                      _( "Undo Update" ),
307                      // Translators: Automatic word-wrapping.
308                      _( "Undo the effect of \">\" above: Set package to \"keep\""
309                         " if it is currently set to \"update\". Ignore all other packages." )
310                      + goto_next );
311
312     html += keyHelp( "!",
313                      // Translators: Keyboard action short ( ! ) description
314                      _( "Taboo" ),
315                      // Translators: Automatic word-wrapping.
316                      _( "Set this package to \"taboo\" if it is not installed:"
317                         " make sure this package does not get installed, especially not"
318                         " because of unresolved dependencies that other packages might have or get. " )
319                      + " "
320                      + _( "Packages set to \"taboo\" are treated as if they did not exist on any installation media." )
321                      + "<br>"
322                      + goto_next );
323
324     html += keyHelp( "*",
325                      // Translators: Keyboard action short ( ! ) description
326                      _( "Protect" ),
327                      // Translators: Automatic word-wrapping.
328                      _( "Set this package to \"protected\" if it is installed:"
329                         " make sure this package will not be modified, especially not"
330                         " because of unresolved dependencies that other packages might have or get. " )
331                      + " "
332                      + _( "Use this for third-party packages that should not be overwritten by newer versions"
333                           " that may come with the distribution." )
334                      + "<br>"
335                      + goto_next );
336
337     html += "/<table>";
338
339     YQPkgTextDialog::showText( this, html );
340 }
341
342
343 QString
344 YQPackageSelector::keyHelp( const QString & key,
345                             const QString & summary,
346                             const QString & explanation         )
347 {
348     QString html = "<tr valign=top>";
349     html +=
350         "<td><table bgcolor=#E0E0E0><tr><td align=center><b>"
351         + key
352         + "</b></td></tr></table></td>"
353         + "<td>" + summary      + "</td>"
354         + "<td>" + explanation  + "</td>"
355         + "</tr>";
356
357     return html;
358 }
359
360
361 QString
362 YQPackageSelector::para( const QString & text )
363 {
364     return "<p>" + text + "</p>";
365 }
366
367
368 QString
369 YQPackageSelector::listItem( const QString & text )
370 {
371     return "<li>" + text + "</li>";
372 }
373
374