summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/addbookmarks
diff options
context:
space:
mode:
Diffstat (limited to 'kopete/plugins/addbookmarks')
-rw-r--r--kopete/plugins/addbookmarks/Makefile.am22
-rw-r--r--kopete/plugins/addbookmarks/addbookmarksplugin.cpp194
-rw-r--r--kopete/plugins/addbookmarks/addbookmarksplugin.h56
-rw-r--r--kopete/plugins/addbookmarks/addbookmarkspreferences.cpp114
-rw-r--r--kopete/plugins/addbookmarks/addbookmarkspreferences.h45
-rw-r--r--kopete/plugins/addbookmarks/addbookmarksprefssettings.cpp87
-rw-r--r--kopete/plugins/addbookmarks/addbookmarksprefssettings.h49
-rw-r--r--kopete/plugins/addbookmarks/addbookmarksprefsui.ui104
-rw-r--r--kopete/plugins/addbookmarks/kopete_addbookmarks.desktop126
-rw-r--r--kopete/plugins/addbookmarks/kopete_addbookmarks_config.desktop121
10 files changed, 918 insertions, 0 deletions
diff --git a/kopete/plugins/addbookmarks/Makefile.am b/kopete/plugins/addbookmarks/Makefile.am
new file mode 100644
index 00000000..696ddfb9
--- /dev/null
+++ b/kopete/plugins/addbookmarks/Makefile.am
@@ -0,0 +1,22 @@
+METASOURCES = AUTO
+AM_CPPFLAGS = $(KOPETE_INCLUDES) $(all_includes)
+
+noinst_HEADERS = addbookmarksplugin.h addbookmarkspreferences.h \
+ addbookmarksprefssettings.h addbookmarksprefsui.h
+
+kde_module_LTLIBRARIES = kopete_addbookmarks.la kcm_kopete_addbookmarks.la
+
+kopete_addbookmarks_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) $(all_libraries)
+kopete_addbookmarks_la_LIBADD = ../../libkopete/libkopete.la
+kopete_addbookmarks_la_SOURCES = addbookmarksplugin.cpp addbookmarksprefssettings.cpp
+
+kcm_kopete_addbookmarks_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) $(all_libraries)
+kcm_kopete_addbookmarks_la_LIBADD = ../../libkopete/libkopete.la $(LIB_KUTILS)
+kcm_kopete_addbookmarks_la_SOURCES = addbookmarkspreferences.cpp addbookmarksprefsui.ui \
+ addbookmarksprefssettings.cpp
+
+service_DATA = kopete_addbookmarks.desktop
+servicedir = $(kde_servicesdir)
+
+kcm_DATA = kopete_addbookmarks_config.desktop
+kcmdir = $(kde_servicesdir)/kconfiguredialog
diff --git a/kopete/plugins/addbookmarks/addbookmarksplugin.cpp b/kopete/plugins/addbookmarks/addbookmarksplugin.cpp
new file mode 100644
index 00000000..fae164f1
--- /dev/null
+++ b/kopete/plugins/addbookmarks/addbookmarksplugin.cpp
@@ -0,0 +1,194 @@
+//
+// C++ Implementation: %{MODULE}
+//
+// Description:
+//
+//
+// Author: Roie Kerstein <[email protected]>, (C) 2004
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+
+#include <kdebug.h>
+#include <kbookmark.h>
+#include <qvariant.h>
+#include <qtextcodec.h>
+#include <qregexp.h>
+
+#include "addbookmarksplugin.moc"
+#include "addbookmarksplugin.h"
+#include "kopetecontact.h"
+#include "kopetechatsessionmanager.h"
+#include "kopeteglobal.h"
+#include "kopetemetacontact.h"
+
+
+K_EXPORT_COMPONENT_FACTORY( kopete_addbookmarks, BookmarksPluginFactory( "kopete_addbookmarks" ) )
+
+
+static bool isURLInGroup(const KURL& url, const KBookmarkGroup& group)
+{
+ KBookmark bookmark = group.first();
+
+ for( ; !bookmark.isNull() ; bookmark = group.next(bookmark) ){
+ if( !bookmark.isGroup() && !bookmark.isSeparator() )
+ if( url == bookmark.url() )
+ return true;
+ }
+ return false;
+}
+
+BookmarksPlugin::BookmarksPlugin(QObject *parent, const char *name, const QStringList &/*args*/)
+ : Kopete::Plugin(BookmarksPluginFactory::instance(), parent, name)
+{
+ //kdDebug(14501) << "plugin loading" << endl;
+ connect( Kopete::ChatSessionManager::self(), SIGNAL( aboutToDisplay( Kopete::Message & ) ), this, SLOT( slotBookmarkURLsInMessage( Kopete::Message & ) ) );
+}
+
+/*!
+ \fn BookmarksPlugin::slotBookmarkURLsInMessage(KopeteMessage & msg)
+ */
+void BookmarksPlugin::slotBookmarkURLsInMessage(Kopete::Message & msg)
+{
+ //kdDebug(14501) << "recieved message:" << endl << msg.parsedBody() << endl;
+ if(msg.direction() != Kopete::Message::Inbound)
+ return;
+ KURL::List *URLsList;
+ KURL::List::iterator it;
+ URLsList = extractURLsFromString( msg.parsedBody() );
+ if (!URLsList->empty()) {
+ for( it = URLsList->begin() ; it != URLsList->end() ; ++it){
+ if ( m_settings.addBookmarksFromUnknownContacts() || !msg.from()->metaContact()->isTemporary() )
+ {
+ if ( msg.from()->metaContact() ) {
+ addKopeteBookmark(*it, msg.from()->metaContact()->displayName() );
+ //kdDebug (14501) << "name:" << msg.from()->metaContact()->displayName() << endl;
+ }
+ else {
+ addKopeteBookmark(*it, msg.from()->property(Kopete::Global::Properties::self()->nickName()).value().toString() );
+ //kdDebug (14501) << "name:" << msg.from()->property(Kopete::Global::Properties::self()->nickName()).value().toString() << endl;
+ }
+ }
+ }
+ }
+ delete URLsList;
+}
+
+void BookmarksPlugin::slotAddKopeteBookmark( KIO::Job *transfer, const QByteArray &data )
+{
+ QTextCodec *codec = getPageEncoding( data );
+ QString htmlpage = codec->toUnicode( data );
+ QRegExp rx("<title>([^<]*){1,96}</title>");
+ rx.setCaseSensitive(false);
+ int pos = rx.search( htmlpage );
+ KBookmarkManager *mgr = KBookmarkManager::userBookmarksManager();
+ KBookmarkGroup group = getKopeteFolder();
+ QString sender = m_map[(KIO::TransferJob*)transfer].sender;
+
+ if ( m_settings.useSubfolderForContact( sender ) )
+ group = getFolder( group, sender );
+
+ if( pos == -1 ){
+ group.addBookmark( mgr, m_map[(KIO::TransferJob*)transfer].url.prettyURL(), m_map[(KIO::TransferJob*)transfer].url.url() );
+ kdDebug( 14501 ) << "failed to extract title from first data chunk" << endl;
+ }else {
+ group.addBookmark( mgr, rx.cap( 1 ).simplifyWhiteSpace(),
+ m_map[(KIO::TransferJob*)transfer].url.url() );
+ }
+ mgr->save();
+ mgr->emitChanged( group );
+ m_map.remove( (KIO::TransferJob*)transfer );
+ transfer->kill();
+}
+
+KURL::List* BookmarksPlugin::extractURLsFromString( const QString& text )
+{
+ KURL::List *list = new KURL::List;
+ QRegExp rx("<a href=\"[^\\s\"]+\"");
+ int pos=0;
+ KURL url;
+
+ for(; (pos=rx.search(text, pos))!=-1; pos+=rx.matchedLength()){
+ //as long as there is a matching URL in text
+ url = text.mid(pos+9, rx.matchedLength()-10);
+ // assuming that in formatted messages links appear as <a href="link"
+ if(url.isValid())
+ list->append(url);
+ }
+ return list;
+}
+
+void BookmarksPlugin::addKopeteBookmark( const KURL& url, const QString& sender )
+{
+ KBookmarkGroup group = getKopeteFolder();
+
+ if ( m_settings.useSubfolderForContact( sender ) ) {
+ group = getFolder( group, sender );
+ }
+ // either restrict to http(s) or to KProtocolInfo::protocolClass() == :internet
+ if( !isURLInGroup( url, group )
+ && url.isValid() && url.protocol().startsWith("http") ) {
+ KIO::TransferJob *transfer;
+ // make asynchronous transfer to avoid GUI freezing due to overloaded web servers
+ transfer = KIO::get(url, false, false);
+ transfer->setInteractive(false);
+ connect ( transfer, SIGNAL ( data( KIO::Job *, const QByteArray & ) ),
+ this, SLOT ( slotAddKopeteBookmark( KIO::Job *, const QByteArray & ) ) );
+ m_map[transfer].url = url;
+ m_map[transfer].sender = sender;
+ }
+}
+
+KBookmarkGroup BookmarksPlugin::getKopeteFolder()
+{
+ KBookmarkManager *mgr = KBookmarkManager::userBookmarksManager();
+
+ return getFolder( mgr->root(), QString::fromLatin1("kopete") );
+}
+
+KBookmarkGroup BookmarksPlugin::getFolder( KBookmarkGroup group, const QString& folder )
+{
+ KBookmark bookmark;
+
+
+ for( bookmark=group.first(); !bookmark.isNull() && !(bookmark.isGroup() && !bookmark.fullText().compare( folder )); bookmark = group.next(bookmark));
+ if( bookmark.isNull() ){
+ KBookmarkManager *mgr = KBookmarkManager::userBookmarksManager();
+ //kdDebug (14501) << "GetFolder:" << folder << endl;
+ group = group.createNewFolder( mgr, folder, true);
+ }else {
+ group = bookmark.toGroup();
+ }
+ return group;
+}
+
+QTextCodec* BookmarksPlugin::getPageEncoding( const QByteArray& data )
+{
+ QString temp = QString::fromLatin1(data);
+ QRegExp rx("<meta[^>]*(charset|CHARSET)\\s*=\\s*[^>]*>");
+ int pos = rx.search( temp );
+ QTextCodec *codec;
+
+ if( pos == -1 ){
+ kdDebug( 14501 ) << "charset not found in first data chunk" << endl;
+ return QTextCodec::codecForName("iso8859-1");
+ }
+ //kdDebug(14501) << temp.mid(pos, rx.matchedLength()) << endl;
+ temp = temp.mid(pos, rx.matchedLength()-1);
+ temp = temp.mid( temp.find("charset", 0, false)+7);
+ temp = temp.remove('=').simplifyWhiteSpace();
+ for( pos = 0 ; temp[pos].isLetterOrNumber() || temp[pos] == '-' ; pos++ );
+ temp = temp.left( pos );
+ //kdDebug(14501) << "encoding: " << temp << endl;
+ codec = QTextCodec::codecForName( temp.latin1() );
+ if( !codec ){
+ return QTextCodec::codecForName("iso8859-1");
+ }
+ return codec;
+}
+
+void BookmarksPlugin::slotReloadSettings()
+{
+ m_settings.load();
+}
diff --git a/kopete/plugins/addbookmarks/addbookmarksplugin.h b/kopete/plugins/addbookmarks/addbookmarksplugin.h
new file mode 100644
index 00000000..4c425b9f
--- /dev/null
+++ b/kopete/plugins/addbookmarks/addbookmarksplugin.h
@@ -0,0 +1,56 @@
+//
+// C++ Interface: %{MODULE}
+//
+// Description:
+//
+//
+// Author: Roie Kerstein <[email protected]>, (C) 2004
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef ADDBOOKMARKSPLUGIN_H
+#define ADDBOOKMARKSPLUGIN_H
+
+#include "addbookmarksprefssettings.h"
+#include <kgenericfactory.h>
+#include <kopeteplugin.h>
+#include <kbookmarkmanager.h>
+#include <kio/job.h>
+#include <qcstring.h>
+#include <qmap.h>
+
+/**
+@author Roie Kerstein <[email protected]>
+*/
+
+class BookmarksPlugin : public Kopete::Plugin
+{
+Q_OBJECT
+public:
+ BookmarksPlugin(QObject *parent, const char *name, const QStringList &args);
+
+private:
+ typedef struct S_URLANDNAME{
+ KURL url;
+ QString sender;
+ } URLandName;
+ typedef QMap<KIO::TransferJob*,URLandName> JobsToURLsMap;
+ JobsToURLsMap m_map;
+ BookmarksPrefsSettings m_settings;
+ void addKopeteBookmark( const KURL& url, const QString& sender );
+ KURL::List* extractURLsFromString( const QString& text );
+ KBookmarkGroup getKopeteFolder();
+ KBookmarkGroup getFolder( KBookmarkGroup group, const QString& folder );
+ QTextCodec* getPageEncoding( const QByteArray& data );
+public slots:
+ void slotBookmarkURLsInMessage(Kopete::Message & msg);
+ void slotReloadSettings();
+
+private slots:
+ void slotAddKopeteBookmark( KIO::Job *transfer, const QByteArray &data );
+};
+
+typedef KGenericFactory<BookmarksPlugin> BookmarksPluginFactory;
+
+#endif
diff --git a/kopete/plugins/addbookmarks/addbookmarkspreferences.cpp b/kopete/plugins/addbookmarks/addbookmarkspreferences.cpp
new file mode 100644
index 00000000..12ebd877
--- /dev/null
+++ b/kopete/plugins/addbookmarks/addbookmarkspreferences.cpp
@@ -0,0 +1,114 @@
+//
+// C++ Implementation: %{MODULE}
+//
+// Description:
+//
+//
+// Author: Roie Kerstein <[email protected]>, (C) 2004
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "addbookmarkspreferences.h"
+#include "addbookmarksprefsui.h"
+#include "addbookmarksplugin.h"
+#include <kgenericfactory.h>
+#include <kopetepluginmanager.h>
+#include <kopetecontactlist.h>
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qbuttongroup.h>
+#include <qlistbox.h>
+#include <qnamespace.h>
+#include <qradiobutton.h>
+
+
+typedef KGenericFactory<BookmarksPreferences> BookmarksPreferencesFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kopete_addbookmarks, BookmarksPreferencesFactory("kcm_kopete_addbookmarks") )
+
+BookmarksPreferences::BookmarksPreferences(QWidget *parent, const char *name, const QStringList &args)
+ : KCModule(BookmarksPreferencesFactory::instance(), parent, args)
+{
+ Q_UNUSED( name );
+ ( new QVBoxLayout (this) )->setAutoAdd( true );
+ p_dialog = new BookmarksPrefsUI( this );
+ load();
+ connect( p_dialog->yesButton, SIGNAL( toggled(bool) ), this, SLOT( slotSetStatusChanged() ));
+ connect( p_dialog->noButton, SIGNAL( toggled(bool) ), this, SLOT( slotSetStatusChanged() ));
+ connect( p_dialog->onlySelectedButton, SIGNAL( toggled(bool) ), this, SLOT( slotSetStatusChanged() ));
+ connect( p_dialog->onlyNotSelectedButton, SIGNAL( toggled(bool) ), this, SLOT( slotSetStatusChanged() ));
+ connect( p_dialog->contactList, SIGNAL( selectionChanged() ), this, SLOT( slotSetStatusChanged() ));
+ if(Kopete::PluginManager::self()->plugin("kopete_addbookmarks") )
+ connect( this, SIGNAL(PreferencesChanged()), Kopete::PluginManager::self()->plugin("kopete_addbookmarks") , SLOT(slotReloadSettings()));
+ connect( p_dialog->m_addUntrusted, SIGNAL( toggled(bool) ), this, SLOT( slotAddUntrustedChanged() ) );
+}
+
+
+BookmarksPreferences::~BookmarksPreferences()
+{
+}
+
+void BookmarksPreferences::save()
+{
+ QStringList list;
+ QStringList::iterator it;
+
+
+ m_settings.setFolderForEachContact( (BookmarksPrefsSettings::UseSubfolders)p_dialog->buttonGroup1->selectedId() );
+ if ( m_settings.isFolderForEachContact() == BookmarksPrefsSettings::SelectedContacts ||
+ m_settings.isFolderForEachContact() == BookmarksPrefsSettings::UnselectedContacts ) {
+ for( uint i = 0; i < p_dialog->contactList->count() ; ++i ){
+ if( p_dialog->contactList->isSelected( i ) ){
+ list += p_dialog->contactList->text( i );
+ }
+ }
+ m_settings.setContactsList( list );
+ }
+ m_settings.setAddBookmarksFromUnknownContacts( p_dialog->m_addUntrusted->isChecked() );
+ m_settings.save();
+ emit PreferencesChanged();
+ emit KCModule::changed(false);
+}
+
+void BookmarksPreferences::slotSetStatusChanged()
+{
+ if ( p_dialog->buttonGroup1->selectedId() == 1 || p_dialog->buttonGroup1->selectedId() == 0)
+ p_dialog->contactList->setEnabled(false);
+ else
+ p_dialog->contactList->setEnabled(true);
+
+ emit KCModule::changed(true);
+}
+
+void BookmarksPreferences::slotAddUntrustedChanged()
+{
+ emit KCModule::changed(true);
+}
+
+void BookmarksPreferences::load()
+{
+ QStringList list;
+ QStringList::iterator it;
+ QListBoxItem* item;
+
+ m_settings.load();
+ p_dialog->buttonGroup1->setButton(m_settings.isFolderForEachContact());
+ p_dialog->m_addUntrusted->setChecked( m_settings.addBookmarksFromUnknownContacts() );
+ if( p_dialog->contactList->count() == 0 ){
+ QStringList contacts = Kopete::ContactList::self()->contacts();
+ contacts.sort();
+ p_dialog->contactList->insertStringList( contacts );
+ }
+ p_dialog->contactList->clearSelection();
+ p_dialog->contactList->setEnabled( m_settings.isFolderForEachContact() == BookmarksPrefsSettings::SelectedContacts ||
+ m_settings.isFolderForEachContact() == BookmarksPrefsSettings::UnselectedContacts );
+ list = m_settings.getContactsList();
+ for( it = list.begin() ; it != list.end() ; ++it){
+ if ( ( item = p_dialog->contactList->findItem(*it, Qt::ExactMatch ) ) ){
+ p_dialog->contactList->setSelected( item, true );
+ }
+ }
+ emit KCModule::changed(false);
+}
+
+#include "addbookmarkspreferences.moc"
diff --git a/kopete/plugins/addbookmarks/addbookmarkspreferences.h b/kopete/plugins/addbookmarks/addbookmarkspreferences.h
new file mode 100644
index 00000000..7a9d5bff
--- /dev/null
+++ b/kopete/plugins/addbookmarks/addbookmarkspreferences.h
@@ -0,0 +1,45 @@
+//
+// C++ Interface: %{MODULE}
+//
+// Description:
+//
+//
+// Author: Roie Kerstein <[email protected]>, (C) 2004
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef ADDBOOKMARKSPREFERENCES_H
+#define ADDBOOKMARKSPREFERENCES_H
+
+#include <kcmodule.h>
+#include "addbookmarksprefssettings.h"
+#include "addbookmarksprefsui.h"
+
+/**
+@author Roie Kerstein <[email protected]>
+*/
+class BookmarksPreferences : public KCModule
+{
+Q_OBJECT
+public:
+ BookmarksPreferences(QWidget *parent = 0, const char *name = 0, const QStringList &args = QStringList());
+
+ ~BookmarksPreferences();
+
+ virtual void load();
+ virtual void save();
+
+signals:
+ void PreferencesChanged();
+
+private:
+ BookmarksPrefsUI *p_dialog;
+ BookmarksPrefsSettings m_settings;
+
+private slots:
+ void slotSetStatusChanged();
+ void slotAddUntrustedChanged();
+};
+
+#endif
diff --git a/kopete/plugins/addbookmarks/addbookmarksprefssettings.cpp b/kopete/plugins/addbookmarks/addbookmarksprefssettings.cpp
new file mode 100644
index 00000000..045ce801
--- /dev/null
+++ b/kopete/plugins/addbookmarks/addbookmarksprefssettings.cpp
@@ -0,0 +1,87 @@
+//
+// C++ Implementation: %{MODULE}
+//
+// Description:
+//
+//
+// Author: Roie Kerstein <[email protected]>, (C) 2004
+//
+// License: GPL v2
+//
+//
+#include <kdebug.h>
+#include <kconfig.h>
+#include <kglobal.h>
+
+#include "addbookmarksprefssettings.h"
+
+BookmarksPrefsSettings::BookmarksPrefsSettings(QObject *parent, const char *name)
+ : QObject(parent, name)
+{
+ load();
+}
+
+
+BookmarksPrefsSettings::~BookmarksPrefsSettings()
+{
+}
+
+void BookmarksPrefsSettings::load()
+{
+ KConfig * configfile = KGlobal::config();
+ m_isfolderforeachcontact = Always;
+ m_contactslist.clear();
+ m_addbookmarksfromunknowns = false;
+ if( configfile->getConfigState() == KConfigBase::NoAccess ){
+ kdDebug( 14501 ) << "load: failed to open config file for reading" << endl;
+ return;
+ }
+ if( !configfile->hasGroup("Bookmarks Plugin") ){
+ kdDebug( 14501 ) << "load: no config found in file" << endl;
+ return;
+ }
+ configfile->setGroup("Bookmarks Plugin");
+ m_isfolderforeachcontact = (UseSubfolders)configfile->readNumEntry( "UseSubfolderForEachContact", 0 );
+ m_contactslist = configfile->readListEntry( "ContactsList" );
+ m_addbookmarksfromunknowns = configfile->readBoolEntry( "AddBookmarksFromUnknownContacts" );
+}
+
+void BookmarksPrefsSettings::save()
+{
+ KConfig * configfile = KGlobal::config();
+
+ if( configfile->getConfigState() != KConfigBase::ReadWrite ){
+ kdDebug( 14501 ) << "save: failed to open config file for writing" << endl;
+ return;
+ }
+ configfile->setGroup( "Bookmarks Plugin" );
+ configfile->writeEntry( "UseSubfolderForEachContact", (int)m_isfolderforeachcontact );
+ configfile->writeEntry( "ContactsList", m_contactslist );
+ configfile->writeEntry( "AddBookmarksFromUnknownContacts", m_addbookmarksfromunknowns );
+ configfile->sync();
+}
+
+bool BookmarksPrefsSettings::useSubfolderForContact( QString nickname )
+{
+ if ( !nickname.isEmpty() )
+ {
+ switch( m_isfolderforeachcontact ){
+ case Never:
+ return false;
+ case Always:
+ return true;
+ case SelectedContacts:
+ return ( m_contactslist.find( nickname ) != m_contactslist.end() );
+ case UnselectedContacts:
+ return ( m_contactslist.find( nickname ) == m_contactslist.end() );
+ }
+ }
+ return false;
+}
+
+void BookmarksPrefsSettings::setAddBookmarksFromUnknownContacts( bool addUntrusted )
+{
+ m_addbookmarksfromunknowns = addUntrusted;
+}
+
+#include "addbookmarksprefssettings.moc"
diff --git a/kopete/plugins/addbookmarks/addbookmarksprefssettings.h b/kopete/plugins/addbookmarks/addbookmarksprefssettings.h
new file mode 100644
index 00000000..2d82e7c4
--- /dev/null
+++ b/kopete/plugins/addbookmarks/addbookmarksprefssettings.h
@@ -0,0 +1,49 @@
+//
+// C++ Interface: %{MODULE}
+//
+// Description:
+//
+//
+// Author: Roie Kerstein <[email protected]>, (C) 2004
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef ADDBOOKMARKSPREFSSETTINGS_H
+#define ADDBOOKMARKSPREFSSETTINGS_H
+
+#include <qobject.h>
+#include <qstringlist.h>
+
+/**
+@author Roie Kerstein <[email protected]>
+*/
+class BookmarksPrefsSettings : public QObject
+{
+Q_OBJECT
+public:
+ enum UseSubfolders { Always=0, Never=1, SelectedContacts=2, UnselectedContacts=3 };
+
+ BookmarksPrefsSettings(QObject *parent = 0, const char *name = 0);
+
+ ~BookmarksPrefsSettings();
+
+ void load();
+ void save();
+ UseSubfolders isFolderForEachContact() {return m_isfolderforeachcontact;}
+ void setFolderForEachContact(UseSubfolders val) {m_isfolderforeachcontact = val;}
+ bool useSubfolderForContact( QString nickname );
+ QStringList getContactsList() {return m_contactslist;}
+ void setContactsList(QStringList list) {m_contactslist = list;}
+ bool addBookmarksFromUnknownContacts() { return m_addbookmarksfromunknowns; };
+ void setAddBookmarksFromUnknownContacts( bool );
+
+private:
+ bool m_folderPerContact;
+ bool m_addbookmarksfromunknowns;
+ UseSubfolders m_isfolderforeachcontact;
+ QStringList m_contactslist;
+
+};
+
+#endif
diff --git a/kopete/plugins/addbookmarks/addbookmarksprefsui.ui b/kopete/plugins/addbookmarks/addbookmarksprefsui.ui
new file mode 100644
index 00000000..67be2b9e
--- /dev/null
+++ b/kopete/plugins/addbookmarks/addbookmarksprefsui.ui
@@ -0,0 +1,104 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>BookmarksPrefsUI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>BookmarksPrefsUI</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>396</width>
+ <height>421</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="title">
+ <string>Use Subfolder for Each Contact</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>yesButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Always</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>noButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Never</string>
+ </property>
+ <property name="buttonGroupId">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>onlySelectedButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Onl&amp;y the selected contacts</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="buttonGroupId">
+ <number>2</number>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>onlyNotSelectedButton</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Not the selected contacts</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QListBox">
+ <property name="name">
+ <cstring>contactList</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>m_addUntrusted</cstring>
+ </property>
+ <property name="text">
+ <string>Add Bookmarks from Contacts Not In Your Contact List</string>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/kopete/plugins/addbookmarks/kopete_addbookmarks.desktop b/kopete/plugins/addbookmarks/kopete_addbookmarks.desktop
new file mode 100644
index 00000000..c3c65428
--- /dev/null
+++ b/kopete/plugins/addbookmarks/kopete_addbookmarks.desktop
@@ -0,0 +1,126 @@
+[Desktop Entry]
+Type=Service
+Name=Bookmarks
+Name[be]=Закладкі
+Name[bg]=Отметки
+Name[bn]=বুকমার্ক
+Name[br]=Sinedoù
+Name[bs]=Zabilješke
+Name[ca]=Punts
+Name[cs]=Záložky
+Name[cy]=Nodau Tudalen
+Name[da]=Bogmærker
+Name[de]=Lesezeichen
+Name[el]=Σελιδοδείκτες
+Name[eo]=Legosignoj
+Name[es]=Marcadores
+Name[et]=Järjehoidjad
+Name[eu]=Lastermarkak
+Name[fa]=چوب الفها
+Name[fi]=Kirjanmerkit
+Name[fr]=Signets
+Name[ga]=Leabharmharcanna
+Name[gl]=Marcadores
+Name[he]=סימניות
+Name[hu]=Könyvjelzők
+Name[id]=Bookmark
+Name[is]=Bókamerki
+Name[it]=Segnalibri
+Name[ja]=ブックマーク
+Name[ka]=სანიშნეები
+Name[kk]=Бетбелгілер
+Name[km]=ចំណាំ
+Name[lt]=Žymelės
+Name[lv]=Grāmatzīmes
+Name[mk]=Обележувачи
+Name[mt]=Favoriti
+Name[nb]=Bokmerker
+Name[nds]=Leestekens
+Name[ne]=पुस्तकचिनो
+Name[nl]=Bladwijzers
+Name[nn]=Bokmerke
+Name[pa]=ਬੁੱਕਮਾਰਕ
+Name[pl]=Zakładki
+Name[pt]=Favoritos
+Name[pt_BR]=Favoritos
+Name[ro]=Semne de carte
+Name[ru]=Закладки
+Name[rw]=Utumenyetso
+Name[sk]=Záložky
+Name[sl]=Zaznamki
+Name[sr]=Маркери
+Name[sr@Latn]=Markeri
+Name[sv]=Bokmärken
+Name[ta]=புத்தகக்குறிகள்
+Name[th]=ที่คั่นหนังสือ
+Name[tr]=Yer imleri
+Name[uk]=Закладки
+Name[uz]=Xatchoʻplar
+Name[uz@cyrillic]=Хатчўплар
+Name[ven]=Dzitswayo dza bugu
+Name[wa]=Rimåkes
+Name[xh]=Amanqaku encwadi
+Name[zh_CN]=书签
+Name[zh_HK]=書籤
+Name[zh_TW]=書籤
+Name[zu]=Amamaki encwadi
+Comment=Automatically bookmark links in incoming messages
+Comment[be]=Аўтаматычна ствараць закладкі для спасылак, перададзеных вам праз імгненныя паведамленні
+Comment[bg]=Автоматично добавяне на връзките във входящите съобщения към отметките
+Comment[bn]=অন্তর্মুখী বার্তামধ্যস্থ লিঙ্কগুলো স্বয়ংক্রীয়ভাবে বুকমার্ক করে
+Comment[bs]=Automatski zabilježi linkove u dolaznim porukama
+Comment[ca]=Apunta automàticament els enllaços en els missatges entrants
+Comment[cs]=Automaticky přidat do záložek odkazy z příchozích zpráv
+Comment[da]=Sæt link til indkommende breve automatisk
+Comment[de]=Verknüpfungen in eingehenden Nachrichten automatisch als Lesezeichen ablegen
+Comment[el]=Αυτόματη τοποθέτηση σελιδοδεικτών στα εισερχόμενα μηνύματα
+Comment[es]=Anota automáticamente los enlaces de los mensajes entrantes
+Comment[et]=Sissetulevates sõnumites olevate viitade automaatne lisamine järjehoidjatesse
+Comment[eu]=Automatikoki gorde lastermarketan sarrerako mezuetako loturak.
+Comment[fa]=چوب الف به طور خودکار به پیامهای واردشده پیوند می‌خورد
+Comment[fi]=Lisää saapuvien viestien sisältämät linkit automaattisesti kirjanmerkkeihin
+Comment[fr]=Ajouter automatiquement un signet pour les liens présents dans les messages rentrants
+Comment[gl]=Marcar automáticamente as ligazóns nas mensaxes entrantes
+Comment[he]=שמור קישורים מהמסרים הנכנסים ברשימת הסימניות באופן אוטומטי
+Comment[hu]=Könyvjelző létrehozása a bejövő üzenetekben található linkekről
+Comment[is]=Setja sjálfkrafa bókamerki á tengla í skilaboðum
+Comment[it]=Aggiungi automaticamente al segnalibro i collegamenti nei messaggi in entrata
+Comment[ja]=受信メッセージ中のリンクを自動的にブックマークに追加
+Comment[ka]=შემომავალ შეტყობინებებში ბმულების ავრომატურად ჩანიშვნა
+Comment[kk]=Кіріс хабарламалардағы сілтемелерді автоматты түрде бетбелгілеу
+Comment[km]=ចំណាំ​តំណ​នៅ​ក្នុង​សារ​ចូល ដោយ​ស្វ័យប្រវត្តិ
+Comment[lt]=Gautose žinutėse esančias nuorodas automatiškai įtraukti į žymeles
+Comment[mk]=Ги обележува автоматски врските во дојдовните пораки
+Comment[nb]=Sett automatisk bokmerke for lenker i innkommende meldinger
+Comment[nds]=Links in rinkamen Narichten automaatsch de Leestekens tofögen
+Comment[ne]=आगमन सन्देशमा स्वचालित पुस्तकचिनो लिङ्क
+Comment[nl]=Koppelingen in inkomende berichten automatisch als bladwijzer opslaan
+Comment[nn]=Lag automatisk bokmerke til lenkjer i innkomande meldingar
+Comment[pl]=Automatycznie dodawaj zakładkę dla odnośników w nadchodzących komunikatach
+Comment[pt]=Adicionar automaticamente ao favoritos ligações em mensagens recebidas
+Comment[pt_BR]=Adiciona automaticamente aos favoritos os links em mensagens recebidas
+Comment[ru]=Автоматически делать закладки ссылок из входных сообщений
+Comment[sk]=Automaticky vytvorí záložky odkazov v prichádzajúcich správach
+Comment[sl]=Samodejno doda povezave v prihajajočih sporočilih med zaznamke
+Comment[sr]=Аутоматски маркирај везе у долазећим порукама
+Comment[sr@Latn]=Automatski markiraj veze u dolazećim porukama
+Comment[sv]=Bokmärk automatiskt länkar i inkommande meddelande.
+Comment[ta]=உள்வரும் செய்திகளில் தானாகவே புத்தகக்குறி இணைப்புகள்
+Comment[tr]=Otomatik olarak gelen mesajları yer imine bağlar
+Comment[uk]=Автоматично робити закладки посилань з вхідних повідомлень
+Comment[zh_CN]=自动将收到消息中的链接加入书签
+Comment[zh_HK]=自動將收到的訊息內的連結加到書籤
+Comment[zh_TW]=自動將接收訊息中的連結加入書籤
+Icon=konqueror
+ServiceTypes=Kopete/Plugin
+X-Kopete-Version=1000900
+X-KDE-Library=kopete_addbookmarks
+X-KDE-PluginInfo-Author=Roie Kerstein
+X-KDE-PluginInfo-Name=kopete_addbookmarks
+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
diff --git a/kopete/plugins/addbookmarks/kopete_addbookmarks_config.desktop b/kopete/plugins/addbookmarks/kopete_addbookmarks_config.desktop
new file mode 100644
index 00000000..933a4ee1
--- /dev/null
+++ b/kopete/plugins/addbookmarks/kopete_addbookmarks_config.desktop
@@ -0,0 +1,121 @@
+[Desktop Entry]
+Type=Service
+Name=Bookmarks
+Name[be]=Закладкі
+Name[bg]=Отметки
+Name[bn]=বুকমার্ক
+Name[br]=Sinedoù
+Name[bs]=Zabilješke
+Name[ca]=Punts
+Name[cs]=Záložky
+Name[cy]=Nodau Tudalen
+Name[da]=Bogmærker
+Name[de]=Lesezeichen
+Name[el]=Σελιδοδείκτες
+Name[eo]=Legosignoj
+Name[es]=Marcadores
+Name[et]=Järjehoidjad
+Name[eu]=Lastermarkak
+Name[fa]=چوب الفها
+Name[fi]=Kirjanmerkit
+Name[fr]=Signets
+Name[ga]=Leabharmharcanna
+Name[gl]=Marcadores
+Name[he]=סימניות
+Name[hu]=Könyvjelzők
+Name[id]=Bookmark
+Name[is]=Bókamerki
+Name[it]=Segnalibri
+Name[ja]=ブックマーク
+Name[ka]=სანიშნეები
+Name[kk]=Бетбелгілер
+Name[km]=ចំណាំ
+Name[lt]=Žymelės
+Name[lv]=Grāmatzīmes
+Name[mk]=Обележувачи
+Name[mt]=Favoriti
+Name[nb]=Bokmerker
+Name[nds]=Leestekens
+Name[ne]=पुस्तकचिनो
+Name[nl]=Bladwijzers
+Name[nn]=Bokmerke
+Name[pa]=ਬੁੱਕਮਾਰਕ
+Name[pl]=Zakładki
+Name[pt]=Favoritos
+Name[pt_BR]=Favoritos
+Name[ro]=Semne de carte
+Name[ru]=Закладки
+Name[rw]=Utumenyetso
+Name[sk]=Záložky
+Name[sl]=Zaznamki
+Name[sr]=Маркери
+Name[sr@Latn]=Markeri
+Name[sv]=Bokmärken
+Name[ta]=புத்தகக்குறிகள்
+Name[th]=ที่คั่นหนังสือ
+Name[tr]=Yer imleri
+Name[uk]=Закладки
+Name[uz]=Xatchoʻplar
+Name[uz@cyrillic]=Хатчўплар
+Name[ven]=Dzitswayo dza bugu
+Name[wa]=Rimåkes
+Name[xh]=Amanqaku encwadi
+Name[zh_CN]=书签
+Name[zh_HK]=書籤
+Name[zh_TW]=書籤
+Name[zu]=Amamaki encwadi
+Comment=Automatically bookmark links in incoming messages
+Comment[be]=Аўтаматычна ствараць закладкі для спасылак, перададзеных вам праз імгненныя паведамленні
+Comment[bg]=Автоматично добавяне на връзките във входящите съобщения към отметките
+Comment[bn]=অন্তর্মুখী বার্তামধ্যস্থ লিঙ্কগুলো স্বয়ংক্রীয়ভাবে বুকমার্ক করে
+Comment[bs]=Automatski zabilježi linkove u dolaznim porukama
+Comment[ca]=Apunta automàticament els enllaços en els missatges entrants
+Comment[cs]=Automaticky přidat do záložek odkazy z příchozích zpráv
+Comment[da]=Sæt link til indkommende breve automatisk
+Comment[de]=Verknüpfungen in eingehenden Nachrichten automatisch als Lesezeichen ablegen
+Comment[el]=Αυτόματη τοποθέτηση σελιδοδεικτών στα εισερχόμενα μηνύματα
+Comment[es]=Anota automáticamente los enlaces de los mensajes entrantes
+Comment[et]=Sissetulevates sõnumites olevate viitade automaatne lisamine järjehoidjatesse
+Comment[eu]=Automatikoki gorde lastermarketan sarrerako mezuetako loturak.
+Comment[fa]=چوب الف به طور خودکار به پیامهای واردشده پیوند می‌خورد
+Comment[fi]=Lisää saapuvien viestien sisältämät linkit automaattisesti kirjanmerkkeihin
+Comment[fr]=Ajouter automatiquement un signet pour les liens présents dans les messages rentrants
+Comment[gl]=Marcar automáticamente as ligazóns nas mensaxes entrantes
+Comment[he]=שמור קישורים מהמסרים הנכנסים ברשימת הסימניות באופן אוטומטי
+Comment[hu]=Könyvjelző létrehozása a bejövő üzenetekben található linkekről
+Comment[is]=Setja sjálfkrafa bókamerki á tengla í skilaboðum
+Comment[it]=Aggiungi automaticamente al segnalibro i collegamenti nei messaggi in entrata
+Comment[ja]=受信メッセージ中のリンクを自動的にブックマークに追加
+Comment[ka]=შემომავალ შეტყობინებებში ბმულების ავრომატურად ჩანიშვნა
+Comment[kk]=Кіріс хабарламалардағы сілтемелерді автоматты түрде бетбелгілеу
+Comment[km]=ចំណាំ​តំណ​នៅ​ក្នុង​សារ​ចូល ដោយ​ស្វ័យប្រវត្តិ
+Comment[lt]=Gautose žinutėse esančias nuorodas automatiškai įtraukti į žymeles
+Comment[mk]=Ги обележува автоматски врските во дојдовните пораки
+Comment[nb]=Sett automatisk bokmerke for lenker i innkommende meldinger
+Comment[nds]=Links in rinkamen Narichten automaatsch de Leestekens tofögen
+Comment[ne]=आगमन सन्देशमा स्वचालित पुस्तकचिनो लिङ्क
+Comment[nl]=Koppelingen in inkomende berichten automatisch als bladwijzer opslaan
+Comment[nn]=Lag automatisk bokmerke til lenkjer i innkomande meldingar
+Comment[pl]=Automatycznie dodawaj zakładkę dla odnośników w nadchodzących komunikatach
+Comment[pt]=Adicionar automaticamente ao favoritos ligações em mensagens recebidas
+Comment[pt_BR]=Adiciona automaticamente aos favoritos os links em mensagens recebidas
+Comment[ru]=Автоматически делать закладки ссылок из входных сообщений
+Comment[sk]=Automaticky vytvorí záložky odkazov v prichádzajúcich správach
+Comment[sl]=Samodejno doda povezave v prihajajočih sporočilih med zaznamke
+Comment[sr]=Аутоматски маркирај везе у долазећим порукама
+Comment[sr@Latn]=Automatski markiraj veze u dolazećim porukama
+Comment[sv]=Bokmärk automatiskt länkar i inkommande meddelande.
+Comment[ta]=உள்வரும் செய்திகளில் தானாகவே புத்தகக்குறி இணைப்புகள்
+Comment[tr]=Otomatik olarak gelen mesajları yer imine bağlar
+Comment[uk]=Автоматично робити закладки посилань з вхідних повідомлень
+Comment[zh_CN]=自动将收到消息中的链接加入书签
+Comment[zh_HK]=自動將收到的訊息內的連結加到書籤
+Comment[zh_TW]=自動將接收訊息中的連結加入書籤
+Icon=konqueror
+ServiceTypes=KCModule
+
+X-KDE-ModuleType=Library
+X-KDE-Library=kopete_addbookmarks
+X-KDE-FactoryName=BookmarksConfigFactory
+X-KDE-ParentApp=kopete_addbookmarks
+X-KDE-ParentComponents=kopete_addbookmarks