author | mickeyl <mickeyl> | 2005-05-02 13:49:14 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-02 13:49:14 (UTC) |
commit | 8cbb0586482ec650d7ff4fa9b6a7390b8b050793 (patch) (unidiff) | |
tree | 926c2fedf0f62a965362178620625e3ddc5171de /examples | |
parent | 3a86e1464fb00d3d9b9962bcabc1041d8a3d9343 (diff) | |
download | opie-8cbb0586482ec650d7ff4fa9b6a7390b8b050793.zip opie-8cbb0586482ec650d7ff4fa9b6a7390b8b050793.tar.gz opie-8cbb0586482ec650d7ff4fa9b6a7390b8b050793.tar.bz2 |
Rewrite OFileNotification to use the upcoming inotify (kernel 2.6) interface instead of the deprecated dnotify
-rw-r--r-- | examples/opiecore/onotifydemo/onotifydemo.cpp | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/examples/opiecore/onotifydemo/onotifydemo.cpp b/examples/opiecore/onotifydemo/onotifydemo.cpp index a38ffee..0e84d80 100644 --- a/examples/opiecore/onotifydemo/onotifydemo.cpp +++ b/examples/opiecore/onotifydemo/onotifydemo.cpp | |||
@@ -32,21 +32,31 @@ DemoApp::DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 | |||
32 | l->setColumnAlignment( 2, AlignCenter ); | 32 | l->setColumnAlignment( 2, AlignCenter ); |
33 | 33 | ||
34 | QHBox* hbox = new QHBox( vbox ); | 34 | QHBox* hbox = new QHBox( vbox ); |
35 | |||
36 | g2 = new QVButtonGroup( "Specify Trigger Type", hbox ); | 35 | g2 = new QVButtonGroup( "Specify Trigger Type", hbox ); |
37 | //QCheckBox* c1 = new QCheckBox( "Multi", g2 ); | 36 | QCheckBox* c1 = new QCheckBox( "Access", g2 ); |
38 | QCheckBox* c2 = new QCheckBox( "Access", g2 ); | 37 | QCheckBox* c2 = new QCheckBox( "Modify", g2 ); |
39 | QCheckBox* c3 = new QCheckBox( "Modify", g2 ); | 38 | QCheckBox* c3 = new QCheckBox( "Attrib", g2 ); |
40 | QCheckBox* c4 = new QCheckBox( "Create", g2 ); | 39 | QCheckBox* c4 = new QCheckBox( "CloseWrite", g2 ); |
41 | QCheckBox* c5 = new QCheckBox( "Delete", g2 ); | 40 | QCheckBox* c5 = new QCheckBox( "CloseNoWrite", g2 ); |
42 | QCheckBox* c6 = new QCheckBox( "Rename", g2 ); | 41 | QCheckBox* c6 = new QCheckBox( "MovedFrom", g2 ); |
43 | QCheckBox* c7 = new QCheckBox( "Attrib", g2 ); | 42 | QCheckBox* c7 = new QCheckBox( "MovedTo", g2 ); |
44 | g2->insert( c2, Access ); | 43 | QCheckBox* c8 = new QCheckBox( "DeleteSubdir", g2 ); |
45 | g2->insert( c3, Modify ); | 44 | QCheckBox* c9 = new QCheckBox( "DeleteFile", g2 ); |
46 | g2->insert( c4, Create ); | 45 | QCheckBox* c10 = new QCheckBox( "CreateSubdir", g2 ); |
47 | g2->insert( c5, Delete ); | 46 | QCheckBox* c11 = new QCheckBox( "CreateFile", g2 ); |
48 | g2->insert( c6, Rename ); | 47 | QCheckBox* c12 = new QCheckBox( "Unmount", g2 ); |
49 | g2->insert( c7, Attrib ); | 48 | g2->insert( c1, Access ); |
49 | g2->insert( c2, Modify ); | ||
50 | g2->insert( c3, Attrib ); | ||
51 | g2->insert( c4, CloseWrite ); | ||
52 | g2->insert( c5, CloseNoWrite ); | ||
53 | g2->insert( c6, MovedFrom ); | ||
54 | g2->insert( c7, MovedTo ); | ||
55 | g2->insert( c8, DeleteSubdir ); | ||
56 | g2->insert( c9, DeleteFile ); | ||
57 | g2->insert( c10, CreateSubdir ); | ||
58 | g2->insert( c11, CreateFile ); | ||
59 | g2->insert( c12, Unmount ); | ||
50 | connect( g2, SIGNAL( pressed(int) ), this, SLOT( modifierClicked(int) ) ); | 60 | connect( g2, SIGNAL( pressed(int) ), this, SLOT( modifierClicked(int) ) ); |
51 | 61 | ||
52 | g1 = new QVButtonGroup( "Add/Remove", hbox ); | 62 | g1 = new QVButtonGroup( "Add/Remove", hbox ); |
@@ -82,14 +92,12 @@ DemoApp::DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 | |||
82 | odebug << "Filename = " << filename << oendl; | 92 | odebug << "Filename = " << filename << oendl; |
83 | 93 | ||
84 | int fntype = m; | 94 | int fntype = m; |
85 | if ( multi ) fntype |=(int) Multi; | ||
86 | |||
87 | QString modifier = QString().sprintf( " = 0x%08x", fntype ); | 95 | QString modifier = QString().sprintf( " = 0x%08x", fntype ); |
88 | new OListViewItem( l, filename, multi ? "MULTI" : "SINGLE", modifier ); | 96 | new OListViewItem( l, filename, multi ? "MULTI" : "SINGLE", modifier ); |
89 | if ( !multi ) | 97 | if ( !multi ) |
90 | OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype ); | 98 | OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype ); |
91 | else | 99 | else |
92 | OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype ); | 100 | odebug << "not yet implemented..." << oendl; |
93 | } | 101 | } |
94 | else | 102 | else |
95 | { | 103 | { |