summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index 0e752ca..6edab2c 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -1,128 +1,147 @@
1/*
2 * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org>
3 *
4 * This file is an add-on for the OPIE Palmtop Environment
5 *
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the pacakaging
9 * of this file.
10 *
11 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 *
14 *
15 * This is a rewrite of the abeditor.h file, modified to provide a more
16 * intuitive interface to TrollTech's original Address Book editor. This
17 * is made to operate exactly in interface with the exception of name.
18 *
19 */
1 20
2#include "contacteditor.h" 21#include "contacteditor.h"
3#include "addresspicker.h" 22#include "addresspicker.h"
4 23
5#include <qpe/categoryselect.h> 24#include <qpe/categoryselect.h>
6#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
7#include <qpe/qpedialog.h> 26#include <qpe/qpedialog.h>
8 27
9#include <qcombobox.h> 28#include <qcombobox.h>
10#include <qlabel.h> 29#include <qlabel.h>
11#include <qtabwidget.h> 30#include <qtabwidget.h>
12#include <qlayout.h> 31#include <qlayout.h>
13#include <qlineedit.h> 32#include <qlineedit.h>
14#include <qmultilineedit.h> 33#include <qmultilineedit.h>
15#include <qscrollview.h> 34#include <qscrollview.h>
16#include <qtoolbutton.h> 35#include <qtoolbutton.h>
17#include <qpushbutton.h> 36#include <qpushbutton.h>
18#include <qmainwindow.h> 37#include <qmainwindow.h>
19#include <qvaluelist.h> 38#include <qvaluelist.h>
20 39
21static inline bool containsAlphaNum( const QString &str ); 40static inline bool containsAlphaNum( const QString &str );
22static inline bool constainsWhiteSpace( const QString &str ); 41static inline bool constainsWhiteSpace( const QString &str );
23 42
24// helper functions, convert our comma delimited list to proper 43// helper functions, convert our comma delimited list to proper
25// file format... 44// file format...
26void parseEmailFrom( const QString &txt, QString &strDefaultEmail, 45void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
27 QString &strAll ); 46 QString &strAll );
28 47
29// helper convert from file format to comma delimited... 48// helper convert from file format to comma delimited...
30void parseEmailTo( const QString &strDefaultEmail, 49void parseEmailTo( const QString &strDefaultEmail,
31 const QString &strOtherEmail, QString &strBack ); 50 const QString &strOtherEmail, QString &strBack );
32 51
33 ContactEditor::ContactEditor(const Contact &entry, 52 ContactEditor::ContactEditor(const Contact &entry,
34 const QValueList<int> *newOrderedValues, 53 const QValueList<int> *newOrderedValues,
35 QStringList *slNewOrdered, 54 QStringList *slNewOrdered,
36 QWidget *parent = 0, 55 QWidget *parent = 0,
37 const char *name = 0, 56 const char *name = 0,
38 WFlags fl = 0 ) 57 WFlags fl = 0 )
39 : QDialog( parent, name, TRUE, fl ), 58 : QDialog( parent, name, TRUE, fl ),
40 orderedValues( newOrderedValues ), 59 orderedValues( newOrderedValues ),
41 slOrdered( slNewOrdered ) 60 slOrdered( slNewOrdered )
42{ 61{
43 62
44 init(); 63 init();
45 initMap(); 64 initMap();
46 setEntry( entry ); 65 setEntry( entry );
47 qDebug("finish"); 66 qDebug("finish");
48} 67}
49 68
50ContactEditor::~ContactEditor() { 69ContactEditor::~ContactEditor() {
51} 70}
52 71
53void ContactEditor::init() { 72void ContactEditor::init() {
54 73
55 useFullName = TRUE; 74 useFullName = TRUE;
56 75
57 int i = 0; 76 int i = 0;
58 77
59 slHomeAddress = new QStringList; 78 slHomeAddress = new QStringList;
60 slBusinessAddress = new QStringList; 79 slBusinessAddress = new QStringList;
61 slChooserNames = new QStringList; 80 slChooserNames = new QStringList;
62 slChooserValues = new QStringList; 81 slChooserValues = new QStringList;
63 82
64 slDynamicEntries = new QStringList; 83 slDynamicEntries = new QStringList;
65 84
66 //*slDynamicEntries = *slOrdered; 85 //*slDynamicEntries = *slOrdered;
67 86
68 for (i = 0; i <= 6; i++) { 87 for (i = 0; i <= 6; i++) {
69 slHomeAddress->append( "" ); 88 slHomeAddress->append( "" );
70 slBusinessAddress->append( "" ); 89 slBusinessAddress->append( "" );
71 } 90 }
72 91
73 { 92 {
74 hasGender = FALSE; 93 hasGender = FALSE;
75 hasTitle = FALSE; 94 hasTitle = FALSE;
76 hasCompany = FALSE; 95 hasCompany = FALSE;
77 hasNotes = FALSE; 96 hasNotes = FALSE;
78 hasStreet = FALSE; 97 hasStreet = FALSE;
79 hasStreet2 = FALSE; 98 hasStreet2 = FALSE;
80 hasPOBox = FALSE; 99 hasPOBox = FALSE;
81 hasCity = FALSE; 100 hasCity = FALSE;
82 hasState = FALSE; 101 hasState = FALSE;
83 hasZip = FALSE; 102 hasZip = FALSE;
84 hasCountry = FALSE; 103 hasCountry = FALSE;
85 104
86 QStringList::ConstIterator it = slOrdered->begin(); 105 QStringList::ConstIterator it = slOrdered->begin();
87 for ( i = 0; it != slOrdered->end(); i++, ++it ) { 106 for ( i = 0; it != slOrdered->end(); i++, ++it ) {
88 107
89 if ( (*it).right( 3 ) == tr( "Fax" ) ) { 108 if ( (*it).right( 3 ) == tr( "Fax" ) ) {
90 slChooserNames->append( *it ); 109 slChooserNames->append( *it );
91 slChooserValues->append( tr( "" ) ); 110 slChooserValues->append( tr( "" ) );
92 //slDynamicEntries->remove( it ); 111 //slDynamicEntries->remove( it );
93 continue; 112 continue;
94 } 113 }
95 114
96 if ( (*it).right( 5 ) == tr( "Phone" ) ) { 115 if ( (*it).right( 5 ) == tr( "Phone" ) ) {
97 slChooserNames->append( *it ); 116 slChooserNames->append( *it );
98 slChooserValues->append( "" ); 117 slChooserValues->append( "" );
99 //slDynamicEntries->remove( it ); 118 //slDynamicEntries->remove( it );
100 continue; 119 continue;
101 } 120 }
102 121
103 if ( (*it).right( 2 ) == tr( "IM" ) ) { 122 if ( (*it).right( 2 ) == tr( "IM" ) ) {
104 slChooserNames->append( *it ); 123 slChooserNames->append( *it );
105 slChooserValues->append( "" ); 124 slChooserValues->append( "" );
106 //slDynamicEntries->remove( it ); 125 //slDynamicEntries->remove( it );
107 continue; 126 continue;
108 } 127 }
109 128
110 if ( (*it).right( 6 ) == tr( "Mobile" ) ) { 129 if ( (*it).right( 6 ) == tr( "Mobile" ) ) {
111 slChooserNames->append( *it ); 130 slChooserNames->append( *it );
112 slChooserValues->append( "" ); 131 slChooserValues->append( "" );
113 //slDynamicEntries->remove( it ); 132 //slDynamicEntries->remove( it );
114 continue; 133 continue;
115 } 134 }
116 135
117 if ( (*it).right( 4 ) == tr( "Page" ) ) { 136 if ( (*it).right( 4 ) == tr( "Page" ) ) {
118 slChooserNames->append( *it ); 137 slChooserNames->append( *it );
119 slChooserValues->append( "" ); 138 slChooserValues->append( "" );
120 //slDynamicEntries->remove( it ); 139 //slDynamicEntries->remove( it );
121 continue; 140 continue;
122 } 141 }
123 142
124 if ( (*it).right( 5 ) == tr( "Pager" ) ) { 143 if ( (*it).right( 5 ) == tr( "Pager" ) ) {
125 slChooserNames->append( *it ); 144 slChooserNames->append( *it );
126 slChooserValues->append( "" ); 145 slChooserValues->append( "" );
127 //slDynamicEntries->remove( it ); 146 //slDynamicEntries->remove( it );
128 continue; 147 continue;