delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / apps / dolphin / src / dolphinviewactionhandler.h
blobad56518c4e0614b1d78590c93b1e941b5f5680fa
1 /***************************************************************************
2 * Copyright (C) 2008 by David Faure <faure@kde.org> *
3 * *
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. *
8 * *
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. *
13 * *
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 "dolphinview.h"
25 #include "libdolphin_export.h"
26 #include <QtCore/QObject>
27 class KToggleAction;
28 class QAction;
29 class QActionGroup;
30 class DolphinView;
31 class KActionCollection;
33 /**
34 * @short Handles all actions for DolphinView
36 * The action handler owns all the actions and slots related to DolphinView,
37 * but can the view that is acts upon can be switched to another one
38 * (this is used in the case of split views).
40 * The purpose of this class is also to share this code between DolphinMainWindow
41 * and DolphinPart.
43 * @see DolphinView
44 * @see DolphinMainWindow
45 * @see DolphinPart
47 class LIBDOLPHINPRIVATE_EXPORT DolphinViewActionHandler : public QObject
49 Q_OBJECT
51 public:
52 explicit DolphinViewActionHandler(KActionCollection* collection, QObject* parent);
54 /**
55 * Sets the view that this action handler should work on.
57 void setCurrentView(DolphinView* view);
59 /**
60 * Returns the name of the action for the current viewmode
62 QString currentViewModeActionName() const;
64 public Q_SLOTS:
65 /**
66 * Update all actions in the 'View' menu, i.e. those that depend on the
67 * settings in the current view.
69 void updateViewActions();
71 Q_SIGNALS:
72 /**
73 * Emitted by DolphinViewActionHandler when the user triggered an action.
74 * This is only used for clearining the statusbar in DolphinMainWindow.
76 void actionBeingHandled();
78 private Q_SLOTS:
79 /**
80 * Opens the dialog for creating a directory. Is connected
81 * with the key shortcut for "new directory" (F10).
83 void slotCreateDir();
85 /**
86 * Emitted when the user requested a change of view mode
88 void slotViewModeActionTriggered(QAction*);
90 /**
91 * Let the user input a name for the selected item(s) and trigger
92 * a renaming afterwards.
94 void slotRename();
96 /**
97 * Moves the selected items of the active view to the trash.
98 * This methods adds "shift means del" handling.
100 void slotTrashActivated(Qt::MouseButtons, Qt::KeyboardModifiers);
103 * Deletes the selected items of the active view.
105 void slotDeleteItems();
108 * Switches between showing a preview of the file content and showing the icon.
110 void togglePreview(bool);
112 /** Updates the state of the 'Show preview' menu action. */
113 void slotShowPreviewChanged();
115 /** Increases the size of the current set view mode. */
116 void zoomIn();
118 /** Decreases the size of the current set view mode. */
119 void zoomOut();
121 /** Switches between an ascending and descending sorting order. */
122 void toggleSortOrder();
125 * Updates the state of the 'Sort Ascending/Descending' action.
127 void slotSortOrderChanged(Qt::SortOrder order);
130 * Updates the state of the 'Sort by' actions.
132 void slotSortingChanged(DolphinView::Sorting sorting);
135 * Updates the state of the 'Zoom In' and 'Zoom Out' actions.
137 void slotZoomLevelChanged(int level);
140 * Switches on or off the displaying of additional information
141 * as specified by \a action.
143 void toggleAdditionalInfo(QAction* action);
146 * Changes the sorting of the current view.
148 void slotSortTriggered(QAction*);
151 * Updates the state of the 'Additional Information' actions.
153 void slotAdditionalInfoChanged();
156 * Switches between sorting by categories or not.
158 void toggleSortCategorization(bool);
161 * Updates the state of the 'Categorized sorting' menu action.
163 void slotCategorizedSortingChanged();
166 * Switches between showing and hiding of hidden marked files
168 void toggleShowHiddenFiles(bool);
171 * Updates the state of the 'Show hidden files' menu action.
173 void slotShowHiddenFilesChanged();
176 * Opens the view properties dialog, which allows to modify the properties
177 * of the currently active view.
179 void slotAdjustViewProperties();
182 * Opens the Find File dialog for the currently shown directory.
184 void slotFindFile();
187 * Connected to the "properties" action.
188 * Opens the properties dialog for the selected items of the
189 * active view. The properties dialog shows information
190 * like name, size and permissions.
192 void slotProperties();
194 private:
196 * Create all the actions.
197 * This is called only once (by the constructor)
199 void createActions();
201 * Creates an action group with all the "show additional information" actions in it.
202 * Helper method for createActions();
204 QActionGroup* createAdditionalInformationActionGroup();
207 * Creates an action group with all the "sort by" actions in it.
208 * Helper method for createActions();
210 QActionGroup* createSortByActionGroup();
213 * Returns the "switch to icons mode" action.
214 * Helper method for createActions();
216 KToggleAction* iconsModeAction();
219 * Returns the "switch to details mode" action.
220 * Helper method for createActions();
222 KToggleAction* detailsModeAction();
225 * Returns the "switch to columns mode" action.
226 * Helper method for createActions();
228 KToggleAction* columnsModeAction();
231 KActionCollection* m_actionCollection;
232 DolphinView* m_currentView;
235 #endif /* DOLPHINVIEWACTIONHANDLER_H */