snippet_part.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #include <qwhatsthis.h>
00010
00011 #include <kaction.h>
00012 #include <kiconloader.h>
00013 #include <klocale.h>
00014 #include <kgenericfactory.h>
00015 #include <kaboutdata.h>
00016 #include <qvbox.h>
00017 #include <kdialogbase.h>
00018 #include <klineedit.h>
00019 #include <qcheckbox.h>
00020 #include <qbuttongroup.h>
00021
00022 #include "kdevcore.h"
00023 #include "kdevmainwindow.h"
00024
00025 #include <kdebug.h>
00026
00027 #include "snippet_widget.h"
00028 #include "snippet_part.h"
00029 #include "snippetitem.h"
00030 #include "snippetsettings.h"
00031
00032 typedef KGenericFactory<SnippetPart> snippetFactory;
00033 K_EXPORT_COMPONENT_FACTORY( libkdevsnippet, snippetFactory( "kdevsnippet" ) )
00034
00035 SnippetPart::SnippetPart(QObject *parent, const char *name, const QStringList& )
00036 : KDevPlugin("CodeSnippet", "editcut", parent, name ? name : "SnippetPart" )
00037 {
00038 setInstance(snippetFactory::instance());
00039
00040
00041 m_widget = new SnippetWidget(this);
00042 m_widget->setCaption(i18n("Code Snippets"));
00043 m_widget->setIcon(SmallIcon( icon() ));
00044
00045 QWhatsThis::add(m_widget, i18n("<b>Code Snippet</b><p>This is a list of available snippets."));
00046
00047 mainWindow()->embedSelectViewRight( m_widget, i18n("Code Snippets"), i18n("Insert a code snippet") );
00048
00049 connect( core(), SIGNAL( configWidget( KDialogBase * ) ), this, SLOT( slotConfigWidget( KDialogBase * ) ) );
00050
00051 }
00052
00053 SnippetPart::~SnippetPart()
00054 {
00055 if ( m_widget )
00056 {
00057 mainWindow()->removeView( m_widget );
00058 }
00059
00060 delete m_widget;
00061 }
00062
00066 KAboutData* SnippetPart::aboutData()
00067 {
00068 KAboutData *data = new KAboutData ("snippetpart", I18N_NOOP("SnippetPart"), "1.1",
00069 I18N_NOOP( "SnippetPart for KDevelop" ),
00070 KAboutData::License_LGPL_V2,
00071 I18N_NOOP( "(c) 2003" ), 0, "http://www.kdevelop.org");
00072 data->addAuthor ("Robert Gruber", I18N_NOOP("Author"), "rgruber@users.sourceforge.net", "http://kmp3indexer.sf.net");
00073
00074
00075 return data;
00076 }
00077
00078
00082 void SnippetPart::slotConfigWidget( KDialogBase *dlg )
00083 {
00084 QVBox *vbox = dlg->addVBoxPage( i18n("Code Snippets"), i18n("Code Snippets"), BarIcon( icon(), KIcon::SizeMedium ) );
00085
00086 SnippetSettings * w = new SnippetSettings( m_widget, vbox );
00087
00088 w->btnGroup->setButton(m_widget->getSnippetConfig()->getInputMethod());
00089 w->leDelimiter->setText(m_widget->getSnippetConfig()->getDelimiter());
00090 w->cbToolTip->setChecked(m_widget->getSnippetConfig()->useToolTips());
00091
00092 connect( dlg, SIGNAL(okClicked()), w, SLOT(slotOKClicked()) );
00093 }
00094
00095
00096 #include "snippet_part.moc"
This file is part of the documentation for KDevelop Version 3.1.2.