summaryrefslogtreecommitdiff
authoreilers <eilers>2003-02-28 10:25:31 (UTC)
committer eilers <eilers>2003-02-28 10:25:31 (UTC)
commit81cbb2d97b4f0cd7eef56536d791434856d7ae8d (patch) (side-by-side diff)
tree644f7c1dc38c07b67b9337a4138ca80741d0c9ca
parent18c19111466e43e91678c5a1fa50f2f561ca3257 (diff)
downloadopie-81cbb2d97b4f0cd7eef56536d791434856d7ae8d.zip
opie-81cbb2d97b4f0cd7eef56536d791434856d7ae8d.tar.gz
opie-81cbb2d97b4f0cd7eef56536d791434856d7ae8d.tar.bz2
Beaming personal vcard on keypress is implented now !
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 0276231..8937227 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -533,61 +533,63 @@ void AddressbookWindow::writeMail()
e << name << email;
return;
} else
m_config.setUseQtMail( true );
}
}
static const char * beamfile = "/tmp/obex/contact.vcf";
void AddressbookWindow::slotBeam()
{
- QString filename;
+ QString beamFilename;
OContact c;
if ( actionPersonal->isOn() ) {
- filename = addressbookPersonalVCardName();
- if (!QFile::exists(filename))
+ beamFilename = addressbookPersonalVCardName();
+ if ( !QFile::exists( beamFilename ) )
return; // can't beam a non-existent file
OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
- filename );
+ beamFilename );
OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
OContactAccess::List allList = access->allRecords();
OContactAccess::List::Iterator it = allList.begin(); // Just take first
c = *it;
delete access;
} else {
unlink( beamfile ); // delete if exists
mkdir("/tmp/obex/", 0755);
c = m_abView -> currentEntry();
OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
beamfile );
OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
access->add( c );
access->save();
delete access;
- filename = beamfile;
+ beamFilename = beamfile;
}
+ qWarning("Beaming: %s", beamFilename.latin1() );
Ir *ir = new Ir( this );
connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
QString description = c.fullName();
- ir->send( filename, description, "text/x-vCard" );
+ ir->send( beamFilename, description, "text/x-vCard" );
}
void AddressbookWindow::beamDone( Ir *ir )
{
+
delete ir;
unlink( beamfile );
}
static void parseName( const QString& name, QString *first, QString *middle,
QString * last )
{
int comma = name.find ( "," );
QString rest;
if ( comma > 0 ) {
@@ -630,27 +632,33 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data)
// qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() );
cnt.setFirstName( fn );
cnt.setMiddleName( mn );
cnt.setLastName( ln );
cnt.insertEmails( email );
cnt.setDefaultEmail( email );
cnt.setFileAs();
m_abView -> addEntry( cnt );
// :SXm_abView()->init( cnt );
editEntry( EditEntry );
-
-
-
+ } else if ( msg == "beamBusinessCard()" ) {
+ QString beamFilename = addressbookPersonalVCardName();
+ if ( !QFile::exists( beamFilename ) )
+ return; // can't beam a non-existent file
+
+ Ir *ir = new Ir( this );
+ connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
+ QString description = "mycard.vcf";
+ ir->send( beamFilename, description, "text/x-vCard" );
}
#if 0
else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) {
QDataStream stream(data,IO_ReadOnly);
QCString ch,m;
QStringList types;
stream >> ch >> m >> types;
AddressPicker picker(abList,this,0,TRUE);
picker.showMaximized();
picker.setChoiceNames(types);
int i=0;
for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) {