summaryrefslogtreecommitdiff
authortille <tille>2003-05-07 12:36:02 (UTC)
committer tille <tille>2003-05-07 12:36:02 (UTC)
commitb8a79edda20f0b764c8d70fb664f21fb80b61299 (patch) (side-by-side diff)
treed5a939395540c7e77fd0f50be0269c2a4537dba6
parentf9cc1ea78086e7df714a34412bbccdbd5c31f62f (diff)
downloadopie-b8a79edda20f0b764c8d70fb664f21fb80b61299.zip
opie-b8a79edda20f0b764c8d70fb664f21fb80b61299.tar.gz
opie-b8a79edda20f0b764c8d70fb664f21fb80b61299.tar.bz2
initial import
searches contacts, todos and events not much more yet
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/osearch/adresssearch.cpp47
-rw-r--r--core/pim/osearch/adresssearch.h38
-rw-r--r--core/pim/osearch/config.in4
-rw-r--r--core/pim/osearch/contactitem.cpp35
-rw-r--r--core/pim/osearch/contactitem.h37
-rw-r--r--core/pim/osearch/datebooksearch.cpp59
-rw-r--r--core/pim/osearch/datebooksearch.h36
-rw-r--r--core/pim/osearch/eventitem.cpp40
-rw-r--r--core/pim/osearch/eventitem.h38
-rw-r--r--core/pim/osearch/main.cpp14
-rw-r--r--core/pim/osearch/mainwindow.cpp177
-rw-r--r--core/pim/osearch/mainwindow.h69
-rw-r--r--core/pim/osearch/olistview.cpp35
-rw-r--r--core/pim/osearch/olistview.h30
-rw-r--r--core/pim/osearch/olistviewitem.cpp30
-rw-r--r--core/pim/osearch/olistviewitem.h29
-rw-r--r--core/pim/osearch/opie-osearch.control10
-rw-r--r--core/pim/osearch/resultitem.cpp41
-rw-r--r--core/pim/osearch/resultitem.h33
-rw-r--r--core/pim/osearch/searchgroup.cpp57
-rw-r--r--core/pim/osearch/searchgroup.h42
-rw-r--r--core/pim/osearch/todoitem.cpp40
-rw-r--r--core/pim/osearch/todoitem.h37
-rw-r--r--core/pim/osearch/todosearch.cpp53
-rw-r--r--core/pim/osearch/todosearch.h35
25 files changed, 1066 insertions, 0 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp
new file mode 100644
index 0000000..4b0bd9c
--- a/dev/null
+++ b/core/pim/osearch/adresssearch.cpp
@@ -0,0 +1,47 @@
+//
+//
+// C++ Implementation: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "adresssearch.h"
+
+#include <opie/ocontactaccess.h>
+
+#include "contactitem.h"
+//#include <qdir.h>
+
+AdressSearch::AdressSearch(QListView* parent, QString name):
+ SearchGroup(parent, name)
+{
+ _contacts = 0;
+}
+
+
+AdressSearch::~AdressSearch()
+{
+ delete _contacts;
+}
+
+
+void AdressSearch::expand()
+{
+ SearchGroup::expand();
+ if (_search.isEmpty()) return;
+ if (!_contacts) _contacts = new OContactAccess("osearch");
+ ORecordList<OContact> results = _contacts->matchRegexp(_search);
+ for (uint i = 0; i < results.count(); i++) {
+// qDebug("i=%i",i);
+// OContact rec = results[i];
+// qDebug("fullname %s",rec.fullName().latin1());
+//(( new OListViewItem( this, rec.fullName() );
+ new ContactItem( this, new OContact( results[i] ));
+ }
+}
+
diff --git a/core/pim/osearch/adresssearch.h b/core/pim/osearch/adresssearch.h
new file mode 100644
index 0000000..ab560d0
--- a/dev/null
+++ b/core/pim/osearch/adresssearch.h
@@ -0,0 +1,38 @@
+//
+//
+// C++ Interface: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef ADRESSSEARCH_H
+#define ADRESSSEARCH_H
+
+#include "searchgroup.h"
+
+class OContactAccess;
+
+/**
+@author Patrick S. Vogt
+*/
+class AdressSearch : public SearchGroup
+{
+public:
+ AdressSearch(QListView* parent, QString name);
+ ~AdressSearch();
+
+ virtual void expand();
+
+protected:
+
+
+private:
+ OContactAccess *_contacts;
+};
+
+#endif
diff --git a/core/pim/osearch/config.in b/core/pim/osearch/config.in
new file mode 100644
index 0000000..85fa632
--- a/dev/null
+++ b/core/pim/osearch/config.in
@@ -0,0 +1,4 @@
+ config CONFEDIT
+ boolean "oseatch"
+ default "y"
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
diff --git a/core/pim/osearch/contactitem.cpp b/core/pim/osearch/contactitem.cpp
new file mode 100644
index 0000000..36e4f00
--- a/dev/null
+++ b/core/pim/osearch/contactitem.cpp
@@ -0,0 +1,35 @@
+//
+//
+// C++ Implementation: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "contactitem.h"
+
+#include <opie/ocontact.h>
+
+ContactItem::ContactItem(OListViewItem* parent, OContact *contact)
+: ResultItem(parent)
+{
+ _contact = contact;
+ setText(0, _contact->fullName());
+}
+
+
+ContactItem::~ContactItem()
+{
+ delete _contact;
+}
+
+
+QString ContactItem::toRichText()
+{
+ return _contact->toRichText();
+}
+
diff --git a/core/pim/osearch/contactitem.h b/core/pim/osearch/contactitem.h
new file mode 100644
index 0000000..3f2915c
--- a/dev/null
+++ b/core/pim/osearch/contactitem.h
@@ -0,0 +1,37 @@
+//
+//
+// C++ Interface: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef CONTACTITEM_H
+#define CONTACTITEM_H
+
+#include "resultitem.h"
+
+class OContact;
+
+/**
+@author Patrick S. Vogt
+*/
+class ContactItem : public ResultItem
+{
+public:
+ ContactItem(OListViewItem* parent, OContact *contact);
+
+ ~ContactItem();
+
+ virtual QString toRichText();
+
+private:
+ OContact *_contact;
+
+};
+
+#endif
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp
new file mode 100644
index 0000000..85c55c2
--- a/dev/null
+++ b/core/pim/osearch/datebooksearch.cpp
@@ -0,0 +1,59 @@
+//
+//
+// C++ Implementation: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "datebooksearch.h"
+
+#include "eventitem.h"
+
+#include <opie/oevent.h>
+#include <opie/odatebookaccess.h>
+
+DatebookSearch::DatebookSearch(QListView* parent, QString name)
+: SearchGroup(parent, name)
+{
+ _dates = 0;
+}
+
+
+DatebookSearch::~DatebookSearch()
+{
+ delete _dates;
+}
+
+
+void DatebookSearch::expand()
+{
+ SearchGroup::expand();
+ if (!_dates){
+ _dates = new ODateBookAccess();
+ _dates->load();
+ }
+
+ ORecordList<OEvent> list = _dates->allRecords();
+ QArray<int> m_currentQuery( list.count() );
+ for( uint i=0; i<list.count(); i++ ){
+
+ if (
+ ( list[i].description().contains( _search ) ) ||
+ ( list[i].note().contains( _search ) ) ||
+ ( list[i].location().contains( _search ) )
+// ( _search.find( list[i].description(), 0 ) > 0 ) ||
+// ( _search.find( list[i].note(), 0 ) > 0 ) ||
+// ( _search.find( list[i].location(), 0 ) > 0 )
+ ){
+ new EventItem( this, new OEvent( list[i] ) );
+// new OListViewItem( this, list[i].description() );
+ }
+
+ }
+}
+
diff --git a/core/pim/osearch/datebooksearch.h b/core/pim/osearch/datebooksearch.h
new file mode 100644
index 0000000..35bbe5a
--- a/dev/null
+++ b/core/pim/osearch/datebooksearch.h
@@ -0,0 +1,36 @@
+//
+//
+// C++ Interface: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef DATEBOOKSEARCH_H
+#define DATEBOOKSEARCH_H
+
+#include "searchgroup.h"
+
+class ODateBookAccess;
+
+/**
+@author Patrick S. Vogt
+*/
+class DatebookSearch : public SearchGroup
+{
+public:
+ DatebookSearch(QListView* parent, QString name);
+
+ ~DatebookSearch();
+
+ virtual void expand();
+private:
+ ODateBookAccess *_dates;
+
+};
+
+#endif
diff --git a/core/pim/osearch/eventitem.cpp b/core/pim/osearch/eventitem.cpp
new file mode 100644
index 0000000..516a274
--- a/dev/null
+++ b/core/pim/osearch/eventitem.cpp
@@ -0,0 +1,40 @@
+//
+//
+// C++ Implementation: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "eventitem.h"
+
+#include <qpe/qcopenvelope_qws.h>
+#include <opie/oevent.h>
+
+EventItem::EventItem(OListViewItem* parent, OEvent *event)
+ : ResultItem(parent)
+{
+ _event = event;
+ setText(0, _event->description() );
+}
+
+
+EventItem::~EventItem()
+{
+}
+
+
+QString EventItem::toRichText()
+{
+ return _event->toRichText();
+}
+
+void EventItem::editItem()
+{
+ QCopEnvelope e("QPE/Application/datebook", "editEvent(int)");
+ e << _event->uid();
+} \ No newline at end of file
diff --git a/core/pim/osearch/eventitem.h b/core/pim/osearch/eventitem.h
new file mode 100644
index 0000000..c3483de
--- a/dev/null
+++ b/core/pim/osearch/eventitem.h
@@ -0,0 +1,38 @@
+//
+//
+// C++ Interface: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef EVENTITEM_H
+#define EVENTITEM_H
+
+#include "resultitem.h"
+
+class OEvent;
+
+/**
+@author Patrick S. Vogt
+*/
+class EventItem : public ResultItem
+{
+public:
+ EventItem(OListViewItem* parent, OEvent *event);
+
+ ~EventItem();
+
+ virtual QString toRichText();
+ virtual void editItem();
+
+private:
+ OEvent *_event;
+
+};
+
+#endif
diff --git a/core/pim/osearch/main.cpp b/core/pim/osearch/main.cpp
new file mode 100644
index 0000000..6c18adb
--- a/dev/null
+++ b/core/pim/osearch/main.cpp
@@ -0,0 +1,14 @@
+
+#include "mainwindow.h"
+
+#include <qpe/qpeapplication.h>
+
+int main( int argc, char ** argv )
+{
+
+ QPEApplication a( argc, argv );
+ MainWindow mw;
+ mw.showMaximized();
+ a.showMainDocumentWidget( &mw );
+ return a.exec();
+}
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
new file mode 100644
index 0000000..3dba3a9
--- a/dev/null
+++ b/core/pim/osearch/mainwindow.cpp
@@ -0,0 +1,177 @@
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
+
+
+#include "mainwindow.h"
+
+#include <qpe/qpemenubar.h>
+#include <qpe/qpemessagebox.h>
+#include <qpe/resource.h>
+#include <qpe/config.h>
+#include <qpe/qpetoolbar.h>
+#include <qpe/qpeapplication.h>
+#include <qaction.h>
+#include <qmessagebox.h>
+#include <qpopupmenu.h>
+#include <qtoolbutton.h>
+#include <qstring.h>
+#include <qlabel.h>
+#include <qfile.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qtextbrowser.h>
+
+#include "olistview.h"
+#include "olistviewitem.h"
+#include "resultitem.h"
+#include "adresssearch.h"
+#include "todosearch.h"
+#include "datebooksearch.h"
+
+
+MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
+ QMainWindow( parent, name, f ), _currentItem(0)
+{
+ setCaption( tr("OSearch") );
+
+ setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
+
+ QFrame *mainFrame = new QFrame( this, "mainFrame" );
+
+ mainLayout = new QVBoxLayout( mainFrame );
+ mainLayout->setSpacing( 0 );
+ mainLayout->setMargin( 0 );
+
+ resultsList = new OListView( mainFrame );
+ resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
+ mainLayout->addWidget( resultsList );
+
+ detailsFrame = new QFrame( mainFrame, "detailsFrame" );
+ QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame );
+ richEdit = new QTextView( detailsFrame );
+ richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
+ detailsLayout->addWidget( richEdit, 0 );
+ QHBoxLayout *buttonLayout = new QHBoxLayout( detailsFrame );
+ detailsLayout->addLayout( buttonLayout, 0 );
+ QPushButton *buttonShow = new QPushButton( detailsFrame, "Show" );
+ buttonShow->setText( tr("show") );
+// buttonShow->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
+ QPushButton *buttonEdit = new QPushButton( detailsFrame, "Edit" );
+ buttonEdit->setText( tr("edit") );
+ // buttonEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
+ buttonLayout->addWidget( buttonShow, 0 );
+ buttonLayout->addWidget( buttonEdit, 0 );
+
+ mainLayout->addWidget( detailsFrame, 0 );
+ detailsFrame->hide();
+
+ adrSearch = new AdressSearch( resultsList, tr("adressbook") );
+ todoSearch = new TodoSearch( resultsList, tr("todo") );
+ datebookSearch = new DatebookSearch( resultsList, tr("datebook") );
+
+ makeMenu();
+ setCentralWidget( mainFrame );
+
+ popupTimer = new QTimer();
+
+ connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
+ connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
+ connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
+ connect(buttonShow, SIGNAL(clicked()), SLOT( showItem() ) );
+ connect(buttonEdit, SIGNAL(clicked()), SLOT( editItem() ) );
+
+
+}
+
+void MainWindow::makeMenu()
+{
+// QPEToolBar *toolBar = new QPEToolBar( this );
+// QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
+// QPopupMenu *searchMenu = new QPopupMenu( menuBar );
+// QPopupMenu *viewMenu = new QPopupMenu( menuBar );
+// QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
+//
+ setToolBarsMovable( false );
+// toolBar->setHorizontalStretchable( true );
+// menuBar->insertItem( tr( "Search" ), searchMenu );
+// menuBar->insertItem( tr( "View" ), viewMenu );
+// menuBar->insertItem( tr( "Settings" ), cfgMenu );
+
+ //SEARCH
+ QPEToolBar *searchBar = new QPEToolBar(this);
+ addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
+ QLabel *label = new QLabel( tr("Search: "), searchBar );
+// label->setBackgroundMode( PaletteForeground );
+ searchBar->setHorizontalStretchable( TRUE );
+ QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
+ searchBar->setStretchableWidget( searchEdit );
+ connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
+ this, SLOT( setSearch( const QString & ) ) );
+
+
+}
+
+MainWindow::~MainWindow()
+{
+}
+
+void MainWindow::setCurrent(QListViewItem *item)
+{
+ if (!item) return;
+ _currentItem = (OListViewItem*)item;
+// _currentItem = dynamic_cast<OListViewItem*>(item);
+ if (_currentItem->rtti() == OListViewItem::Result){
+ ResultItem *res = (ResultItem*)item;
+// ResultItem *res = dynamic_cast<ResultItem*>(item);
+ richEdit->setText( res->toRichText() );
+ detailsFrame->show();
+ }else detailsFrame->hide();
+ //_currentItem = (OListViewItem*)item;
+ popupTimer->start( 300 );
+}
+
+void MainWindow::stopTimer(QListViewItem*)
+{
+ popupTimer->stop();
+}
+
+void MainWindow::showPopup()
+{
+ qDebug("showPopup");
+ if (!_item) return;
+}
+
+void MainWindow::setSearch( const QString &key )
+{
+ adrSearch->setSearch(key);
+ todoSearch->setSearch(key);
+ datebookSearch->setSearch(key);
+}
+
+
+void MainWindow::showItem()
+{
+ if (_currentItem->rtti() == OListViewItem::Result){
+ ResultItem *res = (ResultItem*)_currentItem;
+// ResultItem *res = dynamic_cast<ResultItem*>(item);
+ res->showItem();
+ }
+}
+
+void MainWindow::editItem()
+{
+ if (_currentItem->rtti() == OListViewItem::Result){
+ ResultItem *res = (ResultItem*)_currentItem;
+// ResultItem *res = dynamic_cast<ResultItem*>(item);
+ res->editItem();
+ }
+}
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h
new file mode 100644
index 0000000..f7e8f8e
--- a/dev/null
+++ b/core/pim/osearch/mainwindow.h
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <qmainwindow.h>
+#include <qdialog.h>
+#include <qaction.h>
+#include <qtimer.h>
+#include <qpopupmenu.h>
+
+class QPEToolBar;
+class QVBoxLayout;
+class QTextView;
+class QFrame;
+class QListViewItem;
+class OListView;
+class OListViewItem;
+class AdressSearch;
+class TodoSearch;
+class DatebookSearch;
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+
+public:
+ MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+ ~MainWindow();
+
+
+public slots:
+ void setCurrent(QListViewItem*);
+ void showPopup();
+ void stopTimer( QListViewItem* );
+ void setSearch( const QString& );
+
+protected slots:
+ void showItem();
+ void editItem();
+
+private:
+ OListView *resultsList;
+ QTextView *richEdit;
+ OListViewItem *_currentItem;
+ QVBoxLayout *mainLayout;
+ QFrame *detailsFrame;
+ OListViewItem *_item;
+ QTimer *popupTimer;
+
+ AdressSearch *adrSearch;
+ TodoSearch *todoSearch;
+ DatebookSearch *datebookSearch;
+
+ void makeMenu();
+};
+
+#endif
+
diff --git a/core/pim/osearch/olistview.cpp b/core/pim/osearch/olistview.cpp
new file mode 100644
index 0000000..f5fe462
--- a/dev/null
+++ b/core/pim/osearch/olistview.cpp
@@ -0,0 +1,35 @@
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+ // (c) 2002 Patrick S. Vogtp <tille@handhelds.org>
+
+#include "olistview.h"
+#include "olistviewitem.h"
+#include <qmessagebox.h>
+
+
+OListView::OListView(QWidget *parent, const char *name )
+ : QListView(parent,name)
+{
+
+ setRootIsDecorated( true );
+ addColumn(tr("Results"));
+
+ connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
+}
+
+
+OListView::~OListView()
+{
+}
+
+void OListView::expand(QListViewItem *item)
+{
+ ((OListViewItem*)item)->expand();
+}
+
diff --git a/core/pim/osearch/olistview.h b/core/pim/osearch/olistview.h
new file mode 100644
index 0000000..af3a50b
--- a/dev/null
+++ b/core/pim/osearch/olistview.h
@@ -0,0 +1,30 @@
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+ // (c) 2002 Patrick S. Vogtp <tille@handhelds.org>
+
+#ifndef LISTVIEWCONFDIR_H
+#define LISTVIEWCONFDIR_H
+
+#include <qwidget.h>
+#include <qlistview.h>
+#include <qdir.h>
+
+class QDir;
+
+class OListView : public QListView {
+ Q_OBJECT
+public:
+ OListView(QWidget *parent=0, const char *name=0);
+ ~OListView();
+protected slots:
+ void expand(QListViewItem*);
+};
+
+#endif
diff --git a/core/pim/osearch/olistviewitem.cpp b/core/pim/osearch/olistviewitem.cpp
new file mode 100644
index 0000000..29c5942
--- a/dev/null
+++ b/core/pim/osearch/olistviewitem.cpp
@@ -0,0 +1,30 @@
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "olistviewitem.h"
+
+OListViewItem::OListViewItem(OListViewItem *parent)
+ : QListViewItem(parent)
+{
+}
+
+OListViewItem::OListViewItem(OListViewItem *parent, QString name)
+ : QListViewItem(parent,name)
+{
+}
+
+OListViewItem::OListViewItem(QListView *parent, QString name)
+ : QListViewItem(parent, name)
+{
+}
+
+OListViewItem::~OListViewItem()
+{
+}
+
diff --git a/core/pim/osearch/olistviewitem.h b/core/pim/osearch/olistviewitem.h
new file mode 100644
index 0000000..66471f1
--- a/dev/null
+++ b/core/pim/osearch/olistviewitem.h
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef LISTVIEWITEMCONF_H
+#define LISTVIEWITEMCONF_H
+
+#include <qlistview.h>
+
+
+class OListViewItem : public QListViewItem
+{
+public:
+ enum {Raw, Searchgroup, Result, Contact, Todo, Event};
+ OListViewItem(OListViewItem *parent);
+ OListViewItem(OListViewItem *parent, QString name);
+ OListViewItem(QListView *parent, QString name);
+ ~OListViewItem();
+
+ virtual void expand(){};
+ virtual int rtti() { return Raw;}
+};
+
+#endif
diff --git a/core/pim/osearch/opie-osearch.control b/core/pim/osearch/opie-osearch.control
new file mode 100644
index 0000000..9c68681
--- a/dev/null
+++ b/core/pim/osearch/opie-osearch.control
@@ -0,0 +1,10 @@
+Packagename: opie-osearch
+Files: bin/osearch apps/Applications/osearch.desktop pics/osearch/Osearch.png
+Priority: optional
+Section: opie/
+Maintainer: Patrick S. Vogt <tille@handhelds.org>
+Architecture: arm
+Version: $QPE_VERSION-$SUB_VERSION
+Depends: task-opie-minimal
+Description: search...
+
diff --git a/core/pim/osearch/resultitem.cpp b/core/pim/osearch/resultitem.cpp
new file mode 100644
index 0000000..31114d2
--- a/dev/null
+++ b/core/pim/osearch/resultitem.cpp
@@ -0,0 +1,41 @@
+//
+//
+// C++ Implementation: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "resultitem.h"
+
+#include <qmessagebox.h>
+
+#include <opie/otodo.h>
+
+
+ResultItem::ResultItem(OListViewItem* parent)
+: OListViewItem(parent)
+{
+
+}
+
+
+ResultItem::~ResultItem()
+{
+}
+
+void ResultItem::showItem()
+{
+ QMessageBox::warning(0,"Not implemented","show is not yet implemented for this");
+}
+
+
+void ResultItem::editItem()
+{
+ QMessageBox::warning(0,"Not implemented","edit is not yet implemented for this");
+}
+
diff --git a/core/pim/osearch/resultitem.h b/core/pim/osearch/resultitem.h
new file mode 100644
index 0000000..2cfb7f8
--- a/dev/null
+++ b/core/pim/osearch/resultitem.h
@@ -0,0 +1,33 @@
+//
+//
+// C++ Interface: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef RESULTITEM_H
+#define RESULTITEM_H
+
+#include "olistviewitem.h"
+
+/**
+@author Patrick S. Vogt
+*/
+class ResultItem : public OListViewItem
+{
+public:
+ ResultItem(OListViewItem* parent);
+ ~ResultItem();
+
+ virtual QString toRichText() {return "no text";};
+ virtual int rtti() { return Result;}
+ virtual void showItem();
+ virtual void editItem();
+};
+
+#endif
diff --git a/core/pim/osearch/searchgroup.cpp b/core/pim/osearch/searchgroup.cpp
new file mode 100644
index 0000000..dce3b14
--- a/dev/null
+++ b/core/pim/osearch/searchgroup.cpp
@@ -0,0 +1,57 @@
+//
+//
+// C++ Implementation: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "searchgroup.h"
+#include "olistviewitem.h"
+
+SearchGroup::SearchGroup(QListView* parent, QString name)
+: OListViewItem(parent, name)
+{
+ _name = name;
+ expanded = false;
+}
+
+
+SearchGroup::~SearchGroup()
+{
+}
+
+
+void SearchGroup::expand()
+{
+ QListViewItem *item = firstChild();
+ QListViewItem *toDel;
+
+ while ( item != 0 ) {
+ toDel = item;
+ item = item->nextSibling();
+ //takeItem(toDel);
+ delete toDel;
+ }
+ expanded = true;
+}
+
+void SearchGroup::setSearch(QString s)
+{
+ setSearch( QRegExp( s ) );
+ _search.setCaseSensitive(false);
+}
+
+
+void SearchGroup::setSearch(QRegExp re)
+{
+ setText(0, _name+" - "+re.pattern() );
+ _search = re;
+ if (expanded) expand();
+ else new OListViewItem( this, "searching...");
+}
+
diff --git a/core/pim/osearch/searchgroup.h b/core/pim/osearch/searchgroup.h
new file mode 100644
index 0000000..d26ff17
--- a/dev/null
+++ b/core/pim/osearch/searchgroup.h
@@ -0,0 +1,42 @@
+//
+//
+// C++ Interface: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef SEARCHGROUP_H
+#define SEARCHGROUP_H
+
+#include "olistviewitem.h"
+
+#include <qregexp.h>
+
+/**
+@author Patrick S. Vogt
+*/
+class SearchGroup : public OListViewItem
+{
+public:
+ SearchGroup(QListView* parent, QString name);
+
+ ~SearchGroup();
+
+ virtual void expand();
+ virtual void setSearch(QString);
+ virtual void setSearch(QRegExp);
+ virtual int rtti() { return Searchgroup;}
+
+protected:
+ QRegExp _search;
+private:
+ QString _name;
+ bool expanded;
+};
+
+#endif
diff --git a/core/pim/osearch/todoitem.cpp b/core/pim/osearch/todoitem.cpp
new file mode 100644
index 0000000..422a6d8
--- a/dev/null
+++ b/core/pim/osearch/todoitem.cpp
@@ -0,0 +1,40 @@
+//
+//
+// C++ Implementation: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "todoitem.h"
+
+#include <opie/otodo.h>
+
+TodoItem::TodoItem(OListViewItem* parent, OTodo *todo)
+: ResultItem(parent)
+{
+ _todo = todo;
+ setText( 0, todo->summary() );
+}
+
+
+TodoItem::~TodoItem()
+{
+ delete _todo;
+}
+
+
+void TodoItem::expand()
+{
+ ResultItem::expand();
+}
+
+QString TodoItem::toRichText()
+{
+ return _todo->toRichText();
+}
+
diff --git a/core/pim/osearch/todoitem.h b/core/pim/osearch/todoitem.h
new file mode 100644
index 0000000..1196c68
--- a/dev/null
+++ b/core/pim/osearch/todoitem.h
@@ -0,0 +1,37 @@
+//
+//
+// C++ Interface: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef TODOITEM_H
+#define TODOITEM_H
+
+#include "resultitem.h"
+class OTodo;
+
+/**
+@author Patrick S. Vogt
+*/
+class TodoItem : public ResultItem
+{
+public:
+ TodoItem(OListViewItem* parent, OTodo *todo);
+ ~TodoItem();
+
+ virtual void expand();
+ //virtual int rtti() { return Result;}
+ virtual QString toRichText();
+
+private:
+ OTodo *_todo;
+
+};
+
+#endif
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp
new file mode 100644
index 0000000..e34c384
--- a/dev/null
+++ b/core/pim/osearch/todosearch.cpp
@@ -0,0 +1,53 @@
+//
+//
+// C++ Implementation: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#include "todosearch.h"
+
+#include <opie/otodoaccess.h>
+#include <opie/otodo.h>
+#include <qdir.h>
+
+#include "todoitem.h"
+
+TodoSearch::TodoSearch(QListView* parent, QString name)
+: SearchGroup(parent, name)
+{
+ //_fileName = QDir::homeDirPath()+"/Applications/todolist/todolist.xml";
+ _todos = 0;
+}
+
+
+TodoSearch::~TodoSearch()
+{
+ delete _todos;
+}
+
+
+void TodoSearch::expand()
+{
+ SearchGroup::expand();
+ if (!_todos){
+ _todos = new OTodoAccess();
+ _todos->load();
+ }
+ ORecordList<OTodo> list = _todos->allRecords();
+ QArray<int> m_currentQuery( list.count() );
+ for( uint i=0; i<list.count(); i++ ){
+ if ( list[i].match( _search ) ){
+ new TodoItem( this, new OTodo( list[i] ) );
+ }
+
+ }
+
+}
+
+
diff --git a/core/pim/osearch/todosearch.h b/core/pim/osearch/todosearch.h
new file mode 100644
index 0000000..33c1064
--- a/dev/null
+++ b/core/pim/osearch/todosearch.h
@@ -0,0 +1,35 @@
+//
+//
+// C++ Interface: $MODULE$
+//
+// Description:
+//
+//
+// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
+//
+// Copyright: See COPYING file that comes with this distribution
+//
+//
+#ifndef TODOSEARCH_H
+#define TODOSEARCH_H
+
+#include "filesearch.h"
+
+class OTodoAccess;
+
+/**
+@author Patrick S. Vogt
+*/
+class TodoSearch : public SearchGroup
+{
+public:
+ TodoSearch(QListView* parent, QString name);
+
+ ~TodoSearch();
+
+ virtual void expand();
+private:
+ OTodoAccess *_todos;
+};
+
+#endif