⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contact.cpp

📁 Trolltech公司发布的图形界面操作系统。可在qt-embedded-2.3.10平台上编译为嵌入式图形界面操作系统。
💻 CPP
📖 第 1 页 / 共 3 页
字号:
/************************************************************************ Copyright (C) 2000-2005 Trolltech AS.  All rights reserved.**** This file is part of the Qtopia Environment.** ** 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.** ** A copy of the GNU GPL license version 2 is included in this package as ** LICENSE.GPL.**** 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.**** In addition, as a special exception Trolltech gives permission to link** the code of this program with Qtopia applications copyrighted, developed** and distributed by Trolltech under the terms of the Qtopia Personal Use** License Agreement. You must comply with the GNU General Public License** in all respects for all of the code used other than the applications** licensed under the Qtopia Personal Use License Agreement. If you modify** this file, you may extend this exception to your version of the file,** but you are not obligated to do so. If you do not wish to do so, delete** this exception statement from your version.** ** See http://www.trolltech.com/gpl/ for GPL licensing information.**** Contact info@trolltech.com if any conditions of this licensing are** not clear to you.************************************************************************/#define QTOPIA_INTERNAL_CONTACT_MRE#include "contact.h"#include "vobject_p.h"#include "qfiledirect_p.h"#include <qtopia/stringutil.h>#include <qtopia/timeconversion.h>#include <qobject.h>#include <qregexp.h>#include <qstylesheet.h>#include <qfileinfo.h>#include <stdio.h>#include <qapplication.h> //for translate/*  \class Contact contact.h  \internal  \brief The Contact class holds the data of an address book entry.  This data includes information the name of the person, contact  information, and business information such as deparment and job title.  \ingroup qtopiaemb  \ingroup qtopiadesktop*/Qtopia::UidGen Contact::sUidGen( Qtopia::UidGen::Qtopia );/*  Creates a new, empty contact.*/Contact::Contact()    : Record(), mMap(), d( 0 ){}/*  \internal  Creates a new contact.  The properties of the contact are  set from \a fromMap.*/Contact::Contact( const QMap<int, QString> &fromMap ) :    Record(), mMap( fromMap ), d( 0 ){    QString cats = mMap[ Qtopia::AddressCategory ];    if ( !cats.isEmpty() )	setCategories( idsFromString( cats ) );    QString uidStr = find( Qtopia::AddressUid );    if ( uidStr.isEmpty() )	setUid( uidGen().generate() );    else	setUid( uidStr.toInt() );    if ( !uidStr.isEmpty() )	setUid( uidStr.toInt() );}/*  Destroys a contact.*/Contact::~Contact(){}/* \fn void Contact::setTitle( const QString &str )  Sets the title of the contact to \a str.*//* \fn void Contact::setFirstName( const QString &str )  Sets the first name of the contact to \a str.*//* \fn void Contact::setMiddleName( const QString &str )  Sets the middle name of the contact to \a str.*//* \fn void Contact::setLastName( const QString &str )  Sets the last name of the contact to \a str.*//* \fn void Contact::setSuffix( const QString &str )  Sets the suffix of the contact to \a str.*//* \fn void Contact::setFileAs( const QString &str )  Sets the contact to filed as \a str.*//* \fn void Contact::setDefaultEmail( const QString &str )  Sets the default email of the contact to \a str.*//* \fn void Contact::setHomeStreet( const QString &str )  Sets the home street address of the contact to \a str.*//* \fn void Contact::setHomeCity( const QString &str )  Sets the home city of the contact to \a str.*//* \fn void Contact::setHomeState( const QString &str )  Sets the home state of the contact to \a str.*//* \fn void Contact::setHomeZip( const QString &str )  Sets the home zip code of the contact to \a str.*//* \fn void Contact::setHomeCountry( const QString &str )  Sets the home country of the contact to \a str.*//* \fn void Contact::setHomePhone( const QString &str )  Sets the home phone number of the contact to \a str.*//* \fn void Contact::setHomeFax( const QString &str )  Sets the home fax number of the contact to \a str.*//* \fn void Contact::setHomeMobile( const QString &str )  Sets the home mobile phone number of the contact to \a str.*//* \fn void Contact::setHomeWebpage( const QString &str )  Sets the home webpage of the contact to \a str.*//* \fn void Contact::setCompany( const QString &str )  Sets the company for contact to \a str.*//* \fn void Contact::setJobTitle( const QString &str )  Sets the job title of the contact to \a str.*//* \fn void Contact::setDepartment( const QString &str )  Sets the department for contact to \a str.*//* \fn void Contact::setOffice( const QString &str )  Sets the office for contact to \a str.*//* \fn void Contact::setBusinessStreet( const QString &str )  Sets the business street address of the contact to \a str.*//* \fn void Contact::setBusinessCity( const QString &str )  Sets the business city of the contact to \a str.*//* \fn void Contact::setBusinessState( const QString &str )  Sets the business state of the contact to \a str.*//* \fn void Contact::setBusinessZip( const QString &str )  Sets the business zip code of the contact to \a str.*//* \fn void Contact::setBusinessCountry( const QString &str )  Sets the business country of the contact to \a str.*//* \fn void Contact::setBusinessPhone( const QString &str )  Sets the business phone number of the contact to \a str.*//* \fn void Contact::setBusinessFax( const QString &str )  Sets the business fax number of the contact to \a str.*//* \fn void Contact::setBusinessMobile( const QString &str )  Sets the business mobile phone number of the contact to \a str.*//* \fn void Contact::setBusinessPager( const QString &str )  Sets the business pager number of the contact to \a str.*//* \fn void Contact::setBusinessWebpage( const QString &str )  Sets the business webpage of the contact to \a str.*//* \fn void Contact::setProfession( const QString &str )  Sets the profession of the contact to \a str.*//* \fn void Contact::setAssistant( const QString &str )  Sets the assistant of the contact to \a str.*//* \fn void Contact::setManager( const QString &str )  Sets the manager of the contact to \a str.*//* \fn void Contact::setSpouse( const QString &str )  Sets the spouse of the contact to \a str.*//* \fn void Contact::setGender( const QString &str )  Sets the gender of the contact to \a str.*//* \fn void Contact::setBirthday( const QString &str )  Sets the birthday for the contact to \a str.*//* \fn void Contact::setAnniversary( const QString &str )  Sets the anniversary of the contact to \a str.*//* \fn void Contact::setNickname( const QString &str )  Sets the nickname of the contact to \a str.*//* \fn void Contact::setNotes( const QString &str )  Sets the notes about the contact to \a str.*//* \fn QString Contact::title() const  Returns the title of the contact.*//* \fn QString Contact::firstName() const  Returns the first name of the contact.*//* \fn QString Contact::middleName() const  Returns the middle name of the contact.*//* \fn QString Contact::lastName() const  Returns the last name of the contact.*//* \fn QString Contact::suffix() const  Returns the suffix of the contact.*//* \fn QString Contact::fileAs() const  Returns the string the contact is filed as.*//* \fn QString Contact::defaultEmail() const  Returns the default email address of the contact.*//* \fn QString Contact::emails() const  Returns the list of email address for a contact separated by ';'s in a single  string.*//* \fn QString Contact::homeStreet() const  Returns the home street address of the contact.*//* \fn QString Contact::homeCity() const  Returns the home city of the contact.*//* \fn QString Contact::homeState() const  Returns the home state of the contact.*//* \fn QString Contact::homeZip() const  Returns the home zip of the contact.*//* \fn QString Contact::homeCountry() const  Returns the home country of the contact.*//* \fn QString Contact::homePhone() const  Returns the home phone number of the contact.*//* \fn QString Contact::homeFax() const  Returns the home fax number of the contact.*//* \fn QString Contact::homeMobile() const  Returns the home mobile number of the contact.*//* \fn QString Contact::homeWebpage() const  Returns the home webpage of the contact.*//* \fn QString Contact::company() const  Returns the company for the contact.*//* \fn QString Contact::department() const  Returns the department for the contact.*//* \fn QString Contact::office() const  Returns the office for the contact.*//* \fn QString Contact::jobTitle() const  Returns the job title of the contact.*//* \fn QString Contact::profession() const  Returns the profession of the contact.*//* \fn QString Contact::assistant() const  Returns the assistant of the contact.*//* \fn QString Contact::manager() const  Returns the manager of the contact.*//* \fn QString Contact::businessStreet() const  Returns the business street address of the contact.*//* \fn QString Contact::businessCity() const  Returns the business city of the contact.*//* \fn QString Contact::businessState() const  Returns the business state of the contact.*//* \fn QString Contact::businessZip() const  Returns the business zip of the contact.*//* \fn QString Contact::businessCountry() const  Returns the business country of the contact.*//* \fn QString Contact::businessPhone() const  Returns the business phone number of the contact.*//* \fn QString Contact::businessFax() const  Returns the business fax number of the contact.*//* \fn QString Contact::businessMobile() const  Returns the business mobile number of the contact.*//* \fn QString Contact::businessPager() const  Returns the business pager number of the contact.*//* \fn QString Contact::businessWebpage() const  Returns the business webpage of the contact.*//* \fn QString Contact::spouse() const  Returns the spouse of the contact.*//* \fn QString Contact::gender() const  Returns the gender of the contact.*//* \fn QString Contact::birthday() const  Returns the birthday of the contact.*//* \fn QString Contact::anniversary() const  Returns the anniversary of the contact.*//* \fn QString Contact::nickname() const  Returns the nickname of the contact.*//* \fn QString Contact::children() const  Returns the children of the contact.*//* \fn QString Contact::notes() const  Returns the notes relating to the the contact.*//* \fn QString Contact::groups() const  \internal  Returns the groups for the contact.*//* \fn QStringList Contact::groupList() const  \internal*//* \fn QString Contact::field(int) const  \internal*//* \fn void Contact::saveJournal( journal_action, const QString & = QString::null )  \internal*//* \fn void Contact::setUid( int id )  \internal  Sets the uid for this record to \a id.*//* \enum Contact::journal_action  \internal*//*  \internal*/QMap<int, QString> Contact::toMap() const{    QMap<int, QString> map = mMap;    QString cats = idsToString( categories() );    if ( !cats.isEmpty() )	map.insert( Qtopia::AddressCategory, cats );    return map;}/*  Returns a rich text formatted QString representing the contents the contact.*/QString Contact::toRichText() const{    QString text;    QString value, comp, state;    // name, jobtitle and company    if ( !(value = fullName()).isEmpty() )	text += "<b>" + Qtopia::escapeString(value) + "</b><br>";    if ( !(value = jobTitle()).isEmpty() )	text += Qtopia::escapeString(value) + "<br>";    comp = company();    if ( !(value = department()).isEmpty() ) {	text += Qtopia::escapeString(value);	if ( comp )	    text += ", ";	else	    text += "<br>";    }    if ( !comp.isEmpty() )	text += Qtopia::escapeString(comp) + "<br>";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -