[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/kate/app
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2007-01-28 14:53:43
Message-ID: 1169996023.913824.17826.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 627895 by cullmann:

bit work to give the tabs the correct title ;)

 M  +19 -0     kateviewmanager.cpp  
 M  +4 -0      kateviewmanager.h  
 M  +13 -0     kateviewspacecontainer.cpp  
 M  +4 -0      kateviewspacecontainer.h  


--- trunk/KDE/kdebase/kate/app/kateviewmanager.cpp #627894:627895
@@ -220,6 +220,9 @@
   connect(container,SIGNAL(viewChanged()),this,SIGNAL(viewChanged()));
   connect(container,SIGNAL(viewChanged()),m_mainWindow->mainWindow(),SIGNAL(viewChanged()));
  
+  // update title...
+  connect(container, SIGNAL(changeMyTitle (QWidget *)), this, SLOT(changeMyTitle \
(QWidget *))); +
   if (!m_init)
   {
     container->activateView(doc);
@@ -248,6 +251,22 @@
   tabChanged(m_viewSpaceContainerList[pos]);
 }
 
+void KateViewManager::changeMyTitle (QWidget *page)
+{
+  // get container
+  KateViewSpaceContainer *container=qobject_cast<KateViewSpaceContainer*>(page);
+
+  // should be always valid
+  Q_ASSERT(container);
+
+  // update title if possible
+  if (container->activeView())
+  {
+    m_mainWindow->tabWidget()->setTabText (m_mainWindow->tabWidget()->indexOf (page)
+      , container->activeView()->document()->documentName());
+  }
+}
+
 void KateViewManager::activateNextTab()
 {
   if( m_mainWindow->tabWidget()->count() <= 1 ) return;
--- trunk/KDE/kdebase/kate/app/kateviewmanager.h #627894:627895
@@ -126,9 +126,13 @@
 
     QPointer<KTextEditor::View> guiMergedView;
 
+  protected Q_SLOTS:
+    void changeMyTitle (QWidget *page);
+
   Q_SIGNALS:
     void statChanged ();
     void viewChanged ();
+
   private:
     QList<KateViewSpaceContainer *> m_viewSpaceContainerList;
     KateViewSpaceContainer *m_currentContainer;
--- trunk/KDE/kdebase/kate/app/kateviewspacecontainer.cpp #627894:627895
@@ -74,12 +74,20 @@
 
   connect(KateDocManager::self(),SIGNAL(documentCreated(KTextEditor::Document \
*)),this,SLOT(documentCreated(KTextEditor::Document *)));  \
connect(KateDocManager::self(),SIGNAL(documentDeleted(KTextEditor::Document \
*)),this,SLOT(documentDeleted(KTextEditor::Document *))); +
+  // title change
+  connect(this, SIGNAL(viewChanged()), this, SLOT(titleMayChange()));
 }
 
 KateViewSpaceContainer::~KateViewSpaceContainer ()
 {
 }
 
+void KateViewSpaceContainer::titleMayChange ()
+{
+  emit changeMyTitle (this);
+}
+
 void KateViewSpaceContainer::documentCreated (KTextEditor::Document *doc)
 {
   if (m_blockViewCreationAndActivation) return;
@@ -124,6 +132,11 @@
   connect(view,SIGNAL(dropEventPass(QDropEvent *)), \
mainWindow(),SLOT(slotDropEvent(QDropEvent *)));  \
connect(view,SIGNAL(focusIn(KTextEditor::View \
*)),this,SLOT(activateSpace(KTextEditor::View *)));  
+  // title change
+  connect(view->document(),SIGNAL(documentUrlChanged ( KTextEditor::Document \
*)),this,SLOT(titleMayChange())); +  connect(view->document(), \
SIGNAL(modifiedChanged(KTextEditor::Document *)), this, SLOT(titleMayChange())); +  \
connect(view->document(),SIGNAL(documentNameChanged ( KTextEditor::Document * \
)),SLOT(titleMayChange())); +
   activeViewSpace()->addView( view );
   activateView( view );
 
--- trunk/KDE/kdebase/kate/app/kateviewspacecontainer.h #627894:627895
@@ -138,8 +138,12 @@
     void activateNextView();
     void activatePrevView();
 
+  private Q_SLOTS:
+    void titleMayChange ();
+
   Q_SIGNALS:
     void viewChanged ();
+    void changeMyTitle (QWidget *page);
 
   private:
     KateViewManager *m_viewManager;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic