From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/plugins/translator/translatorplugin.h | 113 +++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 kopete/plugins/translator/translatorplugin.h (limited to 'kopete/plugins/translator/translatorplugin.h') diff --git a/kopete/plugins/translator/translatorplugin.h b/kopete/plugins/translator/translatorplugin.h new file mode 100644 index 00000000..2a04b509 --- /dev/null +++ b/kopete/plugins/translator/translatorplugin.h @@ -0,0 +1,113 @@ +/* + translatorplugin.h + + Kopete Translatorfish Translator plugin + + Copyright (c) 2001-2002 by Duncan Mac-Vicar Prett + Copyright (c) 2002-2003 by Olivier Goffart + + Kopete (c) 2002-2003 by the Kopete developers + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + +#ifndef BABELFISHPLUGIN_H +#define BABELFISHPLUGIN_H + +#include +#include +#include +#include + + +#include + +#include "kopetemessage.h" +#include "kopeteplugin.h" + + +class QString; +class KSelectAction; + +namespace Kopete { class Message; } +namespace Kopete { class MetaContact; } +namespace Kopete { class ChatSession; } + +class TranslatorPreferences; +class TranslatorGUIClient; +class TranslatorLanguages; + +/** + * @author Duncan Mac-Vicar Prett + * + * Kopete Translator Plugin + */ +class TranslatorPlugin : public Kopete::Plugin +{ + Q_OBJECT + +friend class TranslatorGUIClient; + +public: + static TranslatorPlugin *plugin(); + + TranslatorPlugin( QObject *parent, const char *name, const QStringList &args ); + ~TranslatorPlugin(); + + enum TranslateMode + { + DontTranslate = 0, + ShowOriginal = 1, + JustTranslate = 2, + ShowDialog = 3 + }; + +private slots: + void slotIncomingMessage( Kopete::Message& msg ); + void slotOutgoingMessage( Kopete::Message& msg ); + void slotDataReceived ( KIO::Job *, const QByteArray &data); + void slotJobDone ( KIO::Job *); + void slotSetLanguage(); + void slotSelectionChanged(bool); + void slotNewKMM(Kopete::ChatSession *); + void loadSettings(); + +public: + QString translateMessage( const QString &, const QString &, const QString & ); + void translateMessage( const QString &, const QString &, const QString & , QObject * , const char*); + +protected: + QString googleTranslateMessage( const QString &, const QString &, const QString & ); + QString babelTranslateMessage(const QString &, const QString &, const QString & ); + +private: + + QMap< KIO::Job *, QCString> m_data; + QMap< KIO::Job *, bool> m_completed; + + KSelectAction* m_actionLanguage; + + static TranslatorPlugin* pluginStatic_; + TranslatorLanguages *m_languages; + + //Settings + QString m_myLang; + QString m_service; + unsigned int m_outgoingMode; + unsigned int m_incomingMode; + +private: + void sendTranslation(Kopete::Message &msg, const QString &translated); +}; + +#endif + +// vim: set noet ts=4 sts=4 sw=4: + -- cgit v1.2.1