summaryrefslogtreecommitdiff
Side-by-side diff
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 @@
*
* This file is an add-on for the OPIE Palmtop Environment
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 as published by the Free Software
* Foundation and appearing in the file LICENSE.GPL included in the pacakaging
* of this file.
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*
* This is a rewrite of the abeditor.h file, modified to provide a more
* intuitive interface to TrollTech's original Address Book editor. This
* is made to operate exactly in interface with the exception of name.
*
*/
#include "contacteditor.h"
#include "addresspicker.h"
#include "ocontactfields.h"
#include <qpe/categoryselect.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpedialog.h>
#include <qpe/timeconversion.h>
#include <opie/ocontact.h>
#include <qpe/resource.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qtabwidget.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qmultilineedit.h>
#include <qscrollview.h>
#include <qtoolbutton.h>
#include <qpushbutton.h>
#include <qmainwindow.h>
#include <qvaluelist.h>
#include <qpopupmenu.h>
#include <qlistbox.h>
#include <qhbox.h>
#include <qaction.h>
#include <qiconset.h>
static inline bool containsAlphaNum( const QString &str );
static inline bool constainsWhiteSpace( const QString &str );
// helper functions, convert our comma delimited list to proper
// file format...
void parseEmailFrom( const QString &txt, QString &strDefaultEmail,
QString &strAll );
// helper convert from file format to comma delimited...
//void parseEmailTo( const QString &strDefaultEmail,
// const QString &strOtherEmail, QString &strBack );
ContactEditor::ContactEditor( const OContact &entry,
QWidget *parent,
const char *name,
WFlags fl )
: QDialog( parent, name, TRUE, fl ),
m_personalView ( false )
+
{
init();
setEntry( entry );
+
+ cmbDefaultEmail = 0;
}
ContactEditor::~ContactEditor() {
}
void ContactEditor::init() {
useFullName = true;
uint i = 0;
QStringList trlChooserNames;
for (i = 0; i <= 6; i++) {
slHomeAddress.append( "" );
slBusinessAddress.append( "" );
}
trlChooserNames = OContactFields::trphonefields();
slChooserNames = OContactFields::untrphonefields();
slDynamicEntries = OContactFields::untrdetailsfields();
trlDynamicEntries = OContactFields::trdetailsfields();
for (i = 0; i < slChooserNames.count(); i++)
slChooserValues.append("");
QVBoxLayout *vb = new QVBoxLayout( this );
tabMain = new QTabWidget( this );
vb->addWidget( tabMain );
QWidget *tabViewport = new QWidget ( tabMain );
vb = new QVBoxLayout( tabViewport );
svGeneral = new QScrollView( tabViewport );
vb->addWidget( svGeneral, 0, 0 );
svGeneral->setResizePolicy( QScrollView::AutoOneFit );
svGeneral->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( svGeneral->viewport() );
svGeneral->addChild( container );
QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 );
gl->setResizeMode( QLayout::FreeResize );
btnFullName = new QPushButton( tr( "Full Name..." ), container );
gl->addWidget( btnFullName, 0, 0 );
txtFullName = new QLineEdit( container );
gl->addWidget( txtFullName, 0, 1 );
QLabel *l = new QLabel( tr( "Job Title" ), container );
gl->addWidget( l, 1, 0 );
txtJobTitle = new QLineEdit( container );
gl->addWidget( txtJobTitle, 1, 1 );
l = new QLabel( tr( "Organization" ), container );
gl->addWidget( l, 2, 0 );
txtOrganization = new QLineEdit( container );
gl->addWidget( txtOrganization, 2, 1 );
cmbChooserField1 = new QComboBox( FALSE, container );
cmbChooserField1->setMaximumWidth( 90 );
gl->addWidget( cmbChooserField1, 3, 0 );
@@ -570,129 +573,129 @@ void ContactEditor::init() {
QSizePolicy::MinimumExpanding );
gl->addItem( space, 4, 0 );
cmbChooserField1->insertStringList( trlChooserNames );
cmbChooserField2->insertStringList( trlChooserNames );
cmbChooserField3->insertStringList( trlChooserNames );
cmbChooserField4->insertStringList( trlChooserNames );
cmbChooserField1->setCurrentItem( 0 );
cmbChooserField2->setCurrentItem( 1 );
cmbChooserField3->setCurrentItem( 2 );
connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
this, SLOT(slotChooser1Change(const QString &)) );
connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
this, SLOT(slotChooser2Change(const QString &)) );
connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
this, SLOT(slotChooser3Change(const QString &)) );
connect( txtChooserField4, SIGNAL(textChanged(const QString &)),
this, SLOT(slotChooser4Change(const QString &)) );
connect( txtAddress, SIGNAL(textChanged(const QString &)),
this, SLOT(slotAddressChange(const QString &)) );
//connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) );
//connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) );
connect( txtCity, SIGNAL(textChanged(const QString &)),
this, SLOT(slotCityChange(const QString &)) );
connect( txtState, SIGNAL(textChanged(const QString &)),
this, SLOT(slotStateChange(const QString &)) );
connect( txtZip, SIGNAL(textChanged(const QString &)),
this, SLOT(slotZipChange(const QString &)) );
connect( cmbCountry, SIGNAL(textChanged(const QString &)),
this, SLOT(slotCountryChange(const QString &)) );
connect( cmbCountry, SIGNAL(activated(const QString &)),
this, SLOT(slotCountryChange(const QString &)) );
connect( cmbChooserField1, SIGNAL(activated(int)),
this, SLOT(slotCmbChooser1Change(int)) );
connect( cmbChooserField2, SIGNAL(activated(int)),
this, SLOT(slotCmbChooser2Change(int)) );
connect( cmbChooserField3, SIGNAL(activated(int)),
this, SLOT(slotCmbChooser3Change(int)) );
connect( cmbChooserField4, SIGNAL(activated(int)),
this, SLOT(slotCmbChooser4Change(int)) );
connect( cmbAddress, SIGNAL(activated(int)),
this, SLOT(slotAddressTypeChange(int)) );
new QPEDialogListener(this);
setPersonalView ( m_personalView );
}
void ContactEditor::defaultEmailChanged(int i){
qDebug("defaultEmailChanged");
int index = cmbChooserField1->currentItem();
slChooserValues[index] = cmbDefaultEmail->text(i);
}
void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid ) {
if (slChooserNames[index] == "Default Email"){
- delete cmbDefaultEmail;
+ if (cmbDefaultEmail) delete cmbDefaultEmail;
cmbDefaultEmail = new QComboBox(inputWid->parentWidget());
cmbDefaultEmail->setGeometry(inputWid->frameGeometry());
cmbDefaultEmail->insertStringList(ent.emailList());
connect(cmbDefaultEmail,SIGNAL(activated(int)),
SLOT(defaultEmailChanged(int)));
QString demail = ent.defaultEmail();
for ( int i = 0; i < cmbDefaultEmail->count(); i++)
if ( cmbDefaultEmail->text( i ) == demail )
cmbDefaultEmail->setCurrentItem( i );
cmbDefaultEmail->show();
}
slChooserValues[index] = textChanged;
}
void ContactEditor::slotChooser1Change( const QString &textChanged ) {
chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1);
}
void ContactEditor::slotChooser2Change( const QString &textChanged ) {
chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2);
}
void ContactEditor::slotChooser3Change( const QString &textChanged ) {
chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3);
}
void ContactEditor::slotChooser4Change( const QString &textChanged ) {
chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4);
}
void ContactEditor::slotAddressChange( const QString &textChanged ) {
if ( cmbAddress->currentItem() == 0 ) {
slBusinessAddress[0] = textChanged;
} else {
slHomeAddress[0] = textChanged;
}
}
void ContactEditor::slotAddress2Change( const QString &textChanged ) {
if ( cmbAddress->currentItem() == 0 ) {
slBusinessAddress[1] = textChanged;
} else {
slHomeAddress[1] = textChanged;
}
}
void ContactEditor::slotPOBoxChange( const QString &textChanged ) {
if ( cmbAddress->currentItem() == 0 ) {
slBusinessAddress[2] = textChanged;
} else {
slHomeAddress[2] = textChanged;
}
}
void ContactEditor::slotCityChange( const QString &textChanged ) {