From cb9669d71cf10e73305c6a60fe0d832f4eb0ac7a Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Thu, 13 May 2010 22:06:10 +0000 Subject: If an information entry will be added to KFileItemDelegate (like done recently), adjusting the corresponding code in Dolphin is a real pain, as the new information will be shown in Dolphin the following way: - As additional columns in the details view - As additional lines in the icons view - As menu entries in the "Sort By" and "Additional Information" groups - As popup menu entries in the details view header popup - As checkable entries in the View Properties dialog To prevent similar painful transitions in future, the class AdditionalInfoManager has been introduced. All parts in Dolphin that access/show/store additional information, use the AdditionalInfoManager now. If a new information entry will be added in KFileItemDelegate in future, only a small adjustment in AdditionalInfoManager will be required. Still open currently: - AdditionalInfoDialog does not use AdditionalInfoManager yet - DolphinView::Sorting should be replaced by KFileItemDelegate::Information, so that the sorting can also be done in a generic way. - The data for KFileItemDelegate::PathOrUrl is not determined The open issues will get fixed during the next days. Kudos to the brave warriors Sebastian and Frank, that tried to add a new information ;-) CCMAIL: sebastian@trueg.de CCMAIL: frank78ac@googlemail.com svn path=/trunk/KDE/kdebase/apps/; revision=1126410 --- src/dolphinmodel.cpp | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) (limited to 'src/dolphinmodel.cpp') diff --git a/src/dolphinmodel.cpp b/src/dolphinmodel.cpp index d81e0c38b..7e0986485 100644 --- a/src/dolphinmodel.cpp +++ b/src/dolphinmodel.cpp @@ -94,31 +94,17 @@ QVariant DolphinModel::data(const QModelIndex& index, int role) const break; case Qt::DisplayRole: - if (index.column() == DolphinModel::Version) { - switch (m_revisionHash.value(index, KVersionControlPlugin::UnversionedVersion)) { - case KVersionControlPlugin::NormalVersion: - return i18nc("@item::intable", "Normal"); - case KVersionControlPlugin::UpdateRequiredVersion: - return i18nc("@item::intable", "Update required"); - case KVersionControlPlugin::LocallyModifiedVersion: - return i18nc("@item::intable", "Locally modified"); - case KVersionControlPlugin::AddedVersion: - return i18nc("@item::intable", "Added"); - case KVersionControlPlugin::RemovedVersion: - return i18nc("@item::intable", "Removed"); - case KVersionControlPlugin::ConflictingVersion: - return i18nc("@item::intable", "Conflicting"); - case KVersionControlPlugin::UnversionedVersion: - default: - return i18nc("@item::intable", "Unversioned"); - } + switch (index.column()) { + case DolphinModel::LinkDest: { + const KDirModel *dirModel = qobject_cast(index.model()); + const KFileItem item = dirModel->itemForIndex(index); + return item.linkDest(); + } + + case DolphinModel::LocalPathOrUrl: + // TODO: + break; } - else if (index.column() == DolphinModel::LinkDestination) { - const KDirModel *dirModel = qobject_cast(index.model()); - KFileItem item = dirModel->itemForIndex(index); - return item.linkDest(); - } - break; default: @@ -132,10 +118,10 @@ QVariant DolphinModel::headerData(int section, Qt::Orientation orientation, int { if ((orientation == Qt::Horizontal) && (role == Qt::DisplayRole)) { switch (section) { - case DolphinModel::Version: - return i18nc("@title::column", "Version"); - case DolphinModel::LinkDestination: - return i18nc("@title::column", "Link Destination"); + case DolphinModel::LinkDest: + return i18nc("@title::column", "Destination"); + case DolphinModel::LocalPathOrUrl: + return i18nc("@title::column", "Path"); default: return KDirModel::headerData(section, orientation, role); } -- cgit v1.3