Changeset View
Standalone View
src/dolphinmainwindow.cpp
Show First 20 Lines • Show All 545 Lines • ▼ Show 20 Line(s) | |||||
546 | void DolphinMainWindow::selectAll() | 546 | void DolphinMainWindow::selectAll() | ||
547 | { | 547 | { | ||
548 | clearStatusBar(); | 548 | clearStatusBar(); | ||
549 | 549 | | |||
550 | // if the URL navigator is editable and focused, select the whole | 550 | // if the URL navigator is editable and focused, select the whole | ||
551 | // URL instead of all items of the view | 551 | // URL instead of all items of the view | ||
552 | 552 | | |||
553 | KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator(); | 553 | KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator(); | ||
554 | QLineEdit* lineEdit = urlNavigator->editor()->lineEdit(); // krazy:exclude=qclasses | 554 | QLineEdit* lineEdit = urlNavigator->editor()->lineEdit(); | ||
555 | const bool selectUrl = urlNavigator->isUrlEditable() && | 555 | const bool selectUrl = urlNavigator->isUrlEditable() && | ||
556 | lineEdit->hasFocus(); | 556 | lineEdit->hasFocus(); | ||
557 | if (selectUrl) { | 557 | if (selectUrl) { | ||
558 | lineEdit->selectAll(); | 558 | lineEdit->selectAll(); | ||
559 | } else { | 559 | } else { | ||
560 | m_activeViewContainer->view()->selectAll(); | 560 | m_activeViewContainer->view()->selectAll(); | ||
561 | } | 561 | } | ||
562 | } | 562 | } | ||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 613 | { | |||
616 | QAction* action = actionCollection()->action(QStringLiteral("editable_location")); | 616 | QAction* action = actionCollection()->action(QStringLiteral("editable_location")); | ||
617 | KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator(); | 617 | KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator(); | ||
618 | urlNavigator->setUrlEditable(action->isChecked()); | 618 | urlNavigator->setUrlEditable(action->isChecked()); | ||
619 | } | 619 | } | ||
620 | 620 | | |||
621 | void DolphinMainWindow::replaceLocation() | 621 | void DolphinMainWindow::replaceLocation() | ||
622 | { | 622 | { | ||
623 | KUrlNavigator* navigator = m_activeViewContainer->urlNavigator(); | 623 | KUrlNavigator* navigator = m_activeViewContainer->urlNavigator(); | ||
624 | QLineEdit* lineEdit = navigator->editor()->lineEdit(); | ||||
625 | | ||||
626 | // If the text field currently has focus and everything is selected, | ||||
627 | // pressing the keyboard shortcut returns the whole thing to breadcrumb mode | ||||
628 | if (navigator->isUrlEditable() | ||||
629 | && lineEdit->hasFocus() | ||||
630 | && lineEdit->selectedText() == lineEdit->text() ) { | ||||
631 | navigator->setUrlEditable(false); | ||||
632 | } else { | ||||
624 | navigator->setUrlEditable(true); | 633 | navigator->setUrlEditable(true); | ||
625 | navigator->setFocus(); | 634 | navigator->setFocus(); | ||
626 | | ||||
627 | // select the whole text of the combo box editor | | |||
628 | QLineEdit* lineEdit = navigator->editor()->lineEdit(); // krazy:exclude=qclasses | | |||
629 | lineEdit->selectAll(); | 635 | lineEdit->selectAll(); | ||
630 | } | 636 | } | ||
637 | } | ||||
631 | 638 | | |||
632 | void DolphinMainWindow::togglePanelLockState() | 639 | void DolphinMainWindow::togglePanelLockState() | ||
633 | { | 640 | { | ||
634 | const bool newLockState = !GeneralSettings::lockPanels(); | 641 | const bool newLockState = !GeneralSettings::lockPanels(); | ||
635 | foreach (QObject* child, children()) { | 642 | foreach (QObject* child, children()) { | ||
636 | DolphinDockWidget* dock = qobject_cast<DolphinDockWidget*>(child); | 643 | DolphinDockWidget* dock = qobject_cast<DolphinDockWidget*>(child); | ||
637 | if (dock) { | 644 | if (dock) { | ||
638 | dock->setLocked(newLockState); | 645 | dock->setLocked(newLockState); | ||
▲ Show 20 Lines • Show All 321 Lines • ▼ Show 20 Line(s) | |||||
960 | 967 | | |||
961 | void DolphinMainWindow::closedTabsCountChanged(unsigned int count) | 968 | void DolphinMainWindow::closedTabsCountChanged(unsigned int count) | ||
962 | { | 969 | { | ||
963 | actionCollection()->action(QStringLiteral("undo_close_tab"))->setEnabled(count > 0); | 970 | actionCollection()->action(QStringLiteral("undo_close_tab"))->setEnabled(count > 0); | ||
964 | } | 971 | } | ||
965 | 972 | | |||
966 | void DolphinMainWindow::activeViewChanged(DolphinViewContainer* viewContainer) | 973 | void DolphinMainWindow::activeViewChanged(DolphinViewContainer* viewContainer) | ||
967 | { | 974 | { | ||
975 | if (m_activeViewContainer == viewContainer) { | ||||
976 | return; | ||||
977 | } | ||||
elvisangelaccio: This is a symptom that something else is wrong, but ok. | |||||
This seams to be called twice when dolphin is just starting up and twice when you change tabs. To Test I Used this code here. if (m_activeViewContainer == viewContainer) { static int calls = 1; qDebug() <<"ViewContainer Matches(" + QString::number(calls) + ") " << sender(); calls ++; return; } I also added this code to DolphinTabWidget::currentTabChanged() at line 330) if(viewContainer->isActive()) { static int calls = 1; qDebug() <<"View Active(" + QString::number(calls) + ") " << sender(); calls ++; return; } Example output
Create a new Tab:
Create a new Tab:
Switch to tab 1 (middle tab):
Switch to tab 2 (right most):
Switch to tab 0 (left most):
Every time you switch to the left most tab it has three of them . Without the code in the TabWidget it got one ViewContainer Match for every tab crated and every tab i switched to. rizzitello: This seams to be called twice when dolphin is just starting up and twice when you change tabs. | |||||
968 | DolphinViewContainer* oldViewContainer = m_activeViewContainer; | 978 | DolphinViewContainer* oldViewContainer = m_activeViewContainer; | ||
969 | Q_ASSERT(viewContainer); | 979 | Q_ASSERT(viewContainer); | ||
970 | 980 | | |||
971 | m_activeViewContainer = viewContainer; | 981 | m_activeViewContainer = viewContainer; | ||
972 | 982 | | |||
973 | if (oldViewContainer) { | 983 | if (oldViewContainer) { | ||
974 | // Disconnect all signals between the old view container (container, | 984 | // Disconnect all signals between the old view container (container, | ||
975 | // view and url navigator) and main window. | 985 | // view and url navigator) and main window. | ||
Show All 20 Lines | |||||
996 | { | 1006 | { | ||
997 | const bool enableTabActions = (count > 1); | 1007 | const bool enableTabActions = (count > 1); | ||
998 | actionCollection()->action(QStringLiteral("activate_next_tab"))->setEnabled(enableTabActions); | 1008 | actionCollection()->action(QStringLiteral("activate_next_tab"))->setEnabled(enableTabActions); | ||
999 | actionCollection()->action(QStringLiteral("activate_prev_tab"))->setEnabled(enableTabActions); | 1009 | actionCollection()->action(QStringLiteral("activate_prev_tab"))->setEnabled(enableTabActions); | ||
1000 | } | 1010 | } | ||
1001 | 1011 | | |||
1002 | void DolphinMainWindow::updateWindowTitle() | 1012 | void DolphinMainWindow::updateWindowTitle() | ||
1003 | { | 1013 | { | ||
1004 | setWindowTitle(m_activeViewContainer->caption()); | 1014 | const QString newTitle = m_activeViewContainer->caption(); | ||
1015 | if (windowTitle() != newTitle) { | ||||
1016 | setWindowTitle(newTitle); | ||||
1017 | } | ||||
broulik: `const` | |||||
1005 | } | 1018 | } | ||
1006 | 1019 | | |||
1007 | void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString& mountPath) | 1020 | void DolphinMainWindow::slotStorageTearDownFromPlacesRequested(const QString& mountPath) | ||
1008 | { | 1021 | { | ||
1009 | if (m_terminalPanel->currentWorkingDirectory().startsWith(mountPath)) { | 1022 | if (m_terminalPanel->currentWorkingDirectory().startsWith(mountPath)) { | ||
1010 | m_tearDownFromPlacesRequested = true; | 1023 | m_tearDownFromPlacesRequested = true; | ||
1011 | m_terminalPanel->goHome(); | 1024 | m_terminalPanel->goHome(); | ||
1012 | // m_placesPanel->proceedWithTearDown() will be called in slotTerminalDirectoryChanged | 1025 | // m_placesPanel->proceedWithTearDown() will be called in slotTerminalDirectoryChanged | ||
▲ Show 20 Lines • Show All 598 Lines • Show Last 20 Lines |
This is a symptom that something else is wrong, but ok.