]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Allow showing additional information like type, size and date in parallel for the...
authorPeter Penz <peter.penz19@gmail.com>
Tue, 2 Oct 2007 22:04:36 +0000 (22:04 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Tue, 2 Oct 2007 22:04:36 +0000 (22:04 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=720283

12 files changed:
src/dolphin_directoryviewpropertysettings.kcfg
src/dolphincontroller.cpp
src/dolphincontroller.h
src/dolphiniconsview.cpp
src/dolphiniconsview.h
src/dolphinmainwindow.cpp
src/dolphinmainwindow.h
src/dolphinui.rc
src/dolphinview.cpp
src/dolphinview.h
src/viewproperties.cpp
src/viewproperties.h

index 084a49803776fa7e97d0a586f0e01002050c0ade..2bc870a8643cc36b85072d6dab06287b3defe284 100644 (file)
@@ -52,7 +52,7 @@
 
         <entry name="AdditionalInfo" type="Int">
             <label context="@label">Additional information</label>
 
         <entry name="AdditionalInfo" type="Int">
             <label context="@label">Additional information</label>
-            <default code="true">KFileItemDelegate::NoInformation</default>
+            <default>0</default>
         </entry>
 
         <entry name="Timestamp" type="DateTime" >
         </entry>
 
         <entry name="Timestamp" type="DateTime" >
index 32560844254e34519cd9f9dc8fea819aef2f7783..7723fd8ef693582e40d8d906ceeee86b96df051b 100644 (file)
 DolphinController::DolphinController(QObject* parent) :
     QObject(parent),
     m_showPreview(false),
 DolphinController::DolphinController(QObject* parent) :
     QObject(parent),
     m_showPreview(false),
-    m_showAdditionalInfo(false),
     m_zoomInPossible(false),
     m_zoomInPossible(false),
-    m_zoomOutPossible(false)
+    m_zoomOutPossible(false),
+    m_additionalInfoCount(0),
+    m_url()
 {
 }
 
 {
 }
 
@@ -80,11 +81,11 @@ void DolphinController::setShowPreview(bool show)
     }
 }
 
     }
 }
 
-void DolphinController::setShowAdditionalInfo(bool show)
+void DolphinController::setAdditionalInfoCount(int count)
 {
 {
-    if (m_showAdditionalInfo != show) {
-        m_showAdditionalInfo = show;
-        emit showAdditionalInfoChanged(show);
+    if (m_additionalInfoCount != count) {
+        m_additionalInfoCount = count;
+        emit additionalInfoCountChanged(count);
     }
 }
 
     }
 }
 
index d17f34c75ab1ac7af87f56dfc047639eb115a5da..d773a8548e9686f9fb8c40955d90d5b269ca951a 100644 (file)
@@ -77,8 +77,8 @@ public:
     void setShowPreview(bool show);
     bool showPreview() const;
 
     void setShowPreview(bool show);
     bool showPreview() const;
 
-    void setShowAdditionalInfo(bool show);
-    bool showAdditionalInfo() const;
+    void setAdditionalInfoCount(int count);
+    bool additionalInfoCount() const;
 
     void triggerZoomIn();
     void setZoomInPossible(bool possible);
 
     void triggerZoomIn();
     void setZoomInPossible(bool possible);
@@ -156,10 +156,10 @@ signals:
     void showPreviewChanged(bool show);
 
     /**
     void showPreviewChanged(bool show);
 
     /**
-     * Is emitted if the state for showing additional info has been
-     * changed to \a show.
+     * Is emitted if the number of additional informations has been
+     * changed to \a count.
      */
      */
