diff options
| author | Peter Penz <[email protected]> | 2010-09-22 17:28:26 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2010-09-22 17:28:26 +0000 |
| commit | 1f45355b7dab5377ef2f504289210e4374576f7e (patch) | |
| tree | 1b54b146006fd45669c5ffa3c54b8db60d59fe15 | |
| parent | 7d7ecaafb18e85224fcf0b2432f3617edb9e3a2a (diff) | |
Fix issue, that the details-view has no size and date column in the following case:
- Use icons-view as default view
- Create a new directory
- Change view-properties of directory to show e.g. the owner
- Switch to the details-view
svn path=/trunk/KDE/kdebase/apps/; revision=1178311
| -rw-r--r-- | src/views/viewproperties.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp index 72042179b..d6d5bfd94 100644 --- a/src/views/viewproperties.cpp +++ b/src/views/viewproperties.cpp @@ -35,6 +35,13 @@ #include "settings/dolphinsettings.h" +namespace { + // String representation to mark the additional properties of + // the details view as customized by the user. See + // ViewProperties::additionalInfoV2() for more information. + const char* CustomizedDetailsString = "CustomizedDetails"; +} + ViewProperties::ViewProperties(const KUrl& url) : m_changedProps(false), m_autoSave(true), @@ -224,6 +231,17 @@ void ViewProperties::setAdditionalInfo(const KFileItemDelegate::InformationList& if (m_node->version() < 2) { m_node->setVersion(2); } + + const bool markCustomizedDetails = (m_node->viewMode() == DolphinView::DetailsView) + && !newInfoStringList.contains(CustomizedDetailsString); + if (markCustomizedDetails) { + // The additional information of the details-view has been modified. Set a marker, + // so that it is allowed to also show no additional information + // (see fallback in ViewProperties::additionalInfoV2, if no additional information is + // available). + newInfoStringList.append(CustomizedDetailsString); + } + m_node->setAdditionalInfoV2(newInfoStringList); update(); } @@ -355,6 +373,12 @@ KFileItemDelegate::InformationList ViewProperties::additionalInfoV2() const // // To get the representation as KFileItemDelegate::InformationList, the current // view-mode must be checked and the values of this mode added to the list. + // + // For the details-view a special case must be respected: Per default the size + // and date should be shown without creating a .directory file. Only if + // the user explictly has modified the properties of the details view (marked + // by "CustomizedDetails"), also a details-view with no additional information + // is accepted. KFileItemDelegate::InformationList usedInfo; @@ -382,6 +406,16 @@ KFileItemDelegate::InformationList ViewProperties::additionalInfoV2() const } } + // For the details view the size and date should be shown per default + // until the additional information has been explicitly changed by the user + const bool useDefaultValues = usedInfo.isEmpty() + && (m_node->viewMode() == DolphinView::DetailsView) + && !infoStringList.contains(CustomizedDetailsString); + if (useDefaultValues) { + usedInfo.append(KFileItemDelegate::Size); + usedInfo.append(KFileItemDelegate::ModificationTime); + } + return usedInfo; } |
