author | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:21:11 (UTC) |
commit | b6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (unidiff) | |
tree | d3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/apps/opie-bartender/bartender.cpp | |
parent | 0d59c780513da78033f4d9040475dee9db0256d4 (diff) | |
download | opie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2 |
applied the patch generated by the optimize_connect script from
TT.
Diffstat (limited to 'noncore/apps/opie-bartender/bartender.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-bartender/bartender.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp index 3c010e9..b6401ed 100644 --- a/noncore/apps/opie-bartender/bartender.cpp +++ b/noncore/apps/opie-bartender/bartender.cpp | |||
@@ -57,99 +57,99 @@ Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) | |||
57 | layout->addMultiCellWidget( ToolBar1, 0, 0, 0, 4 ); | 57 | layout->addMultiCellWidget( ToolBar1, 0, 0, 0, 4 ); |
58 | 58 | ||
59 | QMenuBar *menuBar = new QMenuBar( ToolBar1 ); | 59 | QMenuBar *menuBar = new QMenuBar( ToolBar1 ); |
60 | QPopupMenu *fileMenu; | 60 | QPopupMenu *fileMenu; |
61 | fileMenu = new QPopupMenu( this); | 61 | fileMenu = new QPopupMenu( this); |
62 | menuBar->insertItem( tr("File"), fileMenu ); | 62 | menuBar->insertItem( tr("File"), fileMenu ); |
63 | 63 | ||
64 | fileMenu->insertItem(tr("New Drink")); | 64 | fileMenu->insertItem(tr("New Drink")); |
65 | fileMenu->insertItem(tr("Open Drink")); | 65 | fileMenu->insertItem(tr("Open Drink")); |
66 | fileMenu->insertItem(tr("Find by Drink Name")); | 66 | fileMenu->insertItem(tr("Find by Drink Name")); |
67 | fileMenu->insertItem(tr("Find by Alcohol")); | 67 | fileMenu->insertItem(tr("Find by Alcohol")); |
68 | 68 | ||
69 | QPopupMenu *editMenu; | 69 | QPopupMenu *editMenu; |
70 | editMenu = new QPopupMenu( this); | 70 | editMenu = new QPopupMenu( this); |
71 | menuBar->insertItem( tr("Edit"), editMenu ); | 71 | menuBar->insertItem( tr("Edit"), editMenu ); |
72 | editMenu->insertItem(tr("edit")); | 72 | editMenu->insertItem(tr("edit")); |
73 | 73 | ||
74 | connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) )); | 74 | connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) )); |
75 | connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) )); | 75 | connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) )); |
76 | 76 | ||
77 | 77 | ||
78 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 ); | 78 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 ); |
79 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 79 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
80 | a->addTo( ToolBar1 ); | 80 | a->addTo( ToolBar1 ); |
81 | 81 | ||
82 | a = new QAction( tr( "Open" ), Resource::loadPixmap( "bartender/bartender_sm" ), "open", 0, this, 0 ); | 82 | a = new QAction( tr( "Open" ), Resource::loadPixmap( "bartender/bartender_sm" ), "open", 0, this, 0 ); |
83 | connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) ); | 83 | connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) ); |
84 | a->addTo( ToolBar1 ); | 84 | a->addTo( ToolBar1 ); |
85 | 85 | ||
86 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), "Find", 0, this, 0 ); | 86 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), "Find", 0, this, 0 ); |
87 | connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) ); | 87 | connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) ); |
88 | a->addTo( ToolBar1 ); | 88 | a->addTo( ToolBar1 ); |
89 | 89 | ||
90 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),"Edit", 0, this, 0 ); | 90 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),"Edit", 0, this, 0 ); |
91 | connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) ); | 91 | connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) ); |
92 | a->addTo( ToolBar1 ); | 92 | a->addTo( ToolBar1 ); |
93 | 93 | ||
94 | QPushButton *t; | 94 | QPushButton *t; |
95 | t= new QPushButton( "BAC", ToolBar1, "bacButtin"); | 95 | t= new QPushButton( "BAC", ToolBar1, "bacButtin"); |
96 | connect( t, SIGNAL( clicked() ), this, SLOT( doBac() ) ); | 96 | connect( t, SIGNAL( clicked() ), this, SLOT( doBac() ) ); |
97 | 97 | ||
98 | DrinkView = new QListView( this, "DrinkView" ); | 98 | DrinkView = new QListView( this, "DrinkView" ); |
99 | DrinkView->addColumn( tr( "Name of Drink" ) ); | 99 | DrinkView->addColumn( tr( "Name of Drink" ) ); |
100 | // DrinkView->setRootIsDecorated( TRUE ); | 100 | // DrinkView->setRootIsDecorated( TRUE ); |
101 | DrinkView->header()->hide(); | 101 | DrinkView->header()->hide(); |
102 | 102 | ||
103 | QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold); | 103 | QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold); |
104 | 104 | ||
105 | connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink( QListViewItem*))); | 105 | connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink(QListViewItem*))); |
106 | connect(DrinkView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 106 | connect(DrinkView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
107 | this,SLOT( showDrink(int, QListViewItem *, const QPoint&, int))); | 107 | this,SLOT( showDrink(int,QListViewItem*,const QPoint&,int))); |
108 | 108 | ||
109 | layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 ); | 109 | layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 ); |
110 | if(QDir("db").exists()) { | 110 | if(QDir("db").exists()) { |
111 | dbFile.setName( "db/drinkdb.txt"); | 111 | dbFile.setName( "db/drinkdb.txt"); |
112 | } else | 112 | } else |
113 | dbFile.setName( QPEApplication::qpeDir()+"/etc/bartender/drinkdb.txt"); | 113 | dbFile.setName( QPEApplication::qpeDir()+"/etc/bartender/drinkdb.txt"); |
114 | initDrinkDb(); | 114 | initDrinkDb(); |
115 | } | 115 | } |
116 | 116 | ||
117 | Bartender::~Bartender() { | 117 | Bartender::~Bartender() { |
118 | } | 118 | } |
119 | 119 | ||
120 | /* | 120 | /* |
121 | this happens right before exit */ | 121 | this happens right before exit */ |
122 | void Bartender::cleanUp() { | 122 | void Bartender::cleanUp() { |
123 | dbFile.close(); | 123 | dbFile.close(); |
124 | 124 | ||
125 | } | 125 | } |
126 | 126 | ||
127 | void Bartender::initDrinkDb() { | 127 | void Bartender::initDrinkDb() { |
128 | 128 | ||
129 | if(!dbFile.isOpen()) | 129 | if(!dbFile.isOpen()) |
130 | if ( !dbFile.open( IO_ReadOnly)) { | 130 | if ( !dbFile.open( IO_ReadOnly)) { |
131 | QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); | 131 | QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); |
132 | return; | 132 | return; |
133 | } | 133 | } |
134 | fillList(); | 134 | fillList(); |
135 | } | 135 | } |
136 | 136 | ||
137 | void Bartender::fillList() { | 137 | void Bartender::fillList() { |
138 | dbFile.at(1); | 138 | dbFile.at(1); |
139 | DrinkView->clear(); | 139 | DrinkView->clear(); |
140 | int i=0; | 140 | int i=0; |
141 | QListViewItem * item ; | 141 | QListViewItem * item ; |
142 | QTextStream t( &dbFile); | 142 | QTextStream t( &dbFile); |
143 | QString s; | 143 | QString s; |
144 | while ( !t.eof()) { | 144 | while ( !t.eof()) { |
145 | s = t.readLine(); | 145 | s = t.readLine(); |
146 | if(s.find("#",0,TRUE) != -1) { | 146 | if(s.find("#",0,TRUE) != -1) { |
147 | // qDebug(s.right(s.length()-2)); | 147 | // qDebug(s.right(s.length()-2)); |
148 | item= new QListViewItem( DrinkView, 0 ); | 148 | item= new QListViewItem( DrinkView, 0 ); |
149 | item->setText( 0, s.right(s.length()-2)); | 149 | item->setText( 0, s.right(s.length()-2)); |
150 | i++; | 150 | i++; |
151 | } | 151 | } |
152 | } | 152 | } |
153 | qDebug("there are currently %d of drinks", i); | 153 | qDebug("there are currently %d of drinks", i); |
154 | } | 154 | } |
155 | 155 | ||