Git commit 298d307055de6bab23f7e1d17e66a11ef39f2035 by Emmanuel Pescosta. Committed on 30/01/2015 at 12:08. Pushed by emmanuelp into branch 'frameworks'. Port away from KGlobalSettings::naturalSorting() by moving it to Dolphin's = GeneralSettings REVIEW: 122310 M +2 -2 dolphin/src/CMakeLists.txt M +5 -4 dolphin/src/kitemviews/kfileitemmodel.cpp M +6 -0 dolphin/src/settings/dolphin_generalsettings.kcfg M +2 -8 dolphin/src/settings/general/behaviorsettingspage.cpp M +17 -1 dolphin/src/tests/CMakeLists.txt http://commits.kde.org/kde-baseapps/298d307055de6bab23f7e1d17e66a11ef39f2035 diff --git a/dolphin/src/CMakeLists.txt b/dolphin/src/CMakeLists.txt index d2ea493..748b093 100644 --- a/dolphin/src/CMakeLists.txt +++ b/dolphin/src/CMakeLists.txt @@ -81,7 +81,7 @@ if(HAVE_BALOO) ) endif() = -kconfig_add_kcfg_files(dolphinprivate_LIB_SRCS +kconfig_add_kcfg_files(dolphinprivate_LIB_SRCS GENERATE_MOC settings/dolphin_compactmodesettings.kcfgc settings/dolphin_directoryviewpropertysettings.kcfgc settings/dolphin_detailsmodesettings.kcfgc @@ -204,7 +204,7 @@ set(dolphin_SRCS views/zoomlevelinfo.cpp ) = -kconfig_add_kcfg_files(dolphin_SRCS +kconfig_add_kcfg_files(dolphin_SRCS GENERATE_MOC panels/folders/dolphin_folderspanelsettings.kcfgc panels/information/dolphin_informationpanelsettings.kcfgc panels/places/dolphin_placespanelsettings.kcfgc diff --git a/dolphin/src/kitemviews/kfileitemmodel.cpp b/dolphin/src/kitemv= iews/kfileitemmodel.cpp index 98249db..0198912 100644 --- a/dolphin/src/kitemviews/kfileitemmodel.cpp +++ b/dolphin/src/kitemviews/kfileitemmodel.cpp @@ -21,7 +21,8 @@ = #include "kfileitemmodel.h" = -#include +#include "dolphin_generalsettings.h" + #include #include #include @@ -41,7 +42,7 @@ KFileItemModel::KFileItemModel(QObject* parent) : KItemModelBase("text", parent), m_dirLister(0), - m_naturalSorting(KGlobalSettings::naturalSorting()), + m_naturalSorting(GeneralSettings::naturalSorting()), m_sortDirsFirst(true), m_sortRole(NameRole), m_sortingProgressPercent(-1), @@ -106,7 +107,7 @@ KFileItemModel::KFileItemModel(QObject* parent) : m_resortAllItemsTimer->setSingleShot(true); connect(m_resortAllItemsTimer, &QTimer::timeout, this, &KFileItemModel= ::resortAllItems); = - connect(KGlobalSettings::self(), &KGlobalSettings::naturalSortingChang= ed, + connect(GeneralSettings::self(), &GeneralSettings::naturalSortingChang= ed, this, &KFileItemModel::slotNaturalSortingChanged); } = @@ -1105,7 +1106,7 @@ void KFileItemModel::slotClear() = void KFileItemModel::slotNaturalSortingChanged() { - m_naturalSorting =3D KGlobalSettings::naturalSorting(); + m_naturalSorting =3D GeneralSettings::naturalSorting(); resortAllItems(); } = diff --git a/dolphin/src/settings/dolphin_generalsettings.kcfg b/dolphin/sr= c/settings/dolphin_generalsettings.kcfg index 3c820e2..2f230bf 100644 --- a/dolphin/src/settings/dolphin_generalsettings.kcfg +++ b/dolphin/src/settings/dolphin_generalsettings.kcfg @@ -8,6 +8,7 @@ QUrl kglobalsettings.h + @@ -92,5 +93,10 @@ true + + + true + + diff --git a/dolphin/src/settings/general/behaviorsettingspage.cpp b/dolphi= n/src/settings/general/behaviorsettingspage.cpp index 83515be..093a1f4 100644 --- a/dolphin/src/settings/general/behaviorsettingspage.cpp +++ b/dolphin/src/settings/general/behaviorsettingspage.cpp @@ -97,6 +97,7 @@ void BehaviorSettingsPage::applySettings() = settings->setShowToolTips(m_showToolTips->isChecked()); settings->setShowSelectionToggle(m_showSelectionToggle->isChecked()); + settings->setNaturalSorting(m_naturalSorting->isChecked()); settings->setRenameInline(m_renameInline->isChecked()); settings->save(); = @@ -108,13 +109,6 @@ void BehaviorSettingsPage::applySettings() ViewProperties globalProps(m_url); globalProps.setDirProperties(props); } - - const bool naturalSorting =3D m_naturalSorting->isChecked(); - if (KGlobalSettings::naturalSorting() !=3D naturalSorting) { - KConfigGroup group(KSharedConfig::openConfig(), "KDE"); - group.writeEntry("NaturalSorting", naturalSorting, KConfig::Persis= tent | KConfig::Global); - KGlobalSettings::emitChange(KGlobalSettings::NaturalSortingChanged= ); - } } = void BehaviorSettingsPage::restoreDefaults() @@ -133,7 +127,7 @@ void BehaviorSettingsPage::loadSettings() = m_showToolTips->setChecked(GeneralSettings::showToolTips()); m_showSelectionToggle->setChecked(GeneralSettings::showSelectionToggle= ()); - m_naturalSorting->setChecked(KGlobalSettings::naturalSorting()); + m_naturalSorting->setChecked(GeneralSettings::naturalSorting()); m_renameInline->setChecked(GeneralSettings::renameInline()); } = diff --git a/dolphin/src/tests/CMakeLists.txt b/dolphin/src/tests/CMakeList= s.txt index a69400b..fe9665d 100644 --- a/dolphin/src/tests/CMakeLists.txt +++ b/dolphin/src/tests/CMakeLists.txt @@ -58,6 +58,10 @@ set(kitemlistcontrollertest_SRCS ../kitemviews/kstandarditemlistwidget.cpp ) = +kconfig_add_kcfg_files(kitemlistcontrollertest_SRCS GENERATE_MOC + ../settings/dolphin_generalsettings.kcfgc +) + add_executable(kitemlistcontrollertest ${kitemlistcontrollertest_SRCS}) add_test(kitemlistcontrollertest kitemlistcontrollertest) ecm_mark_as_test(kitemlistcontrollertest) @@ -79,6 +83,10 @@ set(kfileitemlistviewtest_SRCS ../kitemviews/kstandarditemlistwidget.cpp ) = +kconfig_add_kcfg_files(kfileitemlistviewtest_SRCS GENERATE_MOC + ../settings/dolphin_generalsettings.kcfgc +) + add_executable(kfileitemlistviewtest ${kfileitemlistviewtest_SRCS}) add_test(kfileitemlistviewtest kfileitemlistviewtest) ecm_mark_as_test(kfileitemlistviewtest) @@ -93,6 +101,10 @@ set(kfileitemmodeltest_SRCS ../kitemviews/kitemset.cpp ) = +kconfig_add_kcfg_files(kfileitemmodeltest_SRCS GENERATE_MOC + ../settings/dolphin_generalsettings.kcfgc +) + add_executable(kfileitemmodeltest ${kfileitemmodeltest_SRCS}) add_test(kfileitemmodeltest kfileitemmodeltest) ecm_mark_as_test(kfileitemmodeltest) @@ -106,6 +118,10 @@ set(kfileitemmodelbenchmark_SRCS ../kitemviews/kitemmodelbase.cpp ) = +kconfig_add_kcfg_files(kfileitemmodelbenchmark_SRCS GENERATE_MOC + ../settings/dolphin_generalsettings.kcfgc +) + add_executable(kfileitemmodelbenchmark ${kfileitemmodelbenchmark_SRCS}) ecm_mark_as_test(kfileitemmodelbenchmark) target_link_libraries(kfileitemmodelbenchmark dolphinprivate Qt5::Test) @@ -157,7 +173,7 @@ set(viewpropertiestest_SRCS testdir.cpp ../views/viewproperties.cpp ) -kconfig_add_kcfg_files(viewpropertiestest_SRCS +kconfig_add_kcfg_files(viewpropertiestest_SRCS GENERATE_MOC ../settings/dolphin_generalsettings.kcfgc ../settings/dolphin_directoryviewpropertysettings.kcfgc )