Changeset View
Changeset View
Standalone View
Standalone View
src/dolphinmainwindow.cpp
Show First 20 Lines • Show All 608 Lines • ▼ Show 20 Line(s) | |||||
609 | 609 | | |||
610 | void DolphinMainWindow::paste() | 610 | void DolphinMainWindow::paste() | ||
611 | { | 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( | ||
618 | actionCollection()->action(KStandardAction::name(KStandardAction::Find))->isChecked() | ||||
619 | ); | ||||
620 | } | ||||
621 | | ||||
622 | void DolphinMainWindow::updateSearchAction(bool enabled) | ||||
623 | { | ||||
624 | QAction* searchAction = actionCollection()->action(KStandardAction::name(KStandardAction::Find)); | ||||
625 | searchAction->setChecked(enabled); | ||||
618 | } | 626 | } | ||
619 | 627 | | |||
620 | void DolphinMainWindow::updatePasteAction() | 628 | void DolphinMainWindow::updatePasteAction() | ||
621 | { | 629 | { | ||
622 | QAction* pasteAction = actionCollection()->action(KStandardAction::name(KStandardAction::Paste)); | 630 | QAction* pasteAction = actionCollection()->action(KStandardAction::name(KStandardAction::Paste)); | ||
623 | QPair<bool, QString> pasteInfo = m_activeViewContainer->view()->pasteInfo(); | 631 | QPair<bool, QString> pasteInfo = m_activeViewContainer->view()->pasteInfo(); | ||
624 | pasteAction->setEnabled(pasteInfo.first); | 632 | pasteAction->setEnabled(pasteInfo.first); | ||
625 | pasteAction->setText(pasteInfo.second); | 633 | pasteAction->setText(pasteInfo.second); | ||
626 | } | 634 | } | ||
elvisangelaccio: Please make `DolphinViewContainer::setSearchModeEnabled()` a `public slot` instead, so that we… | |||||
627 | 635 | | |||
628 | void DolphinMainWindow::slotDirectoryLoadingCompleted() | 636 | void DolphinMainWindow::slotDirectoryLoadingCompleted() | ||
629 | { | 637 | { | ||
630 | updatePasteAction(); | 638 | updatePasteAction(); | ||
631 | } | 639 | } | ||
632 | 640 | | |||
633 | void DolphinMainWindow::slotToolBarActionMiddleClicked(QAction *action) | 641 | void DolphinMainWindow::slotToolBarActionMiddleClicked(QAction *action) | ||
634 | { | 642 | { | ||
▲ Show 20 Lines • Show All 450 Lines • ▼ Show 20 Line(s) | 1088 | { | |||
1085 | 1093 | | |||
1086 | if (oldViewContainer) { | 1094 | if (oldViewContainer) { | ||
1087 | // Disconnect all signals between the old view container (container, | 1095 | // Disconnect all signals between the old view container (container, | ||
1088 | // view and url navigator) and main window. | 1096 | // view and url navigator) and main window. | ||
1089 | oldViewContainer->disconnect(this); | 1097 | oldViewContainer->disconnect(this); | ||
1090 | oldViewContainer->view()->disconnect(this); | 1098 | oldViewContainer->view()->disconnect(this); | ||
1091 | oldViewContainer->urlNavigator()->disconnect(this); | 1099 | oldViewContainer->urlNavigator()->disconnect(this); | ||
1092 | 1100 | | |||
1093 | // except the requestItemInfo so that on hover the information panel can still be updated | 1101 | // 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, | 1102 | connect(oldViewContainer->view(), &DolphinView::requestItemInfo, | ||
1095 | this, &DolphinMainWindow::requestItemInfo); | 1103 | 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 | } | 1104 | } | ||
1097 | 1105 | | |||
1098 | connectViewSignals(viewContainer); | 1106 | connectViewSignals(viewContainer); | ||
1099 | 1107 | | |||
1100 | m_actionHandler->setCurrentView(viewContainer->view()); | 1108 | m_actionHandler->setCurrentView(viewContainer->view()); | ||
1101 | 1109 | | |||
1102 | updateHistory(); | 1110 | updateHistory(); | ||
1103 | updateEditActions(); | 1111 | updateEditActions(); | ||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Line(s) | 1155 | { | |||
1211 | paste->setIconText(i18nc("@action:inmenu Edit", "Paste")); | 1219 | paste->setIconText(i18nc("@action:inmenu Edit", "Paste")); | ||
1212 | paste->setWhatsThis(xi18nc("@info:whatsthis paste", "This copies the items from " | 1220 | paste->setWhatsThis(xi18nc("@info:whatsthis paste", "This copies the items from " | ||
1213 | "your <emphasis>clipboard</emphasis> to the currently viewed folder.<nl/>" | 1221 | "your <emphasis>clipboard</emphasis> to the currently viewed folder.<nl/>" | ||
1214 | "If the items were added to the clipboard by the <emphasis>Cut</emphasis> " | 1222 | "If the items were added to the clipboard by the <emphasis>Cut</emphasis> " | ||
1215 | "action they are removed from their old location.") + cutCopyPastePara); | 1223 | "action they are removed from their old location.") + cutCopyPastePara); | ||
1216 | 1224 | | |||
1217 | QAction *searchAction = KStandardAction::find(this, &DolphinMainWindow::find, actionCollection()); | 1225 | QAction *searchAction = KStandardAction::find(this, &DolphinMainWindow::find, actionCollection()); | ||
1218 | searchAction->setText(i18n("Search...")); | 1226 | searchAction->setText(i18n("Search...")); | ||
1227 | searchAction->setCheckable(true); | ||||
1219 | searchAction->setToolTip(i18nc("@info:tooltip", "Search for files and folders")); | 1228 | searchAction->setToolTip(i18nc("@info:tooltip", "Search for files and folders")); | ||
1220 | searchAction->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This helps you " | 1229 | searchAction->setWhatsThis(xi18nc("@info:whatsthis find", "<para>This helps you " | ||
1221 | "find files and folders by opening a <emphasis>find bar</emphasis>. " | 1230 | "find files and folders by opening a <emphasis>find bar</emphasis>. " | ||
1222 | "There you can enter search terms and specify settings to find the " | 1231 | "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 " | 1232 | "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 " | 1233 | "the find bar so we can have a look at it while the settings are " | ||
1225 | "explained.</para>")); | 1234 | "explained.</para>")); | ||
1226 | 1235 | | |||
1227 | QAction* selectAllAction = KStandardAction::selectAll(this, &DolphinMainWindow::selectAll, actionCollection()); | 1236 | QAction* selectAllAction = KStandardAction::selectAll(this, &DolphinMainWindow::selectAll, actionCollection()); | ||
1228 | selectAllAction->setWhatsThis(xi18nc("@info:whatsthis", "This selects all " | 1237 | selectAllAction->setWhatsThis(xi18nc("@info:whatsthis", "This selects all " | ||
1229 | "files and folders in the current location.")); | 1238 | "files and folders in the current location.")); | ||
1230 | 1239 | | |||
1231 | QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection")); | 1240 | QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection")); | ||
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… | |||||
1232 | invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection")); | 1241 | invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection")); | ||
1233 | invertSelection->setWhatsThis(xi18nc("@info:whatsthis invert", "This selects all " | 1242 | invertSelection->setWhatsThis(xi18nc("@info:whatsthis invert", "This selects all " | ||
1234 | "objects that you have currently <emphasis>not</emphasis> selected instead.")); | 1243 | "objects that you have currently <emphasis>not</emphasis> selected instead.")); | ||
1235 | invertSelection->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-invert"))); | 1244 | invertSelection->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-invert"))); | ||
1236 | actionCollection()->setDefaultShortcut(invertSelection, Qt::CTRL + Qt::SHIFT + Qt::Key_A); | 1245 | actionCollection()->setDefaultShortcut(invertSelection, Qt::CTRL + Qt::SHIFT + Qt::Key_A); | ||
1237 | connect(invertSelection, &QAction::triggered, this, &DolphinMainWindow::invertSelection); | 1246 | connect(invertSelection, &QAction::triggered, this, &DolphinMainWindow::invertSelection); | ||
1238 | 1247 | | |||
1239 | // setup 'View' menu | 1248 | // setup 'View' menu | ||
▲ Show 20 Lines • Show All 560 Lines • ▼ Show 20 Line(s) | |||||
1800 | } | 1809 | } | ||
1801 | 1810 | | |||
1802 | void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) | 1811 | void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) | ||
1803 | { | 1812 | { | ||
1804 | connect(container, &DolphinViewContainer::showFilterBarChanged, | 1813 | connect(container, &DolphinViewContainer::showFilterBarChanged, | ||
1805 | this, &DolphinMainWindow::updateFilterBarAction); | 1814 | this, &DolphinMainWindow::updateFilterBarAction); | ||
1806 | connect(container, &DolphinViewContainer::writeStateChanged, | 1815 | connect(container, &DolphinViewContainer::writeStateChanged, | ||
1807 | this, &DolphinMainWindow::slotWriteStateChanged); | 1816 | this, &DolphinMainWindow::slotWriteStateChanged); | ||
1817 | connect(container, &DolphinViewContainer::searchModeEnabledChanged, | ||||
1818 | this, &DolphinMainWindow::updateSearchAction); | ||||
1808 | 1819 | | |||
1809 | const DolphinView* view = container->view(); | 1820 | const DolphinView* view = container->view(); | ||
1810 | connect(view, &DolphinView::selectionChanged, | 1821 | connect(view, &DolphinView::selectionChanged, | ||
1811 | this, &DolphinMainWindow::slotSelectionChanged); | 1822 | this, &DolphinMainWindow::slotSelectionChanged); | ||
1812 | connect(view, &DolphinView::requestItemInfo, | 1823 | connect(view, &DolphinView::requestItemInfo, | ||
1813 | this, &DolphinMainWindow::requestItemInfo); | 1824 | this, &DolphinMainWindow::requestItemInfo); | ||
1814 | connect(view, &DolphinView::tabRequested, | 1825 | connect(view, &DolphinView::tabRequested, | ||
1815 | this, &DolphinMainWindow::openNewTab); | 1826 | 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.