summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-09 02:17:06 (UTC)
committer zautrix <zautrix>2004-10-09 02:17:06 (UTC)
commitc2165f4e14bc2f7ab2ef19f5c35497dde5e87a0d (patch) (side-by-side diff)
treeb83f7cfe5d4bb681b756fe95446e5e3fc193bc36
parent07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861 (diff)
downloadkdepimpi-c2165f4e14bc2f7ab2ef19f5c35497dde5e87a0d.zip
kdepimpi-c2165f4e14bc2f7ab2ef19f5c35497dde5e87a0d.tar.gz
kdepimpi-c2165f4e14bc2f7ab2ef19f5c35497dde5e87a0d.tar.bz2
import ir fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/kopiWhatsNew.txt8
-rw-r--r--kabc/addressbook.cpp16
-rw-r--r--kabc/addressbook.h2
-rw-r--r--kabc/addressee.cpp17
-rw-r--r--kabc/addressee.h1
-rw-r--r--kaddressbook/kabcore.cpp22
-rw-r--r--kaddressbook/kabcore.h1
-rw-r--r--kaddressbook/kaddressbookmain.cpp12
-rw-r--r--kaddressbook/kaddressbookmain.h2
-rw-r--r--kaddressbook/mainembedded.cpp8
-rw-r--r--korganizer/mainwindow.cpp15
-rw-r--r--libkdepim/ksyncmanager.cpp6
12 files changed, 79 insertions, 31 deletions
diff --git a/bin/kdepim/korganizer/kopiWhatsNew.txt b/bin/kdepim/korganizer/kopiWhatsNew.txt
index eea860c..3f95dcf 100644
--- a/bin/kdepim/korganizer/kopiWhatsNew.txt
+++ b/bin/kdepim/korganizer/kopiWhatsNew.txt
@@ -9,21 +9,27 @@ application/config data should be saved.
Define your desired path in the evironment variable
MICROKDEHOME
before starting KO/Pi or KA/Pi.
An easy Kx/Pi to Kx/Pi syncing is now possible
(it is called Pi-Sync) via network.
Please look at the Sync Howto.
-Exporting of data to mobile phones is now possible.
+Exporting of calendar data and contacts to mobile phones is now possible.
The SyncHowto is updated with information howto
access/sync mobile phones.
Please look at the Sync Howto.
+Now KO/Pi and KA/Pi on the Zaurus can receive data via infrared directly.
+Please disable Fastload for the original contact/calendar applications
+and close them.
+KO/Pi and KA/Pi must be running in order to receive the data.
+(KO/Pi and KA/Pi are always running if Fastload for them is enabled!)
+
********** VERSION 1.9.6 ************
Changes in the external application communication on the Zaurus
in order to use less RAM when the apps are running.
First syncing of addressbooks (KA/Pi) is possible.
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index dc3cda1..bf6d053 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -397,32 +397,40 @@ void AddressBook::export2File( QString fileName )
QString vcard;
//Resource *resource() const;
converter.addresseeToVCard( *it, vcard, version );
t << vcard << "\r\n";
}
t << "\r\n\r\n";
outFile.close();
}
-void AddressBook::importFromFile( QString fileName )
+void AddressBook::importFromFile( QString fileName, bool replaceLabel )
{
- KABC::Addressee::List list;
+ KABC::Addressee::List list;
QFile file( fileName );
file.open( IO_ReadOnly );
QByteArray rawData = file.readAll();
file.close();
-
- QString data = QString::fromUtf8( rawData.data(), rawData.size() + 1 );
+ qDebug("AddressBook::importFromFile ");
+ QString data;
+ if ( replaceLabel ) {
+ data = QString::fromLatin1( rawData.data(), rawData.size() + 1 );
+ data.replace ( QRegExp("LABEL") , "ADR" );
+ data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" );
+ } else
+ data = QString::fromUtf8( rawData.data(), rawData.size() + 1 );
KABC::VCardTool tool;
list = tool.parseVCards( data );
KABC::Addressee::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
(*it).setResource( 0 );
+ if ( replaceLabel )
+ (*it).removeVoice();
insertAddressee( (*it), false, true );
}
}
bool AddressBook::saveAB()
{
bool ok = true;
diff --git a/kabc/addressbook.h b/kabc/addressbook.h
index 3603ec1..cea1b03 100644
--- a/kabc/addressbook.h
+++ b/kabc/addressbook.h
@@ -138,17 +138,17 @@ class AddressBook : public QObject
Save address book. The address book is saved to the file, the Ticket
object has been requested for by @ref requestSaveTicket().
@param ticket a ticket object returned by @ref requestSaveTicket()
*/
bool save( Ticket *ticket );
bool saveAB( );
void export2File( QString fileName );
- void importFromFile( QString fileName );
+ void importFromFile( QString fileName, bool replaceLabel = false );
/**
Returns a iterator for first entry of address book.
*/
Iterator begin();
/**
Returns a const iterator for first entry of address book.
*/
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 19a1845..3f3d5c0 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -310,16 +310,33 @@ void Addressee::mergeContact( const Addressee& ad )
// merging categories;
// merging custom;
// merging keys
qDebug("merge contact %s ", ad.uid().latin1());
setUid( ad.uid() );
setRevision( ad.revision() );
}
+bool Addressee::removeVoice()
+{
+ PhoneNumber::List phoneN = phoneNumbers();
+ PhoneNumber::List::Iterator phoneIt;
+ bool found = false;
+ for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) {
+ if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
+ if ((*phoneIt).type() - PhoneNumber::Voice ) {
+ (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
+ insertPhoneNumber( (*phoneIt) );
+ found = true;
+ }
+ }
+
+ }
+ return found;
+}
void Addressee::simplifyAddresses()
{
if ( mData->addresses.count() < 3 ) return ;
int count = 0;
Address::List list;
Address::List::Iterator it;
for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
if ( count > 1 )
diff --git a/kabc/addressee.h b/kabc/addressee.h
index 44f0629..9336edc 100644
--- a/kabc/addressee.h
+++ b/kabc/addressee.h
@@ -116,16 +116,17 @@ class Addressee
QString externalUID() const;
void setOriginalExternalUID( const QString &id );
QString originalExternalUID() const;
void mergeContact( const Addressee& ad );
void simplifyEmails();
void simplifyAddresses();
void simplifyPhoneNumbers();
void simplifyPhoneNumberTypes();
+ bool removeVoice();
/**
Set unique identifier.
*/
void setUid( const QString &uid );
/**
Return unique identifier.
*/
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 9b059d3..3a542ba 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -320,16 +320,22 @@ KABCore::~KABCore()
delete AddresseeConfig::instance();
mAddressBook = 0;
KABC::StdAddressBook::close();
delete syncManager;
}
+void KABCore::recieve( QString fn )
+{
+ qDebug("KABCore::recieve ");
+ mAddressBook->importFromFile( fn, true );
+ topLevelWidget()->raise();
+}
void KABCore::restoreSettings()
{
mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
bool state;
if (mMultipleViewsAtOnce)
state = KABPrefs::instance()->mDetailsPageVisible;
@@ -2081,30 +2087,18 @@ void KABCore::showLicence()
}
void KABCore::removeVoice()
{
if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
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) );
}
}
void KABCore::clipboardDataChanged()
{
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c628399..43c5f99 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -337,16 +337,17 @@ class KABCore : public QWidget, public KSyncInterface
void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
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();
// void slotSyncMenu( int );
private slots:
void setJumpButtonBarVisible( bool visible );
void setCaptionBack();
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index f48f214..8c4ca09 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -87,17 +87,27 @@ KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainW
qApp->processEvents();
mCore->restoreSettings();
}
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 () ;
}
void KAddressBookMain::addEmail( QString addr )
{
mCore->addEmail( addr );
}
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h
index cf6f899..40d2bdd 100644
--- a/kaddressbook/kaddressbookmain.h
+++ b/kaddressbook/kaddressbookmain.h
@@ -76,17 +76,17 @@ class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface
//MOC_SKIP_BEGIN
virtual ASYNC showContactEditor( QString uid );
//MOC_SKIP_END
#endif //KAB_EMBEDDED
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
void createGUI();
#endif //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,10 +1,11 @@
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
+#include <qcopchannel_qws.h>
#include <stdlib.h>
#else
#include <qapplication.h>
#include <qwindowsstyle.h>
#include <qplatinumstyle.h>
#include <qmainwindow.h>
#endif
@@ -72,23 +73,28 @@ int main( int argc, char **argv )
KAddressBookMain m ;
//US MainWindow m;
QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
{
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! ");
}
/*
#include <stdlib.h>
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 3c16458..a69a0bd 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -329,23 +329,24 @@ void MainWindow::closeEvent( QCloseEvent* ce )
void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
{
QDataStream stream( data, IO_ReadOnly );
// QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
//QString datamess;
//qDebug("message ");
qDebug("KO: QCOP message received: %s ", cmsg.data() );
-
- if ( cmsg == "-writeFile" ) {
- // I made from the "-writeFile" an "-writeAlarm"
- mView->viewManager()->showWhatsNextView();
- mCalendar->checkAlarmForIncidence( 0, true);
- showMaximized();
- raise();
+
+ if ( cmsg == "setDocument(QString)" ) {
+ QDataStream stream( data, IO_ReadOnly );
+ QString fileName;
+ stream >> fileName;
+ qDebug("filename %s ", fileName.latin1());
+ KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
+ mSyncManager->slotSyncMenu( 1002 );
return;
}
if ( cmsg == "-writeFile" ) {
// I made from the "-writeFile" an "-writeAlarm"
mView->viewManager()->showWhatsNextView();
mCalendar->checkAlarmForIncidence( 0, true);
showMaximized();
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 08b1a3d..80fb147 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -186,16 +186,20 @@ void KSyncManager::slotSyncMenu( int action )
mShowSyncSummary = temp->getShowSummaryAfterSync();
if ( action == 1000 ) {
syncSharp();
} else if ( action == 1001 ) {
syncLocalFile();
} else if ( action == 1002 ) {
+ mWriteBackFile = false;
+ mAskForPreferences = false;
+ mShowSyncSummary = false;
+ mSyncAlgoPrefs = 3;
quickSyncLocalFile();
} else if ( action >= 1003 ) {
if ( temp->getIsLocalFileSync() ) {
switch(mTargetApp)
{
case (KAPI):
if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
@@ -361,17 +365,17 @@ bool KSyncManager::syncWithFile( QString fn , bool quick )
mPrefs->mLastSyncedLocalFile = fn;
}
return ret;
}
void KSyncManager::quickSyncLocalFile()
{
- if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) {
+ if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) {
qDebug("quick syncLocalFile() successful ");
}
}
void KSyncManager::multiSync( bool askforPrefs )
{
if (blockSave())