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

List:       kde-commits
Subject:    branches/KDE/3.3/kdepim/certmanager
From:       Till Adam <adam () kde ! org>
Date:       2005-06-30 20:29:42
Message-ID: 1120163382.441403.17813.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 430304 by tilladam:

Save and restore the "hierarchical view" switch to the kleopatrarc.


 M  +18 -6     certmanager.cpp  
 M  +2 -0      certmanager.h  


--- branches/KDE/3.3/kdepim/certmanager/certmanager.cpp #430303:430304
@@ -97,8 +97,6 @@
 #include <algorithm>
 #include <assert.h>
 
-static const bool startWithHierarchicalKeyListing = false;
-
 namespace {
 
   class DisplayStrategy : public Kleo::KeyListView::DisplayStrategy{
@@ -184,8 +182,6 @@
 
   // Main Window --------------------------------------------------
   mKeyListView = new CertKeyListView( new ColumnStrategy(), new DisplayStrategy(), \
                this, "mKeyListView" );
-  mKeyListView->setHierarchical( startWithHierarchicalKeyListing );
-  mKeyListView->setRootIsDecorated( startWithHierarchicalKeyListing );
   mKeyListView->setSelectionMode( QListView::Extended );
   setCentralWidget( mKeyListView );
 
@@ -208,15 +204,29 @@
   if ( !import.isEmpty() )
     slotImportCertFromFile( KURL( import ) );
 
+  readConfig();
   updateStatusBarLabels();
   slotSelectionChanged(); // initial state for selection-dependent actions
 }
 
 CertManager::~CertManager() {
+  writeConfig();
   delete mDirmngrProc; mDirmngrProc = 0;
   delete mHierarchyAnalyser; mHierarchyAnalyser = 0;
 }
 
+void CertManager::readConfig() {
+  KConfig config( "kleopatrarc" );
+  config.setGroup( "Display Options" );
+  slotToggleHierarchicalView( config.readBoolEntry( "hierarchicalView", false ) );
+}
+
+void CertManager::writeConfig() {
+  KConfig config( "kleopatrarc" );
+  config.setGroup( "Display Options" );
+  config.writeEntry( "hierarchicalView", mKeyListView->hierarchical() );
+}
+
 void CertManager::createStatusBar() {
   KStatusBar * bar = statusBar();
   mProgressBar = new Kleo::ProgressBar( bar, "mProgressBar" );
@@ -262,11 +272,9 @@
   action = new KAction( i18n("Expand All"), 0, CTRL+Key_Period,
 			this, SLOT(slotExpandAll()),
 			actionCollection(), "view_expandall" );
-  action->setEnabled( startWithHierarchicalKeyListing );
   action = new KAction( i18n("Collapse All"), 0, CTRL+Key_Comma,
 			this, SLOT(slotCollapseAll()),
 			actionCollection(), "view_collapseall" );
-  action->setEnabled( startWithHierarchicalKeyListing );
 
   (void)   new KAction( i18n("Refresh CRLs"), 0, 0,
 			this, SLOT(slotRefreshKeys()),
@@ -412,6 +420,10 @@
     act->setEnabled( hier );
   if ( KAction * act = action("view_collapseall" ) )
     act->setEnabled( hier );
+  if ( KToggleAction * act = 
+      static_cast<KToggleAction*>( action("view_hierarchical") ) )
+    act->setChecked( hier );
+
   if ( hier && !mCurrentQuery.isEmpty() )
     startRedisplay( false );
 }
--- branches/KDE/3.3/kdepim/certmanager/certmanager.h #430303:430304
@@ -172,6 +172,8 @@
     void importNextURLOrRedisplay();
     void startRedisplay( bool validating );
     QString displayNameForJob( const Kleo::Job *job );
+    void readConfig();
+    void writeConfig();
 
 private:
     Kleo::KeyListView * mKeyListView;


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

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