Bug 147799

Summary: Burning dialog does not honour the "ButtonLayout" setting
Product: [Applications] k3b Reporter: Francois Marier <francois>
Component: generalAssignee: Sebastian Trueg <trueg>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Francois Marier 2007-07-11 23:00:52 UTC
Version:           1.0.2 (using KDE KDE 3.5.7)
Installed from:    Debian testing/unstable Packages
OS:                Linux

Mathias Brodala <info@noctus.net> reported the following cosmetic bug on the Debian tracker (http://bugs.debian.org/432760):

When "ButtonLayout" is set to 1 in ~/.kde/share/config/kdeglobals, the
order of dialog buttons should be GTK like.

However, the burning dialog of K3B does not respect this setting and just
shows "Burn", "Close" and "Cancel" where it should be "Close", "Cancel"
and "Burn" instead.
Comment 1 Sebastian Trueg 2007-07-20 14:17:10 UTC
I would love to fix this. All I need is a definition of this standard. Which 
number corresponds to what layout?
Comment 2 Francois Marier 2007-07-20 16:07:58 UTC
Mathias responded with the following comment:

There seems to exist no documentation on this setting, but this is what I found
out by trial and error:

  0 = OK, Apply, Cancel // KDE default layout
  1 = Cancel, Apply, OK
  2 = Apply, Cancel, OK // GTK default layout
  3 = OK, Apply, Cancel (aligned to the left of the window)
  4 = OK, Cancel, Apply (aligned to the left of the window)
>=5 = 0
Comment 3 Sebastian Trueg 2007-07-20 16:23:44 UTC
SVN commit 690257 by trueg:

Honor the ButtonLayout setting in the interaction dialogs. Button layout codes
provided by Francois Marier.

BUG: 147799


 M  +33 -3     k3binteractiondialog.cpp  


--- branches/extragear/kde3/multimedia/k3b/src/k3binteractiondialog.cpp #690256:690257
@@ -45,6 +45,7 @@
 #include <kpushbutton.h>
 #include <kconfig.h>
 #include <kiconloader.h>
+#include <kglobalsettings.h>
 
 
 K3bInteractionDialog::K3bInteractionDialog( QWidget* parent,
@@ -116,14 +117,12 @@
     QFont fnt( m_buttonStart->font() );
     fnt.setBold(true);
     m_buttonStart->setFont( fnt );
-    layout5->addWidget( m_buttonStart );
   }
   else
     m_buttonStart = 0;
 
   if( buttonMask & SAVE_BUTTON ) {
     m_buttonSave = new KPushButton( KStdGuiItem::save(), this, "m_buttonSave" );
-    layout5->addWidget( m_buttonSave );
   }
   else
     m_buttonSave = 0;
@@ -135,11 +134,42 @@
 				      : KStdGuiItem::cancel(),
 				      this,
 				      "m_buttonCancel" );
-    layout5->addWidget( m_buttonCancel );
   }
   else
     m_buttonCancel = 0;
 
+  // we only handle some of the possible settings since
+  // our buttons are always to the right of the dialog
+  switch( KGlobalSettings::buttonLayout() ) {
+  case 0: // KDE default
+  default:
+      if ( m_buttonStart )
+          layout5->addWidget( m_buttonStart );
+      if ( m_buttonSave )
+          layout5->addWidget( m_buttonSave );
+      if ( m_buttonCancel )
+          layout5->addWidget( m_buttonCancel );
+      break;
+
+  case 1: // something different
+      if ( m_buttonCancel )
+          layout5->addWidget( m_buttonCancel );
+      if ( m_buttonSave )
+          layout5->addWidget( m_buttonSave );
+      if ( m_buttonStart )
+          layout5->addWidget( m_buttonStart );
+      break;
+
+  case 2: // GTK-Style
+      if ( m_buttonSave )
+          layout5->addWidget( m_buttonSave );
+      if ( m_buttonCancel )
+          layout5->addWidget( m_buttonCancel );
+      if ( m_buttonStart )
+          layout5->addWidget( m_buttonStart );
+      break;
+  }
+
   mainGrid->addLayout( layout5, 2, 2 );
 
   mainGrid->setRowStretch( 1, 1 );