setComponentName(QStringLiteral("dolphin"), QGuiApplication::applicationDisplayName());
setObjectName(QStringLiteral("Dolphin#"));
- // setStateConfigGroup("State");
+ setStateConfigGroup("State");
connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage,
this, &DolphinMainWindow::showErrorMessage);
QAction *toggleSelectionModeAction = actionCollection()->addAction(QStringLiteral("toggle_selection_mode"));
// i18n: This action toggles a selection mode.
toggleSelectionModeAction->setText(i18nc("@action:inmenu", "Select Files and Folders"));
- // i18n: Opens a selection mode for selecting files/folders and later selecting an action that acts on them.
- // So in a way "Select" here is used to mean both "Select files" and also "Select what to do" but mostly the first.
+ // i18n: Opens a selection mode for selecting files/folders.
// The text is kept so unspecific because it will be shown on the toolbar where space is at a premium.
toggleSelectionModeAction->setIconText(i18nc("@action:intoolbar", "Select"));
toggleSelectionModeAction->setWhatsThis(xi18nc("@info:whatsthis", "<para>This application only knows which files or folders should be acted on if they are"
void ActionTextHelper::textsWhenNothingIsSelectedEnabled(bool enabled)
{
for (auto i = m_registeredActionTextChanges.begin(); i != m_registeredActionTextChanges.end(); ++i) {
- if (!i->action) {
+ while (!i->action) {
i = m_registeredActionTextChanges.erase(i);
- continue;
+ if (i == m_registeredActionTextChanges.end()) {
+ break;
+ }
}
+
if (enabled && i->textStateOfRegisteredText == TextWhenNothingIsSelected) {
QString textWhenSomethingIsSelected = i->action->text();
i->action->setText(i->registeredText);
/**
* @brief Helps changing the texts of actions depending on the current selection.
+ *
+ * This is useful for actions that directly trigger a change when there is a selection and do something
+ * different when nothing is selected. For example should the copy action read "Copy" when items are
+ * selected but when no items are selected it can read "Copy…" since triggering it will enter selection
+ * mode and ask users to select the files they want to copy first.
*/
class ActionTextHelper : QObject
{
/**
* Changes the text of \a action to \a text whenever textsWhenNothingIsSelectedEnabled(true) is called.
- * The texts can be changed back by calling textsWhenNothingIsSelectedEnabled(false) is called.
+ * The texts can be changed back by calling textsWhenNothingIsSelectedEnabled(false).
* @see textsWhenNothingIsSelectedEnabled()
*/
void registerTextWhenNothingIsSelected(QAction *action, QString registeredText);
* @brief Small wrapper/helper class that contains an action and its widget.
*
* This class takes neither the responsibility for deleting its action() nor its widget().
+ *
+ * This class is only used from BottomBarContentsContainer currently.
+ * @see BottomBarContentsContainer
*/
class ActionWithWidget
{
ActionWithWidget(QAction *action);
/**
- * Connect @p action and @p button using copyActionDataToButton() and the
- * wraps the two together in the ActionWithWidget object.
- * ActionWithWidget doesn't take any ownership.
+ * Connect @p action and @p button using copyActionDataToButton() and
+ * wraps the two together in a ActionWithWidget object.
+ * ActionWithWidget doesn't take any ownership over the parameters.
*
* @see copyActionDataToButton()
*
*/
ActionWithWidget(QAction *action, QAbstractButton *button);
- /** @returns the action of this object. Crashes if that action has been deleted elsewhere in the meantime. */
+ /** @returns the action of this object. */
inline QAction *action() {
Q_CHECK_PTR(m_action);
return m_action;
/**
* A small helper method.
- * @return a button with the correct styling for the general mode of the SelectionModeBottomBar which can be added to its layout.
+ * @return a button with the correct styling for the general mode of the BottomBarContentsContainer which can be added to its layout.
*/
QAbstractButton *newButtonForAction(QAction *action, QWidget *parent);
{
updateBackgroundColor();
for (auto i = m_colorControlledWidgets.begin(); i != m_colorControlledWidgets.end(); ++i) {
- if (!*i) {
+ while (!*i) {
i = m_colorControlledWidgets.erase(i);
- continue;
+ if (i == m_colorControlledWidgets.end()) {
+ break;
+ }
}
setBackgroundColorForWidget(*i, m_backgroundColor);
}
}
m_backgroundColor = QColor::fromHsv(newHue,
- // Saturation should be closer to the active color because otherwise the selection mode color might overpower it.
+ // Saturation should be closer to the saturation of the active color
+ // because otherwise the selection mode color might overpower it.
.7 * activeBackgroundColor.saturation() + .3 * positiveBackgroundColor.saturation(),
(activeBackgroundColor.value() + positiveBackgroundColor.value()) / 2,
(activeBackgroundColor.alpha() + positiveBackgroundColor.alpha()) / 2);
/**
* Changes the background color of @p widget to a distinct color scheme matching color which makes it clear that the widget belongs to the selection mode.
+ * The background color of @p widget will from now on be updated automatically when the palette of the application changes.
*/
void controlBackgroundColor(QWidget *widget);
private:
BackgroundColorHelper();
+ /**
+ * Called when the palette of the application changes.
+ * Triggers updateBackgroundColor() and the updates the background color of m_colorControlledWidgets.
+ * @see updateBackgroundColor
+ */
void slotPaletteChanged();
+ /** Calculates a new m_colorControlledWidgets based on the current colour scheme of the application. */
void updateBackgroundColor();
private:
+ /// The widgets who have given up control over the background color to BackgroundColorHelper.
std::vector<QPointer<QWidget>> m_colorControlledWidgets;
+ /// The color to be used for the widgets' backgrounds.
QColor m_backgroundColor;
+ /// Singleton object
static BackgroundColorHelper *s_instance;
};
#include "backgroundcolorhelper.h"
#include "global.h"
-#include <KActionCollection>
-#include <KFileItem>
-#include <KFileItemListProperties>
-#include <KStandardAction>
-
#include <QGridLayout>
#include <QResizeEvent>
#include <QScrollArea>
m_heightAnimation->setDuration(2 *
style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, this) *
GlobalConfig::animationDurationFactor());
-
m_heightAnimation->setStartValue(height());
m_heightAnimation->setEasingCurve(QEasingCurve::OutCubic);
if (visible) {
return QWidget::resizeEvent(resizeEvent);
}
- m_contentsContainer->updateForNewWidth();
+ m_contentsContainer->adaptToNewBarWidth(width());
return QWidget::resizeEvent(resizeEvent);
}
#include <QPropertyAnimation>
#include <QWidget>
-#include <memory>
-
class KActionCollection;
class KFileItemList;
class QAction;
class BottomBarContentsContainer;
/**
- * A bar used in selection mode that serves various purposes depending on what the user is currently trying to do.
+ * @brief A bar used in selection mode that serves various purposes depending on what the user is currently trying to do.
*
* The Contents enum below gives a rough idea about the different states this bar might have.
* The bar is notified of various changes that make changing or updating the content worthwhile.
public:
/** The different contents this bar can have. */
- enum Contents{
+ enum Contents {
CopyContents,
CopyLocationContents,
CopyToOtherViewContents,
*
* This bar might also not show itself when setVisible(true), when context menu actions are supposed to be shown
* for the selected items but no items have been selected yet. In that case it will only show itself once items were selected.
+ *
+ * This bar might also ignore a setVisible(false) call, if it has PasteContents because that bar is supposed to stay visible
+ * even outside of selection mode.
+ *
+ * @param visible Whether this bar is supposed to be visible long term
+ * @param animated Whether this should be animated. The animation is skipped if the users' settings are configured that way.
+ *
* @see QWidget::setVisible()
*/
void setVisible(bool visible, Animated animated);
- using QWidget::setVisible; // Makes sure that the setVisible() declaration above doesn't hide the one from QWidget.
+ /**
+ * Changes the contents of the bar to @p contents.
+ */
void resetContents(Contents contents);
Contents contents() const;
QSize sizeHint() const override;
public Q_SLOTS:
+ /** Adapts the contents based on the selection in the related view. */
void slotSelectionChanged(const KFileItemList &selection, const QUrl &baseUrl);
/** Used to notify the m_selectionModeBottomBar that there is no other ViewContainer in the tab. */
void resizeEvent(QResizeEvent *resizeEvent) override;
private:
+ using QWidget::setVisible; // Makes sure that the setVisible() declaration above doesn't hide the one from QWidget so we can still use it privately.
+
/**
* Identical to SelectionModeBottomBar::setVisible() but doesn't change m_allowedToBeVisible.
* @see SelectionModeBottomBar::setVisible()
* This is necessary because this bar might have been setVisible(true) but there is no reason to show the bar currently so it was kept hidden.
* @see SelectionModeBottomBar::setVisible() */
bool m_allowedToBeVisible = false;
- /// @see SelectionModeBottomBar::setVisible()
+ /** @see SelectionModeBottomBar::setVisible() */
QPointer<QPropertyAnimation> m_heightAnimation;
};
}
}
-void BottomBarContentsContainer::updateForNewWidth()
+void BottomBarContentsContainer::adaptToNewBarWidth(int newBarWidth)
{
+ m_barWidth = newBarWidth;
+
if (m_contents == BottomBar::GeneralContents) {
Q_ASSERT(m_overflowButton);
if (unusedSpace() < 0) {
}
}
} else {
- // We have some unusedSpace(). Let's check if we can maybe add more of the contextual action's widgets.
+ // We have some unusedSpace(). Let's check if we can maybe add more of the contextual actions' widgets.
for (auto i = m_generalBarActions.begin(); i != m_generalBarActions.end(); ++i) {
if (i->isWidgetVisible()) {
continue;
auto contextActions = contextActionsFor(selection, baseUrl);
m_generalBarActions.clear();
if (contextActions.empty()) {
+ // We have nothing to show
Q_ASSERT(qobject_cast<BottomBar *>(parentWidget()->parentWidget()->parentWidget()));
if (isVisibleTo(parentWidget()->parentWidget()->parentWidget()->parentWidget())) { // is the bar visible
Q_EMIT barVisibilityChangeRequested(false);
// We claim to have PasteContents already so triggering the copy action next won't instantly hide the bottom bar.
connect(copyButton, &QAbstractButton::clicked, [this]() {
if (GeneralSettings::showPasteBarAfterCopying()) {
- m_contents = BottomBar::Contents::PasteContents;
+ m_contents = BottomBar::Contents::PasteContents; // prevents hiding
}
});
// Connect the copy action as a second step.
// We claim to have PasteContents already so triggering the cut action next won't instantly hide the bottom bar.
connect(cutButton, &QAbstractButton::clicked, [this]() {
if (GeneralSettings::showPasteBarAfterCopying()) {
- m_contents = BottomBar::Contents::PasteContents;
+ m_contents = BottomBar::Contents::PasteContents; // prevents hiding
}
});
// Connect the cut action as a second step.
vBoxLayout->addWidget(pasteButton);
auto *dismissButton = new QToolButton(this);
- dismissButton->setText(i18nc("@action Dismisses a bar explaining how to use the Paste action", "Dismiss this Reminder"));
+ dismissButton->setText(i18nc("@action Dismisses a bar explaining how to use the Paste action", "Dismiss This Reminder"));
connect(dismissButton, &QAbstractButton::clicked, this, actuallyLeaveSelectionMode);
- auto *dontRemindAgainAction = new QAction(i18nc("@action Dismisses an explanatory area and never shows it again", "Don't remind me again"), this);
+ auto *dontRemindAgainAction = new QAction(i18nc("@action Dismisses an explanatory area and never shows it again", "Don't Remind Me Again"), this);
connect(dontRemindAgainAction, &QAction::triggered, this, []() {
GeneralSettings::setShowPasteBarAfterCopying(false);
});
}
sumOfPreferredWidths += m_layout->itemAt(i)->sizeHint().width() + m_layout->spacing();
}
- Q_ASSERT(qobject_cast<BottomBar *>(parentWidget()->parentWidget()->parentWidget()));
- const int totalBarWidth = parentWidget()->parentWidget()->parentWidget()->width();
- return totalBarWidth - sumOfPreferredWidths - 20; // We consider all space used when there are only 20 pixels left
+ return m_barWidth - sumOfPreferredWidths - 20; // We consider all space used when there are only 20 pixels left
// so there is some room to breath and not too much wonkyness while resizing.
}
}
}
-void BottomBarContentsContainer::updateMainActionButton(const KFileItemList& selection)
+void BottomBarContentsContainer::updateMainActionButton(const KFileItemList& selectedItems)
{
if (!m_mainAction.widget()) {
return;
Q_ASSERT(qobject_cast<QAbstractButton *>(m_mainAction.widget()));
// Users are nudged towards selecting items by having the button disabled when nothing is selected.
- m_mainAction.widget()->setEnabled(selection.count() > 0 && m_mainAction.action()->isEnabled());
+ m_mainAction.widget()->setEnabled(selectedItems.count() > 0 && m_mainAction.action()->isEnabled());
QFontMetrics fontMetrics = m_mainAction.widget()->fontMetrics();
QString buttonText;
switch (m_contents) {
case BottomBar::CopyContents:
- buttonText = i18ncp("@action A more elaborate and clearly worded version of the Copy action",
- "Copy %2 to the Clipboard", "Copy %2 to the Clipboard", selection.count(),
- fileItemListToString(selection, fontMetrics.averageCharWidth() * 20, fontMetrics));
+ // i18n: A more elaborate and clearly worded version of the Copy action
+ // %2 is a textual representation of the currently selected files or folders. This can be the name of
+ // the file/files like "file1" or "file1, file2 and file3" or an aggregate like "8 Selected Folders".
+ // If this sort of word puzzle can not be correctly translated in your language, translate it as "NULL" (without the quotes)
+ // and a fallback will be used.
+ buttonText = i18ncp("@action", "Copy %2 to the Clipboard", "Copy %2 to the Clipboard", selectedItems.count(), fileItemListToString(selectedItems, fontMetrics.averageCharWidth() * 20, fontMetrics));
+ // All these long lines can not be broken up with line breaks becaue the i18n call should be completely
+ // in the line following the "i18n:" comment without any line breaks within the i18n call
+ // or the comment might not be correctly extracted. See: https://commits.kde.org/kxmlgui/a31135046e1b3335b5d7bbbe6aa9a883ce3284c1
break;
case BottomBar::CopyLocationContents:
- buttonText = i18ncp("@action A more elaborate and clearly worded version of the Copy Location action",
- "Copy the Location of %2 to the Clipboard", "Copy the Location of %2 to the Clipboard", selection.count(),
- fileItemListToString(selection, fontMetrics.averageCharWidth() * 20, fontMetrics));
+ // i18n: A more elaborate and clearly worded version of the Copy Location action
+ // %2 is a textual representation of the currently selected files or folders. This can be the name of
+ // the file/files like "file1" or "file1, file2 and file3" or an aggregate like "8 Selected Folders".
+ // If this sort of word puzzle can not be correctly translated in your language, translate it as "NULL" (without the quotes)
+ // and a fallback will be used.
+ buttonText = i18ncp("@action", "Copy the Location of %2 to the Clipboard", "Copy the Location of %2 to the Clipboard", selectedItems.count(), fileItemListToString(selectedItems, fontMetrics.averageCharWidth() * 20, fontMetrics));
break;
case BottomBar::CutContents:
- buttonText = i18ncp("@action A more elaborate and clearly worded version of the Cut action",
- "Cut %2 to the Clipboard", "Cut %2 to the Clipboard", selection.count(),
- fileItemListToString(selection, fontMetrics.averageCharWidth() * 20, fontMetrics));
+ // i18n: A more elaborate and clearly worded version of the Cut action
+ // %2 is a textual representation of the currently selected files or folders. This can be the name of
+ // the file/files like "file1" or "file1, file2 and file3" or an aggregate like "8 Selected Folders".
+ // If this sort of word puzzle can not be correctly translated in your language, translate it as "NULL" (without the quotes)
+ // and a fallback will be used.
+ buttonText = i18ncp("@action", "Cut %2 to the Clipboard", "Cut %2 to the Clipboard", selectedItems.count(), fileItemListToString(selectedItems, fontMetrics.averageCharWidth() * 20, fontMetrics));
break;
case BottomBar::DeleteContents:
- buttonText = i18ncp("@action A more elaborate and clearly worded version of the Delete action",
- "Permanently Delete %2", "Permanently Delete %2", selection.count(),
- fileItemListToString(selection, fontMetrics.averageCharWidth() * 20, fontMetrics));
+ // i18n: A more elaborate and clearly worded version of the Delete action
+ // %2 is a textual representation of the currently selected files or folders. This can be the name of
+ // the file/files like "file1" or "file1, file2 and file3" or an aggregate like "8 Selected Folders".
+ // If this sort of word puzzle can not be correctly translated in your language, translate it as "NULL" (without the quotes)
+ // and a fallback will be used.
+ buttonText = i18ncp("@action", "Permanently Delete %2", "Permanently Delete %2", selectedItems.count(), fileItemListToString(selectedItems, fontMetrics.averageCharWidth() * 20, fontMetrics));
break;
case BottomBar::DuplicateContents:
- buttonText = i18ncp("@action A more elaborate and clearly worded version of the Duplicate action",
- "Duplicate %2", "Duplicate %2", selection.count(),
- fileItemListToString(selection, fontMetrics.averageCharWidth() * 20, fontMetrics));
+ // i18n: A more elaborate and clearly worded version of the Duplicate action
+ // %2 is a textual representation of the currently selected files or folders. This can be the name of
+ // the file/files like "file1" or "file1, file2 and file3" or an aggregate like "8 Selected Folders".
+ // If this sort of word puzzle can not be correctly translated in your language, translate it as "NULL" (without the quotes)
+ // and a fallback will be used.
+ buttonText = i18ncp("@action", "Duplicate %2", "Duplicate %2", selectedItems.count(), fileItemListToString(selectedItems, fontMetrics.averageCharWidth() * 20, fontMetrics));
break;
case BottomBar::MoveToTrashContents:
- buttonText = i18ncp("@action A more elaborate and clearly worded version of the Trash action",
- "Move %2 to the Trash", "Move %2 to the Trash", selection.count(),
- fileItemListToString(selection, fontMetrics.averageCharWidth() * 20, fontMetrics));
+ // i18n: A more elaborate and clearly worded version of the Trash action
+ // %2 is a textual representation of the currently selected files or folders. This can be the name of
+ // the file/files like "file1" or "file1, file2 and file3" or an aggregate like "8 Selected Folders".
+ // If this sort of word puzzle can not be correctly translated in your language, translate it as "NULL" (without the quotes)
+ // and a fallback will be used.
+ buttonText = i18ncp("@action", "Move %2 to the Trash", "Move %2 to the Trash", selectedItems.count(), fileItemListToString(selectedItems, fontMetrics.averageCharWidth() * 20, fontMetrics));
break;
case BottomBar::RenameContents:
- buttonText = i18ncp("@action A more elaborate and clearly worded version of the Rename action",
- "Rename %2", "Rename %2", selection.count(),
- fileItemListToString(selection, fontMetrics.averageCharWidth() * 20, fontMetrics));
+ // i18n: A more elaborate and clearly worded version of the Rename action
+ // %2 is a textual representation of the currently selected files or folders. This can be the name of
+ // the file/files like "file1" or "file1, file2 and file3" or an aggregate like "8 Selected Folders".
+ // If this sort of word puzzle can not be correctly translated in your language, translate it as "NULL" (without the quotes)
+ // and a fallback will be used.
+ buttonText = i18ncp("@action", "Rename %2", "Rename %2", selectedItems.count(), fileItemListToString(selectedItems, fontMetrics.averageCharWidth() * 20, fontMetrics));
break;
default:
return;
*/
explicit BottomBarContentsContainer(KActionCollection *actionCollection, QWidget *parent);
+ /**
+ * @param contents The kind of contents that should be contained instead.
+ */
void resetContents(BottomBar::Contents contents);
inline BottomBar::Contents contents() const
{
return contents() != BottomBar::GeneralContents || m_internalContextMenu;
}
- void updateForNewWidth();
+ /**
+ * Is called when the BottomBar resizes to let this ContentsContainer know that it should adapt its contents to the new width.
+ * Adapting is done by showing or hiding labels or buttons.
+ */
+ void adaptToNewBarWidth(int newBarWidth);
public Q_SLOTS:
+ /** Adapts the contents based on the selection in the related view. */
void slotSelectionChanged(const KFileItemList &selection, const QUrl &baseUrl);
Q_SIGNALS:
void error(const QString &errorMessage);
/**
- * Sometimes the contents see no reason to be visible and request the bar to be hidden instead which emits this signal.
- * This can later change e.g. because the user selected items. Then this signal is used to request showing of the bar.
+ * When it does not make sense to show any specific contents, this signal is emitted and the receiver hides the bar.
+ * Later it might sense to show it again e.g. because the user selected items. Then this signal is used to request showing of the bar.
*/
void barVisibilityChangeRequested(bool visible);
void addRenameContents();
/**
- * Deletes all visible widgets and layouts from the bar.
+ * Deletes every child layout and child widget of this container.
*/
void emptyBarContents();
/**
- * @returns A vector containing contextual actions for the given \a selection in the \a baseUrl.
+ * @returns A vector containing contextual actions for the given \a selectedItems in the \a baseUrl.
* Cut, Copy, Rename and MoveToTrash are always added. Any further contextual actions depend on
- * \a selection and \a baseUrl. \a selection and \a baseUrl can be empty/default constructed if
- * no item- or view-specific actions should be added aside from Cut, Copy, Rename, MoveToTrash.
+ * \a selectedItems and \a baseUrl.
+ * If there are no \a selectedItems, an empty vector is returned and m_internalContextMenu is deleted.
* @param selectedItems The selected items for which contextual actions should be displayed.
* @param baseUrl Base URL of the viewport the contextual actions apply to.
*/
/**
* @returns the amount of pixels that can be spared to add more widgets. A negative value might
* be returned which signifies that some widgets should be hidden or removed from this bar to
- * make sure that this SelectionModeBottomBar won't stretch the width of its parent.
+ * make sure that this BottomBarContentsContainer can fully fit on the BottomBar.
*/
int unusedSpace() const;
void updateExplanatoryLabelVisibility();
/**
- * Changes the text and enabled state of the main action button
- * based on the amount of currently selected items and the state of the current m_mainAction.
+ * Changes the text and enabled state of the main action button based on the amount of currently
+ * selected items and the state of the current m_mainAction.
* The current main action depends on the current barContents.
- * @param selection the currently selected fileItems.
+ * @param selectedItems the currently selected fileItems.
*/
- void updateMainActionButton(const KFileItemList &selection);
+ void updateMainActionButton(const KFileItemList &selectedItems);
private:
/// All the actions that should be available from this bar when in general mode.
KActionCollection *m_actionCollection;
/// Describes the current contents of the bar.
BottomBar::Contents m_contents;
- /** The layout all the buttons and labels are added to.
- * Do not confuse this with layout() because we do have a QScrollView in between this widget and m_layout. */
+ /// The main layout of this ContentsContainer that all the buttons and labels are added to.
QHBoxLayout *m_layout;
- /// The info label used for some of the BarContents. Is hidden for narrow widths.
+ /// Caches the totalBarWidth as set in adaptToNewWidth(newBarWidth). */
+ int m_barWidth = 0;
+ /// The info label used for some of the Contents. Is hidden for narrow widths.
QPointer<QLabel> m_explanatoryLabel;
};
fillParentLayout->setContentsMargins(0, 0, 0, 0);
// Put the contents into a QScrollArea. This prevents increasing the view width
- // in case that not enough width for the contents is available. (this trick is also used in selectionmodebottombar.cpp.)
+ // in case that not enough width for the contents is available. (this trick is also used in bottombar.cpp.)
auto scrollArea = new QScrollArea(this);
fillParentLayout->addWidget(scrollArea);
scrollArea->setFrameShape(QFrame::NoFrame);
m_heightAnimation->start(QAbstractAnimation::DeleteWhenStopped);
}
-void TopBar::resizeEvent(QResizeEvent */* resizeEvent */)
+void TopBar::resizeEvent(QResizeEvent *resizeEvent)
{
updateLabelString();
+ return QWidget::resizeEvent(resizeEvent);
}
void TopBar::updateLabelString()
* @see QWidget::setVisible()
*/
void setVisible(bool visible, Animated animated);
- using QWidget::setVisible; // Makes sure that the setVisible() declaration above doesn't hide the one from QWidget.
Q_SIGNALS:
void leaveSelectionModeRequested();
protected:
- void resizeEvent(QResizeEvent */* resizeEvent */) override;
+ /** Calls updateLabelString() */
+ void resizeEvent(QResizeEvent *resizeEvent) override;
private:
+ using QWidget::setVisible; // Makes sure that the setVisible() declaration above doesn't hide the one from QWidget so we can still use it privately.
+
/** Decides whether the m_fullLabelString or m_shortLabelString should be used based on available width. */
void updateLabelString();
return m_container->controller()->selectionMode();
}
-
void DolphinView::setPreviewsShown(bool show)
{
if (previewsShown() == show) {
void setViewMode(Mode mode);
Mode viewMode() const;
+ /**
+ * Enables or disables a mode for quick and easy selection of items.
+ */
void setSelectionMode(bool enabled);
bool selectionMode() const;
connect(copyPathAction, &QAction::triggered, this, &DolphinViewActionHandler::slotCopyPath);
if (actionTextHelper) {
+ // The "…" at the end make clear that they won't trigger their respective actions directly.
actionTextHelper->registerTextWhenNothingIsSelected(trashAction, i18nc("@action:inmenu File", "Move to Trash…"));
actionTextHelper->registerTextWhenNothingIsSelected(deleteAction, i18nc("@action:inmenu File", "Delete…"));
actionTextHelper->registerTextWhenNothingIsSelected(duplicateAction, i18nc("@action:inmenu File", "Duplicate Here…"));
} else {
Q_EMIT actionBeingHandled();
m_currentView->renameSelectedItems();
+ // We don't exit selectionMode here because users might want to rename more items.
}
}