From: ambar chakravartty Date: Sun, 2 Feb 2025 04:49:11 +0000 (+0000) Subject: Made style and context enhancements X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/bb163a7b3dc7857f698150460b33ba8f3f2204f9 Made style and context enhancements Co-authored by: Felix Ernst --- diff --git a/src/dolphintabbar.cpp b/src/dolphintabbar.cpp index b942c4fd3..4df25263f 100644 --- a/src/dolphintabbar.cpp +++ b/src/dolphintabbar.cpp @@ -177,7 +177,7 @@ void DolphinTabBar::contextMenuEvent(QContextMenuEvent *event) Q_EMIT tabCloseRequested(index); } else if (selectedAction == renameTabAction) { bool renamed = false; - const QString tabNewName = QInputDialog::getText(this, i18n("Rename Tab"), i18n("New tab name:"), QLineEdit::Normal, tabText(index), &renamed); + const QString tabNewName = QInputDialog::getText(this, i18nc("@title:window for text input", "Rename Tab"), i18n("New tab name:"), QLineEdit::Normal, tabText(index), &renamed); if (renamed) { Q_EMIT tabRenamed(index, tabNewName); diff --git a/src/dolphintabbar.h b/src/dolphintabbar.h index f176fb6d2..1210b974e 100644 --- a/src/dolphintabbar.h +++ b/src/dolphintabbar.h @@ -21,7 +21,7 @@ Q_SIGNALS: void tabDragMoveEvent(int index, QDragMoveEvent *event); void tabDropEvent(int index, QDropEvent *event); void tabDetachRequested(int index); - void tabRenamed(int index, const QString &name); + void tabRenamed(int index, const QString &label); protected: void dragEnterEvent(QDragEnterEvent *event) override; diff --git a/src/dolphintabpage.h b/src/dolphintabpage.h index 1b918c248..1e79fb5db 100644 --- a/src/dolphintabpage.h +++ b/src/dolphintabpage.h @@ -140,9 +140,17 @@ public: void switchActiveView(); - void setTitle(const QString &name); + /** + * Overwrites the automatically generated label of this tab with @p label. + * This @p label will be kept until it is overwritten by calling this method again. + * Calling this with an empty string will restore the automatic labelling. + */ + void setCustomLabel(const QString &label); - QString title() const; + /** + * @see setCustomLabel. + */ + QString customLabel() const; Q_SIGNALS: void activeViewChanged(DolphinViewContainer *viewContainer); @@ -205,7 +213,8 @@ private: bool m_primaryViewActive; bool m_splitViewEnabled; bool m_active; - QString m_title; + /** @see setCustomLabel(). */ + QString m_customLabel; }; class DolphinTabPageSplitterHandle : public QSplitterHandle diff --git a/src/dolphintabwidget.h b/src/dolphintabwidget.h index 3d9ba3a51..ca101e2db 100644 --- a/src/dolphintabwidget.h +++ b/src/dolphintabwidget.h @@ -229,7 +229,12 @@ private Q_SLOTS: void currentTabChanged(int index); - void renameTab(int index, const QString &name); + /** + * Calls DolphinTabPage::setCustomLabel(label) for the tab at @p index + * and propagates that change to the DolphinTabBar. + * @see DolphinTabPage::setCustomLabel(). + */ + void renameTab(int index, const QString &label); protected: void tabInserted(int index) override;