summaryrefslogtreecommitdiffabout
path: root/libkdepim
Unidiff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/categoryeditdialog.cpp4
-rw-r--r--libkdepim/categoryselectdialog.cpp4
2 files changed, 8 insertions, 0 deletions
diff --git a/libkdepim/categoryeditdialog.cpp b/libkdepim/categoryeditdialog.cpp
index a19900f..e2325d2 100644
--- a/libkdepim/categoryeditdialog.cpp
+++ b/libkdepim/categoryeditdialog.cpp
@@ -34,48 +34,52 @@
34 34
35using namespace KPIM; 35using namespace KPIM;
36 36
37CategoryEditDialog::CategoryEditDialog( KPimPrefs *prefs, QWidget* parent, 37CategoryEditDialog::CategoryEditDialog( KPimPrefs *prefs, QWidget* parent,
38 const char* name, bool modal, 38 const char* name, bool modal,
39 WFlags fl ) 39 WFlags fl )
40 : CategoryEditDialog_base( parent, name, modal, fl ), 40 : CategoryEditDialog_base( parent, name, modal, fl ),
41 mPrefs( prefs ) 41 mPrefs( prefs )
42{ 42{
43 mCategories->header()->hide(); 43 mCategories->header()->hide();
44 44
45 QStringList::Iterator it; 45 QStringList::Iterator it;
46 bool categoriesExist=false; 46 bool categoriesExist=false;
47 for (it = mPrefs->mCustomCategories.begin(); 47 for (it = mPrefs->mCustomCategories.begin();
48 it != mPrefs->mCustomCategories.end(); ++it ) { 48 it != mPrefs->mCustomCategories.end(); ++it ) {
49 new QListViewItem(mCategories,*it); 49 new QListViewItem(mCategories,*it);
50 categoriesExist=true; 50 categoriesExist=true;
51 } 51 }
52 52
53 connect(mCategories,SIGNAL(selectionChanged(QListViewItem *)), 53 connect(mCategories,SIGNAL(selectionChanged(QListViewItem *)),
54 SLOT(editItem(QListViewItem *))); 54 SLOT(editItem(QListViewItem *)));
55 connect(mEdit,SIGNAL(textChanged ( const QString & )),this,SLOT(slotTextChanged(const QString &))); 55 connect(mEdit,SIGNAL(textChanged ( const QString & )),this,SLOT(slotTextChanged(const QString &)));
56 mButtonRemove->setEnabled(categoriesExist); 56 mButtonRemove->setEnabled(categoriesExist);
57 mButtonModify->setEnabled(categoriesExist); 57 mButtonModify->setEnabled(categoriesExist);
58#ifndef DESKTOP_VERSION
59 mButtonOk->hide();
60 mButtonCancel->hide();
61#endif
58 mButtonAdd->setEnabled(!mEdit->text().isEmpty()); 62 mButtonAdd->setEnabled(!mEdit->text().isEmpty());
59 if ( QApplication::desktop()->width() > 460 ) 63 if ( QApplication::desktop()->width() > 460 )
60 resize( 300, 360 ); 64 resize( 300, 360 );
61 else 65 else
62 showMaximized(); 66 showMaximized();
63} 67}
64 68
65/* 69/*
66 * Destroys the object and frees any allocated resources 70 * Destroys the object and frees any allocated resources
67 */ 71 */
68CategoryEditDialog::~CategoryEditDialog() 72CategoryEditDialog::~CategoryEditDialog()
69{ 73{
70 // no need to delete child widgets, Qt does it all for us 74 // no need to delete child widgets, Qt does it all for us
71} 75}
72 76
73void CategoryEditDialog::slotTextChanged(const QString &text) 77void CategoryEditDialog::slotTextChanged(const QString &text)
74{ 78{
75 mButtonAdd->setEnabled(!text.isEmpty()); 79 mButtonAdd->setEnabled(!text.isEmpty());
76} 80}
77 81
78void CategoryEditDialog::add() 82void CategoryEditDialog::add()
79{ 83{
80 if (!mEdit->text().isEmpty()) { 84 if (!mEdit->text().isEmpty()) {
81 new QListViewItem(mCategories,mEdit->text()); 85 new QListViewItem(mCategories,mEdit->text());
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp
index 974752c..a4e0024 100644
--- a/libkdepim/categoryselectdialog.cpp
+++ b/libkdepim/categoryselectdialog.cpp
@@ -34,48 +34,52 @@
34 34
35#include "kpimprefs.h" 35#include "kpimprefs.h"
36 36
37using namespace KPIM; 37using namespace KPIM;
38 38
39CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, 39CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent,
40 const char* name, 40 const char* name,
41 bool modal, WFlags fl ) 41 bool modal, WFlags fl )
42 : CategorySelectDialog_base( parent, name, true, fl ), 42 : CategorySelectDialog_base( parent, name, true, fl ),
43 mPrefs( prefs ) 43 mPrefs( prefs )
44{ 44{
45 mColorItem = 0; 45 mColorItem = 0;
46 mColorEnabled = false; 46 mColorEnabled = false;
47 mCategories->header()->hide(); 47 mCategories->header()->hide();
48 48
49 setCategories(); 49 setCategories();
50 50
51 connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); 51 connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog()));
52 if ( QApplication::desktop()->width() > 460 ) 52 if ( QApplication::desktop()->width() > 460 )
53 resize( 300, 360 ); 53 resize( 300, 360 );
54 else 54 else
55 showMaximized(); 55 showMaximized();
56 connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) ); 56 connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) );
57 // connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); 57 // connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) );
58#ifndef DESKTOP_VERSION
59 mButtonOk->hide();
60 mButtonCancel->hide();
61#endif
58} 62}
59void CategorySelectDialog::editCategoriesDialog() 63void CategorySelectDialog::editCategoriesDialog()
60{ 64{
61 KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); 65 KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this );
62 66
63 ced->exec(); 67 ced->exec();
64 delete ced; 68 delete ced;
65 slotApply(); 69 slotApply();
66 QStringList temp = mCategoryList; 70 QStringList temp = mCategoryList;
67 setCategories(); 71 setCategories();
68 setSelected( temp ); 72 setSelected( temp );
69} 73}
70void CategorySelectDialog::setCategories() 74void CategorySelectDialog::setCategories()
71{ 75{
72 mColorItem = 0; 76 mColorItem = 0;
73 mCategories->clear(); 77 mCategories->clear();
74 mCategoryList.clear(); 78 mCategoryList.clear();
75 79
76 QStringList::Iterator it; 80 QStringList::Iterator it;
77 for (it = mPrefs->mCustomCategories.begin(); 81 for (it = mPrefs->mCustomCategories.begin();
78 it != mPrefs->mCustomCategories.end(); ++it ) { 82 it != mPrefs->mCustomCategories.end(); ++it ) {
79 CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox); 83 CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox);
80 QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); 84 QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) );
81 85