1
/* This file was part of the KDE libraries
3
Copyright 2002 Carsten Pfeiffer <pfeiffer@kde.org>
4
Copyright 2007-2008 Robert Knight <robertknight@gmail.com>
6
library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Library General Public
8
License as published by the Free Software Foundation, version 2
9
or (at your option) any later version.
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Library General Public License for more details.
16
You should have received a copy of the GNU Library General Public License
17
along with this library; see the file COPYING.LIB. If not, write to
18
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
Boston, MA 02110-1301, USA.
22
// Born as kdelibs/kio/kfile/kfilebookmarkhandler.h
24
#ifndef KONSOLEBOOKMARKHANDLER_H
25
#define KONSOLEBOOKMARKHANDLER_H
28
#include <QtGui/QMenu>
31
#include <KBookmarkManager>
34
#include "konsole_export.h"
38
class KBookmarkManager;
39
class KActionCollection;
47
* This class handles the communication between the bookmark menu and the active session,
48
* providing a suggested title and URL when the user clicks the "Add Bookmark" item in
51
* The bookmark handler is associated with a session controller, which is used to
52
* determine the working URL of the current session. When the user changes the active
53
* view, the bookmark handler's controller should be changed using setController()
55
* When the user selects a bookmark, the openUrl() signal is emitted.
57
class KONSOLEPRIVATE_EXPORT BookmarkHandler : public QObject, public KBookmarkOwner
64
* Constructs a new bookmark handler for Konsole bookmarks.
66
* @param collection The collection which the boomark menu's actions should be added to
67
* @param menu The menu which the bookmark actions should be added to
68
* @param toplevel TODO: Document me
69
* @param parent TODO: Document me
71
BookmarkHandler( KActionCollection* collection , KMenu* menu, bool toplevel , QObject* parent );
76
virtual QString currentUrl() const;
77
virtual QString currentTitle() const;
78
virtual bool enableOption(BookmarkOption option) const;
79
virtual bool supportsTabs() const;
80
virtual QList<QPair<QString,QString> > currentBookmarkList() const;
81
virtual void openFolderinTabs(const KBookmarkGroup& group);
84
* Returns the menu which this bookmark handler inserts its actions into.
86
KMenu *menu() const { return m_menu; }
88
QList<ViewProperties*> views() const;
89
ViewProperties* activeView() const;
95
void setViews( const QList<ViewProperties*>& views );
97
void setActiveView( ViewProperties* view );
101
* Emitted when the user selects a bookmark from the bookmark menu.
103
* @param url The url of the bookmark which was selected by the user.
105
void openUrl( const KUrl& url );
108
* Emitted when the user selects 'Open Folder in Tabs'
109
* from the bookmark menu.
111
* @param urls The urls of the bookmarks in the folder whoose
112
* 'Open Folder in Tabs' action was triggered
114
void openUrls( const QList<KUrl>& urls );
117
void openBookmark( const KBookmark & bm, Qt::MouseButtons, Qt::KeyboardModifiers );
120
QString titleForView( ViewProperties* view ) const;
121
QString urlForView( ViewProperties* view ) const;
124
KBookmarkMenu* m_bookmarkMenu;
127
ViewProperties* m_activeView;
128
QList<ViewProperties*> m_views;
133
#endif // KONSOLEBOOKMARKHANDLER_H