libyui-qt-pkg  2.45.13.1
YQPkgDescriptionView.h
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: YQPkgDescriptionView.h
35 
36  Author: Stefan Hundhammer <sh@suse.de>
37 
38 /-*/
39 
40 
41 #ifndef YQPkgDescriptionView_h
42 #define YQPkgDescriptionView_h
43 
44 #include <QUrl>
45 #include "YQPkgGenericDetailsView.h"
46 
47 using std::list;
48 using std::string;
49 
50 
51 /**
52  * @short Display the description of a ZyppObj derived object along with its
53  * name and summary.
54  **/
56 {
57  Q_OBJECT
58 
59 public:
60 
61  /**
62  * Constructor
63  **/
64  YQPkgDescriptionView( QWidget * parent, bool showSupportability = true );
65 
66  /**
67  * Destructor
68  **/
69  virtual ~YQPkgDescriptionView();
70 
71  /**
72  * Show details for the specified package:
73  * In this case the package description.
74  * Overwritten from YQPkgGenericDetailsView.
75  **/
76  virtual void showDetails( ZyppSel selectable );
77 
78  /**
79  * Get the document pointed to by a hyperlink.
80  *
81  * Reimplemented from QTextBrowser to avoid having an empty text each time
82  * the user clicks on a hyperlink.
83  **/
84  virtual void setSource( const QUrl & name );
85 
86 protected:
87 
88  /**
89  * Format a multi-line text into paragraphs
90  **/
91  QString simpleHtmlParagraphs( QString text );
92 
93  /**
94  * Show information for a hyperlinked object,
95  * e.g., a "pkg:somepkg" link to another package.
96  **/
97  void showLink( const QUrl & url );
98 
99  /**
100  * Return html text that contains a list of application icons.
101  **/
102  QString applicationIconList( const list<string> & fileList ) const;
103 
104  /**
105  * Find absolute file name (incl. path) for a icon.
106  **/
107  QString findDesktopIcon ( const QString& iconName ) const;
108 
109  /**
110  * Extract name, icon and exec attributes from a desktop file.
111  **/
112  QMap<QString, QString> readDesktopFile( const QString & fileName ) const;
113 
114  /**
115  * Search for all desktop files in a file list.
116  **/
117  QStringList findDesktopFiles( const list<string> & fileList ) const;
118 
119  /**
120  * Initialize the language code (lang).
121  **/
122  void initLang();
123 
124 private:
125  QString langWithCountry;
126  QString lang;
127  bool _showSupportability;
128 
129 };
130 
131 
132 #endif // ifndef YQPkgDescriptionView_h
Display the description of a ZyppObj derived object along with its name and summary.
QStringList findDesktopFiles(const list< string > &fileList) const
Search for all desktop files in a file list.
QString simpleHtmlParagraphs(QString text)
Format a multi-line text into paragraphs.
YQPkgDescriptionView(QWidget *parent, bool showSupportability=true)
Constructor.
virtual void setSource(const QUrl &name)
Get the document pointed to by a hyperlink.
Abstract base class for details views.
QString findDesktopIcon(const QString &iconName) const
Find absolute file name (incl.
void initLang()
Initialize the language code (lang).
QMap< QString, QString > readDesktopFile(const QString &fileName) const
Extract name, icon and exec attributes from a desktop file.
void showLink(const QUrl &url)
Show information for a hyperlinked object, e.g., a "pkg:somepkg" link to another package.
virtual ~YQPkgDescriptionView()
Destructor.
virtual void showDetails(ZyppSel selectable)
Show details for the specified package: In this case the package description.
QString applicationIconList(const list< string > &fileList) const
Return html text that contains a list of application icons.