File indexing completed on 2024-04-21 05:01:40

0001 /*
0002     This class provides notifications for Smb4K
0003 
0004     SPDX-FileCopyrightText: 2010-2022 Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef SMB4KNOTIFICATION_H
0009 #define SMB4KNOTIFICATION_H
0010 
0011 // application specific includes
0012 #include "smb4kglobal.h"
0013 
0014 // Qt includes
0015 #include <QDir>
0016 #include <QFile>
0017 #include <QObject>
0018 #include <QProcess>
0019 #include <QScopedPointer>
0020 #include <QUrl>
0021 
0022 // forward declarations
0023 class Smb4KNotificationPrivate;
0024 
0025 /**
0026  * This namespace provides notifications used thoughout Smb4K.
0027  *
0028  * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0029  * @since 1.0.0
0030  */
0031 
0032 namespace Smb4KNotification
0033 {
0034 /**
0035  * Notify the user that a share has been mounted.
0036  *
0037  * @param share     The share that has been mounted
0038  */
0039 Q_DECL_EXPORT void shareMounted(const SharePtr &share);
0040 
0041 /**
0042  * Notify the user that a share has been unmounted.
0043  *
0044  * @param share     The share that has been unmounted
0045  */
0046 Q_DECL_EXPORT void shareUnmounted(const SharePtr &share);
0047 
0048 /**
0049  * Notify the user that multiple shares have been mounted.
0050  * @param number    The number of mounts
0051  */
0052 Q_DECL_EXPORT void sharesMounted(int number);
0053 
0054 /**
0055  * Notify the user that multiple shares have been unmounted at once.
0056  * @param number    The number of unmounts
0057  */
0058 Q_DECL_EXPORT void sharesUnmounted(int number);
0059 
0060 /**
0061  * Warn the user that the wallet could not be opened.
0062  *
0063  * @param name      The name of the wallet
0064  */
0065 Q_DECL_EXPORT void openingWalletFailed(const QString &name);
0066 
0067 /**
0068  * Warn the user that the credentials stored in the wallet could not
0069  * be accessed.
0070  */
0071 Q_DECL_EXPORT void credentialsNotAccessible();
0072 
0073 /**
0074  * Tell the user that the mimetype is not supported and that he/she
0075  * should convert the file.
0076  *
0077  * @param mimetype  The mimetype
0078  */
0079 Q_DECL_EXPORT void mimetypeNotSupported(const QString &mimetype);
0080 
0081 /**
0082  * Tell the user that this bookmark is already present and that it will
0083  * thus be skipped.
0084  *
0085  * @param bookmark  The bookmark
0086  */
0087 Q_DECL_EXPORT void bookmarkExists(const BookmarkPtr &bookmark);
0088 
0089 /**
0090  * Tell the user that the label he/she chose for the bookmark is already
0091  * being used and that it will be changed automatically.
0092  *
0093  * @param bookmark  The bookmark
0094  */
0095 Q_DECL_EXPORT void bookmarkLabelInUse(const BookmarkPtr &bookmark);
0096 
0097 /**
0098  * This error message is shown if the mounting of a share failed.
0099  *
0100  * @param share     The share that was to be mounted
0101  *
0102  * @param errorMessage   The error message
0103  */
0104 Q_DECL_EXPORT void mountingFailed(const SharePtr &share, const QString &errorMessage);
0105 
0106 /**
0107  * This error message is shown if the unmounting of a share failed.
0108  *
0109  * @param share     The share that was to be unmounted
0110  *
0111  * @param errorMessage   The error message
0112  */
0113 Q_DECL_EXPORT void unmountingFailed(const SharePtr &share, const QString &errorMessage);
0114 
0115 /**
0116  * This error message is shown if the unmounting of a certain share
0117  * is not allowed for the user.
0118  *
0119  * @param share     The share that was to be unmounted
0120  */
0121 Q_DECL_EXPORT void unmountingNotAllowed(const SharePtr &share);
0122 
0123 /**
0124  * This error message is shown if the synchronization failed.
0125  *
0126  * @param src       The source URL
0127  *
0128  * @param dest      The destination URL
0129  *
0130  * @param errorMessage   The error message
0131  */
0132 Q_DECL_EXPORT void synchronizationFailed(const QUrl &src, const QUrl &dest, const QString &errorMessage);
0133 
0134 /**
0135  * This error message is shown if a command could not be found.
0136  *
0137  * @param command   The command that could not be found
0138  */
0139 Q_DECL_EXPORT void commandNotFound(const QString &command);
0140 
0141 /**
0142  * This error message is shown if the user tried to bookmark a printer.
0143  *
0144  * @param share     The Smb4KShare object
0145  */
0146 Q_DECL_EXPORT void cannotBookmarkPrinter(const SharePtr &share);
0147 
0148 /**
0149  * This error message is shown if a file could not be found.
0150  *
0151  * @param fileName  The file name
0152  */
0153 Q_DECL_EXPORT void fileNotFound(const QString &fileName);
0154 
0155 /**
0156  * This error message is shown if a file could not be opened.
0157  *
0158  * @param file      The QFile object
0159  */
0160 Q_DECL_EXPORT void openingFileFailed(const QFile &file);
0161 
0162 /**
0163  * This error message is shown if a file could not be read.
0164  *
0165  * @param file      The QFile object
0166  *
0167  * @param errorMessage   The error message (optional)
0168  */
0169 Q_DECL_EXPORT void readingFileFailed(const QFile &file, const QString &errorMessage);
0170 
0171 /**
0172  * This error message is shown if the creation of a directory
0173  * failed.
0174  *
0175  * @param path      The path
0176  */
0177 Q_DECL_EXPORT void mkdirFailed(const QDir &dir);
0178 
0179 /**
0180  * This error message is shown if a process threw an error.
0181  *
0182  * @param error     The code describing the process error
0183  */
0184 Q_DECL_EXPORT void processError(QProcess::ProcessError error);
0185 
0186 /**
0187  * This error message is shown if a KAuth action could not be
0188  * executed and KAuth::ActionReply::failed() reported true. Pass
0189  * the error code supplied by KAuth::ActionReply::errorCode() to
0190  * this function if available.
0191  *
0192  * @param errorCode  The error code
0193  */
0194 Q_DECL_EXPORT void actionFailed(int errorCode = -1);
0195 
0196 /**
0197  * This error message is shown when an invalid URL was passed to some core
0198  * class that refuses to process it.
0199  */
0200 Q_DECL_EXPORT void invalidURLPassed();
0201 
0202 /**
0203  * This error message is shown when a network related action could not be
0204  * perfomed or failed.
0205  *
0206  * @param errorCode     The error code
0207  *
0208  * @param errorMessage  The error message
0209  */
0210 Q_DECL_EXPORT void networkCommunicationFailed(const QString &errorMessage);
0211 
0212 /**
0213  * This error message is shown when an error with the Zeroconf daemon
0214  * (Avahi or mDNS) occurred.
0215  *
0216  * @param errorMessage  The error message
0217  */
0218 Q_DECL_EXPORT void zeroconfError(const QString &errorMessage);
0219 };
0220 
0221 #endif