diff options
Diffstat (limited to 'parts/abbrev')
-rw-r--r-- | parts/abbrev/Makefile.am | 20 | ||||
-rw-r--r-- | parts/abbrev/README.dox | 20 | ||||
-rw-r--r-- | parts/abbrev/abbrevconfigwidget.cpp | 121 | ||||
-rw-r--r-- | parts/abbrev/abbrevconfigwidget.h | 43 | ||||
-rw-r--r-- | parts/abbrev/abbrevconfigwidgetbase.ui | 190 | ||||
-rw-r--r-- | parts/abbrev/abbrevpart.cpp | 696 | ||||
-rw-r--r-- | parts/abbrev/abbrevpart.h | 113 | ||||
-rw-r--r-- | parts/abbrev/addtemplatedlg.cpp | 59 | ||||
-rw-r--r-- | parts/abbrev/addtemplatedlg.h | 41 | ||||
-rw-r--r-- | parts/abbrev/addtemplatedlgbase.ui | 176 | ||||
-rw-r--r-- | parts/abbrev/cpp_keywords | 84 | ||||
-rw-r--r-- | parts/abbrev/kdevabbrev.desktop | 83 | ||||
-rw-r--r-- | parts/abbrev/kdevabbrev.rc | 10 | ||||
-rw-r--r-- | parts/abbrev/qt_classes | 409 |
14 files changed, 2065 insertions, 0 deletions
diff --git a/parts/abbrev/Makefile.am b/parts/abbrev/Makefile.am new file mode 100644 index 00000000..0319852f --- /dev/null +++ b/parts/abbrev/Makefile.am @@ -0,0 +1,20 @@ +# Here resides the abbrev part + +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/util $(all_includes) + +kde_module_LTLIBRARIES = libkdevabbrev.la +libkdevabbrev_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevabbrev_la_LIBADD = $(top_builddir)/lib/libkdevelop.la + +libkdevabbrev_la_SOURCES = abbrevpart.cpp abbrevconfigwidget.cpp abbrevconfigwidgetbase.ui addtemplatedlg.cpp addtemplatedlgbase.ui + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevabbrev.desktop + +sourcesdir = $(kde_datadir)/kdevabbrev/sources +sources_DATA = qt_classes cpp_keywords + +rcdir = $(kde_datadir)/kdevabbrev +rc_DATA = kdevabbrev.rc diff --git a/parts/abbrev/README.dox b/parts/abbrev/README.dox new file mode 100644 index 00000000..1c8b3002 --- /dev/null +++ b/parts/abbrev/README.dox @@ -0,0 +1,20 @@ +/** \class AbbrevPart +Provides support for customizable abbrevations - short words which expand into commonly needed code structures. + +\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a> + +\maintainer <a href="mailto:roberto AT kdevelop.org">Roberto Raggi</a> + +\feature Feature 1 +\feature Feature 2 + +\bug Bug1 +\bug Bug2 + +\note +Put you notes here (if you have them!) :) +\verbatim +Verbatin code here +\endverbatim + +*/ diff --git a/parts/abbrev/abbrevconfigwidget.cpp b/parts/abbrev/abbrevconfigwidget.cpp new file mode 100644 index 00000000..d7729249 --- /dev/null +++ b/parts/abbrev/abbrevconfigwidget.cpp @@ -0,0 +1,121 @@ +/*************************************************************************** + * Copyright (C) 2002 Roberto Raggi * + * roberto@kdevelop.org * + * Copyright (C) 2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2003 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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 "abbrevconfigwidget.h" + +#include <kconfig.h> +#include <kiconloader.h> + +#include <qlistview.h> +#include <qmultilineedit.h> +#include <qcheckbox.h> + +#include "addtemplatedlg.h" +#include "abbrevpart.h" + +AbbrevConfigWidget::AbbrevConfigWidget(AbbrevPart *part, QWidget *parent, const char *name) + : AbbrevConfigWidgetBase(parent, name) +{ + m_part = part; + + qWarning("creating abbrevconfigwidget for %d abbrevs", part->templates().allTemplates().count()); + QPtrList<CodeTemplate> templates = part->templates().allTemplates(); + CodeTemplate *templ; + for (templ = templates.first(); templ; templ = templates.next()) + { + qWarning("creating item for code template "); + QListViewItem *it = new QListViewItem( listTemplates, + templ->name, + templ->description, + templ->suffixes, + templ->code, + templ->code ); + it->setPixmap( 0, SmallIcon("template_source")); + } + + checkWordCompletion->setChecked( part->autoWordCompletionEnabled() ); + listTemplates->setSorting(2); +} + + +AbbrevConfigWidget::~AbbrevConfigWidget() +{} + + +void AbbrevConfigWidget::addTemplate() +{ + QStringList suffixesList = m_part->templates().suffixes(); + + AddTemplateDialog dlg( suffixesList, this ); + if( dlg.exec() ){ + QString templ = dlg.templ(); + QString description = dlg.description(); + QString suffixes = dlg.suffixes(); + if( !(templ.isEmpty() || description.isEmpty()) || suffixes.isEmpty()) { + QListViewItem* item = new QListViewItem( listTemplates, templ, description, suffixes ); + listTemplates->setSelected( item, true ); + editCode->setFocus(); + } + } +} + + +void AbbrevConfigWidget::removeTemplate() +{ + if (!listTemplates->selectedItem()) + return; + delete listTemplates->selectedItem(); +} + + +void AbbrevConfigWidget::selectionChanged() +{ + QListViewItem* item = listTemplates->selectedItem(); + if( item ){ + editCode->setText( item->text(3) ); + } +} + + +void AbbrevConfigWidget::codeChanged() +{ + QListViewItem* item = listTemplates->selectedItem(); + if( item ){ + item->setText( 3, editCode->text() ); + if (item->text(3) == item->text(4)) + item->setPixmap( 0, SmallIcon("template_source") ); + else + item->setPixmap( 0, SmallIcon("filesave") ); + } +} + + +void AbbrevConfigWidget::accept() +{ + m_part->clearTemplates(); + + QListViewItem* item = listTemplates->firstChild(); + while( item ){ + m_part->addTemplate( item->text(0), + item->text(1), + item->text(2), + item->text(3) ); + item = item->nextSibling(); + } + + m_part->setAutoWordCompletionEnabled( checkWordCompletion->isChecked() ); +} + +#include "abbrevconfigwidget.moc" diff --git a/parts/abbrev/abbrevconfigwidget.h b/parts/abbrev/abbrevconfigwidget.h new file mode 100644 index 00000000..b8cc1983 --- /dev/null +++ b/parts/abbrev/abbrevconfigwidget.h @@ -0,0 +1,43 @@ +/*************************************************************************** + * Copyright (C) 2002 Roberto Raggi * + * roberto@kdevelop.org * + * Copyright (C) 2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2003 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _ABBREVCONFIGWIDGET_H_ +#define _ABBREVCONFIGWIDGET_H_ + +#include "abbrevconfigwidgetbase.h" +#include "abbrevpart.h" + + +class AbbrevConfigWidget : public AbbrevConfigWidgetBase +{ + Q_OBJECT + +public: + AbbrevConfigWidget(AbbrevPart *part, QWidget *parent=0, const char *name=0); + ~AbbrevConfigWidget(); + +public slots: + void accept(); + +private: + virtual void addTemplate(); + virtual void removeTemplate(); + virtual void selectionChanged(); + virtual void codeChanged(); + + AbbrevPart *m_part; +}; + +#endif diff --git a/parts/abbrev/abbrevconfigwidgetbase.ui b/parts/abbrev/abbrevconfigwidgetbase.ui new file mode 100644 index 00000000..fd432a3e --- /dev/null +++ b/parts/abbrev/abbrevconfigwidgetbase.ui @@ -0,0 +1,190 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>AbbrevConfigWidgetBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>abbrev_config_widget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>474</width> + <height>410</height> + </rect> + </property> + <property name="caption"> + <string>Code Templates</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>Co&de:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>editCode</cstring> + </property> + </widget> + <widget class="QMultiLineEdit" row="3" column="0"> + <property name="name"> + <cstring>editCode</cstring> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>checkWordCompletion</cstring> + </property> + <property name="text"> + <string>&Enable automatic word completion</string> + </property> + </widget> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton" row="2" column="1"> + <property name="name"> + <cstring>buttonRemoveTemplate</cstring> + </property> + <property name="text"> + <string>&Remove</string> + </property> + </widget> + <widget class="QListView" row="1" column="0" rowspan="3" colspan="1"> + <column> + <property name="text"> + <string>Template</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Description</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Suffixes</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>listTemplates</cstring> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="resizeMode"> + <enum>AllColumns</enum> + </property> + </widget> + <widget class="QPushButton" row="1" column="1"> + <property name="name"> + <cstring>buttonAddTemplate</cstring> + </property> + <property name="text"> + <string>&Add...</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="text"> + <string>&Templates:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>listTemplates</cstring> + </property> + </widget> + <spacer row="3" column="1"> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + </grid> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>buttonAddTemplate</sender> + <signal>clicked()</signal> + <receiver>abbrev_config_widget</receiver> + <slot>addTemplate()</slot> + </connection> + <connection> + <sender>buttonRemoveTemplate</sender> + <signal>clicked()</signal> + <receiver>abbrev_config_widget</receiver> + <slot>removeTemplate()</slot> + </connection> + <connection> + <sender>editCode</sender> + <signal>textChanged()</signal> + <receiver>abbrev_config_widget</receiver> + <slot>codeChanged()</slot> + </connection> + <connection> + <sender>listTemplates</sender> + <signal>selectionChanged()</signal> + <receiver>abbrev_config_widget</receiver> + <slot>selectionChanged()</slot> + </connection> +</connections> +<tabstops> + <tabstop>checkWordCompletion</tabstop> + <tabstop>listTemplates</tabstop> + <tabstop>buttonAddTemplate</tabstop> + <tabstop>buttonRemoveTemplate</tabstop> + <tabstop>editCode</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<slots> + <slot access="protected">addTemplate()</slot> + <slot access="protected">codeChanged()</slot> + <slot access="protected">removeTemplate()</slot> + <slot access="protected">selectionChanged()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/parts/abbrev/abbrevpart.cpp b/parts/abbrev/abbrevpart.cpp new file mode 100644 index 00000000..181606f4 --- /dev/null +++ b/parts/abbrev/abbrevpart.cpp @@ -0,0 +1,696 @@ +/*************************************************************************** + * Copyright (C) 2002 Roberto Raggi * + * roberto@kdevelop.org * + * Copyright (C) 2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2003 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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 "abbrevpart.h" + +#include <qfile.h> +#include <qfileinfo.h> +#include <qregexp.h> +#include <qvbox.h> +#include <kdebug.h> +#include <kdialogbase.h> +#include <klocale.h> +#include <kparts/part.h> +#include <kstandarddirs.h> +#include <kdevgenericfactory.h> +#include <kaction.h> +#include <kconfig.h> +#include <kio/netaccess.h> +#include <kiconloader.h> +#include <kdevplugininfo.h> + +#include <ktexteditor/document.h> +#include <ktexteditor/editinterface.h> +#include <ktexteditor/viewcursorinterface.h> +#include <ktexteditor/codecompletioninterface.h> + +#include "kdevcore.h" +#include "kdevpartcontroller.h" +#include "abbrevconfigwidget.h" +#include "kdeveditorutil.h" + +static const KDevPluginInfo data("kdevabbrev"); + +class AbbrevFactory : public KDevGenericFactory<AbbrevPart> +{ +public: + AbbrevFactory() + : KDevGenericFactory<AbbrevPart>( data ) + { } + + virtual KInstance *createInstance() + { + KInstance *instance = KDevGenericFactory<AbbrevPart>::createInstance(); + KStandardDirs *dirs = instance->dirs(); + dirs->addResourceType( "codetemplates", + KStandardDirs::kde_default( "data" ) + "kdevabbrev/templates/" ); + dirs->addResourceType( "sources", + KStandardDirs::kde_default( "data" ) + "kdevabbrev/sources" ); + + return instance; + } +}; + +K_EXPORT_COMPONENT_FACTORY( libkdevabbrev, AbbrevFactory ) + +AbbrevPart::AbbrevPart(QObject *parent, const char *name, const QStringList &) + : KDevPlugin(&data, parent, name ? name : "AbbrevPart") +{ + setInstance(AbbrevFactory::instance()); + setXMLFile("kdevabbrev.rc"); + + connect(partController(), SIGNAL(activePartChanged(KParts::Part*)), + this, SLOT(slotActivePartChanged(KParts::Part*)) ); + + connect(core(), SIGNAL(configWidget(KDialogBase*)), this, SLOT(configWidget(KDialogBase*))); + + KAction *action; + action = new KAction( i18n("Expand Text"), CTRL + Key_J, + this, SLOT(slotExpandText()), + actionCollection(), "edit_expandtext" ); + action->setToolTip( i18n("Expand current word") ); + action->setWhatsThis( i18n("<b>Expand current word</b><p>Current word can be completed using the list of similar words in source files.") ); + + action = new KAction( i18n("Expand Abbreviation"), CTRL + Key_L, + this, SLOT(slotExpandAbbrev()), + actionCollection(), "edit_expandabbrev" ); + action->setToolTip( i18n("Expand abbreviation") ); + action->setWhatsThis( i18n("<b>Expand abbreviation</b><p>Enable and configure abbreviations in <b>KDevelop Settings</b>, <b>Abbreviations</b> tab.") ); + + load(); + + m_inCompletion = false; + docIface = 0; + editIface = 0; + viewCursorIface = 0; + completionIface = 0; + + m_prevLine = -1; + m_prevColumn = -1; + m_sequenceLength = 0; + + KConfig* config = AbbrevFactory::instance()->config(); + KConfigGroupSaver group( config, "General" ); + m_autoWordCompletionEnabled = config->readBoolEntry( "AutoWordCompletion", false ); + + updateActions(); + + slotActivePartChanged( partController()->activePart() ); +} + + +AbbrevPart::~AbbrevPart() +{ + save(); +} + +bool AbbrevPart::autoWordCompletionEnabled() const +{ + return m_autoWordCompletionEnabled; +} + +void AbbrevPart::setAutoWordCompletionEnabled( bool enabled ) +{ + if( enabled == m_autoWordCompletionEnabled ) + return; + + KConfig* config = AbbrevFactory::instance()->config(); + KConfigGroupSaver group( config, "General" ); + + m_autoWordCompletionEnabled = enabled; + config->writeEntry( "AutoWordCompletion", m_autoWordCompletionEnabled ); + config->sync(); + + if( !docIface || !docIface->widget() ) + return; + + disconnect( docIface, 0, this, 0 ); + disconnect( docIface->widget(), 0, this, 0 ); + + if( m_autoWordCompletionEnabled ){ + connect( docIface->widget(), SIGNAL(completionAborted()), + this, SLOT(slotCompletionAborted()) ); + connect( docIface->widget(), SIGNAL(completionDone()), + this, SLOT(slotCompletionDone()) ); + connect( docIface->widget(), SIGNAL(aboutToShowCompletionBox()), + this, SLOT(slotAboutToShowCompletionBox()) ); + + connect( docIface, SIGNAL(textChanged()), this, SLOT(slotTextChanged()) ); + } +} +void AbbrevPart::load() +{ + KStandardDirs *dirs = AbbrevFactory::instance()->dirs(); + QString localTemplatesFile = locateLocal("codetemplates", "templates", AbbrevFactory::instance()); + QStringList files; + if (QFileInfo(localTemplatesFile).exists()) + files << localTemplatesFile; + else + files = dirs->findAllResources("codetemplates", QString::null, false, true); + + QString localSourcesFile = locateLocal("sources", "sources", AbbrevFactory::instance()); + QStringList sourceFiles; + if (QFileInfo(localSourcesFile).exists()) + sourceFiles << localSourcesFile; + else + sourceFiles = dirs->findAllResources("sources", QString::null, false, true); + kdDebug(9028) << "=========> sourceFiles: " << sourceFiles.join(" ") << endl; + + this->m_completionFile = QString::null; + for( QStringList::Iterator it=sourceFiles.begin(); it!=sourceFiles.end(); ++it ) { + QString fn = *it; + kdDebug(9028) << "===> load file: " << fn << endl; + QFile f( fn ); + if ( f.open(IO_ReadOnly) ) { + QTextStream stream( &f ); + m_completionFile += ( stream.read() + QString("\n") ); + f.close(); + } + } + + QStringList::ConstIterator it; + for (it = files.begin(); it != files.end(); ++it) { + QString fn = *it; + kdDebug(9028) << "fn = " << fn << endl; + QFile f( fn ); + if ( f.open(IO_ReadOnly) ) { + QDomDocument doc; + doc.setContent( &f ); + QDomElement root = doc.firstChild().toElement(); + QDomElement e = root.firstChild().toElement(); + while ( !e.isNull() ){ + addTemplate( e.attribute("name"), + e.attribute("description"), + e.attribute("suffixes"), + e.attribute("code") ); + e = e.nextSibling().toElement(); + } + f.close(); + } + } +} + + +void AbbrevPart::save() +{ + QString fn = AbbrevFactory::instance()->dirs()->saveLocation("codetemplates", "", true); + kdDebug(9028) << "fn = " << fn << endl; + + QDomDocument doc( "Templates" ); + QDomElement root = doc.createElement( "Templates" ); + doc.appendChild( root ); + + QPtrList<CodeTemplate> templates = m_templates.allTemplates(); + CodeTemplate *templ; + for (templ = templates.first(); templ; templ = templates.next()) + { + QDomElement e = doc.createElement( "Template" ); + e.setAttribute( "name", templ->name ); + e.setAttribute( "description", templ->description ); + e.setAttribute( "suffixes", templ->suffixes ); + e.setAttribute( "code", templ->code ); + root.appendChild( e ); + } + + QFile f( fn + "templates" ); + if( f.open(IO_WriteOnly) ){ + QTextStream stream( &f ); + stream << doc.toString(); + f.close(); + } +} + + +QString AbbrevPart::currentWord() const +{ + return KDevEditorUtil::currentWord( dynamic_cast<KTextEditor::Document*>( partController()->activePart() ) ); +} + + +void AbbrevPart::configWidget(KDialogBase *dlg) +{ + QVBox *vbox = dlg->addVBoxPage(i18n("Abbreviations"), i18n("Abbreviations"), BarIcon( info()->icon(), KIcon::SizeMedium) ); + AbbrevConfigWidget *w = new AbbrevConfigWidget(this, vbox, "abbrev config widget"); + connect(dlg, SIGNAL(okClicked()), w, SLOT(accept())); +} + + +void AbbrevPart::slotExpandText() +{ + if( !editIface || !completionIface || !viewCursorIface ) + return; + + QString word = currentWord(); + if (word.isEmpty()) + return; + + QValueList<KTextEditor::CompletionEntry> entries = findAllWords(editIface->text(), word); + if (entries.count() == 0) { + ; // some statusbar message? +// } else if (entries.count() == 1) { +// uint line, col; +// viewCursorIface->cursorPositionReal(&line, &col); +// QString txt = entries[0].text.mid(word.length()); +// editIface->insertText( line, col, txt ); +// viewCursorIface->setCursorPositionReal( line, col + txt.length() ); + } else { + m_inCompletion = true; + completionIface->showCompletionBox(entries, word.length()); + } +} + + +QValueList<KTextEditor::CompletionEntry> AbbrevPart::findAllWords(const QString &text, const QString &prefix) +{ + QValueList<KTextEditor::CompletionEntry> entries; + + KParts::ReadWritePart *part = dynamic_cast<KParts::ReadWritePart*>(partController()->activePart()); + QWidget *view = partController()->activeWidget(); + if (!part || !view) { + kdDebug(9028) << "no rw part" << endl; + return entries; + } + + QString suffix = part->url().url(); + int pos = suffix.findRev('.'); + if (pos != -1) + suffix.remove(0, pos+1); + kdDebug(9028) << "AbbrevPart::findAllWords with suffix " << suffix << endl; + + QMap<QString, bool> map; + QRegExp rx( QString("\\b") + prefix + "[a-zA-Z0-9_]+\\b" ); + + int idx = 0; + pos = 0; + int len = 0; + while ( (pos = rx.search(text, idx)) != -1 ) { + len = rx.matchedLength(); + QString word = text.mid(pos, len); + if (map.find(word) == map.end()) { + KTextEditor::CompletionEntry e; + e.text = word; + entries << e; + map[ word ] = TRUE; + } + idx = pos + len + 1; + } + + idx = 0; + pos = 0; + len = 0; + while ( (pos = rx.search(m_completionFile, idx)) != -1 ) { + len = rx.matchedLength(); + QString word = m_completionFile.mid(pos, len); + if (map.find(word) == map.end()) { + KTextEditor::CompletionEntry e; + e.text = word; + entries << e; + map[ word ] = TRUE; + } + idx = pos + len + 1; + } + + + QMap<QString, CodeTemplate*> m = m_templates[suffix]; + for (QMap<QString, CodeTemplate*>::const_iterator it = m.begin(); it != m.end() ; ++it) { + KTextEditor::CompletionEntry e; + e.text = it.data()->description + " <abbrev>"; + e.userdata = it.key(); + entries << e; + } + + return entries; +} + + +void AbbrevPart::slotExpandAbbrev() +{ + KParts::ReadWritePart *part = dynamic_cast<KParts::ReadWritePart*>(partController()->activePart()); + QWidget *view = partController()->activeWidget(); + if (!part || !view) { + kdDebug(9028) << "no rw part" << endl; + return; + } + + QString suffix = part->url().url(); + int pos = suffix.findRev('.'); + if (pos != -1) + suffix.remove(0, pos+1); + + KTextEditor::EditInterface *editiface + = dynamic_cast<KTextEditor::EditInterface*>(part); + if (!editiface) { + kdDebug(9028) << "no editiface" << endl; + return; + } + KTextEditor::ViewCursorInterface *cursoriface + = dynamic_cast<KTextEditor::ViewCursorInterface*>(view); + if (!cursoriface) { + kdDebug(9028) << "no viewcursoriface" << endl; + return; + } + + QString word = currentWord(); + kdDebug(9028) << "Expanding word " << word << " with suffix " << suffix << "." << endl; + + QMap<QString, CodeTemplate*> m = m_templates[suffix]; + for (QMap<QString, CodeTemplate*>::const_iterator it = m.begin(); it != m.end() ; ++it) { + if (it.key() != word) + continue; + + uint line, col; + cursoriface->cursorPositionReal(&line, &col); + + QString linestr = editIface->textLine(line); + int startPos = QMAX( QMIN( (int)col, (int)linestr.length()-1 ), 0 ); + int endPos = startPos; + startPos--; + while (startPos >= 0 && ( linestr[startPos].isLetterOrNumber() || linestr[startPos] == '_' || linestr[startPos] == '~') ) + startPos--; + while (endPos < (int)linestr.length() && ( linestr[endPos].isLetterOrNumber() || linestr[endPos] == '_' ) ) + endPos++; + + editiface->removeText( line, startPos+1, line, endPos ); + insertChars(it.data()->code ); + } +} + + +void AbbrevPart::insertChars( const QString &chars ) +{ + unsigned line=0, col=0; + viewCursorIface->cursorPositionReal( &line, &col ); + + unsigned int currentLine=line, currentCol=col; + + QString spaces; + QString s = editIface->textLine( currentLine ); + uint i=0; + while( i<s.length() && s[ i ].isSpace() ){ + spaces += s[ i ]; + ++i; + } + + bool foundPipe = false; + QString str; + QTextStream stream( &str, IO_WriteOnly ); + QStringList lines = QStringList::split( "\n", chars ); + QStringList::Iterator it = lines.begin(); + line = currentLine; + while( it != lines.end() ){ + QString lineText = *it; + if( it != lines.begin() ){ + stream << spaces; + if( !foundPipe ) + currentCol += spaces.length(); + } + + int idx = lineText.find( '|' ); + if( idx != -1 ){ + stream << lineText.left( idx ) << lineText.mid( idx+1 ); + if( !foundPipe ){ + foundPipe = true; + currentCol += lineText.left( idx ).length(); + kdDebug(9007) << "found pipe at " << currentLine << ", " << currentCol << endl; + } + } else { + stream << lineText; + } + + ++it; + + if( it != lines.end() ){ + stream << "\n"; + if( !foundPipe ){ + ++currentLine; + currentCol = 0; + } + } + } + editIface->insertText( line, col, str ); + kdDebug(9007) << "go to " << currentLine << ", " << currentCol << endl; + viewCursorIface->setCursorPositionReal( currentLine, currentCol ); +} + +void AbbrevPart::addTemplate( const QString& templ, + const QString& descr, + const QString& suffixes, + const QString& code) +{ + m_templates.insert(templ, descr, code, suffixes); +} + + +void AbbrevPart::removeTemplate( const QString &suffixes, const QString &name ) +{ + m_templates.remove( suffixes, name ); +} + + +void AbbrevPart::clearTemplates() +{ + m_templates.clear(); +} + +CodeTemplateList AbbrevPart::templates() const +{ + return m_templates; +} + +void AbbrevPart::slotActivePartChanged( KParts::Part* part ) +{ + kdDebug(9028) << "AbbrevPart::slotActivePartChanged()" << endl; + KTextEditor::Document* doc = dynamic_cast<KTextEditor::Document*>( part ); + + if( !doc || !part->widget() || doc == docIface ) + { + actionCollection()->action( "edit_expandtext" )->setEnabled( false ); + actionCollection()->action( "edit_expandabbrev" )->setEnabled( false ); + return; + } + + docIface = doc; + + if( !docIface ){ + docIface = 0; + editIface = 0; + viewCursorIface = 0; + completionIface = 0; + } + + editIface = dynamic_cast<KTextEditor::EditInterface*>( part ); + viewCursorIface = dynamic_cast<KTextEditor::ViewCursorInterface*>( part->widget() ); + completionIface = dynamic_cast<KTextEditor::CodeCompletionInterface*>( part->widget() ); + + updateActions(); + + if( !editIface || !viewCursorIface || !completionIface ) + return; + + disconnect( part->widget(), 0, this, 0 ); + disconnect( doc, 0, this, 0 ); + + connect( part->widget(), SIGNAL(filterInsertString(KTextEditor::CompletionEntry*, QString*)), + this, SLOT(slotFilterInsertString(KTextEditor::CompletionEntry*, QString*)) ); + + if( autoWordCompletionEnabled() ){ + connect( part->widget(), SIGNAL(completionAborted()), this, SLOT(slotCompletionAborted()) ); + connect( part->widget(), SIGNAL(completionDone()), this, SLOT(slotCompletionDone()) ); + connect( part->widget(), SIGNAL(aboutToShowCompletionBox()), this, SLOT(slotAboutToShowCompletionBox()) ); + connect( doc, SIGNAL(textChanged()), this, SLOT(slotTextChanged()) ); + } + + m_prevLine = -1; + m_prevColumn = -1; + m_sequenceLength = 0; + kdDebug(9028) << "AbbrevPart::slotActivePartChanged() -- OK" << endl; +} + +void AbbrevPart::slotTextChanged() +{ + if( m_inCompletion ) + return; + + unsigned int line, col; + viewCursorIface->cursorPositionReal( &line, &col ); + + if( m_prevLine != int(line) || m_prevColumn+1 != int(col) || col == 0 ){ + m_prevLine = line; + m_prevColumn = col; + m_sequenceLength = 1; + return; + } + + QString textLine = editIface->textLine( line ); + QChar ch = textLine[ col-1 ]; + QChar currentChar = textLine[ col ]; + + if( currentChar.isLetterOrNumber() || currentChar == QChar('_') || !(ch.isLetterOrNumber() || ch == QChar('_')) ){ + // reset + m_prevLine = -1; + return; + } + + if( m_sequenceLength >= 3 ) + slotExpandText(); + + ++m_sequenceLength; + m_prevLine = line; + m_prevColumn = col; +} + +void AbbrevPart::slotFilterInsertString( KTextEditor::CompletionEntry* entry, QString* text ) +{ + kdDebug(9028) << "AbbrevPart::slotFilterInsertString()" << endl; + KParts::ReadWritePart *part = dynamic_cast<KParts::ReadWritePart*>(partController()->activePart()); + QWidget *view = partController()->activeWidget(); + if (!part || !view) { + kdDebug(9028) << "no rw part" << endl; + return; + } + + QString suffix = part->url().url(); + int pos = suffix.findRev('.'); + if (pos != -1) + suffix.remove(0, pos+1); + kdDebug(9028) << "AbbrevPart::slotFilterInsertString with suffix " << suffix << endl; + + if( !entry || !text || !viewCursorIface || !editIface ) + return; + + QString expand( " <abbrev>" ); + if( !entry->userdata.isNull() && entry->text.endsWith(expand) ){ + QString macro = entry->text.left( entry->text.length() - expand.length() ); + *text = ""; + uint line, col; + viewCursorIface->cursorPositionReal( &line, &col ); + editIface->removeText( line, col-currentWord().length(), line, col ); + insertChars( m_templates[suffix][entry->userdata]->code ); + } +} + +void AbbrevPart::updateActions() +{ + actionCollection()->action( "edit_expandtext" )->setEnabled( docIface != 0 ); + actionCollection()->action( "edit_expandabbrev" )->setEnabled( docIface != 0 ); +} + +void AbbrevPart::slotCompletionAborted() +{ + kdDebug(9028) << "AbbrevPart::slotCompletionAborted()" << endl; + m_inCompletion = false; +} + +void AbbrevPart::slotCompletionDone() +{ + kdDebug(9028) << "AbbrevPart::slotCompletionDone()" << endl; + m_inCompletion = false; +} + +void AbbrevPart::slotAboutToShowCompletionBox() +{ + kdDebug(9028) << "AbbrevPart::slotAboutToShowCompletionBox()" << endl; + m_inCompletion = true; +} + +CodeTemplateList::CodeTemplateList( ) +{ + allCodeTemplates.setAutoDelete(true); +} + +CodeTemplateList::~ CodeTemplateList( ) +{ +} + +QMap< QString, CodeTemplate * > CodeTemplateList::operator [ ]( QString suffix ) +{ + kdDebug(9028) << "CodeTemplateList::operator []" << endl; + QMap< QString, CodeTemplate * > selectedTemplates; + for (QMap<QString, QMap<QString, CodeTemplate* > >::const_iterator it = templates.begin(); it != templates.end(); ++it) + { + kdDebug(9028) << "CodeTemplateList::operator [] - suffixes " << it.key() << endl; + if (QStringList::split(",", it.key()).contains(suffix)) + { + kdDebug(9028) << "CodeTemplateList::operator [] - suffixes " << it.key() << " contains " << suffix << endl; + + QMap<QString, CodeTemplate* > m = it.data(); + for (QMap<QString, CodeTemplate* >::const_iterator itt = m.begin(); itt != m.end(); ++itt) + { + kdDebug(9028) << "x" << endl; + selectedTemplates[itt.key()] = itt.data(); + } + } + } + return selectedTemplates; +} + +void CodeTemplateList::insert( QString name, QString description, QString code, QString suffixes ) +{ + QString origSuffixes = suffixes; +// QStringList suffixList; + int pos = suffixes.find('('); + if (pos == -1) + return; + suffixes.remove(0, pos+1); + pos = suffixes.find(')'); + if (pos == -1) + return; + suffixes.remove(pos, suffixes.length()-pos); +// suffixList = QStringList::split(",", suffixes); + + CodeTemplate *t; + if (templates.contains(suffixes) && templates[suffixes].contains(name)) + { + kdDebug(9028) << "found template for suffixes " << suffixes << " and name " << name << endl; + t = templates[suffixes][name]; + } + else + { + kdDebug(9028) << "creating template for suffixes " << suffixes << " and name " << name << endl; + t = new CodeTemplate(); + allCodeTemplates.append(t); + templates[suffixes][name] = t; + } + t->name = name; + t->description = description; + t->code = code; + t->suffixes = origSuffixes; + if (!m_suffixes.contains(origSuffixes)) + m_suffixes.append(origSuffixes); +} + +QPtrList< CodeTemplate > CodeTemplateList::allTemplates( ) const +{ + return allCodeTemplates; +} + +void CodeTemplateList::remove( const QString & suffixes, const QString & name ) +{ + allCodeTemplates.remove(templates[suffixes][name]); + templates[suffixes].remove(name); +} + +void CodeTemplateList::clear( ) +{ + templates.clear(); + allCodeTemplates.clear(); +} + +QStringList CodeTemplateList::suffixes( ) +{ + return m_suffixes; +} + +#include "abbrevpart.moc" diff --git a/parts/abbrev/abbrevpart.h b/parts/abbrev/abbrevpart.h new file mode 100644 index 00000000..f0029b51 --- /dev/null +++ b/parts/abbrev/abbrevpart.h @@ -0,0 +1,113 @@ +/*************************************************************************** + * Copyright (C) 2002 Roberto Raggi * + * roberto@kdevelop.org * + * Copyright (C) 2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * Copyright (C) 2003 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef _ABBREVPART_H_ +#define _ABBREVPART_H_ + +#include <qmap.h> +#include <qptrlist.h> +#include "kdevplugin.h" + +#include <ktexteditor/codecompletioninterface.h> + +class KDialogBase; + +namespace KParts{ + class Part; +} + +namespace KTextEditor{ + class Document; + class EditInterface; + class ViewCursorInterface; +} + +struct CodeTemplate { + QString name; + QString description; + QString code; + QString suffixes; +}; + +class CodeTemplateList { +public: + CodeTemplateList(); + ~CodeTemplateList(); + + QMap<QString, CodeTemplate* > operator[](QString suffix); + void insert(QString name, QString description, QString code, QString suffixes); + void remove(const QString &suffixes, const QString &name); + void clear(); + QStringList suffixes(); + + QPtrList<CodeTemplate> allTemplates() const; + +private: + QMap<QString, QMap<QString, CodeTemplate* > > templates; + QPtrList<CodeTemplate> allCodeTemplates; + QStringList m_suffixes; +}; + +class AbbrevPart : public KDevPlugin +{ + Q_OBJECT + +public: + AbbrevPart( QObject *parent, const char *name, const QStringList & ); + ~AbbrevPart(); + + bool autoWordCompletionEnabled() const; + void setAutoWordCompletionEnabled( bool enabled ); + + void addTemplate(const QString &templ, const QString &descr, + const QString &suffixes, const QString &code); + void removeTemplate(const QString &suffixes, const QString &name); + void clearTemplates(); + CodeTemplateList templates() const; + +private slots: + void slotExpandText(); + void slotExpandAbbrev(); + void configWidget(KDialogBase *dlg); + void slotActivePartChanged( KParts::Part* ); + void slotTextChanged(); + void slotCompletionAborted(); + void slotCompletionDone(); + void slotFilterInsertString( KTextEditor::CompletionEntry*, QString* ); + void slotAboutToShowCompletionBox(); + +private: + void updateActions(); + void load(); + void save(); + QString currentWord() const; + QValueList<KTextEditor::CompletionEntry> findAllWords(const QString &text, const QString &prefix); + void insertChars( const QString &chars ); +// QAsciiDict<CodeTemplate> m_templates; + CodeTemplateList m_templates; + bool m_inCompletion; + int m_prevLine; + int m_prevColumn; + int m_sequenceLength; + bool m_autoWordCompletionEnabled; + QString m_completionFile; + + KTextEditor::Document* docIface; + KTextEditor::EditInterface* editIface; + KTextEditor::ViewCursorInterface* viewCursorIface; + KTextEditor::CodeCompletionInterface* completionIface; +}; + +#endif diff --git a/parts/abbrev/addtemplatedlg.cpp b/parts/abbrev/addtemplatedlg.cpp new file mode 100644 index 00000000..3c84c2e1 --- /dev/null +++ b/parts/abbrev/addtemplatedlg.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2002 Roberto Raggi (roberto@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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ +#include "addtemplatedlg.h" +#include <qcombobox.h> +#include <klineedit.h> +#include <qpushbutton.h> + +AddTemplateDialog::AddTemplateDialog( QStringList suffixesList, QWidget *parent, const char *name ) + : AddTemplateDialogBase( parent, name ) +{ + setFocusProxy( editTemplate ); + comboSuffixes->insertStringList(suffixesList); + connect( editTemplate, SIGNAL(textChanged ( const QString & )), this, SLOT( textChanged())); + connect( editDescription, SIGNAL(textChanged ( const QString & )), this, SLOT( textChanged())); + buttonOk->setEnabled(false); +} + +AddTemplateDialog::~AddTemplateDialog() +{ +} + +void AddTemplateDialog::textChanged() +{ + buttonOk->setEnabled( !editTemplate->text().isEmpty() && !editDescription->text().isEmpty() ); +} + +QString AddTemplateDialog::templ() const +{ + return editTemplate->text(); +} + +QString AddTemplateDialog::description() const +{ + return editDescription->text(); +} + +QString AddTemplateDialog::suffixes() const +{ + return comboSuffixes->currentText(); +} + +#include "addtemplatedlg.moc" diff --git a/parts/abbrev/addtemplatedlg.h b/parts/abbrev/addtemplatedlg.h new file mode 100644 index 00000000..ddc22eb7 --- /dev/null +++ b/parts/abbrev/addtemplatedlg.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2002 Roberto Raggi (roberto@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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ +#ifndef caddtemplatedialog_h +#define caddtemplatedialog_h + +#include "addtemplatedlgbase.h" + + +class AddTemplateDialog: public AddTemplateDialogBase +{ + Q_OBJECT + +public: + AddTemplateDialog( QStringList suffixesList, QWidget *parent=0, const char *name=0 ); + virtual ~AddTemplateDialog(); + + QString templ() const; + QString description() const; + QString suffixes() const; +private slots: + void textChanged(); +}; + +#endif diff --git a/parts/abbrev/addtemplatedlgbase.ui b/parts/abbrev/addtemplatedlgbase.ui new file mode 100644 index 00000000..bfe5f0bb --- /dev/null +++ b/parts/abbrev/addtemplatedlgbase.ui @@ -0,0 +1,176 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>AddTemplateDialogBase</class> +<widget class="QDialog"> + <property name="name"> + <cstring>AddTemplateDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>348</width> + <height>161</height> + </rect> + </property> + <property name="caption"> + <string>Add Code Template</string> + </property> + <property name="sizeGripEnabled"> + <bool>false</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel3</cstring> + </property> + <property name="text"> + <string>&Template:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>editTemplate</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>TextLabel4</cstring> + </property> + <property name="text"> + <string>&Description:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>editDescription</cstring> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1"> + <property name="name"> + <cstring>editTemplate</cstring> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1"> + <property name="name"> + <cstring>editDescription</cstring> + </property> + </widget> + <spacer row="3" column="1"> + <property name="name"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>MinimumExpanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>10</height> + </size> + </property> + </spacer> + <widget class="QComboBox" row="2" column="1"> + <property name="name"> + <cstring>comboSuffixes</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>labelSuffixes</cstring> + </property> + <property name="text"> + <string>&Suffixes:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>comboSuffixes</cstring> + </property> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>AddTemplateDialog</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>AddTemplateDialog</receiver> + <slot>reject()</slot> + </connection> +</connections> +<tabstops> + <tabstop>editTemplate</tabstop> + <tabstop>editDescription</tabstop> + <tabstop>comboSuffixes</tabstop> + <tabstop>buttonOk</tabstop> + <tabstop>buttonCancel</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>klineedit.h</includehint> +</includehints> +</UI> diff --git a/parts/abbrev/cpp_keywords b/parts/abbrev/cpp_keywords new file mode 100644 index 00000000..72d96901 --- /dev/null +++ b/parts/abbrev/cpp_keywords @@ -0,0 +1,84 @@ +K_DCOP +k_dcop +k_dcop_signals +Q_OBJECT +signals +slots +emit +__int64 +__asm__ +and +and_eq +asm +auto +bitand +bitor +bool +break +case +catch +char +class +compl +const +const_cast +continue +default +delete +do +double +dynamic_cast +else +enum +explicit +export +extern +false +float +for +friend +goto +if +inline +int +long +mutable +namespace +new +not +not_eq +operator +or +or_eq +private +protected +public +register +reinterpret_cast +return +short +signed +sizeof +static +static_cast +struct +switch +template +this +throw +true +try +typedef +typeid +typename +union +unsigned +using +virtual +void +volatile +while +xor +xor_eq + + diff --git a/parts/abbrev/kdevabbrev.desktop b/parts/abbrev/kdevabbrev.desktop new file mode 100644 index 00000000..3e913e8d --- /dev/null +++ b/parts/abbrev/kdevabbrev.desktop @@ -0,0 +1,83 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=Provides support for customizable abbreviations - short words which expand into commonly needed code structures. +Comment[ca]=Proporciona suport per a abreviatures personalitzables - paraules curtes que en expandir-se formen estructures de codi usades habitualment. +Comment[da]=Sørger for støtte til brugerindrettede forkortelser - korte ord som udvides til almindeligt nyttige kodestrukturer. +Comment[de]=Unterstützung für benutzerdefinierte Abkürzungen - Kurzbegriffe, die zu häufig verwendeten Quelltextstrukturen erweitert werden. +Comment[el]=Προσφέρει υποστήριξη για προσαρμοσμένες συντομογραφίες - σύντομες λέξεις οι οποίες αναπτύσσονται σε συχνά χρησιμοποιούμενες δομές κώδικα. +Comment[en_GB]=Provides support for customisable abbreviations - short words which expand into commonly needed code structures. +Comment[es]=Proporciona soporte para las abreviaturas personalizables - palabras cortas que se expanden en estructuras utilizadas habitualmente. +Comment[et]=Pakub kohandatavate lühendite toetust. Viimased on lühendid, mis laienevad sagedamini vajaminevateks koodistruktuurideks. +Comment[eu]=Laburdura pertsonalizatuen euskarria eskeintzen du-normalean behar diren kode-egitura bezala zabalduko diren hitz motzak. +Comment[fa]=پشتیبانی برای مختصرسازیهای سفارشی فراهم میکند - واژههای کوتاه که اغلب به ساختارهای کد مورد نیاز بسط مییابد. +Comment[fr]=Fournit une prise en charge pour les abréviations personnalisables - mots abrégés qui s'étendent en structures de code communément nécessaires. +Comment[gl]=Proporciona soporte para abreviaturas persoalizadas - palabras curtas que se expanden en estructuras de código usadas frecuentemente. +Comment[hi]=मनपसंद किए जा सकने योग्य संक्षिप्त शब्दों जो कि सामान्यतया आवश्यक कोड स्ट्रक्चर में एक्सपांड हो सकें, के लिए समर्थन प्रदान करता है. +Comment[hu]=Lehetővé teszi különféle rövidítések használatát (rövid kifejezések kódstruktúrává kibontását) +Comment[it]=Offre il supporto per le abbreviazioni personalizzate - brevi parole che vengono espanse in strutture di codice richieste comunemente. +Comment[ja]=短い単語を一般に必要とされるコードに展開する、カスタマイズ可能な略語のサポートを提供します。 +Comment[ms]=Menyediakan sokongan untuk kependekan boleh ditetapkan - perkataan pendek yang berkembang kepada struktur kod yang biasa diperlukan. +Comment[nds]=Ünnerstütten för egen Afkörten - Kortwöör, de na faken bruukt Kodestrukturen utfooldt warrt. +Comment[ne]=साझा आवश्यक सङ्केत बनावटमा विस्तार गरिने छोटो शब्द - अनुकूलन संक्षिप्त रूपका लागि समर्थन प्रदान गर्दछ । +Comment[nl]=Biedt ondersteuning voor afkortingen - korte stukjes tekst die expanderen tot veelgebruikte codestructuren. +Comment[pl]=Umożliwia obsługę konfigurowalnych skrótów - krótkich słow rozszerzających się w często używane struktury kodu. +Comment[pt]=Oferece o suporte para abreviaturas personalizadas - palavras curtas que podem expandir para estruturas de código normalmente necessárias. +Comment[pt_BR]=Fornece suporte para abreviaturas personalizadas - palavras curtas que se expandem em estruturas de código normalmente necessárias. +Comment[ru]=Предоставляет поддержку для настраиваемых сокращений - коротких слов, которые заменяются на часто используемые структуры кода. +Comment[sk]=Poskytuje podporu pre prispôsobiteľné skratky - krátke slová, ktoré sa rozvinú do bežne potrebných kódových štruktúr. +Comment[sr]=Обезбеђује подршку за прилагодљиве скраћенице — кратке речи које се проширују у уобичајено потребне структуре кôда. +Comment[sr@Latn]=Obezbeđuje podršku za prilagodljive skraćenice — kratke reči koje se proširuju u uobičajeno potrebne strukture kôda. +Comment[sv]=Ger stöd för anpassningsbara förkortningar: korta ord som expanderas till vanligt använda kodstrukturer. +Comment[ta]=தேவைக்கேற்ப சுருக்கத்திற்கு இது ஆதரவு தரும்-குறியிடு வடிவத்திற்கு இந்த சுருக்கங்கள் மிகவும் உதவும். +Comment[tg]=Барои кӯтоҳ намоӣ ёрдами худро саҳм мегузорад, яъне калимаҳои кӯтоҳе, ки як хел вақт ба структураҳои коди истифода намоии истифода бурда мешавад. +Comment[tr]=Özelleştirilebilir kısaltmalar için destek sağlar - sık ihtiyaç duyualan kod yapıları yerine geçen kısa kelimeler. +Comment[zh_CN]=为自定义缩写提供支持 - 按需要扩展为所需代码结构的简短文字。 +Comment[zh_TW]=提供可調整的縮寫支援 - 將短的字擴展到常用的程式源碼結構。 +Name=KDevAbbrev +Name[da]=KDevelop Forkortelser +Name[de]=Abkürzungsmodul (KDevelop) +Name[hi]=के-डेव-एब्रिवि +Name[nds]=KDevelop-Afkörtenmoduul +Name[pl]=KDevSkróty +Name[sk]=KDev skratky +Name[sv]=KDevelop förkortningar +Name[zh_TW]=KDevelop 縮寫 +GenericName=Abbreviation Expansion +GenericName[ca]=Expansió d'abreviatures +GenericName[da]=Forkortelsesudvidelse +GenericName[de]=Abkürzungsvervollständigung +GenericName[el]=Ανάπτυξη συντομογραφιών +GenericName[es]=Expansión de abreviaturas +GenericName[et]=Lühendite laienemine +GenericName[eu]=Laburduren zabalkuntza +GenericName[fa]=بسط مختصرسازی +GenericName[fr]=Expansion des abréviations +GenericName[gl]=Expansión de abreviaturas +GenericName[hi]=संक्षिप्त शब्द एक्सपांशन +GenericName[hu]=Rövidítéskezelő +GenericName[it]=Espansione delle abbreviazioni +GenericName[ja]=略語拡張 +GenericName[ms]=Pengembang Kependekan +GenericName[nds]=Afkörtenutfoolden +GenericName[ne]=संक्षिप्त रूप विस्तार +GenericName[nl]=Afkortingen expanderen +GenericName[pl]=Rozwijanie skrótów +GenericName[pt]=Expansão de Abreviaturas +GenericName[pt_BR]=Expansão de Abreviaturas +GenericName[ru]=Расширение сокращений +GenericName[sk]=Rozvinutie skratiek +GenericName[sr]=Проширење скраћеница +GenericName[sr@Latn]=Proširenje skraćenica +GenericName[sv]=Expansion av förkortningar +GenericName[ta]=சுருக்கத்தின் விரிவாக்கம் +GenericName[tg]=Васеъкунии кӯтоҳ карда шуда +GenericName[tr]=Kısaltma Genişlemesi +GenericName[zh_CN]=缩写扩展 +GenericName[zh_TW]=縮寫擴展 +ServiceTypes=KDevelop/Plugin +Icon=fontsizeup +X-KDE-Library=libkdevabbrev +X-KDevelop-Version=5 +X-KDevelop-Scope=Global +X-KDevelop-Properties=CodeEditing diff --git a/parts/abbrev/kdevabbrev.rc b/parts/abbrev/kdevabbrev.rc new file mode 100644 index 00000000..e994ee76 --- /dev/null +++ b/parts/abbrev/kdevabbrev.rc @@ -0,0 +1,10 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="KDevAbbrevPart" version="1"> +<MenuBar> + <Menu name="edit" > + <Action name="edit_expandtext"/> + <Action name="edit_expandabbrev"/> + </Menu> +</MenuBar> +</kpartgui> + diff --git a/parts/abbrev/qt_classes b/parts/abbrev/qt_classes new file mode 100644 index 00000000..266307bc --- /dev/null +++ b/parts/abbrev/qt_classes @@ -0,0 +1,409 @@ +QAccel +QAccessible +QApplication +QAsciiDict +QAsyncIO +QAuBucket +QBackInsertIterator +QBaseBucket +QBitArray +QBitVal +QBitmap +QBoxLayout +QBoxLayoutData +QBrush +QButton +QButtonData +QButtonGroup +QButtonList +QCDict +QCList +QCListIt +QCString +QCache +QCanvas +QCanvasChunk +QCanvasData +QCanvasEllipse +QCanvasItem +QCanvasItemExtra +QCanvasLine +QCanvasPixmap +QCanvasPixmapArray +QCanvasPolygon +QCanvasPolygonalItem +QCanvasRectangle +QCanvasSprite +QCanvasText +QCanvasTextExtra +QCanvasView +QCanvasViewData +QChar +QCharRef +QCharRef +QCheckBox +QCheckListItem +QCleanupHandler +QClipboard +QColor +QColorGroup +QComboBox +QComboBoxData +QConnection +QConnectionList +QConnectionListIt +QCursor +QCustomMenuItem +QDataSource +QDataStream +QDataStream +QDate +QDateTime +QDeepCopy +QDialog +QDict +QDir +QDiskFont +QDockArea +QDockAreaLayout +QDockWindow +QDockWindowHandle +QDockWindowResizeHandle +QDockWindowTitleBar +QDomAttr +QDomCDATASection +QDomCharacterData +QDomComment +QDomDocument +QDomDocumentFragment +QDomDocumentType +QDomElement +QDomEntity +QDomEntityReference +QDomImplementation +QDomNamedNodeMap +QDomNode +QDomNodeList +QDomNotation +QDomProcessingInstruction +QDomText +QDragEnterEvent +QDragLeaveEvent +QDragMoveEvent +QDragObject +QDragObjectData +QDropSite +QEvent +QEventLoop +QFileDialog +QFileDialogQFileListView +QFileInfo +QFilePreview +QFocusData +QFocusData +QFocusEvent +QFont +QFontDatabase +QFontEngine +QFontInfo +QFontMetrics +QFontPrivate +QFontStylePrivate +QFtpCommand +QGArray +QGCacheIterator +QGDItList +QGDict +QGDictIterator +QGDictIterator +QGL +QGLCmap +QGLColormap +QGLOverlayWidget +QGList +QGListIterator +QGListIteratorList +QGListStdIterator +QGVector +QGfx +QGridLayout +QGridLayoutBox +QGridLayoutData +QGroupBox +QGuardedPtr +QHBoxLayout +QHeader +QHeaderData +QHostAddress +QHttpHeader +QHttpRequest +QIODevice +QIconDragItem +QIconFactory +QIconSet +QIconView +QIconViewItem +QIconViewItemLineEdit +QIconViewPrivate +QIconViewToolTip +QImage +QImageConsumer +QImageDataMisc +QImageDecoder +QImageDrag +QImageDragData +QImageFormat +QImageFormat +QImageFormatType +QImageIO +QImageTextKeyLang +QIntDict +QInternal +QJpUnicodeConv +QKeyEvent +QKeySequence +QLNode +QLabel +QLayout +QLayoutItem +QLayoutIterator +QLibrary +QLineEdit +QListBox +QListBoxItem +QListView +QListViewItem +QListViewItemIterator +QListViewToolTip +QLocale +QMacDndExtra +QMacMime +QMacSavedPortInfo +QMainWindow +QMainWindowLayout +QMap +QMapConstIterator +QMapIterator +QMemberDict +QMembuf +QMenuBar +QMenuData +QMenuDataData +QMenuItem +QMenuItem +QMenuItemData +QMetaObject +QMetaObject +QMetaObjectCleanUp +QMetaProperty +QMetaProperty +QMimeSource +QMimeSourceFactory +QMimeSourceFactory +QMimeSourceFactoryData +QMouseEvent +QMovie +QMovie +QMultiCellPixmap +QMultiLineEditCommand +QMultiLineEditData +QMutex +QMutexLocker +QNPInstance +QNPStream +QNPlugin +QNetworkOperation +QNetworkProtocol +QNetworkProtocolFactoryBase +QObject +QObjectList +QObjectListIt +QObjectUserData +QObjectUserData +QOleDropTarget +QPaintDevice +QPaintDevice +QPaintDeviceMetrics +QPaintDeviceMetrics +QPaintEvent +QPainter +QPalette +QPen +QPicture +QPixmap +QPixmapCache +QPoint +QPointArray +QPolygonScanner +QPolygonalProcessor +QPopupMenu +QPostEventList +QPrinter +QProcess +QProgressDialogData +QPtrCollection +QPtrDict +QPtrList +QPtrVector +QPushButton +QRangeControl +QRect +QRect +QRegExp +QRegExpEngine +QRegion +QResizeEvent +QSArgument +QSEditor +QSInterpreter +QSObjectFactory +QSProject +QSScript +QSStackFrame +QSWrapperFactory +QScrollViewData +QSemaphore +QSenderObjectList +QSessionManager +QSessionManagerData +QSettings +QSharedCleanupHandler +QShowEvent +QSignal +QSignalMapperData +QSignalVec +QSimpleRichText +QSimpleRichTextData +QSingleCleanupHandler +QSize +QSizePolicy +QSocket +QSocketDevice +QSocketNotifier +QSoundData +QSpacerItem +QSpinBox +QSplitter +QSplitterHandle +QSplitterLayoutStruct +QSql +QSqlCursor +QSqlDatabase +QSqlDriver +QSqlDriverCreatorBase +QSqlDriverExtension +QSqlEditorFactory +QSqlError +QSqlExtension +QSqlField +QSqlFieldInfo +QSqlForm +QSqlIndex +QSqlPropertyMap +QSqlPropertyMap +QSqlQuery +QSqlRecord +QSqlRecordInfo +QSqlResult +QStatusBar +QStoredDragData +QStrList +QString +QStringList +QStyle +QStyleFactory +QStyleHintReturn +QStyleOption +QStyleSheet +QStyleSheetItemData +QSyntaxHighlighter +QSyntaxHighlighterInternal +QTSManip +QTab +QTabBar +QTabWidgetData +QTable +QTableHeader +QTableSelection +QTextBrowser +QTextBrowserData +QTextCodec +QTextCodec +QTextCodecFactory +QTextCommand +QTextCursor +QTextCustomItem +QTextDecoder +QTextDecoder +QTextDocument +QTextDrag +QTextEdit +QTextEncoder +QTextFormat +QTextFormatCollection +QTextItem +QTextOStreamIterator +QTextParag +QTextParagraph +QTextStream +QTextString +QTextView +QThread +QThreadInstance +QThreadStorage +QThreadStorageData +QTime +QTimer +QTimerEvent +QTipManager +QToolBar +QToolButton +QToolTipGroup +QTranslator +QTranslatorMessage +QUrl +QUrlInfo +QUrlOperator +QVBoxLayout +QValidator +QValueList +QValueListConstIterator +QValueListIterator +QValueListNode +QValueVector +QVariant +QWMatrix +QWMatrix +QWSDecoration +QWSDisplay +QWSManager +QWSRegionManager +QWaitCondition +QWheelEvent +QWidget +QWidgetFactory +QWidgetList +QWidgetListIt +QWidgetMapper +QWidgetResizeHandler +QWidgetStack +QWindowsMime +QWindowsXPStyle +QWorkspaceChild +QXmlAttributes +QXmlContentHandler +QXmlDTDHandler +QXmlDeclHandler +QXmlDefaultHandler +QXmlEntityResolver +QXmlErrorHandler +QXmlInputSource +QXmlLexicalHandler +QXmlLocator +QXmlNamespaceSupport +QXmlParseException +QXmlReader +QXmlSimpleReader +QPNGImageWriter +QuickInterpreter +UibStrTable |