Index: ParaView3/Qt/Components/pqMainWindowCore.cxx
===================================================================
RCS file: /cvsroot/ParaView3/ParaView3/Qt/Components/pqMainWindowCore.cxx,v
retrieving revision 1.286
diff -u -p -r1.286 pqMainWindowCore.cxx
--- ParaView3/Qt/Components/pqMainWindowCore.cxx	21 Aug 2008 13:46:27 -0000	1.286
+++ ParaView3/Qt/Components/pqMainWindowCore.cxx	24 Aug 2008 19:01:39 -0000
@@ -3552,6 +3552,14 @@ void pqMainWindowCore::applicationInitia
       this->createReaderOnActiveServer(files);
       }
     }
+
+  // check for --state option. (Bug #5711)
+  if (options->GetParaViewStateFileName())
+    {
+    QStringList files;
+    files.push_back(options->GetParaViewStateFileName());
+    this->onFileLoadServerState(files);
+    }
   
   pqSettings* settings = pqApplicationCore::instance()->settings();
   if (settings->contains("/EnableTooltips"))
Index: ParaView3/Servers/Common/vtkPVOptions.cxx
===================================================================
RCS file: /cvsroot/ParaView3/ParaView3/Servers/Common/vtkPVOptions.cxx,v
retrieving revision 1.43
diff -u -p -r1.43 vtkPVOptions.cxx
--- ParaView3/Servers/Common/vtkPVOptions.cxx	14 Apr 2008 13:02:55 -0000	1.43
+++ ParaView3/Servers/Common/vtkPVOptions.cxx	24 Aug 2008 19:01:40 -0000
@@ -83,6 +83,9 @@ vtkPVOptions::vtkPVOptions()
     }
   this->XMLParser = vtkPVOptionsXMLParser::New();
   this->XMLParser->SetPVOptions(this);
+
+  this->ParaViewStateFileName = 0; // Bug #5711
+
 }
 
 //----------------------------------------------------------------------------
@@ -203,6 +206,12 @@ void vtkPVOptions::Initialize()
 
   this->AddBooleanArgument("--version", "-V", &this->TellVersion, 
                            "Give the version number and exit.");
+
+  // add new Command Option for loading StateFile (Bug #5711)
+  this->AddArgument("--state", 0, &this->ParaViewStateFileName,
+                      "Load the specified statefile (.pvsm).",
+		      vtkPVOptions::PVCLIENT|vtkPVOptions::PARAVIEW);
+
 }
 
 //----------------------------------------------------------------------------
@@ -391,4 +400,7 @@ void vtkPVOptions::PrintSelf(ostream& os
     {
     os << indent << "Running to display software version.\n";
     }
+  
+  os << indent << "ParaViewStateFileName: " << (this->ParaViewStateFileName?this->ParaViewStateFileName:"(none)") << endl; // Bug #5711
+
 }
Index: ParaView3/Servers/Common/vtkPVOptions.h
===================================================================
RCS file: /cvsroot/ParaView3/ParaView3/Servers/Common/vtkPVOptions.h,v
retrieving revision 1.22
diff -u -p -r1.22 vtkPVOptions.h
--- ParaView3/Servers/Common/vtkPVOptions.h	4 Sep 2007 19:29:01 -0000	1.22
+++ ParaView3/Servers/Common/vtkPVOptions.h	24 Aug 2008 19:01:40 -0000
@@ -107,6 +107,8 @@ public:
   // Description:
   // Should this run print the version numbers and exit.
   vtkGetMacro(TellVersion, int);
+  
+  vtkGetStringMacro(ParaViewStateFileName); // Bug #5711
 
 protected:
 //BTX
@@ -163,6 +165,10 @@ protected:
   int ClientMode;
   int RenderServerMode;
 
+  // Command Option for loading StateFile (Bug #5711)
+  vtkSetStringMacro(ParaViewStateFileName);
+  char* ParaViewStateFileName;
+
 
 private:
   // Options:
