summaryrefslogtreecommitdiffstats
path: root/tdeabc/tdeabcdistlistupdater
diff options
context:
space:
mode:
Diffstat (limited to 'tdeabc/tdeabcdistlistupdater')
-rw-r--r--tdeabc/tdeabcdistlistupdater/CMakeLists.txt42
-rw-r--r--tdeabc/tdeabcdistlistupdater/Makefile.am12
-rw-r--r--tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.cpp95
-rw-r--r--tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.desktop10
4 files changed, 159 insertions, 0 deletions
diff --git a/tdeabc/tdeabcdistlistupdater/CMakeLists.txt b/tdeabc/tdeabcdistlistupdater/CMakeLists.txt
new file mode 100644
index 000000000..ddbdd7c9d
--- /dev/null
+++ b/tdeabc/tdeabcdistlistupdater/CMakeLists.txt
@@ -0,0 +1,42 @@
+#################################################
+#
+# (C) 2010-2011 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+tde_import( libkmime )
+tde_import( ktnef )
+tde_import( libkcal )
+tde_import( libtdepim )
+
+include_directories(
+ ${CMAKE_SOURCE_DIR}
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### other data ################################
+
+install(
+ FILES tdeabcdistlistupdater.desktop
+ DESTINATION ${AUTOSTART_INSTALL_DIR}
+)
+
+
+##### tdeabcdistlistupdater (executable) ####################
+
+tde_add_executable( tdeabcdistlistupdater
+ SOURCES tdeabcdistlistupdater.cpp
+ LINK tdepim-shared
+ DESTINATION ${BIN_INSTALL_DIR}
+)
diff --git a/tdeabc/tdeabcdistlistupdater/Makefile.am b/tdeabc/tdeabcdistlistupdater/Makefile.am
new file mode 100644
index 000000000..b60e00653
--- /dev/null
+++ b/tdeabc/tdeabcdistlistupdater/Makefile.am
@@ -0,0 +1,12 @@
+INCLUDES = -I$(includedir)/tdeabc -I$(top_srcdir) $(all_includes)
+
+METASOURCES = AUTO
+
+bin_PROGRAMS = tdeabcdistlistupdater
+
+tdeabcdistlistupdater_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor
+tdeabcdistlistupdater_LDADD = $(LIB_TDEABC) $(top_builddir)/libtdepim/libtdepim.la
+tdeabcdistlistupdater_SOURCES = tdeabcdistlistupdater.cpp
+
+autostart_DATA = tdeabcdistlistupdater.desktop
+autostartdir = $(datadir)/autostart
diff --git a/tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.cpp b/tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.cpp
new file mode 100644
index 000000000..9228e1f47
--- /dev/null
+++ b/tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.cpp
@@ -0,0 +1,95 @@
+/*
+ This file is part of libtdeabc.
+ Copyright (c) 2008 Tobias Koenig <tokoe@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <tdeaboutdata.h>
+#include <tdeapplication.h>
+#include <tdecmdlineargs.h>
+#include <ksimpleconfig.h>
+#include <kdebug.h>
+#include <tdeglobal.h>
+#include <tdelocale.h>
+#include <kstandarddirs.h>
+
+#include <tdeabc/stdaddressbook.h>
+#include <libtdepim/distributionlist.h>
+
+static const TDECmdLineOptions options[] =
+{
+ { "disable-autostart", "Disable automatic startup on login", 0 },
+ TDECmdLineLastOption
+};
+
+void convertDistributionLists()
+{
+ KSimpleConfig cfg( locateLocal( "data", "tdeabc/distlists" ) );
+ const TQMap<TQString, TQString> entryMap = cfg.entryMap( "DistributionLists" );
+
+ if ( entryMap.isEmpty() ) // nothing to convert
+ return;
+
+ TQMapConstIterator<TQString, TQString> it;
+ for ( it = entryMap.begin(); it != entryMap.end(); ++it ) {
+ const TQString listName = it.key();
+ const TQStringList entries = TQStringList::split( ',', it.data(), true );
+
+ KPIM::DistributionList distList;
+ distList.setUid( TDEApplication::randomString( 10 ) );
+ distList.setName( listName );
+
+ if ( entries.count() > 1 ) {
+ for ( uint i = 0; i < entries.count(); i += 2 ) {
+ const TQString uid = entries[ i ];
+ const TQString preferredEMail = entries[ i + 1 ];
+
+ distList.insertEntry( uid, preferredEMail );
+ }
+ }
+
+ TDEABC::StdAddressBook::self()->insertAddressee( distList );
+ }
+
+ TDEABC::StdAddressBook::self()->save();
+}
+
+int main( int argc, char **argv )
+{
+ TDEApplication::disableAutoDcopRegistration();
+
+ TDEAboutData aboutData( "tdeabcdistlistupdater", "Converter tool for distribution lists", "0.1" );
+ aboutData.addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" );
+
+ TDECmdLineArgs::init( argc, argv, &aboutData );
+ TDECmdLineArgs::addCmdLineOptions( options );
+
+ TDEApplication app( false, false );
+
+ TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
+
+ if ( args->isSet( "disable-autostart" ) ) {
+ kdDebug() << "Disable autostart." << endl;
+
+ TDEConfig *config = app.config();
+ config->setGroup( "Startup" );
+ config->writeEntry( "EnableAutostart", false );
+ }
+
+ convertDistributionLists();
+}
+
diff --git a/tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.desktop b/tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.desktop
new file mode 100644
index 000000000..f481a0aaf
--- /dev/null
+++ b/tdeabc/tdeabcdistlistupdater/tdeabcdistlistupdater.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=tdeabcdistlistupdater
+Exec=tdeabcdistlistupdater --disable-autostart
+Icon=misc
+Type=Application
+Comment=Tool to update the old distribution lists to the new ones.
+Terminal=false
+NoDisplay=true
+X-TDE-autostart-condition=tdeabcdistlistupdaterrc:Startup:EnableAutostart:true
+OnlyShowIn=TDE;