filelist_part.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
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
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
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
This file is part of the documentation for KDevelop Version 3.1.2.