~ubuntu-branches/ubuntu/utopic/smb4k/utopic-proposed

« back to all changes in this revision

Viewing changes to core/smb4kcore.h

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2012-05-19 18:54:34 UTC
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: package-import@ubuntu.com-20120519185434-kpqpdrg5i47zm7tl
Tags: upstream-1.0.1
ImportĀ upstreamĀ versionĀ 1.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
    smb4kcore  -  The main core class of Smb4K.
3
3
                             -------------------
4
4
    begin                : Do Apr 8 2004
5
 
    copyright            : (C) 2004-2008 by Alexander Reinholdt
 
5
    copyright            : (C) 2004-2009 by Alexander Reinholdt
6
6
    email                : dustpuppy@users.berlios.de
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, Inc., 59 Temple Place, Suite 330, Boston,   *
23
 
 *   MA  02111-1307 USA                                                    *
 
22
 *   Free Software Foundation, 51 Franklin Street, Suite 500, Boston,      *
 
23
 *   MA 02110-1335, USA                                                    *
24
24
 ***************************************************************************/
25
25
 
26
26
#ifndef SMB4KCORE_H
32
32
 
33
33
// Qt includes
34
34
#include <QObject>
35
 
#include <QList>
36
35
 
37
36
// KDE includes
38
37
#include <kdemacros.h>
39
38
 
40
 
// application specific includes
41
 
#include <smb4kscanner.h>
42
 
#include <smb4kmounter.h>
43
 
#include <smb4kbookmarkhandler.h>
44
 
#include <smb4kprint.h>
45
 
#include <smb4ksynchronizer.h>
46
 
#include <smb4kpreviewer.h>
47
 
#include <smb4ksearch.h>
48
 
#include <smb4ksudowriterinterface.h>
49
 
 
50
 
// forward declarations
51
 
class Smb4KWorkgroup;
52
 
class Smb4KHost;
53
39
class Smb4KShare;
54
40
class Smb4KCorePrivate;
55
41
 
68
54
 
69
55
  public:
70
56
    /**
71
 
     * This enumeration determines with which application the mount point
72
 
     * of the current mounted share is to be opened.
73
 
     */
74
 
    enum OpenWith { FileManager,
75
 
                    Konsole };
76
 
 
77
 
    /**
78
57
     * Returns a static pointer to this class.
79
58
     */
80
59
    static Smb4KCore *self();
81
60
 
82
61
    /**
83
 
     * Returns the state the scanner is in.
84
 
     */
85
 
    static int scannerState() { return self()->m_scanner_state; }
86
 
 
87
 
    /**
88
 
     * Returns the state the mounter is in.
89
 
     */
90
 
    static int mounterState() { return self()->m_mounter_state; }
91
 
 
92
 
    /**
93
 
     * Returns the state the print object is in.
94
 
     */
95
 
    static int printState() { return self()->m_print_state; }
96
 
 
97
 
    /**
98
 
     * Returns the state the synchronizer is in.
99
 
     */
100
 
    static int synchronizerState() { return self()->m_syncer_state; }
101
 
 
102
 
    /**
103
62
     * Returns TRUE if one of the core classes is doing something.
104
63
     */
105
64
    static bool isRunning();
106
65
 
107
66
    /**
108
 
     * Returns the current state the core is in.
109
 
     */
110
 
    static int currentState() { return self()->m_current_state; }
111
 
 
112
 
    /**
113
 
     * Returns a pointer to the scanner object.
114
 
     */
115
 
    static Smb4KScanner *scanner() { return self()->m_scanner; }
116
 
 
117
 
    /**
118
 
     * Returns a pointer to the mounter object.
119
 
     */
120
 
    static Smb4KMounter *mounter() { return self()->m_mounter; }
121
 
 
122
 
    /**
123
 
     * Returns a pointer to the bookmark handler object.
124
 
     */
125
 
    static Smb4KBookmarkHandler *bookmarkHandler() { return self()->m_bookmarkHandler; }
126
 
 
127
 
    /**
128
 
     * Returns a pointer to the printer handler object.
129
 
     */
130
 
    static Smb4KPrint *print() { return self()->m_print; }
131
 
 
132
 
    /**
133
 
     * Returns a pointer to the synchronizer object.
134
 
     */
135
 
    static Smb4KSynchronizer *synchronizer() { return self()->m_synchronizer; }
136
 
 
137
 
    /**
138
 
     * Returns a pointer to the previewer object.
139
 
     */
140
 
    static Smb4KPreviewer *previewer() { return self()->m_previewer; }
141
 
 
142
 
    /**
143
 
     * Returns a pointer to the search object.
144
 
     */
145
 
    static Smb4KSearch *search() { return self()->m_search; }
146
 
 
147
 
    /**
148
 
     * Returns a pointer to the Smb4KSudoWriterInterface object.
149
 
     */
150
 
    static Smb4KSudoWriterInterface *sudoWriter() { return Smb4KSudoWriterInterface::self(); }
151
 
 
152
 
    /**
153
67
     * Aborts any action of the core.
154
68
     */
155
69
    static void abort();
156
70
 
