summaryrefslogtreecommitdiff
authortille <tille>2003-05-10 17:58:10 (UTC)
committer tille <tille>2003-05-10 17:58:10 (UTC)
commitb7d34545193f39c146ab56b1127863279a3121ce (patch) (side-by-side diff)
treebd0d550af05c14689c5b527da0c5e8ae0e11ce7a
parent797a10cb009d58366d8eb3e792e350f87be4d100 (diff)
downloadopie-b7d34545193f39c146ab56b1127863279a3121ce.zip
opie-b7d34545193f39c146ab56b1127863279a3121ce.tar.gz
opie-b7d34545193f39c146ab56b1127863279a3121ce.tar.bz2
and doclnk search
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/doclnkitem.cpp54
-rw-r--r--core/pim/osearch/doclnkitem.h37
-rw-r--r--core/pim/osearch/doclnksearch.cpp46
-rw-r--r--core/pim/osearch/doclnksearch.h35
-rw-r--r--core/pim/osearch/mainwindow.cpp3
-rw-r--r--core/pim/osearch/mainwindow.h2
-rw-r--r--core/pim/osearch/osearch.pro8
7 files changed, 183 insertions, 2 deletions
diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp
new file mode 100644
index 0000000..fd19727
--- a/dev/null
+++ b/core/pim/osearch/doclnkitem.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 "doclnkitem.h"
+
+#include <qpe/applnk.h>
+
+DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app)
+ : ResultItem(parent)
+{
+ _doc = app;
+ setText(0, _doc->name() );
+}
+
+
+DocLnkItem::~DocLnkItem()
+{
+}
+
+
+QString DocLnkItem::toRichText()
+{
+ QString text;
+ text += "<b><h3>";
+ text += _doc->name();
+ text += "</b></h3><br>";
+ text += _doc->comment();
+ text += "<br><br>`";
+ text += _doc->exec();
+ text += "`";
+ return text;
+}
+
+void DocLnkItem::editItem()
+{
+ _doc->execute();
+}
+
+void DocLnkItem::showItem()
+{
+/* QCopEnvelope e("QPE/Application/addressbook", "edit(int)");
+ e << _contact->uid();*/
+ ResultItem::showItem();
+}
+
diff --git a/core/pim/osearch/doclnkitem.h b/core/pim/osearch/doclnkitem.h
new file mode 100644
index 0000000..2718733
--- a/dev/null
+++ b/core/pim/osearch/doclnkitem.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 DOCLNKITEM_H
+#define DOCLNKITEM_H
+
+#include "resultitem.h"
+
+class DocLnk;
+
+/**
+@author Patrick S. Vogt
+*/
+class DocLnkItem : public ResultItem
+{
+public:
+ DocLnkItem(OListViewItem* parent, DocLnk *app);
+ ~DocLnkItem();
+
+ virtual QString toRichText();
+ virtual void editItem();
+ virtual void showItem();
+
+private:
+ DocLnk *_doc;
+};
+
+#endif
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp
new file mode 100644
index 0000000..e99a385
--- a/dev/null
+++ b/core/pim/osearch/doclnksearch.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 "doclnksearch.h"
+
+#include <qpe/applnk.h>
+#include <qpe/qpeapplication.h>
+
+#include "doclnkitem.h"
+
+DocLnkSearch::DocLnkSearch(QListView* parent, QString name): SearchGroup(parent, name)
+{
+ _docs = 0;
+}
+
+
+DocLnkSearch::~DocLnkSearch()
+{
+ delete _docs;
+}
+
+
+void DocLnkSearch::expand()
+{
+ SearchGroup::expand();
+ if (_search.isEmpty()) return;
+ if (!_docs) _docs = new DocLnkSet(QPEApplication::documentDir());
+ QList<DocLnk> appList = _docs->children();
+ for ( DocLnk *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 DocLnkItem( this, app );
+ }
+}
+
diff --git a/core/pim/osearch/doclnksearch.h b/core/pim/osearch/doclnksearch.h
new file mode 100644
index 0000000..ec740de
--- a/dev/null
+++ b/core/pim/osearch/doclnksearch.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 DOCLNKSEARCH_H
+#define DOCLNKSEARCH_H
+
+#include "searchgroup.h"
+
+class DocLnkSet;
+
+/**
+@author Patrick S. Vogt
+*/
+class DocLnkSearch : public SearchGroup
+{
+public:
+ DocLnkSearch(QListView* parent, QString name);
+
+ ~DocLnkSearch();
+
+ virtual void expand();
+private:
+ DocLnkSet *_docs;
+};
+
+#endif
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index 41ce5b6..140d7bb 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -16,89 +16,91 @@
#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"
+#include "doclnksearch.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") );
+ doclnkSearch = new DocLnkSearch( resultsList, tr("documents") );
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 );
@@ -136,44 +138,45 @@ void MainWindow::setCurrent(QListViewItem *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);
+ doclnkSearch->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 f79504c..424b4ba 100644
--- a/core/pim/osearch/mainwindow.h
+++ b/core/pim/osearch/mainwindow.h
@@ -8,64 +8,66 @@
***************************************************************************/
// (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 DocLnkSearch;
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;
+ DocLnkSearch *doclnkSearch;
void makeMenu();
};
#endif
diff --git a/core/pim/osearch/osearch.pro b/core/pim/osearch/osearch.pro
index 75e90f2..f28b01e 100644
--- a/core/pim/osearch/osearch.pro
+++ b/core/pim/osearch/osearch.pro
@@ -1,36 +1,40 @@
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 \
applnksearch.cpp \
- applnkitem.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
+ applnkitem.h \
+ doclnkitem.h \
+ doclnksearch.h