• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KIO

  • sources
  • kde-4.14
  • kdelibs
  • kio
  • bookmarks
kbookmarkmenu.h
Go to the documentation of this file.
1 // -*- c-basic-offset:4; indent-tabs-mode:nil -*-
2 // vim: set ts=4 sts=4 sw=4 et:
3 /* This file is part of the KDE project
4  Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
5  Copyright (C) 2006 Daniel Teske <teske@squorn.de>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #ifndef __kbookmarkmenu_h__
24 #define __kbookmarkmenu_h__
25 
26 #include <sys/types.h>
27 
28 #include <QtCore/QObject>
29 #include <QtCore/QStack>
30 
31 #include <klocale.h>
32 #include <kaction.h>
33 #include <kactionmenu.h>
34 #include <kicon.h>
35 #include <krun.h>
36 #include <kmenu.h>
37 
38 #include "kbookmark.h"
39 #include "kbookmarkmanager.h"
40 
41 class QString;
42 class QMenu;
43 class KBookmark;
44 class KAction;
45 class QAction;
46 class KActionMenu;
47 class KActionCollection;
48 class KBookmarkOwner;
49 class KBookmarkMenu;
50 class KMenu;
51 class KBookmarkActionInterface;
52 
53 class KBookmarkMenuPrivate; // Not implemented
54 
55 namespace KIO { class Job; }
56 
76 class KIO_EXPORT KBookmarkMenu : public QObject
77 {
78  Q_OBJECT
79 public:
95  KBookmarkMenu( KBookmarkManager* mgr, KBookmarkOwner * owner, KMenu * parentMenu, KActionCollection *collec);
96 
103  KBookmarkMenu( KBookmarkManager* mgr, KBookmarkOwner * owner,
104  KMenu * parentMenu, const QString & parentAddress);
105 
106  ~KBookmarkMenu();
107 
112  void ensureUpToDate();
113 
114 public Q_SLOTS:
115  // public for KonqBookmarkBar
116  void slotBookmarksChanged( const QString & );
117 
118 protected Q_SLOTS:
119  void slotAboutToShow();
120  void slotAddBookmarksList();
121  void slotAddBookmark();
122  void slotNewFolder();
123  void slotOpenFolderInTabs();
124 
125 protected:
126  virtual void clear();
127  virtual void refill();
128  virtual QAction* actionForBookmark(const KBookmark &bm);
129  virtual KMenu * contextMenu(QAction * action );
130 
131  void addActions();
132  void fillBookmarks();
133  void addAddBookmark();
134  void addAddBookmarksList();
135  void addEditBookmarks();
136  void addNewFolder();
137  void addOpenInTabs();
138 
139 
140  bool isRoot() const;
141  bool isDirty() const;
142 
146  QString parentAddress() const;
147 
148  KBookmarkManager * manager() const;
149  KBookmarkOwner * owner() const;
154  KMenu * parentMenu() const;
155 
159  QList<KBookmarkMenu *> m_lstSubMenus;
160 
161  // This is used to "export" our actions into an actionlist
162  // we got in the constructor. So that the program can show our
163  // actions in their shortcut dialog
164  KActionCollection * m_actionCollection;
168  QList<QAction *> m_actions;
169 
170 
171 private Q_SLOTS:
172  void slotCustomContextMenu( const QPoint & );
173 
174 private:
175  KBookmarkMenuPrivate* d;
176 
177  bool m_bIsRoot;
178  bool m_bDirty;
179  KBookmarkManager * m_pManager;
180  KBookmarkOwner * m_pOwner;
181 
182  KMenu * m_parentMenu;
183 
184 private:
185  QString m_parentAddress;
186 };
187 
188 class KIO_EXPORT KBookmarkContextMenu : public KMenu
189 {
190  Q_OBJECT
191 
192 public:
193  KBookmarkContextMenu(const KBookmark & bm, KBookmarkManager * manager, KBookmarkOwner *owner, QWidget * parent = 0);
194  virtual ~KBookmarkContextMenu();
195  virtual void addActions();
196 
197 public Q_SLOTS:
198  void slotEditAt();
199  void slotProperties();
200  void slotInsert();
201  void slotRemove();
202  void slotCopyLocation();
203  void slotOpenFolderInTabs();
204 
205 protected:
206  void addBookmark();
207  void addFolderActions();
208  void addProperties();
209  void addBookmarkActions();
210  void addOpenFolderInTabs();
211 
212  KBookmarkManager * manager() const;
213  KBookmarkOwner * owner() const;
214  KBookmark bookmark() const;
215 
216 private Q_SLOTS:
217  void slotAboutToShow();
218 
219 private:
220  KBookmark bm;
221  KBookmarkManager * m_pManager;
222  KBookmarkOwner * m_pOwner;
223 };
224 
225 class KIO_EXPORT KBookmarkActionInterface
226 {
227 public:
228  KBookmarkActionInterface(const KBookmark &bk);
229  virtual ~KBookmarkActionInterface();
230  const KBookmark bookmark() const;
231 private:
232  KBookmark bm;
233 };
234 
235 /***
236  * A wrapper around KActionMenu to provide a nice constructor for bookmark groups.
237  *
238  */
239 
240 class KIO_EXPORT KBookmarkActionMenu : public KActionMenu, public KBookmarkActionInterface
241 {
242 public:
243  KBookmarkActionMenu(const KBookmark &bm, QObject *parent);
244  KBookmarkActionMenu(const KBookmark &bm, const QString & text, QObject *parent);
245  virtual ~KBookmarkActionMenu();
246 };
247 
248 /***
249  * This class is a KAction for bookmarks.
250  * It provides a nice constructor.
251  * And on triggered uses the owner to open the bookmark.
252  *
253  */
254 
255 class KIO_EXPORT KBookmarkAction : public KAction, public KBookmarkActionInterface
256 {
257  Q_OBJECT
258 public:
259  KBookmarkAction(const KBookmark &bk, KBookmarkOwner* owner, QObject *parent);
260  virtual ~KBookmarkAction();
261 
262 public Q_SLOTS:
263  void slotSelected(Qt::MouseButtons mb, Qt::KeyboardModifiers km);
264 
265 private:
266  KBookmarkOwner* m_pOwner;
267 };
268 
269 #endif
KBookmarkMenu::m_lstSubMenus
QList< KBookmarkMenu * > m_lstSubMenus
List of our sub menus.
Definition: kbookmarkmenu.h:159
QWidget
KActionCollection
kbookmarkmanager.h
QWidget::addActions
void addActions(QList< QAction * > actions)
KMenu
KBookmarkManager
This class implements the reading/writing of bookmarks in XML.
Definition: kbookmarkmanager.h:65
QPoint
klocale.h
KBookmark
Definition: kbookmark.h:34
kmenu.h
QObject
clear
KAction * clear(const QObject *recvr, const char *slot, QObject *parent)
kactionmenu.h
addBookmark
KAction * addBookmark(const QObject *recvr, const char *slot, QObject *parent)
QString
QList< KBookmarkMenu * >
KBookmarkOwner
The KBookmarkMenu and KBookmarkBar classes gives the user the ability to either edit bookmarks or add...
Definition: kbookmarkmanager.h:382
KBookmarkAction
Definition: kbookmarkmenu.h:255
KBookmarkMenu::m_actions
QList< QAction * > m_actions
List of our actions.
Definition: kbookmarkmenu.h:168
kaction.h
QMenu
KBookmarkContextMenu
Definition: kbookmarkmenu.h:188
krun.h
KActionMenu
kbookmark.h
Qt::MouseButtons
typedef MouseButtons
KBookmarkMenu
This class provides a bookmark menu.
Definition: kbookmarkmenu.h:76
QAction
KAction
KIO::Job
The base class for all jobs.
Definition: jobclasses.h:94
kicon.h
KBookmarkMenu::m_actionCollection
KActionCollection * m_actionCollection
Definition: kbookmarkmenu.h:164
KBookmarkActionInterface
Definition: kbookmarkmenu.h:225
KBookmarkActionMenu
Definition: kbookmarkmenu.h:240
Qt::KeyboardModifiers
typedef KeyboardModifiers
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal