summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeeditorwidget.cpp50
-rw-r--r--kaddressbook/addresseeeditorwidget.h5
2 files changed, 47 insertions, 8 deletions
diff --git a/kaddressbook/addresseeeditorwidget.cpp b/kaddressbook/addresseeeditorwidget.cpp
index c4083a9..4313998 100644
--- a/kaddressbook/addresseeeditorwidget.cpp
+++ b/kaddressbook/addresseeeditorwidget.cpp
@@ -311,83 +311,119 @@ void AddresseeEditorWidget::setupTab1()
311 SLOT( textChanged( const QString& ) ) ); 311 SLOT( textChanged( const QString& ) ) );
312 label->setBuddy( mURLEdit ); 312 label->setBuddy( mURLEdit );
313 layout->addWidget( label, 8, 4 ); 313 layout->addWidget( label, 8, 4 );
314 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 ); 314 layout->addMultiCellWidget( mURLEdit, 8, 8, 5, 6 );
315 315
316 label = new QLabel( i18n( "&IM address:" ), tab1 ); 316 label = new QLabel( i18n( "&IM address:" ), tab1 );
317 mIMAddressEdit = new KLineEdit( tab1 ); 317 mIMAddressEdit = new KLineEdit( tab1 );
318 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ), 318 connect( mIMAddressEdit, SIGNAL( textChanged( const QString& ) ),
319 SLOT( textChanged( const QString& ) ) ); 319 SLOT( textChanged( const QString& ) ) );
320 label->setBuddy( mIMAddressEdit ); 320 label->setBuddy( mIMAddressEdit );
321 layout->addWidget( label, 9, 4 ); 321 layout->addWidget( label, 9, 4 );
322 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 ); 322 layout->addMultiCellWidget( mIMAddressEdit, 9, 9, 5, 6 );
323 323
324 layout->addColSpacing( 6, 50 ); 324 layout->addColSpacing( 6, 50 );
325 325
326 bar = new KSeparator( KSeparator::HLine, tab1 ); 326 bar = new KSeparator( KSeparator::HLine, tab1 );
327 layout->addMultiCellWidget( bar, 10, 10, 0, 6 ); 327 layout->addMultiCellWidget( bar, 10, 10, 0, 6 );
328*/ 328*/
329 /////////////////////////////////////// 329 ///////////////////////////////////////
330 QHBox *categoryBox = new QHBox( tab1 ,"cato"); 330 QHBox *categoryBox = new QHBox( tab1 ,"cato");
331 categoryBox->setSpacing( KDialogBase::spacingHint() ); 331 categoryBox->setSpacing( KDialogBase::spacingHint() );
332 categoryBox->setMargin( KDialogBase::marginHintSmall() ); 332 categoryBox->setMargin( KDialogBase::marginHintSmall() );
333 333
334 // Categories 334 // Categories
335 button = new QPushButton( i18n( "Categories" ), categoryBox ); 335 button = new QPushButton( i18n( "Categories" )+":", categoryBox );
336 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) ); 336 connect( button, SIGNAL( clicked() ), SLOT( categoryButtonClicked() ) );
337 337
338 mCategoryEdit = new KLineEdit( categoryBox ); 338 mCategoryEdit = new QPushButton ( categoryBox );
339 mCategoryEdit->setReadOnly( true ); 339 mCategoryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
340 connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), 340 mCatPopup = new QPopupMenu ( categoryBox );
341 SLOT( textChanged( const QString& ) ) ); 341 mCategoryEdit->setPopup( mCatPopup );
342 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup()));
343 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int )));
344 //connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
345 // SLOT( textChanged( const QString& ) ) );
342 346
343 mSecrecyWidget = new SecrecyWidget( categoryBox ); 347 mSecrecyWidget = new SecrecyWidget( categoryBox );
344 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); 348 connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) );
345 349
346//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 ); 350//US layout->addMultiCellWidget( categoryBox, 11, 11, 0, 6 );
347 layout->addMultiCellWidget( categoryBox, iii, iii, 0, maxCol ); 351 layout->addMultiCellWidget( categoryBox, iii, iii, 0, maxCol );
348 352
349 // Build the layout and add to the tab widget 353 // Build the layout and add to the tab widget
350 layout->activate(); // required 354 layout->activate(); // required
351 355
352 mTabWidget->addTab( tab1, i18n( "&General" ) ); 356 mTabWidget->addTab( tab1, i18n( "&General" ) );
353} 357}
354 358
359void AddresseeEditorWidget::showCatPopup()
360{
361 mCatPopup->clear();
362 QStringList checkedCategories = QStringList::split (",", mCategoryEdit->text());
363 int index = 0;
364 for (QStringList::Iterator it = KABPrefs::instance()->mCustomCategories.begin ();
365 it != KABPrefs::instance()->mCustomCategories.end ();
366 ++it) {
367 mCatPopup->insertItem (*it, index );
368 //mCategory[index] = *it;
369 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
370 ++index;
371 }
372}
373void AddresseeEditorWidget::selectedCatPopup( int index )
374{
375 QStringList categories = QStringList::split (",", mCategoryEdit->text());
376 QString colcat = categories.first();
377 if (categories.find ( KABPrefs::instance()->mCustomCategories[index]) != categories.end ())
378 categories.remove (KABPrefs::instance()->mCustomCategories[index]);
379 else
380 categories.insert (categories.end(), KABPrefs::instance()->mCustomCategories[index]);
381 categories.sort ();
382 if ( !colcat.isEmpty() ) {
383 if ( categories.find ( colcat ) != categories.end () ) {
384 categories.remove( colcat );
385 categories.prepend( colcat );
386 }
387 }
388 mCategoryEdit->setText( categories.join(",") );
389 emitModified();
390}
355void AddresseeEditorWidget::setRole2FN() 391void AddresseeEditorWidget::setRole2FN()
356{ 392{
357 if ( mRoleEdit->text().isEmpty() ) return; 393 if ( mRoleEdit->text().isEmpty() ) return;
358 mFormattedNameType = NameEditDialog::CustomName; 394 mFormattedNameType = NameEditDialog::CustomName;
359 mAddressee.setFormattedName( mRoleEdit->text() ); 395 mAddressee.setFormattedName( mRoleEdit->text() );
360 mFormattedNameLabel->setText( mRoleEdit->text() ); 396 mFormattedNameLabel->setText( mRoleEdit->text() );
361 mDirty = true; 397 emitModified();
362} 398}
363void AddresseeEditorWidget::setCompany2FN() 399void AddresseeEditorWidget::setCompany2FN()
364{ 400{
365 if ( mOrgEdit->text().isEmpty() ) return; 401 if ( mOrgEdit->text().isEmpty() ) return;
366 mFormattedNameType = NameEditDialog::CustomName; 402 mFormattedNameType = NameEditDialog::CustomName;
367 mAddressee.setFormattedName( mOrgEdit->text() ); 403 mAddressee.setFormattedName( mOrgEdit->text() );
368 mFormattedNameLabel->setText( mOrgEdit->text() ); 404 mFormattedNameLabel->setText( mOrgEdit->text() );
369 mDirty = true; 405 emitModified();
370} 406}
371 407
372void AddresseeEditorWidget::setupTab1_1() 408void AddresseeEditorWidget::setupTab1_1()
373{ 409{
374 // This is the Address tab 410 // This is the Address tab
375 QWidget *tab1_1 = new QWidget( mTabWidget ); 411 QWidget *tab1_1 = new QWidget( mTabWidget );
376 412
377//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 ); 413//US QGridLayout *layout = new QGridLayout( tab1_1, 11, 7 );
378 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 ); 414 QGridLayout *layout = new QGridLayout( tab1_1, 7, 2 );
379 layout->setMargin( KDialogBase::marginHintSmall() ); 415 layout->setMargin( KDialogBase::marginHintSmall() );
380 layout->setSpacing( KDialogBase::spacingHintSmall() ); 416 layout->setSpacing( KDialogBase::spacingHintSmall() );
381 417
382 QLabel *label; 418 QLabel *label;
383 KSeparator* bar; 419 KSeparator* bar;
384 QPushButton *button; 420 QPushButton *button;
385 421
386/*US 422/*US
387 ////////////////////////////////// 423 //////////////////////////////////
388 // Upper left group (person info) 424 // Upper left group (person info)
389 425
390 // Person icon 426 // Person icon
391 label = new QLabel( tab1 ); 427 label = new QLabel( tab1 );
392//US ambiguous call. Add one more parameter 428//US ambiguous call. Add one more parameter
393//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) ); 429//US label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop ) );
diff --git a/kaddressbook/addresseeeditorwidget.h b/kaddressbook/addresseeeditorwidget.h
index eaf5b16..1703e2f 100644
--- a/kaddressbook/addresseeeditorwidget.h
+++ b/kaddressbook/addresseeeditorwidget.h
@@ -68,48 +68,50 @@ namespace KABC { class AddressBook; }
68 68
69class AddresseeEditorWidget : public ExtensionWidget 69class AddresseeEditorWidget : public ExtensionWidget
70{ 70{
71 Q_OBJECT 71 Q_OBJECT
72 72
73 public: 73 public:
74 AddresseeEditorWidget( KABCore *core, bool isExtension, 74 AddresseeEditorWidget( KABCore *core, bool isExtension,
75 QWidget *parent, const char *name = 0 ); 75 QWidget *parent, const char *name = 0 );
76 ~AddresseeEditorWidget(); 76 ~AddresseeEditorWidget();
77 77
78 void setAddressee( const KABC::Addressee& ); 78 void setAddressee( const KABC::Addressee& );
79 const KABC::Addressee &addressee(); 79 const KABC::Addressee &addressee();
80 80
81 void contactsSelectionChanged(); 81 void contactsSelectionChanged();
82 82
83 void load(); 83 void load();
84 void save(); 84 void save();
85 85
86 bool dirty(); 86 bool dirty();
87 87
88 QString title() const; 88 QString title() const;
89 QString identifier() const; 89 QString identifier() const;
90 90
91 protected slots: 91 protected slots:
92 void showCatPopup();
93 void selectedCatPopup( int );
92 void setRole2FN(); 94 void setRole2FN();
93 void setCompany2FN(); 95 void setCompany2FN();
94 void textChanged( const QString& ); 96 void textChanged( const QString& );
95 void pageChanged( QWidget *wdg ); 97 void pageChanged( QWidget *wdg );
96 98
97 /** 99 /**
98 Emits the modified signal and sets the dirty flag. Any slot 100 Emits the modified signal and sets the dirty flag. Any slot
99 that modifies data should use this method instead of calling emit 101 that modifies data should use this method instead of calling emit
100 modified() directly. 102 modified() directly.
101 */ 103 */
102 void emitModified(); 104 void emitModified();
103 105
104 void dateChanged( QDate ); 106 void dateChanged( QDate );
105 void invalidDate(); 107 void invalidDate();
106 void nameTextChanged( const QString& ); 108 void nameTextChanged( const QString& );
107 void nameBoxChanged(); 109 void nameBoxChanged();
108 void nameButtonClicked(); 110 void nameButtonClicked();
109 void categoryButtonClicked(); 111 void categoryButtonClicked();
110 112
111 /** 113 /**
112 Called whenever the categories change in the categories dialog. 114 Called whenever the categories change in the categories dialog.
113 */ 115 */
114 void categoriesSelected( const QStringList& ); 116 void categoriesSelected( const QStringList& );
115 117
@@ -129,49 +131,50 @@ class AddresseeEditorWidget : public ExtensionWidget
129 void setupTab3_1(); 131 void setupTab3_1();
130 132
131 KABC::Addressee mAddressee; 133 KABC::Addressee mAddressee;
132 int mFormattedNameType; 134 int mFormattedNameType;
133 bool mDirty; 135 bool mDirty;
134 bool mIsExtension; 136 bool mIsExtension;
135 bool mBlockSignals; 137 bool mBlockSignals;
136 138
137 // GUI 139 // GUI
138 KPIM::CategorySelectDialog *mCategoryDialog; 140 KPIM::CategorySelectDialog *mCategoryDialog;
139 KPIM::CategoryEditDialog *mCategoryEditDialog; 141 KPIM::CategoryEditDialog *mCategoryEditDialog;
140 QTabWidget *mTabWidget; 142 QTabWidget *mTabWidget;
141 143
142 // Tab1 and Tab1_1 144 // Tab1 and Tab1_1
143 KLineEdit *mNameEdit; 145 KLineEdit *mNameEdit;
144 KLineEdit *mRoleEdit; 146 KLineEdit *mRoleEdit;
145 KLineEdit *mOrgEdit; 147 KLineEdit *mOrgEdit;
146 148
147 KSqueezedTextLabel *mFormattedNameLabel; 149 KSqueezedTextLabel *mFormattedNameLabel;
148 AddressEditWidget *mAddressEditWidget; 150 AddressEditWidget *mAddressEditWidget;
149 EmailEditWidget *mEmailWidget; 151 EmailEditWidget *mEmailWidget;
150 PhoneEditWidget *mPhoneEditWidget; 152 PhoneEditWidget *mPhoneEditWidget;
151 KLineEdit *mURLEdit; 153 KLineEdit *mURLEdit;
152 KLineEdit *mIMAddressEdit; 154 KLineEdit *mIMAddressEdit;
153 KLineEdit *mCategoryEdit; 155 QPushButton *mCategoryEdit;
156 QPopupMenu *mCatPopup;
154 SecrecyWidget *mSecrecyWidget; 157 SecrecyWidget *mSecrecyWidget;
155 KSqueezedTextLabel *mNameLabel; 158 KSqueezedTextLabel *mNameLabel;
156 159
157 // Tab2 and Tab2_2 160 // Tab2 and Tab2_2
158 KLineEdit *mDepartmentEdit; 161 KLineEdit *mDepartmentEdit;
159 KLineEdit *mOfficeEdit; 162 KLineEdit *mOfficeEdit;
160 KLineEdit *mProfessionEdit; 163 KLineEdit *mProfessionEdit;
161 KLineEdit *mManagerEdit; 164 KLineEdit *mManagerEdit;
162 KLineEdit *mAssistantEdit; 165 KLineEdit *mAssistantEdit;
163 KLineEdit *mNicknameEdit; 166 KLineEdit *mNicknameEdit;
164 KLineEdit *mSpouseEdit; 167 KLineEdit *mSpouseEdit;
165 KLineEdit *mChildEdit; 168 KLineEdit *mChildEdit;
166 QComboBox *mGenderBox; 169 QComboBox *mGenderBox;
167 KDateEdit *mBirthdayPicker; 170 KDateEdit *mBirthdayPicker;
168 KDateEdit *mAnniversaryPicker; 171 KDateEdit *mAnniversaryPicker;
169#ifndef KAB_EMBEDDED 172#ifndef KAB_EMBEDDED
170 QTextEdit *mNoteEdit; 173 QTextEdit *mNoteEdit;
171#else //KAB_EMBEDDED 174#else //KAB_EMBEDDED
172 QMultiLineEdit *mNoteEdit; 175 QMultiLineEdit *mNoteEdit;
173#endif //KAB_EMBEDDED 176#endif //KAB_EMBEDDED
174 177
175 QSpinBox *mTimeZoneSpin; 178 QSpinBox *mTimeZoneSpin;
176 QSpinBox *mGeoLat; 179 QSpinBox *mGeoLat;
177 QSpinBox *mGeoLon; 180 QSpinBox *mGeoLon;