Commit f4a0c421 authored by Allen Winter's avatar Allen Winter

CamelCase headers

coding style
parent 142a62e7
/*
This file is part of KAddressBook.
This file is part of KAddressBook.
Copyright (c) 2009 Laurent Montel <montel@kde.org>
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 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.
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.
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 "kdepim-version.h"
#include <klocale.h>
#include <KLocale>
AboutData::AboutData()
: KAboutData( "kaddressbook", 0, ki18n( "KAddressBook" ),
......
/*
This file is part of KAddressBook.
This file is part of KAddressBook.
Copyright (c) 2009 Laurent Montel <montel@kde.org>
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 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.
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.
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
......@@ -23,7 +23,7 @@
#include "kaddressbook_export.h"
#include <kaboutdata.h>
#include <KAboutData>
class KADDRESSBOOK_EXPORT AboutData : public KAboutData
{
......@@ -39,6 +39,5 @@ class KADDRESSBOOK_EXPORT AboutData : public KAboutData
~AboutData();
};
#endif /* ABOUTDATA_H */
This diff is collapsed.
/*
This file is part of KAddressBook.
This file is part of KAddressBook.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
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 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.
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.
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 CONTACTFIELDS_H
#define CONTACTFIELDS_H
#include <kabc/addressee.h>
#include <KABC/Addressee>
class ContactFields
{
......
/*
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.
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 "contactselectiondialog.h"
#include "contactselectionwidget.h"
#include <klocale.h>
#include <KLocale>
ContactSelectionDialog::ContactSelectionDialog( QItemSelectionModel *selectionModel, QWidget *parent )
ContactSelectionDialog::ContactSelectionDialog( QItemSelectionModel *selectionModel,
QWidget *parent )
: KDialog( parent )
{
setCaption( i18n( "Select Contacts" ) );
......
/*
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
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 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.
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.
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 CONTACTSELECTIONDIALOG_H
#define CONTACTSELECTIONDIALOG_H
#include <kabc/addressee.h>
#include <kdialog.h>
#include <KABC/Addressee>
#include <KDialog>
class ContactSelectionWidget;
......@@ -29,7 +29,7 @@ class QItemSelectionModel;
namespace Akonadi
{
class Collection;
class Collection;
}
/**
......
/*
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.
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 "contactselectionwidget.h"
#include <akonadi/collectioncombobox.h>
#include <akonadi/entitytreemodel.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/recursiveitemfetchjob.h>
#include <klocale.h>
#include <Akonadi/CollectionComboBox>
#include <Akonadi/EntityTreeModel>
#include <Akonadi/ItemFetchJob>
#include <Akonadi/ItemFetchScope>
#include <Akonadi/RecursiveItemFetchJob>
#include <KLocale>
#include <QtGui/QButtonGroup>
#include <QtGui/QCheckBox>
......@@ -35,7 +36,8 @@
#include <QtGui/QRadioButton>
#include <QtGui/QVBoxLayout>
ContactSelectionWidget::ContactSelectionWidget( QItemSelectionModel *selectionModel, QWidget *parent )
ContactSelectionWidget::ContactSelectionWidget( QItemSelectionModel *selectionModel,
QWidget *parent )
: QWidget( parent ), mSelectionModel( selectionModel )
{
initGui();
......@@ -50,10 +52,11 @@ ContactSelectionWidget::ContactSelectionWidget( QItemSelectionModel *selectionMo
mAddressBookSelectionRecursive, SLOT(setEnabled(bool)) );
// apply default configuration
if ( mSelectionModel->hasSelection() )
if ( mSelectionModel->hasSelection() ) {
mSelectedContactsButton->setChecked( true );
else
} else {
mAllContactsButton->setChecked( true );
}
}
void ContactSelectionWidget::setMessageText( const QString &message )
......@@ -68,12 +71,13 @@ void ContactSelectionWidget::setDefaultAddressBook( const Akonadi::Collection &a
KABC::Addressee::List ContactSelectionWidget::selectedContacts() const
{
if ( mAllContactsButton->isChecked() )
if ( mAllContactsButton->isChecked() ) {
return collectAllContacts();
else if ( mSelectedContactsButton->isChecked() )
} else if ( mSelectedContactsButton->isChecked() ) {
return collectSelectedContacts();
else if ( mAddressBookContactsButton->isChecked() )
} else if ( mAddressBookContactsButton->isChecked() ) {
return collectAddressBookContacts();
}
return KABC::Addressee::List();
}
......@@ -121,17 +125,20 @@ void ContactSelectionWidget::initGui()
KABC::Addressee::List ContactSelectionWidget::collectAllContacts() const
{
Akonadi::RecursiveItemFetchJob *job = new Akonadi::RecursiveItemFetchJob( Akonadi::Collection::root(),
QStringList() << KABC::Addressee::mimeType() );
Akonadi::RecursiveItemFetchJob *job =
new Akonadi::RecursiveItemFetchJob( Akonadi::Collection::root(),
QStringList() << KABC::Addressee::mimeType() );
job->fetchScope().fetchFullPayload();
KABC::Addressee::List contacts;
if ( !job->exec() )
if ( !job->exec() ) {
return contacts;
}
foreach ( const Akonadi::Item &item, job->items() ) {
if ( item.isValid() && item.hasPayload<KABC::Addressee>() )
if ( item.isValid() && item.hasPayload<KABC::Addressee>() ) {
contacts.append( item.payload<KABC::Addressee>() );
}
}
return contacts;
......@@ -145,9 +152,11 @@ KABC::Addressee::List ContactSelectionWidget::collectSelectedContacts() const
for ( int i = 0; i < indexes.count(); ++i ) {
const QModelIndex index = indexes.at( i );
if ( index.isValid() ) {
const Akonadi::Item item = index.data( Akonadi::EntityTreeModel::ItemRole ).value<Akonadi::Item>();
if ( item.isValid() && item.hasPayload<KABC::Addressee>() )
const Akonadi::Item item =
index.data( Akonadi::EntityTreeModel::ItemRole ).value<Akonadi::Item>();
if ( item.isValid() && item.hasPayload<KABC::Addressee>() ) {
contacts.append( item.payload<KABC::Addressee>() );
}
}
}
......@@ -164,12 +173,14 @@ KABC::Addressee::List ContactSelectionWidget::collectAddressBookContacts() const
}
if ( mAddressBookSelectionRecursive->isChecked() ) {
Akonadi::RecursiveItemFetchJob *job = new Akonadi::RecursiveItemFetchJob( collection,
QStringList() << KABC::Addressee::mimeType() );
Akonadi::RecursiveItemFetchJob *job =
new Akonadi::RecursiveItemFetchJob( collection,
QStringList() << KABC::Addressee::mimeType() );
job->fetchScope().fetchFullPayload();
if ( !job->exec() )
if ( !job->exec() ) {
return contacts;
}
foreach ( const Akonadi::Item &item, job->items() ) {
if ( item.hasPayload<KABC::Addressee>() ) {
......@@ -180,8 +191,9 @@ KABC::Addressee::List ContactSelectionWidget::collectAddressBookContacts() const
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection );
job->fetchScope().fetchFullPayload();
if ( !job->exec() )
if ( !job->exec() ) {
return contacts;
}
foreach ( const Akonadi::Item &item, job->items() ) {
if ( item.hasPayload<KABC::Addressee>() ) {
......
/*
This file is part of KAddressBook.
This file is part of KAddressBook.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
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 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.
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.
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 "contactsorter.h"
#include <kabc/addressee.h>
#include <KABC/Addressee>
class ContactSortHelper
{
......@@ -30,29 +30,44 @@ class ContactSortHelper
{
}
inline bool operator()( const KABC::Addressee &contact, const KABC::Addressee &otherContact ) const
inline bool operator()( const KABC::Addressee &contact,
const KABC::Addressee &otherContact ) const
{
int result = QString::localeAwareCompare( ContactFields::value( mSortField, contact ),
ContactFields::value( mSortField, otherContact ) );
int result =
QString::localeAwareCompare(
ContactFields::value( mSortField, contact ),
ContactFields::value( mSortField, otherContact ) );
if ( result == 0 ) {
int givenNameResult = QString::localeAwareCompare( ContactFields::value( ContactFields::GivenName, contact ),
ContactFields::value( ContactFields::GivenName, otherContact ) );
int givenNameResult =
QString::localeAwareCompare(
ContactFields::value( ContactFields::GivenName, contact ),
ContactFields::value( ContactFields::GivenName, otherContact ) );
if ( givenNameResult == 0 ) {
int familyNameResult = QString::localeAwareCompare( ContactFields::value( ContactFields::FamilyName, contact ),
ContactFields::value( ContactFields::FamilyName, otherContact ) );
int familyNameResult =
QString::localeAwareCompare(
ContactFields::value( ContactFields::FamilyName, contact ),
ContactFields::value( ContactFields::FamilyName, otherContact ) );
if ( familyNameResult == 0 ) {
result = QString::localeAwareCompare( ContactFields::value( ContactFields::FormattedName, contact ),
ContactFields::value( ContactFields::FormattedName, otherContact ) );
} else
result =
QString::localeAwareCompare(
ContactFields::value( ContactFields::FormattedName, contact ),
ContactFields::value( ContactFields::FormattedName, otherContact ) );
} else {
result = familyNameResult;
} else
}
} else {
result = givenNameResult;
}
}
bool lesser = result < 0;
if ( mSortOrder == Qt::DescendingOrder )
if ( mSortOrder == Qt::DescendingOrder ) {
lesser = !lesser;
}
return lesser;
}
......
/*
This file is part of KAddressBook.
This file is part of KAddressBook.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
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 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.
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.
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 CONTACTSORTER_H
......@@ -26,7 +26,8 @@
class ContactSorter
{
public:
explicit ContactSorter( ContactFields::Field field, Qt::SortOrder sortOrder = Qt::AscendingOrder );
explicit ContactSorter( ContactFields::Field field,
Qt::SortOrder sortOrder = Qt::AscendingOrder );
void sort( QList<KABC::Addressee> &contacts ) const;
......
/*
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.
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 "contactswitcher.h"
#include <klocale.h>
#include <KLocale>
#include <QtGui/QAbstractItemView>
#include <QtGui/QHBoxLayout>
......@@ -27,8 +27,7 @@
#include <QtGui/QPushButton>
ContactSwitcher::ContactSwitcher( QWidget *parent )
: QWidget( parent ),
mView( 0 )
: QWidget( parent ), mView( 0 )
{
QHBoxLayout *layout = new QHBoxLayout( this );
......@@ -60,14 +59,16 @@ void ContactSwitcher::setView( QAbstractItemView *view )
void ContactSwitcher::nextClicked()
{
if ( !mView || !mView->model() )
if ( !mView || !mView->model() ) {
return;
}
const QModelIndex index = mView->selectionModel()->currentIndex();
int row = 0;
if ( index.isValid() )
if ( index.isValid() ) {
row = index.row() + 1;
}
mView->selectionModel()->setCurrentIndex( mView->model()->index( row, 0 ),
QItemSelectionModel::Rows |
......@@ -78,14 +79,16 @@ void ContactSwitcher::nextClicked()
void ContactSwitcher::previousClicked()
{
if ( !mView || !mView->model() )
if ( !mView || !mView->model() ) {
return;
}
const QModelIndex index = mView->selectionModel()->currentIndex();
int row = 0;
if ( index.isValid() )
if ( index.isValid() ) {
row = index.row() - 1;