summaryrefslogtreecommitdiff
path: root/libopie2/opiepim
authoreilers <eilers>2002-10-01 16:20:40 (UTC)
committer eilers <eilers>2002-10-01 16:20:40 (UTC)
commit541bd9eaebd630a39a9f1df320bf6e46d499c10a (patch) (side-by-side diff)
treeb897e17212c13432b142574ed4e23f59020e5a5d /libopie2/opiepim
parent3352558f31f2f3f5f32730a28f07161fe71787a9 (diff)
downloadopie-541bd9eaebd630a39a9f1df320bf6e46d499c10a.zip
opie-541bd9eaebd630a39a9f1df320bf6e46d499c10a.tar.gz
opie-541bd9eaebd630a39a9f1df320bf6e46d499c10a.tar.bz2
Implementation of some virtual methods
Diffstat (limited to 'libopie2/opiepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/ocontact.cpp12
-rw-r--r--libopie2/opiepim/ocontact.h11
2 files changed, 13 insertions, 10 deletions
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index 66632f5..828a9de 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -1364,70 +1364,70 @@ QValueList<OContact> OContact::readVCard( const QString &filename )
{
qDebug("trying to open %s, exists=%d", filename.utf8().data(), QFileInfo( filename.utf8().data() ).size() );
VObject *obj = Parse_MIME_FromFileName( (char *)filename.utf8().data() );
qDebug("vobject = %p", obj );
QValueList<OContact> contacts;
while ( obj ) {
contacts.append( parseVObject( obj ) );
VObject *t = obj;
obj = nextVObjectInList(obj);
cleanVObject( t );
}
return contacts;
}
/*!
Returns TRUE if the contact matches the regular expression \a regexp.
Otherwise returns FALSE.
*/
bool OContact::match( const QString &regexp ) const
{
return match(QRegExp(regexp));
}
/*!
\overload
Returns TRUE if the contact matches the regular expression \a regexp.
Otherwise returns FALSE.
*/
bool OContact::match( const QRegExp &r ) const
{
bool match;
match = false;
QMap<int, QString>::ConstIterator it;
for ( it = mMap.begin(); it != mMap.end(); ++it ) {
if ( (*it).find( r ) > -1 ) {
match = true;
break;
}
}
return match;
}
-// Noch nicht definiert ! :SX
QString OContact::toShortText() const
{
- return ( QString::fromLatin1( "Not defined!") );
+ return ( fullName() );
}
QString OContact::type() const
{
return QString::fromLatin1( "OContact" );
}
-// Noch nicht definiert ! :SX
+// Definition is missing ! (se)
QMap<QString,QString> OContact::toExtraMap() const
{
+ qWarning ("Function not implemented: OContact::toExtraMap()");
QMap <QString,QString> useless;
return useless;
}
-// Noch nicht definiert ! :SX
-class QString OContact::recordField(int) const
+class QString OContact::recordField( int pos ) const
{
- return QString::fromLatin1( "Noch nicht implementiert !" );
+ QStringList SLFIELDS = fields(); // ?? why this ? (se)
+ return SLFIELDS[pos];
}
diff --git a/libopie2/opiepim/ocontact.h b/libopie2/opiepim/ocontact.h
index e0555c8..756c87d 100644
--- a/libopie2/opiepim/ocontact.h
+++ b/libopie2/opiepim/ocontact.h
@@ -163,106 +163,109 @@ public:
QString profession() const { return find( Qtopia::Profession ); }
QString assistant() const { return find( Qtopia::Assistant ); }
QString manager() const { return find( Qtopia::Manager ); }
/** Multi line string containing all non-empty address info in the form
* Street
* City, State Zip
* Country
*/
QString displayBusinessAddress() const;
//personal
QString spouse() const { return find( Qtopia::Spouse ); }
QString gender() const { return find( Qtopia::Gender ); }
QString birthday() const { return find( Qtopia::Birthday ); }
QString anniversary() const { return find( Qtopia::Anniversary ); }
QString nickname() const { return find( Qtopia::Nickname ); }
QString children() const { return find( Qtopia::Children ); }
QStringList childrenList() const;
// other
QString notes() const { return find( Qtopia::Notes ); }
QString groups() const { return find( Qtopia::Groups ); }
QStringList groupList() const;
// // custom
// const QString &customField( const QString &key )
// { return find( Custom- + key ); }
static QStringList fields();
static QStringList trfields();
QString toRichText() const;
QMap<int, QString> toMap() const;
QString field( int key ) const { return find( key ); }
// journaling...
void saveJournal( journal_action action, const QString &key = QString::null );
void save( QString &buf ) const;
void setUid( int i )
{ Record::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); }
QString toShortText()const;
QString OContact::type()const;
QMap<QString,QString> OContact::toExtraMap() const;
class QString OContact::recordField(int) const;
+ // Why private ? (eilers,se)
+ QString emailSeparator() const { return " "; }
+ // the emails should be seperated by a comma
+ void setEmails( const QString &v );
+ QString emails() const { return find( Qtopia::Emails ); }
+
+
private:
friend class AbEditor;
friend class AbTable;
friend class AddressBookAccessPrivate;
friend class XMLIO;
- QString emailSeparator() const { return " "; }
- // the emails should be seperated by a comma
- void setEmails( const QString &v );
- QString emails() const { return find( Qtopia::Emails ); }
void insert( int key, const QString &value );
void replace( int key, const QString &value );
QString find( int key ) const;
QString displayAddress( const QString &street,
const QString &city,
const QString &state,
const QString &zip,
const QString &country ) const;
Qtopia::UidGen &uidGen() { return sUidGen; }
static Qtopia::UidGen sUidGen;
QMap<int, QString> mMap;
ContactPrivate *d;
};
// these methods are inlined to keep binary compatability with Qtopia 1.5
inline void OContact::insertEmail( const QString &v )
{
//qDebug("insertEmail %s", v.latin1());
QString e = v.simplifyWhiteSpace();
QString def = defaultEmail();
// if no default, set it as the default email and don't insert
if ( def.isEmpty() ) {
setDefaultEmail( e ); // will insert into the list for us
return;
}
// otherwise, insert assuming doesn't already exist
QString emailsStr = find( Qtopia::Emails );
if ( emailsStr.contains( e ))
return;
if ( !emailsStr.isEmpty() )
emailsStr += emailSeparator();
emailsStr += e;
replace( Qtopia::Emails, emailsStr );
}
inline void OContact::removeEmail( const QString &v )
{
QString e = v.simplifyWhiteSpace();
QString def = defaultEmail();
QString emailsStr = find( Qtopia::Emails );
QStringList emails = emailList();
// otherwise, must first contain it