Commit f81ff78a authored by Christoph Cullmann's avatar Christoph Cullmann

less friends

parent ac016ae7
......@@ -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
......
......@@ -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);
......
......@@ -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)
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment