183
185
if (m_nepomukActivated) {
184
186
m_ratingWidget = new KRatingWidget(parent);
185
187
m_ratingWidget->setFixedHeight(fontMetrics.height());
188
const Qt::Alignment align = (parent->layoutDirection() == Qt::LeftToRight) ?
189
Qt::AlignLeft : Qt::AlignRight;
190
m_ratingWidget->setAlignment(align);
186
191
connect(m_ratingWidget, SIGNAL(ratingChanged(unsigned int)),
187
192
q, SLOT(slotRatingChanged(unsigned int)));
189
194
m_taggingWidget = new KTaggingWidget(parent);
190
195
connect(m_taggingWidget, SIGNAL(tagsChanged(const QList<Nepomuk::Tag>&)),
191
196
q, SLOT(slotTagsChanged(const QList<Nepomuk::Tag>&)));
197
connect(m_taggingWidget, SIGNAL(tagActivated(const Nepomuk::Tag&)),
198
q, SLOT(slotTagActivated(const Nepomuk::Tag&)));
193
200
m_commentWidget = new KCommentWidget(parent);
194
201
connect(m_commentWidget, SIGNAL(commentChanged(const QString&)),
261
268
void KMetaDataWidget::Private::initMetaInfoSettings()
270
const int currentVersion = 1; // increase version, if the blacklist of disabled
271
// properties should be updated
263
273
KConfig config("kmetainformationrc", KConfig::NoGlobals);
264
KConfigGroup settings = config.group("Show");
265
if (!settings.readEntry("initialized", false)) {
274
if (config.group("Misc").readEntry("version", 0) < currentVersion) {
266
275
// The resource file is read the first time. Assure
267
276
// that some meta information is disabled per default.
279
config.deleteGroup( "Show" );
280
KConfigGroup settings = config.group("Show");
282
// trueg: KDE 4.5: use a blacklist of actual rdf properties
269
284
static const char* disabledProperties[] = {
270
285
"asText", "contentSize", "created", "depth", "description", "fileExtension",
271
286
"fileName", "fileSize", "hasTag", "isPartOf", "lastModified", "mimeType", "name",
274
289
0 // mandatory last entry
278
while (disabledProperties[i] != 0) {
292
for (int i = 0; disabledProperties[i] != 0; ++i) {
279
293
settings.writeEntry(disabledProperties[i], false);
283
296
// mark the group as initialized
284
settings.writeEntry("initialized", true);
297
config.group("Misc").writeEntry("version", currentVersion);
333
346
void KMetaDataWidget::Private::slotLoadingFinished()
335
348
#ifdef HAVE_NEPOMUK
336
Q_ASSERT(m_loadMetaDataThread != 0);
349
if (m_loadMetaDataThread == 0) {
350
// The signal finished() has been emitted, but the thread has been marked
351
// as invalid in the meantime. Just ignore the signal in this case.
337
355
Q_ASSERT(m_ratingWidget != 0);
338
356
Q_ASSERT(m_commentWidget != 0);
339
357
Q_ASSERT(m_taggingWidget != 0);
351
369
const QList<KLoadMetaDataThread::Item> items = mergedItems(m_loadMetaDataThread->items());
352
370
foreach (const KLoadMetaDataThread::Item& item, items) {
371
const QString itemLabel = item.label;
372
QString itemValue = item.value;
373
if (item.value.startsWith("<a href=")) {
374
// use the text color for the value-links, to create a visual difference
375
// to the semantically different links like "Change..."
376
const QColor linkColor = q->palette().text().color();
379
decoration = QString::fromLatin1("text-decoration:none;");
381
const QString styleText = QString::fromLatin1("style=\"color:%1;%2\" ")
382
.arg(linkColor.name())
384
itemValue.insert(3 /* after "<a "*/, styleText);
353
386
if (index < rowCount) {
354
387
// adjust texts of the current row
355
m_rows[index].label->setText(item.label);
388
m_rows[index].label->setText(itemLabel);
356
389
QLabel* infoValueLabel = qobject_cast<QLabel*>(m_rows[index].infoWidget);
357
390
Q_ASSERT(infoValueLabel != 0);
358
infoValueLabel->setText(item.value);
391
infoValueLabel->setText(itemValue);
360
393
// create new row
361
QLabel* infoLabel = new QLabel(item.label, q);
362
QLabel* infoValue = new QLabel(item.value, q);
394
QLabel* infoLabel = new QLabel(itemLabel, q);
395
QLabel* infoValue = new QLabel(itemValue, q);
363
396
connect(infoValue, SIGNAL(linkActivated(QString)),
364
397
q, SLOT(slotLinkActivated(QString)));
365
398
addRow(infoLabel, infoValue);