23 #include <tqlistview.h>
24 #include <tqpushbutton.h>
27 #include "categoryselectdialog_base.h"
28 #include <tdelocale.h>
29 #include "categoryselectdialog.h"
31 #include "kpimprefs.h"
35 CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, TQWidget* parent,
36 const char* name,
bool modal )
37 : KDialogBase::KDialogBase( parent, name, modal,
38 i18n(
"Select Categories"), Ok|Apply|Cancel|Help, Ok, true ),
41 mWidget =
new CategorySelectDialog_base(
this,
"CategorySelection" );
42 mWidget->mCategories->header()->hide();
43 setMainWidget( mWidget );
47 connect( mWidget->mButtonEdit, TQ_SIGNAL(clicked()),
48 TQ_SIGNAL(editCategories()) );
49 connect( mWidget->mButtonClear, TQ_SIGNAL(clicked()),
53 void CategorySelectDialog::setCategories(
const TQStringList &categoryList )
55 mWidget->mCategories->clear();
56 mCategoryList.clear();
58 TQStringList::ConstIterator it;
60 for ( it = categoryList.begin(); it != categoryList.end(); ++it )
61 if ( mPrefs->mCustomCategories.find( *it ) == mPrefs->mCustomCategories.end() )
62 mPrefs->mCustomCategories.append( *it );
64 for ( it = mPrefs->mCustomCategories.begin();
65 it != mPrefs->mCustomCategories.end(); ++it ) {
66 new TQCheckListItem( mWidget->mCategories, *it, TQCheckListItem::CheckBox );
70 CategorySelectDialog::~CategorySelectDialog()
74 void CategorySelectDialog::setSelected(
const TQStringList &selList)
78 TQStringList::ConstIterator it;
79 for ( it = selList.begin(); it != selList.end(); ++it ) {
80 TQCheckListItem *item = (TQCheckListItem *)mWidget->mCategories->firstChild();
82 if (item->text() == *it) {
86 item = (TQCheckListItem *)item->nextSibling();
91 TQStringList CategorySelectDialog::selectedCategories()
const
96 void CategorySelectDialog::slotApply()
98 TQStringList categories;
99 TQCheckListItem *item = (TQCheckListItem *)mWidget->mCategories->firstChild();
102 categories.append(item->text());
104 item = (TQCheckListItem *)item->nextSibling();
107 TQString categoriesStr = categories.join(
", ");
109 mCategoryList = categories;
111 emit categoriesSelected(categories);
112 emit categoriesSelected(categoriesStr);
115 void CategorySelectDialog::slotOk()
121 void CategorySelectDialog::clear()
123 TQCheckListItem *item = (TQCheckListItem *)mWidget->mCategories->firstChild();
126 item = (TQCheckListItem *)item->nextSibling();
130 void CategorySelectDialog::updateCategoryConfig()
132 TQStringList selected;
133 TQCheckListItem *item = (TQCheckListItem *)mWidget->mCategories->firstChild();
136 selected.append(item->text());
138 item = (TQCheckListItem *)item->nextSibling();
143 setSelected(selected);
146 #include "categoryselectdialog.moc"
TDEPIM classes for drag and drop of mails.