summaryrefslogtreecommitdiffabout
path: root/kabc/field.cpp
authorulf69 <ulf69>2004-06-30 22:07:56 (UTC)
committer ulf69 <ulf69>2004-06-30 22:07:56 (UTC)
commit1b7b7755bfbedddc72293b784577ded4e684bd6f (patch) (side-by-side diff)
treeff4eba9b8bb53401d2000d70e73a40f7c330d577 /kabc/field.cpp
parentc6f3a3f49498dca52d10418d845f4a84c0c6d941 (diff)
downloadkdepimpi-1b7b7755bfbedddc72293b784577ded4e684bd6f.zip
kdepimpi-1b7b7755bfbedddc72293b784577ded4e684bd6f.tar.gz
kdepimpi-1b7b7755bfbedddc72293b784577ded4e684bd6f.tar.bz2
added a new field of type Resource. This allowes us to display in KAddressbook for each
Addressbookentry its location
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
@@ -32,6 +32,7 @@ $Id$
#include <kglobal.h>
#include "field.h"
+#include "resource.h"
using namespace KABC;
@@ -82,7 +83,8 @@ class Field::FieldImpl
Role,
Organization,
Note,
- Url
+ Url,
+ Resource
};
int fieldId() { return mFieldId; }
@@ -190,6 +192,8 @@ QString Field::label()
return Addressee::noteLabel();
case FieldImpl::Url:
return Addressee::urlLabel();
+ case FieldImpl::Resource:
+ return Addressee::resourceLabel();
case FieldImpl::CustomField:
return mImpl->label();
default:
@@ -267,6 +271,9 @@ QString Field::value( const KABC::Addressee &a )
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:
@@ -360,6 +367,8 @@ 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;
}
@@ -408,6 +417,7 @@ Field::List Field::allFields()
createField( FieldImpl::Organization, Organization );
createField( FieldImpl::Note );
createField( FieldImpl::Url );
+ createField( FieldImpl::Resource );
}
return mAllFields;
@@ -468,13 +478,13 @@ 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() ) {
@@ -491,6 +501,9 @@ 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" );
@@ -504,7 +517,7 @@ 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;
@@ -544,6 +557,9 @@ 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;