Changeset View
Changeset View
Standalone View
Standalone View
src/dolphinmainwindow.h
Show All 21 Lines | |||||
22 | #ifndef DOLPHIN_MAINWINDOW_H | 22 | #ifndef DOLPHIN_MAINWINDOW_H | ||
23 | #define DOLPHIN_MAINWINDOW_H | 23 | #define DOLPHIN_MAINWINDOW_H | ||
24 | 24 | | |||
25 | #include "dolphintabwidget.h" | 25 | #include "dolphintabwidget.h" | ||
26 | #include <config-baloo.h> | 26 | #include <config-baloo.h> | ||
27 | #include <kio/fileundomanager.h> | 27 | #include <kio/fileundomanager.h> | ||
28 | #include <ksortablelist.h> | 28 | #include <ksortablelist.h> | ||
29 | #include <kxmlguiwindow.h> | 29 | #include <kxmlguiwindow.h> | ||
30 | #include <KFileItem> | ||||
31 | #include "kitemviews/kitemlistselectionmanager.h" | ||||
30 | 32 | | |||
31 | #include <QIcon> | 33 | #include <QIcon> | ||
32 | #include <QList> | 34 | #include <QList> | ||
33 | #include <QMenu> | 35 | #include <QMenu> | ||
34 | #include <QPointer> | 36 | #include <QPointer> | ||
35 | #include <QUrl> | 37 | #include <QUrl> | ||
36 | #include <QVector> | 38 | #include <QVector> | ||
37 | 39 | | |||
38 | typedef KIO::FileUndoManager::CommandType CommandType; | 40 | typedef KIO::FileUndoManager::CommandType CommandType; | ||
39 | 41 | | |||
40 | class DolphinBookmarkHandler; | 42 | class DolphinBookmarkHandler; | ||
41 | class DolphinViewActionHandler; | 43 | class DolphinViewActionHandler; | ||
42 | class DolphinSettingsDialog; | 44 | class DolphinSettingsDialog; | ||
43 | class DolphinViewContainer; | 45 | class DolphinViewContainer; | ||
44 | class DolphinRemoteEncoding; | 46 | class DolphinRemoteEncoding; | ||
45 | class DolphinTabWidget; | 47 | class DolphinTabWidget; | ||
46 | class KFileItem; | | |||
47 | class KFileItemList; | | |||
48 | class KJob; | 48 | class KJob; | ||
49 | class KNewFileMenu; | 49 | class KNewFileMenu; | ||
50 | class KHelpMenu; | 50 | class KHelpMenu; | ||
51 | class KToolBarPopupAction; | 51 | class KToolBarPopupAction; | ||
52 | class QToolButton; | 52 | class QToolButton; | ||
53 | class QIcon; | 53 | class QIcon; | ||
54 | class PlacesPanel; | 54 | class PlacesPanel; | ||
55 | class TerminalPanel; | 55 | class TerminalPanel; | ||
56 | class KFileItemListView; | ||||
56 | 57 | | |||
57 | /** | 58 | /** | ||
58 | * @short Main window for Dolphin. | 59 | * @short Main window for Dolphin. | ||
59 | * | 60 | * | ||
60 | * Handles the menus, toolbars and Dolphin views. | 61 | * Handles the menus, toolbars and Dolphin views. | ||
61 | */ | 62 | */ | ||
62 | class DolphinMainWindow: public KXmlGuiWindow | 63 | class DolphinMainWindow: public KXmlGuiWindow | ||
63 | { | 64 | { | ||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | 107 | public slots: | |||
131 | * Determines if a URL is open in any tab. | 132 | * Determines if a URL is open in any tab. | ||
132 | * @note Use of QString instead of QUrl is required to be callable via DBus. | 133 | * @note Use of QString instead of QUrl is required to be callable via DBus. | ||
133 | * | 134 | * | ||
134 | * @param url URL to look for | 135 | * @param url URL to look for | ||
135 | * @returns true if url is currently open in a tab, false otherwise. | 136 | * @returns true if url is currently open in a tab, false otherwise. | ||
136 | */ | 137 | */ | ||
137 | bool isUrlOpen(const QString &url); | 138 | bool isUrlOpen(const QString &url); | ||
138 | 139 | | |||
139 | | ||||
140 | /** | | |||
141 | * Pastes the clipboard data into the currently selected folder | | |||
142 | * of the active view. If not exactly one folder is selected, | | |||
143 | * no pasting is done at all. | | |||
144 | */ | | |||
145 | void pasteIntoFolder(); | | |||
146 | | ||||
147 | /** | 140 | /** | ||
148 | * Implementation of the MainWindowAdaptor/QDBusAbstractAdaptor interface. | 141 | * Implementation of the MainWindowAdaptor/QDBusAbstractAdaptor interface. | ||
149 | * Inform all affected dolphin components (panels, views) of an URL | 142 | * Inform all affected dolphin components (panels, views) of an URL | ||
150 | * change. | 143 | * change. | ||
151 | */ | 144 | */ | ||
152 | void changeUrl(const QUrl& url); | 145 | void changeUrl(const QUrl& url); | ||
153 | 146 | | |||
154 | /** | 147 | /** | ||
Show All 11 Lines | |||||
166 | */ | 159 | */ | ||
167 | void openNewTabAfterCurrentTab(const QUrl& url); | 160 | void openNewTabAfterCurrentTab(const QUrl& url); | ||
168 | 161 | | |||
169 | /** | 162 | /** | ||
170 | * Opens a new tab and places it as the last tab | 163 | * Opens a new tab and places it as the last tab | ||
171 | */ | 164 | */ | ||
172 | void openNewTabAfterLastTab(const QUrl& url); | 165 | void openNewTabAfterLastTab(const QUrl& url); | ||
173 | 166 | | |||
167 | /** | ||||
168 | * Pastes the clipboard data into the currently selected folder | ||||
169 | * of the active view. If not exactly one folder is selected, | ||||
170 | * no pasting is done at all. | ||||
171 | */ | ||||
172 | void pasteIntoFolder(); | ||||
173 | | ||||
174 | signals: | 174 | signals: | ||
175 | /** | 175 | /** | ||
176 | * Is sent if the selection of the currently active view has | 176 | * Is sent if the selection of the currently active view has | ||
177 | * been changed. | 177 | * been changed. | ||
178 | */ | 178 | */ | ||
179 | void selectionChanged(const KFileItemList& selection); | 179 | void selectionChanged(const KFileItemList& selection); | ||
180 | 180 | | |||
181 | /** | 181 | /** | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 216 | private slots: | |||
237 | void slotUndoAvailable(bool available); | 237 | void slotUndoAvailable(bool available); | ||
238 | 238 | | |||
239 | /** Sets the text of the 'Undo' menu action to \a text. */ | 239 | /** Sets the text of the 'Undo' menu action to \a text. */ | ||
240 | void slotUndoTextChanged(const QString& text); | 240 | void slotUndoTextChanged(const QString& text); | ||
241 | 241 | | |||
242 | /** Performs the current undo operation. */ | 242 | /** Performs the current undo operation. */ | ||
243 | void undo(); | 243 | void undo(); | ||
244 | 244 | | |||
245 | /** | | |||
246 | * Copies all selected items to the clipboard and marks | | |||
247 | * the items as cut. | | |||
248 | */ | | |||
249 | void cut(); | | |||
250 | | ||||
251 | /** Copies all selected items to the clipboard. */ | | |||
252 | void copy(); | | |||
253 | | ||||
254 | /** Pastes the clipboard data to the active view. */ | | |||
255 | void paste(); | | |||
256 | | ||||
257 | /** Replaces the URL navigator by a search box to find files. */ | 245 | /** Replaces the URL navigator by a search box to find files. */ | ||
258 | void find(); | 246 | void find(); | ||
259 | 247 | | |||
260 | /** Updates the state of the search action according to the view container. */ | 248 | /** Updates the state of the search action according to the view container. */ | ||
261 | void updateSearchAction(); | 249 | void updateSearchAction(); | ||
262 | 250 | | |||
263 | /** | 251 | /** | ||
264 | * Updates the text of the paste action dependent on | 252 | * Updates the text of the paste action dependent on | ||
▲ Show 20 Lines • Show All 190 Lines • ▼ Show 20 Line(s) | |||||
455 | * @url URL which contains \a item. | 443 | * @url URL which contains \a item. | ||
456 | * @customActions Actions that should be added to the context menu, | 444 | * @customActions Actions that should be added to the context menu, | ||
457 | * if the file item is null. | 445 | * if the file item is null. | ||
458 | */ | 446 | */ | ||
459 | void openContextMenu(const QPoint& pos, | 447 | void openContextMenu(const QPoint& pos, | ||
460 | const KFileItem& item, | 448 | const KFileItem& item, | ||
461 | const QUrl& url, | 449 | const QUrl& url, | ||
462 | const QList<QAction*>& customActions); | 450 | const QList<QAction*>& customActions); | ||
451 | /** | ||||
452 | * Opens the context menu on the current mouse position. | ||||
453 | * @pos Position in screen coordinates. | ||||
454 | * @item File item context. If item is null, the context menu | ||||
455 | * should be applied to \a url. | ||||
456 | * @url URL which contains \a item. | ||||
457 | * @selection The selection manager for this action | ||||
458 | * @view The optional view the selection belongs to | ||||
459 | * @customActions Actions that should be added to the context menu, | ||||
460 | * if the file item is null. | ||||
461 | */ | ||||
462 | void openContextMenuWithSelection(const QPoint& pos, | ||||
463 | const KFileItem& item, | ||||
464 | const QUrl& url, | ||||
465 | const QList<QAction*>& customActions, | ||||
466 | KItemListSelectionManager* selectionManager, | ||||
467 | KFileItemListView* view = nullptr); | ||||
463 | 468 | | |||
464 | void updateControlMenu(); | 469 | void updateControlMenu(); | ||
465 | void updateToolBar(); | 470 | void updateToolBar(); | ||
466 | void slotControlButtonDeleted(); | 471 | void slotControlButtonDeleted(); | ||
467 | 472 | | |||
468 | /** | 473 | /** | ||
469 | * Is called if the user clicked an item in the Places Panel. | 474 | * Is called if the user clicked an item in the Places Panel. | ||
470 | * Reloads the view if \a url is the current URL already, and changes the | 475 | * Reloads the view if \a url is the current URL already, and changes the | ||
▲ Show 20 Lines • Show All 143 Lines • ▼ Show 20 Line(s) | 561 | private: | |||
614 | * Returns the KIO::StatJob::mostLocalUrl() for the active container URL | 619 | * Returns the KIO::StatJob::mostLocalUrl() for the active container URL | ||
615 | * if it's a local file. Otherwise returns the user's home path. | 620 | * if it's a local file. Otherwise returns the user's home path. | ||
616 | */ | 621 | */ | ||
617 | QString activeContainerLocalPath(); | 622 | QString activeContainerLocalPath(); | ||
618 | 623 | | |||
619 | /** Returns preferred search tool as configured in "More Search Tools" menu. */ | 624 | /** Returns preferred search tool as configured in "More Search Tools" menu. */ | ||
620 | QPointer<QAction> preferredSearchTool(); | 625 | QPointer<QAction> preferredSearchTool(); | ||
621 | 626 | | |||
627 | KFileItemList selectedItems(); | ||||
628 | KItemSet selectedItemSet(); | ||||
629 | | ||||
622 | private: | 630 | private: | ||
623 | /** | 631 | /** | ||
624 | * Implements a custom error handling for the undo manager. This | 632 | * Implements a custom error handling for the undo manager. This | ||
625 | * assures that all errors are shown in the status bar of Dolphin | 633 | * assures that all errors are shown in the status bar of Dolphin | ||
626 | * instead as modal error dialog with an OK button. | 634 | * instead as modal error dialog with an OK button. | ||
627 | */ | 635 | */ | ||
628 | class UndoUiInterface : public KIO::FileUndoManager::UiInterface | 636 | class UndoUiInterface : public KIO::FileUndoManager::UiInterface | ||
629 | { | 637 | { | ||
Show All 23 Lines | |||||
653 | PlacesPanel* m_placesPanel; | 661 | PlacesPanel* m_placesPanel; | ||
654 | bool m_tearDownFromPlacesRequested; | 662 | bool m_tearDownFromPlacesRequested; | ||
655 | 663 | | |||
656 | KToolBarPopupAction* m_backAction; | 664 | KToolBarPopupAction* m_backAction; | ||
657 | KToolBarPopupAction* m_forwardAction; | 665 | KToolBarPopupAction* m_forwardAction; | ||
658 | 666 | | |||
659 | QMenu m_searchTools; | 667 | QMenu m_searchTools; | ||
660 | 668 | | |||
669 | KItemListSelectionManager* m_currentSelectionManager = nullptr; | ||||
661 | }; | 670 | }; | ||
662 | 671 | | |||
663 | inline DolphinViewContainer* DolphinMainWindow::activeViewContainer() const | 672 | inline DolphinViewContainer* DolphinMainWindow::activeViewContainer() const | ||
664 | { | 673 | { | ||
665 | return m_activeViewContainer; | 674 | return m_activeViewContainer; | ||
666 | } | 675 | } | ||
667 | 676 | | |||
668 | inline KNewFileMenu* DolphinMainWindow::newFileMenu() const | 677 | inline KNewFileMenu* DolphinMainWindow::newFileMenu() const | ||
669 | { | 678 | { | ||
670 | return m_newFileMenu; | 679 | return m_newFileMenu; | ||
671 | } | 680 | } | ||
672 | 681 | | |||
673 | #endif // DOLPHIN_MAINWINDOW_H | 682 | #endif // DOLPHIN_MAINWINDOW_H | ||
674 | 683 | |