summaryrefslogtreecommitdiffabout
path: root/kabc/field.cpp
Side-by-side diff
Diffstat (limited to 'kabc/field.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/field.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/kabc/field.cpp b/kabc/field.cpp
index 41bbfde..bc2e176 100644
--- a/kabc/field.cpp
+++ b/kabc/field.cpp
@@ -31,8 +31,9 @@ $Id$
#include <kconfigbase.h>
#include <kglobal.h>
#include "field.h"
+#include "resource.h"
using namespace KABC;
class Field::FieldImpl
@@ -81,9 +82,10 @@ class Field::FieldImpl
Title,
Role,
Organization,
Note,
- Url
+ Url,
+ Resource
};
int fieldId() { return mFieldId; }
int category() { return mCategory; }
@@ -189,8 +191,10 @@ QString Field::label()
case FieldImpl::Note:
return Addressee::noteLabel();
case FieldImpl::Url:
return Addressee::urlLabel();
+ case FieldImpl::Resource:
+ return Addressee::resourceLabel();
case FieldImpl::CustomField:
return mImpl->label();
default:
return i18n("Unknown Field");
@@ -266,8 +270,11 @@ QString Field::value( const KABC::Addressee &a )
else
return QString::null;
case FieldImpl::Url:
return a.url().prettyURL();
+//US
+ case FieldImpl::Resource:
+ return a.resource()->resourceName();
case FieldImpl::HomePhone:
return a.phoneNumber( PhoneNumber::Home ).number();
case FieldImpl::BusinessPhone:
return a.phoneNumber( PhoneNumber::Work ).number();
@@ -359,8 +366,10 @@ bool Field::setValue( KABC::Addressee &a, const QString &value )
}
return true;
case FieldImpl::CustomField:
a.insertCustom( mImpl->app(), mImpl->key(), value );
+//US never copy the resourcename back to the adressee.
+ case FieldImpl::Resource:
default:
return false;
}
}
@@ -407,8 +416,9 @@ Field::List Field::allFields()
createField( FieldImpl::Role, Organization );
createField( FieldImpl::Organization, Organization );
createField( FieldImpl::Note );
createField( FieldImpl::Url );
+ createField( FieldImpl::Resource );
}
return mAllFields;
}
@@ -467,15 +477,15 @@ void Field::saveFields( KConfig *cfg, const QString &identifier,
{
QValueList<int> fieldIds;
//US
-//US qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1());
+// qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1());
int custom = 0;
Field::List::ConstIterator it;
for( it = fields.begin(); it != fields.end(); ++it ) {
//US
-//US qDebug("Field::saveFields field:%i", (*it)->mImpl->fieldId());
+// qDebug("Field::saveFields field:%i", (*it)->mImpl->fieldId());
fieldIds.append( (*it)->mImpl->fieldId() );
if( (*it)->isCustom() ) {
QStringList customEntry;
@@ -490,8 +500,11 @@ void Field::saveFields( KConfig *cfg, const QString &identifier,
}
Field::List Field::restoreFields( const QString &identifier )
{
+//US
+// qDebug("Field::restoreFields, identifier: %s", identifier.latin1());
+
KConfig *cfg = KGlobal::config();
KConfigGroupSaver( cfg, "KABCFields" );
cfg->setGroup( "KABCFields" );
@@ -503,9 +516,9 @@ Field::List Field::restoreFields( const QString &identifier )
Field::List Field::restoreFields( KConfig *cfg, const QString &identifier )
{
QValueList<int> fieldIds = cfg->readIntListEntry( identifier);
//US
- qDebug("Field::restoreFields from %s", cfg->getFileName().latin1());
+// qDebug("Field::restoreFields from %s, identifier: %s", cfg->getFileName().latin1(), identifier.latin1());
Field::List fields;
int custom = 0;
@@ -543,8 +556,11 @@ Field *Field::createCustomField( const QString &label, int category,
{
Field *field = new Field( new FieldImpl( FieldImpl::CustomField,
category | CustomCategory,
label, key, app ) );
+//US
+// qDebug("Field::createCustomField label %s", label.latin1() );
+
mCustomFields.append( field );
return field;
}