1
/***************************************************************************
2
* Copyright (C) 2008 by David Faure <faure@kde.org> *
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 2 of the License, or *
7
* (at your option) any later version. *
9
* This program 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 *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18
***************************************************************************/
21
#ifndef DOLPHINVIEWACTIONHANDLER_H
22
#define DOLPHINVIEWACTIONHANDLER_H
24
#include "libdolphin_export.h"
25
#include <kactionmenu.h>
26
#include <kselectaction.h>
27
#include "views/dolphinview.h"
28
#include <QtCore/QObject>
34
class KActionCollection;
37
* @short Handles all actions for DolphinView
39
* The action handler owns all the actions and slots related to DolphinView,
40
* but can the view that is acts upon can be switched to another one
41
* (this is used in the case of split views).
43
* The purpose of this class is also to share this code between DolphinMainWindow
47
* @see DolphinMainWindow
50
class LIBDOLPHINPRIVATE_EXPORT DolphinViewActionHandler : public QObject
55
explicit DolphinViewActionHandler(KActionCollection* collection, QObject* parent);
58
* Sets the view that this action handler should work on.
60
void setCurrentView(DolphinView* view);
63
* Returns the view that this action handler should work on.
65
DolphinView* currentView();
68
* Returns the name of the action for the current viewmode
70
QString currentViewModeActionName() const;
73
* Returns m_actionCollection
75
KActionCollection* actionCollection();
79
* Update all actions in the 'View' menu, i.e. those that depend on the
80
* settings in the current view.
82
void updateViewActions();
86
* Emitted by DolphinViewActionHandler when the user triggered an action.
87
* This is only used for clearining the statusbar in DolphinMainWindow.
89
void actionBeingHandled();
92
* Emitted if the user requested creating a new directory by the F10 key.
93
* The receiver of the signal (DolphinMainWindow or DolphinPart) invokes
94
* the method createDirectory of their KNewFileMenu instance.
96
void createDirectory();
100
* Emitted when the user requested a change of view mode
102
void slotViewModeActionTriggered(QAction*);
105
* Let the user input a name for the selected item(s) and trigger
106
* a renaming afterwards.
111
* Moves the selected items of the active view to the trash.
112
* This methods adds "shift means del" handling.
114
void slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers);
117
* Deletes the selected items of the active view.
119
void slotDeleteItems();
122
* Switches between showing a preview of the file content and showing the icon.
124
void togglePreview(bool);
126
/** Updates the state of the 'Show preview' menu action. */
127
void slotShowPreviewChanged();
129
/** Increases the size of the current set view mode. */
132
/** Decreases the size of the current set view mode. */
135
/** Switches between an ascending and descending sorting order. */
136
void toggleSortOrder();
138
/** Switches between a separate sorting and a mixed sorting of files and folders. */
139
void toggleSortFoldersFirst();
142
* Updates the state of the 'Sort Ascending/Descending' action.
144
void slotSortOrderChanged(Qt::SortOrder order);
147
* Updates the state of the 'Sort Folders First' action.
149
void slotSortFoldersFirstChanged(bool foldersFirst);
152
* Updates the state of the 'Sort by' actions.
154
void slotSortingChanged(DolphinView::Sorting sorting);
157
* Updates the state of the 'Zoom In' and 'Zoom Out' actions.
159
void slotZoomLevelChanged(int level);
162
* Switches on or off the displaying of additional information
163
* as specified by \a action.
165
void toggleAdditionalInfo(QAction* action);
168
* Changes the sorting of the current view.
170
void slotSortTriggered(QAction*);
173
* Updates the state of the 'Additional Information' actions.
175
void slotAdditionalInfoChanged();
178
* Switches between sorting by categories or not.
180
void toggleSortCategorization(bool);
183
* Updates the state of the 'Categorized sorting' menu action.
185
void slotCategorizedSortingChanged();
188
* Switches between showing and hiding of hidden marked files
190
void toggleShowHiddenFiles(bool);
193
* Updates the state of the 'Show hidden files' menu action.
195
void slotShowHiddenFilesChanged();
198
* Opens the view properties dialog, which allows to modify the properties
199
* of the currently active view.
201
void slotAdjustViewProperties();
204
* Connected to the "properties" action.
205
* Opens the properties dialog for the selected items of the
206
* active view. The properties dialog shows information
207
* like name, size and permissions.
209
void slotProperties();
213
* Create all the actions.
214
* This is called only once (by the constructor)
216
void createActions();
219
* Creates an action group with all the "show additional information" actions in it.
220
* Helper method for createActions();
222
QActionGroup* createAdditionalInformationActionGroup();
225
* Creates an action group with all the "sort by" actions in it.
226
* Helper method for createActions();
228
QActionGroup* createSortByActionGroup();
231
* Returns the "switch to icons mode" action.
232
* Helper method for createActions();
234
KToggleAction* iconsModeAction();
237
* Returns the "switch to details mode" action.
238
* Helper method for createActions();
240
KToggleAction* detailsModeAction();
243
* Returns the "switch to columns mode" action.
244
* Helper method for createActions();
246
KToggleAction* columnsModeAction();
248
KActionCollection* m_actionCollection;
249
DolphinView* m_currentView;
252
#endif /* DOLPHINVIEWACTIONHANDLER_H */