summaryrefslogtreecommitdiffstats
path: root/quanta/project/projectprivate.h
blob: 3ab1a20a819ea7a9e838198a42b36d17bcb7b1ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
/***************************************************************************
                          projectprivate.h  -  description
                             -------------------
    begin                : Thu Mar 16 2000
    copyright            : (C) 2000 by Yacovlev Alexander & Dmitry Poplavsky <pdima@mail.univ.kiev.ua>
                           (C) 2001-2004 by Andras Mantia <amantia@kde.org>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef PROJECTPRIVATE_H
#define PROJECTPRIVATE_H

//qt includes
#include <qmap.h>
#include <qregexp.h>
#include <qguardedptr.h>

//app includes
#include "project.h"
#include "projectlist.h"
#include "projectupload.h"

class QWidgetStack;

class KAction;
class KActionCollection;
class KConfig;
class KDirWatch;
class KRecentFilesAction;
class KSelectAction;
class KTempFile;

class CopyTo;
class ProjectNewGeneral;
class ProjectNewLocal;
class ProjectNewWeb;
class ProjectNewFinal;
class ProjectList;
struct EventAction;
typedef QMap<QString, QValueList<EventAction> > EventActions;

class ProjectPrivate
            : public QObject
{
   Q_OBJECT
public:
  ProjectPrivate(Project *p);

  ~ProjectPrivate();

  Project *parent;
  /** Point to the .webprj file */
  KURL projectURL;
  QString projectName;
  /** Points to the directory of the .webprj file */
  KURL baseURL;
/** Points to the document root inside the project. Item under this folder
are treated as the actual documents belonging to the site. They are automatically selected
for upload, searching in project default to this directory, etc. Items outside of the
document root are treated as external, control files and they are by default not selected for
upload.*/

  KURL previewPrefix;
  bool usePreviewPrefix;
  bool m_persistentBookmarks;
  QString author;
  KRecentFilesAction *m_projectRecent;

  ProjectNewGeneral    *png;
  ProjectNewLocal      *pnl;
  ProjectNewWeb       *pnw;
  ProjectNewFinal     *pnf;

  QWidgetStack *stack;
  QString currentProjectView;

  KConfig *config;
  bool m_modified;
  bool m_excludeCvsignore;
  /** Default DTD for this project. */
  QString m_defaultDTD;
  QString m_defaultEncoding;
  QRegExp excludeRx;
  QStringList excludeList;
  KMainWindow *m_mainWindow;
  QString m_debuggerClientEdit;
  QMap<QString, QString> m_passwdList;
  ProjectList m_projectFiles; ///< the list with the _absolute_ URL's of the project
  KDirWatch *m_dirWatch; ///< watches some project directories for modification
  KURL toolbarURL;
  KURL templateURL;
  QString email;
  QDomDocument dom;
  QDomDocument m_sessionDom;
  QString debuggerClient;
  bool m_debuggerPersistentBreakpoints;
  bool m_debuggerPersistentWatches;
  QGuardedPtr<ProjectUpload> m_uploadDialog;

  TeamMember m_teamLeader;
  QMap<QString, TeamMember> m_subprojectLeaders;
  QMap<QString, TeamMember> m_taskLeaders;
  QValueList<TeamMember> m_simpleMembers;
  QValueList<SubProject> m_subprojects;
  QString m_yourself;
  QString m_mailingList;
  bool m_showUploadTreeviews;
  bool m_eventsEnabled;

  KAction
    *closeprjAction, *insertFileAction, *insertDirAction,
    *uploadProjectAction,  *rescanPrjDirAction,
    *projectOptionAction, *saveAsProjectTemplateAction,
    *saveSelectionAsProjectTemplateAction,
    *savePrjViewAction, *saveAsPrjViewAction;

   KSelectAction *openPrjViewAction, *deletePrjViewAction;
  /** the filename of the local webprj file after download */
  QString m_tmpProjectFile;
  QString m_tmpSessionFile;
  /** used for creating a new project */
  KTempFile *tempFile;
  KTempFile *sessionTempFile;
  EventActions *m_events;

  /** setup of the actions */
  void initActions(KActionCollection *ac);

  void adjustActions();

  void adjustViewActions();

  QStringList projectViewList();

  void init();

  void openCurrentView();
 /** insert files */
  void insertFiles( KURL::List files );

  /** insert files from dir recursive */
  void insertFiles(const KURL& pathURL, const QString& mask );

  void loadProjectXML();

  void slotAcceptCreateProject();

  bool createEmptyDom();

  /** load project file
      @param url the url of the project file
   */
  bool loadProject(const KURL &url);

  /** load project from temp file
      @param url the url of the project file
      @param tempFile the path of the already downloaded temp file
      @param sessionTempFile the path of the downloaded project session file. Empty if no such file was downloaded
   */
  void loadProjectFromTemp(const KURL &url, const QString &tempFile, const QString &sessionTempFile);


  void getStatusFromTree();

  /** save project file to local file @ref tmpFileName
      @return false if there was nothing to save or an error occured during save
  */
  bool saveProject();

  /**
      adds information about the current open project into config
   */
  void writeConfig();

  /**
      removes the project from the list of open projects in config

      @param the url string of the project to remove
   */
  void removeFromConfig(const QString & urlStr);

  /**
      test if a project is in the list of open projects in config

      @param the url string of the project to test
   */
  bool projectAlreadyOpen(const QString & urlStr);

  /** uploads the project file
      @return false if there was nothing to upload or an error occured during upload
  */
  bool uploadProjectFile();

public slots:

  void slotDebuggerOptions();

  void slotDebuggerChanged(const QString &debugger);

  /** create new project */
  void slotNewProject();

  /** open project file */
  void slotOpenProject();

  /** iniate closing of the project and the edited files */
  void slotCloseProject();

  /** Proceed with project closing.*/
  void slotProceedWithCloseProject(bool success);

  void slotAddDirectory();

  void slotAddFiles();

  /** Deletes a project view */
  void slotDeleteProjectView(const QString &view);

  /** Saves a project view (group of files & toolbars) asking for a name. */
  void slotSaveAsProjectView(bool askForName = true);

  /** Saves a project view (group of files & toolbars) without asking for a name. */
  void slotSaveProjectView();

  /** Opens a project view (toolbars & files). */
  void slotOpenProjectView(const QString &view);

  /** for the new project wizard */
  void slotSelectProjectType(const QString &title);

  void slotDeleteCopytoDlg(CopyTo *dlg);
  
private slots:
  void slotNewProjectHelpClicked();

signals:
  void setLocalFiles(bool);
  void eventHappened(const QString&, const QString&, const QString& );

private:
  QStringList treeStatusFromXML();
  QString m_wizTitle ;
  bool m_createSessionDom;
};


#endif