summaryrefslogtreecommitdiff
authordrw <drw>2005-01-30 00:39:52 (UTC)
committer drw <drw>2005-01-30 00:39:52 (UTC)
commit2452e48bb55b9257059f22579a51b7a8cc44576a (patch) (unidiff)
tree807ba6014055e6b64699636bc4725799967abc14
parent114c5c468032a08205b2d8b7da3966bff6d47875 (diff)
downloadopie-2452e48bb55b9257059f22579a51b7a8cc44576a.zip
opie-2452e48bb55b9257059f22579a51b7a8cc44576a.tar.gz
opie-2452e48bb55b9257059f22579a51b7a8cc44576a.tar.bz2
Forgot icon for menu item...
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/ui/opimmainwindow.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libopie2/opiepim/ui/opimmainwindow.cpp b/libopie2/opiepim/ui/opimmainwindow.cpp
index 40bbb7b..d46df69 100644
--- a/libopie2/opiepim/ui/opimmainwindow.cpp
+++ b/libopie2/opiepim/ui/opimmainwindow.cpp
@@ -1,424 +1,425 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) 3 Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de)
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
6 .>+-= 6 .>+-=
7 _;:, .> :=|. This program is free software; you can 7 _;:, .> :=|. This program is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public 9:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - . .-<_> .<> Foundation; either version 2 of the License, 11 - . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This program is distributed in the hope that 14 .i_,=:_. -<s. This program is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.= = ; Library General Public License for more 19..}^=.= = ; Library General Public License for more
20++= -. .` .: details. 20++= -. .` .: details.
21 : = ...= . :.=- 21 : = ...= . :.=-
22 -. .:....=;==+<; You should have received a copy of the GNU 22 -. .:....=;==+<; You should have received a copy of the GNU
23 -_. . . )=. = Library General Public License along with 23 -_. . . )=. = Library General Public License along with
24 -- :-=` this library; see the file COPYING.LIB. 24 -- :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include "opimmainwindow.h" 30#include "opimmainwindow.h"
31 31
32/* OPIE */ 32/* OPIE */
33#include <opie2/opimresolver.h> 33#include <opie2/opimresolver.h>
34#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35 35
36#include <qpe/categoryselect.h> 36#include <qpe/categoryselect.h>
37#include <qpe/ir.h> 37#include <qpe/ir.h>
38#include <qpe/qcopenvelope_qws.h> 38#include <qpe/qcopenvelope_qws.h>
39#include <qpe/qpeapplication.h> 39#include <qpe/qpeapplication.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/sound.h> 41#include <qpe/sound.h>
42 42
43/* QT */ 43/* QT */
44#include <qaction.h> 44#include <qaction.h>
45#include <qapplication.h> 45#include <qapplication.h>
46#include <qcopchannel_qws.h> 46#include <qcopchannel_qws.h>
47#include <qdatetime.h> 47#include <qdatetime.h>
48#include <qmenubar.h> 48#include <qmenubar.h>
49#include <qobjectlist.h> 49#include <qobjectlist.h>
50#include <qpopupmenu.h> 50#include <qpopupmenu.h>
51#include <qtoolbar.h> 51#include <qtoolbar.h>
52 52
53namespace Opie { 53namespace Opie {
54OPimMainWindow::OPimMainWindow( const QString &serviceName, 54OPimMainWindow::OPimMainWindow( const QString &serviceName,
55 const QString &appName, const QString &catName, 55 const QString &appName, const QString &catName,
56 const QString &itemName, const QString &configName, 56 const QString &itemName, const QString &configName,
57 QWidget *parent, const char* name, WFlags f ) 57 QWidget *parent, const char* name, WFlags f )
58 : QMainWindow( parent, name, f ), m_rtti(-1), m_service( serviceName ), m_fallBack( 0l ), 58 : QMainWindow( parent, name, f ), m_rtti(-1), m_service( serviceName ), m_fallBack( 0l ),
59 m_appName( appName ), m_catGroupName( catName ), m_config( configName ), m_itemContextMenu( 0l ) 59 m_appName( appName ), m_catGroupName( catName ), m_config( configName ), m_itemContextMenu( 0l )
60{ 60{
61 61
62 /* 62 /*
63 * let's generate our QCopChannel 63 * let's generate our QCopChannel
64 */ 64 */
65 m_str = QString("QPE/"+m_service).local8Bit(); 65 m_str = QString("QPE/"+m_service).local8Bit();
66 m_channel= new QCopChannel(m_str, this ); 66 m_channel= new QCopChannel(m_str, this );
67 connect(m_channel, SIGNAL(received(const QCString&,const QByteArray&)), 67 connect(m_channel, SIGNAL(received(const QCString&,const QByteArray&)),
68 this, SLOT(appMessage(const QCString&,const QByteArray&)) ); 68 this, SLOT(appMessage(const QCString&,const QByteArray&)) );
69 connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), 69 connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
70 this, SLOT(appMessage(const QCString&,const QByteArray&)) ); 70 this, SLOT(appMessage(const QCString&,const QByteArray&)) );
71 71
72 /* connect flush and reload */ 72 /* connect flush and reload */
73 connect(qApp, SIGNAL(flush() ), 73 connect(qApp, SIGNAL(flush() ),
74 this, SLOT(flush() ) ); 74 this, SLOT(flush() ) );
75 connect(qApp, SIGNAL(reload() ), 75 connect(qApp, SIGNAL(reload() ),
76 this, SLOT(reload() ) ); 76 this, SLOT(reload() ) );
77 77
78 // Initialize user interface items 78 // Initialize user interface items
79 setCaption( m_appName ); 79 setCaption( m_appName );
80 initBars( itemName ); 80 initBars( itemName );
81} 81}
82 82
83OPimMainWindow::~OPimMainWindow() { 83OPimMainWindow::~OPimMainWindow() {
84 delete m_channel; 84 delete m_channel;
85} 85}
86 86
87QCopChannel* OPimMainWindow::channel() { 87QCopChannel* OPimMainWindow::channel() {
88 return m_channel; 88 return m_channel;
89} 89}
90 90
91void OPimMainWindow::doSetDocument( const QString& ) { 91void OPimMainWindow::doSetDocument( const QString& ) {
92 92
93} 93}
94 94
95void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) { 95void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) {
96 bool needShow = false; 96 bool needShow = false;
97 /* 97 /*
98 * create demands to create 98 * create demands to create
99 * a new record... 99 * a new record...
100 */ 100 */
101 QDataStream stream(array, IO_ReadOnly); 101 QDataStream stream(array, IO_ReadOnly);
102 if ( cmd == "create()" ) { 102 if ( cmd == "create()" ) {
103 raise(); 103 raise();
104 int uid = create(); 104 int uid = create();
105 QCopEnvelope e(m_str, "created(int)" ); 105 QCopEnvelope e(m_str, "created(int)" );
106 e << uid; 106 e << uid;
107 needShow = true; 107 needShow = true;
108 }else if ( cmd == "remove(int)" ) { 108 }else if ( cmd == "remove(int)" ) {
109 int uid; 109 int uid;
110 stream >> uid; 110 stream >> uid;
111 bool rem = remove( uid ); 111 bool rem = remove( uid );
112 QCopEnvelope e(m_str, "removed(bool)" ); 112 QCopEnvelope e(m_str, "removed(bool)" );
113 e << rem; 113 e << rem;
114 needShow = true; 114 needShow = true;
115 }else if ( cmd == "beam(int)" ) { 115 }else if ( cmd == "beam(int)" ) {
116 int uid; 116 int uid;
117 stream >> uid; 117 stream >> uid;
118 beam( uid); 118 beam( uid);
119 }else if ( cmd == "show(int)" ) { 119 }else if ( cmd == "show(int)" ) {
120 raise(); 120 raise();
121 int uid; 121 int uid;
122 stream >> uid; 122 stream >> uid;
123 show( uid ); 123 show( uid );
124 needShow = true; 124 needShow = true;
125 }else if ( cmd == "edit(int)" ) { 125 }else if ( cmd == "edit(int)" ) {
126 raise(); 126 raise();
127 int uid; 127 int uid;
128 stream >> uid; 128 stream >> uid;
129 edit( uid ); 129 edit( uid );
130 }else if ( cmd == "add(int,QByteArray)" ) { 130 }else if ( cmd == "add(int,QByteArray)" ) {
131 int rtti; 131 int rtti;
132 QByteArray array; 132 QByteArray array;
133 stream >> rtti; 133 stream >> rtti;
134 stream >> array; 134 stream >> array;
135 m_fallBack = record(rtti, array ); 135 m_fallBack = record(rtti, array );
136 if (!m_fallBack) return; 136 if (!m_fallBack) return;
137 add( *m_fallBack ); 137 add( *m_fallBack );
138 delete m_fallBack; 138 delete m_fallBack;
139 }else if ( cmd == "alarm(QDateTime,int)" ) { 139 }else if ( cmd == "alarm(QDateTime,int)" ) {
140 raise(); 140 raise();
141 QDateTime dt; int uid; 141 QDateTime dt; int uid;
142 stream >> dt; 142 stream >> dt;
143 stream >> uid; 143 stream >> uid;
144 QDateTime current = QDateTime::currentDateTime(); 144 QDateTime current = QDateTime::currentDateTime();
145 if ( current.time().hour() != dt.time().hour() && current.time().minute() != dt.time().minute() ) 145 if ( current.time().hour() != dt.time().hour() && current.time().minute() != dt.time().minute() )
146 return; 146 return;
147 doAlarm( dt, uid ); 147 doAlarm( dt, uid );
148 needShow = true; 148 needShow = true;
149 } 149 }
150 150
151 if (needShow ) 151 if (needShow )
152 QPEApplication::setKeepRunning(); 152 QPEApplication::setKeepRunning();
153} 153}
154 154
155/* implement the url scripting here */ 155/* implement the url scripting here */
156void OPimMainWindow::setDocument( const QString& str) { 156void OPimMainWindow::setDocument( const QString& str) {
157 doSetDocument( str ); 157 doSetDocument( str );
158} 158}
159 159
160/* 160/*
161 * we now try to get the array demarshalled 161 * we now try to get the array demarshalled
162 * check if the rtti matches this one 162 * check if the rtti matches this one
163 */ 163 */
164OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) { 164OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) {
165 if ( service() != rtti ) 165 if ( service() != rtti )
166 return 0l; 166 return 0l;
167 167
168 OPimRecord* record = OPimResolver::self()->record( rtti ); 168 OPimRecord* record = OPimResolver::self()->record( rtti );
169 QDataStream str(array, IO_ReadOnly ); 169 QDataStream str(array, IO_ReadOnly );
170 if ( !record || !record->loadFromStream(str) ) { 170 if ( !record || !record->loadFromStream(str) ) {
171 delete record; 171 delete record;
172 record = 0l; 172 record = 0l;
173 } 173 }
174 174
175 return record; 175 return record;
176} 176}
177 177
178/* 178/*
179 * get the rtti for the service 179 * get the rtti for the service
180 */ 180 */
181int OPimMainWindow::service() { 181int OPimMainWindow::service() {
182 if ( m_rtti == -1 ) 182 if ( m_rtti == -1 )
183 m_rtti = OPimResolver::self()->serviceId( m_service ); 183 m_rtti = OPimResolver::self()->serviceId( m_service );
184 184
185 return m_rtti; 185 return m_rtti;
186} 186}
187 187
188void OPimMainWindow::doAlarm( const QDateTime&, int ) { 188void OPimMainWindow::doAlarm( const QDateTime&, int ) {
189 189
190} 190}
191 191
192void OPimMainWindow::startAlarm(int count ) { 192void OPimMainWindow::startAlarm(int count ) {
193 m_alarmCount = count; 193 m_alarmCount = count;
194 m_playedCount = 0; 194 m_playedCount = 0;
195 Sound::soundAlarm(); 195 Sound::soundAlarm();
196 m_timerId = startTimer( 5000 ); 196 m_timerId = startTimer( 5000 );
197} 197}
198 198
199void OPimMainWindow::killAlarm() { 199void OPimMainWindow::killAlarm() {
200 killTimer( m_timerId ); 200 killTimer( m_timerId );
201} 201}
202 202
203void OPimMainWindow::timerEvent( QTimerEvent* e) { 203void OPimMainWindow::timerEvent( QTimerEvent* e) {
204 if ( m_playedCount <m_alarmCount ) { 204 if ( m_playedCount <m_alarmCount ) {
205 m_playedCount++; 205 m_playedCount++;
206 Sound::soundAlarm(); 206 Sound::soundAlarm();
207 }else { 207 }else {
208 killTimer( e->timerId() ); 208 killTimer( e->timerId() );
209 } 209 }
210} 210}
211 211
212QPopupMenu *OPimMainWindow::itemContextMenu() { 212QPopupMenu *OPimMainWindow::itemContextMenu() {
213 if ( !m_itemContextMenu ) { 213 if ( !m_itemContextMenu ) {
214 // Create context menu if hasn't been done before 214 // Create context menu if hasn't been done before
215 m_itemContextMenu = new QPopupMenu( this ); 215 m_itemContextMenu = new QPopupMenu( this );
216 m_itemEditAction->addTo( m_itemContextMenu ); 216 m_itemEditAction->addTo( m_itemContextMenu );
217 m_itemDuplicateAction->addTo( m_itemContextMenu ); 217 m_itemDuplicateAction->addTo( m_itemContextMenu );
218 m_itemDeleteAction->addTo( m_itemContextMenu ); 218 m_itemDeleteAction->addTo( m_itemContextMenu );
219 } 219 }
220 220
221 return m_itemContextMenu; 221 return m_itemContextMenu;
222} 222}
223 223
224void OPimMainWindow::insertItemMenuItems( QActionGroup *items ) { 224void OPimMainWindow::insertItemMenuItems( QActionGroup *items ) {
225 // Insert menu items into Item menu 225 // Insert menu items into Item menu
226 if ( items ) { 226 if ( items ) {
227 // Rebuild Item menu 227 // Rebuild Item menu
228 m_itemMenu->clear(); 228 m_itemMenu->clear();
229 m_itemMenuGroup1->addTo( m_itemMenu ); 229 m_itemMenuGroup1->addTo( m_itemMenu );
230 m_itemMenu->insertSeparator(); 230 m_itemMenu->insertSeparator();
231 items->addTo( m_itemMenu ); 231 items->addTo( m_itemMenu );
232 m_itemMenu->insertSeparator(); 232 m_itemMenu->insertSeparator();
233 m_itemMenuGroup2->addTo( m_itemMenu ); 233 m_itemMenuGroup2->addTo( m_itemMenu );
234 } 234 }
235} 235}
236 236
237void OPimMainWindow::insertViewMenuItems( QActionGroup *items ) { 237void OPimMainWindow::insertViewMenuItems( QActionGroup *items ) {
238 // Insert menu items into View menu 238 // Insert menu items into View menu
239 if ( items ) { 239 if ( items ) {
240 // Rebuild Item menu 240 // Rebuild Item menu
241 m_viewMenu->clear(); 241 m_viewMenu->clear();
242 m_viewMenuCategories->addTo( m_viewMenu ); 242 m_viewMenuCategories->addTo( m_viewMenu );
243 m_viewMenu->insertSeparator(); 243 m_viewMenu->insertSeparator();
244 m_viewMenuGroup->addTo( m_viewMenu ); 244 m_viewMenuGroup->addTo( m_viewMenu );
245 m_viewMenu->insertSeparator(); 245 m_viewMenu->insertSeparator();
246 m_viewMenuAppGroup = items; 246 m_viewMenuAppGroup = items;
247 m_viewMenuAppGroup->addTo( m_viewMenu ); 247 m_viewMenuAppGroup->addTo( m_viewMenu );
248 } 248 }
249} 249}
250 250
251void OPimMainWindow::slotViewCategory( QAction *category ) { 251void OPimMainWindow::slotViewCategory( QAction *category ) {
252 // Set application caption 252 // Set application caption
253 QString caption = m_appName; 253 QString caption = m_appName;
254 if ( category->text() != tr( "All" ) ) 254 if ( category->text() != tr( "All" ) )
255 caption.append( QString( " - %1" ).arg( category->text() ) ); 255 caption.append( QString( " - %1" ).arg( category->text() ) );
256 setCaption( caption ); 256 setCaption( caption );
257 257
258 // Notify application 258 // Notify application
259 emit categorySelected( category->text() ); 259 emit categorySelected( category->text() );
260} 260}
261 261
262void OPimMainWindow::setViewCategory( const QString &category ) { 262void OPimMainWindow::setViewCategory( const QString &category ) {
263 // Find category in menu 263 // Find category in menu
264 QObjectListIt kidIt( *(m_viewMenuCategories->children()) ); 264 QObjectListIt kidIt( *(m_viewMenuCategories->children()) );
265 QObject *obj; 265 QObject *obj;
266 while ( (obj=kidIt.current()) != 0 ) { 266 while ( (obj=kidIt.current()) != 0 ) {
267 QAction *currAction = reinterpret_cast<QAction*>(obj); 267 QAction *currAction = reinterpret_cast<QAction*>(obj);
268 if ( currAction->text() == category ) { 268 if ( currAction->text() == category ) {
269 // Category was found, enable it 269 // Category was found, enable it
270 currAction->setOn( true ); 270 currAction->setOn( true );
271 return; 271 return;
272 } 272 }
273 ++kidIt; 273 ++kidIt;
274 } 274 }
275} 275}
276 276
277void OPimMainWindow::reloadCategories() { 277void OPimMainWindow::reloadCategories() {
278 QString selected; 278 QString selected;
279 279
280 // Remove old categories from View menu 280 // Remove old categories from View menu
281 if ( m_viewMenuCategories ) { 281 if ( m_viewMenuCategories ) {
282 QObjectListIt kidIt( *(m_viewMenuCategories->children()) ); 282 QObjectListIt kidIt( *(m_viewMenuCategories->children()) );
283 QObject *obj; 283 QObject *obj;
284 while ( (obj=kidIt.current()) != 0 ) { 284 while ( (obj=kidIt.current()) != 0 ) {
285 QAction *currAction = reinterpret_cast<QAction*>(obj); 285 QAction *currAction = reinterpret_cast<QAction*>(obj);
286 if ( currAction->isOn() ) 286 if ( currAction->isOn() )
287 selected = currAction->text(); 287 selected = currAction->text();
288 ++kidIt; 288 ++kidIt;
289 delete currAction; 289 delete currAction;
290 } 290 }
291 } 291 }
292 else { 292 else {
293 m_viewMenuCategories = new QActionGroup( this ); 293 m_viewMenuCategories = new QActionGroup( this );
294 connect( m_viewMenuCategories, SIGNAL(selected(QAction*)), this, SLOT(slotViewCategory(QAction*)) ); 294 connect( m_viewMenuCategories, SIGNAL(selected(QAction*)), this, SLOT(slotViewCategory(QAction*)) );
295 295
296 selected = tr( "All" ); 296 selected = tr( "All" );
297 } 297 }
298 298
299 m_viewMenu->clear(); 299 m_viewMenu->clear();
300 300
301 // Add categories to View menu 301 // Add categories to View menu
302 QAction *a = new QAction( tr( "All" ), QString::null, 0, m_viewMenuCategories, QString::null, true ); 302 QAction *a = new QAction( tr( "All" ), QString::null, 0, m_viewMenuCategories, QString::null, true );
303 a->setWhatsThis( tr( "Click here to view all items." ) ); 303 a->setWhatsThis( tr( "Click here to view all items." ) );
304 a->setOn( selected == tr( "All" ) ); 304 a->setOn( selected == tr( "All" ) );
305 305
306 Categories cats; 306 Categories cats;
307 cats.load( categoryFileName() ); 307 cats.load( categoryFileName() );
308 QStringList catList = cats.labels( m_catGroupName ); 308 QStringList catList = cats.labels( m_catGroupName );
309 for ( QStringList::Iterator it = catList.begin(); it != catList.end(); ++it ) { 309 for ( QStringList::Iterator it = catList.begin(); it != catList.end(); ++it ) {
310 a = new QAction( tr( (*it) ), QString::null, 0, m_viewMenuCategories, QString::null, true ); 310 a = new QAction( tr( (*it) ), QString::null, 0, m_viewMenuCategories, QString::null, true );
311 a->setWhatsThis( tr( "Click here to view items belonging to %1." ).arg( (*it) ) ); 311 a->setWhatsThis( tr( "Click here to view items belonging to %1." ).arg( (*it) ) );
312 a->setOn( selected == (*it) ); 312 a->setOn( selected == (*it) );
313 } 313 }
314 314
315 a = new QAction( tr( "Unfiled" ), QString::null, 0, m_viewMenuCategories, QString::null, true ); 315 a = new QAction( tr( "Unfiled" ), QString::null, 0, m_viewMenuCategories, QString::null, true );
316 a->setWhatsThis( tr( "Click here to view all unfiled items." ) ); 316 a->setWhatsThis( tr( "Click here to view all unfiled items." ) );
317 a->setOn( selected == tr( "Unfiled" ) ); 317 a->setOn( selected == tr( "Unfiled" ) );
318 318
319 m_viewMenuCategories->addTo( m_viewMenu ); 319 m_viewMenuCategories->addTo( m_viewMenu );
320 320
321 // Add default items to View menu 321 // Add default items to View menu
322 m_viewMenu->insertSeparator(); 322 m_viewMenu->insertSeparator();
323 m_viewMenuGroup->addTo( m_viewMenu ); 323 m_viewMenuGroup->addTo( m_viewMenu );
324 324
325 // Insert application-specific items (if any) 325 // Insert application-specific items (if any)
326 if ( m_viewMenuAppGroup ) { 326 if ( m_viewMenuAppGroup ) {
327 m_viewMenu->insertSeparator(); 327 m_viewMenu->insertSeparator();
328 m_viewMenuAppGroup->addTo( m_viewMenu ); 328 m_viewMenuAppGroup->addTo( m_viewMenu );
329 } 329 }
330} 330}
331 331
332void OPimMainWindow::initBars( const QString &itemName ) { 332void OPimMainWindow::initBars( const QString &itemName ) {
333 QString itemStr = itemName.lower(); 333 QString itemStr = itemName.lower();
334 334
335 setToolBarsMovable( false ); 335 setToolBarsMovable( false );
336 336
337 // Create application menu bar 337 // Create application menu bar
338 QToolBar *mbHold = new QToolBar( this ); 338 QToolBar *mbHold = new QToolBar( this );
339 mbHold->setHorizontalStretchable( true ); 339 mbHold->setHorizontalStretchable( true );
340 QMenuBar *menubar = new QMenuBar( mbHold ); 340 QMenuBar *menubar = new QMenuBar( mbHold );
341 menubar->setMargin( 0 ); 341 menubar->setMargin( 0 );
342 342
343 // Create application menu bar 343 // Create application menu bar
344 QToolBar *toolbar = new QToolBar( this ); 344 QToolBar *toolbar = new QToolBar( this );
345 345
346 // Create sub-menus 346 // Create sub-menus
347 m_itemMenu = new QPopupMenu( this ); 347 m_itemMenu = new QPopupMenu( this );
348 m_itemMenu->setCheckable( true ); 348 m_itemMenu->setCheckable( true );
349 menubar->insertItem( itemName, m_itemMenu ); 349 menubar->insertItem( itemName, m_itemMenu );
350 m_viewMenu = new QPopupMenu( this ); 350 m_viewMenu = new QPopupMenu( this );
351 m_viewMenu->setCheckable( true ); 351 m_viewMenu->setCheckable( true );
352 menubar->insertItem( tr( "View" ), m_viewMenu ); 352 menubar->insertItem( tr( "View" ), m_viewMenu );
353 353
354 m_viewMenuCategories = 0l; 354 m_viewMenuCategories = 0l;
355 m_viewMenuAppGroup = 0l; 355 m_viewMenuAppGroup = 0l;
356 356
357 // Item menu 357 // Item menu
358 m_itemMenuGroup1 = new QActionGroup( this, QString::null, false ); 358 m_itemMenuGroup1 = new QActionGroup( this, QString::null, false );
359 359
360 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), 360 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ),
361 QString::null, 0, m_itemMenuGroup1, 0 ); 361 QString::null, 0, m_itemMenuGroup1, 0 );
362 connect( a, SIGNAL(activated()), this, SLOT(slotItemNew()) ); 362 connect( a, SIGNAL(activated()), this, SLOT(slotItemNew()) );
363 a->setWhatsThis( tr( "Click here to create a new item." ) ); 363 a->setWhatsThis( tr( "Click here to create a new item." ) );
364 a->addTo( toolbar ); 364 a->addTo( toolbar );
365 365
366 m_itemEditAction = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), 366 m_itemEditAction = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),
367 QString::null, 0, m_itemMenuGroup1, 0 ); 367 QString::null, 0, m_itemMenuGroup1, 0 );
368 connect( m_itemEditAction, SIGNAL(activated()), this, SLOT(slotItemEdit()) ); 368 connect( m_itemEditAction, SIGNAL(activated()), this, SLOT(slotItemEdit()) );
369 m_itemEditAction->setWhatsThis( tr( "Click here to edit the selected item." ) ); 369 m_itemEditAction->setWhatsThis( tr( "Click here to edit the selected item." ) );
370 m_itemEditAction->addTo( toolbar ); 370 m_itemEditAction->addTo( toolbar );
371 371
372 m_itemDuplicateAction = new QAction( tr( "Duplicate" ), QString::null, 0, m_itemMenuGroup1, 0 ); 372 m_itemDuplicateAction = new QAction( tr( "Duplicate" ), Resource::loadPixmap( "copy" ),
373 QString::null, 0, m_itemMenuGroup1, 0 );
373 connect( m_itemDuplicateAction, SIGNAL(activated()), this, SLOT(slotItemDuplicate()) ); 374 connect( m_itemDuplicateAction, SIGNAL(activated()), this, SLOT(slotItemDuplicate()) );
374 m_itemDuplicateAction->setWhatsThis( tr( "Click here to duplicate the selected item." ) ); 375 m_itemDuplicateAction->setWhatsThis( tr( "Click here to duplicate the selected item." ) );
375 376
376 m_itemDeleteAction = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), 377 m_itemDeleteAction = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ),
377 QString::null, 0, m_itemMenuGroup1, 0 ); 378 QString::null, 0, m_itemMenuGroup1, 0 );
378 connect( m_itemDeleteAction, SIGNAL(activated()), this, SLOT(slotItemDelete()) ); 379 connect( m_itemDeleteAction, SIGNAL(activated()), this, SLOT(slotItemDelete()) );
379 m_itemDeleteAction->setWhatsThis( tr( "Click here to delete the selected item." ) ); 380 m_itemDeleteAction->setWhatsThis( tr( "Click here to delete the selected item." ) );
380 m_itemDeleteAction->addTo( toolbar ); 381 m_itemDeleteAction->addTo( toolbar );
381 382
382 if ( Ir::supported() ) { 383 if ( Ir::supported() ) {
383 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), 384 a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ),
384 QString::null, 0, m_itemMenuGroup1, 0 ); 385 QString::null, 0, m_itemMenuGroup1, 0 );
385 connect( a, SIGNAL(activated()), this, SLOT(slotItemBeam()) ); 386 connect( a, SIGNAL(activated()), this, SLOT(slotItemBeam()) );
386 a->setWhatsThis( tr( "Click here to transmit the selected item." ) ); 387 a->setWhatsThis( tr( "Click here to transmit the selected item." ) );
387 //a->addTo( m_itemMenu ); 388 //a->addTo( m_itemMenu );
388 a->addTo( toolbar ); 389 a->addTo( toolbar );
389 } 390 }
390 391
391 m_itemMenuGroup1->addTo( m_itemMenu ); 392 m_itemMenuGroup1->addTo( m_itemMenu );
392 393
393 m_itemMenu->insertSeparator(); 394 m_itemMenu->insertSeparator();
394 395
395 m_itemMenuGroup2 = new QActionGroup( this, QString::null, false ); 396 m_itemMenuGroup2 = new QActionGroup( this, QString::null, false );
396 397
397 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), 398 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ),
398 QString::null, 0, m_itemMenuGroup2, 0 ); 399 QString::null, 0, m_itemMenuGroup2, 0 );
399 connect( a, SIGNAL(activated()), this, SLOT(slotItemFind()) ); 400 connect( a, SIGNAL(activated()), this, SLOT(slotItemFind()) );
400 a->setWhatsThis( tr( "Click here to search for an item." ) ); 401 a->setWhatsThis( tr( "Click here to search for an item." ) );
401 a->addTo( toolbar ); 402 a->addTo( toolbar );
402 403
403 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), 404 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ),
404 QString::null, 0, m_itemMenuGroup2, 0 ); 405 QString::null, 0, m_itemMenuGroup2, 0 );
405 connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); 406 connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) );
406 a->setWhatsThis( tr( "Click here to set your preferences for this application." ) ); 407 a->setWhatsThis( tr( "Click here to set your preferences for this application." ) );
407 408
408 m_itemMenuGroup2->addTo( m_itemMenu ); 409 m_itemMenuGroup2->addTo( m_itemMenu );
409 410
410 // View menu 411 // View menu
411 m_viewMenuGroup = new QActionGroup( this, QString::null, false ); 412 m_viewMenuGroup = new QActionGroup( this, QString::null, false );
412 413
413 a = new QAction( tr( "Filter" ), QString::null, 0, m_viewMenuGroup, 0 ); 414 a = new QAction( tr( "Filter" ), QString::null, 0, m_viewMenuGroup, 0 );
414 connect( a, SIGNAL(activated()), this, SLOT(slotViewFilter()) ); 415 connect( a, SIGNAL(activated()), this, SLOT(slotViewFilter()) );
415 a->setWhatsThis( tr( "Click here to filter the items displayed." ) ); 416 a->setWhatsThis( tr( "Click here to filter the items displayed." ) );
416 417
417 a = new QAction( tr( "Filter Settings" ), QString::null, 0, m_viewMenuGroup, 0 ); 418 a = new QAction( tr( "Filter Settings" ), QString::null, 0, m_viewMenuGroup, 0 );
418 connect( a, SIGNAL(activated()), this, SLOT(slotViewFilterSettings()) ); 419 connect( a, SIGNAL(activated()), this, SLOT(slotViewFilterSettings()) );
419 a->setWhatsThis( tr( "Click here to modify the current filter settings." ) ); 420 a->setWhatsThis( tr( "Click here to modify the current filter settings." ) );
420 421
421 reloadCategories(); 422 reloadCategories();
422} 423}
423 424
424} // namespace Opie 425} // namespace Opie