1
/***************************************************************************
2
* Copyright (C) 2005 by ian reinhart geiser *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
21
#include "scriptingpart.h"
24
#include <qpopupmenu.h>
25
#include <qwhatsthis.h>
29
#include <kdialogbase.h>
30
#include <kiconloader.h>
31
#include <kmessagebox.h>
32
#include <kdevplugininfo.h>
33
#include <kdevgenericfactory.h>
36
#include <kdevmainwindow.h>
37
#include <configwidgetproxy.h>
38
#include <kapplication.h>
40
#include "scriptingglobalconfig.h"
41
#include "kscriptactionmanager.h"
43
typedef KDevGenericFactory<scriptingPart> scriptingFactory;
44
KDevPluginInfo data("kdevscripting");
45
K_EXPORT_COMPONENT_FACTORY( libkdevscripting, scriptingFactory( data ) )
47
#define GLOBALDOC_OPTIONS 1
48
#define PROJECTDOC_OPTIONS 2
50
scriptingPart::scriptingPart(QObject *parent, const char *name, const QStringList &/*args*/)
51
: KDevPlugin(&data, parent, name ? name : "scriptingPart"), m_scripts(0L)
53
setInstance(scriptingFactory::instance());
54
setXMLFile("kdevscripting.rc");
56
m_configProxy = new ConfigWidgetProxy(core());
57
m_configProxy->createGlobalConfigPage(i18n("Scripting"), GLOBALDOC_OPTIONS, info()->icon());
58
connect(m_configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )),
59
this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int)));
63
QTimer::singleShot(0, this, SLOT(init()));
66
scriptingPart::~scriptingPart()
72
void scriptingPart::init()
74
// delayed initialization stuff goes here
75
m_scripts = new KScriptActionManager(this,actionCollection());
79
void scriptingPart::setupActions()
81
kdDebug() << "Load plugins" << endl;
82
// Read KConfig and get the list of custom directories.
83
QStringList searchDirs;
84
searchDirs += "kate/scripts";
86
KConfig *cfg = kapp->config();
87
searchDirs += cfg->readListEntry("SearchDirs");
89
unplugActionList(QString::fromLatin1( "script_actions" ));
90
plugActionList( QString::fromLatin1( "script_actions" ), m_scripts->scripts(core(),searchDirs));
93
void scriptingPart::insertConfigWidget(const KDialogBase *dlg, QWidget *page, unsigned int pageNo)
95
// create configuraton dialogs here
98
case GLOBALDOC_OPTIONS:
100
scriptingGlobalConfig *w = new scriptingGlobalConfig(this, page, "global config");
101
connect(dlg, SIGNAL(okClicked()), w, SLOT(accept()));
108
#include "scriptingpart.moc"