]> cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinpart.h
fix crash when pressing F2 on startup
[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 class KFileItemList;
25 class KFileItem;
26 class DolphinPartBrowserExtension;
27 class DolphinSortFilterProxyModel;
28 class DolphinModel;
29 class KDirLister;
30 class DolphinView;
31 class QLineEdit;
32 class KAboutData;
33
34 class DolphinPart : public KParts::ReadOnlyPart
35 {
36 Q_OBJECT
37 // Used by konqueror. Technically it means "we want undo enabled if
38 // there are things in the undo history and the current part is a dolphin part".
39 // Even though it's konqueror doing the undo...
40 Q_PROPERTY( bool supportsUndo READ supportsUndo )
41
42 public:
43 explicit DolphinPart(QWidget* parentWidget, QObject* parent, const QStringList& args);
44 ~DolphinPart();
45
46 static KAboutData* createAboutData();
47
48 virtual bool openUrl(const KUrl& url);
49
50 /// see the supportsUndo property
51 bool supportsUndo() const { return true; }
52
53 protected:
54 /**
55 * We reimplement openUrl so no need to implement openFile.
56 */
57 virtual bool openFile() { return true; }
58
59 private Q_SLOTS:
60 void slotCompleted(const KUrl& url);
61 void slotCanceled(const KUrl& url);
62 void slotInfoMessage(const QString& msg);
63 void slotErrorMessage(const QString& msg);
64 /**
65 * Shows the information for the item \a item inside the statusbar. If the
66 * item is null, the default statusbar information is shown.
67 */
68 void slotRequestItemInfo(const KFileItem& item);
69 /**
70 * Handles clicking on an item
71 */
72 void slotItemTriggered(const KFileItem& item);
73 /**
74 * Opens the context menu on the current mouse position.
75 * @item File item context. If item is 0, the context menu
76 * should be applied to \a url.
77 * @url URL which contains \a item.
78 */
79 void slotOpenContextMenu(const KFileItem& item, const KUrl& url);
80 /**
81 * Emitted when the user requested a change of view mode
82 */
83 void slotViewModeActionTriggered(QAction*);
84
85 /**
86 * Asks the host to open the URL \a url if the current view has
87 * a different URL.
88 */
89 void slotUrlChanged(const KUrl& url);
90
91 /**
92 * Updates the state of the 'Edit' menu actions and emits
93 * the signal selectionChanged().
94 */
95 void slotSelectionChanged(const KFileItemList& selection);
96
97 /**
98 * Same as in DolphinMainWindow: updates the view menu actions
99 */
100 void updateViewActions();
101
102 private:
103 void createActions();
104
105 private:
106 DolphinView* m_view;
107 KDirLister* m_dirLister;
108 DolphinModel* m_dolphinModel;
109 DolphinSortFilterProxyModel* m_proxyModel;
110 DolphinPartBrowserExtension* m_extension;
111 Q_DISABLE_COPY(DolphinPart)
112 };
113
114 #endif /* DOLPHINPART_H */