author | drw <drw> | 2005-02-07 22:08:38 (UTC) |
---|---|---|
committer | drw <drw> | 2005-02-07 22:08:38 (UTC) |
commit | 2e4fd59ce900490ccbbb6c0f7b2fcd4811ac8a07 (patch) (side-by-side diff) | |
tree | dd1c91d19c4e53fea60245e3d4d535ac176ee2c8 | |
parent | 7631c91d6c495a6c60e87a9ab131280f31ee4c87 (diff) | |
download | opie-2e4fd59ce900490ccbbb6c0f7b2fcd4811ac8a07.zip opie-2e4fd59ce900490ccbbb6c0f7b2fcd4811ac8a07.tar.gz opie-2e4fd59ce900490ccbbb6c0f7b2fcd4811ac8a07.tar.bz2 |
Fix contact edit dialog captioning
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 75e539a..6984501 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -571,235 +571,238 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) if (msg == "editPersonal()") { editPersonal(); // Categories might have changed, so reload reloadCategories(); } else if (msg == "editPersonalAndClose()") { editPersonal(); close(); } else if ( msg == "addContact(QString,QString)" ) { QDataStream stream(data,IO_ReadOnly); QString name, email; stream >> name >> email; Opie::OPimContact cnt; QString fn, mn, ln; parseName( name, &fn, &mn, &ln ); // odebug << " " << fn << " - " << mn " - " << ln << oendl; 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 ); // Categories might have changed, so reload reloadCategories(); } 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)" ) { raise(); QDataStream stream(data,IO_ReadOnly); int uid; stream >> uid; odebug << "Showing uid: " << uid << oendl; // Deactivate Personal View.. if ( m_actionPersonal->isOn() ){ m_actionPersonal->setOn( false ); slotPersonalView(); } // Reset category and show as card.. m_abView -> setShowByCategory( QString::null ); m_abView -> setCurrentUid( uid ); slotViewSwitched ( AbView::CardView ); needShow = true; } else if ( msg == "edit(int)" ) { QDataStream stream(data,IO_ReadOnly); int uid; stream >> uid; // Deactivate Personal View.. if ( m_actionPersonal->isOn() ){ m_actionPersonal->setOn( false ); slotPersonalView(); } // Reset category and edit.. m_abView -> setShowByCategory( QString::null ); m_abView -> setCurrentUid( uid ); slotItemEdit(); // Categories might have changed, so reload reloadCategories(); } if (needShow) QPEApplication::setKeepRunning(); } void AddressbookWindow::editEntry( EntryMode entryMode ) { Opie::OPimContact 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") ); + + // Set the dialog caption + if ( m_actionPersonal->isOn() ) + abEditor->setCaption( tr( "Edit My Personal Details" ) ); + else + abEditor->setCaption( tr( "Edit Contact" ) ); // fix the focus... abEditor->setNameFocus(); if ( QPEApplication::execDialog( abEditor ) == QDialog::Accepted ) { setFocus(); if ( entryMode == NewEntry ) { Opie::OPimContact insertEntry = abEditor->entry(); insertEntry.assignUid(); m_abView -> addEntry( insertEntry ); m_abView -> setCurrentUid( insertEntry.uid() ); } else { Opie::OPimContact replEntry = abEditor->entry(); if ( !replEntry.isValidUid() ) replEntry.assignUid(); m_abView -> replaceEntry( replEntry ); } // Categories might have changed, so reload reloadCategories(); } } void AddressbookWindow::editPersonal() { Opie::OPimContact entry; // Switch to personal view if not selected // but take care of the menu, too if ( ! m_actionPersonal->isOn() ){ odebug << "*** ++++" << oendl; m_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() { odebug << "slotPersonalView()" << oendl; bool personal = m_actionPersonal->isOn(); // Disable actions when showing personal details setItemNewEnabled( !personal ); setItemDuplicateEnabled( !personal ); setItemDeleteEnabled( !personal ); m_actionMail->setEnabled( !personal ); setShowCategories( !personal ); // Display appropriate view m_abView->showPersonal( personal ); if ( personal ) { setCaption( tr( "Contacts - My Personal Details") ); // Set category to 'All' to make sure personal details is visible setViewCategory( "All" ); m_abView->setShowByCategory( "All" ); // Temporarily disable letter picker pLabel->hide(); } else { setCaption( tr( "Contacts") ); // Re-enable letter picker pLabel->show(); } } void AddressbookWindow::reload() { syncing = false; m_abView->clear(); m_abView->reload(); } void AddressbookWindow::flush() { syncing = true; m_abView->save(); } void AddressbookWindow::closeEvent( QCloseEvent *e ) { if ( active_view == AbView::CardView ) { if ( !m_actionPersonal->isOn() ) { // Switch to table view only if not editing personal details slotViewSwitched( AbView::TableView ); } else { // If currently editing personal details, switch off personal view m_actionPersonal->setOn( false ); slotPersonalView(); } e->ignore(); return; } if(syncing) { /* shouldn't we save, I hear you say? well its already been set so that an edit can not occur during a sync, and we flushed at the start of the sync, so there is no need to save Saving however itself would cause problems. */ e->accept(); return; } //################## shouldn't always save // True, but the database handles this automatically ! (se) if ( save() ) e->accept(); else e->ignore(); } /* Returns true if it is OK to exit */ |