summaryrefslogtreecommitdiffstats
path: root/kabc/kabc2mutt
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-09-03 20:02:55 +0200
committerSlávek Banko <slavek.banko@axis.cz>2013-09-03 21:02:00 +0200
commit533bad2a1503973aaf8186691422c2eda91d02d4 (patch)
treef7e52f62416048859aa9bde8425e20aac0e7c669 /kabc/kabc2mutt
parent8144d5434bbd1c4448a37695aed6ad3d348043d8 (diff)
downloadtdepim-533bad2a1503973aaf8186691422c2eda91d02d4.tar.gz
tdepim-533bad2a1503973aaf8186691422c2eda91d02d4.zip
Additional k => tde renaming and fixes
Diffstat (limited to 'kabc/kabc2mutt')
-rw-r--r--kabc/kabc2mutt/CMakeLists.txt29
-rw-r--r--kabc/kabc2mutt/Makefile.am13
-rw-r--r--kabc/kabc2mutt/README19
-rw-r--r--kabc/kabc2mutt/kabc2mutt.cpp160
-rw-r--r--kabc/kabc2mutt/kabc2mutt.h57
-rw-r--r--kabc/kabc2mutt/main.cpp80
6 files changed, 0 insertions, 358 deletions
diff --git a/kabc/kabc2mutt/CMakeLists.txt b/kabc/kabc2mutt/CMakeLists.txt
deleted file mode 100644
index 98c30f0b5..000000000
--- a/kabc/kabc2mutt/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-#################################################
-#
-# (C) 2010-2011 Serghei Amelian
-# serghei (DOT) amelian (AT) gmail.com
-#
-# Improvements and feedback are welcome
-#
-# This file is released under GPL >= 2
-#
-#################################################
-
-include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}
- ${TDE_INCLUDE_DIR}
- ${TQT_INCLUDE_DIRS}
-)
-
-link_directories(
- ${TQT_LIBRARY_DIRS}
-)
-
-
-##### kabc2mutt (executable) ####################
-
-tde_add_executable( kabc2mutt AUTOMOC
- SOURCES kabc2mutt.cpp main.cpp
- LINK tdeabc-shared
- DESTINATION ${BIN_INSTALL_DIR}
-)
diff --git a/kabc/kabc2mutt/Makefile.am b/kabc/kabc2mutt/Makefile.am
deleted file mode 100644
index 5713ff006..000000000
--- a/kabc/kabc2mutt/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-INCLUDES = -I$(includedir)/tdeabc $(all_includes)
-
-METASOURCES = AUTO
-
-bin_PROGRAMS = kabc2mutt
-
-kabc2mutt_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor
-kabc2mutt_LDADD = -ltdeabc $(LIB_TDECORE)
-kabc2mutt_SOURCES = kabc2mutt.cpp main.cpp
-
-messages: rc.cpp
- $(XGETTEXT) *.cpp -o $(podir)/tdeabc2mutt.pot
-
diff --git a/kabc/kabc2mutt/README b/kabc/kabc2mutt/README
deleted file mode 100644
index 5d82fdfec..000000000
--- a/kabc/kabc2mutt/README
+++ /dev/null
@@ -1,19 +0,0 @@
-KAbc2Mutt
------------
-
-kabc2mutt is a small programm to make the email addresses, stored in
-kaddressbook, available in mutt.
-You only have to add the following line to your .muttrc
-
- source "kabc2mutt |"
-
-You can also configure mutt to query kabc2mutt when typing a substring
-of an email address (see the docu for query_command).
-To do this, add the following line to your .muttrc
-
- set query_command = "kabc2mutt --query '%s' --format query"
-
-Have fun with it
-
-Ciao,
-Tobias
diff --git a/kabc/kabc2mutt/kabc2mutt.cpp b/kabc/kabc2mutt/kabc2mutt.cpp
deleted file mode 100644
index 01ae6fd28..000000000
--- a/kabc/kabc2mutt/kabc2mutt.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- KAbc2Mutt
-
- Copyright (c) 2003 - 2004 Tobias Koenig <tokoe@kde.org>
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of version 2 of the GNU General Public
- License as published by the Free Software Foundation.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-#include <tdeabc/distributionlist.h>
-#include <tdeapplication.h>
-#include <tdelocale.h>
-
-#include <tqregexp.h>
-
-#include <iostream>
-
-#include "kabc2mutt.h"
-
-static std::ostream & operator<< ( std::ostream &os, const TQString &s );
-
-KABC2Mutt::KABC2Mutt( TQObject *parent, const char *name )
- : TQObject( parent, name ), mFormat( Aliases ),
- mIgnoreCase( false ), mAllAddresses( false ),
- mAlternateKeyFormat( false ),
- mAddressBook( 0 )
-{
-}
-
-void KABC2Mutt::run()
-{
- mAddressBook = TDEABC::StdAddressBook::self( true );
- TDEABC::StdAddressBook::setAutomaticSave( false );
-
- connect( mAddressBook, TQT_SIGNAL( addressBookChanged( AddressBook* ) ),
- this, TQT_SLOT( loadingFinished() ) );
-}
-
-void KABC2Mutt::loadingFinished()
-{
- // print addressees
- TDEABC::AddressBook::ConstIterator iaddr;
- for ( iaddr = mAddressBook->begin(); iaddr != mAddressBook->end(); ++iaddr ) {
- const TQString name = (*iaddr).givenName() + ' ' + (*iaddr).familyName();
- if ( !mQuery.isEmpty() ) {
- bool match = (name.find(mQuery, 0, mIgnoreCase) > -1) ||
- ((*iaddr).preferredEmail().find( mQuery, 0, mIgnoreCase ) > -1 );
- if ( !match )
- continue;
- }
-
- const TQStringList &allAddresses = (*iaddr).emails();
- TQStringList::const_iterator from, to;
- bool multiple = false;
-
- if ( mAllAddresses ) {
- // use all entries
- multiple = allAddresses.size() > 1;
- from = allAddresses.begin();
- to = allAddresses.end();
- } else {
- // use only the first entry, the one returned by preferredEmail()
- from = to = allAddresses.begin(); // start with empty list
- if ( to != allAddresses.end() )
- ++to;
- }
-
- size_t index = 0;
- if ( mFormat == Aliases ) {
- static const TQChar space = TQChar( ' ' );
- static const TQChar underscore = TQChar( '_' );
-
- TQString key;
- if ( !mAlternateKeyFormat )
- key = (*iaddr).givenName().left( 3 ) + (*iaddr).familyName().left( 3 );
- else
- if ( !(*iaddr).familyName().isEmpty() )
- key = (*iaddr).givenName().left( 1 ).lower() +
- (*iaddr).familyName().lower().replace( space, underscore );
- else
- key = (*iaddr).givenName().lower().replace( space, underscore );
-
- while ( from != to ) {
- std::cout << "alias " << key;
- if ( index )
- std::cout << index;
- std::cout << '\t' << name << " <" << (*from) << '>' << std::endl;
- ++index;
- ++from;
- }
-
- if ( !(*iaddr).nickName().isEmpty() ) {
- std::cout << "alias "
- << (*iaddr).nickName().lower().replace( space, underscore )
- << '\t' << name << " <"
- << (*iaddr).preferredEmail() << '>' << std::endl;
- }
- } else {
- while ( from != to ) {
- std::cout << (*from) << '\t' << name;
- if ( multiple ) {
- if ( index )
- std::cout << "\t#" << index;
- else
- std::cout << '\t' << i18n( "preferred" );
- ++index;
- }
- std::cout << std::endl;
- ++from;
- }
- }
- }
-
- // print all distribution lists
- TDEABC::DistributionListManager manager( mAddressBook );
- manager.load();
-
- TQStringList dists = manager.listNames();
- for ( TQStringList::Iterator iaddr = dists.begin(); iaddr != dists.end(); ++iaddr ) {
- TDEABC::DistributionList *list = manager.list( *iaddr );
- if ( list ) {
- if ( !mQuery.isEmpty() ) {
- bool match = ((*iaddr).find(mQuery) > -1);
- if ( !match )
- continue;
- }
-
- TQStringList emails = list->emails();
- if ( emails.isEmpty() )
- continue;
-
- if ( mFormat == Aliases ) {
- std::cout << "alias " << (*iaddr).replace( TQRegExp( " " ), "_" )
- << '\t' << emails.join( "," ) << std::endl;
- } else {
- std::cout << emails.join( "," ) << '\t' << (*iaddr) << '\t' << std::endl;
- }
- }
- }
-
- kapp->quit();
-}
-
-static std::ostream & operator<< ( std::ostream &os, const TQString &s )
-{
- os << s.local8Bit().data();
- return os;
-}
-
-#include "kabc2mutt.moc"
diff --git a/kabc/kabc2mutt/kabc2mutt.h b/kabc/kabc2mutt/kabc2mutt.h
deleted file mode 100644
index 92b7e9680..000000000
--- a/kabc/kabc2mutt/kabc2mutt.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- KAbc2Mutt
-
- Copyright (c) 2003 - 2004 Tobias Koenig <tokoe@kde.org>
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of version 2 of the GNU General Public
- License as published by the Free Software Foundation.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-#ifndef KABC2MUTT_H
-#define KABC2MUTT_H
-
-#include <tdeabc/stdaddressbook.h>
-
-class KABC2Mutt : public TQObject
-{
- Q_OBJECT
-
-
- public:
-
- enum Format { Aliases, Query };
-
- KABC2Mutt( TQObject *parent, const char *name = 0 );
-
- void setQuery( const TQString &query ) { mQuery = query; }
- void setFormat( Format format ) { mFormat = format; }
- void setIgnoreCase( bool ignoreCase ) { mIgnoreCase = ignoreCase; }
- void setAllAddresses( bool allAddresses ) { mAllAddresses = allAddresses; }
- void setAlternateKeyFormat( bool alternateKeyFormat ) { mAlternateKeyFormat = alternateKeyFormat; }
-
- void run();
-
- private slots:
- void loadingFinished();
-
- private:
- TQString mQuery;
- Format mFormat;
- bool mIgnoreCase;
- bool mAllAddresses;
- bool mAlternateKeyFormat;
-
- TDEABC::AddressBook *mAddressBook;
-};
-
-#endif
diff --git a/kabc/kabc2mutt/main.cpp b/kabc/kabc2mutt/main.cpp
deleted file mode 100644
index d1aefd6ef..000000000
--- a/kabc/kabc2mutt/main.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- KAbc2Mutt
-
- Copyright (c) 2003 - 2004 Tobias Koenig <tokoe@kde.org>
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of version 2 of the GNU General Public
- License as published by the Free Software Foundation.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-#include <tdeapplication.h>
-#include <tdecmdlineargs.h>
-#include <tdelocale.h>
-
-#include <iostream>
-
-#include "kabc2mutt.h"
-
-static const char version[] = "0.2";
-static const char appName[] = "kabc2mutt";
-static const char programName[] = I18N_NOOP( "kabc2mutt" );
-static const char description[] = I18N_NOOP( "kabc - mutt converter" );
-
-static TDECmdLineOptions k2moptions[] =
-{
- { "query <substring>", I18N_NOOP( "Only show contacts where name or address matches <substring>" ), 0 },
- { "format <format>", I18N_NOOP( "Default format is 'alias'. 'query' returns email<tab>name<tab>, as needed by mutt's query_command" ), "alias" },
- { "alternate-key-format", I18N_NOOP( "Default key format is 'JohDoe', this option turns it into 'jdoe'" ), 0 },
- { "ignore-case", I18N_NOOP( "Make queries case insensitive" ), 0 },
- { "all-addresses", I18N_NOOP( "Return all mail addresses, not just the preferred one" ), 0},
- TDECmdLineLastOption
-};
-
-
-int main( int argc, char **argv )
-{
- TDEApplication::disableAutoDcopRegistration();
- TDECmdLineArgs::init( argc, argv, appName, programName, description, version );
- TDECmdLineArgs::addCmdLineOptions( k2moptions );
-
- TDEApplication app( false, false );
-
- TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
-
- KABC2Mutt *object = new KABC2Mutt( 0 );
-
- // Handle --format option
- object->setFormat( (args->getOption("format") == "query") ? KABC2Mutt::Query : KABC2Mutt::Aliases );
-
- // Handle --alternate-key-format option
- object->setAlternateKeyFormat( args->isSet( "alternate-key-format" ) );
-
- // Handle --all-addresses option
- object->setAllAddresses( args->isSet( "all-addresses" ) );
-
- // Handle --query option
- const TQString subString = TQString::fromLocal8Bit( args->getOption( "query" ) );
- if ( !subString.isEmpty() ) {
- // Mutt wants a first line with some status message on it
- // See http://mutt.org/doc/manual/manual-4.html#ss4.5
- std::cout << i18n( "Searching KDE addressbook" ).latin1() << std::endl;
- }
- object->setQuery( subString );
-
- // Handle --ignore-case option
- object->setIgnoreCase( !args->isSet( "ignore-case" ) );
-
- object->run();
-
- return app.exec();
-}