Message info
 
To:kde-commits@kde.org From:Daniele E. Domenichelli Subject:[ktp-accounts-kcm] src: Cleanup Date:Fri, 30 Mar 2012 17:58:08 +0200 (CEST)
 

Git commit 936cc40303d96102087a14b7462bd72a3bed0148 by Daniele E. Domenichelli.
Committed on 28/02/2012 at 01:34.
Pushed by ddomenichelli into branch 'master'.

Cleanup

M +11 -11 src/accounts-list-delegate.cpp

http://commits.kde.org/telepathy-accounts-kcm/936cc40303d96102087a14b7462bd72a3bed0148

diff --git a/src/accounts-list-delegate.cpp b/src/accounts-list-delegate.cpp
index 43d4b12..9c1ff3c 100644
--- a/src/accounts-list-delegate.cpp
+++ b/src/accounts-list-delegate.cpp
@@ -173,7 +173,8 @@ void AccountsListDelegate::updateItemWidgets(const QList<QWidget *> widgets, con
statusTextLabel->setPalette(statusTextLabelPalette);
statusTextLabel->setFont(statusTextFont);
statusTextLabel->setText(statusText);
- statusTextLabel->setFixedSize(statusTextLabel->fontMetrics().boundingRect(statusText).width(), statusTextLabel->height());
+ statusTextLabel->setFixedSize(statusTextLabel->fontMetrics().boundingRect(statusText).width(),
+ statusTextLabel->height());
int statusTextLabelLeftMargin = contentRect.right() - statusTextLabel->width();
int statusTextLabelTopMargin = (outerRect.height() - statusTextLabel->height()) / 2;
statusTextLabel->move(statusTextLabelLeftMargin, statusTextLabelTopMargin);
@@ -197,7 +198,7 @@ void AccountsListDelegate::updateItemWidgets(const QList<QWidget *> widgets, con
QFont displayNameButtonFont = option.font;
QPalette displayNameButtonPalette = option.palette;
if (isEnabled) {
- displayNameButtonPalette.setColor(QPalette::WindowText, displayNameButtonPalette.color(QPalette::Normal, QPalette::Text));
+ displayNameButtonPalette.setColor(QPalette::WindowText, displayNameButtonPalette.color(QPalette::Active, QPalette::Text));
displayNameButtonFont.setBold(true);
} else {
displayNameButtonFont.setItalic(true);
@@ -214,9 +215,8 @@ void AccountsListDelegate::updateItemWidgets(const QList<QWidget *> widgets, con
QString displayNameButtonText = displayNameButton->fontMetrics().elidedText(displayName,
Qt::ElideRight,
innerRect.width() - (7*2));
- QRect displayNameButtonTextRect = displayNameButton->fontMetrics().boundingRect(displayNameButtonText);
displayNameButton->setText(displayNameButtonText);
- displayNameButton->setFixedSize(displayNameButtonTextRect.width() + (7*2),
+ displayNameButton->setFixedSize(displayNameButton->fontMetrics().boundingRect(displayNameButtonText).width() + (7*2),
displayNameButton->minimumSizeHint().height());
displayNameButton->setAccount(account);

@@ -229,7 +229,7 @@ void AccountsListDelegate::updateItemWidgets(const QList<QWidget *> widgets, con
QFont connectionErrorLabelFont = option.font;
QPalette connectionErrorLabelPalette = option.palette;
if (isEnabled) {
- connectionErrorLabelPalette.setColor(QPalette::WindowText, connectionErrorLabelPalette.color(QPalette::Normal, QPalette::Text));
+ connectionErrorLabelPalette.setColor(QPalette::WindowText, connectionErrorLabelPalette.color(QPalette::Active, QPalette::Text));
} else {
connectionErrorLabelFont.setItalic(true);
connectionErrorLabelPalette.setColor(QPalette::Text, connectionErrorLabelPalette.color(QPalette::Disabled, QPalette::Text));
@@ -241,10 +241,12 @@ void AccountsListDelegate::updateItemWidgets(const QList<QWidget *> widgets, con
connectionErrorLabel->setFont(connectionErrorLabelFont);
connectionErrorLabel->setPalette(connectionErrorLabelPalette);

- connectionErrorLabel->setText(connectionErrorLabel->fontMetrics().elidedText(connectionError,
+ QString connectionErrorLabelText = connectionErrorLabel->fontMetrics().elidedText(connectionError,
Qt::ElideRight,
- innerRect.width() - (7*2)));
- connectionErrorLabel->setFixedSize(connectionErrorLabel->minimumSizeHint().width(), displayNameButton->height());
+ innerRect.width() - (7*2));
+ connectionErrorLabel->setText(connectionErrorLabelText);
+ connectionErrorLabel->setFixedSize(connectionErrorLabel->fontMetrics().boundingRect(connectionErrorLabelText).width(),
+ displayNameButton->height());

int connectionErrorLabelLeftMargin = innerRect.left() + 7;
int connectionErrorLabelTopMargin = contentRect.bottom() - displayNameButton->height();
@@ -257,9 +259,7 @@ void AccountsListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
return;
}

- QStyle *style = QApplication::style();
-
- style->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0);
+ QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0);
}