Changeset View
Changeset View
Standalone View
Standalone View
src/dolphinmainwindow.cpp
Show First 20 Lines • Show All 611 Lines • ▼ Show 20 Line(s) | 611 | { | |||
---|---|---|---|---|---|
612 | m_activeViewContainer->view()->paste(); | 612 | m_activeViewContainer->view()->paste(); | ||
613 | } | 613 | } | ||
614 | 614 | | |||
615 | void DolphinMainWindow::find() | 615 | void DolphinMainWindow::find() | ||
616 | { | 616 | { | ||
617 | m_activeViewContainer->setSearchModeEnabled(true); | 617 | m_activeViewContainer->setSearchModeEnabled(true); | ||
618 | } | 618 | } | ||
619 | 619 | | |||
620 | void DolphinMainWindow::toggleSearch() | ||||
621 | { | ||||
622 | QAction* searchAction = actionCollection()->action(QStringLiteral("toggle_search")); | ||||
623 | m_activeViewContainer->setSearchModeEnabled( | ||||
624 | searchAction->isChecked() | ||||
625 | ); | ||||
626 | } | ||||
elvisangelaccio: Please make `DolphinViewContainer::setSearchModeEnabled()` a `public slot` instead, so that we… | |||||
627 | | ||||
628 | void DolphinMainWindow::updateSearchAction() | ||||
629 | { | ||||
630 | QAction* searchAction = actionCollection()->action(QStringLiteral("toggle_search")); | ||||
631 | searchAction->setChecked(m_activeViewContainer->isSearchModeEnabled()); | ||||
632 | } | ||||
633 | | ||||
620 | void DolphinMainWindow::updatePasteAction() | 634 | void DolphinMainWindow::updatePasteAction() | ||
621 | { | 635 | { | ||
622 | QAction* pasteAction = actionCollection()->action(KStandardAction::name(KStandardAction::Paste)); | 636 | QAction* pasteAction = actionCollection()->action(KStandardAction::name(KStandardAction::Paste)); | ||
623 | QPair<bool, QString> pasteInfo = m_activeViewContainer->view()->pasteInfo(); | 637 | QPair<bool, QString> pasteInfo = m_activeViewContainer->view()->pasteInfo(); | ||
624 | pasteAction->setEnabled(pasteInfo.first); | 638 | pasteAction->setEnabled(pasteInfo.first); | ||
625 | pasteAction->setText(pasteInfo.second); | 639 | pasteAction->setText(pasteInfo.second); | ||
626 | } | 640 | } | ||
627 | 641 | | |||
▲ Show 20 Lines • Show All 457 Lines • ▼ Show 20 Line(s) | 1094 | { | |||
1085 | 1099 | | |||
1086 | if (oldViewContainer) { | 1100 | if (oldViewContainer) { | ||
1087 | // Disconnect all signals between the old view container (container, | 1101 | // Disconnect all signals between the old view container (container, | ||
1088 | // view and url navigator) and main window. | 1102 | // view and url navigator) and main window. | ||
1089 | oldViewContainer->disconnect(this); | 1103 | oldViewContainer->disconnect(this); | ||
1090 | oldViewContainer->view()->disconnect(this); | 1104 | oldViewContainer->view()->disconnect(this); | ||
1091 | oldViewContainer->urlNavigator()->disconnect(this); | 1105 | oldViewContainer->urlNavigator()->disconnect(this); | ||
1092 | 1106 | | |||
1093 | // except the requestItemInfo so that on hover the information panel can still be updated | 1107 | // except the requestItemInfo so that on hover the information panel can still be updated | ||
elvisangelaccio: This comment doesn't add much, I'd remove it. | |||||
1094 | connect(oldViewContainer->view(), &DolphinView::requestItemInfo, | 1108 | connect(oldViewContainer->view(), &DolphinView::requestItemInfo, | ||
1095 | this, &DolphinMainWindow::requestItemInfo); | 1109 | this, &DolphinMainWindow::requestItemInfo); | ||
Please move this disconnect to the beginning of this if block. (to not get in between the two existing comments). elvisangelaccio: Please move this disconnect to the beginning of this if block. (to not get in between the two… | |||||
1096 | } | 1110 | } | ||
1097 | 1111 | | |||
1098 | connectViewSignals(viewContainer); | 1112 | connectViewSignals(viewContainer); | ||
1099 | 1113 | | |||
1100 | m_actionHandler->setCurrentView(viewContainer->view()); | 1114 | m_actionHandler->setCurrentView(viewContainer->view()); | ||
1101 | 1115 | | |||
1102 | updateHistory(); | 1116 | updateHistory(); | ||
1103 | updateEditActions(); | 1117 | updateEditActions(); | ||
1104 | updatePasteAction(); | 1118 | updatePasteAction(); | ||
1105 | updateViewActions(); | 1119 | updateViewActions(); | ||
1106 | updateGoActions(); | 1120 | updateGoActions(); | ||
1121 | updateSearchAction(); | ||||
1107 | 1122 | | |||
1108 | const QUrl url = viewContainer->url(); | 1123 | const QUrl url = viewContainer->url(); | ||
1109 | emit urlChanged(url); | 1124 | emit urlChanged(url); | ||
1110 | } | 1125 | } | ||
1111 | 1126 | | |||
1112 | void DolphinMainWindow::tabCountChanged(int count) | 1127 | void DolphinMainWindow::tabCountChanged(int count) | ||
1113 | { | 1128 | { | ||
1114 | const bool enableTabActions = (count > 1); | 1129 | const bool enableTabActions = (count > 1); | ||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Line(s) | 1162 | { | |||
1219 | searchAction->setToolTip(i18nc("@info:tooltip", "Search for files and folders")); | 1234 | searchAction->setToolTip(i18nc("@info:tooltip", "Search for files and folders")); | ||
1220 | searchAction->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This helps you " | 1235 | searchAction->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This helps you " | ||
1221 | "find files and folders by opening a <emphasis>find bar</emphasis>. " | 1236 | "find files and folders by opening a <emphasis>find bar</emphasis>. " | ||
1222 | "There you can enter search terms and specify settings to find the " | 1237 | "There you can enter search terms and specify settings to find the " | ||
1223 | "objects you are looking for.</para><para>Use this help again on " | 1238 | "objects you are looking for.</para><para>Use this help again on " | ||
1224 | "the find bar so we can have a look at it while the settings are " | 1239 | "the find bar so we can have a look at it while the settings are " | ||
1225 | "explained.</para>")); | 1240 | "explained.</para>")); | ||
1226 | 1241 | | |||
1242 | // toggle_search acts as a copy of the main searchAction to be used mainly | ||||
1243 | // in the toolbar, with no default shortcut attached, to avoid messing with | ||||
1244 | // existing workflows (search bar always open and Ctrl-F to focus) | ||||
1245 | QAction *toggleSearchAction = actionCollection()->addAction(QStringLiteral("toggle_search")); | ||||
1246 | toggleSearchAction->setText(i18nc("@action:inmenu", "Toggle search bar")); | ||||
Please use Title Capitalization: https://hig.kde.org/style/writing/capitalization.html#title-capitalization elvisangelaccio: Please use Title Capitalization: https://hig.kde.org/style/writing/capitalization.html#title… | |||||
1247 | toggleSearchAction->setIconText(i18nc("@action:intoolbar", "Search")); | ||||
1248 | toggleSearchAction->setIcon(searchAction->icon()); | ||||
1249 | toggleSearchAction->setToolTip(searchAction->toolTip()); | ||||
1250 | toggleSearchAction->setWhatsThis(searchAction->whatsThis()); | ||||
1251 | toggleSearchAction->setCheckable(true); | ||||
1252 | connect(toggleSearchAction, &QAction::triggered, this, &DolphinMainWindow::toggleSearch); | ||||
1253 | | ||||
1227 | QAction* selectAllAction = KStandardAction::selectAll(this, &DolphinMainWindow::selectAll, actionCollection()); | 1254 | QAction* selectAllAction = KStandardAction::selectAll(this, &DolphinMainWindow::selectAll, actionCollection()); | ||
1228 | selectAllAction->setWhatsThis(xi18nc("@info:whatsthis", "This selects all " | 1255 | selectAllAction->setWhatsThis(xi18nc("@info:whatsthis", "This selects all " | ||
1229 | "files and folders in the current location.")); | 1256 | "files and folders in the current location.")); | ||
1230 | 1257 | | |||
1231 | QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection")); | 1258 | QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection")); | ||
1232 | invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection")); | 1259 | invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection")); | ||
1233 | invertSelection->setWhatsThis(xi18nc("@info:whatsthis invert", "This selects all " | 1260 | invertSelection->setWhatsThis(xi18nc("@info:whatsthis invert", "This selects all " | ||
1234 | "objects that you have currently <emphasis>not</emphasis> selected instead.")); | 1261 | "objects that you have currently <emphasis>not</emphasis> selected instead.")); | ||
▲ Show 20 Lines • Show All 562 Lines • ▼ Show 20 Line(s) | |||||
1797 | } | 1824 | } | ||
1798 | 1825 | | |||
1799 | void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) | 1826 | void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) | ||
1800 | { | 1827 | { | ||
1801 | connect(container, &DolphinViewContainer::showFilterBarChanged, | 1828 | connect(container, &DolphinViewContainer::showFilterBarChanged, | ||
1802 | this, &DolphinMainWindow::updateFilterBarAction); | 1829 | this, &DolphinMainWindow::updateFilterBarAction); | ||
1803 | connect(container, &DolphinViewContainer::writeStateChanged, | 1830 | connect(container, &DolphinViewContainer::writeStateChanged, | ||
1804 | this, &DolphinMainWindow::slotWriteStateChanged); | 1831 | this, &DolphinMainWindow::slotWriteStateChanged); | ||
1832 | connect(container, &DolphinViewContainer::searchModeEnabledChanged, | ||||
1833 | this, &DolphinMainWindow::updateSearchAction); | ||||
1805 | 1834 | | |||
1806 | const DolphinView* view = container->view(); | 1835 | const DolphinView* view = container->view(); | ||
1807 | connect(view, &DolphinView::selectionChanged, | 1836 | connect(view, &DolphinView::selectionChanged, | ||
1808 | this, &DolphinMainWindow::slotSelectionChanged); | 1837 | this, &DolphinMainWindow::slotSelectionChanged); | ||
1809 | connect(view, &DolphinView::requestItemInfo, | 1838 | connect(view, &DolphinView::requestItemInfo, | ||
1810 | this, &DolphinMainWindow::requestItemInfo); | 1839 | this, &DolphinMainWindow::requestItemInfo); | ||
1811 | connect(view, &DolphinView::tabRequested, | 1840 | connect(view, &DolphinView::tabRequested, | ||
1812 | this, &DolphinMainWindow::openNewTab); | 1841 | this, &DolphinMainWindow::openNewTab); | ||
▲ Show 20 Lines • Show All 283 Lines • Show Last 20 Lines |
Please make DolphinViewContainer::setSearchModeEnabled() a public slot instead, so that we can just connect it to the triggered signal of the searchAction.