KDevelop API Documentation

filegroupspart.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2001-2002 by Bernd Gehrmann                             *
00003  *   bernd@kdevelop.org                                                    *
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 "filegroupspart.h"
00013 #include "filegroupspart.moc"
00014 
00015 #include <qwhatsthis.h>
00016 #include <qvbox.h>
00017 #include <qtimer.h>
00018 #include <kaction.h>
00019 #include <kdebug.h>
00020 #include <kiconloader.h>
00021 #include <klocale.h>
00022 #include <kdevgenericfactory.h>
00023 #include <kdialogbase.h>
00024 
00025 #include "kdevcore.h"
00026 #include "kdevproject.h"
00027 #include "kdevmainwindow.h"
00028 
00029 #include "filegroupswidget.h"
00030 #include "filegroupsconfigwidget.h"
00031 
00032 #define FILEGROUPS_OPTIONS 1
00033 
00034 typedef KDevGenericFactory<FileGroupsPart> FileGroupsFactory;
00035 static const KAboutData data("kdevfilegroups", I18N_NOOP("File Group View"), "1.0");
00036 K_EXPORT_COMPONENT_FACTORY( libkdevfilegroups, FileGroupsFactory( &data ) )
00037 
00038 FileGroupsPart::FileGroupsPart(QObject *parent, const char *name, const QStringList &)
00039     : KDevPlugin("FileGroups", "attach", parent, name ? name : "FileGroupsPart")
00040 {
00041     deleteRequested = false;
00042     setInstance(FileGroupsFactory::instance());
00043 
00044     m_filegroups = new FileGroupsWidget(this);
00045     m_filegroups->setCaption(i18n("File Group View"));
00046     m_filegroups->setIcon(SmallIcon( icon() ) );
00047     QWhatsThis::add(m_filegroups, i18n("<b>File group view</b><p>"
00048                                        "The file group viewer shows all files of the project, "
00049                                        "in groups which can be configured in project settings dialog, <b>File Groups</b> tab."));
00050     mainWindow()->embedSelectView(m_filegroups, i18n("File Groups"), i18n("File groups in the project directory"));
00051 
00052     _configProxy = new ConfigWidgetProxy( core() );
00053     _configProxy->createProjectConfigPage( i18n("File Groups"), FILEGROUPS_OPTIONS, icon() );
00054     connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )), 
00055         this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) );
00056 
00057 
00058     // File groups
00059     connect( project(), SIGNAL(addedFilesToProject(const QStringList&)),
00060              m_filegroups, SLOT(addFiles(const QStringList&)) );
00061     connect( project(), SIGNAL(removedFilesFromProject(const QStringList&)),
00062              m_filegroups, SLOT(removeFiles(const QStringList&)) );
00063 /*    connect( project(), SIGNAL(addedFileToProject(const QString&)),
00064              m_filegroups, SLOT(addFile(const QString&)) );
00065     connect( project(), SIGNAL(removedFileFromProject(const QString&)),
00066              m_filegroups, SLOT(removeFile(const QString&)) );*/
00067     m_filegroups->refresh();
00068 }
00069 
00070 FileGroupsPart::~FileGroupsPart()
00071 {
00072     deleteRequested = true;
00073     if (m_filegroups)
00074         mainWindow()->removeView(m_filegroups);
00075     delete m_filegroups;
00076     delete _configProxy;
00077 }
00078 
00079 void FileGroupsPart::refresh()
00080 {
00081     if (deleteRequested)
00082         return;
00083     // This method may be called from m_filetree's slot,
00084     // so we make sure not to modify the list view during
00085     // the execution of the slot
00086     QTimer::singleShot(0, m_filegroups, SLOT(refresh()));
00087 }
00088 
00089 void FileGroupsPart::insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber )
00090 {
00091     if ( pagenumber == FILEGROUPS_OPTIONS )
00092     {
00093         FileGroupsConfigWidget *w = new FileGroupsConfigWidget(this, page, "file groups config widget");
00094         connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) );
00095     }
00096 }
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