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

« back to all changes in this revision

Viewing changes to core/smb4kmounter.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-06-15 16:27:38 UTC
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: package-import@ubuntu.com-20140615162738-t1426an8s5beix1b
Tags: upstream-1.1.2
ImportĀ upstreamĀ versionĀ 1.1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
    smb4kmounter.h  -  The core class that mounts the shares.
3
3
                             -------------------
4
4
    begin                : Die Jun 10 2003
5
 
    copyright            : (C) 2003-2011 by Alexander Reinholdt
 
5
    copyright            : (C) 2003-2013 by Alexander Reinholdt
6
6
    email                : alexander.reinholdt@kdemail.net
7
7
 ***************************************************************************/
8
8
 
19
19
 *                                                                         *
20
20
 *   You should have received a copy of the GNU General Public License     *
21
21
 *   along with this program; if not, write to the                         *
22
 
 *   Free Software Foundation, 51 Franklin Street, Suite 500, Boston,      *
 
22
 *   Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,*
23
23
 *   MA 02110-1335, USA                                                    *
24
24
 ***************************************************************************/
25
25
 
26
26
#ifndef SMB4KMOUNTER_H
27
27
#define SMB4KMOUNTER_H
28
28
 
29
 
#ifdef HAVE_CONFIG_H
30
 
#include <config.h>
31
 
#endif
 
29
// application specific includes
 
30
#include "smb4ksolidinterface.h"
32
31
 
33
32
// Qt includes
34
 
#include <QObject>
35
 
#include <QFile>
36
 
#include <QString>
37
 
#include <QStringList>
 
33
#include <QtCore/QObject>
 
34
#include <QtCore/QFile>
 
35
#include <QtCore/QString>
 
36
#include <QtCore/QStringList>
 
37
#include <QtCore/QScopedPointer>
38
38
 
39
39
// KDE includes
40
40
#include <kdemacros.h>
41
41
#include <kauth.h>
42
42
#include <kcompositejob.h>
 
43
#include <kurl.h>
43
44
 
44
 
// application specific includes
45
 
#include <smb4ksolidinterface.h>
 
45
using namespace KAuth;
46
46
 
47
47
// forward declarations
48
48
class Smb4KShare;
50
50
class Smb4KMountDialog;
51
51
class Smb4KMountJob;
52
52
class Smb4KUnmountJob;
53
 
 
54
 
using namespace KAuth;
 
53
class Smb4KNetworkObject;
 
54
class Smb4KMounterPrivate;
55
55
 
56
56
/**
57
57
 * This is one of the core classes of Smb4K. It manages the mounting
59
59
 * list of all mounts with SMBFS and CIFS file system that are present
60
60
 * on the system.
61
61
 *
62
 
 * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
 
62
 * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net>
63
63
 */
64
64
 
65
65
class KDE_EXPORT Smb4KMounter : public KCompositeJob
70
70
 
71
71
  public:
72
72
    /**
73
 
     * This enumeration denotes the process
74
 
     */
75
 
    enum Process { MountShare,
76
 
                   UnmountShare };
 
73
     * The constructor.
 
74
     */
 
75
    explicit Smb4KMounter( QObject *parent = 0 );
 
76
    
 
77
    /**
 
78
     * The destructor.
 
79
     */
 
80
    ~Smb4KMounter();
77
81
 
78
82
    /**
79
83
     * Returns a static pointer to this class.
80
84
     */
81
85
    static Smb4KMounter *self();
82
 
 
 
86
    
83
87
    /**
84
88
     * Aborts the mount/unmount process that is running for the share @p share.
85
89
     *
121
125
                      QWidget *parent = 0 );
122
126
 
123
127
    /**
124
 
     * This function attempts to unmount a share. This can either be done the "normal"
125
 
     * way, or you may force it. If you decide to force the unmounting by setting
126
 
     * @p force to TRUE, under Linux a lazy unmount will be initiated. With the parameter
127
 
     * @p silent you can suppress any error messages.
 
128
     * This function attempts to unmount a share. With the parameter @p silent you 
 
129
     * can suppress any error messages.
128
130
     *
129
131
     * @param share       The share object that should be unmounted.
130
132
     *
131
 
     * @param force       Force the unmounting of the share.
132
 
     *
133
133
     * @param silent      Determines whether this function should emit an error code in
134
134
     *                    case of an error. The default value is FALSE.
135
135
     * 
140
140
                       QWidget *parent = 0 );
141
141
    
142
142
    /**
143
 
     * This function attempts to unmount a list of shares. This can either be done the "normal"
144
 
     * way, or you may force it. If you decide to force the unmounting by setting
145
 
     * @p force to TRUE, under Linux a lazy unmount will be initiated. With the parameter
146
 
     * @p silent you can suppress any error messages.
 
143
     * This function attempts to unmount a list of shares. With the parameter @p silent 
 
144
     * you can suppress any error messages.
147
145
     * 
148
146
     * @param shares      The list of shares that is to be unmounted
149
147
     * 
150
 
     * @param force       Force the unmounting of the share
151
 
     * 
152
148
     * @param silent      Determines whether this function should emit an error code in
153
149
     *                    case of an error. The default value is FALSE.
154
150
     * 
180
176
     *
181
177
     * @returns TRUE if the mounter is running and FALSE otherwise.
182
178
     */
183
 
    bool isRunning() { return hasSubjobs(); }
 
179
    bool isRunning();
184
180
 
