kate Library API Documentation

kateprojectviews.cpp

00001 /* This file is part of the KDE project 00002 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> 00003 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org> 00004 Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #include "kateprojectviews.h" 00022 #include "kateprojectviews.moc" 00023 00024 #include "kateprojectmanager.h" 00025 #include "katemainwindow.h" 00026 #include "kactionselector.h" 00027 #include "kateprojecttreeview.h" 00028 00029 #include <qapplication.h> 00030 #include <qlayout.h> 00031 #include <qstringlist.h> 00032 00033 #include <klocale.h> 00034 00035 00036 KateProjectViews::KateProjectViews (KateProjectManager *_projectManager, KateMainWindow *_mainWindow, QWidget * parent, const char * name ): QWidget (parent, name) 00037 { 00038 setFocusPolicy ((QWidget::FocusPolicy)0); 00039 00040 QVBoxLayout* lo = new QVBoxLayout(this); 00041 00042 m_projectManager = _projectManager; 00043 m_mainWindow = _mainWindow; 00044 00045 m_stack = new QWidgetStack (this); 00046 lo->addWidget(m_stack); 00047 lo->setStretchFactor(m_stack, 2); 00048 00049 // init of the combo box 00050 for (uint i = 0; i < m_projectManager->projects(); i++) 00051 projectCreated (m_projectManager->project(i)); 00052 00053 projectChanged (); 00054 00055 // connecting 00056 connect(m_projectManager->projectManager(),SIGNAL(projectCreated(Kate::Project *)),this,SLOT(projectCreated(Kate::Project *))); 00057 connect(m_projectManager->projectManager(),SIGNAL(projectDeleted(uint)),this,SLOT(projectDeleted(uint))); 00058 connect(m_mainWindow->mainWindow(),SIGNAL(projectChanged()),this,SLOT(projectChanged())); 00059 } 00060 00061 KateProjectViews::~KateProjectViews () 00062 { 00063 } 00064 00065 void KateProjectViews::projectChanged () 00066 { 00067 Kate::Project *p = 0; 00068 00069 if (!(p = m_mainWindow->activeProject())) 00070 return; 00071 00072 m_stack->raiseWidget (m_wMap[p->projectNumber()]); 00073 } 00074 00075 void KateProjectViews::projectCreated (Kate::Project *project) 00076 { 00077 if (!project) 00078 return; 00079 00080 KateProjectTreeViewContainer *c = 00081 new KateProjectTreeViewContainer( project, m_mainWindow, m_stack ) ; 00082 00083 m_wMap[project->projectNumber()] = c; 00084 00085 m_stack->raiseWidget (c); 00086 } 00087 00088 void KateProjectViews::projectDeleted (uint projectNumber) 00089 { 00090 QWidget *w = m_wMap[projectNumber]; 00091 00092 if (!w) 00093 return; 00094 00095 m_wMap.remove (projectNumber); 00096 m_stack->removeWidget (w); 00097 delete w; 00098 }
KDE Logo
This file is part of the documentation for kate Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 13 21:47:01 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003