summaryrefslogtreecommitdiffstats
path: root/vcs/cvsservice/cvspart.h
blob: e3513a98b3706a6ec14ce965c807ca2ba6c65a5a (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
/***************************************************************************
 *   Copyright (C) 1999-2001 by Bernd Gehrmann                             *
 *   bernd@kdevelop.org                                                    *
 *   Copyright (C) 2003 by Mario Scalas                                    *
 *   mario.scalas@libero.it                                                *
 *                                                                         *
 *   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 _CVSPART_H_
#define _CVSPART_H_

#include <qguardedptr.h>
#include <qcstring.h>
#include <kurl.h>
#include "kdevversioncontrol.h"

class Context;
class QPopupMenu;
class QDir;
class KDialogBase;
class KURL;
class KURL::List;
class KAction;

class CvsProcessWidget;
class CvsForm;
class CheckoutDialog;

class CvsService_stub;
class Repository_stub;
class CvsServicePartImpl;

class CvsServicePart : public KDevVersionControl
{
    Q_OBJECT

    friend class CvsServicePartImpl;

public:
    //! Standard constructor.
    CvsServicePart( QObject *parent, const char *name, const QStringList & );
    //! Destructor.
    virtual ~CvsServicePart();

    /**
    * Returns the configuration widget (for properly configuring the project to
    * use CVS), child of @p parent.
    */
    virtual QWidget *newProjectWidget( QWidget *parent );
    /**
    * Setup a directory tree for use with CVS.
    */
    virtual void createNewProject( const QString& dir );
    /**
    * Fetch a module from remote repository, so it can be used for importing
    */
    virtual bool fetchFromRepository();
    /**
    * @return the info provider for VCS sandboxes
    */
    virtual KDevVCSFileInfoProvider *fileInfoProvider() const;
    /**
    * @param dirPath absolute path of the directory
    * @return true if the the directory is a valid CVS sandbox
    */
    virtual bool isValidDirectory( const QString &dirPath ) const;

private slots:
    /** Add menu items binded to cvs operations' slots to @p popup, using
     * data in @p context.
     * Not that @p context _must_ be FileContext-type, otherwise will do
     * nothing.
     */
    void contextMenu( QPopupMenu *popup, const Context *context );

    // Cvs operations (menubar)
    void slotActionLogin();
    void slotActionLogout();

    void slotActionCommit();
    void slotActionUpdate();
    void slotActionEditors();
    void slotActionEdit();
    void slotActionUnEdit();
    void slotActionAdd();
    void slotActionAnnotate();
    void slotActionAddBinary();
    void slotActionRemove();
    void slotActionRemoveSticky();
    void slotActionLog();
    void slotActionDiff();
    void slotActionTag();
    void slotActionUnTag();
    void slotActionAddToIgnoreList();
    void slotActionRemoveFromIgnoreList();

    // Cvs operations (context menu)
    void slotCommit();
    void slotUpdate();
    void slotEditors();
    void slotEdit();
    void slotUnEdit();
    void slotAdd();
    void slotAnnotate();
    void slotAddBinary();
    void slotRemove();
    void slotRemoveSticky();
    void slotLog();
    void slotDiff();
    void slotTag();
    void slotUnTag();
    void slotAddToIgnoreList();
    void slotRemoveFromIgnoreList();

    void slotProjectOpened();
    void slotProjectClosed();

    void slotAddFilesToProject(const QStringList &);
    void slotRemovedFilesFromProject(const QStringList &);

    /** Adds a configuration widget (for properly configuring CVS command-line options)
     * and adds it to @p dlg.
     */
    void projectConfigWidget( KDialogBase *dlg );

    //! Called when the user wishes to stop an operation.
    void slotStopButtonClicked( KDevPlugin* );

private slots:
    void init();

private:
    void setupActions();
    //! Returns the KURL for the currently focused document, if there is any
    bool urlFocusedDocument( KURL &url );

    //! A list of KURLs of the files to be "operated" on (to be committed, added, removed, ...)
    KURL::List m_urls;

    /** This is a pointer to the d->form used for collecting data about CVS project creation (used
     * by the ApplicationWizard in example)
     */
    QGuardedPtr<CvsForm> m_cvsConfigurationForm;

    // Actions
    KAction *actionCommit,
        *actionDiff,
        *actionLog,
        *actionAnnotate,
        *actionAdd,
        *actionAddBinary,
        *actionRemove,
        *actionUpdate,
        *actionRemoveSticky,
        *actionEdit,
        *actionEditors,
        *actionUnEdit,
        *actionAddToIgnoreList,
        *actionRemoveFromIgnoreList,
        *actionTag,
        *actionUnTag,
        *actionLogin,
        *actionLogout;

    CvsServicePartImpl *m_impl;
};

#endif