/usr/include/kbookmarkmenu.h is in kdelibs5-dev 4:4.13.3-0ubuntu0.5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | // -*- c-basic-offset:4; indent-tabs-mode:nil -*-
// vim: set ts=4 sts=4 sw=4 et:
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
Copyright (C) 2006 Daniel Teske <teske@squorn.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __kbookmarkmenu_h__
#define __kbookmarkmenu_h__
#include <sys/types.h>
#include <QtCore/QObject>
#include <QtCore/QStack>
#include <klocale.h>
#include <kaction.h>
#include <kactionmenu.h>
#include <kicon.h>
#include <krun.h>
#include <kmenu.h>
#include "kbookmark.h"
#include "kbookmarkmanager.h"
class QString;
class QMenu;
class KBookmark;
class KAction;
class QAction;
class KActionMenu;
class KActionCollection;
class KBookmarkOwner;
class KBookmarkMenu;
class KMenu;
class KBookmarkActionInterface;
class KBookmarkMenuPrivate; // Not implemented
namespace KIO { class Job; }
/**
* This class provides a bookmark menu. It is typically used in
* cooperation with KActionMenu but doesn't have to be.
*
* If you use this class by itself, then it will use KDE defaults for
* everything -- the bookmark path, bookmark editor, bookmark launcher..
* everything. These defaults reside in the classes
* KBookmarkOwner (editing bookmarks) and KBookmarkManager
* (almost everything else). If you wish to change the defaults in
* any way, you must reimplement either this class or KBookmarkOwner.
*
* Using this class is very simple:
*
* 1) Create a popup menu (either KActionMenu or KMenu will do)
* 2) Instantiate a new KBookmarkMenu object using the above popup
* menu as a parameter
* 3) Insert your (now full) popup menu wherever you wish
*
*/
class KIO_EXPORT KBookmarkMenu : public QObject
{
Q_OBJECT
public:
/**
* Fills a bookmark menu
* (one instance of KBookmarkMenu is created for the toplevel menu,
* but also one per submenu).
*
* @param mgr The bookmark manager to use (i.e. for reading and writing)
* @param owner implementation of the KBookmarkOwner callback interface.
* Note: If you pass a null KBookmarkOwner to the constructor, the
* openBookmark signal is not emitted, instead KRun is used to open the bookmark.
* @param parentMenu menu to be filled
* @param collec parent collection for the KActions.
*
* @todo KDE 5: give ownership of the bookmarkmenu to another qobject, e.g. parentMenu.
* Currently this is a QObject without a parent, use setParent to benefit from automatic deletion.
*/
KBookmarkMenu( KBookmarkManager* mgr, KBookmarkOwner * owner, KMenu * parentMenu, KActionCollection *collec);
/**
* Creates a bookmark submenu
*
* @todo KDE 5: give ownership of the bookmarkmenu to another qobject, e.g. parentMenu.
* Currently this is a QObject without a parent, use setParent to benefit from automatic deletion.
*/
KBookmarkMenu( KBookmarkManager* mgr, KBookmarkOwner * owner,
KMenu * parentMenu, const QString & parentAddress);
~KBookmarkMenu();
/**
* Call ensureUpToDate() if you need KBookmarkMenu to adjust to its
* final size before it is executed.
**/
void ensureUpToDate();
public Q_SLOTS:
// public for KonqBookmarkBar
void slotBookmarksChanged( const QString & );
protected Q_SLOTS:
void slotAboutToShow();
void slotAddBookmarksList();
void slotAddBookmark();
void slotNewFolder();
void slotOpenFolderInTabs();
protected:
virtual void clear();
virtual void refill();
virtual QAction* actionForBookmark(const KBookmark &bm);
virtual KMenu * contextMenu(QAction * action );
void addActions();
void fillBookmarks();
void addAddBookmark();
void addAddBookmarksList();
void addEditBookmarks();
void addNewFolder();
void addOpenInTabs();
bool isRoot() const;
bool isDirty() const;
/**
* Parent bookmark for this menu.
*/
QString parentAddress() const;
KBookmarkManager * manager() const;
KBookmarkOwner * owner() const;
/**
* The menu in which we insert our actions
* Supplied in the constructor.
*/
KMenu * parentMenu() const;
/**
* List of our sub menus
*/
QList<KBookmarkMenu *> m_lstSubMenus;
// This is used to "export" our actions into an actionlist
// we got in the constructor. So that the program can show our
// actions in their shortcut dialog
KActionCollection * m_actionCollection;
/**
* List of our actions.
*/
QList<QAction *> m_actions;
private Q_SLOTS:
void slotCustomContextMenu( const QPoint & );
private:
KBookmarkMenuPrivate* d;
bool m_bIsRoot;
bool m_bDirty;
KBookmarkManager * m_pManager;
KBookmarkOwner * m_pOwner;
KMenu * m_parentMenu;
private:
QString m_parentAddress;
};
class KIO_EXPORT KBookmarkContextMenu : public KMenu
{
Q_OBJECT
public:
KBookmarkContextMenu(const KBookmark & bm, KBookmarkManager * manager, KBookmarkOwner *owner, QWidget * parent = 0);
virtual ~KBookmarkContextMenu();
virtual void addActions();
public Q_SLOTS:
void slotEditAt();
void slotProperties();
void slotInsert();
void slotRemove();
void slotCopyLocation();
void slotOpenFolderInTabs();
protected:
void addBookmark();
void addFolderActions();
void addProperties();
void addBookmarkActions();
void addOpenFolderInTabs();
KBookmarkManager * manager() const;
KBookmarkOwner * owner() const;
KBookmark bookmark() const;
private Q_SLOTS:
void slotAboutToShow();
private:
KBookmark bm;
KBookmarkManager * m_pManager;
KBookmarkOwner * m_pOwner;
};
class KIO_EXPORT KBookmarkActionInterface
{
public:
KBookmarkActionInterface(const KBookmark &bk);
virtual ~KBookmarkActionInterface();
const KBookmark bookmark() const;
private:
KBookmark bm;
};
/***
* A wrapper around KActionMenu to provide a nice constructor for bookmark groups.
*
*/
class KIO_EXPORT KBookmarkActionMenu : public KActionMenu, public KBookmarkActionInterface
{
public:
KBookmarkActionMenu(const KBookmark &bm, QObject *parent);
KBookmarkActionMenu(const KBookmark &bm, const QString & text, QObject *parent);
virtual ~KBookmarkActionMenu();
};
/***
* This class is a KAction for bookmarks.
* It provides a nice constructor.
* And on triggered uses the owner to open the bookmark.
*
*/
class KIO_EXPORT KBookmarkAction : public KAction, public KBookmarkActionInterface
{
Q_OBJECT
public:
KBookmarkAction(const KBookmark &bk, KBookmarkOwner* owner, QObject *parent);
virtual ~KBookmarkAction();
public Q_SLOTS:
void slotSelected(Qt::MouseButtons mb, Qt::KeyboardModifiers km);
private:
KBookmarkOwner* m_pOwner;
};
#endif
|