Commit f72cf8ad authored by Tobias Koenig's avatar Tobias Koenig

Renamed KContactManager to KAddressBook

svn path=/trunk/KDE/kdepim/kaddressbook/; revision=1007291
parent 0b635e34
project(kaddressbook)
include_directories(
${CMAKE_SOURCE_DIR}/akonadi
${CMAKE_SOURCE_DIR}/akonadi/akonadi_next
${CMAKE_SOURCE_DIR}/libkdepim
${CMAKE_CURRENT_SOURCE_DIR}/editor
${CMAKE_CURRENT_SOURCE_DIR}/xxport/shared
${QT_QTDBUS_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}" )
add_subdirectory(icons)
add_subdirectory(printing)
if(QGPGME_FOUND)
add_definitions(-DQGPGME_FOUND)
endif(QGPGME_FOUND)
set( kaddressbook_printing_SRCS
printing/detailledstyle.cpp
printing/kabentrypainter.cpp
printing/mikesstyle.cpp
printing/printingwizard.cpp
printing/printprogress.cpp
printing/printsortmode.cpp
printing/printstyle.cpp
printing/ringbinderstyle.cpp
printing/selectionpage.cpp
printing/stylepage.cpp
)
kde4_add_ui_files(kaddressbook_printing_SRCS
printing/rbs_appearance.ui
printing/ds_appearance.ui
)
set( kaddressbook_editor_SRCS
editor/addresseditwidget.cpp
editor/contacteditor.cpp
editor/dateeditwidget.cpp
editor/displaynameeditwidget.cpp
editor/emaileditwidget.cpp
editor/freebusyeditwidget.cpp
editor/imagewidget.cpp
editor/imeditwidget.cpp
editor/nameeditwidget.cpp
editor/phoneeditwidget.cpp
editor/secrecyeditwidget.cpp
editor/soundeditwidget.cpp
)
set( kaddressbook_LIB_SRCS
aboutdata.cpp
contactfields.cpp
contacteditordialog.cpp
contactfiltermodel.cpp
contactgroupeditordialog.cpp
contactitemeditor.cpp
contactmetadata.cpp
contactstreemodel.cpp
contactswitcher.cpp
collectioncombobox.cpp
collectionfiltermodel.cpp
collectionselectiondialog.cpp
globalcontactmodel.cpp
mainwidget.cpp
modelcolumnmanager.cpp
quicksearchwidget.cpp
standardcontactactionmanager.cpp
xxport/csv/csv_xxport.cpp
xxport/csv/csvimportdialog.cpp
xxport/csv/dateparser.cpp
xxport/csv/qcsvmodel.cpp
xxport/csv/qcsvreader.cpp
xxport/ldif/ldif_xxport.cpp
xxport/ldap/ldap_xxport.cpp
xxport/ldap/ldapsearchdialog.cpp
xxport/ldap/addhostdialog.cpp
xxport/ldap/ldapoptionswidget.cpp
xxport/gmx/gmx_xxport.cpp
xxport/shared/xxport.cpp
xxport/vcard/vcard_xxport.cpp
xxport/xxportfactory.cpp
xxportmanager.cpp
${kaddressbook_editor_SRCS}
${kaddressbook_printing_SRCS}
)
qt4_add_dbus_adaptor(kaddressbook_LIB_SRCS org.kde.KAddressBook.MainWidget.xml mainwidget.h MainWidget kaddressbookadaptor )
kde4_add_kcfg_files(kaddressbook_LIB_SRCS settings.kcfgc)
kde4_add_library(kaddressbookprivate SHARED ${kaddressbook_LIB_SRCS})
target_link_libraries(kaddressbookprivate kdepim ${KDE4_PHONON_LIBS} ${KDE4_KDEUI_LIBS} ${KDEPIMLIBS_AKONADI_LIBS} ${KDEPIMLIBS_KABC_LIBS} ${KDEPIMLIBS_KCAL_LIBS} ${KDEPIMLIBS_KLDAP_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KUTILS_LIBS} akonadi-kabccommon akonadi_next)
if(QGPGME_FOUND)
target_link_libraries(kaddressbookprivate ${QGPGME_LIBRARIES})
endif(QGPGME_FOUND)
set_target_properties(kaddressbookprivate PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
install(TARGETS kaddressbookprivate ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)
########### next target ###############
set( kaddressbook_SRCS
main.cpp
mainwindow.cpp
)
# todo: more appropriate icon?
kde4_add_app_icon(kaddressbook_SRCS "${KDE4_ICON_DIR}/oxygen/*/actions/view-pim-contacts.png")
kde4_add_executable(kaddressbook RUN_UNINSTALLED ${kaddressbook_SRCS})
target_link_libraries(kaddressbook ${KDEPIMLIBS_SYNDICATION_LIBS} kdepim ${KDEPIMLIBS_KCAL_LIBS}
${KDE4_KIO_LIBS} ${KDE4_KUTILS_LIBS} ${KDE4_PHONON_LIBS})
target_link_libraries(kaddressbook ${KDEPIMLIBS_AKONADI_LIBS} akonadi-kabccommon ${KDE4_KDEUI_LIBS} kaddressbookprivate)
if(QGPGME_FOUND)
target_link_libraries(kaddressbook ${QGPGME_LIBRARIES})
endif(QGPGME_FOUND)
install(TARGETS kaddressbook ${INSTALL_TARGETS_DEFAULT_ARGS})
install( FILES kaddressbook.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
install( FILES kaddressbookui.rc DESTINATION ${DATA_INSTALL_DIR}/kaddressbook)
set(kaddressbook_PART_SRCS kaddressbookpart.cpp )
kde4_add_plugin(kaddressbookpart ${kaddressbook_PART_SRCS})
target_link_libraries(kaddressbookpart ${KDE4_KPARTS_LIBS} kaddressbookprivate )
install(TARGETS kaddressbookpart DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES kaddressbookpart.desktop DESTINATION ${SERVICES_INSTALL_DIR})
#! /bin/sh
$EXTRACTRC `find . -name \*.ui` >> rc.cpp || exit 11
$XGETTEXT `find -name \*.cpp -o -name \*.h` -o $podir/kaddressbook.pot
rm -f rc.cpp
/*
This file is part of KAddressBook.
Copyright (c) 2009 Laurent Montel <montel@kde.org>
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.
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 "aboutdata.h"
#include <klocale.h>
AboutData::AboutData()
: KAboutData( "kaddressbook", 0, ki18n( "KAddressBook" ),
"0.1", ki18n( "The KDE Address Book Application" ),
KAboutData::License_GPL_V2,
ki18n( "(c) 2007-2009 The KDE PIM Team" ) )
{
addAuthor( ki18n( "Tobias Koenig" ), ki18n( "Current maintainer" ), "tokoe@kde.org" );
addAuthor( ki18n("Laurent Montel"), ki18n( "Kontact integration" ), "montel@kde.org" );
}
AboutData::~AboutData()
{
}
/*
This file is part of KAddressBook.
Copyright (c) 2009 Laurent Montel <montel@kde.org>
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.
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 ABOUTDATA_H
#define ABOUTDATA_H
#include "kaddressbook_export.h"
#include <kaboutdata.h>
class KADDRESSBOOK_EXPORT AboutData : public KAboutData
{
public:
/**
* Creates a new about data object.
*/
AboutData();
/**
* Destroys the about data object.
*/
~AboutData();
};
#endif /* ABOUTDATA_H */
#ifndef ABSTRACTCONTACTEDITORWIDGET_H
#define ABSTRACTCONTACTEDITORWIDGET_H
#include <QtGui/QWidget>
namespace KABC
{
class Addressee;
}
class AbstractContactEditorWidget : public QWidget
{
public:
virtual void loadContact( const KABC::Addressee &contact ) = 0;
virtual void storeContact( KABC::Addressee &contact ) const = 0;
};
#endif
/*
Copyright (c) 2007 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 "collectioncombobox.h"
#include <QtCore/QAbstractItemModel>
#include <QtGui/QComboBox>
#include <QtGui/QVBoxLayout>
#include <akonadi/entitytreemodel.h>
using namespace Akonadi;
using namespace KABC;
class CollectionComboBox::Private
{
public:
Private( CollectionComboBox *parent )
: mParent( parent )
{
}
void activated( int index );
CollectionComboBox *mParent;
QComboBox *mComboBox;
};
void CollectionComboBox::Private::activated( int index )
{
if ( !mComboBox->model() )
return;
const QModelIndex modelIndex = mComboBox->model()->index( index, 0 );
if ( modelIndex.isValid() )
emit mParent->selectionChanged( modelIndex.data( EntityTreeModel::CollectionRole).value<Collection>() );
}
CollectionComboBox::CollectionComboBox( QWidget *parent )
: QWidget( parent ), d( new Private( this ) )
{
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 0 );
layout->setSpacing( 0 );
d->mComboBox = new QComboBox( this );
layout->addWidget( d->mComboBox );
connect( d->mComboBox, SIGNAL( activated( int ) ), SLOT( activated( int ) ) );
}
CollectionComboBox::~CollectionComboBox()
{
delete d;
}
void CollectionComboBox::setModel( QAbstractItemModel *model )
{
d->mComboBox->setModel( model );
}
Akonadi::Collection CollectionComboBox::selectedCollection() const
{
Q_ASSERT_X( d->mComboBox->model() != 0, "CollectionComboBox::selectionChanged", "No model set!" );
int index = d->mComboBox->currentIndex();
const QModelIndex modelIndex = d->mComboBox->model()->index( index, 0 );
if ( modelIndex.isValid() )
return modelIndex.data( Akonadi::EntityTreeModel::CollectionRole ).value<Collection>();
else
return Akonadi::Collection();
}
#include "collectioncombobox.moc"
/*
Copyright (c) 2007 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.
*/
#ifndef COLLECTIONCOMBOBOX_H
#define COLLECTIONCOMBOBOX_H
#include <QtGui/QWidget>
#include <akonadi/collection.h>
class QAbstractItemModel;
namespace KABC {
/**
* This class provides a combobox for selecting a collection.
*
* @author Tobias Koenig <tokoe@kde.org>
*/
class CollectionComboBox : public QWidget
{
Q_OBJECT
public:
/**
* Creates a new collection combobox.
*
* @param parent The parent widget.
*/
CollectionComboBox( QWidget *parent = 0 );
/**
* Destroys the collection combobox.
*/
~CollectionComboBox();
/**
* Sets the collection model.
*/
void setModel( QAbstractItemModel *model );
/**
* Returns the identifier of the selected collection
*/
Akonadi::Collection selectedCollection() const;
Q_SIGNALS:
/**
* This signal is emitted whenever the selected collection changed.
*
* @param identifier The identifier of the selected collection.
*/
void selectionChanged( const Akonadi::Collection &identifier );
private:
class Private;
Private* const d;
Q_PRIVATE_SLOT( d, void activated( int ) )
};
}
#endif
/*
Copyright (c) 2009 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 "collectionfiltermodel.h"
#include <akonadi/entitytreemodel.h>
CollectionFilterModel::CollectionFilterModel( QObject *parent )
: QSortFilterProxyModel( parent ), mRights( Akonadi::Collection::ReadOnly )
{
}
void CollectionFilterModel::addContentMimeTypeFilter( const QString &mimeType )
{
mContentMimeTypes.insert( mimeType );
invalidateFilter();
}
void CollectionFilterModel::setRightsFilter( Akonadi::Collection::Rights rights )
{
mRights = rights;
invalidateFilter();
}
bool CollectionFilterModel::filterAcceptsRow( int row, const QModelIndex &parent ) const
{
bool accepted = true;
const QModelIndex index = sourceModel()->index( row, 0, parent );
const Akonadi::Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value<Akonadi::Collection>();
if ( !collection.isValid() )
return false;
if ( !mContentMimeTypes.isEmpty() ) {
QSet<QString> contentMimeTypes = collection.contentMimeTypes().toSet();
qDebug() << collection.name() << "contentMimeTypes" << contentMimeTypes;
accepted = accepted && !(contentMimeTypes.intersect( mContentMimeTypes ).isEmpty());
}
accepted = accepted && (collection.rights() & mRights);
return accepted;
}
#include "collectionfiltermodel.moc"
/*
Copyright (c) 2009 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.
*/
#ifndef COLLECTIONFILTERMODEL_H
#define COLLECTIONFILTERMODEL_H
#include <QtGui/QSortFilterProxyModel>
#include <akonadi/collection.h>
/**
* @short A filter model for Akonadi collections.
*
* This proxy model filters Akonadi collections by content
* mime type and rights.
* It works on a flat list of collections, so a EntityTreeModel
* has to be adapted by using Akonadi::DescendantsProxyModel.
*
* @author Tobias Koenig <tokoe@kde.org>
*/
class CollectionFilterModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
/**
* Creates a new collection filter model.
*
* @param parent The parent object.
*/
CollectionFilterModel( QObject *parent );
/**
* Adds a mime type to the content mime type filter list.
*
* If a mime type has been added, only collections that contain
* this mime type in their content mime types will be listed by
* this proxy model.
*/
void addContentMimeTypeFilter( const QString &mimeType );
/**
* Sets the collection @p rights filter.
*
* Only collections that allows this rights combination
* will be listed by this proxy model.
*/
void setRightsFilter( Akonadi::Collection::Rights rights );
protected:
virtual bool filterAcceptsRow( int row, const QModelIndex &parent ) const;
private:
QSet<QString> mContentMimeTypes;
Akonadi::Collection::Rights mRights;
};
#endif
/*
This file is part of KAddressBook.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
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.
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 "collectionselectiondialog.h"
#include "collectioncombobox.h"
#include <akonadi/descendantsproxymodel.h>
#include <akonadi/entityfilterproxymodel.h>
#include <akonadi/item.h>
#include <kabc/addressee.h>
#include <klocale.h>