summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp20
-rw-r--r--kaddressbook/kabcore.h1
-rw-r--r--kaddressbook/kaddressbookmain.cpp12
-rw-r--r--kaddressbook/kaddressbookmain.h2
-rw-r--r--kaddressbook/mainembedded.cpp6
5 files changed, 26 insertions, 15 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 9b059d3..3a542ba 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -325,6 +325,12 @@ KABCore::~KABCore()
}
+void KABCore::recieve( QString fn )
+{
+ qDebug("KABCore::recieve ");
+ mAddressBook->importFromFile( fn, true );
+ topLevelWidget()->raise();
+}
void KABCore::restoreSettings()
{
mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
@@ -2086,20 +2092,8 @@ void KABCore::removeVoice()
KABC::Addressee::List list = mViewManager->selectedAddressees();
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
- PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
- PhoneNumber::List::Iterator phoneIt;
- bool found = false;
- for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
- if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
- if ((*phoneIt).type() - PhoneNumber::Voice ) {
- (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
- (*it).insertPhoneNumber( (*phoneIt) );
- found = true;
- }
- }
- }
- if ( found )
+ if ( (*it).removeVoice() )
contactModified((*it) );
}
}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c628399..43c5f99 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -342,6 +342,7 @@ class KABCore : public QWidget, public KSyncInterface
void contactSelected( const QString &name );
void contactSelected( const QPixmap &pixmap );
public slots:
+ void recieve(QString cmsg );
void getFile( bool success );
void syncFileRequest();
void setDetailsVisible( bool visible );
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index f48f214..8c4ca09 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -92,7 +92,17 @@ KAddressBookMain::~KAddressBookMain()
{
// mCore->saveSettings();
}
-
+void KAddressBookMain::recieve( const QCString& cmsg, const QByteArray& data )
+{
+ qDebug("KA: QCOP message received: %s ", cmsg.data() );
+ if ( cmsg == "setDocument(QString)" ) {
+ QDataStream stream( data, IO_ReadOnly );
+ QString fileName;
+ stream >> fileName;
+ mCore->recieve( fileName );
+ return;
+ }
+}
void KAddressBookMain::showMinimized ()
{
QWidget::showMinimized () ;
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h
index cf6f899..40d2bdd 100644
--- a/kaddressbook/kaddressbookmain.h
+++ b/kaddressbook/kaddressbookmain.h
@@ -81,7 +81,7 @@ class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface
virtual QString getNameByPhone( QString phone );
virtual void save();
virtual void exit();
-
+ void recieve( const QCString& cmsg, const QByteArray& data );
protected:
void initActions();
#ifdef KAB_EMBEDDED
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 965fb06..6dd97b8 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,5 +1,6 @@
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
+#include <qcopchannel_qws.h>
#include <stdlib.h>
#else
#include <qapplication.h>
@@ -78,12 +79,17 @@ int main( int argc, char **argv )
}
#ifndef DESKTOP_VERSION
a.showMainWidget( &m );
+ QCopChannel* c1 = new QCopChannel("QPE/Application/addressbook",&m, "channelAB" ) ;
+ QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
#else
a.setMainWidget( &m );
m.resize (640, 480 );
m.show();
#endif
a.exec();
+#ifndef DESKTOP_VERSION
+ delete c1;
+#endif
}
qDebug("KA: Bye! ");