-    void showAdditionalInfoChanged(bool show);
+    void additionalInfoCountChanged(int count);
 
     /**
      * Is emitted if the item with the index \a index should be triggered.
 
     /**
      * Is emitted if the item with the index \a index should be triggered.
@@ -188,9 +188,9 @@ signals:
 
 private:
     bool m_showPreview;
 
 private:
     bool m_showPreview;
-    bool m_showAdditionalInfo;
     bool m_zoomInPossible;
     bool m_zoomOutPossible;
     bool m_zoomInPossible;
     bool m_zoomOutPossible;
+    int m_additionalInfoCount;
     KUrl m_url;
 };
 
     KUrl m_url;
 };
 
@@ -204,9 +204,9 @@ inline bool DolphinController::showPreview() const
     return m_showPreview;
 }
 
     return m_showPreview;
 }
 
-inline bool DolphinController::showAdditionalInfo() const
+inline bool DolphinController::additionalInfoCount() const
 {
 {
-    return m_showAdditionalInfo;
+    return m_additionalInfoCount;
 }
 
 inline void DolphinController::setZoomInPossible(bool possible)
 }
 
 inline void DolphinController::setZoomInPossible(bool possible)
index 9e2d3ee02382b3f70b5da840e7d388afea78a04c..6b584612cc9cec51fcfb74ba9b84370c314f132e 100644 (file)
@@ -64,8 +64,8 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
             controller, SLOT(emitViewportEntered()));
     connect(controller, SIGNAL(showPreviewChanged(bool)),
             this, SLOT(slotShowPreviewChanged(bool)));
             controller, SLOT(emitViewportEntered()));
     connect(controller, SIGNAL(showPreviewChanged(bool)),
             this, SLOT(slotShowPreviewChanged(bool)));
-    connect(controller, SIGNAL(showAdditionalInfoChanged(bool)),
-            this, SLOT(slotShowAdditionalInfoChanged(bool)));
+    connect(controller, SIGNAL(additionalInfoCountChanged(int)),
+            this, SLOT(slotAdditionalInfoCountChanged(int)));
     connect(controller, SIGNAL(zoomIn()),
             this, SLOT(zoomIn()));
     connect(controller, SIGNAL(zoomOut()),
     connect(controller, SIGNAL(zoomIn()),
             this, SLOT(zoomIn()));
     connect(controller, SIGNAL(zoomOut()),
@@ -84,7 +84,7 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
     m_viewOptions.font = font;
 
     setWordWrap(settings->numberOfTextlines() > 1);
     m_viewOptions.font = font;
 
     setWordWrap(settings->numberOfTextlines() > 1);
-    updateGridSize(controller->showPreview(), controller->showAdditionalInfo());
+    updateGridSize(controller->showPreview(), controller->additionalInfoCount());
 
     if (settings->arrangement() == QListView::TopToBottom) {
         setFlow(QListView::LeftToRight);
 
     if (settings->arrangement() == QListView::TopToBottom) {
         setFlow(QListView::LeftToRight);
@@ -230,12 +230,12 @@ void DolphinIconsView::keyPressEvent(QKeyEvent* event)
 
 void DolphinIconsView::slotShowPreviewChanged(bool showPreview)
 {
 
 void DolphinIconsView::slotShowPreviewChanged(bool showPreview)
 {
-    updateGridSize(showPreview, m_controller->showAdditionalInfo());
+    updateGridSize(showPreview, m_controller->additionalInfoCount());
 }
 
 }
 
-void DolphinIconsView::slotShowAdditionalInfoChanged(bool showAdditionalInfo)
+void DolphinIconsView::slotAdditionalInfoCountChanged(int count)
 {
 {
-    updateGridSize(m_controller->showPreview(), showAdditionalInfo);
+    updateGridSize(m_controller->showPreview(), count);
 }
 
 void DolphinIconsView::zoomIn()
 }
 
 void DolphinIconsView::zoomIn()
@@ -264,7 +264,7 @@ void DolphinIconsView::zoomIn()
         settings->setItemWidth(settings->itemWidth() + diff);
         settings->setItemHeight(settings->itemHeight() + diff);
 
         settings->setItemWidth(settings->itemWidth() + diff);
         settings->setItemHeight(settings->itemHeight() + diff);
 
-        updateGridSize(showPreview, m_controller->showAdditionalInfo());
+        updateGridSize(showPreview, m_controller->additionalInfoCount());
     }
 }
 
     }
 }
 
@@ -295,7 +295,7 @@ void DolphinIconsView::zoomOut()
         settings->setItemWidth(settings->itemWidth() - diff);
         settings->setItemHeight(settings->itemHeight() - diff);
 
         settings->setItemWidth(settings->itemWidth() - diff);
         settings->setItemHeight(settings->itemHeight() - diff);
 
-        updateGridSize(showPreview, m_controller->showAdditionalInfo());
+        updateGridSize(showPreview, m_controller->additionalInfoCount());
     }
 }
 
     }
 }
 
@@ -341,7 +341,7 @@ int DolphinIconsView::decreasedIconSize(int size) const
     return decSize;
 }
 
     return decSize;
 }
 
-void DolphinIconsView::updateGridSize(bool showPreview, bool showAdditionalInfo)
+void DolphinIconsView::updateGridSize(bool showPreview, int additionalInfoCount)
 {
     const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
     Q_ASSERT(settings != 0);
 {
     const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
     Q_ASSERT(settings != 0);
@@ -360,9 +360,8 @@ void DolphinIconsView::updateGridSize(bool showPreview, bool showAdditionalInfo)
         size = previewSize;
     }
 
         size = previewSize;
     }
 
-    if (showAdditionalInfo) {
-        itemHeight += m_viewOptions.font.pointSize() * 2;
-    }
+    Q_ASSERT(additionalInfoCount >= 0);
+    itemHeight += additionalInfoCount * m_viewOptions.font.pointSize() * 2;
 
     if (settings->arrangement() == QListView::TopToBottom) {
         // The decoration width indirectly defines the maximum
 
     if (settings->arrangement() == QListView::TopToBottom) {
         // The decoration width indirectly defines the maximum
index 69481eb7fffaa9ce27f67c730716076e006e4d86..7e88f39bde3ae0161efb3fff70e8427465a1093d 100644 (file)
@@ -60,7 +60,7 @@ protected:
 
 private slots:
     void slotShowPreviewChanged(bool show);
 
 private slots:
     void slotShowPreviewChanged(bool show);
-    void slotShowAdditionalInfoChanged(bool show);
+    void slotAdditionalInfoCountChanged(int count);
     void zoomIn();
     void zoomOut();
 
     void zoomIn();
     void zoomOut();
 
@@ -76,9 +76,9 @@ private:
 
     /**
      * Updates the size of the grid depending on the state
 
     /**
      * Updates the size of the grid depending on the state
-     * of \a showPreview and \a showAdditionalInfo.
+     * of \a showPreview and \a additionalInfoCount.
      */
      */
