~ubuntu-branches/ubuntu/vivid/smb4k/vivid

« back to all changes in this revision

Viewing changes to core/smb4ksynchronizer_p.h

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2012-05-19 18:54:34 UTC
  • mfrom: (1.1.20)
  • Revision ID: package-import@ubuntu.com-20120519185434-duffny2n87214n1n
Tags: 1.0.1-1
* New upstream release.
* Update debian/compat: bump to 9.
* Update debian/control:
  - bump debhelper to 9.
  - bump kdelibs5-dev build dependency to 4:4.4.0.
  - bump Standards-Version to 3.9.3 (no changes needed).
  - Replace smbfs dependency by cifs-utils. (Closes: #638162)
* Update debian/copyright:
  - update upstream URL.
  - update upstream e-mail.
* Update debian/smb4k.lintian-overrides file.
* Update debian/watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    smb4ksynchronizer_p  -  This file contains private helper classes for
 
3
    the Smb4KSynchronizer class.
 
4
                             -------------------
 
5
    begin                : Fr Okt 24 2008
 
6
    copyright            : (C) 2008-2011 by Alexander Reinholdt
 
7
    email                : alexander.reinholdt@kdemail.net
 
8
 ***************************************************************************/
 
9
 
 
10
/***************************************************************************
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *                                                                         *
 
16
 *   This program is distributed in the hope that it will be useful, but   *
 
17
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
 
18
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
 
19
 *   General Public License for more details.                              *
 
20
 *                                                                         *
 
21
 *   You should have received a copy of the GNU General Public License     *
 
22
 *   along with this program; if not, write to the                         *
 
23
 *   Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,   *
 
24
 *   MA  02111-1307 USA                                                    *
 
25
 ***************************************************************************/
 
26
 
 
27
#ifndef SMB4KSYNCHRONIZER_P_H
 
28
#define SMB4KSYNCHRONIZER_P_H
 
29
 
 
30
#ifdef HAVE_CONFIG_H
 
31
#include <config.h>
 
32
#endif
 
33
 
 
34
// KDE includes
 
35
#include <kjob.h>
 
36
#include <kurlrequester.h>
 
37
#include <kdialog.h>
 
38
#include <kuiserverjobtracker.h>
 
39
 
 
40
// application specific includes
 
41
#include <smb4ksynchronizer.h>
 
42
#include <smb4kprocess.h>
 
43
 
 
44
 
 
45
class Smb4KSyncJob : public KJob
 
46
{
 
47
  Q_OBJECT
 
48
 
 
49
  public:
 
50
    /**
 
51
     * Constructor
 
52
     */
 
53
    Smb4KSyncJob( QObject *parent = 0 );
 
54
 
 
55
    /**
 
56
     * Destructor
 
57
     */
 
58
    ~Smb4KSyncJob();
 
59
 
 
60
    /**
 
61
     * Returns TRUE if the job was started and FALSE
 
62
     * otherwise
 
63
     * 
 
64
     * @returns TRUE if the job was started
 
65
     */
 
66
    bool isStarted() { return m_started; }
 
67
 
 
68
    /**
 
69
     * Starts the synchronization
 
70
     */
 
71
    void start();
 
72
 
 
73
    /**
 
74
     * Setup the synchronization process. You need to set the share, the parent
 
75
     * widget is optional.
 
76
     *
 
77
     * This function must be called before start() is run.
 
78
     *
 
79
     * @param src       The source
 
80
     *
 
81
     * @param dest      The destination
 
82
     */
 
83
    void setupSynchronization( Smb4KShare *share,
 
84
                               QWidget *parent = 0 );
 
85
 
 
86
    /**
 
87
     * Returns the source directory.
 
88
     *
 
89
     * @returns the source directory.
 
90
     */
 
91
    const KUrl &source() { return m_src; }
 
92
 
 
93
    /**
 
94
     * Returns the destination directory.
 
95
     *
 
96
     * @returns the destination directory.
 
97
     */
 
98
    const KUrl &destination() { return m_dest; }
 
99
 
 
100
  signals:
 
101
    /**
 
102
     * This signal is emitted when a job is started. The emitted path
 
103
     * is the one of the destination.
 
104
     *
 
105
     * @param dest        The destination's URL
 
106
     */
 
107
    void aboutToStart( const QString &dest );
 
108
 
 
109
    /**
 
110
     * This signal is emitted when a job has finished. The emitted
 
111
     * URL is the one of the destination.
 
112
     *
 
113
     * @param dest        The destination's URL
 
114
     */
 
115
    void finished( const QString &dest );
 
116
     
 
117
  protected:
 
118
    /**
 
119
     * Reimplemented from KJob. Kills the internal process and
 
120
     * then the job itself.
 
121
     */
 
122
    bool doKill();
 
123
    
 
124
  protected slots:
 
125
    void slotStartSynchronization();
 
126
    void slotReadStandardOutput();
 
127
    void slotReadStandardError();
 
128
    void slotProcessFinished( int exitCode, QProcess::ExitStatus status );
 
129
 
 
130
  private:
 
131
    bool m_started;
 
132
    Smb4KShare *m_share;
 
133
    QWidget *m_parent_widget;
 
134
    KUrl m_src;
 
135
    KUrl m_dest;
 
136
    Smb4KProcess *m_proc;
 
137
    KUiServerJobTracker *m_job_tracker;
 
138
};
 
139
 
 
140
 
 
141
class Smb4KSynchronizationDialog : public KDialog
 
142
{
 
143
  Q_OBJECT
 
144
 
 
145
  public:
 
146
    /**
 
147
     * The constructor
 
148
     *
 
149
     * @param share         The share item
 
150
     *
 
151
     * @param parent        The parent widget
 
152
     */
 
153
    Smb4KSynchronizationDialog( Smb4KShare *share, QWidget *parent = 0 );
 
154
 
 
155
    /**
 
156
     * The destructor
 
157
     */
 
158
    ~Smb4KSynchronizationDialog();
 
159
 
 
160
    /**
 
161
     * The source URL
 
162
     */
 
163
    const KUrl source();
 
164
 
 
165
    /**
 
166
     * The destination URL
 
167
     */
 
168
    const KUrl destination();
 
169
 
 
170
  protected slots:
 
171
    /**
 
172
     * This slot is called when the User1 button is clicked.
 
173
     * It initializes the synchronization.
 
174
     */
 
175
    void slotUser1Clicked();
 
176
 
 
177
    /**
 
178
     * This slot is called when the User2 button is clicked.
 
179
     * It swaps the source and destination.
 
180
     */
 
181
    void slotUser2Clicked();
 
182
 
 
183
    /**
 
184
     * This slot is called when the Cancel button is clicked.
 
185
     * It aborts any action the synchronizer is performing.
 
186
     */
 
187
    void slotUser3Clicked();
 
188
 
 
189
  private:
 
190
    /**
 
191
     * A pointer to the share object
 
192
     */
 
193
    Smb4KShare *m_share;
 
194
 
 
195
    /**
 
196
     * The source URL requester
 
197
     */
 
198
    KUrlRequester *m_source;
 
199
 
 
200
    /**
 
201
     * The destination URL requester
 
202
     */
 
203
    KUrlRequester *m_destination;
 
204
};
 
205
 
 
206
 
 
207
class Smb4KSynchronizerPrivate
 
208
{
 
209
  public:
 
210
    Smb4KSynchronizerPrivate() {};
 
211
    ~Smb4KSynchronizerPrivate() {};
 
212
    Smb4KSynchronizer instance;
 
213
};
 
214
 
 
215
#endif