summaryrefslogtreecommitdiffstats
path: root/editors
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /editors
downloadtdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz
tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'editors')
-rw-r--r--editors/Makefile.am1
-rw-r--r--editors/editor-chooser/Makefile.am13
-rw-r--r--editors/editor-chooser/README.dox8
-rw-r--r--editors/editor-chooser/editchooser.ui130
-rw-r--r--editors/editor-chooser/editorchooser_part.cpp42
-rw-r--r--editors/editor-chooser/editorchooser_part.h33
-rw-r--r--editors/editor-chooser/editorchooser_widget.cpp132
-rw-r--r--editors/editor-chooser/editorchooser_widget.h39
-rw-r--r--editors/editor-chooser/kdeveditorchooser.desktop91
9 files changed, 489 insertions, 0 deletions
diff --git a/editors/Makefile.am b/editors/Makefile.am
new file mode 100644
index 00000000..ae0c79eb
--- /dev/null
+++ b/editors/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = editor-chooser
diff --git a/editors/editor-chooser/Makefile.am b/editors/editor-chooser/Makefile.am
new file mode 100644
index 00000000..2cdf58a6
--- /dev/null
+++ b/editors/editor-chooser/Makefile.am
@@ -0,0 +1,13 @@
+INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes)
+
+kde_module_LTLIBRARIES = libkdeveditorchooser.la
+libkdeveditorchooser_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdeveditorchooser_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdeveditorchooser_la_SOURCES = editorchooser_part.cpp editchooser.ui editorchooser_widget.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdeveditorchooser.desktop
+
diff --git a/editors/editor-chooser/README.dox b/editors/editor-chooser/README.dox
new file mode 100644
index 00000000..4dea700d
--- /dev/null
+++ b/editors/editor-chooser/README.dox
@@ -0,0 +1,8 @@
+/** \class EditorChooserPart
+Chooses the text editor to use in KDevelop from a list of all KTextEditor Class interface compliant editors installed in KDE.
+
+\authors <a href="mailto:hoelzer AT physik.uni-wuerzburg.de">Matthias Hoelzer</a>
+
+\feature Chooses the text editor to use in KDevelop from a list of all KTextEditor Class interface compliant editors installed in KDE.
+
+*/
diff --git a/editors/editor-chooser/editchooser.ui b/editors/editor-chooser/editchooser.ui
new file mode 100644
index 00000000..66f46b59
--- /dev/null
+++ b/editors/editor-chooser/editchooser.ui
@@ -0,0 +1,130 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>EditChooser</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>EditChooser</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>514</width>
+ <height>383</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>&amp;Embedded Editor</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox" row="0" column="0">
+ <property name="name">
+ <cstring>EditorPart</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&lt;i&gt;Note:&lt;/i&gt; Changing the preferred editor will not affect
+already open files.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>external_changes_group</cstring>
+ </property>
+ <property name="title">
+ <string>On External Changes</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;p&gt;&lt;b&gt;Action to take when an open file is changed on disk&lt;/b&gt;&lt;/p&gt;
+&lt;p&gt;&lt;b&gt;Do nothing&lt;/b&gt; - The file will be marked as externally changed and the user will be asked to verify any attempt to overwrite it &lt;/p&gt;
+&lt;p&gt;&lt;b&gt;Alert the user&lt;/b&gt; - A dialog will alert the user that a file has changed and offer the user to reload the file&lt;/p&gt;
+&lt;p&gt;&lt;b&gt;Automatically reload&lt;/b&gt; - Any files that are not modified in memory are reloaded, and an alert is shown for any conflicts&lt;/p&gt;</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>nothing</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Do nothing</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>alert</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>&amp;Alert the user</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>reload</cstring>
+ </property>
+ <property name="text">
+ <string>Automatically reload the file &amp;if safe, alert the user if not</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>EditorPart</sender>
+ <signal>activated(const QString&amp;)</signal>
+ <receiver>EditChooser</receiver>
+ <slot>slotEditPartChanged(const QString&amp;)</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot>slotEditPartChanged(const QString &amp;)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+</UI>
diff --git a/editors/editor-chooser/editorchooser_part.cpp b/editors/editor-chooser/editorchooser_part.cpp
new file mode 100644
index 00000000..f11a540b
--- /dev/null
+++ b/editors/editor-chooser/editorchooser_part.cpp
@@ -0,0 +1,42 @@
+#include <qvbox.h>
+
+
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdialogbase.h>
+#include <kdevgenericfactory.h>
+
+#include <kdevcore.h>
+#include <kdevplugininfo.h>
+
+#include "editorchooser_part.h"
+#include "editorchooser_widget.h"
+
+typedef KDevGenericFactory<EditorChooserPart> EditorChooserFactory;
+static const KDevPluginInfo data("kdeveditorchooser");
+K_EXPORT_COMPONENT_FACTORY( libkdeveditorchooser, EditorChooserFactory( data ) )
+
+EditorChooserPart::EditorChooserPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "EditorChooserPart")
+{
+ setInstance(EditorChooserFactory::instance());
+
+ connect(core(), SIGNAL(configWidget(KDialogBase*)), this, SLOT(configWidget(KDialogBase*)));
+}
+
+
+EditorChooserPart::~EditorChooserPart()
+{
+}
+
+
+void EditorChooserPart::configWidget(KDialogBase *dlg)
+{
+ QVBox *vbox = dlg->addVBoxPage(i18n("Editor"), i18n("Editor"), BarIcon("kate", KIcon::SizeMedium) );
+ EditorChooserWidget *w = new EditorChooserWidget(vbox);
+ connect(dlg, SIGNAL(okClicked()), w, SLOT(accept()));
+}
+
+
+
+#include "editorchooser_part.moc"
diff --git a/editors/editor-chooser/editorchooser_part.h b/editors/editor-chooser/editorchooser_part.h
new file mode 100644
index 00000000..15cb2f97
--- /dev/null
+++ b/editors/editor-chooser/editorchooser_part.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2001 Matthias Hoelzer-Kluepfel <mhk@caldera.de>
+ */
+
+
+#ifndef __KDEVPART_EDITORCHOOSER_H__
+#define __KDEVPART_EDITORCHOOSER_H__
+
+
+class KDialogBase;
+
+
+#include <kdevplugin.h>
+
+
+class EditorChooserPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+
+ EditorChooserPart(QObject *parent, const char *name, const QStringList &);
+ ~EditorChooserPart();
+
+
+private slots:
+
+ void configWidget(KDialogBase *dlg);
+
+};
+
+
+#endif
diff --git a/editors/editor-chooser/editorchooser_widget.cpp b/editors/editor-chooser/editorchooser_widget.cpp
new file mode 100644
index 00000000..6c9f7071
--- /dev/null
+++ b/editors/editor-chooser/editorchooser_widget.cpp
@@ -0,0 +1,132 @@
+#include <qcombobox.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
+
+#include <kapplication.h>
+#include <kdeversion.h>
+#include <kservice.h>
+#include <kdebug.h>
+#include <kconfig.h>
+
+
+#include "editorchooser_widget.h"
+
+
+EditorChooserWidget::EditorChooserWidget(QWidget *parent, const char *name)
+ : EditChooser(parent, name)
+{
+ // ask the trader which editors he has to offer
+ m_offers = KTrader::self()->query("text/plain", "'KTextEditor/Document' in ServiceTypes");
+
+ // remove the vim-part, it's known to crash
+ KTrader::OfferList::Iterator it = m_offers.begin();
+ while( it != m_offers.end() )
+ {
+ if ( ((*it)->desktopEntryName() == "vimpart")
+ || ((*it)->desktopEntryName() == "qeditor_part") )
+ {
+ m_offers.remove( it );
+ break;
+ }
+ ++it;
+ }
+
+ load();
+ slotEditPartChanged(QString());
+}
+
+
+void EditorChooserWidget::load()
+{
+ EditorPart->clear();
+
+ // find the editor to use
+ KConfig *config = kapp->config();
+ config->setGroup("Editor");
+ QString editor = config->readPathEntry("EmbeddedKTextEditor");
+
+ // add the entries to the listview
+ KTrader::OfferList::Iterator it;
+ int index=-1, current=0;
+ for (it = m_offers.begin(); it != m_offers.end(); ++it)
+ {
+ EditorPart->insertItem((*it)->name());
+ if ( (*it)->desktopEntryName() == editor )
+ index = current;
+ ++current;
+ }
+
+ if (index >=0)
+ EditorPart->setCurrentItem(index);
+
+ QString dirtyAction = config->readEntry( "DirtyAction" );
+
+ if ( dirtyAction == "reload" )
+ {
+ reload->setChecked( true );
+ }
+ else if ( dirtyAction == "alert" )
+ {
+ alert->setChecked( true );
+ }
+ else
+ {
+ nothing->setChecked( true );
+ }
+}
+
+
+void EditorChooserWidget::save()
+{
+ KConfig *config = kapp->config();
+ config->setGroup("Editor");
+
+ KTrader::OfferList::Iterator it;
+ for (it = m_offers.begin(); it != m_offers.end(); ++it)
+ if ( EditorPart->currentText() == (*it)->name() )
+ {
+ config->writePathEntry("EmbeddedKTextEditor", (*it)->desktopEntryName());
+ }
+
+ if ( reload->isChecked() )
+ {
+ config->writeEntry( "DirtyAction", "reload" );
+ }
+ else if ( alert->isChecked() )
+ {
+ config->writeEntry( "DirtyAction", "alert" );
+ }
+ else
+ {
+ config->writeEntry( "DirtyAction", "nothing" );
+ }
+
+ config->sync();
+}
+
+
+void EditorChooserWidget::accept()
+{
+ save();
+}
+
+void EditorChooserWidget::slotEditPartChanged( const QString & )
+{
+ KTrader::OfferList::Iterator it;
+ for (it = m_offers.begin(); it != m_offers.end(); ++it)
+ {
+ if ( EditorPart->currentText() == (*it)->name() )
+ {
+ external_changes_group->setEnabled( (*it)->desktopEntryName() == "katepart" );
+ return;
+ }
+ }
+ external_changes_group->setEnabled( false );
+}
+
+
+#include "editorchooser_widget.moc"
+
+
+
+
diff --git a/editors/editor-chooser/editorchooser_widget.h b/editors/editor-chooser/editorchooser_widget.h
new file mode 100644
index 00000000..1688b5c0
--- /dev/null
+++ b/editors/editor-chooser/editorchooser_widget.h
@@ -0,0 +1,39 @@
+#ifndef __EDITORCHOOSER_WIDGET_H__
+#define __EDITORCHOOSER_WIDGET_H__
+
+
+#include <qwidget.h>
+#include <ktrader.h>
+
+#include "editchooser.h"
+
+
+class EditorChooserWidget : public EditChooser
+{
+ Q_OBJECT
+
+public:
+
+ EditorChooserWidget(QWidget *parent=0, const char *name=0);
+
+public slots:
+ virtual void slotEditPartChanged(const QString &);
+
+private slots:
+
+ void load();
+ void save();
+
+ void accept();
+
+private:
+ KTrader::OfferList m_offers;
+
+};
+
+
+#endif
+
+
+
+
diff --git a/editors/editor-chooser/kdeveditorchooser.desktop b/editors/editor-chooser/kdeveditorchooser.desktop
new file mode 100644
index 00000000..691c538a
--- /dev/null
+++ b/editors/editor-chooser/kdeveditorchooser.desktop
@@ -0,0 +1,91 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Provides a dialog for Editor selection.
+Comment[ca]=Proporciona un diàleg per a la selecció de l'Editor.
+Comment[da]=Sørger for en dialog til editor-valg.
+Comment[de]=Editor-Auswahl für KDevelop.
+Comment[el]=Παρέχει ένα διάλογο για επιλογή επεξεργαστή.
+Comment[en_GB]=Provides a dialogue for Editor selection.
+Comment[es]=Proporciona un diálogo para la selección de un editor.
+Comment[et]=Dialoog redaktori valimiseks.
+Comment[eu]=Editorearen hautapenerako elkarrizketa-koadroa eskeintzen du.
+Comment[fa]=محاوره‌ای برای گزینش ویرایشگر فراهم می‌کند.
+Comment[fr]=Fournit une boîte de dialogue pour la sélection de l'éditeur.
+Comment[ga]=Soláthraíonn sé dialóg roghnaithe eagarthóra.
+Comment[gl]=Proporciona un diálogo para a selección dun editor.
+Comment[hi]=संपादक चयन के लिए एक संवाद उपलब्ध कराता है.
+Comment[hu]=A szövegszerkesztő komponens kiválasztását teszi lehetővé.
+Comment[is]=Útvegar samtalsglugga fyrir val á ritli
+Comment[it]=Fornisce a una finestra per la selezione dell'editor.
+Comment[ja]=エディタを選択するためのダイアログを提供します。
+Comment[ms]=Menyediakan dialog untuk pemilihan Penyunting.
+Comment[nds]=Stellt en Dialoog för de Editor-Utwahl praat.
+Comment[ne]=सम्पादन चयनका लागि संवाद प्रदान गर्दछ
+Comment[nl]=Biedt een dialoog om een editor te kiezen.
+Comment[pl]=Okno dialogowe do wyboru edytora.
+Comment[pt]=Fornece um diálogo para a selecção de Editor.
+Comment[pt_BR]=Provê um diálogo para seleção do Editor.
+Comment[ru]=Предоставляет диалог выбора редактора.
+Comment[sk]=Poskytuje dialógové okno pre voľbu editora.
+Comment[sl]=Ponuja pogovorno okno za izbiro urejevalnika
+Comment[sr]=Обезбеђује прозор за избор уређивача.
+Comment[sr@Latn]=Obezbeđuje prozor za izbor uređivača.
+Comment[sv]=Tillhandahåller en dialogruta för val av editor.
+Comment[ta]=தொகுப்பாளர் தேர்விற்கான உரையாடலைத் தரும்
+Comment[tg]=Ба ихтиёр гузоштани гуфтугӯи интихоби муҳаррир.
+Comment[tr]=Düzenleyici seçimi için bir pencere sağlar
+Comment[zh_CN]=提供编辑器选择对话框
+Comment[zh_TW]=提供對話框以編輯選擇。
+Name=KDevEditorChooser
+Name[da]=KDevelop Editorvælger
+Name[de]=Editor-Auswahl (KDevelop)
+Name[hi]=के-डेव-एडिटर-चूसर
+Name[nds]=KDevelop-Editorutwahl
+Name[ne]=केडीई विकास सम्पादक छनोटकर्ता
+Name[pl]=KDevWybórEdytora
+Name[sk]=KDevEditorVolič
+Name[sv]=KDevelop editorväljare
+Name[ta]=கெடெவ் தொகுப்பாளர் தேர்வாளர்
+Name[tg]=KDevМуҳаррирИнтихобкунанда
+Name[zh_TW]=KDevelop 編輯器選擇器
+GenericName=Editor Selection
+GenericName[ca]=Selecció de l'Editor
+GenericName[da]=Editorvalg
+GenericName[de]=Editor-Auswahl
+GenericName[el]=Επιλογή επεξεργαστή
+GenericName[es]=Selección de un editor
+GenericName[et]=Redaktori valimine
+GenericName[eu]=Editore-hautapena
+GenericName[fa]=گزینش ویرایشگر
+GenericName[fr]=Sélection de l'éditeur
+GenericName[ga]=Roghnú Eagarthóra
+GenericName[gl]=Selección de editor
+GenericName[hi]=संपादक चयन
+GenericName[hu]=Szerkesztőkomponens-választás
+GenericName[it]=Selezione Editor
+GenericName[ja]=エディタの選択
+GenericName[ms]=Pemilih Penyunting
+GenericName[nds]=Editor-Utwahl
+GenericName[ne]=सम्पादक चयन
+GenericName[nl]=Editorkiezer
+GenericName[pl]=Wybór edytora
+GenericName[pt]=Selecção de Editor
+GenericName[pt_BR]=Seleção de Editor
+GenericName[ru]=Выбор редактора
+GenericName[sk]=Voľba editora
+GenericName[sl]=Izbira urejevalnika
+GenericName[sr]=Избор уређивача
+GenericName[sr@Latn]=Izbor uređivača
+GenericName[sv]=Val av editor
+GenericName[ta]=தொகுப்பாளர் தேர்வு
+GenericName[tg]=Интихоби муҳаррир
+GenericName[tr]=Düzenleyici Seçimi
+GenericName[zh_CN]=编辑器选择
+GenericName[zh_TW]=編輯器選擇
+Icon=kdevelop
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdeveditorchooser
+X-KDevelop-Version=5
+X-KDevelop-Scope=Core
+X-KDevelop-Properties=EditorChooser