-    void updateGridSize(bool showPreview, bool showAdditionalInfo);
+    void updateGridSize(bool showPreview, int additionalInfoCount);
 
 private:
     DolphinController* m_controller;
 
 private:
     DolphinController* m_controller;
index 38408d7bf341b31441f09b3d42204cf4a2e304c5..a7cbc527afcc5897b1589d91adfa0fd9ebb0a332 100644 (file)
@@ -326,33 +326,35 @@ void DolphinMainWindow::slotSortOrderChanged(Qt::SortOrder order)
 
 void DolphinMainWindow::slotAdditionalInfoChanged(KFileItemDelegate::InformationList list)
 {
 
 void DolphinMainWindow::slotAdditionalInfoChanged(KFileItemDelegate::InformationList list)
 {
-    QAction* action = 0;
-    KFileItemDelegate::Information info = list.isEmpty() ? KFileItemDelegate::NoInformation : list.first();
+    QAction* showMimeInfo = actionCollection()->action("show_mime_info");
+    QAction* showSizeInfo = actionCollection()->action("show_size_info");
+    QAction* showDateInfo = actionCollection()->action("show_date_info");
 
 
-    switch (info) {
-    case KFileItemDelegate::FriendlyMimeType:
-        action = actionCollection()->action("show_mime_info");
-        break;
-    case KFileItemDelegate::Size:
-        action = actionCollection()->action("show_size_info");
-        break;
-    case KFileItemDelegate::ModificationTime:
-        action = actionCollection()->action("show_date_info");
-        break;
-    case KFileItemDelegate::NoInformation:
-    default:
-        action = actionCollection()->action("clear_info");
-        break;
-    }
+    showMimeInfo->setChecked(false);
+    showSizeInfo->setChecked(false);
+    showDateInfo->setChecked(false);
 
 
-    if (action != 0) {
-        KToggleAction* toggleAction = static_cast<KToggleAction*>(action);
-        toggleAction->setChecked(true);
-
-        QActionGroup* group = toggleAction->actionGroup();
-        Q_ASSERT(group != 0);
-        const DolphinView* view = m_activeViewContainer->view();
-        group->setEnabled(view->mode() == DolphinView::IconsView);
+    const DolphinView* view = m_activeViewContainer->view();
+    // currently only the icons view supports additional information
+    const bool enable = (view->mode() == DolphinView::IconsView);
+    showMimeInfo->setEnabled(enable);
+    showSizeInfo->setEnabled(enable);
+    showDateInfo->setEnabled(enable);
+
+    foreach (KFileItemDelegate::Information info, list) {
+        switch (info) {
+        case KFileItemDelegate::FriendlyMimeType:
+            showMimeInfo->setChecked(true);
+            break;
+        case KFileItemDelegate::Size:
+            showSizeInfo->setChecked(true);
+            break;
+        case KFileItemDelegate::ModificationTime:
+            showDateInfo->setChecked(true);
+            break;
+        default:
+            break;
+        }
     }
 }
 
     }
 }
 
@@ -776,27 +778,19 @@ void DolphinMainWindow::toggleSortCategorization()
     view->setCategorizedSorting(!categorizedSorting);
 }
 
     view->setCategorizedSorting(!categorizedSorting);
 }
 
-void DolphinMainWindow::clearInfo()
-{
-    m_activeViewContainer->view()->setAdditionalInfo(KFileItemDelegate::NoInformation);
-}
-
-void DolphinMainWindow::showMimeInfo()
+void DolphinMainWindow::toggleMimeInfo()
 {
 {
-    clearStatusBar();
-    m_activeViewContainer->view()->setAdditionalInfo(KFileItemDelegate::FriendlyMimeType);
+    toggleAdditionalInfo("show_mime_info", KFileItemDelegate::FriendlyMimeType);
 }
 
 }
 
-void DolphinMainWindow::showSizeInfo()
+void DolphinMainWindow::toggleSizeInfo()
 {
 {
-    clearStatusBar();
-    m_activeViewContainer->view()->setAdditionalInfo(KFileItemDelegate::Size);
+    toggleAdditionalInfo("show_size_info", KFileItemDelegate::Size);
 }
 
 }
 
-void DolphinMainWindow::showDateInfo()
+void DolphinMainWindow::toggleDateInfo()
 {
 {
-    clearStatusBar();
-    m_activeViewContainer->view()->setAdditionalInfo(KFileItemDelegate::ModificationTime);
+    toggleAdditionalInfo("show_date_info", KFileItemDelegate::ModificationTime);
 }
 
 void DolphinMainWindow::toggleSplitView()
 }
 
 void DolphinMainWindow::toggleSplitView()
@@ -1245,27 +1239,17 @@ void DolphinMainWindow::setupActions()
     showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups"));
     connect(showInGroups, SIGNAL(triggered()), this, SLOT(toggleSortCategorization()));
 
     showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups"));
     connect(showInGroups, SIGNAL(triggered()), this, SLOT(toggleSortCategorization()));
 
-    KToggleAction* clearInfo = actionCollection()->add<KToggleAction>("clear_info");
-    clearInfo->setText(i18nc("@action:inmenu Additional information", "No Information"));
-    connect(clearInfo, SIGNAL(triggered()), this, SLOT(clearInfo()));
-
     KToggleAction* showMimeInfo = actionCollection()->add<KToggleAction>("show_mime_info");
     showMimeInfo->setText(i18nc("@action:inmenu Additional information", "Type"));
     KToggleAction* showMimeInfo = actionCollection()->add<KToggleAction>("show_mime_info");
     showMimeInfo->setText(i18nc("@action:inmenu Additional information", "Type"));
-    connect(showMimeInfo, SIGNAL(triggered()), this, SLOT(showMimeInfo()));
+    connect(showMimeInfo, SIGNAL(triggered()), this, SLOT(toggleMimeInfo()));
 
     KToggleAction* showSizeInfo = actionCollection()->add<KToggleAction>("show_size_info");
     showSizeInfo->setText(i18nc("@action:inmenu Additional information", "Size"));
 
     KToggleAction* showSizeInfo = actionCollection()->add<KToggleAction>("show_size_info");
     showSizeInfo->setText(i18nc("@action:inmenu Additional information", "Size"));
