TDE personal information management applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dockeditem.cpp 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #include "dockeditem.h"
  19. #include "systemtray.h"
  20. #include <tdeapplication.h>
  21. #include <tdeconfig.h>
  22. #include <kdebug.h>
  23. #include <tdeglobal.h>
  24. #include <kiconloader.h>
  25. #include <kpassivepopup.h>
  26. #include <tdepopupmenu.h>
  27. #include <tdelocale.h>
  28. #include <tqbitmap.h>
  29. #include <tqcursor.h>
  30. #include <tqtooltip.h>
  31. #include <tqpainter.h>
  32. #include <tqpixmap.h>
  33. #include <tqmovie.h>
  34. DockedItem::DockedItem( TQWidget * parent, const char * name )
  35. : BoxContainerItem( TQT_TQOBJECT(parent), name ),
  36. _systemtray( new SystemTray( parent, "System tray" ) )
  37. {
  38. this->fillTDEPopupMenu( _systemtray->contextMenu(), _systemtray->actionCollection() );
  39. connect( _systemtray, TQT_SIGNAL( quitSelected() ), kapp, TQT_SLOT( quit() ) );
  40. connect( _systemtray, TQT_SIGNAL( mouseButtonPressed( TQt::ButtonState ) ),
  41. this, TQT_SLOT( mouseButtonPressed( TQt::ButtonState ) ) );
  42. }
  43. DockedItem::~DockedItem()
  44. {
  45. delete _systemtray;
  46. }
  47. void DockedItem::showBox()
  48. {
  49. _systemtray->show();
  50. }
  51. void DockedItem::readConfig( TDEConfig* config, const int index )
  52. {
  53. BoxContainerItem::readConfig( config, index );
  54. //No additional information to be loaded.
  55. }
  56. void DockedItem::setCount( const int count, const bool newMessages )
  57. {
  58. drawLabel( _systemtray, count, newMessages );
  59. }
  60. void DockedItem::setTooltip( const TQString& tooltip )
  61. {
  62. TQToolTip::add( _systemtray, tooltip );
  63. }
  64. void DockedItem::slotShowPassivePopup( TQPtrList< KornMailSubject >* list, int total, bool date, const TQString& name )
  65. {
  66. showPassivePopup( _systemtray, list, total, name, date );
  67. }
  68. void DockedItem::slotShowPassivePopup( const TQString& message, const TQString& name )
  69. {
  70. KPassivePopup::message( i18n( "Korn - %1/%2" ).arg( TQString(objId()) ).arg( name ), message, _systemtray, "Passive error message" );
  71. }
  72. void DockedItem::doPopup()
  73. {
  74. _systemtray->contextMenu()->popup( TQCursor::pos() );
  75. }
  76. #include "dockeditem.moc"