Commit 0dacef04 authored by Stefan Brüns's avatar Stefan Brüns
Browse files

Remove flawed noLinks handling for originUrls

Summary:
The original use of noLinks was to provide links to "kfileitem#"
targets, i.e. internal links only reachable when file indexing was
enabled (at Nepomuk times).

originUrls on the other hand are web/ftp server URLs, i.e.
independent from any local indexing.

Test Plan:
  #  Add a originURL to a file:

```
    $> setfattr -n user.xdg.origin.url -v "http://some.domain/"  test.txt

```
  # Make file readonly

With the change, the value label shown for originUrl ("Downloaded
from") stays the same

Reviewers: #baloo, ngraham, astippich

Reviewed By: #baloo, ngraham

Tags: #baloo

Differential Revision: https://phabricator.kde.org/D25238
parent 648822be
......@@ -154,7 +154,6 @@ void FileMetaDataWidget::Private::slotLoadingFinished()
}
changedIt++;
}
m_widgetFactory->setNoLinks(true);
m_widgetFactory->setReadOnly(true);
m_gridLayout->setColumnStretch(0, 1);
m_gridLayout->setColumnStretch(1, 3);
......@@ -162,7 +161,6 @@ void FileMetaDataWidget::Private::slotLoadingFinished()
m_gridLayout->setColumnStretch(3, 6);
} else {
data = m_filter->filter(data);
m_widgetFactory->setNoLinks( m_provider->realTimeIndexing() );
m_widgetFactory->setReadOnly(m_provider->isReadOnly());
m_gridLayout->setColumnStretch(0, 4);
m_gridLayout->setColumnStretch(1, 0);
......
......@@ -66,7 +66,6 @@ using namespace Baloo;
WidgetFactory::WidgetFactory(QObject* parent)
: QObject(parent)
, m_readOnly( false )
, m_noLinks( false )
, m_dateFormat(QLocale::LongFormat)
{
}
......@@ -145,17 +144,11 @@ QWidget* WidgetFactory::createWidget(const QString& prop, const QVariant& value,
QString valueString;
auto pi = KFileMetaData::PropertyInfo::fromName(prop);
if (pi.name() == QLatin1String("originUrl")) {
//Won't make sense to shrink originUrl with noLinks,
//since it would make original URL unobtainable
valueString = value.toString();
if (!m_noLinks) {
//Shrink link name.
auto labelString = valueString;
if (labelString.size() > maxUrlLength) {
labelString = KStringHandler::csqueeze(labelString, maxUrlLength);
}
valueString = QStringLiteral("<a href=\"%1\">%2</a>").arg(valueString, labelString);
}
//Shrink link label
auto labelString = KStringHandler::csqueeze(valueString, maxUrlLength);
valueString = QStringLiteral("<a href=\"%1\">%2</a>").arg(valueString, labelString);
} else if (pi.name() != QLatin1String("empty")) {
if (pi.valueType() == QVariant::DateTime || pi.valueType() == QVariant::Date) {
valueString = formatDateTime(value, m_dateFormat);
......@@ -349,11 +342,6 @@ void WidgetFactory::setReadOnly(bool value)
m_readOnly = value;
}
void WidgetFactory::setNoLinks(bool value)
{
m_noLinks = value;
}
void WidgetFactory::setItems(const KFileItemList& items)
{
m_items = items;
......
......@@ -46,7 +46,6 @@ namespace Baloo {
void setItems(const KFileItemList& items);
void setReadOnly(bool value);
void setNoLinks(bool value);
void setDateFormat(const DateFormats format);
DateFormats dateFormat() const;
......@@ -79,7 +78,6 @@ namespace Baloo {
KFileItemList m_items;
QStringList m_prevTags;
bool m_readOnly;
bool m_noLinks;
QLocale::FormatType m_dateFormat;
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment