#include "dolphin_generalsettings.h"
#include "viewproperties.h"
-#include <assert.h>
-
#include <kcomponentdata.h>
#include <klocale.h>
#include <kiconloader.h>
m_viewMode(0),
m_sorting(0),
m_sortOrder(0),
+ m_additionalInfo(0),
m_showPreview(0),
m_showHiddenFiles(0),
m_applyToCurrentFolder(0),
m_applyToSubFolders(0),
m_useAsDefault(0)
{
- assert(dolphinView != 0);
+ Q_ASSERT(dolphinView != 0);
const bool useGlobalViewProps = DolphinSettings::instance().generalSettings()->globalViewProps();
setCaption(i18n("View Properties"));
QLabel* viewModeLabel = new QLabel(i18n("View mode:"), propsBox);
m_viewMode = new QComboBox(propsBox);
- m_viewMode->addItem(SmallIcon("view_icon"), i18n("Icons"));
- m_viewMode->addItem(SmallIcon("view_text"), i18n("Details"));
+ m_viewMode->addItem(SmallIcon("view-icon"), i18n("Icons"));
+ m_viewMode->addItem(SmallIcon("fileview-text"), i18n("Details"));
const int index = static_cast<int>(m_viewProps->viewMode());
m_viewMode->setCurrentIndex(index);
const int sortOrderIdx = (m_viewProps->sortOrder() == Qt::Ascending) ? 0 : 1;
m_sortOrder->setCurrentIndex(sortOrderIdx);
+ QLabel* additionalInfoLabel = new QLabel(i18n("Additional information:"), propsBox);
+ m_additionalInfo = new QComboBox(propsBox);
+ m_additionalInfo->addItem(i18n("No Information"), KFileItemDelegate::NoInformation);
+ m_additionalInfo->addItem(i18n("Type"), KFileItemDelegate::FriendlyMimeType);
+ m_additionalInfo->addItem(i18n("Size"), KFileItemDelegate::Size);
+ m_additionalInfo->addItem(i18n("Date"), KFileItemDelegate::ModificationTime);
+ const int addInfoIndex = m_additionalInfo->findData(m_viewProps->additionalInfo());
+ m_additionalInfo->setCurrentIndex(addInfoIndex);
+ m_additionalInfo->setEnabled(m_viewProps->viewMode() == DolphinView::IconsView);
+
m_showPreview = new QCheckBox(i18n("Show preview"), propsBox);
m_showPreview->setChecked(m_viewProps->showPreview());
propsBoxLayout->addWidget(m_sorting, 1, 1);
propsBoxLayout->addWidget(sortOrderLabel, 2, 0);
propsBoxLayout->addWidget(m_sortOrder, 2, 1);
- propsBoxLayout->addWidget(m_showPreview, 3, 0);
- propsBoxLayout->addWidget(m_showHiddenFiles, 4, 0);
+ propsBoxLayout->addWidget(additionalInfoLabel, 3, 0);
+ propsBoxLayout->addWidget(m_additionalInfo, 3, 1);
+ propsBoxLayout->addWidget(m_showPreview, 4, 0);
+ propsBoxLayout->addWidget(m_showHiddenFiles, 5, 0);
topLayout->addWidget(propsBox);
this, SLOT(slotSortingChanged(int)));
connect(m_sortOrder, SIGNAL(activated(int)),
this, SLOT(slotSortOrderChanged(int)));
+ connect(m_additionalInfo, SIGNAL(activated(int)),
+ this, SLOT(slotAdditionalInfoChanged(int)));
connect(m_showPreview, SIGNAL(clicked()),
this, SLOT(slotShowPreviewChanged()));
connect(m_showHiddenFiles, SIGNAL(clicked()),
void ViewPropertiesDialog::slotViewModeChanged(int index)
{
- assert((index >= 0) && (index <= 2));
+ Q_ASSERT((index >= 0) && (index <= 1));
m_viewProps->setViewMode(static_cast<DolphinView::Mode>(index));
m_isDirty = true;
+
+ m_additionalInfo->setEnabled(m_viewProps->viewMode() == DolphinView::IconsView);
}
void ViewPropertiesDialog::slotSortingChanged(int index)
m_isDirty = true;
}
+void ViewPropertiesDialog::slotAdditionalInfoChanged(int index)
+{
+ KFileItemDelegate::AdditionalInformation info = KFileItemDelegate::NoInformation;
+ switch (index) {
+ case 1: info = KFileItemDelegate::FriendlyMimeType; break;
+ case 2: info = KFileItemDelegate::Size; break;
+ case 3: info = KFileItemDelegate::ModificationTime; break;
+ default: break;
+ }
+ m_viewProps->setAdditionalInfo(info);
+ m_isDirty = true;
+}
+
void ViewPropertiesDialog::slotShowPreviewChanged()
{
const bool show = m_showPreview->isChecked();
m_dolphinView->setMode(m_viewProps->viewMode());
m_dolphinView->setSorting(m_viewProps->sorting());
m_dolphinView->setSortOrder(m_viewProps->sortOrder());
+ m_dolphinView->setAdditionalInfo(m_viewProps->additionalInfo());
m_dolphinView->setShowPreview(m_viewProps->showPreview());
m_dolphinView->setShowHiddenFiles(m_viewProps->showHiddenFiles());
// file stored for the global view properties is used as fallback. To update
// this file we temporary turn on the global view properties mode.
GeneralSettings* settings = DolphinSettings::instance().generalSettings();
- assert(!settings->globalViewProps());
+ Q_ASSERT(!settings->globalViewProps());
settings->setGlobalViewProps(true);
ViewProperties defaultProps(m_dolphinView->url());