From 59c430bb3f0d68135e3d05acb086b53ff07ba1ff Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 17 Oct 2009 12:43:58 +0000 Subject: [PATCH] Use the tunedLabel() workaround also for the configuration dialog. Hopefully this can be cleaned up until KDE 4.4... CCMAIL: trueg@kde.org svn path=/trunk/KDE/kdebase/apps/; revision=1036559 --- .../metadataconfigurationdialog.cpp | 27 +++++++++++++++++-- src/panels/information/metadatawidget.cpp | 2 +- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/panels/information/metadataconfigurationdialog.cpp b/src/panels/information/metadataconfigurationdialog.cpp index 7dbacd164b..2fb7b7699d 100644 --- a/src/panels/information/metadataconfigurationdialog.cpp +++ b/src/panels/information/metadataconfigurationdialog.cpp @@ -44,6 +44,7 @@ public: void init(); void loadMetaData(); + QString tunedLabel(const QString& label) const; int m_hiddenData; MetaDataWidget* m_metaDataWidget; @@ -194,8 +195,11 @@ void MetaDataConfigurationDialog::Private::loadMetaData() } if (!skip) { - // const QString label = tunedLabel(prop.label()); - const QString label = prop.label() + " --- " + key; + // TODO #1: use Nepomuk::formatValue(res, prop) if available + // instead of it.value().toString() + // TODO #2: using tunedLabel() is a workaround for KDE 4.3 (4.4?) until + // we get translated labels + const QString label = tunedLabel(prop.label()); QListWidgetItem* item = new QListWidgetItem(label, m_metaDataList); item->setData(Qt::UserRole, key); const bool show = settings.readEntry(key, true); @@ -207,6 +211,25 @@ void MetaDataConfigurationDialog::Private::loadMetaData() #endif } +QString MetaDataConfigurationDialog::Private::tunedLabel(const QString& label) const +{ + QString tunedLabel; + const int labelLength = label.length(); + if (labelLength > 0) { + tunedLabel.reserve(labelLength); + tunedLabel = label[0].toUpper(); + for (int i = 1; i < labelLength; ++i) { + if (label[i].isUpper() && !label[i - 1].isSpace() && !label[i - 1].isUpper()) { + tunedLabel += ' '; + tunedLabel += label[i].toLower(); + } else { + tunedLabel += label[i]; + } + } + } + return tunedLabel; +} + MetaDataConfigurationDialog::MetaDataConfigurationDialog(QWidget* parent, Qt::WFlags flags) : KDialog(parent, flags), diff --git a/src/panels/information/metadatawidget.cpp b/src/panels/information/metadatawidget.cpp index 8126292d7c..9a4f5ea26d 100644 --- a/src/panels/information/metadatawidget.cpp +++ b/src/panels/information/metadatawidget.cpp @@ -524,7 +524,7 @@ void MetaDataWidget::Private::LoadFilesThread::run() if (settings.readEntry(prop.name(), true)) { // TODO #1: use Nepomuk::formatValue(res, prop) if available // instead of it.value().toString() - // TODO #2: using tunedLabel() is a workaround for KDE 4.3 until + // TODO #2: using tunedLabel() is a workaround for KDE 4.3 (4.4?) until // we get translated labels metaInfoLabels.append(tunedLabel(prop.label())); metaInfoValues.append(it.value().toString());