author | zautrix <zautrix> | 2005-11-13 12:51:35 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-13 12:51:35 (UTC) |
commit | 59a3afa458bfb17314017d39c44b102bebb82fa7 (patch) (unidiff) | |
tree | 689b1ef7a32d526067c7dddf4a59d19872129b68 | |
parent | 4145dc4a513d5899d8a2b9e4573d8140d871b386 (diff) | |
download | kdepimpi-59a3afa458bfb17314017d39c44b102bebb82fa7.zip kdepimpi-59a3afa458bfb17314017d39c44b102bebb82fa7.tar.gz kdepimpi-59a3afa458bfb17314017d39c44b102bebb82fa7.tar.bz2 |
fix
-rw-r--r-- | kaddressbook/addresseeeditorwidget.cpp | 50 | ||||
-rw-r--r-- | kaddressbook/addresseeeditorwidget.h | 5 |
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 | |||
@@ -334,9 +334,13 @@ void AddresseeEditorWidget::setupTab1() | |||
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 | ||
@@ -354,2 +358,34 @@ void AddresseeEditorWidget::setupTab1() | |||
354 | 358 | ||
359 | void 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 | } | ||
373 | void 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 | } | ||
355 | void AddresseeEditorWidget::setRole2FN() | 391 | void AddresseeEditorWidget::setRole2FN() |
@@ -360,3 +396,3 @@ void AddresseeEditorWidget::setRole2FN() | |||
360 | mFormattedNameLabel->setText( mRoleEdit->text() ); | 396 | mFormattedNameLabel->setText( mRoleEdit->text() ); |
361 | mDirty = true; | 397 | emitModified(); |
362 | } | 398 | } |
@@ -368,3 +404,3 @@ void AddresseeEditorWidget::setCompany2FN() | |||
368 | mFormattedNameLabel->setText( mOrgEdit->text() ); | 404 | mFormattedNameLabel->setText( mOrgEdit->text() ); |
369 | mDirty = true; | 405 | emitModified(); |
370 | } | 406 | } |
diff --git a/kaddressbook/addresseeeditorwidget.h b/kaddressbook/addresseeeditorwidget.h index eaf5b16..1703e2f 100644 --- a/kaddressbook/addresseeeditorwidget.h +++ b/kaddressbook/addresseeeditorwidget.h | |||
@@ -91,2 +91,4 @@ class AddresseeEditorWidget : public ExtensionWidget | |||
91 | protected slots: | 91 | protected slots: |
92 | void showCatPopup(); | ||
93 | void selectedCatPopup( int ); | ||
92 | void setRole2FN(); | 94 | void setRole2FN(); |
@@ -152,3 +154,4 @@ class AddresseeEditorWidget : public ExtensionWidget | |||
152 | KLineEdit *mIMAddressEdit; | 154 | KLineEdit *mIMAddressEdit; |
153 | KLineEdit *mCategoryEdit; | 155 | QPushButton *mCategoryEdit; |
156 | QPopupMenu *mCatPopup; | ||
154 | SecrecyWidget *mSecrecyWidget; | 157 | SecrecyWidget *mSecrecyWidget; |