author | drw <drw> | 2004-03-25 23:40:52 (UTC) |
---|---|---|
committer | drw <drw> | 2004-03-25 23:40:52 (UTC) |
commit | 98721c16aa480c4a160d3492462cb8f0de783268 (patch) (unidiff) | |
tree | 2be8dcd6cf985d98912cbb18e5d23e4b567396ff /core/pim/addressbook/contacteditor.cpp | |
parent | 03091cd727701bdb2aa6ac623cd606131546d686 (diff) | |
download | opie-98721c16aa480c4a160d3492462cb8f0de783268.zip opie-98721c16aa480c4a160d3492462cb8f0de783268.tar.gz opie-98721c16aa480c4a160d3492462cb8f0de783268.tar.bz2 |
libopie -> libopie2
Diffstat (limited to 'core/pim/addressbook/contacteditor.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 8acf570..534666d 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -12,28 +12,29 @@ | |||
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 | 23 | ||
24 | #include <opie2/opimcontact.h> | ||
25 | |||
24 | #include <qpe/categoryselect.h> | 26 | #include <qpe/categoryselect.h> |
25 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/qpedialog.h> | 28 | #include <qpe/qpedialog.h> |
27 | #include <opie/ocontact.h> | ||
28 | #include <qpe/resource.h> | 29 | #include <qpe/resource.h> |
29 | 30 | ||
30 | #include <qlabel.h> | 31 | #include <qlabel.h> |
31 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
32 | #include <qlayout.h> | 33 | #include <qlayout.h> |
33 | #include <qlineedit.h> | 34 | #include <qlineedit.h> |
34 | #include <qmultilineedit.h> | 35 | #include <qmultilineedit.h> |
35 | #include <qtoolbutton.h> | 36 | #include <qtoolbutton.h> |
36 | #include <qlistbox.h> | 37 | #include <qlistbox.h> |
37 | #include <qmessagebox.h> | 38 | #include <qmessagebox.h> |
38 | #include <qwhatsthis.h> | 39 | #include <qwhatsthis.h> |
39 | 40 | ||
@@ -42,25 +43,25 @@ | |||
42 | static inline bool containsAlphaNum( const QString &str ); | 43 | static inline bool containsAlphaNum( const QString &str ); |
43 | static inline bool constainsWhiteSpace( const QString &str ); | 44 | static inline bool constainsWhiteSpace( const QString &str ); |
44 | 45 | ||
45 | // helper functions, convert our comma delimited list to proper | 46 | // helper functions, convert our comma delimited list to proper |
46 | // file format... | 47 | // file format... |
47 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 48 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
48 | QString &strAll ); | 49 | QString &strAll ); |
49 | 50 | ||
50 | // helper convert from file format to comma delimited... | 51 | // helper convert from file format to comma delimited... |
51 | void parseEmailTo( const QString &strDefaultEmail, | 52 | void parseEmailTo( const QString &strDefaultEmail, |
52 | const QString &strOtherEmail, QString &strBack ); | 53 | const QString &strOtherEmail, QString &strBack ); |
53 | 54 | ||
54 | ContactEditor::ContactEditor(const OContact &entry, | 55 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, |
55 | QWidget *parent, | 56 | QWidget *parent, |
56 | const char *name, | 57 | const char *name, |
57 | WFlags ) | 58 | WFlags ) |
58 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), | 59 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), |
59 | defaultEmailChooserPosition( -1 ), | 60 | defaultEmailChooserPosition( -1 ), |
60 | m_personalView ( false ), | 61 | m_personalView ( false ), |
61 | cmbDefaultEmail( 0 ), | 62 | cmbDefaultEmail( 0 ), |
62 | initializing ( false ) | 63 | initializing ( false ) |
63 | { | 64 | { |
64 | 65 | ||
65 | initializing = true; | 66 | initializing = true; |
66 | 67 | ||
@@ -78,39 +79,39 @@ ContactEditor::~ContactEditor() { | |||
78 | void ContactEditor::init() { | 79 | void ContactEditor::init() { |
79 | qWarning("init() START"); | 80 | qWarning("init() START"); |
80 | 81 | ||
81 | uint i = 0; | 82 | uint i = 0; |
82 | 83 | ||
83 | QStringList trlChooserNames; | 84 | QStringList trlChooserNames; |
84 | 85 | ||
85 | for (i = 0; i <= 6; i++) { | 86 | for (i = 0; i <= 6; i++) { |
86 | slHomeAddress.append( "" ); | 87 | slHomeAddress.append( "" ); |
87 | slBusinessAddress.append( "" ); | 88 | slBusinessAddress.append( "" ); |
88 | } | 89 | } |
89 | 90 | ||
90 | trlChooserNames = OContactFields::trphonefields( false ); | 91 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); |
91 | slChooserNames = OContactFields::untrphonefields( false ); | 92 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); |
92 | slDynamicEntries = OContactFields::untrdetailsfields( false ); | 93 | slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); |
93 | trlDynamicEntries = OContactFields::trdetailsfields( false ); | 94 | trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); |
94 | 95 | ||
95 | // Ok, we have to remove elements from the list of dynamic entries | 96 | // Ok, we have to remove elements from the list of dynamic entries |
96 | // which are now stored in special (not dynamic) widgets.. | 97 | // which are now stored in special (not dynamic) widgets.. |
97 | // Otherwise we will get problems with field assignments! (se) | 98 | // Otherwise we will get problems with field assignments! (se) |
98 | slDynamicEntries.remove("Anniversary"); | 99 | slDynamicEntries.remove("Anniversary"); |
99 | slDynamicEntries.remove("Birthday"); | 100 | slDynamicEntries.remove("Birthday"); |
100 | slDynamicEntries.remove("Gender"); | 101 | slDynamicEntries.remove("Gender"); |
101 | 102 | ||
102 | // The same with translated fields.. But I will | 103 | // The same with translated fields.. But I will |
103 | // use the translation map to avoid mismatches.. | 104 | // use the translation map to avoid mismatches.. |
104 | QMap<int, QString> translMap = OContactFields::idToTrFields(); | 105 | QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields(); |
105 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); | 106 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); |
106 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); | 107 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); |
107 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 108 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
108 | 109 | ||
109 | // Last Check to be sure.. | 110 | // Last Check to be sure.. |
110 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 111 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
111 | assert( slChooserNames.count() == trlChooserNames.count() ); | 112 | assert( slChooserNames.count() == trlChooserNames.count() ); |
112 | 113 | ||
113 | for (i = 0; i < slChooserNames.count(); i++) | 114 | for (i = 0; i < slChooserNames.count(); i++) |
114 | slChooserValues.append(""); | 115 | slChooserValues.append(""); |
115 | 116 | ||
116 | 117 | ||
@@ -569,26 +570,26 @@ void ContactEditor::init() { | |||
569 | l = new QLabel( tr("Gender"), container ); | 570 | l = new QLabel( tr("Gender"), container ); |
570 | gl->addWidget( l, counter, 0 ); | 571 | gl->addWidget( l, counter, 0 ); |
571 | cmbGender = new QComboBox( container ); | 572 | cmbGender = new QComboBox( container ); |
572 | cmbGender->insertItem( "", 0 ); | 573 | cmbGender->insertItem( "", 0 ); |
573 | cmbGender->insertItem( tr("Male"), 1); | 574 | cmbGender->insertItem( tr("Male"), 1); |
574 | cmbGender->insertItem( tr("Female"), 2); | 575 | cmbGender->insertItem( tr("Female"), 2); |
575 | gl->addWidget( cmbGender, counter, 1 ); | 576 | gl->addWidget( cmbGender, counter, 1 ); |
576 | 577 | ||
577 | ++counter; | 578 | ++counter; |
578 | 579 | ||
579 | // Create Labels and lineedit fields for every dynamic entry | 580 | // Create Labels and lineedit fields for every dynamic entry |
580 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 581 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
581 | QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); | 582 | QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId(); |
582 | QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); | 583 | QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields(); |
583 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { | 584 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { |
584 | 585 | ||
585 | if (((*it) == "Anniversary") || | 586 | if (((*it) == "Anniversary") || |
586 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 587 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
587 | 588 | ||
588 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); | 589 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); |
589 | listName.append( l ); | 590 | listName.append( l ); |
590 | gl->addWidget( l, i, 0 ); | 591 | gl->addWidget( l, i, 0 ); |
591 | QLineEdit *e = new QLineEdit( container ); | 592 | QLineEdit *e = new QLineEdit( container ); |
592 | listValue.append( e ); | 593 | listValue.append( e ); |
593 | gl->addWidget( e, i, 1); | 594 | gl->addWidget( e, i, 1); |
594 | } | 595 | } |
@@ -1241,25 +1242,25 @@ void ContactEditor::cleanupFields() { | |||
1241 | txtChooserField3->setText(""); | 1242 | txtChooserField3->setText(""); |
1242 | txtAddress->setText(""); | 1243 | txtAddress->setText(""); |
1243 | txtCity->setText(""); | 1244 | txtCity->setText(""); |
1244 | txtState->setText(""); | 1245 | txtState->setText(""); |
1245 | txtZip->setText(""); | 1246 | txtZip->setText(""); |
1246 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1247 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1247 | txtTmp->setText(""); | 1248 | txtTmp->setText(""); |
1248 | txtTmp = cmbFileAs->lineEdit(); | 1249 | txtTmp = cmbFileAs->lineEdit(); |
1249 | txtTmp->setText(""); | 1250 | txtTmp->setText(""); |
1250 | 1251 | ||
1251 | } | 1252 | } |
1252 | 1253 | ||
1253 | void ContactEditor::setEntry( const OContact &entry ) { | 1254 | void ContactEditor::setEntry( const Opie::OPimContact &entry ) { |
1254 | 1255 | ||
1255 | initializing = true; | 1256 | initializing = true; |
1256 | 1257 | ||
1257 | // Cleanup and activate the general Page .. | 1258 | // Cleanup and activate the general Page .. |
1258 | cleanupFields(); | 1259 | cleanupFields(); |
1259 | tabMain->setCurrentPage( 0 ); | 1260 | tabMain->setCurrentPage( 0 ); |
1260 | 1261 | ||
1261 | ent = entry; | 1262 | ent = entry; |
1262 | 1263 | ||
1263 | emails = QStringList(ent.emailList()); | 1264 | emails = QStringList(ent.emailList()); |
1264 | defaultEmail = ent.defaultEmail(); | 1265 | defaultEmail = ent.defaultEmail(); |
1265 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1266 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |