author | eilers <eilers> | 2003-03-01 18:06:49 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-03-01 18:06:49 (UTC) |
commit | a0ae7d2b8cfef3f643c4aa536bdf25d7da510142 (patch) (side-by-side diff) | |
tree | 7658121cba0f106d019ecf34682fe9cc079cbf73 | |
parent | 7dd36872a3eb63eb1c3c7a17549f3eeba92f1b32 (diff) | |
download | opie-a0ae7d2b8cfef3f643c4aa536bdf25d7da510142.zip opie-a0ae7d2b8cfef3f643c4aa536bdf25d7da510142.tar.gz opie-a0ae7d2b8cfef3f643c4aa536bdf25d7da510142.tar.bz2 |
Fixing following bugs:
default email chooser jumped sometimes through the widget
default email chooser not completely hiding the textfield
storing the position of the chooser for
the home webpage failed
-rw-r--r-- | core/pim/addressbook/TODO | 21 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 107 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 8 | ||||
-rw-r--r-- | core/pim/addressbook/ocontactfields.cpp | 4 | ||||
-rw-r--r-- | core/pim/addressbook/version.h | 2 |
5 files changed, 82 insertions, 60 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO index 719b720..a0d50a3 100644 --- a/core/pim/addressbook/TODO +++ b/core/pim/addressbook/TODO @@ -1,119 +1,116 @@ Stuff todo until OPIE 1.0 : =========================== Feature requests: ----------------- - Dial by mobile phone by tapping the number.. (Maybe using gsmtool. And we may add a library class for this) - dial with dtmfdial in case it's installed and there's no mobile - 3rd column for 2. Contact - 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 - User center of the joypad to switch back from card to listview ! - Cursor-UP/Down: Should additionally scroll cardview if it is too large (behaviour should be selectable by configuration) Known Bugs: ----------- -- Default Email-button: A lot of problems: - If on second tab: The combo chooser is on the top left of the screen ! :( -- Default Email-Button: Sometimes not hiding the textfields completely Bugs but not in addressbook: ----------------------------- - VCARD: If umlaut (äöüß) in address, the parser gets confused.. -- Exporting and reimporting of Jobtitle was reported to fail (Could not reproduce this ! (se)) - Urgent: -------- -ContactEditor: -- Contact-Editor is temporarely reenabled. Wait for replacement. -- Redesign of Contacteditor - Category is on the wrong position after changing to personal and back to normal ( Temporarily workaround: Category is never deactivated.. :S ) - Fix handling of 3 Firstnames Important: ---------- -- If new contact is added (contacteditor closed): focus (table, card) to - this entry ! -- After search (Started with Return): KeyFocus should be on Tabelle - - "What's this" should be added (Deleyed after Feature Freeze) 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 + +ContactEditor: +- Redesign of Contacteditor Should be Fixed (not absolute sure, need further validation): ------------------------------------------------------------- Fixed/Ready: ------- - Syncing: abtable not reloaded after sync. - Find widget should be replaced by something like qpdf has. - Adding a configuration dialog - Picker: Activated letter schould be more visible - Advanced handling of cursor keys (search..) - Mail-Icon is missing - 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 - The names of the countries are sorted by there english names, only.. Even if they are translated.. :S - Cursor keys should work in detail-view (ablabel) -> Ablabel should be removed and Abtable should be increased with different views (as started by darwin zins).. - Use advanced database functions in abtable to decrease memory footprint and to make everything more easy ! (abtable should store Iterator for selected Category) - Abtable: Configure Contact column (internally already available, need configuration) - Select of primary contact (see #274 on mantis) - Category-select does not work completely: "Unfiled" is always in listview .. - Return from Contacteditor: Category resettet to all - Personal Details not working - If category changed, the letterpicker should be resetted - There should be some icons for List and Cardview - If in Cardview and a category change removes all entries: There are already entries in Cardview after up/down - Personal Details: Anniversary zeigt Fantasie-Werte - Unfiled shown just in Category "All" and "Unfiled". - After finising search and after Edit: Clear Picker - After Edit: Table position back to edited entry. - Optimize Table Update... - Change MyDialog to Config - Store position and state of toolbar - Searchwidget closed: Selected user is jumping - Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) zu lange.. - VCARD: Import of Anniversary does not work correctly (currently disabled) - Name order selected in "contacteditor" not used in list view. - OK-Key does not switch from Detailview (ablable) to Listview - Receiving of beams should open a dialog - Fix start of opie-mail - Implement Button Pics - Add a dialog to accept and optionally edit received contacts by IRDA. - Language not English (tested with german opie-translation): 1. Configure nicht übersetzt (alles leer). 2. Contacteditor nur teilweise übersetzt. 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 - Personal and Business Web-page is not editable +- Default Email-button: A lot of problems: + If on second tab: The combo chooser is on the top left of the screen ! :( +- Default Email-Button: Sometimes not hiding the textfields completely diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index b60f2dd..d1338f6 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -117,113 +117,131 @@ void ContactEditor::init() { QMap<int, QString> translMap = OContactFields::idToTrFields(); trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); trlDynamicEntries.remove( translMap[Qtopia::Gender] ); // Last Check to be sure.. assert( slDynamicEntries.count() == trlDynamicEntries.count() ); assert( slChooserNames.count() == trlChooserNames.count() ); for (i = 0; i < slChooserNames.count(); i++) slChooserValues.append(""); QVBoxLayout *vb = new QVBoxLayout( this ); tabMain = new QTabWidget( this ); vb->addWidget( tabMain ); QWidget *tabViewport = new QWidget ( tabMain ); vb = new QVBoxLayout( tabViewport ); svGeneral = new QScrollView( tabViewport ); vb->addWidget( svGeneral, 0, 0 ); svGeneral->setResizePolicy( QScrollView::AutoOneFit ); svGeneral->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( svGeneral->viewport() ); svGeneral->addChild( container ); QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); gl->setResizeMode( QLayout::FreeResize ); btnFullName = new QPushButton( tr( "Full Name..." ), container ); gl->addWidget( btnFullName, 0, 0 ); txtFullName = new QLineEdit( container ); gl->addWidget( txtFullName, 0, 1 ); QLabel *l = new QLabel( tr( "Job Title" ), container ); gl->addWidget( l, 1, 0 ); txtJobTitle = new QLineEdit( container ); gl->addWidget( txtJobTitle, 1, 1 ); l = new QLabel( tr( "Organization" ), container ); gl->addWidget( l, 2, 0 ); txtOrganization = new QLineEdit( container ); gl->addWidget( txtOrganization, 2, 1 ); + // Chooser 1 cmbChooserField1 = new QComboBox( FALSE, container ); cmbChooserField1->setMaximumWidth( 90 ); gl->addWidget( cmbChooserField1, 3, 0 ); - txtChooserField1 = new QLineEdit( container ); - gl->addWidget( txtChooserField1, 3, 1 ); - + // Textfield for chooser 1. + // Now use Widgetstack to contain the textfield and the default-email combo ! + m_widgetStack1 = new QWidgetStack( container ); + txtChooserField1 = new QLineEdit( m_widgetStack1 ); + m_widgetStack1 -> addWidget( txtChooserField1, TextField ); + gl->addWidget( m_widgetStack1, 3, 1 ); + m_widgetStack1 -> raiseWidget( TextField ); + + // Chooser 2 cmbChooserField2 = new QComboBox( FALSE, container ); cmbChooserField2->setMaximumWidth( 90 ); gl->addWidget( cmbChooserField2, 4, 0 ); - txtChooserField2 = new QLineEdit( container ); - gl->addWidget( txtChooserField2, 4, 1 ); - + // Textfield for chooser 2 + // Now use WidgetStack to contain the textfield and the default-email combo! + m_widgetStack2 = new QWidgetStack( container ); + txtChooserField2 = new QLineEdit( m_widgetStack2 ); + m_widgetStack2 -> addWidget( txtChooserField2, TextField ); + gl->addWidget( m_widgetStack2, 4, 1 ); + m_widgetStack2 -> raiseWidget( TextField ); + + // Chooser 3 cmbChooserField3 = new QComboBox( FALSE, container ); cmbChooserField3->setMaximumWidth( 90 ); gl->addWidget( cmbChooserField3, 5, 0 ); - txtChooserField3 = new QLineEdit( container ); - gl->addWidget( txtChooserField3, 5, 1 ); + // Textfield for chooser 2 + // Now use WidgetStack to contain the textfield and the default-email combo! + m_widgetStack3 = new QWidgetStack( container ); + txtChooserField3 = new QLineEdit( m_widgetStack3 ); + m_widgetStack3 -> addWidget( txtChooserField3, TextField ); + gl->addWidget( m_widgetStack3, 5, 1 ); + m_widgetStack3 -> raiseWidget( TextField ); l = new QLabel( tr( "File As" ), container ); gl->addWidget( l, 6, 0 ); cmbFileAs = new QComboBox( TRUE, container ); gl->addWidget( cmbFileAs, 6, 1 ); labCat = new QLabel( tr( "Category" ), container ); gl->addWidget( labCat, 7, 0 ); cmbCat = new CategorySelect( container ); gl->addWidget( cmbCat, 7, 1 ); labCat->show(); cmbCat->show(); btnNote = new QPushButton( tr( "Notes..." ), container ); gl->addWidget( btnNote, 8, 1 ); tabMain->insertTab( tabViewport, tr( "General" ) ); tabViewport = new QWidget ( tabMain ); vb = new QVBoxLayout( tabViewport ); svAddress = new QScrollView( tabViewport ); vb->addWidget( svAddress, 0, 0 ); svAddress->setResizePolicy( QScrollView::AutoOneFit ); svAddress->setFrameStyle( QFrame::NoFrame ); container = new QWidget( svAddress->viewport() ); svAddress->addChild( container ); gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem cmbAddress = new QComboBox( FALSE, container ); cmbAddress->insertItem( tr( "Business" ) ); cmbAddress->insertItem( tr( "Home" ) ); gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); l = new QLabel( tr( "Address" ), container ); gl->addWidget( l, 1, 0 ); txtAddress = new QLineEdit( container ); gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); l = new QLabel( tr( "City" ), container ); gl->addWidget( l, 2, 0 ); txtCity = new QLineEdit( container ); gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); l = new QLabel( tr( "State" ), container ); @@ -412,101 +430,107 @@ void ContactEditor::init() { cmbCountry->insertItem( tr ( "Senegal" ) ); cmbCountry->insertItem( tr ( "Seychelles" ) ); cmbCountry->insertItem( tr ( "Sierra Leone" ) ); cmbCountry->insertItem( tr ( "Singapore" ) ); cmbCountry->insertItem( tr ( "Slovakia" ) ); cmbCountry->insertItem( tr ( "Slovenia" ) ); cmbCountry->insertItem( tr ( "Solomon Islands" ) ); cmbCountry->insertItem( tr ( "Somalia" ) ); cmbCountry->insertItem( tr ( "South Africa" ) ); cmbCountry->insertItem( tr ( "Spain" ) ); cmbCountry->insertItem( tr ( "Sri Lanka" ) ); cmbCountry->insertItem( tr ( "St. Helena" ) ); cmbCountry->insertItem( tr ( "Sudan" ) ); cmbCountry->insertItem( tr ( "Suriname" ) ); cmbCountry->insertItem( tr ( "Swaziland" ) ); cmbCountry->insertItem( tr ( "Sweden" ) ); cmbCountry->insertItem( tr ( "Switzerland" ) ); cmbCountry->insertItem( tr ( "Taiwan" ) ); cmbCountry->insertItem( tr ( "Tajikistan" ) ); cmbCountry->insertItem( tr ( "Tanzania" ) ); cmbCountry->insertItem( tr ( "Thailand" ) ); cmbCountry->insertItem( tr ( "Togo" ) ); cmbCountry->insertItem( tr ( "Tokelau" ) ); cmbCountry->insertItem( tr ( "Tonga" ) ); cmbCountry->insertItem( tr ( "Tunisia" ) ); cmbCountry->insertItem( tr ( "Turkey" ) ); cmbCountry->insertItem( tr ( "Turkmenistan" ) ); cmbCountry->insertItem( tr ( "Tuvalu" ) ); cmbCountry->insertItem( tr ( "Uganda" ) ); cmbCountry->insertItem( tr ( "Ukraine" ) ); cmbCountry->insertItem( tr ( "Uruguay" ) ); cmbCountry->insertItem( tr ( "Uzbekistan" ) ); cmbCountry->insertItem( tr ( "Vanuatu" ) ); cmbCountry->insertItem( tr ( "Venezuela" ) ); cmbCountry->insertItem( tr ( "Vietnam" ) ); cmbCountry->insertItem( tr ( "Virgin Islands" ) ); cmbCountry->insertItem( tr ( "Western Sahara" ) ); cmbCountry->insertItem( tr ( "Yemen" ) ); cmbCountry->insertItem( tr ( "Yugoslavia" ) ); cmbCountry->insertItem( tr ( "Zambia" ) ); cmbCountry->insertItem( tr ( "Zimbabwe" ) ); if (cmbCountry->listBox()!=0) cmbCountry->listBox()->sort(); cmbCountry->setMaximumWidth( 135 ); gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); + // Chooser 4 cmbChooserField4 = new QComboBox( FALSE, container ); cmbChooserField4->setMaximumWidth( 90 ); gl->addWidget( cmbChooserField4, 6, 0 ); - txtChooserField4 = new QLineEdit( container ); - gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); + // Textfield for chooser 2 + // Now use WidgetStack to contain the textfield and the default-email combo! + m_widgetStack4 = new QWidgetStack( container ); + txtChooserField4 = new QLineEdit( m_widgetStack4 ); + m_widgetStack4 -> addWidget( txtChooserField4, TextField ); + gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); + m_widgetStack4 -> raiseWidget( TextField ); QSpacerItem *space = new QSpacerItem(1,1, QSizePolicy::Maximum, QSizePolicy::MinimumExpanding ); gl->addItem( space, 7, 0 ); tabMain->insertTab( tabViewport, tr( "Address" ) ); tabViewport = new QWidget ( tabMain ); vb = new QVBoxLayout( tabViewport ); svDetails = new QScrollView( tabViewport ); vb->addWidget( svDetails, 0, 0 ); svDetails->setResizePolicy( QScrollView::AutoOneFit ); svDetails->setFrameStyle( QFrame::NoFrame ); container = new QWidget( svDetails->viewport() ); svDetails->addChild( container ); gl = new QGridLayout( container, 1, 2, 2, 4 ); int counter = 0; // Birthday QHBox* hBox = new QHBox( container ); 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( hBox, "buttonStart" ); birthdayButton->setPopup( m1 ); birthdayButton->setPopupDelay(0); QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), tr( "Delete" ), hBox, 0 ); gl->addWidget( hBox, counter , 1 ); connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); ++counter; @@ -655,215 +679,210 @@ void ContactEditor::init() { } void ContactEditor::defaultEmailChanged(int i){ qDebug("defaultEmailChanged"); // was sollte das ? (se) // int index = cmbChooserField1->currentItem(); // slChooserValues[index] = cmbDefaultEmail->text(i); defaultEmail = cmbDefaultEmail->text(i); qDebug ("Changed to: %s", defaultEmail.latin1()); } void ContactEditor::populateDefaultEmailCmb(){ // if the default-email combo was not selected and therfore not created // we get a lot of trouble.. Therfore create an invisible one.. if ( !cmbDefaultEmail ){ cmbDefaultEmail = new QComboBox(this); cmbDefaultEmail -> hide(); } cmbDefaultEmail->clear(); cmbDefaultEmail->insertStringList( emails ); // cmbDefaultEmail->show(); // Select default email in combo.. bool found = false; for ( int i = 0; i < cmbDefaultEmail->count(); i++){ qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ cmbDefaultEmail->setCurrentItem( i ); qDebug("set"); found = true; } } // If the current default email is not found in the list, we choose the // first one.. if ( !found ) defaultEmail = cmbDefaultEmail->text(0); } // Called when any combobox was changed. // "true" returned if the change was chandled by this function, else it should // be handled by something else.. -bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widgetPos ) { +bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { QString type = slChooserNames[index]; qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); if ( !initializing ) contactfields.setFieldOrder( widgetPos-1, index ); // Create and connect combobox for selecting the default email if ( type == "Default Email"){ qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); - // More than one defaul-email chooser is not allowed ! + // More than one default-email chooser is not allowed ! if ( ( defaultEmailChooserPosition != -1 ) && defaultEmailChooserPosition != widgetPos && !initializing){ chooserError( widgetPos ); return true; } - if ( cmbDefaultEmail ){ - delete cmbDefaultEmail; - cmbDefaultEmail = 0l; + QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); + if ( cmbo ){ + inputStack->raiseWidget( TextField ); + inputStack -> removeWidget( cmbo ); + delete cmbo; } - cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); - 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() ); - - connect( cmbDefaultEmail,SIGNAL( activated(int) ), - SLOT( defaultEmailChanged(int) ) ); + cmbo = new QComboBox( inputStack ); + cmbo -> insertStringList( emails ); - cmbDefaultEmail->clear(); - cmbDefaultEmail->insertStringList( emails ); - cmbDefaultEmail->show(); + inputStack -> addWidget( cmbo, Combo ); + inputStack -> raiseWidget( Combo ); defaultEmailChooserPosition = widgetPos; + cmbDefaultEmail = cmbo; + + connect( cmbo,SIGNAL( activated(int) ), + SLOT( defaultEmailChanged(int) ) ); // Set current default email populateDefaultEmailCmb(); } else { // Something else was selected: Hide combo.. qWarning(" Hiding default-email combo" ); if ( defaultEmailChooserPosition == widgetPos ){ defaultEmailChooserPosition = -1; - if ( cmbDefaultEmail ) - cmbDefaultEmail->hide(); + QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); + if ( cmbo ){ + inputStack->raiseWidget( TextField ); + inputStack -> removeWidget( cmbo ); + cmbDefaultEmail = 0l; + delete cmbo; + } } // Caller should initialize the responsible textfield, therefore // "false" is returned return false; } // Everything is worked off .. return true; } // Currently accessed when we select default-email more than once ! void ContactEditor::chooserError( int index ) { qWarning("ContactEditor::chooserError( %d )", index); QMessageBox::warning( this, "Chooser Error", "Multiple selection of this\n" "Item is not allowed !\n\n" "First deselect the previous one !", "&OK", 0, 0, 0, 0 ); // Reset the selected Chooser. Unfortunately the chooser // generates no signal, therfore we have to // call the cmbChooserChange function manually.. switch( index ){ case 1: cmbChooserField1 -> setCurrentItem( 0 ); slotCmbChooser1Change( 0 ); break; case 2: cmbChooserField2 -> setCurrentItem( 0 ); slotCmbChooser2Change( 0 ); break; case 3: cmbChooserField3 -> setCurrentItem( 0 ); slotCmbChooser3Change( 0 ); break; case 4: cmbChooserField4 -> setCurrentItem( 0 ); slotCmbChooser4Change( 0 ); break; } } // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit* , int widgetPos ) { - QString type = slChooserNames[index]; + QString type = slChooserNames[index]; // :SX qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i", type.latin1(),textChanged.latin1(), index, widgetPos ); if ( type == "Default Email"){ qWarning ("??? Wozu??: %s", textChanged.latin1()); defaultEmail = textChanged; populateDefaultEmailCmb(); - }else if (defaultEmailChooserPosition == widgetPos){ - qDebug("cmbDefaultEmail->hide()"); - - if (cmbDefaultEmail) cmbDefaultEmail->hide(); - widgetPos=-1; - - }else if (type == "Emails"){ + }else if (type == "Emails"){ qDebug("emails"); QString de; emails = QStringList::split (",", textChanged ); populateDefaultEmailCmb(); } slChooserValues[index] = textChanged; } void ContactEditor::slotChooser1Change( const QString &textChanged ) { qWarning("ContactEditor::slotChooser1Change( %s )", textChanged.latin1()); chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); } void ContactEditor::slotChooser2Change( const QString &textChanged ) { qWarning("ContactEditor::slotChooser2Change( %s )", textChanged.latin1()); chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); } void ContactEditor::slotChooser3Change( const QString &textChanged ) { qWarning("ContactEditor::slotChooser3Change( %s )", textChanged.latin1()); chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); } void ContactEditor::slotChooser4Change( const QString &textChanged ) { qWarning("ContactEditor::slotChooser4Change( %s )", textChanged.latin1()); chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); } void ContactEditor::slotAddressChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { slBusinessAddress[0] = textChanged; } else { slHomeAddress[0] = textChanged; } } void ContactEditor::slotAddress2Change( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { slBusinessAddress[1] = textChanged; } else { slHomeAddress[1] = textChanged; @@ -874,131 +893,131 @@ void ContactEditor::slotPOBoxChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { slBusinessAddress[2] = textChanged; } else { slHomeAddress[2] = textChanged; } } void ContactEditor::slotCityChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { slBusinessAddress[3] = textChanged; } else { slHomeAddress[3] = textChanged; } } void ContactEditor::slotStateChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { slBusinessAddress[4] = textChanged; } else { slHomeAddress[4] = textChanged; } } void ContactEditor::slotZipChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { slBusinessAddress[5] = textChanged; } else { slHomeAddress[5] = textChanged; } } void ContactEditor::slotCountryChange( const QString &textChanged ) { if ( cmbAddress->currentItem() == 0 ) { slBusinessAddress[6] = textChanged; } else { slHomeAddress[6] = textChanged; } } void ContactEditor::slotCmbChooser1Change( int index ) { qWarning("ContactEditor::slotCmbChooser1Change( %d )", index); - if ( !cmbChooserChange( cmbChooserField1->currentItem(), txtChooserField1, 1) ){ - + if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ + txtChooserField1->setText( slChooserValues[index] ); txtChooserField1->setFocus(); } } void ContactEditor::slotCmbChooser2Change( int index ) { qWarning("ContactEditor::slotCmbChooser2Change( %d )", index); - if ( !cmbChooserChange( cmbChooserField2->currentItem(), txtChooserField2, 2) ){ + if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ txtChooserField2->setText( slChooserValues[index] ); txtChooserField2->setFocus(); } } void ContactEditor::slotCmbChooser3Change( int index ) { qWarning("ContactEditor::slotCmbChooser3Change( %d )", index); - if ( !cmbChooserChange( cmbChooserField3->currentItem(), txtChooserField3, 3) ){ + if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ txtChooserField3->setText( slChooserValues[index] ); txtChooserField3->setFocus(); } } void ContactEditor::slotCmbChooser4Change( int index ) { qWarning("ContactEditor::slotCmbChooser4Change( %d )", index); - if ( !cmbChooserChange( cmbChooserField4->currentItem(), txtChooserField4, 4) ){ + if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ txtChooserField4->setText( slChooserValues[index] ); txtChooserField4->setFocus(); } } void ContactEditor::slotAddressTypeChange( int index ) { if ( !initializing ) contactfields.setFieldOrder( 4, index ); if ( index == 0 ) { txtAddress->setText( slBusinessAddress[0] ); //txtAddress2->setText( (*slBusinessAddress)[1] ); //txtPOBox->setText( (*slBusinessAddress)[2] ); txtCity->setText( slBusinessAddress[3] ); txtState->setText( slBusinessAddress[4] ); txtZip->setText( slBusinessAddress[5] ); QLineEdit *txtTmp = cmbCountry->lineEdit(); txtTmp->setText( slBusinessAddress[6] ); } else { txtAddress->setText( slHomeAddress[0] ); //txtAddress2->setText( (*slHomeAddress)[1] ); //txtPOBox->setText( (*slHomeAddress)[2] ); txtCity->setText( slHomeAddress[3] ); txtState->setText( slHomeAddress[4] ); txtZip->setText( slHomeAddress[5] ); QLineEdit *txtTmp = cmbCountry->lineEdit(); txtTmp->setText( slHomeAddress[6] ); } } void ContactEditor::slotFullNameChange( const QString &textChanged ) { int index = cmbFileAs->currentItem(); cmbFileAs->clear(); cmbFileAs->insertItem( parseName( textChanged, 0 ) ); cmbFileAs->insertItem( parseName( textChanged, 1 ) ); diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index 95f9f2d..703e702 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h @@ -1,186 +1,192 @@ /* * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> * * This file is an add-on for the OPIE Palmtop Environment * * This file may be distributed and/or modified under the terms of the * GNU General Public License version 2 as published by the Free Software * Foundation and appearing in the file LICENSE.GPL included in the pacakaging * of this file. * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * * This is a rewrite of the abeditor.h file, modified to provide a more * intuitive interface to TrollTech's original Address Book editor. This * is made to operate exactly in interface with the exception of name. * */ #ifndef CONTACTEDITOR_H #define CONTACTEDITOR_H #include <opie/ocontact.h> #include <qpe/datebookmonth.h> #include <qdialog.h> #include <qlist.h> #include <qmap.h> #include <qstringlist.h> +#include <qwidgetstack.h> #include "ocontactfields.h" const int NAME_LF = 0; const int NAME_LFM = 1; const int NAME_FL = 2; const int NAME_FMLS = 3; const int NAME_F = 4; const int NAME_M = 5; const int NAME_L = 6; const int NAME_S = 7; class QScrollView; class QTabWidget; class QMultiLineEdit; class QLineEdit; class QComboBox; class QPushButton; class CategorySelect; class QLabel; class ContactEditor : public QDialog { Q_OBJECT public: ContactEditor( const OContact &entry, QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); ~ContactEditor(); void setNameFocus(); void setPersonalView( bool personal = true ); OContact entry() const { return ent; } public slots: void slotNote(); void slotName(); void setEntry(const OContact &entry); protected slots: void accept(); private: void init(); void saveEntry(); bool isEmpty(); void cleanupFields(); void updateDatePicker(); QString parseName( QString fullName, int type ); void chooserError( int index ); private slots: void slotChooser1Change( const QString &textChanged ); void slotChooser2Change( const QString &textChanged ); void slotChooser3Change( const QString &textChanged ); void slotChooser4Change( const QString &textChanged ); void slotCmbChooser1Change( int index ); void slotCmbChooser2Change( int index ); void slotCmbChooser3Change( int index ); void slotCmbChooser4Change( int index ); void slotAddressTypeChange( int index ); void slotAddressChange( const QString &textChanged ); void slotAddress2Change( const QString &textChanged ); void slotPOBoxChange( const QString &textChanged ); void slotCityChange( const QString &textChanged ); void slotStateChange( const QString &textChanged ); void slotZipChange( const QString &textChanged ); 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); void slotRemoveBirthday(); void slotRemoveAnniversary(); void defaultEmailChanged(int); private: + enum StackWidgets { TextField = 1, Combo }; int defaultEmailChooserPosition; void populateDefaultEmailCmb(); void chooserChange( const QString&, int , QLineEdit*, int ); - bool cmbChooserChange( int , QLineEdit*, int ); + bool cmbChooserChange( int , QWidgetStack*, int ); OContactFields contactfields; bool useFullName; OContact ent; QDialog *dlgNote; QDialog *dlgName; QList<QLineEdit> listValue; QList<QLabel> listName; QStringList slDynamicEntries; QStringList trlDynamicEntries; bool m_personalView; QStringList slHomeAddress; QStringList slBusinessAddress; QStringList slChooserNames; QStringList slChooserValues; QStringList emails; QString defaultEmail; QMultiLineEdit *txtNote; QLabel *lblNote; //QLineEdit *txtTitle; QLineEdit *txtFirstName; QLineEdit *txtMiddleName; QLineEdit *txtLastName; QLineEdit *txtSuffix; QTabWidget *tabMain; QScrollView *svGeneral; QPushButton *btnFullName; QPushButton *btnNote; QLineEdit *txtFullName; QLineEdit *txtJobTitle; QLineEdit *txtOrganization; QLineEdit *txtChooserField1; QLineEdit *txtChooserField2; QLineEdit *txtChooserField3; QLineEdit *txtChooserField4; + QWidgetStack* m_widgetStack1; + QWidgetStack* m_widgetStack2; + QWidgetStack* m_widgetStack3; + QWidgetStack* m_widgetStack4; QComboBox *cmbChooserField1; QComboBox *cmbChooserField2; QComboBox *cmbChooserField3; QComboBox *cmbChooserField4; QComboBox *cmbDefaultEmail; QComboBox *cmbFileAs; CategorySelect *cmbCat; QLabel *labCat; QScrollView *svAddress; QLineEdit *txtAddress; //QLineEdit *txtAddress2; //QLineEdit *txtPOBox; QLineEdit *txtCity; QLineEdit *txtState; QLineEdit *txtZip; QComboBox *cmbAddress; QComboBox *cmbCountry; QScrollView *svDetails; QComboBox *cmbGender; DateBookMonth* birthdayPicker; QToolButton* birthdayButton; DateBookMonth* anniversaryPicker; QToolButton* anniversaryButton; bool initializing; }; #endif diff --git a/core/pim/addressbook/ocontactfields.cpp b/core/pim/addressbook/ocontactfields.cpp index ffb88e8..831a596 100644 --- a/core/pim/addressbook/ocontactfields.cpp +++ b/core/pim/addressbook/ocontactfields.cpp @@ -375,82 +375,82 @@ OContactFields::OContactFields(): 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]; + fieldOrder[num] = QString::number( index, 16 )[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); + ret = QString( poschar ).toInt(&ok, 16); 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/version.h b/core/pim/addressbook/version.h index 3c1e5ee..3becfdc 100644 --- a/core/pim/addressbook/version.h +++ b/core/pim/addressbook/version.h @@ -1,10 +1,10 @@ #ifndef _VERSION_H_ #define _VERSION_H_ #define MAINVERSION "0" #define SUBVERSION "2" -#define PATCHVERSION "1" +#define PATCHVERSION "2" #define APPNAME "OPIE_ADDRESSBOOK" #endif |