157
71
    /**
158
 
     * Open the mount point of a share. Which application is used is determined by
159
 
     * the value of @p openWith and - maybe - by settings that were defined by the
160
 
     * user.
161
 
     *
162
 
     * @param share         The share that is to be opened.
163
 
     *
164
 
     * @param openWith      Integer of type Smb4KCore::OpenWith. Determines with which
165
 
     *                      application the share should be opened.
166
 
     */
167
 
    static void open( Smb4KShare *share,
168
 
                      OpenWith openWith = FileManager );
169
 
 
170
 
    /**
171
72
     * This function initializes the core classes.
172
73
     */
173
74
    void init();
174
75
 
175
 
  signals:
176
 
    /**
177
 
     * This signal is emitted, if one of the core objects
178
 
     * starts or stops running.
179
 
     */
180
 
    void runStateChanged();
181
 
 
182
76
  protected slots:
183
77
    /**
184
 
     * This slot sets the run state of the scanner.
185
 
     *
186
 
     * @param state         The run state the scanner is in. For definition of the
187
 
     *                      run states see smb4kdefs.h header file.
188
 
     */
189
 
    void slotSetScannerState( int state );
190
 
 
191
 
    /**
192
 
     * This slot sets the run state of the mounter.
193
 
     *
194
 
     * @param state         The run state the mounter is in. For definition of the
195
 
     *                      run states see smb4kdefs.h header file.
196
 
     */
197
 
    void slotSetMounterState( int state );
198
 
 
199
 
    /**
200
 
     * This slot sets the run state of the synchronizer.
201
 
     *
202
 
     * @param state         The run state the synchronizer is in. For definition of the
203
 
     *                      run states see smb4kdefs.h header file.
204
 
     */
205
 
    void slotSetSynchronizerState( int state );
206
 
 
207
 
    /**
208
 
     * This slot sets the run state of the print handler.
209
 
     *
210
 
     * @param state         The run state the print handler is in. For definition of the
211
 
     *                      run states see smb4kdefs.h header file.
212
 
     */
213
 
    void slotSetPrinterHandlerState( int state );
214
 
 
215
 
    /**
216
 
     * This slot sets the run state for the previewer.
217
 
     *
218
 
     * @param state         The state the previewer is in. For definition of the
219
 
     *                      run states see smb4kdefs.h header file.
220
 
     */
221
 
    void slotSetPreviewerState( int state );
222
 
 
223
 
    /**
224
 
     * This slot sets the run state for the search process.
225
 
     *
226
 
     * @param state         The state the search is in. For definition of the
227
 
     *                      tun states see smb4kdefs.h header file.
228
 
     */
229
 
    void slotSetSearchState( int state );
230
 
 
231
 
    /**
232
78
     * This slot is connected to the QApplication::aboutToQuit() signal. It is invoked
233
79
     * when the application is shut down by the KDE logout or by pressing CTRL+Q, etc.
234
80
     */
246
92
    ~Smb4KCore();
247
93
 
248
94
    /**
249
 
     * The scanner object.
250
 
     */
251
 
    Smb4KScanner *m_scanner;
252
 
 
253
 
    /**
254
 
     * The mounter object.
255
 
     */
256
 
    Smb4KMounter *m_mounter;
257
 
 
258
 
    /**
259
 
     * The bookmark handler object.
260
 
     */
261
 
    Smb4KBookmarkHandler *m_bookmarkHandler;
262
 
 
263
 
    /**
264
 
     * The printer handler object.
265
 
     */
266
 
    Smb4KPrint *m_print;
267
 
 
268
 
    /**
269
 
     * The synchronizer object.
270
 
     */
271
 
    Smb4KSynchronizer *m_synchronizer;
272
 
 
273
 
    /**
274
 
     * The previewer object.
275
 
     */
276
 
    Smb4KPreviewer *m_previewer;
277
 
 
278
 
    /**
279
 
     * The search object
280
 
     */
281
 
    Smb4KSearch *m_search;
282
 
 
283
 
    /**
284
 
     * The state the sanner is in.
285
 
     */
286
 
    int m_scanner_state;
287
 
 
288
 
    /**
289
 
     * The state the mounter is in.
290
 
     */
291
 
    int m_mounter_state;
292
 
 
293
 
    /**
294
 
     * Holds the current state.
295
 
     */
296
 
    int m_current_state;
297
 
 
298
 
    /**
299
 
     * The state the printer handler is in.
300
 
     */
301
 
    int m_print_state;
302
 
 
303
 
    /**
304
 
     * The state the synchronizer is in.
305
 
     */
306
 
    int m_syncer_state;
307
 
 
308
 
    /**
309
 
     * The state the previewer is in.
310
 
     */
311
 
    int m_previewer_state;
312
 
 
313
 
    /**
314
 
     * The state the search is in.
315
 
     */
316
 
    int m_search_state;
317
 
 
318
 
    /**
319
 
     * This function is used to set the current state of the core.
320
 
     *
321
 
     * @param state         One of the states defined in smb4kdefs.h
322
 
     */
323
 
    void setCurrentState( int state );
324
 
 
325
 
    /**
326
95
     * Searches for the needed programs and emits an error
327
96
     * if mandatory ones are missing.
328
97
     */