[kgraphviewer-devel] [KGraphViewer/libkgraphviz] 66b0c6e: Hide most of DotGraph internals for now

Kevin Funk krf at electrostorm.net
Tue Dec 14 18:13:30 CET 2010


commit 66b0c6ed0dd4b39c2dba3a741079d66a35c54814
branch libkgraphviz
Author: Kevin Funk <krf at electrostorm.net>
Date:   Tue Dec 14 18:12:45 2010 +0100

    Hide most of DotGraph internals for now

diff --git a/src/kgraphviz/dotgraph.cpp b/src/kgraphviz/dotgraph.cpp
index ce35504..f901fcf 100644
--- a/src/kgraphviz/dotgraph.cpp
+++ b/src/kgraphviz/dotgraph.cpp
@@ -57,7 +57,12 @@ using namespace KGraphViz;
 
 const distinct_parser<> keyword_p("0-9a-zA-Z_");
 
-DotGraphPrivate::DotGraphPrivate()
+DotGraphPrivate::DotGraphPrivate() :
+  m_width(0.0), m_height(0.0),m_scale(1.0),
+  m_directed(true), m_strict(false),
+  m_horizCellFactor(0), m_vertCellFactor(0),
+  m_wdhcf(0), m_hdvcf(0),
+  m_useLibrary(false)
 {
 }
 
@@ -74,46 +79,37 @@ void DotGraphPrivate::init()
 DotGraph::DotGraph() :
   GraphElement(),
   d_ptr(new DotGraphPrivate),
-  m_dotFileName(""),m_width(0.0), m_height(0.0),m_scale(1.0),
-  m_directed(true),m_strict(false),
-  m_layoutCommand(""),
-  m_horizCellFactor(0), m_vertCellFactor(0),
-  m_wdhcf(0), m_hdvcf(0),
   m_readWrite(false),
-  m_dot(0),
-  m_phase(Initial),
-  m_useLibrary(false)
+  m_phase(Initial)
 {
   setId("unnamed");
 }
 
-DotGraph::DotGraph(const QString& command, const QString& fileName) :
+DotGraph::DotGraph(const QString& layoutCommand, const QString& fileName) :
   GraphElement(),
   d_ptr(new DotGraphPrivate),
-  m_dotFileName(fileName),m_width(0.0), m_height(0.0),m_scale(1.0),
-  m_directed(true),m_strict(false),
-  m_layoutCommand(command),
-  m_horizCellFactor(0), m_vertCellFactor(0),
-  m_wdhcf(0), m_hdvcf(0),
   m_readWrite(false),
