[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Thu Apr 8 18:59:04 CEST 2004


CVS commit by arwalker: 

Have KstView::printToGraphicsFile( ... ) return a bool to indicate whether or not it was successful.


  M +15 -6     kstview.cpp   1.89
  M +1 -1      kstview.h   1.28


--- kdeextragear-2/kst/kst/kstview.cpp  #1.88:1.89
@@ -195,8 +195,8 @@ void KstView::customEvent( QCustomEvent*
 }
 
-// FIXME: make this return an error code!
-void KstView::printToGraphicsFile(const QString &filename, int in_w, int in_h) {
+bool KstView::printToGraphicsFile(const QString &filename, int in_w, int in_h) {
   float w, h, tlx, tly;
   QRect v;
+  bool bRetVal = FALSE;
   KstPlot *pl = 0L;
   double XBorder, maxXBorder = 0;
@@ -242,16 +242,25 @@ void KstView::printToGraphicsFile(const 
   KURL url = KURL::fromPathOrURL(filename);
   if (url.isLocalFile()) {
-    tmpPixmap.save(url.path(), type.latin1());
+    if (tmpPixmap.save(url.path(), type.latin1())) {
+      bRetVal = TRUE;
+    }
   } else {
     KTempFile tf;
     tf.close();
     tf.setAutoDelete(true);
-    tmpPixmap.save(tf.name(), type.latin1());
+    if( tmpPixmap.save(tf.name(), type.latin1())) {
 #if KDE_IS_VERSION(3,1,90)
-    KIO::NetAccess::upload(tf.name(), url, this);
+      if( KIO::NetAccess::upload(tf.name(), url, this)) {
+        bRetVal = TRUE;
+      }
 #else
-    KIO::NetAccess::upload(tf.name(), url);
+      if( KIO::NetAccess::upload(tf.name(), url)) {
+        bRetVal = TRUE;
+      }
+    }
 #endif
   }
+  
+  return bRetVal;
 }
 

--- kdeextragear-2/kst/kst/kstview.h  #1.27:1.28
@@ -89,5 +89,5 @@ public slots:
   void toggleTiedZoom();
 
-  void printToGraphicsFile(const QString &Filename, int w, int h);
+  bool printToGraphicsFile(const QString &Filename, int w, int h);
 
   void cleanupLayout();





More information about the Kst mailing list