summaryrefslogtreecommitdiff
path: root/libopie2/opiecore/ofilenotify.h
authormickeyl <mickeyl>2005-05-07 00:55:52 (UTC)
committer mickeyl <mickeyl>2005-05-07 00:55:52 (UTC)
commit21a9e96cebeb6e729d129cd75544ac54ae4d09f4 (patch) (side-by-side diff)
tree0b5737e5c9b0df8306f3faf5f30fd442ce0bc7c9 /libopie2/opiecore/ofilenotify.h
parent852f6cf4ff1c4010f998ee8cd68936e38001f032 (diff)
downloadopie-21a9e96cebeb6e729d129cd75544ac54ae4d09f4.zip
opie-21a9e96cebeb6e729d129cd75544ac54ae4d09f4.tar.gz
opie-21a9e96cebeb6e729d129cd75544ac54ae4d09f4.tar.bz2
introduce OFileNotifyEvent and add more signals
Diffstat (limited to 'libopie2/opiecore/ofilenotify.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/ofilenotify.h63
1 files changed, 57 insertions, 6 deletions
diff --git a/libopie2/opiecore/ofilenotify.h b/libopie2/opiecore/ofilenotify.h
index 3eb917e..5bbf421 100644
--- a/libopie2/opiecore/ofilenotify.h
+++ b/libopie2/opiecore/ofilenotify.h
@@ -42,6 +42,8 @@ _;:,     .>    :=|. This program is free software; you can
namespace Opie {
namespace Core {
+class OFileNotificationEvent;
+
/*======================================================================================
* OFileNotificationType
*======================================================================================*/
@@ -168,13 +170,23 @@ class OFileNotification : public QObject
int startWatching( const QString& path, bool sshot = false, OFileNotificationType type = Modify );
signals:
- /**
- * This signal is emitted if an event happens of the specified type happens to the file being watched.
- **/
- void triggered( const QString& name );
+ void triggered( const QString&, unsigned int, const QString& );
+ void accessed( const QString& );
+ void modified( const QString& );
+ void attributed( const QString& );
+ void closed( const QString&, bool );
+ void opened( const QString& );
+ void movedTo( const QString&, const QString& );
+ void movedFrom( const QString&, const QString& );
+ void deletedSubdir( const QString&, const QString& );
+ void deletedFile( const QString&, const QString& );
+ void createdSubdir( const QString&, const QString& );
+ void createdFile( const QString&, const QString& );
+ void deleted( const QString& );
+ void unmounted( const QString& );
protected:
- bool activate();
+ bool activate( const OFileNotificationEvent* e );
private slots:
void inotifyEventHandler();
@@ -191,6 +203,8 @@ class OFileNotification : public QObject
static QSocketNotifier* _sn;
int _wd; // inotify watch descriptor
static int _fd; // inotify device descriptor
+
+ friend class OFileNotificationEvent;
};
/*======================================================================================
@@ -227,7 +241,44 @@ class ODirNotification : public QObject
/**
* This signal is emitted if an event happens of the specified type happens to the directory being watched.
**/
- void triggered( const QString& name );
+ void triggered( const QString&, unsigned int, const QString& );
+ void accessed( const QString& );
+ void modified( const QString& );
+ void attributed( const QString& );
+ void closed( const QString&, bool );
+ void opened( const QString& );
+ void movedTo( const QString&, const QString& );
+ void movedFrom( const QString&, const QString& );
+ void deletedSubdir( const QString&, const QString& );
+ void deletedFile( const QString&, const QString& );
+ void createdSubdir( const QString&, const QString& );
+ void createdFile( const QString&, const QString& );
+ void deleted( const QString& );
+ void unmounted( const QString& );
+};
+
+/*======================================================================================
+ * OFileNotificationEvent
+ *======================================================================================*/
+
+class OFileNotificationEvent
+{
+ public:
+ OFileNotificationEvent( OFileNotification* parent, int wd, unsigned int mask, unsigned int cookie, const QString& name );
+ ~OFileNotificationEvent();
+ OFileNotification* parent() const { return _parent; };
+ int descriptor() const { return _wd; };
+ unsigned int mask() const { return _mask; };
+ unsigned int cookie() const { return _cookie; };
+ QString name() const { return _name; };
+ void activate() { _parent->activate( this ); };
+
+ private:
+ OFileNotification* _parent;
+ int _wd;
+ unsigned int _mask;
+ unsigned int _cookie;
+ QString _name;
};