From b6bc5aba8de5aa15a2d43bf53fc351810074cbea Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 19 May 2007 17:53:12 +0000 Subject: [PATCH] - rename m_name to m_nameLabel for consistency - prevent that the m_nameLabel increases the size of the infosidebar if the text cannot get wrapped svn path=/trunk/KDE/kdebase/apps/; revision=666383 --- src/infosidebarpage.cpp | 29 ++++++++++++++++------------- src/infosidebarpage.h | 2 +- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/infosidebarpage.cpp b/src/infosidebarpage.cpp index 1a3e67e1c..7d7545ccd 100644 --- a/src/infosidebarpage.cpp +++ b/src/infosidebarpage.cpp @@ -50,7 +50,7 @@ InfoSidebarPage::InfoSidebarPage(QWidget* parent) : m_pendingPreview(false), m_timer(0), m_preview(0), - m_name(0), + m_nameLabel(0), m_infoLabel(0), m_metadataWidget(0) { @@ -70,10 +70,10 @@ InfoSidebarPage::InfoSidebarPage(QWidget* parent) : m_preview->setFixedHeight(K3Icon::SizeEnormous); // name - m_name = new QLabel(this); - m_name->setTextFormat(Qt::RichText); - m_name->setAlignment(m_name->alignment() | Qt::AlignHCenter); - m_name->setWordWrap(true); + m_nameLabel = new QLabel(this); + m_nameLabel->setTextFormat(Qt::RichText); + m_nameLabel->setAlignment(m_nameLabel->alignment() | Qt::AlignHCenter); + m_nameLabel->setWordWrap(true); // general information m_infoLabel = new QLabel(this); @@ -86,7 +86,7 @@ InfoSidebarPage::InfoSidebarPage(QWidget* parent) : layout->addItem(new QSpacerItem(spacing, spacing, QSizePolicy::Preferred, QSizePolicy::Fixed)); layout->addWidget(m_preview); - layout->addWidget(m_name); + layout->addWidget(m_nameLabel); layout->addWidget(new KSeparator(this)); layout->addWidget(m_infoLabel); layout->addWidget(new KSeparator(this)); @@ -138,11 +138,14 @@ void InfoSidebarPage::showEvent(QShowEvent* event) void InfoSidebarPage::resizeEvent(QResizeEvent* event) { - // If the item name cannot get wrapped, the maximum width of - // the label is increased, so that the width of the information sidebar - // gets increased. To prevent this, the maximum width is adjusted to + // If the text inside the name label or the info label cannot + // get wrapped, then the maximum width of the label is increased + // so that the width of the information sidebar gets increased. + // To prevent this, the maximum width is adjusted to // the current width of the sidebar. - m_name->setMaximumWidth(event->size().width() - KDialog::spacingHint() * 4); + const int maxWidth = event->size().width() - KDialog::spacingHint() * 4; + m_nameLabel->setMaximumWidth(maxWidth); + m_infoLabel->setMaximumWidth(maxWidth); SidebarPage::resizeEvent(event); } @@ -169,7 +172,7 @@ void InfoSidebarPage::showItemInfo() K3Icon::NoGroup, K3Icon::SizeEnormous); m_preview->setPixmap(icon); - m_name->setText(i18n("%1 items selected", selectedItems.count())); + m_nameLabel->setText(i18n("%1 items selected", selectedItems.count())); } else if (!applyBookmark(file)) { // try to get a preview pixmap from the item... KUrl::List list; @@ -195,7 +198,7 @@ void InfoSidebarPage::showItemInfo() QString text(""); text.append(file.fileName()); text.append(""); - m_name->setText(text); + m_nameLabel->setText(text); } showMetaInfo(); @@ -237,7 +240,7 @@ bool InfoSidebarPage::applyBookmark(const KUrl& url) QString text(""); text.append(placesModel->text(index)); text.append(""); - m_name->setText(text); + m_nameLabel->setText(text); m_preview->setPixmap(placesModel->icon(index).pixmap(128, 128)); return true; diff --git a/src/infosidebarpage.h b/src/infosidebarpage.h index 4bd5671a1..c989c5374 100644 --- a/src/infosidebarpage.h +++ b/src/infosidebarpage.h @@ -148,7 +148,7 @@ private: KUrl m_urlCandidate; PixmapViewer* m_preview; - QLabel* m_name; + QLabel* m_nameLabel; QLabel* m_infoLabel; -- 2.47.3