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 <QtCore/QObject>
30 class KActionCollection
;
33 * @short Handles all actions for DolphinView
35 * The action handler owns all the actions and slots related to DolphinView,
36 * but can the view that is acts upon can be switched to another one
37 * (this is used in the case of split views).
39 * The purpose of this class is also to share this code between DolphinMainWindow
43 * @see DolphinMainWindow
46 class LIBDOLPHINPRIVATE_EXPORT DolphinViewActionHandler
: public QObject
51 explicit DolphinViewActionHandler(KActionCollection
* collection
, QObject
* parent
);
54 * Sets the view that this action handler should work on.
56 void setCurrentView(DolphinView
* view
);
59 * Returns the name of the action for the current viewmode
61 QString
currentViewModeActionName() const;
65 * Update all actions in the 'View' menu, i.e. those that depend on the
66 * settings in the current view.
68 void updateViewActions();
72 * Emitted by DolphinViewActionHandler when the user triggered an action.
73 * This is only used for clearining the statusbar in DolphinMainWindow.
75 void actionBeingHandled();
79 * Opens the dialog for creating a directory. Is connected
80 * with the key shortcut for "new directory" (F10).
85 * Emitted when the user requested a change of view mode
87 void slotViewModeActionTriggered(QAction
*);
90 * Let the user input a name for the selected item(s) and trigger
91 * a renaming afterwards.
96 * Moves the selected items of the active view to the trash.
97 * This methods adds "shift means del" handling.
99 void slotTrashActivated(Qt::MouseButtons
, Qt::KeyboardModifiers
);
102 * Deletes the selected items of the active view.
104 void slotDeleteItems();
107 * Switches between showing a preview of the file content and showing the icon.
109 void togglePreview(bool);
111 /** Updates the state of the 'Show preview' menu action. */
112 void slotShowPreviewChanged();
114 /** Increases the size of the current set view mode. */
117 /** Decreases the size of the current set view mode. */
120 /** Switches between an ascending and descending sorting order. */
121 void toggleSortOrder();
124 * Updates the state of the 'Sort Ascending/Descending' action.
126 void slotSortOrderChanged(Qt::SortOrder order
);
129 * Switches on or off the displaying of additional information
130 * as specified by \a action.
132 void toggleAdditionalInfo(QAction
* action
);
135 * Updates the state of the 'Additional Information' actions.
137 void slotAdditionalInfoChanged();
140 * Switches between sorting by categories or not.
142 void toggleSortCategorization(bool);
145 * Updates the state of the 'Categorized sorting' menu action.
147 void slotCategorizedSortingChanged();
150 * Switches between showing and hiding of hidden marked files
152 void toggleShowHiddenFiles(bool);
155 * Updates the state of the 'Show hidden files' menu action.
157 void slotShowHiddenFilesChanged();
161 * Create all the actions.
162 * This is called only once (by the constructor)
164 void createActions();
166 * Creates an action group with all the "show additional information" actions in it.
167 * Helper method for createActions();
169 QActionGroup
* createAdditionalInformationActionGroup();
172 * Returns the "switch to icons mode" action.
173 * Helper method for createActions();
175 KToggleAction
* iconsModeAction();
178 * Returns the "switch to details mode" action.
179 * Helper method for createActions();
181 KToggleAction
* detailsModeAction();
184 * Returns the "switch to columns mode" action.
185 * Helper method for createActions();
187 KToggleAction
* columnsModeAction();
190 KActionCollection
* m_actionCollection
;
191 DolphinView
* m_currentView
;
194 #endif /* DOLPHINVIEWACTIONHANDLER_H */