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

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/widgets
From:       Germain Garand <germain () ebooksfrance ! org>
Date:       2008-01-03 17:23:47
Message-ID: 1199381027.846455.24916.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 756739 by ggarand:

fix the "Lock/Unlock Toolbars" feature so that its state
is remembered accross application restart.

also fix a bug in KToolBar where the Lock/Unlock toggling in the toolbar
contextual menu would go out of sync from one toolbar to the other.

BUG:152263


 M  +15 -0     kmainwindow.cpp  
 M  +7 -6      ktoolbar.cpp  


--- trunk/KDE/kdelibs/kdeui/widgets/kmainwindow.cpp #756738:756739
@@ -589,6 +589,13 @@
     cg.writeEntry("State", state.toBase64());
     // One day will need to save the version number, but for now, assume 0
 
+    if ( !autoSaveSettings() || configGroup == autoSaveGroup() ) {
+        if(!cg.hasDefault("ToolBarsMovable") && !KToolBar::toolBarsLocked())
+            cg.revertToDefault("ToolBarsMovable");
+        else
+            cg.writeEntry("ToolBarsMovable", KToolBar::toolBarsLocked() ? "Disabled" \
: "Enabled");     +    }
+
     int n = 1; // Toolbar counter. toolbars are counted from 1,
     foreach (KToolBar* toolbar, toolBars()) {
         QString group;
@@ -673,6 +680,14 @@
 
     QString configGroup = cg.name();
 
+    if ( !autoSaveSettings() || configGroup == autoSaveGroup() ) {
+        QString entry = cg.readEntry ("ToolBarsMovable", "Enabled");
+        if ( entry == "Disabled" )
+            KToolBar::setToolBarsLocked(true);
+        else
+            KToolBar::setToolBarsLocked(false);
+    }
+
     int n = 1; // Toolbar counter. toolbars are counted from 1,
     foreach (KToolBar* toolbar, toolBars()) {
         QString group;
--- trunk/KDE/kdelibs/kdeui/widgets/ktoolbar.cpp #756738:756739
@@ -194,6 +194,8 @@
 
   if ( !KAuthorized::authorize( "movable_toolbars" ) )
     parent->setMovable( false );
+  else
+    parent->setMovable( !KToolBar::toolBarsLocked() );
 
   connect( parent, SIGNAL( movableChanged( bool ) ),
            parent, SLOT( slotMovableChanged( bool ) ) );
@@ -609,11 +611,6 @@
 void KToolBar::Private::slotLockToolBars( bool lock )
 {
   parent->setToolBarsLocked( lock );
-
-  if(lock)
-    contextLockAction->setText(i18n( "Unlock Toolbars" ));
-  else
-    contextLockAction->setText(i18n( "Lock Toolbars" ));
 }
 
 
@@ -1367,8 +1364,12 @@
     KToolBar::Private::s_locked = locked;
 
     foreach ( KMainWindow* mw, KMainWindow::memberList() )
-      foreach ( KToolBar* toolbar, mw->findChildren<KToolBar*>() )
+      foreach ( KToolBar* toolbar, mw->findChildren<KToolBar*>() ) {
         toolbar->d->setLocked( locked );
+        if (toolbar->d->contextLockAction)
+            toolbar->d->contextLockAction->setText(locked ? i18n( "Unlock Toolbars" \
) : i18n( "Lock Toolbars" )); +      }
+
   }
 }
 


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

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