]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinpart.h
Show elastic band on the column widget
[dolphin.git] / src / dolphinpart.h
1 /* This file is part of the KDE project
2 Copyright (c) 2007 David Faure <faure@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef DOLPHINPART_H
21 #define DOLPHINPART_H
22
23 #include <kparts/part.h>
24 #include <kparts/browserextension.h>
25 class KAction;
26 class KFileItemList;
27 class KFileItem;
28 class DolphinPartBrowserExtension;
29 class DolphinSortFilterProxyModel;
30 class DolphinModel;
31 class KDirLister;
32 class DolphinView;
33 class QLineEdit;
34 class KAboutData;
35
36 class DolphinPart : public KParts::ReadOnlyPart
37 {
38 Q_OBJECT
39 // Used by konqueror. Technically it means "we want undo enabled if
40 // there are things in the undo history and the current part is a dolphin part".
41 // Even though it's konqueror doing the undo...
42 Q_PROPERTY( bool supportsUndo READ supportsUndo )
43
44 public:
45 explicit DolphinPart(QWidget* parentWidget, QObject* parent, const QStringList& args);
46 ~DolphinPart();
47
48 static KAboutData* createAboutData();
49
50 virtual bool openUrl(const KUrl& url);
51
52 /// see the supportsUndo property
53 bool supportsUndo() const { return true; }
54
55 DolphinView* view() { return m_view; }
56
57 protected:
58 /**
59 * We reimplement openUrl so no need to implement openFile.
60 */
61 virtual bool openFile() { return true; }
62
63 private Q_SLOTS:
64 void slotCompleted(const KUrl& url);
65 void slotCanceled(const KUrl& url);
66 void slotInfoMessage(const QString& msg);
67 void slotErrorMessage(const QString& msg);
68 /**
69 * Shows the information for the item \a item inside the statusbar. If the
70 * item is null, the default statusbar information is shown.
71 */
72 void slotRequestItemInfo(const KFileItem& item);
73 /**
74 * Handles clicking on an item
75 */
76 void slotItemTriggered(const KFileItem& item);
77 /**
78 * Opens the context menu on the current mouse position.
79 * @item File item context. If item is 0, the context menu
80 * should be applied to \a url.
81 * @url URL which contains \a item.
82 */
83 void slotOpenContextMenu(const KFileItem& item, const KUrl& url);
84 /**
85 * Emitted when the user requested a change of view mode
86 */
87 void slotViewModeActionTriggered(QAction*);
88
89 /**
90 * Asks the host to open the URL \a url if the current view has
91 * a different URL.
92 */
93 void slotUrlChanged(const KUrl& url);
94
95 /**
96 * Updates the state of the 'Edit' menu actions and emits
97 * the signal selectionChanged().
98 */
99 void slotSelectionChanged(const KFileItemList& selection);
100
101 /**
102 * Same as in DolphinMainWindow: updates the view menu actions
103 */
104 void updateViewActions();
105
106 /**
107 * Updates the text of the paste action dependent from
108 * the number of items which are in the clipboard.
109 */
110 void updatePasteAction();
111
112 /**
113 * Connected to the "move_to_trash" action; adds "shift means del" handling.
114 */
115 void slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers);
116
117 void slotNewDir();
118
119 private:
120 void createActions();
121
122 private:
123 DolphinView* m_view;
124 KDirLister* m_dirLister;
125 DolphinModel* m_dolphinModel;
126 DolphinSortFilterProxyModel* m_proxyModel;
127 DolphinPartBrowserExtension* m_extension;
128 Q_DISABLE_COPY(DolphinPart)
129 };
130
131 class DolphinPartBrowserExtension : public KParts::BrowserExtension
132 {
133 Q_OBJECT
134 public:
135 DolphinPartBrowserExtension( DolphinPart* part )
136 : KParts::BrowserExtension( part ), m_part(part) {}
137
138 public Q_SLOTS:
139 void cut();
140 void copy();
141 void paste();
142
143 private:
144 DolphinPart* m_part;
145 };
146
147 #endif /* DOLPHINPART_H */