summaryrefslogtreecommitdiffstats
path: root/kdat/BackupProfileWidget.h
blob: 0a2f5808628b9095f45d2fc68d5ff825449c2264 (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
// KDat - a tar-based DAT archiver
// Copyright (C) 1998-2000  Sean Vyain, svyain@mail.tds.net
// Copyright (C) 2001-2002  Lawrence Widman, kdat@cardiothink.com
//
// 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

#ifndef _BackupProfileWidget_h_
#define _BackupProfileWidget_h_

#include <ktabctl.h>
#include <tqstrlist.h>

class TQCheckBox;
class TQComboBox;
class TQLabel;
class TQLineEdit;
class TQListBox;

class BackupProfile;

/**
 * @short Display/edit the parameters for a backup operation.
 */
class BackupProfileWidget : public KTabCtl {
    Q_OBJECT
    TQLineEdit* _archiveName;
    TQComboBox* _workingDir;
    TQListBox*  _files;
    TQCheckBox* _oneFilesystem;
    TQCheckBox* _incremental;
    TQLabel*    _snapshotLabel;
    TQLineEdit* _snapshotFile;
    TQCheckBox* _removeSnapshot;
    TQStringList   _absoluteFiles;
    TQStringList   _relativeFiles;
private slots:
    void slotTextChanged( const TQString & text );
    void slotIncrementalToggled( bool set );
    void slotToggled( bool set );
    void slotWorkingDirActivated( const TQString & text );
public:
    /**
     * Create a backup profile widget.
     *
     * @param archiveName The default name for the new archive.
     * @param files       The list of files to be archived.
     * @param parent      The parent widget of this dialog.
     * @param name        The widget name of this dialog.
     */
    BackupProfileWidget( TQWidget* parent=0, const char* name=0 );

    /**
     * Destroy the backup profile widget.
     */
    ~BackupProfileWidget();

    /**
     * Set the parameters for the backup profile.
     *
     * @param backupProfile The backup profile to display/edit.
     */
    void setBackupProfile( BackupProfile* backupProfile );

    /**
     * Set the list of files for the backup profile, with full paths.
     *
     * @param files The list.
     */
    void setAbsoluteFiles( const TQStringList& files );

    /**
     * Query the name of the archive.
     *
     * @return The name of the new archive.
     */
    TQString getArchiveName();

    /**
     * Query the working directory for the tar command.
     *
     * @return The working directory.
     */
    TQString  getWorkingDirectory();

    /**
     * Query the list of files to backup, relative to the working directory.
     *
     * @return The file list.
     */
    const TQStringList& getRelativeFiles();

    /**
     * Query the list of files to backup, with full paths.
     *
     * @return The file list.
     */
    const TQStringList& getAbsoluteFiles();

    /**
     * Query whether or not to cross filesystem boundaries when performing the
     * backup.
     *
     * @return TRUE if the backup is restricted to a single filesystem, FALSE
     *         if the backup can cross filesystem boundaries.
     */
    bool isOneFilesystem();

    /**
     * Query whether this is to be a GNU incremental backup.
     *
     * @return TRUE if incremental, otherwise FALSE.
     */
    bool isIncremental();

    /**
     * Query the name of the snapshot file to use for an incremental backup.
     *
     * @return The name of the snapshot file.
     */
    TQString getSnapshotFile();

    /**
     * Query whether to remove the snapshot file before beginning an
     * incremental backup.  This has the effect of performing a full backup.
     *
     * @return TRUE if the snapshot file should be removed, otherwise FALSE.
     */
    bool getRemoveSnapshot();
signals:
    /**
     * Emitted whenever the user changes anything.
     */
    void sigSomethingChanged();
};

#endif