summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/contacteditor.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/addressbook/contacteditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp75
1 files changed, 59 insertions, 16 deletions
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 ) {