summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabcore.cpp
authorzautrix <zautrix>2005-08-23 13:59:59 (UTC)
committer zautrix <zautrix>2005-08-23 13:59:59 (UTC)
commit02fa432f183ad2b18380de0e41399efe3b867dba (patch) (side-by-side diff)
treed13d3941ef4d6abc90790d5b6039a92787ea7987 /kaddressbook/kabcore.cpp
parent72d600e2c3b3405e5f37615a56560811c0cf9a78 (diff)
downloadkdepimpi-02fa432f183ad2b18380de0e41399efe3b867dba.zip
kdepimpi-02fa432f183ad2b18380de0e41399efe3b867dba.tar.gz
kdepimpi-02fa432f183ad2b18380de0e41399efe3b867dba.tar.bz2
fixx
Diffstat (limited to 'kaddressbook/kabcore.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index b9830b1..c670b1f 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -382,51 +382,74 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
#ifndef KAB_EMBEDDED
connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
mXXPortManager, SLOT( importVCard( const KURL& ) ) );
connect( mDetails, SIGNAL( browse( const QString& ) ),
SLOT( browse( const QString& ) ) );
mAddressBookService = new KAddressBookService( this );
#endif //KAB_EMBEDDED
mMessageTimer = new QTimer( this );
connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
mEditorDialog = 0;
createAddresseeEditorDialog( this );
setModified( false );
mBRdisabled = false;
#ifndef DESKTOP_VERSION
infrared = 0;
#endif
//toggleBeamReceive( );
mMainWindow->toolBar()->show();
// we have a toolbar repainting error on the Zaurus when starting KA/Pi
- QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
+ //QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
+ QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() ));
+}
+void KABCore::receiveStart( const QCString& cmsg, const QByteArray& data )
+{
+ qDebug("KO: QCOP start message received: %s ", cmsg.data() );
+ mCStringMess = cmsg;
+ mByteData = data;
}
+void KABCore::loadDataAfterStart()
+{
+ qDebug("KABCore::loadDataAfterStart() ");
+ ((StdAddressBook*)mAddressBook)->init( true );
+ mViewManager->refreshView();
+
+#ifndef DESKTOP_VERSION
+ disconnect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT (receiveStart ( const QCString &, const QByteArray & )));
+
+ QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
+ if ( !mCStringMess.isEmpty() )
+ ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData );
+#endif
+ QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
+ setCaptionBack();
+}
void KABCore::updateToolBar()
{
static int iii = 0;
++iii;
mMainWindow->toolBar()->repaintMe();
if ( iii < 4 )
QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar()));
}
KABCore::~KABCore()
{
// save();
//saveSettings();
//KABPrefs::instance()->writeConfig();
delete AddresseeConfig::instance();
mAddressBook = 0;
KABC::StdAddressBook::close();
delete syncManager;
#ifndef DESKTOP_VERSION
if ( infrared )
delete infrared;
#endif
}
void KABCore::receive( const QCString& cmsg, const QByteArray& data )
@@ -2424,101 +2447,98 @@ void KABCore::manageCategories( )
}
setModified( true );
mViewManager->refreshView();
message( i18n("Removing categories done!"));
}
delete cp;
}
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;
XXPortSelectDialog dlg( this, false, this );
if ( !dlg.exec() )
return;
mAddressBook->setUntagged();
dlg.tagSelected();
message(i18n("Removing voice..."), false );
KABC::AddressBook::Iterator it;
for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
if ( (*it).tagged() ) {
(*it).removeVoice();
}
}
message(i18n("Refreshing view...") );
- qApp->processEvents();
mViewManager->refreshView( "" );
Addressee add;
mDetails->setAddressee( add );
message(i18n("Remove voice completed!") );
}
void KABCore::setFormattedName()
{
KABFormatPrefs setpref;
if ( !setpref.exec() ) {
return;
}
XXPortSelectDialog dlg( this, false, this );
if ( !dlg.exec() )
return;
mAddressBook->setUntagged();
dlg.tagSelected();
int count = 0;
KABC::AddressBook::Iterator it;
bool modified = false;
for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
if ( (*it).tagged() ) {
if ( (*it).uid().left( 2 ) == "la" )
if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") )
continue;
++count;
if ( count %10 == 0 )
message(i18n("Changing contact #%1").arg( count ) );
- qApp->processEvents();
QString fName;
if ( setpref.simple->isChecked() )
fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
else if ( setpref.full->isChecked() )
fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
else if ( setpref.reverse->isChecked() )
fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
else
fName = (*it).organization();
if ( setpref.setCompany->isChecked() )
if ( fName.isEmpty() || fName =="," )
fName = (*it).organization();
(*it).setFormattedName( fName );
(*it).setChanged( true );
modified = true;
(*it).setRevision( QDateTime::currentDateTime() );
}
}
message(i18n("Refreshing view...") );
- qApp->processEvents();
if ( modified )
setModified( true );
Addressee add;
mDetails->setAddressee( add );
if ( count == 0 )
message(i18n("No contact changed!") );
else
message(i18n("%1 contacts changed!").arg( count ) );
}
void KABCore::clipboardDataChanged()
{
if ( mReadWrite )
mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
}
void KABCore::updateActionMenu()
{
UndoStack *undo = UndoStack::instance();
RedoStack *redo = RedoStack::instance();
if ( undo->isEmpty() )