Version: unspecified (using Devel) OS: Linux When changing the message list display format, the settings dont get saved when I leave the folder and enter it again it always shows the standard setting for the message list. Reproducible: Didn't try
You have to check the 'Save For Collection' checkbox in the messagelist config dialog to store the settings permanently for this collection. Can you verify that this works?
It does work the way described. Unfortunately this functionality does not work the way it is intended. This is a configuration option and should be instantly and durably active. The only thing that needs to be configured is wether this is a folder specific option or a general setting. In order to make this possible we would need to include a general setting into the KMail configuration dialogue and a rework this setting to "Use standard display options" - when disabeling this option the rest of the dialogue should get active.
This issue is still valid on both maemo and wince.
commit 3466ee29a8e98374cd23a9d242d9a4c9bee62ce2 branch master Author: Tobias Koenig <tokoe@kde.org> Date: Wed Jan 19 12:43:05 2011 +0100 Separate global from folder specific messagelist config The user can configure a global messagelist display format in the settings dialog now and overwrite it with a folder specific display format from the context actions menu. BUG: 258859 diff --git a/mobile/mail/configwidget.cpp b/mobile/mail/configwidget.cpp index a309843..ba7dc8e 100644 --- a/mobile/mail/configwidget.cpp +++ b/mobile/mail/configwidget.cpp @@ -20,6 +20,7 @@ #include "configwidget.h" #include "messagecomposer/messagecomposersettings.h" +#include "messagelistsettings.h" #include "messageviewer/globalsettings.h" #include "settings.h" #include "stylesheetloader.h" @@ -123,6 +124,15 @@ void ConfigWidget::loadFromExternalSettings() MessageViewer::GlobalSettings::self()->outlookCompatibleInvitationComparisons() ); Settings::self()->setInvitationsAutomaticSending( MessageViewer::GlobalSettings::self()->automaticSending() ); Settings::self()->setInvitationsDeleteAfterReply( MessageViewer::GlobalSettings::self()->deleteInvitationEmailsAfterSendingReply() ); + + // Message List + { + const MessageListSettings settings = MessageListSettings::fromDefaultConfig(); + Settings::self()->setMessageListSortingOption( settings.sortingOption() ); + Settings::self()->setMessageListSortingOrder( settings.sortingOrder() ); + Settings::self()->setMessageListGroupingOption( settings.groupingOption() ); + Settings::self()->setMessageListUseThreading( settings.useThreading() ); + } } void ConfigWidget::saveToExternalSettings() @@ -157,6 +167,18 @@ void ConfigWidget::saveToExternalSettings() MessageViewer::GlobalSettings::self()->setAutomaticSending( Settings::self()->invitationsAutomaticSending() ); MessageViewer::GlobalSettings::self()->setDeleteInvitationEmailsAfterSendingReply( Settings::self()->invitationsDeleteAfterReply() ); + // Message List + { + MessageListSettings settings = MessageListSettings::fromDefaultConfig(); + + settings.setSortingOption( static_cast<MessageListSettings::SortingOption>( Settings::self()->messageListSortingOption() ) ); + settings.setSortingOrder( static_cast<Qt::SortOrder>( Settings::self()->messageListSortingOrder() ) ); + settings.setGroupingOption( static_cast<MessageListSettings::GroupingOption>( Settings::self()->messageListGroupingOption() ) ); + settings.setUseThreading( Settings::self()->messageListUseThreading() ); + + MessageListSettings::toDefaultConfig( settings ); + } + Settings::self()->writeConfig(); MessageViewer::GlobalSettings::self()->writeConfig(); TemplateParser::GlobalSettings::self()->writeConfig(); diff --git a/mobile/mail/configwidget.ui b/mobile/mail/configwidget.ui index 0317bc0..144f976 100644 --- a/mobile/mail/configwidget.ui +++ b/mobile/mail/configwidget.ui @@ -6,11 +6,11 @@ <rect> <x>0</x> <y>0</y> - <width>334</width> - <height>1216</height> + <width>342</width> + <height>1363</height> </rect> </property> - <layout class="QVBoxLayout" name="verticalLayout_6"> + <layout class="QVBoxLayout" name="verticalLayout_7"> <item> <layout class="QGridLayout" name="gridLayout" rowstretch="0,0" columnstretch="0,1"> <item row="0" column="0" colspan="2"> @@ -247,13 +247,6 @@ </property> </widget> </item> - <item row="3" column="1"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Reply to Sender:</string> - </property> - </widget> - </item> <item row="4" column="1"> <widget class="KTextEdit" name="kcfg_ComposerTemplatesReplyToSender"> <property name="sizePolicy"> @@ -355,6 +348,13 @@ </item> </layout> </item> + <item row="3" column="1"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Reply to Sender:</string> + </property> + </widget> + </item> </layout> </item> <item row="3" column="1"> @@ -515,6 +515,146 @@ to them has been sent</string> </layout> </item> <item> + <layout class="QGridLayout" name="gridLayout_7" columnstretch="0,1"> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="label_13"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Message List</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <spacer name="horizontalSpacer_6"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="1"> + <widget class="QWidget" name="widget" native="true"> + <property name="enabled"> + <bool>true</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout_6"> + <property name="spacing"> + <number>0</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <layout class="QGridLayout" name="gridLayout_6" columnstretch="0,1,1"> + <item row="0" column="1"> + <widget class="QComboBox" name="kcfg_MessageListSortingOption"> + <item> + <property name="text"> + <string>By Date/Time</string> + </property> + </item> + <item> + <property name="text"> + <string>By Most Recent in Discussion</string> + </property> + </item> + <item> + <property name="text"> + <string>By Smart Sender/Receiver</string> + </property> + </item> + <item> + <property name="text"> + <string>By Subject</string> + </property> + </item> + <item> + <property name="text"> + <string>By Size</string> + </property> + </item> + <item> + <property name="text"> + <string>By Action Item Status</string> + </property> + </item> + </widget> + </item> + <item row="0" column="2"> + <widget class="QComboBox" name="kcfg_MessageListSortingOrder"> + <item> + <property name="text"> + <string>Ascending</string> + </property> + </item> + <item> + <property name="text"> + <string>Descending</string> + </property> + </item> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string>Grouping:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="kcfg_MessageListGroupingOption"> + <item> + <property name="text"> + <string>None</string> + </property> + </item> + <item> + <property name="text"> + <string>By Starting Date of Discussion</string> + </property> + </item> + <item> + <property name="text"> + <string>By Smart Sender/Receiver</string> + </property> + </item> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>Sorting:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QCheckBox" name="kcfg_MessageListUseThreading"> + <property name="text"> + <string>Show threads</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> diff --git a/mobile/mail/mainview.cpp b/mobile/mail/mainview.cpp index e01c6fa..68fc3cb 100644 --- a/mobile/mail/mainview.cpp +++ b/mobile/mail/mainview.cpp @@ -1675,6 +1675,18 @@ void MainView::updateConfig() item->viewer()->writeConfig(); item->viewer()->readConfig(); // let CSS parser reread its config } + + if ( !regularSelectionModel() ) + return; + + const QModelIndexList indexes = regularSelectionModel()->selectedIndexes(); + if ( indexes.isEmpty() ) + return; + + const QModelIndex index = indexes.first(); + const Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value<Akonadi::Collection>(); + if ( collection.isValid() && mMessageListSettingsController ) + mMessageListSettingsController->setCollection( collection ); } void MainView::applyFilters() diff --git a/mobile/mail/messagelistsettings.cpp b/mobile/mail/messagelistsettings.cpp index 4b68a5e..5611257 100644 --- a/mobile/mail/messagelistsettings.cpp +++ b/mobile/mail/messagelistsettings.cpp @@ -30,7 +30,7 @@ MessageListSettings::MessageListSettings() mSortDescending( false ), mGroupingOption( GroupByDate ), mUseThreading( true ), - mSaveForCollection( false ) + mUseGlobalSettings( true ) { } @@ -78,14 +78,14 @@ bool MessageListSettings::useThreading() const return mUseThreading; } -void MessageListSettings::setSaveForCollection( bool save ) +void MessageListSettings::setUseGlobalSettings( bool value ) { - mSaveForCollection = save; + mUseGlobalSettings = value; } -bool MessageListSettings::saveForCollection() const +bool MessageListSettings::useGlobalSettings() const { - return mSaveForCollection; + return mUseGlobalSettings; } MessageListSettings MessageListSettings::fromConfig( qint64 collectionId ) @@ -93,15 +93,24 @@ MessageListSettings MessageListSettings::fromConfig( qint64 collectionId ) const QString groupName = QString::fromLatin1( "MessageListSettings-%1" ).arg( collectionId ); MessageListSettings settings; - if ( KGlobal::config()->hasGroup( groupName ) ) - settings.mSaveForCollection = true; - const KConfigGroup group( KGlobal::config(), groupName ); - - settings.mSortingOption = static_cast<SortingOption>( group.readEntry<int>( "SortingOption", SortByDateTimeMostRecent ) ); - settings.mSortDescending = group.readEntry<bool>( "SortDescending", false ); - settings.mGroupingOption = static_cast<GroupingOption>( group.readEntry<int>( "GroupingOption", GroupByDate ) ); - settings.mUseThreading = group.readEntry<bool>( "UseThreading", true ); + if ( KGlobal::config()->hasGroup( groupName ) ) { // use collection specific settings + const KConfigGroup group( KGlobal::config(), groupName ); + + settings.mSortingOption = static_cast<SortingOption>( group.readEntry<int>( "SortingOption", SortByDateTimeMostRecent ) ); + settings.mSortDescending = group.readEntry<bool>( "SortDescending", false ); + settings.mGroupingOption = static_cast<GroupingOption>( group.readEntry<int>( "GroupingOption", GroupByDate ) ); + settings.mUseThreading = group.readEntry<bool>( "UseThreading", true ); + settings.mUseGlobalSettings = false; + } else { // use default settings + const KConfigGroup group( KGlobal::config(), QLatin1String( "MessageListSettings-default" ) ); + + settings.mSortingOption = static_cast<SortingOption>( group.readEntry<int>( "SortingOption", SortByDateTimeMostRecent ) ); + settings.mSortDescending = group.readEntry<bool>( "SortDescending", false ); + settings.mGroupingOption = static_cast<GroupingOption>( group.readEntry<int>( "GroupingOption", GroupByDate ) ); + settings.mUseThreading = group.readEntry<bool>( "UseThreading", true ); + settings.mUseGlobalSettings = true; + } return settings; } @@ -110,7 +119,7 @@ void MessageListSettings::toConfig( qint64 collectionId, const MessageListSettin { const QString groupName = QString::fromLatin1( "MessageListSettings-%1" ).arg( collectionId ); - if ( !settings.saveForCollection() ) { + if ( settings.useGlobalSettings() ) { KGlobal::config()->deleteGroup( groupName ); } else { KConfigGroup group( KGlobal::config(), groupName ); @@ -123,3 +132,31 @@ void MessageListSettings::toConfig( qint64 collectionId, const MessageListSettin KGlobal::config()->sync(); } + +MessageListSettings MessageListSettings::fromDefaultConfig() +{ + const KConfigGroup group( KGlobal::config(), QLatin1String( "MessageListSettings-default" ) ); + + MessageListSettings settings; + settings.mSortingOption = static_cast<SortingOption>( group.readEntry<int>( "SortingOption", SortByDateTimeMostRecent ) ); + settings.mSortDescending = group.readEntry<bool>( "SortDescending", false ); + settings.mGroupingOption = static_cast<GroupingOption>( group.readEntry<int>( "GroupingOption", GroupByDate ) ); + settings.mUseThreading = group.readEntry<bool>( "UseThreading", true ); + settings.mUseGlobalSettings = true; + + return settings; +} + +void MessageListSettings::toDefaultConfig( const MessageListSettings &settings ) +{ + const QLatin1String groupName( "MessageListSettings-default" ); + + KConfigGroup group( KGlobal::config(), groupName ); + + group.writeEntry( "SortingOption", static_cast<int>( settings.mSortingOption ) ); + group.writeEntry( "SortDescending", settings.mSortDescending ); + group.writeEntry( "GroupingOption", static_cast<int>( settings.mGroupingOption ) ); + group.writeEntry( "UseThreading", settings.mUseThreading ); + + KGlobal::config()->sync(); +} diff --git a/mobile/mail/messagelistsettings.h b/mobile/mail/messagelistsettings.h index 0165f43..5955fb7 100644 --- a/mobile/mail/messagelistsettings.h +++ b/mobile/mail/messagelistsettings.h @@ -59,18 +59,21 @@ class MessageListSettings void setUseThreading( bool threading ); bool useThreading() const; - void setSaveForCollection( bool save ); - bool saveForCollection() const; + void setUseGlobalSettings( bool value ); + bool useGlobalSettings() const; static MessageListSettings fromConfig( qint64 collectionId ); static void toConfig( qint64 collectionId, const MessageListSettings &settings ); + static MessageListSettings fromDefaultConfig(); + static void toDefaultConfig( const MessageListSettings &settings ); + private: SortingOption mSortingOption; bool mSortDescending; GroupingOption mGroupingOption; bool mUseThreading; - bool mSaveForCollection; + bool mUseGlobalSettings; }; #endif diff --git a/mobile/mail/messagelistsettingscontroller.cpp b/mobile/mail/messagelistsettingscontroller.cpp index b135e85..291a0ba 100644 --- a/mobile/mail/messagelistsettingscontroller.cpp +++ b/mobile/mail/messagelistsettingscontroller.cpp @@ -85,7 +85,7 @@ void MessageListSettingsController::editSettings() ui.mSortingOrder->setCurrentIndex( mSettings.sortingOrder() == Qt::AscendingOrder ? 0 : 1 ); ui.mGroupingOption->setCurrentIndex( static_cast<int>( mSettings.groupingOption() ) ); ui.mUseThreading->setChecked( mSettings.useThreading() ); - ui.mSaveForCollection->setChecked( mSettings.saveForCollection() ); + ui.mUseGlobalSettings->setChecked( mSettings.useGlobalSettings() ); if ( !dialog.exec() ) return; @@ -94,7 +94,7 @@ void MessageListSettingsController::editSettings() mSettings.setSortingOrder( ui.mSortingOrder->currentIndex() == 0 ? Qt::AscendingOrder : Qt::DescendingOrder ); mSettings.setGroupingOption( static_cast<MessageListSettings::GroupingOption>( ui.mGroupingOption->currentIndex() ) ); mSettings.setUseThreading( ui.mUseThreading->isChecked() ); - mSettings.setSaveForCollection( ui.mSaveForCollection->isChecked() ); + mSettings.setUseGlobalSettings( ui.mUseGlobalSettings->isChecked() ); MessageListSettings::toConfig( mCollectionId, mSettings ); diff --git a/mobile/mail/messagelistsettingseditor.ui b/mobile/mail/messagelistsettingseditor.ui index 11a6a69..66fb498 100644 --- a/mobile/mail/messagelistsettingseditor.ui +++ b/mobile/mail/messagelistsettingseditor.ui @@ -6,107 +6,152 @@ <rect> <x>0</x> <y>0</y> - <width>413</width> - <height>161</height> + <width>450</width> + <height>159</height> </rect> </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QCheckBox" name="mUseGlobalSettings"> <property name="text"> - <string>Sorting:</string> + <string>Folder uses default settings</string> </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="mSortingOption"> - <item> - <property name="text"> - <string>By Date/Time</string> - </property> - </item> - <item> - <property name="text"> - <string>By Most Recent in Discussion</string> - </property> - </item> - <item> - <property name="text"> - <string>By Smart Sender/Receiver</string> - </property> - </item> - <item> - <property name="text"> - <string>By Subject</string> - </property> - </item> - <item> - <property name="text"> - <string>By Size</string> - </property> - </item> - <item> - <property name="text"> - <string>By Action Item Status</string> - </property> - </item> - </widget> - </item> - <item row="0" column="2"> - <widget class="QComboBox" name="mSortingOrder"> - <item> - <property name="text"> - <string>Ascending</string> - </property> - </item> - <item> - <property name="text"> - <string>Descending</string> - </property> - </item> - </widget> - </item> - <item row="1" column="1" colspan="2"> - <widget class="QCheckBox" name="mSaveForCollection"> - <property name="text"> - <string>Folder always uses this sort order</string> + <property name="checked"> + <bool>true</bool> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Grouping:</string> - </property> - </widget> - </item> - <item row="2" column="1" colspan="2"> - <widget class="QComboBox" name="mGroupingOption"> - <item> - <property name="text"> - <string>None</string> - </property> - </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <property name="text"> - <string>By Starting Date of Discussion</string> - </property> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> </item> <item> - <property name="text"> - <string>By Smart Sender/Receiver</string> - </property> + <widget class="QWidget" name="widget" native="true"> + <property name="enabled"> + <bool>false</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Sorting:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="mSortingOption"> + <item> + <property name="text"> + <string>By Date/Time</string> + </property> + </item> + <item> + <property name="text"> + <string>By Most Recent in Discussion</string> + </property> + </item> + <item> + <property name="text"> + <string>By Smart Sender/Receiver</string> + </property> + </item> + <item> + <property name="text"> + <string>By Subject</string> + </property> + </item> + <item> + <property name="text"> + <string>By Size</string> + </property> + </item> + <item> + <property name="text"> + <string>By Action Item Status</string> + </property> + </item> + </widget> + </item> + <item row="0" column="2"> + <widget class="QComboBox" name="mSortingOrder"> + <item> + <property name="text"> + <string>Ascending</string> + </property> + </item> + <item> + <property name="text"> + <string>Descending</string> + </property> + </item> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Grouping:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="mGroupingOption"> + <item> + <property name="text"> + <string>None</string> + </property> + </item> + <item> + <property name="text"> + <string>By Starting Date of Discussion</string> + </property> + </item> + <item> + <property name="text"> + <string>By Smart Sender/Receiver</string> + </property> + </item> + </widget> + </item> + <item row="2" column="1"> + <widget class="QCheckBox" name="mUseThreading"> + <property name="text"> + <string>Show threads</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> </item> - </widget> - </item> - <item row="3" column="1" colspan="2"> - <widget class="QCheckBox" name="mUseThreading"> - <property name="text"> - <string>Show threads</string> - </property> - </widget> + </layout> </item> - <item row="4" column="1"> + <item> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -122,5 +167,22 @@ </layout> </widget> <resources/> - <connections/> + <connections> + <connection> + <sender>mUseGlobalSettings</sender> + <signal>toggled(bool)</signal> + <receiver>widget</receiver> + <slot>setDisabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>48</x> + <y>10</y> + </hint> + <hint type="destinationlabel"> + <x>98</x> + <y>69</y> + </hint> + </hints> + </connection> + </connections> </ui> diff --git a/mobile/mail/settings.kcfg.cmake b/mobile/mail/settings.kcfg.cmake index db4c1c2..1e695cd 100644 --- a/mobile/mail/settings.kcfg.cmake +++ b/mobile/mail/settings.kcfg.cmake @@ -62,4 +62,36 @@ <default>red</default> </entry> </group> + + <group name="MessageList"> + <entry name="MessageListSortingOption" type="Enum"> + <choices> + <choice name="SortByDateTime" /> + <choice name="SortByDateTimeMostRecent" /> + <choice name="SortBySenderReceiver" /> + <choice name="SortBySubject" /> + <choice name="SortBySize" /> + <choice name="SortByActionItem" /> + </choices> + <default>SortByDateTimeMostRecent</default> + </entry> + <entry name="MessageListSortingOrder" type="Enum"> + <choices> + <choice name="Ascending" /> + <choice name="Descending" /> + </choices> + <default>Ascending</default> + </entry> + <entry name="MessageListGroupingOption" type="Enum"> + <choices> + <choice name="GroupByNone" /> + <choice name="GroupByDate" /> + <choice name="GroupBySenderReceiver" /> + </choices> + <default>GroupByDate</default> + </entry> + <entry name="MessageListUseThreading" type="Bool"> + <default>true</default> + </entry> + </group> </kcfg>