author | mickeyl <mickeyl> | 2004-04-18 18:25:24 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-18 18:25:24 (UTC) |
commit | df539f67050ebe61b5dc589f9c138bb9ef1719f6 (patch) (unidiff) | |
tree | 7baa2dc1e44be92dec2736b8205f9642fffc4302 /libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp | |
parent | 56f49e8293110e488f3ea6bc6dad282981c81d4b (diff) | |
download | opie-df539f67050ebe61b5dc589f9c138bb9ef1719f6.zip opie-df539f67050ebe61b5dc589f9c138bb9ef1719f6.tar.gz opie-df539f67050ebe61b5dc589f9c138bb9ef1719f6.tar.bz2 |
the notifier interface is shaping up
Brad: I sorted the "DN_xxx undeclared" issue out, please test
Diffstat (limited to 'libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp b/libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp index a8a5717..74a8158 100644 --- a/libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp +++ b/libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp | |||
@@ -9,10 +9,11 @@ using namespace Opie::Ui; | |||
9 | 9 | ||
10 | /* QT */ | 10 | /* QT */ |
11 | #include <qcheckbox.h> | ||
11 | #include <qvbox.h> | 12 | #include <qvbox.h> |
12 | #include <qhbox.h> | 13 | #include <qhbox.h> |
13 | #include <qhbuttongroup.h> | 14 | #include <qhbuttongroup.h> |
14 | #include <qvbuttongroup.h> | 15 | #include <qvbuttongroup.h> |
16 | #include <qmessagebox.h> | ||
15 | #include <qpushbutton.h> | 17 | #include <qpushbutton.h> |
16 | #include <qcheckbox.h> | ||
17 | 18 | ||
18 | class DemoApp : public OApplication | 19 | class DemoApp : public OApplication |
@@ -28,5 +29,8 @@ public: | |||
28 | l = new OListView( vbox ); | 29 | l = new OListView( vbox ); |
29 | l->addColumn( "Notification Path" ); | 30 | l->addColumn( "Notification Path" ); |
30 | l->addColumn( "Trigger" ); | 31 | l->addColumn( "Trigger Type" ); |
32 | l->addColumn( "Trigger Mask" ); | ||
33 | l->setColumnAlignment( 1, AlignCenter ); | ||
34 | l->setColumnAlignment( 2, AlignCenter ); | ||
31 | 35 | ||
32 | QHBox* hbox = new QHBox( vbox ); | 36 | QHBox* hbox = new QHBox( vbox ); |
@@ -46,4 +50,5 @@ public: | |||
46 | g2->insert( c6, Rename ); | 50 | g2->insert( c6, Rename ); |
47 | g2->insert( c7, Attrib ); | 51 | g2->insert( c7, Attrib ); |
52 | connect( g2, SIGNAL( pressed(int) ), this, SLOT( modifierClicked(int) ) ); | ||
48 | 53 | ||
49 | g1 = new QVButtonGroup( "Add/Remove", hbox ); | 54 | g1 = new QVButtonGroup( "Add/Remove", hbox ); |
@@ -69,13 +74,24 @@ public: | |||
69 | void addTrigger( bool multi = false ) | 74 | void addTrigger( bool multi = false ) |
70 | { | 75 | { |
76 | if ( !m ) | ||
77 | { | ||
78 | QMessageBox::warning( 0, "Add Trigger", "<p>Can't add trigger without at least one selected trigger type</p>", "&Sorry", 0 ); | ||
79 | return; | ||
80 | } | ||
81 | |||
71 | QString filename = OFileDialog::getOpenFileName( OFileSelector::ExtendedAll ); | 82 | QString filename = OFileDialog::getOpenFileName( OFileSelector::ExtendedAll ); |
72 | if ( !filename.isEmpty() ) | 83 | if ( !filename.isEmpty() ) |
73 | { | 84 | { |
74 | odebug << "Filename = " << filename << oendl; | 85 | odebug << "Filename = " << filename << oendl; |
75 | new OListViewItem( l, filename, "Modify" ); | ||
76 | |||
77 | 86 | ||
87 | int fntype = m; | ||
88 | if ( multi ) fntype |=(int) Multi; | ||
78 | 89 | ||
79 | OFileNotifier::singleShot( filename, this, SLOT( trigger() ) ); | 90 | QString modifier = QString().sprintf( " = 0x%08x", fntype ); |
91 | new OListViewItem( l, filename, multi ? "MULTI" : "SINGLE", modifier ); | ||
92 | if ( !multi ) | ||
93 | OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype ); | ||
94 | else | ||
95 | OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype ); | ||
80 | } | 96 | } |
81 | else | 97 | else |
@@ -86,5 +102,5 @@ public: | |||
86 | 102 | ||
87 | public slots: | 103 | public slots: |
88 | 104 | void modifierClicked( int modifier ) { (int)m ^= modifier; }; | |
89 | void addSingle() { addTrigger(); }; | 105 | void addSingle() { addTrigger(); }; |
90 | void addMulti() { addTrigger( true ); }; | 106 | void addMulti() { addTrigger( true ); }; |
@@ -92,6 +108,15 @@ public slots: | |||
92 | void delTrigger() | 108 | void delTrigger() |
93 | { | 109 | { |
94 | QString filename( "bla" ); | 110 | QListViewItem* item = l->selectedItem(); |
95 | odebug << "Filename = " << filename << oendl; | 111 | if ( !item ) |
112 | { | ||
113 | QMessageBox::warning( 0, "Del Trigger", "<p>No trigger selected!</p>", "&Sorry", 0 ); | ||
114 | return; | ||
115 | } | ||
116 | else | ||
117 | { | ||
118 | QString filename( item->text( 0 ) ); | ||
119 | odebug << "Filename = " << filename << oendl; | ||
120 | } | ||
96 | } | 121 | } |
97 | 122 | ||
@@ -105,5 +130,5 @@ private: | |||
105 | QButtonGroup* g1; | 130 | QButtonGroup* g1; |
106 | QButtonGroup* g2; | 131 | QButtonGroup* g2; |
107 | int m; | 132 | OFileNotificationType m; |
108 | }; | 133 | }; |
109 | 134 | ||