summaryrefslogtreecommitdiff
authortille <tille>2003-05-13 13:46:19 (UTC)
committer tille <tille>2003-05-13 13:46:19 (UTC)
commitba4bb8e673fba43ae7a232942dea14d166991530 (patch) (side-by-side diff)
treee775ad637d5256eb1412e576c1bd5e77ed50406d
parent1461a41433a732e3a615508e5de23f8acd91de6a (diff)
downloadopie-ba4bb8e673fba43ae7a232942dea14d166991530.zip
opie-ba4bb8e673fba43ae7a232942dea14d166991530.tar.gz
opie-ba4bb8e673fba43ae7a232942dea14d166991530.tar.bz2
icons ;)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/adresssearch.cpp10
-rw-r--r--core/pim/osearch/applnkitem.cpp1
-rw-r--r--core/pim/osearch/applnksearch.cpp7
-rw-r--r--core/pim/osearch/datebooksearch.cpp5
-rw-r--r--core/pim/osearch/doclnkitem.cpp1
-rw-r--r--core/pim/osearch/doclnksearch.cpp6
-rw-r--r--core/pim/osearch/mainwindow.cpp22
-rw-r--r--core/pim/osearch/mainwindow.h10
-rw-r--r--core/pim/osearch/searchgroup.cpp31
-rw-r--r--core/pim/osearch/searchgroup.h9
-rw-r--r--core/pim/osearch/todosearch.cpp7
11 files changed, 86 insertions, 23 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp
index 69ad9ef..252fb40 100644
--- a/core/pim/osearch/adresssearch.cpp
+++ b/core/pim/osearch/adresssearch.cpp
@@ -1,48 +1,56 @@
//
//
// 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 <qstring.h>
+#include <qiconset.h>
+#include <qpe/resource.h>
#include "contactitem.h"
-//#include <qdir.h>
AdressSearch::AdressSearch(QListView* parent, QString name):
SearchGroup(parent, name)
{
_contacts = 0;
+ QIconSet is = Resource::loadIconSet( "addressbook/AddressBook" );
+ setPixmap( 0, is.pixmap( QIconSet::Small, true ) );
+/* 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");
}
int AdressSearch::search()
{
ORecordList<OContact> results = _contacts->matchRegexp(_search);
for (uint i = 0; i < results.count(); i++) {
new ContactItem( this, new OContact( results[i] ));
}
return results.count();
}
void AdressSearch::insertItem( void* )
{
diff --git a/core/pim/osearch/applnkitem.cpp b/core/pim/osearch/applnkitem.cpp
index 0d04be6..2c4a4cb 100644
--- a/core/pim/osearch/applnkitem.cpp
+++ b/core/pim/osearch/applnkitem.cpp
@@ -1,47 +1,48 @@
//
//
// 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>
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){
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp
index acf650a..d5b181b 100644
--- a/core/pim/osearch/applnksearch.cpp
+++ b/core/pim/osearch/applnksearch.cpp
@@ -1,63 +1,68 @@
//
//
// 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 <qpe/applnk.h>
#include <qpe/qpeapplication.h>
+#include <qiconset.h>
+#include <qpe/resource.h>
#include "applnkitem.h"
AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name)
{
_apps = 0;
+ QIconSet is = Resource::loadIconSet( "osearch/applications" );
+ //QIconSet is = Resource::loadIconSet( "AppsIcon" );
+ setPixmap( 0, is.pixmap( QIconSet::Small, true ) );
}
AppLnkSearch::~AppLnkSearch()
{
delete _apps;
}
void AppLnkSearch::load()
{
_apps = new AppLnkSet(QPEApplication::qpeDir());
}
int AppLnkSearch::search()
{
int count = 0;
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) ) {
count++;
insertItem( app );
}
+ qApp->processEvents( 100 );
}
return count;
}
void AppLnkSearch::insertItem( void *rec )
{
new AppLnkItem( this, (AppLnk*)rec );
}
void AppLnkSearch::setSearch(QRegExp re)
{
- expanded = false;
setOpen( false );
SearchGroup::setSearch( re );
}
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp
index 68699fa..7aabcea 100644
--- a/core/pim/osearch/datebooksearch.cpp
+++ b/core/pim/osearch/datebooksearch.cpp
@@ -1,47 +1,52 @@
//
//
// 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>
+#include <qiconset.h>
+#include <qpe/resource.h>
DatebookSearch::DatebookSearch(QListView* parent, QString name)
: SearchGroup(parent, name)
{
_dates = 0;
+ QIconSet is = Resource::loadIconSet( "datebook/DateBook" );
+ setPixmap( 0, is.pixmap( QIconSet::Small, true ) );
+
}
DatebookSearch::~DatebookSearch()
{
delete _dates;
}
void DatebookSearch::load()
{
_dates = new ODateBookAccess();
_dates->load();
}
int DatebookSearch::search()
{
ORecordList<OEvent> results = _dates->matchRegexp(_search);
for (uint i = 0; i < results.count(); i++)
new EventItem( this, new OEvent( results[i] ));
return results.count();
}
void DatebookSearch::insertItem( void* )
diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp
index 95402b9..a1d0384 100644
--- a/core/pim/osearch/doclnkitem.cpp
+++ b/core/pim/osearch/doclnkitem.cpp
@@ -2,48 +2,49 @@
//
// 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 <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 += "File: " + _doc->file() + "<br>";
text += "Link: " + _doc->linkFile() + "<br>";
text += "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();
}
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp
index f2a60e9..123eaa0 100644
--- a/core/pim/osearch/doclnksearch.cpp
+++ b/core/pim/osearch/doclnksearch.cpp
@@ -1,38 +1,42 @@
//
//
// C++ Implementation: $MODULE$
//
-// Description:
+// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "doclnksearch.h"
#include <qpe/applnk.h>
#include <qpe/qpeapplication.h>
+#include <qiconset.h>
+#include <qpe/resource.h>
#include "doclnkitem.h"
DocLnkSearch::DocLnkSearch(QListView* parent, QString name)
: AppLnkSearch(parent, name)
{
+ QIconSet is = Resource::loadIconSet( "osearch/documents" );
+ setPixmap( 0, is.pixmap( QIconSet::Small, true ) );
}
DocLnkSearch::~DocLnkSearch()
{
}
void DocLnkSearch::load()
{
_apps = new DocLnkSet(QPEApplication::documentDir());
}
void DocLnkSearch::insertItem( void *rec )
{
new DocLnkItem( this, (DocLnk*)rec );
}
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index e15cc7e..33a24bc 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -66,84 +66,88 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
//richEdit->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ));
detailsLayout->addWidget( richEdit, 1 );
buttonGroupActions = new QHButtonGroup( this );
buttonGroupActions->hide();
_buttonCount = 0;
// buttonGroupActions->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
buttonLayout = new QHBoxLayout( detailsFrame );
detailsLayout->addLayout( buttonLayout );
mainLayout->addWidget( detailsFrame );
detailsFrame->hide();
searches.append( new AdressSearch( resultsList, tr("adressbook") ) );
searches.append( new TodoSearch( resultsList, tr("todo") ) );
searches.append( new DatebookSearch( resultsList, tr("datebook") ) );
searches.append( new AppLnkSearch( resultsList, tr("applications") ) );
searches.append( new DocLnkSearch( resultsList, tr("documents") ) );
makeMenu();
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*)));
connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) );
}
void MainWindow::makeMenu()
{
QPEToolBar *toolBar = new QPEToolBar( this );
QPEToolBar *searchBar = 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
- QAction *action = new QAction( tr("Search all"),QString::null, 0, this, 0 );
- connect( action, SIGNAL(activated()), this, SLOT(searchAll()) );
- action->addTo( searchMenu );
+ SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
+ SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) );
+ connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
+ SearchAllAction->addTo( searchMenu );
actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true );
actionCaseSensitiv->addTo( searchMenu );
actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
actionWildcards->addTo( searchMenu );
addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
searchBar->setHorizontalStretchable( TRUE );
searchBar->setStretchableWidget( searchEdit );
+ SearchAllAction->addTo( searchBar );
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() );
QIntDict<QString> acts = res->actions();
QButton *button;
for (uint i = 0; i < acts.count(); i++){
button = buttonGroupActions->find( i );
qDebug("action %i >%s<",i,acts[i]->latin1());
if (!button) {
@@ -163,46 +167,54 @@ void MainWindow::setCurrent(QListViewItem *item)
_buttonCount = acts.count();
// buttonShow = new QPushButton( detailsFrame, "Show" ) ;
// buttonShow->setText( "test" );
// buttonLayout->addWidget( buttonShow, 0 );
// buttonGroupActions->insert(buttonShow);
detailsFrame->show();
}else detailsFrame->hide();
//_currentItem = (OListViewItem*)item;
popupTimer->start( 300 );
}
void MainWindow::stopTimer(QListViewItem*)
{
popupTimer->stop();
}
void MainWindow::showPopup()
{
qDebug("showPopup");
if (!_currentItem) return;
}
void MainWindow::setSearch( const QString &key )
{
- QRegExp re( key, actionCaseSensitiv->isOn(), actionWildcards->isOn() );
+ searchTimer->stop();
+ _searchString = key;
+ searchTimer->start( 300 );
+}
+
+void MainWindow::searchStringChanged()
+{
+ searchTimer->stop();
+ QRegExp re( _searchString, actionCaseSensitiv->isOn(), actionWildcards->isOn() );
for (SearchGroup *s = searches.first(); s != 0; s = searches.next() )
s->setSearch( re );
}
void MainWindow::searchAll()
{
- bool openState;
for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
s->doSearch();
+ //resultsList->repaint();
}
}
void MainWindow::slotAction( int act)
{
if (_currentItem->rtti() == OListViewItem::Result){
ResultItem *res = (ResultItem*)_currentItem;
// ResultItem *res = dynamic_cast<ResultItem*>(item);
res->action(act);
}
}
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h
index 2773205..939762e 100644
--- a/core/pim/osearch/mainwindow.h
+++ b/core/pim/osearch/mainwindow.h
@@ -22,51 +22,55 @@
class QPEToolBar;
class QVBoxLayout;
class QHBoxLayout;
class QTextView;
class QFrame;
class QListViewItem;
class OListView;
class OListViewItem;
class QHButtonGroup;
class SearchGroup;
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& );
void searchAll();
protected slots:
void slotAction(int);
-
+ void showPopup();
+ void stopTimer( QListViewItem* );
+ void searchStringChanged();
+
private:
OListView *resultsList;
QTextView *richEdit;
OListViewItem *_currentItem;
QVBoxLayout *mainLayout;
QHBoxLayout *buttonLayout;
QFrame *detailsFrame;
QTimer *popupTimer;
+ QTimer *searchTimer;
+ QString _searchString;
QList<SearchGroup> searches;
QHButtonGroup *buttonGroupActions;
+ QAction *SearchAllAction;
QAction *actionCaseSensitiv;
QAction *actionWildcards;
uint _buttonCount;
void makeMenu();
};
#endif
diff --git a/core/pim/osearch/searchgroup.cpp b/core/pim/osearch/searchgroup.cpp
index 3159984..490deea 100644
--- a/core/pim/osearch/searchgroup.cpp
+++ b/core/pim/osearch/searchgroup.cpp
@@ -1,74 +1,87 @@
//
//
// 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 <qregexp.h>
+// #include <qapplication.h>
+// #include <opie/owait.h>
#include "olistviewitem.h"
SearchGroup::SearchGroup(QListView* parent, QString name)
: OListViewItem(parent, name)
{
_name = name;
loaded = false;
- expanded = false;
}
SearchGroup::~SearchGroup()
{
}
void SearchGroup::expand()
{
+ //expanded = true;
clearList();
if (_search.isEmpty()) return;
OListViewItem *dummy = new OListViewItem( this, "searching...");
- setOpen( expanded );
- if (!loaded) load();
- int res_count = search();
+ 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;
- if (!loaded) load();
- int res_count = search();
+ int res_count = realSearch();
setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")");
+// repaint();
}
void SearchGroup::clearList()
{
QListViewItem *item = firstChild();
QListViewItem *toDel;
-
while ( item != 0 ) {
toDel = item;
item = item->nextSibling();
delete toDel;
}
- expanded = true;
}
void SearchGroup::setSearch(QRegExp re)
{
setText(0, _name+" - "+re.pattern() );
_search = re;
- if (expanded) expand();
+ if (isOpen()) expand();
else new OListViewItem( this, "searching...");
}
+int SearchGroup::realSearch()
+{
+ //emit isSearching( tr(" Searching for %s in %s" ).arg( _search.pattern().latin1()).arg( _name ) );
+/* OWait *wait = new OWait( qApp->mainWidget(), "test" );
+ wait->show();*/
+ if (!loaded) load();
+ int count = search();
+/* wait->hide();
+ delete wait;*/
+ return count;
+}
+
diff --git a/core/pim/osearch/searchgroup.h b/core/pim/osearch/searchgroup.h
index bf5dc67..32f32e0 100644
--- a/core/pim/osearch/searchgroup.h
+++ b/core/pim/osearch/searchgroup.h
@@ -1,46 +1,51 @@
//
//
// 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"
class QRegExp;
/**
@author Patrick S. Vogt
*/
-class SearchGroup : public OListViewItem
+class SearchGroup : public OListViewItem //, QObject
{
+//Q_OBJECT
public:
SearchGroup(QListView* parent, QString name);
~SearchGroup();
virtual void expand();
virtual void doSearch();
virtual void setSearch(QRegExp);
virtual int rtti() { return Searchgroup;}
+// signals:
+// isSearching(QString);
+
protected:
QRegExp _search;
virtual void load() = 0;
virtual int search() = 0;
virtual void insertItem( void* ) = 0;
void clearList();
QString _name;
- bool expanded;
bool loaded;
+private:
+ int realSearch();
};
#endif
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp
index 6a73530..c9fa61a 100644
--- a/core/pim/osearch/todosearch.cpp
+++ b/core/pim/osearch/todosearch.cpp
@@ -1,47 +1,52 @@
//
//
// 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 <qiconset.h>
+#include <qpe/resource.h>
#include "todoitem.h"
TodoSearch::TodoSearch(QListView* parent, QString name)
: SearchGroup(parent, name)
{
_todos = 0;
+// AppLnkSet als(QPEApplication::qpeDir());
+// setPixmap( 0, als.findExec("todolist")->pixmap() );
+ QIconSet is = Resource::loadIconSet( "todo/TodoList" );
+ setPixmap( 0, is.pixmap( QIconSet::Small, true ) );
}
TodoSearch::~TodoSearch()
{
delete _todos;
}
void TodoSearch::load()
{
_todos = new OTodoAccess();
_todos->load();
}
int TodoSearch::search()
{
ORecordList<OTodo> results = _todos->matchRegexp(_search);
for (uint i = 0; i < results.count(); i++)
new TodoItem( this, new OTodo( results[i] ));
return results.count();
}
void TodoSearch::insertItem( void* )