Bug 61040

Summary: Units under misc defaults to KDE Country/Region setting
Product: [Unmaintained] koffice Reporter: Sean Lynch <techniq35>
Component: generalAssignee: KOffice List <koffice-devel>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Sean Lynch 2003-07-10 13:03:03 UTC
Version:           1.2.91 (using KDE 3.1.9)
Compiler:          gcc version 3.3 20030226 (prerelease) (SuSE Linux)
OS:          Linux (i686) release 2.4.20-4GB-athlon

It would be useful to have KOffice to default its units to what is setup under Control Center->Regional & Accessibility->Country/Region & Language, Other tab.
Comment 1 Brad Hards 2004-05-15 05:53:18 UTC
CVS commit by bhards: 

Make KPresenter respect the locale settings for measurement system.

Previously you got millimetres by default (although it could be changed
on a document by document basis), now you get inches if your locale
uses Imperial, and you get centimetres if you locale uses Metric. The
change from millimetres to centimetres is to match KWord, as requested
by David Faure.

CCMAIL: 61040@bugs.kde.org


  M +6 -2      kpresenter_doc.cc   1.748
  M            templates/A4/OneColumnLandscape.kpt   1.3
  M            templates/A4/OneColumnPortrait.kpt   1.3
  M            templates/A4/TitleLandscape.kpt   1.3
  M            templates/A4/TitlePortrait.kpt   1.3
  M            templates/A4/TwoColumnLandscape.kpt   1.3
  M            templates/A4/TwoColumnPortrait.kpt   1.3
  M            templates/A4/emptyLandscape.kpt   1.3
  M            templates/A4/emptyPortrait.kpt   1.3
  M            templates/Screen/OneColumnLandscape.kpt   1.4
  M            templates/Screen/Title.kpt   1.4
  M            templates/Screen/TitleLandscape.kpt   1.4
  M            templates/Screen/TwoColumnLandscape.kpt   1.4
  M            templates/Screen/emptyLandscape.kpt   1.4
  M            templates/Screenpresentations/BlueBreezeDouble.kpt   1.3
  M            templates/Screenpresentations/BlueBreezePicture.kpt   1.3
  M            templates/Screenpresentations/BlueBreezeSingle.kpt   1.3
  M            templates/Screenpresentations/CopperPlain.kpt   1.2
  M            templates/Screenpresentations/Gradient-Blue-Red.kpt   1.10
  M            templates/Screenpresentations/Plain.kpt   1.8
  M            templates/Screenpresentations/SnowyMountains.kpt   1.3
  M            templates/Screenpresentations/TotallyNewProduct.kpt   1.3
  M            templates/Screenpresentations/kde.kpt   1.4
  M            templates/Screenpresentations/kde2.kpt   1.4
  M            templates/legal/OneColumnLandscape.kpt   1.3
  M            templates/legal/OneColumnPortrait.kpt   1.3
  M            templates/legal/TitleLandscape.kpt   1.3
  M            templates/legal/TitlePortrait.kpt   1.3
  M            templates/legal/TwoColumnLandscape.kpt   1.3
  M            templates/legal/TwoColumnPortrait.kpt   1.3
  M            templates/legal/emptyLandscape.kpt   1.3
  M            templates/legal/emptyPortrait.kpt   1.3
  M            templates/letter/OneColumnLandscape.kpt   1.3
  M            templates/letter/OneColumnPortrait.kpt   1.3
  M            templates/letter/TitleLandscape.kpt   1.3
  M            templates/letter/TitlePortrait.kpt   1.3
  M            templates/letter/TwoColumnLandscape.kpt   1.3
  M            templates/letter/TwoColumnPortrait.kpt   1.3
  M            templates/letter/emptyLandscape.kpt   1.3
  M            templates/letter/emptyPortrait.kpt   1.3



Comment 2 Brad Hards 2004-05-15 09:05:26 UTC
CVS commit by bhards: 

Make KSpread respect the locale settings for measurement system, as set
in the control centre.

Previously you always got millimetres. Now you get millimetres if your
locale uses metric, and inches if your locale uses imperial. There might
be a case for converting the metric default to centimetres though, for
consistency.

CCMAIL: 61040@bugs.kde.org


  M +5 -1      kspread_doc.cc   1.290


