summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-17 17:29:12 (UTC)
committer zautrix <zautrix>2005-04-17 17:29:12 (UTC)
commite3e76014e70643b0828f30f5c5277e212495d37c (patch) (unidiff)
tree6c1b65d08bbecf7f5d83db636cebe3425b1521e8 /korganizer
parent70b45fe97813c4fd336b7ca8fdedab13f9c2e039 (diff)
downloadkdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.zip
kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.tar.gz
kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp13
-rw-r--r--korganizer/searchdialog.cpp3
2 files changed, 8 insertions, 8 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index e1b393d..a1bf9ff 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -86,25 +86,24 @@ private:
86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 86ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
87{ 87{
88 mItem = item; 88 mItem = item;
89 mDate = date; 89 mDate = date;
90} 90}
91 91
92ListItemVisitor::~ListItemVisitor() 92ListItemVisitor::~ListItemVisitor()
93{ 93{
94} 94}
95 95
96bool ListItemVisitor::visit(Event *e) 96bool 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
@@ -117,38 +116,39 @@ bool ListItemVisitor::visit(Event *e)
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
146bool ListItemVisitor::visit(Todo *t) 146bool 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());
@@ -156,24 +156,26 @@ bool ListItemVisitor::visit(Todo *t)
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"));
@@ -871,24 +873,25 @@ void KOListView::showDates(const QDate &start, const QDate &end)
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
881void KOListView::addEvents(QPtrList<Event> eventList) 883void 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
892void KOListView::addTodos(QPtrList<Todo> eventList) 895void KOListView::addTodos(QPtrList<Todo> eventList)
893{ 896{
894 Todo *ev; 897 Todo *ev;
@@ -907,30 +910,30 @@ void KOListView::addJournals(QPtrList<Journal> eventList)
907 } 910 }
908 if ( !mListView->currentItem() ){ 911 if ( !mListView->currentItem() ){
909 updateView(); 912 updateView();
910 } 913 }
911} 914}
912 915
913void KOListView::addIncidence(Incidence *incidence) 916void 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
927void KOListView::showEvents(QPtrList<Event> eventList) 930void 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}
936int KOListView::count() 939int KOListView::count()
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index de65b53..007d1f3 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -214,32 +214,29 @@ void SearchDialog::doSearch()
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}
244void SearchDialog::updateConfig() 241void SearchDialog::updateConfig()
245{ 242{