Commit 2c87e150 authored by Alexander Dymo's avatar Alexander Dymo

Added support for profiles to the KDevelop shell.

This shell now can be easily used in all applications built on KDevelop platform. Shell customisation is done by ShellExtension class. kdevshell library is installed and necessary headers are available from $(includedir)/kdevelop/shell.
Profiles support makes it possible to get rid of TopLevel::mode hack and use _real_ profile for kdevassistant application (KDevAssistant profile, actually).
KDevelop IDE uses "KDevelop" profile by default and therefore loads all available plugins. This may change in the near future.

To edit profiles, use kdevprofileeditor program.
To launch applications, use --profile argument, for example: "kdevelop --profile KDECppIDE" or "kdevelop --profile RubyIDE".
"kdevelop" equals to "kdevelop --profile KDevelop"
"kdevassistant" equals to "kdevassistant --profile KDevAssistant"

What does not currently work:
global plugins configuration page shows plugins but does not allow to unload them;
profiles are not switched when a project is loaded, we need to implement a method to switch the profile;
plugins do not have a way to react on profile changes or to get a current profile.

CCMAIL: kdevelop-devel@kdevelop.org
CCMAIL: quanta-devel@kde.org
parent f7b0249e
INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/lib/interfaces \
-I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external \
-I$(top_srcdir)/lib/interfaces/extras -I$(top_srcdir)/lib/util -I$(top_srcdir)/lib/widgets \
$(KDEVMDI_INCLUDES) $(all_includes)
-I$(top_srcdir)/src/profileengine/lib $(KDEVMDI_INCLUDES) $(all_includes)
KDE_OPTIONS=nofinal
lib_LTLIBRARIES = libkdevshell.la
libkdevshell_la_LDFLAGS = $(all_libraries)
libkdevshell_la_LIBADD = \
$(top_builddir)/src/profileengine/lib/libprofileengine.la $(top_builddir)/lib/libkdevelop.la \
$(top_builddir)/lib/widgets/libkdevwidgets.la $(top_builddir)/lib/interfaces/extras/libkdevextras.la \
$(LIB_KDEVMDI) $(LIB_KDEUI) $(LIB_KPARTS) $(LIB_KHTML) -lktexteditor
libkdevshell_la_SOURCES = api.cpp core.cpp documentationpart.cpp \
editorproxy.cpp generalinfowidget.cpp languageselectwidget.cpp mainwindowshare.cpp \
newmainwindow.cpp partcontroller.cpp partselectwidget.cpp plugincontroller.cpp \
projectmanager.cpp projectsession.cpp splashscreen.cpp statusbar.cpp toplevel.cpp \
generalinfowidgetbase.ui mimewarningdialog.ui shellextension.cpp
bin_PROGRAMS = kdevelop kdevassistant
kdevelop_SOURCES = core.cpp partcontroller.cpp projectmanager.cpp \
plugincontroller.cpp api.cpp partselectwidget.cpp settingswidget.ui toplevel.cpp \
statusbar.cpp editorproxy.cpp documentationpart.cpp projectsession.cpp \
mainwindowshare.cpp generalinfowidgetbase.ui generalinfowidget.cpp languageselectwidget.cpp \
newmainwindow.cpp mimewarningdialog.ui main.cpp splashscreen.cpp
kdevelop_SOURCES = main.cpp kdevideextension.cpp settingswidget.ui
kdevelop_METASOURCES = AUTO
kdevelop_LDFLAGS = $(all_libraries) $(KDE_RPATH)
kdevelop_LDADD = $(top_builddir)/lib/widgets/libkdevwidgets.la \
$(top_builddir)/lib/libkdevelop.la $(top_builddir)/lib/interfaces/extras/libkdevextras.la $(LIB_KDEVMDI) \
$(LIB_KDEUI) $(LIB_KPARTS) $(LIB_KHTML) -lktexteditor
kdevelop_LDADD = $(top_builddir)/src/libkdevshell.la
rcdir = $(kde_datadir)/kdevelop
rc_DATA = kdevelopui.rc eventsrc
# default KDevelop configuration
kdevelopdatadir = $(kde_confdir)
kdevelopdata_DATA = kdeveloprc kdevpluginprofilerc
kdevelopdata_DATA = kdeveloprc
SUBDIRS = profiles profileengine
noinst_HEADERS = languageselectwidget.h newmainwindow.h
kdevassistant_LDFLAGS = $(all_libraries) $(KDE_RPATH)
kdevassistant_SOURCES = api.cpp core.cpp documentationpart.cpp editorproxy.cpp \
generalinfowidget.cpp languageselectwidget.cpp mainwindowshare.cpp newmainwindow.cpp \
partcontroller.cpp partselectwidget.cpp plugincontroller.cpp projectmanager.cpp \
projectsession.cpp settingswidget.ui statusbar.cpp toplevel.cpp generalinfowidgetbase.ui \
main_assistant.cpp mimewarningdialog.ui splashscreen.cpp
kdevassistant_LDADD = $(top_builddir)/lib/widgets/libkdevwidgets.la \
$(top_builddir)/lib/libkdevelop.la $(top_builddir)/lib/interfaces/extras/libkdevextras.la $(LIB_KDEVMDI) \
-lktexteditor $(LIB_KHTML) $(LIB_KPARTS) $(LIB_KDEUI)
kdevassistant_SOURCES = main_assistant.cpp kdevassistantextension.cpp
kdevassistant_LDADD = $(top_builddir)/src/libkdevshell.la
rc_assistantdir = $(kde_datadir)/kdevassistant
rc_assistant_DATA = kdevassistantui.rc
KDE_OPTIONS=nofinal
shellincludedir = $(includedir)/kdevelop/shell
shellinclude_HEADERS = api.h core.h documentationpart.h editorproxy.h\
generalinfowidget.h languageselectwidget.h mainwindowshare.h\
newmainwindow.h partcontroller.h partselectwidget.h plugincontroller.h\
projectmanager.h projectsession.h settingswidget.ui.h shellextension.h\
splashscreen.h statusbar.h toplevel.h generalinfowidgetbase.h\
mimewarningdialog.h settingswidget.h
/***************************************************************************
* Copyright (C) 2004 by Alexander Dymo *
* adymo@kdevelop.org *
* *
* 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. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "kdevassistantextension.h"
KDevAssistantExtension::KDevAssistantExtension()
: ShellExtension()
{
}
void KDevAssistantExtension::init()
{
s_instance = new KDevAssistantExtension();
}
QString KDevAssistantExtension::xmlFile()
{
return "kdevassistantui.rc";
}
QString KDevAssistantExtension::defaultProfile()
{
return "KDevAssistant";
}
/***************************************************************************
* Copyright (C) 2004 by Alexander Dymo *
* adymo@kdevelop.org *
* *
* 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. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef KDEVASSISTANTEXTENSION_H
#define KDEVASSISTANTEXTENSION_H
#include "shellextension.h"
class KDevAssistantExtension : public ShellExtension {
public:
static void init();
virtual void createGlobalSettingsPage(KDialogBase */*dlg*/) {};
virtual void acceptGlobalSettingsPage(KDialogBase */*dlg*/) {};
virtual QString xmlFile();
virtual QString defaultProfile();
protected:
KDevAssistantExtension();
};
#endif
/***************************************************************************
* Copyright (C) 2004 by Alexander Dymo *
* adymo@kdevelop.org *
* *
* 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. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "kdevideextension.h"
#include <qvbox.h>
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <klocale.h>
#include <kconfig.h>
#include <kdialogbase.h>
#include <kiconloader.h>
#include <kurlrequester.h>
#include <kapplication.h>
#include <kdevplugin.h>
#include <kdevmakefrontend.h>
#include <kdevplugincontroller.h>
#include "api.h"
#include "settingswidget.h"
KDevIDEExtension::KDevIDEExtension()
: ShellExtension()
{
}
void KDevIDEExtension::init()
{
s_instance = new KDevIDEExtension();
}
void KDevIDEExtension::createGlobalSettingsPage(KDialogBase *dlg)
{
KConfig* config = kapp->config();
QVBox *vbox = dlg->addVBoxPage(i18n("General"), i18n("General"), BarIcon("kdevelop", KIcon::SizeMedium) );
gsw = new SettingsWidget(vbox, "general settings widget");
gsw->projects_url->setMode((int)KFile::Directory);
config->setGroup("General Options");
gsw->lastProjectCheckbox->setChecked(config->readBoolEntry("Read Last Project On Startup",true));
config->setGroup("MakeOutputView");
gsw->setMessageFont(config->readFontEntry("Messages Font"));
gsw->lineWrappingCheckBox->setChecked(config->readBoolEntry("LineWrapping",true));
gsw->dirNavigMsgCheckBox->setChecked(config->readBoolEntry("ShowDirNavigMsg",false));
gsw->compilerOutputButtonGroup->setRadioButtonExclusive(true);
gsw->compilerOutputButtonGroup->setButton(config->readNumEntry("CompilerOutputLevel",0));
config->setGroup("General Options");
gsw->setApplicationFont(config->readFontEntry("Application Font"));
gsw->changeMessageFontButton->setText(gsw->messageFont().family());
gsw->changeMessageFontButton->setFont(gsw->messageFont());
gsw->changeApplicationFontButton->setText(gsw->applicationFont().family());
gsw->changeApplicationFontButton->setFont(gsw->applicationFont());
gsw->projects_url->setURL(config->readPathEntry("DefaultProjectsDir", QDir::homeDirPath()+"/"));
gsw->embedDesignerCheckBox->setChecked(config->readBoolEntry("Embed KDevDesigner", true));
}
void KDevIDEExtension::acceptGlobalSettingsPage(KDialogBase *dlg)
{
KConfig* config = kapp->config();
config->setGroup("General Options");
config->writeEntry("Embed KDevDesigner", gsw->embedDesignerCheckBox->isChecked());
config->writeEntry("Read Last Project On Startup",gsw->lastProjectCheckbox->isChecked());
config->writePathEntry("DefaultProjectsDir", gsw->projects_url->url());
config->writeEntry("Application Font", gsw->applicationFont());
config->setGroup("MakeOutputView");
config->writeEntry("Messages Font",gsw->messageFont());
config->writeEntry("LineWrapping",gsw->lineWrappingCheckBox->isChecked());
config->writeEntry("ShowDirNavigMsg",gsw->dirNavigMsgCheckBox->isChecked());
QButton* pSelButton = gsw->compilerOutputButtonGroup->selected();
config->writeEntry("CompilerOutputLevel",gsw->compilerOutputButtonGroup->id(pSelButton)); // id must be in sync with the enum!
config->sync();
if( KDevPlugin *makeExt = API::getInstance()->pluginController()->extension("KDevelop/MakeFrontend"))
{
static_cast<KDevMakeFrontend*>(makeExt)->updateSettingsFromConfig();
}
}
QString KDevIDEExtension::xmlFile()
{
return "kdevelopui.rc";
}
QString KDevIDEExtension::defaultProfile()
{
return "KDevelop";
}
/***************************************************************************
* Copyright (C) 2004 by Alexander Dymo *
* adymo@kdevelop.org *
* *
* 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. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef KDEVIDEEXTENSION_H
#define KDEVIDEEXTENSION_H
#include <shellextension.h>
class SettingsWidget;
class KDevIDEExtension : public ShellExtension {
public:
static void init();
virtual void createGlobalSettingsPage(KDialogBase *dlg);
virtual void acceptGlobalSettingsPage(KDialogBase *dlg);
virtual QString xmlFile();
virtual QString defaultProfile();
protected:
KDevIDEExtension();
private:
SettingsWidget *gsw;
};
#endif
......@@ -19,6 +19,8 @@
#include "projectmanager.h"
#include "newmainwindow.h"
#include "kdevideextension.h"
static KCmdLineOptions options[] =
{
{ "profile <profile>", I18N_NOOP("Profile to load"), 0 },
......@@ -80,7 +82,7 @@ int main(int argc, char *argv[])
KApplication app;
TopLevel::mode = TopLevel::IDEMode;
KDevIDEExtension::init();
QPixmap pm;
pm.load(locate("appdata", "pics/kdevelop-splash.png"));
......
......@@ -19,6 +19,8 @@
#include "projectmanager.h"
#include "newmainwindow.h"
#include "kdevassistantextension.h"
static KCmdLineOptions options[] =
{
{ "profile <profile>", I18N_NOOP("Profile to load"), 0 },
......@@ -79,7 +81,7 @@ int main(int argc, char *argv[])
KApplication app;
TopLevel::mode = TopLevel::AssistantMode;
KDevAssistantExtension::init();
QPixmap pm;
pm.load(locate("data", "kdevelop/pics/kdevassistant-splash.png"));
......
......@@ -63,6 +63,8 @@
#include "mainwindowshare.h"
#include "shellextension.h"
#ifdef KDE_MAKE_VERSION
# if KDE_VERSION < KDE_MAKE_VERSION(3,1,90)
# define NEED_CONFIGHACK
......@@ -302,34 +304,11 @@ void MainWindowShare::slotSettings()
KDialogBase dlg(KDialogBase::IconList, i18n("Configure KDevelop"),
KDialogBase::Help|KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, m_pMainWnd,
"customization dialog");
dlg.setHelp("setup");
SettingsWidget *gsw;
ShellExtension::getInstance()->createGlobalSettingsPage(&dlg);
KConfig* config = kapp->config();
if (TopLevel::mode != TopLevel::AssistantMode)
{
dlg.setHelp("setup");
QVBox *vbox = dlg.addVBoxPage(i18n("General"), i18n("General"), BarIcon("kdevelop", KIcon::SizeMedium) );
gsw = new SettingsWidget(vbox, "general settings widget");
gsw->projects_url->setMode((int)KFile::Directory);
config->setGroup("General Options");
gsw->lastProjectCheckbox->setChecked(config->readBoolEntry("Read Last Project On Startup",true));
config->setGroup("MakeOutputView");
gsw->setMessageFont(config->readFontEntry("Messages Font"));
gsw->lineWrappingCheckBox->setChecked(config->readBoolEntry("LineWrapping",true));
gsw->dirNavigMsgCheckBox->setChecked(config->readBoolEntry("ShowDirNavigMsg",false));
gsw->compilerOutputButtonGroup->setRadioButtonExclusive(true);
gsw->compilerOutputButtonGroup->setButton(config->readNumEntry("CompilerOutputLevel",0));
config->setGroup("General Options");
gsw->setApplicationFont(config->readFontEntry("Application Font"));
gsw->changeMessageFontButton->setText(gsw->messageFont().family());
gsw->changeMessageFontButton->setFont(gsw->messageFont());
gsw->changeApplicationFontButton->setText(gsw->applicationFont().family());
gsw->changeApplicationFontButton->setFont(gsw->applicationFont());
gsw->projects_url->setURL(config->readPathEntry("DefaultProjectsDir", QDir::homeDirPath()+"/"));
gsw->embedDesignerCheckBox->setChecked(config->readBoolEntry("Embed KDevDesigner", true));
}
config->setGroup("Global Settings Dialog");
int height = config->readNumEntry( "Height", 600 );
......@@ -344,25 +323,7 @@ void MainWindowShare::slotSettings()
config->writeEntry( "Height", dlg.size().height() );
config->writeEntry( "Width", dlg.size().width() );
if (TopLevel::mode != TopLevel::AssistantMode)
{
config->setGroup("General Options");
config->writeEntry("Embed KDevDesigner", gsw->embedDesignerCheckBox->isChecked());
config->writeEntry("Read Last Project On Startup",gsw->lastProjectCheckbox->isChecked());
config->writePathEntry("DefaultProjectsDir", gsw->projects_url->url());
config->writeEntry("Application Font", gsw->applicationFont());
config->setGroup("MakeOutputView");
config->writeEntry("Messages Font",gsw->messageFont());
config->writeEntry("LineWrapping",gsw->lineWrappingCheckBox->isChecked());
config->writeEntry("ShowDirNavigMsg",gsw->dirNavigMsgCheckBox->isChecked());
QButton* pSelButton = gsw->compilerOutputButtonGroup->selected();
config->writeEntry("CompilerOutputLevel",gsw->compilerOutputButtonGroup->id(pSelButton)); // id must be in sync with the enum!
config->sync();
if( KDevPlugin *makeExt = API::getInstance()->pluginController()->extension("KDevelop/MakeFrontend"))
{
static_cast<KDevMakeFrontend*>(makeExt)->updateSettingsFromConfig();
}
}
ShellExtension::getInstance()->acceptGlobalSettingsPage(&dlg);
}
void MainWindowShare::slotConfigureEditors()
......
......@@ -67,6 +67,8 @@
#include "mainwindowshare.h"
#include "newmainwindow.h"
#include "shellextension.h"
/***************************
WHAT'S NOT WORKING:
......@@ -118,10 +120,7 @@ void NewMainWindow::init() {
setStandardToolBarMenuEnabled( true );
if (TopLevel::mode == TopLevel::AssistantMode)
setXMLFile("kdevassistantui.rc");
else
setXMLFile("kdevelopui.rc");
setXMLFile(ShellExtension::getInstance()->xmlFile());
createFramework();
createActions();
......@@ -162,7 +161,9 @@ void NewMainWindow::init() {
menuBar()->setEnabled( false );
if ( PluginController::pluginServices().isEmpty() ) {
//FIXME: this checks only for global offers which is not quite correct because
//a profile can offer core plugins and no global plugins.
if ( PluginController::getInstance()->engine().allOffers(ProfileEngine::Global).isEmpty() ) {
KMessageBox::sorry( this, i18n("Unable to find plugins, KDevelop will not work properly!\nPlease make sure "
"that KDevelop is installed in your KDE directory, otherwise you have to add KDevelop's installation "
"path to the environment variable KDEDIRS and run kbuildsycoca. Restart KDevelop afterwards.\n"
......@@ -236,7 +237,7 @@ void NewMainWindow::tabContext(QWidget* widget,const QPoint & pos)
if(PartController::getInstance()->parts()->count() > 1)
tabMenu.insertItem( i18n("Close All Others"), 4 );
if(!dynamic_cast<DocumentationPart*>(ro_part))
if(!dynamic_cast<HTMLDocumentationPart*>(ro_part))
{
if(KParts::ReadWritePart * rw_part = dynamic_cast<KParts::ReadWritePart*>( ro_part ))
if(!dynamic_cast<KInterfaceDesigner::Designer*>(ro_part))
......@@ -479,7 +480,8 @@ void NewMainWindow::embedSelectView(QWidget *view, const QString &name, const QS
void NewMainWindow::embedSelectViewRight ( QWidget* view, const QString& name, const QString &toolTip)
{
embedView( KDockWidget::DockRight, view, name, toolTip );
if (TopLevel::mode == TopLevel::AssistantMode)
//FIXME: ok, this is a rude hack
if (PluginController::getInstance()->currentProfile() == "KDevAssistant")
raiseView(view);
}
......
......@@ -483,7 +483,7 @@ void PartController::editDocumentInternal( const KURL & inputUrl, int lineNum, i
void PartController::showDocument(const KURL &url, bool newWin)
{
QString fixedPath = DocumentationPart::resolveEnvVarsInURL(url.url()); // possibly could env vars
QString fixedPath = HTMLDocumentationPart::resolveEnvVarsInURL(url.url()); // possibly could env vars
KURL docUrl(fixedPath);
kdDebug(9000) << "SHOW: " << docUrl.url() << endl;
......@@ -495,10 +495,10 @@ void PartController::showDocument(const KURL &url, bool newWin)
}
DocumentationPart *part = dynamic_cast<DocumentationPart*>(activePart());
HTMLDocumentationPart *part = dynamic_cast<HTMLDocumentationPart*>(activePart());
if (!part || newWin)
{
part = new DocumentationPart;
part = new HTMLDocumentationPart;
integratePart(part,docUrl);
connect(part, SIGNAL(fileNameChanged(KParts::ReadOnlyPart* )),
this, SIGNAL(partURLChanged(KParts::ReadOnlyPart* )));
......@@ -586,7 +586,7 @@ void PartController::integratePart(KParts::Part *part, const KURL &url, QWidget*
connect(part, SIGNAL(completed()), this, SLOT(slotUploadFinished()));
// yes, we're cheating again. this signal exists for katepart's
// Document object and our DocumentationPart
// Document object and our HTMLDocumentationPart
// connect(part, SIGNAL(fileNameChanged()), this, SLOT(slotFileNameChanged()));
// Connect to the document's views newStatus() signal in order to keep track of the
......@@ -1134,7 +1134,7 @@ void PartController::slotActivePartChanged( KParts::Part * part )
addHistoryEntry( _partURLMap[ m_latestPart ] );
}
if ( dynamic_cast<DocumentationPart*>( part ) ) return;
if ( dynamic_cast<HTMLDocumentationPart*>( part ) ) return;
KParts::ReadOnlyPart * ro_part = dynamic_cast<KParts::ReadOnlyPart*>( part );
if ( ro_part )
......
......@@ -32,7 +32,7 @@ class QPopupMenu;
class KAction;
class KToolBarPopupAction;
class KRecentFilesAction;
class DocumentationPart;
class HTMLDocumentationPart;
class HistoryEntry;
class KDirWatch;
......
......@@ -125,13 +125,15 @@ PartSelectWidget::~PartSelectWidget()
void PartSelectWidget::readGlobalConfig()
{
KTrader::OfferList globalOffers = PluginController::pluginServices( "Global" );
KConfig config( PluginController::getInstance()->currentProfilePath() );
config.setGroup("Plugins");
//FIXME: fix this, use new profiles arch !!!!!
KTrader::OfferList globalOffers = PluginController::getInstance()->engine().offers(
PluginController::getInstance()->currentProfile(), ProfileEngine::Global);
// KConfig config( PluginController::getInstance()->currentProfilePath() );
// config.setGroup("Plugins");
for (KTrader::OfferList::ConstIterator it = globalOffers.begin(); it != globalOffers.end(); ++it)
{
// parse out any existing url to make it clickable
// parse out any existing url to make it clickable
QString Comment = (*it)->comment();
QRegExp re("\\bhttp://[\\S]*");
re.search( Comment );
......@@ -144,7 +146,7 @@ void PartSelectWidget::readGlobalConfig()
}
PluginItem *item = new PluginItem( _pluginList, (*it)->name(), (*it)->genericName(), Comment, url );
item->setOn(config.readBoolEntry((*it)->name(), true));
item->setOn(/*config.readBoolEntry((*it)->name(), true)*/ true);
}
QListViewItem * first = _pluginList->firstChild();
......@@ -157,7 +159,8 @@ void PartSelectWidget::readGlobalConfig()
void PartSelectWidget::saveGlobalConfig()
{
KConfig config( PluginController::getInstance()->currentProfilePath() );
//FIXME: fix this, use new profiles arch !!!!!!!!!!!!
/* KConfig config( PluginController::getInstance()->currentProfilePath() );
config.setGroup("Plugins");
QListViewItemIterator it( _pluginList );
......@@ -166,7 +169,7 @@ void PartSelectWidget::saveGlobalConfig()
PluginItem * item = static_cast<PluginItem*>( it.current() );
config.writeEntry( item->name(), item->isOn() );
++it;
}
}*/
}
......@@ -174,7 +177,8 @@ void PartSelectWidget::readProjectConfig()
{
QStringList ignoreparts = DomUtil::readListEntry(m_projectDom, "/general/ignoreparts", "part");
KTrader::OfferList localOffers = PluginController::pluginServices( "Project" );
KTrader::OfferList localOffers = PluginController::getInstance()->engine().offers(
PluginController::getInstance()->currentProfile(), ProfileEngine::Project);
for (KTrader::OfferList::ConstIterator it = localOffers.begin(); it != localOffers.end(); ++it)
{
// parse out any existing url to make it clickable
......
......@@ -29,6 +29,8 @@
#include <kdevplugininfo.h>
#include <kaction.h>
#include <profileengine.h>
#include "core.h"
#include "api.h"
#include "toplevel.h"
......@@ -37,6 +39,8 @@
#include "plugincontroller.h"
#include "shellextension.h"
// a separate method in this anonymous namespace to avoid having it all
// inline in plugincontroller.h
namespace
......@@ -77,37 +81,24 @@ PluginController::PluginController()
connect( Core::getInstance(), SIGNAL(configWidget(KDialogBase*)),
this, SLOT(slotConfigWidget(KDialogBase*)) );
m_defaultProfile = QString::fromLatin1( "FullIDE" );
/* m_defaultProfile = QString::fromLatin1( "FullIDE" );
m_defaultProfilePath = kapp->dirs()->localkdedir() + "/" +
KStandardDirs::kde_default( "data" ) +
QString::fromLatin1("/kdevelop/profiles/FullIDE");
QString::fromLatin1("/kdevelop/profiles/FullIDE");*/
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
if( args->isSet("profile") ){
m_profile = QString::fromLocal8Bit( args->getOption("profile") );
} else {
m_profile = ShellExtension::getInstance()->defaultProfile();
}
}
void PluginController::loadInitialPlugins()
{
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
loadCorePlugins();
m_profile = QString::null;
if( args->isSet("profile") ){
m_profile = QString::fromLocal8Bit( args->getOption("profile") );
if( m_profile[0] != '/' )
m_profilePath = locate( "data", QString::fromLatin1("kdevelop/profiles/") + m_profile );
if( m_profilePath.isEmpty() )
m_profilePath = kapp->dirs()->localkdedir() +
KStandardDirs::kde_default( "data" ) +
QString::fromLatin1("/kdevelop/profiles/") + m_profile;
}
if( m_profile.isEmpty() || m_profilePath.isEmpty() ){
m_profile = m_defaultProfile;
m_profilePath = m_defaultProfilePath;
}
{
loadCorePlugins();
loadGlobalPlugins();
}
......@@ -123,7 +114,7 @@ PluginController::~PluginController()
// sense to put them in the global plugin container
void PluginController::loadCorePlugins()
{
KTrader::OfferList coreOffers = pluginServices( "Core" );
KTrader::OfferList coreOffers = m_engine.offers(m_profile, ProfileEngine::Core);
for (KTrader::OfferList::ConstIterator it = coreOffers.begin(); it != coreOffers.end(); ++it)
{
QString name = (*it)->name();
......@@ -147,15 +138,15 @@ void PluginController::loadCorePlugins()
void PluginController::loadGlobalPlugins()
{
KTrader::OfferList globalOffers = pluginServices( "Global" );
KConfig config( m_profilePath );
KTrader::OfferList globalOffers = m_engine.offers(m_profile, ProfileEngine::Global);
// KConfig config( m_profilePath );
for (KTrader::OfferList::ConstIterator it = globalOffers.begin(); it != globalOffers.end(); ++it)
{
config.setGroup( "Plugins" );
// config.setGroup( "Plugins" );
QString name = (*it)->name();
// Unload it if is marked as ignored and loaded
/* // Unload it if is marked as ignored and loaded
if (!config.readBoolEntry( name, true)) {
KDevPlugin* part = m_parts[name];
if( part ) {
......@@ -164,18 +155,24 @@ void PluginController::loadGlobalPlugins()
part->deleteLater();
}
continue;
}
}*/
kdDebug() << "TRY: " << name << endl;
// Check if it is already loaded
if( m_parts[ name ] != 0 )
continue;
kdDebug() << "GOOD 1: " << name << endl;
assert( !( *it )->hasServiceType( "KDevelop/Part" ) );
kdDebug() << "GOOD 2: " << name << endl;
emit loadingPlugin(i18n("Loading: %1").arg((*it)->genericName()));
KDevPlugin *plugin = loadPlugin( *it );
kdDebug() << "GOOD 3: " << name << endl;
if ( plugin ) {
kdDebug() << "LOADED: " << name << endl;
m_parts.insert( name, plugin );
integratePart( plugin );
}
......@@ -197,7 +194,7 @@ void PluginController::unloadPlugins()
void PluginController::loadLocalParts( ProjectInfo * projectInfo, QStringList const & loadPlugins, QStringList const & ignorePlugins )
{
KTrader::OfferList localOffers = pluginServices( "Project" );
KTrader::OfferList localOffers = m_engine.offers(m_profile, ProfileEngine::Project);
for (KTrader::OfferList::ConstIterator it = localOffers.begin(); it != localOffers.end(); ++it)
{
QString name = (*it)->name();
......@@ -264,7 +261,7 @@ bool PluginController::checkNewService( ProjectInfo * projectInfo, const KServic
return true;
}
KService::List PluginController::pluginServices( const QString &scope )
/*KService::List PluginController::pluginServices( const QString &scope )
{
QString constraint = QString::fromLatin1("[X-KDevelop-Version] == %1").arg(KDEVELOP_PLUGIN_VERSION);
......@@ -274,13 +271,16 @@ KService::List PluginController::pluginServices( const QString &scope )
constraint += QString::fromLatin1( " and [X-KDevelop-Mode] == 'AssistantMode'");
return KTrader::self()->query( QString::fromLatin1( "KDevelop/Plugin" ),
constraint );
}
}*/
KDevPlugin *PluginController::loadPlugin( const KService::Ptr &service )