summaryrefslogtreecommitdiff
path: root/core/pim/osearch
authortille <tille>2003-05-08 12:16:38 (UTC)
committer tille <tille>2003-05-08 12:16:38 (UTC)
commit763d7d7da84682fb87a631a997e93c08f5abde61 (patch) (unidiff)
tree9cfeb731b793e3634fa751a6b6ffce63609f24a2 /core/pim/osearch
parent9e08dd00a96ffb4141da9f4ce2df0b871b334691 (diff)
downloadopie-763d7d7da84682fb87a631a997e93c08f5abde61.zip
opie-763d7d7da84682fb87a631a997e93c08f5abde61.tar.gz
opie-763d7d7da84682fb87a631a997e93c08f5abde61.tar.bz2
this needs the new libopie patch...
Diffstat (limited to 'core/pim/osearch') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/adresssearch.cpp4
-rw-r--r--core/pim/osearch/contactitem.cpp2
-rw-r--r--core/pim/osearch/datebooksearch.cpp16
-rw-r--r--core/pim/osearch/eventitem.cpp4
-rw-r--r--core/pim/osearch/todoitem.cpp16
-rw-r--r--core/pim/osearch/todoitem.h3
-rw-r--r--core/pim/osearch/todosearch.cpp14
-rw-r--r--core/pim/osearch/todosearch.h2
8 files changed, 43 insertions, 18 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp
index 4b0bd9c..c5b1ae7 100644
--- a/core/pim/osearch/adresssearch.cpp
+++ b/core/pim/osearch/adresssearch.cpp
@@ -28,20 +28,16 @@ AdressSearch::~AdressSearch()
28{ 28{
29 delete _contacts; 29 delete _contacts;
30} 30}
31 31
32 32
33void AdressSearch::expand() 33void AdressSearch::expand()
34{ 34{
35 SearchGroup::expand(); 35 SearchGroup::expand();
36 if (_search.isEmpty()) return; 36 if (_search.isEmpty()) return;
37 if (!_contacts) _contacts = new OContactAccess("osearch"); 37 if (!_contacts) _contacts = new OContactAccess("osearch");
38 ORecordList<OContact> results = _contacts->matchRegexp(_search); 38 ORecordList<OContact> results = _contacts->matchRegexp(_search);
39 for (uint i = 0; i < results.count(); i++) { 39 for (uint i = 0; i < results.count(); i++) {
40 // qDebug("i=%i",i);
41 // OContact rec = results[i];
42 // qDebug("fullname %s",rec.fullName().latin1());
43 //(( new OListViewItem( this, rec.fullName() );
44 new ContactItem( this, new OContact( results[i] )); 40 new ContactItem( this, new OContact( results[i] ));
45 } 41 }
46} 42}
47 43
diff --git a/core/pim/osearch/contactitem.cpp b/core/pim/osearch/contactitem.cpp
index 36e4f00..86879aa 100644
--- a/core/pim/osearch/contactitem.cpp
+++ b/core/pim/osearch/contactitem.cpp
@@ -9,25 +9,25 @@
9// 9//
10// Copyright: See COPYING file that comes with this distribution 10// Copyright: See COPYING file that comes with this distribution
11// 11//
12// 12//
13#include "contactitem.h" 13#include "contactitem.h"
14 14
15#include <opie/ocontact.h> 15#include <opie/ocontact.h>
16 16
17ContactItem::ContactItem(OListViewItem* parent, OContact *contact) 17ContactItem::ContactItem(OListViewItem* parent, OContact *contact)
18: ResultItem(parent) 18: ResultItem(parent)
19{ 19{
20 _contact = contact; 20 _contact = contact;
21 setText(0, _contact->fullName()); 21 setText(0, _contact->toShortText());
22} 22}
23 23
24 24
25ContactItem::~ContactItem() 25ContactItem::~ContactItem()
26{ 26{
27 delete _contact; 27 delete _contact;
28} 28}
29 29
30 30
31QString ContactItem::toRichText() 31QString ContactItem::toRichText()
32{ 32{
33 return _contact->toRichText(); 33 return _contact->toRichText();
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp
index 85c55c2..e60a3b1 100644
--- a/core/pim/osearch/datebooksearch.cpp
+++ b/core/pim/osearch/datebooksearch.cpp
@@ -28,32 +28,36 @@ DatebookSearch::~DatebookSearch()
28{ 28{
29 delete _dates; 29 delete _dates;
30} 30}
31 31
32 32
33void DatebookSearch::expand() 33void DatebookSearch::expand()
34{ 34{
35 SearchGroup::expand(); 35 SearchGroup::expand();
36 if (!_dates){ 36 if (!_dates){
37 _dates = new ODateBookAccess(); 37 _dates = new ODateBookAccess();
38 _dates->load(); 38 _dates->load();
39 } 39 }
40 40#define LIPBOPIE_SEARCH
41#ifdef LIPBOPIE_SEARCH
42 ORecordList<OEvent> results = _dates->matchRegexp(_search);
43 for (uint i = 0; i < results.count(); i++) {
44 new EventItem( this, new OEvent( results[i] ));
45 }
46#else
41 ORecordList<OEvent> list = _dates->allRecords(); 47 ORecordList<OEvent> list = _dates->allRecords();
42 QArray<int> m_currentQuery( list.count() ); 48 QArray<int> m_currentQuery( list.count() );
43 for( uint i=0; i<list.count(); i++ ){ 49 for( uint i=0; i<list.count(); i++ ){
44 50 //qDebug("datebook: %s",list[i].description().latin1() );
45 if ( 51 if (
46 ( list[i].description().contains( _search ) ) || 52 ( list[i].description().contains( _search ) ) ||
47 ( list[i].note().contains( _search ) ) || 53 ( list[i].note().contains( _search ) ) ||
48 ( list[i].location().contains( _search ) ) 54 ( list[i].location().contains( _search ) )
49 // ( _search.find( list[i].description(), 0 ) > 0 ) ||
50 // ( _search.find( list[i].note(), 0 ) > 0 ) ||
51 // ( _search.find( list[i].location(), 0 ) > 0 )
52 ){ 55 ){
56 //qDebug("FOUND");
53 new EventItem( this, new OEvent( list[i] ) ); 57 new EventItem( this, new OEvent( list[i] ) );
54 // new OListViewItem( this, list[i].description() );
55 } 58 }
56 59
57 } 60 }
61#endif
58} 62}
59 63
diff --git a/core/pim/osearch/eventitem.cpp b/core/pim/osearch/eventitem.cpp
index 516a274..bf5b2b9 100644
--- a/core/pim/osearch/eventitem.cpp
+++ b/core/pim/osearch/eventitem.cpp
@@ -10,31 +10,31 @@
10// Copyright: See COPYING file that comes with this distribution 10// Copyright: See COPYING file that comes with this distribution
11// 11//
12// 12//
13#include "eventitem.h" 13#include "eventitem.h"
14 14
15#include <qpe/qcopenvelope_qws.h> 15#include <qpe/qcopenvelope_qws.h>
16#include <opie/oevent.h> 16#include <opie/oevent.h>
17 17
18EventItem::EventItem(OListViewItem* parent, OEvent *event) 18EventItem::EventItem(OListViewItem* parent, OEvent *event)
19 : ResultItem(parent) 19 : ResultItem(parent)
20{ 20{
21 _event = event; 21 _event = event;
22 setText(0, _event->description() ); 22 setText(0, _event->toShortText() );
23} 23}
24 24
25 25
26EventItem::~EventItem() 26EventItem::~EventItem()
27{ 27{
28} 28}
29 29
30 30
31QString EventItem::toRichText() 31QString EventItem::toRichText()
32{ 32{
33 return _event->toRichText(); 33 return _event->toRichText();
34} 34}
35 35
36void EventItem::editItem() 36void EventItem::editItem()
37{ 37{
38 QCopEnvelope e("QPE/Application/datebook", "editEvent(int)"); 38 QCopEnvelope e("QPE/Application/datebook", "editEvent(int)");
39 e << _event->uid(); 39 e << _event->uid();
40} \ No newline at end of file 40}
diff --git a/core/pim/osearch/todoitem.cpp b/core/pim/osearch/todoitem.cpp
index 422a6d8..4ea4586 100644
--- a/core/pim/osearch/todoitem.cpp
+++ b/core/pim/osearch/todoitem.cpp
@@ -4,37 +4,51 @@
4// 4//
5// Description: 5// Description:
6// 6//
7// 7//
8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
9// 9//
10// Copyright: See COPYING file that comes with this distribution 10// Copyright: See COPYING file that comes with this distribution
11// 11//
12// 12//
13#include "todoitem.h" 13#include "todoitem.h"
14 14
15#include <opie/otodo.h> 15#include <opie/otodo.h>
16#include <qpe/qcopenvelope_qws.h>
16 17
17TodoItem::TodoItem(OListViewItem* parent, OTodo *todo) 18TodoItem::TodoItem(OListViewItem* parent, OTodo *todo)
18: ResultItem(parent) 19: ResultItem(parent)
19{ 20{
20 _todo = todo; 21 _todo = todo;
21 setText( 0, todo->summary() ); 22 setText( 0, todo->toShortText() );
22} 23}
23 24
24 25
25TodoItem::~TodoItem() 26TodoItem::~TodoItem()
26{ 27{
27 delete _todo; 28 delete _todo;
28} 29}
29 30
30 31
31void TodoItem::expand() 32void TodoItem::expand()
32{ 33{
33 ResultItem::expand(); 34 ResultItem::expand();
34} 35}
35 36
36QString TodoItem::toRichText() 37QString TodoItem::toRichText()
37{ 38{
38 return _todo->toRichText(); 39 return _todo->toRichText();
39} 40}
40 41
42void TodoItem::showItem()
43{
44 //QCopEnvelope e("QPE/Todolist", "show(int)");
45 qDebug("calling todolist for %i",_todo->uid());
46 QCopEnvelope e("QPE/Todolist", "show(int)");
47 e << _todo->uid();
48}
49
50void TodoItem::editItem()
51{
52 QCopEnvelope e("QPE/Todolist", "edit(int)");
53 e << _todo->uid();
54}
diff --git a/core/pim/osearch/todoitem.h b/core/pim/osearch/todoitem.h
index 1196c68..6f34915 100644
--- a/core/pim/osearch/todoitem.h
+++ b/core/pim/osearch/todoitem.h
@@ -17,21 +17,22 @@
17class OTodo; 17class OTodo;
18 18
19/** 19/**
20@author Patrick S. Vogt 20@author Patrick S. Vogt
21*/ 21*/
22class TodoItem : public ResultItem 22class TodoItem : public ResultItem
23{ 23{
24public: 24public:
25 TodoItem(OListViewItem* parent, OTodo *todo); 25 TodoItem(OListViewItem* parent, OTodo *todo);
26 ~TodoItem(); 26 ~TodoItem();
27 27
28 virtual void expand(); 28 virtual void expand();
29 //virtual int rtti() { return Result;}
30 virtual QString toRichText(); 29 virtual QString toRichText();
30 virtual void showItem();
31 virtual void editItem();
31 32
32private: 33private:
33 OTodo *_todo; 34 OTodo *_todo;
34 35
35}; 36};
36 37
37#endif 38#endif
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp
index e34c384..82fae8d 100644
--- a/core/pim/osearch/todosearch.cpp
+++ b/core/pim/osearch/todosearch.cpp
@@ -26,28 +26,38 @@ TodoSearch::TodoSearch(QListView* parent, QString name)
26} 26}
27 27
28 28
29TodoSearch::~TodoSearch() 29TodoSearch::~TodoSearch()
30{ 30{
31 delete _todos; 31 delete _todos;
32} 32}
33 33
34 34
35void TodoSearch::expand() 35void TodoSearch::expand()
36{ 36{
37 SearchGroup::expand(); 37 SearchGroup::expand();
38 if (!_todos){ 38 if (_search.isEmpty()) return;
39
40 if (!_todos){
39 _todos = new OTodoAccess(); 41 _todos = new OTodoAccess();
40 _todos->load(); 42 _todos->load();
41 } 43 }
44
45 ORecordList<OTodo> results = _todos->matchRegexp(_search);
46 for (uint i = 0; i < results.count(); i++) {
47 new TodoItem( this, new OTodo( results[i] ));
48 }
49/*
42 ORecordList<OTodo> list = _todos->allRecords(); 50 ORecordList<OTodo> list = _todos->allRecords();
43 QArray<int> m_currentQuery( list.count() ); 51 QArray<int> m_currentQuery( list.count() );
44 for( uint i=0; i<list.count(); i++ ){ 52 for( uint i=0; i<list.count(); i++ ){
53 // qDebug("todo: %s",list[i].summary().latin1() );
45 if ( list[i].match( _search ) ){ 54 if ( list[i].match( _search ) ){
55 // qDebug("FOUND");
46 new TodoItem( this, new OTodo( list[i] ) ); 56 new TodoItem( this, new OTodo( list[i] ) );
47 } 57 }
48 58
49 } 59 }*/
50 60
51} 61}
52 62
53 63
diff --git a/core/pim/osearch/todosearch.h b/core/pim/osearch/todosearch.h
index 33c1064..856be1f 100644
--- a/core/pim/osearch/todosearch.h
+++ b/core/pim/osearch/todosearch.h
@@ -4,25 +4,25 @@
4// 4//
5// Description: 5// Description:
6// 6//
7// 7//
8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
9// 9//
10// Copyright: See COPYING file that comes with this distribution 10// Copyright: See COPYING file that comes with this distribution
11// 11//
12// 12//
13#ifndef TODOSEARCH_H 13#ifndef TODOSEARCH_H
14#define TODOSEARCH_H 14#define TODOSEARCH_H
15 15
16#include "filesearch.h" 16#include "searchgroup.h"
17 17
18class OTodoAccess; 18class OTodoAccess;
19 19
20/** 20/**
21@author Patrick S. Vogt 21@author Patrick S. Vogt
22*/ 22*/
23class TodoSearch : public SearchGroup 23class TodoSearch : public SearchGroup
24{ 24{
25public: 25public:
26 TodoSearch(QListView* parent, QString name); 26 TodoSearch(QListView* parent, QString name);
27 27
28 ~TodoSearch(); 28 ~TodoSearch();