author | mickeyl <mickeyl> | 2004-04-24 11:04:03 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-24 11:04:03 (UTC) |
commit | 9ac401fbe5c80f710757926920d734e93a7e159b (patch) (unidiff) | |
tree | 1011b8aed028e9f6f0a9118e0fcd8ae49d211a38 | |
parent | 34595890e8373c91a3f5b120dfd63ea3023e46c5 (diff) | |
download | opie-9ac401fbe5c80f710757926920d734e93a7e159b.zip opie-9ac401fbe5c80f710757926920d734e93a7e159b.tar.gz opie-9ac401fbe5c80f710757926920d734e93a7e159b.tar.bz2 |
gcc3.4 fixlet
-rw-r--r-- | libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp b/libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp index 74a8158..b9ff9db 100644 --- a/libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp +++ b/libopie2/examples/opiecore/onotifydemo/onotifydemo.cpp | |||
@@ -1,144 +1,144 @@ | |||
1 | /* OPIE */ | 1 | /* OPIE */ |
2 | #include <opie2/odebug.h> | 2 | #include <opie2/odebug.h> |
3 | #include <opie2/oapplication.h> | 3 | #include <opie2/oapplication.h> |
4 | #include <opie2/ofiledialog.h> | 4 | #include <opie2/ofiledialog.h> |
5 | #include <opie2/olistview.h> | 5 | #include <opie2/olistview.h> |
6 | #include <opie2/ofilenotify.h> | 6 | #include <opie2/ofilenotify.h> |
7 | using namespace Opie::Core; | 7 | using namespace Opie::Core; |
8 | using namespace Opie::Ui; | 8 | using namespace Opie::Ui; |
9 | 9 | ||
10 | /* QT */ | 10 | /* QT */ |
11 | #include <qcheckbox.h> | 11 | #include <qcheckbox.h> |
12 | #include <qvbox.h> | 12 | #include <qvbox.h> |
13 | #include <qhbox.h> | 13 | #include <qhbox.h> |
14 | #include <qhbuttongroup.h> | 14 | #include <qhbuttongroup.h> |
15 | #include <qvbuttongroup.h> | 15 | #include <qvbuttongroup.h> |
16 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
17 | #include <qpushbutton.h> | 17 | #include <qpushbutton.h> |
18 | 18 | ||
19 | class DemoApp : public OApplication | 19 | class DemoApp : public OApplication |
20 | { | 20 | { |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | public: | 22 | public: |
23 | DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 notify demo" ) | 23 | DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 notify demo" ) |
24 | { | 24 | { |
25 | 25 | ||
26 | QVBox* vbox = new QVBox(); | 26 | QVBox* vbox = new QVBox(); |
27 | setMainWidget( vbox ); | 27 | setMainWidget( vbox ); |
28 | 28 | ||
29 | l = new OListView( vbox ); | 29 | l = new OListView( vbox ); |
30 | l->addColumn( "Notification Path" ); | 30 | l->addColumn( "Notification Path" ); |
31 | l->addColumn( "Trigger Type" ); | 31 | l->addColumn( "Trigger Type" ); |
32 | l->addColumn( "Trigger Mask" ); | 32 | l->addColumn( "Trigger Mask" ); |
33 | l->setColumnAlignment( 1, AlignCenter ); | 33 | l->setColumnAlignment( 1, AlignCenter ); |
34 | l->setColumnAlignment( 2, AlignCenter ); | 34 | l->setColumnAlignment( 2, AlignCenter ); |
35 | 35 | ||
36 | QHBox* hbox = new QHBox( vbox ); | 36 | QHBox* hbox = new QHBox( vbox ); |
37 | 37 | ||
38 | g2 = new QVButtonGroup( "Specify Trigger Type", hbox ); | 38 | g2 = new QVButtonGroup( "Specify Trigger Type", hbox ); |
39 | //QCheckBox* c1 = new QCheckBox( "Multi", g2 ); | 39 | //QCheckBox* c1 = new QCheckBox( "Multi", g2 ); |
40 | QCheckBox* c2 = new QCheckBox( "Access", g2 ); | 40 | QCheckBox* c2 = new QCheckBox( "Access", g2 ); |
41 | QCheckBox* c3 = new QCheckBox( "Modify", g2 ); | 41 | QCheckBox* c3 = new QCheckBox( "Modify", g2 ); |
42 | QCheckBox* c4 = new QCheckBox( "Create", g2 ); | 42 | QCheckBox* c4 = new QCheckBox( "Create", g2 ); |
43 | QCheckBox* c5 = new QCheckBox( "Delete", g2 ); | 43 | QCheckBox* c5 = new QCheckBox( "Delete", g2 ); |
44 | QCheckBox* c6 = new QCheckBox( "Rename", g2 ); | 44 | QCheckBox* c6 = new QCheckBox( "Rename", g2 ); |
45 | QCheckBox* c7 = new QCheckBox( "Attrib", g2 ); | 45 | QCheckBox* c7 = new QCheckBox( "Attrib", g2 ); |
46 | g2->insert( c2, Access ); | 46 | g2->insert( c2, Access ); |
47 | g2->insert( c3, Modify ); | 47 | g2->insert( c3, Modify ); |
48 | g2->insert( c4, Create ); | 48 | g2->insert( c4, Create ); |
49 | g2->insert( c5, Delete ); | 49 | g2->insert( c5, Delete ); |
50 | g2->insert( c6, Rename ); | 50 | g2->insert( c6, Rename ); |
51 | g2->insert( c7, Attrib ); | 51 | g2->insert( c7, Attrib ); |
52 | connect( g2, SIGNAL( pressed(int) ), this, SLOT( modifierClicked(int) ) ); | 52 | connect( g2, SIGNAL( pressed(int) ), this, SLOT( modifierClicked(int) ) ); |
53 | 53 | ||
54 | g1 = new QVButtonGroup( "Add/Remove", hbox ); | 54 | g1 = new QVButtonGroup( "Add/Remove", hbox ); |
55 | QPushButton* plus1 = new QPushButton( "Add\n&Single", g1 ); | 55 | QPushButton* plus1 = new QPushButton( "Add\n&Single", g1 ); |
56 | QPushButton* plus2 = new QPushButton( "Add\n&Multi", g1 ); | 56 | QPushButton* plus2 = new QPushButton( "Add\n&Multi", g1 ); |
57 | QPushButton* minus = new QPushButton( "&Remove\nIt!", g1 ); | 57 | QPushButton* minus = new QPushButton( "&Remove\nIt!", g1 ); |
58 | g1->insert( plus1, 0 ); | 58 | g1->insert( plus1, 0 ); |
59 | g1->insert( plus2, 1 ); | 59 | g1->insert( plus2, 1 ); |
60 | g1->insert( minus, 2 ); | 60 | g1->insert( minus, 2 ); |
61 | connect( plus1, SIGNAL( clicked() ), this, SLOT( addSingle() ) ); | 61 | connect( plus1, SIGNAL( clicked() ), this, SLOT( addSingle() ) ); |
62 | connect( plus2, SIGNAL( clicked() ), this, SLOT( addMulti() ) ); | 62 | connect( plus2, SIGNAL( clicked() ), this, SLOT( addMulti() ) ); |
63 | connect( minus, SIGNAL( clicked() ), this, SLOT( delTrigger() ) ); | 63 | connect( minus, SIGNAL( clicked() ), this, SLOT( delTrigger() ) ); |
64 | 64 | ||
65 | g1->show(); | 65 | g1->show(); |
66 | g2->show(); | 66 | g2->show(); |
67 | l->show(); | 67 | l->show(); |
68 | hbox->show(); | 68 | hbox->show(); |
69 | vbox->show(); | 69 | vbox->show(); |
70 | showMainWidget( vbox ); | 70 | showMainWidget( vbox ); |
71 | } | 71 | } |
72 | 72 | ||
73 | public: | 73 | public: |
74 | void addTrigger( bool multi = false ) | 74 | void addTrigger( bool multi = false ) |
75 | { | 75 | { |
76 | if ( !m ) | 76 | if ( !m ) |
77 | { | 77 | { |
78 | QMessageBox::warning( 0, "Add Trigger", "<p>Can't add trigger without at least one selected trigger type</p>", "&Sorry", 0 ); | 78 | QMessageBox::warning( 0, "Add Trigger", "<p>Can't add trigger without at least one selected trigger type</p>", "&Sorry", 0 ); |
79 | return; | 79 | return; |
80 | } | 80 | } |
81 | 81 | ||
82 | QString filename = OFileDialog::getOpenFileName( OFileSelector::ExtendedAll ); | 82 | QString filename = OFileDialog::getOpenFileName( OFileSelector::ExtendedAll ); |
83 | if ( !filename.isEmpty() ) | 83 | if ( !filename.isEmpty() ) |
84 | { | 84 | { |
85 | odebug << "Filename = " << filename << oendl; | 85 | odebug << "Filename = " << filename << oendl; |
86 | 86 | ||
87 | int fntype = m; | 87 | int fntype = m; |
88 | if ( multi ) fntype |=(int) Multi; | 88 | if ( multi ) fntype |=(int) Multi; |
89 | 89 | ||
90 | QString modifier = QString().sprintf( " = 0x%08x", fntype ); | 90 | QString modifier = QString().sprintf( " = 0x%08x", fntype ); |
91 | new OListViewItem( l, filename, multi ? "MULTI" : "SINGLE", modifier ); | 91 | new OListViewItem( l, filename, multi ? "MULTI" : "SINGLE", modifier ); |
92 | if ( !multi ) | 92 | if ( !multi ) |
93 | OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype ); | 93 | OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype ); |
94 | else | 94 | else |
95 | OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype ); | 95 | OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype ); |
96 | } | 96 | } |
97 | else | 97 | else |
98 | { | 98 | { |
99 | odebug << "cancelled." << oendl; | 99 | odebug << "cancelled." << oendl; |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | public slots: | 103 | public slots: |
104 | void modifierClicked( int modifier ) { (int)m ^= modifier; }; | 104 | void modifierClicked( int modifier ) { m = static_cast<OFileNotificationType>( (int)m ^ int(modifier) ); }; |
105 | void addSingle() { addTrigger(); }; | 105 | void addSingle() { addTrigger(); }; |
106 | void addMulti() { addTrigger( true ); }; | 106 | void addMulti() { addTrigger( true ); }; |
107 | 107 | ||
108 | void delTrigger() | 108 | void delTrigger() |
109 | { | 109 | { |
110 | QListViewItem* item = l->selectedItem(); | 110 | QListViewItem* item = l->selectedItem(); |
111 | if ( !item ) | 111 | if ( !item ) |
112 | { | 112 | { |
113 | QMessageBox::warning( 0, "Del Trigger", "<p>No trigger selected!</p>", "&Sorry", 0 ); | 113 | QMessageBox::warning( 0, "Del Trigger", "<p>No trigger selected!</p>", "&Sorry", 0 ); |
114 | return; | 114 | return; |
115 | } | 115 | } |
116 | else | 116 | else |
117 | { | 117 | { |
118 | QString filename( item->text( 0 ) ); | 118 | QString filename( item->text( 0 ) ); |
119 | odebug << "Filename = " << filename << oendl; | 119 | odebug << "Filename = " << filename << oendl; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | void trigger() | 123 | void trigger() |
124 | { | 124 | { |
125 | owarn << "FIRE!" << oendl; | 125 | owarn << "FIRE!" << oendl; |
126 | } | 126 | } |
127 | 127 | ||
128 | private: | 128 | private: |
129 | OListView* l; | 129 | OListView* l; |
130 | QButtonGroup* g1; | 130 | QButtonGroup* g1; |
131 | QButtonGroup* g2; | 131 | QButtonGroup* g2; |
132 | OFileNotificationType m; | 132 | OFileNotificationType m; |
133 | }; | 133 | }; |
134 | 134 | ||
135 | int main( int argc, char** argv ) | 135 | int main( int argc, char** argv ) |
136 | { | 136 | { |
137 | DemoApp* app = new DemoApp( argc, argv ); | 137 | DemoApp* app = new DemoApp( argc, argv ); |
138 | app->exec(); | 138 | app->exec(); |
139 | 139 | ||
140 | return 0; | 140 | return 0; |
141 | 141 | ||
142 | } | 142 | } |
143 | 143 | ||
144 | #include "moc/onotifydemo.moc" | 144 | #include "moc/onotifydemo.moc" |