~ubuntu-branches/ubuntu/utopic/kdebase/utopic

« back to all changes in this revision

Viewing changes to konsole/src/BookmarkHandler.h

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers, José Manuel Santamaría Lema, Modestas Vainius
  • Date: 2011-05-26 02:53:50 UTC
  • mfrom: (0.7.7 upstream) (0.4.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 296.
  • Revision ID: james.westby@ubuntu.com-20110526025350-7o10g65yegec2rnq
Tags: 4:4.6.3-1
* New upstream release.

[ José Manuel Santamaría Lema ]
* Bump kde-sc-dev-latest build dependency to 4:4.6.3.
* Bump Standards-Version to 3.9.2; no changes needed.

[ Modestas Vainius ]
* Enable DLRestrictions for libraries in this package. Requires
  libdlrestrictions-dev 0.14 and kdelibs5-dev 4:4.6.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file was part of the KDE libraries
 
2
    
 
3
    Copyright 2002 Carsten Pfeiffer <pfeiffer@kde.org>
 
4
    Copyright 2007-2008 Robert Knight <robertknight@gmail.com>
 
5
 
 
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.
 
10
 
 
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.
 
15
 
 
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.
 
20
*/
 
21
 
 
22
// Born as kdelibs/kio/kfile/kfilebookmarkhandler.h
 
23
 
 
24
#ifndef KONSOLEBOOKMARKHANDLER_H
 
25
#define KONSOLEBOOKMARKHANDLER_H
 
26
 
 
27
// Qt
 
28
#include <QtGui/QMenu>
 
29
 
 
30
// KDE
 
31
#include <KBookmarkManager>
 
32
 
 
33
// Konsole
 
34
#include "konsole_export.h"
 
35
 
 
36
class KMenu;
 
37
class KBookmarkMenu;
 
38
class KBookmarkManager;
 
39
class KActionCollection;
 
40
 
 
41
namespace Konsole
 
42
{
 
43
 
 
44
class ViewProperties;
 
45
 
 
46
/**
 
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
 
49
 * the bookmarks menu.
 
50
 *
 
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()
 
54
 *
 
55
 * When the user selects a bookmark, the openUrl() signal is emitted.
 
56
 */
 
57
class KONSOLEPRIVATE_EXPORT BookmarkHandler : public QObject, public KBookmarkOwner
 
58
{
 
59
    Q_OBJECT
 
60
 
 
61
public:
 
62
 
 
63
    /**
 
64
     * Constructs a new bookmark handler for Konsole bookmarks.
 
65
     *
 
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
 
70
     */
 
71
    BookmarkHandler( KActionCollection* collection , KMenu* menu, bool toplevel , QObject* parent );
 
72
    ~BookmarkHandler();
 
73
 
 
74
    QMenu * popupMenu();
 
75
 
 
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);
 
82
 
 
83
    /** 
 
84
     * Returns the menu which this bookmark handler inserts its actions into.
 
85
     */
 
86
    KMenu *menu() const { return m_menu; }
 
87
 
 
88
    QList<ViewProperties*> views() const;
 
89
    ViewProperties* activeView() const;
 
90
 
 
91
public slots:
 
92
    /**
 
93
     *
 
94
     */
 
95
    void setViews( const QList<ViewProperties*>& views );
 
96
 
 
97
    void setActiveView( ViewProperties* view );
 
98
 
 
99
signals:
 
100
    /**
 
101
     * Emitted when the user selects a bookmark from the bookmark menu.
 
102
     *
 
103
     * @param url The url of the bookmark which was selected by the user.
 
104
     */
 
105
    void openUrl( const KUrl& url ); 
 
106
 
 
107
    /**
 
108
     * Emitted when the user selects 'Open Folder in Tabs' 
 
109
     * from the bookmark menu.
 
110
     *
 
111
     * @param urls The urls of the bookmarks in the folder whoose
 
112
     * 'Open Folder in Tabs' action was triggered
 
113
     */
 
114
    void openUrls( const QList<KUrl>& urls );
 
115
 
 
116
private Q_SLOTS:
 
117
    void openBookmark( const KBookmark & bm, Qt::MouseButtons, Qt::KeyboardModifiers );
 
118
 
 
119
private:
 
120
    QString titleForView( ViewProperties* view ) const;
 
121
    QString urlForView( ViewProperties* view ) const;
 
122
 
 
123
    KMenu* m_menu;
 
124
    KBookmarkMenu* m_bookmarkMenu;
 
125
    QString m_file;
 
126
    bool m_toplevel;
 
127
    ViewProperties* m_activeView;
 
128
    QList<ViewProperties*> m_views;
 
129
};
 
130
 
 
131
}
 
132
 
 
133
#endif // KONSOLEBOOKMARKHANDLER_H