185
181
    /**
186
182
     * This function starts the composite job
187
183
     */
188
184
    void start();
189
 
 
190
 
  signals:
 
185
    
 
186
  Q_SIGNALS:
191
187
    /**
192
188
     * This signal is emitted whenever a share item was updated. This mainly happens
193
 
     * from within the import() function.
 
189
     * from within the import process.
194
190
     * 
195
191
     * @param share             The share item that was just updated.
196
192
     */ 
213
209
     * @param share            The share that is going to be unmounted.
214
210
     */
215
211
    void unmounted( Smb4KShare *share );
216
 
 
 
212
    
217
213
    /**
218
214
     * This signal is emitted when a mount/unmount process for the share 
219
215
     * @p share is about to be started.
235
231
     */
236
232
    void finished( Smb4KShare *share,
237
233
                   int process );
 
234
    
 
235
    /**
 
236
     * This signal is emitted every time a share was added to or removed
 
237
     * from the list of shares. In contrast to the mounted() and unmounted()
 
238
     * signals, this signal is emitted at the end of the modification of
 
239
     * the list (the unmount() signal is emitted before the share is actually
 
240
     * removed from the list).
 
241
     * 
 
242
     * If you need to know if the contents of a specific share has been changed,
 
243
     * you need to connect to the updated() signal.
 
244
     */
 
245
    void mountedSharesListChanged();
238
246
 
239
247
  protected:
240
248
    /**
244
252
     */
245
253
    void timerEvent( QTimerEvent *event );
246
254
 
247
 
  protected slots:
 
255
  protected Q_SLOTS:
248
256
    /**
249
257
     * Starts the composite job
250
258
     */
322
330
     *
323
331
     * @param shares          The list of shares that are going to be mounted
324
332
     */
325
 
    void slotAboutToStartMounting( const QList<Smb4KShare> &shares );
 
333
    void slotAboutToStartMounting( const QList<Smb4KShare *> &shares );
326
334
 
327
335
    /**
328
336
     * Called when a mount job has finished. It just emits the
331
339
     *
332
340
     * @param shares          The shares that were mounted
333
341
     */
334
 
    void slotFinishedMounting( const QList<Smb4KShare> &shares );
 
342
    void slotFinishedMounting( const QList<Smb4KShare *> &shares );
335
343
    
336
344
    /**
337
345
     * Called when an unmount job started. It just emits the 
340
348
     *
341
349
     * @param shares          The shares that are going to be unmounted
342
350
     */
343
 
    void slotAboutToStartUnmounting( const QList<Smb4KShare> &shares );
 
351
    void slotAboutToStartUnmounting( const QList<Smb4KShare *> &shares );
344
352
 
345
353
    /**
346
354
     * Called when an unmount job has finished. It just emits the
349
357
     *
350
358
     * @param shares          The shares that were unmounted
351
359
     */
352
 
    void slotFinishedUnmounting( const QList<Smb4KShare> &shares );
 
360
    void slotFinishedUnmounting( const QList<Smb4KShare *> &shares );
353
361
    
354
362
    /**
355
363
     * Called when a mounted share has been stat'ed.
360
368
 
361
369
  private:
362
370
    /**
363
 
     * The constructor.
364
 
     */
365
 
    Smb4KMounter();
366
 
    /**
367
 
     * The destructor.
368
 
     */
369
 
    ~Smb4KMounter();
370
 
 
371
 
    /**
372
 
     * Trigger the remounting of shares.
373
 
     */
374
 
    void triggerRemounts();
 
371
     * Trigger the remounting of shares. If the parameter @p fill_list is
 
372
     * set to true, the internal list should be populated with the shares
 
373
     * that are scheduled for a remount.
 
374
     * 
 
375
     * @param fill_list       Fill the internal list with shares that are 
 
376
     *                        to be remounted.
 
377
     */
 
378
    void triggerRemounts( bool fill_list );
375
379
 
376
380
    /**
377
381
     * Imports mounted shares.
400
404
     * Clean up the mount prefix.
401
405
     */
402
406
    void cleanup();
403
 
    
404
 
    /**
405
 
     * Time out
406
 
     */
407
 
    int m_timeout;
408
 
    
409
 
    /**
410
 
     * Number of checks. This is used to determine when inaccessible
411
 
     * shares have to be checked again.
412
 
     */
413
 
    int m_checks;
414
 
 
415
 
    /**
416
 
     * Retries
417
 
     */
418
 
    QList<Smb4KShare> m_retries;
419
 
    
420
 
    /**
421
 
     * Shares that were imported from /proc/mounts or by reading
422
 
     * KMountpoint stuff.
423
 
     */
424
 
    QList<Smb4KShare> m_imported_shares;
425
 
    
426
 
    /**
427
 
     * Obsolete mount points that need to be removed
428
 
     */
429
 
    QStringList m_obsolete_mountpoints;
430
 
 
431
 
    /**
432
 
     * The mount dialog
433
 
     */
434
 
    Smb4KMountDialog *m_dialog;
435
 
    
436
 
    /**
437
 
     * The first import has been done
438
 
     */
439
 
    bool m_first_import_done;
440
 
    
441
 
    /**
442
 
     * The remounting has been done
443
 
     */
444
 
    bool m_remounting_done;
 
407
 
 
408
    /**
 
409
     * Pointer to the Smb4KMounterPrivate class.
 
410
     */
 
411
    const QScopedPointer<Smb4KMounterPrivate> d;
445
412
};
446
413
 
447
414
#endif