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>";
76 QString YQPkgFileListView::formatFileList( const list<string> & fileList ) const
79 unsigned line_count = 0;
81 for ( list<string>::const_iterator it = fileList.begin();
82 it != fileList.end() && line_count < MAX_LINES;
85 QString line = htmlEscape( fromUTF8( *it ) );
87 if ( line.contains( "/bin/" ) ||
88 line.contains( "/sbin/" ) )
90 line = "<b>" + line + "</b>";
93 html += line + "<br>";
96 if ( fileList.size() > MAX_LINES )
102 // %1 is the total number of files in a file list
103 html += "<br>" + _( "%1 files total" ).arg( (unsigned long) fileList.size() );
105 return "<p>" + html + "</p>";
109 #include "YQPkgFileListView.moc"