summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/TODO4
-rw-r--r--core/pim/addressbook/abtable.cpp18
-rw-r--r--core/pim/addressbook/abtable.h2
-rw-r--r--core/pim/addressbook/addressbook.cpp75
-rw-r--r--core/pim/addressbook/addressbook.h6
-rw-r--r--core/pim/addressbook/addressbook.pro9
-rw-r--r--core/pim/addressbook/configdlg.cpp45
-rw-r--r--core/pim/addressbook/configdlg.h25
-rw-r--r--core/pim/addressbook/configdlg_base.ui232
-rw-r--r--core/pim/addressbook/ofloatbar.h2
10 files changed, 381 insertions, 37 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO
index d8720b3..0accd87 100644
--- a/core/pim/addressbook/TODO
+++ b/core/pim/addressbook/TODO
@@ -20,7 +20,9 @@ Less important:
qpdf has.
- The picker (alphabetical sort widget) should be
placed verticaly or horizontally (configurable)
-
+- Use advanced database functions in abtable to decrease
+ memory footprint and to make everything more easy !
+ (abtable should store Iterator for selected Category)
Should be Fixed (not absolute sure, need validation):
- "Nonenglish" translation bug has to be fixed.
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 9297d6a..97f4a8f 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -128,7 +128,7 @@ AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *nam
lastSortCol( -1 ),
asc( TRUE ),
intFields( order ),
- currFindRow( -2 ),
+ currFindRow( -1 ),
mCat( 0 ),
m_contactdb ("addressbook", 0l, 0l, false) // Handle syncing myself.. !
{
@@ -638,15 +638,19 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
bool backwards, QString cat /* int category */ )
{
int category = 0;
+
+ // Use the current Category if nothing else selected
if ( cat.isEmpty() )
- category = -2; // mCat.id("Contacts", "All");
- else
+ category = mCat.id( "Contacts", showCat );
+ else{
category = mCat.id("Contacts", cat );
+ }
qWarning ("Found in Category %d", category);
if ( currFindRow < -1 )
- currFindRow = currentRow() - 1;
+ currFindRow = - 1;
+
clearSelection( TRUE );
int rows, row;
AbTableItem *ati;
@@ -659,14 +663,12 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
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;
}
}
@@ -688,7 +690,7 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
foundSelection.init( currFindRow, 0 );
foundSelection.expandTo( currFindRow, numCols() - 1 );
addSelection( foundSelection );
- setCurrentCell( currFindRow, numCols() - 1 );
+ setCurrentCell( currFindRow, 0 /* numCols() - 1 */ );
wrapAround = true;
}
}
@@ -700,7 +702,7 @@ static bool contactCompare( const OContact &cnt, const QRegExp &r, int category
cats = cnt.categories();
returnMe = false;
- if ( (category == -1 && cats.count() == 0) || category == -2 )
+ if ( (cats.count() == 0) || (category == 0) )
returnMe = cnt.match( r );
else {
int i;
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
index a603e17..1039e66 100644
--- a/core/pim/addressbook/abtable.h
+++ b/core/pim/addressbook/abtable.h
@@ -74,7 +74,7 @@ public:
void deleteCurrentEntry();
void clear();
- void clearFindRow() { currFindRow = -2; }
+ void clearFindRow() { currFindRow = -1; }
void loadFields();
void refresh();
bool save();
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 8335d8b..84e66fb 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -33,10 +33,6 @@
#include <qpe/config.h>
#include <opie/ocontact.h>
-#ifndef MAKE_FOR_SHARP_ROM
-#include <qpe/finddialog.h>
-#endif
-
#include <qpe/global.h>
#include <qpe/resource.h>
#include <qpe/ir.h>
@@ -67,6 +63,7 @@
#include <qdatetime.h>
#include "picker.h"
+#include "configdlg.h"
static QString addressbookPersonalVCardName()
{
@@ -80,6 +77,9 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
WFlags f )
: QMainWindow( parent, name, f ),
abEditor(0),
+ useRegExp(false),
+ DoSignalWrapAround(false),
+ caseSensitive(false),
bAbEditFirstTime(TRUE),
syncing(FALSE)
{
@@ -208,7 +208,11 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) );
a->addTo( edit );
#endif
-
+ a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null,
+ 0, this, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) );
+ a->addTo( edit );
+
// Create Views
listContainer = new QWidget( this );
@@ -254,11 +258,36 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
// qDebug("adressbook contrsuction: t=%d", t.elapsed() );
abList->setCurrentCell( 0, 0 );
+
+ // Read Config settings
+ Config cfg("AddressBook");
+ cfg.setGroup("Search");
+ useRegExp = cfg.readBoolEntry( "useRegExp" );
+ caseSensitive = cfg.readBoolEntry( "caseSensitive" );
+ DoSignalWrapAround = cfg.readBoolEntry( "signalWrapAround" );
isLoading = false;
}
+void AddressbookWindow::slotConfig()
+{
+ ConfigDlg* dlg = new ConfigDlg( this, "Config" );
+ dlg -> setUseRegExp ( useRegExp );
+ dlg -> setBeCaseSensitive( caseSensitive );
+ dlg -> setSignalWrapAround( DoSignalWrapAround );
+ dlg -> showMaximized();
+ if ( dlg -> exec() ) {
+ qWarning ("Config Dialog accepted !");
+ useRegExp = dlg -> useRegExp();
+ caseSensitive = dlg -> beCaseSensitive();
+ DoSignalWrapAround = dlg -> signalWrapAround();
+ }
+
+ delete dlg;
+}
+
+
void AddressbookWindow::slotSetFont( int size ) {
if (size > 2 || size < 0)
@@ -340,6 +369,11 @@ AddressbookWindow::~AddressbookWindow()
Config cfg("AddressBook");
cfg.setGroup("Font");
cfg.writeEntry("fontSize", startFontSize);
+
+ cfg.setGroup("Search");
+ cfg.writeEntry("useRegExp", useRegExp);
+ cfg.writeEntry("caseSensitive", caseSensitive);
+ cfg.writeEntry("signalWrapAround", DoSignalWrapAround);
}
void AddressbookWindow::slotUpdateToolbar()
@@ -894,34 +928,35 @@ AbLabel *AddressbookWindow::abView()
void AddressbookWindow::slotFindOpen()
{
searchBar->show();
+ searchEdit->setFocus();
}
void AddressbookWindow::slotFindClose()
{
searchBar->hide();
+ abList->setFocus();
}
void AddressbookWindow::slotFindNext()
{
-}
-
-void AddressbookWindow::slotFind()
-{
if ( centralWidget() == abView() )
showList();
-
-// FindDialog frmFind( "Contacts", this );
+
+ // Maybe we should react on Wraparound and notfound ?
// 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);
if ( abList->numSelections() )
abList->clearSelection();
+
+}
+
+void AddressbookWindow::slotFind()
+{
abList->clearFindRow();
+ slotFindNext();
}
void AddressbookWindow::slotSetCategory( int c )
@@ -932,15 +967,9 @@ void AddressbookWindow::slotSetCategory( int c )
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 );
+ // Set checkItem for selected one
+ for ( unsigned int i = 1; i < catMenu->count(); i++ )
+ catMenu->setItemChecked( i, c == (int)i );
for ( unsigned int i = 1; i < catMenu->count(); i++ ) {
if (catMenu->isItemChecked( i )) {
diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h
index b7cf355..18b083f 100644
--- a/core/pim/addressbook/addressbook.h
+++ b/core/pim/addressbook/addressbook.h
@@ -89,6 +89,8 @@ private slots:
void slotFind();
void slotFindNext();
+ void slotConfig();
+
private:
void initFields(); // inititialize our fields...
AbLabel *abView();
@@ -106,8 +108,12 @@ private:
AbTable *abList;
QWidget *listContainer;
+ // Searching stuff
OFloatBar* searchBar;
QLineEdit* searchEdit;
+ bool useRegExp;
+ bool DoSignalWrapAround;
+ bool caseSensitive;
QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, *actionPersonal, *actionMail;
diff --git a/core/pim/addressbook/addressbook.pro b/core/pim/addressbook/addressbook.pro
index 05aa5ec..9ed2f68 100644
--- a/core/pim/addressbook/addressbook.pro
+++ b/core/pim/addressbook/addressbook.pro
@@ -7,15 +7,18 @@ HEADERS = addressbook.h \
abtable.h \
addresssettings.h \
picker.h \
- ofloatbar.h
+ ofloatbar.h \
+ configdlg.h
SOURCES = main.cpp \
addressbook.cpp \
contacteditor.cpp \
ablabel.cpp \
abtable.cpp \
addresssettings.cpp \
- picker.cpp
-INTERFACES = addresssettingsbase.ui
+ picker.cpp \
+ configdlg.cpp
+
+INTERFACES = addresssettingsbase.ui configdlg_base.ui
TARGET = addressbook
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp
new file mode 100644
index 0000000..b7c3b77
--- a/dev/null
+++ b/core/pim/addressbook/configdlg.cpp
@@ -0,0 +1,45 @@
+#include "configdlg.h"
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+
+ConfigDlg::ConfigDlg( QWidget *parent = 0, const char *name = 0 ):
+ ConfigDlg_Base(parent, name, true )
+{}
+
+
+bool ConfigDlg::useRegExp() const
+{
+ return m_useRegExp->isOn();
+}
+bool ConfigDlg::useWildCards() const
+{
+ return m_useWildCard->isOn();
+}
+bool ConfigDlg::beCaseSensitive() const
+{
+ return m_useCaseSensitive->isChecked();
+}
+bool ConfigDlg::signalWrapAround() const
+{
+ return m_signalWrapAround->isChecked();
+}
+void ConfigDlg::setUseRegExp( bool v )
+{
+ m_useRegExp->setChecked( v );
+}
+void ConfigDlg::setUseWildCards( bool v )
+{
+ m_useWildCard->setChecked( v );
+}
+void ConfigDlg::setBeCaseSensitive( bool v )
+{
+ m_useCaseSensitive->setChecked( v );
+}
+void ConfigDlg::setSignalWrapAround( bool v )
+{
+ m_signalWrapAround->setChecked( v );
+}
+
+
+
+
diff --git a/core/pim/addressbook/configdlg.h b/core/pim/addressbook/configdlg.h
new file mode 100644
index 0000000..8be469b
--- a/dev/null
+++ b/core/pim/addressbook/configdlg.h
@@ -0,0 +1,25 @@
+#ifndef _CONFIGDLG_H_
+#define _CONFIGDLG_H_
+
+#include "configdlg_base.h"
+
+class ConfigDlg: public ConfigDlg_Base
+{
+ Q_OBJECT
+public:
+ ConfigDlg( QWidget *parent = 0, const char *name = 0 );
+
+ // Search Settings
+ bool useRegExp() const;
+ bool useWildCards() const;
+ bool beCaseSensitive() const;
+ bool signalWrapAround() const;
+
+ void setUseRegExp( bool v );
+ void setUseWildCards( bool v );
+ void setBeCaseSensitive( bool v );
+ void setSignalWrapAround( bool v );
+};
+
+
+#endif
diff --git a/core/pim/addressbook/configdlg_base.ui b/core/pim/addressbook/configdlg_base.ui
new file mode 100644
index 0000000..e082702
--- a/dev/null
+++ b/core/pim/addressbook/configdlg_base.ui
@@ -0,0 +1,232 @@
+<!DOCTYPE UI><UI>
+<class>ConfigDlg_Base</class>
+<author>Stefan Eilers</author>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Configuration</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>227</width>
+ <height>287</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>MyDialog1</string>
+ </property>
+ <property stdset="1">
+ <name>sizeGripEnabled</name>
+ <bool>true</bool>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QTabWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>configDlg_base</cstring>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Widget5</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Search</string>
+ </attribute>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>5</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QButtonGroup</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ButtonGroup1</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Query Style</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_useRegExp</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Use Regular Expressions</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QRadioButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_useWildCard</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Use Wildcards (*,?)</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_useCaseSensitive</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Case Sensitive</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_signalWrapAround</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Signal Wrap Around</string>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer3</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout1</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>buttonOk</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&amp;OK</string>
+ </property>
+ <property stdset="1">
+ <name>autoDefault</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>default</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>buttonCancel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&amp;Cancel</string>
+ </property>
+ <property stdset="1">
+ <name>autoDefault</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>buttonOk</sender>
+ <signal>clicked()</signal>
+ <receiver>Configuration</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>buttonCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>Configuration</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>configDlg_base</tabstop>
+ <tabstop>m_useWildCard</tabstop>
+ <tabstop>m_useCaseSensitive</tabstop>
+ <tabstop>m_signalWrapAround</tabstop>
+ <tabstop>buttonOk</tabstop>
+ <tabstop>buttonCancel</tabstop>
+</tabstops>
+</UI>
diff --git a/core/pim/addressbook/ofloatbar.h b/core/pim/addressbook/ofloatbar.h
index 85a0c4f..f9c49d6 100644
--- a/core/pim/addressbook/ofloatbar.h
+++ b/core/pim/addressbook/ofloatbar.h
@@ -7,7 +7,7 @@
class OFloatBar : public QToolBar
{
Q_OBJECT
- virtual void hideEvent(QHideEvent* e)
+ virtual void hideEvent(QHideEvent* /* e */)
{
/*if (e->spontaneous())*/ emit OnHide();
}