[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/messagelist
From:       Thomas McGuire <mcguire () kde ! org>
Date:       2009-09-18 13:05:25
Message-ID: 1253279125.522611.27923.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1025339 by tmcguire:

Don't hardcode the config to KGlobal::config(), instead provide a ConfigProvider \
class to get and set the config.

This is needed so KMail can use the same config when running standalone or in \
Kontact.


 M  +1 -0      CMakeLists.txt  
 A             core/configprovider.cpp   [License: GPL (v2/3)]
 A             core/configprovider.h   [License: GPL (v2/3)]
 M  +22 -16    core/manager.cpp  
 M  +2 -1      utils/aggregationcombobox.cpp  
 M  +3 -1      utils/themecombobox.cpp  


--- trunk/KDE/kdepim/messagelist/CMakeLists.txt #1025338:1025339
@@ -9,6 +9,7 @@
 
 set(libmessagelist_SRCS
     core/aggregation.cpp
+    core/configprovider.cpp
     core/delegate.cpp
     core/filter.cpp
     core/item.cpp
--- trunk/KDE/kdepim/messagelist/core/manager.cpp #1025338:1025339
@@ -28,6 +28,7 @@
 #include "core/model.h"
 #include "core/model_p.h"
 #include "core/settings.h"
+#include "core/configprovider.h"
 
 #include "utils/configureaggregationsdialog.h"
 #include "utils/configureaggregationsdialog_p.h"
@@ -166,7 +167,8 @@
 
 unsigned long Manager::preSelectedMessageForStorageModel( const StorageModel \
*storageModel )  {
-  KConfigGroup conf( KGlobal::config(), \
"MessageListView::StorageModelSelectedMessages" ); +  KConfigGroup conf( \
ConfigProvider::self()->config(), +                     \
"MessageListView::StorageModelSelectedMessages" );  
   // QVariant supports unsigned int OR unsigned long long int, NOT unsigned long \
int... doh...  qulonglong defValue = 0;
@@ -176,7 +178,8 @@
 
 void Manager::savePreSelectedMessageForStorageModel( const StorageModel * \
storageModel, unsigned long uniqueIdOfMessage )  {
-  KConfigGroup conf( KGlobal::config(), \
"MessageListView::StorageModelSelectedMessages" ); +  KConfigGroup conf( \
ConfigProvider::self()->config(), +                     \
"MessageListView::StorageModelSelectedMessages" );  
 
   if ( uniqueIdOfMessage )
@@ -200,7 +203,8 @@
 
 const Aggregation * Manager::defaultAggregation()
 {
-  KConfigGroup conf( KGlobal::config(), "MessageListView::StorageModelAggregations" \
); +  KConfigGroup conf( ConfigProvider::self()->config(),
+                     "MessageListView::StorageModelAggregations" );
 
   QString aggregationId = conf.readEntry( QString( "DefaultSet" ), "" );
 
@@ -226,7 +230,8 @@
 
 void Manager::saveAggregationForStorageModel( const StorageModel *storageModel, \
const QString &id, bool storageUsesPrivateAggregation )  {
-  KConfigGroup conf( KGlobal::config(), "MessageListView::StorageModelAggregations" \
); +  KConfigGroup conf( ConfigProvider::self()->config(),
+                     "MessageListView::StorageModelAggregations" );
 
   if ( storageUsesPrivateAggregation )
     conf.writeEntry( QString( "SetForStorageModel%1" ).arg( storageModel->id() ), id \
); @@ -247,7 +252,8 @@
   if ( !storageModel )
     return defaultAggregation();
 
-  KConfigGroup conf( KGlobal::config(), "MessageListView::StorageModelAggregations" \
); +  KConfigGroup conf( ConfigProvider::self()->config(),
+                     "MessageListView::StorageModelAggregations" );
 
   QString aggregationId = conf.readEntry( QString( "SetForStorageModel%1" ).arg( \
storageModel->id() ), "" );  
@@ -448,7 +454,7 @@
   if ( !storageModel )
     return SortOrder();
 
-  KConfigGroup conf( KGlobal::config(), "MessageListView::StorageModelSortOrder" );
+  KConfigGroup conf( ConfigProvider::self()->config(), \
"MessageListView::StorageModelSortOrder" );  SortOrder ret;
   ret.readConfig( conf, storageModel->id(), storageUsesPrivateSortOrder );
   return ret;
@@ -457,7 +463,7 @@
 void Manager::saveSortOrderForStorageModel( const StorageModel *storageModel,
                                             const SortOrder& order, bool \
storageUsesPrivateSortOrder )  {
-  KConfigGroup conf( KGlobal::config(), "MessageListView::StorageModelSortOrder" );
+  KConfigGroup conf( ConfigProvider::self()->config(), \
"MessageListView::StorageModelSortOrder" );  order.writeConfig( conf, \
storageModel->id(), storageUsesPrivateSortOrder );  }
 
@@ -472,7 +478,7 @@
 
 const Theme * Manager::defaultTheme()
 {
-  KConfigGroup conf( KGlobal::config(), "MessageListView::StorageModelThemes" );
+  KConfigGroup conf( ConfigProvider::self()->config(), \
"MessageListView::StorageModelThemes" );  
   QString themeId = conf.readEntry( QString( "DefaultSet" ), "" );
 
@@ -501,7 +507,7 @@
 
 void Manager::saveThemeForStorageModel( const StorageModel *storageModel, const \
QString &id, bool storageUsesPrivateTheme )  {
-  KConfigGroup conf( KGlobal::config(), "MessageListView::StorageModelThemes" );
+  KConfigGroup conf( ConfigProvider::self()->config(), \
"MessageListView::StorageModelThemes" );  
   if ( storageUsesPrivateTheme )
     conf.writeEntry( QString( "SetForStorageModel%1" ).arg( storageModel->id() ), id \
); @@ -522,7 +528,7 @@
   if ( !storageModel )
     return defaultTheme();
 
-  KConfigGroup conf( KGlobal::config(), "MessageListView::StorageModelThemes" );
+  KConfigGroup conf( ConfigProvider::self()->config(), \
"MessageListView::StorageModelThemes" );  QString themeId = conf.readEntry( QString( \
"SetForStorageModel%1" ).arg( storageModel->id() ), "" );  
   Theme * opt = 0;
@@ -859,7 +865,7 @@
 void Manager::loadGlobalConfiguration()
 {
   // Load the date format
-  KConfigGroup config( KGlobal::config(), "General" );
+  KConfigGroup config( ConfigProvider::self()->config(), "General" );
 
   KMime::DateFormatter::FormatType t = (KMime::DateFormatter::FormatType) \
config.readEntry(  "dateFormat",
@@ -878,7 +884,7 @@
   {
     // load Aggregations
 
-    KConfigGroup conf( KGlobal::config(), "MessageListView::Aggregations" );
+    KConfigGroup conf( ConfigProvider::self()->config(), \
"MessageListView::Aggregations" );  
     mAggregations.clear();
 
@@ -913,7 +919,7 @@
   {
     // load Themes
 
-    KConfigGroup conf( KGlobal::config(), "MessageListView::Themes" );
+    KConfigGroup conf( ConfigProvider::self()->config(), "MessageListView::Themes" \
);  
     mThemes.clear();
 
@@ -961,7 +967,7 @@
   {
     // store aggregations
 
-    KConfigGroup conf( KGlobal::config(), "MessageListView::Aggregations" );
+    KConfigGroup conf( ConfigProvider::self()->config(), \
"MessageListView::Aggregations" );  //conf.clear();
 
     conf.writeEntry( "Count", mAggregations.count() );
@@ -977,7 +983,7 @@
   {
     // store themes
 
-    KConfigGroup conf( KGlobal::config(), "MessageListView::Themes" );
+    KConfigGroup conf( ConfigProvider::self()->config(), "MessageListView::Themes" \
);  //conf.clear();
 
     conf.writeEntry( "Count", mThemes.count() );
@@ -990,6 +996,6 @@
     }
   }
 
-  KGlobal::config()->sync();
+  ConfigProvider::self()->config()->sync();
 }
 
--- trunk/KDE/kdepim/messagelist/utils/aggregationcombobox.cpp #1025338:1025339
@@ -22,6 +22,7 @@
 
 #include "messagelist/core/aggregation.h"
 #include "messagelist/core/manager.h"
+#include "messagelist/core/configprovider.h"
 
 #include <KDE/KGlobal>
 
@@ -46,7 +47,7 @@
 
 void AggregationComboBox::writeDefaultConfig() const
 {
-  KConfigGroup group( KGlobal::config(), "MessageListView::StorageModelAggregations" \
); +  KConfigGroup group( ConfigProvider::self()->config(), \
"MessageListView::StorageModelAggregations" );  
   const QString aggregationID = currentAggregation();
   group.writeEntry( QString( "DefaultSet" ), aggregationID );
--- trunk/KDE/kdepim/messagelist/utils/themecombobox.cpp #1025338:1025339
@@ -17,11 +17,13 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 #include "themecombobox.h"
+
 #include "messagelist/utils/themecombobox.h"
 #include "messagelist/utils/themecombobox_p.h"
 
 #include "messagelist/core/manager.h"
 #include "messagelist/core/theme.h"
+#include "messagelist/core/configprovider.h"
 
 #include <KDE/KGlobal>
 
@@ -46,7 +48,7 @@
 
 void ThemeComboBox::writeDefaultConfig() const
 {
-  KConfigGroup group( KGlobal::config(), "MessageListView::StorageModelThemes" );
+  KConfigGroup group( ConfigProvider::self()->config(), \
"MessageListView::StorageModelThemes" );  
   const QString themeID = currentTheme();
   group.writeEntry( QString( "DefaultSet" ), themeID );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic