Diffstat (limited to 'noncore/apps/opie-bartender/bartender.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-bartender/bartender.cpp | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp index e6cb515..59fc242 100644 --- a/noncore/apps/opie-bartender/bartender.cpp +++ b/noncore/apps/opie-bartender/bartender.cpp @@ -15,14 +15,15 @@ #include "inputDialog.h" #include "searchresults.h" #include "bac.h" -#include <qtoolbar.h> -#include <qmenubar.h> -//#include <opie2/colorpopupmenu.h> +/* OPIE */ +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> +using namespace Opie::Core; +/* QT */ #include <qlineedit.h> #include <qdir.h> #include <qpushbutton.h> #include <qlistbox.h> @@ -32,16 +33,18 @@ #include <qaction.h> #include <qheader.h> #include <qlistview.h> #include <qlayout.h> +#include <qtoolbar.h> +#include <qmenubar.h> +/* STD */ #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <errno.h> - Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) : QMainWindow( parent, name, fl ) { if ( !name ) setName( "Bartender" ); @@ -143,15 +146,15 @@ void Bartender::fillList() { QString s; while ( !t.eof()) { s = t.readLine(); if(s.find("#",0,TRUE) != -1) { -// qDebug(s.right(s.length()-2)); +// odebug << s.right(s.length()-2) << oendl; item= new QListViewItem( DrinkView, 0 ); item->setText( 0, s.right(s.length()-2)); i++; } } - qDebug("there are currently %d of drinks", i); + odebug << "there are currently " << i << " of drinks" << oendl; } void Bartender::fileNew() { @@ -170,9 +173,9 @@ void Bartender::fileNew() { } if(newDrinks ->result() == 1 ) { QString newDrink="\n# "+newName+"\n"; newDrink.append(newIng+"\n"); - qDebug("writing "+newDrink); + odebug << "writing "+newDrink << oendl; dbFile.writeBlock( newDrink.latin1(), newDrink.length()); clearList(); dbFile.close(); @@ -206,9 +209,9 @@ void Bartender::showDrink( QListViewItem *item) { if(s.find( myDrink, 0, TRUE) != -1) { for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { s2 = t.readLine(); if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { -// qDebug(s2); +// odebug << s2 << oendl; showDrinks->MultiLineEdit1->append(s2); } if( dbFile.atEnd() ) break; } @@ -247,9 +250,9 @@ void Bartender::doSearchByName() { searchForDrinkName = fileDlg->LineEdit1->text(); QListViewItemIterator it( DrinkView ); for ( ; it.current(); ++it ) { if ( it.current()->text(0).find( searchForDrinkName, 0, TRUE) != -1 ) { -// qDebug( it.current()->text(0)); +// odebug << it.current()->text(0) << oendl; searchList.append(it.current()->text(0)); } } if(searchList.count() >0) @@ -278,12 +281,12 @@ void Bartender::doSearchByDrink() { while ( !t.eof()) { s = t.readLine(); if(s.find("#",0,TRUE) != -1) { lastDrinkName=s.right(s.length()-2); -// qDebug("last drink name "+lastDrinkName); +// odebug << "last drink name "+lastDrinkName << oendl; } else if( s.find( searchForDrinkName ,0, FALSE) != -1 && lastDrinkName != tempName ) { -// qDebug("appending "+lastDrinkName); +// odebug << "appending "+lastDrinkName << oendl; searchList.append( lastDrinkName); tempName=lastDrinkName; } // if( dbFile.atEnd() ) break; @@ -312,9 +315,9 @@ void Bartender::showSearchResult(QStringList &searchList) { } QListViewItemIterator it2( DrinkView ); for ( ; it2.current(); ++it2 ) { if ( it2.current()->text(0)== result ) { -// qDebug( it2.current()->text(0)); +// odebug << it2.current()->text(0) << oendl; showDrink(it2.current()); } } delete searchDlg; @@ -342,9 +345,9 @@ void Bartender::doEdit() { foundAt = dbFile.at() - (s.length()+1); for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { s2 = t.readLine(); if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { -// qDebug(s2); +// odebug << s2 << oendl; newDrinks->MultiLineEdit1->append(s2); newDrinks->LineEdit1->setText(myDrink); } if( dbFile.atEnd() ) break; @@ -369,9 +372,9 @@ void Bartender::doEdit() { #warning FIXME problems with editing drinks db ////////// FIXME write to user file QString newDrink="# "+newName+"\n"; newDrink.append(newIng+"\n"); - qDebug("writing "+newDrink); + odebug << "writing "+newDrink << oendl; dbFile.writeBlock( newDrink.latin1(), newDrink.length()); clearList(); dbFile.flush(); @@ -396,9 +399,9 @@ void Bartender::openCurrentDrink() { showDrink(DrinkView->currentItem()); } void Bartender::fileMenuActivated( int item) { - qDebug("Item %d", item); + odebug << "Item " << item << "" << oendl; switch(item) { case -3: // new -3 fileNew(); break; @@ -417,9 +420,9 @@ void Bartender::fileMenuActivated( int item) { } } void Bartender::editMenuActivated(int item) { - qDebug("Item %d", item); + odebug << "Item " << item << "" << oendl; /* edit -8 */ switch(item) { |