2009-02-25 09:15:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/**************************************************************************
  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  This  file  is  part  of  Qt  Creator  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
									
										
										
										
											2011-01-11 16:28:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* *  Copyright  ( c )  2011  Nokia  Corporation  and / or  its  subsidiary ( - ies ) .  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
									
										
										
										
											2011-04-13 08:42:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* *  Contact :  Nokia  Corporation  ( info @ qt . nokia . com )  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
									
										
										
										
											2008-12-02 14:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
									
										
										
										
											2009-02-25 09:15:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* *  GNU  Lesser  General  Public  License  Usage  
						 
					
						
							
								
									
										
										
										
											2008-12-02 14:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
									
										
										
										
											2011-04-13 08:42:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* *  This  file  may  be  used  under  the  terms  of  the  GNU  Lesser  General  Public  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  License  version  2.1  as  published  by  the  Free  Software  Foundation  and  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  appearing  in  the  file  LICENSE . LGPL  included  in  the  packaging  of  this  file .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  Please  review  the  following  information  to  ensure  the  GNU  Lesser  General  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  Public  License  version  2.1  requirements  will  be  met :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  http : //www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
  
						 
					
						
							
								
									
										
										
										
											2008-12-02 14:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
									
										
										
										
											2010-12-17 16:01:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* *  In  addition ,  as  a  special  exception ,  Nokia  gives  you  certain  additional  
						 
					
						
							
								
									
										
										
										
											2011-04-13 08:42:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* *  rights .  These  rights  are  described  in  the  Nokia  Qt  LGPL  Exception  
						 
					
						
							
								
									
										
										
										
											2010-12-17 16:01:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* *  version  1.1 ,  included  in  the  file  LGPL_EXCEPTION . txt  in  this  package .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
									
										
										
										
											2011-04-13 08:42:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* *  Other  Usage  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  Alternatively ,  this  file  may  be  used  in  accordance  with  the  terms  and  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  conditions  contained  in  a  signed  written  agreement  between  you  and  Nokia .  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
									
										
										
										
											2010-12-17 16:01:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* *  If  you  have  questions  regarding  the  use  of  this  file ,  please  contact  
						 
					
						
							
								
									
										
										
										
											2011-05-06 15:05:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* *  Nokia  at  info @ qt . nokia . com .  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								* *  
						 
					
						
							
								
									
										
										
										
											2009-02-25 09:15:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */  
						 
					
						
							
								
									
										
										
										
											2008-12-02 16:19:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "perforceplugin.h" 
  
						 
					
						
							
								
									
										
										
										
											2008-12-09 15:25:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "changenumberdialog.h" 
  
						 
					
						
							
								
									
										
										
										
											2008-12-09 15:25:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "pendingchangesdialog.h" 
  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "perforceconstants.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "perforceeditor.h" 
  
						 
					
						
							
								
									
										
										
										
											2008-12-09 15:25:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "perforcesubmiteditor.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "perforceversioncontrol.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "perforcechecker.h" 
  
						 
					
						
							
								
									
										
										
										
											2008-12-09 15:25:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "settingspage.h" 
  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-13 13:39:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <coreplugin/actionmanager/actionmanager.h> 
  
						 
					
						
							
								
									
										
										
										
											2010-03-18 10:59:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <coreplugin/actionmanager/actioncontainer.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <coreplugin/actionmanager/command.h> 
  
						 
					
						
							
								
									
										
										
										
											2010-11-02 16:53:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <coreplugin/uniqueidmanager.h> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <coreplugin/coreconstants.h> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-09 15:25:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <coreplugin/editormanager/editormanager.h> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <coreplugin/filemanager.h> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-09 15:25:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <coreplugin/icore.h> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <coreplugin/messagemanager.h> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-09 15:25:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <coreplugin/mimedatabase.h> 
  
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <locator/commandlocator.h> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-09 15:25:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <utils/qtcassert.h> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <utils/synchronousprocess.h> 
  
						 
					
						
							
								
									
										
										
										
											2009-05-15 15:41:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <utils/parameteraction.h> 
  
						 
					
						
							
								
									
										
										
										
											2011-03-30 15:15:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <utils/fileutils.h> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <vcsbase/basevcseditorfactory.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <vcsbase/basevcssubmiteditorfactory.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <vcsbase/vcsbaseeditor.h> 
  
						 
					
						
							
								
									
										
										
										
											2009-08-10 15:46:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <vcsbase/vcsbaseoutputwindow.h> 
  
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <vcsbase/vcsbaseeditorparameterwidget.h> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 17:14:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <QtCore/QtPlugin> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <QtCore/QDebug> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <QtCore/QDir> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-09 15:25:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <QtCore/QFileInfo> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <QtCore/QSettings> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <QtCore/QTextCodec> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-09 15:25:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <QtGui/QAction> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-09 15:25:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <QtGui/QFileDialog> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <QtGui/QMainWindow> 
  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <QtGui/QMenu> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <QtGui/QMessageBox> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  VCSBase : : VCSBaseEditorParameters  editorParameters [ ]  =  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    VCSBase : : RegularCommandOutput , 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 18:17:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Perforce : : Constants : : PERFORCE_COMMANDLOG_EDITOR_ID , 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-08 09:48:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Perforce : : Constants : : PERFORCE_COMMANDLOG_EDITOR_DISPLAY_NAME , 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Perforce : : Constants : : PERFORCE_COMMANDLOG_EDITOR_CONTEXT , 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    " application/vnd.nokia.text.scs_commandlog " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " scslog " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{    VCSBase : : LogOutput ,  
						 
					
						
							
								
									
										
										
										
											2010-01-07 18:17:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Perforce : : Constants : : PERFORCE_LOG_EDITOR_ID , 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-08 09:48:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Perforce : : Constants : : PERFORCE_LOG_EDITOR_DISPLAY_NAME , 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Perforce : : Constants : : PERFORCE_LOG_EDITOR_CONTEXT , 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    " application/vnd.nokia.text.scs_filelog " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " scsfilelog " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{     VCSBase : : AnnotateOutput ,  
						 
					
						
							
								
									
										
										
										
											2010-01-07 18:17:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     Perforce : : Constants : : PERFORCE_ANNOTATION_EDITOR_ID , 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-08 09:48:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     Perforce : : Constants : : PERFORCE_ANNOTATION_EDITOR_DISPLAY_NAME , 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     Perforce : : Constants : : PERFORCE_ANNOTATION_EDITOR_CONTEXT , 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    " application/vnd.nokia.text.scs_annotation " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    " scsannotate " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{    VCSBase : : DiffOutput ,  
						 
					
						
							
								
									
										
										
										
											2010-01-07 18:17:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Perforce : : Constants : : PERFORCE_DIFF_EDITOR_ID , 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-08 09:48:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Perforce : : Constants : : PERFORCE_DIFF_EDITOR_DISPLAY_NAME , 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Perforce : : Constants : : PERFORCE_DIFF_EDITOR_CONTEXT , 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    " text/x-patch " , " diff " } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Utility to find a parameter set by type
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  inline  const  VCSBase : : VCSBaseEditorParameters  * findType ( int  ie )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  VCSBase : : EditorContentType  et  =  static_cast < VCSBase : : EditorContentType > ( ie ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-21 16:02:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return   VCSBase : : VCSBaseEditorWidget : : findType ( editorParameters ,  sizeof ( editorParameters ) / sizeof ( VCSBase : : VCSBaseEditorParameters ) ,  et ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  inline  QString  debugCodec ( const  QTextCodec  * c )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  c  ?  QString : : fromAscii ( c - > name ( ) )  :  QString : : fromAscii ( " Null codec " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Ensure adding "..." to relative paths which is p4's convention
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// for the current directory
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  inline  QStringList  perforceRelativeFileArguments ( const  QStringList  & args )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( args . isEmpty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  QStringList ( QLatin1String ( " ... " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( args . size ( )  = =  1 ,  return  QStringList ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QStringList  p4Args  =  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p4Args . front ( )  + =  QLatin1String ( " /... " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  p4Args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  inline  QStringList  perforceRelativeProjectDirectory ( const  VCSBase : : VCSBasePluginState  & s )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  perforceRelativeFileArguments ( s . relativeCurrentProject ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Clean user setting off diff-binary for 'p4 resolve' and 'p4 diff'.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  inline  QProcessEnvironment  overrideDiffEnvironmentVariable ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QProcessEnvironment  rc  =  QProcessEnvironment : : systemEnvironment ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    rc . remove ( QLatin1String ( " P4DIFF " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  rc ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-10 11:02:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-10 15:19:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  const  char  CMD_ID_PERFORCE_MENU [ ]  =  " Perforce.Menu " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_EDIT [ ]  =  " Perforce.Edit " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_ADD [ ]  =  " Perforce.Add " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_DELETE_FILE [ ]  =  " Perforce.Delete " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_OPENED [ ]  =  " Perforce.Opened " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_PROJECTLOG [ ]  =  " Perforce.ProjectLog " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_REPOSITORYLOG [ ]  =  " Perforce.RepositoryLog " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_REVERT [ ]  =  " Perforce.Revert " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_DIFF_CURRENT [ ]  =  " Perforce.DiffCurrent " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_DIFF_PROJECT [ ]  =  " Perforce.DiffProject " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_UPDATE_PROJECT [ ]  =  " Perforce.UpdateProject " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_REVERT_PROJECT [ ]  =  " Perforce.RevertProject " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_REVERT_UNCHANGED_PROJECT [ ]  =  " Perforce.RevertUnchangedProject " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_DIFF_ALL [ ]  =  " Perforce.DiffAll " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_RESOLVE [ ]  =  " Perforce.Resolve " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_SUBMIT [ ]  =  " Perforce.Submit " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_PENDING_CHANGES [ ]  =  " Perforce.PendingChanges " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_DESCRIBE [ ]  =  " Perforce.Describe " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_ANNOTATE_CURRENT [ ]  =  " Perforce.AnnotateCurrent " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_ANNOTATE [ ]  =  " Perforce.Annotate " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_FILELOG_CURRENT [ ]  =  " Perforce.FilelogCurrent " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_FILELOG [ ]  =  " Perforce.Filelog " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_UPDATEALL [ ]  =  " Perforce.UpdateAll " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_SEPARATOR1 [ ]  =  " Perforce.Separator1 " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_SEPARATOR2 [ ]  =  " Perforce.Separator2 " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  char  CMD_ID_SEPARATOR3 [ ]  =  " Perforce.Separator3 " ;  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// PerforcePlugin
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								////
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								namespace  Perforce  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								namespace  Internal  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								PerforceResponse : : PerforceResponse ( )  :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    error ( true ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    exitCode ( - 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								PerforcePlugin  * PerforcePlugin : : m_perforcePluginInstance  =  NULL ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								PerforcePlugin : : PerforcePlugin ( )  :  
						 
					
						
							
								
									
										
										
										
											2010-01-07 18:17:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    VCSBase : : VCSBasePlugin ( QLatin1String ( Constants : : PERFORCE_SUBMIT_EDITOR_ID ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    m_editAction ( 0 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_addAction ( 0 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deleteAction ( 0 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_openedAction ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_revertFileAction ( 0 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_diffFileAction ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    m_diffProjectAction ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_updateProjectAction ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_revertProjectAction ( 0 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_revertUnchangedAction ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    m_diffAllAction ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_submitProjectAction ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    m_pendingAction ( 0 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_describeAction ( 0 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_annotateCurrentAction ( 0 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_annotateAction ( 0 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_filelogCurrentAction ( 0 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_filelogAction ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 11:33:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_logProjectAction ( 0 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_logRepositoryAction ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-20 10:16:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_submitCurrentLogAction ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_updateAllAction ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-20 10:16:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_submitActionTriggered ( false ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_diffSelectedFiles ( 0 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_undoAction ( 0 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-08 14:26:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_redoAction ( 0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  const  VCSBase : : VCSBaseSubmitEditorParameters  submitParameters  =  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    Perforce : : Constants : : SUBMIT_MIMETYPE , 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 18:17:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Perforce : : Constants : : PERFORCE_SUBMIT_EDITOR_ID , 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-08 09:48:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Perforce : : Constants : : PERFORCE_SUBMIT_EDITOR_DISPLAY_NAME , 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Perforce : : Constants : : PERFORCESUBMITEDITOR_CONTEXT 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  inline  Core : : Command  * createSeparator ( QObject  * parent ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                             Core : : ActionManager  * ami , 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-25 12:56:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                             const  char  * id , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                             const  Core : : Context  & globalcontext ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QAction  * tmpaction  =  new  QAction ( parent ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    tmpaction - > setSeparator ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  ami - > registerAction ( tmpaction ,  id ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-06-25 12:56:16 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  PerforcePlugin : : initialize ( const  QStringList  &  /* arguments */ ,  QString  * errorMessage )  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    typedef  VCSBase : : VCSEditorFactory < PerforceEditor >  PerforceEditorFactory ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    typedef  VCSBase : : VCSSubmitEditorFactory < PerforceSubmitEditor >  PerforceSubmitEditorFactory ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-04 21:07:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    initializeVcs ( new  PerforceVersionControl ( this ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-08 14:26:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:52:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : ICore  * core  =  Core : : ICore : : instance ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! core - > mimeDatabase ( ) - > addMimeTypes ( QLatin1String ( " :/trolltech.perforce/Perforce.mimetypes.xml " ) ,  errorMessage ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_perforcePluginInstance  =  this ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:52:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( QSettings  * settings  =  core - > settings ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        m_settings . fromSettings ( settings ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-08-10 15:46:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    addAutoReleasedObject ( new  SettingsPage ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Editor factories
 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-10 15:46:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    addAutoReleasedObject ( new  PerforceSubmitEditorFactory ( & submitParameters ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    static  const  char  * describeSlot  =  SLOT ( describe ( QString , QString ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  int  editorCount  =  sizeof ( editorParameters ) / sizeof ( VCSBase : : VCSBaseEditorParameters ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-10 15:46:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    for  ( int  i  =  0 ;  i  <  editorCount ;  i + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        addAutoReleasedObject ( new  PerforceEditorFactory ( editorParameters  +  i ,  this ,  describeSlot ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QString  prefix  =  QLatin1String ( " p4 " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_commandLocator  =  new  Locator : : CommandLocator ( QLatin1String ( " Perforce " ) ,  prefix ,  prefix ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    addAutoReleasedObject ( m_commandLocator ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    //register actions
 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:52:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : ActionManager  * am  =  Core : : ICore : : instance ( ) - > actionManager ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-14 12:39:59 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : ActionContainer  * mtools  = 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        am - > actionContainer ( Core : : Constants : : M_TOOLS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-14 12:39:59 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : ActionContainer  * mperforce  = 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-10 14:13:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        am - > createMenu ( Core : : Id ( CMD_ID_PERFORCE_MENU ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    mperforce - > menu ( ) - > setTitle ( tr ( " &Perforce " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mtools - > addMenu ( mperforce ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-08 14:26:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_menuAction  =  mperforce - > menu ( ) - > menuAction ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-06-28 14:30:03 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : Context  globalcontext ( Core : : Constants : : C_GLOBAL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-25 17:37:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : Context  perforcesubmitcontext ( Constants : : PERFORCESUBMITEDITOR_CONTEXT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-14 13:17:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : Command  * command ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_diffFileAction  =  new  Utils : : ParameterAction ( tr ( " Diff Current File " ) ,  tr ( " Diff  \" %1 \" " ) ,  Utils : : ParameterAction : : EnabledWithParameter ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_diffFileAction ,  CMD_ID_DIFF_CURRENT ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultText ( tr ( " Diff Current File " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_diffFileAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( diffCurrentFile ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_annotateCurrentAction  =  new  Utils : : ParameterAction ( tr ( " Annotate Current File " ) ,  tr ( " Annotate  \" %1 \" " ) ,  Utils : : ParameterAction : : EnabledWithParameter ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_annotateCurrentAction ,  CMD_ID_ANNOTATE_CURRENT ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultText ( tr ( " Annotate Current File " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_annotateCurrentAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( annotateCurrentFile ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_filelogCurrentAction  =  new  Utils : : ParameterAction ( tr ( " Filelog Current File " ) ,  tr ( " Filelog  \" %1 \" " ) ,  Utils : : ParameterAction : : EnabledWithParameter ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_filelogCurrentAction ,  CMD_ID_FILELOG_CURRENT ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultKeySequence ( QKeySequence ( tr ( " Alt+P,Alt+F " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultText ( tr ( " Filelog Current File " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_filelogCurrentAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( filelogCurrentFile ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( createSeparator ( this ,  am ,  " Perforce.Sep.Edit " ,  globalcontext ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-05 11:06:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_editAction  =  new  Utils : : ParameterAction ( tr ( " Edit " ) ,  tr ( " Edit  \" %1 \" " ) ,  Utils : : ParameterAction : : EnabledWithParameter ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_editAction ,  CMD_ID_EDIT ,  globalcontext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-14 13:17:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultKeySequence ( QKeySequence ( tr ( " Alt+P,Alt+E " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultText ( tr ( " Edit File " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_editAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( openCurrentFile ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-05 11:06:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_addAction  =  new  Utils : : ParameterAction ( tr ( " Add " ) ,  tr ( " Add  \" %1 \" " ) ,  Utils : : ParameterAction : : EnabledWithParameter ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_addAction ,  CMD_ID_ADD ,  globalcontext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-14 13:17:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultKeySequence ( QKeySequence ( tr ( " Alt+P,Alt+A " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultText ( tr ( " Add File " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_addAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( addCurrentFile ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 15:22:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_deleteAction  =  new  Utils : : ParameterAction ( tr ( " Delete... " ) ,  tr ( " Delete  \" %1 \" ... " ) ,  Utils : : ParameterAction : : EnabledWithParameter ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_deleteAction ,  CMD_ID_DELETE_FILE ,  globalcontext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-14 13:17:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultText ( tr ( " Delete File " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 15:22:17 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    connect ( m_deleteAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( promptToDeleteCurrentFile ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_revertFileAction  =  new  Utils : : ParameterAction ( tr ( " Revert " ) ,  tr ( " Revert  \" %1 \" " ) ,  Utils : : ParameterAction : : EnabledWithParameter ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_revertFileAction ,  CMD_ID_REVERT ,  globalcontext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-14 13:17:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultKeySequence ( QKeySequence ( tr ( " Alt+P,Alt+R " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultText ( tr ( " Revert File " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    connect ( m_revertFileAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( revertCurrentFile ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    mperforce - > addAction ( createSeparator ( this ,  am ,  " Perforce.Sep.Project " ,  globalcontext ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QString  diffProjectDefaultText  =  tr ( " Diff Current Project/Session " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-05 11:06:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_diffProjectAction  =  new  Utils : : ParameterAction ( diffProjectDefaultText ,  tr ( " Diff Project  \" %1 \" " ) ,  Utils : : ParameterAction : : AlwaysEnabled ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_diffProjectAction ,  CMD_ID_DIFF_PROJECT ,  globalcontext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-14 13:17:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultKeySequence ( QKeySequence ( tr ( " Alt+P,Alt+D " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command - > setDefaultText ( diffProjectDefaultText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    connect ( m_diffProjectAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( diffCurrentProject ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 14:52:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_logProjectAction  =  new  Utils : : ParameterAction ( tr ( " Log Project " ) ,  tr ( " Log Project  \" %1 \" " ) ,  Utils : : ParameterAction : : EnabledWithParameter ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 11:33:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_logProjectAction ,  CMD_ID_PROJECTLOG ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_logProjectAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( logProject ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 11:33:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_submitProjectAction  =  new  Utils : : ParameterAction ( tr ( " Submit Project " ) ,  tr ( " Submit Project  \" %1 \" " ) ,  Utils : : ParameterAction : : EnabledWithParameter ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_submitProjectAction ,  CMD_ID_SUBMIT ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultKeySequence ( QKeySequence ( tr ( " Alt+P,Alt+S " ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    connect ( m_submitProjectAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( startSubmitProject ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QString  updateProjectDefaultText  =  tr ( " Update Current Project " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-05 11:06:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_updateProjectAction  =  new  Utils : : ParameterAction ( updateProjectDefaultText ,  tr ( " Update Project  \" %1 \" " ) ,  Utils : : ParameterAction : : AlwaysEnabled ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_updateProjectAction ,  CMD_ID_UPDATE_PROJECT ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultText ( updateProjectDefaultText ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_updateProjectAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( updateCurrentProject ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_revertUnchangedAction  =  new  Utils : : ParameterAction ( tr ( " Revert Unchanged " ) ,  tr ( " Revert Unchanged Files of Project  \" %1 \" " ) ,  Utils : : ParameterAction : : EnabledWithParameter ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_revertUnchangedAction ,  CMD_ID_REVERT_UNCHANGED_PROJECT ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_revertUnchangedAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( revertUnchangedCurrentProject ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_revertProjectAction  =  new  Utils : : ParameterAction ( tr ( " Revert Project " ) ,  tr ( " Revert Project  \" %1 \" " ) ,  Utils : : ParameterAction : : EnabledWithParameter ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_revertProjectAction ,  CMD_ID_REVERT_PROJECT ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_revertProjectAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( revertCurrentProject ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    mperforce - > addAction ( createSeparator ( this ,  am ,  " Perforce.Sep.Repository " ,  globalcontext ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_diffAllAction  =  new  QAction ( tr ( " Diff Opened Files " ) ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_diffAllAction ,  CMD_ID_DIFF_ALL ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_diffAllAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( diffAllOpened ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_openedAction  =  new  QAction ( tr ( " Opened " ) ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_openedAction ,  CMD_ID_OPENED ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command - > setDefaultKeySequence ( QKeySequence ( tr ( " Alt+P,Alt+O " ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_openedAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( printOpenedFileList ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_logRepositoryAction  =  new  QAction ( tr ( " Repository Log " ) ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_logRepositoryAction ,  CMD_ID_REPOSITORYLOG ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_logRepositoryAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( logRepository ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_pendingAction  =  new  QAction ( tr ( " Pending Changes... " ) ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_pendingAction ,  CMD_ID_PENDING_CHANGES ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_pendingAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( printPendingChanges ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_updateAllAction  =  new  QAction ( tr ( " Update All " ) ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_updateAllAction ,  CMD_ID_UPDATEALL ,  globalcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( m_updateAllAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( updateAll ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_commandLocator - > appendCommand ( command ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 17:17:16 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    mperforce - > addAction ( createSeparator ( this ,  am ,  " Perforce.Sep.Dialogs " ,  globalcontext ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    m_describeAction  =  new  QAction ( tr ( " Describe... " ) ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_describeAction ,  CMD_ID_DESCRIBE ,  globalcontext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    connect ( m_describeAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( describeChange ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_annotateAction  =  new  QAction ( tr ( " Annotate... " ) ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_annotateAction ,  CMD_ID_ANNOTATE ,  globalcontext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    connect ( m_annotateAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( annotate ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_filelogAction  =  new  QAction ( tr ( " Filelog... " ) ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_filelogAction ,  CMD_ID_FILELOG ,  globalcontext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    connect ( m_filelogAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( filelog ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    mperforce - > addAction ( command ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 17:05:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_submitCurrentLogAction  =  new  QAction ( VCSBase : : VCSBaseSubmitEditor : : submitIcon ( ) ,  tr ( " Submit " ) ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_submitCurrentLogAction ,  Constants : : SUBMIT_CURRENT ,  perforcesubmitcontext ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-19 10:04:21 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    command - > setAttribute ( Core : : Command : : CA_UpdateText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    connect ( m_submitCurrentLogAction ,  SIGNAL ( triggered ( ) ) ,  this ,  SLOT ( submitCurrentLog ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-03 14:58:43 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_diffSelectedFiles  =  new  QAction ( VCSBase : : VCSBaseSubmitEditor : : diffIcon ( ) ,  tr ( " Diff &Selected Files " ) ,  this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_diffSelectedFiles ,  Constants : : DIFF_SELECTED ,  perforcesubmitcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_undoAction  =  new  QAction ( tr ( " &Undo " ) ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_undoAction ,  Core : : Constants : : UNDO ,  perforcesubmitcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_redoAction  =  new  QAction ( tr ( " &Redo " ) ,  this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    command  =  am - > registerAction ( m_redoAction ,  Core : : Constants : : REDO ,  perforcesubmitcontext ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : extensionsInitialized ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-04-26 09:12:58 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    VCSBase : : VCSBasePlugin : : extensionsInitialized ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    getTopLevel ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : openCurrentFile ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBasePluginState  state  =  currentState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( state . hasFile ( ) ,  return ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    vcsOpen ( state . currentFileTopLevel ( ) ,  state . relativeCurrentFile ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : addCurrentFile ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBasePluginState  state  =  currentState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( state . hasFile ( ) ,  return ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    vcsAdd ( state . currentFileTopLevel ( ) ,  state . relativeCurrentFile ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : revertCurrentFile ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBasePluginState  state  =  currentState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( state . hasFile ( ) ,  return ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-21 16:02:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QTextCodec  * codec  =  VCSBase : : VCSBaseEditorWidget : : getCodec ( state . currentFile ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    QStringList  args ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " diff " )  < <  QLatin1String ( " -sa " )  < <  state . relativeCurrentFile ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    PerforceResponse  result  =  runP4Cmd ( state . currentFileTopLevel ( ) ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                       RunFullySynchronous | CommandToWindow | StdErrToWindow | ErrorToWindow , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                       QStringList ( ) ,  QByteArray ( ) ,  codec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( result . error ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // "foo.cpp - file(s) not opened on this client."
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( result . stdOut . isEmpty ( )  | |  result . stdOut . contains ( QLatin1String ( "  -  " ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  bool  doNotRevert  =  QMessageBox : : warning ( 0 ,  tr ( " p4 revert " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                             tr ( " The file has been changed. Do you want to revert it? " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                             QMessageBox : : Yes ,  QMessageBox : : No )  = =  QMessageBox : : No ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( doNotRevert ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : FileChangeBlocker  fcb ( state . currentFile ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " revert " )  < <  state . relativeCurrentFile ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    PerforceResponse  result2  =  runP4Cmd ( state . currentFileTopLevel ( ) ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                        CommandToWindow | StdOutToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-11 14:32:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ! result2 . error ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        perforceVersionControl ( ) - > emitFilesChanged ( QStringList ( state . currentFile ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : diffCurrentFile ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBasePluginState  state  =  currentState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( state . hasFile ( ) ,  return ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p4Diff ( state . currentFileTopLevel ( ) ,  QStringList ( state . relativeCurrentFile ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : diffCurrentProject ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBasePluginState  state  =  currentState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( state . hasProject ( ) ,  return ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p4Diff ( state . currentProjectTopLevel ( ) ,  perforceRelativeProjectDirectory ( state ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : diffAllOpened ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    p4Diff ( m_settings . topLevel ( ) ,  QStringList ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  PerforcePlugin : : updateCurrentProject ( )  
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBasePluginState  state  =  currentState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( state . hasProject ( ) ,  return ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    updateCheckout ( state . currentProjectTopLevel ( ) ,  perforceRelativeProjectDirectory ( state ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  PerforcePlugin : : updateAll ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    updateCheckout ( m_settings . topLevel ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : revertCurrentProject ( )  
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBasePluginState  state  =  currentState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( state . hasProject ( ) ,  return ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  QString  msg  =  tr ( " Do you want to revert all changes to the project  \" %1 \" ? " ) . arg ( state . currentProjectName ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( QMessageBox : : warning ( 0 ,  tr ( " p4 revert " ) ,  msg ,  QMessageBox : : Yes ,  QMessageBox : : No )  = =  QMessageBox : : No ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    revertProject ( state . currentProjectTopLevel ( ) ,  perforceRelativeProjectDirectory ( state ) ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  PerforcePlugin : : revertUnchangedCurrentProject ( )  
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // revert -a.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBasePluginState  state  =  currentState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( state . hasProject ( ) ,  return ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    revertProject ( state . currentProjectTopLevel ( ) ,  perforceRelativeProjectDirectory ( state ) ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  PerforcePlugin : : revertProject ( const  QString  & workingDir ,  const  QStringList  & pathArgs ,  bool  unchangedOnly )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QStringList  args ( QLatin1String ( " revert " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( unchangedOnly ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        args . push_back ( QLatin1String ( " -a " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args . append ( pathArgs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse  resp  =  runP4Cmd ( workingDir ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                           RunFullySynchronous | CommandToWindow | StdOutToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  ! resp . error ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : updateCheckout ( const  QString  & workingDir ,  const  QStringList  & dirs )  
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QStringList  args ( QLatin1String ( " sync " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args . append ( dirs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  PerforceResponse  resp  =  runP4Cmd ( workingDir ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                           CommandToWindow | StdOutToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( dirs . empty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( ! workingDir . isEmpty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            perforceVersionControl ( ) - > emitRepositoryChanged ( workingDir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  QChar  slash  =  QLatin1Char ( ' / ' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-11 14:32:54 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        foreach ( const  QString  & dir ,  dirs ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            perforceVersionControl ( ) - > emitRepositoryChanged ( workingDir  +  slash  +  dir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : printOpenedFileList ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-15 14:20:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  PerforceResponse  perforceResponse 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            =  runP4Cmd ( m_settings . topLevel ( ) ,  QStringList ( QLatin1String ( " opened " ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                       CommandToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( perforceResponse . error  | |  perforceResponse . stdOut . isEmpty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // reformat "//depot/file.cpp#1 - description" into "file.cpp # - description"
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // for context menu opening to work. This produces absolute paths, then.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    VCSBase : : VCSBaseOutputWindow  * outWin  =  VCSBase : : VCSBaseOutputWindow : : instance ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QString  errorMessage ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QString  mapped ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  QChar  delimiter  =  QLatin1Char ( ' # ' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    foreach  ( const  QString  & line ,  perforceResponse . stdOut . split ( QLatin1Char ( ' \n ' ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mapped . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  int  delimiterPos  =  line . indexOf ( delimiter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( delimiterPos  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            mapped  =  fileNameFromPerforceName ( line . left ( delimiterPos ) ,  true ,  & errorMessage ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( mapped . isEmpty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            outWin - > appendSilently ( line ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            outWin - > appendSilently ( mapped  +  QLatin1Char ( '   ' )  +  line . mid ( delimiterPos ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    outWin - > popup ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  PerforcePlugin : : startSubmitProject ( )  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-05-27 16:17:24 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( VCSBase : : VCSBaseSubmitEditor : : raiseSubmitEditor ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 12:23:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( isCommitEditorOpen ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-10 15:46:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        VCSBase : : VCSBaseOutputWindow : : instance ( ) - > appendWarning ( tr ( " Another submit is currently executed. " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBasePluginState  state  =  currentState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( state . hasProject ( ) ,  return ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Revert all unchanged files.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! revertProject ( state . currentProjectTopLevel ( ) ,  perforceRelativeProjectDirectory ( state ) ,  true ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Start a change
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QStringList  args ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " change " )  < <  QLatin1String ( " -o " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    PerforceResponse  result  =  runP4Cmd ( state . currentProjectTopLevel ( ) ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                       RunFullySynchronous | CommandToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( result . error )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 12:23:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        cleanCommitMessageFile ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-30 15:15:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Utils : : TempFileSaver  saver ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    saver . setAutoRemove ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    saver . write ( result . stdOut . toAscii ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! saver . finalize ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        VCSBase : : VCSBaseOutputWindow : : instance ( ) - > appendError ( saver . errorString ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        cleanCommitMessageFile ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_commitMessageFileName  =  saver . fileName ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    args . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " fstat " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args . append ( perforceRelativeProjectDirectory ( state ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    PerforceResponse  fstatResult  =  runP4Cmd ( state . currentProjectTopLevel ( ) ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                            RunFullySynchronous | CommandToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( fstatResult . error )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 12:23:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        cleanCommitMessageFile ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QStringList  fstatLines  =  fstatResult . stdOut . split ( QLatin1Char ( ' \n ' ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    QStringList  depotFileNames ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    foreach  ( const  QString  & line ,  fstatLines )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-01 12:43:56 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( line . startsWith ( QLatin1String ( " ... depotFile " ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            depotFileNames . append ( line . mid ( 14 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( depotFileNames . isEmpty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-10 15:46:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        VCSBase : : VCSBaseOutputWindow : : instance ( ) - > appendWarning ( tr ( " Project has no files " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 12:23:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        cleanCommitMessageFile ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 12:23:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    openPerforceSubmitEditor ( m_commitMessageFileName ,  depotFileNames ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Core : : IEditor  * PerforcePlugin : : openPerforceSubmitEditor ( const  QString  & fileName ,  const  QStringList  & depotFileNames )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-01-21 15:52:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : EditorManager  * editorManager  =  Core : : EditorManager : : instance ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-14 15:15:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : IEditor  * editor  =  editorManager - > openEditor ( fileName ,  Constants : : PERFORCE_SUBMIT_EDITOR_ID , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                      Core : : EditorManager : : ModeSwitch ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-25 16:08:52 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    PerforceSubmitEditor  * submitEditor  =  static_cast < PerforceSubmitEditor * > ( editor ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    submitEditor - > restrictToProjectFiles ( depotFileNames ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-13 14:06:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    submitEditor - > registerActions ( m_undoAction ,  m_redoAction ,  m_submitCurrentLogAction ,  m_diffSelectedFiles ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    connect ( submitEditor ,  SIGNAL ( diffSelectedFiles ( QStringList ) ) ,  this ,  SLOT ( slotSubmitDiff ( QStringList ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 10:56:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    submitEditor - > setCheckScriptWorkingDirectory ( m_commitWorkingDirectory ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    return  editor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : printPendingChanges ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    qApp - > setOverrideCursor ( Qt : : WaitCursor ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:52:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    PendingChangesDialog  dia ( pendingChangesData ( ) ,  Core : : ICore : : instance ( ) - > mainWindow ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    qApp - > restoreOverrideCursor ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( dia . exec ( )  = =  QDialog : : Accepted )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-04 16:24:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  int  i  =  dia . changeNumber ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        QStringList  args ( QLatin1String ( " submit " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        args  < <  QLatin1String ( " -c " )  < <  QString : : number ( i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        runP4Cmd ( m_settings . topLevel ( ) ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 CommandToWindow | StdOutToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : describeChange ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ChangeNumberDialog  dia ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( dia . exec ( )  = =  QDialog : : Accepted  & &  dia . number ( )  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        describe ( QString ( ) ,  QString : : number ( dia . number ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : annotateCurrentFile ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBasePluginState  state  =  currentState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( state . hasFile ( ) ,  return ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    annotate ( state . currentFileTopLevel ( ) ,  state . relativeCurrentFile ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : annotate ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QString  file  =  QFileDialog : : getOpenFileName ( 0 ,  tr ( " p4 annotate " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! file . isEmpty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  QFileInfo  fi ( file ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        annotate ( fi . absolutePath ( ) ,  fi . fileName ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-19 17:22:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  PerforcePlugin : : vcsAnnotate ( const  QString  & file ,  const  QString  & revision ,  int  lineNumber )  
						 
					
						
							
								
									
										
										
										
											2010-01-06 17:24:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  QFileInfo  fi ( file ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    annotate ( fi . absolutePath ( ) ,  fi . fileName ( ) ,  revision ,  lineNumber ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : annotate ( const  QString  & workingDir ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                              const  QString  & fileName , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                              const  QString  & changeList  /* = QString() */ , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                              int  lineNumber  /* = -1 */ ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QStringList  files  =  QStringList ( fileName ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-21 16:02:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QTextCodec  * codec  =  VCSBase : : VCSBaseEditorWidget : : getCodec ( workingDir ,  files ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  QString  id  =  VCSBase : : VCSBaseEditorWidget : : getTitleId ( workingDir ,  files ,  changeList ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  QString  source  =  VCSBase : : VCSBaseEditorWidget : : getSource ( workingDir ,  files ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    QStringList  args ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-06 17:24:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " annotate " )  < <  QLatin1String ( " -cqi " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( changeList . isEmpty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        args  < <  fileName ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        args  < <  ( fileName  +  QLatin1Char ( ' @ ' )  +  changeList ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  PerforceResponse  result  =  runP4Cmd ( workingDir ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                             CommandToWindow | StdErrToWindow | ErrorToWindow , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                             QStringList ( ) ,  QByteArray ( ) ,  codec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( ! result . error )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-06 17:24:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( lineNumber  <  1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-21 16:02:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            lineNumber  =  VCSBase : : VCSBaseEditorWidget : : lineNumberOfCurrentEditor ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        const  QFileInfo  fi ( fileName ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        Core : : IEditor  * ed  =  showOutputInEditor ( tr ( " p4 annotate %1 " ) . arg ( id ) , 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-06 17:24:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                               result . stdOut ,  VCSBase : : AnnotateOutput , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                               source ,  codec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-21 16:02:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        VCSBase : : VCSBaseEditorWidget : : gotoLineOfEditor ( ed ,  lineNumber ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : filelogCurrentFile ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBasePluginState  state  =  currentState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( state . hasFile ( ) ,  return ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 11:33:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    filelog ( state . currentFileTopLevel ( ) ,  QStringList ( state . relativeCurrentFile ( ) ) ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : filelog ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QString  file  =  QFileDialog : : getOpenFileName ( 0 ,  tr ( " p4 filelog " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! file . isEmpty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  QFileInfo  fi ( file ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        filelog ( fi . absolutePath ( ) ,  QStringList ( fi . fileName ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 11:33:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  PerforcePlugin : : logProject ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBasePluginState  state  =  currentState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( state . hasProject ( ) ,  return ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    filelog ( state . currentProjectTopLevel ( ) ,  perforceRelativeFileArguments ( state . relativeCurrentProject ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : logRepository ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBasePluginState  state  =  currentState ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( state . hasTopLevel ( ) ,  return ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    filelog ( state . topLevel ( ) ,  perforceRelativeFileArguments ( QStringList ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : filelog ( const  QString  & workingDir ,  const  QStringList  & fileNames ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                             bool  enableAnnotationContextMenu ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-02-21 16:02:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QString  id  =  VCSBase : : VCSBaseEditorWidget : : getTitleId ( workingDir ,  fileNames ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTextCodec  * codec  =  VCSBase : : VCSBaseEditorWidget : : getCodec ( workingDir ,  fileNames ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    QStringList  args ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " filelog " )  < <  QLatin1String ( " -li " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 11:33:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( m_settings . logCount ( )  >  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        args  < <  QLatin1String ( " -m " )  < <  QString : : number ( m_settings . logCount ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    args . append ( fileNames ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse  result  =  runP4Cmd ( workingDir ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                             CommandToWindow | StdErrToWindow | ErrorToWindow , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                             QStringList ( ) ,  QByteArray ( ) ,  codec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 11:33:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ! result . error )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-21 16:02:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        const  QString  source  =  VCSBase : : VCSBaseEditorWidget : : getSource ( workingDir ,  fileNames ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 11:33:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        Core : : IEditor  * editor  =  showOutputInEditor ( tr ( " p4 filelog %1 " ) . arg ( id ) ,  result . stdOut , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                VCSBase : : LogOutput ,  source ,  codec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( enableAnnotationContextMenu ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-21 16:02:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            VCSBase : : VCSBaseEditorWidget : : getVcsBaseEditor ( editor ) - > setFileLogAnnotateEnabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 11:33:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-08 14:26:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  PerforcePlugin : : updateActions ( VCSBase : : VCSBasePlugin : : ActionState  as )  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-02-12 16:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ! enableMenuAction ( as ,  m_menuAction ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        m_commandLocator - > setEnabled ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return ;         
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  bool  hasTopLevel  =  currentState ( ) . hasTopLevel ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_commandLocator - > setEnabled ( hasTopLevel ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_logRepositoryAction - > setEnabled ( hasTopLevel ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 11:33:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QString  fileName  =  currentState ( ) . currentFileName ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_editAction - > setParameter ( fileName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_addAction - > setParameter ( fileName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_deleteAction - > setParameter ( fileName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_revertFileAction - > setParameter ( fileName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_diffFileAction - > setParameter ( fileName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_annotateCurrentAction - > setParameter ( fileName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_filelogCurrentAction - > setParameter ( fileName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  QString  projectName  =  currentState ( ) . currentProjectName ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 11:33:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_logProjectAction - > setParameter ( projectName ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_updateProjectAction - > setParameter ( projectName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_diffProjectAction - > setParameter ( projectName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_submitProjectAction - > setParameter ( projectName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_revertProjectAction - > setParameter ( projectName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_revertUnchangedAction - > setParameter ( projectName ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    m_diffAllAction - > setEnabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_openedAction - > setEnabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_describeAction - > setEnabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_annotateAction - > setEnabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_filelogAction - > setEnabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_pendingAction - > setEnabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-13 14:48:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_updateAllAction - > setEnabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-05-20 16:24:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  PerforcePlugin : : managesDirectory ( const  QString  & directory ,  QString  * topLevel  /* = 0 */ )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  bool  rc  =  managesDirectoryFstat ( directory ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( topLevel )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( rc )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            * topLevel  =  m_settings . topLevelSymLinkTarget ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            topLevel - > clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  rc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								bool  PerforcePlugin : : managesDirectoryFstat ( const  QString  & directory )  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ! m_settings . isValid ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-19 16:11:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // Cached?
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  ManagedDirectoryCache : : const_iterator  cit  =  m_managedDirectoryCache . constFind ( directory ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( cit  ! =  m_managedDirectoryCache . constEnd ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  cit . value ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Determine value and insert into cache
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    bool  managed  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    do  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // Quick check: Must be at or below top level and not "../../other_path"
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  QStringList  relativeDirArgs  =  m_settings . relativeToTopLevelArguments ( directory ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( ! relativeDirArgs . empty ( )  & &  relativeDirArgs . front ( ) . startsWith ( QLatin1String ( " .. " ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // Is it actually managed by perforce?
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        QStringList  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        args  < <  QLatin1String ( " fstat " )  < <  QLatin1String ( " -m1 " )  < <  perforceRelativeFileArguments ( relativeDirArgs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  PerforceResponse  result  =  runP4Cmd ( m_settings . topLevel ( ) ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                 RunFullySynchronous ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        managed  =  result . stdOut . contains ( " depotFile " )  | |  result . stdErr . contains ( " ... - no such file(s) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  while ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_managedDirectoryCache . insert ( directory ,  managed ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  managed ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  PerforcePlugin : : vcsOpen ( const  QString  & workingDir ,  const  QString  & fileName )  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( Perforce : : Constants : : debug ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        qDebug ( )  < <  " PerforcePlugin::vcsOpen "  < <  workingDir  < <  fileName ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QStringList  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " edit " )  < <  QDir : : toNativeSeparators ( fileName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse  result  =  runP4Cmd ( workingDir ,  args , 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-04 16:24:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                       CommandToWindow | StdOutToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    return  ! result . error ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  PerforcePlugin : : vcsAdd ( const  QString  & workingDir ,  const  QString  & fileName )  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QStringList  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " add " )  < <  fileName ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse  result  =  runP4Cmd ( workingDir ,  args , 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-04 16:24:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                       CommandToWindow | StdOutToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    return  ! result . error ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  PerforcePlugin : : vcsDelete ( const  QString  & workingDir ,  const  QString  & fileName )  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QStringList  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " revert " )  < <  fileName ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse  revertResult  =  runP4Cmd ( workingDir ,  args , 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-04 16:24:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                       CommandToWindow | StdOutToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( revertResult . error ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " delete " )  < <  fileName ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse  deleteResult  =  runP4Cmd ( workingDir ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                             CommandToWindow | StdOutToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // TODO need to carefully parse the actual messages from perforce
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // or do a fstat before to decide what to do
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Different states are:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // File is in depot and unopened => p4 delete %
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // File is in depot and opened => p4 revert %, p4 delete %
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // File is not in depot => p4 revert %
 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  ! deleteResult . error ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-05-11 14:13:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  PerforcePlugin : : vcsMove ( const  QString  & workingDir ,  const  QString  & from ,  const  QString  & to )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // TODO verify this works
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QStringList  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " edit " )  < <  from ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse  editResult  =  runP4Cmd ( workingDir ,  args , 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-22 14:53:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                                 RunFullySynchronous | CommandToWindow | StdOutToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-11 14:13:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( editResult . error ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " move " )  < <  from  < <  to ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse  moveResult  =  runP4Cmd ( workingDir ,  args , 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-22 14:53:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                                 RunFullySynchronous | CommandToWindow | StdOutToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-11 14:13:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  ! moveResult . error ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Write extra args to temporary file
  
						 
					
						
							
								
									
										
										
										
											2011-03-30 15:15:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								QSharedPointer < Utils : : TempFileSaver >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        PerforcePlugin : : createTemporaryArgumentFile ( const  QStringList  & extraArgs , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                    QString  * errorString )  const 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( extraArgs . isEmpty ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-30 15:15:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  QSharedPointer < Utils : : TempFileSaver > ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // create pattern
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( m_tempFilePattern . isEmpty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        m_tempFilePattern  =  QDir : : tempPath ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( ! m_tempFilePattern . endsWith ( QDir : : separator ( ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            m_tempFilePattern  + =  QDir : : separator ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        m_tempFilePattern  + =  QLatin1String ( " qtc_p4_XXXXXX.args " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-30 15:15:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QSharedPointer < Utils : : TempFileSaver >  rc ( new  Utils : : TempFileSaver ( m_tempFilePattern ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    rc - > setAutoRemove ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  int  last  =  extraArgs . size ( )  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( int  i  =  0 ;  i  < =  last ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        rc - > write ( extraArgs . at ( i ) . toLocal8Bit ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( i  ! =  last ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-30 15:15:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            rc - > write ( " \n " ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-30 15:15:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ! rc - > finalize ( errorString ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  QSharedPointer < Utils : : TempFileSaver > ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  rc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Run messages
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  inline  QString  msgNotStarted ( const  QString  & cmd )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  PerforcePlugin : : tr ( " Could not start perforce '%1'. Please check your settings in the preferences. " ) . arg ( cmd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 09:41:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  inline  QString  msgTimeout ( int  timeOut )  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-14 09:41:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  PerforcePlugin : : tr ( " Perforce did not respond within timeout limit (%1 ms). " ) . arg ( timeOut  ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  inline  QString  msgCrash ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  PerforcePlugin : : tr ( " The process terminated abnormally. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  inline  QString  msgExitCode ( int  ex )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  PerforcePlugin : : tr ( " The process terminated with exit code %1. " ) . arg ( ex ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Run using a SynchronousProcess, emitting signals to the message window
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								PerforceResponse  PerforcePlugin : : synchronousProcess ( const  QString  & workingDir ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                    const  QStringList  & args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                    unsigned  flags , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                    const  QByteArray  & stdInput , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                    QTextCodec  * outputCodec )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( stdInput . isEmpty ( ) ,  return  PerforceResponse ( ) )  // Not supported here
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    VCSBase : : VCSBaseOutputWindow  * outputWindow  =  VCSBase : : VCSBaseOutputWindow : : instance ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // Run, connect stderr to the output window
 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-05 11:06:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Utils : : SynchronousProcess  process ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 12:45:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  int  timeOut  =  ( flags  &  LongTimeOut )  ?  m_settings . longTimeOutMS ( )  :  m_settings . timeOutMS ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 09:41:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    process . setTimeout ( timeOut ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    process . setStdOutCodec ( outputCodec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( flags  &  OverrideDiffEnvironment ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        process . setProcessEnvironment ( overrideDiffEnvironmentVariable ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! workingDir . isEmpty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        process . setWorkingDirectory ( workingDir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // connect stderr to the output window if desired
 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( flags  &  StdErrToWindow )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        process . setStdErrBufferedSignalsEnabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-10 15:46:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        connect ( & process ,  SIGNAL ( stdErrBuffered ( QString , bool ) ) ,  outputWindow ,  SLOT ( append ( QString ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // connect stdout to the output window if desired
 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( flags  &  StdOutToWindow )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        process . setStdOutBufferedSignalsEnabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-10 15:46:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        connect ( & process ,  SIGNAL ( stdOutBuffered ( QString , bool ) ) ,  outputWindow ,  SLOT ( append ( QString ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( Perforce : : Constants : : debug ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        qDebug ( )  < <  " PerforcePlugin::run syncp actual args [ "  < <  process . workingDirectory ( )  < <  ' ] '  < <  args ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-21 17:46:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    process . setTimeOutMessageBoxEnabled ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  Utils : : SynchronousProcessResponse  sp_resp  =  process . run ( m_settings . p4Command ( ) ,  args ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( Perforce : : Constants : : debug ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        qDebug ( )  < <  sp_resp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    PerforceResponse  response ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    response . error  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    response . exitCode  =  sp_resp . exitCode ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    response . stdErr  =  sp_resp . stdErr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    response . stdOut  =  sp_resp . stdOut ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    switch  ( sp_resp . result )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-05 11:06:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    case  Utils : : SynchronousProcessResponse : : Finished : 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        response . error  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-05 11:06:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    case  Utils : : SynchronousProcessResponse : : FinishedError : 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        response . message  =  msgExitCode ( sp_resp . exitCode ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        response . error  =  ! ( flags  &  IgnoreExitCode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-05 11:06:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    case  Utils : : SynchronousProcessResponse : : TerminatedAbnormally : 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        response . message  =  msgCrash ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-05 11:06:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    case  Utils : : SynchronousProcessResponse : : StartFailed : 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        response . message  =  msgNotStarted ( m_settings . p4Command ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-05 11:06:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    case  Utils : : SynchronousProcessResponse : : Hang : 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        response . message  =  msgCrash ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  response ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Run using a QProcess, for short queries
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								PerforceResponse  PerforcePlugin : : fullySynchronousProcess ( const  QString  & workingDir ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                         const  QStringList  & args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                         unsigned  flags , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                         const  QByteArray  & stdInput , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                         QTextCodec  * outputCodec )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QProcess  process ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( flags  &  OverrideDiffEnvironment ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        process . setProcessEnvironment ( overrideDiffEnvironmentVariable ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! workingDir . isEmpty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        process . setWorkingDirectory ( workingDir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( Perforce : : Constants : : debug ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        qDebug ( )  < <  " PerforcePlugin::run fully syncp actual args [ "  < <  process . workingDirectory ( )  < <  ' ] '  < <  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    PerforceResponse  response ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    process . start ( m_settings . p4Command ( ) ,  args ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( stdInput . isEmpty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        process . closeWriteChannel ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! process . waitForStarted ( 3000 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        response . error  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        response . message  =  msgNotStarted ( m_settings . p4Command ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  response ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! stdInput . isEmpty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( process . write ( stdInput )  = =  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-01 10:06:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            Utils : : SynchronousProcess : : stopProcess ( process ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            response . error  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-05 09:52:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            response . message  =  tr ( " Unable to write input data to process %1: %2 " ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                               arg ( QDir : : toNativeSeparators ( m_settings . p4Command ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                   process . errorString ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            return  response ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        process . closeWriteChannel ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-01 10:06:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QByteArray  stdOut ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QByteArray  stdErr ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 12:45:45 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  int  timeOut  =  ( flags  &  LongTimeOut )  ?  m_settings . longTimeOutMS ( )  :  m_settings . timeOutMS ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-21 17:46:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ! Utils : : SynchronousProcess : : readDataFromProcess ( process ,  timeOut ,  & stdOut ,  & stdErr ,  true ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-01 10:06:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        Utils : : SynchronousProcess : : stopProcess ( process ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        response . error  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 09:41:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        response . message  =  msgTimeout ( timeOut ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  response ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( process . exitStatus ( )  ! =  QProcess : : NormalExit )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        response . error  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        response . message  =  msgCrash ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  response ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    response . exitCode  =  process . exitCode ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    response . error  =  response . exitCode  ?  ! ( flags  &  IgnoreExitCode )  :  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-01 10:06:05 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    response . stdErr  =  QString : : fromLocal8Bit ( stdErr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    response . stdOut  =  outputCodec  ?  outputCodec - > toUnicode ( stdOut . constData ( ) ,  stdOut . size ( ) )  : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    QString : : fromLocal8Bit ( stdOut ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 17:04:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QChar  cr  =  QLatin1Char ( ' \r ' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    response . stdErr . remove ( cr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    response . stdOut . remove ( cr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // Logging
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    VCSBase : : VCSBaseOutputWindow  * outputWindow  =  VCSBase : : VCSBaseOutputWindow : : instance ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ( flags  &  StdErrToWindow )  & &  ! response . stdErr . isEmpty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        outputWindow - > append ( response . stdErr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ( flags  &  StdOutToWindow )  & &  ! response . stdOut . isEmpty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        outputWindow - > append ( response . stdOut ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  response ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								PerforceResponse  PerforcePlugin : : runP4Cmd ( const  QString  & workingDir ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                          const  QStringList  & args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                          unsigned  flags , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                          const  QStringList  & extraArgs , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                          const  QByteArray  & stdInput , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                          QTextCodec  * outputCodec )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( Perforce : : Constants : : debug ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        qDebug ( )  < <  " PerforcePlugin::runP4Cmd [ "  < <  workingDir  < <  ' ] '  < <  args  < <  extraArgs  < <  stdInput  < <  debugCodec ( outputCodec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    VCSBase : : VCSBaseOutputWindow  * outputWindow  =  VCSBase : : VCSBaseOutputWindow : : instance ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! m_settings . isValid ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        PerforceResponse  invalidConfigResponse ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        invalidConfigResponse . error  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        invalidConfigResponse . message  =  tr ( " Perforce is not correctly configured. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        outputWindow - > appendError ( invalidConfigResponse . message ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  invalidConfigResponse ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QStringList  actualArgs  =  m_settings . commonP4Arguments ( workingDir ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-30 15:15:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QString  errorMessage ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QSharedPointer < Utils : : TempFileSaver >  tempFile  =  createTemporaryArgumentFile ( extraArgs ,  & errorMessage ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! tempFile . isNull ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        actualArgs  < <  QLatin1String ( " -x " )  < <  tempFile - > fileName ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-30 15:15:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    }  else  if  ( ! errorMessage . isEmpty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        PerforceResponse  tempFailResponse ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        tempFailResponse . error  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        tempFailResponse . message  =  errorMessage ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  tempFailResponse ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    actualArgs . append ( args ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( flags  &  CommandToWindow ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-21 17:46:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        outputWindow - > appendCommand ( workingDir ,  m_settings . p4Command ( ) ,  actualArgs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( flags  &  ShowBusyCursor ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        QApplication : : setOverrideCursor ( QCursor ( Qt : : WaitCursor ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse   response  =  ( flags  &  RunFullySynchronous )   ? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        fullySynchronousProcess ( workingDir ,  actualArgs ,  flags ,  stdInput ,  outputCodec )  : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        synchronousProcess ( workingDir ,  actualArgs ,  flags ,  stdInput ,  outputCodec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( flags  &  ShowBusyCursor ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        QApplication : : restoreOverrideCursor ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-04 16:24:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( response . error )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( Perforce : : Constants : : debug ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            qDebug ( )  < <  response . message ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( flags  &  ErrorToWindow ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-10 15:46:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            outputWindow - > appendError ( response . message ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-04 16:24:15 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    return  response ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Core : : IEditor  *  PerforcePlugin : : showOutputInEditor ( const  QString &  title ,  const  QString  output ,  
						 
					
						
							
								
									
										
										
										
											2010-01-06 17:24:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                                   int  editorType , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                   const  QString  & source , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                   QTextCodec  * codec ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBaseEditorParameters  * params  =  findType ( editorType ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-09 15:25:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QTC_ASSERT ( params ,  return  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 18:17:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QString  id  =  params - > id ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( Perforce : : Constants : : debug ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 18:17:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( )  < <  " PerforcePlugin::showOutputInEditor "  < <  title  < <  id  < <   " Size=  "  < <  output . size ( )  < <   "  Type= "  < <  editorType  < <  debugCodec ( codec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    QString  s  =  title ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 18:17:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : IEditor  * editor  =  Core : : EditorManager : : instance ( ) - > openEditorWithContents ( id ,  & s ,  output ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 11:33:30 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    connect ( editor ,  SIGNAL ( annotateRevisionRequested ( QString , QString , int ) ) , 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-19 17:22:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            this ,  SLOT ( vcsAnnotate ( QString , QString , int ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-21 15:52:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    PerforceEditor  * e  =  qobject_cast < PerforceEditor * > ( editor - > widget ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( ! e ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-07 14:53:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    e - > setForceReadOnly ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-06 17:24:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    e - > setSource ( source ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    s . replace ( QLatin1Char ( '   ' ) ,  QLatin1Char ( ' _ ' ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    e - > setSuggestedFileName ( s ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( codec ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        e - > setCodec ( codec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-21 16:02:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : IEditor  * ie  =  e - > editor ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-14 15:15:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : EditorManager : : instance ( ) - > activateEditor ( ie ,  Core : : EditorManager : : ModeSwitch ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-10 11:02:12 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  ie ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  PerforcePlugin : : slotSubmitDiff ( const  QStringList  & files )  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    p4Diff ( m_commitWorkingDirectory ,  files ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								struct  PerforceDiffParameters  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QString  workingDir ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QStringList  diffArguments ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QStringList  files ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Parameter widget controlling whitespace diff mode, associated with a parameter
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								class  PerforceDiffParameterWidget  :  public  VCSBase : : VCSBaseEditorParameterWidget  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    Q_OBJECT 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								public :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    explicit  PerforceDiffParameterWidget ( const  PerforceDiffParameters  & p ,  QWidget  * parent  =  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								signals :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    void  reRunDiff ( const  Perforce : : Internal : : PerforceDiffParameters  & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								private  slots :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    void  triggerReRun ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								private :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceDiffParameters  m_parameters ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								PerforceDiffParameterWidget : : PerforceDiffParameterWidget ( const  PerforceDiffParameters  & p ,  QWidget  * parent )  :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    VCSBase : : VCSBaseEditorParameterWidget ( parent ) ,  m_parameters ( p ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    setBaseArguments ( p . diffArguments ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-03 12:57:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    addToggleButton ( QLatin1String ( " w " ) ,  tr ( " Ignore whitespace " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    connect ( this ,  SIGNAL ( argumentsChanged ( ) ) ,  this ,  SLOT ( triggerReRun ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforceDiffParameterWidget : : triggerReRun ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    PerforceDiffParameters  effectiveParameters  =  m_parameters ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    effectiveParameters . diffArguments  =  arguments ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    emit  reRunDiff ( effectiveParameters ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  PerforcePlugin : : p4Diff ( const  QString  & workingDir ,  const  QStringList  & files )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    PerforceDiffParameters  p ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p . workingDir  =  workingDir ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p . files  =  files ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p . diffArguments . push_back ( QString ( QLatin1Char ( ' u ' ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    p4Diff ( p ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : p4Diff ( const  PerforceDiffParameters  & p )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTextCodec  * codec  =  VCSBase : : VCSBaseEditorWidget : : getCodec ( p . workingDir ,  p . files ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  QString  id  =  VCSBase : : VCSBaseEditorWidget : : getTitleId ( p . workingDir ,  p . files ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // Reuse existing editors for that id
 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QString  tag  =  VCSBase : : VCSBaseEditorWidget : : editorTag ( VCSBase : : DiffOutput ,  p . workingDir ,  p . files ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    Core : : IEditor  * existingEditor  =  VCSBase : : VCSBaseEditorWidget : : locateEditorByTag ( tag ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // Split arguments according to size
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QStringList  args ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " diff " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! p . diffArguments . isEmpty ( ) )  // -duw..
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        args  < <  ( QLatin1String ( " -d " )  +  p . diffArguments . join ( QString ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QStringList  extraArgs ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( p . files . size ( )  >  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        extraArgs  =  p . files ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        args . append ( p . files ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  unsigned  flags  =  CommandToWindow | StdErrToWindow | ErrorToWindow | OverrideDiffEnvironment ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  PerforceResponse  result  =  runP4Cmd ( p . workingDir ,  args ,  flags , 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                             extraArgs ,  QByteArray ( ) ,  codec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( result . error ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( existingEditor )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        existingEditor - > createNew ( result . stdOut ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-14 15:15:57 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        Core : : EditorManager : : instance ( ) - > activateEditor ( existingEditor ,  Core : : EditorManager : : ModeSwitch ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // Create new editor
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    Core : : IEditor  * editor  =  showOutputInEditor ( tr ( " p4 diff %1 " ) . arg ( id ) ,  result . stdOut ,  VCSBase : : DiffOutput , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                               VCSBase : : VCSBaseEditorWidget : : getSource ( p . workingDir ,  p . files ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                               codec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    VCSBase : : VCSBaseEditorWidget : : tagEditor ( editor ,  tag ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    VCSBase : : VCSBaseEditorWidget  * diffEditorWidget  =  qobject_cast < VCSBase : : VCSBaseEditorWidget  * > ( editor - > widget ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Wire up the parameter widget to trigger a re-run on
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // parameter change and 'revert' from inside the diff editor.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    diffEditorWidget - > setRevertDiffChunkEnabled ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    PerforceDiffParameterWidget  * pw  =  new  PerforceDiffParameterWidget ( p ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( pw ,  SIGNAL ( reRunDiff ( Perforce : : Internal : : PerforceDiffParameters ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            this ,  SLOT ( p4Diff ( Perforce : : Internal : : PerforceDiffParameters ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( diffEditorWidget ,  SIGNAL ( diffChunkReverted ( VCSBase : : DiffChunk ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            pw ,  SLOT ( triggerReRun ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    diffEditorWidget - > setConfigurationWidget ( pw ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : describe ( const  QString  &  source ,  const  QString  & n )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-02-21 16:02:26 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QTextCodec  * codec  =  source . isEmpty ( )  ?  static_cast < QTextCodec  * > ( 0 )  :  VCSBase : : VCSBaseEditorWidget : : getCodec ( source ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    QStringList  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " describe " )  < <  QLatin1String ( " -du " )  < <  n ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  PerforceResponse  result  =  runP4Cmd ( m_settings . topLevel ( ) ,  args ,  CommandToWindow | StdErrToWindow | ErrorToWindow , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                             QStringList ( ) ,  QByteArray ( ) ,  codec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( ! result . error ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-06 17:24:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        showOutputInEditor ( tr ( " p4 describe %1 " ) . arg ( n ) ,  result . stdOut ,  VCSBase : : DiffOutput ,  source ,  codec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : submitCurrentLog ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-03-20 10:16:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_submitActionTriggered  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-21 15:52:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : EditorManager  * em  =  Core : : EditorManager : : instance ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 11:52:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    em - > closeEditors ( QList < Core : : IEditor * > ( )  < <  em - > currentEditor ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 12:23:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  PerforcePlugin : : cleanCommitMessageFile ( )  
						 
					
						
							
								
									
										
										
										
											2009-03-20 16:52:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-09-22 12:23:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ! m_commitMessageFileName . isEmpty ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        QFile : : remove ( m_commitMessageFileName ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        m_commitMessageFileName . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_commitWorkingDirectory . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-20 16:52:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 12:23:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  PerforcePlugin : : isCommitEditorOpen ( )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  ! m_commitMessageFileName . isEmpty ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-08 14:26:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								bool  PerforcePlugin : : submitEditorAboutToClose ( VCSBase : : VCSBaseSubmitEditor  * submitEditor )  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-08 14:26:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ! isCommitEditorOpen ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-08 14:26:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Core : : IFile  * fileIFace  =  submitEditor - > file ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceSubmitEditor  * perforceEditor  =  qobject_cast < PerforceSubmitEditor  * > ( submitEditor ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! fileIFace  | |  ! perforceEditor ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-19 17:40:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // Prompt the user. Force a prompt unless submit was actually invoked (that
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // is, the editor was closed or shutdown).
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    bool  wantsPrompt  =  m_settings . promptToSubmit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  VCSBase : : VCSBaseSubmitEditor : : PromptSubmitResult  answer  = 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-19 17:40:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            perforceEditor - > promptSubmit ( tr ( " Closing p4 Editor " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                         tr ( " Do you want to submit this change list? " ) , 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-21 17:07:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                         tr ( " The commit message check failed. Do you want to submit this change list? " ) , 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-19 16:34:38 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                         & wantsPrompt ,  ! m_submitActionTriggered ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    m_submitActionTriggered  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-19 17:40:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( answer  = =  VCSBase : : VCSBaseSubmitEditor : : SubmitCanceled ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // Set without triggering the checking mechanism
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( wantsPrompt  ! =  m_settings . promptToSubmit ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        m_settings . setPromptToSubmit ( wantsPrompt ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        m_settings . toSettings ( Core : : ICore : : instance ( ) - > settings ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-30 12:43:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ! Core : : ICore : : instance ( ) - > fileManager ( ) - > saveFile ( fileIFace ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( answer  = =  VCSBase : : VCSBaseSubmitEditor : : SubmitDiscarded )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 12:23:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        cleanCommitMessageFile ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Pipe file into p4 submit -i
 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-30 15:15:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Utils : : FileReader  reader ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! reader . fetch ( m_commitMessageFileName ,  QIODevice : : Text ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        VCSBase : : VCSBaseOutputWindow : : instance ( ) - > appendError ( reader . errorString ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QStringList  submitArgs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    submitArgs  < <  QLatin1String ( " submit " )  < <  QLatin1String ( " -i " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse  submitResponse  =  runP4Cmd ( m_settings . topLevelSymLinkTarget ( ) ,  submitArgs , 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 09:41:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                                     LongTimeOut | RunFullySynchronous | CommandToWindow | StdErrToWindow | ErrorToWindow | ShowBusyCursor , 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-30 15:15:15 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                                     QStringList ( ) ,  reader . data ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( submitResponse . error )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        VCSBase : : VCSBaseOutputWindow : : instance ( ) - > appendError ( tr ( " p4 submit failed: %1 " ) . arg ( submitResponse . message ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    VCSBase : : VCSBaseOutputWindow : : instance ( ) - > append ( submitResponse . stdOut ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( submitResponse . stdOut . contains ( QLatin1String ( " Out of date files must be resolved or reverted) " ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        QMessageBox : : warning ( submitEditor - > widget ( ) ,  tr ( " Pending change " ) ,  tr ( " Could not submit the change, because your workspace was out of date. Created a pending submit instead. " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    cleanCommitMessageFile ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								QString  PerforcePlugin : : clientFilePath ( const  QString  & serverFilePath )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QTC_ASSERT ( m_settings . isValid ( ) ,  return  QString ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QStringList  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " fstat " )  < <  serverFilePath ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse  response  =  runP4Cmd ( m_settings . topLevelSymLinkTarget ( ) ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                               ShowBusyCursor | RunFullySynchronous | CommandToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( response . error ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-02 17:09:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  QString ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QRegExp  r ( QLatin1String ( " \\ . \\ . \\ . \\ sclientFile \\ s(.+) \ n " )) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    r . setMinimal ( true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  QString  path  =  r . indexIn ( response . stdOut )  ! =  - 1  ?  r . cap ( 1 ) . trimmed ( )  :  QString ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( Perforce : : Constants : : debug ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        qDebug ( )  < <  " clientFilePath "  < <  serverFilePath  < <  path ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    return  path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								QString  PerforcePlugin : : pendingChangesData ( )  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QTC_ASSERT ( m_settings . isValid ( ) ,  return  QString ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QStringList  args  =  QStringList ( QLatin1String ( " info " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse  userResponse  =  runP4Cmd ( m_settings . topLevelSymLinkTarget ( ) ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                               RunFullySynchronous | CommandToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( userResponse . error ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-02 17:09:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  QString ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QRegExp  r ( QLatin1String ( " User \\ sname: \\ s( \\ S+) \ \ s * \ n " )) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( r . isValid ( ) ,  return  QString ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    r . setMinimal ( true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-02 17:09:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QString  user  =  r . indexIn ( userResponse . stdOut )  ! =  - 1  ?  r . cap ( 1 ) . trimmed ( )  :  QString ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( user . isEmpty ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-02 17:09:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  QString ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    args . clear ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " changes " )  < <  QLatin1String ( " -s " )  < <  QLatin1String ( " pending " )  < <  QLatin1String ( " -u " )  < <  user ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse  dataResponse  =  runP4Cmd ( m_settings . topLevelSymLinkTarget ( ) ,  args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                   RunFullySynchronous | CommandToWindow | StdErrToWindow | ErrorToWindow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-02 17:09:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  dataResponse . error  ?  QString ( )  :  dataResponse . stdOut ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								PerforcePlugin : : ~ PerforcePlugin ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-19 16:11:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								const  PerforceSettings &  PerforcePlugin : : settings ( )  const  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  m_settings ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-28 10:30:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  PerforcePlugin : : setSettings ( const  Settings  & newSettings )  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-05-28 10:30:10 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( newSettings  ! =  m_settings . settings ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        m_settings . setSettings ( newSettings ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_managedDirectoryCache . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-19 16:11:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        m_settings . toSettings ( Core : : ICore : : instance ( ) - > settings ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        getTopLevel ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-15 17:43:44 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        perforceVersionControl ( ) - > emitConfigurationChanged ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  inline  QString  msgWhereFailed ( const  QString  &  file ,  const  QString  & why )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-02-25 14:52:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    //: Failed to run p4 "where" to resolve a Perforce file name to a local
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    //: file system name.
 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-05 09:52:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  PerforcePlugin : : tr ( " Error running  \" where \"  on %1: %2 " ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            arg ( QDir : : toNativeSeparators ( file ) ,  why ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								// Map a perforce name "//xx" to its real name in the file system
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								QString  PerforcePlugin : : fileNameFromPerforceName ( const  QString &  perforceName ,  
						 
					
						
							
								
									
										
										
										
											2009-12-15 14:20:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                                 bool  quiet , 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								                                                 QString  * errorMessage )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // All happy, already mapped
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! perforceName . startsWith ( QLatin1String ( " // " ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  perforceName ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // "where" remaps the file to client file tree
 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QStringList  args ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    args  < <  QLatin1String ( " where " )  < <  perforceName ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-15 14:20:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    unsigned  flags  =  RunFullySynchronous ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! quiet ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        flags  | =  CommandToWindow | StdErrToWindow | ErrorToWindow ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  PerforceResponse  response  =  runP4Cmd ( m_settings . topLevelSymLinkTarget ( ) ,  args ,  flags ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( response . error )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        * errorMessage  =  msgWhereFailed ( perforceName ,  response . message ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-25 15:27:13 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  QString ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    QString  output  =  response . stdOut ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( output . endsWith ( QLatin1Char ( ' \r ' ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        output . chop ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( output . endsWith ( QLatin1Char ( ' \n ' ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        output . chop ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( output . isEmpty ( ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 14:52:20 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        //: File is not managed by Perforce
 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        * errorMessage  =  msgWhereFailed ( perforceName ,  tr ( " The file is not mapped " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        return  QString ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QString  p4fileSpec  =  output . mid ( output . lastIndexOf ( QLatin1Char ( '   ' ) )  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  QString  rc  =  m_settings . mapToFileSystem ( p4fileSpec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    if  ( Perforce : : Constants : : debug ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qDebug ( )  < <  " fileNameFromPerforceName "  < <  perforceName  < <  p4fileSpec  < <  rc ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    return  rc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-09 15:25:01 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PerforcePlugin  * PerforcePlugin : : perforcePluginInstance ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    QTC_ASSERT ( m_perforcePluginInstance ,  return  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  m_perforcePluginInstance ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-08 14:26:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PerforceVersionControl  * PerforcePlugin : : perforceVersionControl ( )  const  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  static_cast < PerforceVersionControl  * > ( versionControl ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  PerforcePlugin : : slotTopLevelFound ( const  QString  & t )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    m_settings . setTopLevel ( t ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-05 09:52:32 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    const  QString  msg  =  tr ( " Perforce repository: %1 " ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        arg ( QDir : : toNativeSeparators ( t ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    VCSBase : : VCSBaseOutputWindow : : instance ( ) - > appendSilently ( msg ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( Perforce : : Constants : : debug ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        qDebug ( )  < <  " P4:  "  < <  t ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : slotTopLevelFailed ( const  QString  & errorMessage )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-12-14 09:26:29 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    VCSBase : : VCSBaseOutputWindow : : instance ( ) - > appendSilently ( tr ( " Perforce: Unable to determine the repository: %1 " ) . arg ( errorMessage ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( Perforce : : Constants : : debug ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        qDebug ( )  < <  errorMessage ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  PerforcePlugin : : getTopLevel ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Run a new checker
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( m_settings . p4Command ( ) . isEmpty ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    PerforceChecker  * checker  =  new  PerforceChecker ( this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( checker ,  SIGNAL ( failed ( QString ) ) ,  this ,  SLOT ( slotTopLevelFailed ( QString ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( checker ,  SIGNAL ( failed ( QString ) ) ,  checker ,  SLOT ( deleteLater ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( checker ,  SIGNAL ( succeeded ( QString ) ) ,  this ,  SLOT ( slotTopLevelFound ( QString ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    connect ( checker ,  SIGNAL ( succeeded ( QString ) ) , checker ,  SLOT ( deleteLater ( ) ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    checker - > start ( m_settings . p4Command ( ) ,  m_settings . commonP4Arguments ( QString ( ) ) ,  30000 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2008-12-02 12:01:29 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 16:43:39 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Q_EXPORT_PLUGIN ( Perforce : : Internal : : PerforcePlugin )  
						 
					
						
							
								
									
										
										
										
											2011-03-31 10:57:33 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "perforceplugin.moc"