summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-11-13 12:51:35 (UTC)
committer zautrix <zautrix>2005-11-13 12:51:35 (UTC)
commit59a3afa458bfb17314017d39c44b102bebb82fa7 (patch) (side-by-side diff)
tree689b1ef7a32d526067c7dddf4a59d19872129b68
parent4145dc4a513d5899d8a2b9e4573d8140d871b386 (diff)
downloadkdepimpi-59a3afa458bfb17314017d39c44b102bebb82fa7.zip
kdepimpi-59a3afa458bfb17314017d39c44b102bebb82fa7.tar.gz
kdepimpi-59a3afa458bfb17314017d39c44b102bebb82fa7.tar.bz2
fix
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
@@ -334,9 +334,13 @@ void AddresseeEditorWidget::setupTab1()
// Categories
- button = new QPushButton( i18n( "Categories" ), categoryBox );
+ 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& ) ) );
+ mCategoryEdit = new QPushButton ( categoryBox );
+ mCategoryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
+ mCatPopup = new QPopupMenu ( categoryBox );
+ mCategoryEdit->setPopup( mCatPopup );
+ connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup()));
+ connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int )));
+ //connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ),
+ // SLOT( textChanged( const QString& ) ) );
@@ -354,2 +358,34 @@ void AddresseeEditorWidget::setupTab1()
+void AddresseeEditorWidget::showCatPopup()
+{
+ mCatPopup->clear();
+ QStringList checkedCategories = QStringList::split (",", mCategoryEdit->text());
+ int index = 0;
+ for (QStringList::Iterator it = KABPrefs::instance()->mCustomCategories.begin ();
+ it != KABPrefs::instance()->mCustomCategories.end ();
+ ++it) {
+ mCatPopup->insertItem (*it, index );
+ //mCategory[index] = *it;
+ if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
+ ++index;
+ }
+}
+void AddresseeEditorWidget::selectedCatPopup( int index )
+{
+ QStringList categories = QStringList::split (",", mCategoryEdit->text());
+ QString colcat = categories.first();
+ if (categories.find ( KABPrefs::instance()->mCustomCategories[index]) != categories.end ())
+ categories.remove (KABPrefs::instance()->mCustomCategories[index]);
+ else
+ categories.insert (categories.end(), KABPrefs::instance()->mCustomCategories[index]);
+ categories.sort ();
+ if ( !colcat.isEmpty() ) {
+ if ( categories.find ( colcat ) != categories.end () ) {
+ categories.remove( colcat );
+ categories.prepend( colcat );
+ }
+ }
+ mCategoryEdit->setText( categories.join(",") );
+ emitModified();
+}
void AddresseeEditorWidget::setRole2FN()
@@ -360,3 +396,3 @@ void AddresseeEditorWidget::setRole2FN()
mFormattedNameLabel->setText( mRoleEdit->text() );
- mDirty = true;
+ emitModified();
}
@@ -368,3 +404,3 @@ void AddresseeEditorWidget::setCompany2FN()
mFormattedNameLabel->setText( mOrgEdit->text() );
- mDirty = true;
+ emitModified();
}
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
protected slots:
+ void showCatPopup();
+ void selectedCatPopup( int );
void setRole2FN();
@@ -152,3 +154,4 @@ class AddresseeEditorWidget : public ExtensionWidget
KLineEdit *mIMAddressEdit;
- KLineEdit *mCategoryEdit;
+ QPushButton *mCategoryEdit;
+ QPopupMenu *mCatPopup;
SecrecyWidget *mSecrecyWidget;