KNemo – network interfaces monitor for systray
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.
 
 
 
 
 
 

112 lines
2.8 KiB

  1. /* This file is part of KNemo
  2. Copyright (C) 2004, 2005 Percy Leonhardt <percy@eris23.de>
  3. KNemo is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of
  6. the License, or (at your option) any later version.
  7. KNemo is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public License
  12. along with this library; see the file COPYING.LIB. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  14. Boston, MA 02110-1301, USA.
  15. */
  16. #ifndef INTERFACEICON_H
  17. #define INTERFACEICON_H
  18. #include <tqobject.h>
  19. #include <tqstring.h>
  20. class Interface;
  21. class InterfaceTray;
  22. /**
  23. * This is the logical representation of the systemtray icon. It handles
  24. * creation and deletion of the real icon, setting the tooltip, setting
  25. * the correct icon image and displaying of the settings dialog.
  26. *
  27. * @short Logical representation of the systemtray icon
  28. * @author Percy Leonhardt <percy@eris23.de>
  29. */
  30. class InterfaceIcon : public TQObject
  31. {
  32. Q_OBJECT
  33. public:
  34. /**
  35. * Default Constructor
  36. */
  37. InterfaceIcon( Interface* interface );
  38. /**
  39. * Default Destructor
  40. */
  41. virtual ~InterfaceIcon();
  42. /*
  43. * Change the tooltip according to the alias of the interface
  44. */
  45. void updateToolTip();
  46. /*
  47. * Fill the context menu with entries if the user configured
  48. * start and stop command
  49. */
  50. void updateMenu();
  51. signals:
  52. void statisticsSelected();
  53. public slots:
  54. /*
  55. * Changes the icon image displayed in the tray
  56. */
  57. void updateStatus( int status );
  58. /*
  59. * Creates or deletes the tray icon
  60. */
  61. void updateTrayStatus( int previousState, bool notify=true );
  62. /*
  63. * Resizes the tray icon
  64. */
  65. void resizeIcon();
  66. private slots:
  67. /*
  68. * Called when the user selects 'Configure KNemo' from the context menu
  69. */
  70. void showConfigDialog();
  71. /*
  72. * Called when the user setup custom commands and selects one
  73. * in the context menu
  74. */
  75. void menuActivated( int id );
  76. private:
  77. // the interface this icon belongs to
  78. Interface* mInterface;
  79. // the real tray icon
  80. InterfaceTray* mTray;
  81. static const TQString ICON_DISCONNECTED;
  82. static const TQString ICON_CONNECTED;
  83. static const TQString ICON_INCOMING;
  84. static const TQString ICON_OUTGOING;
  85. static const TQString ICON_TRAFFIC;
  86. static const TQString SUFFIX_PPP;
  87. static const TQString SUFFIX_LAN;
  88. static const TQString SUFFIX_WLAN;
  89. };
  90. #endif // INTERFACEICON_H