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

List:       kde-commits
Subject:    koffice/kivio/kiviopart
From:       Ariya Hidayat <ariya () kde ! org>
Date:       2004-01-28 19:38:30
Message-ID: 20040128193830.80325A62D () office ! kde ! org
[Download RAW message or body]

CVS commit by ariya: 

use the new KoZoomAction


  M +3 -51     kivio_view.cpp   1.138
  M +0 -1      kivio_view.h   1.49


--- koffice/kivio/kiviopart/kivio_view.cpp  #1.137:1.138
@@ -73,4 +73,5 @@
 #include <koApplication.h>
 #include <kotabbar.h>
+#include <kozoomaction.h>
 
 #include "kivio_view.h"
@@ -476,9 +477,7 @@ void KivioView::setupActions()
   //--
 
-  m_viewZoom = new KSelectAction(i18n("Zoom &Level"), "viewmag", 0, \
                actionCollection(), "viewZoom");
-  m_viewZoom->setEditable(true);
+  m_viewZoom = new KoZoomAction(i18n("Zoom &Level"), "viewmag", 0, \
actionCollection(), "view_zoom" );  m_viewZoom->setWhatsThis(i18n("This allows you to \
zoom in or out of a document. You can either choose one of the predefined zoomfactors \
                or enter a new zoomfactor (in percent)."));
-  connect(m_viewZoom, SIGNAL(activated(const QString&)), SLOT(viewZoom(const \
                QString&)));
-  changeZoomMenu();
+  connect(m_viewZoom, SIGNAL(zoomChanged(const QString&)), SLOT(viewZoom(const \
QString&)));  
   m_setArrowHeads = new KivioArrowHeadAction(i18n("Arrowheads"), "arrowheads", \
actionCollection(), "arrowHeads"); @@ -777,5 +776,4 @@ void KivioView::viewZoom(int \
zoom)  vRuler->setFrameStartEnd(zoomHandler()->zoomItY(l.ptTop), \
zoomHandler()->zoomItY(l.ptHeight - l.ptBottom));  \
hRuler->setFrameStartEnd(zoomHandler()->zoomItX(l.ptLeft), \
                zoomHandler()->zoomItX(l.ptWidth - l.ptRight));
-  changeZoomMenu(zoom);
   showZoom(zoom);
 }
@@ -783,5 +781,4 @@ void KivioView::viewZoom(int zoom)
 void KivioView::canvasZoomChanged()
 {
-  changeZoomMenu(zoomHandler()->zoom());
   showZoom(zoomHandler()->zoom());
   vRuler->setZoom(zoomHandler()->zoomedResolutionY());
@@ -1794,49 +1791,4 @@ void KivioView::viewZoom(const QString& 
 }
 
-void KivioView::changeZoomMenu(int zoom)
-{
-  QStringList lst;
-
-  if(zoom > 0) {
-    // This code is taken from KWords changeZoomMenu
-    QValueList<int> list;
-    bool ok;
-    const QStringList itemsList ( m_viewZoom->items() );
-    QRegExp regexp("(\\d+)"); // "Captured" non-empty sequence of digits
-
-    for (QStringList::ConstIterator it = itemsList.begin() ; it != itemsList.end() ; \
                ++it) {
-      regexp.search(*it);
-      const int val=regexp.cap(1).toInt(&ok);
-      //zoom : limit inferior=10
-      if(ok && val>9 && list.contains(val)==0)
-      list.append( val );
-    }
-    //necessary at the beginning when we read config
-    //this value is not in combo list
-    if(list.contains(zoom)==0)
-      list.append( zoom );
-
-    qHeapSort( list );
-
-    for (QValueList<int>::Iterator it = list.begin() ; it != list.end() ; ++it)
-      lst.append( i18n("%1%").arg(*it) );
-  } else {
-    lst << i18n("%1%").arg("33");
-    lst << i18n("%1%").arg("50");
-    lst << i18n("%1%").arg("75");
-    lst << i18n("%1%").arg("100");
-    lst << i18n("%1%").arg("125");
-    lst << i18n("%1%").arg("150");
-    lst << i18n("%1%").arg("200");
-    lst << i18n("%1%").arg("250");
-    lst << i18n("%1%").arg("350");
-    lst << i18n("%1%").arg("400");
-    lst << i18n("%1%").arg("450");
-    lst << i18n("%1%").arg("500");
-  }
-
-  m_viewZoom->setItems(lst);
-}
-
 void KivioView::showZoom(int z)
 {

--- koffice/kivio/kiviopart/kivio_view.h  #1.48:1.49
@@ -270,5 +270,4 @@ class KivioView : public KoView
     virtual void partActivateEvent(KParts::PartActivateEvent* event);
 
-    void changeZoomMenu(int z = 0);
     void showZoom(int z);
   private:


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

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