-rw-r--r-- | core/pim/addressbook/TODO | 16 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 40 | ||||
-rw-r--r-- | core/pim/addressbook/abview.cpp | 48 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 75 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 5 | ||||
-rw-r--r-- | core/pim/addressbook/ocontactfields.cpp | 101 | ||||
-rw-r--r-- | core/pim/addressbook/ocontactfields.h | 34 | ||||
-rw-r--r-- | core/pim/addressbook/version.h | 4 |
8 files changed, 251 insertions, 72 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index 76247c1..c600d20 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO @@ -8,3 +8,3 @@ Feature requests: add a library class for this) -- dial with dtmfdial incase it's installed and there's no mobile +- dial with dtmfdial in case it's installed and there's no mobile - 3rd column for 2. Contact @@ -12,4 +12,4 @@ Feature requests: - Birthday & Anniversary Reminder -- Plugin for Today for Birthdays and Anniversaries - Beaming of multiple contacts (current list/ by search or by category) +- Configure the letter-picker: lastname/fullname search @@ -17,3 +17,4 @@ Known Bugs: ----------- - +- Email-button: A lot of problems.. :( +- Default Email-Button: Sometimes not hiding the textfields completely @@ -31,3 +32,2 @@ ContactEditor: - Redesign of Contacteditor -- Store last settings of combo-boxes - Category is on the wrong position after changing to personal and back to normal @@ -42,3 +42,2 @@ Important: this entry ! -- Implement a picker/combo for the default email. - After search (Started with Return): KeyFocus should be on Tabelle @@ -50,3 +49,2 @@ Less important: - Reload if contacts were changed externally -- Overview window cleanup needed.. - The picker (alphabetical sort widget) should be @@ -59,3 +57,3 @@ Should be Fixed (not absolute sure, need further validation): -Fixed: +Fixed/Ready: ------- @@ -112 +110,5 @@ Fixed: 3. Kategorie-Picker geht nicht. +- Plugin for Today for Birthdays and Anniversaries +- Implement a picker/combo for the default email. +- Overview window cleanup needed.. +- Store last settings of combo-boxes diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 00335ae..aec390d 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp @@ -128,3 +128,3 @@ AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name { - qWarning("C'tor start"); + // qWarning("C'tor start"); @@ -137,3 +137,3 @@ AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name contactList.clear(); - qWarning("C'tor end"); + // qWarning("C'tor end"); } @@ -159,3 +159,3 @@ void AbTable::setContacts( const OContactAccess::List& viewList ) { - qWarning("AbTable::setContacts()"); + // qWarning("AbTable::setContacts()"); @@ -185,3 +185,3 @@ bool AbTable::selectContact( int UID ) { - qWarning( "AbTable::selectContact( %d )", UID ); + // qWarning( "AbTable::selectContact( %d )", UID ); int rows = numRows(); @@ -215,3 +215,3 @@ void AbTable::insertIntoTable( const OContact& cnt, int row ) { - qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); + // qWarning( "void AbTable::insertIntoTable( const OContact& cnt, %d )", row ); QString strName, @@ -256,3 +256,3 @@ void AbTable::resort() { - qWarning( "void AbTable::resort()" ); + // qWarning( "void AbTable::resort()" ); setPaintingEnabled( FALSE ); @@ -270,3 +270,3 @@ OContact AbTable::currentEntry() { - qWarning( "OContact AbTable::currentEntry()" ); + // qWarning( "OContact AbTable::currentEntry()" ); OContact cnt; @@ -288,3 +288,3 @@ void AbTable::clear() { - qWarning( "void AbTable::clear()" ); + // qWarning( "void AbTable::clear()" ); contactList.clear(); @@ -306,3 +306,3 @@ void AbTable::refresh() { - qWarning( "void AbTable::refresh()" ); + // qWarning( "void AbTable::refresh()" ); int rows = numRows(); @@ -328,3 +328,3 @@ void AbTable::keyPressEvent( QKeyEvent *e ) - qWarning("Received key .."); + // qWarning("Received key .."); switch( e->key() ) { @@ -413,3 +413,3 @@ void AbTable::realignTable() { - qWarning( "void AbTable::realignTable()" ); + // qWarning( "void AbTable::realignTable()" ); @@ -463,3 +463,3 @@ void AbTable::fitColumns() { - qWarning( "void AbTable::fitColumns()" ); + // qWarning( "void AbTable::fitColumns()" ); int contentsWidth = visibleWidth() / 2; // :SX Why too low @@ -475,3 +475,3 @@ void AbTable::fitColumns() - qWarning("Width: %d", contentsWidth); + // qWarning("Width: %d", contentsWidth); @@ -487,3 +487,3 @@ void AbTable::show() { - qWarning( "void AbTable::show()" ); + // qWarning( "void AbTable::show()" ); realignTable(); @@ -509,3 +509,3 @@ void AbTable::itemClicked(int,int col) { - qWarning( "AbTable::itemClicked(int, col:%d)", col); + // qWarning( "AbTable::itemClicked(int, col:%d)", col); if ( col == 2 ) { @@ -513,3 +513,3 @@ void AbTable::itemClicked(int,int col) } else { - qWarning ("Emitting signalSwitch()"); + // qWarning ("Emitting signalSwitch()"); emit signalSwitch(); @@ -550,3 +550,3 @@ void AbTable::updateVisible() { - qWarning("void AbTable::updateVisible()"); + // qWarning("void AbTable::updateVisible()"); @@ -588,3 +588,3 @@ void AbTable::setPaintingEnabled( bool e ) { - qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); + // qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); @@ -604,3 +604,3 @@ void AbTable::setPaintingEnabled( bool e ) } - qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); + // qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); } @@ -608,3 +608,3 @@ void AbTable::setPaintingEnabled( bool e ) void AbTable::viewportPaintEvent( QPaintEvent* e ) { - qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); + // qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); if ( enablePainting ) diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index 93e57ca..7da0992 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp @@ -97,3 +97,3 @@ void AbView::setView( Views view ) { - qWarning("AbView::setView( Views view )"); + // qWarning("AbView::setView( Views view )"); m_curr_View = view; @@ -104,3 +104,3 @@ void AbView::addEntry( const OContact &newContact ) { - qWarning("abview:AddContact"); + // qWarning("abview:AddContact"); m_contactdb->add ( newContact ); @@ -111,3 +111,3 @@ void AbView::removeEntry( const int UID ) { - qWarning("abview:RemoveContact"); + // qWarning("abview:RemoveContact"); m_contactdb->remove( UID ); @@ -118,3 +118,3 @@ void AbView::replaceEntry( const OContact &contact ) { - qWarning("abview:ReplaceContact"); + // qWarning("abview:ReplaceContact"); m_contactdb->replace( contact ); @@ -142,3 +142,3 @@ bool AbView::save() { - qWarning("abView:Save data"); + // qWarning("abView:Save data"); @@ -149,3 +149,3 @@ void AbView::load() { - qWarning("abView:Load data"); + // qWarning("abView:Load data"); @@ -162,3 +162,3 @@ void AbView::load() - qWarning ("Number of contacts: %d", m_list.count()); + // qWarning ("Number of contacts: %d", m_list.count()); @@ -170,3 +170,3 @@ void AbView::reload() { - qWarning( "void AbView::reload()" ); + // qWarning( "void AbView::reload()" ); @@ -183,3 +183,3 @@ void AbView::setShowByCategory( const QString& cat ) { - qWarning("AbView::setShowCategory( const QString& cat )"); + // qWarning("AbView::setShowCategory( const QString& cat )"); @@ -195,3 +195,3 @@ void AbView::setShowByCategory( const QString& cat ) if ( intCat != m_curr_category ){ - qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); + // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); @@ -207,5 +207,5 @@ void AbView::setShowToView( Views view ) { - qWarning("void AbView::setShowToView( View %d )", view); + // qWarning("void AbView::setShowToView( View %d )", view); - qWarning ("Change the View (Category is: %d)", m_curr_category); + // qWarning ("Change the View (Category is: %d)", m_curr_category); @@ -222,3 +222,3 @@ void AbView::setShowByLetter( char c ) { - qWarning("void AbView::setShowByLetter( %c )", c ); + // qWarning("void AbView::setShowByLetter( %c )", c ); OContact query; @@ -256,3 +256,3 @@ void AbView::showPersonal( bool personal ) { - qWarning ("void AbView::showPersonal( %d )", personal); + // qWarning ("void AbView::showPersonal( %d )", personal); @@ -305,3 +305,3 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, { - qWarning( "void AbView::slotDoFind" ); + // qWarning( "void AbView::slotDoFind" ); @@ -319,3 +319,3 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, - qWarning ("Find in Category %d", category); + // qWarning ("Find in Category %d", category); @@ -328,3 +328,3 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, - qWarning( "found: %d", m_list.count() ); + // qWarning( "found: %d", m_list.count() ); if ( m_list.count() == 0 ){ @@ -351,3 +351,3 @@ void AbView::offSearch() void AbView::slotSwitch(){ - qWarning("AbView::slotSwitch()"); + // qWarning("AbView::slotSwitch()"); @@ -379,3 +379,3 @@ void AbView::clearForCategory() if ( !contactCompare( *it, m_curr_category ) ){ - qWarning("Removing %d", (*it).uid()); + // qWarning("Removing %d", (*it).uid()); m_list.remove( (*it).uid() ); @@ -389,3 +389,3 @@ bool AbView::contactCompare( const OContact &cnt, int category ) { - qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); + // qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); @@ -395,3 +395,3 @@ bool AbView::contactCompare( const OContact &cnt, int category ) - qWarning ("Number of categories: %d", cats.count() ); + // qWarning ("Number of categories: %d", cats.count() ); @@ -404,3 +404,3 @@ bool AbView::contactCompare( const OContact &cnt, int category ) for ( i = 0; i < int(cats.count()); i++ ) { - qWarning("Comparing %d with %d",cats[i],category ); + // qWarning("Comparing %d with %d",cats[i],category ); if ( cats[i] == category ) { @@ -411,3 +411,3 @@ bool AbView::contactCompare( const OContact &cnt, int category ) } - qWarning ("Return: %d", returnMe); + // qWarning ("Return: %d", returnMe); return returnMe; @@ -424,3 +424,3 @@ void AbView::updateView( bool newdata ) { - qWarning("AbView::updateView()"); + // qWarning("AbView::updateView()"); diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index d14ac51..d830ad3 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -69,10 +69,16 @@ ContactEditor::ContactEditor( const OContact &entry, : QDialog( parent, name, TRUE, fl ), - m_personalView ( false ) - + defaultEmailChooserPosition( -1 ), + m_personalView ( false ), + cmbDefaultEmail( 0 ), + initializing ( false ) { + initializing = true; + init(); setEntry( entry ); - cmbDefaultEmail = 0; - defaultEmailChooserPosition = -1; +// cmbDefaultEmail = 0; +// defaultEmailChooserPosition = -1; + + initializing = false; } @@ -83,2 +89,3 @@ ContactEditor::~ContactEditor() { void ContactEditor::init() { + qWarning("init() START"); @@ -602,5 +609,5 @@ void ContactEditor::init() { - cmbChooserField1->setCurrentItem( 0 ); - cmbChooserField2->setCurrentItem( 1 ); - cmbChooserField3->setCurrentItem( 2 ); + cmbChooserField1->setCurrentItem( 0 ); + cmbChooserField2->setCurrentItem( 1 ); + cmbChooserField3->setCurrentItem( 2 ); @@ -644,2 +651,4 @@ void ContactEditor::init() { setPersonalView ( m_personalView ); + + qWarning("init() END"); } @@ -694,3 +703,6 @@ bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widget QString type = slChooserNames[index]; - qWarning("ContactEditor::cmbChooserChange -> Type: %s", type.latin1() ); + qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); + + if ( !initializing ) + contactfields.setFieldOrder( widgetPos-1, index ); @@ -698,3 +710,3 @@ bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widget if ( type == "Default Email"){ - qWarning("Choosing default-email "); + qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); @@ -702,3 +714,3 @@ bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widget if ( ( defaultEmailChooserPosition != -1 ) && - defaultEmailChooserPosition != widgetPos ){ + defaultEmailChooserPosition != widgetPos && !initializing){ chooserError( widgetPos ); @@ -712,3 +724,9 @@ bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widget cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); - cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); + cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); /* :SX */ + + QRect rect = inputWid->frameGeometry(); + qWarning("Geometrie: X=%d, Y=%d, Left=%d, Top=%d, Right=%d, Bottom=%d", + rect.x(), rect.y(), rect.left(), rect.top(), rect.right(), rect.bottom()); + QPoint pnt = inputWid->pos(); + qWarning("Position : X=%d, Y=%d", pnt.x(), pnt.y() ); @@ -946,2 +964,7 @@ void ContactEditor::slotAddressTypeChange( int index ) { + + if ( !initializing ) + contactfields.setFieldOrder( 4, index ); + + if ( index == 0 ) { @@ -1278,2 +1301,4 @@ void ContactEditor::setEntry( const OContact &entry ) { + initializing = true; + cleanupFields(); @@ -1282,4 +1307,2 @@ void ContactEditor::setEntry( const OContact &entry ) { - - emails = QStringList(ent.emailList()); @@ -1457,2 +1480,19 @@ void ContactEditor::setEntry( const OContact &entry ) { + slotAddressTypeChange( cmbAddress->currentItem() ); + + // Calling "show()" to arrange all widgets. Otherwise we will get + // a wrong position of the textfields and are unable to put our + // default-email combo over it.. This is very ugly ! + // Does anybody has a better solution ? + // Basically we should rethink the strategy to hide + // a textfield with overwriting.. (se) + show(); + + // Get combo-settings from contact and set preset.. + contactfields.loadFromRecord( ent ); + cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 0) ); + cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 1) ); + cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 2) ); + cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 5) ); + cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); slotCmbChooser1Change( cmbChooserField1->currentItem() ); @@ -1460,7 +1500,8 @@ void ContactEditor::setEntry( const OContact &entry ) { slotCmbChooser3Change( cmbChooserField3->currentItem() ); - + slotCmbChooser4Change( cmbChooserField4->currentItem() ); slotAddressTypeChange( cmbAddress->currentItem() ); - // loadFields(); :SX updateDatePicker(); + + initializing = false; } @@ -1485,3 +1526,5 @@ void ContactEditor::saveEntry() { - + // Store current combo into contact + contactfields.saveToRecord( ent ); + if ( useFullName ) { diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index 4fa48d1..95f9f2d 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h @@ -32,2 +32,4 @@ +#include "ocontactfields.h" + const int NAME_LF = 0; @@ -110,2 +112,3 @@ class ContactEditor : public QDialog { bool cmbChooserChange( int , QLineEdit*, int ); + OContactFields contactfields; @@ -178,2 +181,4 @@ class ContactEditor : public QDialog { QToolButton* anniversaryButton; + + bool initializing; }; diff --git a/core/pim/addressbook/ocontactfields.cpp b/core/pim/addressbook/ocontactfields.cpp index 0da6a4f..75a7641 100644 --- a/core/pim/addressbook/ocontactfields.cpp +++ b/core/pim/addressbook/ocontactfields.cpp @@ -8,2 +8,4 @@ #include <qpe/recordfields.h> +#include <qpe/config.h> +#include <opie/ocontact.h> @@ -201,3 +203,3 @@ QMap<int, QString> OContactFields::idToTrFields() QMap<int, QString> ret_map; - + ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") ); @@ -256,3 +258,3 @@ QMap<int, QString> OContactFields::idToTrFields() ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) ); - + @@ -270,3 +272,3 @@ QMap<QString, int> OContactFields::trFieldsToId() ret_map.insert( *it, it.key() ); - + @@ -274 +276,94 @@ QMap<QString, int> OContactFields::trFieldsToId() } + +OContactFields::OContactFields(): + fieldOrder( DEFAULT_FIELD_ORDER ), + changedFieldOrder( false ) +{ + // Get the global field order from the config file and + // use it as a start pattern + Config cfg ( "AddressBook" ); + cfg.setGroup( "ContactFieldOrder" ); + globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER ); +} + +OContactFields::~OContactFields(){ + + // We will store the fieldorder into the config file + // to reuse it for the future.. + if ( changedFieldOrder ){ + Config cfg ( "AddressBook" ); + cfg.setGroup( "ContactFieldOrder" ); + cfg.writeEntry( "General", globalFieldOrder ); + } +} + + + +void OContactFields::saveToRecord( OContact &cnt ){ + + qDebug("ocontactfields saveToRecord: >%s<",fieldOrder.latin1()); + + // Store fieldorder into this contact. + cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder ); + + globalFieldOrder = fieldOrder; + changedFieldOrder = true; + +} + +void OContactFields::loadFromRecord( const OContact &cnt ){ + qDebug("ocontactfields loadFromRecord"); + qDebug("loading >%s<",cnt.fullName().latin1()); + + // Get fieldorder for this contact. If none is defined, + // we will use the global one from the config file.. + + fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME ); + + qDebug("fieldOrder from contact>%s<",fieldOrder.latin1()); + + if (fieldOrder.isEmpty()){ + fieldOrder = globalFieldOrder; + } + + + qDebug("effective fieldOrder in loadFromRecord >%s<",fieldOrder.latin1()); +} + +void OContactFields::setFieldOrder( int num, int index ){ + qDebug("qcontactfields setfieldorder pos %i -> %i",num,index); + + fieldOrder[num] = QString::number( index )[0]; + + // We will store this new fieldorder globally to + // remember it for contacts which have none + globalFieldOrder = fieldOrder; + changedFieldOrder = true; + + qDebug("fieldOrder >%s<",fieldOrder.latin1()); +} + +int OContactFields::getFieldOrder( int num, int defIndex ){ + qDebug("ocontactfields getFieldOrder"); + qDebug("fieldOrder >%s<",fieldOrder.latin1()); + + // Get index of combo as char.. + QChar poschar = fieldOrder[num]; + + bool ok; + int ret = 0; + // Convert char to number.. + if ( !( poschar == QChar::null ) ) + ret = QString( poschar ).toInt(&ok, 10); + else + ok = false; + + // Return default value if index for + // num was not set or if anything else happened.. + if ( !ok ) ret = defIndex; + + qDebug("returning >%i<",ret); + + return ret; + +} diff --git a/core/pim/addressbook/ocontactfields.h b/core/pim/addressbook/ocontactfields.h index 796bc0a..bf3a7f5 100644 --- a/core/pim/addressbook/ocontactfields.h +++ b/core/pim/addressbook/ocontactfields.h @@ -7,3 +7,7 @@ class QStringList; #include <qstring.h> +#include <opie/ocontact.h> +#define CONTACT_FIELD_ORDER_NAME "opie-contactfield-order" +#define DEFAULT_FIELD_ORDER "__________" + class OContactFields{ @@ -11,2 +15,32 @@ class OContactFields{ public: + OContactFields(); + ~OContactFields(); + /** Set the index for combo boxes. + * Sets the <b>index</b> of combo <b>num</b>. + * @param num selects the number of the combo + * @param index sets the index in the combo + */ + void setFieldOrder( int num, int index ); + + /** Get the index for combo boxes. + * Returns the index of combo <b>num</b> or defindex + * if none was defined.. + * @param num Selects the number of the combo + * @param defIndex will be returned if none was defined (either + * globally in the config file, nor by the contact which was used + * by loadFromRecord() ) + */ + int getFieldOrder( int num, int defIndex); + + /** Store fieldorder to contact. */ + void saveToRecord( OContact& ); + /** Get Fieldorder from contact. */ + void loadFromRecord( const OContact& ); + + private: + QString fieldOrder; + QString globalFieldOrder; + bool changedFieldOrder; + + public: static QStringList trphonefields( bool sorted = true ); diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h index b740326..e716fe4 100644 --- a/core/pim/addressbook/version.h +++ b/core/pim/addressbook/version.h @@ -4,4 +4,4 @@ #define MAINVERSION "0" -#define SUBVERSION "1" -#define PATCHVERSION "1" +#define SUBVERSION "2" +#define PATCHVERSION "0" |