summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Haumann <dhaumann@kde.org>2014-01-22 21:32:11 (GMT)
committerDominik Haumann <dhaumann@kde.org>2014-01-22 21:32:11 (GMT)
commit42039be2bb58573afc6fd1544783600875697cc7 (patch)
tree42ba1c7e5977a3a0f20243b1c196fb04cc919a4d
parent19281dd6f0b4b66f275b9c74a21de159438ac53b (diff)
some cleanups
- derive KateViewSpace from QWidget - activate view space before showing view
-rw-r--r--kate/app/kateviewspace.cpp19
-rw-r--r--kate/app/kateviewspace.h6
2 files changed, 11 insertions, 14 deletions
diff --git a/kate/app/kateviewspace.cpp b/kate/app/kateviewspace.cpp
index 5b3be5b..5d0a37b 100644
--- a/kate/app/kateviewspace.cpp
+++ b/kate/app/kateviewspace.cpp
@@ -30,26 +30,18 @@
#include "katetabbar.h"
#include "kactioncollection.h"
-#include <KSqueezedTextLabel>
-#include <KStringHandler>
#include <KLocalizedString>
-#include <kiconutils.h>
#include <KConfigGroup>
-#include <KXMLGUIFactory>
-#include <QTimer>
#include <QToolButton>
-#include <QCursor>
#include <QMouseEvent>
-#include <QMenu>
-#include <QSizeGrip>
#include <QStackedWidget>
//BEGIN KateViewSpace
KateViewSpace::KateViewSpace( KateViewManager *viewManager,
QWidget* parent, const char* name )
- : QFrame(parent),
- m_viewManager( viewManager )
+ : QWidget(parent)
+ , m_viewManager(viewManager)
{
setObjectName(QString::fromLatin1(name));
QVBoxLayout *layout = new QVBoxLayout(this);
@@ -61,7 +53,6 @@ KateViewSpace::KateViewSpace( KateViewManager *viewManager,
// add tab bar
m_tabBar = new KateTabBar(this);
- layout->addWidget(m_tabBar);
connect(m_tabBar, &KateTabBar::currentChanged, this, &KateViewSpace::changeView);
hLayout->addWidget(m_tabBar);
@@ -239,6 +230,12 @@ void KateViewSpace::changeView(int buttonId)
KTextEditor::Document * doc = m_docToTabId.key(buttonId);
Q_ASSERT(doc);
+ // make sure we open the view in this view space
+ if (! isActiveSpace()) {
+ m_viewManager->setActiveSpace(this);
+ }
+
+ // tell the view manager to show the view
m_viewManager->activateView(doc);
}
diff --git a/kate/app/kateviewspace.h b/kate/app/kateviewspace.h
index 2f5bbf5..627de20 100644
--- a/kate/app/kateviewspace.h
+++ b/kate/app/kateviewspace.h
@@ -25,9 +25,9 @@
#include <ktexteditor/document.h>
#include <ktexteditor/modificationinterface.h>
-#include <QList>
-#include <QFrame>
#include <QHash>
+#include <QList>
+#include <QWidget>
class KConfigBase;
class KateViewManager;
@@ -36,7 +36,7 @@ class QStackedWidget;
class QLabel;
class KateTabBar;
-class KateViewSpace : public QFrame
+class KateViewSpace : public QWidget
{
Q_OBJECT