-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 975911e..25c6f3a 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -613,192 +613,193 @@ void AddressbookWindow::slotBeam() QString description = c.fullName(); ir->send( beamFilename, description, "text/x-vCard" ); } void AddressbookWindow::beamDone( Ir *ir ) { delete ir; unlink( beamfile ); } static void parseName( const QString& name, QString *first, QString *middle, QString * last ) { int comma = name.find ( "," ); QString rest; if ( comma > 0 ) { *last = name.left( comma ); comma++; while ( comma < int(name.length()) && name[comma] == ' ' ) comma++; rest = name.mid( comma ); } else { int space = name.findRev( ' ' ); *last = name.mid( space+1 ); rest = name.left( space ); } int space = rest.find( ' ' ); if ( space <= 0 ) { *first = rest; } else { *first = rest.left( space ); *middle = rest.mid( space+1 ); } } void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) { qWarning("Receiving QCop-Call with message %s", QString( msg ).latin1() ); if (msg == "editPersonal()") { editPersonal(); } else if (msg == "editPersonalAndClose()") { editPersonal(); close(); } else if ( msg == "addContact(QString,QString)" ) { QDataStream stream(data,IO_ReadOnly); QString name, email; stream >> name >> email; OContact cnt; QString fn, mn, ln; parseName( name, &fn, &mn, &ln ); // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); cnt.setFirstName( fn ); cnt.setMiddleName( mn ); cnt.setLastName( ln ); cnt.insertEmails( email ); cnt.setDefaultEmail( email ); cnt.setFileAs(); m_abView -> addEntry( cnt ); // :SXm_abView()->init( cnt ); editEntry( EditEntry ); } else if ( msg == "beamBusinessCard()" ) { QString beamFilename = addressbookPersonalVCardName(); if ( !QFile::exists( beamFilename ) ) return; // can't beam a non-existent file Ir *ir = new Ir( this ); connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); QString description = "mycard.vcf"; ir->send( beamFilename, description, "text/x-vCard" ); } else if ( msg == "show(int)" ) { QDataStream stream(data,IO_ReadOnly); int uid; stream >> uid; qWarning( "Showing uid: %d" , uid ); // Deactivate Personal View.. if ( actionPersonal->isOn() ){ actionPersonal->setOn( false ); slotPersonalView(); } // Reset category and show as card.. m_abView -> setShowByCategory( QString::null ); m_abView -> setCurrentUid( uid ); slotViewSwitched ( AbView::CardView ); + showMaximized(); qApp->exec(); } else if ( msg == "edit(int)" ) { QDataStream stream(data,IO_ReadOnly); int uid; stream >> uid; // Deactivate Personal View.. if ( actionPersonal->isOn() ){ actionPersonal->setOn( false ); slotPersonalView(); } // Reset category and edit.. m_abView -> setShowByCategory( QString::null ); m_abView -> setCurrentUid( uid ); slotViewEdit(); } } void AddressbookWindow::editEntry( EntryMode entryMode ) { OContact entry; if ( !abEditor ) { abEditor = new ContactEditor( entry, this, "editor" ); } if ( entryMode == EditEntry ) abEditor->setEntry( m_abView -> currentEntry() ); else if ( entryMode == NewEntry ) abEditor->setEntry( entry ); // other things may change the caption. abEditor->setCaption( tr("Edit Address") ); #if defined(Q_WS_QWS) || defined(_WS_QWS_) abEditor->showMaximized(); #endif // fix the foxus... abEditor->setNameFocus(); if ( abEditor->exec() ) { setFocus(); if ( entryMode == NewEntry ) { OContact insertEntry = abEditor->entry(); insertEntry.assignUid(); m_abView -> addEntry( insertEntry ); } else { OContact replEntry = abEditor->entry(); if ( !replEntry.isValidUid() ) replEntry.assignUid(); m_abView -> replaceEntry( replEntry ); } } // populateCategories(); } void AddressbookWindow::editPersonal() { OContact entry; // Switch to personal view if not selected // but take care of the menu, too if ( ! actionPersonal->isOn() ){ qWarning("*** ++++"); actionPersonal->setOn( true ); slotPersonalView(); } if ( !abEditor ) { abEditor = new ContactEditor( entry, this, "editor" ); } abEditor->setCaption(tr("Edit My Personal Details")); abEditor->setPersonalView( true ); editEntry( EditEntry ); abEditor->setPersonalView( false ); } void AddressbookWindow::slotPersonalView() { qWarning("slotPersonalView()"); if (!actionPersonal->isOn()) { // we just turned it off qWarning("slotPersonalView()-> OFF"); setCaption( tr("Contacts") ); actionNew->setEnabled(TRUE); actionTrash->setEnabled(TRUE); actionFind->setEnabled(TRUE); actionMail->setEnabled(TRUE); // slotUpdateToolbar(); m_abView->showPersonal( false ); |