libyui-qt-pkg  2.44.7
 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  //FIXME: This should be HELP_ICONS_DIR but is set wrong by libyui
250  QString imgPath = "/usr/share/YaST2/images";
251  QString html = "<tr valign='top'>";
252  html += "<td><img src=\"" + imgPath + "/" + imgFileName + "\"></td>"
253  + "<td>" + summary + "</td>"
254  + "<td>" + explanation + "</td>"
255  + "</tr>";
256 
257  return html;
258 }
259 
260 
261 void
263 {
264  // Translators: Headline for help about "magic keys" in the package manager
265  QString html = YQPkgTextDialog::htmlHeading( _( "Special Keys Overview" ) );
266 
267  // Translators: Additional hint that will be added to any of the following keyboard actions.
268  // Automatic word wrapping.
269  QString goto_next = "<br>" + _( "In any case, go to the next list item." );
270 
271  html += "<br>";
272  html += "<table border=1>";
273 
274  html += keyHelp( "+",
275  // Translators: Keyboard action short (!) description
276  _( "Add" ),
277  // Translators: Automatic word-wrapping.
278  _( "Get this package. Install it if it is not installed yet."
279  " Update it to the latest version if it is installed "
280  " and there is a newer version." )
281  + goto_next );
282 
283  html += keyHelp( "-",
284  // Translators: Keyboard action short (!) description
285  _( "Remove" ),
286  // Translators: Automatic word-wrapping.
287  _( "Get rid of this package. Mark it as \"do not install\" "
288  "if it is not installed yet. Delete it if it is installed." )
289  + goto_next );
290 
291  html += keyHelp( "&gt;",
292  // Translators: Keyboard action short (!) description
293  _( "Update" ),
294  // Translators: Automatic word-wrapping.
295  _( "Update this package if it is installed and there is a newer version."
296  " Ignore packages that are not installed." )
297  + goto_next );
298 
299 
300  html += keyHelp( "&lt;",
301  // Translators: Keyboard action short (!) description
302  _( "Undo Update" ),
303  // Translators: Automatic word-wrapping.
304  _( "Undo the effect of \">\" above: Set package to \"keep\""
305  " if it is currently set to \"update\". Ignore all other packages." )
306  + goto_next );
307 
308  html += keyHelp( "!",
309  // Translators: Keyboard action short (!) description
310  _( "Taboo" ),
311  // Translators: Automatic word-wrapping.
312  _( "Set this package to \"taboo\" if it is not installed:"
313  " make sure this package does not get installed, especially not"
314  " because of unresolved dependencies that other packages might have or get. " )
315  + " "
316  + _( "Packages set to \"taboo\" are treated as if they did not exist on any installation media." )
317  + "<br>"
318  + goto_next );
319 
320  html += keyHelp( "*",
321  // Translators: Keyboard action short (!) description
322  _( "Protect" ),
323  // Translators: Automatic word-wrapping.
324  _( "Set this package to \"protected\" if it is installed:"
325  " make sure this package will not be modified, especially not"
326  " because of unresolved dependencies that other packages might have or get. " )
327  + " "
328  + _( "Use this for third-party packages that should not be overwritten by newer versions"
329  " that may come with the distribution." )
330  + "<br>"
331  + goto_next );
332 
333  html += "</table>";
334 
335  YQPkgTextDialog::showText( this, html );
336 }
337 
338 
339 QString
340 YQPackageSelector::keyHelp( const QString & key,
341  const QString & summary,
342  const QString & explanation )
343 {
344  QString html = "<tr valign='top'>";
345  html +=
346  "<td><table><tr><td align='center'><b>"
347  + key
348  + "</b></td></tr></table></td>"
349  + "<td>" + summary + "</td>"
350  + "<td>" + explanation + "</td>"
351  + "</tr>";
352 
353  return html;
354 }
355 
356 
357 QString
358 YQPackageSelector::para( const QString & text )
359 {
360  return "<p>" + text + "</p>";
361 }
362 
363 
364 QString
365 YQPackageSelector::listItem( const QString & text )
366 {
367  return "<li>" + text + "</li>";
368 }
369 
370 
QString keyHelp(const QString &key, const QString &summary, const QString &explanation)
Return HTML code describing a key.
QString symHelp(const QString &imgFileName, const QString &summary, const QString &explanation)
Return HTML code describing a symbol (an icon).
void keyboardHelp()
Display online help about magic keys.
static void showText(QWidget *parent, const QString &text)
Show a text and wait until the user confirmed with 'OK'.
void symbolHelp()
Display online help about symbols (package status icons).
static QString listItem(const QString &text)
Basic HTML formatting: Embed text into ...
void help()
Display (generic) online help.
static QString para(const QString &text)
Basic HTML formatting: Embed text into.
static QString htmlHeading(const QString &text)
Returns a uniform heading in HTML format.