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()); | | |||
1105 | | ||||
1106 | QAction* selectAll = actionCollection()->addAction(QStringLiteral("select_all")); | 1107 | QAction* selectAll = actionCollection()->addAction(QStringLiteral("select_all")); | ||
1107 | selectAll->setText(i18nc("@action:inmenu Edit", "Select All")); | 1108 | selectAll->setText(i18nc("@action:inmenu Edit", "Select All")); | ||
1108 | selectAll->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-all"))); | 1109 | selectAll->setIcon(QIcon::fromTheme(QStringLiteral("edit-select-all"))); | ||
1109 | actionCollection()->setDefaultShortcut(selectAll, Qt::CTRL + Qt::Key_A); | 1110 | actionCollection()->setDefaultShortcut(selectAll, Qt::CTRL + Qt::Key_A); | ||
1110 | connect(selectAll, &QAction::triggered, this, &DolphinMainWindow::selectAll); | 1111 | connect(selectAll, &QAction::triggered, this, &DolphinMainWindow::selectAll); | ||
1111 | 1112 | | |||
1112 | QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection")); | 1113 | QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection")); | ||
1113 | invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection")); | 1114 | invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection")); | ||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Line(s) | 1207 | #endif | |||
1248 | openInNewTabs->setText(i18nc("@action:inmenu", "Open in New Tabs")); | 1249 | openInNewTabs->setText(i18nc("@action:inmenu", "Open in New Tabs")); | ||
1249 | openInNewTabs->setIcon(QIcon::fromTheme(QStringLiteral("tab-new"))); | 1250 | openInNewTabs->setIcon(QIcon::fromTheme(QStringLiteral("tab-new"))); | ||
1250 | connect(openInNewTabs, &QAction::triggered, this, &DolphinMainWindow::openInNewTab); | 1251 | connect(openInNewTabs, &QAction::triggered, this, &DolphinMainWindow::openInNewTab); | ||
1251 | 1252 | | |||
1252 | QAction* openInNewWindow = actionCollection()->addAction(QStringLiteral("open_in_new_window")); | 1253 | QAction* openInNewWindow = actionCollection()->addAction(QStringLiteral("open_in_new_window")); | ||
1253 | openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window")); | 1254 | openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window")); | ||
1254 | openInNewWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new"))); | 1255 | openInNewWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new"))); | ||
1255 | connect(openInNewWindow, &QAction::triggered, this, &DolphinMainWindow::openInNewWindow); | 1256 | connect(openInNewWindow, &QAction::triggered, this, &DolphinMainWindow::openInNewWindow); | ||
1257 | | ||||
1258 | KToggleAction* showSearch = actionCollection()->add<KToggleAction>(QStringLiteral("edit_find")); | ||||
1259 | showSearch->setText(i18nc("@action:intoolbar", "Find...")); | ||||
1260 | showSearch->setToolTip(i18nc("@info", "Toggle search bar")); | ||||
1261 | showSearch->setIcon(QIcon::fromTheme(QStringLiteral("edit-find"))); | ||||
1262 | actionCollection()->setDefaultShortcut(showSearch, QKeySequence(Qt::CTRL + Qt::Key_F)); | ||||
1263 | connect(showSearch, &KToggleAction::triggered, this, &DolphinMainWindow::slotToggleSearch); | ||||
1264 | | ||||
1256 | } | 1265 | } | ||
1257 | 1266 | | |||
1258 | void DolphinMainWindow::setupDockWidgets() | 1267 | void DolphinMainWindow::setupDockWidgets() | ||
1259 | { | 1268 | { | ||
1260 | const bool lock = GeneralSettings::lockPanels(); | 1269 | const bool lock = GeneralSettings::lockPanels(); | ||
1261 | 1270 | | |||
1262 | KDualAction* lockLayoutAction = actionCollection()->add<KDualAction>(QStringLiteral("lock_panels")); | 1271 | KDualAction* lockLayoutAction = actionCollection()->add<KDualAction>(QStringLiteral("lock_panels")); | ||
1263 | lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels")); | 1272 | lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels")); | ||
▲ Show 20 Lines • Show All 251 Lines • ▼ Show 20 Line(s) | |||||
1515 | 1524 | | |||
1516 | void DolphinMainWindow::clearStatusBar() | 1525 | void DolphinMainWindow::clearStatusBar() | ||
1517 | { | 1526 | { | ||
1518 | m_activeViewContainer->statusBar()->resetToDefaultText(); | 1527 | m_activeViewContainer->statusBar()->resetToDefaultText(); | ||
1519 | } | 1528 | } | ||
1520 | 1529 | | |||
1521 | void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) | 1530 | void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container) | ||
1522 | { | 1531 | { | ||
1532 | connect(container, &DolphinViewContainer::sendSearchState, | ||||
1533 | this, &DolphinMainWindow::searchStateChanged); | ||||
1523 | connect(container, &DolphinViewContainer::showFilterBarChanged, | 1534 | connect(container, &DolphinViewContainer::showFilterBarChanged, | ||
1524 | this, &DolphinMainWindow::updateFilterBarAction); | 1535 | this, &DolphinMainWindow::updateFilterBarAction); | ||
1525 | connect(container, &DolphinViewContainer::writeStateChanged, | 1536 | connect(container, &DolphinViewContainer::writeStateChanged, | ||
1526 | this, &DolphinMainWindow::slotWriteStateChanged); | 1537 | this, &DolphinMainWindow::slotWriteStateChanged); | ||
1527 | 1538 | | |||
1528 | const DolphinView* view = container->view(); | 1539 | const DolphinView* view = container->view(); | ||
1529 | connect(view, &DolphinView::selectionChanged, | 1540 | connect(view, &DolphinView::selectionChanged, | ||
1530 | this, &DolphinMainWindow::slotSelectionChanged); | 1541 | this, &DolphinMainWindow::slotSelectionChanged); | ||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 1632 | { | |||
1623 | if (mainWin) { | 1634 | if (mainWin) { | ||
1624 | DolphinViewContainer* container = mainWin->activeViewContainer(); | 1635 | DolphinViewContainer* container = mainWin->activeViewContainer(); | ||
1625 | container->showMessage(job->errorString(), DolphinViewContainer::Error); | 1636 | container->showMessage(job->errorString(), DolphinViewContainer::Error); | ||
1626 | } else { | 1637 | } else { | ||
1627 | KIO::FileUndoManager::UiInterface::jobError(job); | 1638 | KIO::FileUndoManager::UiInterface::jobError(job); | ||
1628 | } | 1639 | } | ||
1629 | } | 1640 | } | ||
1630 | 1641 | | |||
1642 | void DolphinMainWindow::slotToggleSearch() | ||||
1643 | { | ||||
1644 | bool active = m_activeViewContainer->isSearchModeEnabled(); | ||||
1645 | m_activeViewContainer->setSearchModeEnabled(!active); | ||||
anthonyfieroni: Indent | |||||
1646 | } | ||||
1647 | | ||||
1648 | void DolphinMainWindow::searchStateChanged(bool enabled) | ||||
1649 | { | ||||
1650 | KToggleAction* findButton = | ||||
1651 | static_cast<KToggleAction*>(actionCollection()->action(QStringLiteral("edit_find"))); | ||||
1652 | findButton->setChecked(enabled); | ||||
1653 | } |
Indent