summaryrefslogtreecommitdiff
authoreilers <eilers>2002-10-18 15:42:57 (UTC)
committer eilers <eilers>2002-10-18 15:42:57 (UTC)
commit47e60a8dc20f46dd00b9405f7fde122792018627 (patch) (side-by-side diff)
treeb109ca9e9c200e7e47c0e61e8f2e86ba6bf4a37f
parentc16dcab3fe45ae7193cbdfb2f62bf7e5482d449b (diff)
downloadopie-47e60a8dc20f46dd00b9405f7fde122792018627.zip
opie-47e60a8dc20f46dd00b9405f7fde122792018627.tar.gz
opie-47e60a8dc20f46dd00b9405f7fde122792018627.tar.bz2
First attempt of new find entry field.. It still needs some finetuning !
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/TODO1
-rw-r--r--core/pim/addressbook/abtable.cpp10
-rw-r--r--core/pim/addressbook/abtable.h2
-rw-r--r--core/pim/addressbook/addressbook.cpp69
-rw-r--r--core/pim/addressbook/addressbook.h17
-rw-r--r--core/pim/addressbook/addressbook.pro3
-rw-r--r--core/pim/addressbook/ofloatbar.h20
7 files changed, 97 insertions, 25 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO
index 7bc906d..d8720b3 100644
--- a/core/pim/addressbook/TODO
+++ b/core/pim/addressbook/TODO
@@ -13,4 +13,5 @@ Important:
Even if they are translated.. :S
- Store last settings of combo-boxes
+- Mail-Icon is missing
Less important:
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 91a7171..9297d6a 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -636,6 +636,14 @@ void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch )
void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
- bool backwards, int category )
+ bool backwards, QString cat /* int category */ )
{
+ int category = 0;
+ if ( cat.isEmpty() )
+ category = -2; // mCat.id("Contacts", "All");
+ else
+ category = mCat.id("Contacts", cat );
+
+ qWarning ("Found in Category %d", category);
+
if ( currFindRow < -1 )
currFindRow = currentRow() - 1;
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
index 80c3ca0..a603e17 100644
--- a/core/pim/addressbook/abtable.h
+++ b/core/pim/addressbook/abtable.h
@@ -101,5 +101,5 @@ public:
public slots:
void slotDoFind( const QString &str, bool caseSensitive, bool backwards,
- int category );
+ QString category = QString::null );
signals:
void empty( bool );
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 82a1b57..8335d8b 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -69,8 +69,4 @@
#include "picker.h"
-// Remove this for OPIE releae 1.0 !
-#define __DEBUG_RELEASE
-
-
static QString addressbookPersonalVCardName()
{
@@ -141,18 +137,29 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
#endif
#endif
-
-
-
-
-
-#ifndef MAKE_FOR_SHARP_ROM
a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ),
QString::null, 0, this, 0 );
actionFind = a;
- connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
+ connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) );
a->addTo( edit );
a->addTo( listTools );
-#endif
-
+
+ // Much better search widget, taken from QTReader.. (se)
+ searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE );
+ searchBar->setHorizontalStretchable( TRUE );
+ searchBar->hide();
+ searchEdit = new QLineEdit( searchBar, "searchEdit" );
+// QFont f("unifont", 16 /*, QFont::Bold*/);
+// searchEdit->setFont( f );
+ searchBar->setStretchableWidget( searchEdit );
+ connect( searchEdit, SIGNAL( returnPressed( ) ),
+ this, SLOT( slotFind( ) ) );
+
+ a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( slotFindNext() ) );
+ a->addTo( searchBar );
+
+ a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) );
+ a->addTo( searchBar );
a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ),
@@ -199,5 +206,5 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
// for debug purposes ..
a = new QAction( tr( "Save all Data"), QString::null, 0, 0 );
- connect( a, SIGNAL( activated() ), this, SLOT( save() ) );
+ connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) );
a->addTo( edit );
#endif
@@ -754,4 +761,11 @@ bool AddressbookWindow::save()
}
+#ifdef __DEBUG_RELEASE
+void AddressbookWindow::slotSave()
+{
+ save();
+}
+#endif
+
void AddressbookWindow::slotSettings()
{
@@ -878,16 +892,30 @@ AbLabel *AddressbookWindow::abView()
}
+void AddressbookWindow::slotFindOpen()
+{
+ searchBar->show();
+}
+void AddressbookWindow::slotFindClose()
+{
+ searchBar->hide();
+}
+void AddressbookWindow::slotFindNext()
+{
+}
+
void AddressbookWindow::slotFind()
{
-#ifndef MAKE_FOR_SHARP_ROM
if ( centralWidget() == abView() )
showList();
- FindDialog frmFind( "Contacts", this );
- QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int)));
- QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) );
- QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) );
+// FindDialog frmFind( "Contacts", this );
+// QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) );
+// QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) );
+// frmFind.exec();
+
+ // QStringList categories = abList->categories();
+ // abList->setShowCategory( book, cat );
+ abList->slotDoFind( searchEdit->text(), false, false);
- frmFind.exec();
if ( abList->numSelections() )
@@ -895,5 +923,4 @@ void AddressbookWindow::slotFind()
abList->clearFindRow();
-#endif
}
diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h
index bf36407..b7cf355 100644
--- a/core/pim/addressbook/addressbook.h
+++ b/core/pim/addressbook/addressbook.h
@@ -21,7 +21,12 @@
#define Addressbook_H
+// Remove this for OPIE releae 1.0 !
+#define __DEBUG_RELEASE
+
#include <qmainwindow.h>
#include <qvaluelist.h>
#include <qstringlist.h>
+#include <qlineedit.h>
+#include "ofloatbar.h"
class ContactEditor;
@@ -58,4 +63,7 @@ public slots:
void appMessage(const QCString &, const QByteArray &);
void setDocument( const QString & );
+#ifdef __DEBUG_RELEASE
+ void slotSave();
+#endif
private slots:
@@ -72,5 +80,4 @@ private slots:
void slotBeam();
void beamDone( Ir * );
- void slotFind();
void slotSetCategory( int );
void slotSetLetter( char );
@@ -78,4 +85,9 @@ private slots:
void slotSetFont(int);
+ void slotFindOpen();
+ void slotFindClose();
+ void slotFind();
+ void slotFindNext();
+
private:
void initFields(); // inititialize our fields...
@@ -95,4 +107,7 @@ private:
QWidget *listContainer;
+ OFloatBar* searchBar;
+ QLineEdit* searchEdit;
+
QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, *actionPersonal, *actionMail;
diff --git a/core/pim/addressbook/addressbook.pro b/core/pim/addressbook/addressbook.pro
index 24bdd8c..05aa5ec 100644
--- a/core/pim/addressbook/addressbook.pro
+++ b/core/pim/addressbook/addressbook.pro
@@ -7,5 +7,6 @@ HEADERS = addressbook.h \
abtable.h \
addresssettings.h \
- picker.h
+ picker.h \
+ ofloatbar.h
SOURCES = main.cpp \
addressbook.cpp \
diff --git a/core/pim/addressbook/ofloatbar.h b/core/pim/addressbook/ofloatbar.h
new file mode 100644
index 0000000..85a0c4f
--- a/dev/null
+++ b/core/pim/addressbook/ofloatbar.h
@@ -0,0 +1,20 @@
+#ifndef __OFLOATBAR_H
+#define __OFLOATBAR_H
+
+#include <qtoolbar.h>
+#include <qevent.h>
+
+class OFloatBar : public QToolBar
+{
+ Q_OBJECT
+ virtual void hideEvent(QHideEvent* e)
+ {
+ /*if (e->spontaneous())*/ emit OnHide();
+ }
+ public:
+ OFloatBar(char* t, QMainWindow* mw, QMainWindow::ToolBarDock td, bool f) : QToolBar(t, mw, td, f) {}
+ signals:
+ void OnHide();
+};
+
+#endif