summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/applnkitem.cpp54
-rw-r--r--core/pim/osearch/applnkitem.h37
-rw-r--r--core/pim/osearch/applnksearch.cpp46
-rw-r--r--core/pim/osearch/applnksearch.h35
-rw-r--r--core/pim/osearch/mainwindow.cpp4
-rw-r--r--core/pim/osearch/mainwindow.h2
-rw-r--r--core/pim/osearch/osearch.pro8
7 files changed, 183 insertions, 3 deletions
diff --git a/core/pim/osearch/applnkitem.cpp b/core/pim/osearch/applnkitem.cpp
new file mode 100644
index 0000000..f45ed68
--- a/dev/null
+++ b/core/pim/osearch/applnkitem.cpp
@@ -0,0 +1,54 @@
+//
+//
+// 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>
+
+AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app)
+ : ResultItem(parent)
+{
+ _app = app;
+ setText(0, _app->name() );
+}
+
+
+AppLnkItem::~AppLnkItem()
+{
+}
+
+
+QString AppLnkItem::toRichText()
+{
+ QString text;
+ text += "<b><h3>";
+ text += _app->name();
+ text += "</b></h3><br>";
+ text += _app->comment();
+ text += "<br><br>`";
+ text += _app->exec();
+ text += "`";
+ return text;
+}
+
+void AppLnkItem::editItem()
+{
+ _app->execute();
+}
+
+void AppLnkItem::showItem()
+{
+/* QCopEnvelope e("QPE/Application/addressbook", "edit(int)");
+ e << _contact->uid();*/
+ ResultItem::showItem();
+}
+
diff --git a/core/pim/osearch/applnkitem.h b/core/pim/osearch/applnkitem.h
new file mode 100644
index 0000000..b28631a
--- a/dev/null
+++ b/core/pim/osearch/applnkitem.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 APPLNKITEM_H
+#define APPLNKITEM_H
+
+#include "resultitem.h"
+
+class AppLnk;
+
+/**
+@author Patrick S. Vogt
+*/
+class AppLnkItem : public ResultItem
+{
+public:
+ AppLnkItem(OListViewItem* parent, AppLnk *app);
+ ~AppLnkItem();
+
+ virtual QString toRichText();
+ virtual void editItem();
+ virtual void showItem();
+
+private:
+ AppLnk *_app;
+};
+
+#endif
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp
new file mode 100644
index 0000000..7872ae3
--- a/dev/null
+++ b/core/pim/osearch/applnksearch.cpp
@@ -0,0 +1,46 @@
+//
+//
+// 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 "applnkitem.h"
+
+AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name)
+{
+ _apps = 0;
+}
+
+
+AppLnkSearch::~AppLnkSearch()
+{
+ delete _apps;
+}
+
+
+void AppLnkSearch::expand()
+{
+ SearchGroup::expand();
+ if (_search.isEmpty()) return;
+ if (!_apps) _apps = new AppLnkSet(QPEApplication::qpeDir());
+ QList<AppLnk> appList = _apps->children();
+ for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){
+// if (app->name().contains(_search) || app->comment().contains(_search))
+ if ( (_search.match( app->name() ) != -1)
+ || (_search.match(app->comment()) != -1)
+ || (_search.match(app->exec()) != -1) )
+ new AppLnkItem( this, app );
+ }
+}
+
diff --git a/core/pim/osearch/applnksearch.h b/core/pim/osearch/applnksearch.h
new file mode 100644
index 0000000..e283cd3
--- a/dev/null
+++ b/core/pim/osearch/applnksearch.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 APPLNKSEARCH_H
+#define APPLNKSEARCH_H
+
+#include "searchgroup.h"
+
+class AppLnkSet;
+
+/**
+@author Patrick S. Vogt
+*/
+class AppLnkSearch : public SearchGroup
+{
+public:
+ AppLnkSearch(QListView* parent, QString name);
+
+ ~AppLnkSearch();
+
+ virtual void expand();
+private:
+ AppLnkSet *_apps;
+};
+
+#endif
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index 3dba3a9..41ce5b6 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -1,177 +1,179 @@
/***************************************************************************
* *
* 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"
-
+#include "applnksearch.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") );
+ applnkSearch = new AppLnkSearch( resultsList, tr("applications") );
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);
+ applnkSearch->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
index f7e8f8e..f79504c 100644
--- a/core/pim/osearch/mainwindow.h
+++ b/core/pim/osearch/mainwindow.h
@@ -1,69 +1,71 @@
/***************************************************************************
* *
* 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 AppLnkSearch;
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;
+ AppLnkSearch *applnkSearch;
void makeMenu();
};
#endif
diff --git a/core/pim/osearch/osearch.pro b/core/pim/osearch/osearch.pro
index 397bc83..75e90f2 100644
--- a/core/pim/osearch/osearch.pro
+++ b/core/pim/osearch/osearch.pro
@@ -1,32 +1,36 @@
DEPENDPATH += $(OPIEDIR)/ioclude
LIBS += -lqpe -lopie
INTERFACES =
include ( $(OPIEDIR)/include.pro )
TEMPLATE = app
CONFIG += debug warn_on qt
DESTDIR = $(OPIEDIR)/bin
TARGET = osearch
INCLUDEPATH = $(OPIEDIR)/include
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
+ eventitem.cpp \
+ applnksearch.cpp \
+ applnkitem.cpp
HEADERS += mainwindow.h \
olistview.h \
olistviewitem.h \
adresssearch.h \
todosearch.h \
datebooksearch.h \
searchgroup.h \
resultitem.h \
todoitem.h \
contactitem.h \
- eventitem.h
+ eventitem.h \
+ applnksearch.h \
+ applnkitem.h