author | drw <drw> | 2005-02-06 23:12:25 (UTC) |
---|---|---|
committer | drw <drw> | 2005-02-06 23:12:25 (UTC) |
commit | 5652634e4ff03370564925ce0856b260c001dc0f (patch) (unidiff) | |
tree | 614cbdec8ff9f4f674a9cb4e5caf44cce1def4f8 /core/pim/addressbook/contacteditor.cpp | |
parent | 266d71ee80151b3c97671acc95275aa65b682388 (diff) | |
download | opie-5652634e4ff03370564925ce0856b260c001dc0f.zip opie-5652634e4ff03370564925ce0856b260c001dc0f.tar.gz opie-5652634e4ff03370564925ce0856b260c001dc0f.tar.bz2 |
Convert to OPimMainWindow and UI tweaks. There is still a couple items yet to do...
Diffstat (limited to 'core/pim/addressbook/contacteditor.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index b078968..dec4c7c 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | 32 | ||
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qtabwidget.h> | ||
35 | #include <qlayout.h> | 34 | #include <qlayout.h> |
36 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
37 | #include <qmultilineedit.h> | 36 | #include <qmultilineedit.h> |
@@ -58,7 +57,7 @@ ContactEditor::ContactEditor( const Opie::OPimContact &entry, | |||
58 | QWidget *parent, | 57 | QWidget *parent, |
59 | const char *name, | 58 | const char *name, |
60 | WFlags ) | 59 | WFlags ) |
61 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), | 60 | : QDialog( parent, name, true, WStyle_ContextHelp ), |
62 | defaultEmailChooserPosition( -1 ), | 61 | defaultEmailChooserPosition( -1 ), |
63 | m_personalView ( false ), | 62 | m_personalView ( false ), |
64 | cmbDefaultEmail( 0 ), | 63 | cmbDefaultEmail( 0 ), |
@@ -119,14 +118,14 @@ void ContactEditor::init() { | |||
119 | 118 | ||
120 | QVBoxLayout *vb = new QVBoxLayout( this ); | 119 | QVBoxLayout *vb = new QVBoxLayout( this ); |
121 | 120 | ||
122 | tabMain = new QTabWidget( this ); | 121 | tabMain = new Opie::Ui::OTabWidget( this ); |
123 | vb->addWidget( tabMain ); | 122 | vb->addWidget( tabMain ); |
124 | 123 | ||
125 | QWidget *tabViewport = new QWidget ( tabMain ); | 124 | m_generalWidget = new QWidget ( tabMain ); |
126 | 125 | ||
127 | vb = new QVBoxLayout( tabViewport ); | 126 | vb = new QVBoxLayout( m_generalWidget ); |
128 | 127 | ||
129 | svGeneral = new QScrollView( tabViewport ); | 128 | svGeneral = new QScrollView( m_generalWidget ); |
130 | vb->addWidget( svGeneral, 0, 0 ); | 129 | vb->addWidget( svGeneral, 0, 0 ); |
131 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 130 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
132 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); | 131 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); |
@@ -136,8 +135,7 @@ void ContactEditor::init() { | |||
136 | QWidget *container = new QWidget( svGeneral->viewport() ); | 135 | QWidget *container = new QWidget( svGeneral->viewport() ); |
137 | svGeneral->addChild( container ); | 136 | svGeneral->addChild( container ); |
138 | 137 | ||
139 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 138 | QGridLayout *gl = new QGridLayout( container, 10, 2, 2, 4 ); |
140 | gl->setResizeMode( QLayout::FreeResize ); | ||
141 | 139 | ||
142 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 140 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
143 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); | 141 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); |
@@ -168,7 +166,7 @@ void ContactEditor::init() { | |||
168 | gl->addWidget( txtOrganization, 3, 1 ); | 166 | gl->addWidget( txtOrganization, 3, 1 ); |
169 | 167 | ||
170 | // Chooser 1 | 168 | // Chooser 1 |
171 | cmbChooserField1 = new QComboBox( FALSE, container ); | 169 | cmbChooserField1 = new QComboBox( false, container ); |
172 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); | 170 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); |
173 | cmbChooserField1->setMaximumWidth( 90 ); | 171 | cmbChooserField1->setMaximumWidth( 90 ); |
174 | gl->addWidget( cmbChooserField1, 4, 0 ); | 172 | gl->addWidget( cmbChooserField1, 4, 0 ); |
@@ -181,7 +179,7 @@ void ContactEditor::init() { | |||
181 | m_widgetStack1 -> raiseWidget( TextField ); | 179 | m_widgetStack1 -> raiseWidget( TextField ); |
182 | 180 | ||
183 | // Chooser 2 | 181 | // Chooser 2 |
184 | cmbChooserField2 = new QComboBox( FALSE, container ); | 182 | cmbChooserField2 = new QComboBox( false, container ); |
185 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); | 183 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); |
186 | cmbChooserField2->setMaximumWidth( 90 ); | 184 | cmbChooserField2->setMaximumWidth( 90 ); |
187 | gl->addWidget( cmbChooserField2, 5, 0 ); | 185 | gl->addWidget( cmbChooserField2, 5, 0 ); |
@@ -194,7 +192,7 @@ void ContactEditor::init() { | |||
194 | m_widgetStack2 -> raiseWidget( TextField ); | 192 | m_widgetStack2 -> raiseWidget( TextField ); |
195 | 193 | ||
196 | // Chooser 3 | 194 | // Chooser 3 |
197 | cmbChooserField3 = new QComboBox( FALSE, container ); | 195 | cmbChooserField3 = new QComboBox( false, container ); |
198 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); | 196 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); |
199 | cmbChooserField3->setMaximumWidth( 90 ); | 197 | cmbChooserField3->setMaximumWidth( 90 ); |
200 | gl->addWidget( cmbChooserField3, 6, 0 ); | 198 | gl->addWidget( cmbChooserField3, 6, 0 ); |
@@ -209,7 +207,7 @@ void ContactEditor::init() { | |||
209 | l = new QLabel( tr( "File As" ), container ); | 207 | l = new QLabel( tr( "File As" ), container ); |
210 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); | 208 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); |
211 | gl->addWidget( l, 7, 0 ); | 209 | gl->addWidget( l, 7, 0 ); |
212 | cmbFileAs = new QComboBox( TRUE, container ); | 210 | cmbFileAs = new QComboBox( true, container ); |
213 | gl->addWidget( cmbFileAs, 7, 1 ); | 211 | gl->addWidget( cmbFileAs, 7, 1 ); |
214 | 212 | ||
215 | labCat = new QLabel( tr( "Category" ), container ); | 213 | labCat = new QLabel( tr( "Category" ), container ); |
@@ -219,12 +217,12 @@ void ContactEditor::init() { | |||
219 | labCat->show(); | 217 | labCat->show(); |
220 | cmbCat->show(); | 218 | cmbCat->show(); |
221 | 219 | ||
222 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 220 | btnNote = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Notes..." ), container ); |
223 | gl->addWidget( btnNote, 9, 1 ); | 221 | gl->addWidget( btnNote, 9, 1 ); |
224 | 222 | ||
225 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 223 | tabMain->addTab( m_generalWidget, "addressbook/AddressBookSmall", tr( "General" ) ); |
226 | 224 | ||
227 | tabViewport = new QWidget ( tabMain ); | 225 | QWidget *tabViewport = new QWidget ( tabMain ); |
228 | 226 | ||
229 | vb = new QVBoxLayout( tabViewport ); | 227 | vb = new QVBoxLayout( tabViewport ); |
230 | 228 | ||
@@ -238,7 +236,7 @@ void ContactEditor::init() { | |||
238 | 236 | ||
239 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 237 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
240 | 238 | ||
241 | cmbAddress = new QComboBox( FALSE, container ); | 239 | cmbAddress = new QComboBox( false, container ); |
242 | cmbAddress->insertItem( tr( "Business" ) ); | 240 | cmbAddress->insertItem( tr( "Business" ) ); |
243 | cmbAddress->insertItem( tr( "Home" ) ); | 241 | cmbAddress->insertItem( tr( "Home" ) ); |
244 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 242 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
@@ -265,7 +263,7 @@ void ContactEditor::init() { | |||
265 | 263 | ||
266 | l = new QLabel( tr( "Country" ), container ); | 264 | l = new QLabel( tr( "Country" ), container ); |
267 | gl->addWidget( l, 5, 0 ); | 265 | gl->addWidget( l, 5, 0 ); |
268 | cmbCountry = new QComboBox( TRUE, container ); | 266 | cmbCountry = new QComboBox( true, container ); |
269 | cmbCountry->insertItem( "" ); | 267 | cmbCountry->insertItem( "" ); |
270 | cmbCountry->insertItem( tr ( "United States" ) ); | 268 | cmbCountry->insertItem( tr ( "United States" ) ); |
271 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 269 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
@@ -485,7 +483,7 @@ void ContactEditor::init() { | |||
485 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 483 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
486 | 484 | ||
487 | // Chooser 4 | 485 | // Chooser 4 |
488 | cmbChooserField4 = new QComboBox( FALSE, container ); | 486 | cmbChooserField4 = new QComboBox( false, container ); |
489 | cmbChooserField4->setMaximumWidth( 90 ); | 487 | cmbChooserField4->setMaximumWidth( 90 ); |
490 | gl->addWidget( cmbChooserField4, 6, 0 ); | 488 | gl->addWidget( cmbChooserField4, 6, 0 ); |
491 | // Textfield for chooser 2 | 489 | // Textfield for chooser 2 |
@@ -501,7 +499,7 @@ void ContactEditor::init() { | |||
501 | QSizePolicy::MinimumExpanding ); | 499 | QSizePolicy::MinimumExpanding ); |
502 | gl->addItem( space, 7, 0 ); | 500 | gl->addItem( space, 7, 0 ); |
503 | 501 | ||
504 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 502 | tabMain->addTab( tabViewport, "home", tr( "Address" ) ); |
505 | 503 | ||
506 | tabViewport = new QWidget ( tabMain ); | 504 | tabViewport = new QWidget ( tabMain ); |
507 | 505 | ||
@@ -525,7 +523,7 @@ void ContactEditor::init() { | |||
525 | gl->addWidget( l, counter, 0 ); | 523 | gl->addWidget( l, counter, 0 ); |
526 | 524 | ||
527 | QPopupMenu* m1 = new QPopupMenu( container ); | 525 | QPopupMenu* m1 = new QPopupMenu( container ); |
528 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 526 | birthdayPicker = new DateBookMonth( m1, 0, true ); |
529 | m1->insertItem( birthdayPicker ); | 527 | m1->insertItem( birthdayPicker ); |
530 | 528 | ||
531 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 529 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
@@ -550,7 +548,7 @@ void ContactEditor::init() { | |||
550 | gl->addWidget( l, counter, 0 ); | 548 | gl->addWidget( l, counter, 0 ); |
551 | 549 | ||
552 | m1 = new QPopupMenu( container ); | 550 | m1 = new QPopupMenu( container ); |
553 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 551 | anniversaryPicker = new DateBookMonth( m1, 0, true ); |
554 | m1->insertItem( anniversaryPicker ); | 552 | m1->insertItem( anniversaryPicker ); |
555 | 553 | ||
556 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 554 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
@@ -599,16 +597,16 @@ void ContactEditor::init() { | |||
599 | //loadFields(); | 597 | //loadFields(); |
600 | 598 | ||
601 | 599 | ||
602 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 600 | tabMain->addTab( tabViewport, "UtilsIcon", tr( "Details" ) ); |
603 | 601 | ||
604 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 602 | dlgNote = new QDialog( this, "Note Dialog", true ); |
605 | dlgNote->setCaption( tr("Enter Note") ); | 603 | dlgNote->setCaption( tr("Enter Note") ); |
606 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 604 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
607 | txtNote = new QMultiLineEdit( dlgNote ); | 605 | txtNote = new QMultiLineEdit( dlgNote ); |
608 | vbNote->addWidget( txtNote ); | 606 | vbNote->addWidget( txtNote ); |
609 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 607 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
610 | 608 | ||
611 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 609 | dlgName = new QDialog( this, "Name Dialog", true ); |
612 | dlgName->setCaption( tr("Edit Name") ); | 610 | dlgName->setCaption( tr("Edit Name") ); |
613 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 611 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
614 | 612 | ||
@@ -1093,7 +1091,7 @@ void ContactEditor::slotName() { | |||
1093 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1091 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1094 | 1092 | ||
1095 | if ( QPEApplication::execDialog( dlgName ) ) { | 1093 | if ( QPEApplication::execDialog( dlgName ) ) { |
1096 | if ( txtLastName->text().contains( ' ', TRUE ) ) | 1094 | if ( txtLastName->text().contains( ' ', true ) ) |
1097 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); | 1095 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); |
1098 | else | 1096 | else |
1099 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); | 1097 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); |
@@ -1138,7 +1136,7 @@ QString ContactEditor::parseName( const QString fullName, int type ) { | |||
1138 | 1136 | ||
1139 | odebug << "Fullname: " << simplifiedName << oendl; | 1137 | odebug << "Fullname: " << simplifiedName << oendl; |
1140 | 1138 | ||
1141 | commapos = simplifiedName.find( ',', 0, TRUE); | 1139 | commapos = simplifiedName.find( ',', 0, true); |
1142 | if ( commapos >= 0 ) { | 1140 | if ( commapos >= 0 ) { |
1143 | odebug << " Commapos: " << commapos << oendl; | 1141 | odebug << " Commapos: " << commapos << oendl; |
1144 | 1142 | ||
@@ -1262,7 +1260,7 @@ void ContactEditor::setEntry( const Opie::OPimContact &entry ) { | |||
1262 | 1260 | ||
1263 | // Cleanup and activate the general Page .. | 1261 | // Cleanup and activate the general Page .. |
1264 | cleanupFields(); | 1262 | cleanupFields(); |
1265 | tabMain->setCurrentPage( 0 ); | 1263 | tabMain->setCurrentTab( m_generalWidget ); |
1266 | 1264 | ||
1267 | ent = entry; | 1265 | ent = entry; |
1268 | 1266 | ||
@@ -1283,7 +1281,7 @@ void ContactEditor::setEntry( const Opie::OPimContact &entry ) { | |||
1283 | 1281 | ||
1284 | if ( !ent.isEmpty() ){ | 1282 | if ( !ent.isEmpty() ){ |
1285 | // Lastnames with multiple words need to be protected by a comma ! | 1283 | // Lastnames with multiple words need to be protected by a comma ! |
1286 | if ( ent.lastName().contains( ' ', TRUE ) ) | 1284 | if ( ent.lastName().contains( ' ', true ) ) |
1287 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | 1285 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); |
1288 | else | 1286 | else |
1289 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | 1287 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); |
@@ -1687,8 +1685,8 @@ static inline bool containsAlphaNum( const QString &str ) | |||
1687 | count = str.length(); | 1685 | count = str.length(); |
1688 | for ( i = 0; i < count; i++ ) | 1686 | for ( i = 0; i < count; i++ ) |
1689 | if ( !str[i].isSpace() ) | 1687 | if ( !str[i].isSpace() ) |
1690 | return TRUE; | 1688 | return true; |
1691 | return FALSE; | 1689 | return false; |
1692 | } | 1690 | } |
1693 | 1691 | ||
1694 | static inline bool constainsWhiteSpace( const QString &str ) | 1692 | static inline bool constainsWhiteSpace( const QString &str ) |
@@ -1697,8 +1695,8 @@ static inline bool constainsWhiteSpace( const QString &str ) | |||
1697 | count = str.length(); | 1695 | count = str.length(); |
1698 | for (i = 0; i < count; i++ ) | 1696 | for (i = 0; i < count; i++ ) |
1699 | if ( str[i].isSpace() ) | 1697 | if ( str[i].isSpace() ) |
1700 | return TRUE; | 1698 | return true; |
1701 | return FALSE; | 1699 | return false; |
1702 | } | 1700 | } |
1703 | 1701 | ||
1704 | void ContactEditor::setPersonalView( bool personal ) | 1702 | void ContactEditor::setPersonalView( bool personal ) |