Changeset View
Changeset View
Standalone View
Standalone View
src/dolphinmainwindow.cpp
Show First 20 Lines • Show All 964 Lines • ▼ Show 20 Line(s) | 961 | { | |||
---|---|---|---|---|---|
965 | m_activeViewContainer = viewContainer; | 965 | m_activeViewContainer = viewContainer; | ||
966 | 966 | | |||
967 | if (oldViewContainer) { | 967 | if (oldViewContainer) { | ||
968 | // Disconnect all signals between the old view container (container, | 968 | // Disconnect all signals between the old view container (container, | ||
969 | // view and url navigator) and main window. | 969 | // view and url navigator) and main window. | ||
970 | oldViewContainer->disconnect(this); | 970 | oldViewContainer->disconnect(this); | ||
971 | oldViewContainer->view()->disconnect(this); | 971 | oldViewContainer->view()->disconnect(this); | ||
972 | oldViewContainer->urlNavigator()->disconnect(this); | 972 | oldViewContainer->urlNavigator()->disconnect(this); | ||
973 | | ||||
974 | // manually trigger slot to update search bar state on new view container | ||||
975 | searchStateChanged(m_activeViewContainer->isSearchModeEnabled()); | ||||
973 | } | 976 | } | ||
974 | 977 | | |||
975 | connectViewSignals(viewContainer); | 978 | connectViewSignals(viewContainer); | ||
976 | 979 | | |||
977 | m_actionHandler->setCurrentView(viewContainer->view()); | 980 | m_actionHandler->setCurrentView(viewContainer->view()); | ||
978 | 981 | | |||
979 | updateHistory(); | 982 | updateHistory(); | ||
980 | updateEditActions(); | 983 | updateEditActions(); | ||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | 1062 | { | |||
1096 | KStandardAction::cut(this, &DolphinMainWindow::cut, actionCollection()); | 1099 | KStandardAction::cut(this, &DolphinMainWindow::cut, actionCollection()); | ||
1097 | KStandardAction::copy(this, &DolphinMainWindow::copy, actionCollection()); | 1100 | KStandardAction::copy(this, &DolphinMainWindow::copy, actionCollection()); | ||
1098 | QAction* paste = KStandardAction::paste(this, &DolphinMainWindow::paste, actionCollection()); | 1101 | QAction* paste = KStandardAction::paste(this, &DolphinMainWindow::paste, actionCollection()); | ||
1099 | // The text of the paste-action is modified dynamically by Dolphin | 1102 | // The text of the paste-action is modified dynamically by Dolphin | ||
1100 | // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes | 1103 | // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes | ||
1101 | // due to the long text, the text "Paste" is used: | 1104 | // due to the long text, the text "Paste" is used: | ||
1102 | paste->setIconText(i18nc("@action:inmenu Edit", "Paste")); | 1105 | paste->setIconText(i18nc("@action:inmenu Edit", "Paste")); | ||
1103 | 1106 | | |||
1104 | KStandardAction::find(this, &DolphinMainWindow::find, actionCollection()); | 1107 | QAction* openFind = actionCollection()->addAction(QStringLiteral("open_find")); | ||
1108 | openFind->setText(i18nc("@action:inmenu Edit", "Find...")); | ||||
1109 | openFind->setIcon(QIcon::fromTheme(QStringLiteral("edit-find"))); | ||||
1110 | actionCollection()->setDefaultShortcut(openFind, Qt::CTRL + Qt::Key_F); | ||||
1111 | connect(openFind, &QAction::triggered, this, &DolphinMainWindow::openFind); | ||||
1105 | 1112 | | |||
1106 | QAction* selectAll = actionCollection()->addAction(QStringLiteral("select_all")); | 1113 | QAction* selectAll = actionCollection()->addAction(QStringLiteral("select_all")); | ||
1107 | selectAll->setText(i18nc("@action:inmenu Edit", "Select All")); | 1114 | selectAll->setText(i18nc("@action:inmenu Edit", "Select All")); | ||
1108 | selectAll->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-all"))); | 1115 | selectAll->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-all"))); | ||
1109 | actionCollection()->setDefaultShortcut(selectAll, Qt::CTRL + Qt::Key_A); | 1116 | actionCollection()->setDefaultShortcut(selectAll, Qt::CTRL + Qt::Key_A); | ||
1110 | connect(selectAll, &QAction::triggered, this, &DolphinMainWindow::selectAll); | 1117 | connect(selectAll, &QAction::triggered, this, &DolphinMainWindow::selectAll); | ||
1111 | 1118 | | |||
1112 | QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection")); | 1119 | QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection")); | ||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Line(s) | 1213 | #endif | |||
1248 | openInNewTabs->setText(i18nc("@action:inmenu", "Open in New Tabs")); | 1255 | openInNewTabs->setText(i18nc("@action:inmenu", "Open in New Tabs")); | ||
1249 | openInNewTabs->setIcon(QIcon::fromTheme(QStringLiteral("tab-new"))); | 1256 | openInNewTabs->setIcon(QIcon::fromTheme(QStringLiteral("tab-new"))); | ||
1250 | connect(openInNewTabs, &QAction::triggered, this, &DolphinMainWindow::openInNewTab); | 1257 | connect(openInNewTabs, &QAction::triggered, this, &DolphinMainWindow::openInNewTab); | ||
1251 | 1258 | | |||
1252 | QAction* openInNewWindow = actionCollection()->addAction(QStringLiteral("open_in_new_window")); | 1259 | QAction* openInNewWindow = actionCollection()->addAction(QStringLiteral("open_in_new_window")); | ||
1253 | openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window")); | 1260 | openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window")); | ||
1254 | openInNewWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new"))); | 1261 | openInNewWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new"))); | ||
1255 | connect(openInNewWindow, &QAction::triggered, this, &DolphinMainWindow::openInNewWindow); | 1262 | connect(openInNewWindow, &QAction::triggered, this, &DolphinMainWindow::openInNewWindow); | ||
1263 | | ||||
1264 | KToggleAction* showSearch = actionCollection()->add<KToggleAction>(QStringLiteral("toggle_find")); | ||||
1265 | showSearch->setText(i18nc("@action:intoolbar", "Find...")); | ||||
1266 | showSearch->setToolTip(i18nc("@info", "Toggle search bar")); | ||||
1267 | showSearch->setIcon(QIcon::fromTheme(QStringLiteral("edit-find"))); | ||||
1268 | connect(showSearch, &KToggleAction::triggered, this, &DolphinMainWindow::slotToggleSearch); | ||||
1269 | | ||||
1256 | } | 1270 | } | ||
1257 | 1271 | | |||
1258 | void DolphinMainWindow::setupDockWidgets() | 1272 | void DolphinMainWindow::setupDockWidgets() | ||
1259 | { | 1273 | { | ||
1260 | const bool lock = GeneralSettings::lockPanels(); | 1274 | const bool lock = GeneralSettings::lockPanels(); | ||
1261 | 1275 | | |||
1262 | KDualAction* lockLayoutAction = actionCollection()->add<KDualAction>(QStringLiteral("lock_panels")); | 1276 | KDualAction* lockLayoutAction = actionCollection()->add<KDualAction>(QStringLiteral("lock_panels")); | ||
1263 | lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels")); | 1277 | lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels")); | ||
▲ Show 20 Lines • Show All 251 Lines • ▼ Show 20 Line(s) | |||||
1515 | 1529 | | |||
1516 | void DolphinMainWindow::clearStatusBar() | 1530 | void DolphinMainWindow::clearStatusBar() | ||
1517 | { | 1531 | { | ||
1518 | m_activeViewContainer->statusBar()->resetToDefaultText(); | 1532 | m_activeViewContainer->statusBar()->resetToDefaultText(); | ||
1519 | } | 1533 | } | ||
1520 | 1534 | | |||
1521 | void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) | 1535 | void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) | ||
1522 | { | 1536 | { | ||
1537 | connect(container, &DolphinViewContainer::sendSearchState, | ||||
1538 | this, &DolphinMainWindow::searchStateChanged); | ||||
1523 | connect(container, &DolphinViewContainer::showFilterBarChanged, | 1539 | connect(container, &DolphinViewContainer::showFilterBarChanged, | ||
1524 | this, &DolphinMainWindow::updateFilterBarAction); | 1540 | this, &DolphinMainWindow::updateFilterBarAction); | ||
1525 | connect(container, &DolphinViewContainer::writeStateChanged, | 1541 | connect(container, &DolphinViewContainer::writeStateChanged, | ||
1526 | this, &DolphinMainWindow::slotWriteStateChanged); | 1542 | this, &DolphinMainWindow::slotWriteStateChanged); | ||
1527 | 1543 | | |||
1528 | const DolphinView* view = container->view(); | 1544 | const DolphinView* view = container->view(); | ||
1529 | connect(view, &DolphinView::selectionChanged, | 1545 | connect(view, &DolphinView::selectionChanged, | ||
1530 | this, &DolphinMainWindow::slotSelectionChanged); | 1546 | this, &DolphinMainWindow::slotSelectionChanged); | ||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 1637 | { | |||
1623 | if (mainWin) { | 1639 | if (mainWin) { | ||
1624 | DolphinViewContainer* container = mainWin->activeViewContainer(); | 1640 | DolphinViewContainer* container = mainWin->activeViewContainer(); | ||
1625 | container->showMessage(job->errorString(), DolphinViewContainer::Error); | 1641 | container->showMessage(job->errorString(), DolphinViewContainer::Error); | ||
1626 | } else { | 1642 | } else { | ||
1627 | KIO::FileUndoManager::UiInterface::jobError(job); | 1643 | KIO::FileUndoManager::UiInterface::jobError(job); | ||
1628 | } | 1644 | } | ||
1629 | } | 1645 | } | ||
1630 | 1646 | | |||
1647 | void DolphinMainWindow::openFind() | ||||
1648 | { | ||||
1649 | m_activeViewContainer->setSearchModeEnabled(true); | ||||
1650 | searchStateChanged(true); | ||||
anthonyfieroni: Indent | |||||
1651 | } | ||||
1652 | | ||||
1653 | void DolphinMainWindow::slotToggleSearch() | ||||
1654 | { | ||||
1655 | bool active = m_activeViewContainer->isSearchModeEnabled(); | ||||
1656 | m_activeViewContainer->setSearchModeEnabled(!active); | ||||
1657 | } | ||||
1658 | | ||||
1659 | void DolphinMainWindow::searchStateChanged(bool enabled) | ||||
1660 | { | ||||
1661 | KToggleAction* findButton = | ||||
1662 | static_cast<KToggleAction*>(actionCollection()->action(QStringLiteral("toggle_find"))); | ||||
1663 | findButton->setChecked(enabled); | ||||
1664 | } |
Indent