]> cloud.milkyroute.net Git - dolphin.git/blob - src/sidebarpage.h
Forwardport 773570:
[dolphin.git] / src / sidebarpage.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Cvetoslav Ludmiloff <ludmiloff@gmail.com> *
3 * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
20
21 #ifndef _SIDEBARPAGE_H_
22 #define _SIDEBARPAGE_H_
23
24 #include <QtGui/QWidget>
25 #include <kurl.h>
26 #include <kfileitem.h>
27
28 /**
29 * @brief Base widget for all pages that can be embedded into the Sidebar.
30 */
31 class SidebarPage : public QWidget
32 {
33 Q_OBJECT
34 public:
35 explicit SidebarPage(QWidget* parent = 0);
36 virtual ~SidebarPage();
37
38 /** Returns the current set URL of the active Dolphin view. */
39 const KUrl& url() const;
40
41 /** Returns the current selected items of the active Dolphin view. */
42 const KFileItemList& selection() const;
43
44 public slots:
45 /**
46 * This is invoked every time the folder being displayed in the
47 * active Dolphin view changes.
48 */
49 virtual void setUrl(const KUrl& url);
50
51 /**
52 * This is invoked to inform the sidebar that the user has selected a new
53 * set of items.
54 */
55 virtual void setSelection(const KFileItemList& selection);
56
57 signals:
58 /**
59 * This signal is emitted when the sidebar requests an URL-change in the
60 * currently active file-management view. The view is not requested to
61 * accept this change, if it is accepted the sidebar will be informed via
62 * the setUrl() slot.
63 */
64 void changeUrl(const KUrl& url);
65
66 /**
67 * This signal is emitted when the sidebar requests a change in the
68 * current selection. The file-management view recieving this signal is
69 * not required to select all listed files, limiting the selection to
70 * e.g. the current folder. The new selection will be reported via the
71 * setSelection slot.
72 */
73 void changeSelection(const KFileItemList& selection);
74
75 /**
76 * This signal is emitted whenever a drop action on this widget needs the
77 * MainWindow's attention.
78 */
79 void urlsDropped(const KUrl::List& urls, const KUrl& destination);
80
81 private:
82 KUrl m_url;
83 KFileItemList m_currentSelection;
84 };
85
86 #endif // _SIDEBARPAGE_H_