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

List:       koffice-devel
Subject:    [PATCH] Fix kivio statusbar
From:       Peter Simonsson <psn () linux ! se>
Date:       2003-09-13 21:51:54
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!
This patch should fix the problem that kivio don't remove a label in the 
statusbar when embeded... I'll commit on monday if nobody complains.
- -- 
LLaP
Peter Simonsson

Kivio (KOffice Flowcharting Application) - http://www.koffice.org/kivio/
Kexi - http://www.koffice.org/kexi/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/Y5GBjR6JKcrOq3sRAh1KAJ9mV3ZVLxj8D+w+TEbgMSItD2LQ4ACeMhbc
JrjLyRVI3HKCWvrpOs0Na0c=
=gqsN
-----END PGP SIGNATURE-----

["kivio.diff" (text/x-diff)]

Index: kiviopart/kivio_view.cpp
===================================================================
RCS file: /home/kde/koffice/kivio/kiviopart/kivio_view.cpp,v
retrieving revision 1.110
diff -u -p -r1.110 kivio_view.cpp
--- kiviopart/kivio_view.cpp	12 Sep 2003 19:13:42 -0000	1.110
+++ kiviopart/kivio_view.cpp	13 Sep 2003 21:46:54 -0000
@@ -137,16 +137,13 @@ KivioView::KivioView( QWidget *_parent, 
   dcop = 0;
   dcopObject(); // build it
 
-  KStatusBar* sb = statusBar();
-
-  if(sb) {
-    QString unit = KoUnit::unitName(m_pDoc->units());
-    KoPoint xy(0, 0);
-    QString text = i18n("X: %1 %3 Y: %2 %4").arg(KGlobal::_locale->formatNumber(xy.x(), 2))
-      .arg(KGlobal::_locale->formatNumber(xy.y(), 2)).arg(unit).arg(unit);
-    sb->removeItem(MOUSEPOS_TEXT);
-    sb->insertItem(text, MOUSEPOS_TEXT, 0, true);
-  }
+  // Add coords to the statusbar
+  QString unit = KoUnit::unitName(m_pDoc->units());
+  KoPoint xy(0, 0);
+  QString text = i18n("X: %1 %3 Y: %2 %4").arg(KGlobal::_locale->formatNumber(xy.x(), 2))
+  .arg(KGlobal::_locale->formatNumber(xy.y(), 2)).arg(unit).arg(unit);
+  m_coordSLbl = new KStatusBarLabel(text, 1000);
+  addStatusBarItem(m_coordSLbl, 0, true);
 
   bool isModified = doc->isModified();
   m_pTools = new ToolController(this);
@@ -1709,16 +1706,15 @@ void KivioView::setMousePos( int mx, int
 {
   vRuler->setMousePos(mx, my);
   hRuler->setMousePos(mx, my);
-  KStatusBar* sb = statusBar();
 
-  if(sb && (mx >= 0) && (my >= 0)) {
+  if((mx >= 0) && (my >= 0)) {
     QString unit = KoUnit::unitName(m_pDoc->units());
     KoPoint xy = m_pCanvas->mapFromScreen(QPoint(mx, my));
     xy.setX(KoUnit::ptToUnit(xy.x(), m_pDoc->units()));
     xy.setY(KoUnit::ptToUnit(xy.y(), m_pDoc->units()));
     QString text = i18n("X: %1 %3 Y: %2 %4").arg(KGlobal::_locale->formatNumber(xy.x(), 2))
       .arg(KGlobal::_locale->formatNumber(xy.y(), 2)).arg(unit).arg(unit);
-    sb->changeItem(text, MOUSEPOS_TEXT);
+    m_coordSLbl->setText(text);
   }
 }
 
Index: kiviopart/kivio_view.h
===================================================================
RCS file: /home/kde/koffice/kivio/kiviopart/kivio_view.h,v
retrieving revision 1.38
diff -u -p -r1.38 kivio_view.h
--- kiviopart/kivio_view.h	5 Jul 2003 19:17:31 -0000	1.38
+++ kiviopart/kivio_view.h	13 Sep 2003 21:46:54 -0000
@@ -62,6 +62,7 @@ class DCOPObject;
 class KoRuler;
 class KoZoomHandler;
 class KoUnitDoubleSpinBox;
+class KStatusBarLabel;
 
 #include <qdom.h>
 #include <qptrlist.h>
@@ -336,6 +337,8 @@ class KivioView : public KoView
     DCOPObject *dcop;
 
     KoZoomHandler* m_zoomHandler;
+
+    KStatusBarLabel* m_coordSLbl;
 };
 
 #endif


_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel


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

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