File indexing completed on 2024-04-21 15:42:50
0001 /*************************************************************************** 0002 This class provides notifications for Smb4K 0003 ------------------- 0004 begin : Son Jun 27 2010 0005 copyright : (C) 2010-2019 by Alexander Reinholdt 0006 email : alexander.reinholdt@kdemail.net 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * This program is free software; you can redistribute it and/or modify * 0011 * it under the terms of the GNU General Public License as published by * 0012 * the Free Software Foundation; either version 2 of the License, or * 0013 * (at your option) any later version. * 0014 * * 0015 * This program is distributed in the hope that it will be useful, but * 0016 * WITHOUT ANY WARRANTY; without even the implied warranty of * 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 0018 * General Public License for more details. * 0019 * * 0020 * You should have received a copy of the GNU General Public License * 0021 * along with this program; if not, write to the * 0022 * Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,* 0023 * MA 02110-1335, USA * 0024 ***************************************************************************/ 0025 0026 #ifndef SMB4KNOTIFICATION_H 0027 #define SMB4KNOTIFICATION_H 0028 0029 // application specific includes 0030 #include "smb4kglobal.h" 0031 0032 // Qt includes 0033 #include <QObject> 0034 #include <QFile> 0035 #include <QDir> 0036 #include <QProcess> 0037 #include <QScopedPointer> 0038 #include <QUrl> 0039 0040 // forward declarations 0041 class Smb4KBookmark; 0042 class Smb4KNotificationPrivate; 0043 0044 /** 0045 * This namespace provides notifications used thoughout Smb4K. 0046 * 0047 * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0048 * @since 1.0.0 0049 */ 0050 0051 namespace Smb4KNotification 0052 { 0053 /** 0054 * Notify the user that a share has been mounted. 0055 * 0056 * @param share The share that has been mounted 0057 */ 0058 Q_DECL_EXPORT void shareMounted(const SharePtr &share); 0059 0060 /** 0061 * Notify the user that a share has been unmounted. 0062 * 0063 * @param share The share that has been unmounted 0064 */ 0065 Q_DECL_EXPORT void shareUnmounted(const SharePtr &share); 0066 0067 /** 0068 * Notify the user that multiple shares have been mounted. 0069 * @param number The number of mounts 0070 */ 0071 Q_DECL_EXPORT void sharesMounted(int number); 0072 0073 /** 0074 * Notify the user that multiple shares have been unmounted at once. 0075 * @param number The number of unmounts 0076 */ 0077 Q_DECL_EXPORT void sharesUnmounted(int number); 0078 0079 /** 0080 * Warn the user that the wallet could not be opened. 0081 * 0082 * @param name The name of the wallet 0083 */ 0084 Q_DECL_EXPORT void openingWalletFailed(const QString &name); 0085 0086 /** 0087 * Warn the user that the credentials stored in the wallet could not 0088 * be accessed. 0089 */ 0090 Q_DECL_EXPORT void credentialsNotAccessible(); 0091 0092 /** 0093 * Tell the user that the mimetype is not supported and that he/she 0094 * should convert the file. 0095 * 0096 * @param mimetype The mimetype 0097 */ 0098 Q_DECL_EXPORT void mimetypeNotSupported(const QString &mimetype); 0099 0100 /** 0101 * Tell the user that this bookmark is already present and that it will 0102 * thus be skipped. 0103 * 0104 * @param bookmark The bookmark 0105 */ 0106 Q_DECL_EXPORT void bookmarkExists(Smb4KBookmark *bookmark); 0107 0108 /** 0109 * Tell the user that the label he/she chose for the bookmark is already 0110 * being used and that it will be changed automatically. 0111 * 0112 * @param bookmark The bookmark 0113 */ 0114 Q_DECL_EXPORT void bookmarkLabelInUse(Smb4KBookmark *bookmark); 0115 0116 /** 0117 * This warning is shown if the configuration file for the Samba suite 0118 * (smb.conf) could not be loaded. 0119 */ 0120 Q_DECL_EXPORT void sambaConfigFileMissing(); 0121 0122 /** 0123 * This error message is shown if the mounting of a share failed. 0124 * 0125 * @param share The share that was to be mounted 0126 * 0127 * @param errorMessage The error message 0128 */ 0129 Q_DECL_EXPORT void mountingFailed(const SharePtr &share, const QString &errorMessage); 0130 0131 /** 0132 * This error message is shown if the unmounting of a share failed. 0133 * 0134 * @param share The share that was to be unmounted 0135 * 0136 * @param errorMessage The error message 0137 */ 0138 Q_DECL_EXPORT void unmountingFailed(const SharePtr &share, const QString &errorMessage); 0139 0140 /** 0141 * This error message is shown if the unmounting of a certain share 0142 * is not allowed for the user. 0143 * 0144 * @param share The share that was to be unmounted 0145 */ 0146 Q_DECL_EXPORT void unmountingNotAllowed(const SharePtr &share); 0147 0148 /** 0149 * This error message is shown if the synchronization failed. 0150 * 0151 * @param src The source URL 0152 * 0153 * @param dest The destination URL 0154 * 0155 * @param errorMessage The error message 0156 */ 0157 Q_DECL_EXPORT void synchronizationFailed(const QUrl &src, 0158 const QUrl &dest, 0159 const QString &errorMessage); 0160 0161 /** 0162 * This error message is shown if a command could not be found. 0163 * 0164 * @param command The command that could not be found 0165 */ 0166 Q_DECL_EXPORT void commandNotFound(const QString &command); 0167 0168 /** 0169 * This error message is shown if the user tried to bookmark a printer. 0170 * 0171 * @param share The Smb4KShare object 0172 */ 0173 Q_DECL_EXPORT void cannotBookmarkPrinter(const SharePtr &share); 0174 0175 /** 0176 * This error message is shown if a file could not be found. 0177 * 0178 * @param fileName The file name 0179 */ 0180 Q_DECL_EXPORT void fileNotFound(const QString &fileName); 0181 0182 /** 0183 * This error message is shown if a file could not be opened. 0184 * 0185 * @param file The QFile object 0186 */ 0187 Q_DECL_EXPORT void openingFileFailed(const QFile &file); 0188 0189 /** 0190 * This error message is shown if a file could not be read. 0191 * 0192 * @param file The QFile object 0193 * 0194 * @param errorMessage The error message (optional) 0195 */ 0196 Q_DECL_EXPORT void readingFileFailed(const QFile &file, const QString &errorMessage); 0197 0198 /** 0199 * This error message is shown if the creation of a directory 0200 * failed. 0201 * 0202 * @param path The path 0203 */ 0204 Q_DECL_EXPORT void mkdirFailed(const QDir &dir); 0205 0206 /** 0207 * This error message is shown if a process threw an error. 0208 * 0209 * @param proc_err The code describing the process error 0210 */ 0211 Q_DECL_EXPORT void processError(QProcess::ProcessError error); 0212 0213 /** 0214 * This error message is shown if a KAuth action could not be 0215 * executed and KAuth::ActionReply::failed() reported true. Pass 0216 * the error code supplied by KAuth::ActionReply::errorCode() to 0217 * this function if available. 0218 * 0219 * @param errorCode The error code 0220 */ 0221 Q_DECL_EXPORT void actionFailed(int errorCode = -1); 0222 0223 /** 0224 * This error message is shown when an invalid URL was passed to some core 0225 * class that refuses to process it. 0226 */ 0227 Q_DECL_EXPORT void invalidURLPassed(); 0228 0229 /** 0230 * This error message is shown when a network related action could not be 0231 * perfomed or failed. 0232 * 0233 * @param errorCode The error code 0234 * 0235 * @param errorMessage The error message 0236 */ 0237 Q_DECL_EXPORT void networkCommunicationFailed(const QString &errorMessage); 0238 }; 0239 0240 0241 #endif