summaryrefslogtreecommitdiff
path: root/core/pim
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 /core/pim
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 (limited to 'core/pim') (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
@@ -1,28 +1,29 @@
Stuff todo:
Urgent:
- Font menu is invisible using german translation
Important:
- Finishing of new View functions (List, Phonebook...)
- Reload if contacts were changed externally
- "What's this" should be added
- The names of the countries are sorted by there english names, only..
Even if they are translated.. :S
- Store last settings of combo-boxes
+- Mail-Icon is missing
Less important:
- Find widget should be replaced by something like
qpdf has.
- The picker (alphabetical sort widget) should be
placed verticaly or horizontally (configurable)
Should be Fixed (not absolute sure, need validation):
- "Nonenglish" translation bug has to be fixed.
Fixed:
- Syncing: abtable not reloaded after sync.
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
@@ -614,50 +614,58 @@ void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch )
QArray<QRect> r = reg.rects();
for (unsigned int i=0; i<r.count(); i++)
p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) );
}
#endif
#endif
// int AbTable::rowHeight( int ) const
// {
// return 18;
// }
// int AbTable::rowPos( int row ) const
// {
// return 18*row;
// }
// int AbTable::rowAt( int pos ) const
// {
// return QMIN( pos/18, numRows()-1 );
// }
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;
clearSelection( TRUE );
int rows, row;
AbTableItem *ati;
QRegExp r( findString );
r.setCaseSensitive( caseSensitive );
rows = numRows();
static bool wrapAround = true;
if ( !backwards ) {
for ( row = currFindRow + 1; row < rows; row++ ) {
ati = static_cast<AbTableItem*>( item(row, 0) );
if ( contactCompare( contactList[ati], r, category ) )
//if ( contactCompare( contactList[row], r, category ) )
break;
}
} else {
for ( row = currFindRow - 1; row > -1; row-- ) {
ati = static_cast<AbTableItem*>( item(row, 0) );
if ( contactCompare( contactList[ati], r, category ) )
//if ( contactCompare( contactList[row], r, category ) )
break;
}
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
@@ -79,49 +79,49 @@ public:
void refresh();
bool save();
void load();
void reload();
// addresspicker mode
void setChoiceNames( const QStringList& list);
QStringList choiceNames() const;
void setChoiceSelection(int index, const QStringList& list);
QStringList choiceSelection(int index) const;
void setShowCategory( const QString &b, const QString &c );
void setShowByLetter( char c );
QString showCategory() const;
QStringList categories();
void resizeRows();
void show();
void setPaintingEnabled( bool e );
QString showBook() const;
public slots:
void slotDoFind( const QString &str, bool caseSensitive, bool backwards,
- int category );
+ QString category = QString::null );
signals:
void empty( bool );
void details();
void signalNotFound();
void signalWrapAround();
protected:
virtual void keyPressEvent( QKeyEvent *e );
// int rowHeight( int ) const;
// int rowPos( int row ) const;
// virtual int rowAt( int pos ) const;
protected slots:
void moveTo( char );
virtual void columnClicked( int col );
void itemClicked(int,int col);
void rowHeightChanged( int row );
private:
void loadFile( const QString &strFile, bool journalFile );
void fitColumns();
void resort();
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
@@ -47,52 +47,48 @@
#include <qdialog.h>
#include <qdir.h>
#include <qfile.h>
#include <qimage.h>
#include <qlayout.h>
#include <qpe/qpemenubar.h>
#include <qmessagebox.h>
#include <qpixmap.h>
#include <qpopupmenu.h>
#include <qpe/qpetoolbar.h>
#include <qstringlist.h>
#include <qtoolbutton.h>
#include <qwhatsthis.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <qdatetime.h>
#include "picker.h"
-// Remove this for OPIE releae 1.0 !
-#define __DEBUG_RELEASE
-
-
static QString addressbookPersonalVCardName()
{
QString filename = Global::applicationFileName("addressbook",
"businesscard.vcf");
return filename;
}
AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
WFlags f )
: QMainWindow( parent, name, f ),
abEditor(0),
bAbEditFirstTime(TRUE),
syncing(FALSE)
{
isLoading = true;
initFields();
setCaption( tr("Contacts") );
setIcon( Resource::loadPixmap( "AddressBook" ) );
setToolBarsMovable( FALSE );
@@ -119,107 +115,118 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
0, this, 0 );
actionEdit = a;
connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) );
a->addTo( edit );
a->addTo( listTools );
a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null,
0, this, 0 );
actionTrash = a;
connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) );
a->addTo( edit );
a->addTo( listTools );
// make it possible to go directly to businesscard via qcop call
#if defined(Q_WS_QWS)
#if !defined(QT_NO_COP)
QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this );
connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)),
this, SLOT ( appMessage(const QCString &, const QByteArray &) ) );
#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" ),
QString::null, 0, this, 0 );
//a->setEnabled( FALSE ); we got support for it now :) zecke
actionMail = a;
connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) );
a->addTo( edit );
a->addTo( listTools );
if ( Ir::supported() ) {
a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null,
0, this, 0 );
actionBeam = a;
connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
a->addTo( edit );
a->addTo( listTools );
}
edit->insertSeparator();
a = new QAction( tr("Import vCard"), QString::null, 0, 0, 0, TRUE );
actionPersonal = a;
connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) );
a->addTo( edit );
edit->insertSeparator();
a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE );
actionPersonal = a;
connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) );
a->addTo( edit );
// Do we need this function ? (se)
// a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 );
// connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
// a->addTo( edit );
#ifdef __DEBUG_RELEASE
// Remove this function for public Release ! This is only
// 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
// Create Views
listContainer = new QWidget( this );
QVBoxLayout *vb = new QVBoxLayout( listContainer );
abList = new AbTable( &orderedFields, listContainer, "table" );
vb->addWidget(abList);
// abList->setHScrollBarMode( QScrollView::AlwaysOff );
connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) );
connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) );
connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) );
mView = 0;
abList->load();
pLabel = new LetterPicker( listContainer );
connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
vb->addWidget(pLabel);
catMenu = new QPopupMenu( this );
catMenu->setCheckable( TRUE );
@@ -732,48 +739,55 @@ void AddressbookWindow::closeEvent( QCloseEvent *e )
}
/*
Returns TRUE if it is OK to exit
*/
bool AddressbookWindow::save()
{
if ( !abList->save() ) {
if ( QMessageBox::critical( 0, tr( "Out of space" ),
tr("Unable to save information.\n"
"Free up some space\n"
"and try again.\n"
"\nQuit anyway?"),
QMessageBox::Yes|QMessageBox::Escape,
QMessageBox::No|QMessageBox::Default )
!= QMessageBox::No )
return TRUE;
else
return FALSE;
}
return TRUE;
}
+#ifdef __DEBUG_RELEASE
+void AddressbookWindow::slotSave()
+{
+ save();
+}
+#endif
+
void AddressbookWindow::slotSettings()
{
AddressSettings frmSettings( this );
#if defined(Q_WS_QWS) || defined(_WS_QWS_)
frmSettings.showMaximized();
#endif
if ( frmSettings.exec() ) {
allFields.clear();
orderedFields.clear();
slOrderedFields.clear();
initFields();
if ( abEditor )
abEditor->loadFields();
abList->refresh();
}
}
void AddressbookWindow::initFields()
{
// we really don't need the things from the configuration, anymore
// only thing that is important are the important categories. So,
// Call the contact functions that correspond to these old functions...
@@ -856,66 +870,79 @@ void AddressbookWindow::initFields()
orderedFields.remove( Qtopia::Notes );
orderedFields.remove( Qtopia::Gender );
slOrderedFields.remove( "Name Title" );
slOrderedFields.remove( "First Name" );
slOrderedFields.remove( "Last Name" );
slOrderedFields.remove( "File As" );
slOrderedFields.remove( "Default Email" );
slOrderedFields.remove( "Notes" );
slOrderedFields.remove( "Gender" );
}
}
AbLabel *AddressbookWindow::abView()
{
if ( !mView ) {
mView = new AbLabel( this, "viewer" );
mView->init( OContact() );
connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) );
}
return mView;
}
+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() )
abList->clearSelection();
abList->clearFindRow();
-#endif
}
void AddressbookWindow::slotSetCategory( int c )
{
QString cat, book;
if ( c <= 0 )
return;
// Checkmark Book Menu Item Selected
if ( c < 6 )
for ( unsigned int i = 1; i < 6; i++ )
catMenu->setItemChecked( i, c == (int)i );
// Checkmark Category Menu Item Selected
else
for ( unsigned int i = 6; i < catMenu->count(); i++ )
catMenu->setItemChecked( i, c == (int)i );
for ( unsigned int i = 1; i < catMenu->count(); i++ ) {
if (catMenu->isItemChecked( i )) {
if ( i == 1 ) // default List view
book = QString::null;
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
@@ -1,109 +1,124 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Palmtop Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef Addressbook_H
#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;
class AbLabel;
class AbTable;
class QPEToolBar;
class QPopupMenu;
class QToolButton;
class QDialog;
class Ir;
class QAction;
class LetterPicker;
class AddressbookWindow: public QMainWindow
{
Q_OBJECT
public:
AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
~AddressbookWindow();
protected:
void resizeEvent( QResizeEvent * e );
void showList();
void showView();
enum EntryMode { NewEntry=0, EditEntry };
void editPersonal();
void editEntry( EntryMode );
void closeEvent( QCloseEvent *e );
bool save();
public slots:
void flush();
void reload();
void appMessage(const QCString &, const QByteArray &);
void setDocument( const QString & );
+#ifdef __DEBUG_RELEASE
+ void slotSave();
+#endif
private slots:
void importvCard();
void slotListNew();
void slotListView();
void slotListDelete();
void slotViewBack();
void slotViewEdit();
void slotPersonalView();
void listIsEmpty( bool );
void slotSettings();
void writeMail();
void slotBeam();
void beamDone( Ir * );
- void slotFind();
void slotSetCategory( int );
void slotSetLetter( char );
void slotUpdateToolbar();
void slotSetFont(int);
+ void slotFindOpen();
+ void slotFindClose();
+ void slotFind();
+ void slotFindNext();
+
private:
void initFields(); // inititialize our fields...
AbLabel *abView();
void populateCategories();
QPopupMenu *catMenu, *fontMenu;
QPEToolBar *listTools;
QToolButton *deleteButton;
QValueList<int> allFields, orderedFields;
QStringList slOrderedFields;
enum Panes { paneList=0, paneView, paneEdit };
ContactEditor *abEditor;
AbLabel *mView;
LetterPicker *pLabel;
AbTable *abList;
QWidget *listContainer;
+ OFloatBar* searchBar;
+ QLineEdit* searchEdit;
+
QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, *actionPersonal, *actionMail;
bool bAbEditFirstTime;
int viewMargin;
bool syncing;
QFont *defaultFont;
int startFontSize;
bool isLoading;
};
#endif
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
@@ -1,33 +1,34 @@
TEMPLATE = app
CONFIG = qt warn_on release
DESTDIR = $(OPIEDIR)/bin
HEADERS = addressbook.h \
contacteditor.h \
ablabel.h \
abtable.h \
addresssettings.h \
- picker.h
+ picker.h \
+ ofloatbar.h
SOURCES = main.cpp \
addressbook.cpp \
contacteditor.cpp \
ablabel.cpp \
abtable.cpp \
addresssettings.cpp \
picker.cpp
INTERFACES = addresssettingsbase.ui
TARGET = addressbook
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
TRANSLATIONS = ../../../i18n/de/addressbook.ts \
../../../i18n/en/addressbook.ts \
../../../i18n/es/addressbook.ts \
../../../i18n/fr/addressbook.ts \
../../../i18n/hu/addressbook.ts \
../../../i18n/ja/addressbook.ts \
../../../i18n/ko/addressbook.ts \
../../../i18n/no/addressbook.ts \
../../../i18n/pl/addressbook.ts \
../../../i18n/pt/addressbook.ts \
../../../i18n/pt_BR/addressbook.ts \
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