[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: [PATCH] Bug 87290-zoom value locale problem (CVS KDE_3_3_0_RELEASE)
From: Antti Markus <antti.markus () starman ! ee>
Date: 2004-09-20 16:43:25
Message-ID: 1095698605.414f08adc3511 () 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 does nothing instead of zooming to 0%
["kde33_kghostview_kgv_view.diff" (text/x-diff)]
Index: kgv_view.cpp
===================================================================
RCS file: /home/kde/kdegraphics/kghostview/kgv_view.cpp,v
retrieving revision 1.186
diff -u -3 -p -u -p -r1.186 kgv_view.cpp
--- kgv_view.cpp 5 Jul 2004 10:41:41 -0000 1.186
+++ kgv_view.cpp 17 Sep 2004 17:53:36 -0000
@@ -251,12 +251,18 @@ 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;
}
@@ -889,15 +895,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