1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/***************************************************************************
* Copyright (C) 2001-2002 by Bernd Gehrmann *
* [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "filegroupspart.h"
#include "filegroupspart.moc"
#include <tqwhatsthis.h>
#include <tqvbox.h>
#include <tqtimer.h>
#include <tdeaction.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <tdelocale.h>
#include <kdevgenericfactory.h>
#include <kdialogbase.h>
#include "kdevcore.h"
#include "kdevproject.h"
#include "kdevmainwindow.h"
#include "kdevplugininfo.h"
#include "filegroupswidget.h"
#include "filegroupsconfigwidget.h"
#define FILEGROUPS_OPTIONS 1
typedef KDevGenericFactory<FileGroupsPart> FileGroupsFactory;
static const KDevPluginInfo pluginData("kdevfilegroups");
K_EXPORT_COMPONENT_FACTORY( libkdevfilegroups, FileGroupsFactory( pluginData ) )
FileGroupsPart::FileGroupsPart(TQObject *parent, const char *name, const TQStringList &)
: KDevPlugin(&pluginData, parent, name ? name : "FileGroupsPart")
{
deleteRequested = false;
setInstance(FileGroupsFactory::instance());
m_filegroups = new FileGroupsWidget(this);
m_filegroups->setCaption(i18n("File Group View"));
m_filegroups->setIcon(SmallIcon( info()->icon() ) );
TQWhatsThis::add(m_filegroups, i18n("<b>File group view</b><p>"
"The file group viewer shows all files of the project, "
"in groups which can be configured in project settings dialog, <b>File Groups</b> tab."));
mainWindow()->embedSelectView(m_filegroups, i18n("File Groups"), i18n("File groups in the project directory"));
_configProxy = new ConfigWidgetProxy( core() );
_configProxy->createProjectConfigPage( i18n("File Groups"), FILEGROUPS_OPTIONS, info()->icon() );
connect( _configProxy, TQT_SIGNAL(insertConfigWidget(const KDialogBase*, TQWidget*, unsigned int )),
this, TQT_SLOT(insertConfigWidget(const KDialogBase*, TQWidget*, unsigned int )) );
// File groups
connect( project(), TQT_SIGNAL(addedFilesToProject(const TQStringList&)),
m_filegroups, TQT_SLOT(addFiles(const TQStringList&)) );
connect( project(), TQT_SIGNAL(removedFilesFromProject(const TQStringList&)),
m_filegroups, TQT_SLOT(removeFiles(const TQStringList&)) );
/* connect( project(), TQT_SIGNAL(addedFileToProject(const TQString&)),
m_filegroups, TQT_SLOT(addFile(const TQString&)) );
connect( project(), TQT_SIGNAL(removedFileFromProject(const TQString&)),
m_filegroups, TQT_SLOT(removeFile(const TQString&)) );*/
m_filegroups->refresh();
}
FileGroupsPart::~FileGroupsPart()
{
deleteRequested = true;
if (m_filegroups)
mainWindow()->removeView(m_filegroups);
delete m_filegroups;
delete _configProxy;
}
void FileGroupsPart::refresh()
{
if (deleteRequested)
return;
// This method may be called from m_filetree's slot,
// so we make sure not to modify the list view during
// the execution of the slot
TQTimer::singleShot(0, m_filegroups, TQT_SLOT(refresh()));
}
void FileGroupsPart::insertConfigWidget( const KDialogBase * dlg, TQWidget * page, unsigned int pagenumber )
{
if ( pagenumber == FILEGROUPS_OPTIONS )
{
FileGroupsConfigWidget *w = new FileGroupsConfigWidget(this, page, "file groups config widget");
connect( dlg, TQT_SIGNAL(okClicked()), w, TQT_SLOT(accept()) );
}
}
|