author | eilers <eilers> | 2002-10-25 13:06:09 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-10-25 13:06:09 (UTC) |
commit | 3421736c248c6ca7171bafdf3af9e2edf94eb593 (patch) (side-by-side diff) | |
tree | d07fb1c6ae99109aec6e483b1e848533a61d7b6d /core | |
parent | 2f2c23d398b6a47bd06aaf329a55bb455cf5ddd1 (diff) | |
download | opie-3421736c248c6ca7171bafdf3af9e2edf94eb593.zip opie-3421736c248c6ca7171bafdf3af9e2edf94eb593.tar.gz opie-3421736c248c6ca7171bafdf3af9e2edf94eb593.tar.bz2 |
If I want to edit my personal settings, category is disabled.
Now using Datepicker for birthday and annyversary..
-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 | 16 |
5 files changed, 154 insertions, 41 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 @@ -9,5 +9,3 @@ Important: -- Personal contact editor: Disable categories - Name order selected in "contacteditor" not used in list view. -- contacteditor: Birthday, annyversary, ... : Use Dateselector @@ -15,3 +13,4 @@ Important: - 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 @@ -21,2 +20,3 @@ Important: - Reload if contacts were changed externally +- "What's this" should be added @@ -31,3 +31,3 @@ Less important: Should be Fixed (not absolute sure, need further validation): -- "Nonenglish" translation bug has to be fixed. + @@ -43 +43,4 @@ Fixed: - 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 @@ -96,3 +96,3 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, cfg.setGroup("Mail"); - m_useQtMail = cfg.readBoolEntry( "useQtMail" ); + m_useQtMail = cfg.readBoolEntry( "useQtMail", true ); m_useOpieMail=cfg.readBoolEntry( "useOpieMail" ); @@ -675,2 +675,3 @@ void AddressbookWindow::editPersonal() if (bAbEditFirstTime) { + qWarning("Editing personal data"); abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, @@ -679,4 +680,7 @@ void AddressbookWindow::editPersonal() bAbEditFirstTime = FALSE; - } else + } else{ abEditor->setEntry( me ); + } + + abEditor->setPersonalView( true ); @@ -696,2 +700,3 @@ 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 @@ -14,4 +14,4 @@ <y>0</y> - <width>217</width> - <height>287</height> + <width>244</width> + <height>298</height> </rect> @@ -331,2 +331,4 @@ is provided free !</string> <tabstop>m_signalWrapAround</tabstop> + <tabstop>m_useQtMail</tabstop> + <tabstop>m_useOpieMail</tabstop> <tabstop>buttonOk</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 @@ -26,2 +26,3 @@ #include <qpe/qpedialog.h> +#include <qpe/timeconversion.h> @@ -38,2 +39,3 @@ #include <qvaluelist.h> +#include <qpopupmenu.h> @@ -59,3 +61,4 @@ ContactEditor::ContactEditor( const OContact &entry, orderedValues( newOrderedValues ), - slOrdered( *slNewOrdered ) + slOrdered( *slNewOrdered ), + m_personalView ( false ) { @@ -208,3 +211,12 @@ 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; @@ -404,4 +416,4 @@ void ContactEditor::init() { - 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 ); @@ -409,2 +421,12 @@ void ContactEditor::init() { + // 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 ); @@ -709,5 +731,52 @@ void ContactEditor::init() { + 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 ); @@ -722,9 +791,2 @@ void ContactEditor::init() { - 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 ); @@ -1011,2 +1073,3 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) { +// Loads the detail fields void ContactEditor::loadFields() { @@ -1038,8 +1101,2 @@ void ContactEditor::loadFields() { - if ( *it == "Birthday" ) - (*lit)->setText( tr( "Birthday" ) ); - - if ( *it == "Anniversary" ) - (*lit)->setText( tr( "Anniversary" ) ); - if ( *it == "Nickname" ) @@ -1050,2 +1107,17 @@ void ContactEditor::loadFields() { } + // 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") ); + } @@ -1431,8 +1503,2 @@ void ContactEditor::setEntry( const OContact &entry ) { - if ( *it == "Birthday" ) - (*itLE)->setText( ent.birthday() ); - - if ( *it == "Anniversary" ) - (*itLE)->setText( ent.anniversary() ); - if ( *it == "Nickname" ) @@ -1520,2 +1586,3 @@ void ContactEditor::setEntry( const OContact &entry ) { + cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); @@ -1533,2 +1600,4 @@ void ContactEditor::setEntry( const OContact &entry ) { + loadFields(); + } @@ -1629,8 +1698,2 @@ void ContactEditor::saveEntry() { - if ( *it == "Birthday" ) - ent.setBirthday( (*itLE)->text() ); - - if ( *it == "Anniversary" ) - ent.setAnniversary( (*itLE)->text() ); - if ( *it == "Nickname" ) @@ -1808 +1871,31 @@ 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 @@ -25,2 +25,4 @@ +#include <qpe/datebookmonth.h> + #include <qdialog.h> @@ -63,2 +65,3 @@ class ContactEditor : public QDialog { void setNameFocus(); + void setPersonalView( bool personal = true ); OContact entry() const { return ent; } @@ -80,3 +83,2 @@ class ContactEditor : public QDialog { QString parseName( QString fullName, int type ); - private slots: @@ -99,2 +101,4 @@ class ContactEditor : public QDialog { void slotFullNameChange( const QString &textChanged ); + void slotAnniversaryDateChanged( int year, int month, int day); + void slotBirthdayDateChanged( int year, int month, int day); @@ -114,2 +118,4 @@ class ContactEditor : public QDialog { + bool m_personalView; + QStringList slHomeAddress; @@ -145,2 +151,3 @@ class ContactEditor : public QDialog { CategorySelect *cmbCat; + QLabel *labCat; @@ -158,4 +165,7 @@ class ContactEditor : public QDialog { QComboBox *cmbGender; - -}; + DateBookMonth* birthdayPicker; + QToolButton* birthdayButton; + DateBookMonth* anniversaryPicker; + QToolButton* anniversaryButton; + }; |