summaryrefslogtreecommitdiffstats
path: root/libtdepim/komposer
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:57:02 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:57:02 -0600
commit2c2fbd828ca474671bb9e03681b30b115d8d6035 (patch)
tree526a9da418f8d3d7ccf515c37048d3dfc80f2843 /libtdepim/komposer
parentf0610eece3676b6fe99f42cf4ef2b19a39a5c4e8 (diff)
downloadtdepim-2c2fbd828ca474671bb9e03681b30b115d8d6035.tar.gz
tdepim-2c2fbd828ca474671bb9e03681b30b115d8d6035.zip
Actually move the kde files that were renamed in the last commit
Diffstat (limited to 'libtdepim/komposer')
-rw-r--r--libtdepim/komposer/Makefile.am1
-rw-r--r--libtdepim/komposer/core/Makefile.am28
-rw-r--r--libtdepim/komposer/core/attachment.cpp112
-rw-r--r--libtdepim/komposer/core/attachment.h61
-rw-r--r--libtdepim/komposer/core/core.cpp357
-rw-r--r--libtdepim/komposer/core/core.h108
-rw-r--r--libtdepim/komposer/core/corewidget.cpp32
-rw-r--r--libtdepim/komposer/core/corewidget.h49
-rw-r--r--libtdepim/komposer/core/editor.cpp51
-rw-r--r--libtdepim/komposer/core/editor.h105
-rw-r--r--libtdepim/komposer/core/komposer.kcfg26
-rw-r--r--libtdepim/komposer/core/komposerIface.h85
-rw-r--r--libtdepim/komposer/core/komposerconfig.desktop56
-rw-r--r--libtdepim/komposer/core/komposereditor.desktop56
-rw-r--r--libtdepim/komposer/core/komposerplugin.desktop59
-rw-r--r--libtdepim/komposer/core/komposerui.rc51
-rw-r--r--libtdepim/komposer/core/plugin.cpp80
-rw-r--r--libtdepim/komposer/core/plugin.h76
-rw-r--r--libtdepim/komposer/core/pluginmanager.cpp489
-rw-r--r--libtdepim/komposer/core/pluginmanager.h252
-rw-r--r--libtdepim/komposer/core/prefsmodule.cpp142
-rw-r--r--libtdepim/komposer/core/prefsmodule.h72
-rw-r--r--libtdepim/komposer/core/settings.kcfgc9
-rw-r--r--libtdepim/komposer/core/tests/Makefile.am20
-rw-r--r--libtdepim/komposer/core/tests/main.cpp52
-rw-r--r--libtdepim/komposer/core/tests/managertest.cpp43
-rw-r--r--libtdepim/komposer/core/tests/managertest.h45
-rw-r--r--libtdepim/komposer/core/tests/tester.cpp30
-rw-r--r--libtdepim/komposer/core/tests/tester.h71
-rw-r--r--libtdepim/komposer/core/tests/testfactory.h71
-rw-r--r--libtdepim/komposer/core/tests/testkomposer.cpp18
-rw-r--r--libtdepim/komposer/core/tests/testmanager.cpp53
-rw-r--r--libtdepim/komposer/core/tests/testmanager.h26
-rw-r--r--libtdepim/komposer/plugins/Makefile.am1
-rw-r--r--libtdepim/komposer/plugins/default/Makefile.am15
-rw-r--r--libtdepim/komposer/plugins/default/defaulteditor.cpp361
-rw-r--r--libtdepim/komposer/plugins/default/defaulteditor.desktop109
-rw-r--r--libtdepim/komposer/plugins/default/defaulteditor.h118
-rw-r--r--libtdepim/komposer/plugins/default/defaulteditorui.rc90
-rw-r--r--libtdepim/komposer/test/Makefile.am7
-rw-r--r--libtdepim/komposer/test/test.cpp56
41 files changed, 3543 insertions, 0 deletions
diff --git a/libtdepim/komposer/Makefile.am b/libtdepim/komposer/Makefile.am
new file mode 100644
index 00000000..13509925
--- /dev/null
+++ b/libtdepim/komposer/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = core plugins test
diff --git a/libtdepim/komposer/core/Makefile.am b/libtdepim/komposer/core/Makefile.am
new file mode 100644
index 00000000..b494e715
--- /dev/null
+++ b/libtdepim/komposer/core/Makefile.am
@@ -0,0 +1,28 @@
+AM_CPPFLAGS = -I$(top_builddir)/libtdepim $(all_includes)
+METASOURCES = AUTO
+
+lib_LTLIBRARIES = libkomposer.la
+
+libkomposer_la_SOURCES = plugin.cpp editor.cpp core.cpp attachment.cpp corewidget.cpp \
+ settings.kcfgc pluginmanager.cpp komposerIface.skel
+libkomposer_la_LDFLAGS = -no-undefined $(KDE_RPATH) -version-info 1:0:0 $(all_libraries)
+libkomposer_la_LIBADD = $(LIB_KPARTS) $(top_builddir)/libtdepim/libtdepim.la -lkutils
+
+#kde_module_LTLIBRARIES = kcm_komposer.la
+
+#kcm_komposer_la_SOURCES = prefsmodule.cpp
+#kcm_komposer_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries)
+#kcm_komposer_la_LIBADD = libkomposer.la $(top_builddir)/libtdepim/libtdepim.la $(LIB_KDECORE)
+
+kpincludedir = $(includedir)/komposer
+kpinclude_HEADERS = plugin.h editor.h core.h
+
+rcdir = $(kde_datadir)/komposer
+rc_DATA = komposerui.rc
+
+kde_kcfg_DATA = komposer.kcfg
+
+servicetypedir = $(kde_servicetypesdir)
+servicetype_DATA = komposerplugin.desktop komposereditor.desktop
+
+kde_services_DATA = komposerconfig.desktop
diff --git a/libtdepim/komposer/core/attachment.cpp b/libtdepim/komposer/core/attachment.cpp
new file mode 100644
index 00000000..df803de6
--- /dev/null
+++ b/libtdepim/komposer/core/attachment.cpp
@@ -0,0 +1,112 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+/**
+ * attachment.cpp
+ *
+ * Copyright (C) 2003 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "attachment.h"
+
+using namespace Komposer;
+
+class Attachment::Private
+{
+public:
+ TQString name;
+ TQCString cte;
+ TQByteArray data;
+ TQCString type;
+ TQCString subType;
+ TQCString paramAttr;
+ TQString paramValue;
+ TQCString contDisp;
+};
+
+Attachment::Attachment( const TQString &name,
+ const TQCString &cte,
+ const TQByteArray &data,
+ const TQCString &type,
+ const TQCString &subType,
+ const TQCString &paramAttr,
+ const TQString &paramValue,
+ const TQCString &contDisp )
+ : d( new Private )
+{
+ d->name = name;
+ d->cte = cte;
+ d->data = data;
+ d->type = type;
+ d->subType = subType;
+ d->paramAttr = paramAttr;
+ d->paramValue = paramValue;
+ d->contDisp = contDisp;
+}
+
+Attachment::~Attachment()
+{
+ delete d; d = 0;
+}
+
+TQString
+Attachment::name() const
+{
+ return d->name;
+}
+
+TQCString
+Attachment::cte() const
+{
+ return d->cte;
+}
+
+TQByteArray
+Attachment::data() const
+{
+ return d->data;
+}
+
+TQCString
+Attachment::type() const
+{
+ return d->type;
+}
+
+
+TQCString
+Attachment::subType() const
+{
+ return d->subType;
+}
+
+TQCString
+Attachment::paramAttr() const
+{
+ return d->paramAttr;
+}
+
+TQString
+Attachment::paramValue() const
+{
+ return d->paramValue;
+}
+
+TQCString
+Attachment::contentDisposition() const
+{
+ return d->contDisp;
+}
+
diff --git a/libtdepim/komposer/core/attachment.h b/libtdepim/komposer/core/attachment.h
new file mode 100644
index 00000000..5c4e1ebf
--- /dev/null
+++ b/libtdepim/komposer/core/attachment.h
@@ -0,0 +1,61 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+/**
+ * attachment.h
+ *
+ * Copyright (C) 2003 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef KOMPOSER_ATTACHMENT_H
+#define KOMPOSER_ATTACHMENT_H
+
+#include <tqstring.h>
+#include <tqcstring.h>
+#include <tqvaluelist.h>
+
+namespace Komposer
+{
+
+ class Attachment
+ {
+ public:
+ Attachment( const TQString &name,
+ const TQCString &cte,
+ const TQByteArray &data,
+ const TQCString &type,
+ const TQCString &subType,
+ const TQCString &paramAttr,
+ const TQString &paramValue,
+ const TQCString &contDisp );
+ ~Attachment();
+
+ TQString name() const;
+ TQCString cte() const;
+ TQByteArray data() const;
+ TQCString type() const;
+ TQCString subType() const;
+ TQCString paramAttr() const;
+ TQString paramValue() const;
+ TQCString contentDisposition() const;
+
+ private:
+ class Private;
+ Private *d;
+ };
+ typedef TQValueList<Attachment> AttachmentList;
+}
+
+#endif
diff --git a/libtdepim/komposer/core/core.cpp b/libtdepim/komposer/core/core.cpp
new file mode 100644
index 00000000..f93e59cc
--- /dev/null
+++ b/libtdepim/komposer/core/core.cpp
@@ -0,0 +1,357 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+/**
+ * core.cpp
+ *
+ * Copyright (C) 2003 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include "core.h"
+
+#include "pluginmanager.h"
+#include "editor.h"
+#include "plugin.h"
+
+#include <ksettings/dialog.h>
+#include <kplugininfo.h>
+#include <kapplication.h>
+#include <kconfig.h>
+#include <ktrader.h>
+#include <klibloader.h>
+#include <kstdaction.h>
+#include <klistbox.h>
+#include <kiconloader.h>
+#include <kstandarddirs.h>
+#include <kshortcut.h>
+#include <klocale.h>
+#include <kstatusbar.h>
+#include <kguiitem.h>
+#include <kpopupmenu.h>
+#include <kshortcut.h>
+#include <kcmultidialog.h>
+#include <kaction.h>
+#include <kstdaccel.h>
+#include <kdebug.h>
+
+#include <tqwidgetstack.h>
+#include <tqhbox.h>
+#include <tqwidget.h>
+
+using namespace Komposer;
+
+Core::Core( TQWidget *parent, const char *name )
+ : KomposerIface( "KomposerIface" ),
+ KMainWindow( parent, name ), m_currentEditor( 0 )
+{
+ initWidgets();
+ initCore();
+ initConnections();
+ setInstance( new KInstance( "komposer" ) );
+
+ createActions();
+ setXMLFile( "komposerui.rc" );
+
+ createGUI( 0 );
+
+ resize( 600, 400 ); // initial size
+ setAutoSaveSettings();
+
+ loadSettings();
+}
+
+Core::~Core()
+{
+ saveSettings();
+
+ //Prefs::self()->writeConfig();
+}
+
+void
+Core::addEditor( Komposer::Editor *editor )
+{
+ if ( editor->widget() ) {
+ m_stack->addWidget( editor->widget() );
+ m_stack->raiseWidget( editor->widget() );
+ editor->widget()->show();
+ m_currentEditor = editor;
+ }
+
+ // merge the editors GUI into the main window
+ //insertChildClient( editor );
+ guiFactory()->addClient( editor );
+}
+
+void
+Core::addPlugin( Komposer::Plugin *plugin )
+{
+ //insertChildClient( plugin );
+ guiFactory()->addClient( plugin );
+}
+
+void
+Core::slotPluginLoaded( Plugin *plugin )
+{
+ kdDebug() << "Plugin loaded "<<endl;
+
+ Editor *editor = dynamic_cast<Editor*>( plugin );
+ if ( editor ) {
+ addEditor( editor );
+ } else {
+ addPlugin( plugin );
+ }
+}
+
+void
+Core::slotAllPluginsLoaded()
+{
+ TQValueList<KPluginInfo*> plugins = m_pluginManager->availablePlugins();
+ kdDebug()<<"Number of available plugins is "<< plugins.count() <<endl;
+ for ( TQValueList<KPluginInfo*>::iterator it = plugins.begin(); it != plugins.end(); ++it ) {
+ KPluginInfo *i = ( *it );
+ kdDebug()<<"\tAvailable plugin "<< i->pluginName()
+ <<", comment = "<< i->comment() <<endl;
+ }
+
+ if ( !m_stack->visibleWidget() ) {
+ m_pluginManager->loadPlugin( "komposer_defaulteditor", PluginManager::LoadAsync );
+ }
+}
+
+#if 0
+void
+Core::slotActivePartChanged( KParts::Part *part )
+{
+ if ( !part ) {
+ createGUI( 0 );
+ return;
+ }
+
+ kdDebug() << "Part activated: " << part << " with stack id. "
+ << m_stack->id( part->widget() )<< endl;
+
+ createGUI( part );
+}
+
+void
+Core::selectEditor( Komposer::Editor *editor )
+{
+ if ( !editor )
+ return;
+
+ KParts::Part *part = editor->part();
+
+ editor->select();
+
+ TQPtrList<KParts::Part> *partList = const_cast<TQPtrList<KParts::Part>*>(
+ m_partManager->parts() );
+ if ( partList->find( part ) == -1 )
+ addPart( part );
+
+ m_partManager->setActivePart( part );
+ TQWidget *view = part->widget();
+ Q_ASSERT( view );
+
+ kdDebug()<<"Raising view "<<view<<endl;
+ if ( view )
+ {
+ m_stack->raiseWidget( view );
+ view->show();
+ view->setFocus();
+ m_currentEditor = editor;
+ }
+}
+
+void
+Core::selectEditor( const TQString &editorName )
+{
+
+}
+#endif
+
+void
+Core::loadSettings()
+{
+ //kdDebug()<<"Trying to select "<< Prefs::self()->m_activeEditor <<endl;
+ //selectEditor( Prefs::self()->m_activeEditor );
+
+ //m_activeEditors = Prefs::self()->m_activeEditors;
+}
+
+void
+Core::saveSettings()
+{
+ //if ( m_currentEditor )
+ //Prefs::self()->m_activeEditor = m_currentEditor->identifier();
+}
+
+void
+Core::slotQuit()
+{
+ kdDebug()<<"exit"<<endl;
+ m_pluginManager->shutdown();
+}
+
+void
+Core::slotPreferences()
+{
+ if ( m_dlg == 0 )
+ m_dlg = new KSettings::Dialog( this );
+ m_dlg->show();
+}
+
+void
+Core::initWidgets()
+{
+ statusBar()->show();
+ TQHBox *topWidget = new TQHBox( this );
+ setCentralWidget( topWidget );
+ m_stack = new TQWidgetStack( topWidget );
+}
+
+void
+Core::initCore()
+{
+ m_pluginManager = new PluginManager( this );
+ connect( m_pluginManager, TQT_SIGNAL(pluginLoaded(Plugin*)),
+ TQT_SLOT(slotPluginLoaded(Plugin*)) );
+ connect( m_pluginManager, TQT_SIGNAL(allPluginsLoaded()),
+ TQT_SLOT(slotAllPluginsLoaded()) );
+
+
+ m_pluginManager->loadAllPlugins();
+ kdDebug()<<"Loading"<<endl;
+}
+
+void
+Core::initConnections()
+{
+ connect( kapp, TQT_SIGNAL(shutDown()),
+ TQT_SLOT(slotQuit()) );
+}
+
+void
+Core::createActions()
+{
+ KStdAction::close( this, TQT_SLOT(slotClose()), actionCollection() );
+
+ (void) new KAction( i18n( "&Send" ), "mail_send", CTRL+Key_Return,
+ this, TQT_SLOT(slotSendNow()), actionCollection(),
+ "send_default" );
+
+ (void) new KAction( i18n( "&Queue" ), "queue", 0,
+ this, TQT_SLOT(slotSendLater()),
+ actionCollection(), "send_alternative" );
+
+ (void) new KAction( i18n( "Save in &Drafts Folder" ), "filesave", 0,
+ this, TQT_SLOT(slotSaveDraft()),
+ actionCollection(), "save_in_drafts" );
+ (void) new KAction( i18n( "&Insert File..." ), "fileopen", 0,
+ this, TQT_SLOT(slotInsertFile()),
+ actionCollection(), "insert_file" );
+ (void) new KAction( i18n( "&Address Book" ), "contents",0,
+ this, TQT_SLOT(slotAddrBook()),
+ actionCollection(), "addressbook" );
+ (void) new KAction( i18n( "&New Composer" ), "mail_new",
+ KStdAccel::shortcut( KStdAccel::New ),
+ this, TQT_SLOT(slotNewComposer()),
+ actionCollection(), "new_composer" );
+
+ (void) new KAction( i18n( "&Attach File..." ), "attach",
+ 0, this, TQT_SLOT(slotAttachFile()),
+ actionCollection(), "attach_file" );
+}
+
+void
+Core::slotClose()
+{
+ close( false );
+}
+
+void
+Core::slotSendNow()
+{
+
+}
+
+void
+Core::slotSendLater()
+{
+
+}
+
+void
+Core::slotSaveDraft()
+{
+
+}
+
+void
+Core::slotInsertFile()
+{
+
+}
+
+void
+Core::slotAddrBook()
+{
+
+}
+
+void
+Core::slotNewComposer()
+{
+
+}
+
+void
+Core::slotAttachFile()
+{
+
+}
+
+void
+Core::send( int how )
+{
+
+}
+
+void
+Core::addAttachment( const KURL &url, const TQString &comment )
+{
+
+}
+
+void
+Core::setBody( const TQString &body )
+{
+ m_currentEditor->setText( body );
+}
+
+void
+Core::addAttachment( const TQString &name,
+ const TQCString &cte,
+ const TQByteArray &data,
+ const TQCString &type,
+ const TQCString &subType,
+ const TQCString &paramAttr,
+ const TQString &paramValue,
+ const TQCString &contDisp )
+{
+
+}
+
+#include "core.moc"
diff --git a/libtdepim/komposer/core/core.h b/libtdepim/komposer/core/core.h
new file mode 100644
index 00000000..91487572
--- /dev/null
+++ b/libtdepim/komposer/core/core.h
@@ -0,0 +1,108 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+/**
+ * core.h
+ *
+ * Copyright (C) 2003 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef KOMPOSER_CORE_H
+#define KOMPOSER_CORE_H
+
+#include "komposerIface.h"
+
+#include <kmainwindow.h>
+#include <tqptrlist.h>
+
+namespace KSettings {
+ class Dialog;
+}
+class TQWidgetStack;
+
+namespace Komposer
+{
+
+ class Editor;
+ class Plugin;
+ class PluginManager;
+
+ /**
+ * This class provides the interface to the Komposer core for the editor.
+ */
+ class Core : public KMainWindow, virtual public KomposerIface
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ Core( TQWidget *parentWidget = 0, const char *name = 0 );
+ virtual ~Core();
+
+ public slots:
+ virtual void send( int how );
+ virtual void addAttachment( const KURL &url, const TQString &comment );
+ virtual void setBody( const TQString &body );
+ virtual void addAttachment( const TQString &name,
+ const TQCString &cte,
+ const TQByteArray &data,
+ const TQCString &type,
+ const TQCString &subType,
+ const TQCString &paramAttr,
+ const TQString &paramValue,
+ const TQCString &contDisp );
+
+
+
+ protected slots:
+ //void slotActivePartChanged( KParts::Part *part );
+ void slotPluginLoaded( Plugin* );
+ void slotAllPluginsLoaded();
+ void slotPreferences();
+ void slotQuit();
+ void slotClose();
+
+ void slotSendNow();
+ void slotSendLater();
+ void slotSaveDraft();
+ void slotInsertFile();
+ void slotAddrBook();
+ void slotNewComposer();
+ void slotAttachFile();
+
+ protected:
+ virtual void initWidgets();
+ void initCore();
+ void initConnections();
+ void loadSettings();
+ void saveSettings();
+ void createActions();
+
+ void addEditor( Komposer::Editor *editor );
+ void addPlugin( Komposer::Plugin *plugin );
+
+ private:
+ TQWidgetStack *m_stack;
+ Editor *m_currentEditor;
+ PluginManager *m_pluginManager;
+
+ KSettings::Dialog *m_dlg;
+
+ class Private;
+ Private *d;
+};
+
+}
+
+#endif
diff --git a/libtdepim/komposer/core/corewidget.cpp b/libtdepim/komposer/core/corewidget.cpp
new file mode 100644
index 00000000..c6589376
--- /dev/null
+++ b/libtdepim/komposer/core/corewidget.cpp
@@ -0,0 +1,32 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+/**
+ * corewidget.cpp
+ *
+ * Copyright (C) 2003 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include "corewidget.h"
+
+using namespace Komposer;
+
+CoreWidget::CoreWidget( TQWidget *parent, const char *name )
+ : TQWidget( parent, name )
+{
+}
+
+#include "corewidget.moc"
diff --git a/libtdepim/komposer/core/corewidget.h b/libtdepim/komposer/core/corewidget.h
new file mode 100644
index 00000000..7d2acc6d
--- /dev/null
+++ b/libtdepim/komposer/core/corewidget.h
@@ -0,0 +1,49 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+/**
+ * corewidget.h
+ *
+ * Copyright (C) 2003-2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef COREWIDGET_H
+#define COREWIDGET_H
+
+#include "attachment.h"
+
+#include <tqwidget.h>
+
+namespace Komposer
+{
+
+ class CoreWidget : public TQWidget
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ CoreWidget( TQWidget *parent, const char *name=0 );
+
+ virtual TQString subject() const =0;
+ virtual TQStringList to() const =0;
+ virtual TQStringList cc() const =0;
+ virtual TQStringList bcc() const =0;
+ virtual TQString from() const =0;
+ virtual TQString replyTo() const =0;
+ virtual AttachmentList attachments() const =0;
+ };
+}
+
+#endif
diff --git a/libtdepim/komposer/core/editor.cpp b/libtdepim/komposer/core/editor.cpp
new file mode 100644
index 00000000..5dada393
--- /dev/null
+++ b/libtdepim/komposer/core/editor.cpp
@@ -0,0 +1,51 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+/**
+ * editor.cpp
+ *
+ * Copyright (C) 2003 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include "editor.h"
+#include "core.h"
+
+namespace Komposer {
+
+class Editor::Private {
+public:
+ TQString id;
+};
+
+Editor::Editor( TQObject *parent, const char *name, const TQStringList &args )
+ : Plugin( parent, name, args ), d( new Private )
+{
+}
+
+Editor::~Editor()
+{
+ delete d; d = 0;
+}
+
+void
+Editor::select()
+{
+}
+
+
+}
+
+#include "editor.moc"
diff --git a/libtdepim/komposer/core/editor.h b/libtdepim/komposer/core/editor.h
new file mode 100644
index 00000000..cdc05710
--- /dev/null
+++ b/libtdepim/komposer/core/editor.h
@@ -0,0 +1,105 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+/**
+ * editor.h
+ *
+ * Copyright (C) 2003-2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef KOMPOSER_EDITOR_H
+#define KOMPOSER_EDITOR_H
+
+#include "plugin.h"
+
+#include <tqstringlist.h>
+
+namespace KParts {
+ class Part;
+}
+
+namespace Komposer {
+
+ class Core;
+
+ class Editor : public Plugin
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ enum TextType {
+ Plain = 1 << 0,
+ RichText = 1 << 1,
+ HTML = 1 << 2
+ };
+ virtual ~Editor();
+
+ /**
+ * This is the magic function that all derivatives have to reimplement.
+ * It returns the actual editor component.
+ */
+ virtual TQWidget *widget() =0;
+
+ int supportedTextFormats() const;
+
+ /**
+ * Returns the full text inside the editor.
+ */
+ virtual TQString text() const =0;
+
+ /**
+ * This function is called when the plugin is selected by the user before the
+ * widget of the KPart belonging to the plugin is raised.
+ */
+ virtual void select();
+
+ /**
+ * Reimplement this method and return a @ref TQStringList of all config
+ * modules your application part should offer via Komposer. Note that the
+ * part and the module will have to take care for config syncing themselves.
+ * Usually @p DCOP used for that purpose.
+ *
+ * @note Make sure you offer the modules in the form:
+ * <code>"pathrelativetosettings/mysettings.desktop"</code>
+ */
+ virtual TQStringList configModules() const { return TQStringList(); }
+
+
+ public slots:
+ /**
+ * Sets the text of the opened editor.
+ * Most commonly used on replaying.
+ * If any text is present if will be deleted.
+ */
+ virtual void setText( const TQString &txt ) =0;
+
+ /**
+ * Changes currently used signature. If no signature is present
+ * a new one should be appened.
+ */
+ virtual void changeSignature( const TQString &txt ) =0;
+
+ protected:
+ Editor( TQObject *parent, const char *name, const TQStringList &args );
+
+ private:
+ class Private;
+ Private *d;
+ };
+
+}
+
+#endif
diff --git a/libtdepim/komposer/core/komposer.kcfg b/libtdepim/komposer/core/komposer.kcfg
new file mode 100644
index 00000000..111584b8
--- /dev/null
+++ b/libtdepim/komposer/core/komposer.kcfg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+ <kcfgfile name="komposerrc"/>
+
+ <group name="Colors">
+
+ <entry type="Color" name="foregroundColor">
+ </entry>
+
+ <entry type="Color" name="backgroundColor">
+ </entry>
+
+ <entry type="Color" name="QuotedText$(Level)" key="quotedColor_$(Level)">
+ <parameter name="Level" type="Int" max="3"/>
+ <default param="0">#ff0000</default>
+ <default param="1">#00ff00</default>
+ <default param="2">#0000ff</default>
+ <default param="3">#ffff00</default>
+ </entry>
+
+ </group>
+
+</kcfg>
diff --git a/libtdepim/komposer/core/komposerIface.h b/libtdepim/komposer/core/komposerIface.h
new file mode 100644
index 00000000..eecab2f3
--- /dev/null
+++ b/libtdepim/komposer/core/komposerIface.h
@@ -0,0 +1,85 @@
+/*
+ * komposerIface.h
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef KOMPOSERIFACE_H
+#define KOMPOSERIFACE_H
+
+#include <dcopobject.h>
+#include <kurl.h>
+
+namespace Komposer
+{
+
+/**
+ DCOP interface for mail composer window. The address header fields are set,
+ when the composer is constructed. KMailIface::openComposer() returns a
+ reference to the DCOP interface of the new composer window, which provides the
+ functions defined in the MailComposerIface.
+*/
+class KomposerIface : virtual public DCOPObject
+{
+ K_DCOP
+k_dcop:
+ /**
+ Send message.
+
+ @param how 0 for deafult method, 1 for sending now, 2 for sending later.
+ */
+ virtual void send(int how) = 0;
+
+ /**
+ Add url as attachment with a user-defined comment.
+ */
+ virtual void addAttachment( const KURL &url, const TQString &comment) = 0;
+
+ /**
+ Set message body.
+ */
+ virtual void setBody( const TQString &body ) = 0;
+
+ /**
+ Add attachment.
+
+ @param name Name of Attachment
+ @param cte Content Transfer Encoding
+ @param data Data to be attached
+ @param type MIME content type
+ @param subType MIME content sub type
+ @param paramAttr Attribute name of parameter of content type
+ @param paramValue Value of parameter of content type
+ @param contDisp Content disposition
+ */
+ virtual void addAttachment( const TQString &name,
+ const TQCString &cte,
+ const TQByteArray &data,
+ const TQCString &type,
+ const TQCString &subType,
+ const TQCString &paramAttr,
+ const TQString &paramValue,
+ const TQCString &contDisp ) = 0;
+public:
+ KomposerIface( const char *name )
+ : DCOPObject( name )
+ {}
+};
+
+}
+
+#endif
diff --git a/libtdepim/komposer/core/komposerconfig.desktop b/libtdepim/komposer/core/komposerconfig.desktop
new file mode 100644
index 00000000..58c8bd76
--- /dev/null
+++ b/libtdepim/komposer/core/komposerconfig.desktop
@@ -0,0 +1,56 @@
+[Desktop Entry]
+Exec=kcmshell komposerconfig
+Icon=komposer
+Type=Application
+Terminal=false
+
+X-KDE-ModuleType=Library
+X-KDE-Library=komposer
+X-KDE-FactoryName=komposerconfig
+X-KDE-HasReadOnlyMode=false
+
+Name=Komposer
+Name[cy]=Kyfansoddydd
+Name[da]=Brevskriver
+Name[hi]=कम्पोज़र
+Name[ms]=Penggubah
+Name[ne]=कम्पोजर
+Name[pt]=Kompositor
+Name[ta]=கம்போசர்
+Comment=KDE Komposer
+Comment[bg]=Писане на форматиран текст
+Comment[br]=Komposer KDE
+Comment[ca]=Compositor per a KDE
+Comment[cy]=Cyfansoddydd KDE
+Comment[da]=KDE Brevskriver
+Comment[de]=KDE-Komposer
+Comment[fr]=Komposer KDE
+Comment[ga]=Komposer KDE
+Comment[hi]=केडीई कम्पोज़र
+Comment[ms]=Penggubah KDE
+Comment[nds]=Nettbreef-Editor vun KDE
+Comment[ne]=केडीई कम्पोजर
+Comment[nn]=KDE, tekstredigerar for e-post
+Comment[pl]=Komposer dla KDE
+Comment[pt]=Kompositor do KDE
+Comment[pt_BR]=Konposer do KDE
+Comment[ru]=Композитор KDE
+Comment[ta]=கேடிஇ கம்போசர்
+Comment[tg]=Композитори KDE
+Keywords=komposer
+Keywords[bg]=редактор, съставител, форматиране, текст, komposer
+Keywords[ca]=compositor
+Keywords[cy]=komposer,kyfansoddydd
+Keywords[da]=brevskriver
+Keywords[de]=Komposer
+Keywords[fy]=komposer,opstellen, opsteller
+Keywords[hi]=कम्पोज़र
+Keywords[nds]=Komposer
+Keywords[ne]=कम्पोजर
+Keywords[nl]=komposer,opstellen
+Keywords[nn]=komposer,tekstredigerar,epost
+Keywords[ru]=komposer,ноты
+Keywords[sr]=komposer,састављач
+Keywords[sr@Latn]=komposer,sastavljač
+Keywords[ta]=கம்போசர்
+Keywords[tg]=komposer,нотаҳо
diff --git a/libtdepim/komposer/core/komposereditor.desktop b/libtdepim/komposer/core/komposereditor.desktop
new file mode 100644
index 00000000..fd1c1341
--- /dev/null
+++ b/libtdepim/komposer/core/komposereditor.desktop
@@ -0,0 +1,56 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=Komposer/Editor
+X-KDE-Derived=Komposer/Plugin
+Comment=Komposer Editor
+Comment[af]=Komposer Redigeerder
+Comment[bg]=Писане на форматиран текст
+Comment[br]=Aozer Komposer
+Comment[bs]=Komposer editor
+Comment[ca]=Compositor per a KDE
+Comment[cs]=Komposer editor
+Comment[da]=Komposer editor
+Comment[el]=Επεξεργαστής Komposer
+Comment[eo]=Komposer-redaktilo
+Comment[es]=Editor Komposer
+Comment[et]=Komposeri redaktor
+Comment[eu]=Komposer editorea
+Comment[fa]=ویرایشگر Komposer
+Comment[fi]=Komposer-muokkain
+Comment[fr]=Éditeur Komposer
+Comment[fy]=Komposer-bewurker
+Comment[ga]=Eagarthóir Komposer
+Comment[gl]=Editor Komposer
+Comment[he]=עורך של Komposer
+Comment[hu]=Komposer
+Comment[is]=Komposer ritill
+Comment[it]=Komposer editor
+Comment[ja]=Komposer,エディタ
+Comment[kk]=Komposer өңдегіші
+Comment[km]=កម្មវិធី​និពន្ធ Komposer
+Comment[ko]=Komposer 편집기
+Comment[lt]=Komposer redaktorius
+Comment[ms]=Editor Komposer
+Comment[nb]=Komposer redigerer
+Comment[nds]=Komposer-Editor
+Comment[ne]=कम्पोजर सम्पादक
+Comment[nl]=Komposer-editor
+Comment[nn]=Komposer redigerar
+Comment[pl]=Edytor Komposer
+Comment[pt]=Editor Kompositor
+Comment[pt_BR]=Editor de Mensagens
+Comment[ru]=Редактор Komposer
+Comment[sk]=Editor Komposer
+Comment[sl]=Urejevalnik Komposer
+Comment[sr]=Уређивач Komposer
+Comment[sr@Latn]=Uređivač Komposer
+Comment[sv]=Komposer editor
+Comment[ta]=கம்போசர் தொகுப்பான்
+Comment[tg]=Муҳаррири Komposer
+Comment[tr]=Komposer Düzenleyicisi
+Comment[uk]=Редактор Komposer
+Comment[zh_CN]=Komposer 编辑器
+Comment[zh_TW]=Komposer 編輯器
+
+[PropertyDef::X-Komposer-Weight]
+Type=int
diff --git a/libtdepim/komposer/core/komposerplugin.desktop b/libtdepim/komposer/core/komposerplugin.desktop
new file mode 100644
index 00000000..b398e1c6
--- /dev/null
+++ b/libtdepim/komposer/core/komposerplugin.desktop
@@ -0,0 +1,59 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=Komposer/Plugin
+X-KDE-Derived=KPluginInfo
+Name=Komposer Plugin
+Name[af]=Komposer inprop module
+Name[bg]=Приставка за Komposer
+Name[br]=Lugent Komposer
+Name[bs]=Komposer dodatak
+Name[ca]=Endollable Komposer
+Name[cs]=Komposer modul
+Name[cy]=Ategyn Kyfansoddydd
+Name[da]=Brevskriver-plugin
+Name[de]=Komposer-Modul
+Name[el]=Πρόσθετο του Komposer
+Name[eo]=Komposer-kromaĵo
+Name[es]=Accesorio Komposer
+Name[et]=Komposeri plugin
+Name[eu]=Komposer plugin-a
+Name[fa]=وصلۀ Komposer
+Name[fi]=Komposer-liitännäinen
+Name[fr]=Module de Komposer
+Name[fy]=Komposer-plugin
+Name[ga]=Breiseán Komposer
+Name[gl]=Extensión Komposer
+Name[he]=תןסף Kompoer
+Name[hi]=कम्पोज़र प्लगइन
+Name[hu]=Komposer bővítőmodul
+Name[is]=Komposer íforrit
+Name[it]=Plugin Komposer
+Name[ja]=Komposer プラグイン
+Name[kk]=Komposer плагин модулі
+Name[km]=កម្មវិធី​ជំនួយ Komposer
+Name[ko]=Komposer 플러그인
+Name[lt]=Komposer priedas
+Name[ms]=Plugin Komposer
+Name[nb]=Komposer-programtillegg
+Name[nds]=Komposer-Moduul
+Name[ne]=कम्पोजर प्लगइन
+Name[nn]=Komposer-programtillegg
+Name[pl]=Wtyczka Komposer
+Name[pt]='Plugin' do Kompositor
+Name[pt_BR]=Plug-in do Komposer
+Name[ro]=Modul Komposer
+Name[ru]=Модуль Komposer
+Name[sk]=Modul Komposer
+Name[sl]=Vstavek za Komposer
+Name[sr]=Прикључак Komposer-а
+Name[sr@Latn]=Priključak Komposer-a
+Name[sv]=Komposer-insticksprogram
+Name[ta]=கம்போசர் சொருகுப்பொருள்
+Name[tg]=Модули Komposer
+Name[tr]=Komposer Eklentisi
+Name[uk]=Втулок Komposer
+Name[zh_CN]=Komposer 插件
+Name[zh_TW]=Komposer 外掛程式
+
+[PropertyDef::X-Komposer-Version]
+Type=int
diff --git a/libtdepim/komposer/core/komposerui.rc b/libtdepim/komposer/core/komposerui.rc
new file mode 100644
index 00000000..83ec4d29
--- /dev/null
+++ b/libtdepim/komposer/core/komposerui.rc
@@ -0,0 +1,51 @@
+<!DOCTYPE kpartgui >
+<kpartgui version="2" name="komposer" >
+<MenuBar>
+ <Menu name="file" noMerge="1">
+ <text>&amp;Message</text>
+ <Action name="new_composer" />
+ <Action name="open_mailreader" />
+ <Separator/>
+ <Action name="send_default" />
+ <Action name="send_alternative" />
+ <Action name="save_in_drafts" />
+ <Separator/>
+ <Action name="insert_file" />
+ <Action name="file_print" />
+ <Separator/>
+ <Merge/>
+ <Separator/>
+ <Action name="file_close" />
+ </Menu>
+ <Merge />
+ <Menu noMerge="1" name="attach">
+ <text>&amp;Attach</text>
+ <Merge/>
+ <Separator/>
+ <Action name="attach_file"/>
+ <Action name="remove_attachment"/>
+ <Action name="attachment_properties"/>
+ </Menu>
+ <Menu noMerge="1" name="Tools">
+ <text>&amp;Tools</text>
+ <Merge/>
+ <Action name="addressbook"/>
+ </Menu>
+ <Menu noMerge="1" name="settings">
+ <text>&amp;Settings</text>
+ <Merge/>
+ <Separator/>
+ <Action name="settings_configure_komposer"/>
+ </Menu>
+</MenuBar>
+<ToolBar position="Top" iconText="IconOnly" noMerge="1" name="mainToolBar"><text>Main Toolbar</text>
+ <Action name="send_default" />
+ <Action name="send_alternative" />
+ <Separator/>
+ <Action name="attach_file"/>
+ <Separator/>
+ <Merge/>
+ <Separator/>
+ <Action name="help_whats_this"/>
+</ToolBar>
+</kpartgui>
diff --git a/libtdepim/komposer/core/plugin.cpp b/libtdepim/komposer/core/plugin.cpp
new file mode 100644
index 00000000..41af47cd
--- /dev/null
+++ b/libtdepim/komposer/core/plugin.cpp
@@ -0,0 +1,80 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+/**
+ * plugin.cpp
+ *
+ * Copyright (C) 2003 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "plugin.h"
+
+#include "core.h"
+
+#include <kdebug.h>
+#include <tqstring.h>
+
+namespace Komposer
+{
+
+class Plugin::Private
+{
+public:
+ //Core* core;
+};
+
+Plugin::Plugin( TQObject *parent, const char *name, const TQStringList & )
+ : TQObject( parent, name ), d( new Private )
+{
+ //d->core = core;
+}
+
+Plugin::~Plugin()
+{
+ delete d; d = 0;
+}
+
+void
+Plugin::startedComposing()
+{
+}
+
+void
+Plugin::sendClicked()
+{
+}
+
+void
+Plugin::quitClicked()
+{
+}
+
+void
+Plugin::aboutToUnload()
+{
+ kdDebug()<<"plugin unloading"<<endl;
+ emit readyForUnload();
+}
+
+Core*
+Plugin::core() const
+{
+ return 0;
+ //return d->core;
+}
+
+}//end namespace Komposer
+
+#include "plugin.moc"
diff --git a/libtdepim/komposer/core/plugin.h b/libtdepim/komposer/core/plugin.h
new file mode 100644
index 00000000..7acd7f70
--- /dev/null
+++ b/libtdepim/komposer/core/plugin.h
@@ -0,0 +1,76 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+/**
+ * plugin.h
+ *
+ * Copyright (C) 2003 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef KOMPOSER_PLUGIN_H
+#define KOMPOSER_PLUGIN_H
+
+#include <tqobject.h>
+#include <kxmlguiclient.h>
+
+namespace Komposer
+{
+ class Core;
+
+ class Plugin : public TQObject,
+ virtual public KXMLGUIClient
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ virtual ~Plugin();
+
+ signals:
+ void statusMessage( const TQString & );
+ void readyForUnload();
+
+ protected slots:
+ /**
+ * Called when a new message is created.
+ */
+ virtual void startedComposing();
+
+ /**
+ * Called after the send button has been pressed
+ * and before the message has been sent.
+ */
+ virtual void sendClicked();
+
+ /**
+ * Called after the quit button has been pressed
+ */
+ virtual void quitClicked();
+
+ virtual void aboutToUnload();
+
+ protected:
+ Core *core() const;
+ protected:
+ friend class PluginManager;
+ Plugin( TQObject *parent, const char *name, const TQStringList& args = TQStringList() );
+
+ private:
+ class Private;
+ Private *d;
+ };
+
+}
+
+#endif
diff --git a/libtdepim/komposer/core/pluginmanager.cpp b/libtdepim/komposer/core/pluginmanager.cpp
new file mode 100644
index 00000000..dcfea6f4
--- /dev/null
+++ b/libtdepim/komposer/core/pluginmanager.cpp
@@ -0,0 +1,489 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 2; -*-
+/**
+ * pluginmanager.cpp
+ * Most of this code has been lifted from Martijn's KopetePluginManager class
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "pluginmanager.h"
+
+#include "plugin.h"
+
+#include <tqapplication.h>
+#include <tqfile.h>
+#include <tqregexp.h>
+#include <tqtimer.h>
+#include <tqvaluestack.h>
+
+#include <kapplication.h>
+#include <kdebug.h>
+#include <kparts/componentfactory.h>
+#include <kplugininfo.h>
+#include <ksettings/dispatcher.h>
+#include <ksimpleconfig.h>
+#include <kstandarddirs.h>
+#include <kstaticdeleter.h>
+#include <kurl.h>
+
+
+namespace Komposer
+{
+
+class PluginManager::Private
+{
+public:
+ // All available plugins, regardless of category, and loaded or not
+ TQValueList<KPluginInfo*> plugins;
+
+ // Dict of all currently loaded plugins, mapping the KPluginInfo to
+ // a plugin
+ TQMap<KPluginInfo*, Plugin*> loadedPlugins;
+
+ // The plugin manager's mode. The mode is StartingUp until loadAllPlugins()
+ // has finished loading the plugins, after which it is set to Running.
+ // ShuttingDown and DoneShutdown are used during Komposer shutdown by the
+ // async unloading of plugins.
+ enum ShutdownMode { StartingUp, Running, ShuttingDown, DoneShutdown };
+ ShutdownMode shutdownMode;
+
+ KSharedConfig::Ptr config;
+ // Plugins pending for loading
+ TQValueStack<TQString> pluginsToLoad;
+};
+
+PluginManager::PluginManager( TQObject *parent )
+ : TQObject( parent )
+{
+ d = new Private;
+
+ // We want to add a reference to the application's event loop so we
+ // can remain in control when all windows are removed.
+ // This way we can unload plugins asynchronously, which is more
+ // robust if they are still doing processing.
+ kapp->ref();
+ d->shutdownMode = Private::StartingUp;
+
+ KSettings::Dispatcher::self()->registerInstance( KGlobal::instance(),
+ this, TQT_SLOT( loadAllPlugins() ) );
+
+ d->plugins = KPluginInfo::fromServices(
+ KTrader::self()->query( TQString::tqfromLatin1( "Komposer/Plugin" ),
+ TQString::tqfromLatin1( "[X-Komposer-Version] == 1" ) ) );
+}
+
+PluginManager::~PluginManager()
+{
+ if ( d->shutdownMode != Private::DoneShutdown ) {
+ slotShutdownTimeout();
+#if 0
+ kdWarning() << k_funcinfo
+ << "Destructing plugin manager without going through "
+ << "the shutdown process!"
+ << endl
+ << kdBacktrace(10) << endl;
+#endif
+ }
+
+ // Quick cleanup of the remaining plugins, hope it helps
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); /* EMPTY */ )
+ {
+ // Remove causes the iterator to become invalid, so pre-increment first
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator nextIt( it );
+ ++nextIt;
+ kdWarning() << k_funcinfo << "Deleting stale plugin '"
+ << it.data()->name() << "'" << endl;
+ delete it.data();
+ it = nextIt;
+ }
+
+ delete d;
+}
+
+TQValueList<KPluginInfo*>
+PluginManager::availablePlugins( const TQString &category ) const
+{
+ if ( category.isEmpty() )
+ return d->plugins;
+
+ TQValueList<KPluginInfo*> result;
+ TQValueList<KPluginInfo*>::ConstIterator it;
+ for ( it = d->plugins.begin(); it != d->plugins.end(); ++it )
+ {
+ if ( ( *it )->category() == category )
+ result.append( *it );
+ }
+
+ return result;
+}
+
+TQMap<KPluginInfo*, Plugin*>
+PluginManager::loadedPlugins( const TQString &category ) const
+{
+ TQMap<KPluginInfo*, Plugin*> result;
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); ++it )
+ {
+ if ( category.isEmpty() || it.key()->category() == category )
+ result.insert( it.key(), it.data() );
+ }
+
+ return result;
+}
+
+void
+PluginManager::shutdown()
+{
+ d->shutdownMode = Private::ShuttingDown;
+
+ // Remove any pending plugins to load, we're shutting down now :)
+ d->pluginsToLoad.clear();
+
+ // Ask all plugins to unload
+ if ( d->loadedPlugins.empty() ) {
+ d->shutdownMode = Private::DoneShutdown;
+ } else {
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); /* EMPTY */ )
+ {
+ // Remove causes the iterator to become invalid, so pre-increment first
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator nextIt( it );
+ ++nextIt;
+ it.data()->aboutToUnload();
+ it = nextIt;
+ }
+ }
+
+ TQTimer::singleShot( 3000, this, TQT_SLOT(slotShutdownTimeout()) );
+}
+
+void
+PluginManager::slotPluginReadyForUnload()
+{
+ // Using TQObject::sender() is on purpose here, because otherwise all
+ // plugins would have to pass 'this' as parameter, which makes the API
+ // less clean for plugin authors
+ Plugin* plugin = dynamic_cast<Plugin*>( const_cast<TQObject*>( sender() ) );
+ if ( !plugin )
+ {
+ kdWarning() << k_funcinfo << "Calling object is not a plugin!" << endl;
+ return;
+
+ }
+ kdDebug()<<"manager unloading"<<endl;
+ plugin->deleteLater();
+}
+
+void
+PluginManager::slotShutdownTimeout()
+{
+ // When we were already done the timer might still fire.
+ // Do nothing in that case.
+ if ( d->shutdownMode == Private::DoneShutdown )
+ return;
+
+#ifndef NDEBUG
+ TQStringList remaining;
+ for ( TQMap<KPluginInfo*, Plugin*>::ConstIterator it = d->loadedPlugins.begin();
+ it != d->loadedPlugins.end(); ++it )
+ remaining.append( it.key()->pluginName() );
+
+ kdWarning() << k_funcinfo << "Some plugins didn't shutdown in time!" << endl
+ << "Remaining plugins: "
+ << remaining.join( TQString::tqfromLatin1( ", " ) ) << endl
+ << "Forcing Komposer shutdown now." << endl;
+#endif
+
+ slotShutdownDone();
+}
+
+void
+PluginManager::slotShutdownDone()
+{
+ d->shutdownMode = Private::DoneShutdown;
+
+ kapp->deref();
+}
+
+void
+PluginManager::loadAllPlugins()
+{
+ // FIXME: We need session management here - Martijn
+
+ if ( !d->config )
+ d->config = KSharedConfig::openConfig( "komposerrc" );
+
+ TQMap<TQString, TQString> entries = d->config->entryMap(
+ TQString::tqfromLatin1( "Plugins" ) );
+
+ TQMap<TQString, TQString>::Iterator it;
+ for ( it = entries.begin(); it != entries.end(); ++it )
+ {
+ TQString key = it.key();
+ if ( key.endsWith( TQString::tqfromLatin1( "Enabled" ) ) )
+ {
+ key.setLength( key.length() - 7 );
+ //kdDebug() << k_funcinfo << "Set " << key << " to " << it.data() << endl;
+
+ if ( it.data() == TQString::tqfromLatin1( "true" ) )
+ {
+ if ( !plugin( key ) )
+ d->pluginsToLoad.push( key );
+ }
+ else
+ {
+ // FIXME: Does this ever happen? As loadAllPlugins is only called on startup
+ // I'd say 'no'. If it does, it should be made async
+ // though. - Martijn
+ if ( plugin( key ) )
+ unloadPlugin( key );
+ }
+ }
+ }
+
+ // Schedule the plugins to load
+ TQTimer::singleShot( 0, this, TQT_SLOT( slotLoadNextPlugin() ) );
+}
+
+void PluginManager::slotLoadNextPlugin()
+{
+ if ( d->pluginsToLoad.isEmpty() )
+ {
+ if ( d->shutdownMode == Private::StartingUp )
+ {
+ d->shutdownMode = Private::Running;
+ emit allPluginsLoaded();
+ }
+ return;
+ }
+
+ TQString key = d->pluginsToLoad.pop();
+ loadPluginInternal( key );
+
+ // Schedule the next run unconditionally to avoid code duplication on the
+ // allPluginsLoaded() signal's handling. This has the added benefit that
+ // the signal is delayed one event loop, so the accounts are more likely
+ // to be instantiated.
+ TQTimer::singleShot( 0, this, TQT_SLOT( slotLoadNextPlugin() ) );
+}
+
+Plugin*
+PluginManager::loadPlugin( const TQString &pluginId,
+ PluginLoadMode mode /* = LoadSync */ )
+{
+ if ( mode == LoadSync ) {
+ return loadPluginInternal( pluginId );
+ } else {
+ d->pluginsToLoad.push( pluginId );
+ TQTimer::singleShot( 0, this, TQT_SLOT( slotLoadNextPlugin() ) );
+ return 0;
+ }
+}
+
+Plugin*
+PluginManager::loadPluginInternal( const TQString &pluginId )
+{
+ KPluginInfo* info = infoForPluginId( pluginId );
+ if ( !info ) {
+ kdWarning() << k_funcinfo << "Unable to find a plugin named '"
+ << pluginId << "'!" << endl;
+ return 0;
+ }
+
+ if ( d->loadedPlugins.contains( info ) )
+ return d->loadedPlugins[ info ];
+
+ int error = 0;
+ Plugin *plugin = KParts::ComponentFactory::createInstanceFromQuery<Komposer::Plugin>(
+ TQString::tqfromLatin1( "Komposer/Plugin" ),
+ TQString::tqfromLatin1( "[X-KDE-PluginInfo-Name]=='%1'" ).tqarg( pluginId ),
+ this, 0, TQStringList(), &error );
+
+ if ( plugin ) {
+ d->loadedPlugins.insert( info, plugin );
+ info->setPluginEnabled( true );
+
+ connect( plugin, TQT_SIGNAL(destroyed(TQObject*)),
+ this, TQT_SLOT(slotPluginDestroyed(TQObject*)) );
+ connect( plugin, TQT_SIGNAL(readyForUnload()),
+ this, TQT_SLOT(slotPluginReadyForUnload()) );
+
+ kdDebug() << k_funcinfo << "Successfully loaded plugin '"
+ << pluginId << "'" << endl;
+
+ emit pluginLoaded( plugin );
+ } else {
+ switch ( error ) {
+ case KParts::ComponentFactory::ErrNoServiceFound:
+ kdDebug() << k_funcinfo << "No service implementing the given mimetype "
+ << "and fullfilling the given constraint expression can be found."
+ << endl;
+ break;
+
+ case KParts::ComponentFactory::ErrServiceProvidesNoLibrary:
+ kdDebug() << "the specified service provides no shared library." << endl;
+ break;
+
+ case KParts::ComponentFactory::ErrNoLibrary:
+ kdDebug() << "the specified library could not be loaded." << endl;
+ break;
+
+ case KParts::ComponentFactory::ErrNoFactory:
+ kdDebug() << "the library does not export a factory for creating components."
+ << endl;
+ break;
+
+ case KParts::ComponentFactory::ErrNoComponent:
+ kdDebug() << "the factory does not support creating components "
+ << "of the specified type."
+ << endl;
+ break;
+ }
+
+ kdDebug() << k_funcinfo << "Loading plugin '" << pluginId
+ << "' failed, KLibLoader reported error: '"
+ << KLibLoader::self()->lastErrorMessage()
+ << "'" << endl;
+ }
+
+ return plugin;
+}
+
+bool
+PluginManager::unloadPlugin( const TQString &spec )
+{
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); ++it )
+ {
+ if ( it.key()->pluginName() == spec )
+ {
+ it.data()->aboutToUnload();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void
+PluginManager::slotPluginDestroyed( TQObject *plugin )
+{
+ TQMap<KPluginInfo*, Plugin*>::Iterator it;
+ for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); ++it )
+ {
+ if ( it.data() == plugin )
+ {
+ d->loadedPlugins.erase( it );
+ break;
+ }
+ }
+
+ if ( d->shutdownMode == Private::ShuttingDown && d->loadedPlugins.isEmpty() )
+ {
+ // Use a timer to make sure any pending deleteLater() calls have
+ // been handled first
+ TQTimer::singleShot( 0, this, TQT_SLOT(slotShutdownDone()) );
+ }
+}
+
+Plugin*
+PluginManager::plugin( const TQString &pluginId ) const
+{
+ KPluginInfo *info = infoForPluginId( pluginId );
+ if ( !info )
+ return 0;
+
+ if ( d->loadedPlugins.contains( info ) )
+ return d->loadedPlugins[ info ];
+ else
+ return 0;
+}
+
+TQString
+PluginManager::pluginName( const Plugin *plugin ) const
+{
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); ++it )
+ {
+ if ( it.data() == plugin )
+ return it.key()->name();
+ }
+
+ return TQString::tqfromLatin1( "Unknown" );
+}
+
+TQString
+PluginManager::pluginId( const Plugin *plugin ) const
+{
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); ++it )
+ {
+ if ( it.data() == plugin )
+ return it.key()->pluginName();
+ }
+
+ return TQString::tqfromLatin1( "unknown" );
+}
+
+TQString
+PluginManager::pluginIcon( const Plugin *plugin ) const
+{
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); ++it )
+ {
+ if ( it.data() == plugin )
+ return it.key()->icon();
+ }
+
+ return TQString::tqfromLatin1( "Unknown" );
+}
+
+KPluginInfo*
+PluginManager::infoForPluginId( const TQString &pluginId ) const
+{
+ TQValueList<KPluginInfo*>::ConstIterator it;
+ for ( it = d->plugins.begin(); it != d->plugins.end(); ++it )
+ {
+ if ( ( *it )->pluginName() == pluginId )
+ return *it;
+ }
+
+ return 0;
+}
+
+bool
+PluginManager::setPluginEnabled( const TQString &pluginId, bool enabled /* = true */ )
+{
+ if ( !d->config )
+ d->config = KSharedConfig::openConfig( "komposerrc" );
+
+ d->config->setGroup( "Plugins" );
+
+
+ if ( !infoForPluginId( pluginId ) )
+ return false;
+
+ d->config->writeEntry( pluginId + TQString::tqfromLatin1( "Enabled" ), enabled );
+ d->config->sync();
+
+ return true;
+}
+
+}
+
+#include "pluginmanager.moc"
diff --git a/libtdepim/komposer/core/pluginmanager.h b/libtdepim/komposer/core/pluginmanager.h
new file mode 100644
index 00000000..34cc6b9c
--- /dev/null
+++ b/libtdepim/komposer/core/pluginmanager.h
@@ -0,0 +1,252 @@
+// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+/**
+ * pluginmanager.h
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2003 Martijn Klingens <klingens@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef KOMPOSER_PLUGINMANAGER_H
+#define KOMPOSER_PLUGINMANAGER_H
+
+#include <tqmap.h>
+#include <tqobject.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
+#include <tqvaluelist.h>
+
+class KPluginInfo;
+
+namespace Komposer
+{
+
+ class Plugin;
+
+ class PluginManager : public TQObject
+ {
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ PluginManager( TQObject * );
+
+ ~PluginManager();
+
+ /**
+ * Returns a list of all available plugins for the given category.
+ * Currently there are two categories, "Plugins" and "Editors", but
+ * you can add your own categories if you want.
+ *
+ * If you pass an empty string you get the complete list of ALL plugins.
+ *
+ * You can query all information on the plugins through the @ref KPluginInfo
+ * interface.
+ */
+ TQValueList<KPluginInfo*> availablePlugins( const TQString &category
+ = TQString() ) const;
+
+ /**
+ * Returns a list of all plugins that are actually loaded.
+ * If you omit the category you get all, otherwise it's a filtered list.
+ * See also @ref availablePlugins().
+ */
+ TQMap<KPluginInfo*, Plugin*> loadedPlugins( const TQString &category
+ = TQString() ) const;
+
+ /**
+ * @brief Search by plugin name. This is the key used as X-KDE-PluginInfo-Name
+ * in the .desktop file, e.g. "komposer_attachment"
+ *
+ * @return The @ref Plugin object found by the search, or a null
+ * pointer if the plugin is not loaded.
+ *
+ * If you want to also load the plugin you can better use @ref loadPlugin,
+ * which returns
+ * the pointer to the plugin if it's already loaded.
+ */
+ Plugin* plugin( const TQString &pluginName ) const;
+
+ /**
+ * @brief Return the short user-visible name of the plugin.
+ *
+ * If you want to have the internal name, use @ref pluginId() instead.
+ *
+ * @return The name of the protocol, in the user's locale.
+ */
+ TQString pluginName( const Plugin *plugin ) const;
+
+ /**
+ * @brief Return the internal name of the plugin.
+ *
+ * You cannot display this name on the screen, it's used internally for
+ * passing around IDs. Use @ref pluginName() for a string ready for display.
+ *
+ * @return The name of the protocol, in the user's locale.
+ */
+ TQString pluginId( const Plugin *plugin ) const;
+
+ /**
+ * @brief Unload the plugin specified by @p pluginName
+ */
+ bool unloadPlugin( const TQString &pluginName );
+
+ /**
+ * @brief Retrieve the name of the icon for a @ref Plugin.
+ *
+ * @return An empty string if the given plugin is not loaded
+ * or the filename of the icon to use.
+ */
+ TQString pluginIcon( const Plugin *plugin ) const;
+
+ /**
+ * Shuts down the plugin manager on Komposer shutdown, but first
+ * unloads all plugins asynchronously.
+ *
+ * After 3 seconds all plugins should be removed; what's still left
+ * by then is unloaded through a hard delete instead.
+ *
+ * Note that this call also derefs the plugin manager from the event
+ * loop, so do NOT call this method when not terminating Komposer!
+ */
+ void shutdown();
+
+ /**
+ * Enable a plugin.
+ *
+ * This marks a plugin as enabled in the config file, so loadAll()
+ * can pick it up later.
+ *
+ * This method does not actually load a plugin, it only edits the
+ * config file.
+ *
+ * @param name is the name of the plugin as it is listed in the .desktop
+ * file in the X-KDE-Library field.
+ *
+ * Returns false when no appropriate plugin can be found.
+ */
+ bool setPluginEnabled( const TQString &name, bool enabled = true );
+
+ /**
+ * Plugin loading mode. Used by @loadPlugin. Code that doesn't want to block
+ * the GUI and/or lot a lot of plugins at once should use Async loading.
+ * The default is sync loading.
+ */
+ enum PluginLoadMode { LoadSync, LoadAsync };
+
+ public slots:
+ /**
+ * @brief Load a single plugin by plugin name. Returns an existing plugin
+ * if one is already loaded in memory.
+ *
+ * If mode is set to Async, the plugin will be queued and loaded in
+ * the background. This method will return a null pointer. To get
+ * the loaded plugin you can track the @ref pluginLoaded() signal.
+ *
+ * See also @ref plugin().
+ */
+ Plugin* loadPlugin( const TQString &pluginId, PluginLoadMode mode = LoadSync );
+
+ /**
+ * @brief Loads all the enabled plugins. Also used to reread the
+ * config file when the configuration has changed.
+ */
+ void loadAllPlugins();
+
+ signals:
+ /**
+ * @brief Signals a new plugin has just been loaded.
+ */
+ void pluginLoaded( Plugin *plugin );
+
+ /**
+ * @brief All plugins have been loaded by the plugin manager.
+ *
+ * This signal is emitted exactly ONCE, when the plugin manager has emptied
+ * its plugin queue for the first time. This means that if you call an async
+ * loadPlugin() before loadAllPlugins() this signal is probably emitted after
+ * the initial call completes, unless you are quick enough to fill the queue
+ * before it completes, which is a dangerous race you shouldn't count upon :)
+ *
+ * The signal is delayed one event loop iteration through a singleShot timer,
+ * but that is not guaranteed to be enough for account instantiation. You may
+ * need an additional timer for it in the code if you want to programmatically
+ * act on it.
+ *
+ * If you use the signal for enabling/disabling GUI objects there is little
+ * chance a user is able to activate them in the short while that's remaining,
+ * the slow part of the code is over now and the remaining processing time
+ * is neglectable for the user.
+ */
+ void allPluginsLoaded();
+
+ private slots:
+ /**
+ * @brief Cleans up some references if the plugin is destroyed
+ */
+ void slotPluginDestroyed( TQObject *plugin );
+
+ /**
+ * shutdown() starts a timer, when it fires we force all plugins
+ * to be unloaded here by deref()-ing the event loop to trigger the plugin
+ * manager's destruction
+ */
+ void slotShutdownTimeout();
+
+ /**
+ * Common entry point to deref() the KApplication. Used both by the clean
+ * shutdown and the timeout condition of slotShutdownTimeout()
+ */
+ void slotShutdownDone();
+
+ /**
+ * Emitted by a Plugin when it's ready for unload
+ */
+ void slotPluginReadyForUnload();
+
+ /**
+ * Load a plugin from our queue. Does nothing if the queue is empty.
+ * Schedules itself again if more plugins are pending.
+ */
+ void slotLoadNextPlugin();
+
+ private:
+ /**
+ * @internal
+ *
+ * The internal method for loading plugins.
+ * Called by @ref loadPlugin directly or through the queue for async plugin
+ * loading.
+ */
+ Plugin *loadPluginInternal( const TQString &pluginId );
+
+ /**
+ * @internal
+ *
+ * Find the KPluginInfo structure by key. Reduces some code duplication.
+ *
+ * Returns a null pointer when no plugin info is found.
+ */
+ KPluginInfo *infoForPluginId( const TQString &pluginId ) const;
+ private:
+ class Private;
+ Private *d;
+ };
+
+}
+
+#endif // KOMPOSER_PLUGINMANAGER_H
diff --git a/libtdepim/komposer/core/prefsmodule.cpp b/libtdepim/komposer/core/prefsmodule.cpp
new file mode 100644
index 00000000..77e1c264
--- /dev/null
+++ b/libtdepim/komposer/core/prefsmodule.cpp
@@ -0,0 +1,142 @@
+/**
+ * prefsmodule.cpp
+ *
+ * Copyright (C) 2003-2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include "prefsmodule.h"
+
+#include <kaboutdata.h>
+#include <kdebug.h>
+#include <kcombobox.h>
+#include <klocale.h>
+#include <ktrader.h>
+
+#include <tqlayout.h>
+#include <tqlabel.h>
+#include <tqbuttongroup.h>
+
+#include <tdepimmacros.h>
+
+extern "C"
+{
+ KDE_EXPORT KCModule *create_komposerconfig( TQWidget *parent, const char * ) {
+ return new Komposer::PrefsModule( parent, "komposerprefs" );
+ }
+}
+using namespace Komposer;
+
+PrefsModule::PrefsModule( TQWidget *parent, const char *name )
+ : KPrefsModule( Komposer::Prefs::self(), parent, name )
+{
+ TQVBoxLayout *topLayout = new TQVBoxLayout( this );
+
+ EditorSelection *editors = new EditorSelection( i18n( "Editors" ),
+ Komposer::Prefs::self()->m_activeEditor,
+ this );
+ topLayout->addWidget( editors->groupBox() );
+
+ addWid( editors );
+
+ load();
+}
+
+const KAboutData*
+PrefsModule::aboutData() const
+{
+ KAboutData *about = new KAboutData( I18N_NOOP( "komposerconfig" ),
+ I18N_NOOP( "KDE Komposer" ),
+ 0, 0, KAboutData::License_LGPL,
+ I18N_NOOP( "(c), 2003-2004 Zack Rusin" ) );
+
+ about->addAuthor( "Zack Rusin", 0, "zack@kde.org" );;
+
+ return about;
+}
+
+
+EditorSelection::EditorSelection( const TQString &text, TQString &reference,
+ TQWidget *parent )
+ : m_reference( reference )
+{
+ m_box = new TQGroupBox( 0, TQt::Vertical, text, parent );
+ TQVBoxLayout *boxLayout = new TQVBoxLayout( m_box->tqlayout() );
+ boxLayout->tqsetAlignment( TQt::AlignTop );
+
+ m_editorsCombo = new KComboBox( m_box );
+ boxLayout->addWidget( m_editorsCombo );
+
+ connect( m_editorsCombo, TQT_SIGNAL(activated(constTQString&)),
+ TQT_SLOT(slotActivated(const TQString&)) );
+}
+
+EditorSelection::~EditorSelection()
+{
+}
+
+TQGroupBox*
+EditorSelection::groupBox() const
+{
+ return m_box;
+}
+
+void
+EditorSelection::readConfig()
+{
+ m_editorsCombo->clear();
+
+ KTrader::OfferList editors = KTrader::self()->query(
+ TQString::tqfromLatin1( "Komposer/Editor" ) );
+ KTrader::OfferList::ConstIterator it;
+ int i = 0;
+ for ( it = editors.begin(); it != editors.end(); ++it, ++i ) {
+ if ( !(*it)->hasServiceType( TQString::tqfromLatin1( "Komposer/Editor" ) ) )
+ continue;
+
+ TQString name = (*it)->property( "X-KDE-KomposerIdentifier" ).toString();
+ m_editorsCombo->insertItem( name );
+ if ( m_reference.contains( name ) )
+ m_editorsCombo->setCurrentItem( i );
+ }
+}
+
+void EditorSelection::writeConfig()
+{
+ m_reference = m_services[ m_editorsCombo->currentText()]->
+ property( "X-KDE-KomposerIdentifier" ).toString();
+}
+
+void
+EditorSelection::slotActivated( const TQString &editor )
+{
+ if ( !editor.isEmpty() )
+ emit changed();
+}
+
+void
+EditorSelection::setItem( const TQString &str )
+{
+ for ( int i = 0; i < m_editorsCombo->count(); ++i ) {
+ if ( m_editorsCombo->text( i ) == str ) {
+ m_editorsCombo->setCurrentItem( i );
+ break;
+ }
+ }
+}
+
+#include "prefsmodule.moc"
diff --git a/libtdepim/komposer/core/prefsmodule.h b/libtdepim/komposer/core/prefsmodule.h
new file mode 100644
index 00000000..aba969f1
--- /dev/null
+++ b/libtdepim/komposer/core/prefsmodule.h
@@ -0,0 +1,72 @@
+/*
+ * prefsmodule.h
+ *
+ * Copyright (C) 2003 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef KOMPOSER_PREFSMODULE_H
+#define KOMPOSER_PREFSMODULE_H
+
+#include <kprefsdialog.h>
+#include <kservice.h>
+#include <tqmap.h>
+class TQGroupBox;
+class TQListViewItem;
+
+class KAboutData;
+class KComboBox;
+
+namespace Komposer {
+
+ class PrefsModule : public KPrefsModule
+ {
+ Q_OBJECT
+ TQ_OBJECT
+ public:
+ PrefsModule( TQWidget *parent=0, const char *name=0 );
+ virtual const KAboutData *aboutData() const;
+ };
+
+ class EditorSelection : public KPrefsWid
+ {
+ Q_OBJECT
+ TQ_OBJECT
+
+ public:
+ EditorSelection( const TQString &text, TQString &reference, TQWidget *parent );
+ ~EditorSelection();
+
+ void readConfig();
+ void writeConfig();
+
+ TQGroupBox *groupBox() const;
+
+ private slots:
+ void slotActivated( const TQString & );
+
+ private:
+ void setItem( const TQString & );
+ private:
+ TQString &m_reference;
+
+ TQGroupBox *m_box;
+ KComboBox *m_editorsCombo;
+ TQMap<TQString, KService::Ptr> m_services;
+ };
+}
+
+#endif
diff --git a/libtdepim/komposer/core/settings.kcfgc b/libtdepim/komposer/core/settings.kcfgc
new file mode 100644
index 00000000..fc98478a
--- /dev/null
+++ b/libtdepim/komposer/core/settings.kcfgc
@@ -0,0 +1,9 @@
+# Code generation options for kconfig_compiler
+File=komposer.kcfg
+NameSpace=Komposer
+ClassName=Config
+Singleton=true
+Mutators=true
+#MemberVariables=public
+GlobalEnums=true
+#SetUserTexts=true
diff --git a/libtdepim/komposer/core/tests/Makefile.am b/libtdepim/komposer/core/tests/Makefile.am
new file mode 100644
index 00000000..fbf12795
--- /dev/null
+++ b/libtdepim/komposer/core/tests/Makefile.am
@@ -0,0 +1,20 @@
+INCLUDES = -I$(top_builddir)/libtdepim/komposer/core $(all_includes)
+
+check_PROGRAMS = testfactory testmanager testkomposer
+
+METASOURCES = AUTO
+
+testfactory_SOURCES = main.cpp managertest.cpp
+testfactory_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor
+testfactory_LDADD = ../libkomposer.la
+
+testmanager_SOURCES = testmanager.cpp
+testmanager_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor
+testmanager_LDADD = ../libkomposer.la
+
+testkomposer_SOURCES = testkomposer.cpp
+testkomposer_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor
+testkomposer_LDADD = ../libkomposer.la
+
+check: testfactory
+ @./testfactory 2>&1 | grep "tests:"
diff --git a/libtdepim/komposer/core/tests/main.cpp b/libtdepim/komposer/core/tests/main.cpp
new file mode 100644
index 00000000..4a33a2f1
--- /dev/null
+++ b/libtdepim/komposer/core/tests/main.cpp
@@ -0,0 +1,52 @@
+/**
+ * main.cpp
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "testfactory.h"
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kcmdlineargs.h>
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+
+static const KCmdLineOptions options[] =
+{
+ {"verbose", "Verbose output", 0},
+ KCmdLineLastOption
+};
+int main( int argc, char** argv )
+{
+ KAboutData aboutData( "tests","Test","0.1" );
+ KCmdLineArgs::init( argc, argv, &aboutData );
+ KCmdLineArgs::addCmdLineOptions( options );
+
+ KApplication app;
+
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ Q_UNUSED( args );
+
+ TestFactory t;
+ return t.runTests();
+}
diff --git a/libtdepim/komposer/core/tests/managertest.cpp b/libtdepim/komposer/core/tests/managertest.cpp
new file mode 100644
index 00000000..487a84c5
--- /dev/null
+++ b/libtdepim/komposer/core/tests/managertest.cpp
@@ -0,0 +1,43 @@
+/**
+ * managertest.cpp
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "managertest.h"
+
+#include "pluginmanager.h"
+using namespace Komposer;
+
+ManagerTest::ManagerTest( TQObject* parent )
+ : TQObject( parent )
+{
+ m_manager = new PluginManager( this );
+}
+
+
+void ManagerTest::allTests()
+{
+ CHECK( m_manager->availablePlugins().isEmpty(), true );
+ CHECK( m_manager->loadedPlugins().empty(), true );
+ CHECK( m_manager->plugin( "non-existing" ), ( Plugin* )0 );
+ m_manager->loadAllPlugins();
+ CHECK( m_manager->loadedPlugins().empty(), true );
+ m_manager->shutdown();
+}
+
+#include "managertest.moc"
diff --git a/libtdepim/komposer/core/tests/managertest.h b/libtdepim/komposer/core/tests/managertest.h
new file mode 100644
index 00000000..f02510e6
--- /dev/null
+++ b/libtdepim/komposer/core/tests/managertest.h
@@ -0,0 +1,45 @@
+/*
+ * managertest.h
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef MANAGERTEST_H
+#define MANAGERTEST_H
+
+#include <tqobject.h>
+#include "tester.h"
+
+namespace Komposer {
+ class PluginManager;
+}
+
+class ManagerTest : public TQObject,
+ public Tester
+{
+ Q_OBJECT
+ TQ_OBJECT
+public:
+ ManagerTest( TQObject* parent = 0 );
+
+public slots:
+ void allTests();
+private:
+ Komposer::PluginManager* m_manager;
+};
+
+#endif
diff --git a/libtdepim/komposer/core/tests/tester.cpp b/libtdepim/komposer/core/tests/tester.cpp
new file mode 100644
index 00000000..b32c8964
--- /dev/null
+++ b/libtdepim/komposer/core/tests/tester.cpp
@@ -0,0 +1,30 @@
+/**
+ * tester.cpp
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "tester.h"
+
+
+Tester::Tester( TQObject* parent )
+ : TQObject( parent )
+{
+}
+
+
+#include "tester.moc"
diff --git a/libtdepim/komposer/core/tests/tester.h b/libtdepim/komposer/core/tests/tester.h
new file mode 100644
index 00000000..5981d681
--- /dev/null
+++ b/libtdepim/komposer/core/tests/tester.h
@@ -0,0 +1,71 @@
+/*
+ * tester.h
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef TESTER_H
+#define TESTER_H
+
+#include <kdebug.h>
+#include <tqstringlist.h>
+
+#define CHECK( x, y ) check( __FILE__, __LINE__, #x, x, y )
+
+class Tester
+{
+public:
+ Tester() : m_tests( 0 ) {}
+ virtual ~Tester() {}
+
+public:
+ virtual void allTests() = 0;
+
+public:
+ int testsFinished() const {
+ return m_tests;
+ }
+ int testsFailed() const {
+ return m_errorList.count();
+ }
+ TQStringList errorList() const {
+ return m_errorList;
+ }
+
+protected:
+ template<typename T>
+ void check( const char* file, int line, const char* str,
+ const T& result, const T& expectedResult )
+ {
+ if ( result != expectedResult ) {
+ TQString error;
+ TQTextStream ts( &error, IO_WriteOnly );
+ ts << file << "["<< line <<"]:"
+ <<" failed on \""<< str <<"\""
+ << "\ntests:\t\t result = "
+ << result
+ << ", expected = "<< expectedResult;
+ m_errorList.append( error );
+ }
+ ++m_tests;
+ }
+private:
+ TQStringList m_errorList;
+ int m_tests;
+};
+
+#endif
diff --git a/libtdepim/komposer/core/tests/testfactory.h b/libtdepim/komposer/core/tests/testfactory.h
new file mode 100644
index 00000000..9354e52a
--- /dev/null
+++ b/libtdepim/komposer/core/tests/testfactory.h
@@ -0,0 +1,71 @@
+/*
+ * testfactory.h
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef TESTFACTORY_H
+#define TESTFACTORY_H
+
+#include "managertest.h"
+
+#include <tqasciidict.h>
+
+#define ADD_TEST(x) addTest( #x, new x )
+
+class TestFactory
+{
+public:
+ TestFactory()
+ {
+ ADD_TEST( ManagerTest );
+ m_tests.setAutoDelete( true );
+ }
+
+ int runTests()
+ {
+ int result = 0;
+ kdDebug()<<"Running tests..."<<endl;
+ TQAsciiDictIterator<Tester> it( m_tests );
+ for( ; it.current(); ++it ) {
+ Tester* test = it.current();
+ test->allTests();
+ TQStringList errorList = test->errorList();
+ if ( !errorList.empty() ) {
+ ++result;
+ kdDebug()<< it.currentKey() <<" errors:" << endl;
+ for ( TQStringList::Iterator itr = errorList.begin();
+ itr != errorList.end(); ++itr ) {
+ kdDebug()<< "\t" << (*itr).latin1() <<endl;;
+ }
+ } else {
+ kdDebug()<< it.currentKey()<< " OK "<<endl;
+ }
+ }
+ kdDebug()<< "Done" <<endl;
+ return result;
+ }
+public:
+ void addTest( const char* name, Tester* test )
+ {
+ m_tests.insert( name, test );
+ }
+private:
+ TQAsciiDict<Tester> m_tests;
+};
+
+#endif
diff --git a/libtdepim/komposer/core/tests/testkomposer.cpp b/libtdepim/komposer/core/tests/testkomposer.cpp
new file mode 100644
index 00000000..b7997e8c
--- /dev/null
+++ b/libtdepim/komposer/core/tests/testkomposer.cpp
@@ -0,0 +1,18 @@
+#include "core.h"
+
+#include <kplugininfo.h>
+#include <kcmdlineargs.h>
+#include <kapplication.h>
+#include <kdebug.h>
+
+int main( int argc, char **argv )
+{
+ KCmdLineArgs::init( argc, argv, "test", "test", "test", "0.1" );
+ KApplication app;
+
+ Komposer::Core *core = new Komposer::Core();
+ app.setMainWidget( core );
+ core->show();
+
+ return app.exec();
+}
diff --git a/libtdepim/komposer/core/tests/testmanager.cpp b/libtdepim/komposer/core/tests/testmanager.cpp
new file mode 100644
index 00000000..0fcba16b
--- /dev/null
+++ b/libtdepim/komposer/core/tests/testmanager.cpp
@@ -0,0 +1,53 @@
+#include "testmanager.h"
+#include "testmanager.moc"
+
+#include "pluginmanager.h"
+#include "plugin.h"
+
+#include <kplugininfo.h>
+#include <kcmdlineargs.h>
+#include <kapplication.h>
+#include <kdebug.h>
+
+using namespace Komposer;
+
+TestManager::TestManager( TQObject *parent )
+ : TQObject( parent )
+{
+ m_manager = new PluginManager( this );
+ connect( m_manager, TQT_SIGNAL(pluginLoaded(Plugin*)),
+ TQT_SLOT(slotPluginLoaded(Plugin*)) );
+ connect( m_manager, TQT_SIGNAL(allPluginsLoaded()),
+ TQT_SLOT(slotAllPluginsLoaded()) );
+ m_manager->loadAllPlugins();
+
+ TQValueList<KPluginInfo*> plugins = m_manager->availablePlugins();
+ kdDebug()<<"Number of available plugins is "<< plugins.count() <<endl;
+ for ( TQValueList<KPluginInfo*>::iterator it = plugins.begin(); it != plugins.end(); ++it ) {
+ KPluginInfo *i = ( *it );
+ kdDebug()<<"\tAvailable plugin "<< i->name()
+ <<", comment = "<< i->comment() <<endl;
+ }
+}
+
+void TestManager::slotAllPluginsLoaded()
+{
+ kdDebug()<<"Done"<<endl;
+ m_manager->shutdown();
+ tqApp->exit();
+}
+
+void TestManager::slotPluginLoaded( Plugin *plugin )
+{
+ kdDebug()<<"A plugin "<< m_manager->pluginName( plugin ) << " has been loaded"<<endl;
+}
+
+int main( int argc, char **argv )
+{
+ KCmdLineArgs::init( argc, argv, "test", "test", "test", "0.1" );
+ KApplication app;
+
+ TestManager manager( &app );
+
+ return app.exec();
+}
diff --git a/libtdepim/komposer/core/tests/testmanager.h b/libtdepim/komposer/core/tests/testmanager.h
new file mode 100644
index 00000000..5dfaa15d
--- /dev/null
+++ b/libtdepim/komposer/core/tests/testmanager.h
@@ -0,0 +1,26 @@
+#ifndef TESTMANAGER_H
+#define TESTMANAGER_H
+
+#include <tqobject.h>
+
+namespace Komposer {
+ class Plugin;
+ class PluginManager;
+}
+using Komposer::Plugin;
+
+class TestManager : public TQObject
+{
+ Q_OBJECT
+ TQ_OBJECT
+public:
+ TestManager( TQObject *parent );
+
+public slots:
+ void slotPluginLoaded( Plugin *plugin );
+ void slotAllPluginsLoaded();
+private:
+ Komposer::PluginManager *m_manager;
+};
+
+#endif
diff --git a/libtdepim/komposer/plugins/Makefile.am b/libtdepim/komposer/plugins/Makefile.am
new file mode 100644
index 00000000..dcc4764a
--- /dev/null
+++ b/libtdepim/komposer/plugins/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = default
diff --git a/libtdepim/komposer/plugins/default/Makefile.am b/libtdepim/komposer/plugins/default/Makefile.am
new file mode 100644
index 00000000..7ae32dc0
--- /dev/null
+++ b/libtdepim/komposer/plugins/default/Makefile.am
@@ -0,0 +1,15 @@
+AM_CPPFLAGS = -I$(top_builddir)/libtdepim/komposer/core $(all_includes)
+
+kde_module_LTLIBRARIES = libkomposer_defaulteditor.la
+libkomposer_defaulteditor_la_LDFLAGS = $(KDE_PLUGIN) $(all_libraries)
+libkomposer_defaulteditor_la_LIBADD = ../../core/libkomposer.la $(LIB_KPARTS)
+
+libkomposer_defaulteditor_la_SOURCES = defaulteditor.cpp
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)/komposer
+service_DATA = defaulteditor.desktop
+
+rcdir = $(kde_datadir)/komposer_defaulteditor
+rc_DATA = defaulteditorui.rc
diff --git a/libtdepim/komposer/plugins/default/defaulteditor.cpp b/libtdepim/komposer/plugins/default/defaulteditor.cpp
new file mode 100644
index 00000000..27018ce5
--- /dev/null
+++ b/libtdepim/komposer/plugins/default/defaulteditor.cpp
@@ -0,0 +1,361 @@
+/**
+ * defaulteditor.cpp
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "defaulteditor.h"
+#include "core.h"
+
+#include <kgenericfactory.h>
+#include <kapplication.h>
+#include <kaction.h>
+#include <kiconloader.h>
+#include <kdebug.h>
+
+#include <kaction.h>
+#include <kcolordialog.h>
+#include <kfiledialog.h>
+#include <kinstance.h>
+#include <klocale.h>
+#include <kstdaction.h>
+#include <kprinter.h>
+#include <kfinddialog.h>
+#include <kfind.h>
+#include <kreplacedialog.h>
+#include <kreplace.h>
+
+#include <tqtextedit.h>
+#include <tqwidget.h>
+
+typedef KGenericFactory<DefaultEditor> DefaultEditorFactory;
+K_EXPORT_COMPONENT_FACTORY( libkomposer_defaulteditor,
+ DefaultEditorFactory( "komposer_defaulteditor" ) )
+
+DefaultEditor::DefaultEditor( TQObject *parent, const char *name, const TQStringList &args )
+ : Editor( parent, name, args ), m_textEdit( 0 )
+{
+ setInstance( DefaultEditorFactory::instance() );
+
+ m_textEdit = new TQTextEdit( 0 );
+
+ createActions( actionCollection() );
+
+ setXMLFile( "defaulteditorui.rc" );
+}
+
+DefaultEditor::~DefaultEditor()
+{
+}
+
+
+TQWidget*
+DefaultEditor::widget()
+{
+ return m_textEdit;
+}
+
+TQString
+DefaultEditor::text() const
+{
+ return m_textEdit->text();
+}
+
+void
+DefaultEditor::setText( const TQString &text )
+{
+ m_textEdit->setText( text );
+}
+
+void
+DefaultEditor::changeSignature( const TQString &sig )
+{
+ TQString text = m_textEdit->text();
+
+ int sigStart = text.findRev( "-- " );
+ TQString sigText = TQString( "-- \n%1" ).tqarg( sig );
+
+ text.replace( sigStart, text.length(), sigText );
+}
+
+void
+DefaultEditor::createActions( KActionCollection *ac )
+{
+ //
+ // File Actions
+ //
+ (void) KStdAction::open( this, TQT_SLOT(open()), ac );
+ (void) KStdAction::openRecent( this, TQT_SLOT(openURL(const KURL &)), ac );
+ (void) KStdAction::save( this, TQT_SLOT(save()), ac );
+ (void) KStdAction::saveAs( this, TQT_SLOT(saveAs()), ac );
+
+ //
+ // Edit Actions
+ //
+ KAction *actionUndo = KStdAction::undo( m_textEdit, TQT_SLOT(undo()), ac );
+ actionUndo->setEnabled( false );
+ connect( m_textEdit, TQT_SIGNAL(undoAvailable(bool)),
+ actionUndo, TQT_SLOT(setEnabled(bool)) );
+
+ KAction *actionRedo = KStdAction::redo( m_textEdit, TQT_SLOT(redo()), ac );
+ actionRedo->setEnabled( false );
+ connect( m_textEdit, TQT_SIGNAL(redoAvailable(bool)),
+ actionRedo, TQT_SLOT(setEnabled(bool)) );
+
+ KAction *action_cut = KStdAction::cut( m_textEdit, TQT_SLOT(cut()), ac );
+ action_cut->setEnabled( false );
+ connect( m_textEdit, TQT_SIGNAL(copyAvailable(bool)),
+ action_cut, TQT_SLOT(setEnabled(bool)) );
+
+ KAction *action_copy = KStdAction::copy( m_textEdit, TQT_SLOT(copy()), ac );
+ action_copy->setEnabled( false );
+ connect( m_textEdit, TQT_SIGNAL(copyAvailable(bool)),
+ action_copy, TQT_SLOT(setEnabled(bool)) );
+
+ (void) KStdAction::print( this, TQT_SLOT(print()), ac );
+
+ (void) KStdAction::paste( m_textEdit, TQT_SLOT(paste()), ac );
+ (void) new KAction( i18n( "C&lear" ), 0,
+ m_textEdit, TQT_SLOT(removeSelectedText()),
+ ac, "edit_clear" );
+
+ (void) KStdAction::selectAll( m_textEdit, TQT_SLOT(selectAll()), ac );
+
+ //
+ // View Actions
+ //
+ (void) KStdAction::zoomIn( m_textEdit, TQT_SLOT(zoomIn()), ac );
+ (void) KStdAction::zoomOut( m_textEdit, TQT_SLOT(zoomOut()), ac );
+
+ //
+ // Character Formatting
+ //
+ m_actionBold = new KToggleAction( i18n("&Bold"), "text_bold", CTRL+Key_B,
+ ac, "format_bold" );
+ connect( m_actionBold, TQT_SIGNAL(toggled(bool)),
+ m_textEdit, TQT_SLOT(setBold(bool)) );
+
+ m_actionItalic = new KToggleAction( i18n("&Italic"), "text_italic", CTRL+Key_I,
+ ac, "format_italic" );
+
+ connect( m_actionItalic, TQT_SIGNAL(toggled(bool)),
+ m_textEdit, TQT_SLOT(setItalic(bool) ));
+
+ m_actionUnderline = new KToggleAction( i18n("&Underline"), "text_under", CTRL+Key_U,
+ ac, "format_underline" );
+
+ connect( m_actionUnderline, TQT_SIGNAL(toggled(bool)),
+ m_textEdit, TQT_SLOT(setUnderline(bool)) );
+
+ (void) new KAction( i18n("Text &Color..."), "colorpicker", 0,
+ this, TQT_SLOT(formatColor()),
+ ac, "format_color" );
+
+ //
+ // Font
+ //
+ m_actionFont = new KFontAction( i18n("&Font"), 0,
+ ac, "format_font" );
+ connect( m_actionFont, TQT_SIGNAL(activated(const TQString &)),
+ m_textEdit, TQT_SLOT(setFamily(const TQString &)) );
+
+
+ m_actionFontSize = new KFontSizeAction( i18n("Font &Size"), 0,
+ ac, "format_font_size" );
+ connect( m_actionFontSize, TQT_SIGNAL(fontSizeChanged(int)),
+ m_textEdit, TQT_SLOT(setPointSize(int)) );
+
+ //
+ // Alignment
+ //
+ m_actionAlignLeft = new KToggleAction( i18n("Align &Left"), "text_left", 0,
+ ac, "format_align_left" );
+ connect( m_actionAlignLeft, TQT_SIGNAL(toggled(bool)),
+ this, TQT_SLOT(setAlignLeft(bool)) );
+
+ m_actionAlignCenter = new KToggleAction( i18n("Align &Center"), "text_center", 0,
+ ac, "format_align_center" );
+ connect( m_actionAlignCenter, TQT_SIGNAL(toggled(bool)),
+ this, TQT_SLOT(setAlignCenter(bool)) );
+
+ m_actionAlignRight = new KToggleAction( i18n("Align &Right"), "text_right", 0,
+ ac, "format_align_right" );
+ connect( m_actionAlignRight, TQT_SIGNAL(toggled(bool)),
+ this, TQT_SLOT(setAlignRight(bool)) );
+
+ m_actionAlignJustify = new KToggleAction( i18n("&Justify"), "text_block", 0,
+ ac, "format_align_justify" );
+ connect( m_actionAlignJustify, TQT_SIGNAL(toggled(bool)),
+ this, TQT_SLOT(setAlignJustify(bool)) );
+
+ m_actionAlignLeft->setExclusiveGroup( "tqalignment" );
+ m_actionAlignCenter->setExclusiveGroup( "tqalignment" );
+ m_actionAlignRight->setExclusiveGroup( "tqalignment" );
+ m_actionAlignJustify->setExclusiveGroup( "tqalignment" );
+
+ //
+ // Tools
+ //
+ (void) KStdAction::spelling( this, TQT_SLOT(checkSpelling()), ac );
+
+ //
+ // Setup enable/disable
+ //
+ updateActions();
+
+ connect( m_textEdit, TQT_SIGNAL(currentFontChanged(const TQFont &)),
+ this, TQT_SLOT( updateFont() ) );
+ connect( m_textEdit, TQT_SIGNAL(currentFontChanged(const TQFont &)),
+ this, TQT_SLOT(updateCharFmt()) );
+ connect( m_textEdit, TQT_SIGNAL(cursorPositionChanged(int, int)),
+ this, TQT_SLOT(updateAligment()) );
+}
+
+void
+DefaultEditor::updateActions()
+{
+ updateCharFmt();
+ updateAligment();
+ updateFont();
+}
+
+void
+DefaultEditor::updateCharFmt()
+{
+ m_actionBold->setChecked( m_textEdit->bold() );
+ m_actionItalic->setChecked( m_textEdit->italic() );
+ m_actionUnderline->setChecked( m_textEdit->underline() );
+}
+
+void
+DefaultEditor::updateAligment()
+{
+ int align = m_textEdit->tqalignment();
+
+ switch ( align ) {
+ case AlignRight:
+ m_actionAlignRight->setChecked( true );
+ break;
+ case AlignCenter:
+ m_actionAlignCenter->setChecked( true );
+ break;
+ case AlignLeft:
+ m_actionAlignLeft->setChecked( true );
+ break;
+ case AlignJustify:
+ m_actionAlignJustify->setChecked( true );
+ break;
+ default:
+ break;
+ }
+}
+
+void
+DefaultEditor::updateFont()
+{
+ if ( m_textEdit->pointSize() > 0 )
+ m_actionFontSize->setFontSize( m_textEdit->pointSize() );
+ m_actionFont->setFont( m_textEdit->family() );
+}
+
+void
+DefaultEditor::formatColor()
+{
+ TQColor col;
+
+ int s = KColorDialog::getColor( col, m_textEdit->color(), m_textEdit );
+ if ( s != TQDialog::Accepted )
+ return;
+
+ m_textEdit->setColor( col );
+}
+
+void
+DefaultEditor::setAlignLeft( bool yes )
+{
+ if ( yes )
+ m_textEdit->tqsetAlignment( AlignLeft );
+}
+
+void
+DefaultEditor::setAlignRight( bool yes )
+{
+ if ( yes )
+ m_textEdit->tqsetAlignment( AlignRight );
+}
+
+void
+DefaultEditor::setAlignCenter( bool yes )
+{
+ if ( yes )
+ m_textEdit->tqsetAlignment( AlignCenter );
+}
+
+void
+DefaultEditor::setAlignJustify( bool yes )
+{
+ if ( yes )
+ m_textEdit->tqsetAlignment( AlignJustify );
+}
+
+//
+// Content Actions
+//
+
+bool
+DefaultEditor::open()
+{
+ KURL url = KFileDialog::getOpenURL();
+ if ( url.isEmpty() )
+ return false;
+
+ //fixme
+ //return openURL( url );
+ return true;
+}
+
+bool
+DefaultEditor::saveAs()
+{
+ KURL url = KFileDialog::getSaveURL();
+ if ( url.isEmpty() )
+ return false;
+
+ //FIXME
+ //return KParts::ReadWritePart::saveAs( url );
+ return true;
+}
+
+void
+DefaultEditor::checkSpelling()
+{
+ TQString s;
+ if ( m_textEdit->hasSelectedText() )
+ s = m_textEdit->selectedText();
+ else
+ s = m_textEdit->text();
+
+ //KSpell::modalCheck( s );
+}
+
+bool
+DefaultEditor::print()
+{
+ return true;
+}
+
+#include "defaulteditor.moc"
diff --git a/libtdepim/komposer/plugins/default/defaulteditor.desktop b/libtdepim/komposer/plugins/default/defaulteditor.desktop
new file mode 100644
index 00000000..910f7d89
--- /dev/null
+++ b/libtdepim/komposer/plugins/default/defaulteditor.desktop
@@ -0,0 +1,109 @@
+[Desktop Entry]
+Type=Service
+Icon=editor
+ServiceTypes=Komposer/Editor
+
+X-KDE-Library=libkomposer_defaulteditor
+X-Komposer-Version=1
+X-Komposer-Weight=10
+
+X-KDE-PluginInfo-Author=Zack Rusin
+X-KDE-PluginInfo-Email=zack@kde.org
+X-KDE-PluginInfo-Name=komposer_defaulteditor
+X-KDE-PluginInfo-Version=0.0.1
+X-KDE-PluginInfo-Website=http://www.kde.org
+X-KDE-PluginInfo-Category=Editors
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=LGPL
+X-KDE-PluginInfo-EnabledByDefault=true
+Name=Komposer Editor
+Name[af]=Komposer Redigeerder
+Name[bg]=Редактор за Komposer
+Name[br]=Aozer Komposer
+Name[ca]=Editor Komposer
+Name[cs]=Komposer editor
+Name[da]=Komposer-editor
+Name[el]=Επεξεργαστής Komposer
+Name[eo]=Komposer-redaktilo
+Name[es]=Editor Komposer
+Name[et]=Komposeri redaktor
+Name[eu]=Komposer editorea
+Name[fa]=ویرایشگر Komposer
+Name[fi]=Komposer-muokkain
+Name[fr]=Éditeur Komposer
+Name[fy]=Komposer-bewurker
+Name[ga]=Eagarthóir Komposer
+Name[gl]=Editor Komposer
+Name[hu]=Komposer szerkesztő
+Name[is]=Komposer ritill
+Name[it]=Editor Komposer
+Name[ja]=Komposer エディタ
+Name[kk]=Komposer өңдегіші
+Name[km]=កម្មវិធី​និពន្ធ Komposer
+Name[lt]=Komposer redaktorius
+Name[ms]=Editor Komposer
+Name[nb]=Komposer-redigering
+Name[ne]=कम्पोजर सम्पादक
+Name[nl]=Komposer-editor
+Name[nn]=Komposer-redigering
+Name[pl]=Edytor Komposer
+Name[pt]=Editor Kompositor
+Name[pt_BR]=Editor do Komposer
+Name[ru]=Редактор Komposer
+Name[sk]=Editor Komposer
+Name[sl]=Urejevalnik Komposer
+Name[sr]=Уређивач Komposer-а
+Name[sr@Latn]=Uređivač Komposer-a
+Name[sv]=Komposer editor
+Name[ta]=கம்போசர் தொகுப்பான்
+Name[tr]=Komposer Düzenleyicisi
+Name[uk]=Редактор Komposer
+Name[zh_CN]=Komposer 编辑器
+Name[zh_TW]=Komposer 編輯器
+Comment=Komposer default editor
+Comment[af]=Komposer standaard redigeerder
+Comment[bg]=Подразбиращ се редактор за Komposer
+Comment[ca]=Editor predeterminat de Komposer
+Comment[cs]=Výchozí Komposer editor
+Comment[da]=Komposer standardeditor
+Comment[de]=Komposer Standardeditor
+Comment[el]=Προεπιλεγμένος επεξεργαστής του Komposer
+Comment[eo]=Komposer-redaktilo apriora
+Comment[es]=Editor predefinido Komposer
+Comment[et]=Komposeri vaikeredaktor
+Comment[eu]=Komposer editore lehenetsia
+Comment[fa]=ویرایشگر پیش‌فرض Komposer
+Comment[fi]=Komposer oletusmuokkain
+Comment[fr]=Éditeur Komposer par défaut
+Comment[fy]=Komposer standertbewurker
+Comment[ga]=Eagarthóir réamhshocraithe Komposer
+Comment[gl]=Editor por defecto Komposer
+Comment[he]=עורך ברירת מחדל של Kompoer
+Comment[hu]=A Komposer alapértelmezett szerkesztője
+Comment[is]=Sjálfgefinn ritill Komposer
+Comment[it]=Editor di default per Komposer
+Comment[ja]=Komposer 標準エディタ
+Comment[kk]=Komposer әдетті өңдегіші
+Comment[km]=កម្មវិធី​និពន្ធ​លំនាំដើម​របស់ Komposer
+Comment[ko]=Komposer 기본 편집기
+Comment[lt]=Komposer numatytasis redaktorius
+Comment[ms]=Pengedit piawai Komposer
+Comment[nb]=Komposer standard-redigerer
+Comment[nds]=Komposer-Standardeditor
+Comment[ne]=कम्पोजरको पूर्वनिर्धारित सम्पादक
+Comment[nl]=Komposer standaardeditor
+Comment[nn]=Komposer standard-redigeringsprogram
+Comment[pl]=Domyślny edytor Komposera
+Comment[pt]=Editor predefinido Kompositor
+Comment[pt_BR]=Editor padrão do Komposer
+Comment[ru]=Редактор Komposer по умолчанию
+Comment[sk]=Štandardný editor Komposer
+Comment[sl]=Privzeti urejevalnik Komposer
+Comment[sr]=Подразумевани Komposer-ов уређивач
+Comment[sr@Latn]=Podrazumevani Komposer-ov uređivač
+Comment[sv]=Komposer standardeditor
+Comment[ta]=கம்போசர் முன்னிருப்பு தொகுப்பான்
+Comment[tr]=Öntanımlı Komposer düzenleyicisi
+Comment[uk]=Типовий редактор Komposer
+Comment[zh_CN]=Komposer 默认编辑器
+Comment[zh_TW]=Komposer 預設編輯器
diff --git a/libtdepim/komposer/plugins/default/defaulteditor.h b/libtdepim/komposer/plugins/default/defaulteditor.h
new file mode 100644
index 00000000..84cedcbc
--- /dev/null
+++ b/libtdepim/komposer/plugins/default/defaulteditor.h
@@ -0,0 +1,118 @@
+/*
+ * defaulteditor.h
+ *
+ * Copyright (C) 2004 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef DEFAULTEDITOR_H
+#define DEFAULTEDITOR_H
+
+#include "editor.h"
+
+class TQTextEdit;
+class KFontAction;
+class KFontSizeAction;
+class KToggleAction;
+class KActionCollection;
+
+
+class DefaultEditor : public Komposer::Editor
+{
+ Q_OBJECT
+ TQ_OBJECT
+public:
+ DefaultEditor( TQObject *parent, const char *name, const TQStringList &args );
+ ~DefaultEditor();
+
+ virtual TQWidget *widget();
+ virtual TQString text() const;
+public slots:
+ virtual void setText( const TQString &txt );
+ virtual void changeSignature( const TQString &txt );
+
+ /**
+ * Displays a file dialog and loads the selected file.
+ */
+ bool open();
+
+ /**
+ * Displays a file dialog and saves to the selected file.
+ */
+ bool saveAs();
+
+ /**
+ * Prints the current document
+ */
+ bool print();
+
+ /**
+ * Displays a color dialog and sets the text color to the selected value.
+ */
+ void formatColor();
+
+ void checkSpelling();
+
+ /**
+ * @internal
+ */
+ void setAlignLeft( bool yes );
+
+ /**
+ * @internal
+ */
+ void setAlignRight( bool yes );
+
+ /**
+ * @internal
+ */
+ void setAlignCenter( bool yes );
+
+ /**
+ * @internal
+ */
+ void setAlignJustify( bool yes );
+
+protected slots:
+ /**
+ * Creates the part's actions in the part's action collection.
+ */
+ void createActions( KActionCollection *ac );
+
+ void updateActions();
+
+ void updateFont();
+ void updateCharFmt();
+ void updateAligment();
+
+private:
+ TQTextEdit *m_textEdit;
+
+ KToggleAction *m_actionBold;
+ KToggleAction *m_actionItalic;
+ KToggleAction *m_actionUnderline;
+
+ KFontAction *m_actionFont;
+ KFontSizeAction *m_actionFontSize;
+
+ KToggleAction *m_actionAlignLeft;
+ KToggleAction *m_actionAlignRight;
+ KToggleAction *m_actionAlignCenter;
+ KToggleAction *m_actionAlignJustify;
+};
+
+#endif
diff --git a/libtdepim/komposer/plugins/default/defaulteditorui.rc b/libtdepim/komposer/plugins/default/defaulteditorui.rc
new file mode 100644
index 00000000..de8c2e6d
--- /dev/null
+++ b/libtdepim/komposer/plugins/default/defaulteditorui.rc
@@ -0,0 +1,90 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="defaulteditor" version="3">
+<MenuBar>
+ <Menu name="edit"><text>&amp;Edit</text>
+ <Action name="edit_undo"/>
+ <Action name="edit_redo"/>
+ <Separator/>
+ <Action name="edit_cut" append="edit_paste_merge"/>
+ <Action name="edit_copy" append="edit_paste_merge"/>
+ <Action name="edit_paste" append="edit_paste_merge"/>
+ <Action name="edit_clear" append="edit_paste_merge"/>
+ <Separator/>
+ <Action name="edit_select_all" append="edit_select_merge"/>
+ </Menu>
+ <Menu name="view"><text>&amp;View</text>
+ <Action name="view_zoom_in" />
+ <Action name="view_zoom_out" />
+ <DefineGroup name="view_zoom_group" />
+ </Menu>
+ <Menu name="format"><text>F&amp;ormat</text>
+ <Action name="format_bold"/>
+ <Action name="format_italic"/>
+ <Action name="format_underline"/>
+ <Action name="format_color"/>
+ <DefineGroup name="format_chars_group" />
+ <Separator/>
+ <Menu name="tqalignment"><text>&amp;Alignment</text>
+ <Action name="format_align_left"/>
+ <Action name="format_align_center"/>
+ <Action name="format_align_right"/>
+ <Action name="format_align_justify"/>
+ <DefineGroup name="format_align_group" />
+ </Menu>
+ <Separator/>
+ <Action name="format_font"/>
+ <Action name="format_font_size"/>
+ <DefineGroup name="format_font_group" />
+ </Menu>
+ <Menu name="tools"><text>&amp;Tools</text>
+ <Action name="tools_spelling"/>
+ </Menu>
+ <Merge />
+ <Menu name="help"><text>&amp;Help</text>
+ </Menu>
+</MenuBar>
+<ToolBar name="mainToolBar"><text>Editor Toolbar</text>
+ <Separator lineSeparator="true"/>
+ <Action name="edit_undo"/>
+ <Action name="edit_redo"/>
+ <Separator lineSeparator="true"/>
+ <Action name="edit_cut"/>
+ <Action name="edit_copy"/>
+ <Action name="edit_paste"/>
+ <Separator lineSeparator="true"/>
+ <Action name="view_zoom_in" />
+ <Action name="view_zoom_out" />
+</ToolBar>
+<ToolBar name="formatToolBar"><text>Format Toolbar</text>
+ <Action name="format_bold"/>
+ <Action name="format_italic"/>
+ <Action name="format_underline"/>
+ <Action name="format_color"/>
+ <DefineGroup name="format_chars_group" />
+ <Separator lineSeparator="true"/>
+ <Action name="format_font"/>
+ <Action name="format_font_size"/>
+ <DefineGroup name="format_font_group" />
+ <Separator lineSeparator="true"/>
+ <Action name="format_align_left"/>
+ <Action name="format_align_center"/>
+ <Action name="format_align_right"/>
+ <Action name="format_align_justify"/>
+ <DefineGroup name="format_align_group" />
+</ToolBar>
+
+<Menu name="editor_popup">
+ <Action name="edit_undo"/>
+ <Action name="edit_redo"/>
+ <Separator/>
+ <Action name="edit_cut"/>
+ <Action name="edit_copy"/>
+ <Action name="edit_paste"/>
+ <Action name="edit_clear"/>
+ <Separator/>
+ <Action name="edit_select_all"/>
+</Menu>
+
+</kpartgui>
+
+
diff --git a/libtdepim/komposer/test/Makefile.am b/libtdepim/komposer/test/Makefile.am
new file mode 100644
index 00000000..af51004e
--- /dev/null
+++ b/libtdepim/komposer/test/Makefile.am
@@ -0,0 +1,7 @@
+AM_CPPFLAGS = -I$(top_srcdir) -I../core $(all_includes)
+LDADD = $(LIB_KPARTS) ../core/libkomposer.la
+AM_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor
+
+check_PROGRAMS = test
+
+test_SOURCES = test.cpp
diff --git a/libtdepim/komposer/test/test.cpp b/libtdepim/komposer/test/test.cpp
new file mode 100644
index 00000000..5d4544d2
--- /dev/null
+++ b/libtdepim/komposer/test/test.cpp
@@ -0,0 +1,56 @@
+/**
+ * test.cpp
+ *
+ * Copyright (C) 2003 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include "core.h"
+
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kuniqueapplication.h>
+
+#include <tqlabel.h>
+
+static const char description[] =
+ I18N_NOOP( "KDE mail editing manager" );
+
+static const char version[] = "0.0.1 (SVN)";
+
+int main(int argc, char **argv)
+{
+ KAboutData about( "komposertest", I18N_NOOP( "KomposerTest" ), version, description,
+ KAboutData::License_GPL, "(C) 2001-2003 The Kontact developers", 0, "http://kontact.kde.org", "zack@kde.org" );
+ about.addAuthor( "Zack Rusin", 0, "zack@kde.org" );
+
+ KCmdLineArgs::init( argc, argv, &about );
+ KUniqueApplication app;
+
+ // see if we are starting with session management
+ if ( app.isRestored() )
+ RESTORE( Komposer::Core )
+ else {
+ // no session.. just start up normally
+ Komposer::Core *mw = new Komposer::Core;
+ mw->show();
+ }
+
+ return app.exec();
+}