-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 | |||
@@ -121,59 +121,98 @@ void KOEditorGeneral::setFocusOn( int i ) | |||
121 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); | 121 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); |
122 | } | 122 | } |
123 | void KOEditorGeneral::slotSetFocusOn() | 123 | void KOEditorGeneral::slotSetFocusOn() |
124 | { | 124 | { |
125 | mNextFocus; | 125 | mNextFocus; |
126 | if ( mNextFocus == 1 ) { | 126 | if ( mNextFocus == 1 ) { |
127 | mDescriptionEdit->setFocus(); | 127 | mDescriptionEdit->setFocus(); |
128 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); | 128 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); |
129 | } | 129 | } |
130 | if ( mNextFocus == 2 ) { | 130 | if ( mNextFocus == 2 ) { |
131 | mSummaryEdit->setFocus(); | 131 | mSummaryEdit->setFocus(); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | void KOEditorGeneral::editCategories() | 134 | void KOEditorGeneral::editCategories() |
135 | { | 135 | { |
136 | // qDebug("KOEditorGeneral::editCategories() "); | 136 | // qDebug("KOEditorGeneral::editCategories() "); |
137 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 137 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
138 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); | 138 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); |
139 | //KOGlobals::fitDialogToScreen( csd ); | 139 | //KOGlobals::fitDialogToScreen( csd ); |
140 | csd->setColorEnabled(); | 140 | csd->setColorEnabled(); |
141 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); | 141 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); |
142 | csd->exec(); | 142 | csd->exec(); |
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 | } |
158 | 197 | ||
159 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) | 198 | void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) |
160 | { | 199 | { |
161 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); | 200 | QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); |
162 | 201 | ||
163 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); | 202 | QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); |
164 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); | 203 | mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); |
165 | secrecyLayout->addWidget(mCancelBox); | 204 | secrecyLayout->addWidget(mCancelBox); |
166 | secrecyLayout->addWidget(secrecyLabel); | 205 | secrecyLayout->addWidget(secrecyLabel); |
167 | 206 | ||
168 | mSecrecyCombo = new QComboBox(parent); | 207 | mSecrecyCombo = new QComboBox(parent); |
169 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); | 208 | mSecrecyCombo->insertStringList(Incidence::secrecyList()); |
170 | secrecyLayout->addWidget(mSecrecyCombo); | 209 | secrecyLayout->addWidget(mSecrecyCombo); |
171 | } | 210 | } |
172 | 211 | ||
173 | void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) | 212 | void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) |
174 | { | 213 | { |
175 | mDescriptionEdit = new KTextEdit(parent); | 214 | mDescriptionEdit = new KTextEdit(parent); |
176 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); | 215 | mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); |
177 | mDescriptionEdit->append(""); | 216 | mDescriptionEdit->append(""); |
178 | mDescriptionEdit->setReadOnly(false); | 217 | mDescriptionEdit->setReadOnly(false); |
179 | mDescriptionEdit->setOverwriteMode(false); | 218 | mDescriptionEdit->setOverwriteMode(false); |
diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h index a8f6443..c463403 100644 --- a/korganizer/koeditorgeneral.h +++ b/korganizer/koeditorgeneral.h | |||
@@ -6,48 +6,49 @@ | |||
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOEDITORGENERAL_H | 23 | #ifndef KOEDITORGENERAL_H |
24 | #define KOEDITORGENERAL_H | 24 | #define KOEDITORGENERAL_H |
25 | 25 | ||
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
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> |
32 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
33 | #include <qlistview.h> | 34 | #include <qlistview.h> |
34 | #include <qradiobutton.h> | 35 | #include <qradiobutton.h> |
35 | #include <qlayout.h> | 36 | #include <qlayout.h> |
36 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
37 | 38 | ||
38 | #include <ktextedit.h> | 39 | #include <ktextedit.h> |
39 | #include <krestrictedline.h> | 40 | #include <krestrictedline.h> |
40 | 41 | ||
41 | #include <libkcal/incidence.h> | 42 | #include <libkcal/incidence.h> |
42 | 43 | ||
43 | #include "ktimeedit.h" | 44 | #include "ktimeedit.h" |
44 | 45 | ||
45 | class KDateEdit; | 46 | class KDateEdit; |
46 | class KOLocationBox; | 47 | class KOLocationBox; |
47 | using namespace KCal; | 48 | using namespace KCal; |
48 | 49 | ||
49 | class KOEditorGeneral : public QObject | 50 | class KOEditorGeneral : public QObject |
50 | { | 51 | { |
51 | Q_OBJECT | 52 | Q_OBJECT |
52 | public: | 53 | public: |
53 | KOEditorGeneral (QObject* parent=0,const char* name=0); | 54 | KOEditorGeneral (QObject* parent=0,const char* name=0); |
@@ -61,56 +62,60 @@ class KOEditorGeneral : public QObject | |||
61 | 62 | ||
62 | /** Set widgets to default values */ | 63 | /** Set widgets to default values */ |
63 | void setDefaults(bool allDay); | 64 | void setDefaults(bool allDay); |
64 | /** Read event object and setup widgets accordingly */ | 65 | /** Read event object and setup widgets accordingly */ |
65 | void readIncidence(Incidence *); | 66 | void readIncidence(Incidence *); |
66 | /** Write event settings to event object */ | 67 | /** Write event settings to event object */ |
67 | void writeIncidence(Incidence *); | 68 | void writeIncidence(Incidence *); |
68 | 69 | ||
69 | /** Check if the input is valid. */ | 70 | /** Check if the input is valid. */ |
70 | bool validateInput() { return true; } | 71 | bool validateInput() { return true; } |
71 | 72 | ||
72 | void enableAlarm( bool enable ); | 73 | void enableAlarm( bool enable ); |
73 | void setSecrecy( int num ); | 74 | void setSecrecy( int num ); |
74 | public slots: | 75 | public slots: |
75 | void setCategories(const QString &); | 76 | void setCategories(const QString &); |
76 | void editCategories(); | 77 | void editCategories(); |
77 | 78 | ||
78 | protected slots: | 79 | protected slots: |
79 | void enableAlarmEdit( bool enable ); | 80 | void enableAlarmEdit( bool enable ); |
80 | void disableAlarmEdit( bool disable ); | 81 | void disableAlarmEdit( bool disable ); |
81 | void alarmDisable( bool disable ); | 82 | void alarmDisable( bool disable ); |
82 | void pickAlarmSound(); | 83 | void pickAlarmSound(); |
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(); |
87 | void allAccepted(); | 91 | void allAccepted(); |
88 | void dateTimesChanged(QDateTime,QDateTime); | 92 | void dateTimesChanged(QDateTime,QDateTime); |
89 | 93 | ||
90 | protected: | 94 | protected: |
91 | int mNextFocus; | 95 | int mNextFocus; |
92 | //QLineEdit *mSummaryEdit; | 96 | //QLineEdit *mSummaryEdit; |
93 | //QLineEdit *mLocationEdit; | 97 | //QLineEdit *mLocationEdit; |
94 | KOLocationBox *mSummaryEdit; | 98 | KOLocationBox *mSummaryEdit; |
95 | KOLocationBox *mLocationEdit; | 99 | KOLocationBox *mLocationEdit; |
96 | QLabel *mAlarmBell; | 100 | QLabel *mAlarmBell; |
97 | QCheckBox *mAlarmButton; | 101 | QCheckBox *mAlarmButton; |
98 | QSpinBox *mAlarmTimeEdit; | 102 | QSpinBox *mAlarmTimeEdit; |
99 | QPushButton *mAlarmSoundButton; | 103 | QPushButton *mAlarmSoundButton; |
100 | QPushButton *mAlarmProgramButton; | 104 | QPushButton *mAlarmProgramButton; |
101 | QComboBox *mAlarmIncrCombo; | 105 | QComboBox *mAlarmIncrCombo; |
102 | KTextEdit *mDescriptionEdit; | 106 | KTextEdit *mDescriptionEdit; |
103 | QLabel *mOwnerLabel; | 107 | QLabel *mOwnerLabel; |
104 | QComboBox *mSecrecyCombo; | 108 | QComboBox *mSecrecyCombo; |
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; |
112 | QString mAlarmProgram; | 117 | QString mAlarmProgram; |
113 | QString mAlarmMessage; | 118 | QString mAlarmMessage; |
114 | }; | 119 | }; |
115 | 120 | ||
116 | #endif | 121 | #endif |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 7ba7269..9db2040 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -370,61 +370,61 @@ void KOPrefs::setCategoryDefaults() | |||
370 | { | 370 | { |
371 | mCustomCategories.clear(); | 371 | mCustomCategories.clear(); |
372 | mCustomCategories = getDefaultList(); | 372 | mCustomCategories = getDefaultList(); |
373 | 373 | ||
374 | QStringList::Iterator it; | 374 | QStringList::Iterator it; |
375 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 375 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
376 | setCategoryColor(*it,mDefaultCategoryColor); | 376 | setCategoryColor(*it,mDefaultCategoryColor); |
377 | } | 377 | } |
378 | } | 378 | } |
379 | QStringList KOPrefs::getLocationDefaultList() | 379 | QStringList KOPrefs::getLocationDefaultList() |
380 | { | 380 | { |
381 | QStringList retval ; | 381 | QStringList retval ; |
382 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 382 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
383 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | 383 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") |
384 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 384 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
385 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 385 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
386 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 386 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
387 | 387 | ||
388 | retval.sort(); | 388 | retval.sort(); |
389 | return retval; | 389 | return retval; |
390 | } | 390 | } |
391 | QStringList KOPrefs::getDefaultList() | 391 | 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(); |
403 | //qDebug("cat %s ", retval.join("-").latin1()); | 403 | //qDebug("cat %s ", retval.join("-").latin1()); |
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 | { |
409 | config()->setGroup("General"); | 409 | config()->setGroup("General"); |
410 | 410 | ||
411 | //qDebug("KOPrefs::usrReadConfig() "); | 411 | //qDebug("KOPrefs::usrReadConfig() "); |
412 | mCustomCategories = config()->readListEntry("Custom Categories"); | 412 | mCustomCategories = config()->readListEntry("Custom Categories"); |
413 | mOldLoadedLanguage = mOldLanguage ; | 413 | mOldLoadedLanguage = mOldLanguage ; |
414 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 414 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
415 | if (mLocationDefaults.isEmpty()) { | 415 | if (mLocationDefaults.isEmpty()) { |
416 | mLocationDefaults = getLocationDefaultList(); | 416 | mLocationDefaults = getLocationDefaultList(); |
417 | } | 417 | } |
418 | 418 | ||
419 | if (mEventSummaryUser.isEmpty()) { | 419 | if (mEventSummaryUser.isEmpty()) { |
420 | mEventSummaryUser = getDefaultList() ; | 420 | mEventSummaryUser = getDefaultList() ; |
421 | } | 421 | } |
422 | if (mTodoSummaryUser.isEmpty()) { | 422 | if (mTodoSummaryUser.isEmpty()) { |
423 | mTodoSummaryUser = getDefaultList() ; | 423 | mTodoSummaryUser = getDefaultList() ; |
424 | } | 424 | } |
425 | 425 | ||
426 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 426 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
427 | 427 | ||
428 | config()->setGroup("Personal Settings"); | 428 | config()->setGroup("Personal Settings"); |
429 | mName = config()->readEntry("user_name",""); | 429 | mName = config()->readEntry("user_name",""); |
430 | mEmail = config()->readEntry("user_email",""); | 430 | mEmail = config()->readEntry("user_email",""); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 1bfdef9..873a776 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -476,48 +476,49 @@ void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | |||
476 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 476 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
477 | QLineEdit(parent) | 477 | QLineEdit(parent) |
478 | { | 478 | { |
479 | setText(i18n("Click to add a new Todo")); | 479 | setText(i18n("Click to add a new Todo")); |
480 | } | 480 | } |
481 | 481 | ||
482 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 482 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
483 | { | 483 | { |
484 | if ( text()==i18n("Click to add a new Todo") ) | 484 | if ( text()==i18n("Click to add a new Todo") ) |
485 | setText(""); | 485 | setText(""); |
486 | QLineEdit::focusInEvent(ev); | 486 | QLineEdit::focusInEvent(ev); |
487 | } | 487 | } |
488 | 488 | ||
489 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 489 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
490 | { | 490 | { |
491 | setText(i18n("Click to add a new Todo")); | 491 | setText(i18n("Click to add a new Todo")); |
492 | QLineEdit::focusOutEvent(ev); | 492 | QLineEdit::focusOutEvent(ev); |
493 | } | 493 | } |
494 | 494 | ||
495 | ///////////////////////////////////////////////////////////////////////////// | 495 | ///////////////////////////////////////////////////////////////////////////// |
496 | 496 | ||
497 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 497 | 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; |
502 | mNavigator = 0; | 503 | mNavigator = 0; |
503 | QBoxLayout *topLayout = new QVBoxLayout(this); | 504 | QBoxLayout *topLayout = new QVBoxLayout(this); |
504 | mName = QString ( name ); | 505 | mName = QString ( name ); |
505 | mBlockUpdate = false; | 506 | mBlockUpdate = false; |
506 | mQuickAdd = new KOQuickTodo(this); | 507 | mQuickAdd = new KOQuickTodo(this); |
507 | topLayout->addWidget(mQuickAdd); | 508 | topLayout->addWidget(mQuickAdd); |
508 | 509 | ||
509 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 510 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
510 | 511 | ||
511 | mTodoListView = new KOTodoListView(calendar,this, name ); | 512 | mTodoListView = new KOTodoListView(calendar,this, name ); |
512 | topLayout->addWidget(mTodoListView); | 513 | topLayout->addWidget(mTodoListView); |
513 | //mTodoListView->header()->setMaximumHeight(30); | 514 | //mTodoListView->header()->setMaximumHeight(30); |
514 | mTodoListView->setRootIsDecorated(true); | 515 | mTodoListView->setRootIsDecorated(true); |
515 | mTodoListView->setAllColumnsShowFocus(true); | 516 | mTodoListView->setAllColumnsShowFocus(true); |
516 | 517 | ||
517 | mTodoListView->setShowSortIndicator(true); | 518 | mTodoListView->setShowSortIndicator(true); |
518 | 519 | ||
519 | mTodoListView->addColumn(i18n("Todo")); | 520 | mTodoListView->addColumn(i18n("Todo")); |
520 | mTodoListView->addColumn(i18n("Prio")); | 521 | mTodoListView->addColumn(i18n("Prio")); |
521 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 522 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
522 | mTodoListView->addColumn(i18n("Complete")); | 523 | mTodoListView->addColumn(i18n("Complete")); |
523 | mTodoListView->setColumnAlignment(2,AlignCenter); | 524 | mTodoListView->setColumnAlignment(2,AlignCenter); |
@@ -1137,64 +1138,64 @@ void KOTodoView::setNewPercentage(int index) | |||
1137 | 1138 | ||
1138 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { | 1139 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { |
1139 | mActiveItem->setOn( true ); | 1140 | mActiveItem->setOn( true ); |
1140 | return; | 1141 | return; |
1141 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | 1142 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { |
1142 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | 1143 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); |
1143 | if ( par && par->isOn() ) | 1144 | if ( par && par->isOn() ) |
1144 | par->setOn( false ); | 1145 | par->setOn( false ); |
1145 | } | 1146 | } |
1146 | if (mPercentage[index] == 100) { | 1147 | if (mPercentage[index] == 100) { |
1147 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1148 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1148 | } else { | 1149 | } else { |
1149 | mActiveItem->todo()->setCompleted(false); | 1150 | mActiveItem->todo()->setCompleted(false); |
1150 | } | 1151 | } |
1151 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 1152 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
1152 | mActiveItem->construct(); | 1153 | mActiveItem->construct(); |
1153 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 1154 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
1154 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1155 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1155 | } | 1156 | } |
1156 | } | 1157 | } |
1157 | 1158 | ||
1158 | 1159 | ||
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) |
1179 | { | 1180 | { |
1180 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1181 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1181 | QStringList categories = mActiveItem->todo()->categories (); | 1182 | QStringList categories = mActiveItem->todo()->categories (); |
1182 | QString colcat = categories.first(); | 1183 | QString colcat = categories.first(); |
1183 | if (categories.find (mCategory[index]) != categories.end ()) | 1184 | if (categories.find (mCategory[index]) != categories.end ()) |
1184 | categories.remove (mCategory[index]); | 1185 | categories.remove (mCategory[index]); |
1185 | else | 1186 | else |
1186 | categories.insert (categories.end(), mCategory[index]); | 1187 | categories.insert (categories.end(), mCategory[index]); |
1187 | categories.sort (); | 1188 | categories.sort (); |
1188 | if ( !colcat.isEmpty() ) { | 1189 | if ( !colcat.isEmpty() ) { |
1189 | if ( categories.find ( colcat ) != categories.end () ) { | 1190 | if ( categories.find ( colcat ) != categories.end () ) { |
1190 | categories.remove( colcat ); | 1191 | categories.remove( colcat ); |
1191 | categories.prepend( colcat ); | 1192 | categories.prepend( colcat ); |
1192 | } | 1193 | } |
1193 | } | 1194 | } |
1194 | mActiveItem->todo()->setCategories (categories); | 1195 | mActiveItem->todo()->setCategories (categories); |
1195 | mActiveItem->construct(); | 1196 | mActiveItem->construct(); |
1196 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1197 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1197 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 1198 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
1198 | } | 1199 | } |
1199 | } | 1200 | } |
1200 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1201 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |