summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp32
-rw-r--r--kaddressbook/addresseeeditorwidget.h2
2 files changed, 28 insertions, 6 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index 29abd6f..310d628 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -167,63 +167,67 @@ void AddresseeEditorWidget::setupTab1()
// Person icon
/* LR
label = new QLabel( tab1 );
//US ambiguous call. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
layout->addMultiCellWidget( label, 0, 1, 0, 0 );
*/
// First name
button = new QPushButton( i18n( "Name..." ), tab1 );
//US QToolTip::add( button, i18n( "Edit the contact's name" ) );
mNameEdit = new KLineEdit( tab1, "mNameEdit" );
connect( mNameEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( nameTextChanged( const QString& ) ) );
connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) );
mNameLabel = new KSqueezedTextLabel( tab1 );
mNameLabel->hide();
layout->addWidget( button, 0, 0 );
layout->addWidget( mNameEdit, 0, 1 );
layout->addWidget( mNameLabel, 0, 1 );
- label = new QLabel( i18n( "Role:" ), tab1 );
+ button = new QPushButton( i18n( "Role:" ), tab1 );
+ connect( button, SIGNAL( clicked() ), SLOT( setRole2FN() ) );
+ //label = new QLabel( i18n( "Role:" ), tab1 );
mRoleEdit = new KLineEdit( tab1 );
connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
- label->setBuddy( mRoleEdit );
- layout->addWidget( label, 1, 0 );
+ //label->setBuddy( mRoleEdit );
+ layout->addWidget( button, 1, 0 );
layout->addWidget( mRoleEdit, 1, 1 );
// Organization
- label = new QLabel( i18n( "Organization:" ), tab1 );
+ button = new QPushButton( i18n( "Organization:" ), tab1 );
+ connect( button, SIGNAL( clicked() ), SLOT( setCompany2FN() ) );
+ //label = new QLabel( i18n( "Organization:" ), tab1 );
mOrgEdit = new KLineEdit( tab1 );
- label->setBuddy( mOrgEdit );
+ //label->setBuddy( mOrgEdit );
connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
- layout->addWidget( label, 2, 0 );
+ layout->addWidget( button, 2, 0 );
layout->addWidget( mOrgEdit, 2, 1 );
// File as (formatted name)
label = new QLabel( i18n( "Formatted name:" ), tab1 );
mFormattedNameLabel = new KSqueezedTextLabel( tab1 );
layout->addWidget( label, 3, 0 );
layout->addWidget( mFormattedNameLabel, 3, 1 );
/* LR
// Left hand separator. This separator doesn't go all the way
// across so the dialog still flows from top to bottom
bar = new KSeparator( KSeparator::HLine, tab1 );
layout->addMultiCellWidget( bar, 4, 4, 0, 2 );
*/
//////////////////////////////////////
/* LR
// Phone numbers (upper right)
label = new QLabel( tab1 );
//US loadIcon call is ambiguous. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, 0 ) );
//US layout->addMultiCellWidget( label, 0, 1, 3, 3 );
layout->addMultiCellWidget( label, 5, 6, 0, 0 );
*/
@@ -304,48 +308,64 @@ void AddresseeEditorWidget::setupTab1()
categoryBox->setSpacing( KDialogBase::spacingHint() );
categoryBox->setMargin( KDialogBase::marginHintSmall() );
// Categories
button = new QPushButton( i18n( "Categories" ), categoryBox );
connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
mCategoryEdit = new KLineEdit( categoryBox );
mCategoryEdit->setReadOnly( true );
connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
SLOT( textChanged( const QString& ) ) );
mSecrecyWidget = new SecrecyWidget( categoryBox );
connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
layout->addMultiCellWidget( categoryBox, iii, iii, 0, 1 );
// Build the layout and add to the tab widget
layout->activate(); // required
mTabWidget->addTab( tab1, i18n( "&General" ) );
}
+void AddresseeEditorWidget::setRole2FN()
+{
+ if ( mRoleEdit->text().isEmpty() ) return;
+ mFormattedNameType = NameEditDialog::CustomName;
+ mAddressee.setFormattedName( mRoleEdit->text() );
+ mFormattedNameLabel->setText( mRoleEdit->text() );
+ mDirty = true;
+}
+void AddresseeEditorWidget::setCompany2FN()
+{
+ if ( mOrgEdit->text().isEmpty() ) return;
+ mFormattedNameType = NameEditDialog::CustomName;
+ mAddressee.setFormattedName( mOrgEdit->text() );
+ mFormattedNameLabel->setText( mOrgEdit->text() );
+ mDirty = true;
+}
void AddresseeEditorWidget::setupTab1_1()
{
// This is the Address tab
QWidget *tab1_1 = new QWidget( mTabWidget );
//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 );
QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 );
layout->setMargin( KDialogBase::marginHintSmall() );
layout->setSpacing( KDialogBase::spacingHintSmall() );
QLabel *label;
KSeparator* bar;
QPushButton *button;
/*US
//////////////////////////////////
// Upper left group (person info)
// Person icon
label = new QLabel( tab1 );
//US ambiguous call. Add one more parameter
//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, 0 ) );
diff --git a/kaddressbook/addresseeeditorwidget.h b/kaddressbook/addresseeeditorwidget.h
index 995f30e..eaf5b16 100644
--- a/kaddressbook/addresseeeditorwidget.h
+++ b/kaddressbook/addresseeeditorwidget.h
@@ -68,48 +68,50 @@ namespace KABC { class AddressBook; }
class AddresseeEditorWidget : public ExtensionWidget
{
Q_OBJECT
public:
AddresseeEditorWidget( KABCore *core, bool isExtension,
QWidget *parent, const char *name = 0 );
~AddresseeEditorWidget();
void setAddressee( const KABC::Addressee& );
const KABC::Addressee &addressee();
void contactsSelectionChanged();
void load();
void save();
bool dirty();
QString title() const;
QString identifier() const;
protected slots:
+ void setRole2FN();
+ void setCompany2FN();
void textChanged( const QString& );
void pageChanged( QWidget *wdg );
/**
Emits the modified signal and sets the dirty flag. Any slot
that modifies data should use this method instead of calling emit
modified() directly.
*/
void emitModified();
void dateChanged( QDate );
void invalidDate();
void nameTextChanged( const QString& );
void nameBoxChanged();
void nameButtonClicked();
void categoryButtonClicked();
/**
Called whenever the categories change in the categories dialog.
*/
void categoriesSelected( const QStringList& );
/**
Edits which categories are available in the CategorySelectDialog.