summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/examples/opiecore/onotifydemo/.cvsignore6
-rw-r--r--libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp119
-rw-r--r--libopie2/examples/opiecore/onotifydemo/onotifydemo.pro18
-rw-r--r--libopie2/examples/opiecore/opiecore.pro3
4 files changed, 144 insertions, 2 deletions
diff --git a/libopie2/examples/opiecore/onotifydemo/.cvsignore b/libopie2/examples/opiecore/onotifydemo/.cvsignore
new file mode 100644
index 0000000..8f7300c
--- a/dev/null
+++ b/libopie2/examples/opiecore/onotifydemo/.cvsignore
@@ -0,0 +1,6 @@
1Makefile*
2moc*
3*moc
4*.o
5~*
6
diff --git a/libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp b/libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp
new file mode 100644
index 0000000..5b1b6ed
--- a/dev/null
+++ b/libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp
@@ -0,0 +1,119 @@
1/* OPIE */
2#include <opie2/odebug.h>
3#include <opie2/oapplication.h>
4#include <opie2/ofiledialog.h>
5#include <opie2/olistview.h>
6#include <opie2/ofilenotify.h>
7using namespace Opie::Core;
8using namespace Opie::Ui;
9
10/* QT */
11#include <qvbox.h>
12#include <qhbox.h>
13#include <qhbuttongroup.h>
14#include <qvbuttongroup.h>
15#include <qpushbutton.h>
16#include <qcheckbox.h>
17
18class DemoApp : public OApplication
19{
20 Q_OBJECT
21public:
22 DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 notify demo" )
23 {
24
25 QVBox* vbox = new QVBox();
26 setMainWidget( vbox );
27
28 l = new OListView( vbox );
29 l->addColumn( "Notification Path" );
30 l->addColumn( "Trigger" );
31
32 QHBox* hbox = new QHBox( vbox );
33
34 g2 = new QVButtonGroup( "Specify Trigger Type", hbox );
35 //QCheckBox* c1 = new QCheckBox( "Multi", g2 );
36 QCheckBox* c2 = new QCheckBox( "Access", g2 );
37 QCheckBox* c3 = new QCheckBox( "Modify", g2 );
38 QCheckBox* c4 = new QCheckBox( "Create", g2 );
39 QCheckBox* c5 = new QCheckBox( "Delete", g2 );
40 QCheckBox* c6 = new QCheckBox( "Rename", g2 );
41 QCheckBox* c7 = new QCheckBox( "Attrib", g2 );
42 g2->insert( c2, Access );
43 g2->insert( c3, Modify );
44 g2->insert( c4, Create );
45 g2->insert( c5, Delete );
46 g2->insert( c6, Rename );
47 g2->insert( c7, Attrib );
48
49 g1 = new QVButtonGroup( "Add/Remove", hbox );
50 QPushButton* plus1 = new QPushButton( "Add\n&Single", g1 );
51 QPushButton* plus2 = new QPushButton( "Add\n&Multi", g1 );
52 QPushButton* minus = new QPushButton( "&Remove\nIt!", g1 );
53 g1->insert( plus1, 0 );
54 g1->insert( plus2, 1 );
55 g1->insert( minus, 2 );
56 connect( plus1, SIGNAL( clicked() ), this, SLOT( addSingle() ) );
57 connect( plus2, SIGNAL( clicked() ), this, SLOT( addMulti() ) );
58 connect( minus, SIGNAL( clicked() ), this, SLOT( delTrigger() ) );
59
60 g1->show();
61 g2->show();
62 l->show();
63 hbox->show();
64 vbox->show();
65 showMainWidget( vbox );
66 }
67
68public:
69 void addTrigger( bool multi = False )
70 {
71 QString filename = OFileDialog::getOpenFileName( OFileSelector::ExtendedAll );
72 if ( !filename.isEmpty() )
73 {
74 odebug << "Filename = " << filename << oendl;
75 new OListViewItem( l, filename, "Modify" );
76
77
78
79 OFileNotifier::singleShot( filename, this, SLOT( trigger() ) );
80 }
81 else
82 {
83 odebug << "cancelled." << oendl;
84 }
85 {
86
87public slots:
88
89 void addSingle() { addTrigger(); }
90 void addMulti() { addTrigger( true ); };
91
92 void delTrigger()
93 {
94 QString filename( "bla" );
95 odebug << "Filename = " << filename << oendl;
96 }
97
98 void trigger()
99 {
100 owarn << "FIRE!" << oendl;
101 }
102
103private:
104 OListView* l;
105 QButtonGroup* g1;
106 QButtonGroup* g2;
107 int m;
108};
109
110int main( int argc, char** argv )
111{
112 DemoApp* app = new DemoApp( argc, argv );
113 app->exec();
114
115 return 0;
116
117}
118
119#include "moc/onotifydemo.moc"
diff --git a/libopie2/examples/opiecore/onotifydemo/onotifydemo.pro b/libopie2/examples/opiecore/onotifydemo/onotifydemo.pro
new file mode 100644
index 0000000..3ae756b
--- a/dev/null
+++ b/libopie2/examples/opiecore/onotifydemo/onotifydemo.pro
@@ -0,0 +1,18 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS =
4SOURCES = onotifydemo.cpp
5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lopiecore2 -lopieui2
8TARGET = onotifydemo
9
10!contains( platform, x11 ) {
11 include ( $(OPIEDIR)/include.pro )
12}
13
14contains( platform, x11 ) {
15 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
16}
17
18MOC_DIR = moc
diff --git a/libopie2/examples/opiecore/opiecore.pro b/libopie2/examples/opiecore/opiecore.pro
index ec14be0..98fa18a 100644
--- a/libopie2/examples/opiecore/opiecore.pro
+++ b/libopie2/examples/opiecore/opiecore.pro
@@ -1,3 +1,2 @@
1TEMPLATE = subdirs 1TEMPLATE = subdirs
2unix:SUBDIRS = odebugdemo oconfigdemo oglobalsettingsdemo oprocessdemo 2unix:SUBDIRS = odebugdemo oconfigdemo oglobalsettingsdemo onotifydemo oprocessdemo
3