-rw-r--r-- | libopie2/opiepim/ui/opimmainwindow.cpp | 3 |
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 | |||
@@ -276,149 +276,150 @@ void OPimMainWindow::setViewCategory( const QString &category ) { | |||
276 | 276 | ||
277 | void OPimMainWindow::reloadCategories() { | 277 | void 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 | ||
332 | void OPimMainWindow::initBars( const QString &itemName ) { | 332 | void 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 |