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

« back to all changes in this revision

Viewing changes to core/smb4knotification.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:
 
1
/***************************************************************************
 
2
    smb4knotification  -  This class provides notifications for Smb4K.
 
3
                             -------------------
 
4
    begin                : Son Jun 27 2010
 
5
    copyright            : (C) 2010-2011 by Alexander Reinholdt
 
6
    email                : alexander.reinholdt@kdemail.org
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *   This program is free software; you can redistribute it and/or modify  *
 
11
 *   it under the terms of the GNU General Public License as published by  *
 
12
 *   the Free Software Foundation; either version 2 of the License, or     *
 
13
 *   (at your option) any later version.                                   *
 
14
 *                                                                         *
 
15
 *   This program is distributed in the hope that it will be useful, but   *
 
16
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
 
17
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
 
18
 *   General Public License for more details.                              *
 
19
 *                                                                         *
 
20
 *   You should have received a copy of the GNU General Public License     *
 
21
 *   along with this program; if not, write to the                         *
 
22
 *   Free Software Foundation, 51 Franklin Street, Suite 500, Boston,      *
 
23
 *   MA 02110-1335, USA                                                    *
 
24
 ***************************************************************************/
 
25
 
 
26
#ifndef SMB4KNOTIFICATION_H
 
27
#define SMB4KNOTIFICATION_H
 
28
 
 
29
#ifdef HAVE_CONFIG_H
 
30
#include <config.h>
 
31
#endif
 
32
 
 
33
// Qt includes
 
34
#include <QObject>
 
35
#include <QFile>
 
36
#include <QDir>
 
37
#include <QProcess>
 
38
 
 
39
// KDE includes
 
40
#include <kurl.h>
 
41
 
 
42
// application specific includes
 
43
#include <smb4kshare.h>
 
44
 
 
45
// forward declarations
 
46
class Smb4KBookmark;
 
47
class Smb4KWorkgroup;
 
48
class Smb4KHost;
 
49
 
 
50
/**
 
51
 * This class provides notifications used thoughout Smb4K.
 
52
 *
 
53
 * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net>
 
54
 */
 
55
 
 
56
 
 
57
class KDE_EXPORT Smb4KNotification : public QObject
 
