summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/ocontactfields.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/ocontactfields.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/ocontactfields.cpp40
1 files changed, 25 insertions, 15 deletions
diff --git a/libopie2/opiepim/ocontactfields.cpp b/libopie2/opiepim/ocontactfields.cpp
index deaa1e5..bec00f7 100644
--- a/libopie2/opiepim/ocontactfields.cpp
+++ b/libopie2/opiepim/ocontactfields.cpp
@@ -1,15 +1,15 @@
/*
This file is part of the Opie Project
- Copyright (C) The Main Author <main-author@whereever.org>
+ Copyright (C) Stefan Eilers <eilers.stefan@epost.de>
=. Copyright (C) The Opie Team <opie-devel@handhelds.org>
.=l.
.>+-=
_;:, .> :=|. This program is free software; you can
.> <`_, > . <= redistribute it and/or modify it under
:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
.="- .-=="i, .._ License as published by the Free Software
- . .-<_> .<> Foundation; either version 2 of the License,
._= =} : or (at your option) any later version.
.%`+i> _;_.
.i_,=:_. -<s. This program is distributed in the hope that
+ . -:. = it will be useful, but WITHOUT ANY WARRANTY;
@@ -18,35 +18,38 @@
_.=:. : :=>`: 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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#include <opie2/ocontactfields.h>
+#include "ocontactfields.h"
-#include <qstringlist.h>
+/* OPIE */
+#include <opie2/ocontact.h>
+#include <qpe/recordfields.h> // We should use our own enum in the future ..
+#include <qpe/config.h>
+
+/* QT */
#include <qobject.h>
+#include <qstringlist.h>
-// We should use our own enum in the future ..
-#include <qpe/recordfields.h>
-#include <qpe/config.h>
-#include <opie2/ocontact.h>
-namespace Opie {
+namespace Opie
+{
/*!
\internal
Returns a list of personal field names for a contact.
*/
QStringList OContactFields::personalfields( bool sorted, bool translated )
{
QStringList list;
QMap<int, QString> mapIdToStr;
if ( translated )
mapIdToStr = idToTrFields();
else
mapIdToStr = idToUntrFields();
@@ -414,82 +417,89 @@ QMap<QString, int> OContactFields::untrFieldsToId()
OContactFields::OContactFields():
fieldOrder( DEFAULT_FIELD_ORDER ),
changedFieldOrder( false )
{
// Get the global field order from the config file and
// use it as a start pattern
Config cfg ( "AddressBook" );
cfg.setGroup( "ContactFieldOrder" );
globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER );
}
-OContactFields::~OContactFields(){
+OContactFields::~OContactFields()
+{
// We will store the fieldorder into the config file
// to reuse it for the future..
- if ( changedFieldOrder ){
+ if ( changedFieldOrder )
+ {
Config cfg ( "AddressBook" );
cfg.setGroup( "ContactFieldOrder" );
cfg.writeEntry( "General", globalFieldOrder );
}
}
-void OContactFields::saveToRecord( OContact &cnt ){
+void OContactFields::saveToRecord( OContact &cnt )
+{
qDebug("ocontactfields saveToRecord: >%s<",fieldOrder.latin1());
// Store fieldorder into this contact.
cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder );
globalFieldOrder = fieldOrder;
changedFieldOrder = true;
}
-void OContactFields::loadFromRecord( const OContact &cnt ){
+void OContactFields::loadFromRecord( const OContact &cnt )
+{
qDebug("ocontactfields loadFromRecord");
qDebug("loading >%s<",cnt.fullName().latin1());
// Get fieldorder for this contact. If none is defined,
// we will use the global one from the config file..
fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME );
qDebug("fieldOrder from contact>%s<",fieldOrder.latin1());
- if (fieldOrder.isEmpty()){
+ if ( fieldOrder.isEmpty() )
+ {
fieldOrder = globalFieldOrder;
}
qDebug("effective fieldOrder in loadFromRecord >%s<",fieldOrder.latin1());
}
-void OContactFields::setFieldOrder( int num, int index ){
+void OContactFields::setFieldOrder( int num, int index )
+{
qDebug("qcontactfields setfieldorder pos %i -> %i",num,index);
fieldOrder[num] = QString::number( index, 16 )[0];
// We will store this new fieldorder globally to
// remember it for contacts which have none
globalFieldOrder = fieldOrder;
changedFieldOrder = true;
qDebug("fieldOrder >%s<",fieldOrder.latin1());
}
-int OContactFields::getFieldOrder( int num, int defIndex ){
+int OContactFields::getFieldOrder( int num, int defIndex )
+{
qDebug("ocontactfields getFieldOrder");
qDebug("fieldOrder >%s<",fieldOrder.latin1());
// Get index of combo as char..
QChar poschar = fieldOrder[num];
bool ok;
int ret = 0;
// Convert char to number..
if ( !( poschar == QChar::null ) )
ret = QString( poschar ).toInt(&ok, 16);
else