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/autoreplace/Makefile.am | 21 ++ kopete/plugins/autoreplace/autoreplaceconfig.cpp | 133 +++++++++++++ kopete/plugins/autoreplace/autoreplaceconfig.h | 58 ++++++ kopete/plugins/autoreplace/autoreplaceplugin.cpp | 128 ++++++++++++ kopete/plugins/autoreplace/autoreplaceplugin.h | 63 ++++++ .../plugins/autoreplace/autoreplacepreferences.cpp | 215 ++++++++++++++++++++ .../plugins/autoreplace/autoreplacepreferences.h | 64 ++++++ kopete/plugins/autoreplace/autoreplaceprefs.ui | 219 +++++++++++++++++++++ kopete/plugins/autoreplace/icons/Makefile.am | 3 + .../autoreplace/icons/cr32-app-autoreplace.png | Bin 0 -> 819 bytes .../plugins/autoreplace/kopete_autoreplace.desktop | 128 ++++++++++++ .../autoreplace/kopete_autoreplace_config.desktop | 124 ++++++++++++ 12 files changed, 1156 insertions(+) create mode 100644 kopete/plugins/autoreplace/Makefile.am create mode 100644 kopete/plugins/autoreplace/autoreplaceconfig.cpp create mode 100644 kopete/plugins/autoreplace/autoreplaceconfig.h create mode 100644 kopete/plugins/autoreplace/autoreplaceplugin.cpp create mode 100644 kopete/plugins/autoreplace/autoreplaceplugin.h create mode 100644 kopete/plugins/autoreplace/autoreplacepreferences.cpp create mode 100644 kopete/plugins/autoreplace/autoreplacepreferences.h create mode 100644 kopete/plugins/autoreplace/autoreplaceprefs.ui create mode 100644 kopete/plugins/autoreplace/icons/Makefile.am create mode 100644 kopete/plugins/autoreplace/icons/cr32-app-autoreplace.png create mode 100644 kopete/plugins/autoreplace/kopete_autoreplace.desktop create mode 100644 kopete/plugins/autoreplace/kopete_autoreplace_config.desktop (limited to 'kopete/plugins/autoreplace') diff --git a/kopete/plugins/autoreplace/Makefile.am b/kopete/plugins/autoreplace/Makefile.am new file mode 100644 index 00000000..511da48d --- /dev/null +++ b/kopete/plugins/autoreplace/Makefile.am @@ -0,0 +1,21 @@ +METASOURCES = AUTO +AM_CPPFLAGS = $(KOPETE_INCLUDES) $(all_includes) + +SUBDIRS = icons + +kde_module_LTLIBRARIES = kopete_autoreplace.la kcm_kopete_autoreplace.la + +kopete_autoreplace_la_SOURCES = autoreplaceplugin.cpp autoreplaceconfig.cpp +kopete_autoreplace_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) $(all_libraries) +kopete_autoreplace_la_LIBADD = ../../libkopete/libkopete.la + +kcm_kopete_autoreplace_la_SOURCES = autoreplacepreferences.cpp autoreplaceconfig.cpp autoreplaceprefs.ui +kcm_kopete_autoreplace_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) $(all_libraries) +kcm_kopete_autoreplace_la_LIBADD = ../../libkopete/libkopete.la $(LIB_KUTILS) + +service_DATA = kopete_autoreplace.desktop +servicedir = $(kde_servicesdir) + +kcm_DATA = kopete_autoreplace_config.desktop +kcmdir = $(kde_servicesdir)/kconfiguredialog + diff --git a/kopete/plugins/autoreplace/autoreplaceconfig.cpp b/kopete/plugins/autoreplace/autoreplaceconfig.cpp new file mode 100644 index 00000000..0407990a --- /dev/null +++ b/kopete/plugins/autoreplace/autoreplaceconfig.cpp @@ -0,0 +1,133 @@ +/* + autoreplaceconfig.cpp + + Copyright (c) 2003 by Roberto Pariset + Copyright (c) 2003 by Martijn Klingens + + 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. * + * * + ************************************************************************* +*/ + +#include "autoreplaceconfig.h" + +#include +#include +#include + +AutoReplaceConfig::AutoReplaceConfig() +{ + load(); +} + +// reload configuration reading it from kopeterc +void AutoReplaceConfig::load() +{ + KConfig *config = KGlobal::config(); + config->setGroup( "AutoReplace Plugin" ); + + QStringList wordsList = config->readListEntry( "WordsToReplace" ); + if( wordsList.isEmpty() ) + { + // basic list, key/value + // a list based on i18n should be provided, i.e. for italian + // "qsa,qualcosa,qno,qualcuno" remember UTF-8 accents + wordsList = defaultAutoReplaceList(); + } + + // we may be reloading after removing an entry from the list + m_map.clear(); + QString k, v; + for ( QStringList::Iterator it = wordsList.begin(); it != wordsList.end(); ++it ) + { + k = *it; + ++it; + if( it == wordsList.end() ) + break; + v = *it; + m_map.insert( k, v ); + } + + m_autoreplaceIncoming = config->readBoolEntry( "AutoReplaceIncoming" , false ); + m_autoreplaceOutgoing = config->readBoolEntry( "AutoReplaceOutgoing" , true ); + m_addDot = config->readBoolEntry( "DotEndSentence" , false ); + m_upper = config->readBoolEntry( "CapitalizeBeginningSentence" , false ); +} + +QStringList AutoReplaceConfig::defaultAutoReplaceList() +{ + return QStringList::split( ",", i18n( "list_of_words_to_replace", + "ur,your,r,are,u,you,theres,there is,arent,are not,dont,do not" ) ); +} + +void AutoReplaceConfig::loadDefaultAutoReplaceList() +{ + QStringList wordsList = defaultAutoReplaceList(); + m_map.clear(); + QString k, v; + for ( QStringList::Iterator it = wordsList.begin(); it != wordsList.end(); ++it ) + { + k = *it; + v = *( ++it ); + m_map.insert( k, v ); + } +} + + +bool AutoReplaceConfig::autoReplaceIncoming() const +{ + return m_autoreplaceIncoming; +} + +bool AutoReplaceConfig::autoReplaceOutgoing() const +{ + return m_autoreplaceOutgoing; +} + +bool AutoReplaceConfig::dotEndSentence() const +{ + return m_addDot; +} + +bool AutoReplaceConfig::capitalizeBeginningSentence() const +{ + return m_upper; +} + +void AutoReplaceConfig::setMap( const WordsToReplace &w ) +{ + m_map = w; +} + +AutoReplaceConfig::WordsToReplace AutoReplaceConfig::map() const +{ + return m_map; +} + +void AutoReplaceConfig::save() +{ + KConfig * config = KGlobal::config(); + config->setGroup( "AutoReplace Plugin" ); + + QStringList newWords; + WordsToReplace::Iterator it; + for ( it = m_map.begin(); it != m_map.end(); ++it ) + { + newWords.append( it.key() ); + newWords.append( it.data() ); + } + + config->writeEntry( "WordsToReplace", newWords ); + + config->sync(); +} + +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/kopete/plugins/autoreplace/autoreplaceconfig.h b/kopete/plugins/autoreplace/autoreplaceconfig.h new file mode 100644 index 00000000..62b11fbf --- /dev/null +++ b/kopete/plugins/autoreplace/autoreplaceconfig.h @@ -0,0 +1,58 @@ +/* + autoreplaceconfig.h + + Copyright (c) 2003 by Roberto Pariset + Copyright (c) 2003 by Martijn Klingens + + 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. * + * * + ************************************************************************* +*/ + +#include +#include +#include + +#ifndef AutoReplaceConfig_H +#define AutoReplaceConfig_H + +class AutoReplaceConfig +{ +public: + AutoReplaceConfig(); + + void save(); + void load(); + + typedef QMap WordsToReplace; + + WordsToReplace map() const; + bool autoReplaceIncoming() const; + bool autoReplaceOutgoing() const; + bool dotEndSentence() const; + bool capitalizeBeginningSentence() const; + + void setMap( const WordsToReplace &w ); + QStringList defaultAutoReplaceList(); + void loadDefaultAutoReplaceList(); + +private: + WordsToReplace m_map; + + bool m_autoreplaceIncoming; + bool m_autoreplaceOutgoing; + bool m_addDot; + bool m_upper; +}; + +#endif + +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/kopete/plugins/autoreplace/autoreplaceplugin.cpp b/kopete/plugins/autoreplace/autoreplaceplugin.cpp new file mode 100644 index 00000000..c06bc0bd --- /dev/null +++ b/kopete/plugins/autoreplace/autoreplaceplugin.cpp @@ -0,0 +1,128 @@ +/*************************************************************************** + autoreplaceplugin.cpp - description + ------------------- + begin : 20030425 + copyright : (C) 2003 by Roberto Pariset + email : victorheremita@fastwebnet.it + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include + +#include + +#include "kopetechatsessionmanager.h" +#include "kopetesimplemessagehandler.h" + +#include "autoreplaceplugin.h" +#include "autoreplaceconfig.h" + +typedef KGenericFactory AutoReplacePluginFactory; +K_EXPORT_COMPONENT_FACTORY( kopete_autoreplace, AutoReplacePluginFactory( "kopete_autoreplace" ) ) +AutoReplacePlugin * AutoReplacePlugin::pluginStatic_ = 0L; + +AutoReplacePlugin::AutoReplacePlugin( QObject *parent, const char * name, const QStringList & ) +: Kopete::Plugin( AutoReplacePluginFactory::instance(), parent, name ) +{ + if( !pluginStatic_ ) + pluginStatic_ = this; + + m_prefs = new AutoReplaceConfig; + + connect( Kopete::ChatSessionManager::self(), SIGNAL( aboutToSend( Kopete::Message & ) ), + this, SLOT( slotAboutToSend( Kopete::Message & ) ) ); + + // nb this connection causes the slot to be called on in- and outbound + // messages which suggests something is broken in the message handler + // system! + m_inboundHandler = new Kopete::SimpleMessageHandlerFactory( Kopete::Message::Inbound, + Kopete::MessageHandlerFactory::InStageToSent, this, SLOT( slotAboutToSend( Kopete::Message& ) ) ); + + connect( this, SIGNAL( settingsChanged() ), this, SLOT( slotSettingsChanged() ) ); +} + +AutoReplacePlugin::~AutoReplacePlugin() +{ + pluginStatic_ = 0L; + delete m_inboundHandler; + delete m_prefs; +} + +AutoReplacePlugin * AutoReplacePlugin::plugin() +{ + return pluginStatic_ ; +} + +void AutoReplacePlugin::slotSettingsChanged() +{ + m_prefs->load(); +} + +void AutoReplacePlugin::slotAboutToSend( Kopete::Message &msg ) +{ + if ( ( msg.direction() == Kopete::Message::Outbound && m_prefs->autoReplaceOutgoing() ) || + ( msg.direction() == Kopete::Message::Inbound && m_prefs->autoReplaceIncoming() ) ) + { + QString replaced_message = msg.plainBody(); + AutoReplaceConfig::WordsToReplace map = m_prefs->map(); + + // replaces all matched words --> try to find a more 'economic' way + // "\\b(%1)\\b" doesn't work when substituting /me. + QString match = "(^|\\s|\\.|\\;|\\,|\\:)(%1)(\\b)"; + AutoReplaceConfig::WordsToReplace::Iterator it; + bool isReplaced=false; + for ( it = map.begin(); it != map.end(); ++it ) + { + QRegExp re( match.arg( QRegExp::escape( it.key() ) ) ); + if( re.search( replaced_message ) != -1 ) + { + QString before = re.cap(1); + QString after = re.cap(3); + replaced_message.replace( re, before + map.find( it.key() ).data() + after ); + isReplaced=true; + } + } + + // the message is now the one with replaced words + if(isReplaced) + msg.setBody( replaced_message, Kopete::Message::PlainText ); + + if( msg.direction() == Kopete::Message::Outbound ) + { + if ( m_prefs->dotEndSentence() ) + { + QString replaced_message = msg.plainBody(); + // eventually add . at the end of the lines, sent lines only + replaced_message.replace( QRegExp( "([a-z])$" ), "\\1." ); + // replaced_message.replace(QRegExp( "([\\w])$" ), "\\1." ); + + // the message is now the one with replaced words + msg.setBody( replaced_message, Kopete::Message::PlainText ); + } + + if( m_prefs->capitalizeBeginningSentence() ) + { + QString replaced_message = msg.plainBody(); + // eventually start each sent line with capital letter + // TODO ". " "? " "! " + replaced_message[ 0 ] = replaced_message.at( 0 ).upper(); + + // the message is now the one with replaced words + msg.setBody( replaced_message, Kopete::Message::PlainText ); + } + } + } +} + +#include "autoreplaceplugin.moc" + +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/kopete/plugins/autoreplace/autoreplaceplugin.h b/kopete/plugins/autoreplace/autoreplaceplugin.h new file mode 100644 index 00000000..750f0614 --- /dev/null +++ b/kopete/plugins/autoreplace/autoreplaceplugin.h @@ -0,0 +1,63 @@ +/*************************************************************************** + autoreplaceplugin.h - description + ------------------- + begin : 20030425 + copyright : (C) 2003 by Roberto Pariset + email : victorheremita@fastwebnet.it + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 AutoReplacePLUGIN_H +#define AutoReplacePLUGIN_H + +#include +#include +#include +#include + +#include "kopetemessage.h" +#include "kopeteplugin.h" + +namespace Kopete { + class Message; + class MetaContact; + class ChatSession; + class SimpleMessageHandlerFactory; +} + +class AutoReplaceConfig; + +class AutoReplacePlugin : public Kopete::Plugin +{ + Q_OBJECT + +public: + static AutoReplacePlugin *plugin(); + + AutoReplacePlugin( QObject *parent, const char *name, const QStringList &args ); + ~AutoReplacePlugin(); + +private slots: + void slotAboutToSend( Kopete::Message &msg ); + + void slotSettingsChanged(); + +private: + static AutoReplacePlugin * pluginStatic_; + Kopete::SimpleMessageHandlerFactory *m_inboundHandler; + + AutoReplaceConfig *m_prefs; +}; + +#endif + +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/kopete/plugins/autoreplace/autoreplacepreferences.cpp b/kopete/plugins/autoreplace/autoreplacepreferences.cpp new file mode 100644 index 00000000..0a2a6b0f --- /dev/null +++ b/kopete/plugins/autoreplace/autoreplacepreferences.cpp @@ -0,0 +1,215 @@ +/*************************************************************************** + autoreplacepreferences.cpp - description + ------------------- + begin : 20030426 + copyright : (C) 2003 by Roberto Pariset + email : victorheremita@fastwebnet.it + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "autoreplaceprefs.h" +#include "autoreplacepreferences.h" +#include "autoreplaceconfig.h" + +typedef KGenericFactory AutoReplacePreferencesFactory; + +K_EXPORT_COMPONENT_FACTORY( kcm_kopete_autoreplace, AutoReplacePreferencesFactory( "kcm_kopete_autoreplace" ) ) + +AutoReplacePreferences::AutoReplacePreferences( QWidget *parent, const char * /* name */, const QStringList &args ) +: KCAutoConfigModule( AutoReplacePreferencesFactory::instance(), parent, args ) +{ + ( new QVBoxLayout( this ) )->setAutoAdd( true ); + preferencesDialog = new AutoReplacePrefsUI( this ); + + // creates table columns (avoids new columns every time) + preferencesDialog->m_list->addColumn( i18n("Text" ) ); + preferencesDialog->m_list->addColumn( i18n("Replacement" ) ); + preferencesDialog->m_list->header()->setStretchEnabled( true , 1 ); + + // connect SIGNALS/SLOTS + connect( preferencesDialog->m_add, SIGNAL(pressed()), + SLOT( slotAddCouple()) ); + connect( preferencesDialog->m_edit, SIGNAL(pressed()), + SLOT( slotEditCouple()) ); + connect( preferencesDialog->m_remove, SIGNAL(pressed()), + SLOT(slotRemoveCouple()) ); + connect( preferencesDialog->m_list, SIGNAL(selectionChanged()), + SLOT(slotSelectionChanged()) ); + connect( preferencesDialog->m_key, SIGNAL(textChanged ( const QString & )), + SLOT( slotEnableAddEdit( const QString & )) ); + + m_wordListChanged = false; + + // Sentence options and which messages to apply autoreplace to + // are managed by KCMAutoConfigModule. The list of replacements + // itself is manually read/written as KCMAutoConfigModule doesn't support it. + autoConfig()->ignoreSubWidget( preferencesDialog->replacementsGroup ); + setMainWidget( preferencesDialog, "AutoReplace Plugin" ); + + m_config = new AutoReplaceConfig; + load(); +} + +AutoReplacePreferences::~AutoReplacePreferences() +{ + delete m_config; +} + +// reload configuration reading it from kopeterc +void AutoReplacePreferences::load() +{ + m_config->load(); + + // Removes and deletes all the items in this list view and triggers an update + preferencesDialog->m_list->clear(); + + // show keys/values on gui + AutoReplaceConfig::WordsToReplace::Iterator it; + AutoReplaceConfig::WordsToReplace map = m_config->map(); + for ( it = map.begin(); it != map.end(); ++it ) + { + // notice: insertItem is called automatically by the constructor + new QListViewItem( preferencesDialog->m_list, it.key(), it.data() ); + } + + m_wordListChanged = false; + KCAutoConfigModule::load(); +} + +// save list to kopeterc and creates map out of it +void AutoReplacePreferences::save() +{ + // make a list reading all values from gui + AutoReplaceConfig::WordsToReplace newWords; + for ( QListViewItem * i = preferencesDialog->m_list->firstChild(); i != 0; i = i->nextSibling() ) + newWords[ i->text( 0 ) ] = i->text( 1 ); + + // save the words list + m_config->setMap( newWords ); + m_config->save(); + + m_wordListChanged = false; + KCAutoConfigModule::save(); +} + +// read m_key m_value, create a QListViewItem +void AutoReplacePreferences::slotAddCouple() +{ + QString k = preferencesDialog->m_key->text(); + QString v = preferencesDialog->m_value->text(); + if ( !k.isEmpty() && !k.isNull() && !v.isEmpty() && !v.isNull() ) + { + QListViewItem * lvi; + QListViewItem * oldLvi = 0; + // see if we are replacing an existing entry + if ( ( oldLvi = preferencesDialog->m_list->findItem( k, 0 ) ) ) + delete oldLvi; + lvi = new QListViewItem( preferencesDialog->m_list, k, v ); + // Triggers a size, geometry and content update + // during the next iteration of the event loop + preferencesDialog->m_list->triggerUpdate(); + // select last added + preferencesDialog->m_list->setSelected( lvi, true ); + } + + m_wordListChanged = true; + slotWidgetModified(); +} + +// edit the selected item +void AutoReplacePreferences::slotEditCouple() +{ + QString k = preferencesDialog->m_key->text(); + QString v = preferencesDialog->m_value->text(); + QListViewItem * lvi; + if ( ( lvi = preferencesDialog->m_list->selectedItem() ) && !k.isEmpty() && !k.isNull() && !v.isEmpty() && !v.isNull() ) + { + lvi->setText( 0, k ); + lvi->setText( 1, v ); + preferencesDialog->m_list->triggerUpdate(); + m_wordListChanged = true; + slotWidgetModified(); + } +} + +// Returns a pointer to the selected item if the list view is in +// Single selection mode and an item is selected +void AutoReplacePreferences::slotRemoveCouple() +{ + delete preferencesDialog->m_list->selectedItem(); + + m_wordListChanged = true; + slotWidgetModified(); +} + +void AutoReplacePreferences::slotEnableAddEdit( const QString & keyText ) +{ + preferencesDialog->m_add->setEnabled( !keyText.isEmpty() ); + preferencesDialog->m_edit->setEnabled( !keyText.isEmpty() && preferencesDialog->m_list->selectedItem() ); +} + +void AutoReplacePreferences::slotSelectionChanged() +{ + QListViewItem *selection = 0; + if ( ( selection = preferencesDialog->m_list->selectedItem() ) ) + { + // enable the remove button + preferencesDialog->m_remove->setEnabled( true ); + // put the selection contents into the text entry widgets so they can be edited + preferencesDialog->m_key->setText( selection->text( 0 ) ); + preferencesDialog->m_value->setText( selection->text( 1 ) ); + } + else + { + preferencesDialog->m_remove->setEnabled( false ); + preferencesDialog->m_key->clear(); + preferencesDialog->m_value->clear(); + } +} + +void AutoReplacePreferences::slotWidgetModified() +{ + emit KCModule::changed( m_wordListChanged || autoConfig()->hasChanged() ); +} + +void AutoReplacePreferences::defaults() +{ + KCAutoConfigModule::defaults(); + preferencesDialog->m_list->clear(); + m_config->loadDefaultAutoReplaceList(); + AutoReplaceConfig::WordsToReplace::Iterator it; + AutoReplaceConfig::WordsToReplace map = m_config->map(); + for ( it = map.begin(); it != map.end(); ++it ) + { + // notice: insertItem is called automatically by the constructor + new QListViewItem( preferencesDialog->m_list, it.key(), it.data() ); + } + m_wordListChanged = true; + slotWidgetModified(); +} + +#include "autoreplacepreferences.moc" + +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/kopete/plugins/autoreplace/autoreplacepreferences.h b/kopete/plugins/autoreplace/autoreplacepreferences.h new file mode 100644 index 00000000..a08b2ba2 --- /dev/null +++ b/kopete/plugins/autoreplace/autoreplacepreferences.h @@ -0,0 +1,64 @@ +/*************************************************************************** + autoreplacepreferences.h - description + ------------------- + begin : 20030426 + copyright : (C) 2003 by Roberto Pariset + email : victorheremita@fastwebnet.it + ***************************************************************************/ + +/*************************************************************************** + * * + * 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 AutoReplacePREFERENCES_H +#define AutoReplacePREFERENCES_H + +#include "kcautoconfigmodule.h" + +class AutoReplacePrefsUI; +class AutoReplaceConfig; + + // TODO + // add button enabled only when k and v are present + // remove button enabled only when a QListViewItem is selected + // signal/slot when map changes (needed?) + // capital letter not just at the beginning but always after ". ", "! "... + +class AutoReplacePreferences : public KCAutoConfigModule +{ + Q_OBJECT + +public: + AutoReplacePreferences( QWidget *parent = 0, const char *name = 0, const QStringList &args = QStringList() ); + ~AutoReplacePreferences(); + + virtual void save(); + virtual void load(); + virtual void defaults(); + +private slots: + //void slotSettingsDirty(); + void slotAddCouple(); + void slotEditCouple(); + void slotRemoveCouple(); + void slotEnableAddEdit( const QString & ); + void slotSelectionChanged(); + +protected slots: + virtual void slotWidgetModified(); +private: + AutoReplacePrefsUI * preferencesDialog; + AutoReplaceConfig *m_config; + + bool m_wordListChanged; +}; + +#endif + +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/kopete/plugins/autoreplace/autoreplaceprefs.ui b/kopete/plugins/autoreplace/autoreplaceprefs.ui new file mode 100644 index 00000000..09db8e9d --- /dev/null +++ b/kopete/plugins/autoreplace/autoreplaceprefs.ui @@ -0,0 +1,219 @@ + +AutoReplacePrefsUI +Roberto Pariset + + + AutoReplacePrefsUI + + + + 0 + 0 + 458 + 378 + + + + + unnamed + + + + gb_sentences + + + Sentence Options + + + + unnamed + + + + DotEndSentence + + + Add a dot at the end of each sent line + + + + + CapitalizeBeginningSentence + + + Start each sent line with a capital letter + + + + + + + gb_options + + + Replacement Options + + + + unnamed + + + + AutoReplaceIncoming + + + Auto replace on incoming messages + + + + + AutoReplaceOutgoing + + + Auto replace on outgoing messages + + + true + + + + + + + replacementsGroup + + + Replacements List + + + + unnamed + + + + layout5 + + + + unnamed + + + + m_add + + + true + + + &Add + + + false + + + + + m_edit + + + false + + + &Edit + + + false + + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 40 + + + + + + m_remove + + + false + + + &Remove + + + + + + + layout1 + + + + unnamed + + + + textLabel1 + + + Te&xt: + + + m_key + + + + + m_key + + + + + textLabel2 + + + Re&placement: + + + m_value + + + + + m_value + + + + + + + m_list + + + Single + + + true + + + true + + + + + + + + diff --git a/kopete/plugins/autoreplace/icons/Makefile.am b/kopete/plugins/autoreplace/icons/Makefile.am new file mode 100644 index 00000000..224eb420 --- /dev/null +++ b/kopete/plugins/autoreplace/icons/Makefile.am @@ -0,0 +1,3 @@ +kopeteicondir = $(kde_datadir)/kopete/icons +kopeteicon_ICON = AUTO + diff --git a/kopete/plugins/autoreplace/icons/cr32-app-autoreplace.png b/kopete/plugins/autoreplace/icons/cr32-app-autoreplace.png new file mode 100644 index 00000000..71f1fa32 Binary files /dev/null and b/kopete/plugins/autoreplace/icons/cr32-app-autoreplace.png differ diff --git a/kopete/plugins/autoreplace/kopete_autoreplace.desktop b/kopete/plugins/autoreplace/kopete_autoreplace.desktop new file mode 100644 index 00000000..7189fdc2 --- /dev/null +++ b/kopete/plugins/autoreplace/kopete_autoreplace.desktop @@ -0,0 +1,128 @@ +[Desktop Entry] +Type=Service +X-Kopete-Version=1000900 +Icon=autoreplace +ServiceTypes=Kopete/Plugin +X-KDE-Library=kopete_autoreplace +X-KDE-PluginInfo-Author=Roberto Pariset +X-KDE-PluginInfo-Email=victorheremita@fastwebnet.it +X-KDE-PluginInfo-Name=kopete_autoreplace +X-KDE-PluginInfo-Version=0.8.0 +X-KDE-PluginInfo-Website=http://kopete.kde.org +X-KDE-PluginInfo-Category=Plugins +X-KDE-PluginInfo-Depends= +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=false +Name=Auto Replace +Name[ar]=الاستبدال التلقائي +Name[be]=Аўтаматычная замена +Name[bg]=Автоматична замяна +Name[bn]=স্বয়ংক্রীয় প্রতিস্থাপন +Name[bs]=Auto zamjena +Name[ca]=Auto-substitució +Name[cs]=Automatické nahrazení +Name[cy]=Hunan-Amnewid +Name[da]=Auto-erstat +Name[de]=Automatische Ersetzung +Name[el]=Αυτόματη αντικατάσταση +Name[eo]=Aŭtomata anstataŭigo +Name[es]=Auto reemplazar +Name[et]=Automaatne asendamine +Name[eu]=Auto ordezkatu +Name[fa]=جایگزینی خودکار +Name[fi]=Automaattinen korvaus +Name[fr]=Remplacement automatique +Name[gl]=Auto-reemplazo +Name[he]=החלפה אוטומטית +Name[hi]=स्वचलित बदलें +Name[hr]=Automatska zamijena +Name[hu]=Automatikus szövegcsere +Name[is]=Skipta sjálfkrafa út +Name[it]=Sostituisci automaticamente +Name[ja]=自動置換 +Name[ka]=ავტო ჩანაცვლება +Name[kk]=Авто алмастыру +Name[km]=ជំនួស​ស្វ័យប្រវត្តិ +Name[lt]=Automatinis keitimas +Name[mk]=Автоматска замена +Name[nb]=Automatisk utskifting +Name[nds]=Automaatsch utwesseln +Name[ne]=स्वत: प्रतिस्थापन +Name[nl]=Automatisch vervangen +Name[nn]=Automatisk utbyting +Name[pa]=ਆਟੋ ਤਬਦੀਲ +Name[pl]=Automatyczne zastępowanie +Name[pt]=Substituição Automática +Name[pt_BR]=Substituição Automática +Name[ro]=Înlocuire automată +Name[ru]=Автозамена +Name[se]=Auto-buhtte +Name[sk]=Automatické náhrady +Name[sl]=Samo-zamenjava +Name[sr]=Аутоматска замена +Name[sr@Latn]=Automatska zamena +Name[sv]=Ersätt automatiskt +Name[ta]=தன்னியக்க மாற்றி +Name[tg]=Ҷойивазкунии Худкор +Name[tr]=Otomatik Değiştir +Name[uk]=Автоматична заміна +Name[uz]=Avto-almashtirish +Name[uz@cyrillic]=Авто-алмаштириш +Name[wa]=Replaecî otomaticmint +Name[zh_CN]=自动替换 +Name[zh_HK]=自動取代 +Name[zh_TW]=自動取代 +Comment=Auto replaces some text you can choose +Comment[ar]=يقوم بتغيير تلفائي للنصوص التي يمكن اختيارها +Comment[be]=Аўтаматычная замена тэксту +Comment[bg]=Приставка за автоматична замяна на текст в съобщенията +Comment[bn]=স্বয়ংক্রীয়ভাবে প্রতিস্থাপন করে কিছু টেক্সট যা আপনি বেছে নিতে পারেন +Comment[bs]=Automatski zamjenjuje neki tekst koji izaberete +Comment[ca]=Auto-substitueix algun text que podreu escollir +Comment[cs]=Automaticky nahrazuje zvolený text +Comment[cy]=Hunan-amnewid testun y gallwch ei ddewis +Comment[da]=Autoerstatter noget tekst du kan vælge +Comment[de]=Ersetzt wählbare Texte automatisch +Comment[el]=Αντικαθιστά αυτόματα κάποιο κείμενο που επιλέγετε +Comment[es]=Autoreemplaza texto que puede elegir +Comment[et]=Asendab automaatselt sinu valitud teksti +Comment[eu]=Hautatu dezakezun testua auto ordezten du +Comment[fa]=بعضی از متنها را که می‌توانید انتخاب کنید، به طور خودکار جایگزین می‌کند +Comment[fi]=Korvaa valitsemasi tekstit automaattisesti +Comment[fr]=Remplace automatiquement du texte que vous pouvez choisir +Comment[gl]=Reemplaza automáticamente algún texto que tí podes escoller +Comment[he]=מחליף אוטומטית טקסט לבחירתך +Comment[hi]=कुछ पाठ जिन्हें आप चुन सकते हैं, स्वचलित बदलें +Comment[hr]=Automatska zamjena teksta kojeg odaberete +Comment[hu]=A beállított szövegeket automatikusan lecseréli +Comment[is]=Skiptir sjálfkrafa út þeim texta sem þú velur +Comment[it]=Sostituisci automaticamente del testo a scelta +Comment[ja]=選択したテキストを自動置換 +Comment[ka]=არჩეული ტექსტის ავტო ჩანაცვლება +Comment[kk]=Таңдаған мәтінді автоматты түрде алмастыру +Comment[km]=ជំនួស​អត្ថបទ​ដែល​អ្នក​អាច​ជ្រើស ដោយ​ស្វ័យប្រវត្តិ +Comment[lt]=Automatiškai keičia parinktą tekstą +Comment[mk]=Автоматска замена на некој текст што го избирате +Comment[nb]=Skift ut en valgt tekst automatisk +Comment[nds]=Wesselt automaatsch wat instellbor Text ut +Comment[ne]=स्वत: प्रतिस्थापन हुने केही पाठ तपाईँले रोज्न सक्नुहुन्छ +Comment[nl]=Vervangt automatisch tekst die u kunt instellen +Comment[nn]=Skift ut ein vald tekst automatisk +Comment[pl]=Automatycznie zastępuje określony tekst +Comment[pt]=Substitui automaticamente algum texto seleccionado por si +Comment[pt_BR]=Substitui automaticamente o texto que você escolher +Comment[ru]=Автоматически заменяет текст, который вы вводите +Comment[se]=Automáhtalaččat buhtte teavstta maid válljet +Comment[sk]=Automaticky nahradzuje text, ktorý si vyberiete +Comment[sl]=Samodejno zamenja besedilo, ki ga lahko izberete +Comment[sr]=Аутоматска замена неког текста који одаберете +Comment[sr@Latn]=Automatska zamena nekog teksta koji odaberete +Comment[sv]=Ersätt automatiskt text du kan markera +Comment[ta]=நீங்கள் தேர்வு செய்த உரையை தானாக மாற்றவும் +Comment[tg]=Матни интихобкардаи шуморо ба таври худкор иваз мекунад +Comment[tr]=Seçilen bazı metinler otomatik değiştirilir +Comment[uk]=Автоматично заміняє текст, який ви вкажете +Comment[zh_CN]=自动替换您可选择的某些文字 +Comment[zh_HK]=自動取代可選擇的文字 +Comment[zh_TW]=自動取代您所選擇的文字 + diff --git a/kopete/plugins/autoreplace/kopete_autoreplace_config.desktop b/kopete/plugins/autoreplace/kopete_autoreplace_config.desktop new file mode 100644 index 00000000..4efc1abd --- /dev/null +++ b/kopete/plugins/autoreplace/kopete_autoreplace_config.desktop @@ -0,0 +1,124 @@ +[Desktop Entry] +Icon=color +Type=Service +ServiceTypes=KCModule + +X-KDE-ModuleType=Library +X-KDE-Library=kopete_autoreplace +X-KDE-FactoryName=AutoReplaceConfigFactory +X-KDE-ParentApp=kopete_autoreplace +X-KDE-ParentComponents=kopete_autoreplace + +Name=Auto Replace +Name[ar]=الاستبدال التلقائي +Name[be]=Аўтаматычная замена +Name[bg]=Автоматична замяна +Name[bn]=স্বয়ংক্রীয় প্রতিস্থাপন +Name[bs]=Auto zamjena +Name[ca]=Auto-substitució +Name[cs]=Automatické nahrazení +Name[cy]=Hunan-Amnewid +Name[da]=Auto-erstat +Name[de]=Automatische Ersetzung +Name[el]=Αυτόματη αντικατάσταση +Name[eo]=Aŭtomata anstataŭigo +Name[es]=Auto reemplazar +Name[et]=Automaatne asendamine +Name[eu]=Auto ordezkatu +Name[fa]=جایگزینی خودکار +Name[fi]=Automaattinen korvaus +Name[fr]=Remplacement automatique +Name[gl]=Auto-reemplazo +Name[he]=החלפה אוטומטית +Name[hi]=स्वचलित बदलें +Name[hr]=Automatska zamijena +Name[hu]=Automatikus szövegcsere +Name[is]=Skipta sjálfkrafa út +Name[it]=Sostituisci automaticamente +Name[ja]=自動置換 +Name[ka]=ავტო ჩანაცვლება +Name[kk]=Авто алмастыру +Name[km]=ជំនួស​ស្វ័យប្រវត្តិ +Name[lt]=Automatinis keitimas +Name[mk]=Автоматска замена +Name[nb]=Automatisk utskifting +Name[nds]=Automaatsch utwesseln +Name[ne]=स्वत: प्रतिस्थापन +Name[nl]=Automatisch vervangen +Name[nn]=Automatisk utbyting +Name[pa]=ਆਟੋ ਤਬਦੀਲ +Name[pl]=Automatyczne zastępowanie +Name[pt]=Substituição Automática +Name[pt_BR]=Substituição Automática +Name[ro]=Înlocuire automată +Name[ru]=Автозамена +Name[se]=Auto-buhtte +Name[sk]=Automatické náhrady +Name[sl]=Samo-zamenjava +Name[sr]=Аутоматска замена +Name[sr@Latn]=Automatska zamena +Name[sv]=Ersätt automatiskt +Name[ta]=தன்னியக்க மாற்றி +Name[tg]=Ҷойивазкунии Худкор +Name[tr]=Otomatik Değiştir +Name[uk]=Автоматична заміна +Name[uz]=Avto-almashtirish +Name[uz@cyrillic]=Авто-алмаштириш +Name[wa]=Replaecî otomaticmint +Name[zh_CN]=自动替换 +Name[zh_HK]=自動取代 +Name[zh_TW]=自動取代 +Comment=Autoreplaces some text you can choose +Comment[ar]=تقوم بتغييرتلقائي لبعض النصوص التي يمكنك الاختيار منها +Comment[be]=Аўтаматычная замена тэксту +Comment[bg]=Приставка за автоматична замяна на текст в съобщенията +Comment[bn]=স্বয়ংক্রীয়ভাবে প্রতিস্থাপন করে কিছু টেক্সট যা আপনি বেছে নিতে পারেন +Comment[bs]=Automatski zamjenjuje neki tekst koji izaberete +Comment[ca]=Auto-substitueix algun text que podreu escollir +Comment[cs]=Automaticky nahrazuje zvolený text +Comment[cy]=Hunan-amnewid testun y gallwch ei ddewis +Comment[da]=Autoerstatter noget tekst du kan vælge +Comment[de]=Ersetzt wählbare Texte automatisch +Comment[el]=Αντικαθιστά αυτόματα κάποιο κείμενο που επιλέγετε +Comment[es]=Autoreemplaza texto que puede elegir +Comment[et]=Asendab automaatselt sinu valitud teksti +Comment[eu]=Hautatu dezakezun testua auto ordezten du +Comment[fa]=بعضی از متنها را که می‌توانید انتخاب کنید، به طور خودکار جایگزین می‌کند +Comment[fi]=Korvaa valitsemasi tekstit automaattisesti +Comment[fr]=Remplace automatiquement du texte que vous pouvez choisir +Comment[gl]=Reemplaza algún texto que podes escoller +Comment[he]=מחליף אוטומטית טקסט לבחירתך +Comment[hi]=कुछ पाठ जिन्हें आप चुन सकते हैं, स्वचलित बदलें +Comment[hr]=Automatska zamjena teksta kojeg odaberete +Comment[hu]=A kiválasztott szövegeket automatikusan lecseréli +Comment[is]=Skiptir sjálfkrafa út þeim texta sem þú velur +Comment[it]=Sostituisci automaticamente del testo a scelta +Comment[ja]=選択したテキストを自動置換 +Comment[ka]=არჩეული ტექსტის ავტო ჩანაცვლება +Comment[kk]=Таңдаған мәтінді автоматты түрде алмастыру +Comment[km]=ជំនួស​អត្ថបទ​ដែល​អ្នក​អាច​ជ្រើស ដោយ​ស្វ័យប្រវត្តិ +Comment[lt]=Automatiškai keičia parinktą tekstą +Comment[mk]=Автоматска замена на некој текст што го избирате +Comment[nb]=Skift ut en valgt tekst automatisk +Comment[nds]=Wesselt automaatsch wat instellbor Text ut +Comment[ne]=स्वत: प्रतिस्थापन हुने केही पाठ तपाईँले रोज्न सक्नुहुन्छ +Comment[nl]=Vervangt automatisch tekst die u kunt instellen +Comment[nn]=Byter ut ein vald tekst automatisk +Comment[pl]=Automatycznie zastępuje określony tekst +Comment[pt]=Substitui automaticamente algum texto seleccionado por si +Comment[pt_BR]=Substitui automaticamente o texto que você escolher +Comment[ru]=Автоматически заменяет выбранный вами текст +Comment[se]=Buhtte válljejuvvon teavstta automáhtalaš +Comment[sk]=Automaticky nahradzuje text, ktorý si vyberiete +Comment[sl]=Samodejno zamenja besedilo, ki ga lahko izberete +Comment[sr]=Аутоматска замена неког текста који одаберете +Comment[sr@Latn]=Automatska zamena nekog teksta koji odaberete +Comment[sv]=Ersätt automatiskt text du kan markera +Comment[ta]=நீங்கள் தேர்வு செய்த உரையை தானாக மாற்றவும் +Comment[tg]=Матни интихобкардаи шуморо ба таври худкор иваз мекунад +Comment[tr]=Seçilen bazı metinler otomatik değiştirilir +Comment[uk]=Автоматично заміняє текст, який ви вкажете +Comment[zh_CN]=自动替换您可选择的某些文字 +Comment[zh_HK]=自動取代可選擇的文字 +Comment[zh_TW]=自動取代您所選擇的文字 + -- cgit v1.2.1