]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Made style and context enhancements
authorambar chakravartty <amch9605@gmail.com>
Sun, 2 Feb 2025 04:49:11 +0000 (04:49 +0000)
committerMéven Car <meven@kde.org>
Thu, 6 Feb 2025 14:32:35 +0000 (14:32 +0000)
Co-authored by: Felix Ernst

src/dolphintabbar.cpp
src/dolphintabbar.h
src/dolphintabpage.h
src/dolphintabwidget.h

index b942c4fd354fbad50b593f4e2ae34df5b1eca307..4df25263f3f52deb07a5555e60feba2453336a2b 100644 (file)
@@ -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);
index f176fb6d285fcdb48c62bcec9bab51f674cc6ab9..1210b974e3be5ecbffb8b56814b31b12316cf876 100644 (file)
@@ -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;
index 1b918c24807b97ebf4221b312e3daf9cb184a2cb..1e79fb5db071f48c68f95c06faedcb2a033064db 100644 (file)
@@ -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
index 3d9ba3a51e8feb84753d3e6d7146f0dcec45f1c4..ca101e2dbfcf6a6c232b61cb337270e50d13ecf1 100644 (file)
@@ -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;