1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQPkgChangeLogView.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 "YQPkgChangeLogView.h"
26 #include "YQPkgDescriptionDialog.h"
32 YQPkgChangeLogView::YQPkgChangeLogView( QWidget * parent )
33 : YQPkgGenericDetailsView( parent )
38 YQPkgChangeLogView::~YQPkgChangeLogView()
45 YQPkgChangeLogView::showDetails( ZyppSel selectable )
47 _selectable = selectable;
55 QString html = htmlHeading( selectable,
56 true ); // showVersion
58 ZyppPkg installed = tryCastToZyppPkg( selectable->installedObj() );
62 html += changeLogTable( installed->changelog() );
66 html += "<p><i>" + _( "Information only available for installed packages." ) + "</i></p>";
69 setTextFormat( Qt::RichText );
75 QString YQPkgChangeLogView::changeLogTable( const zypp::Changelog & changeLog ) const
79 for ( zypp::Changelog::const_iterator it = changeLog.begin();
80 it != changeLog.end();
83 QString changes = htmlEscape( fromUTF8( (*it).text() ) );
84 changes.replace( "\n", "<br>" );
85 changes.replace( " ", " " );
88 cell( (*it).date() ) +
89 cell( (*it).author() ) +
90 "<td valign=top>" + changes + "</td>" // cell() calls htmlEscape() !
94 return html.isEmpty() ? "" : table( html );
98 #include "YQPkgChangeLogView.moc"