summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--korganizer/koeditorgeneral.cpp1
-rw-r--r--korganizer/kotodoview.cpp7
-rw-r--r--libkdepim/categoryselectdialog.cpp88
-rw-r--r--libkdepim/categoryselectdialog.h8
-rw-r--r--libkdepim/categoryselectdialog_base.cpp9
-rw-r--r--libkdepim/categoryselectdialog_base.h1
7 files changed, 103 insertions, 15 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 523c054..ee37492 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1226,2 +1226,6 @@
{ "Parent todo:<br>","Über Todo:<br>" },
+{ "Set current as color category","Setze Gewählte als Farbkategorie" },
+{ "","" },
+{ "","" },
+{ "","" },
{ "","" },
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index f5eb52e..496f125 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -123,2 +123,3 @@ void KOEditorGeneral::editCategories()
//KOGlobals::fitDialogToScreen( csd );
+ csd->setColorEnabled();
csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 1a1bce5..3011458 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -963,2 +963,3 @@ void KOTodoView::changedCategories(int index)
QStringList categories = mActiveItem->todo()->categories ();
+ QString colcat = categories.first();
if (categories.find (mCategory[index]) != categories.end ())
@@ -968,2 +969,8 @@ void KOTodoView::changedCategories(int index)
categories.sort ();
+ if ( !colcat.isEmpty() ) {
+ if ( categories.find ( colcat ) != categories.end () ) {
+ categories.remove( colcat );
+ categories.prepend( colcat );
+ }
+ }
mActiveItem->todo()->setCategories (categories);
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp
index 7df9154..8b2bc4e 100644
--- a/libkdepim/categoryselectdialog.cpp
+++ b/libkdepim/categoryselectdialog.cpp
@@ -28,2 +28,3 @@
#include <qmessagebox.h>
+#include <kmessagebox.h>
@@ -43,11 +44,15 @@ CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent,
{
- mCategories->header()->hide();
+ mColorItem = 0;
+ mColorEnabled = false;
+ mCategories->header()->hide();
- setCategories();
+ setCategories();
- connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog()));
- if ( QApplication::desktop()->width() > 460 )
- resize( 300, 360 );
- else
- showMaximized();
+ connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog()));
+ if ( QApplication::desktop()->width() > 460 )
+ resize( 300, 360 );
+ else
+ showMaximized();
+ connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) );
+ connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) );
}
@@ -57,3 +62,3 @@ void CategorySelectDialog::editCategoriesDialog()
- ced->exec();
+ ced->exec();
delete ced;
@@ -63,2 +68,3 @@ void CategorySelectDialog::setCategories()
{
+ mColorItem = 0;
mCategories->clear();
@@ -67,3 +73,2 @@ void CategorySelectDialog::setCategories()
QStringList::Iterator it;
-
for (it = mPrefs->mCustomCategories.begin();
@@ -91,2 +96,4 @@ void CategorySelectDialog::setSelected(const QStringList &selList)
item->setOn(true);
+ if ( ! found )
+ setColorItem( item );
found = true;
@@ -115,3 +122,56 @@ QStringList CategorySelectDialog::selectedCategories() const
}
+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 );
+ newColorItem->setPixmap ( 0, pix );
+ mColorItem = newColorItem;
+ }
+}
void CategorySelectDialog::slotApply()
@@ -120,5 +180,9 @@ void CategorySelectDialog::slotApply()
QCheckListItem *item = (QCheckListItem *)mCategories->firstChild();
+ QString colcat;
while (item) {
if (item->isOn()) {
- categories.append(item->text());
+ if ( item == mColorItem)
+ colcat = item->text();
+ else
+ categories.append(item->text());
}
@@ -126,3 +190,5 @@ void CategorySelectDialog::slotApply()
}
-
+ categories.sort();
+ if ( ! colcat.isEmpty() )
+ categories.prepend( colcat );
QString categoriesStr = categories.join(",");
diff --git a/libkdepim/categoryselectdialog.h b/libkdepim/categoryselectdialog.h
index 9b6261c..680a093 100644
--- a/libkdepim/categoryselectdialog.h
+++ b/libkdepim/categoryselectdialog.h
@@ -28,2 +28,3 @@
class KPimPrefs;
+class QCheckListItem;
@@ -41,2 +42,3 @@ class CategorySelectDialog : public CategorySelectDialog_base
void setCategories();
+ void setColorEnabled();
void setSelected(const QStringList &selList);
@@ -52,3 +54,4 @@ class CategorySelectDialog : public CategorySelectDialog_base
void updateCategoryConfig();
-
+ void setColorCat();
+ void clicked ( QListViewItem * );
signals:
@@ -59,4 +62,7 @@ class CategorySelectDialog : public CategorySelectDialog_base
private:
+ bool mColorEnabled;
KPimPrefs *mPrefs;
QStringList mCategoryList;
+ QCheckListItem *mColorItem;
+ void setColorItem( QCheckListItem * );
diff --git a/libkdepim/categoryselectdialog_base.cpp b/libkdepim/categoryselectdialog_base.cpp
index 3f050cf..4793fd7 100644
--- a/libkdepim/categoryselectdialog_base.cpp
+++ b/libkdepim/categoryselectdialog_base.cpp
@@ -38,4 +38,5 @@ CategorySelectDialog_base::CategorySelectDialog_base( QWidget* parent, const cha
CategorySelectDialog_baseLayout->addWidget( mCategories );
-
- Layout12 = new QHBoxLayout( 0, 0, 6, "Layout12");
+ mSetColorCat = new QPushButton( this, "msetColor" );
+ CategorySelectDialog_baseLayout->addWidget( mSetColorCat );
+ Layout12 = new QHBoxLayout( 0, 0, 4, "Layout12");
@@ -50,3 +51,3 @@ CategorySelectDialog_base::CategorySelectDialog_base( QWidget* parent, const cha
- Layout11 = new QHBoxLayout( 0, 0, 6, "Layout11");
+ Layout11 = new QHBoxLayout( 0, 0, 4, "Layout11");
@@ -86,2 +87,3 @@ CategorySelectDialog_base::CategorySelectDialog_base( QWidget* parent, const cha
//raise();
+ mSetColorCat->hide();
}
@@ -109,2 +111,3 @@ void CategorySelectDialog_base::languageChange()
mButtonOk->setText( i18n( "&OK" ) );
+ mSetColorCat->setText( i18n( "Set current as color category" ) );
mButtonCancel->setText( i18n( "&Cancel" ) );
diff --git a/libkdepim/categoryselectdialog_base.h b/libkdepim/categoryselectdialog_base.h
index af905ed..59ffa22 100644
--- a/libkdepim/categoryselectdialog_base.h
+++ b/libkdepim/categoryselectdialog_base.h
@@ -37,2 +37,3 @@ public:
QPushButton* mButtonCancel;
+ QPushButton* mSetColorCat;