summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2005-02-07 13:03:38 (UTC)
committer zautrix <zautrix>2005-02-07 13:03:38 (UTC)
commit7de846e9f01ce27b622541493e6a02e26e37bf2c (patch) (side-by-side diff)
treedf59c7803b1e171b08d3c387f49b1239d1adc3b5 /libkdepim
parentafc19166fcdc09d3d5b757a84abfeb0b2746f35f (diff)
downloadkdepimpi-7de846e9f01ce27b622541493e6a02e26e37bf2c.zip
kdepimpi-7de846e9f01ce27b622541493e6a02e26e37bf2c.tar.gz
kdepimpi-7de846e9f01ce27b622541493e6a02e26e37bf2c.tar.bz2
fixxxx
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/categoryselectdialog.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp
index 8b2bc4e..8038934 100644
--- a/libkdepim/categoryselectdialog.cpp
+++ b/libkdepim/categoryselectdialog.cpp
@@ -81,156 +81,155 @@ CategorySelectDialog::~CategorySelectDialog()
{
}
void CategorySelectDialog::setSelected(const QStringList &selList)
{
clear();
QStringList::ConstIterator it;
QStringList notFound;
bool found = false;
for (it=selList.begin();it!=selList.end();++it) {
//qDebug(" CategorySelectDialog::setSelected(");
QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
while (item) {
if (item->text() == *it) {
item->setOn(true);
if ( ! found )
setColorItem( item );
found = true;
break;
}
item = (QCheckListItem *)item->nextSibling();
}
// if ( ! found ) {
//emit updateCategoriesGlobal();
// QMessageBox::information( this, "KO/E: Information!",
// "Categories found, which were not\n"
// "in list of categories!\n"
// "message",
// "OK", "", 0,
// 0, 1 );
// setSelected(selList);
// return;
// }
}
}
QStringList CategorySelectDialog::selectedCategories() const
{
return mCategoryList;
}
void CategorySelectDialog::setColorEnabled()
{
mColorEnabled = true;
mSetColorCat->show();
}
void CategorySelectDialog::setColorCat()
{
QCheckListItem * newColorItem = (QCheckListItem * )mCategories->currentItem ();
if ( !newColorItem ) {
KMessageBox::error(this,i18n("There is no current item."));
return;
}
if ( !newColorItem->isOn() )
newColorItem->setOn( true );
setColorItem( newColorItem );
}
void CategorySelectDialog::clicked ( QListViewItem * it )
{
if ( ! it )
return;
QCheckListItem *i = (QCheckListItem *) it;
- qDebug("click %d ", i->isOn());
if ( !i->isOn() && i==mColorItem) {
setColorItem( 0);
QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
while (item) {
if (item->isOn()) {
setColorItem( item );
break;
}
item = (QCheckListItem *)item->nextSibling();
}
} else if ( i->isOn() && !mColorItem) {
setColorItem( i);
}
}
void CategorySelectDialog::setColorItem( QCheckListItem * newColorItem )
{
if ( !mColorEnabled )
return;
if ( mColorItem == newColorItem)
return;
if ( mColorItem ) {
mColorItem->setPixmap ( 0, QPixmap() );
mColorItem = 0;
}
if ( newColorItem ) {
QPixmap pix (newColorItem->height()/2, newColorItem->height()/2 );
- pix.fill(Qt::blue );
+ pix.fill(Qt::red );
newColorItem->setPixmap ( 0, pix );
mColorItem = newColorItem;
}
}
void CategorySelectDialog::slotApply()
{
QStringList categories;
QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
QString colcat;
while (item) {
if (item->isOn()) {
if ( item == mColorItem)
colcat = item->text();
else
categories.append(item->text());
}
item = (QCheckListItem *)item->nextSibling();
}
categories.sort();
if ( ! colcat.isEmpty() )
categories.prepend( colcat );
QString categoriesStr = categories.join(",");
mCategoryList = categories;
emit categoriesSelected(categories);
emit categoriesSelected(categoriesStr);
}
void CategorySelectDialog::accept()
{
slotOk();
}
void CategorySelectDialog::slotOk()
{
slotApply();
QDialog::accept();
}
void CategorySelectDialog::clear()
{
QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
while (item) {
item->setOn(false);
item = (QCheckListItem *)item->nextSibling();
}
}
void CategorySelectDialog::updateCategoryConfig()
{
QStringList selected;
QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
while (item) {
if (item->isOn()) {
selected.append(item->text());
}
item = (QCheckListItem *)item->nextSibling();
}
setCategories();
setSelected(selected);
}