-rw-r--r-- | korganizer/koeditorgeneral.cpp | 51 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.h | 7 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 16 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 33 |
4 files changed, 76 insertions, 31 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 915c7ec..50a04ea 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -143,15 +143,54 @@ void KOEditorGeneral::editCategories() | |||
143 | delete csd; | 143 | delete csd; |
144 | } | 144 | } |
145 | |||
146 | void KOEditorGeneral::showCatPopup() | ||
147 | { | ||
148 | mCatPopup->clear(); | ||
149 | QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); | ||
150 | int index = 0; | ||
151 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | ||
152 | it != KOPrefs::instance()->mCustomCategories.end (); | ||
153 | ++it) { | ||
154 | mCatPopup->insertItem (*it, index ); | ||
155 | //mCategory[index] = *it; | ||
156 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); | ||
157 | ++index; | ||
158 | } | ||
159 | } | ||
160 | void KOEditorGeneral::selectedCatPopup( int index ) | ||
161 | { | ||
162 | qDebug("i %d c %d ", index, KOPrefs::instance()->mCustomCategories.count()); | ||
163 | QStringList categories = QStringList::split (",", mCategoriesLabel->text()); | ||
164 | QString colcat = categories.first(); | ||
165 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) | ||
166 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); | ||
167 | else | ||
168 | categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); | ||
169 | categories.sort (); | ||
170 | if ( !colcat.isEmpty() ) { | ||
171 | if ( categories.find ( colcat ) != categories.end () ) { | ||
172 | categories.remove( colcat ); | ||
173 | categories.prepend( colcat ); | ||
174 | } | ||
175 | } | ||
176 | mCategoriesLabel->setText( categories.join(",") ); | ||
177 | } | ||
178 | |||
145 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) | 179 | void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) |
146 | { | 180 | { |
147 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); | 181 | QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); |
148 | 182 | mCatPopup = new QPopupMenu ( parent ); | |
183 | mCatPopup->setCheckable (true); | ||
184 | connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); | ||
185 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); | ||
149 | mCategoriesButton = new QPushButton(parent); | 186 | mCategoriesButton = new QPushButton(parent); |
150 | mCategoriesButton->setText(i18n("Categories...")); | 187 | mCategoriesButton->setText(i18n("Categories")); |
151 | connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); | 188 | //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); |
152 | categoriesLayout->addWidget(mCategoriesButton); | 189 | categoriesLayout->addWidget(mCategoriesButton); |
153 | 190 | mCategoriesButton->setPopup( mCatPopup ); | |
154 | mCategoriesLabel = new QLabel(parent); | 191 | mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); |
155 | mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 192 | mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
193 | connect(mCategoriesLabel,SIGNAL(clicked()),this, SLOT(editCategories() )); | ||
194 | //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); | ||
156 | categoriesLayout->addWidget(mCategoriesLabel,1); | 195 | categoriesLayout->addWidget(mCategoriesLabel,1); |
157 | } | 196 | } |
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h index a8f6443..c463403 100644 --- a/korganizer/koeditorgeneral.h +++ b/korganizer/koeditorgeneral.h | |||
@@ -28,4 +28,5 @@ | |||
28 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qpopupmenu.h> | ||
30 | #include <qgroupbox.h> | 31 | #include <qgroupbox.h> |
31 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
@@ -83,4 +84,7 @@ class KOEditorGeneral : public QObject | |||
83 | void pickAlarmProgram(); | 84 | void pickAlarmProgram(); |
84 | void slotSetFocusOn(); | 85 | void slotSetFocusOn(); |
86 | void showCatPopup(); | ||
87 | void selectedCatPopup( int ); | ||
88 | |||
85 | signals: | 89 | signals: |
86 | void openCategoryDialog(); | 90 | void openCategoryDialog(); |
@@ -105,7 +109,8 @@ class KOEditorGeneral : public QObject | |||
105 | QCheckBox *mCancelBox; | 109 | QCheckBox *mCancelBox; |
106 | QPushButton *mCategoriesButton; | 110 | QPushButton *mCategoriesButton; |
107 | QLabel *mCategoriesLabel; | 111 | QPushButton *mCategoriesLabel; |
108 | 112 | ||
109 | private: | 113 | private: |
114 | QPopupMenu * mCatPopup; | ||
110 | QString getFittingPath( const QString ) ; | 115 | QString getFittingPath( const QString ) ; |
111 | QString mAlarmSound; | 116 | QString mAlarmSound; |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 7ba7269..9db2040 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -392,11 +392,11 @@ QStringList KOPrefs::getDefaultList() | |||
392 | { | 392 | { |
393 | QStringList retval ; | 393 | QStringList retval ; |
394 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 394 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Cinema") << i18n("Customer") |
395 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 395 | << i18n("Break") |
396 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 396 | << i18n("Family") << i18n("Favorites") << i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
397 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 397 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Key Customer") |
398 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 398 | << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") |
399 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 399 | << i18n("PHB") << i18n("Phone Calls") << i18n("School") << i18n("Shopping") |
400 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 400 | << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
401 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 401 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
402 | retval.sort(); | 402 | retval.sort(); |
@@ -404,5 +404,5 @@ QStringList KOPrefs::getDefaultList() | |||
404 | return retval; | 404 | return retval; |
405 | } | 405 | } |
406 | 406 | // << i18n("Business Travel") << i18n("Education") << i18n("Hiking") << i18n("Hunting") << i18n("Recurring") << i18n("Personal Travel") << i18n("Speach") << i18n("Festival") << i18n("Competition")<< i18n("Party")<< i18n("Projects")<< i18n("Kids") << i18n("Special Occasion")<< i18n("Breakfast")<< i18n("Dinner") << i18n("Lunch") | |
407 | void KOPrefs::usrReadConfig() | 407 | void KOPrefs::usrReadConfig() |
408 | { | 408 | { |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 1bfdef9..873a776 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -498,4 +498,5 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
498 | KOrg::BaseView(calendar,parent,name) | 498 | KOrg::BaseView(calendar,parent,name) |
499 | { | 499 | { |
500 | mCategoryPopupMenu = 0; | ||
500 | mPendingUpdateBeforeRepaint = false; | 501 | mPendingUpdateBeforeRepaint = false; |
501 | isFlatDisplay = false; | 502 | isFlatDisplay = false; |
@@ -1159,20 +1160,20 @@ void KOTodoView::setNewPercentage(int index) | |||
1159 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 1160 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
1160 | { | 1161 | { |
1161 | QPopupMenu* tempMenu = new QPopupMenu (this); | 1162 | if ( !mCategoryPopupMenu ) { |
1162 | QStringList checkedCategories = todoItem->todo()->categories (); | 1163 | mCategoryPopupMenu = new QPopupMenu (this); |
1163 | 1164 | mCategoryPopupMenu->setCheckable (true); | |
1164 | tempMenu->setCheckable (true); | 1165 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
1165 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 1166 | } |
1166 | it != KOPrefs::instance()->mCustomCategories.end (); | 1167 | mCategoryPopupMenu->clear(); |
1167 | ++it) { | 1168 | QStringList checkedCategories = todoItem->todo()->categories (); |
1168 | int index = tempMenu->insertItem (*it); | 1169 | |
1169 | mCategory[index] = *it; | 1170 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
1170 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 1171 | it != KOPrefs::instance()->mCustomCategories.end (); |
1171 | } | 1172 | ++it) { |
1172 | 1173 | int index = mCategoryPopupMenu->insertItem (*it); | |
1173 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 1174 | mCategory[index] = *it; |
1174 | return tempMenu; | 1175 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); |
1175 | 1176 | } | |
1176 | 1177 | return mCategoryPopupMenu; | |
1177 | } | 1178 | } |
1178 | void KOTodoView::changedCategories(int index) | 1179 | void KOTodoView::changedCategories(int index) |