mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
kdeui: enable opening of external links for KMessageWidget and disable text selection
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
e86c7d9264
commit
53dc9fede5
2 changed files with 7 additions and 5 deletions
|
@ -212,7 +212,7 @@ int KMessageBox::createKMessageBox(KDialog *dialog, const QIcon &icon, const QSt
|
|||
styleOption.initFrom(listWidget);
|
||||
QFontMetrics fm(styleOption.font);
|
||||
int w = listWidget->width();
|
||||
Q_FOREACH(const QString &str, strlist) {
|
||||
foreach (const QString &str, strlist) {
|
||||
w = qMax(w, fm.width(str));
|
||||
}
|
||||
const int borderWidth = listWidget->width() - listWidget->viewport()->width() + listWidget->verticalScrollBar()->height();
|
||||
|
@ -246,8 +246,9 @@ int KMessageBox::createKMessageBox(KDialog *dialog, const QIcon &icon, const QSt
|
|||
detailTextBrowser->setMinimumHeight(detailTextBrowser->fontMetrics().lineSpacing() * 11);
|
||||
detailTextBrowser->setOpenExternalLinks(options & KMessageBox::AllowLink);
|
||||
Qt::TextInteractionFlags flags = Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard;
|
||||
if ( options & KMessageBox::AllowLink )
|
||||
if (options & KMessageBox::AllowLink) {
|
||||
flags |= Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard;
|
||||
}
|
||||
detailTextBrowser->setTextInteractionFlags(flags);
|
||||
detailsLayout->addWidget(detailTextBrowser, 50);
|
||||
if (!usingListWidget) {
|
||||
|
|
|
@ -122,8 +122,8 @@ void KMessageWidgetPrivate::updateColors()
|
|||
const KColorScheme scheme(QPalette::Active, KColorScheme::Window);
|
||||
switch (messagetype) {
|
||||
case KMessageWidget::Information: {
|
||||
// even tho the selection color may be more suitable for that it cannot be used because
|
||||
// the text is selectable
|
||||
// even tho the selection color may be more suitable for that there is KColorScheme
|
||||
// background type for it
|
||||
textlabel->bg = scheme.background(KColorScheme::PositiveBackground).color();
|
||||
break;
|
||||
}
|
||||
|
@ -185,7 +185,8 @@ KMessageWidget::KMessageWidget(QWidget *parent)
|
|||
|
||||
d->textlabel = new KMessageLabel(this);
|
||||
d->textlabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
||||
d->textlabel->setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::LinksAccessibleByMouse);
|
||||
d->textlabel->setOpenExternalLinks(true);
|
||||
d->textlabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
|
||||
d->textlabel->setAlignment(Qt::AlignCenter);
|
||||
connect(d->textlabel, SIGNAL(linkActivated(QString)), this, SIGNAL(linkActivated(QString)));
|
||||
connect(d->textlabel, SIGNAL(linkHovered(QString)), this, SIGNAL(linkHovered(QString)));
|
||||
|
|
Loading…
Add table
Reference in a new issue