TDE base libraries and programs
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

konq_actions.h 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /* This file is part of the KDE project
  2. Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public
  5. License as published by the Free Software Foundation; either
  6. version 2 of the License, or (at your option) any later version.
  7. This library 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 GNU
  10. 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 __konq_actions_h__
  17. #define __konq_actions_h__
  18. #include <konq_historymgr.h>
  19. #include <tdeaction.h>
  20. #include <tqptrlist.h>
  21. class HistoryEntry;
  22. class TQPopupMenu;
  23. /**
  24. * Plug this action into a menu to get a bidirectional history
  25. * (both back and forward, including current location)
  26. */
  27. class KonqBidiHistoryAction : public TDEAction
  28. {
  29. Q_OBJECT
  30. public:
  31. KonqBidiHistoryAction( const TQString & text, TQObject* parent = 0, const char* name = 0 );
  32. virtual ~KonqBidiHistoryAction() {};
  33. virtual int plug( TQWidget *widget, int index = -1 );
  34. //virtual void unplug( TQWidget *widget );
  35. void fillGoMenu( const TQPtrList<HistoryEntry> &history );
  36. // Used by KonqHistoryAction and KonqBidiHistoryAction
  37. static void fillHistoryPopup( const TQPtrList<HistoryEntry> &history,
  38. TQPopupMenu * popup,
  39. bool onlyBack = false,
  40. bool onlyForward = false,
  41. bool checkCurrentItem = false,
  42. uint startPos = 0 );
  43. protected slots:
  44. void slotActivated( int );
  45. signals:
  46. void menuAboutToShow();
  47. // -1 for one step back, 0 for don't move, +1 for one step forward, etc.
  48. void activated( int );
  49. private:
  50. uint m_firstIndex; // first index in the Go menu
  51. int m_startPos;
  52. int m_currentPos; // == history.at()
  53. TQPopupMenu *m_goMenu; // hack
  54. };
  55. /////
  56. class KonqLogoAction : public TDEAction
  57. {
  58. Q_OBJECT
  59. public:
  60. KonqLogoAction( const TQString& text, int accel = 0, TQObject* parent = 0, const char* name = 0 );
  61. KonqLogoAction( const TQString& text, int accel,
  62. TQObject* receiver, const char* slot, TQObject* parent, const char* name = 0 );
  63. KonqLogoAction( const TQString& text, const TQIconSet& pix, int accel = 0,
  64. TQObject* parent = 0, const char* name = 0 );
  65. KonqLogoAction( const TQString& text, const TQIconSet& pix, int accel,
  66. TQObject* receiver, const char* slot, TQObject* parent, const char* name = 0 );
  67. // text missing !
  68. KonqLogoAction( const TQStringList& icons, TQObject* receiver,
  69. const char* slot, TQObject* parent, const char* name = 0 );
  70. virtual int plug( TQWidget *widget, int index = -1 );
  71. virtual void updateIcon(int id);
  72. void start();
  73. void stop();
  74. private:
  75. TQStringList iconList;
  76. };
  77. class KonqViewModeAction : public TDERadioAction
  78. {
  79. Q_OBJECT
  80. public:
  81. KonqViewModeAction( const TQString &text, const TQString &icon,
  82. TQObject *parent, const char *name );
  83. virtual ~KonqViewModeAction();
  84. virtual int plug( TQWidget *widget, int index = -1 );
  85. TQPopupMenu *popupMenu() const { return m_menu; }
  86. private slots:
  87. void slotPopupAboutToShow();
  88. void slotPopupActivated();
  89. void slotPopupAboutToHide();
  90. private:
  91. bool m_popupActivated;
  92. TQPopupMenu *m_menu;
  93. };
  94. class MostOftenList : public KonqBaseHistoryList
  95. {
  96. protected:
  97. /**
  98. * Ensures that the items are sorted by numberOfTimesVisited
  99. */
  100. virtual int compareItems( TQPtrCollection::Item, TQPtrCollection::Item );
  101. };
  102. class KonqMostOftenURLSAction : public TDEActionMenu
  103. {
  104. Q_OBJECT
  105. public:
  106. KonqMostOftenURLSAction( const TQString& text, TQObject *parent,
  107. const char *name );
  108. virtual ~KonqMostOftenURLSAction();
  109. signals:
  110. void activated( const KURL& );
  111. private slots:
  112. void slotHistoryCleared();
  113. void slotEntryAdded( const KonqHistoryEntry *entry );
  114. void slotEntryRemoved( const KonqHistoryEntry *entry );
  115. void slotFillMenu();
  116. //void slotClearMenu();
  117. void slotActivated( int );
  118. private:
  119. void init();
  120. void parseHistory();
  121. static MostOftenList *s_mostEntries;
  122. static uint s_maxEntries;
  123. KURL::List m_popupList;
  124. };
  125. #endif