Changeset View
Changeset View
Standalone View
Standalone View
src/dolphinmainwindow.cpp
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | |||||
65 | #include <KToolBar> | 65 | #include <KToolBar> | ||
66 | #include <KToolInvocation> | 66 | #include <KToolInvocation> | ||
67 | #include <KUrlComboBox> | 67 | #include <KUrlComboBox> | ||
68 | #include <KUrlNavigator> | 68 | #include <KUrlNavigator> | ||
69 | 69 | | |||
70 | #include <QApplication> | 70 | #include <QApplication> | ||
71 | #include <QClipboard> | 71 | #include <QClipboard> | ||
72 | #include <QCloseEvent> | 72 | #include <QCloseEvent> | ||
73 | #include <QDesktopServices> | ||||
73 | #include <QDialog> | 74 | #include <QDialog> | ||
74 | #include <QFileInfo> | 75 | #include <QFileInfo> | ||
75 | #include <QLineEdit> | 76 | #include <QLineEdit> | ||
76 | #include <QMenu> | 77 | #include <QMenu> | ||
77 | #include <QMenuBar> | 78 | #include <QMenuBar> | ||
78 | #include <QPushButton> | 79 | #include <QPushButton> | ||
79 | #include <QShowEvent> | 80 | #include <QShowEvent> | ||
80 | #include <QStandardPaths> | 81 | #include <QStandardPaths> | ||
81 | #include <QTimer> | 82 | #include <QTimer> | ||
82 | #include <QToolButton> | 83 | #include <QToolButton> | ||
elvisangelaccio: Please keep the includes sorted by name. | |||||
84 | #include <QWhatsThisClickedEvent> | ||||
83 | 85 | | |||
84 | namespace { | 86 | namespace { | ||
85 | // Used for GeneralSettings::version() to determine whether | 87 | // Used for GeneralSettings::version() to determine whether | ||
86 | // an updated version of Dolphin is running. | 88 | // an updated version of Dolphin is running. | ||
87 | const int CurrentDolphinVersion = 200; | 89 | const int CurrentDolphinVersion = 200; | ||
88 | } | 90 | } | ||
89 | 91 | | |||
90 | DolphinMainWindow::DolphinMainWindow() : | 92 | DolphinMainWindow::DolphinMainWindow() : | ||
91 | KXmlGuiWindow(nullptr), | 93 | KXmlGuiWindow(nullptr, Qt::WindowContextHelpButtonHint), | ||
92 | m_newFileMenu(nullptr), | 94 | m_newFileMenu(nullptr), | ||
95 | m_helpMenu(nullptr), | ||||
93 | m_tabWidget(nullptr), | 96 | m_tabWidget(nullptr), | ||
94 | m_activeViewContainer(nullptr), | 97 | m_activeViewContainer(nullptr), | ||
95 | m_actionHandler(nullptr), | 98 | m_actionHandler(nullptr), | ||
96 | m_remoteEncoding(nullptr), | 99 | m_remoteEncoding(nullptr), | ||
97 | m_settingsDialog(), | 100 | m_settingsDialog(), | ||
98 | m_bookmarkHandler(nullptr), | 101 | m_bookmarkHandler(nullptr), | ||
99 | m_controlButton(nullptr), | 102 | m_controlButton(nullptr), | ||
100 | m_updateToolBarTimer(nullptr), | 103 | m_updateToolBarTimer(nullptr), | ||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | 108 | { | |||
174 | if (!showMenu) { | 177 | if (!showMenu) { | ||
175 | createControlButton(); | 178 | createControlButton(); | ||
176 | } | 179 | } | ||
177 | 180 | | |||
178 | // enable middle-click on back/forward/up to open in a new tab | 181 | // enable middle-click on back/forward/up to open in a new tab | ||
179 | auto *middleClickEventFilter = new MiddleClickActionEventFilter(this); | 182 | auto *middleClickEventFilter = new MiddleClickActionEventFilter(this); | ||
180 | connect(middleClickEventFilter, &MiddleClickActionEventFilter::actionMiddleClicked, this, &DolphinMainWindow::slotToolBarActionMiddleClicked); | 183 | connect(middleClickEventFilter, &MiddleClickActionEventFilter::actionMiddleClicked, this, &DolphinMainWindow::slotToolBarActionMiddleClicked); | ||
181 | toolBar()->installEventFilter(middleClickEventFilter); | 184 | toolBar()->installEventFilter(middleClickEventFilter); | ||
185 | | ||||
186 | setupWhatsThis(); | ||||
182 | } | 187 | } | ||
183 | 188 | | |||
184 | DolphinMainWindow::~DolphinMainWindow() | 189 | DolphinMainWindow::~DolphinMainWindow() | ||
185 | { | 190 | { | ||
186 | } | 191 | } | ||
187 | 192 | | |||
188 | QVector<DolphinViewContainer*> DolphinMainWindow::viewContainers() const | 193 | QVector<DolphinViewContainer*> DolphinMainWindow::viewContainers() const | ||
189 | { | 194 | { | ||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | |||||
295 | void DolphinMainWindow::updateHistory() | 300 | void DolphinMainWindow::updateHistory() | ||
296 | { | 301 | { | ||
297 | const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator(); | 302 | const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator(); | ||
298 | const int index = urlNavigator->historyIndex(); | 303 | const int index = urlNavigator->historyIndex(); | ||
299 | 304 | | |||
300 | QAction* backAction = actionCollection()->action(KStandardAction::name(KStandardAction::Back)); | 305 | QAction* backAction = actionCollection()->action(KStandardAction::name(KStandardAction::Back)); | ||
301 | if (backAction) { | 306 | if (backAction) { | ||
302 | backAction->setToolTip(i18nc("@info", "Go back")); | 307 | backAction->setToolTip(i18nc("@info", "Go back")); | ||
308 | backAction->setWhatsThis(i18nc("@info:whatsthis go back", "Return to the previously viewed folder.")); | ||||
303 | backAction->setEnabled(index < urlNavigator->historySize() - 1); | 309 | backAction->setEnabled(index < urlNavigator->historySize() - 1); | ||
304 | } | 310 | } | ||
305 | 311 | | |||
306 | QAction* forwardAction = actionCollection()->action(KStandardAction::name(KStandardAction::Forward)); | 312 | QAction* forwardAction = actionCollection()->action(KStandardAction::name(KStandardAction::Forward)); | ||
307 | if (forwardAction) { | 313 | if (forwardAction) { | ||
308 | forwardAction->setToolTip(i18nc("@info", "Go forward")); | 314 | forwardAction->setToolTip(i18nc("@info", "Go forward")); | ||
315 | forwardAction->setWhatsThis(xi18nc("@info:whatsthis go forward", | ||||
316 | "This undoes a <interface>Go|Back</interface> action.")); | ||||
309 | forwardAction->setEnabled(index > 0); | 317 | forwardAction->setEnabled(index > 0); | ||
310 | } | 318 | } | ||
311 | } | 319 | } | ||
312 | 320 | | |||
313 | void DolphinMainWindow::updateFilterBarAction(bool show) | 321 | void DolphinMainWindow::updateFilterBarAction(bool show) | ||
314 | { | 322 | { | ||
315 | QAction* showFilterBarAction = actionCollection()->action(QStringLiteral("show_filter_bar")); | 323 | QAction* showFilterBarAction = actionCollection()->action(QStringLiteral("show_filter_bar")); | ||
316 | showFilterBarAction->setChecked(show); | 324 | showFilterBarAction->setChecked(show); | ||
▲ Show 20 Lines • Show All 691 Lines • ▼ Show 20 Line(s) | 936 | { | |||
1008 | menu->addMenu(toolsMenu); | 1016 | menu->addMenu(toolsMenu); | ||
1009 | 1017 | | |||
1010 | // Add "Settings" menu entries | 1018 | // Add "Settings" menu entries | ||
1011 | addActionToMenu(ac->action(KStandardAction::name(KStandardAction::KeyBindings)), menu); | 1019 | addActionToMenu(ac->action(KStandardAction::name(KStandardAction::KeyBindings)), menu); | ||
1012 | addActionToMenu(ac->action(KStandardAction::name(KStandardAction::ConfigureToolbars)), menu); | 1020 | addActionToMenu(ac->action(KStandardAction::name(KStandardAction::ConfigureToolbars)), menu); | ||
1013 | addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Preferences)), menu); | 1021 | addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Preferences)), menu); | ||
1014 | 1022 | | |||
1015 | // Add "Help" menu | 1023 | // Add "Help" menu | ||
1016 | auto helpMenu = new KHelpMenu(menu); | 1024 | menu->addMenu(m_helpMenu->menu()); | ||
1017 | menu->addMenu(helpMenu->menu()); | | |||
1018 | 1025 | | |||
1019 | menu->addSeparator(); | 1026 | menu->addSeparator(); | ||
1020 | addActionToMenu(ac->action(KStandardAction::name(KStandardAction::ShowMenubar)), menu); | 1027 | addActionToMenu(ac->action(KStandardAction::name(KStandardAction::ShowMenubar)), menu); | ||
1021 | } | 1028 | } | ||
1022 | 1029 | | |||
1023 | void DolphinMainWindow::updateToolBar() | 1030 | void DolphinMainWindow::updateToolBar() | ||
1024 | { | 1031 | { | ||
1025 | if (!menuBar()->isVisible()) { | 1032 | if (!menuBar()->isVisible()) { | ||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 1129 | { | |||
1126 | menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New")); | 1133 | menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New")); | ||
1127 | menu->setIcon(QIcon::fromTheme(QStringLiteral("document-new"))); | 1134 | menu->setIcon(QIcon::fromTheme(QStringLiteral("document-new"))); | ||
1128 | m_newFileMenu->setDelayed(false); | 1135 | m_newFileMenu->setDelayed(false); | ||
1129 | connect(menu, &QMenu::aboutToShow, | 1136 | connect(menu, &QMenu::aboutToShow, | ||
1130 | this, &DolphinMainWindow::updateNewMenu); | 1137 | this, &DolphinMainWindow::updateNewMenu); | ||
1131 | 1138 | | |||
1132 | QAction* newWindow = KStandardAction::openNew(this, &DolphinMainWindow::openNewMainWindow, actionCollection()); | 1139 | QAction* newWindow = KStandardAction::openNew(this, &DolphinMainWindow::openNewMainWindow, actionCollection()); | ||
1133 | newWindow->setText(i18nc("@action:inmenu File", "New &Window")); | 1140 | newWindow->setText(i18nc("@action:inmenu File", "New &Window")); | ||
1141 | newWindow->setWhatsThis(xi18nc("@info:whatsthis", "This opens a new " | ||||
1142 | "window just like this one with the current location and view." | ||||
1143 | "<nl/>You can drag and drop items between windows.")); | ||||
1134 | newWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new"))); | 1144 | newWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new"))); | ||
1135 | 1145 | | |||
1136 | QAction* newTab = actionCollection()->addAction(QStringLiteral("new_tab")); | 1146 | QAction* newTab = actionCollection()->addAction(QStringLiteral("new_tab")); | ||
1137 | newTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-new"))); | 1147 | newTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-new"))); | ||
1138 | newTab->setText(i18nc("@action:inmenu File", "New Tab")); | 1148 | newTab->setText(i18nc("@action:inmenu File", "New Tab")); | ||
1149 | newTab->setWhatsThis(xi18nc("@info:whatsthis", "This opens a new " | ||||
1150 | "<emphasis>Tab</emphasis> with the current location and view.<nl/>" | ||||
1151 | "A tab is an additional view within this window. " | ||||
1152 | "You can drag and drop items between tabs.")); | ||||
1139 | actionCollection()->setDefaultShortcuts(newTab, {Qt::CTRL + Qt::Key_T, Qt::CTRL + Qt::SHIFT + Qt::Key_N}); | 1153 | actionCollection()->setDefaultShortcuts(newTab, {Qt::CTRL + Qt::Key_T, Qt::CTRL + Qt::SHIFT + Qt::Key_N}); | ||
1140 | connect(newTab, &QAction::triggered, this, &DolphinMainWindow::openNewActivatedTab); | 1154 | connect(newTab, &QAction::triggered, this, &DolphinMainWindow::openNewActivatedTab); | ||
1141 | 1155 | | |||
elvisangelaccio: Please add `const` | |||||
1142 | QAction* closeTab = KStandardAction::close(m_tabWidget, QOverload<>::of(&DolphinTabWidget::closeTab), actionCollection()); | 1156 | QAction* closeTab = KStandardAction::close(m_tabWidget, QOverload<>::of(&DolphinTabWidget::closeTab), actionCollection()); | ||
1143 | closeTab->setText(i18nc("@action:inmenu File", "Close Tab")); | 1157 | closeTab->setText(i18nc("@action:inmenu File", "Close Tab")); | ||
1158 | closeTab->setWhatsThis(i18nc("@info:whatsthis", "This closes the " | ||||
1159 | "currently viewed tab. If no more tabs are left this window " | ||||
1160 | "will close instead.")); | ||||
1144 | 1161 | | |||
Please call it cutAction. (I know we use paste below for the paste action, but that's old code). elvisangelaccio: Please call it `cutAction`. (I know we use `paste` below for the paste action, but that's old… | |||||
1145 | KStandardAction::quit(this, &DolphinMainWindow::quit, actionCollection()); | 1162 | QAction* quitAction = KStandardAction::quit(this, &DolphinMainWindow::quit, actionCollection()); | ||
1163 | quitAction->setWhatsThis(i18nc("@info:whatsthis quit", "This closes this window.")); | ||||
1146 | 1164 | | |||
1147 | // setup 'Edit' menu | 1165 | // setup 'Edit' menu | ||
1148 | KStandardAction::undo(this, | 1166 | KStandardAction::undo(this, | ||
1149 | &DolphinMainWindow::undo, | 1167 | &DolphinMainWindow::undo, | ||
elvisangelaccio: Please call it `copyAction`. | |||||
1150 | actionCollection()); | 1168 | actionCollection()); | ||
1151 | 1169 | | |||
1152 | 1170 | // i18n: This will be the last paragraph for the whatsthis for all three: | |||
1153 | KStandardAction::cut(this, &DolphinMainWindow::cut, actionCollection()); | 1171 | // Cut, Copy and Paste | ||
1154 | KStandardAction::copy(this, &DolphinMainWindow::copy, actionCollection()); | 1172 | const QString cutCopyPastePara = xi18nc("@info:whatsthis", "<para><emphasis>Cut, " | ||
1173 | "Copy</emphasis> and <emphasis>Paste</emphasis> work between many " | ||||
1174 | "applications and are among the most used commands. That's why their " | ||||
1175 | "<emphasis>keyboard shortcuts</emphasis> are prominently placed right " | ||||
1176 | "next to each other on the keyboard: <shortcut>Ctrl+X</shortcut>, " | ||||
1177 | "<shortcut>Ctrl+C</shortcut> and <shortcut>Ctrl+V</shortcut>.</para>"); | ||||
1178 | QAction* cutAction = KStandardAction::cut(this, &DolphinMainWindow::cut, actionCollection()); | ||||
1179 | cutAction->setWhatsThis(xi18nc("@info:whatsthis cut", "This copies the items " | ||||
1180 | "in your current selection to the <emphasis>clipboard</emphasis>.<nl/>" | ||||
1181 | "Use the <emphasis>Paste</emphasis> action afterwards to copy them from " | ||||
1182 | "the clipboard to a new location. The items will be removed from their " | ||||
elvisangelaccio: Please call it `findAction`. | |||||
1183 | "initial location.") + cutCopyPastePara); | ||||
1184 | QAction* copyAction = KStandardAction::copy(this, &DolphinMainWindow::copy, actionCollection()); | ||||
1185 | copyAction->setWhatsThis(xi18nc("@info:whatsthis copy", "This copies the " | ||||
1186 | "items in your current selection to the <emphasis>clipboard</emphasis>." | ||||
1187 | "<nl/>Use the <emphasis>Paste</emphasis> action afterwards to copy them " | ||||
1188 | "from the clipboard to a new location.") + cutCopyPastePara); | ||||
1155 | QAction* paste = KStandardAction::paste(this, &DolphinMainWindow::paste, actionCollection()); | 1189 | QAction* paste = KStandardAction::paste(this, &DolphinMainWindow::paste, actionCollection()); | ||
1156 | // The text of the paste-action is modified dynamically by Dolphin | 1190 | // The text of the paste-action is modified dynamically by Dolphin | ||
1157 | // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes | 1191 | // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes | ||
elvisangelaccio: Please call it `selectAllAction`. | |||||
1158 | // due to the long text, the text "Paste" is used: | 1192 | // due to the long text, the text "Paste" is used: | ||
1159 | paste->setIconText(i18nc("@action:inmenu Edit", "Paste")); | 1193 | paste->setIconText(i18nc("@action:inmenu Edit", "Paste")); | ||
1194 | paste->setWhatsThis(xi18nc("@info:whatsthis paste", "This copies the items from " | ||||
1195 | "your <emphasis>clipboard</emphasis> to the currently viewed folder.<nl/>" | ||||
1196 | "If the items were added to the clipboard by the <emphasis>Cut</emphasis> " | ||||
1197 | "action they are removed from their old location.") + cutCopyPastePara); | ||||
1160 | 1198 | | |||
1161 | QAction *searchAction = KStandardAction::find(this, &DolphinMainWindow::find, actionCollection()); | 1199 | QAction *searchAction = KStandardAction::find(this, &DolphinMainWindow::find, actionCollection()); | ||
1162 | searchAction->setText(i18n("Search...")); | 1200 | searchAction->setText(i18n("Search...")); | ||
1163 | 1201 | searchAction->setToolTip(i18nc("@info:tooltip", "Search for files and folders")); | |||
1164 | KStandardAction::selectAll(this, &DolphinMainWindow::selectAll, actionCollection()); | 1202 | searchAction->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This helps you " | ||
1203 | "find files and folders by opening a <emphasis>find bar</emphasis>. " | ||||
1204 | "There you can enter search terms and specify settings to find the " | ||||
1205 | "objects you are looking for.</para><para>Use this help again on " | ||||
1206 | "the find bar so we can have a look at it while the settings are " | ||||
1207 | "explained.</para>")); | ||||
1208 | | ||||
1209 | QAction* selectAllAction = KStandardAction::selectAll(this, &DolphinMainWindow::selectAll, actionCollection()); | ||||
1210 | selectAllAction->setWhatsThis(xi18nc("@info:whatsthis", "This selects all " | ||||
1211 | "files and folders in the current location.")); | ||||
1165 | 1212 | | |||
1166 | QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection")); | 1213 | QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection")); | ||
1167 | invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection")); | 1214 | invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection")); | ||
1215 | invertSelection->setWhatsThis(xi18nc("@info:whatsthis invert", "This selects all " | ||||
1216 | "objects that you have currently <emphasis>not</emphasis> selected instead.")); | ||||
1168 | invertSelection->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-invert"))); | 1217 | invertSelection->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-invert"))); | ||
1169 | actionCollection()->setDefaultShortcut(invertSelection, Qt::CTRL + Qt::SHIFT + Qt::Key_A); | 1218 | actionCollection()->setDefaultShortcut(invertSelection, Qt::CTRL + Qt::SHIFT + Qt::Key_A); | ||
1170 | connect(invertSelection, &QAction::triggered, this, &DolphinMainWindow::invertSelection); | 1219 | connect(invertSelection, &QAction::triggered, this, &DolphinMainWindow::invertSelection); | ||
1171 | 1220 | | |||
1172 | // setup 'View' menu | 1221 | // setup 'View' menu | ||
1173 | // (note that most of it is set up in DolphinViewActionHandler) | 1222 | // (note that most of it is set up in DolphinViewActionHandler) | ||
1174 | 1223 | | |||
1175 | QAction* split = actionCollection()->addAction(QStringLiteral("split_view")); | 1224 | QAction* split = actionCollection()->addAction(QStringLiteral("split_view")); | ||
1225 | split->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This splits " | ||||
1226 | "the folder view below into two autonomous views.</para><para>This " | ||||
1227 | "way you can see two locations at once and move items between them " | ||||
1228 | "quickly.</para>Click this again afterwards to recombine the views.")); | ||||
1176 | actionCollection()->setDefaultShortcut(split, Qt::Key_F3); | 1229 | actionCollection()->setDefaultShortcut(split, Qt::Key_F3); | ||
1177 | connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView); | 1230 | connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView); | ||
1178 | 1231 | | |||
1179 | QAction* stashSplit = actionCollection()->addAction(QStringLiteral("split_stash")); | 1232 | QAction* stashSplit = actionCollection()->addAction(QStringLiteral("split_stash")); | ||
1180 | actionCollection()->setDefaultShortcut(stashSplit, Qt::CTRL + Qt::Key_S); | 1233 | actionCollection()->setDefaultShortcut(stashSplit, Qt::CTRL + Qt::Key_S); | ||
1181 | stashSplit->setText(i18nc("@action:intoolbar Stash", "Stash")); | 1234 | stashSplit->setText(i18nc("@action:intoolbar Stash", "Stash")); | ||
1182 | stashSplit->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window")); | 1235 | stashSplit->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window")); | ||
1183 | stashSplit->setIcon(QIcon::fromTheme(QStringLiteral("folder-stash"))); | 1236 | stashSplit->setIcon(QIcon::fromTheme(QStringLiteral("folder-stash"))); | ||
1184 | stashSplit->setCheckable(false); | 1237 | stashSplit->setCheckable(false); | ||
1185 | stashSplit->setVisible(KProtocolInfo::isKnownProtocol("stash")); | 1238 | stashSplit->setVisible(KProtocolInfo::isKnownProtocol("stash")); | ||
1186 | connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash); | 1239 | connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash); | ||
1187 | 1240 | | |||
1188 | KStandardAction::redisplay(this, &DolphinMainWindow::reloadView, actionCollection()); | 1241 | KStandardAction::redisplay(this, &DolphinMainWindow::reloadView, actionCollection()); | ||
1189 | 1242 | | |||
1190 | QAction* stop = actionCollection()->addAction(QStringLiteral("stop")); | 1243 | QAction* stop = actionCollection()->addAction(QStringLiteral("stop")); | ||
1191 | stop->setText(i18nc("@action:inmenu View", "Stop")); | 1244 | stop->setText(i18nc("@action:inmenu View", "Stop")); | ||
1192 | stop->setToolTip(i18nc("@info", "Stop loading")); | 1245 | stop->setToolTip(i18nc("@info", "Stop loading")); | ||
1246 | stop->setWhatsThis(i18nc("@info", "This stops the loading of the contents of the current folder.")); | ||||
1193 | stop->setIcon(QIcon::fromTheme(QStringLiteral("process-stop"))); | 1247 | stop->setIcon(QIcon::fromTheme(QStringLiteral("process-stop"))); | ||
1194 | connect(stop, &QAction::triggered, this, &DolphinMainWindow::stopLoading); | 1248 | connect(stop, &QAction::triggered, this, &DolphinMainWindow::stopLoading); | ||
1195 | 1249 | | |||
1196 | KToggleAction* editableLocation = actionCollection()->add<KToggleAction>(QStringLiteral("editable_location")); | 1250 | KToggleAction* editableLocation = actionCollection()->add<KToggleAction>(QStringLiteral("editable_location")); | ||
1197 | editableLocation->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location")); | 1251 | editableLocation->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location")); | ||
1252 | editableLocation->setWhatsThis(xi18nc("@info:whatsthis", | ||||
1253 | "This toggles the <emphasis>Location Bar</emphasis> to be " | ||||
1254 | "editable so you can directly enter a location you want to go to.<nl/>" | ||||
1255 | "You can also switch to editing by clicking to the right of the " | ||||
1256 | "location and switch back by confirming the edited location.")); | ||||
1198 | actionCollection()->setDefaultShortcut(editableLocation, Qt::Key_F6); | 1257 | actionCollection()->setDefaultShortcut(editableLocation, Qt::Key_F6); | ||
1199 | connect(editableLocation, &KToggleAction::triggered, this, &DolphinMainWindow::toggleEditLocation); | 1258 | connect(editableLocation, &KToggleAction::triggered, this, &DolphinMainWindow::toggleEditLocation); | ||
1200 | 1259 | | |||
1201 | QAction* replaceLocation = actionCollection()->addAction(QStringLiteral("replace_location")); | 1260 | QAction* replaceLocation = actionCollection()->addAction(QStringLiteral("replace_location")); | ||
1202 | replaceLocation->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location")); | 1261 | replaceLocation->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location")); | ||
1262 | // i18n: "enter" is used both in the meaning of "writing" and "going to" a new location here. | ||||
1263 | // Both meanings are useful but not necessary to understand the use of "Replace Location". | ||||
1264 | // So you might want to be more verbose in your language to convey the meaning but it's up to you. | ||||
1265 | replaceLocation->setWhatsThis(xi18nc("@info:whatsthis", | ||||
1266 | "This switches to editing the location and selects it " | ||||
1267 | "so you can quickly enter a different location.")); | ||||
1203 | actionCollection()->setDefaultShortcut(replaceLocation, Qt::CTRL + Qt::Key_L); | 1268 | actionCollection()->setDefaultShortcut(replaceLocation, Qt::CTRL + Qt::Key_L); | ||
1204 | connect(replaceLocation, &QAction::triggered, this, &DolphinMainWindow::replaceLocation); | 1269 | connect(replaceLocation, &QAction::triggered, this, &DolphinMainWindow::replaceLocation); | ||
1205 | 1270 | | |||
1206 | // setup 'Go' menu | 1271 | // setup 'Go' menu | ||
1207 | QAction* backAction = KStandardAction::back(this, &DolphinMainWindow::goBack, actionCollection()); | 1272 | QAction* backAction = KStandardAction::back(this, &DolphinMainWindow::goBack, actionCollection()); | ||
1208 | auto backShortcuts = backAction->shortcuts(); | 1273 | auto backShortcuts = backAction->shortcuts(); | ||
1209 | backShortcuts.append(QKeySequence(Qt::Key_Backspace)); | 1274 | backShortcuts.append(QKeySequence(Qt::Key_Backspace)); | ||
1210 | actionCollection()->setDefaultShortcuts(backAction, backShortcuts); | 1275 | actionCollection()->setDefaultShortcuts(backAction, backShortcuts); | ||
1211 | 1276 | | |||
1212 | DolphinRecentTabsMenu* recentTabsMenu = new DolphinRecentTabsMenu(this); | 1277 | DolphinRecentTabsMenu* recentTabsMenu = new DolphinRecentTabsMenu(this); | ||
1213 | actionCollection()->addAction(QStringLiteral("closed_tabs"), recentTabsMenu); | 1278 | actionCollection()->addAction(QStringLiteral("closed_tabs"), recentTabsMenu); | ||
1214 | connect(m_tabWidget, &DolphinTabWidget::rememberClosedTab, | 1279 | connect(m_tabWidget, &DolphinTabWidget::rememberClosedTab, | ||
1215 | recentTabsMenu, &DolphinRecentTabsMenu::rememberClosedTab); | 1280 | recentTabsMenu, &DolphinRecentTabsMenu::rememberClosedTab); | ||
1216 | connect(recentTabsMenu, &DolphinRecentTabsMenu::restoreClosedTab, | 1281 | connect(recentTabsMenu, &DolphinRecentTabsMenu::restoreClosedTab, | ||
1217 | m_tabWidget, &DolphinTabWidget::restoreClosedTab); | 1282 | m_tabWidget, &DolphinTabWidget::restoreClosedTab); | ||
1218 | connect(recentTabsMenu, &DolphinRecentTabsMenu::closedTabsCountChanged, | 1283 | connect(recentTabsMenu, &DolphinRecentTabsMenu::closedTabsCountChanged, | ||
1219 | this, &DolphinMainWindow::closedTabsCountChanged); | 1284 | this, &DolphinMainWindow::closedTabsCountChanged); | ||
1220 | 1285 | | |||
1221 | QAction* undoCloseTab = actionCollection()->addAction(QStringLiteral("undo_close_tab")); | 1286 | QAction* undoCloseTab = actionCollection()->addAction(QStringLiteral("undo_close_tab")); | ||
1222 | undoCloseTab->setText(i18nc("@action:inmenu File", "Undo close tab")); | 1287 | undoCloseTab->setText(i18nc("@action:inmenu File", "Undo close tab")); | ||
1288 | undoCloseTab->setWhatsThis(i18nc("@info:whatsthis undo close tab", | ||||
1289 | "This returns you to the previously closed tab.")); | ||||
1223 | actionCollection()->setDefaultShortcut(undoCloseTab, Qt::CTRL + Qt::SHIFT + Qt::Key_T); | 1290 | actionCollection()->setDefaultShortcut(undoCloseTab, Qt::CTRL + Qt::SHIFT + Qt::Key_T); | ||
1224 | undoCloseTab->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo"))); | 1291 | undoCloseTab->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo"))); | ||
1225 | undoCloseTab->setEnabled(false); | 1292 | undoCloseTab->setEnabled(false); | ||
1226 | connect(undoCloseTab, &QAction::triggered, recentTabsMenu, &DolphinRecentTabsMenu::undoCloseTab); | 1293 | connect(undoCloseTab, &QAction::triggered, recentTabsMenu, &DolphinRecentTabsMenu::undoCloseTab); | ||
1227 | 1294 | | |||
1228 | auto undoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Undo)); | 1295 | auto undoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Undo)); | ||
1296 | undoAction->setWhatsThis(xi18nc("@info:whatsthis", "This undoes " | ||||
1297 | "the last change you made to files or folders.<nl/>" | ||||
1298 | "Such changes include <interface>creating, renaming</interface> " | ||||
1299 | "and <interface>moving</interface> them to a different location " | ||||
1300 | "or to the <filename>Trash</filename>. <nl/>Changes that can't " | ||||
1301 | "be undone will ask for your confirmation.")); | ||||
1229 | undoAction->setEnabled(false); // undo should be disabled by default | 1302 | undoAction->setEnabled(false); // undo should be disabled by default | ||
1230 | 1303 | | |||
1231 | KStandardAction::forward(this, &DolphinMainWindow::goForward, actionCollection()); | 1304 | KStandardAction::forward(this, &DolphinMainWindow::goForward, actionCollection()); | ||
1232 | KStandardAction::up(this, &DolphinMainWindow::goUp, actionCollection()); | 1305 | KStandardAction::up(this, &DolphinMainWindow::goUp, actionCollection()); | ||
1233 | KStandardAction::home(this, &DolphinMainWindow::goHome, actionCollection()); | 1306 | QAction* homeAction = KStandardAction::home(this, &DolphinMainWindow::goHome, actionCollection()); | ||
1307 | homeAction->setWhatsThis(xi18nc("@info:whatsthis", "Go to your " | ||||
1308 | "<filename>Home</filename> folder.<nl/>Every user account " | ||||
1309 | "has their own <filename>Home</filename> that contains their data " | ||||
1310 | "including folders that contain personal application data.")); | ||||
1234 | 1311 | | |||
1235 | // setup 'Tools' menu | 1312 | // setup 'Tools' menu | ||
1236 | QAction* showFilterBar = actionCollection()->addAction(QStringLiteral("show_filter_bar")); | 1313 | QAction* showFilterBar = actionCollection()->addAction(QStringLiteral("show_filter_bar")); | ||
1237 | showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar")); | 1314 | showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar")); | ||
1315 | showFilterBar->setWhatsThis(xi18nc("@info:whatsthis", "This opens the " | ||||
1316 | "<emphasis>Filter Bar</emphasis> at the bottom of the window.<nl/> " | ||||
1317 | "There you can enter a text to filter the files and folders currently displayed. " | ||||
1318 | "Only those that contain the text in their name will be kept in view.")); | ||||
1238 | showFilterBar->setIcon(QIcon::fromTheme(QStringLiteral("view-filter"))); | 1319 | showFilterBar->setIcon(QIcon::fromTheme(QStringLiteral("view-filter"))); | ||
1239 | actionCollection()->setDefaultShortcuts(showFilterBar, {Qt::CTRL + Qt::Key_I, Qt::Key_Slash}); | 1320 | actionCollection()->setDefaultShortcuts(showFilterBar, {Qt::CTRL + Qt::Key_I, Qt::Key_Slash}); | ||
1240 | connect(showFilterBar, &QAction::triggered, this, &DolphinMainWindow::showFilterBar); | 1321 | connect(showFilterBar, &QAction::triggered, this, &DolphinMainWindow::showFilterBar); | ||
1241 | 1322 | | |||
1242 | QAction* compareFiles = actionCollection()->addAction(QStringLiteral("compare_files")); | 1323 | QAction* compareFiles = actionCollection()->addAction(QStringLiteral("compare_files")); | ||
1243 | compareFiles->setText(i18nc("@action:inmenu Tools", "Compare Files")); | 1324 | compareFiles->setText(i18nc("@action:inmenu Tools", "Compare Files")); | ||
1244 | compareFiles->setIcon(QIcon::fromTheme(QStringLiteral("kompare"))); | 1325 | compareFiles->setIcon(QIcon::fromTheme(QStringLiteral("kompare"))); | ||
1245 | compareFiles->setEnabled(false); | 1326 | compareFiles->setEnabled(false); | ||
1246 | connect(compareFiles, &QAction::triggered, this, &DolphinMainWindow::compareFiles); | 1327 | connect(compareFiles, &QAction::triggered, this, &DolphinMainWindow::compareFiles); | ||
1247 | 1328 | | |||
1248 | #ifdef HAVE_TERMINAL | 1329 | #ifdef HAVE_TERMINAL | ||
1249 | if (KAuthorized::authorize(QStringLiteral("shell_access"))) { | 1330 | if (KAuthorized::authorize(QStringLiteral("shell_access"))) { | ||
1250 | QAction* openTerminal = actionCollection()->addAction(QStringLiteral("open_terminal")); | 1331 | QAction* openTerminal = actionCollection()->addAction(QStringLiteral("open_terminal")); | ||
1251 | openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal")); | 1332 | openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal")); | ||
1333 | openTerminal->setWhatsThis(xi18nc("@info:whatsthis", | ||||
1334 | "<para>This opens a <emphasis>terminal</emphasis> application for the viewed location.</para>" | ||||
1335 | "<para>To learn more about terminals use the help in the terminal application.</para>")); | ||||
1252 | openTerminal->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal"))); | 1336 | openTerminal->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal"))); | ||
1253 | actionCollection()->setDefaultShortcut(openTerminal, Qt::SHIFT + Qt::Key_F4); | 1337 | actionCollection()->setDefaultShortcut(openTerminal, Qt::SHIFT + Qt::Key_F4); | ||
1254 | connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal); | 1338 | connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal); | ||
1255 | } | 1339 | } | ||
1256 | #endif | 1340 | #endif | ||
1257 | 1341 | | |||
1258 | // setup 'Bookmarks' menu | 1342 | // setup 'Bookmarks' menu | ||
1259 | KActionMenu *bookmarkMenu = new KActionMenu(i18nc("@title:menu", "&Bookmarks"), this); | 1343 | KActionMenu *bookmarkMenu = new KActionMenu(i18nc("@title:menu", "&Bookmarks"), this); | ||
1260 | m_bookmarkHandler = new DolphinBookmarkHandler(this, actionCollection(), bookmarkMenu->menu(), this); | 1344 | m_bookmarkHandler = new DolphinBookmarkHandler(this, actionCollection(), bookmarkMenu->menu(), this); | ||
1261 | actionCollection()->addAction(QStringLiteral("bookmarks"), bookmarkMenu); | 1345 | actionCollection()->addAction(QStringLiteral("bookmarks"), bookmarkMenu); | ||
1262 | 1346 | | |||
1263 | // setup 'Settings' menu | 1347 | // setup 'Settings' menu | ||
1264 | KToggleAction* showMenuBar = KStandardAction::showMenubar(nullptr, nullptr, actionCollection()); | 1348 | KToggleAction* showMenuBar = KStandardAction::showMenubar(nullptr, nullptr, actionCollection()); | ||
1349 | showMenuBar->setWhatsThis(xi18nc("@info:whatsthis", | ||||
1350 | "This switches between having a <emphasis>Menubar</emphasis> " | ||||
1351 | "and having a <interface>Control</interface> button. Both " | ||||
1352 | "contain mostly the same commands and configuration options.")); | ||||
1265 | connect(showMenuBar, &KToggleAction::triggered, // Fixes #286822 | 1353 | connect(showMenuBar, &KToggleAction::triggered, // Fixes #286822 | ||
1266 | this, &DolphinMainWindow::toggleShowMenuBar, Qt::QueuedConnection); | 1354 | this, &DolphinMainWindow::toggleShowMenuBar, Qt::QueuedConnection); | ||
1267 | KStandardAction::preferences(this, &DolphinMainWindow::editSettings, actionCollection()); | 1355 | KStandardAction::preferences(this, &DolphinMainWindow::editSettings, actionCollection()); | ||
1268 | 1356 | | |||
1357 | // setup 'Help' menu for the m_controlButton. The other one is set up in the base class. | ||||
1358 | m_helpMenu = new KHelpMenu(nullptr); | ||||
1359 | m_helpMenu->menu()->installEventFilter(this); | ||||
1360 | // remove duplicate shortcuts | ||||
1361 | m_helpMenu->action(KHelpMenu::menuHelpContents)->setShortcut(QKeySequence()); | ||||
1362 | m_helpMenu->action(KHelpMenu::menuWhatsThis)->setShortcut(QKeySequence()); | ||||
1363 | | ||||
1269 | // not in menu actions | 1364 | // not in menu actions | ||
1270 | QList<QKeySequence> nextTabKeys = KStandardShortcut::tabNext(); | 1365 | QList<QKeySequence> nextTabKeys = KStandardShortcut::tabNext(); | ||
1271 | nextTabKeys.append(QKeySequence(Qt::CTRL + Qt::Key_Tab)); | 1366 | nextTabKeys.append(QKeySequence(Qt::CTRL + Qt::Key_Tab)); | ||
1272 | 1367 | | |||
1273 | QList<QKeySequence> prevTabKeys = KStandardShortcut::tabPrev(); | 1368 | QList<QKeySequence> prevTabKeys = KStandardShortcut::tabPrev(); | ||
1274 | prevTabKeys.append(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab)); | 1369 | prevTabKeys.append(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab)); | ||
1275 | 1370 | | |||
1276 | QAction* activateNextTab = actionCollection()->addAction(QStringLiteral("activate_next_tab")); | 1371 | QAction* activateNextTab = actionCollection()->addAction(QStringLiteral("activate_next_tab")); | ||
Show All 37 Lines | |||||
1314 | { | 1409 | { | ||
1315 | const bool lock = GeneralSettings::lockPanels(); | 1410 | const bool lock = GeneralSettings::lockPanels(); | ||
1316 | 1411 | | |||
1317 | KDualAction* lockLayoutAction = actionCollection()->add<KDualAction>(QStringLiteral("lock_panels")); | 1412 | KDualAction* lockLayoutAction = actionCollection()->add<KDualAction>(QStringLiteral("lock_panels")); | ||
1318 | lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels")); | 1413 | lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels")); | ||
1319 | lockLayoutAction->setActiveIcon(QIcon::fromTheme(QStringLiteral("object-unlocked"))); | 1414 | lockLayoutAction->setActiveIcon(QIcon::fromTheme(QStringLiteral("object-unlocked"))); | ||
1320 | lockLayoutAction->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels")); | 1415 | lockLayoutAction->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels")); | ||
1321 | lockLayoutAction->setInactiveIcon(QIcon::fromTheme(QStringLiteral("object-locked"))); | 1416 | lockLayoutAction->setInactiveIcon(QIcon::fromTheme(QStringLiteral("object-locked"))); | ||
1417 | lockLayoutAction->setWhatsThis(xi18nc("@info:whatsthis", "This " | ||||
1418 | "switches between having panels <emphasis>locked</emphasis> or " | ||||
1419 | "<emphasis>unlocked</emphasis>.<nl/>Unlocked panels can be " | ||||
1420 | "dragged to the other side of the window and have a close " | ||||
1421 | "button.<nl/>Locked panels are embedded more cleanly.")); | ||||
1322 | lockLayoutAction->setActive(lock); | 1422 | lockLayoutAction->setActive(lock); | ||
1323 | connect(lockLayoutAction, &KDualAction::triggered, this, &DolphinMainWindow::togglePanelLockState); | 1423 | connect(lockLayoutAction, &KDualAction::triggered, this, &DolphinMainWindow::togglePanelLockState); | ||
1324 | 1424 | | |||
1325 | // Setup "Information" | 1425 | // Setup "Information" | ||
1326 | DolphinDockWidget* infoDock = new DolphinDockWidget(i18nc("@title:window", "Information")); | 1426 | DolphinDockWidget* infoDock = new DolphinDockWidget(i18nc("@title:window", "Information")); | ||
1327 | infoDock->setLocked(lock); | 1427 | infoDock->setLocked(lock); | ||
elvisangelaccio: Please add `const` | |||||
1328 | infoDock->setObjectName(QStringLiteral("infoDock")); | 1428 | infoDock->setObjectName(QStringLiteral("infoDock")); | ||
1329 | infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); | 1429 | infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); | ||
1330 | 1430 | | |||
1331 | #ifdef HAVE_BALOO | 1431 | #ifdef HAVE_BALOO | ||
1332 | InformationPanel* infoPanel = new InformationPanel(infoDock); | 1432 | InformationPanel* infoPanel = new InformationPanel(infoDock); | ||
1333 | infoPanel->setCustomContextMenuActions({lockLayoutAction}); | 1433 | infoPanel->setCustomContextMenuActions({lockLayoutAction}); | ||
yurchor: Typo: informations -> information | |||||
1334 | connect(infoPanel, &InformationPanel::urlActivated, this, &DolphinMainWindow::handleUrl); | 1434 | connect(infoPanel, &InformationPanel::urlActivated, this, &DolphinMainWindow::handleUrl); | ||
1335 | infoDock->setWidget(infoPanel); | 1435 | infoDock->setWidget(infoPanel); | ||
1336 | 1436 | | |||
1337 | QAction* infoAction = infoDock->toggleViewAction(); | 1437 | QAction* infoAction = infoDock->toggleViewAction(); | ||
1338 | createPanelAction(QIcon::fromTheme(QStringLiteral("dialog-information")), Qt::Key_F11, infoAction, QStringLiteral("show_information_panel")); | 1438 | createPanelAction(QIcon::fromTheme(QStringLiteral("dialog-information")), Qt::Key_F11, infoAction, QStringLiteral("show_information_panel")); | ||
yurchor: Typo: informations -> information | |||||
1339 | 1439 | | |||
1340 | addDockWidget(Qt::RightDockWidgetArea, infoDock); | 1440 | addDockWidget(Qt::RightDockWidgetArea, infoDock); | ||
1341 | connect(this, &DolphinMainWindow::urlChanged, | 1441 | connect(this, &DolphinMainWindow::urlChanged, | ||
1342 | infoPanel, &InformationPanel::setUrl); | 1442 | infoPanel, &InformationPanel::setUrl); | ||
1343 | connect(this, &DolphinMainWindow::selectionChanged, | 1443 | connect(this, &DolphinMainWindow::selectionChanged, | ||
1344 | infoPanel, &InformationPanel::setSelection); | 1444 | infoPanel, &InformationPanel::setSelection); | ||
1345 | connect(this, &DolphinMainWindow::requestItemInfo, | 1445 | connect(this, &DolphinMainWindow::requestItemInfo, | ||
1346 | infoPanel, &InformationPanel::requestDelayedItemInfo); | 1446 | infoPanel, &InformationPanel::requestDelayedItemInfo); | ||
1347 | #endif | 1447 | #endif | ||
1348 | 1448 | | |||
1449 | // i18n: This is the last paragraph for the "What's This"-texts of all four panels. | ||||
1450 | const QString panelWhatsThis = xi18nc("@info:whatsthis", "<para>To show or " | ||||
1451 | "hide panels like this go to <interface>Control|Panels</interface> " | ||||
1452 | "or <interface>View|Panels</interface>.</para>"); | ||||
1453 | actionCollection()->action(QStringLiteral("show_information_panel")) | ||||
Crashes here for me. The action looks like it's only added when you have #if HAVE_BALOO broulik: Crashes here for me. The action looks like it's only added when you have `#if HAVE_BALOO` | |||||
broulik: Fixed it https://cgit.kde.org/dolphin.git/commit/?id=5d83ceeb339c56e6b9a241e809cff2dd0a260fcb | |||||
1454 | ->setWhatsThis(xi18nc("@info:whatsthis", "<para> This toggles the " | ||||
1455 | "<emphasis>information</emphasis> panel at the right side of the " | ||||
1456 | "window.</para><para>The panel provides in-depth information " | ||||
1457 | "about the items your mouse is hovering over or about the selected " | ||||
1458 | "items. Otherwise it informs you about the currently viewed folder.<nl/>" | ||||
1459 | "For single items a preview of their contents is provided.</para>")); | ||||
1460 | infoDock->setWhatsThis(xi18nc("@info:whatsthis", "<para>This panel " | ||||
1461 | "provides in-depth information about the items your mouse is " | ||||
1462 | "hovering over or about the selected items. Otherwise it informs " | ||||
1463 | "you about the currently viewed folder.<nl/>For single items a " | ||||
1464 | "preview of their contents is provided.</para><para>You can configure " | ||||
1465 | "which and how details are given here by right-clicking.</para>") + panelWhatsThis); | ||||
1466 | | ||||
1349 | // Setup "Folders" | 1467 | // Setup "Folders" | ||
1350 | DolphinDockWidget* foldersDock = new DolphinDockWidget(i18nc("@title:window", "Folders")); | 1468 | DolphinDockWidget* foldersDock = new DolphinDockWidget(i18nc("@title:window", "Folders")); | ||
1351 | foldersDock->setLocked(lock); | 1469 | foldersDock->setLocked(lock); | ||
1352 | foldersDock->setObjectName(QStringLiteral("foldersDock")); | 1470 | foldersDock->setObjectName(QStringLiteral("foldersDock")); | ||
1353 | foldersDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); | 1471 | foldersDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); | ||
1354 | FoldersPanel* foldersPanel = new FoldersPanel(foldersDock); | 1472 | FoldersPanel* foldersPanel = new FoldersPanel(foldersDock); | ||
1355 | foldersPanel->setCustomContextMenuActions({lockLayoutAction}); | 1473 | foldersPanel->setCustomContextMenuActions({lockLayoutAction}); | ||
1356 | foldersDock->setWidget(foldersPanel); | 1474 | foldersDock->setWidget(foldersPanel); | ||
1357 | 1475 | | |||
1358 | QAction* foldersAction = foldersDock->toggleViewAction(); | 1476 | QAction* foldersAction = foldersDock->toggleViewAction(); | ||
1359 | createPanelAction(QIcon::fromTheme(QStringLiteral("folder")), Qt::Key_F7, foldersAction, QStringLiteral("show_folders_panel")); | 1477 | createPanelAction(QIcon::fromTheme(QStringLiteral("folder")), Qt::Key_F7, foldersAction, QStringLiteral("show_folders_panel")); | ||
1360 | 1478 | | |||
1361 | addDockWidget(Qt::LeftDockWidgetArea, foldersDock); | 1479 | addDockWidget(Qt::LeftDockWidgetArea, foldersDock); | ||
1362 | connect(this, &DolphinMainWindow::urlChanged, | 1480 | connect(this, &DolphinMainWindow::urlChanged, | ||
1363 | foldersPanel, &FoldersPanel::setUrl); | 1481 | foldersPanel, &FoldersPanel::setUrl); | ||
1364 | connect(foldersPanel, &FoldersPanel::folderActivated, | 1482 | connect(foldersPanel, &FoldersPanel::folderActivated, | ||
1365 | this, &DolphinMainWindow::changeUrl); | 1483 | this, &DolphinMainWindow::changeUrl); | ||
1366 | connect(foldersPanel, &FoldersPanel::folderMiddleClicked, | 1484 | connect(foldersPanel, &FoldersPanel::folderMiddleClicked, | ||
1367 | this, &DolphinMainWindow::openNewTabAfterCurrentTab); | 1485 | this, &DolphinMainWindow::openNewTabAfterCurrentTab); | ||
1368 | connect(foldersPanel, &FoldersPanel::errorMessage, | 1486 | connect(foldersPanel, &FoldersPanel::errorMessage, | ||
1369 | this, &DolphinMainWindow::showErrorMessage); | 1487 | this, &DolphinMainWindow::showErrorMessage); | ||
1370 | 1488 | | |||
1489 | actionCollection()->action(QStringLiteral("show_folders_panel")) | ||||
1490 | ->setWhatsThis(xi18nc("@info:whatsthis", "This toggles the " | ||||
1491 | "<emphasis>folders</emphasis> panel at the left side of the window." | ||||
1492 | "<nl/><nl/>It shows the folders of the <emphasis>file system" | ||||
1493 | "</emphasis> in a <emphasis>tree view</emphasis>.")); | ||||
1494 | foldersDock->setWhatsThis(xi18nc("@info:whatsthis", "<para>This panel " | ||||
1495 | "shows the folders of the <emphasis>file system</emphasis> in a " | ||||
1496 | "<emphasis>tree view</emphasis>.</para><para>Click a folder to go " | ||||
1497 | "there. Click the arrow to the left of a folder to see its subfolders. " | ||||
1498 | "This allows quick switching between any folders.</para>") + panelWhatsThis); | ||||
1499 | | ||||
1371 | // Setup "Terminal" | 1500 | // Setup "Terminal" | ||
1372 | #ifdef HAVE_TERMINAL | 1501 | #ifdef HAVE_TERMINAL | ||
1373 | if (KAuthorized::authorize(QStringLiteral("shell_access"))) { | 1502 | if (KAuthorized::authorize(QStringLiteral("shell_access"))) { | ||
1374 | DolphinDockWidget* terminalDock = new DolphinDockWidget(i18nc("@title:window Shell terminal", "Terminal")); | 1503 | DolphinDockWidget* terminalDock = new DolphinDockWidget(i18nc("@title:window Shell terminal", "Terminal")); | ||
1375 | terminalDock->setLocked(lock); | 1504 | terminalDock->setLocked(lock); | ||
1376 | terminalDock->setObjectName(QStringLiteral("terminalDock")); | 1505 | terminalDock->setObjectName(QStringLiteral("terminalDock")); | ||
1377 | m_terminalPanel = new TerminalPanel(terminalDock); | 1506 | m_terminalPanel = new TerminalPanel(terminalDock); | ||
1378 | m_terminalPanel->setCustomContextMenuActions({lockLayoutAction}); | 1507 | m_terminalPanel->setCustomContextMenuActions({lockLayoutAction}); | ||
Show All 11 Lines | |||||
1390 | 1519 | | |||
1391 | addDockWidget(Qt::BottomDockWidgetArea, terminalDock); | 1520 | addDockWidget(Qt::BottomDockWidgetArea, terminalDock); | ||
1392 | connect(this, &DolphinMainWindow::urlChanged, | 1521 | connect(this, &DolphinMainWindow::urlChanged, | ||
1393 | m_terminalPanel, &TerminalPanel::setUrl); | 1522 | m_terminalPanel, &TerminalPanel::setUrl); | ||
1394 | 1523 | | |||
1395 | if (GeneralSettings::version() < 200) { | 1524 | if (GeneralSettings::version() < 200) { | ||
1396 | terminalDock->hide(); | 1525 | terminalDock->hide(); | ||
1397 | } | 1526 | } | ||
1527 | | ||||
1528 | actionCollection()->action(QStringLiteral("show_terminal_panel")) | ||||
1529 | ->setWhatsThis(xi18nc("@info:whatsthis", "<para>This toggles the " | ||||
1530 | "<emphasis>terminal</emphasis> panel at the bottom of the window." | ||||
1531 | "<nl/>The location in the terminal will always match the folder " | ||||
1532 | "view so you can navigate using either.</para><para>The terminal " | ||||
1533 | "panel is not needed for basic computer usage but can be useful " | ||||
1534 | "for advanced tasks. To learn more about terminals use the help " | ||||
1535 | "in a standalone terminal application like Konsole.</para>")); | ||||
1536 | terminalDock->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is " | ||||
1537 | "the <emphasis>terminal</emphasis> panel. It behaves like a " | ||||
1538 | "normal terminal but will match the location of the folder view " | ||||
1539 | "so you can navigate using either.</para><para>The terminal panel " | ||||
1540 | "is not needed for basic computer usage but can be useful for " | ||||
1541 | "advanced tasks. To learn more about terminals use the help in a " | ||||
1542 | "standalone terminal application like Konsole.</para>") + panelWhatsThis); | ||||
1398 | } | 1543 | } | ||
1399 | #endif | 1544 | #endif | ||
1400 | 1545 | | |||
1401 | if (GeneralSettings::version() < 200) { | 1546 | if (GeneralSettings::version() < 200) { | ||
1402 | infoDock->hide(); | 1547 | infoDock->hide(); | ||
1403 | foldersDock->hide(); | 1548 | foldersDock->hide(); | ||
1404 | } | 1549 | } | ||
1405 | 1550 | | |||
Show All 27 Lines | 1577 | connect(m_placesPanel, &PlacesPanel::storageTearDownRequested, | |||
1433 | this, &DolphinMainWindow::slotStorageTearDownFromPlacesRequested); | 1578 | this, &DolphinMainWindow::slotStorageTearDownFromPlacesRequested); | ||
1434 | connect(m_placesPanel, &PlacesPanel::storageTearDownExternallyRequested, | 1579 | connect(m_placesPanel, &PlacesPanel::storageTearDownExternallyRequested, | ||
1435 | this, &DolphinMainWindow::slotStorageTearDownExternallyRequested); | 1580 | this, &DolphinMainWindow::slotStorageTearDownExternallyRequested); | ||
1436 | m_tabWidget->slotPlacesPanelVisibilityChanged(m_placesPanel->isVisible()); | 1581 | m_tabWidget->slotPlacesPanelVisibilityChanged(m_placesPanel->isVisible()); | ||
1437 | 1582 | | |||
1438 | auto actionShowAllPlaces = new QAction(QIcon::fromTheme(QStringLiteral("hint")), i18nc("@item:inmenu", "Show Hidden Places"), this); | 1583 | auto actionShowAllPlaces = new QAction(QIcon::fromTheme(QStringLiteral("hint")), i18nc("@item:inmenu", "Show Hidden Places"), this); | ||
1439 | actionShowAllPlaces->setCheckable(true); | 1584 | actionShowAllPlaces->setCheckable(true); | ||
1440 | actionShowAllPlaces->setDisabled(true); | 1585 | actionShowAllPlaces->setDisabled(true); | ||
1586 | actionShowAllPlaces->setWhatsThis(i18nc("@info:whatsthis", "This displays " | ||||
1587 | "all places in the places panel that have been hidden. They will " | ||||
1588 | "appear semi-transparent unless you uncheck their hide property.")); | ||||
1441 | 1589 | | |||
1442 | connect(actionShowAllPlaces, &QAction::triggered, this, [actionShowAllPlaces, this](bool checked){ | 1590 | connect(actionShowAllPlaces, &QAction::triggered, this, [actionShowAllPlaces, this](bool checked){ | ||
1443 | actionShowAllPlaces->setIcon(QIcon::fromTheme(checked ? QStringLiteral("visibility") : QStringLiteral("hint"))); | 1591 | actionShowAllPlaces->setIcon(QIcon::fromTheme(checked ? QStringLiteral("visibility") : QStringLiteral("hint"))); | ||
1444 | m_placesPanel->showHiddenEntries(checked); | 1592 | m_placesPanel->showHiddenEntries(checked); | ||
1445 | }); | 1593 | }); | ||
1446 | 1594 | | |||
1447 | connect(m_placesPanel, &PlacesPanel::showHiddenEntriesChanged, this, [actionShowAllPlaces] (bool checked){ | 1595 | connect(m_placesPanel, &PlacesPanel::showHiddenEntriesChanged, this, [actionShowAllPlaces] (bool checked){ | ||
1448 | actionShowAllPlaces->setChecked(checked); | 1596 | actionShowAllPlaces->setChecked(checked); | ||
1449 | actionShowAllPlaces->setIcon(QIcon::fromTheme(checked ? QStringLiteral("visibility") : QStringLiteral("hint"))); | 1597 | actionShowAllPlaces->setIcon(QIcon::fromTheme(checked ? QStringLiteral("visibility") : QStringLiteral("hint"))); | ||
1450 | }); | 1598 | }); | ||
1451 | 1599 | | |||
1600 | actionCollection()->action(QStringLiteral("show_places_panel")) | ||||
1601 | ->setWhatsThis(xi18nc("@info:whatsthis", "<para>This toggles the " | ||||
1602 | "<emphasis>places</emphasis> panel at the left side of the window." | ||||
1603 | "</para><para>It allows you to go to locations you have " | ||||
1604 | "bookmarked and to access disk or media attached to the computer " | ||||
1605 | "or to the network. It also contains sections to find recently " | ||||
1606 | "saved files or files of a certain type.</para>")); | ||||
1607 | placesDock->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the " | ||||
1608 | "<emphasis>Places</emphasis> panel. It allows you to go to locations " | ||||
1609 | "you have bookmarked and to access disk or media attached to the " | ||||
1610 | "computer or to the network. It also contains sections to find " | ||||
1611 | "recently saved files or files of a certain type.</para><para>" | ||||
1612 | "Click on an entry to go there. Click with the right mouse button " | ||||
1613 | "instead to open any entry in a new tab or new window.</para>" | ||||
1614 | "<para>New entries can be added by dragging folders onto this panel. " | ||||
1615 | "Right-click any section or entry to hide it. Right-click an empty " | ||||
1616 | "space on this panel and select <interface>Show Hidden Places" | ||||
1617 | "</interface> to display it again.</para>") + panelWhatsThis); | ||||
1618 | | ||||
1452 | // Add actions into the "Panels" menu | 1619 | // Add actions into the "Panels" menu | ||
1453 | KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this); | 1620 | KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this); | ||
1454 | actionCollection()->addAction(QStringLiteral("panels"), panelsMenu); | 1621 | actionCollection()->addAction(QStringLiteral("panels"), panelsMenu); | ||
1455 | panelsMenu->setDelayed(false); | 1622 | panelsMenu->setDelayed(false); | ||
1456 | const KActionCollection* ac = actionCollection(); | 1623 | const KActionCollection* ac = actionCollection(); | ||
1457 | panelsMenu->addAction(ac->action(QStringLiteral("show_places_panel"))); | 1624 | panelsMenu->addAction(ac->action(QStringLiteral("show_places_panel"))); | ||
1458 | #ifdef HAVE_BALOO | 1625 | #ifdef HAVE_BALOO | ||
1459 | panelsMenu->addAction(ac->action(QStringLiteral("show_information_panel"))); | 1626 | panelsMenu->addAction(ac->action(QStringLiteral("show_information_panel"))); | ||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 1668 | { | |||
1510 | const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator(); | 1677 | const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator(); | ||
1511 | editableLocactionAction->setChecked(urlNavigator->isUrlEditable()); | 1678 | editableLocactionAction->setChecked(urlNavigator->isUrlEditable()); | ||
1512 | } | 1679 | } | ||
1513 | 1680 | | |||
1514 | void DolphinMainWindow::updateGoActions() | 1681 | void DolphinMainWindow::updateGoActions() | ||
1515 | { | 1682 | { | ||
1516 | QAction* goUpAction = actionCollection()->action(KStandardAction::name(KStandardAction::Up)); | 1683 | QAction* goUpAction = actionCollection()->action(KStandardAction::name(KStandardAction::Up)); | ||
1517 | const QUrl currentUrl = m_activeViewContainer->url(); | 1684 | const QUrl currentUrl = m_activeViewContainer->url(); | ||
1685 | // I think this is one of the best places to firstly be confronted | ||||
1686 | // with a file system and its hierarchy. Talking about the root | ||||
1687 | // directory might seem too much here but it is the question that | ||||
1688 | // naturally arises in this context. | ||||
1689 | goUpAction->setWhatsThis(xi18nc("@info:whatsthis", "<para>Go to " | ||||
1690 | "the folder that contains the currenty viewed one.</para>" | ||||
1691 | "<para>All files and folders are organized in a hierarchical " | ||||
1692 | "<emphasis>file system</emphasis>. At the top of this hierarchy is " | ||||
1693 | "a directory that contains all data connected to this computer" | ||||
1694 | "—the <emphasis>root directory</emphasis>.</para>")); | ||||
1518 | goUpAction->setEnabled(KIO::upUrl(currentUrl) != currentUrl); | 1695 | goUpAction->setEnabled(KIO::upUrl(currentUrl) != currentUrl); | ||
1519 | } | 1696 | } | ||
1520 | 1697 | | |||
1521 | void DolphinMainWindow::createControlButton() | 1698 | void DolphinMainWindow::createControlButton() | ||
1522 | { | 1699 | { | ||
1523 | if (m_controlButton) { | 1700 | if (m_controlButton) { | ||
1524 | return; | 1701 | return; | ||
1525 | } | 1702 | } | ||
1526 | Q_ASSERT(!m_controlButton); | 1703 | Q_ASSERT(!m_controlButton); | ||
1527 | 1704 | | |||
1528 | m_controlButton = new QToolButton(this); | 1705 | m_controlButton = new QToolButton(this); | ||
1529 | m_controlButton->setIcon(QIcon::fromTheme(QStringLiteral("application-menu"))); | 1706 | m_controlButton->setIcon(QIcon::fromTheme(QStringLiteral("application-menu"))); | ||
1530 | m_controlButton->setText(i18nc("@action", "Control")); | 1707 | m_controlButton->setText(i18nc("@action", "Control")); | ||
1708 | m_controlButton->setAttribute(Qt::WidgetAttribute::WA_CustomWhatsThis); | ||||
1531 | m_controlButton->setPopupMode(QToolButton::InstantPopup); | 1709 | m_controlButton->setPopupMode(QToolButton::InstantPopup); | ||
1532 | m_controlButton->setToolButtonStyle(toolBar()->toolButtonStyle()); | 1710 | m_controlButton->setToolButtonStyle(toolBar()->toolButtonStyle()); | ||
1533 | 1711 | | |||
1534 | QMenu* controlMenu = new QMenu(m_controlButton); | 1712 | QMenu* controlMenu = new QMenu(m_controlButton); | ||
1535 | connect(controlMenu, &QMenu::aboutToShow, this, &DolphinMainWindow::updateControlMenu); | 1713 | connect(controlMenu, &QMenu::aboutToShow, this, &DolphinMainWindow::updateControlMenu); | ||
1714 | controlMenu->installEventFilter(this); | ||||
1536 | 1715 | | |||
1537 | m_controlButton->setMenu(controlMenu); | 1716 | m_controlButton->setMenu(controlMenu); | ||
1538 | 1717 | | |||
1539 | toolBar()->addWidget(m_controlButton); | 1718 | toolBar()->addWidget(m_controlButton); | ||
1540 | connect(toolBar(), &KToolBar::iconSizeChanged, | 1719 | connect(toolBar(), &KToolBar::iconSizeChanged, | ||
1541 | m_controlButton, &QToolButton::setIconSize); | 1720 | m_controlButton, &QToolButton::setIconSize); | ||
1542 | connect(toolBar(), &KToolBar::toolButtonStyleChanged, | 1721 | connect(toolBar(), &KToolBar::toolButtonStyleChanged, | ||
1543 | m_controlButton, &QToolButton::setToolButtonStyle); | 1722 | m_controlButton, &QToolButton::setToolButtonStyle); | ||
▲ Show 20 Lines • Show All 138 Lines • ▼ Show 20 Line(s) | 1857 | { | |||
1682 | panelAction->setText(dockAction->text()); | 1861 | panelAction->setText(dockAction->text()); | ||
1683 | panelAction->setIcon(icon); | 1862 | panelAction->setIcon(icon); | ||
1684 | actionCollection()->setDefaultShortcut(panelAction, shortcut); | 1863 | actionCollection()->setDefaultShortcut(panelAction, shortcut); | ||
1685 | 1864 | | |||
1686 | connect(panelAction, &QAction::triggered, dockAction, &QAction::trigger); | 1865 | connect(panelAction, &QAction::triggered, dockAction, &QAction::trigger); | ||
1687 | connect(dockAction, &QAction::toggled, panelAction, &QAction::setChecked); | 1866 | connect(dockAction, &QAction::toggled, panelAction, &QAction::setChecked); | ||
1688 | } | 1867 | } | ||
1689 | 1868 | | |||
1869 | void DolphinMainWindow::setupWhatsThis() | ||||
1870 | { | ||||
1871 | // main widgets | ||||
1872 | menuBar()->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the " | ||||
1873 | "<emphasis>Menubar</emphasis>. It provides access to commands and " | ||||
1874 | "configuration options. Left-click on any of the menus on this " | ||||
1875 | "bar to see its contents.</para><para>The Menubar can be hidden " | ||||
1876 | "by unchecking <interface>Settings|Show Menubar</interface>. Then " | ||||
1877 | "most of its contents become available through a <interface>Control" | ||||
1878 | "</interface> button on the <emphasis>Toolbar</emphasis>.</para>")); | ||||
This is not correct, as the Control button only has a subset of all the available actions. elvisangelaccio: This is not correct, as the Control button only has a subset of all the available actions. | |||||
1879 | toolBar()->setWhatsThis(xi18nc("@info:whatsthis", "<para>This is the " | ||||
1880 | "<emphasis>Toolbar</emphasis>. It allows quick access to " | ||||
1881 | "frequently used actions.</para><para>It is highly customizable. " | ||||
1882 | "All items you see in the <interface>Control</interface> menu or " | ||||
1883 | "in the <interface>Menubar</interface> can be placed on the " | ||||
1884 | "Toolbar. Just right-click on it and select <interface>Configure " | ||||
1885 | "Toolbars…</interface> or find this action in the <interface>" | ||||
1886 | "Control</interface> or <interface>Settings</interface> menu." | ||||
1887 | "</para><para>The location of the bar and the style of its " | ||||
1888 | "buttons can also be changed in the right-click menu. Right-click " | ||||
1889 | "a button if you want to show or hide its text.</para>")); | ||||
1890 | m_tabWidget->setWhatsThis(xi18nc("@info:whatsthis main view", | ||||
1891 | "<para>Here you can see the <emphasis>folders</emphasis> and " | ||||
1892 | "<emphasis>files</emphasis> that are at the location described in " | ||||
1893 | "the <interface>Location Bar</interface> above. This area is the " | ||||
1894 | "central part of this application where you navigate to the files " | ||||
1895 | "you want to use.</para><para>For an elaborate and general " | ||||
1896 | "introduction to this application <link " | ||||
1897 | "url='https://userbase.kde.org/Dolphin/File_Management#Introduction_to_Dolphin'>" | ||||
1898 | "click here</link>. This will open an introductory article from " | ||||
1899 | "the <emphasis>KDE UserBase Wiki</emphasis>.</para><para>For brief " | ||||
1900 | "explanations of all the features of this <emphasis>view</emphasis> " | ||||
1901 | "<link url='help:/dolphin/dolphin-view.html'>click here</link> " | ||||
1902 | "instead. This will open a page from the <emphasis>Handbook" | ||||
1903 | "</emphasis> that covers the basics.</para>")); | ||||
1904 | | ||||
1905 | // Settings menu | ||||
1906 | actionCollection()->action(KStandardAction::name(KStandardAction::KeyBindings)) | ||||
1907 | ->setWhatsThis(xi18nc("@info:whatsthis","<para>This opens a window " | ||||
1908 | "that lists the <emphasis>keyboard shortcuts</emphasis>.<nl/>" | ||||
1909 | "There you can set up key combinations to trigger an action when " | ||||
1910 | "they are pressed simultaneously. All commands in this application can " | ||||
1911 | "be triggered this way.</para>")); | ||||
1912 | actionCollection()->action(KStandardAction::name(KStandardAction::ConfigureToolbars)) | ||||
elvisangelaccio: Please add `const` | |||||
1913 | ->setWhatsThis(xi18nc("@info:whatsthis","<para>This opens a window in which " | ||||
1914 | "you can change which buttons appear on the <emphasis>Toolbar</emphasis>.</para>" | ||||
1915 | "<para>All items you see in the <interface>Control</interface> menu " | ||||
1916 | "or in the <interface>Menubar</interface> can also be placed on the Toolbar.</para>")); | ||||
1917 | actionCollection()->action(KStandardAction::name(KStandardAction::Preferences)) | ||||
1918 | ->setWhatsThis(xi18nc("@info:whatsthis","This opens a window where you can " | ||||
1919 | "change a multitude of settings for this application. For an explanation " | ||||
1920 | "of the various settings go to the chapter <emphasis>Configuring Dolphin" | ||||
1921 | "</emphasis> in <interface>Help|Dolphin Handbook</interface>.")); | ||||
1922 | | ||||
1923 | // Help menu | ||||
1924 | // The whatsthis has to be set for the m_helpMenu and for the | ||||
1925 | // StandardAction separately because both are used in different locations. | ||||
1926 | // m_helpMenu is only used for createControlButton() button. | ||||
1927 | | ||||
1928 | // Links do not work within the Menubar so texts without links are provided there. | ||||
elvisangelaccio: Funny name :D
Please add `const` here as well | |||||
1929 | | ||||
1930 | // i18n: If the external link isn't available in your language you should | ||||
1931 | // probably state the external link language at least in brackets to not | ||||
1932 | // frustrate the user. If there are multiple languages that the user might | ||||
1933 | // know with a reasonable chance you might want to have 2 external links. | ||||
1934 | // The same is in my opinion true for every external link you translate. | ||||
1935 | const QString whatsThisHelpContents = xi18nc("@info:whatsthis handbook", | ||||
1936 | "<para>This opens the Handbook for this application. It provides " | ||||
1937 | "explanations for every part of <emphasis>Dolphin</emphasis>.</para>"); | ||||
1938 | actionCollection()->action(KStandardAction::name(KStandardAction::HelpContents)) | ||||
1939 | ->setWhatsThis(whatsThisHelpContents | ||||
1940 | + xi18nc("@info:whatsthis second half of handbook hb text without link", | ||||
1941 | "<para>If you want more elaborate introductions to the " | ||||
1942 | "different features of <emphasis>Dolphin</emphasis> " | ||||
1943 | "go to the KDE UserBase Wiki.</para>")); | ||||
1944 | m_helpMenu->action(KHelpMenu::menuHelpContents)->setWhatsThis(whatsThisHelpContents | ||||
1945 | + xi18nc("@info:whatsthis second half of handbook text with link", | ||||
1946 | "<para>If you want more elaborate introductions to the " | ||||
1947 | "different features of <emphasis>Dolphin</emphasis> " | ||||
1948 | "<link url='https://userbase.kde.org/Dolphin/File_Management'>click here</link>. " | ||||
1949 | "It will open the dedicated page in the KDE UserBase Wiki.</para>")); | ||||
1950 | | ||||
elvisangelaccio: Please add `const` | |||||
1951 | const QString whatsThisWhatsThis = xi18nc("@info:whatsthis whatsthis button", | ||||
1952 | "<para>This is the button that invokes the help feature you are " | ||||
1953 | "using right now! Click it, then click any component of this " | ||||
1954 | "application to ask \"What's this?\" about it. The mouse cursor " | ||||
1955 | "will change appearance if no help is available for a spot.</para>"); | ||||
1956 | actionCollection()->action(KStandardAction::name(KStandardAction::WhatsThis)) | ||||
1957 | ->setWhatsThis(whatsThisWhatsThis | ||||
1958 | + xi18nc("@info:whatsthis second half of whatsthis button text without link", | ||||
1959 | "<para>There are two other ways to get help for this application: The " | ||||
1960 | "<interface>Dolphin Handbook</interface> in the <interface>Help" | ||||
1961 | "</interface> menu and the <emphasis>KDE UserBase Wiki</emphasis> " | ||||
1962 | "article about <emphasis>File Management</emphasis> online." | ||||
elvisangelaccio: Please add `const` | |||||
1963 | "</para><para>The \"What's this?\" help is " | ||||
1964 | "missing in most other windows so don't get too used to this.</para>")); | ||||
1965 | m_helpMenu->action(KHelpMenu::menuWhatsThis)->setWhatsThis(whatsThisWhatsThis | ||||
1966 | + xi18nc("@info:whatsthis second half of whatsthis button text with link", | ||||
1967 | "<para>There are two other ways to get help: " | ||||
1968 | "The <link url='help:/dolphin/index.html'>Dolphin Handbook</link> and " | ||||
1969 | "the <link url='https://userbase.kde.org/Dolphin/File_Management'>KDE " | ||||
1970 | "UserBase Wiki</link>.</para><para>The \"What's this?\" help is " | ||||
1971 | "missing in most other windows so don't get too used to this.</para>")); | ||||
1972 | | ||||
1973 | const QString whatsThisReportBug = xi18nc("@info:whatsthis","<para>This opens a " | ||||
1974 | "window that will guide you through reporting errors or flaws " | ||||
1975 | "in this application or in other KDE software.</para>"); | ||||
1976 | actionCollection()->action(KStandardAction::name(KStandardAction::ReportBug)) | ||||
elvisangelaccio: Please add `const` | |||||
1977 | ->setWhatsThis(whatsThisReportBug); | ||||
1978 | m_helpMenu->action(KHelpMenu::menuReportBug)->setWhatsThis(whatsThisReportBug | ||||
1979 | + xi18nc("@info:whatsthis second half of reportbug text with link", | ||||
1980 | "<para>High-quality bug reports are much appreciated. To learn " | ||||
1981 | "how to make your bug report as effective as possible " | ||||
1982 | "<link url='https://community.kde.org/Get_Involved/Bug_Reporting'>" | ||||
1983 | "click here</link>.</para>")); | ||||
1984 | | ||||
elvisangelaccio: Please add `const` | |||||
1985 | const QString whatsThisDonate = xi18nc("@info:whatsthis","<para>This opens a " | ||||
1986 | "<emphasis>web page</emphasis> where you can donate to " | ||||
1987 | "support the continued work on this application and many " | ||||
1988 | "other projects by the <emphasis>KDE</emphasis> community.</para>" | ||||
1989 | "<para>Donating is the easiest and fastest way to efficiently " | ||||
1990 | "support KDE and its projects. KDE projects are available for " | ||||
1991 | "free therefore your donation is needed to cover things that " | ||||
elvisangelaccio: Please add `const` | |||||
1992 | "require money like servers, contributor meetings, etc.</para>" | ||||
1993 | "<para><emphasis>KDE e.V.</emphasis> is the non-profit " | ||||
1994 | "organization behind the KDE community.</para>"); | ||||
1995 | actionCollection()->action(KStandardAction::name(KStandardAction::Donate)) | ||||
1996 | ->setWhatsThis(whatsThisDonate); | ||||
1997 | m_helpMenu->action(KHelpMenu::menuDonate)->setWhatsThis(whatsThisDonate); | ||||
1998 | | ||||
1999 | const QString whatsThisSwitchLanguage = xi18nc("@info:whatsthis", | ||||
2000 | "With this you can change the language this application uses." | ||||
2001 | "<nl/>You can even set secondary languages which will be used " | ||||
2002 | "if texts are not available in your preferred language."); | ||||
2003 | actionCollection()->action(KStandardAction::name(KStandardAction::SwitchApplicationLanguage)) | ||||
2004 | ->setWhatsThis(whatsThisSwitchLanguage); | ||||
2005 | m_helpMenu->action(KHelpMenu::menuSwitchLanguage)->setWhatsThis(whatsThisSwitchLanguage); | ||||
2006 | | ||||
2007 | const QString whatsThisAboutApp = xi18nc("@info:whatsthis","This opens a " | ||||
2008 | "window that informs you about the version, license, " | ||||
2009 | "used libraries and maintainers of this application."); | ||||
Coding style: please use if (event->type() == QEvent::WhatsThisClicked) { } elvisangelaccio: Coding style: please use
```
if (event->type() == QEvent::WhatsThisClicked) {
}
``` | |||||
2010 | actionCollection()->action(KStandardAction::name(KStandardAction::AboutApp)) | ||||
2011 | ->setWhatsThis(whatsThisAboutApp); | ||||
2012 | m_helpMenu->action(KHelpMenu::menuAboutApp)->setWhatsThis(whatsThisAboutApp); | ||||
2013 | | ||||
2014 | const QString whatsThisAboutKDE = xi18nc("@info:whatsthis","This opens a " | ||||
elvisangelaccio: Unnecessary semicolon. | |||||
2015 | "window with information about <emphasis>KDE</emphasis>. " | ||||
2016 | "The KDE community are the people behind this free software." | ||||
2017 | "<nl/>If you like using this application but don't know " | ||||
2018 | "about KDE or want to see a cute dragon have a look!"); | ||||
2019 | actionCollection()->action(KStandardAction::name(KStandardAction::AboutKDE)) | ||||
2020 | ->setWhatsThis(whatsThisAboutKDE); | ||||
2021 | m_helpMenu->action(KHelpMenu::menuAboutKDE)->setWhatsThis(whatsThisAboutKDE); | ||||
elvisangelaccio: Coding style (same as above). | |||||
2022 | } | ||||
2023 | | ||||
2024 | bool DolphinMainWindow::event(QEvent *event) | ||||
2025 | { | ||||
2026 | if (event->type() == QEvent::WhatsThisClicked) { | ||||
2027 | event->accept(); | ||||
2028 | QWhatsThisClickedEvent* whatsThisEvent = dynamic_cast<QWhatsThisClickedEvent*>(event); | ||||
2029 | QDesktopServices::openUrl(QUrl(whatsThisEvent->href())); | ||||
2030 | return true; | ||||
2031 | } | ||||
2032 | return KXmlGuiWindow::event(event); | ||||
2033 | } | ||||
2034 | | ||||
elvisangelaccio: Please add a space before this function. | |||||
2035 | bool DolphinMainWindow::eventFilter(QObject* obj, QEvent* event) | ||||
2036 | { | ||||
2037 | Q_UNUSED(obj) | ||||
2038 | if (event->type() == QEvent::WhatsThisClicked) { | ||||
2039 | event->accept(); | ||||
2040 | QWhatsThisClickedEvent* whatsThisEvent = dynamic_cast<QWhatsThisClickedEvent*>(event); | ||||
2041 | QDesktopServices::openUrl(QUrl(whatsThisEvent->href())); | ||||
2042 | return true; | ||||
2043 | } | ||||
2044 | return false; | ||||
2045 | } | ||||
2046 | | ||||
1690 | DolphinMainWindow::UndoUiInterface::UndoUiInterface() : | 2047 | DolphinMainWindow::UndoUiInterface::UndoUiInterface() : | ||
1691 | KIO::FileUndoManager::UiInterface() | 2048 | KIO::FileUndoManager::UiInterface() | ||
1692 | { | 2049 | { | ||
1693 | } | 2050 | } | ||
1694 | 2051 | | |||
1695 | DolphinMainWindow::UndoUiInterface::~UndoUiInterface() | 2052 | DolphinMainWindow::UndoUiInterface::~UndoUiInterface() | ||
1696 | { | 2053 | { | ||
1697 | } | 2054 | } | ||
Show All 12 Lines |
Please keep the includes sorted by name.