-rw-r--r-- | libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp | 41 |
1 files changed, 33 insertions, 8 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 | |||
@@ -10,2 +10,3 @@ using namespace Opie::Ui; | |||
10 | /* QT */ | 10 | /* QT */ |
11 | #include <qcheckbox.h> | ||
11 | #include <qvbox.h> | 12 | #include <qvbox.h> |
@@ -14,4 +15,4 @@ using namespace Opie::Ui; | |||
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 | ||
@@ -29,3 +30,6 @@ public: | |||
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 | ||
@@ -47,2 +51,3 @@ public: | |||
47 | g2->insert( c7, Attrib ); | 51 | g2->insert( c7, Attrib ); |
52 | connect( g2, SIGNAL( pressed(int) ), this, SLOT( modifierClicked(int) ) ); | ||
48 | 53 | ||
@@ -70,2 +75,8 @@ public: | |||
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 ); |
@@ -74,7 +85,12 @@ public: | |||
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 | } |
@@ -87,3 +103,3 @@ public: | |||
87 | public slots: | 103 | public slots: |
88 | 104 | void modifierClicked( int modifier ) { (int)m ^= modifier; }; | |
89 | void addSingle() { addTrigger(); }; | 105 | void addSingle() { addTrigger(); }; |
@@ -93,5 +109,14 @@ public slots: | |||
93 | { | 109 | { |
94 | QString filename( "bla" ); | 110 | QListViewItem* item = l->selectedItem(); |
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 ) ); | ||
95 | odebug << "Filename = " << filename << oendl; | 119 | odebug << "Filename = " << filename << oendl; |
96 | } | 120 | } |
121 | } | ||
97 | 122 | ||
@@ -106,3 +131,3 @@ private: | |||
106 | QButtonGroup* g2; | 131 | QButtonGroup* g2; |
107 | int m; | 132 | OFileNotificationType m; |
108 | }; | 133 | }; |