~ubuntu-branches/ubuntu/vivid/muon/vivid-proposed

« back to all changes in this revision

Viewing changes to updater/ChangelogWidget.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-03-24 23:06:35 UTC
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: package-import@ubuntu.com-20150324230635-nvt7aq7kqvaxq36e
Tags: upstream-5.2.2-1
ImportĀ upstreamĀ versionĀ 5.2.2-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include <QtCore/QPropertyAnimation>
27
27
#include <QtCore/QStringBuilder>
28
28
#include <QtCore/QTextStream>
29
 
#include <QProcess>
30
29
#include <QtWidgets/QToolButton>
31
30
#include <QtWidgets/QVBoxLayout>
32
31
#include <QtWidgets/QApplication>
39
38
#include <KPixmapSequenceOverlayPainter>
40
39
#include <KIconLoader>
41
40
#include <QTextBrowser>
42
 
#include <QPushButton>
43
 
#include <QDebug>
44
41
 
45
42
ChangelogWidget::ChangelogWidget(QWidget *parent)
46
43
        : QWidget(parent)
64
61
    sideWidget->setLayout(sideLayout);
65
62
 
66
63
    m_changelogBrowser = new QTextBrowser(this);
67
 
    m_changelogBrowser->setOpenLinks(false);
68
64
    m_changelogBrowser->setFrameShape(QFrame::NoFrame);
69
65
    m_changelogBrowser->setFrameShadow(QFrame::Plain);
70
66
    m_changelogBrowser->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
71
 
    connect(m_changelogBrowser, &QTextBrowser::anchorClicked, this, &ChangelogWidget::showMore);
72
67
 
73
68
    QWidget *viewport = m_changelogBrowser->viewport();
74
69
    QPalette palette = viewport->palette();
82
77
    m_busyWidget->setWidget(this);
83
78
 
84
79
    QHBoxLayout *mainLayout = new QHBoxLayout(this);
 
80
    mainLayout->setMargin(0);
85
81
    mainLayout->setSpacing(0);
86
82
    mainLayout->addWidget(sideWidget);
87
83
    mainLayout->addWidget(m_changelogBrowser);
148
144
    if (m_package) {
149
145
        // Work around http://bugreports.qt.nokia.com/browse/QTBUG-2533 by forcibly resetting the CharFormat
150
146
        m_changelogBrowser->setCurrentCharFormat(QTextCharFormat());
151
 
        QString fullText;
152
 
        fullText += i18nc("@info/rich", "<p><b>Package Name:</b> <a href='package:%1'>%1</a></p>", m_package->packageName());
153
 
        fullText += i18nc("@info/rich", "<p><b>Installed Version:</b> %1</p>", m_package->installedVersion());
154
 
        fullText += changelog;
155
 
        m_changelogBrowser->setHtml(fullText);
 
147
        m_changelogBrowser->setHtml(changelog);
156
148
    }
157
149
 
158
150
    m_busyWidget->stop();
168
160
    m_busyWidget->start();
169
161
    m_package->fetchChangelog();
170
162
}
171
 
 
172
 
void ChangelogWidget::showMore(const QUrl& package)
173
 
{
174
 
    bool b = QProcess::startDetached("muon-discover", { "--application", package.path() });
175
 
    if (!b) {
176
 
        qWarning() << "Couldn't launch muon-discover";
177
 
    }
178
 
}