-  m_dot(0),
-  m_phase(Initial),
-  m_useLibrary(false)
+  m_phase(Initial)
 {
   setId("unnamed");
+
+  Q_D(DotGraph);
+  d->m_fileName = fileName;
+  d->m_layoutCommand = layoutCommand;
 }
 
 DotGraph::~DotGraph()  
 {
+  Q_D(DotGraph); 
   GraphNodeMap::iterator itn, itn_end;
-  itn = m_nodesMap.begin(); itn_end = m_nodesMap.end();
+  itn = d->m_nodesMap.begin(); itn_end = d->m_nodesMap.end();
   for (; itn != itn_end; itn++)
   {
     delete *itn;
   }
 
   GraphEdgeMap::iterator ite, ite_end;
-  ite = m_edgesMap.begin(); ite_end = m_edgesMap.end();
+  ite = d->m_edgesMap.begin(); ite_end = d->m_edgesMap.end();
   for (; ite != ite_end; ite++)
   {
     delete (*ite);
@@ -122,6 +118,156 @@ DotGraph::~DotGraph()
   delete d_ptr;
 }
 
+QString DotGraph::dotFileName() const
+{
+  Q_D(const DotGraph);
+  return d->m_fileName;
+}
+
+void DotGraph::setDotFileName(const QString& fileName)
+{
+  Q_D(DotGraph);
+  d->m_fileName = fileName;
+}
+
+QString DotGraph::layoutCommand() const
+{
+  Q_D(const DotGraph);
+  return d->m_layoutCommand;
+}
+
+void DotGraph::setLayoutCommand(const QString& layoutCommand)
+{
+  Q_D(DotGraph);
+  d->m_layoutCommand = layoutCommand;
+}
+
+const KGraphViz::GraphNodeMap& DotGraph::nodes() const
+{
+  Q_D(const DotGraph);
+  return d->m_nodesMap;
+}
+
+const KGraphViz::GraphEdgeMap& DotGraph::edges() const
+{
+  Q_D(const DotGraph);
+  return d->m_edgesMap;
+}
+
+const KGraphViz::GraphSubgraphMap& DotGraph::subgraphs() const
+{
+  Q_D(const DotGraph);
+  return d->m_subgraphsMap;
+}
+
+KGraphViz::GraphNodeMap& DotGraph::nodes()
+{
+  Q_D(DotGraph);
+  return d->m_nodesMap;
+}
+
+KGraphViz::GraphEdgeMap& DotGraph::edges()
+{
+  Q_D(DotGraph);
+  return d->m_edgesMap;
+}
+
+KGraphViz::GraphSubgraphMap& DotGraph::subgraphs()
+{
+  Q_D(DotGraph);
+  return d->m_subgraphsMap;
+}
+
+double DotGraph::width() const
+{
+  Q_D(const DotGraph);
+  return d->m_width;
+}
+void DotGraph::setWidth(double width)
+{
+  Q_D(DotGraph);
+  d->m_width = width;
+}
+
+double DotGraph::height() const
+{
+  Q_D(const DotGraph);
+  return d->m_height;
+}
+void DotGraph::setHeight(double height)
+{
+  Q_D(DotGraph);
+  d->m_height = height;
+}
+
+double DotGraph::scale() const
+{
+  Q_D(const DotGraph);
+  return d->m_scale;
+}
+void DotGraph::setScale(double scale)
+{
+  Q_D(DotGraph);
+  d->m_scale = scale;
+}
+
+bool DotGraph::strict() const
+{
+  Q_D(const DotGraph);
+  return d->m_strict;
+}
+void DotGraph::setStrict(bool isStrict)
+{
+  Q_D(DotGraph);
+  d->m_strict = isStrict;
+}
+
+bool DotGraph::directed() const
+{
+  Q_D(const DotGraph);
+  return d->m_directed;
+}
+void DotGraph::setDirected(bool isDirected)
+{
+  Q_D(DotGraph);
+  d->m_directed = isDirected;
+}
+
+double DotGraph::hdvcf() const
+{
+  Q_D(const DotGraph);
+  return d->m_hdvcf;
+}
+
+double DotGraph::wdhcf() const
+{
+  Q_D(const DotGraph);
+  return d->m_wdhcf;
+}
+
+unsigned int DotGraph::horizCellFactor() const
+{
+  Q_D(const DotGraph);
+  return d->m_horizCellFactor;
+}
+
+unsigned int DotGraph::vertCellFactor() const
+{
+  Q_D(const DotGraph);
+  return d->m_vertCellFactor;
+}
+
+bool DotGraph::useLibrary() const
+{
+  Q_D(const DotGraph);
+  return d->m_useLibrary;
+}
+void DotGraph::setUseLibrary(bool value)
+{
+  Q_D(DotGraph);
+  d->m_useLibrary = value;
+}
+
 bool DotGraph::parseDot(const QString& fileName)
 {
   kDebug() << fileName;
@@ -134,8 +280,10 @@ bool DotGraph::parseDot(const QString& fileName)
 
 bool DotGraph::update()
 {
+  Q_D(DotGraph);
+  
   GraphExporter exporter;
-  if (!m_useLibrary)
+  if (!useLibrary())
   {
     kDebug() << "command";
     QString str = exporter.writeDot(this);
@@ -147,7 +295,7 @@ bool DotGraph::update()
     graph_t* graph = exporter.exportToGraphviz(this);
 
     GVC_t* gvc = gvContext();
-    gvLayout(gvc, graph, m_layoutCommand.toUtf8().data());
+    gvLayout(gvc, graph, layoutCommand().toUtf8().data());
     gvRender (gvc, graph, "xdot", NULL);
 
     updateWithGraph(graph);
@@ -163,13 +311,13 @@ unsigned int DotGraph::cellNumber(int x, int y)
 {
 /*  kDebug() << "x= " << x << ", y= " << y << ", m_width= " << m_width << ", m_height= " << m_height << ", m_horizCellFactor= " << m_horizCellFactor << ", m_vertCellFactor= " << m_vertCellFactor  << ", m_wdhcf= " << m_wdhcf << ", m_hdvcf= " << m_hdvcf;*/
   
-  unsigned int nx = (unsigned int)(( x - ( x % int(m_wdhcf) ) ) / m_wdhcf);
-  unsigned int ny = (unsigned int)(( y - ( y % int(m_hdvcf) ) ) / m_hdvcf);
+  unsigned int nx = (unsigned int)(( x - ( x % int(wdhcf()) ) ) / wdhcf());
+  unsigned int ny = (unsigned int)(( y - ( y % int(hdvcf()) ) ) / hdvcf());
 /*  kDebug() << "nx = " << (unsigned int)(( x - ( x % int(m_wdhcf) ) ) / m_wdhcf);
   kDebug() << "ny = " << (unsigned int)(( y - ( y % int(m_hdvcf) ) ) / m_hdvcf);
   kDebug() << "res = " << ny * m_horizCellFactor + nx;*/
   
-  unsigned int res = ny * m_horizCellFactor + nx;
+  unsigned int res = ny * horizCellFactor() + nx;
   return res;
 }
 
@@ -178,6 +326,8 @@ unsigned int DotGraph::cellNumber(int x, int y)
 void DotGraph::computeCells()
 {
   return;
+  
+/* FIXME: Is this used?
   kDebug() << m_width << m_height << endl;
   m_horizCellFactor = m_vertCellFactor = 1;
   m_wdhcf = (int)ceil(((double)m_width) / m_horizCellFactor)+1;
@@ -226,11 +376,13 @@ void DotGraph::computeCells()
   } while (!stop);
   kDebug() << "m_wdhcf=" << m_wdhcf << "; m_hdvcf=" << m_hdvcf << endl;
   kDebug() << "finished" << endl;
+*/
 }
 
 QSet< GraphNode* >& DotGraph::nodesOfCell(unsigned int id)
 {
-  return m_cells[id];
+  Q_D(DotGraph);
+  return d->m_cells[id];
 }
 
 void DotGraph::storeOriginalAttributes()
@@ -252,10 +404,10 @@ void DotGraph::storeOriginalAttributes()
 
 void DotGraph::saveTo(const QString& fileName)
 {
-  kDebug() << fileName;
-  m_dotFileName = fileName;
-  GraphExporter exporter;
-  exporter.writeDot(this, fileName);
+  kDebug() << "Filename:" << fileName;
+
+  Q_D(DotGraph);
+  d->m_graphIO.saveToDotFile(this, fileName);
 }
 
 void DotGraph::updateWithGraph(graph_t* newGraph)
@@ -390,13 +542,15 @@ void DotGraph::updateWithGraph(graph_t* newGraph)
 
 void DotGraph::updateWithGraph(const DotGraph& newGraph)
 {
+  Q_D(DotGraph);
   kDebug();
   GraphElement::updateWithElement(newGraph);
-  m_width=newGraph.width();
-  m_height=newGraph.height();
-  m_scale=newGraph.scale();
-  m_directed=newGraph.directed();
-  m_strict=newGraph.strict();
+  d->m_width = newGraph.width();
+  d->m_height = newGraph.height();
+  d->m_scale = newGraph.scale();
+  d->m_directed = newGraph.directed();
+  d->m_strict = newGraph.strict();
+
   computeCells();
   foreach (GraphSubgraph* nsg, newGraph.subgraphs())
   {
@@ -473,6 +627,7 @@ void DotGraph::updateWithGraph(const DotGraph& newGraph)
 
 void DotGraph::removeNodeNamed(const QString& nodeName)
 {
+  Q_D(DotGraph);
   kDebug() << nodeName;
   GraphNode* node = dynamic_cast<GraphNode*>(elementNamed(nodeName));
   if (node == 0)
@@ -482,7 +637,7 @@ void DotGraph::removeNodeNamed(const QString& nodeName)
   }
   
   GraphEdgeMap::iterator it, it_end;
-  it = m_edgesMap.begin(); it_end = m_edgesMap.end();
+  it = d->m_edgesMap.begin(); it_end = d->m_edgesMap.end();
   while (it != it_end)
   {
     if ( it.value()->fromNode() == node
@@ -542,6 +697,7 @@ void DotGraph::removeNodeFromSubgraph(
 
 void DotGraph::removeSubgraphNamed(const QString& subgraphName)
 {
+  Q_D(DotGraph);
   kDebug() << subgraphName << " from " << subgraphs().keys();
   GraphSubgraph* subgraph = subgraphs()[subgraphName];
 
@@ -551,7 +707,7 @@ void DotGraph::removeSubgraphNamed(const QString& subgraphName)
     return;
   }
   GraphEdgeMap::iterator it, it_end;
-  it = m_edgesMap.begin(); it_end = m_edgesMap.end();
+  it = d->m_edgesMap.begin(); it_end = d->m_edgesMap.end();
   while (it != it_end)
   {
     if ( it.value()->fromNode() == subgraph
@@ -671,16 +827,17 @@ void DotGraph::setAttribute(const QString& elementId, const QString& attributeNa
   }
 }
 
-GraphElement* DotGraph::elementNamed(const QString& id)
+GraphElement* DotGraph::elementNamed(const QString& id) const
 {
+  Q_D(const DotGraph);
   GraphElement* ret = 0;
-  if ((ret = m_nodesMap.value(id, 0))) {
+  if ((ret = d->m_nodesMap.value(id, 0))) {
     return ret;
   }
-  if ((ret = m_edgesMap.value(id, 0))) {
+  if ((ret = d->m_edgesMap.value(id, 0))) {
     return ret;
   }
-  foreach(GraphSubgraph* subGraph, m_subgraphsMap) {
+  foreach(GraphSubgraph* subGraph, subgraphs()) {
     if ((ret = subGraph->elementNamed(id))) {
       return ret;
     }
diff --git a/src/kgraphviz/dotgraph.h b/src/kgraphviz/dotgraph.h
index 7c5a207..46741a7 100644
--- a/src/kgraphviz/dotgraph.h
+++ b/src/kgraphviz/dotgraph.h
@@ -49,56 +49,58 @@ class DotGraphPrivate;
 class KGRAPHVIZ_EXPORT DotGraph : public GraphElement
 {
   Q_OBJECT
+
 public:
   enum ParsePhase {Initial, Final};
-  
+
   DotGraph();
-  DotGraph(const QString& command, const QString& fileName);
+  DotGraph(const QString& layoutCommand, const QString& fileName);
 
   virtual ~DotGraph();
   
   bool parseDot(const QString& fileName);
-  
+
+  const GraphNodeMap& nodes() const;
+  const GraphEdgeMap& edges() const;
+  const GraphSubgraphMap& subgraphs() const;
+
   /** Constant accessor to the nodes of this graph */
-  inline const GraphNodeMap& nodes() const {return m_nodesMap;}
+  GraphNodeMap& nodes();
   /** Constant accessor to the edges of this graph */
-  inline const GraphEdgeMap& edges() const {return m_edgesMap;}
-  inline const GraphSubgraphMap& subgraphs() const {return m_subgraphsMap;}
-  /** Accessor to the nodes of this graph */
-  inline GraphNodeMap& nodes() {return m_nodesMap;}
-  /** Accessor to the edges of this graph */
-  inline GraphEdgeMap& edges() {return m_edgesMap;}
-  inline GraphSubgraphMap& subgraphs() {return m_subgraphsMap;}
-  double width() const {return m_width;}
-  double height() const {return m_height;}
-  double scale() const {return m_scale;}
-  void setWidth(double w) {m_width = w;}
-  void setHeight(double h) {m_height = h;}
-  void setScale(double s) {m_scale = s;}
+  GraphEdgeMap& edges();
+  GraphSubgraphMap& subgraphs();
+
+  double width() const;
+  double height() const;
+  double scale() const;
+  void setWidth(double w);
+  void setHeight(double h);
+  void setScale(double s);
+
   virtual QString backColor() const;
   
-  inline void setStrict(bool s) {m_strict = s;}
-  inline void setDirected(bool d) {m_directed = d;}
-  inline bool strict() const {return m_strict;}
-  inline bool directed() const {return m_directed;}
+  void setStrict(bool isStrict);
+  void setDirected(bool isDirected);
+  bool strict() const;
+  bool directed() const;
 
   QSet< GraphNode* >& nodesOfCell(unsigned int id);
   
-  inline unsigned int horizCellFactor() const {return m_horizCellFactor;}
-  inline unsigned int vertCellFactor() const {return m_vertCellFactor;}
-  inline double wdhcf() const {return m_wdhcf;}
-  inline double hdvcf() const {return m_hdvcf;}
+  unsigned int horizCellFactor() const;
+  unsigned int vertCellFactor() const;
+  double wdhcf() const;
+  double hdvcf() const;
   
-  inline void setLayoutCommand(const QString& command) {m_layoutCommand = command;}
-  inline const QString& layoutCommand() const {return m_layoutCommand;}
-  
-  inline void setDotFileName(const QString& fileName) {m_dotFileName = fileName;}
-  inline const QString& dotFileName() const {return m_dotFileName;}
+  void setLayoutCommand(const QString& layoutCommand);
+  QString layoutCommand() const;
+
+  void setDotFileName(const QString& fileName);
+  QString dotFileName() const;
 
   bool update();
 
-  inline void setReadWrite() {m_readWrite = true;}
-  inline void setReadOnly() {m_readWrite = false;}
+  void setReadWrite() {m_readWrite = true;}
+  void setReadOnly() {m_readWrite = false;}
 
   virtual void storeOriginalAttributes();
 
@@ -109,10 +111,10 @@ public:
 
   void setAttribute(const QString& elementId, const QString& attributeName, const QString& attributeValue);
 
-  GraphElement* elementNamed(const QString& id);
+  GraphElement* elementNamed(const QString& id) const;
 
-  inline void setUseLibrary(bool value) {m_useLibrary = value;}
-  inline bool useLibrary() const {return m_useLibrary;}
+  void setUseLibrary(bool value);
+  bool useLibrary() const;
 
   void setGraphAttributes(QMap<QString,QString> attribs);
   void addNewNode(QMap<QString,QString> attribs);
@@ -120,6 +122,7 @@ public:
   void addNewNodeToSubgraph(QMap<QString,QString> attribs, QString subgraph);
   void addExistingNodeToSubgraph(QMap<QString,QString> attribs,QString subgraph);
   void moveExistingNodeToMainGraph(QMap<QString,QString> attribs);
+
   void addNewEdge(QString src, QString tgt, QMap<QString,QString> attribs);
   void removeAttribute(const QString& nodeName, const QString& attribName);
   void renameNode(const QString& oldNodeName, const QString& newNodeName);
@@ -138,31 +141,10 @@ private:
 
   unsigned int cellNumber(int x, int y);
   void computeCells();
-  QByteArray getDotResult(int exitCode, QProcess::ExitStatus exitStatus);
-    
-  QString m_dotFileName;
-  GraphSubgraphMap m_subgraphsMap;
-  GraphNodeMap m_nodesMap;
-  GraphEdgeMap m_edgesMap;
-  double m_width, m_height;
-  double m_scale;
-  bool m_directed;
-  bool m_strict;
-  QString m_layoutCommand;
-  
-  unsigned int m_horizCellFactor, m_vertCellFactor;
-  QVector< QSet< GraphNode* > > m_cells;
-  
-  double m_wdhcf, m_hdvcf;
 
   bool m_readWrite;
-  QProcess* m_dot;
 
   ParsePhase m_phase;
-
-  QMutex m_dotProcessMutex;
-
-  bool m_useLibrary;
 };
 
 }
diff --git a/src/kgraphviz/dotgraph_p.h b/src/kgraphviz/dotgraph_p.h
index 70a1c3f..78e93c3 100644
--- a/src/kgraphviz/dotgraph_p.h
+++ b/src/kgraphviz/dotgraph_p.h
@@ -37,6 +37,24 @@ public:
 
   GraphIO m_graphIO;
 
+  QString m_fileName;
+  QString m_layoutCommand;
+
+  GraphSubgraphMap m_subgraphsMap;
+  GraphNodeMap m_nodesMap;
+  GraphEdgeMap m_edgesMap;
+  double m_width, m_height;
+  double m_scale;
+  bool m_directed;
+  bool m_strict;
+
+  unsigned int m_horizCellFactor, m_vertCellFactor;
+  double m_wdhcf, m_hdvcf;
+
+  QVector< QSet< GraphNode* > > m_cells;
+  
+  bool m_useLibrary;
+
 private:
   Q_DECLARE_PUBLIC(DotGraph);
   DotGraph* q_ptr;
diff --git a/src/kgraphviz/dotgraphview.cpp b/src/kgraphviz/dotgraphview.cpp
index 6ba94dc..1a03668 100644
--- a/src/kgraphviz/dotgraphview.cpp
+++ b/src/kgraphviz/dotgraphview.cpp
@@ -635,7 +635,7 @@ bool DotGraphView::loadDot(const QString& dotFileName)
   loadingLabel->setZValue(100);
   centerOn(loadingLabel);
 
-  if (!d->m_graph->parseDot(d->m_graph->dotFileName())) {
+  if (!d->m_graph->parseDot(dotFileName)) {
     kError() << "NOT successfully parsed!" << endl;
     loadingLabel->setText(i18n("error parsing file %1", dotFileName));
     return false;
@@ -1321,11 +1321,7 @@ void DotGraphView::printPreview()
 bool DotGraphView::reload()
 {
   Q_D(DotGraphView);
-  QString fileName = d->m_graph->dotFileName();
-  if (d->m_graph->useLibrary())
-    return loadLibrary(fileName);
-  else
-    return loadDot(fileName);
+  d->m_graph->update();
 }
 
 void DotGraphView::initEmpty()
@@ -1336,29 +1332,16 @@ void DotGraphView::initEmpty()
 
 void DotGraphView::dirty(const QString& dotFileName)
 {
-  Q_D(DotGraphView);
-//   std::cerr << "SLOT dirty for " << dotFileName << std::endl;
-  if (dotFileName == d->m_graph->dotFileName())
-  {
-    if (KMessageBox::questionYesNo(this, 
+  kDebug() << "Filename:" << dotFileName;
+
+  if (KMessageBox::questionYesNo(this,
                                 i18n("The file %1 has been modified on disk.\nDo you want to reload it?",dotFileName),
                                 i18n("Reload Confirmation"),
                                 KStandardGuiItem::yes(),
                                 KStandardGuiItem::no(),
-                                "reloadOnChangeMode"   ) == KMessageBox::Yes)
-    {
-      if (d->m_graph->useLibrary())
-        loadLibrary(dotFileName);
-      else
-        loadDot(dotFileName);
+                                "reloadOnChangeMode"   ) == KMessageBox::Yes) {
+      reload();
     }
-  }
-}
-
-const QString& DotGraphView::dotFileName() 
-{
-  Q_D(DotGraphView);
-  return d->m_graph->dotFileName();
 }
 
 void DotGraphView::hideToolsWindows()
@@ -1853,9 +1836,7 @@ void DotGraphView::slotAGraphLayoutFinished()
     return;
   }
   
-  bool result = loadLibrary(d->m_layoutThread.g(), d->m_layoutThread.layoutCommand());
-  if (result)
-    d->m_graph->setDotFileName(d->m_loadThread.dotFileName());
+  loadLibrary(d->m_layoutThread.g(), d->m_layoutThread.layoutCommand());
 
   gvFreeLayout(d->m_layoutThread.gvc(), d->m_layoutThread.g());
   agclose(d->m_layoutThread.g());
diff --git a/src/kgraphviz/dotgraphview.h b/src/kgraphviz/dotgraphview.h
index 1bbb8e5..8fdb1b7 100644
--- a/src/kgraphviz/dotgraphview.h
+++ b/src/kgraphviz/dotgraphview.h
@@ -93,8 +93,6 @@ public:
   void setZoomFactor(double factor);
   
   void setLayoutCommand(const QString& command);
-    
-  const QString& dotFileName();
 
   void hideToolsWindows();
   double zoom() const;
diff --git a/src/part/simpleprintingcommand.cpp b/src/part/simpleprintingcommand.cpp
index c1a6c34..12b7f75 100644
--- a/src/part/simpleprintingcommand.cpp
+++ b/src/part/simpleprintingcommand.cpp
@@ -35,6 +35,7 @@
 // #include <kexi_version.h>
 
 #include <kgraphviz/dotgraphview.h>
+#include <kgraphviz/dotgraph.h>
 
 #include <kapplication.h>
 #include <kstandarddirs.h>
@@ -277,7 +278,7 @@ void KGVSimplePrintingCommand::slotShowPageSetupRequested()
     m_pageSetupDialog = new QDialog(0,"glurp",false);
     QMap<QString,QString> map;
     map["action"]=="pageSetup";
-    map["title"]==m_graphView->dotFileName();
+    map["title"]==m_graphView->graph()->dotFileName();
     QVBoxLayout *lyr = new QVBoxLayout(m_pageSetupDialog);
     KGVSimplePrintingPageSetup* sppsb = new KGVSimplePrintingPageSetup(this, m_graphView, m_pageSetupDialog, &map);
     if (m_previewWindow != 0)
diff --git a/src/part/simpleprintingpagesetup.cpp b/src/part/simpleprintingpagesetup.cpp
index 23505cc..bbe3a97 100644
--- a/src/part/simpleprintingpagesetup.cpp
+++ b/src/part/simpleprintingpagesetup.cpp
@@ -32,6 +32,7 @@
 #include "simpleprintpreviewwindow.h"
 
 #include <kgraphviz/dotgraphview.h>
+#include <kgraphviz/dotgraph.h>
 
 #include <kapplication.h>
 #include <kstandarddirs.h>
@@ -121,7 +122,7 @@ KGVSimplePrintingPageSetup::KGVSimplePrintingPageSetup(
       m_contents->headerTitleLineEdit->setText((*args)["title"]);
       QString origCaptionLabelText = m_contents->captionLabel->text();
       m_contents->captionLabel->setText( i18n("<qt><h2>Page Setup for Printing Graph \"%1\"</h2></qt>", 
-            KUrl::fromPathOrUrl(m_graphView->dotFileName()).fileName() 
+            KUrl::fromPathOrUrl(m_graphView->graph()->dotFileName()).fileName()
             ) );
 	}
 	connect(m_contents->headerTitleLineEdit,SIGNAL(textChanged(const QString&)), 


More information about the kgraphviewer-devel mailing list