-    connect(showSizeInfo, SIGNAL(triggered()), this, SLOT(showSizeInfo()));
+    connect(showSizeInfo, SIGNAL(triggered()), this, SLOT(toggleSizeInfo()));
 
     KToggleAction* showDateInfo = actionCollection()->add<KToggleAction>("show_date_info");
     showDateInfo->setText(i18nc("@action:inmenu Additional information", "Date"));
 
     KToggleAction* showDateInfo = actionCollection()->add<KToggleAction>("show_date_info");
     showDateInfo->setText(i18nc("@action:inmenu Additional information", "Date"));
-    connect(showDateInfo, SIGNAL(triggered()), this, SLOT(showDateInfo()));
-
-    QActionGroup* infoGroup = new QActionGroup(this);
-    infoGroup->addAction(clearInfo);
-    infoGroup->addAction(showMimeInfo);
-    infoGroup->addAction(showSizeInfo);
-    infoGroup->addAction(showDateInfo);
+    connect(showDateInfo, SIGNAL(triggered()), this, SLOT(toggleDateInfo()));
 
     KToggleAction* showPreview = actionCollection()->add<KToggleAction>("show_preview");
     showPreview->setText(i18nc("@action:intoolbar", "Preview"));
 
     KToggleAction* showPreview = actionCollection()->add<KToggleAction>("show_preview");
     showPreview->setText(i18nc("@action:intoolbar", "Preview"));
@@ -1612,6 +1596,28 @@ void DolphinMainWindow::updateSplitAction()
     }
 }
 
     }
 }
 
+void DolphinMainWindow::toggleAdditionalInfo(const char* actionName,
+                                             KFileItemDelegate::Information info)
+{
+    clearStatusBar();
+
+    DolphinView* view = m_activeViewContainer->view();
+    KFileItemDelegate::InformationList list = view->additionalInfo();
+
+    const bool show = actionCollection()->action(actionName)->isChecked();
+
+    const int index = list.indexOf(info);
+    const bool containsInfo = (index >= 0);
+    if (show && !containsInfo) {
+        list.append(info);
+        view->setAdditionalInfo(list);
+    } else if (!show && containsInfo) {
+        list.removeAt(index);
+        view->setAdditionalInfo(list);
+        Q_ASSERT(list.indexOf(info) < 0);
+    }
+}
+
 DolphinMainWindow::UndoUiInterface::UndoUiInterface(DolphinMainWindow* mainWin) :
     KonqUndoManager::UiInterface(mainWin),
     m_mainWin(mainWin)
 DolphinMainWindow::UndoUiInterface::UndoUiInterface(DolphinMainWindow* mainWin) :
     KonqUndoManager::UiInterface(mainWin),
     m_mainWin(mainWin)
index 806399b6de56f4ec94b96c20507e03fa12bc3dc4..991312c0cb97b79ec4689d4a1757be329ba6fb65 100644 (file)
 
 #include <config-nepomuk.h>
 
 
 #include <config-nepomuk.h>
 
-#include <kxmlguiwindow.h>
-#include <ksortablelist.h>
+#include <kfileitemdelegate.h>
 #include <konq_undo.h>
 #include <konq_undo.h>
+#include <ksortablelist.h>
+#include <kxmlguiwindow.h>
 
 #include <QtCore/QList>
 
 
 #include <QtCore/QList>
 
@@ -292,20 +293,14 @@ private slots:
     /** Switches between sorting by categories or not. */
     void toggleSortCategorization();
 
     /** Switches between sorting by categories or not. */
     void toggleSortCategorization();
 
-    /**
-     * Clears any additional information for an item except for the
-     * name and the icon.
-     */
-    void clearInfo();
-
-    /** Shows the MIME type as additional information for the item. */
-    void showMimeInfo();
+    /** Switches between showing the MIME type as additional information for the item or not. */
+    void toggleMimeInfo();
 
 
-    /** Shows the size as additional information for the item. */
-    void showSizeInfo();
+    /** Switches between showing the size as additional information for the item or not. */
+    void toggleSizeInfo();
 
 
-    /** Shows the date as additional information for the item. */
-    void showDateInfo();
+    /** Switchtes between showing the date as additional information for the item or not. */
+    void toggleDateInfo();
 
     /**
      * Switches between one and two views:
 
     /**
      * Switches between one and two views:
@@ -463,6 +458,14 @@ private:
      */
     void updateSplitAction();
 
      */
     void updateSplitAction();
 
