-rw-r--r-- | core/pim/addressbook/TODO | 11 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 9 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg_base.ui | 6 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 153 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 14 |
5 files changed, 153 insertions, 40 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index 96134f4..100a6fd 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO @@ -8,11 +8,10 @@ Urgent: Important: -- Personal contact editor: Disable categories - Name order selected in "contacteditor" not used in list view. -- contacteditor: Birthday, annyversary, ... : Use Dateselector - Overview window cleanup needed.. - Cursor keys should work in detail-view (ablabel) -- "What's this" should be added + -> Ablabel should be removed and Abtable should be increased with + different views (as started by darwin zins).. - Store last settings of combo-boxes - Finishing of new View functions (List, Phonebook...) @@ -20,4 +19,5 @@ Important: Even if they are translated.. :S - Reload if contacts were changed externally +- "What's this" should be added Less important: @@ -30,5 +30,5 @@ Less important: Should be Fixed (not absolute sure, need further validation): -- "Nonenglish" translation bug has to be fixed. + Fixed: @@ -42,2 +42,5 @@ Fixed: - Use opie-mail insted of qt-mail if possible. - Font menu is invisible using german translation +- Personal contact editor: Disable categories +- "Nonenglish" translation bug has to be fixed. +- contacteditor: Birthday, annyversary, ... : Use Dateselector diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 39d8321..108e66d 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp @@ -95,5 +95,5 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, doNotifyWrapAround = cfg.readBoolEntry( "doNotifyWrapAround" ); cfg.setGroup("Mail"); - m_useQtMail = cfg.readBoolEntry( "useQtMail" ); + m_useQtMail = cfg.readBoolEntry( "useQtMail", true ); m_useOpieMail=cfg.readBoolEntry( "useOpieMail" ); @@ -674,10 +674,14 @@ void AddressbookWindow::editPersonal() me = OContact::readVCard( filename )[0]; if (bAbEditFirstTime) { + qWarning("Editing personal data"); abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, this, "editor" ); // don't create a new editor every time bAbEditFirstTime = FALSE; - } else + } else{ abEditor->setEntry( me ); + } + + abEditor->setPersonalView( true ); abEditor->setCaption(tr("Edit My Personal Details")); @@ -695,4 +699,5 @@ void AddressbookWindow::editPersonal() } abEditor->setCaption( tr("Edit Address") ); + abEditor->setPersonalView( false ); } diff --git a/core/pim/addressbook/configdlg_base.ui b/core/pim/addressbook/configdlg_base.ui index d3ea12e..a6fcffa 100644 --- a/core/pim/addressbook/configdlg_base.ui +++ b/core/pim/addressbook/configdlg_base.ui @@ -13,6 +13,6 @@ <x>0</x> <y>0</y> - <width>217</width> - <height>287</height> + <width>244</width> + <height>298</height> </rect> </property> @@ -330,4 +330,6 @@ is provided free !</string> <tabstop>m_useCaseSensitive</tabstop> <tabstop>m_signalWrapAround</tabstop> + <tabstop>m_useQtMail</tabstop> + <tabstop>m_useOpieMail</tabstop> <tabstop>buttonOk</tabstop> <tabstop>buttonCancel</tabstop> diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index e7f2ebd..a59a927 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -25,4 +25,5 @@ #include <qpe/qpeapplication.h> #include <qpe/qpedialog.h> +#include <qpe/timeconversion.h> #include <qcombobox.h> @@ -37,4 +38,5 @@ #include <qmainwindow.h> #include <qvaluelist.h> +#include <qpopupmenu.h> static inline bool containsAlphaNum( const QString &str ); @@ -58,5 +60,6 @@ ContactEditor::ContactEditor( const OContact &entry, : QDialog( parent, name, TRUE, fl ), orderedValues( newOrderedValues ), - slOrdered( *slNewOrdered ) + slOrdered( *slNewOrdered ), + m_personalView ( false ) { @@ -207,5 +210,14 @@ void ContactEditor::init() { } - if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" ) + if ( *it == "Name Title" || + *it == "First Name" || + *it == "Middle Name" || + *it == "Last Name" || + *it == "File As" || + *it == "Default Email" || + *it == "Emails" || + *it == "Groups" || + *it == "Anniversary" || + *it == "Birthday" ) continue; @@ -403,9 +415,19 @@ void ContactEditor::init() { gl->addWidget( cmbFileAs, 6, 1 ); - l = new QLabel( tr( "Category" ), container ); - gl->addWidget( l, 7, 0 ); + labCat = new QLabel( tr( "Category" ), container ); + gl->addWidget( labCat, 7, 0 ); cmbCat = new CategorySelect( container ); gl->addWidget( cmbCat, 7, 1 ); + // We don't need categories for the personal view + if ( m_personalView ){ + qWarning("Disable Category.."); + labCat->hide(); + cmbCat->hide(); + } else { + labCat->show(); + cmbCat->show(); + } + btnNote = new QPushButton( tr( "Notes..." ), container ); gl->addWidget( btnNote, 8, 1 ); @@ -708,7 +730,54 @@ void ContactEditor::init() { gl = new QGridLayout( container, 1, 2, 2, 4 ); + int counter = 0; + + // Birthday + l = new QLabel( tr("Birthday"), container ); + gl->addWidget( l, counter, 0 ); + + QPopupMenu* m1 = new QPopupMenu( container ); + birthdayPicker = new DateBookMonth( m1, 0, TRUE ); + m1->insertItem( birthdayPicker ); + + birthdayButton= new QToolButton( container, "buttonStart" ); + birthdayButton->setPopup( m1 ); + birthdayButton->setPopupDelay(0); + gl->addWidget( birthdayButton, counter , 1 ); + connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), + this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); + + ++counter; + + // Anniversary + l = new QLabel( tr("Anniversary"), container ); + gl->addWidget( l, counter, 0 ); + + m1 = new QPopupMenu( container ); + anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); + m1->insertItem( anniversaryPicker ); + + anniversaryButton= new QToolButton( container, "buttonStart" ); + anniversaryButton->setPopup( m1 ); + anniversaryButton->setPopupDelay(0); + gl->addWidget( anniversaryButton, counter , 1 ); + connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), + this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); + + ++counter; + + // Gender + l = new QLabel( tr("Gender"), container ); + gl->addWidget( l, counter, 0 ); + cmbGender = new QComboBox( container ); + cmbGender->insertItem( "", 0 ); + cmbGender->insertItem( tr("Male"), 1); + cmbGender->insertItem( tr("Female"), 2); + gl->addWidget( cmbGender, counter, 1 ); + + ++counter; + // Create Labels and lineedit fields for every dynamic entry QStringList::ConstIterator it = slDynamicEntries.begin(); - for (i = 0; it != slDynamicEntries.end(); i++, ++it) { + for (i = counter; it != slDynamicEntries.end(); i++, ++it) { l = new QLabel( QString::null , container ); listName.append( l ); @@ -721,11 +790,4 @@ void ContactEditor::init() { loadFields(); - l = new QLabel( tr("Gender"), container ); - gl->addWidget( l, slDynamicEntries.count(), 0 ); - cmbGender = new QComboBox( container ); - cmbGender->insertItem( "", 0 ); - cmbGender->insertItem( tr("Male"), 1); - cmbGender->insertItem( tr("Female"), 2); - gl->addWidget( cmbGender, slDynamicEntries.count(), 1 ); tabMain->insertTab( tabViewport, tr( "Details" ) ); @@ -1010,4 +1072,5 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) { } +// Loads the detail fields void ContactEditor::loadFields() { @@ -1037,10 +1100,4 @@ void ContactEditor::loadFields() { (*lit)->setText( tr( "Spouse" ) ); - if ( *it == "Birthday" ) - (*lit)->setText( tr( "Birthday" ) ); - - if ( *it == "Anniversary" ) - (*lit)->setText( tr( "Anniversary" ) ); - if ( *it == "Nickname" ) (*lit)->setText( tr( "Nickname" ) ); @@ -1049,4 +1106,19 @@ void ContactEditor::loadFields() { (*lit)->setText( tr( "Children" ) ); } + // Set DatePicker + qWarning ("**Info: %s", ent.birthday().latin1() ); + if ( !ent.birthday().isEmpty() ){ + birthdayButton->setText( ent.birthday() ); + birthdayPicker->setDate( TimeConversion::fromString ( ent.birthday() ) ); + } else + birthdayButton->setText( tr ("Unknown") ); + + qWarning ("**Info: %s", ent.anniversary().latin1() ); + if ( !ent.anniversary().isEmpty() ){ + anniversaryButton->setText( ent.anniversary() ); + anniversaryPicker->setDate( TimeConversion::fromString ( ent.birthday() ) ); + } else + anniversaryButton->setText( tr ("Unknown") ); + } @@ -1430,10 +1502,4 @@ void ContactEditor::setEntry( const OContact &entry ) { (*itLE)->setText( ent.spouse() ); - if ( *it == "Birthday" ) - (*itLE)->setText( ent.birthday() ); - - if ( *it == "Anniversary" ) - (*itLE)->setText( ent.anniversary() ); - if ( *it == "Nickname" ) (*itLE)->setText( ent.nickname() ); @@ -1519,4 +1585,5 @@ void ContactEditor::setEntry( const OContact &entry ) { } + cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); @@ -1532,4 +1599,6 @@ void ContactEditor::setEntry( const OContact &entry ) { slotAddressTypeChange( cmbAddress->currentItem() ); + loadFields(); + } @@ -1628,10 +1697,4 @@ void ContactEditor::saveEntry() { ent.setSpouse( (*itLE)->text() ); - if ( *it == "Birthday" ) - ent.setBirthday( (*itLE)->text() ); - - if ( *it == "Anniversary" ) - ent.setAnniversary( (*itLE)->text() ); - if ( *it == "Nickname" ) ent.setNickname( (*itLE)->text() ); @@ -1807,2 +1870,32 @@ static inline bool constainsWhiteSpace( const QString &str ) } +void ContactEditor::setPersonalView( bool personal ) +{ + m_personalView = personal; + if ( personal ){ + cmbCat->hide(); + labCat->hide(); + } else{ + cmbCat->show(); + labCat->show(); + + } +} + +void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) +{ + QDate date; + date.setYMD( year, month, day ); + QString dateString = TimeString::numberDateString( date ); + anniversaryButton->setText( dateString ); + ent.setAnniversary ( dateString ); +} + +void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) +{ + QDate date; + date.setYMD( year, month, day ); + QString dateString = TimeString::numberDateString( date ); + birthdayButton->setText( dateString ); + ent.setBirthday ( dateString ); +} diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index 8ed8553..40ce864 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h @@ -24,4 +24,6 @@ #include <opie/ocontact.h> +#include <qpe/datebookmonth.h> + #include <qdialog.h> #include <qlist.h> @@ -62,4 +64,5 @@ class ContactEditor : public QDialog { void loadFields(); void setNameFocus(); + void setPersonalView( bool personal = true ); OContact entry() const { return ent; } @@ -79,5 +82,4 @@ class ContactEditor : public QDialog { void cleanupFields(); QString parseName( QString fullName, int type ); - private slots: void slotChooser1Change( const QString &textChanged ); @@ -98,4 +100,6 @@ class ContactEditor : public QDialog { void slotCountryChange( const QString &textChanged ); void slotFullNameChange( const QString &textChanged ); + void slotAnniversaryDateChanged( int year, int month, int day); + void slotBirthdayDateChanged( int year, int month, int day); private: @@ -113,4 +117,6 @@ class ContactEditor : public QDialog { QStringList slDynamicEntries; + bool m_personalView; + QStringList slHomeAddress; QStringList slBusinessAddress; @@ -144,4 +150,5 @@ class ContactEditor : public QDialog { QComboBox *cmbFileAs; CategorySelect *cmbCat; + QLabel *labCat; QScrollView *svAddress; @@ -157,5 +164,8 @@ class ContactEditor : public QDialog { QScrollView *svDetails; QComboBox *cmbGender; - + DateBookMonth* birthdayPicker; + QToolButton* birthdayButton; + DateBookMonth* anniversaryPicker; + QToolButton* anniversaryButton; }; |