summaryrefslogtreecommitdiffstats
path: root/quanta/components/cvsservice/cvsservice.h
blob: 5c12d91a13a4091088e1897e6fd4c60c7cd68ece (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
/***************************************************************************
                                              cvsservice.h  -  description
                                             ------------------------------
    begin                : Sun May 16 17:50:25 2004
    copyright          : (C) 2004, 2005 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; version 2
 *
 ***************************************************************************/

#ifndef CVSSERVICE_H
#define CVSSERVICE_H

//qt includes
#include <tqobject.h>

//kde includes
#include <dcopref.h>

//own includes
#include "cvsservicedcopif.h"

class TQTimer;
class TDEPopupMenu;
class TDEActionCollection;
class CvsJob_stub;
class CvsService_stub;
class Repository_stub;

class CVSCommitDlgS;
class CVSUpdateToDlgS;

/** @short This class manages the CVS repositories from withing Quanta with the help of "cvsservice"
 *
 */
class CVSService : public TQObject, public CVSServiceDCOPIf
{
  Q_OBJECT
  

public:

  /**
   *  since this class is a singleton you must use this function to access it
   *  @return the class pointer
   */
  static CVSService* ref(TDEActionCollection *ac = 0L)
  {
    static CVSService *m_ref;
    if (!m_ref) m_ref = new CVSService(ac);
    return m_ref;
  }

  ~CVSService();

  void setAppId(const TQCString& id);
  /** Returns true if the cvsservice was found */
  bool exists() {return !m_appId.isEmpty();}
  void setRepository(const TQString &repository);
  void setCurrentFile(const TQString &file) {m_defaultFile = file;}
  TDEPopupMenu *menu() {return m_menu;}

public slots:
  void slotUpdate();
  void slotUpdate(const TQStringList &files);
  void slotUpdateToTag();
  void slotUpdateToTag(const TQStringList &files);
  void slotUpdateToHead();
  void slotUpdateToHead(const TQStringList &files);
  void slotCommit();
  void slotCommit(const TQStringList &files);
  void slotRevert();
  void slotRevert(const TQStringList &files);
  void slotAdd();
  void slotAdd(const TQStringList &files);
  void slotRemove();
  void slotRemove(const TQStringList &files);
  void slotBrowseLog();
  void slotAddToCVSIgnore();
  void slotRemoveFromCVSIgnore();

  virtual void slotJobExited(bool normalExit, int exitStatus);
  virtual void slotReceivedStdout(TQString output);
  virtual void slotReceivedStderr(TQString output);

signals:
  void clearMessages();
  void showMessage(const TQString &msg, bool append);
  void commandExecuted(const TQString& command, const TQStringList& files);

private slots:  
  void slotTimeout();
  
private:
  CVSService(TDEActionCollection *ac);
  void notInRepository();
  void startService();

  TQCString m_appId;
  TDEPopupMenu *m_menu;
  Repository_stub *m_repository;
  CvsJob_stub *m_cvsJob;
  CvsService_stub *m_cvsService;
  TQString m_defaultFile;
  TQString m_repositoryPath;
  TQString m_cvsCommand;
  TQStringList m_files;
  CVSCommitDlgS *m_commitDlg;
  CVSUpdateToDlgS *m_updateToDlg;
  DCOPRef m_job;
  TQTimer *m_timer;
};

#endif