Changeset View
Changeset View
Standalone View
Standalone View
src/views/dolphinview.cpp
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Line(s) | 97 | { | |||
---|---|---|---|---|---|
123 | 123 | | |||
124 | // The EnlargeSmallPreviews setting can only be changed after the model | 124 | // The EnlargeSmallPreviews setting can only be changed after the model | ||
125 | // has been set in the view by KItemListController. | 125 | // has been set in the view by KItemListController. | ||
126 | m_view->setEnlargeSmallPreviews(GeneralSettings::enlargeSmallPreviews()); | 126 | m_view->setEnlargeSmallPreviews(GeneralSettings::enlargeSmallPreviews()); | ||
127 | 127 | | |||
128 | m_container = new KItemListContainer(controller, this); | 128 | m_container = new KItemListContainer(controller, this); | ||
129 | m_container->installEventFilter(this); | 129 | m_container->installEventFilter(this); | ||
130 | setFocusProxy(m_container); | 130 | setFocusProxy(m_container); | ||
131 | connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip); | 131 | connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, [=] { hideToolTip(); }); | ||
132 | connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip); | 132 | connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, [=] { hideToolTip(); }); | ||
133 | 133 | | |||
134 | controller->setSelectionBehavior(KItemListController::MultiSelection); | 134 | controller->setSelectionBehavior(KItemListController::MultiSelection); | ||
135 | connect(controller, &KItemListController::itemActivated, this, &DolphinView::slotItemActivated); | 135 | connect(controller, &KItemListController::itemActivated, this, &DolphinView::slotItemActivated); | ||
136 | connect(controller, &KItemListController::itemsActivated, this, &DolphinView::slotItemsActivated); | 136 | connect(controller, &KItemListController::itemsActivated, this, &DolphinView::slotItemsActivated); | ||
137 | connect(controller, &KItemListController::itemMiddleClicked, this, &DolphinView::slotItemMiddleClicked); | 137 | connect(controller, &KItemListController::itemMiddleClicked, this, &DolphinView::slotItemMiddleClicked); | ||
138 | connect(controller, &KItemListController::itemContextMenuRequested, this, &DolphinView::slotItemContextMenuRequested); | 138 | connect(controller, &KItemListController::itemContextMenuRequested, this, &DolphinView::slotItemContextMenuRequested); | ||
139 | connect(controller, &KItemListController::viewContextMenuRequested, this, &DolphinView::slotViewContextMenuRequested); | 139 | connect(controller, &KItemListController::viewContextMenuRequested, this, &DolphinView::slotViewContextMenuRequested); | ||
140 | connect(controller, &KItemListController::headerContextMenuRequested, this, &DolphinView::slotHeaderContextMenuRequested); | 140 | connect(controller, &KItemListController::headerContextMenuRequested, this, &DolphinView::slotHeaderContextMenuRequested); | ||
▲ Show 20 Lines • Show All 598 Lines • ▼ Show 20 Line(s) | 736 | case QEvent::PaletteChange: | |||
739 | break; | 739 | break; | ||
740 | 740 | | |||
741 | case QEvent::WindowActivate: | 741 | case QEvent::WindowActivate: | ||
742 | case QEvent::WindowDeactivate: | 742 | case QEvent::WindowDeactivate: | ||
743 | updatePalette(); | 743 | updatePalette(); | ||
744 | break; | 744 | break; | ||
745 | 745 | | |||
746 | case QEvent::KeyPress: | 746 | case QEvent::KeyPress: | ||
747 | hideToolTip(ToolTipManager::HideBehavior::Instantly); | ||||
747 | if (GeneralSettings::useTabForSwitchingSplitView()) { | 748 | if (GeneralSettings::useTabForSwitchingSplitView()) { | ||
748 | QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); | 749 | QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); | ||
749 | if (keyEvent->key() == Qt::Key_Tab && keyEvent->modifiers() == Qt::NoModifier) { | 750 | if (keyEvent->key() == Qt::Key_Tab && keyEvent->modifiers() == Qt::NoModifier) { | ||
750 | emit toggleActiveViewRequested(); | 751 | emit toggleActiveViewRequested(); | ||
751 | return true; | 752 | return true; | ||
752 | } | 753 | } | ||
753 | } | 754 | } | ||
754 | break; | 755 | break; | ||
▲ Show 20 Lines • Show All 654 Lines • ▼ Show 20 Line(s) | 1393 | if (!selectionManager->hasSelection()) { | |||
1409 | } | 1410 | } | ||
1410 | 1411 | | |||
1411 | selectionManager->beginAnchoredSelection(selectionManager->currentItem()); | 1412 | selectionManager->beginAnchoredSelection(selectionManager->currentItem()); | ||
1412 | selectionManager->setSelectedItems(selectedItems); | 1413 | selectionManager->setSelectedItems(selectedItems); | ||
1413 | } | 1414 | } | ||
1414 | } | 1415 | } | ||
1415 | } | 1416 | } | ||
1416 | 1417 | | |||
1417 | void DolphinView::hideToolTip() | 1418 | void DolphinView::hideToolTip(const ToolTipManager::HideBehavior behavior) | ||
1418 | { | 1419 | { | ||
1419 | #ifdef HAVE_BALOO | 1420 | #ifdef HAVE_BALOO | ||
1420 | if (GeneralSettings::showToolTips()) { | 1421 | if (GeneralSettings::showToolTips()) { | ||
1421 | m_toolTipManager->hideToolTip(); | 1422 | m_toolTipManager->hideToolTip(behavior); | ||
1422 | } | 1423 | } | ||
1423 | #endif | 1424 | #endif | ||
1424 | } | 1425 | } | ||
1425 | 1426 | | |||
1426 | void DolphinView::calculateItemCount(int& fileCount, | 1427 | void DolphinView::calculateItemCount(int& fileCount, | ||
1427 | int& folderCount, | 1428 | int& folderCount, | ||
1428 | KIO::filesize_t& totalFileSize) const | 1429 | KIO::filesize_t& totalFileSize) const | ||
1429 | { | 1430 | { | ||
1430 | const int itemCount = m_model->count(); | 1431 | const int itemCount = m_model->count(); | ||
1431 | for (int i = 0; i < itemCount; ++i) { | 1432 | for (int i = 0; i < itemCount; ++i) { | ||
1432 | const KFileItem item = m_model->fileItem(i); | 1433 | const KFileItem item = m_model->fileItem(i); | ||
1433 | if (item.isDir()) { | 1434 | if (item.isDir()) { | ||
1434 | ++folderCount; | 1435 | ++folderCount; | ||
elvisangelaccio: I don't like this duplicate function. We could just add the bool parameter to `DolphinView… | |||||
broulik: or rather some flag :) | |||||
Of course a single function was my initial version. connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip); connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip); error: static assertion failed: Signal and slot arguments are not compatible. Tried solving this with SLOT(), default argument, separate overloaded function with no arguments. It seems that will require QOverload in every connect() call: connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, QOverload<>::of(&DolphinView::hideToolTip)); connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, QOverload<>::of(&DolphinView::hideToolTip)); Are you OK with this? pdabrowski: Of course a single function was my initial version.
But then I got errors for connect()s:
```… | |||||
To be precise: pdabrowski: To be precise:
QOverload plus still a separate overloaded DolphinView::hideToolTip() function… | |||||
We can fix this issue by using a lamba ;) connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, [=] { hideToolTip(); }); elvisangelaccio: We can fix this issue by using a lamba ;)
```
connect(m_container->horizontalScrollBar()… | |||||
Have you tried to use this lambda in order to bring back the approach of https://phabricator.kde.org/D22512?id=62021 ? (which I prefer because we avoid to duplicate DolphinView::hideToolTip()) elvisangelaccio: Have you tried to use this lambda in order to bring back the approach of https://phabricator. | |||||
1435 | } else { | 1436 | } else { | ||
1436 | ++fileCount; | 1437 | ++fileCount; | ||
1437 | totalFileSize += item.size(); | 1438 | totalFileSize += item.size(); | ||
1438 | } | 1439 | } | ||
1439 | } | 1440 | } | ||
1440 | } | 1441 | } | ||
1441 | 1442 | | |||
1442 | void DolphinView::slotTwoClicksRenamingTimerTimeout() | 1443 | void DolphinView::slotTwoClicksRenamingTimerTimeout() | ||
▲ Show 20 Lines • Show All 400 Lines • Show Last 20 Lines |
I don't like this duplicate function. We could just add the bool parameter to DolphinView::hideToolTip().