42 #define YUILogComponent "qt-pkg" 46 #include "YQPkgChangeLogView.h" 47 #include "YQPkgDescriptionDialog.h" 53 static const int MAX_DISPLAYED_CHANGES = 512;
70 _selectable = selectable;
78 yuiDebug() <<
"Generating changelog..." << std::endl;
83 ZyppPkg installed = tryCastToZyppPkg( selectable->installedObj() );
89 int not_displayed = installed->changelog().size() - MAX_DISPLAYED_CHANGES;
90 if (not_displayed > 0)
92 yuiWarning() <<
"Changelog size limit reached, ignoring last " 93 << not_displayed <<
" items" << std::endl;
94 html.append(
"<p class='note'>" 95 +
notDisplayedChanges(not_displayed, installed->name() +
"-" + installed->edition().asString())
101 html +=
"<p><i>" + _(
"Information only available for installed packages." ) +
"</i></p>";
105 yuiDebug() <<
"Changelog HTML size: " << html.size() << std::endl;
107 yuiDebug() <<
"Changes displayed" << std::endl;
114 yuiDebug() <<
"Changelog size: " << changeLog.size() <<
" entries" << std::endl;
118 for ( zypp::Changelog::const_iterator it = changeLog.begin();
119 it != changeLog.end();
122 QString changes =
htmlEscape( fromUTF8( (*it).text() ) );
123 changes.replace(
"\n",
"<br>" );
124 changes.replace(
" ",
" " );
127 cell( (*it).date() ) +
128 cell( (*it).author() ) +
129 "<td valign='top'>" + changes +
"</td>" 132 if (++index == MAX_DISPLAYED_CHANGES)
136 return html.isEmpty() ?
"" :
table( html );
144 QString msg = _(
"(%1 more change entries are not displayed. Run \"" 145 "%2\" to see the complete change log.)");
147 QString cmd = QString(
"rpm -q --changelog %1").arg(pkg.c_str());
148 return msg.arg(QString::number(missing), cmd);
virtual ~YQPkgChangeLogView()
Destructor.
QString changeLogTable(const zypp::Changelog &changeLog) const
Format a change log list in HTML.
static QString htmlHeading(ZyppSel selectable, bool showVersion=false)
Returns a uniform heading in HTML format for the specified selectable: name and summary or name...
Abstract base class for details views.
static QString cell(QString contents)
Returns a string containing a HTML table cell with 'contents'.
YQPkgChangeLogView(QWidget *parent)
Constructor.
static QString htmlEscape(const QString &plainText)
Escapes characters special to HTML in a ( plain text ) string, such as: '<' -> '<' '>' -> '>' '&' -> ...
static QString table(const QString &contents)
Returns a string containing a HTML table with 'contents'.
virtual void showDetails(ZyppSel selectable)
Show details for the specified package: In this case the package description.
static QString row(const QString &contents)
Returns a string containing a HTML table row with 'contents'.
static QString htmlStart()
starts the html tag and set the style
QString notDisplayedChanges(int missing, const std::string &pkg)
Format an info message about not displayed changes.