summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-08-06 08:39:55 (UTC)
committer zautrix <zautrix>2004-08-06 08:39:55 (UTC)
commit15edf84bf2bdd1cb00cbdc37d0402b9587c40f21 (patch) (side-by-side diff)
treef4da393d531292ff6702aed0936f2405bdf20555
parent3bf62eb85312197352b7c836239d6d239e9a70cf (diff)
downloadkdepimpi-15edf84bf2bdd1cb00cbdc37d0402b9587c40f21.zip
kdepimpi-15edf84bf2bdd1cb00cbdc37d0402b9587c40f21.tar.gz
kdepimpi-15edf84bf2bdd1cb00cbdc37d0402b9587c40f21.tar.bz2
Fixed some beaming problems
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp49
1 files changed, 35 insertions, 14 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index d891b07..25891a0 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -441,29 +441,29 @@ void KABCore::setContactSelected( const QString &uid )
bool selected = !uid.isEmpty();
if ( mReadWrite ) {
mActionCut->setEnabled( selected );
mActionPaste->setEnabled( selected );
}
mActionCopy->setEnabled( selected );
mActionDelete->setEnabled( selected );
mActionEditAddressee->setEnabled( selected );
mActionMail->setEnabled( selected );
mActionMailVCard->setEnabled( selected );
- if (mActionBeam)
- mActionBeam->setEnabled( selected );
+ //if (mActionBeam)
+ //mActionBeam->setEnabled( selected );
- if (mActionBeam)
- mActionBeamVCard->setEnabled( selected );
+ if (mActionBeamVCard)
+ mActionBeamVCard->setEnabled( selected );
mActionWhoAmI->setEnabled( selected );
mActionCategories->setEnabled( selected );
}
void KABCore::sendMail()
{
sendMail( mViewManager->selectedEmails().join( ", " ) );
}
void KABCore::sendMail( const QString& email )
{
@@ -576,24 +576,28 @@ void KABCore::mailVCard( const QStringList& uids )
/**
Beams the "WhoAmI contact.
*/
void KABCore::beamMySelf()
{
KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
if (!a.isEmpty())
{
QStringList uids;
uids << a.uid();
beamVCard(uids);
+ } else {
+ KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
+
+
}
}
void KABCore::beamVCard()
{
QStringList uids = mViewManager->selectedUids();
if ( !uids.isEmpty() )
beamVCard( uids );
}
void KABCore::beamVCard(const QStringList& uids)
@@ -620,71 +624,84 @@ void KABCore::beamVCard(const QStringList& uids)
Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
beamfile );
Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
access->add( c );
access->save();
delete access;
beamFilename = beamfile;
}
owarn << "Beaming: " << beamFilename << oendl;
*/
+
+#if 0
QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
QString name = "contact.vcf";
QString fileName = dirName + "/" + name;
+#endif
+ // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory
+ //
+ QString fileName = "/tmp/kdepimbeamfile";
- QDir().mkdir( dirName, true );
+ //QDir().mkdir( dirName, true );
QFile outFile(fileName);
KABC::VCardConverter converter;
QString description;
if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
QTextStream t( &outFile ); // use a text stream
t.setEncoding( QTextStream::UnicodeUTF8 );
for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
KABC::Addressee a = mAddressBook->findByUid( *it );
if ( a.isEmpty() )
continue;
if (description.isEmpty())
description = a.formattedName();
QString vcard;
converter.addresseeToVCard( a, vcard );
t << vcard;
}
+ } else {
+ qDebug("Error open temp beam file ");
+ return;
}
outFile.close();
+#ifndef DESKTOP_VERSION
Ir *ir = new Ir( this );
connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
ir->send( fileName, description, "text/x-vCard" );
+#endif
}
void KABCore::beamDone( Ir *ir )
{
+#ifndef DESKTOP_VERSION
delete ir;
+#endif
}
void KABCore::browse( const QString& url )
{
#ifndef KAB_EMBEDDED
kapp->invokeBrowser( url );
#else //KAB_EMBEDDED
qDebug("KABCore::browse must be fixed");
#endif //KAB_EMBEDDED
}
@@ -1481,30 +1498,37 @@ void KABCore::initActions()
mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
SLOT( save() ), actionCollection(), "file_sync" );
mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
SLOT( newContact() ), actionCollection(), "file_new_contact" );
mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
this, SLOT( mailVCard() ),
actionCollection(), "file_mail_vcard");
mActionBeamVCard = 0;
+ mActionBeam = 0;
+
+#ifndef DESKTOP_VERSION
if ( Ir::supported() ) {
- mActionBeamVCard = new KAction( i18n( "Beam v&Card" ), "beam", 0, this,
+ mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
SLOT( beamVCard() ), actionCollection(),
"kaddressbook_beam_vcard" );
+
+ mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
+ SLOT( beamMySelf() ), actionCollection(),
+ "kaddressbook_beam_myself" );
}
-
+#endif
mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
this, SLOT( editContact2() ),
actionCollection(), "file_properties" );
#ifdef KAB_EMBEDDED
// mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
mMainWindow, SLOT( exit() ),
actionCollection(), "quit" );
#endif //KAB_EMBEDDED
@@ -1588,30 +1612,25 @@ void KABCore::initActions()
this, SLOT( openLDAPDialog() ), actionCollection(),
"ldap_lookup" );
}
#else //KAB_EMBEDDED
//qDebug("KABCore::initActions() LDAP has to be implemented");
#endif //KAB_EMBEDDED
mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
SLOT( setWhoAmI() ), actionCollection(),
"set_personal" );
- mActionBeam = 0;
- if ( Ir::supported() ) {
- mActionBeam = new KAction( i18n( "&Beam Who Am I" ), "beam", 0, this,
- SLOT( beamMySelf() ), actionCollection(),
- "kaddressbook_beam_myself" );
- }
+
mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
SLOT( setCategories() ), actionCollection(),
"edit_set_categories" );
mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
SLOT( removeVoice() ), actionCollection(),
"remove_voice" );
mActionImportOL = new KAction( i18n( "Import from OL..." ), 0, this,
SLOT( importFromOL() ), actionCollection(),
"import_OL" );
@@ -1684,25 +1703,28 @@ void KABCore::addActionsManually()
fileMenu->insertSeparator();
mActionNewContact->plug( fileMenu );
mActionNewContact->plug( tb );
mActionEditAddressee->plug( fileMenu );
fileMenu->insertSeparator();
mActionSave->plug( fileMenu );
fileMenu->insertItem( "&Import", ImportMenu );
fileMenu->insertItem( "&Emport", ExportMenu );
fileMenu->insertSeparator();
mActionMailVCard->plug( fileMenu );
+#ifndef DESKTOP_VERSION
if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
+ if ( Ir::supported() ) mActionBeam->plug(fileMenu );
+#endif
fileMenu->insertSeparator();
mActionQuit->plug( fileMenu );
#ifdef _WIN32_
mActionImportOL->plug( ImportMenu );
#endif
// edit menu
mActionUndo->plug( editMenu );
mActionRedo->plug( editMenu );
editMenu->insertSeparator();
mActionCut->plug( editMenu );
mActionCopy->plug( editMenu );
mActionPaste->plug( editMenu );
@@ -1725,25 +1747,24 @@ void KABCore::addActionsManually()
} else {
mActionKeyBindings->plug( settingsMenu );
}
settingsMenu->insertSeparator();
mActionJumpBar->plug( settingsMenu );
mActionDetails->plug( settingsMenu );
settingsMenu->insertSeparator();
mActionWhoAmI->plug( settingsMenu );
- if ( Ir::supported() ) mActionBeam->plug( settingsMenu );
mActionCategories->plug( settingsMenu );
mActionAboutKAddressbook->plug( helpMenu );
if (QApplication::desktop()->width() > 320 ) {
mActionEditAddressee->plug( tb );
mActionSave->plug( tb );
mViewManager->getFilterAction()->plug ( tb);
if (QApplication::desktop()->width() > 480 ) {
mActionUndo->plug( tb );