KDevelop API Documentation

viewmanager.cpp

Go to the documentation of this file.
00001 #include <kiconloader.h>
00002 #include <kstandarddirs.h>
00003 #include <kapplication.h>
00004 #include <kaction.h>
00005 #include <klocale.h>
00006 #include <kfiledialog.h>
00007 #include <kmessagebox.h>
00008 #include <kcmdlineargs.h>
00009 #include <klibloader.h>
00010 #include <qwidget.h>
00011 #include <qdir.h>
00012 
00013 #include "viewmanager.h"
00014 
00015 ViewManager::ViewManager (QWidget *parent, DocManager *dm) : QTabWidget (parent)
00016 {
00017   views.setAutoDelete (true);
00018   this->dm = dm;
00019 }
00020 
00021 ViewManager::~ViewManager()
00022 {
00023   views.setAutoDelete (false);
00024 }
00025 
00026 void ViewManager::createView (KTextEditor::Document *doc)
00027 {
00028   KTextEditor::View *view = doc->createView (this, "nix");
00029   addTab (view, QString ("test"));
00030   view->show();
00031   showPage (view);
00032   views.append (view);
00033 }
00034 
00035 void ViewManager::closeView (KTextEditor::View *view)
00036 {
00037   removePage (view);
00038 }
00039 
00040 void ViewManager::slotDocumentNew()
00041 {
00042   KTextEditor::Document *doc = dm->createDoc ("");
00043   createView (doc);
00044 }
00045 
00046 void ViewManager::slotDocumentOpen()
00047 {
00048   QString path = QString::null;
00049   KURL::List urls = KFileDialog::getOpenURLs(path, QString::null, 0L, i18n("Open File"));
00050   if(urls.isEmpty())
00051       return;
00052   for (KURL::List::Iterator i=urls.begin(); i != urls.end(); ++i)
00053   {
00054     KTextEditor::Document *doc = dm->createDoc ("");
00055     createView (doc);
00056     doc->openURL( *i );
00057   }
00058 }
00059 
00060 void ViewManager::slotDocumentClose()
00061 {
00062   KTextEditor::View *view = (KTextEditor::View *) currentPage();
00063   KTextEditor::Document *doc = view->document();
00064   closeView (view);
00065   dm->deleteDoc(doc);
00066 }
00067 #include "viewmanager.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:41 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003