]>
cloud.milkyroute.net Git - dolphin.git/blob - src/dolphinmainwindow.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
3 * Copyright (C) 2006 by Stefan Monov <logixoul@gmail.com> *
4 * Copyright (C) 2006 by Cvetoslav Ludmiloff <ludmiloff@gmail.com> *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the *
18 * Free Software Foundation, Inc., *
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20 ***************************************************************************/
22 #ifndef _DOLPHIN_MAINWINDOW_H_
23 #define _DOLPHIN_MAINWINDOW_H_
25 #include "dolphinview.h"
27 #include <kmainwindow.h>
28 #include <ksortablelist.h>
29 #include <konq_operations.h>
43 class DolphinApplication
;
46 * @short Main window for Dolphin.
48 * Handles the menus, toolbars and Dolphin views.
50 * @author Peter Penz <peter.penz@gmx.at>
52 class DolphinMainWindow
: public KMainWindow
55 friend class DolphinApplication
;
57 virtual ~DolphinMainWindow();
60 * Activates the given view, which means that
61 * all menu actions are applied to this view. When
62 * having a split view setup the nonactive view
63 * is usually shown in darker colors.
65 void setActiveView(DolphinView
* view
);
68 * Returns the currently active view. See
69 * DolphinMainWindow::setActiveView() for more details.
71 DolphinView
* activeView() const { return m_activeView
; }
74 * Handles the dropping of Urls to the given
75 * destination. A context menu with the options
76 * 'Move Here', 'Copy Here', 'Link Here' and
77 * 'Cancel' is offered to the user.
78 * @param urls List of Urls which have been
80 * @param destination Destination Url, where the
81 * list or Urls should be moved,
82 * copied or linked to.
84 void dropUrls(const KUrl::List
& urls
,
85 const KUrl
& destination
);
88 * Refreshs the views of the main window by recreating them dependent from
89 * the given Dolphin settings.
94 * Returns the 'Create New...' sub menu which also can be shared
95 * with other menus (e. g. a context menu).
97 KNewMenu
* newMenu() const { return m_newMenu
; }
101 * Is send if the active view has been changed in
102 * the split view mode.
104 void activeViewChanged();
107 * Is send if the selection of the currently active view has
110 void selectionChanged();
113 /** @see QMainWindow::closeEvent */
114 virtual void closeEvent(QCloseEvent
* event
);
117 * This method is called when it is time for the app to save its
118 * properties for session management purposes.
120 void saveProperties(KConfig
*);
123 * This method is called when this app is restored. The KConfig
124 * object points to the session management config file that was saved
125 * with @ref saveProperties
127 void readProperties(KConfig
*);
130 /** Updates the 'Create New...' sub menu. */
131 void updateNewMenu();
133 /** Renames the selected item of the active view. */
136 /** Moves the selected items of the active view to the trash. */
139 /** Deletes the selected items of the active view. */
143 * Opens the properties window for the selected items of the
144 * active view. The properties windows shows informations
145 * like name, size and permissions.
149 /** Stores all settings and quits Dolphin. */
153 * Shows the error information of the job \a job
156 void slotHandleJobError(KJob
* job
);
159 * Indicates in the status bar that the delete operation
160 * of the job \a job has been finished.
162 void slotDeleteFileFinished(KJob
* job
);
165 * Updates the state of the 'Undo' menu action dependent
166 * from the parameter \a available.
168 void slotUndoAvailable(bool available
);
170 /** Sets the text of the 'Undo' menu action to \a text. */
171 void slotUndoTextChanged(const QString
& text
);
174 * Copies all selected items to the clipboard and marks
175 * the items as cutted.
179 /** Copies all selected items to the clipboard. */
182 /** Pastes the clipboard data to the active view. */
186 * Updates the text of the paste action dependent from
187 * the number of items which are in the clipboard.
189 void updatePasteAction();
191 /** Selects all items from the active view. */
195 * Inverts the selection of all items of the active view:
196 * Selected items get nonselected and nonselected items get
199 void invertSelection();
201 /** The current active view is switched to the icons mode. */
204 /** The current active view is switched to the details mode. */
205 void setDetailsView();
207 /** The sorting of the current view should be done by the name. */
210 /** The sorting of the current view should be done by the size. */
213 /** The sorting of the current view should be done by the date. */
216 /** Switches between an ascending and descending sorting order. */
217 void toggleSortOrder();
220 * Switches between one and two views:
221 * If one view is visible, it will get split into two views.
222 * If already two views are visible, the nonactivated view gets closed.
224 void toggleSplitView();
226 /** Reloads the current active view. */
229 /** Stops the loading process for the current active view. */
232 /** Switches between showing a preview of the file content and showing the icon. */
233 void togglePreview();
236 * Switches between showing and hiding of hidden marked files dependent
237 * from the current state of the 'Show Hidden Files' menu toggle action.
239 void toggleShowHiddenFiles();
242 * Switches between showing and hiding of the filter bar dependent
243 * from the current state of the 'Show Filter Bar' menu toggle action.
245 void showFilterBar();
247 /** Increases the size of the current set view mode. */
250 /** Decreases the size of the current set view mode. */
254 * Toggles between edit and brose mode of the navigation bar.
256 void toggleEditLocation();
259 * Switches to the edit mode of the navigation bar. If the edit mode is
260 * already active, it is assured that the navigation bar get focused.
265 * Opens the view properties dialog, which allows to modify the properties
266 * of the currently active view.
268 void adjustViewProperties();
270 /** Goes back on step of the Url history. */
273 /** Goes forward one step of the Url history. */
276 /** Goes up one hierarchy of the current Url. */
279 /** Goes to the home Url. */
282 /** Opens a terminal for the current shown directory. */
285 /** Opens KFind for the current shown directory. */
288 /** Opens Kompare for 2 selected files. */
291 /** Opens the settings dialog for Dolphin. */
294 /** Updates the state of all 'View' menu actions. */
295 void slotViewModeChanged();
297 /** Updates the state of the 'Show hidden files' menu action. */
298 void slotShowHiddenFilesChanged();
300 /** Updates the state of the 'Sort by' actions. */
301 void slotSortingChanged(DolphinView::Sorting sorting
);
303 /** Updates the state of the 'Sort Ascending/Descending' action. */
304 void slotSortOrderChanged(Qt::SortOrder order
);
306 /** Updates the state of the 'Edit' menu actions. */
307 void slotSelectionChanged();
310 * Updates the state of the 'Back' and 'Forward' menu
311 * actions corresponding the the current history.
313 void slotHistoryChanged();
316 * Updates the caption of the main window and the state
317 * of all menu actions which depend from a changed Url.
319 void slotUrlChanged(const KUrl
& url
);
321 /** Updates the state of the 'Show filter bar' menu action. */
322 void updateFilterBarAction(bool show
);
324 /** Open a new main window. */
325 void openNewMainWindow();
334 void setupDockWidgets();
335 void updateHistory();
336 void updateEditActions();
337 void updateViewActions();
338 void updateGoActions();
339 void copyUrls(const KUrl::List
& source
, const KUrl
& dest
);
340 void moveUrls(const KUrl::List
& source
, const KUrl
& dest
);
341 void clearStatusBar();
344 * Connects the signals from the created DolphinView with
345 * the index \a viewIndex with the corresponding slots of
346 * the DolphinMainWindow. This method must be invoked each
347 * time a DolphinView has been created.
349 void connectViewSignals(int viewIndex
);
353 QSplitter
* m_splitter
;
354 DolphinView
* m_activeView
;
357 * DolphinMainWindowsupports only one or two views, which
358 * are handled internally as primary and secondary view.
365 DolphinView
* m_view
[SecondaryIdx
+ 1];
367 /// remember pending undo operations until they are finished
368 QList
<KonqOperations::Operation
> m_undoOperations
;
370 /** Contains meta information for creating files. */
371 struct CreateFileEntry
375 QString templatePath
;
381 #endif // _DOLPHIN_H_