+    /**
+     * Helper method for the slots toggleDateInfo(), toggleSizeInfo()
+     * and toggleMimeInfo(). Applies \a info dependent from the  current
+     * checked state of the action \a actionName to the file item delegate.
+     */
+    void toggleAdditionalInfo(const char* actionName,
+                              KFileItemDelegate::Information info);
+
 private:
     /**
      * DolphinMainWindow supports up to two views beside each other.
 private:
     /**
      * DolphinMainWindow supports up to two views beside each other.
index 235359fbfb8f3c2d84097f42eed0bccbb4778812..21d10c5f796826a01d291cf5c4c4e65d17878214 100644 (file)
@@ -38,7 +38,6 @@
    </Menu>
    <Menu name="additional_info">
     <text context="@title:menu">Additional Information</text>
    </Menu>
    <Menu name="additional_info">
     <text context="@title:menu">Additional Information</text>
-    <Action name="clear_info" />
     <Action name="show_mime_info" />
     <Action name="show_size_info" />
     <Action name="show_date_info" />
     <Action name="show_mime_info" />
     <Action name="show_size_info" />
     <Action name="show_date_info" />
index 30e3e7fe773b91376a6d9208c5fb9b9679947fe5..6a6c40c7bb23cc07753cdab7696b5ec6523b53e5 100644 (file)
@@ -412,22 +412,13 @@ void DolphinView::setAdditionalInfo(KFileItemDelegate::InformationList info)
     ViewProperties props(viewPropsUrl);
     props.setAdditionalInfo(info);
 
     ViewProperties props(viewPropsUrl);
     props.setAdditionalInfo(info);
 
-    m_controller->setShowAdditionalInfo(!info.isEmpty());
+    m_controller->setAdditionalInfoCount(info.count());
     m_fileItemDelegate->setShowInformation(info);
 
     emit additionalInfoChanged(info);
     startDirLister(viewPropsUrl, true);
 }
 
     m_fileItemDelegate->setShowInformation(info);
 
     emit additionalInfoChanged(info);
     startDirLister(viewPropsUrl, true);
 }
 
-void DolphinView::setAdditionalInfo(KFileItemDelegate::Information info)
-{
-    KFileItemDelegate::InformationList list;
-    if (info != KFileItemDelegate::NoInformation)
-        list << info;
-
-    setAdditionalInfo(list);
-}
-
 KFileItemDelegate::InformationList DolphinView::additionalInfo() const
 {
     return m_fileItemDelegate->showInformation();
 KFileItemDelegate::InformationList DolphinView::additionalInfo() const
 {
     return m_fileItemDelegate->showInformation();
@@ -658,7 +649,7 @@ void DolphinView::applyViewProperties(const KUrl& url)
 
     KFileItemDelegate::InformationList info = props.additionalInfo();
     if (info != m_fileItemDelegate->showInformation()) {
 
     KFileItemDelegate::InformationList info = props.additionalInfo();
     if (info != m_fileItemDelegate->showInformation()) {
-        m_controller->setShowAdditionalInfo(!info.isEmpty());
+        m_controller->setAdditionalInfoCount(info.count());
         m_fileItemDelegate->setShowInformation(info);
         emit additionalInfoChanged(info);
     }
         m_fileItemDelegate->setShowInformation(info);
         emit additionalInfoChanged(info);
     }
@@ -807,6 +798,11 @@ void DolphinView::clearHoverInformation()
 
 void DolphinView::createView()
 {
 
 void DolphinView::createView()
 {
+    KFileItemDelegate::InformationList infoList;
+    if (m_fileItemDelegate != 0) {
+        infoList = m_fileItemDelegate->showInformation();
+    }
+
     // delete current view
     QAbstractItemView* view = itemView();
     if (view != 0) {
     // delete current view
     QAbstractItemView* view = itemView();
     if (view != 0) {
@@ -846,6 +842,7 @@ void DolphinView::createView()
     Q_ASSERT(view != 0);
 
     m_fileItemDelegate = new KFileItemDelegate(view);
     Q_ASSERT(view != 0);
 
     m_fileItemDelegate = new KFileItemDelegate(view);
+    m_fileItemDelegate->setShowInformation(infoList);
     view->setItemDelegate(m_fileItemDelegate);
 
     view->setModel(m_proxyModel);
     view->setItemDelegate(m_fileItemDelegate);
 
     view->setModel(m_proxyModel);
index 96c649d97b58ce3cda2fc7c989a593fc5d89ade2..c3d1c7abc6a50b3fdcd3bc9a6a8ee42cdb9b39d8 100644 (file)
@@ -281,9 +281,6 @@ public:
     /** Sets the additional information which should be shown for the items. */
     void setAdditionalInfo(KFileItemDelegate::InformationList info);
 
     /** Sets the additional information which should be shown for the items. */
     void setAdditionalInfo(KFileItemDelegate::InformationList info);
 
