author | drw <drw> | 2005-04-05 22:45:37 (UTC) |
---|---|---|
committer | drw <drw> | 2005-04-05 22:45:37 (UTC) |
commit | 2a9ee3ea1d8d978b735f0ce3f2e54a15e37c87b3 (patch) (unidiff) | |
tree | 9d53a71c9a250f0c54f098093013cf3964e3858d /libopie2 | |
parent | 0f7b159f0a4972b6ffdc292f5eb4d2169c7fa75d (diff) | |
download | opie-2a9ee3ea1d8d978b735f0ce3f2e54a15e37c87b3.zip opie-2a9ee3ea1d8d978b735f0ce3f2e54a15e37c87b3.tar.gz opie-2a9ee3ea1d8d978b735f0ce3f2e54a15e37c87b3.tar.bz2 |
Use OResource for loading images
-rw-r--r-- | libopie2/opiepim/ui/opimmainwindow.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/libopie2/opiepim/ui/opimmainwindow.cpp b/libopie2/opiepim/ui/opimmainwindow.cpp index a6d574b..efb45ca 100644 --- a/libopie2/opiepim/ui/opimmainwindow.cpp +++ b/libopie2/opiepim/ui/opimmainwindow.cpp | |||
@@ -1,72 +1,72 @@ | |||
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> | ||
34 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
34 | #include <opie2/opimresolver.h> | ||
35 | #include <opie2/oresource.h> | ||
35 | 36 | ||
36 | #include <qpe/categoryselect.h> | 37 | #include <qpe/categoryselect.h> |
37 | #include <qpe/ir.h> | 38 | #include <qpe/ir.h> |
38 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
39 | #include <qpe/qpeapplication.h> | 40 | #include <qpe/qpeapplication.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 <qcombobox.h> | 46 | #include <qcombobox.h> |
47 | #include <qcopchannel_qws.h> | 47 | #include <qcopchannel_qws.h> |
48 | #include <qdatetime.h> | 48 | #include <qdatetime.h> |
49 | #include <qmenubar.h> | 49 | #include <qmenubar.h> |
50 | #include <qobjectlist.h> | 50 | #include <qobjectlist.h> |
51 | #include <qpopupmenu.h> | 51 | #include <qpopupmenu.h> |
52 | #include <qtoolbar.h> | 52 | #include <qtoolbar.h> |
53 | #include <qwhatsthis.h> | 53 | #include <qwhatsthis.h> |
54 | 54 | ||
55 | namespace Opie { | 55 | namespace Opie { |
56 | OPimMainWindow::OPimMainWindow( const QString &serviceName, const QString &catName, | 56 | OPimMainWindow::OPimMainWindow( const QString &serviceName, const QString &catName, |
57 | const QString &itemName, const QString &configName, | 57 | const QString &itemName, const QString &configName, |
58 | QWidget *parent, const char* name, WFlags f ) | 58 | QWidget *parent, const char* name, WFlags f ) |
59 | : QMainWindow( parent, name, f ), m_rtti(-1), m_service( serviceName ), m_fallBack( 0l ), | 59 | : QMainWindow( parent, name, f ), m_rtti(-1), m_service( serviceName ), m_fallBack( 0l ), |
60 | m_catGroupName( catName ), m_config( configName ), m_itemContextMenu( 0l ) | 60 | m_catGroupName( catName ), m_config( configName ), m_itemContextMenu( 0l ) |
61 | { | 61 | { |
62 | 62 | ||
63 | /* | 63 | /* |
64 | * let's generate our QCopChannel | 64 | * let's generate our QCopChannel |
65 | */ | 65 | */ |
66 | m_str = QString("QPE/"+m_service).local8Bit(); | 66 | m_str = QString("QPE/"+m_service).local8Bit(); |
67 | m_channel= new QCopChannel(m_str, this ); | 67 | m_channel= new QCopChannel(m_str, this ); |
68 | connect(m_channel, SIGNAL(received(const QCString&,const QByteArray&)), | 68 | connect(m_channel, SIGNAL(received(const QCString&,const QByteArray&)), |
69 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); | 69 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); |
70 | connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), | 70 | connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
71 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); | 71 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); |
72 | 72 | ||
@@ -298,98 +298,104 @@ void OPimMainWindow::setConfigureEnabled( bool enable ) { | |||
298 | void OPimMainWindow::setShowCategories( bool show ) { | 298 | void OPimMainWindow::setShowCategories( bool show ) { |
299 | show ? m_catSelect->show() | 299 | show ? m_catSelect->show() |
300 | : m_catSelect->hide(); | 300 | : m_catSelect->hide(); |
301 | } | 301 | } |
302 | 302 | ||
303 | void OPimMainWindow::initBars( const QString &itemName ) { | 303 | void OPimMainWindow::initBars( const QString &itemName ) { |
304 | QString itemStr = itemName.lower(); | 304 | QString itemStr = itemName.lower(); |
305 | 305 | ||
306 | setToolBarsMovable( false ); | 306 | setToolBarsMovable( false ); |
307 | 307 | ||
308 | // Create application menu bar | 308 | // Create application menu bar |
309 | QToolBar *mbHold = new QToolBar( this ); | 309 | QToolBar *mbHold = new QToolBar( this ); |
310 | mbHold->setHorizontalStretchable( true ); | 310 | mbHold->setHorizontalStretchable( true ); |
311 | QMenuBar *menubar = new QMenuBar( mbHold ); | 311 | QMenuBar *menubar = new QMenuBar( mbHold ); |
312 | menubar->setMargin( 0 ); | 312 | menubar->setMargin( 0 ); |
313 | 313 | ||
314 | // Create application menu bar | 314 | // Create application menu bar |
315 | QToolBar *toolbar = new QToolBar( this ); | 315 | QToolBar *toolbar = new QToolBar( this ); |
316 | 316 | ||
317 | // Create sub-menus | 317 | // Create sub-menus |
318 | m_itemMenu = new QPopupMenu( this ); | 318 | m_itemMenu = new QPopupMenu( this ); |
319 | m_itemMenu->setCheckable( true ); | 319 | m_itemMenu->setCheckable( true ); |
320 | menubar->insertItem( itemName, m_itemMenu ); | 320 | menubar->insertItem( itemName, m_itemMenu ); |
321 | m_viewMenu = new QPopupMenu( this ); | 321 | m_viewMenu = new QPopupMenu( this ); |
322 | m_viewMenu->setCheckable( true ); | 322 | m_viewMenu->setCheckable( true ); |
323 | menubar->insertItem( tr( "View" ), m_viewMenu ); | 323 | menubar->insertItem( tr( "View" ), m_viewMenu ); |
324 | 324 | ||
325 | m_viewMenuAppGroup = 0l; | 325 | m_viewMenuAppGroup = 0l; |
326 | 326 | ||
327 | // Item menu | 327 | // Item menu |
328 | m_itemMenuGroup1 = new QActionGroup( this, QString::null, false ); | 328 | m_itemMenuGroup1 = new QActionGroup( this, QString::null, false ); |
329 | 329 | ||
330 | m_itemNewAction = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), | 330 | m_itemNewAction = new QAction( tr( "New" ), |
331 | QString::null, 0, m_itemMenuGroup1, 0 ); | 331 | Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), |
332 | QString::null, 0, m_itemMenuGroup1, 0 ); | ||
332 | connect( m_itemNewAction, SIGNAL(activated()), this, SLOT(slotItemNew()) ); | 333 | connect( m_itemNewAction, SIGNAL(activated()), this, SLOT(slotItemNew()) ); |
333 | m_itemNewAction->setWhatsThis( tr( "Click here to create a new item." ) ); | 334 | m_itemNewAction->setWhatsThis( tr( "Click here to create a new item." ) ); |
334 | m_itemNewAction->addTo( toolbar ); | 335 | m_itemNewAction->addTo( toolbar ); |
335 | 336 | ||
336 | m_itemEditAction = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), | 337 | m_itemEditAction = new QAction( tr( "Edit" ), |
338 | Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), | ||
337 | QString::null, 0, m_itemMenuGroup1, 0 ); | 339 | QString::null, 0, m_itemMenuGroup1, 0 ); |
338 | connect( m_itemEditAction, SIGNAL(activated()), this, SLOT(slotItemEdit()) ); | 340 | connect( m_itemEditAction, SIGNAL(activated()), this, SLOT(slotItemEdit()) ); |
339 | m_itemEditAction->setWhatsThis( tr( "Click here to edit the selected item." ) ); | 341 | m_itemEditAction->setWhatsThis( tr( "Click here to edit the selected item." ) ); |
340 | m_itemEditAction->addTo( toolbar ); | 342 | m_itemEditAction->addTo( toolbar ); |
341 | 343 | ||
342 | m_itemDuplicateAction = new QAction( tr( "Duplicate" ), Resource::loadPixmap( "copy" ), | 344 | m_itemDuplicateAction = new QAction( tr( "Duplicate" ), |
345 | Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon ), | ||
343 | QString::null, 0, m_itemMenuGroup1, 0 ); | 346 | QString::null, 0, m_itemMenuGroup1, 0 ); |
344 | connect( m_itemDuplicateAction, SIGNAL(activated()), this, SLOT(slotItemDuplicate()) ); | 347 | connect( m_itemDuplicateAction, SIGNAL(activated()), this, SLOT(slotItemDuplicate()) ); |
345 | m_itemDuplicateAction->setWhatsThis( tr( "Click here to duplicate the selected item." ) ); | 348 | m_itemDuplicateAction->setWhatsThis( tr( "Click here to duplicate the selected item." ) ); |
346 | 349 | ||
347 | if ( Ir::supported() ) { | 350 | if ( Ir::supported() ) { |
348 | m_itemBeamAction = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), | 351 | m_itemBeamAction = new QAction( tr( "Beam" ), |
352 | Opie::Core::OResource::loadPixmap( "beam", Opie::Core::OResource::SmallIcon ), | ||
349 | QString::null, 0, m_itemMenuGroup1, 0 ); | 353 | QString::null, 0, m_itemMenuGroup1, 0 ); |
350 | connect( m_itemBeamAction, SIGNAL(activated()), this, SLOT(slotItemBeam()) ); | 354 | connect( m_itemBeamAction, SIGNAL(activated()), this, SLOT(slotItemBeam()) ); |
351 | m_itemBeamAction->setWhatsThis( tr( "Click here to transmit the selected item." ) ); | 355 | m_itemBeamAction->setWhatsThis( tr( "Click here to transmit the selected item." ) ); |
352 | m_itemBeamAction->addTo( toolbar ); | 356 | m_itemBeamAction->addTo( toolbar ); |
353 | } | 357 | } |
354 | 358 | ||
355 | m_itemDeleteAction = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), | 359 | m_itemDeleteAction = new QAction( tr( "Delete" ), |
360 | Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), | ||
356 | QString::null, 0, m_itemMenuGroup1, 0 ); | 361 | QString::null, 0, m_itemMenuGroup1, 0 ); |
357 | connect( m_itemDeleteAction, SIGNAL(activated()), this, SLOT(slotItemDelete()) ); | 362 | connect( m_itemDeleteAction, SIGNAL(activated()), this, SLOT(slotItemDelete()) ); |
358 | m_itemDeleteAction->setWhatsThis( tr( "Click here to delete the selected item." ) ); | 363 | m_itemDeleteAction->setWhatsThis( tr( "Click here to delete the selected item." ) ); |
359 | m_itemDeleteAction->addTo( toolbar ); | 364 | m_itemDeleteAction->addTo( toolbar ); |
360 | 365 | ||
361 | m_itemMenuGroup1->addTo( m_itemMenu ); | 366 | m_itemMenuGroup1->addTo( m_itemMenu ); |
362 | 367 | ||
363 | m_itemMenu->insertSeparator(); | 368 | m_itemMenu->insertSeparator(); |
364 | 369 | ||
365 | m_itemMenuGroup2 = new QActionGroup( this, QString::null, false ); | 370 | m_itemMenuGroup2 = new QActionGroup( this, QString::null, false ); |
366 | 371 | ||
367 | m_configureAction = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), | 372 | m_configureAction = new QAction( tr( "Configure" ), |
373 | Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), | ||
368 | QString::null, 0, m_itemMenuGroup2, 0 ); | 374 | QString::null, 0, m_itemMenuGroup2, 0 ); |
369 | connect( m_configureAction, SIGNAL(activated()), this, SLOT(slotConfigure()) ); | 375 | connect( m_configureAction, SIGNAL(activated()), this, SLOT(slotConfigure()) ); |
370 | m_configureAction->setWhatsThis( tr( "Click here to set your preferences for this application." ) ); | 376 | m_configureAction->setWhatsThis( tr( "Click here to set your preferences for this application." ) ); |
371 | 377 | ||
372 | m_itemMenuGroup2->addTo( m_itemMenu ); | 378 | m_itemMenuGroup2->addTo( m_itemMenu ); |
373 | 379 | ||
374 | // View menu | 380 | // View menu |
375 | // m_viewMenuGroup = new QActionGroup( this, QString::null, false ); | 381 | // m_viewMenuGroup = new QActionGroup( this, QString::null, false ); |
376 | 382 | ||
377 | // QAction *a = new QAction( tr( "Filter" ), QString::null, 0, m_viewMenuGroup, 0 ); | 383 | // QAction *a = new QAction( tr( "Filter" ), QString::null, 0, m_viewMenuGroup, 0 ); |
378 | // connect( a, SIGNAL(activated()), this, SLOT(slotViewFilter()) ); | 384 | // connect( a, SIGNAL(activated()), this, SLOT(slotViewFilter()) ); |
379 | // a->setWhatsThis( tr( "Click here to filter the items displayed." ) ); | 385 | // a->setWhatsThis( tr( "Click here to filter the items displayed." ) ); |
380 | // | 386 | // |
381 | // a = new QAction( tr( "Filter Settings" ), QString::null, 0, m_viewMenuGroup, 0 ); | 387 | // a = new QAction( tr( "Filter Settings" ), QString::null, 0, m_viewMenuGroup, 0 ); |
382 | // connect( a, SIGNAL(activated()), this, SLOT(slotViewFilterSettings()) ); | 388 | // connect( a, SIGNAL(activated()), this, SLOT(slotViewFilterSettings()) ); |
383 | // a->setWhatsThis( tr( "Click here to modify the current filter settings." ) ); | 389 | // a->setWhatsThis( tr( "Click here to modify the current filter settings." ) ); |
384 | 390 | ||
385 | // Create view toolbar | 391 | // Create view toolbar |
386 | toolbar = new QToolBar( this ); | 392 | toolbar = new QToolBar( this ); |
387 | m_catSelect = new QComboBox( toolbar ); | 393 | m_catSelect = new QComboBox( toolbar ); |
388 | connect( m_catSelect, SIGNAL(activated(const QString&)), this, SIGNAL(categorySelected(const QString&)) ); | 394 | connect( m_catSelect, SIGNAL(activated(const QString&)), this, SIGNAL(categorySelected(const QString&)) ); |
389 | QWhatsThis::add( m_catSelect, tr( "Click here to filter items by category." ) ); | 395 | QWhatsThis::add( m_catSelect, tr( "Click here to filter items by category." ) ); |
390 | 396 | ||
391 | // Do initial load of categories | 397 | // Do initial load of categories |
392 | reloadCategories(); | 398 | reloadCategories(); |
393 | } | 399 | } |
394 | 400 | ||
395 | } // namespace Opie | 401 | } // namespace Opie |