Commit d7905edf authored by Ignat Semenov's avatar Ignat Semenov
Browse files

add a "Sort order" combo to the Display config page

Allow the user to change sorting order using the Settings dialog.

CCBUG:306537
parent bbc2be3c
......@@ -740,6 +740,9 @@ void FolderView::createConfigurationInterface(KConfigDialog *parent)
uiDisplay.sortCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("sort_type")->text()), KDirModel::Type);
uiDisplay.sortCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("sort_date")->text()), KDirModel::ModifiedTime);
uiDisplay.directionCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("sort_ascending")->text()), QVariant::fromValue(Qt::AscendingOrder));
uiDisplay.directionCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("sort_descending")->text()), QVariant::fromValue(Qt::DescendingOrder));
uiDisplay.flowCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("arrange_ver_ltr")->text()), QVariant::fromValue(IconView::VerLeftToRight));
uiDisplay.flowCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("arrange_ver_rtl")->text()), QVariant::fromValue(IconView::VerRightToLeft));
uiDisplay.flowCombo->addItem(KGlobal::locale()->removeAcceleratorMarker(m_actionCollection.action("arrange_hor_ltr")->text()), QVariant::fromValue(IconView::HorLeftToRight));
......@@ -765,6 +768,13 @@ void FolderView::createConfigurationInterface(KConfigDialog *parent)
}
}
for (int i = 0; i < uiDisplay.directionCombo->maxCount(); i++) {
if (m_sortOrder == uiDisplay.directionCombo->itemData(i).value<Qt::SortOrder>()) {
uiDisplay.directionCombo->setCurrentIndex(i);
break;
}
}
for (int i = 0; i < uiDisplay.flowCombo->maxCount(); i++) {
if (m_flow == uiDisplay.flowCombo->itemData(i).value<IconView::Flow>()) {
uiDisplay.flowCombo->setCurrentIndex(i);
......@@ -825,6 +835,7 @@ void FolderView::createConfigurationInterface(KConfigDialog *parent)
connect(uiDisplay.flowCombo, SIGNAL(currentIndexChanged(int)), parent, SLOT(settingsModified()));
connect(uiDisplay.sortCombo, SIGNAL(currentIndexChanged(int)), parent, SLOT(settingsModified()));
connect(uiDisplay.directionCombo, SIGNAL(currentIndexChanged(int)), parent, SLOT(settingsModified()));
connect(uiDisplay.sizeSlider, SIGNAL(valueChanged(int)), parent, SLOT(settingsModified()));
connect(uiDisplay.showPreviews, SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
connect(uiDisplay.lockInPlace, SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
......@@ -896,6 +907,9 @@ void FolderView::configAccepted()
const int sortColumn = uiDisplay.sortCombo->itemData(uiDisplay.sortCombo->currentIndex()).toInt();
cg.writeEntry("sortColumn", sortColumn);
const Qt::SortOrder order = uiDisplay.directionCombo->itemData(uiDisplay.directionCombo->currentIndex()).value<Qt::SortOrder>();
cg.writeEntry("sortOrder", sortOrderEnumToString(order));
const IconView::Flow flow = uiDisplay.flowCombo->itemData(uiDisplay.flowCombo->currentIndex()).value<IconView::Flow>();
cg.writeEntry("flow", static_cast<int>(flow));
......
......@@ -7,87 +7,198 @@
<x>0</x>
<y>0</y>
<width>442</width>
<height>401</height>
<height>430</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="1">
<widget class="QLabel" name="lockInPlaceLabel">
<property name="text">
<string>Lock in place:</string>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="iconsTitle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Icons</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="previewsAdvancedLabel">
<item row="1" column="0" rowspan="6">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>148</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QLabel" name="flowLabel">
<property name="text">
<string>Previews:</string>
<string>Arrangement:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>flowCombo</cstring>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="numLinesEditLabel">
<item row="1" column="3">
<widget class="KComboBox" name="flowCombo">
<property name="whatsThis">
<string>Use this control to choose if you want the icons to be arranged top to bottom starting on the left side of the view, or arranged left to right starting at the top of the view.</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="sortLabel">
<property name="text">
<string>Lines:</string>
<string>Sorting:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>numLinesEdit</cstring>
<cstring>sortCombo</cstring>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QCheckBox" name="lockInPlace">
<item row="2" column="3">
<widget class="KComboBox" name="sortCombo">
<property name="whatsThis">
<string>Check this option if you do not want the icons to be moveable in the view.
This option is useful if you want to avoid accidentally moving the icons while interacting with them.</string>
<string>Use this control to choose the criteria by which the icons will be sorted in the view.</string>
</property>
</widget>
</item>
<item row="2" column="4" colspan="2">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>160</width>
<height>23</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="QLabel" name="directionLabel">
<property name="text">
<string/>
<string>Direction:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>directionCombo</cstring>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QCheckBox" name="alignToGrid">
<item row="3" column="3">
<widget class="KComboBox" name="directionCombo">
<property name="whatsThis">
<string>Check this option if you want the icons to be arranged in a grid.
When this option is checked, icons will automatically snap to the nearest grid cell when you move them around in the view.</string>
</property>
<property name="text">
<string/>
<string>Use this control to choose the criteria by which the icons will be sorted in the view.</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="iconsTitle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="3" column="4" colspan="2">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
<property name="sizeHint" stdset="0">
<size>
<width>208</width>
<height>23</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="QLabel" name="sizeSliderLabel">
<property name="text">
<string>Icons</string>
<string>Size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>sizeSlider</cstring>
</property>
</widget>
</item>
<item row="4" column="3" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Small</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="sizeSlider">
<property name="whatsThis">
<string>Use this slider to increase or decrease the size of the icons in the view.</string>
</property>
<property name="maximum">
<number>6</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Large</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="1" colspan="2">
<widget class="QLabel" name="previewsAdvancedLabel">
<property name="text">
<string>Previews:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="2" colspan="2">
<item row="5" column="3" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="showPreviews">
......@@ -124,30 +235,29 @@ When this option is checked, icons will automatically snap to the nearest grid c
</item>
</layout>
</item>
<item row="11" column="1">
<widget class="QLabel" name="drawShadowsLabel">
<item row="6" column="1" colspan="2">
<widget class="QLabel" name="lockInPlaceLabel">
<property name="text">
<string>Shadows:</string>
<string>Lock in place:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>numLinesEdit</cstring>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QCheckBox" name="clickToView">
<item row="6" column="3">
<widget class="QCheckBox" name="lockInPlace">
<property name="whatsThis">
<string>Check this option if you want folder previews to appear only when clicked. When this option is turned off, folder previews will appear automatically when the mouse hovers over a folder.</string>
<string>Check this option if you do not want the icons to be moveable in the view.
This option is useful if you want to avoid accidentally moving the icons while interacting with them.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1" colspan="2">
<widget class="QLabel" name="alignToGridLabel">
<property name="text">
<string>Align to grid:</string>
......@@ -157,70 +267,19 @@ When this option is checked, icons will automatically snap to the nearest grid c
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="KComboBox" name="flowCombo">
<property name="whatsThis">
<string>Use this control to choose if you want the icons to be arranged top to bottom starting on the left side of the view, or arranged left to right starting at the top of the view.</string>
</property>
</widget>
</item>
<item row="10" column="2">
<widget class="KColorButton" name="colorButton">
<item row="7" column="3">
<widget class="QCheckBox" name="alignToGrid">
<property name="whatsThis">
<string>Click this button to choose the color which is used for the text labels in the view.</string>
<string>Check this option if you want the icons to be arranged in a grid.
When this option is checked, icons will automatically snap to the nearest grid cell when you move them around in the view.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="KComboBox" name="sortCombo">
<property name="whatsThis">
<string>Use this control to choose the criteria by which the icons will be sorted in the view.</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLabel" name="colorButtonLabel">
<property name="text">
<string>Color:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>colorButton</cstring>
</property>
</widget>
</item>
<item row="2" column="3">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>160</width>
<height>23</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QLabel" name="flowLabel">
<property name="text">
<string>Arrangement:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>flowCombo</cstring>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1" colspan="2">
<widget class="QLabel" name="clickToViewLabel">
<property name="text">
<string>Click to view folder:</string>
......@@ -230,47 +289,49 @@ When this option is checked, icons will automatically snap to the nearest grid c
</property>
</widget>
</item>
<item row="11" column="2">
<widget class="QCheckBox" name="drawShadows">
<item row="8" column="3">
<widget class="QCheckBox" name="clickToView">
<property name="whatsThis">
<string>&lt;html&gt;&lt;body&gt;&lt;p&gt;Check this option if you want the text labels to cast a shadow on the background.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Shadows help make the text easier to read by making it stand out more from the background.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Note that with dark text colors, this option will cause the text to glow with a bright halo, instead of casting a shadow.&lt;/i&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>Check this option if you want folder previews to appear only when clicked. When this option is turned off, folder previews will appear automatically when the mouse hovers over a folder.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="12" column="3">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="9" column="0" colspan="3">
<widget class="QLabel" name="iconTextTitle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>44</width>
<height>216</height>
</size>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
</spacer>
<property name="text">
<string>Icon Text</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="sizeSliderLabel">
<item row="10" column="1">
<widget class="QLabel" name="numLinesEditLabel">
<property name="text">
<string>Size:</string>
<string>Lines:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>sizeSlider</cstring>
<cstring>numLinesEdit</cstring>
</property>
</widget>
</item>
<item row="9" column="2">
<item row="10" column="3">
<widget class="KIntSpinBox" name="numLinesEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
......@@ -295,7 +356,7 @@ When this option is checked, icons will automatically snap to the nearest grid c
</property>
</widget>
</item>
<item row="10" column="0">
<item row="11" column="0">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -311,97 +372,69 @@ When this option is checked, icons will automatically snap to the nearest grid c
</property>
</spacer>
</item>
<item row="8" column="0" colspan="2">
<widget class="QLabel" name="iconTextTitle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="11" column="1">
<widget class="QLabel" name="colorButtonLabel">
<property name="text">
<string>Color:</string>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="text">
<string>Icon Text</string>
<property name="buddy">
<cstring>colorButton</cstring>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="6">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<item row="11" column="3">
<widget class="KColorButton" name="colorButton">
<property name="whatsThis">
<string>Click this button to choose the color which is used for the text labels in the view.</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>148</height>
</size>
<property name="text">
<string/>
</property>
</spacer>
</item>
<item row="3" column="2" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Small</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="sizeSlider">
<property name="whatsThis">
<string>Use this slider to increase or decrease the size of the icons in the view.</string>
</property>
<property name="maximum">
<number>6</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Large</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="sortLabel">
<item row="12" column="1" colspan="2">
<widget class="QLabel" name="drawShadowsLabel">
<property name="text">
<string>Sorting:</string>
<string>Shadows:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>sortCombo</cstring>
<cstring>numLinesEdit</cstring>
</property>
</widget>
</item>
<item row="12" column="3">
<widget class="QCheckBox" name="drawShadows">
<property name="whatsThis">
<string>&lt;html&gt;&lt;body&gt;&lt;p&gt;Check this option if you want the text labels to cast a shadow on the background.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Shadows help make the text easier to read by making it stand out more from the background.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;