From e31f22952f47aeb54b206349f1e469704a6a6e8f Mon Sep 17 00:00:00 2001 From: mickeyl Date: Tue, 10 May 2005 13:30:51 +0000 Subject: add foundation for a much more intuitive API for file notifications --- (limited to 'libopie2') diff --git a/libopie2/opiecore/ofilenotify.cpp b/libopie2/opiecore/ofilenotify.cpp index 4264327..36ec6bf 100644 --- a/libopie2/opiecore/ofilenotify.cpp +++ b/libopie2/opiecore/ofilenotify.cpp @@ -59,6 +59,62 @@ namespace Opie { namespace Core { //================================================================================================= +// OFile +//================================================================================================= + +OFile::OFile() : QObject( 0, 0 ), QFile() +{ + qDebug( "OFile()" ); +} + +OFile::OFile( const QString& name ) : QObject( 0, 0 ), QFile( name ) +{ + qDebug( "OFile()" ); +} + +OFile::~OFile() +{ + qDebug( "~OFile()" ); +} + +void OFile::connectNotify( const char *signal ) +{ + QString s = normalizeSignalSlot( signal+1 ); + qDebug( "OFile::connectNotify() signal = '%s'", (const char*) s ); + + if ( s.startsWith( "accessed" ) ) + + + + + + + + QObject::connectNotify( signal ); + +/* + void accessed( const QString& ); + void modified( const QString& ); + void attributed( const QString& ); + void closed( const QString&, bool ); + void opened( const QString& ); + void deleted( const QString& ); + void unmounted( const QString& ); +*/ + +} + +void OFile::disconnectNotify( const char* signal ) +{ + qDebug( "OFile::disconnectNotify() signal = '%s'", signal ); + QObject::disconnectNotify( signal ); +} + +int OFile::startWatch( int mode ) +{ +} + +//================================================================================================= // OFileNotificationEvent //================================================================================================= OFileNotificationEvent::OFileNotificationEvent( OFileNotification* parent, int wd, unsigned int mask, unsigned int cookie, const QString& name ) @@ -219,7 +275,7 @@ void OFileNotification::inotifyEventHandler() qDebug( "OFileNotification::inotifyEventHandler(): reached." ); char buffer[16384]; - size_t buffer_i; + ssize_t buffer_i; struct inotify_event *pevent, *event; ssize_t r; size_t event_size; diff --git a/libopie2/opiecore/ofilenotify.h b/libopie2/opiecore/ofilenotify.h index 5bbf421..05343b9 100644 --- a/libopie2/opiecore/ofilenotify.h +++ b/libopie2/opiecore/ofilenotify.h @@ -38,10 +38,47 @@ _;:,     .>    :=|. This program is free software; you can #include #include #include +#include +#include namespace Opie { namespace Core { +class OFile : public QObject, public QFile +{ + Q_OBJECT + + public: + OFile(); + OFile( const QString & name ); + virtual ~OFile(); + + protected: + virtual void connectNotify( const char* signal ); + virtual void disconnectNotify( const char* signal ); + + private: + int startWatch( int mode ); + + signals: + void accessed( const QString& ); + void modified( const QString& ); + void attributed( const QString& ); + void closed( const QString&, bool ); + void opened( const QString& ); + void deleted( const QString& ); + void unmounted( 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& ); +*/ + class OFileNotificationEvent; /*====================================================================================== -- cgit v0.9.0.2