[kde-doc-english] KDE/kdeutils/kcalc

David Johnson david at usermode.org
Sun Aug 31 21:39:21 CEST 2008


SVN commit 855439 by brandybuck:

GUI: separate menu item to show/hide bitset edit widget


 M  +20 -4     kcalc.cpp  
 M  +3 -0      kcalc.h  
 M  +4 -0      kcalc.kcfg  
 M  +1 -1      kcalc_settings.kcfgc  
 M  +1 -0      kcalcui.rc  


--- trunk/KDE/kdeutils/kcalc/kcalc.cpp #855438:855439
@@ -142,7 +142,7 @@
 
 	updateDisplay(true);
 
-	// Read and set button groups
+	// misc settings
 
 	actionStatshow->setChecked(KCalcSettings::showStat());
 	slotStatshow(KCalcSettings::showStat());
@@ -156,6 +156,9 @@
 	actionConstantsShow->setChecked(KCalcSettings::showConstants());
 	slotConstantsShow(KCalcSettings::showConstants());
 
+	actionBitsetshow->setChecked(KCalcSettings::showBitset());
+	slotBitsetshow(KCalcSettings::showBitset());
+
 	// connections
 
 	connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
@@ -212,6 +215,12 @@
 	hideAct->setText(i18n("&Hide All"));
 	connect(hideAct, SIGNAL(triggered()), this, SLOT(slotHideAll()));
 
+	actionBitsetshow = actionCollection()->add<KToggleAction>( "show_bitset" );
+	actionBitsetshow->setText( i18n("Show B&it Edit") );
+	actionBitsetshow->setChecked(true);
+	connect(actionBitsetshow, SIGNAL(toggled(bool)),
+			SLOT(slotBitsetshow(bool)));
+
 	KStandardAction::preferences(this, SLOT(showSettings()), actionCollection());
 	KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()),
 actionCollection());
@@ -1560,7 +1569,6 @@
   constants->kcfg_nameConstant5->setText(chosen_const.label);
 }
 
-
 void KCalculator::slotStatshow(bool toggled)
 {
 	if(toggled)
@@ -1612,7 +1620,7 @@
 {
 	if(toggled)
 	{
-		mBitset->show();
+		mBitset->setEnabled(true);
 		connect(mBitset, SIGNAL(valueChanged(unsigned long long)),
 			this, SLOT(slotBitsetChanged(unsigned long long)));
 		connect(calc_display, SIGNAL(changedAmount(const KNumber &)),
@@ -1632,7 +1640,7 @@
 	}
 	else
 	{
-		mBitset->hide();
+		mBitset->setEnabled(false);
 		disconnect(mBitset, SIGNAL(valueChanged(unsigned long long)),
 			this, SLOT(slotBitsetChanged(unsigned long long)));
 		disconnect(calc_display, SIGNAL(changedAmount(const KNumber &)),
@@ -1671,6 +1679,12 @@
 	KCalcSettings::setShowConstants(toggled);
 }
 
+void KCalculator::slotBitsetshow(bool toggled)
+{
+    mBitset->setVisible(toggled);
+    KCalcSettings::setShowBitset(toggled);
+}
+
 // This function is for setting the constant names configured in the
 // kcalc settings menu. If the user doesn't enter a name for the
 // constant C1 to C6 is used.
@@ -1690,6 +1704,7 @@
 	if(!actionScientificshow->isChecked()) actionScientificshow->trigger();
 	if(!actionLogicshow->isChecked()) actionLogicshow->trigger();
 	if(!actionConstantsShow->isChecked()) actionConstantsShow->trigger();
+	if(!actionBitsetshow->isChecked()) actionBitsetshow->trigger();
 }
 
 void KCalculator::slotHideAll(void)
@@ -1699,6 +1714,7 @@
 	if(actionScientificshow->isChecked()) actionScientificshow->trigger();
 	if(actionLogicshow->isChecked()) actionLogicshow->trigger();
 	if(actionConstantsShow->isChecked()) actionConstantsShow->trigger();
+	if(actionBitsetshow->isChecked()) actionBitsetshow->trigger();
 }
 
 void KCalculator::slotBitsetChanged(unsigned long long value) {
--- trunk/KDE/kdeutils/kcalc/kcalc.h #855438:855439
@@ -123,6 +123,7 @@
     void slotScientificshow(bool toggled);
     void slotLogicshow(bool toggled);
     void slotConstantsShow(bool toggled);   
+    void slotBitsetshow(bool toggled);
     void slotShowAll(void);
     void slotHideAll(void);
     void slotAngleSelected(int mode);
@@ -222,6 +223,8 @@
     QList<QAbstractButton*> statButtons;
     QList<QAbstractButton*> constButtons;
 
+    KToggleAction *actionMenubarshow;
+    KToggleAction *actionBitsetshow;
     KToggleAction *actionStatshow;
     KToggleAction *actionScientificshow;
     KToggleAction *actionLogicshow;
--- trunk/KDE/kdeutils/kcalc/kcalc.kcfg #855438:855439
@@ -87,6 +87,10 @@
       <label>Whether to group digits.</label>
       <default>true</default>
     </entry>
+    <entry name="ShowBitset" type="Bool">
+      <label>Whether to show the bit edit widget.</label>
+      <default>true</default>
+    </entry>
     <entry name="ShowStat" type="Bool">
       <label>Whether to show statistical buttons.</label>
       <default>false</default>
--- trunk/KDE/kdeutils/kcalc/kcalc_settings.kcfgc #855438:855439
@@ -2,6 +2,6 @@
 File=kcalc.kcfg
 ClassName=KCalcSettings
 Singleton=true
-Mutators=ShowStat,ShowScientific,ShowLogic,ShowConstants,nameConstant,valueConstant
+Mutators=ShowBitset,ShowStat,ShowScientific,ShowLogic,ShowConstants,nameConstant,valueConstant
 # Inherits=KConfigSkeleton
 # MemberVariables=public
--- trunk/KDE/kdeutils/kcalc/kcalcui.rc #855438:855439
@@ -6,6 +6,7 @@
     <Action name="show_stat"/>
     <Action name="show_logic"/>
     <Action name="show_constants"/>
+    <Action name="show_bitset"/>
     <Separator/>
     <Action name="show_all"/>
     <Action name="hide_all"/>



More information about the kde-doc-english mailing list