KDevelop API Documentation

fileselector_part.cpp

Go to the documentation of this file.
00001 #include <qwhatsthis.h>
00002 #include <qpushbutton.h>
00003 #include <qcheckbox.h>
00004 #include <qslider.h>
00005 #include <qvbox.h>
00006 
00007 #include <kiconloader.h>
00008 #include <klocale.h>
00009 #include <kapplication.h>
00010 #include <kstandarddirs.h>
00011 #include <ktextbrowser.h>
00012 #include <kconfig.h>
00013 #include <kfileitem.h>
00014 #include <kdevgenericfactory.h>
00015 #include <kdiroperator.h>
00016 #include <kdialogbase.h>
00017 
00018 #include <kdevapi.h>
00019 #include <kdevcore.h>
00020 #include <kdevproject.h>
00021 #include <kdevmainwindow.h>
00022 #include <kdevpartcontroller.h>
00023 
00024 #include <ktip.h>
00025 
00026 #include "fileselector_widget.h"
00027 #include "fileselector_part.h"
00028 
00029 typedef KDevGenericFactory<FileSelectorPart> FileSelectorFactory;
00030 static const KAboutData data("kdevfileselector", I18N_NOOP("File Selector"), "1.0");
00031 K_EXPORT_COMPONENT_FACTORY( libkdevfileselector, FileSelectorFactory( &data ) )
00032 
00033 FileSelectorPart::FileSelectorPart(QObject *parent, const char *name, const QStringList &)
00034     : KDevPlugin("FileSelector", "fileopen", parent, name ? name : "FileSelectorPart")
00035 {
00036     setInstance(FileSelectorFactory::instance());
00037 
00038     m_filetree = new KDevFileSelector( this, mainWindow(), partController(), 0, "fileselectorwidget" );
00039 
00040     connect( m_filetree->dirOperator(), SIGNAL(fileSelected(const KFileItem*)),
00041          this, SLOT(fileSelected(const KFileItem*)));
00042     connect( core(), SIGNAL(projectOpened()), this, SLOT(slotProjectOpened()) );
00043 
00044     connect( core(), SIGNAL(configWidget(KDialogBase*)), this, SLOT(slotConfigWidget(KDialogBase*)) );
00045 
00046     m_filetree->setCaption( i18n("File Selector") );
00047     m_filetree->setIcon( SmallIcon( icon() ) );
00048     mainWindow()->embedSelectView( m_filetree, i18n("File Selector"), i18n("File selector") );
00049     QWhatsThis::add(m_filetree, i18n("<b>File selector</b><p>This file selector lists directory contents and provides some file management functions."));
00050 
00051     m_filetree->readConfig( instance()->config(), "fileselector" );
00052 }
00053 
00054 FileSelectorPart::~FileSelectorPart()
00055 {
00056     if (m_filetree){
00057     mainWindow()->removeView( m_filetree );
00058     }
00059 
00060     delete (KDevFileSelector*) m_filetree;
00061 }
00062 
00063 void FileSelectorPart::fileSelected( const KFileItem * file )
00064 {
00065     KURL u(file->url());
00066 
00067     partController()->editDocument( u );
00068 }
00069 
00070 void FileSelectorPart::slotProjectOpened()
00071 {
00072     KURL u;
00073     u.setPath( project()->projectDirectory() );
00074     m_filetree->setDir( u );
00075 }
00076 
00077 void FileSelectorPart::slotConfigWidget( KDialogBase * dlg )
00078 {
00079     QVBox* vbox = dlg->addVBoxPage( i18n("File Selector"), i18n("File Selector"), BarIcon( icon(), KIcon::SizeMedium) );
00080     KFSConfigPage* page = new KFSConfigPage( vbox, 0, m_filetree );
00081     connect( dlg, SIGNAL( okClicked( ) ), page, SLOT( apply( ) ) );
00082     // ### implement reload
00083 }
00084 
00085 #include "fileselector_part.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:40 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003