-    /** Sets the additional information which should be shown for the items. */
-    void setAdditionalInfo(KFileItemDelegate::Information info);
-
     /** Returns the additional information which should be shown for the items. */
     KFileItemDelegate::InformationList additionalInfo() const;
 
     /** Returns the additional information which should be shown for the items. */
     KFileItemDelegate::InformationList additionalInfo() const;
 
index 8dc5b8ad67d2d6d2c0764996befae0845ea4d281..f5fdbbf3a05caf9347e677faa4b6eee5490fe8e6 100644 (file)
@@ -199,8 +199,22 @@ Qt::SortOrder ViewProperties::sortOrder() const
 
 void ViewProperties::setAdditionalInfo(KFileItemDelegate::InformationList list)
 {
 
 void ViewProperties::setAdditionalInfo(KFileItemDelegate::InformationList list)
 {
-    KFileItemDelegate::Information info = list.isEmpty() ?
-                            KFileItemDelegate::NoInformation : list.first();
+    int info = NoInfo;
+    foreach (KFileItemDelegate::Information currentInfo, list) {
+        switch (currentInfo) {
+        case KFileItemDelegate::FriendlyMimeType:
+            info = info | TypeInfo;
+            break;
+        case KFileItemDelegate::Size:
+            info = info | SizeInfo;
+            break;
+        case KFileItemDelegate::ModificationTime:
+            info = info | DateInfo;
+            break;
+        default:
+            break;
+        }
+    }
 
     if (m_node->additionalInfo() != info) {
         m_node->setAdditionalInfo(info);
 
     if (m_node->additionalInfo() != info) {
         m_node->setAdditionalInfo(info);
@@ -210,12 +224,20 @@ void ViewProperties::setAdditionalInfo(KFileItemDelegate::InformationList list)
 
 KFileItemDelegate::InformationList ViewProperties::additionalInfo() const
 {
 
 KFileItemDelegate::InformationList ViewProperties::additionalInfo() const
 {
-    KFileItemDelegate::Information info = static_cast<KFileItemDelegate::Information>(m_node->additionalInfo());
+    const int info = m_node->additionalInfo();
+
+    KFileItemDelegate::InformationList list;
+    if (info & TypeInfo) {
+        list.append(KFileItemDelegate::FriendlyMimeType);
+    }
+    if (info & SizeInfo) {
+        list.append(KFileItemDelegate::Size);
+    }
+    if (info & DateInfo) {
+        list.append(KFileItemDelegate::ModificationTime);
+    }
 
 
-    if (info != KFileItemDelegate::NoInformation)
-        return KFileItemDelegate::InformationList() << info;
-    else
-        return KFileItemDelegate::InformationList();
+    return list;
 }
 
 
 }
 
 
index 155d4e2f5e97683659fdc965db15c68d29f569b5..70c33b11b735dc8d7a0d2da351c00e9a71319401 100644 (file)
@@ -120,6 +120,14 @@ private:
     Q_DISABLE_COPY(ViewProperties)
 
 private:
     Q_DISABLE_COPY(ViewProperties)
 
 private:
+    enum AdditionalInfoValues
+    {
+        NoInfo   = 0,
+        TypeInfo = 1,
+        SizeInfo = 2,
+        DateInfo = 4
+    };
+
     bool m_changedProps;
     bool m_autoSave;
     QString m_filepath;
     bool m_changedProps;
     bool m_autoSave;
     QString m_filepath;