author | drw <drw> | 2005-02-07 20:32:51 (UTC) |
---|---|---|
committer | drw <drw> | 2005-02-07 20:32:51 (UTC) |
commit | e56c7dfec502972fc7efcd9e0357c371d0e9cd15 (patch) (side-by-side diff) | |
tree | 7dec179671853b250afdfc6f55decda42d86fc2d | |
parent | aeda5d05178f635c05ce4556e3a0b7f9be7d6401 (diff) | |
download | opie-e56c7dfec502972fc7efcd9e0357c371d0e9cd15.zip opie-e56c7dfec502972fc7efcd9e0357c371d0e9cd15.tar.gz opie-e56c7dfec502972fc7efcd9e0357c371d0e9cd15.tar.bz2 |
Disable certain UI elements while editing personal details
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index a4c2c6e..7c52ef2 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -647,160 +647,188 @@ 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") ); // 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 certain menu items when showing personal details + // 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 ); - // Set application caption - personal ? setCaption( tr( "Contacts - My Personal Details") ) - : setCaption( tr( "Contacts") ); + 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 ( 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 */ bool AddressbookWindow::save() { if ( !m_abView->save() ) { if ( QMessageBox::critical( 0, tr( "Out of space" ), tr("Unable to save information.\n" "Free up some space\n" "and try again.\n" "\nQuit anyway?"), QMessageBox::Yes|QMessageBox::Escape, QMessageBox::No|QMessageBox::Default ) != QMessageBox::No ) return true; else return false; } return true; } #ifdef __DEBUG_RELEASE void AddressbookWindow::slotSave() { save(); } #endif void AddressbookWindow::slotNotFound() { odebug << "Got not found signal!" << oendl; QMessageBox::information( this, tr( "Not Found" ), "<qt>" + tr( "Unable to find a contact for this search pattern!" ) + "</qt>" ); } void AddressbookWindow::slotWrapAround() { odebug << "Got wrap signal!" << oendl; // if ( doNotifyWrapAround ) // QMessageBox::information( this, tr( "End of list" ), // tr( "End of list. Wrap around now...!" ) + "\n" ); |