mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
allow sorting by type
svn path=/trunk/KDE/kdebase/apps/; revision=656971
This commit is contained in:
parent
28a08b940c
commit
a195131147
|
@ -36,17 +36,17 @@
|
|||
#include <QSpinBox>
|
||||
|
||||
DetailsViewSettingsPage::DetailsViewSettingsPage(DolphinMainWindow* mainWindow,
|
||||
QWidget* parent) :
|
||||
KVBox(parent),
|
||||
m_mainWindow(mainWindow),
|
||||
m_dateBox(0),
|
||||
m_permissionsBox(0),
|
||||
m_ownerBox(0),
|
||||
m_groupBox(0),
|
||||
m_smallIconSize(0),
|
||||
m_mediumIconSize(0),
|
||||
m_largeIconSize(0),
|
||||
m_fontRequester(0)
|
||||
QWidget* parent) :
|
||||
KVBox(parent),
|
||||
m_mainWindow(mainWindow),
|
||||
m_dateBox(0),
|
||||
m_permissionsBox(0),
|
||||
m_ownerBox(0),
|
||||
m_groupBox(0),
|
||||
m_smallIconSize(0),
|
||||
m_mediumIconSize(0),
|
||||
m_largeIconSize(0),
|
||||
m_fontRequester(0)
|
||||
{
|
||||
const int spacing = KDialog::spacingHint();
|
||||
const int margin = KDialog::marginHint();
|
||||
|
@ -74,11 +74,15 @@ DetailsViewSettingsPage::DetailsViewSettingsPage(DolphinMainWindow* mainWindow,
|
|||
m_groupBox = new QCheckBox(i18n("Group"), this);
|
||||
m_groupBox->setChecked(settings->showGroup());
|
||||
|
||||
m_typeBox = new QCheckBox(i18n("Type"), this);
|
||||
m_typeBox->setChecked(settings->showType());
|
||||
|
||||
QHBoxLayout* columnsLayout = new QHBoxLayout(columnsBox);
|
||||
columnsLayout->addWidget(m_dateBox);
|
||||
columnsLayout->addWidget(m_permissionsBox);
|
||||
columnsLayout->addWidget(m_ownerBox);
|
||||
columnsLayout->addWidget(m_groupBox);
|
||||
columnsLayout->addWidget(m_typeBox);
|
||||
|
||||
// Create "Icon" properties
|
||||
QGroupBox* iconSizeBox = new QGroupBox(i18n("Icon Size"), this);
|
||||
|
@ -134,7 +138,8 @@ DetailsViewSettingsPage::DetailsViewSettingsPage(DolphinMainWindow* mainWindow,
|
|||
}
|
||||
|
||||
DetailsViewSettingsPage::~DetailsViewSettingsPage()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void DetailsViewSettingsPage::applySettings()
|
||||
{
|
||||
|
@ -145,6 +150,7 @@ void DetailsViewSettingsPage::applySettings()
|
|||
settings->setShowPermissions(m_permissionsBox->isChecked());
|
||||
settings->setShowOwner(m_ownerBox->isChecked());
|
||||
settings->setShowGroup(m_groupBox->isChecked());
|
||||
settings->setShowType(m_typeBox->isChecked());
|
||||
|
||||
int iconSize = K3Icon::SizeSmall;
|
||||
if (m_mediumIconSize->isChecked()) {
|
||||
|
|
|
@ -54,6 +54,7 @@ private:
|
|||
QCheckBox* m_permissionsBox;
|
||||
QCheckBox* m_ownerBox;
|
||||
QCheckBox* m_groupBox;
|
||||
QCheckBox* m_typeBox;
|
||||
QRadioButton* m_smallIconSize;
|
||||
QRadioButton* m_mediumIconSize;
|
||||
QRadioButton* m_largeIconSize;
|
||||
|
|
|
@ -45,5 +45,9 @@
|
|||
<label>Show size</label>
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="ShowType" type="Bool">
|
||||
<label>Show type</label>
|
||||
<default>false</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
|
@ -116,6 +116,10 @@ bool DolphinDetailsView::event(QEvent* event)
|
|||
if (!settings->showGroup()) {
|
||||
hideColumn(KDirModel::Group);
|
||||
}
|
||||
|
||||
if (!settings->showType()) {
|
||||
hideColumn(KDirModel::Type);
|
||||
}
|
||||
}
|
||||
|
||||
return QTreeView::event(event);
|
||||
|
|
|
@ -305,6 +305,8 @@ void DolphinMainWindow::slotSortingChanged(DolphinView::Sorting sorting)
|
|||
case DolphinView::SortByGroup:
|
||||
action = actionCollection()->action("by_group");
|
||||
break;
|
||||
case DolphinView::SortByType:
|
||||
action = actionCollection()->action("by_type");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -703,6 +705,11 @@ void DolphinMainWindow::sortByGroup()
|
|||
m_activeView->setSorting(DolphinView::SortByGroup);
|
||||
}
|
||||
|
||||
void DolphinMainWindow::sortByType()
|
||||
{
|
||||
m_activeView->setSorting(DolphinView::SortByType);
|
||||
}
|
||||
|
||||
void DolphinMainWindow::toggleSortOrder()
|
||||
{
|
||||
const Qt::SortOrder order = (m_activeView->sortOrder() == Qt::AscendingOrder) ?
|
||||
|
@ -1137,6 +1144,10 @@ void DolphinMainWindow::setupActions()
|
|||
sortByGroup->setText(i18n("By Group"));
|
||||
connect(sortByGroup, SIGNAL(triggered()), this, SLOT(sortByGroup()));
|
||||
|
||||
KToggleAction* sortByType = actionCollection()->add<KToggleAction>("by_type");
|
||||
sortByType->setText(i18n("By Type"));
|
||||
connect(sortByType, SIGNAL(triggered()), this, SLOT(sortByType()));
|
||||
|
||||
QActionGroup* sortGroup = new QActionGroup(this);
|
||||
sortGroup->addAction(sortByName);
|
||||
sortGroup->addAction(sortBySize);
|
||||
|
@ -1144,6 +1155,7 @@ void DolphinMainWindow::setupActions()
|
|||
sortGroup->addAction(sortByPermissions);
|
||||
sortGroup->addAction(sortByOwner);
|
||||
sortGroup->addAction(sortByGroup);
|
||||
sortGroup->addAction(sortByType);
|
||||
|
||||
KToggleAction* sortDescending = actionCollection()->add<KToggleAction>("descending");
|
||||
sortDescending->setText(i18n("Descending"));
|
||||
|
@ -1259,6 +1271,10 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
// after the dock concept has been finalized.
|
||||
|
||||
// setup "Information"
|
||||
|
||||
// TODO: temporary deactivated info sidebar because of some minor side effects
|
||||
|
||||
/*
|
||||
QDockWidget* infoDock = new QDockWidget(i18n("Information"));
|
||||
infoDock->setObjectName("infoDock");
|
||||
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
|
@ -1269,7 +1285,7 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
actionCollection()->addAction("show_info_panel", infoDock->toggleViewAction());
|
||||
|
||||
addDockWidget(Qt::RightDockWidgetArea, infoDock);
|
||||
connectSidebarPage(infoWidget);
|
||||
connectSidebarPage(infoWidget);*/
|
||||
|
||||
// setup "Tree View"
|
||||
QDockWidget* treeViewDock = new QDockWidget(i18n("Folders"));
|
||||
|
@ -1286,7 +1302,7 @@ void DolphinMainWindow::setupDockWidgets()
|
|||
|
||||
const bool firstRun = DolphinSettings::instance().generalSettings()->firstRun();
|
||||
if (firstRun) {
|
||||
infoDock->hide();
|
||||
//infoDock->hide();
|
||||
treeViewDock->hide();
|
||||
}
|
||||
|
||||
|
|
|
@ -262,6 +262,9 @@ private slots:
|
|||
/** The sorting of the current view should be done by the group. */
|
||||
void sortByGroup();
|
||||
|
||||
/** The sorting of the current view should be done by the type. */
|
||||
void sortByType();
|
||||
|
||||
/** Switches between an ascending and descending sorting order. */
|
||||
void toggleSortOrder();
|
||||
|
||||
|
|
|
@ -24,26 +24,28 @@
|
|||
#include <kdirmodel.h>
|
||||
#include <kfileitem.h>
|
||||
|
||||
static const int dolphinMapSize = 6;
|
||||
static const int dolphinMapSize = 7;
|
||||
static int dolphinViewToDirModelColumn[] =
|
||||
{
|
||||
KDirModel::Name, // DolphinView::SortByName
|
||||
KDirModel::Size, // DolphinView::SortBySize
|
||||
KDirModel::ModifiedTime, // DolphinView::SortByDate
|
||||
KDirModel::Permissions, // DolphinView::SortByPermissions
|
||||
KDirModel::Owner, // DolphinView::SortByOwner
|
||||
KDirModel::Group // DolphinView::SortByGroup
|
||||
};
|
||||
{
|
||||
KDirModel::Name, // DolphinView::SortByName
|
||||
KDirModel::Size, // DolphinView::SortBySize
|
||||
KDirModel::ModifiedTime, // DolphinView::SortByDate
|
||||
KDirModel::Permissions, // DolphinView::SortByPermissions
|
||||
KDirModel::Owner, // DolphinView::SortByOwner
|
||||
KDirModel::Group, // DolphinView::SortByGroup
|
||||
KDirModel::Type // DolphinView::SortByType
|
||||
};
|
||||
|
||||
static DolphinView::Sorting dirModelColumnToDolphinView[] =
|
||||
{
|
||||
DolphinView::SortByName, // KDirModel::Name
|
||||
DolphinView::SortBySize, // KDirModel::Size
|
||||
DolphinView::SortByDate, // KDirModel::ModifiedTime
|
||||
DolphinView::SortByPermissions, // KDirModel::Permissions
|
||||
DolphinView::SortByOwner, // KDirModel::Owner
|
||||
DolphinView::SortByGroup // KDirModel::Group
|
||||
};
|
||||
{
|
||||
DolphinView::SortByName, // KDirModel::Name
|
||||
DolphinView::SortBySize, // KDirModel::Size
|
||||
DolphinView::SortByDate, // KDirModel::ModifiedTime
|
||||
DolphinView::SortByPermissions, // KDirModel::Permissions
|
||||
DolphinView::SortByOwner, // KDirModel::Owner
|
||||
DolphinView::SortByGroup, // KDirModel::Group
|
||||
DolphinView::SortByType // KDirModel::Type
|
||||
};
|
||||
|
||||
|
||||
DolphinSortFilterProxyModel::DolphinSortFilterProxyModel(QObject* parent) :
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
<Action name="by_permissions" />
|
||||
<Action name="by_owner" />
|
||||
<Action name="by_group" />
|
||||
<Action name="by_type" />
|
||||
<Separator/>
|
||||
<Action name="descending" />
|
||||
<Action name="categorized" />
|
||||
|
|
|
@ -108,7 +108,8 @@ public:
|
|||
SortByPermissions,
|
||||
SortByOwner,
|
||||
SortByGroup,
|
||||
MaxSortEnum = SortByGroup
|
||||
SortByType,
|
||||
MaxSortEnum = SortByType
|
||||
};
|
||||
|
||||
DolphinView(DolphinMainWindow* mainwindow,
|
||||
|
|
|
@ -54,6 +54,7 @@ bool SidebarTreeView::event(QEvent* event)
|
|||
hideColumn(KDirModel::Permissions);
|
||||
hideColumn(KDirModel::Owner);
|
||||
hideColumn(KDirModel::Group);
|
||||
hideColumn(KDirModel::Type);
|
||||
header()->hide();
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
m_viewMode->addItem(KIcon("fileview-column"), i18n("Column"));
|
||||
const int index = static_cast<int>(m_viewProps->viewMode());
|
||||
m_viewMode->setCurrentIndex(index);
|
||||
const bool iconsViewEnabled = (index == DolphinView::IconsView);
|
||||
|
||||
QLabel* sortingLabel = new QLabel(i18n("Sorting:"), propsBox);
|
||||
QWidget* sortingBox = new QWidget(propsBox);
|
||||
|
@ -99,6 +100,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
m_categorizedSorting->addItem(i18n("Uncategorized"));
|
||||
m_categorizedSorting->addItem(i18n("Categorized"));
|
||||
m_categorizedSorting->setCurrentIndex(m_viewProps->categorizedSorting() ? 1 : 0);
|
||||
m_categorizedSorting->setEnabled(iconsViewEnabled);
|
||||
|
||||
m_sorting = new QComboBox(sortingBox);
|
||||
m_sorting->addItem("By Name");
|
||||
|
@ -107,6 +109,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
m_sorting->addItem("By Permissions");
|
||||
m_sorting->addItem("By Owner");
|
||||
m_sorting->addItem("By Group");
|
||||
m_sorting->addItem("By Type");
|
||||
m_sorting->setCurrentIndex(m_viewProps->sorting());
|
||||
|
||||
QHBoxLayout* sortingLayout = new QHBoxLayout();
|
||||
|
@ -124,7 +127,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
|
|||
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_additionalInfo->setEnabled(iconsViewEnabled);
|
||||
|
||||
m_showPreview = new QCheckBox(i18n("Show preview"), propsBox);
|
||||
m_showPreview->setChecked(m_viewProps->showPreview());
|
||||
|
|
Loading…
Reference in a new issue