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