author | zautrix <zautrix> | 2005-07-02 18:24:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-02 18:24:42 (UTC) |
commit | 80fe6533cb7d751aa72ae5ad0871a9fb76fb3d0b (patch) (unidiff) | |
tree | 51da32a82f3a9b6feb7e8a4f89df96b1be6e8d08 /korganizer | |
parent | 8eea5713638412f5613be51b339f0452f629705c (diff) | |
download | kdepimpi-80fe6533cb7d751aa72ae5ad0871a9fb76fb3d0b.zip kdepimpi-80fe6533cb7d751aa72ae5ad0871a9fb76fb3d0b.tar.gz kdepimpi-80fe6533cb7d751aa72ae5ad0871a9fb76fb3d0b.tar.bz2 |
fax
-rw-r--r-- | korganizer/koeventpopupmenu.cpp | 173 | ||||
-rw-r--r-- | korganizer/koeventpopupmenu.h | 3 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 20 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 4 |
4 files changed, 121 insertions, 79 deletions
diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp index 90caaf4..41d331a 100644 --- a/korganizer/koeventpopupmenu.cpp +++ b/korganizer/koeventpopupmenu.cpp | |||
@@ -1,168 +1,195 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
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 | 23 | ||
24 | #include <qcursor.h> | 24 | #include <qcursor.h> |
25 | 25 | ||
26 | #include <klocale.h> | 26 | #include <klocale.h> |
27 | #include <kdebug.h> | 27 | #include <kdebug.h> |
28 | #include <kiconloader.h> | 28 | #include <kiconloader.h> |
29 | 29 | ||
30 | #include <libkcal/event.h> | 30 | #include <libkcal/event.h> |
31 | 31 | ||
32 | #include "koeventpopupmenu.h" | 32 | #include "koeventpopupmenu.h" |
33 | #include "koprefs.h" | 33 | #include "koprefs.h" |
34 | 34 | ||
35 | KOEventPopupMenu::KOEventPopupMenu(): QPopupMenu() | 35 | KOEventPopupMenu::KOEventPopupMenu(): QPopupMenu() |
36 | { | 36 | { |
37 | mCurrentIncidence = 0; | 37 | mCurrentIncidence = 0; |
38 | mHasAdditionalItems = false; | 38 | mHasAdditionalItems = false; |
39 | 39 | ||
40 | 40 | ||
41 | mSingleOnlyItems.append( insertItem (i18n("&Show"),this,SLOT(popupShow()))); | 41 | mSingleOnlyItems.append( insertItem (i18n("&Show"),this,SLOT(popupShow()))); |
42 | mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit()))); | 42 | mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit()))); |
43 | mEditOnlyItems.append(insertItem (i18n("&Delete"), | 43 | mEditOnlyItems.append(insertItem (i18n("&Delete"), |
44 | this,SLOT(popupDelete()))); | 44 | this,SLOT(popupDelete()))); |
45 | mEditOnlyItems.append(insertItem (i18n("&Clone..."), | 45 | mEditOnlyItems.append(insertItem (i18n("&Clone..."), |
46 | this,SLOT(popupClone()))); | 46 | this,SLOT(popupClone()))); |
47 | mEditOnlyItems.append(insertItem (i18n("&Move..."), | 47 | mEditOnlyItems.append(insertItem (i18n("&Move..."), |
48 | this,SLOT(popupMove()))); | 48 | this,SLOT(popupMove()))); |
49 | #ifndef DESKTOP_VERSION | 49 | #ifndef DESKTOP_VERSION |
50 | mEditOnlyItems.append(insertItem (i18n("&Beam..."), | 50 | mEditOnlyItems.append(insertItem (i18n("&Beam..."), |
51 | this,SLOT(popupBeam()))); | 51 | this,SLOT(popupBeam()))); |
52 | #endif | 52 | #endif |
53 | mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"), | 53 | mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"), |
54 | this,SLOT(popupCancel()))); | 54 | this,SLOT(popupCancel()))); |
55 | isDisabled = false; | 55 | isDisabled = false; |
56 | mCatPopup = new QPopupMenu ( this ); | 56 | mCatPopup = new QPopupMenu ( this ); |
57 | mCatPopup->setCheckable (true); | 57 | mCatPopup->setCheckable (true); |
58 | connect(mCatPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCatPopup())); | 58 | connect(mCatPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCatPopup())); |
59 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCatPopup( int ))); | 59 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCatPopup( int ))); |
60 | mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup )); | 60 | mCalPopup = new QPopupMenu ( this ); |
61 | QValueList<int>::Iterator it; | 61 | mCalPopup->setCheckable (true); |
62 | for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { | 62 | connect(mCalPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCalPopup())); |
63 | mSingleOnlyItems.append(*it); | 63 | connect(mCalPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCalPopup( int ))); |
64 | } | 64 | mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup )); |
65 | mEditOnlyItems.append(insertItem (i18n("Calendar"),mCalPopup )); | ||
66 | QValueList<int>::Iterator it; | ||
67 | for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { | ||
68 | mSingleOnlyItems.append(*it); | ||
69 | } | ||
65 | 70 | ||
66 | } | 71 | } |
67 | void KOEventPopupMenu::enableDefault( bool enable ) | 72 | void KOEventPopupMenu::enableDefault( bool enable ) |
68 | { | 73 | { |
69 | isDisabled = !enable; | 74 | isDisabled = !enable; |
70 | QValueList<int>::Iterator it; | 75 | QValueList<int>::Iterator it; |
71 | for( it = mSingleOnlyItems.begin(); it != mSingleOnlyItems.end(); ++it ) { | 76 | for( it = mSingleOnlyItems.begin(); it != mSingleOnlyItems.end(); ++it ) { |
72 | setItemEnabled(*it,enable); | 77 | setItemEnabled(*it,enable); |
73 | } | 78 | } |
74 | 79 | ||
75 | } | 80 | } |
76 | 81 | ||
82 | void KOEventPopupMenu::fillCalPopup() // CAL | ||
83 | { | ||
84 | mCalPopup->clear(); | ||
85 | if (!mCurrentIncidence) return; | ||
86 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | ||
87 | while ( kkf ) { | ||
88 | int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); | ||
89 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | ||
90 | mCalPopup->setItemEnabled( index, false ); | ||
91 | mCalPopup->setItemChecked (index, kkf->mCalNumber == mCurrentIncidence->calID()); | ||
92 | kkf = KOPrefs::instance()->mCalendars.next(); | ||
93 | } | ||
94 | } | ||
95 | void KOEventPopupMenu::computeCalPopup( int index ) // CAL | ||
96 | { | ||
97 | if (!mCurrentIncidence) return; | ||
98 | mCurrentIncidence->setCalID( index ); | ||
99 | emit categoryChanged( mCurrentIncidence ); | ||
100 | } | ||
77 | void KOEventPopupMenu::fillCatPopup() | 101 | void KOEventPopupMenu::fillCatPopup() |
78 | { | 102 | { |
79 | mCatPopup->clear(); | 103 | mCatPopup->clear(); |
104 | if (!mCurrentIncidence) return; | ||
80 | QStringList checkedCategories = mCurrentIncidence->categories(); | 105 | QStringList checkedCategories = mCurrentIncidence->categories(); |
81 | int index = 0; | 106 | int index = 0; |
82 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 107 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
83 | it != KOPrefs::instance()->mCustomCategories.end (); | 108 | it != KOPrefs::instance()->mCustomCategories.end (); |
84 | ++it) { | 109 | ++it) { |
85 | mCatPopup->insertItem (*it, index ); | 110 | mCatPopup->insertItem (*it, index ); |
86 | if (checkedCategories.find (*it) != checkedCategories.end ()) { | 111 | if (checkedCategories.find (*it) != checkedCategories.end ()) { |
87 | mCatPopup->setItemChecked (index, true); | 112 | mCatPopup->setItemChecked (index, true); |
88 | } | 113 | } |
89 | ++index; | 114 | ++index; |
90 | } | 115 | } |
91 | } | 116 | } |
92 | void KOEventPopupMenu::computeCatPopup( int index ) | 117 | void KOEventPopupMenu::computeCatPopup( int index ) |
93 | { | 118 | { |
119 | if (!mCurrentIncidence) return; | ||
94 | QStringList categories = mCurrentIncidence->categories(); | 120 | QStringList categories = mCurrentIncidence->categories(); |
95 | QString colcat = categories.first(); | 121 | QString colcat = categories.first(); |
96 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) | 122 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) |
97 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); | 123 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); |
98 | else | 124 | else |
99 | categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); | 125 | categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); |
100 | categories.sort (); | 126 | categories.sort (); |
101 | if ( !colcat.isEmpty() ) { | 127 | if ( !colcat.isEmpty() ) { |
102 | if ( categories.find ( colcat ) != categories.end () ) { | 128 | if ( categories.find ( colcat ) != categories.end () ) { |
103 | categories.remove( colcat ); | 129 | categories.remove( colcat ); |
104 | categories.prepend( colcat ); | 130 | categories.prepend( colcat ); |
105 | } | 131 | } |
106 | } | 132 | } |
107 | mCurrentIncidence->setCategories( categories ); | 133 | mCurrentIncidence->setCategories( categories ); |
108 | emit categoryChanged( mCurrentIncidence ); | 134 | emit categoryChanged( mCurrentIncidence ); |
109 | } | 135 | } |
110 | void KOEventPopupMenu::showIncidencePopup(Incidence *incidence) | 136 | void KOEventPopupMenu::showIncidencePopup(Incidence *incidence) |
111 | { | 137 | { |
112 | mCurrentIncidence = incidence; | 138 | if ( !incidence) return; |
139 | mCurrentIncidence = incidence; | ||
113 | 140 | ||
114 | if (mCurrentIncidence) { | 141 | if (mCurrentIncidence) { |
115 | // Enable/Disabled menu items only valid for editable events. | 142 | // Enable/Disabled menu items only valid for editable events. |
116 | if ( !isDisabled ) { | 143 | if ( !isDisabled ) { |
117 | QValueList<int>::Iterator it; | 144 | QValueList<int>::Iterator it; |
118 | for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { | 145 | for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { |
119 | setItemEnabled(*it,!mCurrentIncidence->isReadOnly()); | 146 | setItemEnabled(*it,!mCurrentIncidence->isReadOnly()); |
120 | } | 147 | } |
121 | } | 148 | } |
122 | popup(QCursor::pos()); | 149 | popup(QCursor::pos()); |
123 | } | 150 | } |
124 | } | 151 | } |
125 | 152 | ||
126 | void KOEventPopupMenu::addAdditionalItem(const QIconSet &icon,const QString &text, | 153 | void KOEventPopupMenu::addAdditionalItem(const QIconSet &icon,const QString &text, |
127 | const QObject *receiver, const char *member, | 154 | const QObject *receiver, const char *member, |
128 | bool editOnly) | 155 | bool editOnly) |
129 | { | 156 | { |
130 | if (!mHasAdditionalItems) { | 157 | if (!mHasAdditionalItems) { |
131 | mHasAdditionalItems = true; | 158 | mHasAdditionalItems = true; |
132 | insertSeparator(); | 159 | insertSeparator(); |
133 | } | 160 | } |
134 | int id = insertItem(icon,text,receiver,member); | 161 | int id = insertItem(icon,text,receiver,member); |
135 | if (editOnly) mEditOnlyItems.append(id); | 162 | if (editOnly) mEditOnlyItems.append(id); |
136 | } | 163 | } |
137 | 164 | ||
138 | void KOEventPopupMenu::popupShow() | 165 | void KOEventPopupMenu::popupShow() |
139 | { | 166 | { |
140 | if (mCurrentIncidence) emit showIncidenceSignal(mCurrentIncidence); | 167 | if (mCurrentIncidence) emit showIncidenceSignal(mCurrentIncidence); |
141 | } | 168 | } |
142 | 169 | ||
143 | void KOEventPopupMenu::popupEdit() | 170 | void KOEventPopupMenu::popupEdit() |
144 | { | 171 | { |
145 | if (mCurrentIncidence) emit editIncidenceSignal(mCurrentIncidence); | 172 | if (mCurrentIncidence) emit editIncidenceSignal(mCurrentIncidence); |
146 | } | 173 | } |
147 | 174 | ||
148 | void KOEventPopupMenu::popupDelete() | 175 | void KOEventPopupMenu::popupDelete() |
149 | { | 176 | { |
150 | if (mCurrentIncidence) emit deleteIncidenceSignal(mCurrentIncidence); | 177 | if (mCurrentIncidence) emit deleteIncidenceSignal(mCurrentIncidence); |
151 | } | 178 | } |
152 | void KOEventPopupMenu::popupClone() | 179 | void KOEventPopupMenu::popupClone() |
153 | { | 180 | { |
154 | if (mCurrentIncidence) emit cloneIncidenceSignal(mCurrentIncidence); | 181 | if (mCurrentIncidence) emit cloneIncidenceSignal(mCurrentIncidence); |
155 | } | 182 | } |
156 | void KOEventPopupMenu::popupCancel() | 183 | void KOEventPopupMenu::popupCancel() |
157 | { | 184 | { |
158 | if (mCurrentIncidence) emit cancelIncidenceSignal(mCurrentIncidence); | 185 | if (mCurrentIncidence) emit cancelIncidenceSignal(mCurrentIncidence); |
159 | } | 186 | } |
160 | void KOEventPopupMenu::popupMove() | 187 | void KOEventPopupMenu::popupMove() |
161 | { | 188 | { |
162 | if (mCurrentIncidence) emit moveIncidenceSignal(mCurrentIncidence); | 189 | if (mCurrentIncidence) emit moveIncidenceSignal(mCurrentIncidence); |
163 | } | 190 | } |
164 | 191 | ||
165 | void KOEventPopupMenu::popupBeam() | 192 | void KOEventPopupMenu::popupBeam() |
166 | { | 193 | { |
167 | if (mCurrentIncidence) emit beamIncidenceSignal(mCurrentIncidence); | 194 | if (mCurrentIncidence) emit beamIncidenceSignal(mCurrentIncidence); |
168 | } | 195 | } |
diff --git a/korganizer/koeventpopupmenu.h b/korganizer/koeventpopupmenu.h index 3d8b595..e28745b 100644 --- a/korganizer/koeventpopupmenu.h +++ b/korganizer/koeventpopupmenu.h | |||
@@ -1,80 +1,83 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
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 KOEVENTPOPUPMENU_H | 23 | #ifndef KOEVENTPOPUPMENU_H |
24 | #define KOEVENTPOPUPMENU_H | 24 | #define KOEVENTPOPUPMENU_H |
25 | // | 25 | // |
26 | // Context menu for event views with standard event actions | 26 | // Context menu for event views with standard event actions |
27 | // | 27 | // |
28 | 28 | ||
29 | #include <qpopupmenu.h> | 29 | #include <qpopupmenu.h> |
30 | 30 | ||
31 | #include <libkcal/incidence.h> | 31 | #include <libkcal/incidence.h> |
32 | 32 | ||
33 | using namespace KCal; | 33 | using namespace KCal; |
34 | 34 | ||
35 | class KOEventPopupMenu : public QPopupMenu { | 35 | class KOEventPopupMenu : public QPopupMenu { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | KOEventPopupMenu(); | 38 | KOEventPopupMenu(); |
39 | 39 | ||
40 | void addAdditionalItem(const QIconSet &icon,const QString &text, | 40 | void addAdditionalItem(const QIconSet &icon,const QString &text, |
41 | const QObject *receiver, const char *member, | 41 | const QObject *receiver, const char *member, |
42 | bool editOnly=false); | 42 | bool editOnly=false); |
43 | 43 | ||
44 | 44 | ||
45 | public slots: | 45 | public slots: |
46 | void showIncidencePopup(Incidence *); | 46 | void showIncidencePopup(Incidence *); |
47 | void enableDefault( bool ); | 47 | void enableDefault( bool ); |
48 | 48 | ||
49 | protected slots: | 49 | protected slots: |
50 | void popupShow(); | 50 | void popupShow(); |
51 | void popupEdit(); | 51 | void popupEdit(); |
52 | void popupDelete(); | 52 | void popupDelete(); |
53 | void popupClone(); | 53 | void popupClone(); |
54 | void popupCancel(); | 54 | void popupCancel(); |
55 | void popupMove(); | 55 | void popupMove(); |
56 | void popupBeam(); | 56 | void popupBeam(); |
57 | void fillCatPopup(); | 57 | void fillCatPopup(); |
58 | void computeCatPopup( int ); | 58 | void computeCatPopup( int ); |
59 | void fillCalPopup(); | ||
60 | void computeCalPopup( int ); | ||
59 | 61 | ||
60 | signals: | 62 | signals: |
61 | void editIncidenceSignal(Incidence *); | 63 | void editIncidenceSignal(Incidence *); |
62 | void showIncidenceSignal(Incidence *); | 64 | void showIncidenceSignal(Incidence *); |
63 | void deleteIncidenceSignal(Incidence *); | 65 | void deleteIncidenceSignal(Incidence *); |
64 | void cloneIncidenceSignal(Incidence *); | 66 | void cloneIncidenceSignal(Incidence *); |
65 | void cancelIncidenceSignal(Incidence *); | 67 | void cancelIncidenceSignal(Incidence *); |
66 | void moveIncidenceSignal(Incidence *); | 68 | void moveIncidenceSignal(Incidence *); |
67 | void beamIncidenceSignal(Incidence *); | 69 | void beamIncidenceSignal(Incidence *); |
68 | void categoryChanged( Incidence * ); | 70 | void categoryChanged( Incidence * ); |
69 | 71 | ||
70 | private: | 72 | private: |
71 | Incidence *mCurrentIncidence; | 73 | Incidence *mCurrentIncidence; |
72 | 74 | ||
73 | bool mHasAdditionalItems; | 75 | bool mHasAdditionalItems; |
74 | QValueList<int> mEditOnlyItems; | 76 | QValueList<int> mEditOnlyItems; |
75 | QValueList<int> mSingleOnlyItems; | 77 | QValueList<int> mSingleOnlyItems; |
76 | bool isDisabled; | 78 | bool isDisabled; |
77 | QPopupMenu *mCatPopup; | 79 | QPopupMenu *mCatPopup; |
80 | QPopupMenu *mCalPopup; | ||
78 | }; | 81 | }; |
79 | 82 | ||
80 | #endif | 83 | #endif |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index db3f802..cdcbbf0 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -179,297 +179,307 @@ bool ListItemVisitor::visit(Todo *t) | |||
179 | mItem->setText(5, i18n("No")); | 179 | mItem->setText(5, i18n("No")); |
180 | } | 180 | } |
181 | mItem->setText(6, t->recurrence()->recurrenceText()); | 181 | mItem->setText(6, t->recurrence()->recurrenceText()); |
182 | if( ! t->doesRecur() ) | 182 | if( ! t->doesRecur() ) |
183 | mItem->setSortKey( 6, "-" ); | 183 | mItem->setSortKey( 6, "-" ); |
184 | if (t->hasDueDate()) { | 184 | if (t->hasDueDate()) { |
185 | mItem->setText(7,t->dtDueDateStr()); | 185 | mItem->setText(7,t->dtDueDateStr()); |
186 | if (t->doesFloat()) { | 186 | if (t->doesFloat()) { |
187 | mItem->setText(8,"---"); | 187 | mItem->setText(8,"---"); |
188 | } else { | 188 | } else { |
189 | mItem->setText(8,t->dtDueTimeStr()); | 189 | mItem->setText(8,t->dtDueTimeStr()); |
190 | } | 190 | } |
191 | } else { | 191 | } else { |
192 | mItem->setText(7,"---"); | 192 | mItem->setText(7,"---"); |
193 | mItem->setText(8,"---"); | 193 | mItem->setText(8,"---"); |
194 | } | 194 | } |
195 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 195 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
196 | mItem->setText(10,t->categoriesStr()); | 196 | mItem->setText(10,t->categoriesStr()); |
197 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); | 197 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); |
198 | 198 | ||
199 | QString key; | 199 | QString key; |
200 | QDate d; | 200 | QDate d; |
201 | if (t->hasDueDate()) { | 201 | if (t->hasDueDate()) { |
202 | d = t->dtDue().date(); | 202 | d = t->dtDue().date(); |
203 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 203 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
204 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 204 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
205 | mItem->setSortKey(7,key); | 205 | mItem->setSortKey(7,key); |
206 | } | 206 | } |
207 | if ( t->hasStartDate() ) { | 207 | if ( t->hasStartDate() ) { |
208 | d = t->dtStart().date(); | 208 | d = t->dtStart().date(); |
209 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 209 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
210 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 210 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
211 | mItem->setSortKey(1,key); | 211 | mItem->setSortKey(1,key); |
212 | } | 212 | } |
213 | return true; | 213 | return true; |
214 | } | 214 | } |
215 | 215 | ||
216 | bool ListItemVisitor::visit(Journal * j) | 216 | bool ListItemVisitor::visit(Journal * j) |
217 | { | 217 | { |
218 | 218 | ||
219 | QString des; | 219 | QString des; |
220 | if ( !j->summary().isEmpty() ) { | 220 | if ( !j->summary().isEmpty() ) { |
221 | des = j->summary(); | 221 | des = j->summary(); |
222 | } else { | 222 | } else { |
223 | des = j->description().left(30); | 223 | des = j->description().left(30); |
224 | des = des.simplifyWhiteSpace (); | 224 | des = des.simplifyWhiteSpace (); |
225 | des.replace (QRegExp ("\\n"),"" ); | 225 | des.replace (QRegExp ("\\n"),"" ); |
226 | des.replace (QRegExp ("\\r"),"" ); | 226 | des.replace (QRegExp ("\\r"),"" ); |
227 | } | 227 | } |
228 | mItem->setText(0,i18n("Journal: ")+des.left(25)); | 228 | mItem->setText(0,i18n("Journal: ")+des.left(25)); |
229 | mItem->setText(1,j->dtStartDateStr()); | 229 | mItem->setText(1,j->dtStartDateStr()); |
230 | mItem->setText(2,"---"); | 230 | mItem->setText(2,"---"); |
231 | mItem->setText(3,"---"); | 231 | mItem->setText(3,"---"); |
232 | mItem->setText(4,"---"); | 232 | mItem->setText(4,"---"); |
233 | mItem->setText(5,"---"); | 233 | mItem->setText(5,"---"); |
234 | mItem->setText(6,"---"); | 234 | mItem->setText(6,"---"); |
235 | mItem->setText(7,j->dtStartDateStr()); | 235 | mItem->setText(7,j->dtStartDateStr()); |
236 | mItem->setText(8,"---"); | 236 | mItem->setText(8,"---"); |
237 | mItem->setText(9,"---"); | 237 | mItem->setText(9,"---"); |
238 | mItem->setText(10,j->categoriesStr()); | 238 | mItem->setText(10,j->categoriesStr()); |
239 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); | 239 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); |
240 | 240 | ||
241 | QString key; | 241 | QString key; |
242 | QDate d = j->dtStart().date(); | 242 | QDate d = j->dtStart().date(); |
243 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 243 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
244 | mItem->setSortKey(1,key); | 244 | mItem->setSortKey(1,key); |
245 | mItem->setSortKey(7,key); | 245 | mItem->setSortKey(7,key); |
246 | 246 | ||
247 | return true; | 247 | return true; |
248 | } | 248 | } |
249 | 249 | ||
250 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 250 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
251 | const char *name) | 251 | const char *name) |
252 | : KOEventView(calendar, parent, name) | 252 | : KOEventView(calendar, parent, name) |
253 | { | 253 | { |
254 | 254 | ||
255 | mActiveItem = 0; | 255 | mActiveItem = 0; |
256 | mForceShowCompletedTodos = false; | 256 | mForceShowCompletedTodos = false; |
257 | mListView = new KOListViewListView(this); | 257 | mListView = new KOListViewListView(this); |
258 | mListView->addColumn(i18n("Summary")); | 258 | mListView->addColumn(i18n("Summary")); |
259 | mListView->addColumn(i18n("Start Date")); | 259 | mListView->addColumn(i18n("Start Date")); |
260 | mListView->addColumn(i18n("Start Time")); | 260 | mListView->addColumn(i18n("Start Time")); |
261 | mListView->addColumn(i18n("End Date")); | 261 | mListView->addColumn(i18n("End Date")); |
262 | mListView->addColumn(i18n("End Time")); | 262 | mListView->addColumn(i18n("End Time")); |
263 | mListView->addColumn(i18n("Alarm")); // alarm set? | 263 | mListView->addColumn(i18n("Alarm")); // alarm set? |
264 | mListView->addColumn(i18n("Recurs")); // recurs? | 264 | mListView->addColumn(i18n("Recurs")); // recurs? |
265 | mListView->addColumn(i18n("Due Date")); | 265 | mListView->addColumn(i18n("Due Date")); |
266 | mListView->addColumn(i18n("Due Time")); | 266 | mListView->addColumn(i18n("Due Time")); |
267 | mListView->addColumn(i18n("Cancelled")); | 267 | mListView->addColumn(i18n("Cancelled")); |
268 | mListView->addColumn(i18n("Categories")); | 268 | mListView->addColumn(i18n("Categories")); |
269 | mListView->addColumn(i18n("Calendar")); | 269 | mListView->addColumn(i18n("Calendar")); |
270 | 270 | ||
271 | mListView->setColumnAlignment(0,AlignLeft); | 271 | mListView->setColumnAlignment(0,AlignLeft); |
272 | mListView->setColumnAlignment(1,AlignLeft); | 272 | mListView->setColumnAlignment(1,AlignLeft); |
273 | mListView->setColumnAlignment(2,AlignHCenter); | 273 | mListView->setColumnAlignment(2,AlignHCenter); |
274 | mListView->setColumnAlignment(3,AlignLeft); | 274 | mListView->setColumnAlignment(3,AlignLeft); |
275 | mListView->setColumnAlignment(4,AlignHCenter); | 275 | mListView->setColumnAlignment(4,AlignHCenter); |
276 | mListView->setColumnAlignment(5,AlignLeft); | 276 | mListView->setColumnAlignment(5,AlignLeft); |
277 | mListView->setColumnAlignment(6,AlignLeft); | 277 | mListView->setColumnAlignment(6,AlignLeft); |
278 | mListView->setColumnAlignment(7,AlignLeft); | 278 | mListView->setColumnAlignment(7,AlignLeft); |
279 | mListView->setColumnAlignment(8,AlignLeft); | 279 | mListView->setColumnAlignment(8,AlignLeft); |
280 | mListView->setColumnAlignment(9,AlignLeft); | 280 | mListView->setColumnAlignment(9,AlignLeft); |
281 | mListView->setColumnAlignment(10,AlignLeft); | 281 | mListView->setColumnAlignment(10,AlignLeft); |
282 | mListView->setColumnAlignment(11,AlignLeft); | 282 | mListView->setColumnAlignment(11,AlignLeft); |
283 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); | 283 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); |
284 | 284 | ||
285 | int iii = 0; | 285 | int iii = 0; |
286 | for ( iii = 0; iii< 12 ; ++iii ) | 286 | for ( iii = 0; iii< 12 ; ++iii ) |
287 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 287 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
288 | 288 | ||
289 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 289 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
290 | layoutTop->addWidget(mListView); | 290 | layoutTop->addWidget(mListView); |
291 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 291 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
292 | mPopupMenu = eventPopup(); | 292 | mPopupMenu = eventPopup(); |
293 | QPopupMenu* selPopup = new QPopupMenu ( this ); | 293 | QPopupMenu* selPopup = new QPopupMenu ( this ); |
294 | mPopupMenu->insertSeparator(); | 294 | mPopupMenu->insertSeparator(); |
295 | 295 | ||
296 | selPopup->insertItem(i18n("All"),this, | 296 | selPopup->insertItem(i18n("All"),this, |
297 | SLOT(allSelection())); | 297 | SLOT(allSelection())); |
298 | selPopup->insertItem(i18n("None"),this, | 298 | selPopup->insertItem(i18n("None"),this, |
299 | SLOT(clearSelection())); | 299 | SLOT(clearSelection())); |
300 | selPopup->insertItem(i18n("Delete selected..."),this, | 300 | selPopup->insertItem(i18n("Delete selected..."),this, |
301 | SLOT(deleteAll())); | 301 | SLOT(deleteAll())); |
302 | mPopupMenu->insertItem(i18n("Selection"), selPopup ); | 302 | mPopupMenu->insertItem(i18n("Selection"), selPopup ); |
303 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 303 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
304 | i18n("Hide all selected"),this, | 304 | i18n("Hide all selected"),this, |
305 | SLOT(hideAll()),true); | 305 | SLOT(hideAll()),true); |
306 | 306 | ||
307 | mPopupMenu->insertSeparator(); | 307 | selPopup->insertSeparator(); |
308 | #ifdef DESKTOP_VERSION | 308 | #ifdef DESKTOP_VERSION |
309 | mPopupMenu->insertSeparator(); | ||
309 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 310 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
310 | i18n("Print complete list"),this, | 311 | i18n("Print complete list"),this, |
311 | SLOT(printList()),true); | 312 | SLOT(printList()),true); |
312 | mPopupMenu->insertSeparator(); | ||
313 | #endif | 313 | #endif |
314 | mCalPopup = new QPopupMenu ( this ); | 314 | mCalPopup = new QPopupMenu ( this ); |
315 | mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup ); | 315 | selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); |
316 | 316 | ||
317 | selPopup->insertItem(i18n("Set categories")+"...",this, | ||
318 | SLOT(setCat()) ); | ||
319 | selPopup->insertItem( i18n("Set alarm..."),this, | ||
320 | SLOT(setAlarm())); | ||
321 | #if 0 | ||
317 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 322 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
318 | i18n("Set categories")+"...",this, | 323 | i18n("Set categories")+"...",this, |
319 | SLOT(setCat()),true); | 324 | SLOT(setCat()),true); |
320 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 325 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
321 | i18n("Set alarm..."),this, | 326 | i18n("Set alarm..."),this, |
322 | SLOT(setAlarm()),true); | 327 | SLOT(setAlarm()),true); |
328 | #endif | ||
323 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, | 329 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, |
324 | SLOT( populateCalPopup() )); | 330 | SLOT( populateCalPopup() )); |
325 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, | 331 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, |
326 | SLOT( setCalendar( int ) )); | 332 | SLOT( setCalendar( int ) )); |
327 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, | 333 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, |
328 | SLOT( catChanged( Incidence * ) )); | 334 | SLOT( catChanged( Incidence * ) )); |
329 | QPopupMenu * exportPO = new QPopupMenu ( this ); | 335 | QPopupMenu * exportPO = new QPopupMenu ( this ); |
330 | mPopupMenu->insertItem( i18n("Export"), exportPO ); | 336 | selPopup->insertItem( i18n("Export"), exportPO ); |
331 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, | 337 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, |
332 | SLOT(saveToFile())); | 338 | SLOT(saveToFile())); |
333 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, | 339 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, |
334 | SLOT(saveToFileVCS())); | 340 | SLOT(saveToFileVCS())); |
335 | exportPO->insertItem( i18n("Journal/Details..."),this, | 341 | exportPO->insertItem( i18n("Journal/Details..."),this, |
336 | SLOT(saveDescriptionToFile())); | 342 | SLOT(saveDescriptionToFile())); |
337 | // mPopupMenu->insertSeparator(); | 343 | // mPopupMenu->insertSeparator(); |
338 | // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 344 | // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
339 | // i18n("Add Categ. to selected..."),this, | 345 | // i18n("Add Categ. to selected..."),this, |
340 | // SLOT(addCat()),true); | 346 | // SLOT(addCat()),true); |
341 | //mPopupMenu->insertSeparator(); | 347 | //mPopupMenu->insertSeparator(); |
342 | #ifndef DESKTOP_VERSION | 348 | #ifndef DESKTOP_VERSION |
343 | mPopupMenu->insertSeparator(); | 349 | selPopup->insertSeparator(); |
350 | selPopup->insertItem( i18n("Beam via IR"),this, | ||
351 | SLOT(beamSelected())); | ||
352 | #if 0 | ||
344 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 353 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
345 | i18n("Beam via IR"),this, | 354 | i18n("Beam via IR"),this, |
346 | SLOT(beamSelected()),true); | 355 | SLOT(beamSelected()),true); |
347 | #endif | 356 | #endif |
357 | #endif | ||
348 | /* | 358 | /* |
349 | mPopupMenu = new QPopupMenu; | 359 | mPopupMenu = new QPopupMenu; |
350 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 360 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
351 | SLOT (editEvent())); | 361 | SLOT (editEvent())); |
352 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 362 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
353 | SLOT (deleteEvent())); | 363 | SLOT (deleteEvent())); |
354 | mPopupMenu->insertSeparator(); | 364 | mPopupMenu->insertSeparator(); |
355 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 365 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
356 | SLOT(showDates())); | 366 | SLOT(showDates())); |
357 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 367 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
358 | SLOT(hideDates())); | 368 | SLOT(hideDates())); |
359 | */ | 369 | */ |
360 | QObject::connect(mListView,SIGNAL( newEvent()), | 370 | QObject::connect(mListView,SIGNAL( newEvent()), |
361 | this,SIGNAL(signalNewEvent())); | 371 | this,SIGNAL(signalNewEvent())); |
362 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 372 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
363 | this,SLOT(defaultItemAction(QListViewItem *))); | 373 | this,SLOT(defaultItemAction(QListViewItem *))); |
364 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, | 374 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, |
365 | const QPoint &, int )), | 375 | const QPoint &, int )), |
366 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 376 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); |
367 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 377 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), |
368 | SLOT(processSelectionChange(QListViewItem *))); | 378 | SLOT(processSelectionChange(QListViewItem *))); |
369 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 379 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
370 | SIGNAL(showIncidenceSignal(Incidence *)) ); | 380 | SIGNAL(showIncidenceSignal(Incidence *)) ); |
371 | 381 | ||
372 | readSettings(KOGlobals::config(),"KOListView Layout"); | 382 | readSettings(KOGlobals::config(),"KOListView Layout"); |
373 | } | 383 | } |
374 | 384 | ||
375 | KOListView::~KOListView() | 385 | KOListView::~KOListView() |
376 | { | 386 | { |
377 | delete mPopupMenu; | 387 | delete mPopupMenu; |
378 | #if QT_VERSION >= 0x030000 | 388 | #if QT_VERSION >= 0x030000 |
379 | 389 | ||
380 | #else | 390 | #else |
381 | delete mKOListViewWhatsThis; | 391 | delete mKOListViewWhatsThis; |
382 | #endif | 392 | #endif |
383 | } | 393 | } |
384 | 394 | ||
385 | void KOListView::catChanged( Incidence* inc) | 395 | void KOListView::catChanged( Incidence* inc) |
386 | { | 396 | { |
387 | KOListViewItem* item = getItemForEvent(inc); | 397 | KOListViewItem* item = getItemForEvent(inc); |
388 | if (item) { | 398 | if (item) { |
389 | ListItemVisitor v(item, mStartDate ); | 399 | ListItemVisitor v(item, mStartDate ); |
390 | inc->accept(v); | 400 | inc->accept(v); |
391 | } | 401 | } |
392 | } | 402 | } |
393 | QString KOListView::getWhatsThisText(QPoint p) | 403 | QString KOListView::getWhatsThisText(QPoint p) |
394 | { | 404 | { |
395 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); | 405 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); |
396 | if ( item ) | 406 | if ( item ) |
397 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), | 407 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), |
398 | KOPrefs::instance()->mWTshowDetails, | 408 | KOPrefs::instance()->mWTshowDetails, |
399 | KOPrefs::instance()->mWTshowCreated, | 409 | KOPrefs::instance()->mWTshowCreated, |
400 | KOPrefs::instance()->mWTshowChanged); | 410 | KOPrefs::instance()->mWTshowChanged); |
401 | return i18n("That is the list view" ); | 411 | return i18n("That is the list view" ); |
402 | 412 | ||
403 | } | 413 | } |
404 | 414 | ||
405 | void KOListView::setCalendar( int c ) | 415 | void KOListView::setCalendar( int c ) |
406 | { | 416 | { |
407 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 417 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
408 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), | 418 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), |
409 | i18n("Continue"), i18n("Cancel"), 0, | 419 | i18n("Continue"), i18n("Cancel"), 0, |
410 | 0, 1 ); | 420 | 0, 1 ); |
411 | if ( result != 0 ) { | 421 | if ( result != 0 ) { |
412 | return; | 422 | return; |
413 | } | 423 | } |
414 | 424 | ||
415 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 425 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
416 | int icount = delSel.count(); | 426 | int icount = delSel.count(); |
417 | if ( icount ) { | 427 | if ( icount ) { |
418 | Incidence *incidence = delSel.first(); | 428 | Incidence *incidence = delSel.first(); |
419 | while ( incidence ) { | 429 | while ( incidence ) { |
420 | incidence->setCalID( c ); | 430 | incidence->setCalID( c ); |
421 | KOListViewItem * item = getItemForEvent( incidence ); | 431 | KOListViewItem * item = getItemForEvent( incidence ); |
422 | if ( item ) { | 432 | if ( item ) { |
423 | ListItemVisitor v(item, mStartDate ); | 433 | ListItemVisitor v(item, mStartDate ); |
424 | incidence->accept(v); | 434 | incidence->accept(v); |
425 | } | 435 | } |
426 | incidence = delSel.next(); | 436 | incidence = delSel.next(); |
427 | } | 437 | } |
428 | } | 438 | } |
429 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 439 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
430 | KopiCalendarFile * cal = calendars.first(); | 440 | KopiCalendarFile * cal = calendars.first(); |
431 | while ( cal ) { | 441 | while ( cal ) { |
432 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 442 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
433 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 443 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
434 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 444 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
435 | if ( cal->isStandard ) | 445 | if ( cal->isStandard ) |
436 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 446 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
437 | cal = calendars.next(); | 447 | cal = calendars.next(); |
438 | } | 448 | } |
439 | mCalendar->setSyncEventsReadOnly(); | 449 | mCalendar->setSyncEventsReadOnly(); |
440 | mCalendar->reInitAlarmSettings(); | 450 | mCalendar->reInitAlarmSettings(); |
441 | 451 | ||
442 | } | 452 | } |
443 | void KOListView::populateCalPopup() | 453 | void KOListView::populateCalPopup() |
444 | { | 454 | { |
445 | mCalPopup->clear(); | 455 | mCalPopup->clear(); |
446 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 456 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
447 | while ( kkf ) { | 457 | while ( kkf ) { |
448 | int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); | 458 | int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); |
449 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | 459 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) |
450 | mCalPopup->setItemEnabled( index, false ); | 460 | mCalPopup->setItemEnabled( index, false ); |
451 | kkf = KOPrefs::instance()->mCalendars.next(); | 461 | kkf = KOPrefs::instance()->mCalendars.next(); |
452 | } | 462 | } |
453 | } | 463 | } |
454 | void KOListView::updateList() | 464 | void KOListView::updateList() |
455 | { | 465 | { |
456 | // qDebug(" KOListView::updateList() "); | 466 | // qDebug(" KOListView::updateList() "); |
457 | 467 | ||
458 | } | 468 | } |
459 | 469 | ||
460 | void KOListView::clearList() | 470 | void KOListView::clearList() |
461 | { | 471 | { |
462 | clear (); | 472 | clear (); |
463 | } | 473 | } |
464 | 474 | ||
465 | void KOListView::setCat() | 475 | void KOListView::setCat() |
466 | { | 476 | { |
467 | 477 | ||
468 | bool set = true; | 478 | bool set = true; |
469 | int result = KMessageBox::warningYesNoCancel(this, | 479 | int result = KMessageBox::warningYesNoCancel(this, |
470 | i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), | 480 | i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), |
471 | i18n("Set categories"), | 481 | i18n("Set categories"), |
472 | i18n("Add"), | 482 | i18n("Add"), |
473 | i18n("Reset")); | 483 | i18n("Reset")); |
474 | if (result == KMessageBox::Cancel) return; | 484 | if (result == KMessageBox::Cancel) return; |
475 | if (result == KMessageBox::Yes) set = false; | 485 | if (result == KMessageBox::Yes) set = false; |
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index d0865c3..efe8774 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -1,255 +1,257 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1998 Preston Brown | 3 | Copyright (c) 1998 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qcheckbox.h> | 26 | #include <qcheckbox.h> |
27 | #include <qgroupbox.h> | 27 | #include <qgroupbox.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlistview.h> | 29 | #include <qlistview.h> |
30 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qhbuttongroup.h> | 33 | #include <qhbuttongroup.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | 36 | ||
37 | #include <libkdepim/kdateedit.h> | 37 | #include <libkdepim/kdateedit.h> |
38 | 38 | ||
39 | #include "koglobals.h" | 39 | #include "koglobals.h" |
40 | #include "koprefs.h" | 40 | #include "koprefs.h" |
41 | #include "klineedit.h" | 41 | #include "klineedit.h" |
42 | 42 | ||
43 | #include "calendarview.h" | 43 | #include "calendarview.h" |
44 | #include "koviewmanager.h" | 44 | #include "koviewmanager.h" |
45 | #include "searchdialog.h" | 45 | #include "searchdialog.h" |
46 | 46 | ||
47 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) | 47 | SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) |
48 | : QVBox( 0 ) | 48 | : QVBox( 0 ) |
49 | 49 | ||
50 | { | 50 | { |
51 | mCalendar = calendar; | 51 | mCalendar = calendar; |
52 | QFrame *topFrame = new QFrame( this ) ;//plainPage(); | 52 | QFrame *topFrame = new QFrame( this ) ;//plainPage(); |
53 | QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); | 53 | QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); |
54 | 54 | ||
55 | // Search expression | 55 | // Search expression |
56 | QHBoxLayout *subLayout = new QHBoxLayout(); | 56 | QHBoxLayout *subLayout = new QHBoxLayout(); |
57 | layout->addLayout(subLayout); | 57 | layout->addLayout(subLayout); |
58 | /* | 58 | /* |
59 | searchLabel = new QLabel(topFrame); | 59 | searchLabel = new QLabel(topFrame); |
60 | searchLabel->setText(i18n("Search for:")); | 60 | searchLabel->setText(i18n("Search for:")); |
61 | subLayout->addWidget(searchLabel); | 61 | subLayout->addWidget(searchLabel); |
62 | */ | 62 | */ |
63 | QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame ); | 63 | QPushButton *OkButton = new QPushButton( i18n("Search for:"), topFrame ); |
64 | //OkButton->setDefault( true ); | 64 | //OkButton->setDefault( true ); |
65 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); | 65 | connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); |
66 | subLayout->addWidget(OkButton); | 66 | subLayout->addWidget(OkButton); |
67 | searchEdit = new KLineEdit(topFrame); | 67 | searchEdit = new KLineEdit(topFrame); |
68 | subLayout->addWidget(searchEdit); | 68 | subLayout->addWidget(searchEdit); |
69 | 69 | ||
70 | mAddItems = new QRadioButton( "+ ", topFrame ); | 70 | mAddItems = new QRadioButton( "+ ", topFrame ); |
71 | mSubItems = new QRadioButton( "- ", topFrame ); | 71 | mSubItems = new QRadioButton( "- ", topFrame ); |
72 | mRefineItems = new QRadioButton( "< ", topFrame ); | 72 | mRefineItems = new QRadioButton( "< ", topFrame ); |
73 | subLayout->addWidget( mAddItems ); | 73 | subLayout->addWidget( mAddItems ); |
74 | subLayout->addWidget( mSubItems ); | 74 | subLayout->addWidget( mSubItems ); |
75 | subLayout->addWidget( mRefineItems ); | 75 | subLayout->addWidget( mRefineItems ); |
76 | QFont fo ( mAddItems->font() ); | 76 | QFont fo ( mAddItems->font() ); |
77 | fo.setBold( true ); | 77 | fo.setBold( true ); |
78 | fo.setPointSize( fo.pointSize() + 2 ); | 78 | fo.setPointSize( fo.pointSize() + 2 ); |
79 | mAddItems->setFont( fo ); | 79 | mAddItems->setFont( fo ); |
80 | mSubItems->setFont( fo ); | 80 | mSubItems->setFont( fo ); |
81 | mRefineItems->setFont( fo ); | 81 | mRefineItems->setFont( fo ); |
82 | connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); | 82 | connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); |
83 | connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); | 83 | connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); |
84 | connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); | 84 | connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); |
85 | 85 | ||
86 | QPushButton *togButton = new QPushButton( "", topFrame ); | 86 | QPushButton *togButton = new QPushButton( "", topFrame ); |
87 | subLayout->addWidget(togButton); | 87 | subLayout->addWidget(togButton); |
88 | connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); | 88 | connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); |
89 | togButton->setPixmap(SmallIcon("1updownarrow")); | 89 | togButton->setPixmap(SmallIcon("1updownarrow")); |
90 | togButton->setMinimumWidth( togButton->sizeHint().height() ); | 90 | togButton->setMinimumWidth( togButton->sizeHint().height() ); |
91 | 91 | ||
92 | searchEdit->setText("*"); // Find all events by default | 92 | searchEdit->setText("*"); // Find all events by default |
93 | searchEdit->setFocus(); | 93 | searchEdit->setFocus(); |
94 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); | 94 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); |
95 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); | 95 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); |
96 | // Subjects to search | 96 | // Subjects to search |
97 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), | 97 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), |
98 | // topFrame); | 98 | // topFrame); |
99 | 99 | ||
100 | incidenceGroup = new QHBox( topFrame ); | 100 | incidenceGroup = new QHBox( topFrame ); |
101 | layout->addWidget(incidenceGroup); | 101 | layout->addWidget(incidenceGroup); |
102 | 102 | ||
103 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); | 103 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); |
104 | //mSearchEvent->setChecked(true); | 104 | //mSearchEvent->setChecked(true); |
105 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); | 105 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); |
106 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); | 106 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); |
107 | 107 | ||
108 | subjectGroup = new QHBox( topFrame ); | 108 | subjectGroup = new QHBox( topFrame ); |
109 | layout->addWidget(subjectGroup); | 109 | layout->addWidget(subjectGroup); |
110 | 110 | ||
111 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); | 111 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); |
112 | mSummaryCheck->setChecked(true); | 112 | mSummaryCheck->setChecked(true); |
113 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); | 113 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); |
114 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); | 114 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); |
115 | 115 | ||
116 | attendeeGroup = new QHBox( topFrame ); | 116 | attendeeGroup = new QHBox( topFrame ); |
117 | layout->addWidget(attendeeGroup ); | 117 | layout->addWidget(attendeeGroup ); |
118 | new QLabel( i18n("Attendee:"),attendeeGroup ); | 118 | new QLabel( i18n("Attendee:"),attendeeGroup ); |
119 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); | 119 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); |
120 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); | 120 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); |
121 | // Date range | 121 | // Date range |
122 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), | 122 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), |
123 | // topFrame); | 123 | // topFrame); |
124 | // layout->addWidget(rangeGroup); | 124 | // layout->addWidget(rangeGroup); |
125 | 125 | ||
126 | QWidget *rangeWidget = new QWidget(topFrame); | 126 | QWidget *rangeWidget = new QWidget(topFrame); |
127 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()-3); | 127 | int space = KDialog::spacingHint(); |
128 | if ( QApplication::desktop()->width() <= 240 ) space = 1; | ||
129 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,space); | ||
128 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); | 130 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); |
129 | mStartDate = new KDateEdit(rangeWidget); | 131 | mStartDate = new KDateEdit(rangeWidget); |
130 | rangeLayout->addWidget(mStartDate); | 132 | rangeLayout->addWidget(mStartDate); |
131 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); | 133 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); |
132 | mEndDate = new KDateEdit(rangeWidget); | 134 | mEndDate = new KDateEdit(rangeWidget); |
133 | mEndDate->setDate(QDate::currentDate().addDays(365)); | 135 | mEndDate->setDate(QDate::currentDate().addDays(365)); |
134 | rangeLayout->addWidget(mEndDate); | 136 | rangeLayout->addWidget(mEndDate); |
135 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); | 137 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); |
136 | rangeLayout->addWidget( (QWidget*)wt ); | 138 | rangeLayout->addWidget( (QWidget*)wt ); |
137 | layout->addWidget(rangeWidget); | 139 | layout->addWidget(rangeWidget); |
138 | // Results list view | 140 | // Results list view |
139 | listView = new KOListView(mCalendar,topFrame); | 141 | listView = new KOListView(mCalendar,topFrame); |
140 | layout->addWidget(listView); | 142 | layout->addWidget(listView); |
141 | listView->showCompletedTodos(); | 143 | listView->showCompletedTodos(); |
142 | //layout->setStretchFactor( listView, 333 ); | 144 | //layout->setStretchFactor( listView, 333 ); |
143 | //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); | 145 | //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); |
144 | //listView->setMaximumHeight( 50 ); | 146 | //listView->setMaximumHeight( 50 ); |
145 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); | 147 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); |
146 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); | 148 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); |
147 | 149 | ||
148 | setCaption( i18n("KO/Pi Find: ")); | 150 | setCaption( i18n("KO/Pi Find: ")); |
149 | #ifdef DESKTOP_VERSION | 151 | #ifdef DESKTOP_VERSION |
150 | OkButton = new QPushButton( i18n("Close"), this ); | 152 | OkButton = new QPushButton( i18n("Close"), this ); |
151 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); | 153 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); |
152 | #endif | 154 | #endif |
153 | } | 155 | } |
154 | 156 | ||
155 | SearchDialog::~SearchDialog() | 157 | SearchDialog::~SearchDialog() |
156 | { | 158 | { |
157 | 159 | ||
158 | } | 160 | } |
159 | void SearchDialog::slot_add( bool b ) | 161 | void SearchDialog::slot_add( bool b ) |
160 | { | 162 | { |
161 | if ( b ) { | 163 | if ( b ) { |
162 | if ( mSubItems->isOn() ) mSubItems->toggle(); | 164 | if ( mSubItems->isOn() ) mSubItems->toggle(); |
163 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); | 165 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); |
164 | setCaption( i18n("Matching items will be added to list")); | 166 | setCaption( i18n("Matching items will be added to list")); |
165 | } else | 167 | } else |
166 | setCaption( i18n("List will be cleared before search")); | 168 | setCaption( i18n("List will be cleared before search")); |
167 | } | 169 | } |
168 | void SearchDialog::slot_sub( bool b) | 170 | void SearchDialog::slot_sub( bool b) |
169 | { | 171 | { |
170 | if ( b ) { | 172 | if ( b ) { |
171 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); | 173 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); |
172 | if ( mAddItems->isOn() ) mAddItems->toggle(); | 174 | if ( mAddItems->isOn() ) mAddItems->toggle(); |
173 | setCaption( i18n("Matching items will be removed from list")); | 175 | setCaption( i18n("Matching items will be removed from list")); |
174 | } else | 176 | } else |
175 | setCaption( i18n("List will be cleared before search")); | 177 | setCaption( i18n("List will be cleared before search")); |
176 | } | 178 | } |
177 | void SearchDialog::slot_refine( bool b) | 179 | void SearchDialog::slot_refine( bool b) |
178 | { | 180 | { |
179 | if ( b ) { | 181 | if ( b ) { |
180 | if ( mSubItems->isOn() ) mSubItems->toggle(); | 182 | if ( mSubItems->isOn() ) mSubItems->toggle(); |
181 | if ( mAddItems->isOn() ) mAddItems->toggle(); | 183 | if ( mAddItems->isOn() ) mAddItems->toggle(); |
182 | setCaption( i18n("Search on displayed list only")); | 184 | setCaption( i18n("Search on displayed list only")); |
183 | } else | 185 | } else |
184 | setCaption( i18n("List will be cleared before search")); | 186 | setCaption( i18n("List will be cleared before search")); |
185 | } | 187 | } |
186 | void SearchDialog::toggleCheckboxes() | 188 | void SearchDialog::toggleCheckboxes() |
187 | { | 189 | { |
188 | if ( incidenceGroup->isVisible() ) { | 190 | if ( incidenceGroup->isVisible() ) { |
189 | incidenceGroup->hide() ; | 191 | incidenceGroup->hide() ; |
190 | subjectGroup->hide() ; | 192 | subjectGroup->hide() ; |
191 | attendeeGroup->hide() ; | 193 | attendeeGroup->hide() ; |
192 | } else { | 194 | } else { |
193 | incidenceGroup->show() ; | 195 | incidenceGroup->show() ; |
194 | subjectGroup->show() ; | 196 | subjectGroup->show() ; |
195 | attendeeGroup->show() ; | 197 | attendeeGroup->show() ; |
196 | } | 198 | } |
197 | } | 199 | } |
198 | void SearchDialog::raiseAndSelect() | 200 | void SearchDialog::raiseAndSelect() |
199 | { | 201 | { |
200 | 202 | ||
201 | static int currentState = 0; | 203 | static int currentState = 0; |
202 | 204 | ||
203 | if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) | 205 | if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) |
204 | currentState = 0; | 206 | currentState = 0; |
205 | int newState = 0; | 207 | int newState = 0; |
206 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 208 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
207 | newState = VIEW_J_VIEW; | 209 | newState = VIEW_J_VIEW; |
208 | } | 210 | } |
209 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 211 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
210 | newState = VIEW_T_VIEW; | 212 | newState = VIEW_T_VIEW; |
211 | } | 213 | } |
212 | else { | 214 | else { |
213 | newState = VIEW_A_VIEW; | 215 | newState = VIEW_A_VIEW; |
214 | } | 216 | } |
215 | if ( newState != currentState ) { | 217 | if ( newState != currentState ) { |
216 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { | 218 | if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { |
217 | if ( ! mSearchJournal->isChecked() ) { | 219 | if ( ! mSearchJournal->isChecked() ) { |
218 | mSearchJournal->setChecked( true ); | 220 | mSearchJournal->setChecked( true ); |
219 | mSearchTodo->setChecked( false ); | 221 | mSearchTodo->setChecked( false ); |
220 | mSearchEvent->setChecked( false ); | 222 | mSearchEvent->setChecked( false ); |
221 | mSummaryCheck->setChecked( true ); | 223 | mSummaryCheck->setChecked( true ); |
222 | mDescriptionCheck->setChecked( true ); | 224 | mDescriptionCheck->setChecked( true ); |
223 | 225 | ||
224 | } | 226 | } |
225 | } | 227 | } |
226 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { | 228 | else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { |
227 | if ( ! mSearchTodo->isChecked() ) { | 229 | if ( ! mSearchTodo->isChecked() ) { |
228 | mSearchTodo->setChecked( true ); | 230 | mSearchTodo->setChecked( true ); |
229 | mSearchJournal->setChecked( false ); | 231 | mSearchJournal->setChecked( false ); |
230 | mSearchEvent->setChecked( false ); | 232 | mSearchEvent->setChecked( false ); |
231 | } | 233 | } |
232 | } | 234 | } |
233 | else { | 235 | else { |
234 | if ( ! mSearchEvent->isChecked() ) { | 236 | if ( ! mSearchEvent->isChecked() ) { |
235 | mSearchEvent->setChecked( true ); | 237 | mSearchEvent->setChecked( true ); |
236 | mSearchJournal->setChecked( false ); | 238 | mSearchJournal->setChecked( false ); |
237 | mSearchTodo->setChecked( false ); | 239 | mSearchTodo->setChecked( false ); |
238 | } | 240 | } |
239 | } | 241 | } |
240 | } | 242 | } |
241 | currentState = newState; | 243 | currentState = newState; |
242 | raise(); | 244 | raise(); |
243 | } | 245 | } |
244 | void SearchDialog::setFocusToList() | 246 | void SearchDialog::setFocusToList() |
245 | { | 247 | { |
246 | listView->resetFocus(); | 248 | listView->resetFocus(); |
247 | } | 249 | } |
248 | void SearchDialog::accept() | 250 | void SearchDialog::accept() |
249 | { | 251 | { |
250 | doSearch(); | 252 | doSearch(); |
251 | } | 253 | } |
252 | void SearchDialog::updateList() | 254 | void SearchDialog::updateList() |
253 | { | 255 | { |
254 | //listView->updateList(); | 256 | //listView->updateList(); |
255 | if ( isVisible() ) { | 257 | if ( isVisible() ) { |