[Konversation-devel] [Bug 207734] when closing the last tab the new last tab gets marked as read

Eike Hein hein at kde.org
Thu Jul 1 16:20:45 CEST 2010


https://bugs.kde.org/show_bug.cgi?id=207734





--- Comment #3 from Eike Hein <hein kde org>  2010-07-01 16:20:43 ---
commit 4c2bfcc96be4eb701115dcaaa538ef070bf5667b
Author: Eike Hein <hein at kde.org>
Date:   Thu Sep 17 23:57:18 2009 +0000

    Fixed a bug with Qt 4.5 where after closing a tab a tab adjacent to it
    would briefly be activated before subsequently activating the tab that
    was active before the just closed one (i.e. only noticable when 'a tab
    adjacent to the just closed tab' and 'the previously active tab' are not
    the same).
    BUG:207734

    svn path=/trunk/extragear/network/konversation/; revision=1025089

diff --git a/ChangeLog b/ChangeLog
index 9379e43..c440c93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,6 +59,11 @@ Changes since 1.2-alpha6:
   the expected way.
 * Various actions that operate on the active tab (e.g. those found in the
   "Insert" menu) are now properly disabled when the last tab is closed.
+* Fixed a bug with Qt 4.5 where after closing a tab a tab adjacent to it
+  would briefly be activated before subsequently activating the tab that
+  was active before the just closed one (i.e. only noticable when 'a tab
+  adjacent to the just closed tab' and 'the previously active tab' are not
+  the same).


 Changes from 1.2-alpha5 to 1.2-alpha6:
diff --git a/src/viewer/viewcontainer.cpp b/src/viewer/viewcontainer.cpp
index 3af953f..a4f85be 100644
--- a/src/viewer/viewcontainer.cpp
+++ b/src/viewer/viewcontainer.cpp
@@ -38,22 +38,29 @@
 #include <QList>
 #include <QSplitter>
 #include <QToolButton>
+#include <QTabBar>

 #include <KInputDialog>
-#include <KTabWidget>
 #include <KMessageBox>
 #include <KGlobalSettings>
 #include <KVBox>
 #include <KRun>
 #include <KUrl>
 #include <KXMLGUIFactory>
-
 #include <KActionCollection>
 #include <KToggleAction>
 #include <KSelectAction>

 using namespace Konversation;

+TabWidget::TabWidget(QWidget* parent) : KTabWidget(parent)
+{
+}
+
+TabWidget::~TabWidget()
+{
+}
+
 ViewContainer::ViewContainer(MainWindow* window):
         m_window(window)
         , m_tabWidget(0)
@@ -153,13 +160,16 @@ void ViewContainer::setupTabWidget()
     m_vbox = new KVBox(m_viewTreeSplitter);
     m_viewTreeSplitter->setStretchFactor(m_viewTreeSplitter->indexOf(m_vbox),
1);
     m_vbox->setObjectName("main_window_right_side");
-    m_tabWidget = new KTabWidget(m_vbox);
+    m_tabWidget = new TabWidget(m_vbox);
     m_tabWidget->setObjectName("main_window_tab_widget");
     m_queueTuner = new QueueTuner(m_vbox, this);
     m_queueTuner->hide();

     m_tabWidget->setTabReorderingEnabled(true);
     m_tabWidget->setTabCloseActivatePrevious(true);
+#if QT_VERSION >= 0x040500
+   
m_tabWidget->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
+#endif

     m_vbox->hide();    //m_tabWidget->hide();

@@ -1378,6 +1388,8 @@ void ViewContainer::addView(ChatWindow* view, const
QString& label, bool weiniti

 void ViewContainer::switchView(int newIndex)
 {
+    kDebug();
+
     ChatWindow* view =
static_cast<ChatWindow*>(m_tabWidget->widget(newIndex));
     if (!view) return;

@@ -1429,6 +1441,8 @@ void ViewContainer::switchView(int newIndex)

 void ViewContainer::showView(ChatWindow* view)
 {
+    kDebug();
+
     // Don't bring Tab to front if TabWidget is hidden. Otherwise QT gets
confused
     // and shows the Tab as active but will display the wrong pane
     if (m_tabWidget && m_tabWidget->isVisible())
diff --git a/src/viewer/viewcontainer.h b/src/viewer/viewcontainer.h
index 1b7c0cd..088ea08 100644
--- a/src/viewer/viewcontainer.h
+++ b/src/viewer/viewcontainer.h
@@ -20,10 +20,12 @@
 #include <QObject>
 #include <QPointer>

+#include <KTabWidget>
+

 class QSplitter;
+class QTabBar;

-class KTabWidget;
 class KActionCollection;
 class KVBox;

@@ -47,6 +49,17 @@ namespace Konversation
     }
 }

+class TabWidget : public KTabWidget
+{
+    Q_OBJECT
+
+    public:
+        TabWidget(QWidget* parent = 0);
+        ~TabWidget();
+
+    QTabBar* tabBar() { return KTabWidget::tabBar(); }
+};
+
 class ViewContainer : public QObject
 {
     Q_OBJECT
@@ -207,10 +220,10 @@ class ViewContainer : public QObject
         MainWindow* m_window;

         QSplitter* m_viewTreeSplitter;
-        KTabWidget* m_tabWidget;
+        TabWidget* m_tabWidget;
         ViewTree* m_viewTree;
-        KVBox *m_vbox;
-        QueueTuner *m_queueTuner;
+        KVBox* m_vbox;
+        QueueTuner* m_queueTuner;

         Images* images;

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Konversation-devel mailing list