File indexing completed on 2024-04-21 05:45:35

0001 /*
0002  * SPDX-FileCopyrightText: 2009 Peter Penz <peter.penz19@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef DOLPHINNEWFILEMENUOBSERVER_H
0008 #define DOLPHINNEWFILEMENUOBSERVER_H
0009 
0010 #include "dolphin_export.h"
0011 
0012 #include <QObject>
0013 
0014 class DolphinNewFileMenu;
0015 
0016 /**
0017  * @brief Allows to observe new file items that have been created
0018  *        by a DolphinNewFileMenu instance.
0019  *
0020  * As soon as a DolphinNewFileMenu instance created a new item,
0021  * the observer will emit the signal itemCreated().
0022  */
0023 class DOLPHIN_EXPORT DolphinNewFileMenuObserver : public QObject
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     static DolphinNewFileMenuObserver &instance();
0029     void attach(const DolphinNewFileMenu *menu);
0030     void detach(const DolphinNewFileMenu *menu);
0031 
0032 Q_SIGNALS:
0033     void itemCreated(const QUrl &url);
0034     void errorMessage(const QString &error);
0035 
0036 private:
0037     DolphinNewFileMenuObserver();
0038     ~DolphinNewFileMenuObserver() override;
0039 
0040     friend class DolphinNewFileMenuObserverSingleton;
0041 };
0042 
0043 #endif