Changeset View
Changeset View
Standalone View
Standalone View
src/views/dolphinviewactionhandler.cpp
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 90 | { | |||
---|---|---|---|---|---|
94 | newDirAction->setText(i18nc("@action", "Create Folder...")); | 94 | newDirAction->setText(i18nc("@action", "Create Folder...")); | ||
95 | m_actionCollection->setDefaultShortcut(newDirAction, Qt::Key_F10); | 95 | m_actionCollection->setDefaultShortcut(newDirAction, Qt::Key_F10); | ||
96 | newDirAction->setIcon(QIcon::fromTheme(QStringLiteral("folder-new"))); | 96 | newDirAction->setIcon(QIcon::fromTheme(QStringLiteral("folder-new"))); | ||
97 | newDirAction->setEnabled(false); // Will be enabled in slotWriteStateChanged(bool) if the current URL is writable | 97 | newDirAction->setEnabled(false); // Will be enabled in slotWriteStateChanged(bool) if the current URL is writable | ||
98 | connect(newDirAction, &QAction::triggered, this, &DolphinViewActionHandler::createDirectoryTriggered); | 98 | connect(newDirAction, &QAction::triggered, this, &DolphinViewActionHandler::createDirectoryTriggered); | ||
99 | 99 | | |||
100 | // File menu | 100 | // File menu | ||
101 | 101 | | |||
102 | KStandardAction::renameFile(this, &DolphinViewActionHandler::slotRename, m_actionCollection); | 102 | auto renameAction = KStandardAction::renameFile(this, &DolphinViewActionHandler::slotRename, m_actionCollection); | ||
103 | renameAction->setWhatsThis(xi18nc("@info:whatsthis", "This renames the " | ||||
104 | "items in your current selection.<nl/>Renaming multiple items " | ||||
105 | "at once amounts to their new names differing only in a number.")); | ||||
103 | 106 | | |||
104 | auto trashAction = KStandardAction::moveToTrash(this, &DolphinViewActionHandler::slotTrashActivated, m_actionCollection); | 107 | auto trashAction = KStandardAction::moveToTrash(this, &DolphinViewActionHandler::slotTrashActivated, m_actionCollection); | ||
105 | auto trashShortcuts = trashAction->shortcuts(); | 108 | auto trashShortcuts = trashAction->shortcuts(); | ||
106 | if (!trashShortcuts.contains(QKeySequence::Delete)) { | 109 | if (!trashShortcuts.contains(QKeySequence::Delete)) { | ||
107 | trashShortcuts.append(QKeySequence::Delete); | 110 | trashShortcuts.append(QKeySequence::Delete); | ||
108 | m_actionCollection->setDefaultShortcuts(trashAction, trashShortcuts); | 111 | m_actionCollection->setDefaultShortcuts(trashAction, trashShortcuts); | ||
109 | } | 112 | } | ||
113 | trashAction->setWhatsThis(xi18nc("@info:whatsthis", "This moves the " | ||||
114 | "items in your current selection to the <filename>Trash" | ||||
115 | "</filename>.<nl/>The trash is a temporary storage where " | ||||
116 | "items can be deleted from if disk space is needed.")); | ||||
110 | 117 | | |||
111 | auto deleteAction = KStandardAction::deleteFile(this, &DolphinViewActionHandler::slotDeleteItems, m_actionCollection); | 118 | auto deleteAction = KStandardAction::deleteFile(this, &DolphinViewActionHandler::slotDeleteItems, m_actionCollection); | ||
112 | auto deleteShortcuts = deleteAction->shortcuts(); | 119 | auto deleteShortcuts = deleteAction->shortcuts(); | ||
113 | if (!deleteShortcuts.contains(Qt::SHIFT | Qt::Key_Delete)) { | 120 | if (!deleteShortcuts.contains(Qt::SHIFT | Qt::Key_Delete)) { | ||
114 | deleteShortcuts.append(Qt::SHIFT | Qt::Key_Delete); | 121 | deleteShortcuts.append(Qt::SHIFT | Qt::Key_Delete); | ||
115 | m_actionCollection->setDefaultShortcuts(deleteAction, deleteShortcuts); | 122 | m_actionCollection->setDefaultShortcuts(deleteAction, deleteShortcuts); | ||
116 | } | 123 | } | ||
124 | deleteAction->setWhatsThis(xi18nc("@info:whatsthis", "This deletes " | ||||
125 | "the items in your current selection completely. They can " | ||||
126 | "not be recovered by normal means.")); | ||||
117 | 127 | | |||
118 | // This action is useful for being enabled when KStandardAction::MoveToTrash should be | 128 | // This action is useful for being enabled when KStandardAction::MoveToTrash should be | ||
119 | // disabled and KStandardAction::DeleteFile is enabled (e.g. non-local files), so that Key_Del | 129 | // disabled and KStandardAction::DeleteFile is enabled (e.g. non-local files), so that Key_Del | ||
120 | // can be used for deleting the file (#76016). It needs to be a separate action | 130 | // can be used for deleting the file (#76016). It needs to be a separate action | ||
121 | // so that the Edit menu isn't affected. | 131 | // so that the Edit menu isn't affected. | ||
122 | QAction* deleteWithTrashShortcut = m_actionCollection->addAction(QStringLiteral("delete_shortcut")); | 132 | QAction* deleteWithTrashShortcut = m_actionCollection->addAction(QStringLiteral("delete_shortcut")); | ||
123 | // The descriptive text is just for the shortcuts editor. | 133 | // The descriptive text is just for the shortcuts editor. | ||
124 | deleteWithTrashShortcut->setText(i18nc("@action \"Move to Trash\" for non-local files, etc.", "Delete (using shortcut for Trash)")); | 134 | deleteWithTrashShortcut->setText(i18nc("@action \"Move to Trash\" for non-local files, etc.", "Delete (using shortcut for Trash)")); | ||
125 | m_actionCollection->setDefaultShortcuts(deleteWithTrashShortcut, KStandardShortcut::moveToTrash()); | 135 | m_actionCollection->setDefaultShortcuts(deleteWithTrashShortcut, KStandardShortcut::moveToTrash()); | ||
126 | deleteWithTrashShortcut->setEnabled(false); | 136 | deleteWithTrashShortcut->setEnabled(false); | ||
127 | connect(deleteWithTrashShortcut, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems); | 137 | connect(deleteWithTrashShortcut, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems); | ||
128 | 138 | | |||
129 | QAction *propertiesAction = m_actionCollection->addAction( QStringLiteral("properties") ); | 139 | QAction *propertiesAction = m_actionCollection->addAction( QStringLiteral("properties") ); | ||
130 | // Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :) | 140 | // Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :) | ||
131 | propertiesAction->setText( i18nc("@action:inmenu File", "Properties") ); | 141 | propertiesAction->setText( i18nc("@action:inmenu File", "Properties") ); | ||
142 | propertiesAction->setWhatsThis(xi18nc("@info:whatsthis properties", | ||||
143 | "This shows a complete list of properties of the currently " | ||||
144 | "selected items in a new window.<nl/>If nothing is selected the " | ||||
145 | "window will be about the currently viewed folder instead.<nl/>" | ||||
146 | "You can configure advanced options there like managing " | ||||
147 | "read- and write-permissions.")); | ||||
132 | propertiesAction->setIcon(QIcon::fromTheme(QStringLiteral("document-properties"))); | 148 | propertiesAction->setIcon(QIcon::fromTheme(QStringLiteral("document-properties"))); | ||
133 | m_actionCollection->setDefaultShortcuts(propertiesAction, {Qt::ALT + Qt::Key_Return, Qt::ALT + Qt::Key_Enter}); | 149 | m_actionCollection->setDefaultShortcuts(propertiesAction, {Qt::ALT + Qt::Key_Return, Qt::ALT + Qt::Key_Enter}); | ||
134 | connect(propertiesAction, &QAction::triggered, this, &DolphinViewActionHandler::slotProperties); | 150 | connect(propertiesAction, &QAction::triggered, this, &DolphinViewActionHandler::slotProperties); | ||
135 | 151 | | |||
136 | // View menu | 152 | // View menu | ||
137 | KToggleAction* iconsAction = iconsModeAction(); | 153 | KToggleAction* iconsAction = iconsModeAction(); | ||
138 | KToggleAction* compactAction = compactModeAction(); | 154 | KToggleAction* compactAction = compactModeAction(); | ||
139 | KToggleAction* detailsAction = detailsModeAction(); | 155 | KToggleAction* detailsAction = detailsModeAction(); | ||
140 | 156 | | |||
157 | iconsAction->setWhatsThis(xi18nc("@info:whatsthis Icons view mode", | ||||
158 | "<para>This switches to a view mode that focuses on the folder " | ||||
159 | "and file icons. This mode makes it easy to distinguish folders " | ||||
160 | "from files and to detect items with distinctive <emphasis>" | ||||
161 | "file types</emphasis>.</para><para> This mode is handy to " | ||||
162 | "browse through pictures when the <interface>Preview" | ||||
163 | "</interface> option is enabled.</para>")); | ||||
164 | compactAction->setWhatsThis(xi18nc("@info:whatsthis Compact view mode", | ||||
165 | "<para>This switches to a compact view mode that lists the folders " | ||||
166 | "and files in columns with the names beside the icons. <para></para>" | ||||
167 | "This helps to keep the overview in folders with many items.</para>")); | ||||
168 | detailsAction->setWhatsThis(xi18nc("@info:whatsthis Details view mode", | ||||
169 | "<para>This switches to a list view mode that focuses on folder " | ||||
170 | "and file details.</para><para>Click on a detail in the column " | ||||
171 | "header to sort the items by it. Click again to sort the other " | ||||
172 | "way around. To select which details should be displayed click " | ||||
173 | "the header with the right mouse button.</para><para>You can " | ||||
174 | "view the contents of a folder without leaving the current " | ||||
175 | "location by clicking to the left of it. This way you can view " | ||||
176 | "the contents of multiple folders in the same list.</para>")); | ||||
177 | | ||||
141 | KSelectAction* viewModeActions = m_actionCollection->add<KSelectAction>(QStringLiteral("view_mode")); | 178 | KSelectAction* viewModeActions = m_actionCollection->add<KSelectAction>(QStringLiteral("view_mode")); | ||
142 | viewModeActions->setText(i18nc("@action:intoolbar", "View Mode")); | 179 | viewModeActions->setText(i18nc("@action:intoolbar", "View Mode")); | ||
143 | viewModeActions->addAction(iconsAction); | 180 | viewModeActions->addAction(iconsAction); | ||
144 | viewModeActions->addAction(compactAction); | 181 | viewModeActions->addAction(compactAction); | ||
145 | viewModeActions->addAction(detailsAction); | 182 | viewModeActions->addAction(detailsAction); | ||
146 | viewModeActions->setToolBarMode(KSelectAction::MenuMode); | 183 | viewModeActions->setToolBarMode(KSelectAction::MenuMode); | ||
147 | connect(viewModeActions, QOverload<QAction*>::of(&KSelectAction::triggered), this, &DolphinViewActionHandler::slotViewModeActionTriggered); | 184 | connect(viewModeActions, QOverload<QAction*>::of(&KSelectAction::triggered), this, &DolphinViewActionHandler::slotViewModeActionTriggered); | ||
148 | 185 | | |||
149 | KStandardAction::zoomIn(this, | 186 | QAction* zoomInAction = KStandardAction::zoomIn(this, | ||
150 | &DolphinViewActionHandler::zoomIn, | 187 | &DolphinViewActionHandler::zoomIn, | ||
151 | m_actionCollection); | 188 | m_actionCollection); | ||
189 | zoomInAction->setWhatsThis(i18nc("@info:whatsthis zoom in", "This increases the icon size.")); | ||||
152 | 190 | | |||
153 | KStandardAction::zoomOut(this, | 191 | QAction* zoomOutAction = KStandardAction::zoomOut(this, | ||
154 | &DolphinViewActionHandler::zoomOut, | 192 | &DolphinViewActionHandler::zoomOut, | ||
155 | m_actionCollection); | 193 | m_actionCollection); | ||
194 | zoomOutAction->setWhatsThis(i18nc("@info:whatsthis zoom in", "This reduces the icon size.")); | ||||
156 | 195 | | |||
157 | KToggleAction* showPreview = m_actionCollection->add<KToggleAction>(QStringLiteral("show_preview")); | 196 | KToggleAction* showPreview = m_actionCollection->add<KToggleAction>(QStringLiteral("show_preview")); | ||
158 | showPreview->setText(i18nc("@action:intoolbar", "Preview")); | 197 | showPreview->setText(i18nc("@action:intoolbar", "Preview")); | ||
159 | showPreview->setToolTip(i18nc("@info", "Show preview of files and folders")); | 198 | showPreview->setToolTip(i18nc("@info", "Show preview of files and folders")); | ||
199 | showPreview->setWhatsThis(xi18nc("@info:whatsthis", "When this is " | ||||
200 | "enabled, the icons are based on the actual file or folder " | ||||
201 | "contents.<nl/>For example the icons of images become scaled " | ||||
202 | "down versions of the images.")); | ||||
160 | showPreview->setIcon(QIcon::fromTheme(QStringLiteral("view-preview"))); | 203 | showPreview->setIcon(QIcon::fromTheme(QStringLiteral("view-preview"))); | ||
161 | connect(showPreview, &KToggleAction::triggered, this, &DolphinViewActionHandler::togglePreview); | 204 | connect(showPreview, &KToggleAction::triggered, this, &DolphinViewActionHandler::togglePreview); | ||
162 | 205 | | |||
163 | KToggleAction* sortDescending = m_actionCollection->add<KToggleAction>(QStringLiteral("descending")); | 206 | KToggleAction* sortDescending = m_actionCollection->add<KToggleAction>(QStringLiteral("descending")); | ||
164 | sortDescending->setText(i18nc("@action:inmenu Sort", "Descending")); | 207 | sortDescending->setText(i18nc("@action:inmenu Sort", "Descending")); | ||
165 | connect(sortDescending, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortOrder); | 208 | connect(sortDescending, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortOrder); | ||
166 | 209 | | |||
167 | KToggleAction* sortFoldersFirst = m_actionCollection->add<KToggleAction>(QStringLiteral("folders_first")); | 210 | KToggleAction* sortFoldersFirst = m_actionCollection->add<KToggleAction>(QStringLiteral("folders_first")); | ||
Show All 24 Lines | |||||
192 | 235 | | |||
193 | foreach (QAction* action, visibleRolesGroup->actions()) { | 236 | foreach (QAction* action, visibleRolesGroup->actions()) { | ||
194 | visibleRolesMenu->addAction(action); | 237 | visibleRolesMenu->addAction(action); | ||
195 | } | 238 | } | ||
196 | 239 | | |||
197 | KToggleAction* showInGroups = m_actionCollection->add<KToggleAction>(QStringLiteral("show_in_groups")); | 240 | KToggleAction* showInGroups = m_actionCollection->add<KToggleAction>(QStringLiteral("show_in_groups")); | ||
198 | showInGroups->setIcon(QIcon::fromTheme(QStringLiteral("view-group"))); | 241 | showInGroups->setIcon(QIcon::fromTheme(QStringLiteral("view-group"))); | ||
199 | showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups")); | 242 | showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups")); | ||
243 | showInGroups->setWhatsThis(i18nc("@info:whatsthis", "This groups files and folders by their first letter.")); | ||||
200 | connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting); | 244 | connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting); | ||
201 | 245 | | |||
202 | KToggleAction* showHiddenFiles = m_actionCollection->add<KToggleAction>(QStringLiteral("show_hidden_files")); | 246 | KToggleAction* showHiddenFiles = m_actionCollection->add<KToggleAction>(QStringLiteral("show_hidden_files")); | ||
203 | showHiddenFiles->setText(i18nc("@action:inmenu View", "Hidden Files")); | 247 | showHiddenFiles->setText(i18nc("@action:inmenu View", "Hidden Files")); | ||
204 | showHiddenFiles->setToolTip(i18nc("@info", "Visibility of hidden files and folders")); | 248 | showHiddenFiles->setToolTip(i18nc("@info", "Visibility of hidden files and folders")); | ||
249 | showHiddenFiles->setWhatsThis(xi18nc("@info:whatsthis", "<para>When " | ||||
250 | "this is enabled <emphasis>hidden</emphasis> files and folders " | ||||
251 | "are visible. They will be displayed semi-transparent.</para>" | ||||
252 | "<para>Hidden items only differ from other ones in that their " | ||||
253 | "name starts with a \".\". In general there is no need for " | ||||
254 | "users to access them which is why they are hidden.</para>")); | ||||
205 | m_actionCollection->setDefaultShortcuts(showHiddenFiles, {Qt::ALT + Qt::Key_Period, Qt::CTRL + Qt::Key_H, Qt::Key_F8}); | 255 | m_actionCollection->setDefaultShortcuts(showHiddenFiles, {Qt::ALT + Qt::Key_Period, Qt::CTRL + Qt::Key_H, Qt::Key_F8}); | ||
206 | connect(showHiddenFiles, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleShowHiddenFiles); | 256 | connect(showHiddenFiles, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleShowHiddenFiles); | ||
207 | 257 | | |||
208 | QAction* adjustViewProps = m_actionCollection->addAction(QStringLiteral("view_properties")); | 258 | QAction* adjustViewProps = m_actionCollection->addAction(QStringLiteral("view_properties")); | ||
209 | adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Properties...")); | 259 | adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Properties...")); | ||
260 | adjustViewProps->setWhatsThis(i18nc("@info:whatsthis", "This opens a window " | ||||
261 | "in which all folder view properties can be adjusted.")); | ||||
210 | connect(adjustViewProps, &QAction::triggered, this, &DolphinViewActionHandler::slotAdjustViewProperties); | 262 | connect(adjustViewProps, &QAction::triggered, this, &DolphinViewActionHandler::slotAdjustViewProperties); | ||
211 | } | 263 | } | ||
212 | 264 | | |||
213 | QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QString& groupPrefix) | 265 | QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QString& groupPrefix) | ||
214 | { | 266 | { | ||
215 | const bool isSortGroup = (groupPrefix == QLatin1String("sort_by_")); | 267 | const bool isSortGroup = (groupPrefix == QLatin1String("sort_by_")); | ||
216 | Q_ASSERT(isSortGroup || (!isSortGroup && groupPrefix == QLatin1String("show_"))); | 268 | Q_ASSERT(isSortGroup || (!isSortGroup && groupPrefix == QLatin1String("show_"))); | ||
217 | 269 | | |||
▲ Show 20 Lines • Show All 382 Lines • Show Last 20 Lines |