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>
29 class KActionCollection
;
32 * @short Handles all actions for DolphinView
34 * The action handler owns all the actions and slots related to DolphinView,
35 * but can the view that is acts upon can be switched to another one
36 * (this is used in the case of split views).
38 * The purpose of this class is also to share this code between DolphinMainWindow
42 * @see DolphinMainWindow
45 class LIBDOLPHINPRIVATE_EXPORT DolphinViewActionHandler
: public QObject
50 explicit DolphinViewActionHandler(KActionCollection
* collection
, QObject
* parent
);
53 * Sets the view that this action handler should work on.
55 void setCurrentView(DolphinView
* view
);
58 * Update all actions in the 'View' menu, i.e. those that depend on the
59 * settings in the current view.
61 void updateViewActions();
65 * Emitted by DolphinViewActionHandler when the user triggered an action.
66 * This is only used for clearining the statusbar in DolphinMainWindow.
68 void actionBeingHandled();
72 * Opens the dialog for creating a directory. Is connected
73 * with the key shortcut for "new directory" (F10).
78 * Let the user input a name for the selected item(s) and trigger
79 * a renaming afterwards.
84 * Moves the selected items of the active view to the trash.
85 * This methods adds "shift means del" handling.
87 void slotTrashActivated(Qt::MouseButtons
, Qt::KeyboardModifiers
);
90 * Deletes the selected items of the active view.
92 void slotDeleteItems();
95 * Switches between showing a preview of the file content and showing the icon.
97 void togglePreview(bool);
99 /** Updates the state of the 'Show preview' menu action. */
100 void slotShowPreviewChanged();
102 /** Increases the size of the current set view mode. */
105 /** Decreases the size of the current set view mode. */
108 /** Switches between an ascending and descending sorting order. */
109 void toggleSortOrder();
112 * Updates the state of the 'Sort Ascending/Descending' action.
114 void slotSortOrderChanged(Qt::SortOrder order
);
117 * Switches on or off the displaying of additional information
118 * as specified by \a action.
120 void toggleAdditionalInfo(QAction
* action
);
123 * Updates the state of the 'Additional Information' actions.
125 void slotAdditionalInfoChanged();
128 * Switches between sorting by categories or not.
130 void toggleSortCategorization(bool);
133 * Updates the state of the 'Categorized sorting' menu action.
135 void slotCategorizedSortingChanged();
138 * Switches between showing and hiding of hidden marked files
140 void toggleShowHiddenFiles(bool);
143 * Updates the state of the 'Show hidden files' menu action.
145 void slotShowHiddenFilesChanged();
149 * Create all the actions.
150 * This is called only once (by the constructor)
152 void createActions();
154 * Creates an action group with all the "show additional information" actions in it.
155 * Helper method for createActions();
157 QActionGroup
* createAdditionalInformationActionGroup();
159 KActionCollection
* m_actionCollection
;
160 DolphinView
* m_currentView
;
164 #endif /* DOLPHINVIEWACTIONHANDLER_H */