58
{
 
59
  Q_OBJECT
 
60
 
 
61
  public:
 
62
    /**
 
63
     * The constructor
 
64
     */
 
65
    Smb4KNotification( QObject *parent = 0 );
 
66
 
 
67
    /**
 
68
     * The destructor
 
69
     */
 
70
    ~Smb4KNotification();
 
71
 
 
72
    //
 
73
    // Notifications
 
74
    //
 
75
 
 
76
    /**
 
77
     * Notify the user that a share has been mounted.
 
78
     *
 
79
     * @param share     The share that has been mounted
 
80
     */
 
81
    void shareMounted( Smb4KShare *share );
 
82
 
 
83
    /**
 
84
     * Notify the user that a share has been unmounted.
 
85
     *
 
86
     * @param share     The share that has been unmounted
 
87
     */
 
88
    void shareUnmounted( Smb4KShare *share );
 
89
 
 
90
    /**
 
91
     * Notify the user that shares have been remounted.
 
92
     *
 
93
     * @param total     The number of remounts that were scheduled
 
94
     *
 
95
     * @param actual    The number of remounts that were actually
 
96
     *                  mounted.
 
97
     */
 
98
    void sharesMounted( int total, int actual );
 
99
 
 
100
    /**
 
101
     * Notify the user that all shares have been unmounted at once.
 
102
     *
 
103
     * @param total     The number of unmounts that were scheduled
 
104
     *
 
105
     * @param actual    The number of unmounts that actually finished
 
106
     *                  successfully.
 
107
     */
 
108
    void allSharesUnmounted( int total, int actual );
 
109
 
 
110
    //
 
111
    // Warnings
 
112
    //
 
113
 
 
114
    /**
 
115
     * Warn the user that the wallet could not be opened.
 
116
     *
 
117
     * @param name      The name of the wallet
 
118
     */
 
119
    void openingWalletFailed( const QString &name );
 
120
 
 
121
    /**
 
122
     * Warn the user that the logins stored in the wallet could not
 
123
     * be accessed.
 
124
     */
 
125
    void loginsNotAccessible();
 
126
 
 
127
    /**
 
128
     * Tell the user that the mimetype is not supported and that he/she
 
129
     * should convert the file.
 
130
     *
 
131
     * @param mimetype  The mimetype
 
132
     */
 
133
    void mimetypeNotSupported( const QString &mimetype );
 
134
 
 
135
    /**
 
136
     * Tell the user that this bookmark is already present and that it will
 
137
     * thus be skipped.
 
138
     *
 
139
     * @param bookmark  The bookmark
 
140
     */
 
141
    void bookmarkExists( Smb4KBookmark *bookmark );
 
142
 
 
143
    /**
 
144
     * Tell the user that the label he/she chose for the bookmark is already
 
145
     * being used and that it will be changed automatically.
 
146
     *
 
147
     * @param bookmark  The bookmark
 
148
     */
 
149
    void bookmarkLabelInUse( Smb4KBookmark *bookmark );
 
150
 
 
151
    /**
 
152
     * This warning is shown if the entry of the custom master browser
 
153
     * is empty.
 
154
     */
 
155
    void emptyCustomMasterBrowser();
 
156
 
 
157
    //
 
158
    // Errors
 
159
    //
 
160
 
 
161
    /**
 
162
     * This error message is shown if the list of workgroups could not
 
163
     * be retrieved.
 
164
     *
 
165
     * @param err_msg   The error message
 
166
     */
 
167
    void retrievingDomainsFailed( const QString &err_msg );
 
168
 
 
169
    /**
 
170
     * This error message is shown if the scanning of the broadcast
 
171
     * areas failed.
 
172
     *
 
173
     * @param err_msg   The error message
 
174
     */
 
175
    void scanningBroadcastAreaFailed( const QString &err_msg );
 
176
 
 
177
    /**
 
178
     * This error message is shown if the list of servers could not
 
179
     * be retrieved.
 
180
     *
 
181
     * @param err_msg   The error message
 
182
     */
 
183
    void retrievingServersFailed( Smb4KWorkgroup *workgroup, const QString &err_msg );
 
184
 
 
185
    /**
 
186
     * This error message is shown if the list of shares could not
 
187
     * be retrieved.
 
188
     *
 
189
     * @param host      The host object
 
190
     *
 
191
     * @param err_msg   The error message
 
192
     */
 
193
    void retrievingSharesFailed( Smb4KHost *host, const QString &err_msg );
 
194
 
 
195
    /**
 
196
     * This error message is shown if the preview could not be
 
197
     * retrieved.
 
198
     *
 
199
     * @param err_meg   The error message
 
200
     */
 
201
    void retrievingPreviewFailed( Smb4KShare *share, const QString &err_msg );
 
202
 
 
203
    /**
 
204
     * This error message is shown if the mounting of a share failed.
 
205
     *
 
206
     * @param share     The share that was to be mounted
 
207
     *
 
208
     * @param err_msg   The error message
 
209
     */
 
210
    void mountingFailed( Smb4KShare *share, const QString &err_msg );
 
211
 
 
212
    /**
 
213
     * This error message is shown if the unmounting of a share failed.
 
214
     *
 
215
     * @param share     The share that was to be unmounted
 
216
     *
 
217
     * @param err_msg   The error message
 
218
     */
 
219
    void unmountingFailed( Smb4KShare *share, const QString &err_msg );
 
220
 
 
221
    /**
 
222
     * This error message is shown if the unmounting of a certain share
 
223
     * is not allowed for the user.
 
224
     *
 
225
     * @param share     The share that was to be unmounted
 
226
     */
 
227
    void unmountingNotAllowed( Smb4KShare *share );
 
228
 
 
229
    /**
 
230
     * This error message is shown if printing failed.
 
231
     *
 
232
     * @param printer   The printer share
 
233
     *
 
234
     * @param err_msg   The error message
 
235
     */
 
236
    void printingFailed( Smb4KShare *printer, const QString &err_msg );
 
237
 
 
238
    /**
 
239
     * This error message is shown if the synchronization failed.
 
240
     *
 
241
     * @param src       The source URL
 
242
     *
 
243
     * @param dest      The destination URL
 
244
     *
 
245
     * @param err_msg   The error message
 
246
     */
 
247
    void synchronizationFailed( const KUrl &src,
 
248
                                const KUrl &dest,
 
249
                                const QString &err_msg );
 
250
 
 
251
    /**
 
252
     * This error message is shown if the searching of the network
 
253
     * neighborhood failed.
 
254
     *
 
255
     * @param item      The search item
 
256
     *
 
257
     * @param err_msg   The error message
 
258
     */
 
259
    void searchingFailed( const QString &item, const QString &err_msg );
 
260
 
 
261
    /**
 
262
     * This error message is shown if a command could not be found.
 
263
     *
 
264
     * @param command   The command that could not be found
 
265
     */
 
266
    void commandNotFound( const QString &command );
 
267
 
 
268
    /**
 
269
     * This error message is shown if the user tried to bookmark a printer.
 
270
     *
 
271
     * @param share     The Smb4KShare object
 
272
     */
 
273
    void cannotBookmarkPrinter( Smb4KShare *share );
 
274
 
 
275
    /**
 
276
     * This error message is shown if a file could not be found.
 
277
     *
 
278
     * @param fileName  The file name
 
279
     */
 
280
    void fileNotFound( const QString &fileName );
 
281
 
 
282
    /**
 
283
     * This error message is shown if a file could not be opened.
 
284
     *
 
285
     * @param file      The QFile object
 
286
     */
 
287
    void openingFileFailed( const QFile &file );
 
288
 
 
289
    /**
 
290
     * This error message is shown if a file could not be read.
 
291
     *
 
292
     * @param file      The QFile object
 
293
     *
 
294
     * @param err_msg   The error message (optional)
 
295
     */
 
296
    void readingFileFailed( const QFile &file, const QString &err_msg );
 
297
 
 
298
    /**
 
299
     * This error message is shown if the creation of a directory
 
300
     * failed.
 
301
     *
 
302
     * @param path      The path
 
303
     */
 
304
    void mkdirFailed( const QDir &dir );
 
305
 
 
306
    /**
 
307
     * This error message is shown if there are mandatorily needed
 
308
     * programs missing.
 
309
     *
 
310
     * @param programs  The list of missing programs
 
311
     */
 
312
    void missingPrograms( const QStringList &programs );
 
313
 
 
314
    /**
 
315
     * This error message is shown if a process threw an error.
 
316
     *
 
317
     * @param proc_err  The code describing the process error
 
318
     */
 
319
    void processError( QProcess::ProcessError error );
 
320
 
 
321
    /**
 
322
     * This error message is shown if a system call returned an error.
 
323
     *
 
324
     * @param sys_call  The system call as string, e.g. "gethostname()"
 
325
     *
 
326
     * @param errno     The error number
 
327
     */
 
328
    void systemCallFailed( const QString &sys_call, int err_no );
 
329
 
 
330
    /**
 
331
     * This error message is shown if a KAuth action could not be
 
332
     * executed and KAuth::ActionReply::failed() reported true. Pass
 
333
     * the error code supplied by KAuth::ActionReply::errorCode() to
 
334
     * this function if available.
 
335
     *
 
336
     * @param err_code  The error code
 
337
     */
 
338
    void actionFailed( int err_code = -1 );
 
339
    
 
340
    /**
 
341
    * This error message is shown when an invalid URL was passed to some core
 
342
    * class that refuses to process it.
 
343
    */
 
344
    void invalidURLPassed();
 
345
 
 
346
    /**
 
347
     * This error message is emitted if the entry of the broadcast areas
 
348
     * is empty.
 
349
     */
 
350
    void emptyBroadcastAreas();
 
351
 
 
352
  protected slots:
 
353
    /**
 
354
     * This slot is invoked when the notification is closed or ignored.
 
355
     */
 
356
    void slotNotificationClosed();
 
357
 
 
358
    /**
 
359
     * Opens the contents of a share in a file manager
 
360
     */
 
361
    void slotOpenShare();
 
362
 
 
363
  private:
 
364
    Smb4KShare m_share;
 
365
};
 
366
 
 
367
#endif