From 37084d3961026893840ef9891132bdf193a312b3 Mon Sep 17 00:00:00 2001 From: eilers Date: Sun, 11 May 2003 12:36:30 +0000 Subject: Some improvements in handling of organizations: - If you enter a organization name and no Fullname is entered, the organization name will be used. Thus, the organization is shown correctly in the listview.. - The letterpicker now searches for the SaveAs Entry (configurable) instead for lastname. Ths guarantees that the organization is found as expected.. This addresses bugreport #590 and #895.. --- diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index a3cffa7..383f8c5 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO @@ -11,7 +11,6 @@ Feature requests: - Implementing additional Views (Phonebook, ...) - Birthday & Anniversary Reminder - Beaming of multiple contacts (current list/ by search or by category) -- Configure the letter-picker: lastname/fullname search - Optionally put scrollbars left. Known Bugs: @@ -26,17 +25,18 @@ Urgent: Important: ---------- -- "What's this" should be added (Deleyed after Feature Freeze) +- Configure the letter-picker: lastname/fullname search + -> Currently just behind the scenes .. +- Implement a correct handling of Organizations. They are currently + handled as normal persons.. :( Less important: --------------- - Reload if contacts were changed externally - The picker (alphabetical sort widget) should be placed verticaly or horizontally (configurable) -- Find a smart solution for activating/deactivating the "send email" event -- If new contact is added (contacteditor closed): focus (table, card) to - this entry ! - After search (Started with Return): KeyFocus should be on Tabelle +- Find a smart solution for activating/deactivating the "send email" event ContactEditor: - Redesign of Contacteditor @@ -110,3 +110,6 @@ Fixed/Ready: - Cursor-UP/Down: Should additionally scroll cardview if it is too large (behaviour should be selectable by configuration) - User center of the joypad to switch back from card to listview ! +- If new contact is added (contacteditor closed): focus (table, card) to + this entry ! +- Typo: Mov_e_able in Config-Dlg diff --git a/core/pim/addressbook/abconfig.cpp b/core/pim/addressbook/abconfig.cpp index 0b61614..4a0875b 100644 --- a/core/pim/addressbook/abconfig.cpp +++ b/core/pim/addressbook/abconfig.cpp @@ -12,6 +12,7 @@ AbConfig::AbConfig( ): m_fontSize( 1 ), m_barPos( QMainWindow::Top ), m_fixedBars( true ), + m_lpSearchMode( LastName ), m_changed( false ) { } @@ -60,6 +61,11 @@ bool AbConfig::fixedBars() const return m_fixedBars; } +AbConfig::LPSearchMode AbConfig::letterPickerSearch() const +{ + return ( AbConfig::LPSearchMode ) m_lpSearchMode; +} + void AbConfig::setUseRegExp( bool v ) { m_useRegExp = v ; @@ -109,6 +115,12 @@ void AbConfig::setFixedBars( const bool fixed ) m_changed = true; } +void AbConfig::setLetterPickerSearch( const AbConfig::LPSearchMode mode ) +{ + m_lpSearchMode = mode; + m_changed = true; +} + void AbConfig::load() { // Read Config settings @@ -118,8 +130,9 @@ void AbConfig::load() m_fontSize = cfg.readNumEntry( "fontSize", 1 ); cfg.setGroup("Search"); - m_useRegExp = cfg.readBoolEntry( "useRegExp" ); - m_beCaseSensitive = cfg.readBoolEntry( "caseSensitive" ); + m_useRegExp = cfg.readBoolEntry( "useRegExp", false ); + m_beCaseSensitive = cfg.readBoolEntry( "caseSensitive", false ); + m_lpSearchMode = cfg.readNumEntry( "lpSearchMode", FullName ); cfg.setGroup("Mail"); m_useQtMail = cfg.readBoolEntry( "useQtMail", true ); @@ -159,6 +172,7 @@ void AbConfig::save() cfg.setGroup("Search"); cfg.writeEntry("useRegExp", m_useRegExp); cfg.writeEntry("caseSensitive", m_beCaseSensitive); + cfg.writeEntry("lpSearchMode", m_lpSearchMode ); cfg.setGroup("Mail"); cfg.writeEntry( "useQtMail", m_useQtMail ); @@ -194,5 +208,6 @@ void AbConfig::operator= ( const AbConfig& cnf ) m_ordered = cnf.m_ordered; m_barPos = cnf.m_barPos; m_fixedBars = cnf.m_fixedBars; + m_lpSearchMode = cnf.m_lpSearchMode; } diff --git a/core/pim/addressbook/abconfig.h b/core/pim/addressbook/abconfig.h index ce51b4c..93764f2 100644 --- a/core/pim/addressbook/abconfig.h +++ b/core/pim/addressbook/abconfig.h @@ -7,6 +7,14 @@ class AbConfig { public: + enum LPSearchMode{ + LastName = 0, + FullName, + LASTELEMENT + }; + + + AbConfig(); ~AbConfig(); @@ -20,6 +28,7 @@ public: QValueList orderList() const; QMainWindow::ToolBarDock getToolBarPos() const; bool fixedBars() const; + LPSearchMode letterPickerSearch() const; void setUseRegExp( bool v ); void setUseWildCards( bool v ); @@ -30,6 +39,7 @@ public: void setOrderList( const QValueList& list ); void setToolBarDock( const QMainWindow::ToolBarDock v ); void setFixedBars( const bool fixed ); + void setLetterPickerSearch( const LPSearchMode mode ); void operator= ( const AbConfig& cnf ); @@ -50,6 +60,7 @@ protected: QValueList m_ordered; int m_barPos; bool m_fixedBars; + int m_lpSearchMode; bool m_changed; }; diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index d3ca783..664bd3f 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp @@ -22,6 +22,8 @@ #include +#include + // Is defined in LibQPE extern QString categoryFileName(); @@ -160,7 +162,7 @@ void AbView::load() clearForCategory(); } - // qWarning ("Number of contacts: %d", m_list.count()); + qWarning ("Number of contacts: %d", m_list.count()); updateView( true ); @@ -218,9 +220,12 @@ void AbView::setShowToView( Views view ) } -void AbView::setShowByLetter( char c ) +void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) { - // qWarning("void AbView::setShowByLetter( %c )", c ); + qWarning("void AbView::setShowByLetter( %c, %d )", c, mode ); + + assert( mode < AbConfig::LASTELEMENT ); + OContact query; if ( c == 0 ){ load(); @@ -232,7 +237,18 @@ void AbView::setShowByLetter( char c ) return; } - query.setLastName( QString("%1*").arg(c) ); + switch( mode ){ + case AbConfig::LastName: + query.setLastName( QString("%1*").arg(c) ); + break; + case AbConfig::FullName: + query.setFileAs( QString("%1*").arg(c) ); + break; + default: + qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode ); + qWarning( "I will ignore it.." ); + return; + } m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); clearForCategory(); m_curr_Contact = 0; diff --git a/core/pim/addressbook/abview.h b/core/pim/addressbook/abview.h index 55c63cc..49bb4be 100644 --- a/core/pim/addressbook/abview.h +++ b/core/pim/addressbook/abview.h @@ -11,6 +11,7 @@ #include "contacteditor.h" #include "abtable.h" #include "ablabel.h" +#include "abconfig.h" class AbView: public QWidget { @@ -32,7 +33,7 @@ public: void setCurrentUid( int uid ); void setShowByCategory( const QString& cat ); void setShowToView( Views view ); - void setShowByLetter( char c ); + void setShowByLetter( char c, AbConfig::LPSearchMode mode = AbConfig::LastName ); void setListOrder( const QValueList& ordered ); // Add Entry and put to current diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 25c6f3a..34bf7f1 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -752,6 +752,7 @@ void AddressbookWindow::editEntry( EntryMode entryMode ) OContact insertEntry = abEditor->entry(); insertEntry.assignUid(); m_abView -> addEntry( insertEntry ); + m_abView -> setCurrentUid( insertEntry.uid() ); } else { OContact replEntry = abEditor->entry(); @@ -1011,7 +1012,7 @@ void AddressbookWindow::slotCardView() void AddressbookWindow::slotSetLetter( char c ) { - m_abView->setShowByLetter( c ); + m_abView->setShowByLetter( c, m_config.letterPickerSearch() ); } diff --git a/core/pim/addressbook/configdlg_base.ui b/core/pim/addressbook/configdlg_base.ui index 1b5ac17..f892d08 100644 --- a/core/pim/addressbook/configdlg_base.ui +++ b/core/pim/addressbook/configdlg_base.ui @@ -305,7 +305,7 @@ text - Movable + Moveable whatsThis diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index f33ee0a..ce14f98 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -656,10 +656,12 @@ void ContactEditor::init() { connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); - connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); - - connect( txtSuffix, SIGNAL(textChanged(const QString &)), this, SLOT(slotSuffixChange(const QString &)) ); - + connect( txtFullName, SIGNAL(textChanged(const QString &)), + this, SLOT(slotFullNameChange(const QString &)) ); + connect( txtSuffix, SIGNAL(textChanged(const QString &)), + this, SLOT(slotSuffixChange(const QString &)) ); + connect( txtOrganization, SIGNAL(textChanged(const QString &)), + this, SLOT(slotOrganizationChange(const QString &)) ); connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) ); connect( txtChooserField2, SIGNAL(textChanged(const QString &)), @@ -1057,6 +1059,16 @@ void ContactEditor::slotSuffixChange( const QString& ) { slotFullNameChange( txtFullName->text() ); } +void ContactEditor::slotOrganizationChange( const QString &textChanged ){ + qWarning( "ContactEditor::slotOrganizationChange( %s )", textChanged.latin1() ); + // Special handling for storing Companies: + // If no Fullname is given, we store the Company-Name as lastname + // to handle it like a person.. + if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) + txtFullName->setText( textChanged ); + +} + void ContactEditor::accept() { if ( isEmpty() ) { diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index c6fa48f..e7432ee 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h @@ -101,6 +101,7 @@ class ContactEditor : public QDialog { void slotCountryChange( const QString &textChanged ); void slotFullNameChange( const QString &textChanged ); void slotSuffixChange( const QString &textChanged ); + void slotOrganizationChange( const QString &textChanged ); void slotAnniversaryDateChanged( int year, int month, int day); void slotBirthdayDateChanged( int year, int month, int day); void slotRemoveBirthday(); diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h index c0465b5..4c93584 100644 --- a/core/pim/addressbook/version.h +++ b/core/pim/addressbook/version.h @@ -3,7 +3,7 @@ #define MAINVERSION "0" #define SUBVERSION "9" -#define PATCHVERSION "4" +#define PATCHVERSION "5" #define APPNAME "OPIE_ADDRESSBOOK" -- cgit v0.9.0.2