KDevelop API Documentation

filelist_part.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Jens Dagerbo                                    *
00003  *   jens.dagerbo@swipnet.se                                               *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  ***************************************************************************/
00011 
00012 #include <qwhatsthis.h>
00013 
00014 #include <kiconloader.h>
00015 #include <klocale.h>
00016 #include <kdevgenericfactory.h>
00017 #include <kdevpartcontroller.h>
00018 #include <kurl.h>
00019 #include <kparts/part.h>
00020 #include <kdebug.h>
00021 
00022 #include "kdevcore.h"
00023 #include "kdevmainwindow.h"
00024 
00025 
00026 #include "filelist_widget.h"
00027 #include "filelist_part.h"
00028 
00029 static const KAboutData data("kdevfilelist", I18N_NOOP("File List"), "1.0");
00030 
00031 typedef KDevGenericFactory<FileListPart> filelistFactory;
00032 K_EXPORT_COMPONENT_FACTORY( libkdevfilelist, filelistFactory( &data ) )
00033 
00034 FileListPart::FileListPart(QObject *parent, const char *name, const QStringList& )
00035         : KDevPlugin("filelist", "view_text", parent, name ? name : "FileListPart" )
00036 {
00037     setInstance(filelistFactory::instance());
00038     //setXMLFile("kdevpart_filelist.rc");
00039 
00040     m_widget = new FileListWidget(this);
00041     m_widget->setCaption(i18n("File List"));
00042     m_widget->setIcon( SmallIcon( icon() ) );
00043 
00044     QWhatsThis::add
00045         (m_widget, i18n("<b>File List</b><p>This is the list of opened files."));
00046 
00047     mainWindow()->embedSelectView( m_widget, i18n("File List"), i18n("Open files") );
00048 }
00049 
00050 
00051 FileListPart::~FileListPart()
00052 {
00053     if ( m_widget )
00054     {
00055         mainWindow()->removeView( m_widget );
00056     }
00057     delete m_widget;
00058 }
00059 
00060 // @todo remove. use partcontroller's method instead
00061 KURL::List FileListPart::openFiles()
00062 {
00063     KURL::List openfiles;
00064     if( const QPtrList<KParts::Part> * partlist = partController()->parts() )
00065     {
00066         QPtrListIterator<KParts::Part> it( *partlist );
00067         while ( KParts::Part* part = it.current() )
00068         {
00069             if ( KParts::ReadOnlyPart * ro_part = dynamic_cast<KParts::ReadOnlyPart*>( part ) )
00070             {
00071                 openfiles.append( ro_part->url() );
00072             }
00073             ++it;
00074         }
00075     }
00076     return openfiles;
00077 }
00078 
00079 #include "filelist_part.moc"
00080 
00081 // kate: space-indent off; indent-width 4; tab-width 4; show-tabs off;
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:57 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003