Diffstat (limited to 'noncore/apps/opie-bartender/bartender.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-bartender/bartender.cpp | 235 |
1 files changed, 100 insertions, 135 deletions
diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp index b4958b3..bee164c 100644 --- a/noncore/apps/opie-bartender/bartender.cpp +++ b/noncore/apps/opie-bartender/bartender.cpp | |||
@@ -12,12 +12,13 @@ | |||
12 | 12 | ||
13 | #include "bartender.h" | 13 | #include "bartender.h" |
14 | #include "showdrinks.h" | 14 | #include "showdrinks.h" |
15 | #include "inputDialog.h" | 15 | #include "inputDialog.h" |
16 | #include "searchresults.h" | 16 | #include "searchresults.h" |
17 | #include "bac.h" | 17 | #include "bac.h" |
18 | #include "drinkdata.h" | ||
18 | 19 | ||
19 | /* OPIE */ | 20 | /* OPIE */ |
20 | #include <opie2/odebug.h> | 21 | #include <opie2/odebug.h> |
21 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
22 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
23 | using namespace Opie::Core; | 24 | using namespace Opie::Core; |
@@ -52,30 +53,32 @@ Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) | |||
52 | layout->setSpacing( 2); | 53 | layout->setSpacing( 2); |
53 | layout->setMargin( 2); | 54 | layout->setMargin( 2); |
54 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 55 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
55 | 56 | ||
56 | setCaption( tr( "Bartender" ) ); | 57 | setCaption( tr( "Bartender" ) ); |
57 | 58 | ||
59 | setToolBarsMovable( FALSE ); | ||
60 | |||
58 | ToolBar1 = new QToolBar( this, "ToolBar1" ); | 61 | ToolBar1 = new QToolBar( this, "ToolBar1" ); |
59 | ToolBar1->setFixedHeight(22); | 62 | ToolBar1->setFixedHeight(22); |
60 | layout->addMultiCellWidget( ToolBar1, 0, 0, 0, 4 ); | 63 | layout->addMultiCellWidget( ToolBar1, 0, 0, 0, 4 ); |
61 | 64 | ||
62 | QMenuBar *menuBar = new QMenuBar( ToolBar1 ); | 65 | QMenuBar *menuBar = new QMenuBar( ToolBar1 ); |
63 | QPopupMenu *fileMenu; | 66 | QPopupMenu *fileMenu; |
64 | fileMenu = new QPopupMenu( this); | 67 | fileMenu = new QPopupMenu( this); |
65 | menuBar->insertItem( tr("File"), fileMenu ); | 68 | menuBar->insertItem( tr("File"), fileMenu ); |
66 | 69 | ||
67 | fileMenu->insertItem(tr("New Drink")); | 70 | fileMenu->insertItem(tr("New Drink")); |
68 | fileMenu->insertItem(tr("Open Drink")); | 71 | fileMenu->insertItem(tr("Open Drink")); |
69 | fileMenu->insertItem(tr("Find by Drink Name")); | 72 | fileMenu->insertItem(tr("Find by Drink Name")); |
70 | fileMenu->insertItem(tr("Find by Alcohol")); | 73 | fileMenu->insertItem(tr("Find by Ingredient")); |
71 | 74 | ||
72 | QPopupMenu *editMenu; | 75 | QPopupMenu *editMenu; |
73 | editMenu = new QPopupMenu( this); | 76 | editMenu = new QPopupMenu( this); |
74 | menuBar->insertItem( tr("Edit"), editMenu ); | 77 | menuBar->insertItem( tr("Edit"), editMenu ); |
75 | editMenu->insertItem(tr("edit")); | 78 | editMenu->insertItem(tr("Edit Drink")); |
76 | 79 | ||
77 | connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) )); | 80 | connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) )); |
78 | connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) )); | 81 | connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) )); |
79 | 82 | ||
80 | 83 | ||
81 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 ); | 84 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 ); |
@@ -107,82 +110,88 @@ Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) | |||
107 | 110 | ||
108 | connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink(QListViewItem*))); | 111 | connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink(QListViewItem*))); |
109 | connect(DrinkView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 112 | connect(DrinkView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
110 | this,SLOT( showDrink(int,QListViewItem*,const QPoint&,int))); | 113 | this,SLOT( showDrink(int,QListViewItem*,const QPoint&,int))); |
111 | 114 | ||
112 | layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 ); | 115 | layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 ); |
113 | if(QDir("db").exists()) { | 116 | if(QDir("db").exists()) |
114 | dbFile.setName( "db/drinkdb.txt"); | 117 | drinkDB.setFile("db/drinkdb.txt"); |
115 | } else | 118 | else |
116 | dbFile.setName( QPEApplication::qpeDir()+"etc/bartender/drinkdb.txt"); | 119 | drinkDB.setFile(QPEApplication::qpeDir()+"etc/bartender/drinkdb.txt"); |
120 | |||
117 | initDrinkDb(); | 121 | initDrinkDb(); |
122 | |||
123 | DrinkView->setFocus(); | ||
118 | } | 124 | } |
119 | 125 | ||
120 | Bartender::~Bartender() { | 126 | Bartender::~Bartender() { |
121 | } | 127 | } |
122 | 128 | ||
123 | /* | 129 | /* |
124 | this happens right before exit */ | 130 | this happens right before exit */ |
125 | void Bartender::cleanUp() { | 131 | void Bartender::cleanUp() { |
126 | dbFile.close(); | ||
127 | 132 | ||
128 | } | 133 | } |
129 | 134 | ||
130 | void Bartender::initDrinkDb() { | 135 | void Bartender::initDrinkDb() { |
131 | 136 | if(drinkDB.read()) | |
132 | if(!dbFile.isOpen()) | 137 | fillList(); |
133 | if ( !dbFile.open( IO_ReadOnly)) { | 138 | else |
134 | QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); | 139 | QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); |
135 | return; | ||
136 | } | ||
137 | fillList(); | ||
138 | } | 140 | } |
139 | 141 | ||
140 | void Bartender::fillList() { | 142 | void Bartender::fillList() { |
141 | dbFile.at(1); | 143 | QString lastName; |
144 | if( DrinkView->currentItem() != NULL ) | ||
145 | lastName = DrinkView->currentItem()->text(0); | ||
146 | else | ||
147 | lastName = ""; | ||
148 | |||
142 | DrinkView->clear(); | 149 | DrinkView->clear(); |
143 | int i=0; | 150 | int i=0; |
144 | QListViewItem * item ; | 151 | QListViewItem * item ; |
145 | QTextStream t( &dbFile); | ||
146 | QString s; | 152 | QString s; |
147 | while ( !t.eof()) { | 153 | |
148 | s = t.readLine(); | 154 | DrinkList::Iterator it = drinkDB.getBegin(); |
149 | if(s.find("#",0,TRUE) != -1) { | 155 | while ( it != drinkDB.getEnd() ) { |
150 | // odebug << s.right(s.length()-2) << oendl; | 156 | item= new QListViewItem( DrinkView, 0 ); |
151 | item= new QListViewItem( DrinkView, 0 ); | 157 | item->setText( 0, (*it).getName()); |
152 | item->setText( 0, s.right(s.length()-2)); | 158 | i++; |
153 | i++; | 159 | ++it; |
160 | } | ||
161 | |||
162 | if( lastName != "" ) { | ||
163 | QListViewItemIterator it( DrinkView ); | ||
164 | for ( ; it.current(); ++it ) { | ||
165 | if ( it.current()->text(0) == lastName ) { | ||
166 | DrinkView->setCurrentItem(it.current()); | ||
167 | break; | ||
168 | } | ||
154 | } | 169 | } |
155 | } | 170 | } |
171 | else if( DrinkView->childCount() > 0) | ||
172 | DrinkView->setCurrentItem(DrinkView->firstChild()); | ||
173 | |||
156 | odebug << "there are currently " << i << " of drinks" << oendl; | 174 | odebug << "there are currently " << i << " of drinks" << oendl; |
157 | } | 175 | } |
158 | 176 | ||
159 | void Bartender::fileNew() { | 177 | void Bartender::fileNew() { |
160 | 178 | ||
161 | New_Drink *newDrinks; | 179 | New_Drink *newDrinks; |
162 | newDrinks = new New_Drink(this,"New Drink....", TRUE); | 180 | newDrinks = new New_Drink(this,"New Drink", TRUE); |
163 | QString newName, newIng; | 181 | QString newName, newIng; |
164 | QPEApplication::execDialog( newDrinks ); | 182 | QPEApplication::execDialog( newDrinks ); |
165 | newName = newDrinks->LineEdit1->text(); | 183 | newName = newDrinks->LineEdit1->text(); |
166 | newIng= newDrinks->MultiLineEdit1->text(); | 184 | newIng= newDrinks->MultiLineEdit1->text(); |
167 | 185 | ||
168 | if(dbFile.isOpen()) | ||
169 | dbFile.close(); | ||
170 | if ( !dbFile.open( IO_WriteOnly| IO_Append)) { | ||
171 | QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); | ||
172 | return; | ||
173 | } | ||
174 | if(newDrinks ->result() == 1 ) { | 186 | if(newDrinks ->result() == 1 ) { |
175 | QString newDrink="\n# "+newName+"\n"; | 187 | drinkDB.addDrink(newName, newIng); |
176 | newDrink.append(newIng+"\n"); | 188 | if(!drinkDB.writeChanges()) { |
177 | odebug << "writing "+newDrink << oendl; | 189 | QMessageBox::message( (tr("Note")), (tr("Failed to write to drink database!\n")) ); |
178 | dbFile.writeBlock( newDrink.latin1(), newDrink.length()); | 190 | } |
179 | clearList(); | 191 | fillList(); |
180 | dbFile.close(); | ||
181 | |||
182 | initDrinkDb(); | ||
183 | } | 192 | } |
184 | delete newDrinks; | 193 | delete newDrinks; |
185 | } | 194 | } |
186 | 195 | ||
187 | void Bartender::showDrink(int mouse, QListViewItem * item, const QPoint&, int) { | 196 | void Bartender::showDrink(int mouse, QListViewItem * item, const QPoint&, int) { |
188 | switch (mouse) { | 197 | switch (mouse) { |
@@ -194,49 +203,36 @@ void Bartender::showDrink(int mouse, QListViewItem * item, const QPoint&, int) { | |||
194 | break; | 203 | break; |
195 | } | 204 | } |
196 | } | 205 | } |
197 | 206 | ||
198 | void Bartender::showDrink( QListViewItem *item) { | 207 | void Bartender::showDrink( QListViewItem *item) { |
199 | if(item==NULL) return; | 208 | if(item==NULL) return; |
200 | dbFile.at(0); | ||
201 | Show_Drink *showDrinks; | 209 | Show_Drink *showDrinks; |
202 | QString myDrink=item->text(0); | 210 | QString myDrink=item->text(0); |
203 | showDrinks = new Show_Drink(this, myDrink, TRUE); | 211 | showDrinks = new Show_Drink(this, myDrink, TRUE); |
204 | QTextStream t( &dbFile); | ||
205 | |||
206 | QString s, s2; | ||
207 | while ( !t.eof()) { | ||
208 | s = t.readLine(); | ||
209 | if(s.find( myDrink, 0, TRUE) != -1) { | ||
210 | for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { | ||
211 | s2 = t.readLine(); | ||
212 | if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { | ||
213 | // odebug << s2 << oendl; | ||
214 | showDrinks->MultiLineEdit1->append(s2); | ||
215 | } | ||
216 | if( dbFile.atEnd() ) break; | ||
217 | } | ||
218 | } | ||
219 | } | ||
220 | QPEApplication::execDialog( showDrinks ); | ||
221 | 212 | ||
222 | if(showDrinks ->result() ==0) { | 213 | DrinkList::Iterator it = drinkDB.findDrink(myDrink); |
223 | doEdit(); | 214 | if(it != drinkDB.getEnd()) { |
215 | showDrinks->MultiLineEdit1->setText((*it).getIngredients()); | ||
216 | |||
217 | connect(showDrinks->editDrinkButton, SIGNAL(clicked()), this, SLOT(doEdit())); | ||
218 | QPEApplication::execDialog( showDrinks ); | ||
224 | } | 219 | } |
220 | |||
225 | delete showDrinks; | 221 | delete showDrinks; |
226 | } | 222 | } |
227 | 223 | ||
228 | void Bartender::askSearch() { | 224 | void Bartender::askSearch() { |
229 | switch ( QMessageBox::warning(this,tr("Find"),tr("Search by drink name\n")+ | 225 | switch ( QMessageBox::warning(this,tr("Find"),tr("Search by drink name\n")+ |
230 | "\nor alcohol ?" | 226 | "\nor ingredient ?" |
231 | ,tr("Drink Name"),tr("Alcohol"),0,0,1) ) { | 227 | ,tr("Drink Name"),tr("Ingredient"),0,0,1) ) { |
232 | case 0: | 228 | case 0: |
233 | doSearchByName(); | 229 | doSearchByName(); |
234 | break; | 230 | break; |
235 | case 1: | 231 | case 1: |
236 | doSearchByDrink(); | 232 | doSearchByIngredient(); |
237 | break; | 233 | break; |
238 | }; | 234 | }; |
239 | } | 235 | } |
240 | 236 | ||
241 | /* search by name */ | 237 | /* search by name */ |
242 | void Bartender::doSearchByName() { | 238 | void Bartender::doSearchByName() { |
@@ -247,58 +243,51 @@ void Bartender::doSearchByName() { | |||
247 | fileDlg = new InputDialog(this,tr("Find by Drink Name"),TRUE, 0); | 243 | fileDlg = new InputDialog(this,tr("Find by Drink Name"),TRUE, 0); |
248 | fileDlg->exec(); | 244 | fileDlg->exec(); |
249 | if( fileDlg->result() == 1 ) { | 245 | if( fileDlg->result() == 1 ) { |
250 | searchForDrinkName = fileDlg->LineEdit1->text(); | 246 | searchForDrinkName = fileDlg->LineEdit1->text(); |
251 | QListViewItemIterator it( DrinkView ); | 247 | QListViewItemIterator it( DrinkView ); |
252 | for ( ; it.current(); ++it ) { | 248 | for ( ; it.current(); ++it ) { |
253 | if ( it.current()->text(0).find( searchForDrinkName, 0, TRUE) != -1 ) { | 249 | if ( it.current()->text(0).find( searchForDrinkName, 0, FALSE) != -1 ) { |
254 | // odebug << it.current()->text(0) << oendl; | 250 | // odebug << it.current()->text(0) << oendl; |
255 | searchList.append(it.current()->text(0)); | 251 | searchList.append(it.current()->text(0)); |
256 | } | 252 | } |
257 | } | 253 | } |
258 | if(searchList.count() >0) | 254 | if(searchList.count() >0) |
259 | showSearchResult(searchList); | 255 | showSearchResult(searchList); |
260 | else | 256 | else |
261 | QMessageBox::message(tr("Search"),tr("Sorry no results for\n")+searchForDrinkName); | 257 | QMessageBox::message(tr("Search"),tr("Sorry no results for\n")+searchForDrinkName); |
262 | }//end Inputdialog | 258 | }//end Inputdialog |
263 | delete fileDlg; | 259 | delete fileDlg; |
264 | } | 260 | } |
265 | 261 | ||
266 | void Bartender::doSearchByDrink() { | 262 | void Bartender::doSearchByIngredient() { |
267 | // if( DrinkView->currentItem() == NULL) return; | 263 | // if( DrinkView->currentItem() == NULL) return; |
268 | QStringList searchList; | 264 | QStringList searchList; |
269 | QString searchForDrinkName, lastDrinkName, tempName; | 265 | QString searchForIngredient, lastDrinkName, lastDrinkIngredients; |
270 | 266 | ||
271 | InputDialog *fileDlg; | 267 | InputDialog *fileDlg; |
272 | fileDlg = new InputDialog(this,tr("Find by Alcohol"),TRUE, 0); | 268 | fileDlg = new InputDialog(this,tr("Find by Ingredient"),TRUE, 0); |
273 | fileDlg->exec(); | 269 | fileDlg->exec(); |
274 | if( fileDlg->result() == 1 ) { | 270 | if( fileDlg->result() == 1 ) { |
275 | searchForDrinkName = fileDlg->LineEdit1->text(); | 271 | searchForIngredient = fileDlg->LineEdit1->text(); |
276 | 272 | ||
277 | dbFile.at(0); | 273 | DrinkList::Iterator it = drinkDB.getBegin(); |
278 | QTextStream t( &dbFile); | 274 | while ( it != drinkDB.getEnd() ) { |
279 | 275 | lastDrinkName = (*it).getName(); | |
280 | QString s, s2; | 276 | lastDrinkIngredients = (*it).getIngredients(); |
281 | while ( !t.eof()) { | 277 | |
282 | s = t.readLine(); | 278 | if( lastDrinkIngredients.find( searchForIngredient ,0, FALSE) != -1 ) |
283 | if(s.find("#",0,TRUE) != -1) { | 279 | searchList.append( lastDrinkName ); |
284 | lastDrinkName=s.right(s.length()-2); | 280 | |
285 | // odebug << "last drink name "+lastDrinkName << oendl; | 281 | ++it; |
286 | } | 282 | } |
287 | else if( s.find( searchForDrinkName ,0, FALSE) != -1 && lastDrinkName != tempName ) { | 283 | |
288 | // odebug << "appending "+lastDrinkName << oendl; | ||
289 | searchList.append( lastDrinkName); | ||
290 | tempName=lastDrinkName; | ||
291 | } | ||
292 | // if( dbFile.atEnd() ) break; | ||
293 | |||
294 | } //oef | ||
295 | if(searchList.count() >0) | 284 | if(searchList.count() >0) |
296 | showSearchResult(searchList); | 285 | showSearchResult(searchList); |
297 | else | 286 | else |
298 | QMessageBox::message(tr("Search"),tr("Sorry no results for\n")+ searchForDrinkName); | 287 | QMessageBox::message(tr("Search"),tr("Sorry no results for\n")+ searchForIngredient); |
299 | } | 288 | } |
300 | delete fileDlg; | 289 | delete fileDlg; |
301 | } | 290 | } |
302 | 291 | ||
303 | void Bartender::showSearchResult(QStringList &searchList) { | 292 | void Bartender::showSearchResult(QStringList &searchList) { |
304 | QString result; | 293 | QString result; |
@@ -321,69 +310,45 @@ void Bartender::showSearchResult(QStringList &searchList) { | |||
321 | } | 310 | } |
322 | } | 311 | } |
323 | delete searchDlg; | 312 | delete searchDlg; |
324 | } | 313 | } |
325 | 314 | ||
326 | void Bartender::doEdit() { | 315 | void Bartender::doEdit() { |
327 | if(DrinkView->currentItem() == NULL) { | 316 | if(DrinkView->currentItem() == NULL) { |
328 | fileNew(); | 317 | fileNew(); |
329 | } | 318 | return; |
319 | } | ||
330 | 320 | ||
331 | QString myDrink; | 321 | QString myDrink; |
332 | myDrink= DrinkView->currentItem()->text(0); | 322 | myDrink= DrinkView->currentItem()->text(0); |
333 | dbFile.at(0); | 323 | |
334 | int foundAt=0; | ||
335 | New_Drink *newDrinks; | 324 | New_Drink *newDrinks; |
336 | newDrinks = new New_Drink(this,"Edit Drink....", TRUE); | 325 | newDrinks = new New_Drink(this,"Edit Drink", TRUE); |
337 | QString newName, newIng; | 326 | QString newName, newIng; |
338 | QPEApplication::showDialog( newDrinks ); | 327 | QPEApplication::showDialog( newDrinks ); |
339 | QTextStream t( &dbFile); | ||
340 | |||
341 | QString s, s2; | ||
342 | while ( !t.eof()) { | ||
343 | s = t.readLine(); | ||
344 | if(s.find( myDrink, 0, TRUE) != -1) { | ||
345 | foundAt = dbFile.at() - (s.length()+1); | ||
346 | for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { | ||
347 | s2 = t.readLine(); | ||
348 | if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { | ||
349 | // odebug << s2 << oendl; | ||
350 | newDrinks->MultiLineEdit1->append(s2); | ||
351 | newDrinks->LineEdit1->setText(myDrink); | ||
352 | } | ||
353 | if( dbFile.atEnd() ) break; | ||
354 | } | ||
355 | } | ||
356 | } | ||
357 | newDrinks->exec(); | ||
358 | newName = newDrinks->LineEdit1->text(); | ||
359 | newIng= newDrinks->MultiLineEdit1->text(); | ||
360 | 328 | ||
361 | if( newDrinks ->result() == 1 ) { | 329 | DrinkList::Iterator drinkItem = drinkDB.findDrink(myDrink); |
362 | if(dbFile.isOpen()) | 330 | if(drinkItem != drinkDB.getEnd()) { |
363 | dbFile.close(); | 331 | newDrinks->LineEdit1->setText((*drinkItem).getName()); |
364 | if ( !dbFile.open( IO_ReadWrite )) { | 332 | newDrinks->MultiLineEdit1->setText((*drinkItem).getIngredients()); |
365 | QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); | 333 | |
366 | return; | 334 | newDrinks->exec(); |
335 | newName = newDrinks->LineEdit1->text(); | ||
336 | newIng= newDrinks->MultiLineEdit1->text(); | ||
337 | |||
338 | if( newDrinks ->result() == 1 ) { | ||
339 | (*drinkItem).setName(newName); | ||
340 | (*drinkItem).setIngredients(newIng); | ||
341 | if(!drinkDB.writeChanges()) { | ||
342 | QMessageBox::message( (tr("Note")), (tr("Failed to write to drink database!\n")) ); | ||
343 | } | ||
344 | fillList(); | ||
367 | } | 345 | } |
368 | int fd = dbFile.handle(); | ||
369 | lseek( fd, foundAt, SEEK_SET); | ||
370 | |||
371 | // dbFile.at( foundAt); | ||
372 | #warning FIXME problems with editing drinks db | ||
373 | ////////// FIXME write to user file | ||
374 | QString newDrink="# "+newName+"\n"; | ||
375 | newDrink.append(newIng+"\n"); | ||
376 | odebug << "writing "+newDrink << oendl; | ||
377 | dbFile.writeBlock( newDrink.latin1(), newDrink.length()); | ||
378 | clearList(); | ||
379 | |||
380 | dbFile.flush(); | ||
381 | |||
382 | initDrinkDb(); | ||
383 | } | 346 | } |
347 | |||
348 | delete newDrinks; | ||
384 | } | 349 | } |
385 | 350 | ||
386 | void Bartender::clearList() { | 351 | void Bartender::clearList() { |
387 | DrinkView->clear(); | 352 | DrinkView->clear(); |
388 | } | 353 | } |
389 | 354 | ||
@@ -410,13 +375,13 @@ void Bartender::fileMenuActivated( int item) { | |||
410 | break; | 375 | break; |
411 | case -5:// drink -5 | 376 | case -5:// drink -5 |
412 | doSearchByName(); | 377 | doSearchByName(); |
413 | 378 | ||
414 | break; | 379 | break; |
415 | case -6:// alcohol -6 | 380 | case -6:// alcohol -6 |
416 | doSearchByDrink(); | 381 | doSearchByIngredient(); |
417 | 382 | ||
418 | break; | 383 | break; |
419 | 384 | ||
420 | } | 385 | } |
421 | } | 386 | } |
422 | 387 | ||