author | zautrix <zautrix> | 2005-04-17 17:29:12 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-17 17:29:12 (UTC) |
commit | e3e76014e70643b0828f30f5c5277e212495d37c (patch) (unidiff) | |
tree | 6c1b65d08bbecf7f5d83db636cebe3425b1521e8 | |
parent | 70b45fe97813c4fd336b7ca8fdedab13f9c2e039 (diff) | |
download | kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.zip kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.tar.gz kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.tar.bz2 |
fixes
-rw-r--r-- | korganizer/kolistview.cpp | 13 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 3 | ||||
-rw-r--r-- | libkcal/alarm.cpp | 2 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index e1b393d..a1bf9ff 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -66,134 +66,136 @@ | |||
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | 69 | ||
70 | class KOListViewWhatsThis :public QWhatsThis | 70 | class KOListViewWhatsThis :public QWhatsThis |
71 | { | 71 | { |
72 | public: | 72 | public: |
73 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 73 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
74 | 74 | ||
75 | protected: | 75 | protected: |
76 | virtual QString text( const QPoint& p) | 76 | virtual QString text( const QPoint& p) |
77 | { | 77 | { |
78 | return _view->getWhatsThisText(p) ; | 78 | return _view->getWhatsThisText(p) ; |
79 | } | 79 | } |
80 | private: | 80 | private: |
81 | QWidget* _wid; | 81 | QWidget* _wid; |
82 | KOListView * _view; | 82 | KOListView * _view; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | 85 | ||
86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
87 | { | 87 | { |
88 | mItem = item; | 88 | mItem = item; |
89 | mDate = date; | 89 | mDate = date; |
90 | } | 90 | } |
91 | 91 | ||
92 | ListItemVisitor::~ListItemVisitor() | 92 | ListItemVisitor::~ListItemVisitor() |
93 | { | 93 | { |
94 | } | 94 | } |
95 | 95 | ||
96 | bool ListItemVisitor::visit(Event *e) | 96 | bool ListItemVisitor::visit(Event *e) |
97 | { | 97 | { |
98 | |||
99 | bool ok = false; | 98 | bool ok = false; |
100 | QString start, end; | 99 | QString start, end; |
101 | QDate ds, de; | 100 | QDate ds, de; |
102 | if ( e->doesRecur() ) { | 101 | if ( e->doesRecur() ) { |
103 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); | 102 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); |
104 | if ( ok ) { | 103 | if ( ok ) { |
105 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); | 104 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); |
106 | start = KGlobal::locale()->formatDate(ds,true); | 105 | start = KGlobal::locale()->formatDate(ds,true); |
107 | de = ds.addDays( days); | 106 | de = ds.addDays( days); |
108 | end = KGlobal::locale()->formatDate(de,true); | 107 | end = KGlobal::locale()->formatDate(de,true); |
109 | } | 108 | } |
110 | 109 | ||
111 | } | 110 | } |
112 | if ( ! ok ) { | 111 | if ( ! ok ) { |
113 | start =e->dtStartDateStr(); | 112 | start =e->dtStartDateStr(); |
114 | end = e->dtEndDateStr(); | 113 | end = e->dtEndDateStr(); |
115 | ds = e->dtStart().date(); | 114 | ds = e->dtStart().date(); |
116 | de = e->dtEnd().date(); | 115 | de = e->dtEnd().date(); |
117 | } | 116 | } |
118 | mItem->setText(0,e->summary()); | 117 | mItem->setText(0,e->summary()); |
119 | mItem->setText(1,start); | 118 | mItem->setText(1,start); |
120 | mItem->setText(2,e->dtStartTimeStr()); | 119 | mItem->setText(2,e->dtStartTimeStr()); |
121 | mItem->setText(3,end); | 120 | mItem->setText(3,end); |
122 | mItem->setText(4,e->dtEndTimeStr()); | 121 | mItem->setText(4,e->dtEndTimeStr()); |
123 | if ( e->isAlarmEnabled() ) { | 122 | if ( e->isAlarmEnabled() ) { |
124 | mItem->setText(5,e->alarms().first()->offsetText() ); | 123 | mItem->setText(5,e->alarms().first()->offsetText() ); |
125 | } else { | 124 | } else { |
126 | mItem->setText(5, i18n("No")); | 125 | mItem->setText(5, i18n("No")); |
127 | } | 126 | } |
128 | mItem->setText(6, e->recurrence()->recurrenceText()); | 127 | mItem->setText(6, e->recurrence()->recurrenceText()); |
128 | if( ! e->doesRecur() ) | ||
129 | mItem->setSortKey( 6, "-" ); | ||
129 | mItem->setText(7,"---"); | 130 | mItem->setText(7,"---"); |
130 | mItem->setText(8,"---"); | 131 | mItem->setText(8,"---"); |
131 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 132 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
132 | mItem->setText(10,e->categoriesStr()); | 133 | mItem->setText(10,e->categoriesStr()); |
133 | 134 | ||
134 | QString key; | 135 | QString key; |
135 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 136 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
136 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); | 137 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
137 | mItem->setSortKey(1,key); | 138 | mItem->setSortKey(1,key); |
138 | 139 | ||
139 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 140 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
140 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); | 141 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
141 | mItem->setSortKey(3,key); | 142 | mItem->setSortKey(3,key); |
142 | |||
143 | return true; | 143 | return true; |
144 | } | 144 | } |
145 | 145 | ||
146 | bool ListItemVisitor::visit(Todo *t) | 146 | bool ListItemVisitor::visit(Todo *t) |
147 | { | 147 | { |
148 | mItem->setText(0,i18n("Todo: %1").arg(t->summary())); | 148 | mItem->setText(0,i18n("Todo: %1").arg(t->summary())); |
149 | if (t->hasStartDate()) { | 149 | if (t->hasStartDate()) { |
150 | mItem->setText(1,t->dtStartDateStr()); | 150 | mItem->setText(1,t->dtStartDateStr()); |
151 | if (t->doesFloat()) { | 151 | if (t->doesFloat()) { |
152 | mItem->setText(2,"---"); | 152 | mItem->setText(2,"---"); |
153 | } else { | 153 | } else { |
154 | mItem->setText(2,t->dtStartTimeStr()); | 154 | mItem->setText(2,t->dtStartTimeStr()); |
155 | } | 155 | } |
156 | } else { | 156 | } else { |
157 | mItem->setText(1,"---"); | 157 | mItem->setText(1,"---"); |
158 | mItem->setText(2,"---"); | 158 | mItem->setText(2,"---"); |
159 | } | 159 | } |
160 | mItem->setText(3,"---"); | 160 | mItem->setText(3,"---"); |
161 | mItem->setText(4,"---"); | 161 | mItem->setText(4,"---"); |
162 | if ( t->isAlarmEnabled() ) { | 162 | if ( t->isAlarmEnabled() ) { |
163 | mItem->setText(5,t->alarms().first()->offsetText() ); | 163 | mItem->setText(5,t->alarms().first()->offsetText() ); |
164 | } else { | 164 | } else { |
165 | mItem->setText(5, i18n("No")); | 165 | mItem->setText(5, i18n("No")); |
166 | } | 166 | } |
167 | mItem->setText(6, t->recurrence()->recurrenceText()); | 167 | mItem->setText(6, t->recurrence()->recurrenceText()); |
168 | if( ! t->doesRecur() ) | ||
169 | mItem->setSortKey( 6, "-" ); | ||
168 | if (t->hasDueDate()) { | 170 | if (t->hasDueDate()) { |
169 | mItem->setText(7,t->dtDueDateStr()); | 171 | mItem->setText(7,t->dtDueDateStr()); |
170 | if (t->doesFloat()) { | 172 | if (t->doesFloat()) { |
171 | mItem->setText(8,"---"); | 173 | mItem->setText(8,"---"); |
172 | } else { | 174 | } else { |
173 | mItem->setText(8,t->dtDueTimeStr()); | 175 | mItem->setText(8,t->dtDueTimeStr()); |
174 | } | 176 | } |
175 | } else { | 177 | } else { |
176 | mItem->setText(7,"---"); | 178 | mItem->setText(7,"---"); |
177 | mItem->setText(8,"---"); | 179 | mItem->setText(8,"---"); |
178 | } | 180 | } |
179 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 181 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
180 | mItem->setText(10,t->categoriesStr()); | 182 | mItem->setText(10,t->categoriesStr()); |
181 | 183 | ||
182 | QString key; | 184 | QString key; |
183 | QDate d; | 185 | QDate d; |
184 | if (t->hasDueDate()) { | 186 | if (t->hasDueDate()) { |
185 | d = t->dtDue().date(); | 187 | d = t->dtDue().date(); |
186 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 188 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
187 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 189 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
188 | mItem->setSortKey(7,key); | 190 | mItem->setSortKey(7,key); |
189 | } | 191 | } |
190 | if ( t->hasStartDate() ) { | 192 | if ( t->hasStartDate() ) { |
191 | d = t->dtStart().date(); | 193 | d = t->dtStart().date(); |
192 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 194 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
193 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 195 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
194 | mItem->setSortKey(1,key); | 196 | mItem->setSortKey(1,key); |
195 | } | 197 | } |
196 | return true; | 198 | return true; |
197 | } | 199 | } |
198 | 200 | ||
199 | bool ListItemVisitor::visit(Journal * j) | 201 | bool ListItemVisitor::visit(Journal * j) |
@@ -851,106 +853,107 @@ void KOListView::updateConfig() | |||
851 | 853 | ||
852 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 854 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
853 | updateView(); | 855 | updateView(); |
854 | 856 | ||
855 | } | 857 | } |
856 | void KOListView::setStartDate(const QDate &start) | 858 | void KOListView::setStartDate(const QDate &start) |
857 | { | 859 | { |
858 | mStartDate = start; | 860 | mStartDate = start; |
859 | } | 861 | } |
860 | 862 | ||
861 | void KOListView::showDates(const QDate &start, const QDate &end) | 863 | void KOListView::showDates(const QDate &start, const QDate &end) |
862 | { | 864 | { |
863 | clear(); | 865 | clear(); |
864 | mStartDate = start; | 866 | mStartDate = start; |
865 | QDate date = start; | 867 | QDate date = start; |
866 | QPtrList<Journal> j_list; | 868 | QPtrList<Journal> j_list; |
867 | while( date <= end ) { | 869 | while( date <= end ) { |
868 | addEvents(calendar()->events(date)); | 870 | addEvents(calendar()->events(date)); |
869 | addTodos(calendar()->todos(date)); | 871 | addTodos(calendar()->todos(date)); |
870 | Journal* jo = calendar()->journal(date); | 872 | Journal* jo = calendar()->journal(date); |
871 | if ( jo ) | 873 | if ( jo ) |
872 | j_list.append( jo ); | 874 | j_list.append( jo ); |
873 | date = date.addDays( 1 ); | 875 | date = date.addDays( 1 ); |
874 | } | 876 | } |
875 | addJournals(j_list); | 877 | addJournals(j_list); |
876 | emit incidenceSelected( 0 ); | 878 | emit incidenceSelected( 0 ); |
877 | updateView(); | 879 | updateView(); |
878 | 880 | ||
879 | } | 881 | } |
880 | 882 | ||
881 | void KOListView::addEvents(QPtrList<Event> eventList) | 883 | void KOListView::addEvents(QPtrList<Event> eventList) |
882 | { | 884 | { |
885 | |||
883 | Event *ev; | 886 | Event *ev; |
884 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 887 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
885 | addIncidence(ev); | 888 | addIncidence(ev); |
886 | } | 889 | } |
887 | if ( !mListView->currentItem() ){ | 890 | if ( !mListView->currentItem() ){ |
888 | updateView(); | 891 | updateView(); |
889 | } | 892 | } |
890 | } | 893 | } |
891 | 894 | ||
892 | void KOListView::addTodos(QPtrList<Todo> eventList) | 895 | void KOListView::addTodos(QPtrList<Todo> eventList) |
893 | { | 896 | { |
894 | Todo *ev; | 897 | Todo *ev; |
895 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 898 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
896 | addIncidence(ev); | 899 | addIncidence(ev); |
897 | } | 900 | } |
898 | if ( !mListView->currentItem() ){ | 901 | if ( !mListView->currentItem() ){ |
899 | updateView(); | 902 | updateView(); |
900 | } | 903 | } |
901 | } | 904 | } |
902 | void KOListView::addJournals(QPtrList<Journal> eventList) | 905 | void KOListView::addJournals(QPtrList<Journal> eventList) |
903 | { | 906 | { |
904 | Journal *ev; | 907 | Journal *ev; |
905 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 908 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
906 | addIncidence(ev); | 909 | addIncidence(ev); |
907 | } | 910 | } |
908 | if ( !mListView->currentItem() ){ | 911 | if ( !mListView->currentItem() ){ |
909 | updateView(); | 912 | updateView(); |
910 | } | 913 | } |
911 | } | 914 | } |
912 | 915 | ||
913 | void KOListView::addIncidence(Incidence *incidence) | 916 | void KOListView::addIncidence(Incidence *incidence) |
914 | { | 917 | { |
915 | if ( mUidDict.find( incidence->uid() ) ) return; | 918 | if ( mUidDict.find( incidence->uid() ) ) return; |
916 | 919 | ||
917 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 920 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
918 | mUidDict.insert( incidence->uid(), incidence ); | 921 | mUidDict.insert( incidence->uid(), incidence ); |
919 | |||
920 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); | 922 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); |
921 | ListItemVisitor v(item, mStartDate ); | 923 | ListItemVisitor v(item, mStartDate ); |
922 | if (incidence->accept(v)) return; | 924 | if (incidence->accept(v)) { |
925 | return; | ||
926 | } | ||
923 | else delete item; | 927 | else delete item; |
924 | //qDebug("delete item "); | ||
925 | } | 928 | } |
926 | 929 | ||
927 | void KOListView::showEvents(QPtrList<Event> eventList) | 930 | void KOListView::showEvents(QPtrList<Event> eventList) |
928 | { | 931 | { |
929 | clear(); | 932 | clear(); |
930 | 933 | ||
931 | addEvents(eventList); | 934 | addEvents(eventList); |
932 | 935 | ||
933 | // After new creation of list view no events are selected. | 936 | // After new creation of list view no events are selected. |
934 | emit incidenceSelected( 0 ); | 937 | emit incidenceSelected( 0 ); |
935 | } | 938 | } |
936 | int KOListView::count() | 939 | int KOListView::count() |
937 | { | 940 | { |
938 | return mListView->childCount(); | 941 | return mListView->childCount(); |
939 | } | 942 | } |
940 | 943 | ||
941 | void KOListView::changeEventDisplay(Event *event, int action) | 944 | void KOListView::changeEventDisplay(Event *event, int action) |
942 | { | 945 | { |
943 | KOListViewItem *item; | 946 | KOListViewItem *item; |
944 | 947 | ||
945 | switch(action) { | 948 | switch(action) { |
946 | case KOGlobals::EVENTADDED: | 949 | case KOGlobals::EVENTADDED: |
947 | addIncidence( event ); | 950 | addIncidence( event ); |
948 | break; | 951 | break; |
949 | case KOGlobals::EVENTEDITED: | 952 | case KOGlobals::EVENTEDITED: |
950 | item = getItemForEvent(event); | 953 | item = getItemForEvent(event); |
951 | if (item) { | 954 | if (item) { |
952 | mUidDict.remove( event->uid() ); | 955 | mUidDict.remove( event->uid() ); |
953 | delete item; | 956 | delete item; |
954 | addIncidence( event ); | 957 | addIncidence( event ); |
955 | } | 958 | } |
956 | break; | 959 | break; |
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index de65b53..007d1f3 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -194,72 +194,69 @@ void SearchDialog::updateList() | |||
194 | } | 194 | } |
195 | } | 195 | } |
196 | void SearchDialog::searchTextChanged( const QString &_text ) | 196 | void SearchDialog::searchTextChanged( const QString &_text ) |
197 | { | 197 | { |
198 | #if 0 | 198 | #if 0 |
199 | enableButton( KDialogBase::User1, !_text.isEmpty() ); | 199 | enableButton( KDialogBase::User1, !_text.isEmpty() ); |
200 | #endif | 200 | #endif |
201 | } | 201 | } |
202 | 202 | ||
203 | void SearchDialog::doSearch() | 203 | void SearchDialog::doSearch() |
204 | { | 204 | { |
205 | QRegExp re; | 205 | QRegExp re; |
206 | 206 | ||
207 | re.setWildcard(true); // most people understand these better. | 207 | re.setWildcard(true); // most people understand these better. |
208 | re.setCaseSensitive(false); | 208 | re.setCaseSensitive(false); |
209 | QString st = searchEdit->text(); | 209 | QString st = searchEdit->text(); |
210 | if ( st.right(1) != "*") | 210 | if ( st.right(1) != "*") |
211 | st += "*"; | 211 | st += "*"; |
212 | re.setPattern(st); | 212 | re.setPattern(st); |
213 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { | 213 | if (!mSearchEvent->isChecked() && !mSearchTodo->isChecked() && !mSearchJournal->isChecked() ) { |
214 | KMessageBox::sorry(this, | 214 | KMessageBox::sorry(this, |
215 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); | 215 | i18n("Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals")); |
216 | return; | 216 | return; |
217 | } | 217 | } |
218 | if (!re.isValid() ) { | 218 | if (!re.isValid() ) { |
219 | KMessageBox::sorry(this, | 219 | KMessageBox::sorry(this, |
220 | i18n("Invalid search expression,\ncannot perform " | 220 | i18n("Invalid search expression,\ncannot perform " |
221 | "the search.\nPlease enter a search expression\n" | 221 | "the search.\nPlease enter a search expression\n" |
222 | "using the wildcard characters\n '*' and '?'" | 222 | "using the wildcard characters\n '*' and '?'" |
223 | "where needed.")); | 223 | "where needed.")); |
224 | return; | 224 | return; |
225 | } | 225 | } |
226 | |||
227 | search(re); | 226 | search(re); |
228 | |||
229 | listView->setStartDate( mStartDate->date() ); | 227 | listView->setStartDate( mStartDate->date() ); |
230 | listView->showEvents(mMatchedEvents); | 228 | listView->showEvents(mMatchedEvents); |
231 | listView->addTodos(mMatchedTodos); | 229 | listView->addTodos(mMatchedTodos); |
232 | listView->addJournals(mMatchedJournals); | 230 | listView->addJournals(mMatchedJournals); |
233 | |||
234 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { | 231 | if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { |
235 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); | 232 | setCaption(i18n("No items found. Use '*' and '?' where needed.")); |
236 | } else { | 233 | } else { |
237 | QString mess; | 234 | QString mess; |
238 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); | 235 | mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); |
239 | setCaption( i18n("KO/Pi Find: ") + mess); | 236 | setCaption( i18n("KO/Pi Find: ") + mess); |
240 | 237 | ||
241 | } | 238 | } |
242 | searchEdit->setFocus(); | 239 | searchEdit->setFocus(); |
243 | } | 240 | } |
244 | void SearchDialog::updateConfig() | 241 | void SearchDialog::updateConfig() |
245 | { | 242 | { |
246 | listView->updateConfig(); | 243 | listView->updateConfig(); |
247 | } | 244 | } |
248 | void SearchDialog::updateView() | 245 | void SearchDialog::updateView() |
249 | { | 246 | { |
250 | //qDebug("SearchDialog::updateView() %d ", isVisible()); | 247 | //qDebug("SearchDialog::updateView() %d ", isVisible()); |
251 | QRegExp re; | 248 | QRegExp re; |
252 | re.setWildcard(true); // most people understand these better. | 249 | re.setWildcard(true); // most people understand these better. |
253 | re.setCaseSensitive(false); | 250 | re.setCaseSensitive(false); |
254 | QString st = searchEdit->text(); | 251 | QString st = searchEdit->text(); |
255 | if ( st.right(1) != "*") | 252 | if ( st.right(1) != "*") |
256 | st += "*"; | 253 | st += "*"; |
257 | re.setPattern(st); | 254 | re.setPattern(st); |
258 | if (re.isValid()) { | 255 | if (re.isValid()) { |
259 | search(re); | 256 | search(re); |
260 | } else { | 257 | } else { |
261 | mMatchedEvents.clear(); | 258 | mMatchedEvents.clear(); |
262 | mMatchedTodos.clear(); | 259 | mMatchedTodos.clear(); |
263 | mMatchedJournals.clear(); | 260 | mMatchedJournals.clear(); |
264 | } | 261 | } |
265 | listView->setStartDate( mStartDate->date() ); | 262 | listView->setStartDate( mStartDate->date() ); |
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp index d8f15b5..6de1566 100644 --- a/libkcal/alarm.cpp +++ b/libkcal/alarm.cpp | |||
@@ -329,65 +329,65 @@ QString Alarm::text() const | |||
329 | } | 329 | } |
330 | 330 | ||
331 | void Alarm::setTime(const QDateTime &alarmTime) | 331 | void Alarm::setTime(const QDateTime &alarmTime) |
332 | { | 332 | { |
333 | mAlarmTime = alarmTime; | 333 | mAlarmTime = alarmTime; |
334 | mHasTime = true; | 334 | mHasTime = true; |
335 | 335 | ||
336 | mParent->updated(); | 336 | mParent->updated(); |
337 | } | 337 | } |
338 | int Alarm::offset() | 338 | int Alarm::offset() |
339 | { | 339 | { |
340 | if ( hasTime() ) { | 340 | if ( hasTime() ) { |
341 | if (mParent->type()=="Todo") { | 341 | if (mParent->type()=="Todo") { |
342 | Todo *t = static_cast<Todo*>(mParent); | 342 | Todo *t = static_cast<Todo*>(mParent); |
343 | return t->dtDue().secsTo( mAlarmTime ) ; | 343 | return t->dtDue().secsTo( mAlarmTime ) ; |
344 | } else | 344 | } else |
345 | return mParent->dtStart().secsTo( mAlarmTime ) ; | 345 | return mParent->dtStart().secsTo( mAlarmTime ) ; |
346 | } | 346 | } |
347 | else | 347 | else |
348 | { | 348 | { |
349 | return mOffset.asSeconds(); | 349 | return mOffset.asSeconds(); |
350 | } | 350 | } |
351 | 351 | ||
352 | } | 352 | } |
353 | QString Alarm::offsetText() | 353 | QString Alarm::offsetText() |
354 | { | 354 | { |
355 | int min = -offset()/60; | 355 | int min = -offset()/60; |
356 | int hours = min /60; | 356 | int hours = min /60; |
357 | min = min % 60; | 357 | min = min % 60; |
358 | int days = hours /24; | 358 | int days = hours /24; |
359 | hours = hours % 24; | 359 | hours = hours % 24; |
360 | QString message; | 360 | QString message; |
361 | qDebug("%d %d %d ", days, hours, min ); | 361 | //qDebug("%d %d %d ", days, hours, min ); |
362 | if ( days > 0 ) | 362 | if ( days > 0 ) |
363 | message += i18n("%1d").arg( days ); | 363 | message += i18n("%1d").arg( days ); |
364 | if ( hours > 0 ) { | 364 | if ( hours > 0 ) { |
365 | if ( !message.isEmpty() ) message += "/"; | 365 | if ( !message.isEmpty() ) message += "/"; |
366 | message += i18n("%1h").arg( hours ); | 366 | message += i18n("%1h").arg( hours ); |
367 | } | 367 | } |
368 | if ( min > 0 ) { | 368 | if ( min > 0 ) { |
369 | if ( !message.isEmpty() ) message += "/"; | 369 | if ( !message.isEmpty() ) message += "/"; |
370 | message += i18n("%1min").arg( min ); | 370 | message += i18n("%1min").arg( min ); |
371 | } | 371 | } |
372 | if ( message.isEmpty() ) | 372 | if ( message.isEmpty() ) |
373 | message = i18n("%1min").arg( 0 ); | 373 | message = i18n("%1min").arg( 0 ); |
374 | return message; | 374 | return message; |
375 | } | 375 | } |
376 | 376 | ||
377 | 377 | ||
378 | QDateTime Alarm::time() const | 378 | QDateTime Alarm::time() const |
379 | { | 379 | { |
380 | if ( hasTime() ) | 380 | if ( hasTime() ) |
381 | return mAlarmTime; | 381 | return mAlarmTime; |
382 | else | 382 | else |
383 | { | 383 | { |
384 | if (mParent->type()=="Todo") { | 384 | if (mParent->type()=="Todo") { |
385 | Todo *t = static_cast<Todo*>(mParent); | 385 | Todo *t = static_cast<Todo*>(mParent); |
386 | return mOffset.end( t->dtDue() ); | 386 | return mOffset.end( t->dtDue() ); |
387 | } else if (mEndOffset) { | 387 | } else if (mEndOffset) { |
388 | return mOffset.end( mParent->dtEnd() ); | 388 | return mOffset.end( mParent->dtEnd() ); |
389 | } else { | 389 | } else { |
390 | return mOffset.end( mParent->dtStart() ); | 390 | return mOffset.end( mParent->dtStart() ); |
391 | } | 391 | } |
392 | } | 392 | } |
393 | } | 393 | } |
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 8ae5b46..7d61b7f 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -254,65 +254,65 @@ void KIncidenceFormatter::setTodo(Todo *event ) | |||
254 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 254 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
255 | #else | 255 | #else |
256 | addTag("p",i18n("<b>Created: ") +" </b>"); | 256 | addTag("p",i18n("<b>Created: ") +" </b>"); |
257 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 257 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
258 | #endif | 258 | #endif |
259 | 259 | ||
260 | } | 260 | } |
261 | if ( mModified ) { | 261 | if ( mModified ) { |
262 | #ifdef DESKTOP_VERSION | 262 | #ifdef DESKTOP_VERSION |
263 | addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 263 | addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
264 | #else | 264 | #else |
265 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 265 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
266 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 266 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
267 | #endif | 267 | #endif |
268 | 268 | ||
269 | } | 269 | } |
270 | if ( mDetails ) { | 270 | if ( mDetails ) { |
271 | if (!event->description().isEmpty()) { | 271 | if (!event->description().isEmpty()) { |
272 | addTag("p",i18n("<b>Details: </b>")); | 272 | addTag("p",i18n("<b>Details: </b>")); |
273 | addTag("p",deTag(event->description())); | 273 | addTag("p",deTag(event->description())); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | void KIncidenceFormatter::setJournal(Journal* ) | 278 | void KIncidenceFormatter::setJournal(Journal* ) |
279 | { | 279 | { |
280 | 280 | ||
281 | } | 281 | } |
282 | 282 | ||
283 | void KIncidenceFormatter::formatCategories(Incidence *event) | 283 | void KIncidenceFormatter::formatCategories(Incidence *event) |
284 | { | 284 | { |
285 | if (!event->categoriesStr().isEmpty()) { | 285 | if (!event->categoriesStr().isEmpty()) { |
286 | addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); | 286 | addTag("p",i18n("<b>Categories: </b>")+event->categoriesStrWithSpace() ); |
287 | //mText.append(event->categoriesStr()); | 287 | //mText.append(event->categoriesStr()); |
288 | } | 288 | } |
289 | } | 289 | } |
290 | void KIncidenceFormatter::addTag(const QString & tag,const QString & text) | 290 | void KIncidenceFormatter::addTag(const QString & tag,const QString & text) |
291 | { | 291 | { |
292 | int number=text.contains("\n"); | 292 | int number=text.contains("\n"); |
293 | QString str = "<" + tag + ">"; | 293 | QString str = "<" + tag + ">"; |
294 | QString tmpText=text; | 294 | QString tmpText=text; |
295 | QString tmpStr=str; | 295 | QString tmpStr=str; |
296 | if(number !=-1) | 296 | if(number !=-1) |
297 | { | 297 | { |
298 | if (number > 0) { | 298 | if (number > 0) { |
299 | int pos=0; | 299 | int pos=0; |
300 | QString tmp; | 300 | QString tmp; |
301 | for(int i=0;i<=number;i++) { | 301 | for(int i=0;i<=number;i++) { |
302 | pos=tmpText.find("\n"); | 302 | pos=tmpText.find("\n"); |
303 | tmp=tmpText.left(pos); | 303 | tmp=tmpText.left(pos); |
304 | tmpText=tmpText.right(tmpText.length()-pos-1); | 304 | tmpText=tmpText.right(tmpText.length()-pos-1); |
305 | tmpStr+=tmp+"<br>"; | 305 | tmpStr+=tmp+"<br>"; |
306 | } | 306 | } |
307 | } | 307 | } |
308 | else tmpStr += tmpText; | 308 | else tmpStr += tmpText; |
309 | tmpStr+="</" + tag + ">"; | 309 | tmpStr+="</" + tag + ">"; |
310 | mText.append(tmpStr); | 310 | mText.append(tmpStr); |
311 | } | 311 | } |
312 | else | 312 | else |
313 | { | 313 | { |
314 | str += text + "</" + tag + ">"; | 314 | str += text + "</" + tag + ">"; |
315 | mText.append(str); | 315 | mText.append(str); |
316 | } | 316 | } |
317 | } | 317 | } |
318 | 318 | ||