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
@@ -437,37 +437,37 @@ void KABCore::setContactSelected( const QString &uid )
mExtensionManager->setSelectionChanged();
// update the actions
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 )
{
//US original kde implementation : kapp->invokeMailer( email, "" );
/*US original qtopia implementation
PimContact c = abList->currentEntry();
@@ -572,32 +572,36 @@ 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)
{
/*US
QString beamFilename;
Opie::OPimContact c;
@@ -616,79 +620,92 @@ void KABCore::beamVCard(const QStringList& uids)
} else {
unlink( beamfile ); // delete if exists
mkdir("/tmp/obex/", 0755);
c = m_abView -> currentEntry();
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
}
void KABCore::selectAllContacts()
{
mViewManager->setSelected( QString::null, true );
}
@@ -1477,38 +1494,45 @@ void KABCore::initActions()
mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
}
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
// edit menu
if ( mIsPart ) {
mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
SLOT( copyContacts() ), actionCollection(),
@@ -1584,38 +1608,33 @@ void KABCore::initActions()
// only enable LDAP lookup if we can handle the protocol
#ifndef KAB_EMBEDDED
if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
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" );
#ifdef KAB_EMBEDDED
mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
this, SLOT( createAboutData() ), actionCollection(),
@@ -1680,33 +1699,36 @@ void KABCore::addActionsManually()
//US Now connect the actions with the menue entries.
mActionPrint->plug( fileMenu );
mActionMail->plug( fileMenu );
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 );
mActionDelete->plug( editMenu );
editMenu->insertSeparator();
mActionSelectAll->plug( editMenu );
@@ -1721,33 +1743,32 @@ void KABCore::addActionsManually()
if ( mIsPart ) {
mActionConfigShortcuts->plug( settingsMenu );
mActionConfigureToolbars->plug( settingsMenu );
} 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 );
mActionDelete->plug( tb );
mActionRedo->plug( tb );
}
}