--- koffice/kspread/kspread_doc.cc  #1.289:1.290
@@ -202,5 +202,9 @@ KSpreadDoc::KSpreadDoc( QWidget *parentW
 
   // default document properties
+  if ( KGlobal::locale()->measureSystem() == KLocale::Imperial ) {
+    d->unit = KoUnit::U_INCH;
+  } else {
   d->unit = KoUnit::U_MM;
+  }
   d->syntaxVersion = CURRENT_SYNTAX_VERSION;
   d->verticalScrollBar = true;


Comment 3 Brad Hards 2004-05-15 12:30:41 UTC
CVS commit by bhards: 

Make Karbon 14 respect the locale settings for the measurement system
as set in the Control Centre.

Previously you always got millimetres, now you get centimetres if 
you select metric, and inches if you select Imperial. The change
is as discussed on koffice-devel mailing list.

CCMAIL: 61040@bugs.kde.org


  M +12 -4     karbon_part.cc   1.153


--- koffice/karbon/karbon_part.cc  #1.152:1.153
@@ -337,8 +337,16 @@ KarbonPart::initUnit()
         KConfig* config = KarbonPart::instance()->config();
 
-        if( config->hasGroup( "Misc" ) )
-        {
+
+        if (KGlobal::locale()->measureSystem() == KLocale::Imperial) {
+                setUnit( KoUnit::U_INCH );
+        } else {
+                setUnit( KoUnit::U_CM );
+        }
+
+        if(config->hasGroup("Misc") ) {
                 config->setGroup( "Misc" );
-                m_doc.setUnit( KoUnit::unit( config->readEntry( "Units", KoUnit::unitName( KoUnit::U_MM ) ) ) );
+                if ( config->hasKey( "Units" ) ) {
+                         setUnit( KoUnit::unit( config->readEntry("Units") ) );
+                } 
         }
 }


Comment 4 Brad Hards 2004-05-16 05:26:20 UTC
CVS commit by bhards: 

Make KWord respect the locale settings for measurement system as set
in the Control Centre.

Previously you got centimetres by default - now you get centimetres
if you're in a Metric locale, and inches if you are in an Imperial
locale.

Peter Simonsson fixed Kivio, and I've previously done KPresenter,
KSpread, and Karbon. I don't see any use of measurement units for
Kugar, KChart, KDGantt, Kexi or KFormula; and Krita looks to be hard
wired into pixels. So that takes care of Bug 61040.

Thanks to David Faure, Nicholas Goutte, Peter Simonsson and Thomas
Zander for their input and assistance towards resolving this bug.

CCMAIL: 61040-done@bugs.kde.org


  M +12 -3     kwdoc.cc   1.666


--- koffice/kword/kwdoc.cc  #1.665:1.666
@@ -131,8 +131,12 @@ const int KWDocument::CURRENT_SYNTAX_VER
 KWDocument::KWDocument(QWidget *parentWidget, const char *widgetName, QObject* parent, const char* name, bool singleViewMode )
     : KoDocument( parentWidget, widgetName, parent, name, singleViewMode ),
-      m_unit( KoUnit::U_CM ),
       m_urlIntern()
 {
     dcop = 0;
+    if (KGlobal::locale()->measureSystem() == KLocale::Imperial) {
+        m_unit = KoUnit::U_INCH;
+    } else {
+        m_unit = KoUnit::U_CM;
+    }
     m_pages = 1;
     m_loadingInfo = 0L;
@@ -530,4 +534,11 @@ void KWDocument::initUnit()
     //load default unit setting - this is only used for new files (from templates) or empty files
     KConfig *config = KWFactory::global()->config();
+
+    if (KGlobal::locale()->measureSystem() == KLocale::Imperial) {
+        m_unit = KoUnit::U_INCH;
+    } else {
+        m_unit = KoUnit::U_CM;
+    }
+
     if(config->hasGroup("Misc") )
     {
@@ -535,6 +546,4 @@ void KWDocument::initUnit()
         if ( config->hasKey( "Units" ) )
             setUnit( KoUnit::unit( config->readEntry("Units") ) );
-        else
-            setUnit( KoUnit::U_CM );
         setDefaultColumnSpacing( config->readDoubleNumEntry("ColumnSpacing", 3.0) );
     }