1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQPkgFileListView.cc
15 Author: Stefan Hundhammer <sh@suse.de>
17 Textdomain "packages-qt"
21 #define y2log_component "qt-pkg"
22 #include <ycp/y2log.h>
25 #include "YQPkgFileListView.h"
26 #include "YQPkgDescriptionDialog.h"
31 #define MAX_LINES 5000
34 YQPkgFileListView::YQPkgFileListView( QWidget * parent )
35 : YQPkgGenericDetailsView( parent )
40 YQPkgFileListView::~YQPkgFileListView()
47 YQPkgFileListView::showDetails( ZyppSel selectable )
49 _selectable = selectable;
57 QString html = htmlHeading( selectable,
58 true ); // showVersion
60 ZyppPkg installed = tryCastToZyppPkg( selectable->installedObj() );
64 html += formatFileList( installed->filenames() );
68 html += "<p><i>" + _( "Information only available for installed packages." ) + "</i></p>";
71 setTextFormat( Qt::RichText );
77 QString YQPkgFileListView::formatFileList( const list<string> & fileList ) const
80 unsigned line_count = 0;
82 for ( list<string>::const_iterator it = fileList.begin();
83 it != fileList.end() && line_count < MAX_LINES;
86 QString line = htmlEscape( fromUTF8( *it ) );
88 if ( line.contains( "/bin/" ) ||
89 line.contains( "/sbin/" ) )
91 line = "<b>" + line + "</b>";
94 html += line + "<br>";
97 if ( fileList.size() > MAX_LINES )
103 // %1 is the total number of files in a file list
104 html += "<br>" + _( "%1 files total" ).arg( (unsigned long) fileList.size() );
106 return "<p>" + html + "</p>";
110 #include "YQPkgFileListView.moc"