summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2014-01-21 10:21:07 (GMT)
committerChristoph Cullmann <cullmann@kde.org>2014-01-21 10:21:07 (GMT)
commitf81ff78a53eb7a3a76567f1b61bd35671f5de8f5 (patch)
treee7c2e77736064f1903a063695142ff072baee5a3
parentac016ae7e49d925cf550b6a3f5920419c84c597f (diff)
less friends
-rw-r--r--kate/app/kateviewmanager.cpp6
-rw-r--r--kate/app/kateviewmanager.h5
-rw-r--r--kate/app/kateviewspace.cpp24
-rw-r--r--kate/app/kateviewspace.h11
4 files changed, 22 insertions, 24 deletions
diff --git a/kate/app/kateviewmanager.cpp b/kate/app/kateviewmanager.cpp
index 5b98ee6..1cf111d 100644
--- a/kate/app/kateviewmanager.cpp
+++ b/kate/app/kateviewmanager.cpp
@@ -433,7 +433,7 @@ bool KateViewManager::createView ( KTextEditor::Document *doc )
* create view, registers its XML gui itself
* pass the view the correct main window
*/
- KTextEditor::View *view = (KTextEditor::View *) doc->createView (activeViewSpace()->stack, m_mainWindow->wrapper());
+ KTextEditor::View *view = activeViewSpace()->createView (doc);
m_viewList.append (view);
m_activeStates[view] = false;
@@ -442,13 +442,9 @@ bool KateViewManager::createView ( KTextEditor::Document *doc )
delete view->actionCollection()->action( QStringLiteral("set_confdlg") );
delete view->actionCollection()->action( QStringLiteral("editor_options") );
- //view->setContextMenu(view->defaultContextMenu());
-
connect(view, SIGNAL(dropEventPass(QDropEvent*)), mainWindow(), SLOT(slotDropEvent(QDropEvent*)));
connect(view, SIGNAL(focusIn(KTextEditor::View*)), this, SLOT(activateSpace(KTextEditor::View*)));
- activeViewSpace()->addView( view );
-
viewCreated(view);
#ifdef KActivities_FOUND
diff --git a/kate/app/kateviewmanager.h b/kate/app/kateviewmanager.h
index 0ef23fd..7e77e48 100644
--- a/kate/app/kateviewmanager.h
+++ b/kate/app/kateviewmanager.h
@@ -47,9 +47,6 @@ class KateViewManager : public QSplitter
{
Q_OBJECT
- friend class KateViewSpace;
- friend class KateVSStatusBar;
-
public:
KateViewManager (QWidget *parentW, KateMainWindow *parent);
~KateViewManager ();
@@ -139,13 +136,13 @@ class KateViewManager : public QSplitter
return m_viewList;
}
- private:
/**
* create and activate a new view for doc, if doc == 0, then
* create a new document
*/
bool createView ( KTextEditor::Document *doc = 0L );
+ private:
bool deleteView ( KTextEditor::View *view, bool delViewSpace = true);
void moveViewtoSplit (KTextEditor::View *view);
diff --git a/kate/app/kateviewspace.cpp b/kate/app/kateviewspace.cpp
index b2141b5..e361a43 100644
--- a/kate/app/kateviewspace.cpp
+++ b/kate/app/kateviewspace.cpp
@@ -106,8 +106,13 @@ void KateViewSpace::statusBarToggled ()
mStatusBar->hide ();
}
-void KateViewSpace::addView(KTextEditor::View* v, bool show)
+KTextEditor::View *KateViewSpace::createView (KTextEditor::Document *doc)
{
+ /**
+ * Create a fresh view
+ */
+ KTextEditor::View *v = doc->createView (stack, m_viewManager->mainWindow()->wrapper());
+
// restore the config of this view if possible
if ( !m_group.isEmpty() )
{
@@ -128,18 +133,9 @@ void KateViewSpace::addView(KTextEditor::View* v, bool show)
}
stack->addWidget(v);
- if (show)
- {
- mViewList.append(v);
- showView( v );
- }
- else
- {
- KTextEditor::View* c = (KTextEditor::View*)stack->currentWidget();
- mViewList.prepend( v );
- showView( c );
- }
-
+ mViewList.append(v);
+ showView( v );
+
// signals for the statusbar
connect(v, SIGNAL(cursorPositionChanged(KTextEditor::View*,KTextEditor::Cursor)), mStatusBar, SLOT(cursorPositionChanged(KTextEditor::View*)));
connect(v, SIGNAL(viewModeChanged(KTextEditor::View*)), mStatusBar, SLOT(viewModeChanged(KTextEditor::View*)));
@@ -149,6 +145,8 @@ void KateViewSpace::addView(KTextEditor::View* v, bool show)
connect(v->document(), SIGNAL(modifiedOnDisk(KTextEditor::Document*,bool,KTextEditor::ModificationInterface::ModifiedOnDiskReason)), mStatusBar, SLOT(modifiedChanged()) );
connect(v->document(), SIGNAL(documentNameChanged(KTextEditor::Document*)), mStatusBar, SLOT(documentNameChanged()));
connect(v->document(), SIGNAL(configChanged()), mStatusBar, SLOT(documentConfigChanged()));
+
+ return v;
}
void KateViewSpace::removeView(KTextEditor::View* v)
diff --git a/kate/app/kateviewspace.h b/kate/app/kateviewspace.h
index 57b2eaf..3b17695 100644
--- a/kate/app/kateviewspace.h
+++ b/kate/app/kateviewspace.h
@@ -97,10 +97,16 @@ class KateViewSpace : public QFrame
public:
explicit KateViewSpace(KateViewManager *, QWidget* parent = 0, const char* name = 0);
~KateViewSpace();
+
bool isActiveSpace();
void setActive(bool b, bool showled = false);
- QStackedWidget* stack;
- void addView(KTextEditor::View* v, bool show = true);
+
+ /**
+ * Create new view for given document
+ * @param doc document to create view for
+ * @return new created view
+ */
+ KTextEditor::View *createView (KTextEditor::Document *doc);
void removeView(KTextEditor::View* v);
bool showView(KTextEditor::View *view)
@@ -122,6 +128,7 @@ class KateViewSpace : public QFrame
void statusBarToggled ();
private:
+ QStackedWidget* stack;
bool mIsActiveSpace;
KateVSStatusBar* mStatusBar;
/// This list is necessary to only save the order of the accessed views.