-rw-r--r-- | kaddressbook/kabcore.cpp | 22 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 1 | ||||
-rw-r--r-- | kaddressbook/kaddressbookmain.cpp | 12 | ||||
-rw-r--r-- | kaddressbook/kaddressbookmain.h | 2 | ||||
-rw-r--r-- | kaddressbook/mainembedded.cpp | 8 |
5 files changed, 28 insertions, 17 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 9b059d3..3a542ba 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -324,8 +324,14 @@ KABCore::~KABCore() delete syncManager; } +void KABCore::recieve( QString fn ) +{ + qDebug("KABCore::recieve "); + mAddressBook->importFromFile( fn, true ); + topLevelWidget()->raise(); +} void KABCore::restoreSettings() { mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; @@ -2085,22 +2091,10 @@ void KABCore::removeVoice() return; 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 @@ -341,8 +341,9 @@ class KABCore : public QWidget, public KSyncInterface signals: 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 ); void setDetailsToState(); diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp index f48f214..8c4ca09 100644 --- a/kaddressbook/kaddressbookmain.cpp +++ b/kaddressbook/kaddressbookmain.cpp @@ -91,9 +91,19 @@ KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainW 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 @@ -80,9 +80,9 @@ class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface virtual void newContact(); 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 //US new method to setup menues and toolbars on embedded systems diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index 965fb06..6dd97b8 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp @@ -1,6 +1,7 @@ #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> +#include <qcopchannel_qws.h> #include <stdlib.h> #else #include <qapplication.h> #include <qwindowsstyle.h> @@ -76,15 +77,20 @@ int main( int argc, char **argv ) { KPimGlobalPrefs::instance()->setGlobalConfig(); } #ifndef DESKTOP_VERSION - a.showMainWidget( &m ); + 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! "); } |