diff --git a/doc/index.docbook b/doc/index.docbook
index 03c4c4848..170a092ff 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -1,2184 +1,2184 @@
]>
The &dolphin; HandbookPeterPenzpeter.penz@gmx.atOrvilleBennett
&Orville.Bennett.mail;
MichaelAustintuxedup@users.sourceforge.netDavidEdmundsonkde@davidedmundson.co.ukAlanBlanchflowerFrankReininghausfrank78ac@googlemail.com2006Peter Penz2006&Orville.Bennett;Michael Austin2009Frank Reininghaus&FDLNotice;2019-09-30Applications 19.12
&dolphin; is the default file manager by &kde;, designed with usability as a primary focus.
KDEDolphinFilemanagerfilemanagementIntroduction
&dolphin; is &plasma;'s default file manager. It aims to improve usability at the
user interface level. &dolphin; focuses only on being a file manager whereas
&konqueror;, which was &kde;'s default file manager in &kde; 3 and can still be
used for file management, is a universal viewer for many file types.
This design approach allows the developers to concentrate on optimizing the user
interface for the specific task of file management.
Please report any problems or feature requests to the &dolphin; author via the
bug report dialog. This is accessible either from the Control
button at the right of the toolbar in the default mode without
menubar; or from HelpReport Bug...
menu of the application, if the menubar is shown.
Using &dolphin;&dolphin; User Interface
The screenshot below shows &dolphin;'s default user interface:
Screenshot of &dolphin;'s default user interface&dolphin;'s default user interface.
&dolphin;'s default user interface.
The elements of the default user interface are:
The toolbar, which can be used for quick access to frequently used actions. The
toolbar can be customized by clicking it with the &RMB; and choosing
Configure Toolbars...
from the context menu, with Configure Toolbars...
from the Control button at the
right of the toolbar or via SettingsConfigure Toolbars...
from the main menu.
Screenshot of &dolphin;'s toolbarThe default toolbar.
Toolbar items where the icon is sufficient for knowing the command do not have text
alongside the icons. This can be changed by a &RMB; click and selecting the item text
below Show Text. The Control
button at the right side of the toolbar is only displayed if the menubar is hidden.
The location bar, which always displays the path to the current folder. It can
be switched between two different modes, see the
section on the location bar for details.
The view, which shows all files
and folders in the current folder.
The Places panel, which
provides quick access to bookmarked locations and disks or other media.
If desktop search and file indexing are enabled in the Desktop Search
module in the &systemsettings; the panel provides Recent
items and allows you to search for Documents, Images,
Audio Files and Video.
The status bar. It displays the name, size and type of the file which is
currently hovered over with the mouse, or the number and size of the files which are
selected. At the right, there is a zoom slider that allows you to adjust the size
of the icons in the view.
The menubar (hidden by default), which provides access to all commands and configuration options.
See the Command Reference for a list of
all menu commands. The menubar can be toggled with
Show Menubar (&Ctrl;M)
from the Settings menu or the Control button.
If the menubar is hidden, all its actions are available from the
Control button.
The additional Information, Folders
and Terminal panels are hidden
by default, for more information see Panels.
The &dolphin; ViewUsing the View
The view displays all files and folders in the current folder. These items
can be accessed or manipulated in different ways:
A file or folder can be opened by clicking it with the &LMB; (or
double-clicking, if Double-click to open files and folders
is enabled in the &systemsettings; in the Input DevicesMouse module.
Clicking any item or the white area around the items with the &RMB; opens a
context menu which provides access to many frequently used actions for the item
or the current folder, respectively.
If the &LMB; is pressed on an item, but not immediately released, the item can
be dragged and dropped in another folder in the current view or in another
&dolphin; view (in another &dolphin; window or in the same window if the
view is split, see below) to move or copy it or to create a symbolic link.
Items can even be dropped in another application to open them in that application.
&dolphin; remembers the history of visited folders. To navigate backward or
forward in the history, the corresponding buttons in the toolbar can be used:
Screenshot of &dolphin;'s toolbarThe Back and Forward buttons in the toolbar.
The Back and Forward buttons in
the toolbar can be used to navigate in the history.
If you click with the &MMB; the item in the history is opened in a new tab
thus keeping the current tab with its content.
&dolphin; View Appearance
The toolbar contains buttons to control the appearance of the view:
Screenshot of &dolphin;'s toolbarThe buttons in the toolbar which control the appearance of the view.
The buttons in the toolbar which control the appearance of the view.
All the settings discussed below and other options concerning, ⪚ the
sorting of the files in the current folder, can also be modified in the
View menu and in the
-View Properties dialog. By
+View Display Style dialog. By
default, these settings are remembered for each folder separately. This
behavior can be changed in the
General section of the settings.
View Modes
The first three buttons in the above screenshot switch between &dolphin;'s
view modes.
In the Icons view, which is the default, files will be
represented by an icon that visualizes the file type, and a folder icon will be
shown for subfolders. The names of folders and files, and the items enabled in
ViewAdditional Information,
are displayed below the icons.
The Compact view shows the folder contents as icons with
the name beside it and the items enabled in
ViewAdditional Information
below the name. The items are grouped in columns similar to the Short View
in the &kde; file dialog.
In the Details view, the folder contents are displayed
as a detailed list which contains the name, size and last modification time of
each item. Additional columns can be added by clicking a column header with the
&RMB;.
In the context menu of the header line you can choose between custom or automatic
column width. Automatic width adjusts the width of all columns once to display the longest
item in the column completely, except for the Name column where
the extension is replaced by ...The order of columns can be changed by drag and drop of column headers, except for
the Name header, which is always the first column in this view.
The details view allows you to view the current folder
in a tree-like fashion if
Expandable folders are enabled:
Each subfolder of the current folder can be
expanded or collapsed by clicking on the >
or v icon next to it.Grouped ViewGrouped View
All view modes support grouping by the sort type selected
in ViewSort by
Information in the View
In all view modes &dolphin; shows at least an icon and a name for each item.
Using Additional Information in the View
menu or the context menu of the header in Details mode, you can select
more information for each item to be shown:
Size, Date,
Type, Rating,
Tags or Comment.
Depending on the file type, additionally, sorting criteria can be selected:
Document: Number of words and linesImage: Size and orientationAudio: Artist, album, duration and trackThe Other submenu allows you to select
Path, Link Destination,
Copied From,
Permissions, Owner or
User Group.
Preview
If Preview is enabled, the icons are based on the actual
file or folder contents; ⪚ for images a scaled down preview of the image is
shown.
Split
If Split is clicked, two views are shown which can
display the contents of different folders. This can be convenient for moving or
copying files.
Selecting Items in the View
There are several ways to select items in the view. Once a group of items
is selected, all actions, such as
Cut,
Copy,
Move to Trash,
and drag and drop operations, affect all selected items.
Selecting Items Using the Mouse
You can press the &LMB; somewhere in the view and draw a rectangle around
a group of items before releasing the button. This will select all items in the
rectangle and clear the previous selection. If the &Shift; key is pressed during
the selection process, the previous selection is kept.
If the &Ctrl; key is pressed while an item is clicked with the &LMB;, the
selection state of this item is toggled. If the &Ctrl; key is pressed while a
rectangle is drawn around a group of items as described above, the selection
state of all items in the rectangle will be toggled.
If the &Shift; key is pressed while an item is clicked with the &LMB;, all items
between the previous current item and the clicked item will be selected.
If Show selection marker is enabled in the
Behavior
tab of the General section of the settings, a small
+ or - button appears in the top
left corner of the item which is currently hovered over with the mouse. Clicking
this sign selects or deselects the item, respectively.
Selecting Items Using the Keyboard
If an arrow key, Page Up, Page Down,
Home, or End is pressed, the new current item
is selected, and the previous selection is cleared.
If the &Ctrl; key is held while one of the above keys is pressed, the selection
remains unchanged.
If the &Shift; key is held while one of the above keys is pressed, all items
between the previous current item and the new current item will be selected.
If &Ctrl;Space is pressed,
the selection state of the current item is toggled.
&Ctrl;A selects all items
in the view.
&Ctrl;&Shift;A toggles the
selection state of all items in the view.
Select a file or folder by typing the first few letters of its name and the
first matching item is selected.
To clear the selection and cancel the keyboard search press &Esc; or wait longer than
the timeout of 1 second.
Location Bar
The location bar, which can be found above &dolphin;'s view, displays
the path to the current folder. The location bar has two modes.
Bread Crumb Mode
In the bread crumb mode, which is the default, each folder name in
the path to the current folder is a button which can be clicked to quickly open
that folder. Moreover, clicking the > sign to the right of a
folder opens a menu which allows you to quickly open a subfolder of that folder.
Screenshot of the location bar in bread crumb modeLocation bar in bread crumb mode.
Location bar in bread crumb mode.
Editable Mode
When in bread crumb mode, clicking in the gray area to the right of the path
with the &LMB; switches the location bar to editable mode,
in which the path can be edited using the keyboard. To switch back to bread
crumb mode, click the check mark at the right of the location bar with the &LMB;.
Screenshot of the location bar in editable modeLocation bar in editable mode.
Location bar in editable mode.
Using KioslavesIf the location bar is empty in editable mode, a drop down box appears in
front of the bar listing all available kioslaves on your system. Kioslaves are
programs built into &kde; which add support for many different protocols to
&dolphin; and other &kde; applications.For example with the fish kioslave &dolphin; can be
used to manage files and folders on a remote host that is accessible
via SSH. To do this you would type fish://username@remotehost
into the location bar. Similar remote file management can be done on
remote hosts accessible via the &FTP;, NFS, SFTP, SMB (CIFS) or webdav protocols.It is also possible to use the kioslaves drop down list to access
&systemsettings;, fonts, trash, other programs and devices attached to your computer.
See the drop down list for the full list of capabilities available from kioslaves on your system.
Screenshot of the list of kioslavesLocation bar showing list of available kioslaves.
List of available kioslaves.
Places and Context
If the Places panel is hidden; in both modes an additional icon
in front of the path is displayed. This icon can be clicked with the &LMB; to open a
menu which offers quick access to places and storage media. See the
section about the Places Panel for details.
Location bar with Places iconLocation bar with Places iconThe context menu of the location bar offers actions to switch between the modes and
to copy and paste the path using the clipboard. Check the last option in this context menu to
display either the full path starting with the root folder of the file system or to display
the path starting with the current places entry.
Location bar context menuLocation bar context menuPanels
&dolphin; allows a number of panels to be placed next to the view. These can
be enabled in ViewShow Panels.
By unlocking the panels and clicking and dragging a panel title, the panel can be moved
to a different position, even outside the window.
Places
The Places panel is located at the left of the window by
default. The Places panel shows any locations you have
bookmarked. It also shows any disk or media attached to the computer, recently accessed items
and allows you to search for certain type of files. The order of these entries can be changed by drag and drop.
The easiest way to add a folder to the Places panel is to
drag it and drop it in the panel. Moreover, you can click inside the panel with
the &RMB; and choose Add Entry...
from the context menu. The first procedure creates a system wide bookmark, the second
procedure can be used to add the current path of the location bar or any desired folder or device.
A dialog opens where label, location and icon can be edited and the usage of this entry
can be restricted to &dolphin;.
A &RMB; click opens the context menu to edit, add, hide or remove entries
and change the icon size to one of the predefined values or lock/unlock the panels.
The context menu has an action to open the entry in a new tab.
Devices can be unmounted using the context menu.
Information
The Information panel shows extended information about the
selected items(s) or about the current folder or the file which is currently hovered
over with the mouse, including size, type, and date of last modification. It also
features a large preview of the selected item and allows you to assign a rating,
tags, and comments to it.
Folders
The Folders panel shows a tree view structure of the file
system. It only shows folders. Clicking a folder with the &LMB; opens this folder
in the &dolphin; view.
Use Limit to Home Directory to hide all folders from
the tree view except your Home.
Terminal
This panel contains a terminal. The terminal will open at the folder currently
shown in the &dolphin; view. Changing the folder in the active &dolphin;
view will update the working folder of the terminal. Changing the directory in
the terminal will update the working folder in the &dolphin; view. The
terminal only works with local media.
Quick Tips
The following are a number of tips to save time when using &dolphin;.
Quick Bookmarking
To quickly create a bookmark in the Places panel for the
current folder, &RMB; click in the work space and click
Add to Places in the context menu.
Finding Files and Searching in Files
&dolphin; is capable of searching for files and for content in files. If
&Ctrl;F is pressed or EditSearch... is used, the Search
bar will open already set up to search for files within the current folder and any sub-folders.
Start to type into the find input box and the search starts immediately.
Search files and for content in filesSearch files and for content in files
&dolphin; searching files and for content in files.
The search is case insensitive, and does not require surrounding wildcards
(*foo* and foo are equivalent),
but you can use wildcards inside the search term. * will match
zero or more characters, ? only one single character.This feature can be used with running Baloo services; without these services
a KIOSlave is launched to provide the search results.The option from Everywhere with activated Baloo
services searches in all indexed folders, without Baloo this option
starts the search from the user's Home folder.Search with More OptionsSearch with More Options
&dolphin; searching with More Options.
Use the More Options button to extend the Search
bar. This provides a very comfortable way for
the user to shrink the number of search results.To start a search select one or more file types (Documents,
Audio, Video, Images),
a time period and ratingAlternatively you can use these options in the Places panel
together with the Filter bar to find files using Baloo or limit
the search to files matching the filter expression.Use the Save icon to save a search to the Search For
section in the Places panel to quickly access it again in the future.
Mounting Storage Media
A quick way to mount Storage Media is to click on the device in the
Places panel. This will mount and open the device in &dolphin;.
Undo Actions
&dolphin; is capable of undoing changes you have made to files. For example if
you moved a file to the Trash, &dolphin; can undo this and move it back to its
original location. To undo an action, press &Ctrl;Z
or select EditUndo: (action name)
in the menu, ⪚ Undo: Rename.
Renaming A Batch Of Files
&dolphin; is capable of renaming a number of files at the same time. Each file
will have the file name specified, including a number, ⪚, Image1.jpg,
Image2.jpg, Image3.jpg. This can be useful, ⪚, for pictures taken with a digital camera.
If you wish to rename a batch of files, first select the files to be renamed.
This can be done by pressing the &LMB; and drawing a rectangle around the files
to be renamed before releasing it, or by holding &Ctrl; and clicking each file
to be renamed (see Selecting Items in the View
for more details on item selection). Then open the batch-rename dialog by pressing
F2 or via the File menu:
FileRename...
Then enter the name you wish to give the files. The # character must be present
within the name. The files will then be renamed, where the #
character is replaced by a different consecutive number for each file.
If all file extensions in your selection are different, the name of all files
can be changed without using a # placeholder while preserving
the file extensions. This is ⪚ useful to rename a video file and all associated
subtitle files, which have the same filename, but different extensions.
Comparing A Selection Of Files or Folders
If the &kompare; application is installed, you can use it to see the differences
between two files or folders.
First select the two files or folders to be compared. Then launch the &kompare; application
via the Tools menu: ToolsCompare Files.
&kompare; will then open showing the differences between the files or folders.
Filtering Files
&dolphin; is capable of filtering files, &ie; showing only those items in the
view whose name contains a given text. For example, if you wish to show
only the MP3 files within a folder, you could filter for .mp3.
This would then filter out all files whose name does not contain .mp3.
To filter files, first enable the filter bar, either by pressing &Ctrl;I
or via the menu: ToolsShow Filter Bar.
You can then enter the text to be filtered for in the filter bar. The filter bar can
be disabled either by pressing &Esc;, or with a &LMB; click on the
Hide Filter Bar icon.
Configuring &dolphin;
&dolphin; distinguishes two different kinds of settings:
Settings which affect the general behavior of &dolphin;. These can be configured
using the Preferences Dialog.
Settings which determine how the contents of a folder are displayed in &dolphin;.
-These settings are called View Properties
+These settings are called View Display Styles
and can be controlled with toolbar buttons, via the View menu,
-and with the View Properties Dialog.
-In the default configuration, the view properties are remembered for each folder,
-but &dolphin; can also be configured to use common view properties for all folders
+and with the View Display Style dialog.
+In the default configuration, all folders use the same display style,
+but &dolphin; can also be configured to remember each folder's display style separately
in the General
section of the settings.
The &dolphin; Preferences Dialog
The Preferences Dialog is opened via SettingsConfigure &dolphin;... in the menu in
&dolphin;'s main window. The settings are divided into several groups which can
be accessed by clicking the corresponding icon on the left of the dialog.
All settings except for the Startup page and the Status Bar
tab on the General page are shared with &konqueror; in filemanager mode.
General
This group contains settings which control the general behavior of &dolphin;.
The group is divided further into four subgroups which can be accessed using the
tab bar at the top.
Screenshot of the General settings in &dolphin;'s preferences dialogGeneral Settings.
General Settings in &dolphin;'s Preferences Dialog.
Behavior Tab
-In the View section, you can configure whether the
- view properties are stored for each
-folder or if common view properties are to be used for all folders.
+In the View section, you can configure whether the same
+ view display styleis shared among all folders
+or folders remember their own individual view display styles.
Sorting Mode controls how items are sorted in
the view. If Natural sorting is enabled, the sort order of three example files
will be
File1,File2,File10.
If this option is disabled, the normal alphabetical sorting case sensitive or case insensitive
will be used, which leads to the sort order
File1,File10,File2.
When hovering over a file or folder with the mouse, a small window with relevant
information is shown if Show tooltips is enabled.
Show selection marker shows a small +
or - button above an item's icon if the item is hovered over
with the mouse. These can be used to select or deselect the item.
Enable Rename inline to use this mode if only one item is currently selected.
If this option is disabled or several items are selected, a dialog will be displayed for renaming.
Enabling Switch between split panes with tab key
allows to switch split views with the 	 key.
Disable Turning off split view closes active pane
to close the inactive pane when you are turning off the split view mode, ⪚ pressing F3.
Previews Tab
In this tab, you can configure for which file types previews are shown.
Moreover, the maximum size of remote files for which previews are generated can be chosen.
If previews are enabled for folders, previews of some files in the folder will
be shown inside a folder's icon.
Confirmations Tab
In the ask for confirmation section, you can enable warning dialogs that
are shown before potentially harmful actions.
It is also possible to choose the default action When opening an executable file. There are three options, namely Always ask, Open in application, and Run script.
The confirmation settings for Moving files or folders to trash and
Deleting files or folders affect file operations in &dolphin;, &konqueror;,
Gwenview and all &kde; applications using the default &kde; file dialog,
whereas Closing Dolphin windows
with multiple tabs is a &dolphin; specific setting.Status Bar Tab
In this tab, some additional items can be enabled for the status bar, provided
the status bar is wide enough:
A zoom slider which can be used to change the icon size quickly.
A bar that shows how much space is free on the current drive.
Startup
This group contains settings which control the appearance of &dolphin; on startup.
Screenshot of the Startup settings in &dolphin;'s preferences dialogStartup Settings.
Startup Settings in &dolphin;'s Preferences Dialog.
The Start in folder is the folder which is opened on startup. The
location of the folder can be entered directly or chosen in a dialog which can
be opened by clicking the button showing a folder icon. Moreover,
the current location or the default location (which is the user's home folder)
can be used as the startup folder by clicking the corresponding button.
Split view mode controls if the
&dolphin; view is split on startup
or not.
Editable location bar controls if the location bar is in
editable mode on startup. The bread crumb mode of the location bar is used
otherwise. See the section about the location bar
for details about the two modes.
If Show full path inside location bar is enabled, the full
path of the current location is shown in the bread crumb mode of the location bar.
Otherwise, a shortened version of the path is shown if it begins with the path of
one of the places in the Places panel.
Show filter bar controls if the filter bar is shown on
startup or not. See the section on the filter bar
for details.
Show full path in title bar makes it easy to distinguish
between files or folders with the same name in different folders.
Open new folders in tabs controls whether &dolphin; should open a new folder in a new tab of the current instance when called externally. If not enabled, the new folders will be opened in new instances of &dolphin;. By default this option is enabled.
View Modes
This group contains settings which control the behavior of &dolphin;'s view
modes. The three view modes (Icons, Compact, and Details) are accessible via the
tab bar at the top.
Screenshot of the Icons View settings in &dolphin;'s preferences dialogView Modes Settings.
View Modes Settings in &dolphin;'s Preferences Dialog.
Common settings for all view modes
All three view modes have some common settings:
Sliders which control the size of the icons. The Default or
Preview sizes are used if previews are disabled or enabled,
respectively. Note that the icon size can be changed easily with the zoom slider
in the status bar if the corresponding option is enabled in the
General
section of the settings.
A setting for the font used in the view mode: either the system font or a
custom font can be chosen.
The other settings in the Text section which apply to only
one of the view modes are discussed below.
IconsWidth controls the minimum width that is reserved for
the text of a file item.
Maximum lines means maximum number of text lines below the icon.
CompactMaximum width controls the maximum width that is reserved for
the text of a file item.
DetailsExpandable folders determines whether any folders that have subfolders
are displayed in a tree view, where the sub items can be expanded by &LMB; clicking the
> icon and collapsed by clicking the v icon.
Navigation
This group contains settings which control how navigation in the folder
structure and in archives works.
Screenshot of the Navigation settings in &dolphin;'s preferences dialogNavigation Settings.
Navigation Settings in &dolphin;'s Preferences Dialog.
The option to open items with a single or double mouse click is a system wide setting and can be
changed in the &systemsettings; in the Input DevicesMouse module.
Archives will be opened inside &dolphin;, and not in an external application, if
Open Archives as folder is enabled.
If Open folders during drag operations is enabled, dragging
an item with the mouse and hovering over a folder with it for a short time will open
that folder. This allows you to move or copy items quickly to folders which are
several levels deeper in the folder hierarchy.
Services
This group offers a selection of services that can be shown in the
Actions submenu of &dolphin;'s context menu which
appears when clicking a file or folder with the &RMB;.
Screenshot of the Services settings in &dolphin;'s preferences dialogServices Settings.
Services Settings in &dolphin;'s Preferences Dialog.
Using the Download New Services you can fetch additional
services for the context menu.
If you have installed &dolphin;'s plugins for Bazaar,
Mercurial, Git or
Subversion from the kdesdk module these services are shown in the list.
If these plugins are enabled and you enter a folder which is under version control,
the version state (locally changed, up to date &etc;) is indicated by icons
and you have additional entries in the
context menu like commit, update, add, remove &etc;
In the service list you can also choose if the Delete,
Copy To, and Move To
commands are shown in the context menu.
&dolphin; has to be restarted to activate the changes for some of these settings.
Trash
This group contains settings which control the behavior of the trash.
Screenshot of the Trash settings in &dolphin;'s preferences dialogTrash Settings.
Trash Settings in &dolphin;'s Preferences Dialog.
Files which are older than a configurable number of days can be deleted automatically.
The size of the trash can be limited to a configurable percentage of the disk
size. If this limit is reached, a warning can be issued, or the oldest or
largest files can be deleted automatically.
-Folder View Properties
+Folder View Display Style
The following settings control how the contents of a folder are displayed in the
&dolphin; view, and are stored on a per-folder basis by default:
The view mode (Icons, Compact, Details)
The sorting of items, which is determined by the sort order (ascending,
descending) and the attribute (such as name, size,...) that the items are
sorted by
Sorting of folders and files – are folders shown first or not?
Previews – are they shown instead of icons (based on the settings made in
Previews
tab of &dolphin;'s General settings) or not?
Are items shown in groups in the views?
Are hidden files shown?
What additional information (besides the name) is shown in the Icons or Details view?
-The view properties can be configured in the
+The view display style can be configured in the
View menu, some (such as the view
mode) can also be changed using toolbar buttons.
-The View Properties Dialog
+The View Display Style dialog
-Screenshot of the View Properties dialog
+Screenshot of the View Display Style dialog
-The View Properties dialog.
+The View Display Style dialog.
-
The View Properties Dialog.
+
The View Display Style Dialog.
-The View Properties dialog can be used to quickly modify
-several view properties at once. This is done for the current folder, for the
+The View Display Style dialog can be used to quickly modify
+the view display styles for many folders at once. This is done for the current folder, for the
current folder including all subfolders, or even for all folders, depending on
the choice made in the Apply to section.
If Use as default view settings is enabled, the chosen view
properties will also be used for all folders which do not have customized view
properties yet.
Command ReferenceBy default the menubar is not shown. All actions described here either can
be accessed with toolbar buttons or with items in the menu of the
Control toolbar button.The Menubar in &dolphin;'s Main WindowThe File MenuFileCreate NewCreates a new object (such as a folder or a text file) in the current
folder.You will find an explanation of all available objects in &konqueror;'s handbook in the chapter
Create New.&Ctrl;NFileNew WindowOpens a new &dolphin; window.&Ctrl;TFileNew TabOpens a new tab.&Ctrl;WFileClose TabCloses the current tab.&Ctrl;&Shift;TFileUndo close tabReopens the last closed tab.F2FileRenameRenames one currently selected item inline.
Opens the batch rename dialog if several
items are selected.DelFileMove to TrashMoves the currently selected item(s) to the
trash.&Shift;DelFileDeletePermanently deletes the currently selected item(s). The items are not moved
to the trash and cannot be restored.FileShow TargetThis action highlights a link target in a new &dolphin; window.
&Alt;ReturnFilePropertiesShows the properties dialog for the currently selected
item(s).&Ctrl;QFileQuitExits &dolphin;.The Edit Menu&Ctrl;ZEditUndoUndoes the last action performed by &dolphin;.&Ctrl;XEditCutCuts the currently selected item(s).&Ctrl;CEditCopyCopies the currently selected item(s).&Ctrl;VEditPaste Clipboard Contents... or
EditPaste one File or
EditPaste one Folder or
EditPaste x ItemsPastes the currently copied/cut items to the current
folder. If the clipboard does not contain files or folders, the clipboard
contents (such as text or image data) will be pasted into a new file.
The name of this file has to be entered in a dialog.
&Ctrl;FEditSearch...Opens the find bar. Enter a search term into the edit box and select to search for filename
or in contents of files starting from the current folder or everywhere.&Ctrl;AEditSelect AllSelects all files and folders in the current
folder.&Ctrl;&Shift;AEditInvert Selection
Selects all unselected items and deselects all selected items in the current folder.
The View Menu&Ctrl;+ViewZoom InIncreases the size of icons in the view.&Ctrl;-ViewZoom OutDecreases the size of icons in the view.&Ctrl;0ViewZoom ResetResets the size of icons in the view to default.ViewView ModeChanges the view mode to Icons
(&Ctrl;1), Compact
(&Ctrl;2) or Details
(&Ctrl;3).ViewSort ByChanges whether items are sorted by Name
or other criteria described in Information in the View.Descending reverses the sort order.
Folders First sorts folders before files.
ViewShow Additional InformationDisplays additional information
described in Information in the View.
ViewShow PreviewsDisplays a symbolic preview of the file contents in the different
view modes.ViewShow in GroupsDisplays the content of the
current folder grouped by the option selected in Sort By.
&Alt;.ViewShow Hidden FilesShows all the hidden files and sub-folders within the current
folder.There is an alternate shortcut &Ctrl;H
for this action.F3ViewSplitEnables and disables the split view mode.F5ViewReloadReloads the current folder.ViewStopStops loading/reading the contents of the current
folder.ViewShow PanelsEnables and disables the different panels:
Places (F9), Information
(F11), Folders (F7),
Terminal (F4).
With Lock Panels the panel header with caption and two buttons is
hidden to save space and the panels are immutable, with Unlock Panels
the header is visible and the panel can be moved to the right or left or even
outside the main window.
F6ViewLocation BarEditable LocationChanges the location bar between the two modes; the
bread crumb mode and the
editable mode.
&Ctrl;LViewLocation BarReplace LocationSwitches the location bar to editable mode,
if necessary, and selects the location such that it can be replaced quickly.
View
-Adjust View Properties...
+Adjust View Display Style...
-Opens the View Properties
+Opens the View Display Style
Dialog.The Go Menu&Alt;UpGoUpChanges to the folder above the current folder.&Alt;LeftGoBackChanges to the previously viewed folder.&Alt;RightGoForwardUndoes a Go Back action.&Alt;HomeGoHomeChanges to the users home folder, ⪚
/home/Peter/.GoRecently Closed TabsShows a list of recently closed tabs which can
be reopened.The Tools Menu&Ctrl;IToolsShow Filter BarEnables and disables the filter bar.
You can also use the alternate shortcut &Shift;/
for this action.&Shift;F4ToolsOpen TerminalOpens &konsole; within the current folder.&Ctrl;&Shift;FToolsOpen Preferred Search ToolOpens preferred search tool in the current folder.ToolsCompare FilesCompare the currently selected files or folders with
&kompare;. This action is only enabled if two files or folders are selected.ToolsSelect Remote CharsetAllows you to choose the charset used by a remote
connection manually.The Settings and Help Menu
&dolphin; has the common &kde; Settings and Help
menu items, for more information read the sections about the Settings Menu and Help Menu
of the &kde; Fundamentals.
Miscellaneous QuestionsHas &dolphin; replaced &konqueror;?
&dolphin; is not intended to be a competitor to &konqueror;: &konqueror; acts as
a universal viewer being able to show &HTML; pages, text documents, folders and a
lot more, whereas &dolphin; focuses on being only a file manager. This approach
allows the optimization of the user interface for the task of file management.
How can I get involved with the development of &dolphin;?
The easiest way to get involved with &dolphin; is to subscribe to the developer
mailing list kfm-devel
and drop an email to the developer mailing list. Email what you can do, how much time
you can devote &etc;, the developers will let you know what you can do in the
project. If you wish to contribute to the documentation please email the
&kde; Documentation Team list.
How can I submit bug reports?
The official channel for submitting bug reports is via the &kde; bug tracking
system. The &kde; bug tracker can be found at
http://bugs.kde.org.
How can I submit feature requests?
The official channel for submitting feature requests is via the &kde; bug
tracking system. The &kde; bug tracker can be found at
http://bugs.kde.org.
Credits and License
&dolphin;
Program copyright 2006–2014 Peter Penz peter.penz@gmx.at,
Frank Reininghaus frank78ac@googlemail.com and Emmanuel Pescosta
emmanuelpescosta099@gmail.com
Contributors:
Cvetoslav Ludmiloff ludmiloff@gmail.comStefan Monov logixoul@gmail.comMichael Austin tuxedup@users.sourceforge.net&Orville.Bennett; &Orville.Bennett.mail;
Documentation copyright 2005 Peter Penz peter.penz@gmx.at
Documentation copyright 2006 &Orville.Bennett; &Orville.Bennett.mail;
Documentation copyright 2006 Michael Austin tuxedup@users.sourceforge.net
Documentation copyright 2009 Frank Reininghaus frank78ac@googlemail.com
&underFDL;
&underGPL;
&documentation.index;
diff --git a/src/settings/general/behaviorsettingspage.cpp b/src/settings/general/behaviorsettingspage.cpp
index df7ea2113..30883c5da 100644
--- a/src/settings/general/behaviorsettingspage.cpp
+++ b/src/settings/general/behaviorsettingspage.cpp
@@ -1,209 +1,209 @@
/***************************************************************************
* Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) and *
* and Patrice Tremblay *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "behaviorsettingspage.h"
#include "global.h"
#include "views/viewproperties.h"
#include
#include
#include
#include
#include
#include
BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
SettingsPageBase(parent),
m_url(url),
m_localViewProps(nullptr),
m_globalViewProps(nullptr),
m_showToolTips(nullptr),
m_showSelectionToggle(nullptr),
m_naturalSorting(nullptr),
m_caseSensitiveSorting(nullptr),
m_caseInsensitiveSorting(nullptr),
m_renameInline(nullptr),
m_useTabForSplitViewSwitch(nullptr)
{
QFormLayout* topLayout = new QFormLayout(this);
// View properties
- m_globalViewProps = new QRadioButton(i18nc("@option:radio", "Use common properties for all folders"));
- m_localViewProps = new QRadioButton(i18nc("@option:radio", "Remember properties for each folder"));
+ m_globalViewProps = new QRadioButton(i18nc("@option:radio", "Use common display style for all folders"));
+ m_localViewProps = new QRadioButton(i18nc("@option:radio", "Remember display style for each folder"));
m_localViewProps->setToolTip(i18nc("@info", "Dolphin will create a hidden .directory file in each folder you change view properties for."));
QButtonGroup* viewGroup = new QButtonGroup(this);
viewGroup->addButton(m_globalViewProps);
viewGroup->addButton(m_localViewProps);
topLayout->addRow(i18nc("@title:group", "View: "), m_globalViewProps);
topLayout->addRow(QString(), m_localViewProps);
topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
// Sorting properties
m_naturalSorting = new QRadioButton(i18nc("option:radio", "Natural"));
m_caseInsensitiveSorting = new QRadioButton(i18nc("option:radio", "Alphabetical, case insensitive"));
m_caseSensitiveSorting = new QRadioButton(i18nc("option:radio", "Alphabetical, case sensitive"));
QButtonGroup* sortingModeGroup = new QButtonGroup(this);
sortingModeGroup->addButton(m_naturalSorting);
sortingModeGroup->addButton(m_caseInsensitiveSorting);
sortingModeGroup->addButton(m_caseSensitiveSorting);
topLayout->addRow(i18nc("@title:group", "Sorting mode: "), m_naturalSorting);
topLayout->addRow(QString(), m_caseInsensitiveSorting);
topLayout->addRow(QString(), m_caseSensitiveSorting);
topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
#ifdef HAVE_BALOO
// 'Show tooltips'
m_showToolTips = new QCheckBox(i18nc("@option:check", "Show tooltips"));
topLayout->addRow(i18nc("@title:group", "Miscellaneous: "), m_showToolTips);
#endif
// 'Show selection marker'
m_showSelectionToggle = new QCheckBox(i18nc("@option:check", "Show selection marker"));
#ifdef HAVE_BALOO
topLayout->addRow(QString(), m_showSelectionToggle);
#else
topLayout->addRow(i18nc("@title:group", "Miscellaneous: "), m_showSelectionToggle);
#endif
// 'Inline renaming of items'
m_renameInline = new QCheckBox(i18nc("option:check", "Rename inline"));
topLayout->addRow(QString(), m_renameInline);
// 'Switch between panes of split views with tab key'
m_useTabForSplitViewSwitch = new QCheckBox(i18nc("option:check", "Switch between split views panes with tab key"));
topLayout->addRow(QString(), m_useTabForSplitViewSwitch);
// 'Close active pane when turning off split view'
m_closeActiveSplitView = new QCheckBox(i18nc("option:check", "Turning off split view closes active pane"));
topLayout->addRow(QString(), m_closeActiveSplitView);
m_closeActiveSplitView->setToolTip(i18n("When deactivated, turning off split view will close the inactive pane"));
loadSettings();
connect(m_localViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
connect(m_globalViewProps, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
#ifdef HAVE_BALOO
connect(m_showToolTips, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
#endif
connect(m_showSelectionToggle, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
connect(m_naturalSorting, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
connect(m_caseInsensitiveSorting, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
connect(m_caseSensitiveSorting, &QRadioButton::toggled, this, &BehaviorSettingsPage::changed);
connect(m_renameInline, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
connect(m_useTabForSplitViewSwitch, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
connect(m_closeActiveSplitView, &QCheckBox::toggled, this, &BehaviorSettingsPage::changed);
}
BehaviorSettingsPage::~BehaviorSettingsPage()
{
}
void BehaviorSettingsPage::applySettings()
{
GeneralSettings* settings = GeneralSettings::self();
ViewProperties props(m_url); // read current view properties
const bool useGlobalViewProps = m_globalViewProps->isChecked();
settings->setGlobalViewProps(useGlobalViewProps);
#ifdef HAVE_BALOO
settings->setShowToolTips(m_showToolTips->isChecked());
#endif
settings->setShowSelectionToggle(m_showSelectionToggle->isChecked());
setSortingChoiceValue(settings);
settings->setRenameInline(m_renameInline->isChecked());
settings->setUseTabForSwitchingSplitView(m_useTabForSplitViewSwitch->isChecked());
settings->setCloseActiveSplitView(m_closeActiveSplitView->isChecked());
settings->save();
if (useGlobalViewProps) {
// Remember the global view properties by applying the current view properties.
// It is important that GeneralSettings::globalViewProps() is set before
// the class ViewProperties is used, as ViewProperties uses this setting
// to find the destination folder for storing the view properties.
ViewProperties globalProps(m_url);
globalProps.setDirProperties(props);
}
}
void BehaviorSettingsPage::restoreDefaults()
{
GeneralSettings* settings = GeneralSettings::self();
settings->useDefaults(true);
loadSettings();
settings->useDefaults(false);
}
void BehaviorSettingsPage::loadSettings()
{
const bool useGlobalViewProps = GeneralSettings::globalViewProps();
m_localViewProps->setChecked(!useGlobalViewProps);
m_globalViewProps->setChecked(useGlobalViewProps);
#ifdef HAVE_BALOO
m_showToolTips->setChecked(GeneralSettings::showToolTips());
#endif
m_showSelectionToggle->setChecked(GeneralSettings::showSelectionToggle());
m_renameInline->setChecked(GeneralSettings::renameInline());
m_useTabForSplitViewSwitch->setChecked(GeneralSettings::useTabForSwitchingSplitView());
m_closeActiveSplitView->setChecked(GeneralSettings::closeActiveSplitView());
loadSortingChoiceSettings();
}
void BehaviorSettingsPage::setSortingChoiceValue(GeneralSettings *settings)
{
using Choice = GeneralSettings::EnumSortingChoice;
if (m_naturalSorting->isChecked()) {
settings->setSortingChoice(Choice::NaturalSorting);
} else if (m_caseInsensitiveSorting->isChecked()) {
settings->setSortingChoice(Choice::CaseInsensitiveSorting);
} else if (m_caseSensitiveSorting->isChecked()) {
settings->setSortingChoice(Choice::CaseSensitiveSorting);
}
}
void BehaviorSettingsPage::loadSortingChoiceSettings()
{
using Choice = GeneralSettings::EnumSortingChoice;
switch (GeneralSettings::sortingChoice()) {
case Choice::NaturalSorting:
m_naturalSorting->setChecked(true);
break;
case Choice::CaseInsensitiveSorting:
m_caseInsensitiveSorting->setChecked(true);
break;
case Choice::CaseSensitiveSorting:
m_caseSensitiveSorting->setChecked(true);
break;
default:
Q_UNREACHABLE();
}
}
diff --git a/src/settings/viewpropertiesdialog.cpp b/src/settings/viewpropertiesdialog.cpp
index a1f9718fe..c3078d5df 100644
--- a/src/settings/viewpropertiesdialog.cpp
+++ b/src/settings/viewpropertiesdialog.cpp
@@ -1,444 +1,444 @@
/***************************************************************************
* Copyright (C) 2006 by Peter Penz *
* Copyright (C) 2018 by Elvis Angelaccio *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "viewpropertiesdialog.h"
#include "dolphin_generalsettings.h"
#include "dolphin_iconsmodesettings.h"
#include "global.h"
#include "kitemviews/kfileitemmodel.h"
#include "viewpropsprogressinfo.h"
#include "views/dolphinview.h"
#include
#include
#include
#include
#ifdef HAVE_BALOO
#include
#endif
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
QDialog(dolphinView),
m_isDirty(false),
m_dolphinView(dolphinView),
m_viewProps(nullptr),
m_viewMode(nullptr),
m_sortOrder(nullptr),
m_sorting(nullptr),
m_sortFoldersFirst(nullptr),
m_previewsShown(nullptr),
m_showInGroups(nullptr),
m_showHiddenFiles(nullptr),
m_applyToCurrentFolder(nullptr),
m_applyToSubFolders(nullptr),
m_applyToAllFolders(nullptr),
m_useAsDefault(nullptr)
{
Q_ASSERT(dolphinView);
const bool useGlobalViewProps = GeneralSettings::globalViewProps();
- setWindowTitle(i18nc("@title:window", "View Properties"));
+ setWindowTitle(i18nc("@title:window", "View Display Style"));
const QUrl& url = dolphinView->url();
m_viewProps = new ViewProperties(url);
m_viewProps->setAutoSaveEnabled(false);
auto layout = new QFormLayout(this);
// Otherwise the dialog won't resize when we collapse the KCollapsibleGroupBox.
layout->setSizeConstraint(QLayout::SetFixedSize);
setLayout(layout);
// create 'Properties' group containing view mode, sorting, sort order and show hidden files
m_viewMode = new QComboBox();
m_viewMode->addItem(QIcon::fromTheme(QStringLiteral("view-list-icons")), i18nc("@item:inlistbox", "Icons"), DolphinView::IconsView);
m_viewMode->addItem(QIcon::fromTheme(QStringLiteral("view-list-details")), i18nc("@item:inlistbox", "Compact"), DolphinView::CompactView);
m_viewMode->addItem(QIcon::fromTheme(QStringLiteral("view-list-tree")), i18nc("@item:inlistbox", "Details"), DolphinView::DetailsView);
m_sortOrder = new QComboBox();
m_sortOrder->addItem(i18nc("@item:inlistbox Sort", "Ascending"));
m_sortOrder->addItem(i18nc("@item:inlistbox Sort", "Descending"));
m_sorting = new QComboBox();
const QList rolesInfo = KFileItemModel::rolesInformation();
foreach (const KFileItemModel::RoleInfo& info, rolesInfo) {
m_sorting->addItem(info.translation, info.role);
}
m_sortFoldersFirst = new QCheckBox(i18nc("@option:check", "Show folders first"));
m_previewsShown = new QCheckBox(i18nc("@option:check", "Show preview"));
m_showInGroups = new QCheckBox(i18nc("@option:check", "Show in groups"));
m_showHiddenFiles = new QCheckBox(i18nc("@option:check", "Show hidden files"));
auto additionalInfoBox = new KCollapsibleGroupBox();
additionalInfoBox->setTitle(i18nc("@title:group", "Additional Information"));
auto innerLayout = new QVBoxLayout();
{
QList visibleRoles = m_viewProps->visibleRoles();
const bool useDefaultRoles = (m_viewProps->viewMode() == DolphinView::DetailsView) && visibleRoles.isEmpty();
if (useDefaultRoles) {
// Using the details view without any additional information (-> additional column)
// makes no sense and leads to a usability problem as no viewport area is available
// anymore. Hence as fallback provide at least a size and date column.
visibleRoles.clear();
visibleRoles.append("text");
visibleRoles.append("size");
visibleRoles.append("modificationtime");
m_viewProps->setVisibleRoles(visibleRoles);
}
// Add checkboxes
bool indexingEnabled = false;
#ifdef HAVE_BALOO
Baloo::IndexerConfig config;
indexingEnabled = config.fileIndexingEnabled();
#endif
m_listWidget = new QListWidget();
connect(m_listWidget, &QListWidget::itemChanged, this, &ViewPropertiesDialog::slotItemChanged);
m_listWidget->setSelectionMode(QAbstractItemView::NoSelection);
const QList rolesInfo = KFileItemModel::rolesInformation();
foreach (const KFileItemModel::RoleInfo& info, rolesInfo) {
QListWidgetItem* item = new QListWidgetItem(info.translation, m_listWidget);
item->setCheckState(visibleRoles.contains(info.role) ? Qt::Checked : Qt::Unchecked);
const bool enable = ((!info.requiresBaloo && !info.requiresIndexer) ||
(info.requiresBaloo) ||
(info.requiresIndexer && indexingEnabled)) && info.role != "text";
if (!enable) {
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
}
}
QLabel* additionalViewOptionsLabel = new QLabel(i18n("Choose what to see on each file or folder:"));
innerLayout->addWidget(additionalViewOptionsLabel);
innerLayout->addWidget(m_listWidget);
}
additionalInfoBox->setLayout(innerLayout);
QHBoxLayout* sortingLayout = new QHBoxLayout();
sortingLayout->setContentsMargins(0, 0, 0, 0);
sortingLayout->addWidget(m_sortOrder);
sortingLayout->addWidget(m_sorting);
layout->addRow(i18nc("@label:listbox", "View mode:"), m_viewMode);
layout->addRow(i18nc("@label:listbox", "Sorting:"), sortingLayout);
layout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
layout->addRow(i18n("View options:"), m_sortFoldersFirst);
layout->addRow(QString(), m_previewsShown);
layout->addRow(QString(), m_showInGroups);
layout->addRow(QString(), m_showHiddenFiles);
connect(m_viewMode, QOverload::of(&QComboBox::currentIndexChanged),
this, &ViewPropertiesDialog::slotViewModeChanged);
connect(m_sorting, QOverload::of(&QComboBox::currentIndexChanged),
this, &ViewPropertiesDialog::slotSortingChanged);
connect(m_sortOrder, QOverload::of(&QComboBox::currentIndexChanged),
this, &ViewPropertiesDialog::slotSortOrderChanged);
connect(m_sortFoldersFirst, &QCheckBox::clicked,
this, &ViewPropertiesDialog::slotSortFoldersFirstChanged);
connect(m_previewsShown, &QCheckBox::clicked,
this, &ViewPropertiesDialog::slotShowPreviewChanged);
connect(m_showInGroups, &QCheckBox::clicked,
this, &ViewPropertiesDialog::slotGroupedSortingChanged);
connect(m_showHiddenFiles, &QCheckBox::clicked,
this, &ViewPropertiesDialog::slotShowHiddenFilesChanged);
// Only show the following settings if the view properties are remembered
// for each directory:
if (!useGlobalViewProps) {
// create 'Apply View Properties To' group
m_applyToCurrentFolder = new QRadioButton(i18nc("@option:radio Apply View Properties To",
"Current folder"));
m_applyToCurrentFolder->setChecked(true);
m_applyToSubFolders = new QRadioButton(i18nc("@option:radio Apply View Properties To",
"Current folder and sub-folders"));
m_applyToAllFolders = new QRadioButton(i18nc("@option:radio Apply View Properties To",
"All folders"));
QButtonGroup* applyGroup = new QButtonGroup(this);
applyGroup->addButton(m_applyToCurrentFolder);
applyGroup->addButton(m_applyToSubFolders);
applyGroup->addButton(m_applyToAllFolders);
layout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
layout->addRow(i18nc("@title:group", "Apply to:"), m_applyToCurrentFolder);
layout->addRow(QString(), m_applyToSubFolders);
layout->addRow(QString(), m_applyToAllFolders);
layout->addRow(QString(), m_applyToAllFolders);
m_useAsDefault = new QCheckBox(i18nc("@option:check", "Use as default view settings"), this);
layout->addRow(QString(), m_useAsDefault);
connect(m_applyToCurrentFolder, &QRadioButton::clicked,
this, &ViewPropertiesDialog::markAsDirty);
connect(m_applyToSubFolders, &QRadioButton::clicked,
this, &ViewPropertiesDialog::markAsDirty);
connect(m_applyToAllFolders, &QRadioButton::clicked,
this, &ViewPropertiesDialog::markAsDirty);
connect(m_useAsDefault, &QCheckBox::clicked,
this, &ViewPropertiesDialog::markAsDirty);
}
layout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
layout->addRow(additionalInfoBox);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Apply, this);
connect(buttonBox, &QDialogButtonBox::accepted, this, &ViewPropertiesDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &ViewPropertiesDialog::reject);
layout->addWidget(buttonBox);
auto okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setShortcut(Qt::CTRL + Qt::Key_Return);
okButton->setDefault(true);
auto applyButton = buttonBox->button(QDialogButtonBox::Apply);
applyButton->setEnabled(false);
connect(applyButton, &QPushButton::clicked, this, &ViewPropertiesDialog::slotApply);
connect(this, &ViewPropertiesDialog::isDirtyChanged, applyButton, [applyButton](bool isDirty) {
applyButton->setEnabled(isDirty);
});
const KConfigGroup dialogConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "ViewPropertiesDialog");
KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig);
loadSettings();
}
ViewPropertiesDialog::~ViewPropertiesDialog()
{
m_isDirty = false;
delete m_viewProps;
m_viewProps = nullptr;
KConfigGroup dialogConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "ViewPropertiesDialog");
KWindowConfig::saveWindowSize(windowHandle(), dialogConfig);
}
void ViewPropertiesDialog::accept()
{
applyViewProperties();
QDialog::accept();
}
void ViewPropertiesDialog::slotApply()
{
applyViewProperties();
markAsDirty(false);
}
void ViewPropertiesDialog::slotViewModeChanged(int index)
{
const QVariant itemData = m_viewMode->itemData(index);
const DolphinView::Mode viewMode = static_cast(itemData.toInt());
m_viewProps->setViewMode(viewMode);
markAsDirty(true);
}
void ViewPropertiesDialog::slotSortingChanged(int index)
{
const QByteArray role = m_sorting->itemData(index).toByteArray();
m_viewProps->setSortRole(role);
markAsDirty(true);
}
void ViewPropertiesDialog::slotSortOrderChanged(int index)
{
const Qt::SortOrder sortOrder = (index == 0) ? Qt::AscendingOrder : Qt::DescendingOrder;
m_viewProps->setSortOrder(sortOrder);
markAsDirty(true);
}
void ViewPropertiesDialog::slotGroupedSortingChanged()
{
m_viewProps->setGroupedSorting(m_showInGroups->isChecked());
markAsDirty(true);
}
void ViewPropertiesDialog::slotSortFoldersFirstChanged()
{
const bool foldersFirst = m_sortFoldersFirst->isChecked();
m_viewProps->setSortFoldersFirst(foldersFirst);
markAsDirty(true);
}
void ViewPropertiesDialog::slotShowPreviewChanged()
{
const bool show = m_previewsShown->isChecked();
m_viewProps->setPreviewsShown(show);
markAsDirty(true);
}
void ViewPropertiesDialog::slotShowHiddenFilesChanged()
{
const bool show = m_showHiddenFiles->isChecked();
m_viewProps->setHiddenFilesShown(show);
markAsDirty(true);
}
void ViewPropertiesDialog::slotItemChanged(QListWidgetItem *item)
{
Q_UNUSED(item)
markAsDirty(true);
}
void ViewPropertiesDialog::markAsDirty(bool isDirty)
{
if (m_isDirty != isDirty) {
m_isDirty = isDirty;
emit isDirtyChanged(isDirty);
}
}
void ViewPropertiesDialog::applyViewProperties()
{
// if nothing changed in the dialog, we have nothing to apply
if (!m_isDirty) {
return;
}
// Update visible roles.
{
QList visibleRoles;
int index = 0;
const QList rolesInfo = KFileItemModel::rolesInformation();
foreach (const KFileItemModel::RoleInfo& info, rolesInfo) {
const QListWidgetItem* item = m_listWidget->item(index);
if (item->checkState() == Qt::Checked) {
visibleRoles.append(info.role);
}
++index;
}
m_viewProps->setVisibleRoles(visibleRoles);
}
const bool applyToSubFolders = m_applyToSubFolders && m_applyToSubFolders->isChecked();
if (applyToSubFolders) {
const QString text(i18nc("@info", "The view properties of all sub-folders will be changed. Do you want to continue?"));
if (KMessageBox::questionYesNo(this, text) == KMessageBox::No) {
return;
}
ViewPropsProgressInfo* info = new ViewPropsProgressInfo(m_dolphinView,
m_dolphinView->url(),
*m_viewProps);
info->setAttribute(Qt::WA_DeleteOnClose);
info->setWindowModality(Qt::NonModal);
info->show();
}
const bool applyToAllFolders = m_applyToAllFolders && m_applyToAllFolders->isChecked();
// If the user selected 'Apply To All Folders' the view properties implicitly
// are also used as default for new folders.
const bool useAsDefault = applyToAllFolders || (m_useAsDefault && m_useAsDefault->isChecked());
if (useAsDefault) {
// For directories where no .directory file is available, the .directory
// file stored for the global view properties is used as fallback. To update
// this file we temporary turn on the global view properties mode.
Q_ASSERT(!GeneralSettings::globalViewProps());
GeneralSettings::setGlobalViewProps(true);
ViewProperties defaultProps(m_dolphinView->url());
defaultProps.setDirProperties(*m_viewProps);
defaultProps.save();
GeneralSettings::setGlobalViewProps(false);
}
if (applyToAllFolders) {
const QString text(i18nc("@info", "The view properties of all folders will be changed. Do you want to continue?"));
if (KMessageBox::questionYesNo(this, text) == KMessageBox::No) {
return;
}
// Updating the global view properties time stamp in the general settings makes
// all existing viewproperties invalid, as they have a smaller time stamp.
GeneralSettings* settings = GeneralSettings::self();
settings->setViewPropsTimestamp(QDateTime::currentDateTime());
settings->save();
}
m_dolphinView->setMode(m_viewProps->viewMode());
m_dolphinView->setSortRole(m_viewProps->sortRole());
m_dolphinView->setSortOrder(m_viewProps->sortOrder());
m_dolphinView->setSortFoldersFirst(m_viewProps->sortFoldersFirst());
m_dolphinView->setGroupedSorting(m_viewProps->groupedSorting());
m_dolphinView->setVisibleRoles(m_viewProps->visibleRoles());
m_dolphinView->setPreviewsShown(m_viewProps->previewsShown());
m_dolphinView->setHiddenFilesShown(m_viewProps->hiddenFilesShown());
m_viewProps->save();
markAsDirty(false);
}
void ViewPropertiesDialog::loadSettings()
{
// Load view mode
switch (m_viewProps->viewMode()) {
case DolphinView::IconsView: m_viewMode->setCurrentIndex(0); break;
case DolphinView::CompactView: m_viewMode->setCurrentIndex(1); break;
case DolphinView::DetailsView: m_viewMode->setCurrentIndex(2); break;
default: break;
}
// Load sort order and sorting
const int sortOrderIndex = (m_viewProps->sortOrder() == Qt::AscendingOrder) ? 0 : 1;
m_sortOrder->setCurrentIndex(sortOrderIndex);
const QList rolesInfo = KFileItemModel::rolesInformation();
int sortRoleIndex = 0;
for (int i = 0; i < rolesInfo.count(); ++i) {
if (rolesInfo[i].role == m_viewProps->sortRole()) {
sortRoleIndex = i;
break;
}
}
m_sorting->setCurrentIndex(sortRoleIndex);
m_sortFoldersFirst->setChecked(m_viewProps->sortFoldersFirst());
// Load show preview, show in groups and show hidden files settings
m_previewsShown->setChecked(m_viewProps->previewsShown());
m_showInGroups->setChecked(m_viewProps->groupedSorting());
m_showHiddenFiles->setChecked(m_viewProps->hiddenFilesShown());
markAsDirty(false);
}
diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp
index 0d9f9f81c..ef9f317ee 100644
--- a/src/views/dolphinviewactionhandler.cpp
+++ b/src/views/dolphinviewactionhandler.cpp
@@ -1,698 +1,698 @@
/***************************************************************************
* Copyright (C) 2008 by David Faure *
* Copyright (C) 2012 by Peter Penz *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "dolphinviewactionhandler.h"
#include "dolphindebug.h"
#include "kitemviews/kfileitemmodel.h"
#include "settings/viewpropertiesdialog.h"
#include "views/zoomlevelinfo.h"
#ifdef HAVE_BALOO
#include
#endif
#include
#include
#include
#include
#include
#include
#include
#include
DolphinViewActionHandler::DolphinViewActionHandler(KActionCollection* collection, QObject* parent) :
QObject(parent),
m_actionCollection(collection),
m_currentView(nullptr),
m_sortByActions(),
m_visibleRoles()
{
Q_ASSERT(m_actionCollection);
createActions();
}
void DolphinViewActionHandler::setCurrentView(DolphinView* view)
{
Q_ASSERT(view);
if (m_currentView) {
disconnect(m_currentView, nullptr, this, nullptr);
}
m_currentView = view;
connect(view, &DolphinView::modeChanged,
this, &DolphinViewActionHandler::updateViewActions);
connect(view, &DolphinView::previewsShownChanged,
this, &DolphinViewActionHandler::slotPreviewsShownChanged);
connect(view, &DolphinView::sortOrderChanged,
this, &DolphinViewActionHandler::slotSortOrderChanged);
connect(view, &DolphinView::sortFoldersFirstChanged,
this, &DolphinViewActionHandler::slotSortFoldersFirstChanged);
connect(view, &DolphinView::visibleRolesChanged,
this, &DolphinViewActionHandler::slotVisibleRolesChanged);
connect(view, &DolphinView::groupedSortingChanged,
this, &DolphinViewActionHandler::slotGroupedSortingChanged);
connect(view, &DolphinView::hiddenFilesShownChanged,
this, &DolphinViewActionHandler::slotHiddenFilesShownChanged);
connect(view, &DolphinView::sortRoleChanged,
this, &DolphinViewActionHandler::slotSortRoleChanged);
connect(view, &DolphinView::zoomLevelChanged,
this, &DolphinViewActionHandler::slotZoomLevelChanged);
connect(view, &DolphinView::writeStateChanged,
this, &DolphinViewActionHandler::slotWriteStateChanged);
}
DolphinView* DolphinViewActionHandler::currentView()
{
return m_currentView;
}
void DolphinViewActionHandler::createActions()
{
// This action doesn't appear in the GUI, it's for the shortcut only.
// KNewFileMenu takes care of the GUI stuff.
QAction* newDirAction = m_actionCollection->addAction(QStringLiteral("create_dir"));
newDirAction->setText(i18nc("@action", "Create Folder..."));
m_actionCollection->setDefaultShortcut(newDirAction, Qt::Key_F10);
newDirAction->setIcon(QIcon::fromTheme(QStringLiteral("folder-new")));
newDirAction->setEnabled(false); // Will be enabled in slotWriteStateChanged(bool) if the current URL is writable
connect(newDirAction, &QAction::triggered, this, &DolphinViewActionHandler::createDirectoryTriggered);
// File menu
auto renameAction = KStandardAction::renameFile(this, &DolphinViewActionHandler::slotRename, m_actionCollection);
renameAction->setWhatsThis(xi18nc("@info:whatsthis", "This renames the "
"items in your current selection.Renaming multiple items "
"at once amounts to their new names differing only in a number."));
auto trashAction = KStandardAction::moveToTrash(this, &DolphinViewActionHandler::slotTrashActivated, m_actionCollection);
auto trashShortcuts = trashAction->shortcuts();
if (!trashShortcuts.contains(QKeySequence::Delete)) {
trashShortcuts.append(QKeySequence::Delete);
m_actionCollection->setDefaultShortcuts(trashAction, trashShortcuts);
}
trashAction->setWhatsThis(xi18nc("@info:whatsthis", "This moves the "
"items in your current selection to the Trash"
".The trash is a temporary storage where "
"items can be deleted from if disk space is needed."));
auto deleteAction = KStandardAction::deleteFile(this, &DolphinViewActionHandler::slotDeleteItems, m_actionCollection);
auto deleteShortcuts = deleteAction->shortcuts();
if (!deleteShortcuts.contains(Qt::SHIFT | Qt::Key_Delete)) {
deleteShortcuts.append(Qt::SHIFT | Qt::Key_Delete);
m_actionCollection->setDefaultShortcuts(deleteAction, deleteShortcuts);
}
deleteAction->setWhatsThis(xi18nc("@info:whatsthis", "This deletes "
"the items in your current selection completely. They can "
"not be recovered by normal means."));
// This action is useful for being enabled when KStandardAction::MoveToTrash should be
// disabled and KStandardAction::DeleteFile is enabled (e.g. non-local files), so that Key_Del
// can be used for deleting the file (#76016). It needs to be a separate action
// so that the Edit menu isn't affected.
QAction* deleteWithTrashShortcut = m_actionCollection->addAction(QStringLiteral("delete_shortcut"));
// The descriptive text is just for the shortcuts editor.
deleteWithTrashShortcut->setText(i18nc("@action \"Move to Trash\" for non-local files, etc.", "Delete (using shortcut for Trash)"));
m_actionCollection->setDefaultShortcuts(deleteWithTrashShortcut, KStandardShortcut::moveToTrash());
deleteWithTrashShortcut->setEnabled(false);
connect(deleteWithTrashShortcut, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems);
QAction *propertiesAction = m_actionCollection->addAction( QStringLiteral("properties") );
// Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :)
propertiesAction->setText( i18nc("@action:inmenu File", "Properties") );
propertiesAction->setWhatsThis(xi18nc("@info:whatsthis properties",
"This shows a complete list of properties of the currently "
"selected items in a new window.If nothing is selected the "
"window will be about the currently viewed folder instead."
"You can configure advanced options there like managing "
"read- and write-permissions."));
propertiesAction->setIcon(QIcon::fromTheme(QStringLiteral("document-properties")));
m_actionCollection->setDefaultShortcuts(propertiesAction, {Qt::ALT + Qt::Key_Return, Qt::ALT + Qt::Key_Enter});
connect(propertiesAction, &QAction::triggered, this, &DolphinViewActionHandler::slotProperties);
// View menu
KToggleAction* iconsAction = iconsModeAction();
KToggleAction* compactAction = compactModeAction();
KToggleAction* detailsAction = detailsModeAction();
iconsAction->setWhatsThis(xi18nc("@info:whatsthis Icons view mode",
"This switches to a view mode that focuses on the folder "
"and file icons. This mode makes it easy to distinguish folders "
"from files and to detect items with distinctive "
"file types. This mode is handy to "
"browse through pictures when the Preview"
" option is enabled."));
compactAction->setWhatsThis(xi18nc("@info:whatsthis Compact view mode",
"This switches to a compact view mode that lists the folders "
"and files in columns with the names beside the icons."
"This helps to keep the overview in folders with many items."));
detailsAction->setWhatsThis(xi18nc("@info:whatsthis Details view mode",
"This switches to a list view mode that focuses on folder "
"and file details.Click on a detail in the column "
"header to sort the items by it. Click again to sort the other "
"way around. To select which details should be displayed click "
"the header with the right mouse button.You can "
"view the contents of a folder without leaving the current "
"location by clicking to the left of it. This way you can view "
"the contents of multiple folders in the same list."));
KSelectAction* viewModeActions = m_actionCollection->add(QStringLiteral("view_mode"));
viewModeActions->setText(i18nc("@action:intoolbar", "View Mode"));
viewModeActions->addAction(iconsAction);
viewModeActions->addAction(compactAction);
viewModeActions->addAction(detailsAction);
viewModeActions->setToolBarMode(KSelectAction::MenuMode);
connect(viewModeActions, QOverload::of(&KSelectAction::triggered), this, &DolphinViewActionHandler::slotViewModeActionTriggered);
QAction* zoomInAction = KStandardAction::zoomIn(this,
&DolphinViewActionHandler::zoomIn,
m_actionCollection);
zoomInAction->setWhatsThis(i18nc("@info:whatsthis zoom in", "This increases the icon size."));
QAction* zoomResetAction = m_actionCollection->addAction(QStringLiteral("view_zoom_reset"));
zoomResetAction->setText(i18nc("@action:inmenu View", "Reset Zoom Level"));
zoomResetAction->setToolTip(i18n("Zoom To Default"));
zoomResetAction->setWhatsThis(i18nc("@info:whatsthis zoom reset", "This resets the icon size to default."));
zoomResetAction->setIcon(QIcon::fromTheme(QStringLiteral("zoom-original")));
m_actionCollection->setDefaultShortcuts(zoomResetAction, {Qt::CTRL + Qt::Key_0});
connect(zoomResetAction, &QAction::triggered, this, &DolphinViewActionHandler::zoomReset);
QAction* zoomOutAction = KStandardAction::zoomOut(this,
&DolphinViewActionHandler::zoomOut,
m_actionCollection);
zoomOutAction->setWhatsThis(i18nc("@info:whatsthis zoom out", "This reduces the icon size."));
KToggleAction* showPreview = m_actionCollection->add(QStringLiteral("show_preview"));
showPreview->setText(i18nc("@action:intoolbar", "Show Previews"));
showPreview->setToolTip(i18nc("@info", "Show preview of files and folders"));
showPreview->setWhatsThis(xi18nc("@info:whatsthis", "When this is "
"enabled, the icons are based on the actual file or folder "
"contents.For example the icons of images become scaled "
"down versions of the images."));
showPreview->setIcon(QIcon::fromTheme(QStringLiteral("view-preview")));
connect(showPreview, &KToggleAction::triggered, this, &DolphinViewActionHandler::togglePreview);
KToggleAction* sortFoldersFirst = m_actionCollection->add(QStringLiteral("folders_first"));
sortFoldersFirst->setText(i18nc("@action:inmenu Sort", "Folders First"));
connect(sortFoldersFirst, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortFoldersFirst);
// View -> Sort By
QActionGroup* sortByActionGroup = createFileItemRolesActionGroup(QStringLiteral("sort_by_"));
KActionMenu* sortByActionMenu = m_actionCollection->add(QStringLiteral("sort"));
sortByActionMenu->setIcon(QIcon::fromTheme(QStringLiteral("view-sort")));
sortByActionMenu->setText(i18nc("@action:inmenu View", "Sort By"));
sortByActionMenu->setDelayed(false);
foreach (QAction* action, sortByActionGroup->actions()) {
sortByActionMenu->addAction(action);
}
sortByActionMenu->addSeparator();
QActionGroup* group = new QActionGroup(sortByActionMenu);
group->setExclusive(true);
KToggleAction* ascendingAction = m_actionCollection->add(QStringLiteral("ascending"));
ascendingAction->setActionGroup(group);
connect(ascendingAction, &QAction::triggered, this, [this] {
m_currentView->setSortOrder(Qt::AscendingOrder);
});
KToggleAction* descendingAction = m_actionCollection->add(QStringLiteral("descending"));
descendingAction->setActionGroup(group);
connect(descendingAction, &QAction::triggered, this, [this] {
m_currentView->setSortOrder(Qt::DescendingOrder);
});
sortByActionMenu->addAction(ascendingAction);
sortByActionMenu->addAction(descendingAction);
sortByActionMenu->addSeparator();
sortByActionMenu->addAction(sortFoldersFirst);
// View -> Additional Information
QActionGroup* visibleRolesGroup = createFileItemRolesActionGroup(QStringLiteral("show_"));
KActionMenu* visibleRolesMenu = m_actionCollection->add(QStringLiteral("additional_info"));
visibleRolesMenu->setText(i18nc("@action:inmenu View", "Show Additional Information"));
visibleRolesMenu->setIcon(QIcon::fromTheme(QStringLiteral("documentinfo")));
visibleRolesMenu->setDelayed(false);
foreach (QAction* action, visibleRolesGroup->actions()) {
visibleRolesMenu->addAction(action);
}
KToggleAction* showInGroups = m_actionCollection->add(QStringLiteral("show_in_groups"));
showInGroups->setIcon(QIcon::fromTheme(QStringLiteral("view-group")));
showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups"));
showInGroups->setWhatsThis(i18nc("@info:whatsthis", "This groups files and folders by their first letter."));
connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting);
KToggleAction* showHiddenFiles = m_actionCollection->add(QStringLiteral("show_hidden_files"));
showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files"));
showHiddenFiles->setToolTip(i18nc("@info", "Visibility of hidden files and folders"));
showHiddenFiles->setWhatsThis(xi18nc("@info:whatsthis", "When "
"this is enabled hidden files and folders "
"are visible. They will be displayed semi-transparent."
"Hidden items only differ from other ones in that their "
"name starts with a \".\". In general there is no need for "
"users to access them which is why they are hidden."));
m_actionCollection->setDefaultShortcuts(showHiddenFiles, {Qt::ALT + Qt::Key_Period, Qt::CTRL + Qt::Key_H, Qt::Key_F8});
connect(showHiddenFiles, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleShowHiddenFiles);
QAction* adjustViewProps = m_actionCollection->addAction(QStringLiteral("view_properties"));
- adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Properties..."));
+ adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Display Style..."));
adjustViewProps->setIcon(QIcon::fromTheme(QStringLiteral("view-choose")));
adjustViewProps->setWhatsThis(i18nc("@info:whatsthis", "This opens a window "
"in which all folder view properties can be adjusted."));
connect(adjustViewProps, &QAction::triggered, this, &DolphinViewActionHandler::slotAdjustViewProperties);
}
QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QString& groupPrefix)
{
const bool isSortGroup = (groupPrefix == QLatin1String("sort_by_"));
Q_ASSERT(isSortGroup || groupPrefix == QLatin1String("show_"));
QActionGroup* rolesActionGroup = new QActionGroup(m_actionCollection);
rolesActionGroup->setExclusive(isSortGroup);
if (isSortGroup) {
connect(rolesActionGroup, &QActionGroup::triggered,
this, &DolphinViewActionHandler::slotSortTriggered);
} else {
connect(rolesActionGroup, &QActionGroup::triggered,
this, &DolphinViewActionHandler::toggleVisibleRole);
}
QString groupName;
KActionMenu* groupMenu = nullptr;
QActionGroup* groupMenuGroup = nullptr;
bool indexingEnabled = false;
#ifdef HAVE_BALOO
Baloo::IndexerConfig config;
indexingEnabled = config.fileIndexingEnabled();
#endif
const QList rolesInfo = KFileItemModel::rolesInformation();
foreach (const KFileItemModel::RoleInfo& info, rolesInfo) {
if (!isSortGroup && info.role == "text") {
// It should not be possible to hide the "text" role
continue;
}
KToggleAction* action = nullptr;
const QString name = groupPrefix + info.role;
if (info.group.isEmpty()) {
action = m_actionCollection->add(name);
action->setActionGroup(rolesActionGroup);
} else {
if (!groupMenu || info.group != groupName) {
groupName = info.group;
groupMenu = m_actionCollection->add(groupName);
groupMenu->setText(groupName);
groupMenu->setActionGroup(rolesActionGroup);
groupMenuGroup = new QActionGroup(groupMenu);
groupMenuGroup->setExclusive(isSortGroup);
if (isSortGroup) {
connect(groupMenuGroup, &QActionGroup::triggered,
this, &DolphinViewActionHandler::slotSortTriggered);
} else {
connect(groupMenuGroup, &QActionGroup::triggered,
this, &DolphinViewActionHandler::toggleVisibleRole);
}
}
action = new KToggleAction(groupMenu);
action->setActionGroup(groupMenuGroup);
groupMenu->addAction(action);
}
action->setText(info.translation);
action->setData(info.role);
const bool enable = (!info.requiresBaloo && !info.requiresIndexer) ||
(info.requiresBaloo) ||
(info.requiresIndexer && indexingEnabled);
action->setEnabled(enable);
if (isSortGroup) {
m_sortByActions.insert(info.role, action);
} else {
m_visibleRoles.insert(info.role, action);
}
}
return rolesActionGroup;
}
void DolphinViewActionHandler::slotViewModeActionTriggered(QAction* action)
{
const DolphinView::Mode mode = action->data().value();
m_currentView->setMode(mode);
QAction* viewModeMenu = m_actionCollection->action(QStringLiteral("view_mode"));
viewModeMenu->setIcon(action->icon());
}
void DolphinViewActionHandler::slotRename()
{
emit actionBeingHandled();
m_currentView->renameSelectedItems();
}
void DolphinViewActionHandler::slotTrashActivated()
{
emit actionBeingHandled();
m_currentView->trashSelectedItems();
}
void DolphinViewActionHandler::slotDeleteItems()
{
emit actionBeingHandled();
m_currentView->deleteSelectedItems();
}
void DolphinViewActionHandler::togglePreview(bool show)
{
emit actionBeingHandled();
m_currentView->setPreviewsShown(show);
}
void DolphinViewActionHandler::slotPreviewsShownChanged(bool shown)
{
Q_UNUSED(shown)
// It is not enough to update the 'Show Preview' action, also
// the 'Zoom In', 'Zoom Out' and 'Zoom Reset' actions must be adapted.
updateViewActions();
}
QString DolphinViewActionHandler::currentViewModeActionName() const
{
switch (m_currentView->mode()) {
case DolphinView::IconsView:
return QStringLiteral("icons");
case DolphinView::DetailsView:
return QStringLiteral("details");
case DolphinView::CompactView:
return QStringLiteral("compact");
default:
Q_ASSERT(false);
break;
}
return QString(); // can't happen
}
KActionCollection* DolphinViewActionHandler::actionCollection()
{
return m_actionCollection;
}
void DolphinViewActionHandler::updateViewActions()
{
QAction* viewModeAction = m_actionCollection->action(currentViewModeActionName());
if (viewModeAction) {
viewModeAction->setChecked(true);
QAction* viewModeMenu = m_actionCollection->action(QStringLiteral("view_mode"));
viewModeMenu->setIcon(viewModeAction->icon());
}
QAction* showPreviewAction = m_actionCollection->action(QStringLiteral("show_preview"));
showPreviewAction->setChecked(m_currentView->previewsShown());
slotSortOrderChanged(m_currentView->sortOrder());
slotSortFoldersFirstChanged(m_currentView->sortFoldersFirst());
slotVisibleRolesChanged(m_currentView->visibleRoles(), QList());
slotGroupedSortingChanged(m_currentView->groupedSorting());
slotSortRoleChanged(m_currentView->sortRole());
slotZoomLevelChanged(m_currentView->zoomLevel(), -1);
// Updates the "show_hidden_files" action state and icon
slotHiddenFilesShownChanged(m_currentView->hiddenFilesShown());
}
void DolphinViewActionHandler::zoomIn()
{
const int level = m_currentView->zoomLevel();
m_currentView->setZoomLevel(level + 1);
updateViewActions();
}
void DolphinViewActionHandler::zoomOut()
{
const int level = m_currentView->zoomLevel();
m_currentView->setZoomLevel(level - 1);
updateViewActions();
}
void DolphinViewActionHandler::zoomReset()
{
m_currentView->resetZoomLevel();
updateViewActions();
}
void DolphinViewActionHandler::toggleSortFoldersFirst()
{
const bool sortFirst = m_currentView->sortFoldersFirst();
m_currentView->setSortFoldersFirst(!sortFirst);
}
void DolphinViewActionHandler::slotSortOrderChanged(Qt::SortOrder order)
{
QAction* descending = m_actionCollection->action(QStringLiteral("descending"));
QAction* ascending = m_actionCollection->action(QStringLiteral("ascending"));
const bool sortDescending = (order == Qt::DescendingOrder);
descending->setChecked(sortDescending);
ascending->setChecked(!sortDescending);
}
void DolphinViewActionHandler::slotSortFoldersFirstChanged(bool foldersFirst)
{
m_actionCollection->action(QStringLiteral("folders_first"))->setChecked(foldersFirst);
}
void DolphinViewActionHandler::toggleVisibleRole(QAction* action)
{
emit actionBeingHandled();
const QByteArray toggledRole = action->data().toByteArray();
QList roles = m_currentView->visibleRoles();
const bool show = action->isChecked();
const int index = roles.indexOf(toggledRole);
const bool containsInfo = (index >= 0);
if (show && !containsInfo) {
roles.append(toggledRole);
m_currentView->setVisibleRoles(roles);
} else if (!show && containsInfo) {
roles.removeAt(index);
m_currentView->setVisibleRoles(roles);
Q_ASSERT(roles.indexOf(toggledRole) < 0);
}
}
void DolphinViewActionHandler::slotVisibleRolesChanged(const QList& current,
const QList& previous)
{
Q_UNUSED(previous)
const QSet checkedRoles = current.toSet();
QHashIterator it(m_visibleRoles);
while (it.hasNext()) {
it.next();
const QByteArray& role = it.key();
KToggleAction* action = it.value();
action->setChecked(checkedRoles.contains(role));
}
}
void DolphinViewActionHandler::toggleGroupedSorting(bool grouped)
{
m_currentView->setGroupedSorting(grouped);
}
void DolphinViewActionHandler::slotGroupedSortingChanged(bool groupedSorting)
{
QAction* showInGroupsAction = m_actionCollection->action(QStringLiteral("show_in_groups"));
showInGroupsAction->setChecked(groupedSorting);
}
void DolphinViewActionHandler::toggleShowHiddenFiles(bool show)
{
emit actionBeingHandled();
m_currentView->setHiddenFilesShown(show);
}
void DolphinViewActionHandler::slotHiddenFilesShownChanged(bool shown)
{
QAction* showHiddenFilesAction = m_actionCollection->action(QStringLiteral("show_hidden_files"));
showHiddenFilesAction->setChecked(shown);
// #374508: don't overwrite custom icons.
const QString iconName = showHiddenFilesAction->icon().name();
if (!iconName.isEmpty() && iconName != QLatin1String("view-visible") && iconName != QLatin1String("view-hidden")) {
return;
}
showHiddenFilesAction->setIcon(QIcon::fromTheme(shown ? QStringLiteral("view-visible") : QStringLiteral("view-hidden")));
}
void DolphinViewActionHandler::slotWriteStateChanged(bool isFolderWritable)
{
m_actionCollection->action(QStringLiteral("create_dir"))->setEnabled(isFolderWritable &&
KProtocolManager::supportsMakeDir(currentView()->url()));
}
KToggleAction* DolphinViewActionHandler::iconsModeAction()
{
KToggleAction* iconsView = m_actionCollection->add(QStringLiteral("icons"));
iconsView->setText(i18nc("@action:inmenu View Mode", "Icons"));
iconsView->setToolTip(i18nc("@info", "Icons view mode"));
m_actionCollection->setDefaultShortcut(iconsView, Qt::CTRL + Qt::Key_1);
iconsView->setIcon(QIcon::fromTheme(QStringLiteral("view-list-icons")));
iconsView->setData(QVariant::fromValue(DolphinView::IconsView));
return iconsView;
}
KToggleAction* DolphinViewActionHandler::compactModeAction()
{
KToggleAction* iconsView = m_actionCollection->add(QStringLiteral("compact"));
iconsView->setText(i18nc("@action:inmenu View Mode", "Compact"));
iconsView->setToolTip(i18nc("@info", "Compact view mode"));
m_actionCollection->setDefaultShortcut(iconsView, Qt::CTRL + Qt::Key_2);
iconsView->setIcon(QIcon::fromTheme(QStringLiteral("view-list-details"))); // TODO: discuss with Oxygen-team the wrong (?) name
iconsView->setData(QVariant::fromValue(DolphinView::CompactView));
return iconsView;
}
KToggleAction* DolphinViewActionHandler::detailsModeAction()
{
KToggleAction* detailsView = m_actionCollection->add(QStringLiteral("details"));
detailsView->setText(i18nc("@action:inmenu View Mode", "Details"));
detailsView->setToolTip(i18nc("@info", "Details view mode"));
m_actionCollection->setDefaultShortcut(detailsView, Qt::CTRL + Qt::Key_3);
detailsView->setIcon(QIcon::fromTheme(QStringLiteral("view-list-tree")));
detailsView->setData(QVariant::fromValue(DolphinView::DetailsView));
return detailsView;
}
void DolphinViewActionHandler::slotSortRoleChanged(const QByteArray& role)
{
KToggleAction* action = m_sortByActions.value(role);
if (action) {
action->setChecked(true);
if (!action->icon().isNull()) {
QAction* sortByMenu = m_actionCollection->action(QStringLiteral("sort"));
sortByMenu->setIcon(action->icon());
}
}
QAction* descending = m_actionCollection->action(QStringLiteral("descending"));
QAction* ascending = m_actionCollection->action(QStringLiteral("ascending"));
if (role == "text" || role == "type" || role == "tags" || role == "comment") {
descending->setText(i18nc("Sort descending", "Z-A"));
ascending->setText(i18nc("Sort ascending", "A-Z"));
} else if (role == "size") {
descending->setText(i18nc("Sort descending", "Largest first"));
ascending->setText(i18nc("Sort ascending", "Smallest first"));
} else if (role == "modificationtime" || role == "creationtime" || role == "accesstime") {
descending->setText(i18nc("Sort descending", "Newest first"));
ascending->setText(i18nc("Sort ascending", "Oldest first"));
} else if (role == "rating") {
descending->setText(i18nc("Sort descending", "Highest first"));
ascending->setText(i18nc("Sort ascending", "Lowest first"));
} else {
descending->setText(i18nc("Sort descending", "Descending"));
ascending->setText(i18nc("Sort ascending", "Ascending"));
}
slotSortOrderChanged(m_currentView->sortOrder());
}
void DolphinViewActionHandler::slotZoomLevelChanged(int current, int previous)
{
Q_UNUSED(previous)
QAction* zoomInAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomIn));
if (zoomInAction) {
zoomInAction->setEnabled(current < ZoomLevelInfo::maximumLevel());
}
QAction* zoomOutAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomOut));
if (zoomOutAction) {
zoomOutAction->setEnabled(current > ZoomLevelInfo::minimumLevel());
}
}
void DolphinViewActionHandler::slotSortTriggered(QAction* action)
{
// The radiobuttons of the "Sort By"-menu are split between the main-menu
// and several sub-menus. Because of this they don't have a common
// action-group that assures an exclusive toggle-state between the main-menu
// actions and the sub-menu-actions. If an action gets checked, it must
// be assured that all other actions get unchecked, except the ascending/
// descending actions
for (QAction *groupAction : qAsConst(m_sortByActions)) {
KActionMenu* actionMenu = qobject_cast(groupAction);
if (actionMenu) {
foreach (QAction* subAction, actionMenu->menu()->actions()) {
subAction->setChecked(false);
}
} else if (groupAction->actionGroup()) {
groupAction->setChecked(false);
}
}
action->setChecked(true);
// Apply the activated sort-role to the view
const QByteArray role = action->data().toByteArray();
m_currentView->setSortRole(role);
}
void DolphinViewActionHandler::slotAdjustViewProperties()
{
emit actionBeingHandled();
QPointer dialog = new ViewPropertiesDialog(m_currentView);
dialog->exec();
delete dialog;
}
void DolphinViewActionHandler::slotProperties()
{
KPropertiesDialog* dialog = nullptr;
const KFileItemList list = m_currentView->selectedItems();
if (list.isEmpty()) {
const QUrl url = m_currentView->url();
dialog = new KPropertiesDialog(url, m_currentView);
} else {
dialog = new KPropertiesDialog(list, m_currentView);
}
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
dialog->raise();
dialog->activateWindow();
}