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