-rw-r--r-- | noncore/apps/opie-bartender/bartender.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp index bee164c..57b28d4 100644 --- a/noncore/apps/opie-bartender/bartender.cpp +++ b/noncore/apps/opie-bartender/bartender.cpp | |||
@@ -19,8 +19,8 @@ | |||
19 | 19 | ||
20 | /* OPIE */ | 20 | /* OPIE */ |
21 | #include <opie2/odebug.h> | 21 | #include <opie2/odebug.h> |
22 | #include <opie2/oresource.h> | ||
22 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/resource.h> | ||
24 | using namespace Opie::Core; | 24 | using namespace Opie::Core; |
25 | 25 | ||
26 | /* QT */ | 26 | /* QT */ |
@@ -49,20 +49,17 @@ Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) | |||
49 | : QMainWindow( parent, name, fl ) { | 49 | : QMainWindow( parent, name, fl ) { |
50 | if ( !name ) | 50 | if ( !name ) |
51 | setName( "Bartender" ); | 51 | setName( "Bartender" ); |
52 | QGridLayout *layout = new QGridLayout( this ); | 52 | |
53 | layout->setSpacing( 2); | ||
54 | layout->setMargin( 2); | ||
55 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 53 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
56 | 54 | ||
57 | setCaption( tr( "Bartender" ) ); | 55 | setCaption( tr( "Bartender" ) ); |
58 | 56 | ||
59 | setToolBarsMovable( FALSE ); | 57 | setToolBarsMovable( false ); |
60 | 58 | QToolBar *dock = new QToolBar( this ); | |
61 | ToolBar1 = new QToolBar( this, "ToolBar1" ); | 59 | dock->setHorizontalStretchable( true ); |
62 | ToolBar1->setFixedHeight(22); | ||
63 | layout->addMultiCellWidget( ToolBar1, 0, 0, 0, 4 ); | ||
64 | 60 | ||
65 | QMenuBar *menuBar = new QMenuBar( ToolBar1 ); | 61 | QMenuBar *menuBar = new QMenuBar( dock ); |
62 | menuBar->setMargin( 0 ); | ||
66 | QPopupMenu *fileMenu; | 63 | QPopupMenu *fileMenu; |
67 | fileMenu = new QPopupMenu( this); | 64 | fileMenu = new QPopupMenu( this); |
68 | menuBar->insertItem( tr("File"), fileMenu ); | 65 | menuBar->insertItem( tr("File"), fileMenu ); |
@@ -80,20 +77,25 @@ Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) | |||
80 | connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) )); | 77 | connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) )); |
81 | connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) )); | 78 | connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) )); |
82 | 79 | ||
80 | ToolBar1 = new QToolBar( this ); | ||
83 | 81 | ||
84 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 ); | 82 | QAction *a = new QAction( tr( "New" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), |
83 | "New", 0, this, 0 ); | ||
85 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 84 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
86 | a->addTo( ToolBar1 ); | 85 | a->addTo( ToolBar1 ); |
87 | 86 | ||
88 | a = new QAction( tr( "Open" ), Resource::loadPixmap( "bartender/bartender_sm" ), "open", 0, this, 0 ); | 87 | a = new QAction( tr( "Open" ), Opie::Core::OResource::loadPixmap( "bartender/bartender_sm", Opie::Core::OResource::SmallIcon ), |
88 | "open", 0, this, 0 ); | ||
89 | connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) ); | 89 | connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) ); |
90 | a->addTo( ToolBar1 ); | 90 | a->addTo( ToolBar1 ); |
91 | 91 | ||
92 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), "Find", 0, this, 0 ); | 92 | a = new QAction( tr( "Find" ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), |
93 | "Find", 0, this, 0 ); | ||
93 | connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) ); | 94 | connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) ); |
94 | a->addTo( ToolBar1 ); | 95 | a->addTo( ToolBar1 ); |
95 | 96 | ||
96 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),"Edit", 0, this, 0 ); | 97 | a = new QAction( tr( "Edit" ), Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), |
98 | "Edit", 0, this, 0 ); | ||
97 | connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) ); | 99 | connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) ); |
98 | a->addTo( ToolBar1 ); | 100 | a->addTo( ToolBar1 ); |
99 | 101 | ||
@@ -103,7 +105,6 @@ Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) | |||
103 | 105 | ||
104 | DrinkView = new QListView( this, "DrinkView" ); | 106 | DrinkView = new QListView( this, "DrinkView" ); |
105 | DrinkView->addColumn( tr( "Name of Drink" ) ); | 107 | DrinkView->addColumn( tr( "Name of Drink" ) ); |
106 | // DrinkView->setRootIsDecorated( TRUE ); | ||
107 | DrinkView->header()->hide(); | 108 | DrinkView->header()->hide(); |
108 | 109 | ||
109 | QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold); | 110 | QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold); |
@@ -112,7 +113,6 @@ Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) | |||
112 | connect(DrinkView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 113 | connect(DrinkView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
113 | this,SLOT( showDrink(int,QListViewItem*,const QPoint&,int))); | 114 | this,SLOT( showDrink(int,QListViewItem*,const QPoint&,int))); |
114 | 115 | ||
115 | layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 ); | ||
116 | if(QDir("db").exists()) | 116 | if(QDir("db").exists()) |
117 | drinkDB.setFile("db/drinkdb.txt"); | 117 | drinkDB.setFile("db/drinkdb.txt"); |
118 | else | 118 | else |
@@ -121,6 +121,8 @@ Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) | |||
121 | initDrinkDb(); | 121 | initDrinkDb(); |
122 | 122 | ||
123 | DrinkView->setFocus(); | 123 | DrinkView->setFocus(); |
124 | |||
125 | setCentralWidget( DrinkView ); | ||
124 | } | 126 | } |
125 | 127 | ||
126 | Bartender::~Bartender() { | 128 | Bartender::~Bartender() { |