summaryrefslogtreecommitdiff
authortille <tille>2002-12-08 18:37:00 (UTC)
committer tille <tille>2002-12-08 18:37:00 (UTC)
commitff55ff70dc982d070bb085acb96831ae30b30902 (patch) (unidiff)
tree3cb5f5c0e75794420a525ebc7aa929003fc6a650
parent741a70d585c5680ccdb2786df4a73e7bde1d7c5d (diff)
downloadopie-ff55ff70dc982d070bb085acb96831ae30b30902.zip
opie-ff55ff70dc982d070bb085acb96831ae30b30902.tar.gz
opie-ff55ff70dc982d070bb085acb96831ae30b30902.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 7338eeb..f125edb 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -4,132 +4,135 @@
4 * 4 *
5 * This file is an add-on for the OPIE Palmtop Environment 5 * This file is an add-on for the OPIE Palmtop Environment
6 * 6 *
7 * This file may be distributed and/or modified under the terms of the 7 * This file may be distributed and/or modified under the terms of the
8 * GNU General Public License version 2 as published by the Free Software 8 * GNU General Public License version 2 as published by the Free Software
9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging 9 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
10 * of this file. 10 * of this file.
11 * 11 *
12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 12 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 13 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 * 14 *
15 * 15 *
16 * This is a rewrite of the abeditor.h file, modified to provide a more 16 * This is a rewrite of the abeditor.h file, modified to provide a more
17 * intuitive interface to TrollTech's original Address Book editor. This 17 * intuitive interface to TrollTech's original Address Book editor. This
18 * is made to operate exactly in interface with the exception of name. 18 * is made to operate exactly in interface with the exception of name.
19 * 19 *
20 */ 20 */
21 21
22#include "contacteditor.h" 22#include "contacteditor.h"
23#include "addresspicker.h" 23#include "addresspicker.h"
24#include "ocontactfields.h" 24#include "ocontactfields.h"
25 25
26#include <qpe/categoryselect.h> 26#include <qpe/categoryselect.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/qpedialog.h> 28#include <qpe/qpedialog.h>
29#include <qpe/timeconversion.h> 29#include <qpe/timeconversion.h>
30#include <opie/ocontact.h> 30#include <opie/ocontact.h>
31#include <qpe/resource.h> 31#include <qpe/resource.h>
32 32
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qlabel.h> 34#include <qlabel.h>
35#include <qtabwidget.h> 35#include <qtabwidget.h>
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qlineedit.h> 37#include <qlineedit.h>
38#include <qmultilineedit.h> 38#include <qmultilineedit.h>
39#include <qscrollview.h> 39#include <qscrollview.h>
40#include <qtoolbutton.h> 40#include <qtoolbutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qmainwindow.h> 42#include <qmainwindow.h>
43#include <qvaluelist.h> 43#include <qvaluelist.h>
44#include <qpopupmenu.h> 44#include <qpopupmenu.h>
45#include <qlistbox.h> 45#include <qlistbox.h>
46#include <qhbox.h> 46#include <qhbox.h>
47#include <qaction.h> 47#include <qaction.h>
48#include <qiconset.h> 48#include <qiconset.h>
49 49
50static inline bool containsAlphaNum( const QString &str ); 50static inline bool containsAlphaNum( const QString &str );
51static inline bool constainsWhiteSpace( const QString &str ); 51static inline bool constainsWhiteSpace( const QString &str );
52 52
53// helper functions, convert our comma delimited list to proper 53// helper functions, convert our comma delimited list to proper
54// file format... 54// file format...
55void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 55void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
56 QString &strAll ); 56 QString &strAll );
57 57
58// helper convert from file format to comma delimited... 58// helper convert from file format to comma delimited...
59//void parseEmailTo( const QString &strDefaultEmail, 59//void parseEmailTo( const QString &strDefaultEmail,
60 // const QString &strOtherEmail, QString &strBack ); 60 // const QString &strOtherEmail, QString &strBack );
61 61
62 ContactEditor::ContactEditor(const OContact &entry, 62 ContactEditor::ContactEditor(const OContact &entry,
63 QWidget *parent, 63 QWidget *parent,
64 const char *name, 64 const char *name,
65 WFlags fl ) 65 WFlags fl )
66 : QDialog( parent, name, TRUE, fl ), 66 : QDialog( parent, name, TRUE, fl ),
67 m_personalView ( false ) 67 m_personalView ( false )
68
68{ 69{
69 70
70 init(); 71 init();
71 setEntry( entry ); 72 setEntry( entry );
73
74 cmbDefaultEmail = 0;
72} 75}
73 76
74ContactEditor::~ContactEditor() { 77ContactEditor::~ContactEditor() {
75} 78}
76 79
77void ContactEditor::init() { 80void ContactEditor::init() {
78 81
79 useFullName = true; 82 useFullName = true;
80 83
81 uint i = 0; 84 uint i = 0;
82 85
83 QStringList trlChooserNames; 86 QStringList trlChooserNames;
84 87
85 for (i = 0; i <= 6; i++) { 88 for (i = 0; i <= 6; i++) {
86 slHomeAddress.append( "" ); 89 slHomeAddress.append( "" );
87 slBusinessAddress.append( "" ); 90 slBusinessAddress.append( "" );
88 } 91 }
89 92
90 trlChooserNames = OContactFields::trphonefields(); 93 trlChooserNames = OContactFields::trphonefields();
91 slChooserNames = OContactFields::untrphonefields(); 94 slChooserNames = OContactFields::untrphonefields();
92 slDynamicEntries = OContactFields::untrdetailsfields(); 95 slDynamicEntries = OContactFields::untrdetailsfields();
93 trlDynamicEntries = OContactFields::trdetailsfields(); 96 trlDynamicEntries = OContactFields::trdetailsfields();
94 for (i = 0; i < slChooserNames.count(); i++) 97 for (i = 0; i < slChooserNames.count(); i++)
95 slChooserValues.append(""); 98 slChooserValues.append("");
96 99
97 100
98 QVBoxLayout *vb = new QVBoxLayout( this ); 101 QVBoxLayout *vb = new QVBoxLayout( this );
99 102
100 tabMain = new QTabWidget( this ); 103 tabMain = new QTabWidget( this );
101 vb->addWidget( tabMain ); 104 vb->addWidget( tabMain );
102 105
103 QWidget *tabViewport = new QWidget ( tabMain ); 106 QWidget *tabViewport = new QWidget ( tabMain );
104 107
105 vb = new QVBoxLayout( tabViewport ); 108 vb = new QVBoxLayout( tabViewport );
106 109
107 svGeneral = new QScrollView( tabViewport ); 110 svGeneral = new QScrollView( tabViewport );
108 vb->addWidget( svGeneral, 0, 0 ); 111 vb->addWidget( svGeneral, 0, 0 );
109 svGeneral->setResizePolicy( QScrollView::AutoOneFit ); 112 svGeneral->setResizePolicy( QScrollView::AutoOneFit );
110 svGeneral->setFrameStyle( QFrame::NoFrame ); 113 svGeneral->setFrameStyle( QFrame::NoFrame );
111 114
112 QWidget *container = new QWidget( svGeneral->viewport() ); 115 QWidget *container = new QWidget( svGeneral->viewport() );
113 svGeneral->addChild( container ); 116 svGeneral->addChild( container );
114 117
115 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); 118 QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
116 gl->setResizeMode( QLayout::FreeResize ); 119 gl->setResizeMode( QLayout::FreeResize );
117 120
118 btnFullName = new QPushButton( tr( "Full Name..." ), container ); 121 btnFullName = new QPushButton( tr( "Full Name..." ), container );
119 gl->addWidget( btnFullName, 0, 0 ); 122 gl->addWidget( btnFullName, 0, 0 );
120 txtFullName = new QLineEdit( container ); 123 txtFullName = new QLineEdit( container );
121 gl->addWidget( txtFullName, 0, 1 ); 124 gl->addWidget( txtFullName, 0, 1 );
122 125
123 QLabel *l = new QLabel( tr( "Job Title" ), container ); 126 QLabel *l = new QLabel( tr( "Job Title" ), container );
124 gl->addWidget( l, 1, 0 ); 127 gl->addWidget( l, 1, 0 );
125 txtJobTitle = new QLineEdit( container ); 128 txtJobTitle = new QLineEdit( container );
126 gl->addWidget( txtJobTitle, 1, 1 ); 129 gl->addWidget( txtJobTitle, 1, 1 );
127 130
128 l = new QLabel( tr( "Organization" ), container ); 131 l = new QLabel( tr( "Organization" ), container );
129 gl->addWidget( l, 2, 0 ); 132 gl->addWidget( l, 2, 0 );
130 txtOrganization = new QLineEdit( container ); 133 txtOrganization = new QLineEdit( container );
131 gl->addWidget( txtOrganization, 2, 1 ); 134 gl->addWidget( txtOrganization, 2, 1 );
132 135
133 cmbChooserField1 = new QComboBox( FALSE, container ); 136 cmbChooserField1 = new QComboBox( FALSE, container );
134 cmbChooserField1->setMaximumWidth( 90 ); 137 cmbChooserField1->setMaximumWidth( 90 );
135 gl->addWidget( cmbChooserField1, 3, 0 ); 138 gl->addWidget( cmbChooserField1, 3, 0 );
@@ -570,129 +573,129 @@ void ContactEditor::init() {
570 QSizePolicy::MinimumExpanding ); 573 QSizePolicy::MinimumExpanding );
571 gl->addItem( space, 4, 0 ); 574 gl->addItem( space, 4, 0 );
572 575
573 cmbChooserField1->insertStringList( trlChooserNames ); 576 cmbChooserField1->insertStringList( trlChooserNames );
574 cmbChooserField2->insertStringList( trlChooserNames ); 577 cmbChooserField2->insertStringList( trlChooserNames );
575 cmbChooserField3->insertStringList( trlChooserNames ); 578 cmbChooserField3->insertStringList( trlChooserNames );
576 cmbChooserField4->insertStringList( trlChooserNames ); 579 cmbChooserField4->insertStringList( trlChooserNames );
577 580
578 cmbChooserField1->setCurrentItem( 0 ); 581 cmbChooserField1->setCurrentItem( 0 );
579 cmbChooserField2->setCurrentItem( 1 ); 582 cmbChooserField2->setCurrentItem( 1 );
580 cmbChooserField3->setCurrentItem( 2 ); 583 cmbChooserField3->setCurrentItem( 2 );
581 584
582 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 585 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
583 586
584 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 587 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
585 588
586 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), 589 connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
587 this, SLOT(slotChooser1Change(const QString &)) ); 590 this, SLOT(slotChooser1Change(const QString &)) );
588 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), 591 connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
589 this, SLOT(slotChooser2Change(const QString &)) ); 592 this, SLOT(slotChooser2Change(const QString &)) );
590 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), 593 connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
591 this, SLOT(slotChooser3Change(const QString &)) ); 594 this, SLOT(slotChooser3Change(const QString &)) );
592 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), 595 connect( txtChooserField4, SIGNAL(textChanged(const QString &)),
593 this, SLOT(slotChooser4Change(const QString &)) ); 596 this, SLOT(slotChooser4Change(const QString &)) );
594 connect( txtAddress, SIGNAL(textChanged(const QString &)), 597 connect( txtAddress, SIGNAL(textChanged(const QString &)),
595 this, SLOT(slotAddressChange(const QString &)) ); 598 this, SLOT(slotAddressChange(const QString &)) );
596 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); 599 //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) );
597 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); 600 //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) );
598 connect( txtCity, SIGNAL(textChanged(const QString &)), 601 connect( txtCity, SIGNAL(textChanged(const QString &)),
599 this, SLOT(slotCityChange(const QString &)) ); 602 this, SLOT(slotCityChange(const QString &)) );
600 connect( txtState, SIGNAL(textChanged(const QString &)), 603 connect( txtState, SIGNAL(textChanged(const QString &)),
601 this, SLOT(slotStateChange(const QString &)) ); 604 this, SLOT(slotStateChange(const QString &)) );
602 connect( txtZip, SIGNAL(textChanged(const QString &)), 605 connect( txtZip, SIGNAL(textChanged(const QString &)),
603 this, SLOT(slotZipChange(const QString &)) ); 606 this, SLOT(slotZipChange(const QString &)) );
604 connect( cmbCountry, SIGNAL(textChanged(const QString &)), 607 connect( cmbCountry, SIGNAL(textChanged(const QString &)),
605 this, SLOT(slotCountryChange(const QString &)) ); 608 this, SLOT(slotCountryChange(const QString &)) );
606 connect( cmbCountry, SIGNAL(activated(const QString &)), 609 connect( cmbCountry, SIGNAL(activated(const QString &)),
607 this, SLOT(slotCountryChange(const QString &)) ); 610 this, SLOT(slotCountryChange(const QString &)) );
608 connect( cmbChooserField1, SIGNAL(activated(int)), 611 connect( cmbChooserField1, SIGNAL(activated(int)),
609 this, SLOT(slotCmbChooser1Change(int)) ); 612 this, SLOT(slotCmbChooser1Change(int)) );
610 connect( cmbChooserField2, SIGNAL(activated(int)), 613 connect( cmbChooserField2, SIGNAL(activated(int)),
611 this, SLOT(slotCmbChooser2Change(int)) ); 614 this, SLOT(slotCmbChooser2Change(int)) );
612 connect( cmbChooserField3, SIGNAL(activated(int)), 615 connect( cmbChooserField3, SIGNAL(activated(int)),
613 this, SLOT(slotCmbChooser3Change(int)) ); 616 this, SLOT(slotCmbChooser3Change(int)) );
614 connect( cmbChooserField4, SIGNAL(activated(int)), 617 connect( cmbChooserField4, SIGNAL(activated(int)),
615 this, SLOT(slotCmbChooser4Change(int)) ); 618 this, SLOT(slotCmbChooser4Change(int)) );
616 connect( cmbAddress, SIGNAL(activated(int)), 619 connect( cmbAddress, SIGNAL(activated(int)),
617 this, SLOT(slotAddressTypeChange(int)) ); 620 this, SLOT(slotAddressTypeChange(int)) );
618 621
619 new QPEDialogListener(this); 622 new QPEDialogListener(this);
620 623
621 setPersonalView ( m_personalView ); 624 setPersonalView ( m_personalView );
622} 625}
623 626
624void ContactEditor::defaultEmailChanged(int i){ 627void ContactEditor::defaultEmailChanged(int i){
625 qDebug("defaultEmailChanged"); 628 qDebug("defaultEmailChanged");
626 int index = cmbChooserField1->currentItem(); 629 int index = cmbChooserField1->currentItem();
627 slChooserValues[index] = cmbDefaultEmail->text(i); 630 slChooserValues[index] = cmbDefaultEmail->text(i);
628 631
629} 632}
630 633
631void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid ) { 634void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid ) {
632 635
633 if (slChooserNames[index] == "Default Email"){ 636 if (slChooserNames[index] == "Default Email"){
634 delete cmbDefaultEmail; 637 if (cmbDefaultEmail) delete cmbDefaultEmail;
635 cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); 638 cmbDefaultEmail = new QComboBox(inputWid->parentWidget());
636 cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); 639 cmbDefaultEmail->setGeometry(inputWid->frameGeometry());
637 cmbDefaultEmail->insertStringList(ent.emailList()); 640 cmbDefaultEmail->insertStringList(ent.emailList());
638 connect(cmbDefaultEmail,SIGNAL(activated(int)), 641 connect(cmbDefaultEmail,SIGNAL(activated(int)),
639 SLOT(defaultEmailChanged(int))); 642 SLOT(defaultEmailChanged(int)));
640 QString demail = ent.defaultEmail(); 643 QString demail = ent.defaultEmail();
641 for ( int i = 0; i < cmbDefaultEmail->count(); i++) 644 for ( int i = 0; i < cmbDefaultEmail->count(); i++)
642 if ( cmbDefaultEmail->text( i ) == demail ) 645 if ( cmbDefaultEmail->text( i ) == demail )
643 cmbDefaultEmail->setCurrentItem( i ); 646 cmbDefaultEmail->setCurrentItem( i );
644 647
645 cmbDefaultEmail->show(); 648 cmbDefaultEmail->show();
646 } 649 }
647 650
648 651
649 slChooserValues[index] = textChanged; 652 slChooserValues[index] = textChanged;
650 653
651} 654}
652 655
653void ContactEditor::slotChooser1Change( const QString &textChanged ) { 656void ContactEditor::slotChooser1Change( const QString &textChanged ) {
654 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1); 657 chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1);
655} 658}
656 659
657void ContactEditor::slotChooser2Change( const QString &textChanged ) { 660void ContactEditor::slotChooser2Change( const QString &textChanged ) {
658 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2); 661 chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2);
659 662
660} 663}
661 664
662void ContactEditor::slotChooser3Change( const QString &textChanged ) { 665void ContactEditor::slotChooser3Change( const QString &textChanged ) {
663 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3); 666 chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3);
664} 667}
665 668
666void ContactEditor::slotChooser4Change( const QString &textChanged ) { 669void ContactEditor::slotChooser4Change( const QString &textChanged ) {
667 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4); 670 chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4);
668} 671}
669 672
670void ContactEditor::slotAddressChange( const QString &textChanged ) { 673void ContactEditor::slotAddressChange( const QString &textChanged ) {
671 674
672 if ( cmbAddress->currentItem() == 0 ) { 675 if ( cmbAddress->currentItem() == 0 ) {
673 slBusinessAddress[0] = textChanged; 676 slBusinessAddress[0] = textChanged;
674 } else { 677 } else {
675 slHomeAddress[0] = textChanged; 678 slHomeAddress[0] = textChanged;
676 } 679 }
677} 680}
678 681
679void ContactEditor::slotAddress2Change( const QString &textChanged ) { 682void ContactEditor::slotAddress2Change( const QString &textChanged ) {
680 683
681 if ( cmbAddress->currentItem() == 0 ) { 684 if ( cmbAddress->currentItem() == 0 ) {
682 slBusinessAddress[1] = textChanged; 685 slBusinessAddress[1] = textChanged;
683 } else { 686 } else {
684 slHomeAddress[1] = textChanged; 687 slHomeAddress[1] = textChanged;
685 } 688 }
686} 689}
687 690
688void ContactEditor::slotPOBoxChange( const QString &textChanged ) { 691void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
689 692
690 if ( cmbAddress->currentItem() == 0 ) { 693 if ( cmbAddress->currentItem() == 0 ) {
691 slBusinessAddress[2] = textChanged; 694 slBusinessAddress[2] = textChanged;
692 } else { 695 } else {
693 slHomeAddress[2] = textChanged; 696 slHomeAddress[2] = textChanged;
694 } 697 }
695} 698}
696 699
697void ContactEditor::slotCityChange( const QString &textChanged ) { 700void ContactEditor::slotCityChange( const QString &textChanged ) {
698 701