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

List:       kde-devel
Subject:    [PATCH] Bug 87290-zoom value locale problem (CVS HEAD)
From:       Antti Markus <antti.markus () starman ! ee>
Date:       2004-09-20 16:40:29
Message-ID: 1095698429.414f07fd0c369 () webmail ! starman ! ee
[Download RAW message or body]

This message is in MIME format.


Attached patch applies to kdegraphics/kghostview/kgv_view.cpp

- uses locale specific decimal separator for fractional zoom values
- if entered zoom value is not a number then does nothing instead of zooming to
0%



["cvshead_kghostview_kgv_view.patch" (text/x-diff)]

Index: kgv_view.cpp
===================================================================
RCS file: /home/kde/kdegraphics/kghostview/kgv_view.cpp,v
retrieving revision 1.188
diff -u -3 -p -u -p -r1.188 kgv_view.cpp
--- kgv_view.cpp	10 Sep 2004 14:46:29 -0000	1.188
+++ kgv_view.cpp	20 Sep 2004 16:29:16 -0000
@@ -260,12 +260,17 @@ KGVPart::KGVPart( QWidget* parentWidget,
     _zoomTo->clear();
     QValueList<double> mags = DisplayOptions::normalMagnificationValues();
     QStringList translated;
+    QString localValue;
+    QString double_oh("00");
     int idx = 0;
     int cur = 0;
     for ( QValueList<double>::iterator first = mags.begin(), last = mags.end();
 	    first != last;
 	    ++first ) {
-	translated << i18n( "zoom-factor (percentage)", "%1%" ).arg( *first * 100.0 );
+	localValue = KGlobal::locale()->formatNumber( *first * 100.0, 2 );
+	localValue.remove( KGlobal::locale()->decimalSymbol()+double_oh );
+	
+	translated << i18n( "zoom-factor (percentage)", "%1%" ).arg( localValue );
 	if ( *first == 1.0 ) idx = cur;
 	++cur;
     }
@@ -903,15 +908,19 @@ void KGVPart::slotZoom( const QString& n
     QString z = nz;
     double zoom;
     z.remove(  z.find(  '%' ), 1 );
-    zoom = KGlobal::locale()->readNumber(  z ) / 100;
-    kdDebug( 4500 ) << "ZOOM = "  << nz << ", setting zoom = " << zoom << endl;
-
-    DisplayOptions options = miniWidget()->displayOptions();
-    options.setMagnification( zoom );
-    miniWidget()->setDisplayOptions( options );
-    miniWidget()->redisplay();
-    _mainWidget->setFocus();
-    updateZoomActions();
+    bool isNumber = true;
+    zoom = KGlobal::locale()->readNumber(  z, &isNumber ) / 100;
+    
+    if( isNumber ) {
+        kdDebug( 4500 ) << "ZOOM = "  << nz << ", setting zoom = " << zoom << endl;
+
+        DisplayOptions options = miniWidget()->displayOptions();
+        options.setMagnification( zoom );
+        miniWidget()->setDisplayOptions( options );
+        miniWidget()->redisplay();
+        _mainWidget->setFocus();
+        updateZoomActions();
+    }
 }
 
 void KGVPart::slotFitToPage()


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


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

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