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