summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-02-06 18:00:15 (UTC)
committer zautrix <zautrix>2005-02-06 18:00:15 (UTC)
commit282c7fc5b72f8a6ff78a408e10a6018c290ed9f0 (patch) (unidiff)
tree95291ead32969e45a6e4e405f15532c9f29543f7 /korganizer
parent002a447671cdec6a2ee7940bc183c630c61121fa (diff)
downloadkdepimpi-282c7fc5b72f8a6ff78a408e10a6018c290ed9f0.zip
kdepimpi-282c7fc5b72f8a6ff78a408e10a6018c290ed9f0.tar.gz
kdepimpi-282c7fc5b72f8a6ff78a408e10a6018c290ed9f0.tar.bz2
cat color better
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneral.cpp1
-rw-r--r--korganizer/kotodoview.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index f5eb52e..496f125 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -76,96 +76,97 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
76 76
77 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 77 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
78 headerLayout->addWidget(summaryLabel,1,0); 78 headerLayout->addWidget(summaryLabel,1,0);
79 79
80 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 80 mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
81 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 81 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
82 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 82 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
83 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 83 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
84 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 84 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
85 if ( QApplication::desktop()->width() > 320 ) 85 if ( QApplication::desktop()->width() > 320 )
86 mSummaryEdit->setMaximumHeight( hei +6 ); 86 mSummaryEdit->setMaximumHeight( hei +6 );
87 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 87 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
88 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 88 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
89 // mSummaryEdit = new QLineEdit(parent); 89 // mSummaryEdit = new QLineEdit(parent);
90 headerLayout->addWidget(mSummaryEdit,1,1); 90 headerLayout->addWidget(mSummaryEdit,1,1);
91 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 91 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
92 92
93 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 93 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
94 headerLayout->addWidget(locationLabel,2,0); 94 headerLayout->addWidget(locationLabel,2,0);
95 95
96 mLocationEdit = new KOLocationBox(TRUE,parent,10); 96 mLocationEdit = new KOLocationBox(TRUE,parent,10);
97 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 97 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
98 if ( QApplication::desktop()->width() > 320 ) 98 if ( QApplication::desktop()->width() > 320 )
99 mLocationEdit->setMaximumHeight( hei + 6); 99 mLocationEdit->setMaximumHeight( hei + 6);
100 100
101 // mLocationEdit = new QLineEdit(parent); 101 // mLocationEdit = new QLineEdit(parent);
102 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 102 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
103 headerLayout->addWidget(mLocationEdit,2,1); 103 headerLayout->addWidget(mLocationEdit,2,1);
104 headerLayout->setColStretch( 1, 10); 104 headerLayout->setColStretch( 1, 10);
105} 105}
106void KOEditorGeneral::setFocusOn( int i ) 106void KOEditorGeneral::setFocusOn( int i )
107{ 107{
108 qApp->processEvents(); 108 qApp->processEvents();
109 if ( i == 1 ) { 109 if ( i == 1 ) {
110 mDescriptionEdit->setFocus(); 110 mDescriptionEdit->setFocus();
111 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 111 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
112 } 112 }
113 if ( i == 2 ) { 113 if ( i == 2 ) {
114 mSummaryEdit->setFocus(); 114 mSummaryEdit->setFocus();
115 } 115 }
116 116
117} 117}
118void KOEditorGeneral::editCategories() 118void KOEditorGeneral::editCategories()
119{ 119{
120 // qDebug("KOEditorGeneral::editCategories() "); 120 // qDebug("KOEditorGeneral::editCategories() ");
121 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 121 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
122 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 122 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
123 //KOGlobals::fitDialogToScreen( csd ); 123 //KOGlobals::fitDialogToScreen( csd );
124 csd->setColorEnabled();
124 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 125 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
125 csd->exec(); 126 csd->exec();
126 delete csd; 127 delete csd;
127} 128}
128void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 129void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
129{ 130{
130 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 131 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
131 132
132 mCategoriesButton = new QPushButton(parent); 133 mCategoriesButton = new QPushButton(parent);
133 mCategoriesButton->setText(i18n("Categories...")); 134 mCategoriesButton->setText(i18n("Categories..."));
134 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 135 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
135 categoriesLayout->addWidget(mCategoriesButton); 136 categoriesLayout->addWidget(mCategoriesButton);
136 137
137 mCategoriesLabel = new QLabel(parent); 138 mCategoriesLabel = new QLabel(parent);
138 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 139 mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
139 categoriesLayout->addWidget(mCategoriesLabel,1); 140 categoriesLayout->addWidget(mCategoriesLabel,1);
140} 141}
141 142
142void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 143void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
143{ 144{
144 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 145 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
145 146
146 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 147 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
147 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 148 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
148 secrecyLayout->addWidget(mCancelBox); 149 secrecyLayout->addWidget(mCancelBox);
149 secrecyLayout->addWidget(secrecyLabel); 150 secrecyLayout->addWidget(secrecyLabel);
150 151
151 mSecrecyCombo = new QComboBox(parent); 152 mSecrecyCombo = new QComboBox(parent);
152 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 153 mSecrecyCombo->insertStringList(Incidence::secrecyList());
153 secrecyLayout->addWidget(mSecrecyCombo); 154 secrecyLayout->addWidget(mSecrecyCombo);
154} 155}
155 156
156void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 157void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
157{ 158{
158 mDescriptionEdit = new KTextEdit(parent); 159 mDescriptionEdit = new KTextEdit(parent);
159 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 160 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
160 mDescriptionEdit->append(""); 161 mDescriptionEdit->append("");
161 mDescriptionEdit->setReadOnly(false); 162 mDescriptionEdit->setReadOnly(false);
162 mDescriptionEdit->setOverwriteMode(false); 163 mDescriptionEdit->setOverwriteMode(false);
163 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 164 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
164 topLayout->addWidget(mDescriptionEdit); 165 topLayout->addWidget(mDescriptionEdit);
165#ifndef DESKTOP_VERSION 166#ifndef DESKTOP_VERSION
166 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 167 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
167#endif 168#endif
168 169
169} 170}
170 171
171void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 172void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 1a1bce5..3011458 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -916,101 +916,108 @@ void KOTodoView::setNewPriority(int index)
916void KOTodoView::setNewPercentage(int index) 916void KOTodoView::setNewPercentage(int index)
917{ 917{
918 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 918 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
919 919
920 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { 920 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) {
921 mActiveItem->setOn( true ); 921 mActiveItem->setOn( true );
922 return; 922 return;
923 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { 923 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) {
924 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); 924 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent()));
925 if ( par && par->isOn() ) 925 if ( par && par->isOn() )
926 par->setOn( false ); 926 par->setOn( false );
927 } 927 }
928 if (mPercentage[index] == 100) { 928 if (mPercentage[index] == 100) {
929 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 929 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
930 } else { 930 } else {
931 mActiveItem->todo()->setCompleted(false); 931 mActiveItem->todo()->setCompleted(false);
932 } 932 }
933 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 933 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
934 mActiveItem->construct(); 934 mActiveItem->construct();
935 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 935 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
936 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 936 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
937 } 937 }
938} 938}
939 939
940 940
941QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) 941QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
942{ 942{
943 QPopupMenu* tempMenu = new QPopupMenu (this); 943 QPopupMenu* tempMenu = new QPopupMenu (this);
944 QStringList checkedCategories = todoItem->todo()->categories (); 944 QStringList checkedCategories = todoItem->todo()->categories ();
945 945
946 tempMenu->setCheckable (true); 946 tempMenu->setCheckable (true);
947 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 947 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
948 it != KOPrefs::instance()->mCustomCategories.end (); 948 it != KOPrefs::instance()->mCustomCategories.end ();
949 ++it) { 949 ++it) {
950 int index = tempMenu->insertItem (*it); 950 int index = tempMenu->insertItem (*it);
951 mCategory[index] = *it; 951 mCategory[index] = *it;
952 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 952 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
953 } 953 }
954 954
955 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 955 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
956 return tempMenu; 956 return tempMenu;
957 957
958 958
959} 959}
960void KOTodoView::changedCategories(int index) 960void KOTodoView::changedCategories(int index)
961{ 961{
962 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 962 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
963 QStringList categories = mActiveItem->todo()->categories (); 963 QStringList categories = mActiveItem->todo()->categories ();
964 QString colcat = categories.first();
964 if (categories.find (mCategory[index]) != categories.end ()) 965 if (categories.find (mCategory[index]) != categories.end ())
965 categories.remove (mCategory[index]); 966 categories.remove (mCategory[index]);
966 else 967 else
967 categories.insert (categories.end(), mCategory[index]); 968 categories.insert (categories.end(), mCategory[index]);
968 categories.sort (); 969 categories.sort ();
970 if ( !colcat.isEmpty() ) {
971 if ( categories.find ( colcat ) != categories.end () ) {
972 categories.remove( colcat );
973 categories.prepend( colcat );
974 }
975 }
969 mActiveItem->todo()->setCategories (categories); 976 mActiveItem->todo()->setCategories (categories);
970 mActiveItem->construct(); 977 mActiveItem->construct();
971 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 978 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
972 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 979 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
973 } 980 }
974} 981}
975void KOTodoView::itemDoubleClicked(QListViewItem *item) 982void KOTodoView::itemDoubleClicked(QListViewItem *item)
976{ 983{
977 if ( pendingSubtodo != 0 ) { 984 if ( pendingSubtodo != 0 ) {
978 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 985 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
979 } 986 }
980 pendingSubtodo = 0; 987 pendingSubtodo = 0;
981 if (!item) { 988 if (!item) {
982 newTodo(); 989 newTodo();
983 return; 990 return;
984 } 991 }
985 if ( KOPrefs::instance()->mEditOnDoubleClick ) 992 if ( KOPrefs::instance()->mEditOnDoubleClick )
986 editItem( item ); 993 editItem( item );
987 else 994 else
988 showItem( item , QPoint(), 0 ); 995 showItem( item , QPoint(), 0 );
989} 996}
990void KOTodoView::itemClicked(QListViewItem *item) 997void KOTodoView::itemClicked(QListViewItem *item)
991{ 998{
992 999
993 if (!item) { 1000 if (!item) {
994 if ( pendingSubtodo != 0 ) { 1001 if ( pendingSubtodo != 0 ) {
995 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1002 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
996 } 1003 }
997 pendingSubtodo = 0; 1004 pendingSubtodo = 0;
998 return; 1005 return;
999 } 1006 }
1000 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1007 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1001 if ( pendingSubtodo != 0 ) { 1008 if ( pendingSubtodo != 0 ) {
1002 bool allowReparent = true; 1009 bool allowReparent = true;
1003 QListViewItem *par = item; 1010 QListViewItem *par = item;
1004 while ( par ) { 1011 while ( par ) {
1005 if ( par == pendingSubtodo ) { 1012 if ( par == pendingSubtodo ) {
1006 allowReparent = false; 1013 allowReparent = false;
1007 break; 1014 break;
1008 } 1015 }
1009 par = par->parent(); 1016 par = par->parent();
1010 } 1017 }
1011 if ( !allowReparent ) { 1018 if ( !allowReparent ) {
1012 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1019 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1013 qDebug("Recursive reparenting not possible "); 1020 qDebug("Recursive reparenting not possible ");
1014 pendingSubtodo = 0; 1021 pendingSubtodo = 0;
1015 } else { 1022 } else {
1016 Todo* newParent = todoItem->todo(); 1023 Todo* newParent = todoItem->todo();