Smb4K – Samba (SMB) share advanced browser
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.

159 lines
4.5KB

  1. /***************************************************************************
  2. smb4kshareslistview - This is the shares list view of Smb4K.
  3. -------------------
  4. begin : Sa Jun 30 2007
  5. copyright : (C) 2007 by Alexander Reinholdt
  6. email : dustpuppy@users.berlios.de
  7. ***************************************************************************/
  8. /***************************************************************************
  9. * This program is free software; you can redistribute it and/or modify *
  10. * it under the terms of the GNU General Public License as published by *
  11. * the Free Software Foundation; either version 2 of the License, or *
  12. * (at your option) any later version. *
  13. * *
  14. * This program is distributed in the hope that it will be useful, but *
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of *
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
  17. * General Public License for more details. *
  18. * *
  19. * You should have received a copy of the GNU General Public License *
  20. * along with this program; if not, write to the *
  21. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
  22. * MA 02110-1301 USA *
  23. ***************************************************************************/
  24. #ifndef SMB4KSHARESLISTVIEW_H
  25. #define SMB4KSHARESLISTVIEW_H
  26. #ifdef HAVE_CONFIG_H
  27. #include <config.h>
  28. #endif
  29. // KDE includes
  30. #include <klistview.h>
  31. #include <kurldrag.h>
  32. // forward declarations
  33. class Smb4KSharesListViewToolTip;
  34. /**
  35. * This widget class provides the shares list view of Smb4K.
  36. *
  37. * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
  38. */
  39. class Smb4KSharesListView : public KListView
  40. {
  41. Q_OBJECT
  42. TQ_OBJECT
  43. public:
  44. /**
  45. * The constructor
  46. *
  47. * @param parent The parent widget
  48. *
  49. * @param name The name of this object
  50. */
  51. Smb4KSharesListView( TQWidget *parent = 0, const char *name = 0 );
  52. /**
  53. * The destructor
  54. */
  55. ~Smb4KSharesListView();
  56. /**
  57. * Enumeration for the columns.
  58. */
  59. #ifndef __FreeBSD__
  60. enum Columns { Item = 0,
  61. Owner = 1,
  62. Login = 2,
  63. FileSystem = 3,
  64. Free = 4,
  65. Used = 5,
  66. Total = 6,
  67. Usage = 7 };
  68. #else
  69. enum Columns { Item = 0,
  70. Owner = 1,
  71. FileSystem = 2,
  72. Free = 3,
  73. Used = 4,
  74. Total = 5,
  75. Usage = 6 };
  76. #endif
  77. /**
  78. * Update the tool tip if it exists. This function just executes
  79. * Smb4KSharesListViewToolTip::update().
  80. */
  81. void updateToolTip();
  82. protected:
  83. /**
  84. * Reimplemented (sort of) from TQListView to enable dragging. As TQDragObject
  85. * a KURLDrag will be returned.
  86. *
  87. * @returns a KURLDrag object.
  88. */
  89. KURLDrag *dragObject();
  90. /**
  91. * Reimplemented from TQListView to allow some actions to be carried
  92. * out before the drag begins.
  93. */
  94. void startDrag();
  95. /**
  96. * Reimplemented from TQListView.
  97. */
  98. void contentsDragEnterEvent( TQDragEnterEvent * );
  99. /**
  100. * Reimplemented from TQListView.
  101. */
  102. void contentsDragMoveEvent( TQDragMoveEvent *e );
  103. /**
  104. * Reimplemented from TQListView.
  105. */
  106. void contentsDropEvent( TQDropEvent *e );
  107. /**
  108. * Reimplemented from TQListView. This function is used to
  109. * show the tooltips.
  110. */
  111. void contentsMouseMoveEvent( TQMouseEvent *e );
  112. protected slots:
  113. /**
  114. * This slot is connected to KListView::pressed() and clears the selection
  115. * if the user clicked on the viewport.
  116. *
  117. * @param item The TQIconViewItem that the user clicked or NULL
  118. * if he/she pressed a mouse button on the viewport.
  119. */
  120. void slotPressed( TQListViewItem *item );
  121. /**
  122. * This slot shows the tool tip for an icon view item.
  123. */
  124. void slotShowToolTip();
  125. private:
  126. /**
  127. * The current global mouse position
  128. */
  129. TQPoint m_pos;
  130. /**
  131. * The tool tip
  132. */
  133. Smb4KSharesListViewToolTip *m_tooltip;
  134. };
  135. #endif