summaryrefslogtreecommitdiffstats
path: root/kbabel/catalogmanager/libcvs/cvsdialog.h
blob: 0eccf24ce6d25190ea61cdd7ea87012b1fe13d25 (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
/* ****************************************************************************
  This file is part of KBabel

  Copyright (C) 2002-2003 by Marco Wegner <mail@marcowegner.de>
  Copyright (C) 2005, 2006 by Nicolas GOUTTE <goutte@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.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

  In addition, as a special exception, the copyright holders give
  permission to link the code of this program with any edition of
  the Qt library by Trolltech AS, Norway (or with modified versions
  of Qt that use the same license as Qt), and distribute linked
  combinations including the two.  You must obey the GNU General
  Public License in all respects for all of the code used other than
  Qt. If you modify this file, you may extend this exception to
  your version of the file, but you are not obligated to do so.  If
  you do not wish to do so, delete this exception statement from
  your version.

**************************************************************************** */


#ifndef CVSDIALOG_H
#define CVSDIALOG_H

// KDE include files
#include <kdialog.h>
// Project specific include files
#include "cvsresources.h"
// Forwarding Qt classes
class TQCheckBox;
class TQComboBox;
class TQListBox;
class TQPushButton;
class TQString;
class TQStringList;
class TQTextEdit;
// Forwarding KDE classes
class KProcess;
class KTempFile;
class KComboBox;

/**
 * This class represents the dialog which is used for executing CVS commands
 * in KBabel's Catalog Manager. The dialog shows the list of files to be
 * processed as well as the output from the command.
 *
 * In Commit mode there is also an option for automatically executing
 * 'cvs add' if necessary.
 *
 * @short  Dialog for CVS support in Catalog Manager
 * @author Marco Wegner <mail@marcowegner.de>
 */
class CVSDialog : public KDialog
{
  Q_OBJECT

  public:
    /**
     * Constructor for creating the dialog.
     * @param cmd The type of command to be executed.
     */
    CVSDialog( CVS::Command cmd, TQWidget * parent, KSharedConfig* config );
    ~CVSDialog();
    /**
     * Set the list of files which will be used for the CVS command.
     * @param files The list of files.
     */
    void setFiles( const TQStringList& files );
    /**
     * Set the command line for the execution of the CVS command.
     * @param command The command line.
     */
    void setCommandLine( const TQString& command );
    /**
     * Set the command line for adding files to the CVS repository.
     * This method is only used together with a 'cvs commit' for automatically
     * adding files which are not yet in the repository.
     * @param command The command line.
     */
    void setAddCommand( const TQString& command );
    /**
     * Return the output of a 'cvs status' command.
     * @returns The complete output.
     */
    TQString statusOutput( );

  protected:
    /**
     * This method is overwritten so that the settings can be saved after
     * pressing the 'Close' button.
     */
    virtual void accept( );
    /** Read the dialog's settings. */
    void readSettings( );
    /** Save the dialog's settings. */
    void saveSettings( );

  protected slots:
    /** Slot for executing the CVS Command. */
    void slotExecuteCommand( );
    /** Slot for processing the stdout of the CVS Command. */
    void slotProcessStdout( KProcess*, char * buffer, int len );
    /** Slot for processing the stderr of the CVS Command. */
    void slotProcessStderr( KProcess*, char * buffer, int len );
    /** Slot for post-processing after the CVS command is fninished. */
    void slotProcessExited( KProcess * p );
    /// Slot for combox having been activated
    void slotComboActivated( int );

  private:
    CVS::Command _cmd;

    TQPushButton * mainBtn;
    TQPushButton * cancelBtn;
    TQListBox  * filebox;
    TQComboBox * oldMessages;
    TQTextEdit * logedit;
    TQTextEdit * output;
    TQCheckBox * autoAddBox;

    KProcess * p;

    TQString _commandLine;
    TQString _addCommand;
    TQString _statusOutput;

    /// Log messages (long version)
    TQStringList m_logMessages;
    /// Log messages (short version)
    TQStringList m_squeezedLogMessages;

    /// Temporary file (for commits)
    KTempFile* m_tempFile;

    /// Encoding for the commit log message
    TQString m_encoding;

    /// Combo box for the encoding
    KComboBox* m_encodingComboBox;

    /// Configuration data (of the KBabel project)
    KSharedConfig* m_config;
};

#endif // CVSDIALOG_H