summaryrefslogtreecommitdiff
authorharlekin <harlekin>2004-03-01 16:38:12 (UTC)
committer harlekin <harlekin>2004-03-01 16:38:12 (UTC)
commit49615014f281a58bd9bde5543692ffddab052755 (patch) (side-by-side diff)
treefea29073a62a2217ce25976e492772f0636dce80
parent032f2d909293fb29e6c7e3cf9cce1a12484c80f7 (diff)
downloadopie-49615014f281a58bd9bde5543692ffddab052755.zip
opie-49615014f281a58bd9bde5543692ffddab052755.tar.gz
opie-49615014f281a58bd9bde5543692ffddab052755.tar.bz2
osearch libopie1->libopie2
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/adresssearch.cpp19
-rw-r--r--core/pim/osearch/adresssearch.h8
-rw-r--r--core/pim/osearch/applnkitem.cpp3
-rw-r--r--core/pim/osearch/applnksearch.cpp13
-rw-r--r--core/pim/osearch/contactitem.cpp7
-rw-r--r--core/pim/osearch/contactitem.h9
-rw-r--r--core/pim/osearch/datebooksearch.cpp19
-rw-r--r--core/pim/osearch/datebooksearch.h4
-rw-r--r--core/pim/osearch/doclnkitem.cpp3
-rw-r--r--core/pim/osearch/doclnksearch.cpp18
-rw-r--r--core/pim/osearch/eventitem.cpp10
-rw-r--r--core/pim/osearch/eventitem.h8
-rw-r--r--core/pim/osearch/mainwindow.cpp50
-rw-r--r--core/pim/osearch/mainwindow.h1
-rw-r--r--core/pim/osearch/olistview.cpp9
-rw-r--r--core/pim/osearch/osearch.pro2
-rw-r--r--core/pim/osearch/resultitem.cpp4
-rw-r--r--core/pim/osearch/resultitem.h4
-rw-r--r--core/pim/osearch/searchgroup.cpp8
-rw-r--r--core/pim/osearch/todoitem.cpp16
-rw-r--r--core/pim/osearch/todoitem.h9
-rw-r--r--core/pim/osearch/todosearch.cpp14
-rw-r--r--core/pim/osearch/todosearch.h8
23 files changed, 137 insertions, 109 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp
index 7681ea2..dbd6df6 100644
--- a/core/pim/osearch/adresssearch.cpp
+++ b/core/pim/osearch/adresssearch.cpp
@@ -1,62 +1,61 @@
//
//
// 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 "contactitem.h"
+
+#include <qpe/resource.h>
#include <qstring.h>
#include <qiconset.h>
//#include <qwhatsthis.h>
-#include <qpe/resource.h>
-#include <opie/ocontactaccess.h>
-
-#include "contactitem.h"
AdressSearch::AdressSearch(QListView* parent, QString name):
SearchGroup(parent, name)
{
_contacts = 0;
- QIconSet is = Resource::loadIconSet( "addressbook/AddressBookSmall" );
+ QIconSet is = Resource::loadIconSet( "addressbook/AddressBookSmall" );
setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
-
-
+
+
// QWhatsThis::add( this, QObject::tr("Search the addressbook") );
/* QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" );
QImage img = pix.convertToImage();
img.smoothScale( 14, 14 );
pix.convertFromImage( img );
setPixmap( 0, pix );*/
}
AdressSearch::~AdressSearch()
{
delete _contacts;
}
void AdressSearch::load()
{
- _contacts = new OContactAccess("osearch");
+ _contacts = new OPimContactAccess("osearch");
}
int AdressSearch::search()
{
- ORecordList<OContact> results = _contacts->matchRegexp(_search);
+ OPimRecordList<OPimContact> results = _contacts->matchRegexp(_search);
for (uint i = 0; i < results.count(); i++) {
- (void)new ContactItem( this, new OContact( results[i] ));
+ (void)new ContactItem( this, new OPimContact( results[i] ));
}
return results.count();
}
void AdressSearch::insertItem( void* )
{
}
diff --git a/core/pim/osearch/adresssearch.h b/core/pim/osearch/adresssearch.h
index d5c7622..028521a 100644
--- a/core/pim/osearch/adresssearch.h
+++ b/core/pim/osearch/adresssearch.h
@@ -1,38 +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"
+#include <opie2/ocontactaccess.h>
+
+using namespace Opie;
-class OContactAccess;
/**
@author Patrick S. Vogt
*/
class AdressSearch : public SearchGroup
{
public:
AdressSearch(QListView* parent, QString name);
~AdressSearch();
protected:
virtual void load();
virtual int search();
virtual void insertItem( void* );
private:
- OContactAccess *_contacts;
+ OPimContactAccess *_contacts;
};
#endif
diff --git a/core/pim/osearch/applnkitem.cpp b/core/pim/osearch/applnkitem.cpp
index 2c4a4cb..06c2b1e 100644
--- a/core/pim/osearch/applnkitem.cpp
+++ b/core/pim/osearch/applnkitem.cpp
@@ -1,60 +1,61 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "applnkitem.h"
#include <qpe/applnk.h>
-#include <qfileinfo.h>
#include <qpe/qcopenvelope_qws.h>
+#include <qfileinfo.h>
+
AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app)
: ResultItem(parent)
{
_app = app;
setText(0, _app->name() );
setPixmap(0, _app->pixmap() );
}
AppLnkItem::~AppLnkItem()
{
}
QString AppLnkItem::toRichText()
{
QString text;
text += "<b><h3>" + _app->name() + "</b></h3><br>";
text += _app->comment() + "<br>";
text += "<br>`" + _app->exec() + "`<br>";
text += "<br>`" + _app->file() + "`<br>";
text += "<br>`" + _app->linkFile() + "`<br>";
return text;
}
void AppLnkItem::action( int act )
{
if (!_app->isValid()) qDebug("INVALID");
if (act == 0) _app->execute();
else if (act == 1){
QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)");
e << _app->linkFile();
}
}
QIntDict<QString> AppLnkItem::actions()
{
QIntDict<QString> result;
result.insert( 0, new QString( QObject::tr("execute") ) );
result.insert( 1, new QString( QObject::tr("open in filemanager") ) );
return result;
}
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp
index e8170c5..1c84d66 100644
--- a/core/pim/osearch/applnksearch.cpp
+++ b/core/pim/osearch/applnksearch.cpp
@@ -1,71 +1,70 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "applnksearch.h"
+#include "applnkitem.h"
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
-#include <qiconset.h>
#include <qpe/resource.h>
-#include "applnkitem.h"
-
+#include <qiconset.h>
AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name)
{
_apps = 0;
QIconSet is = Resource::loadIconSet( "osearch/applicationsSmall" );
//QIconSet is = Resource::loadIconSet( "AppsIcon" );
setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
}
AppLnkSearch::~AppLnkSearch()
{
delete _apps;
}
void AppLnkSearch::load()
{
_apps = new AppLnkSet(QPEApplication::qpeDir());
}
int AppLnkSearch::search()
{
QList<AppLnk> appList = _apps->children();
-
+
for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){
if ( (_search.match( app->name() ) != -1)
|| (_search.match(app->comment()) != -1)
- || (_search.match(app->exec()) != -1) ) {
+ || (_search.match(app->exec()) != -1) ) {
insertItem( app );
}else
if (searchFile( app ))
- insertItem( app );
- qApp->processEvents( 100 );
+ insertItem( app );
+ qApp->processEvents( 100 );
}
return _resultCount;
}
void AppLnkSearch::insertItem( void *rec )
{
(void)new AppLnkItem( this, (AppLnk*)rec );
_resultCount++;
}
void AppLnkSearch::setSearch(QRegExp re)
{
setOpen( false );
SearchGroup::setSearch( re );
}
diff --git a/core/pim/osearch/contactitem.cpp b/core/pim/osearch/contactitem.cpp
index c4738ae..eedc374 100644
--- a/core/pim/osearch/contactitem.cpp
+++ b/core/pim/osearch/contactitem.cpp
@@ -1,141 +1,142 @@
//
//
// 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 <qpixmap.h>
-#include <opie/ocontact.h>
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
-ContactItem::ContactItem(OListViewItem* parent, OContact *contact)
+#include <qpixmap.h>
+
+
+ContactItem::ContactItem(OListViewItem* parent, OPimContact *contact)
: ResultItem(parent)
{
_contact = contact;
setText(0, _contact->toShortText());
setIcon();
}
void ContactItem::setIcon()
{
QPixmap icon;
switch ( _contact->lastHitField() ) {
case -1:
icon = Resource::loadPixmap( "reset" );
break;
case Qtopia::BusinessPhone:
icon = Resource::loadPixmap( "addressbook/phonework" );
break;
case Qtopia::BusinessFax:
icon = Resource::loadPixmap( "addressbook/faxwork" );
break;
case Qtopia::BusinessMobile:
icon = Resource::loadPixmap( "addressbook/mobilework" );
break;
case Qtopia::DefaultEmail:
case Qtopia::Emails:
icon = Resource::loadPixmap( "addressbook/email" );
break;
case Qtopia::HomePhone:
icon = Resource::loadPixmap( "addressbook/phonehome" );
break;
case Qtopia::HomeFax:
icon = Resource::loadPixmap( "addressbook/faxhome" );
break;
case Qtopia::HomeMobile:
icon = Resource::loadPixmap( "addressbook/mobilehome" );
break;
case Qtopia::HomeWebPage:
icon = Resource::loadPixmap( "addressbook/webpagehome" );
break;
case Qtopia::BusinessWebPage:
icon = Resource::loadPixmap( "addressbook/webpagework" );
break;
case Qtopia::Title:
case Qtopia::JobTitle:
case Qtopia::FirstName:
case Qtopia::MiddleName:
case Qtopia::LastName:
case Qtopia::Suffix:
case Qtopia::Nickname:
case Qtopia::FileAs:
icon = Resource::loadPixmap( "addressbook/identity" );
break;
case Qtopia::HomeStreet:
case Qtopia::HomeCity:
case Qtopia::HomeState:
case Qtopia::HomeZip:
case Qtopia::HomeCountry:
icon = Resource::loadPixmap( "osearch/addresshome" );
break;
case Qtopia::Company:
case Qtopia::BusinessCity:
case Qtopia::BusinessStreet:
case Qtopia::BusinessZip:
case Qtopia::BusinessCountry:
case Qtopia::Department:
case Qtopia::Office:
case Qtopia::Manager:
case Qtopia::BusinessPager:
case Qtopia::Profession:
icon = Resource::loadPixmap( "osearch/addresshome" );
break;
case Qtopia::Assistant:
case Qtopia::Spouse:
case Qtopia::Children:
icon = Resource::loadPixmap( "osearch/personal" );
break;
case Qtopia::Birthday:
case Qtopia::Anniversary:
icon = Resource::loadPixmap( "osearch/clock" );
break;
case Qtopia::Notes:
icon = Resource::loadPixmap( "txt" );
break;
default:
icon = Resource::loadPixmap( "DocsIcon" );
break;
}
setPixmap( 0, icon );
}
ContactItem::~ContactItem()
{
delete _contact;
}
QString ContactItem::toRichText()
{
return _contact->toRichText();
}
void ContactItem::action( int act )
{
if (act == 0){
QCopEnvelope e("QPE/Application/addressbook", "show(int)");
e << _contact->uid();
}else if(act == 1){
QCopEnvelope e("QPE/Application/addressbook", "edit(int)");
e << _contact->uid();
}
}
QIntDict<QString> ContactItem::actions()
{
QIntDict<QString> result;
result.insert( 0, new QString( QObject::tr("show") ) );
result.insert( 1, new QString( QObject::tr("edit") ) );
return result;
}
diff --git a/core/pim/osearch/contactitem.h b/core/pim/osearch/contactitem.h
index d6303e2..3c553fc 100644
--- a/core/pim/osearch/contactitem.h
+++ b/core/pim/osearch/contactitem.h
@@ -1,41 +1,44 @@
//
//
// 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 <opie2/opimrecord.h>
+#include <opie2/opimcontact.h>
+
#include "resultitem.h"
-class OContact;
+using namespace Opie;
/**
@author Patrick S. Vogt
*/
class ContactItem : public ResultItem
{
public:
- ContactItem(OListViewItem* parent, OContact *contact);
+ ContactItem(OListViewItem* parent, OPimContact *contact);
~ContactItem();
virtual QString toRichText();
virtual void action( int );
virtual QIntDict<QString> actions();
private:
void setIcon();
- OContact *_contact;
+ OPimContact *_contact;
};
#endif
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp
index 50c76e0..2b4660a 100644
--- a/core/pim/osearch/datebooksearch.cpp
+++ b/core/pim/osearch/datebooksearch.cpp
@@ -1,92 +1,95 @@
//
//
// C++ Implementation: $MODULE$
//
-// Description:
+// 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 <opie2/opimevent.h>
+#include <opie2/opimrecurrence.h>
+
+
#include <qpe/resource.h>
#include <qpe/config.h>
-#include <opie/oevent.h>
-#include <opie/orecur.h>
-#include <opie/odatebookaccess.h>
+
#include <qiconset.h>
#include <qaction.h>
#include <qdatetime.h>
#include <qpopupmenu.h>
+
+
DatebookSearch::DatebookSearch(QListView* parent, QString name)
: SearchGroup(parent, name), _dates(0), _popupMenu(0)
{
QIconSet is = Resource::loadIconSet( "datebook/DateBookSmall" );
setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
actionShowPastEvents = new QAction( QObject::tr("show past events"),QString::null, 0, 0, 0, true );
actionSearchInDates = new QAction( QObject::tr("search in dates"),QString::null, 0, 0, 0, true );
Config cfg( "osearch", Config::User );
cfg.setGroup( "datebook_settings" );
actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) );
actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) );
}
DatebookSearch::~DatebookSearch()
{
qDebug("SAVE DATEBOOK SEARCH CONFIG");
Config cfg( "osearch", Config::User );
cfg.setGroup( "datebook_settings" );
cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() );
cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() );
delete _dates;
delete _popupMenu;
delete actionShowPastEvents;
delete actionSearchInDates;
}
void DatebookSearch::load()
{
_dates = new ODateBookAccess();
_dates->load();
}
int DatebookSearch::search()
{
- ORecordList<OEvent> results = _dates->matchRegexp(_search);
+ OPimRecordList<OPimEvent> results = _dates->matchRegexp(_search);
for (uint i = 0; i < results.count(); i++)
- insertItem( new OEvent( results[i] ) );
+ insertItem( new OPimEvent( results[i] ) );
return _resultCount;
}
void DatebookSearch::insertItem( void *rec )
{
- OEvent *ev = (OEvent*)rec;
+ OPimEvent *ev = (OPimEvent*)rec;
if ( !actionShowPastEvents->isOn() &&
ev->endDateTime() < QDateTime::currentDateTime() &&
!ev->recurrence().doesRecur()
) return;
if ( !actionSearchInDates->isOn() && (
ev->lastHitField() == Qtopia::StartDateTime ||
ev->lastHitField() == Qtopia::EndDateTime )
) return;
new EventItem( this, ev );
_resultCount++;
}
QPopupMenu* DatebookSearch::popupMenu()
{
if (!_popupMenu){
_popupMenu = new QPopupMenu( 0 );
actionShowPastEvents->addTo( _popupMenu );
actionSearchInDates->addTo( _popupMenu );
}
return _popupMenu;
}
diff --git a/core/pim/osearch/datebooksearch.h b/core/pim/osearch/datebooksearch.h
index a6d115e..2af727d 100644
--- a/core/pim/osearch/datebooksearch.h
+++ b/core/pim/osearch/datebooksearch.h
@@ -1,44 +1,46 @@
//
//
// 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"
+#include <opie2/odatebookaccess.h>
+
+using namespace Opie;
-class ODateBookAccess;
class QAction;
/**
@author Patrick S. Vogt
*/
class DatebookSearch : public SearchGroup
{
public:
DatebookSearch(QListView* parent, QString name);
~DatebookSearch();
virtual QPopupMenu* popupMenu();
protected:
virtual void load();
virtual int search();
virtual void insertItem( void* );
private:
ODateBookAccess *_dates;
QAction *actionShowPastEvents;
QAction *actionSearchInDates;
QPopupMenu *_popupMenu;
};
#endif
diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp
index 56eb26a..1516b8e 100644
--- a/core/pim/osearch/doclnkitem.cpp
+++ b/core/pim/osearch/doclnkitem.cpp
@@ -1,79 +1,80 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "doclnkitem.h"
#include <qpe/applnk.h>
+#include <qpe/qcopenvelope_qws.h>
+
#include <qfile.h>
#include <qtextstream.h>
#include <qfileinfo.h>
-#include <qpe/qcopenvelope_qws.h>
DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app)
: ResultItem(parent)
{
_doc = app;
setText(0, _doc->name() );
setPixmap(0, _doc->pixmap() );
}
DocLnkItem::~DocLnkItem()
{
}
QString DocLnkItem::toRichText()
{
QString text;
text += "<b><h3>" + _doc->name() + "</b></h3><br>";
text += _doc->comment() + "<br>";
text += QObject::tr("File: ") + _doc->file() + "<br>";
text += QObject::tr("Link: ") + _doc->linkFile() + "<br>";
text += QObject::tr("Mimetype: ") + _doc->type() + "<br>";
if ( _doc->type().contains( "text" ) ){
text += "<br><br><hr><br>";
QFile f(_doc->file());
if ( f.open(IO_ReadOnly) ) {
QTextStream t( &f );
while ( !t.eof() )
text += t.readLine() + "<br>";
}
f.close();
}
/* text += "<br><br>`";
text += _doc->exec();
text += "`";*/
QStringList list = _doc->mimeTypes();
int i = 0;
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
text += QString::number( i++) + " - " + *it ;
}
return text;
}
void DocLnkItem::action( int act )
{
qDebug("action %i",act);
if (!_doc->isValid()) qDebug("INVALID");
if (act == 0) _doc->execute();
else if (act == 1){
QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)");
e << _doc->file();
}
}
QIntDict<QString> DocLnkItem::actions()
{
QIntDict<QString> result;
result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) );
result.insert( 1, new QString( QObject::tr("open in filemanager") ) );
return result;
}
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp
index b03dbd8..c73dcbf 100644
--- a/core/pim/osearch/doclnksearch.cpp
+++ b/core/pim/osearch/doclnksearch.cpp
@@ -1,95 +1,99 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
+
+#include "doclnkitem.h"
+#include "doclnksearch.h"
+
+#include <opie2/owait.h>
+
+#include <qpe/applnk.h>
+#include <qpe/config.h>
+#include <qpe/resource.h>
+#include <qpe/qpeapplication.h>
+
#include <qaction.h>
#include <qfile.h>
#include <qiconset.h>
#include <qpopupmenu.h>
#include <qtextstream.h>
-#include <qpe/applnk.h>
-#include <qpe/config.h>
-#include <qpe/resource.h>
-#include <qpe/qpeapplication.h>
-#include <opie/owait.h>
-#include "doclnkitem.h"
-#include "doclnksearch.h"
DocLnkSearch::DocLnkSearch(QListView* parent, QString name)
: AppLnkSearch(parent, name), _popupMenu(0)
{
QIconSet is = Resource::loadIconSet( "osearch/documentsSmall" );
setPixmap( 0, is.pixmap( QIconSet::Automatic, true ) );
actionSearchInFiles = new QAction( QObject::tr("search content"),QString::null, 0, 0, 0, true );
Config cfg( "osearch", Config::User );
cfg.setGroup( "doclnk_settings" );
actionSearchInFiles->setOn( cfg.readBoolEntry( "search_content", false ) );
}
DocLnkSearch::~DocLnkSearch()
{
Config cfg( "osearch", Config::User );
cfg.setGroup( "doclnk_settings" );
cfg.writeEntry( "search_content", actionSearchInFiles->isOn() );
}
void DocLnkSearch::load()
{
_apps = new DocLnkSet(QPEApplication::documentDir());
}
bool DocLnkSearch::searchFile( AppLnk *app )
{
if (!actionSearchInFiles->isOn()) return false;
DocLnk *doc = (DocLnk*)app;
bool found = false;
if ( doc->type().contains( "text" ) ){
#ifdef NEW_OWAIT
QString ouput = QObject::tr("searching %1").arg(doc->file());
OWait( output );
#endif
QFile f(doc->file());
if ( f.open(IO_ReadOnly) ) {
QTextStream t( &f );
while ( !t.eof() )
if (_search.match( t.readLine()) != -1) {
found = true;
break;
}
}
f.close();
}
return found;
}
void DocLnkSearch::insertItem( void *rec )
{
(void)new DocLnkItem( this, (DocLnk*)rec );
_resultCount++;
}
QPopupMenu* DocLnkSearch::popupMenu()
{
if (!_popupMenu){
_popupMenu = new QPopupMenu( 0 );
actionSearchInFiles->addTo( _popupMenu );
}
return _popupMenu;
// (void) new DocLnkItem( this, (DocLnk*)rec );
// rec is undeclared here
#warning FIXME
_resultCount++;
}
diff --git a/core/pim/osearch/eventitem.cpp b/core/pim/osearch/eventitem.cpp
index 3228093..f6e34fe 100644
--- a/core/pim/osearch/eventitem.cpp
+++ b/core/pim/osearch/eventitem.cpp
@@ -1,86 +1,86 @@
//
//
// 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 <qdatetime.h>
-#include <qpixmap.h>
+
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
-//#include <qwhatsthis.h>
-#include <opie/oevent.h>
-EventItem::EventItem(OListViewItem* parent, OEvent *event)
+#include <qdatetime.h>
+#include <qpixmap.h>
+
+EventItem::EventItem(OListViewItem* parent, OPimEvent *event)
: ResultItem(parent)
{
_event = event;
setText(0, _event->toShortText() );
setIcon();
}
EventItem::~EventItem()
{
}
QString EventItem::toRichText()
{
return _event->toRichText();
}
void EventItem::action( int act )
{
if (act == 0){
QCopEnvelope e("QPE/Application/datebook", "viewDefault(QDate)");
e << _event->startDateTime().date();
}else if(act == 1){
QCopEnvelope e("QPE/Application/datebook", "editEvent(int)");
e << _event->uid();
}
}
QIntDict<QString> EventItem::actions()
{
QIntDict<QString> result;
result.insert( 0, new QString( QObject::tr("show") ) );
result.insert( 1, new QString( QObject::tr("edit") ) );
return result;
}
void EventItem::setIcon()
{
QPixmap icon;
switch ( _event->lastHitField() ) {
case -1:
icon = Resource::loadPixmap( "reset" );
// QWhatsThis::add( icon, QObject::tr("Enter your search terms here") );
break;
case Qtopia::DatebookDescription:
icon = Resource::loadPixmap( "osearch/summary" );
break;
case Qtopia::Notes:
icon = Resource::loadPixmap( "txt" );
break;
case Qtopia::Location:
icon = Resource::loadPixmap( "home" );
break;
case Qtopia::StartDateTime:
case Qtopia::EndDateTime:
icon = Resource::loadPixmap( "osearch/clock" );
break;
default:
icon = Resource::loadPixmap( "DocsIcon" );
break;
}
setPixmap( 0, icon );
}
diff --git a/core/pim/osearch/eventitem.h b/core/pim/osearch/eventitem.h
index 5f9c9fc..68923f1 100644
--- a/core/pim/osearch/eventitem.h
+++ b/core/pim/osearch/eventitem.h
@@ -1,40 +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 EVENTITEM_H
#define EVENTITEM_H
#include "resultitem.h"
-class OEvent;
+#include <opie2/opimevent.h>
+
+using namespace Opie;
/**
@author Patrick S. Vogt
*/
class EventItem : public ResultItem
{
public:
- EventItem(OListViewItem* parent, OEvent *event);
+ EventItem(OListViewItem* parent, OPimEvent *event);
~EventItem();
virtual QString toRichText();
virtual void action( int );
virtual QIntDict<QString> actions();
private:
void setIcon();
- OEvent *_event;
+ OPimEvent *_event;
};
#endif
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index 55302cb..95f5967 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -1,313 +1,317 @@
/***************************************************************************
* *
* 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 "olistview.h"
+#include "olistviewitem.h"
+#include "resultitem.h"
+#include "adresssearch.h"
+#include "todosearch.h"
+#include "datebooksearch.h"
+#include "applnksearch.h"
+#include "doclnksearch.h"
+#include "mainwindow.h"
+#include <opie2/owait.h>
+
+#include <qpe/qpemessagebox.h>
+#include <qpe/resource.h>
+#include <qpe/config.h>
+
+#include <qpe/qpeapplication.h>
+#include <qpe/config.h>
+#include <qpe/global.h>
+
+#include <qtoolbar.h>
#include <qaction.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qtoolbutton.h>
#include <qstring.h>
#include <qlabel.h>
#include <qfile.h>
#include <qhbuttongroup.h>
#include <qhbox.h>
#include <qpushbutton.h>
#include <qintdict.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qsignalmapper.h>
#include <qtextbrowser.h>
#include <qregexp.h>
#include <qwhatsthis.h>
#include <qmenubar.h>
-#include <qpe/qpemessagebox.h>
-#include <qpe/resource.h>
-#include <qpe/config.h>
-#include <qtoolbar.h>
-#include <qpe/qpeapplication.h>
-#include <qpe/config.h>
-#include <qpe/global.h>
-#include <opie/owait.h>
-#include "olistview.h"
-#include "olistviewitem.h"
-#include "resultitem.h"
-#include "adresssearch.h"
-#include "todosearch.h"
-#include "datebooksearch.h"
-#include "applnksearch.h"
-#include "doclnksearch.h"
-#include "mainwindow.h"
-static const char* const image1_data[] = {
+
+static const char* const image1_data[] = {
"14 14 3 1",
". c None",
"# c #000000",
"a c #ff0000",
"..............",
"..##.......###",
".#aa#....##aa#",
"#aaaa#.##aaaa#",
".##aaa#aaaaa##",
"...#aaaaaaa#..",
"....#aaaaa#...",
"...#aaaaa#....",
"..#aaaaaaa#...",
".#aaaaaaaaa#..",
"#aaaa###aaaa#.",
"#aaa#..##aaa#.",
"#aaa#...#aa#..",
".###.....##..."};
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" );
mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
mainLayout = new QVBoxLayout( mainFrame );
mainLayout->setSpacing( 0 );
mainLayout->setMargin( 3 );
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 );
QWhatsThis::add( richEdit, tr("The details of the current result") );
richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
detailsLayout->addWidget( richEdit );
buttonBox = new QHBox( mainFrame, "Button Box" );
_buttonCount = 0;
mainLayout->addWidget( detailsFrame );
mainLayout->addWidget( buttonBox );
detailsFrame->hide();
buttonBox->hide();
searches.append( new AppLnkSearch( resultsList, tr("Applications") ) );
searches.append( new DocLnkSearch( resultsList, tr("Documents") ) );
searches.append( new TodoSearch( resultsList, tr("Todo List") ) );
searches.append( new DatebookSearch( resultsList, tr("Calendar") ) );
searches.append( new AdressSearch( resultsList, tr("Contacts") ) );
setCentralWidget( mainFrame );
popupTimer = new QTimer();
searchTimer = new QTimer();
connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged()));
connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
signalMapper = new QSignalMapper( this );
connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) );
makeMenu();
Config cfg( "osearch", Config::User );
cfg.setGroup( "search_settings" );
actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) );
actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) );
// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) );
}
void MainWindow::makeMenu()
{
QToolBar *toolBar = new QToolBar( this );
QToolBar *searchBar = new QToolBar(this);
QMenuBar *menuBar = new QMenuBar( toolBar );
QPopupMenu *searchMenu = new QPopupMenu( menuBar );
// QPopupMenu *viewMenu = new QPopupMenu( menuBar );
QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
QPopupMenu *searchOptions = new QPopupMenu( cfgMenu );
setToolBarsMovable( false );
toolBar->setHorizontalStretchable( true );
menuBar->insertItem( tr( "Search" ), searchMenu );
menuBar->insertItem( tr( "Settings" ), cfgMenu );
//SETTINGS MENU
cfgMenu->insertItem( tr( "Search" ), searchOptions );
QPopupMenu *pop;
for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
pop = s->popupMenu();
if (pop){
cfgMenu->insertItem( s->text(0), pop );
}
}
//SEARCH
SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) );
// QWhatsThis::add( SearchAllAction, tr("Search everything...") );
connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
SearchAllAction->addTo( searchMenu );
searchMenu->insertItem( tr( "Options" ), searchOptions );
//SEARCH OPTIONS
//actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true );
//actionWholeWordsOnly->addTo( searchOptions );
actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true );
actionCaseSensitiv->addTo( searchOptions );
actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
actionWildcards->addTo( searchOptions );
//SEARCH BAR
LabelEnterText = new QLabel( searchBar, "Label" );
LabelEnterText->setAutoMask( FALSE );
LabelEnterText->setText( tr( "Search for: " ) );
-
+
addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
QWhatsThis::add( searchEdit, tr("Enter your search terms here") );
searchEdit->setFocus();
searchBar->setHorizontalStretchable( TRUE );
searchBar->setStretchableWidget( searchEdit );
-
+
//Search button
SearchAllAction->addTo( searchBar );
-
+
//image ripped of off opie-login/loginwindow.cpp
QPixmap image1( ( const char** ) image1_data );
-
+
//Clear text
ClearSearchText = new QToolButton( searchBar, "ClearSearchText");
ClearSearchText->setText( tr( "" ) );
ClearSearchText->setPixmap( image1 );
-
+
connect( searchEdit, SIGNAL( textChanged( const QString & ) ),this, SLOT( setSearch( const QString & ) ) );
connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) );
}
MainWindow::~MainWindow()
{
Config cfg( "osearch", Config::User );
cfg.setGroup( "search_settings" );
cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() );
cfg.writeEntry( "wildcards", actionWildcards->isOn() );
//cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() );
}
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() );
QIntDict<QString> acts = res->actions();
QButton *button;
for (uint i = 0; i < acts.count(); i++){
button = buttonMap[i];
if (!button) {
qWarning(" no button for %s", (*acts[i]).latin1() );
button = new QPushButton( buttonBox );
buttonMap.insert( i, button );
signalMapper->setMapping(button, i );
connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) );
}
button->setText( *acts[i] );
button->show();
}
for (uint i = acts.count(); i < _buttonCount; i++){
button = buttonMap[i];
if (button) button->hide();
}
_buttonCount = acts.count();
detailsFrame->show();
buttonBox->show();
}else {
detailsFrame->hide();
buttonBox->hide();
}
popupTimer->start( 300, true );
}
void MainWindow::stopTimer(QListViewItem*)
{
popupTimer->stop();
}
void MainWindow::showPopup()
{
popupTimer->stop();
if (!_currentItem) return;
QPopupMenu *pop = _currentItem->popupMenu();
if (pop) pop->popup( QCursor::pos() );
}
void MainWindow::setSearch( const QString &key )
{
searchTimer->stop();
_searchString = key;
searchTimer->start( 300 );
}
void MainWindow::searchStringChanged()
{
#ifdef NEW_OWAIT
OWait("setting search string");
#endif
searchTimer->stop();
QString ss = _searchString;
//ss = Global::stringQuote( _searchString );
// if (actionWholeWordsOnly->isOn())
// ss = "\\s"+_searchString+"\\s";
// qDebug(" set searchString >%s<",ss.latin1());
QRegExp re( ss );
re.setCaseSensitive( actionCaseSensitiv->isOn() );
re.setWildcard( actionWildcards->isOn() );
for (SearchGroup *s = searches.first(); s != 0; s = searches.next() )
s->setSearch( re );
}
void MainWindow::searchAll()
{
#ifdef NEW_OWAIT
OWait("searching...");
#endif
for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
s->doSearch();
//resultsList->repaint();
}
}
void MainWindow::slotAction( int act )
{
if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){
ResultItem *res = (ResultItem*)_currentItem;
// ResultItem *res = dynamic_cast<ResultItem*>(item);
res->action(act);
}
}
void MainWindow::optionChanged(int )
{
searchStringChanged();
}
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h
index 9886053..bf3081f 100644
--- a/core/pim/osearch/mainwindow.h
+++ b/core/pim/osearch/mainwindow.h
@@ -1,89 +1,88 @@
/***************************************************************************
* *
* 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-2003 Patrick S. Vogt <tille@handhelds.org>
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <qmainwindow.h>
#include <qdialog.h>
#include <qaction.h>
#include <qlist.h>
-
#include <qmap.h>
#include <qtimer.h>
#include <qpopupmenu.h>
class QAction;
class QToolBar;
class QHBox;
class QVBoxLayout;
class QTextView;
class QFrame;
class OListView;
class OListViewItem;
class QListViewItem;
class QPopupMenu;
class QTimer;
class QLabel;
class QSignalMapper;
class QButton;
class SearchGroup;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
~MainWindow();
static QString appName() { return QString::fromLatin1("osearch"); }
public slots:
void setCurrent(QListViewItem*);
void setSearch( const QString& );
void searchAll();
protected slots:
void slotAction(int);
void showPopup();
void stopTimer( QListViewItem* );
void searchStringChanged();
void optionChanged(int);
private:
QHBox *buttonBox;
QMap<int, QButton*> buttonMap;
QSignalMapper* signalMapper;
OListView *resultsList;
QTextView *richEdit;
OListViewItem *_currentItem;
QVBoxLayout *mainLayout;
QFrame *detailsFrame;
QTimer *popupTimer;
QTimer *searchTimer;
QToolButton* ClearSearchText;
QLabel* LabelEnterText;
QString _searchString;
QList<SearchGroup> searches;
QAction *SearchAllAction;
QAction *actionCaseSensitiv;
QAction *actionWildcards;
//QAction *actionWholeWordsOnly;
uint _buttonCount;
void makeMenu();
};
#endif
diff --git a/core/pim/osearch/olistview.cpp b/core/pim/osearch/olistview.cpp
index e678d63..7a7cb26 100644
--- a/core/pim/osearch/olistview.cpp
+++ b/core/pim/osearch/olistview.cpp
@@ -1,37 +1,40 @@
/***************************************************************************
* *
* 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>
+
#include <qpe/qpeapplication.h>
+#include <qmessagebox.h>
+
+
OListView::OListView(QWidget *parent, const char *name )
: QListView(parent,name)
{
- setRootIsDecorated( true );
+ setRootIsDecorated( true );
addColumn(tr("Results"),qApp->desktop()->width() - 9 );
//setColumnWidthMode(0, Manual);
-
+
setSorting( -1 );
connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
}
OListView::~OListView()
{
}
void OListView::expand(QListViewItem *item)
{
((OListViewItem*)item)->expand();
}
diff --git a/core/pim/osearch/osearch.pro b/core/pim/osearch/osearch.pro
index c988f48..7412de9 100644
--- a/core/pim/osearch/osearch.pro
+++ b/core/pim/osearch/osearch.pro
@@ -1,39 +1,39 @@
CONFIG += qt release warn_on quick-app
SOURCES += main.cpp \
mainwindow.cpp \
olistview.cpp \
olistviewitem.cpp \
adresssearch.cpp \
todosearch.cpp \
datebooksearch.cpp \
searchgroup.cpp \
resultitem.cpp \
todoitem.cpp \
contactitem.cpp \
eventitem.cpp \
applnksearch.cpp \
applnkitem.cpp \
doclnkitem.cpp \
doclnksearch.cpp
HEADERS += mainwindow.h \
olistview.h \
olistviewitem.h \
adresssearch.h \
todosearch.h \
datebooksearch.h \
searchgroup.h \
resultitem.h \
todoitem.h \
contactitem.h \
eventitem.h \
applnksearch.h \
applnkitem.h \
doclnkitem.h \
doclnksearch.h
TARGET = osearch
INCLUDEPATH = $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopie
+LIBS += -lqpe -lopiecore2 -lopiepim2 -lopieui2
include ( $(OPIEDIR)/include.pro )
diff --git a/core/pim/osearch/resultitem.cpp b/core/pim/osearch/resultitem.cpp
index 2c1e95a..f051b12 100644
--- a/core/pim/osearch/resultitem.cpp
+++ b/core/pim/osearch/resultitem.cpp
@@ -1,29 +1,27 @@
//
//
// 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>
+#include <qmessagebox.h>
ResultItem::ResultItem(OListViewItem* parent)
: OListViewItem(parent)
{
}
ResultItem::~ResultItem()
{
}
diff --git a/core/pim/osearch/resultitem.h b/core/pim/osearch/resultitem.h
index 9e87f99..1c14e8f 100644
--- a/core/pim/osearch/resultitem.h
+++ b/core/pim/osearch/resultitem.h
@@ -1,35 +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 RESULTITEM_H
#define RESULTITEM_H
-#include <qintdict.h>
-
#include "olistviewitem.h"
+#include <qintdict.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 action( int ) = 0;
virtual QIntDict<QString> actions() = 0;
};
#endif
diff --git a/core/pim/osearch/searchgroup.cpp b/core/pim/osearch/searchgroup.cpp
index 0b58176..5377b9f 100644
--- a/core/pim/osearch/searchgroup.cpp
+++ b/core/pim/osearch/searchgroup.cpp
@@ -1,92 +1,92 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
+#include "olistviewitem.h"
+#include "searchgroup.h"
+
+#include <opie2/owait.h>
#include <qobject.h>
#include <qregexp.h>
#include <qapplication.h>
-#include <opie/owait.h>
-
-#include "olistviewitem.h"
-#include "searchgroup.h"
#ifndef NEW_OWAIT
static OWait *wait = 0;
#endif
SearchGroup::SearchGroup(QListView* parent, QString name)
: OListViewItem(parent, name)
{
_name = name;
loaded = false;
}
SearchGroup::~SearchGroup()
{
}
void SearchGroup::expand()
{
//expanded = true;
if (_lastSearch != _search) clearList();
if (_search.isEmpty()) return;
OListViewItem *dummy = new OListViewItem( this, "searching...");
setOpen( true );
repaint();
int res_count = realSearch();
setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")");
delete dummy;
repaint();
}
void SearchGroup::doSearch()
{
clearList();
if (_search.isEmpty()) return;
_resultCount = realSearch();
// repaint();
}
void SearchGroup::setSearch(QRegExp re)
{
if (re == _search) return;
setText(0, _name+" - "+re.pattern() );
_search = re;
if (isOpen()) expand();
else new OListViewItem( this, "searching...");
}
int SearchGroup::realSearch()
{
if (_lastSearch == _search) return _resultCount;
#ifndef NEW_OWAIT
if (!wait) wait = new OWait( qApp->mainWidget(), "osearch" );
wait->show();
qApp->processEvents();
#else
qDebug("********** NEW_OWAIT *************");
OWait( "searching" );
#endif
if (!loaded) load();
_resultCount = 0;
_resultCount = search();
_lastSearch = _search;
setText(0, _name + " - " + _search.pattern() + " (" + QString::number( _resultCount ) + ")");
#ifndef NEW_OWAIT
wait->hide();
#endif
return _resultCount;
}
diff --git a/core/pim/osearch/todoitem.cpp b/core/pim/osearch/todoitem.cpp
index 9808a04..c20f1fd 100644
--- a/core/pim/osearch/todoitem.cpp
+++ b/core/pim/osearch/todoitem.cpp
@@ -1,81 +1,83 @@
//
//
// 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>
-#include <qpixmap.h>
+
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
-TodoItem::TodoItem(OListViewItem* parent, OTodo *todo)
+#include <qpixmap.h>
+
+
+TodoItem::TodoItem(OListViewItem* parent, OPimTodo *todo)
: ResultItem(parent)
{
_todo = todo;
setText( 0, todo->toShortText() );
setIcon();
}
TodoItem::~TodoItem()
{
delete _todo;
}
QString TodoItem::toRichText()
{
return _todo->toRichText();
}
void TodoItem::action( int act )
{
if (act == 0){
QCopEnvelope e("QPE/Application/todolist", "show(int)");
e << _todo->uid();
}else if (act == 1){
QCopEnvelope e("QPE/Application/todolist", "edit(int)");
e << _todo->uid();
}
}
QIntDict<QString> TodoItem::actions()
{
QIntDict<QString> result;
result.insert( 0, new QString( QObject::tr("show") ) );
result.insert( 1, new QString( QObject::tr("edit") ) );
return result;
}
void TodoItem::setIcon()
{
QPixmap icon;
switch ( _todo->lastHitField() ) {
case -1:
icon = Resource::loadPixmap( "reset" );
break;
- case OTodo::Description:
+ case OPimTodo::Description:
icon = Resource::loadPixmap( "txt" );
break;
- case OTodo::Summary:
+ case OPimTodo::Summary:
icon = Resource::loadPixmap( "osearch/summary" );
break;
- case OTodo::Priority:
+ case OPimTodo::Priority:
icon = Resource::loadPixmap( "todo/priority1" );
break;
- case OTodo::HasDate:
+ case OPimTodo::HasDate:
icon = Resource::loadPixmap( "osearch/clock" );
break;
default:
icon = Resource::loadPixmap( "DocsIcon" );
break;
}
setPixmap( 0, icon );
}
diff --git a/core/pim/osearch/todoitem.h b/core/pim/osearch/todoitem.h
index cc78e57..7c8537b 100644
--- a/core/pim/osearch/todoitem.h
+++ b/core/pim/osearch/todoitem.h
@@ -1,38 +1,41 @@
//
//
// 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 <opie2/opimtodo.h>
#include "resultitem.h"
-class OTodo;
+
+using namespace Opie;
/**
@author Patrick S. Vogt
*/
class TodoItem : public ResultItem
{
public:
- TodoItem(OListViewItem* parent, OTodo *todo);
+ TodoItem(OListViewItem* parent, OPimTodo *todo);
~TodoItem();
virtual QString toRichText();
virtual void action( int );
virtual QIntDict<QString> actions();
private:
void setIcon();
- OTodo *_todo;
+ OPimTodo *_todo;
};
#endif
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp
index 8de875e..5042803 100644
--- a/core/pim/osearch/todosearch.cpp
+++ b/core/pim/osearch/todosearch.cpp
@@ -1,80 +1,80 @@
//
//
// 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 "todoitem.h"
-#include <opie/otodoaccess.h>
-#include <opie/otodo.h>
#include <qpe/resource.h>
#include <qpe/config.h>
+
#include <qiconset.h>
#include <qaction.h>
#include <qpopupmenu.h>
-#include "todoitem.h"
+
TodoSearch::TodoSearch(QListView* parent, QString name)
: SearchGroup(parent, name), _todos(0), _popupMenu(0)
{
// AppLnkSet als(QPEApplication::qpeDir());
// setPixmap( 0, als.findExec("todolist")->pixmap() );
QIconSet is = Resource::loadIconSet( "todo/TodoListSmall" );
setPixmap( 0, is.pixmap( QIconSet::Large, true ) );
actionShowCompleted = new QAction( QObject::tr("show completed tasks"),QString::null, 0, 0, 0, true );
Config cfg( "osearch", Config::User );
cfg.setGroup( "todo_settings" );
actionShowCompleted->setOn( cfg.readBoolEntry( "show_completed_tasks", false ) );
}
TodoSearch::~TodoSearch()
{
Config cfg( "osearch", Config::User );
cfg.setGroup( "todo_settings" );
cfg.writeEntry( "show_completed_tasks", actionShowCompleted->isOn() );
delete _popupMenu;
delete actionShowCompleted;
delete _todos;
}
void TodoSearch::load()
{
- _todos = new OTodoAccess();
+ _todos = new OPimTodoAccess();
_todos->load();
}
int TodoSearch::search()
{
- ORecordList<OTodo> results = _todos->matchRegexp(_search);
+ OPimRecordList<OPimTodo> results = _todos->matchRegexp(_search);
for (uint i = 0; i < results.count(); i++)
- insertItem( new OTodo( results[i] ));
+ insertItem( new OPimTodo( results[i] ));
return _resultCount;
}
void TodoSearch::insertItem( void *rec )
{
- OTodo *todo = (OTodo*)rec;
+ OPimTodo *todo = (OPimTodo*)rec;
if (!actionShowCompleted->isOn() &&
todo->isCompleted() ) return;
(void)new TodoItem( this, todo );
_resultCount++;
}
QPopupMenu* TodoSearch::popupMenu()
{
if (!_popupMenu){
_popupMenu = new QPopupMenu( 0 );
actionShowCompleted->addTo( _popupMenu );
}
return _popupMenu;
}
diff --git a/core/pim/osearch/todosearch.h b/core/pim/osearch/todosearch.h
index ee175da..740e483 100644
--- a/core/pim/osearch/todosearch.h
+++ b/core/pim/osearch/todosearch.h
@@ -1,43 +1,47 @@
//
//
// 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 "searchgroup.h"
-class OTodoAccess;
+#include <opie2/otodoaccess.h>
+#include <opie2/opimtodo.h>
+
class QAction;
+using namespace Opie;
+
/**
@author Patrick S. Vogt
*/
class TodoSearch : public SearchGroup
{
public:
TodoSearch(QListView* parent, QString name);
~TodoSearch();
virtual QPopupMenu* popupMenu();
protected:
virtual void load();
virtual int search();
virtual void insertItem( void* );
private:
- OTodoAccess *_todos;
+ OPimTodoAccess *_todos;
QAction *actionShowCompleted;
QPopupMenu *_popupMenu;
};
#endif