summaryrefslogtreecommitdiff
authoreilers <eilers>2002-10-19 17:54:00 (UTC)
committer eilers <eilers>2002-10-19 17:54:00 (UTC)
commit8c9e2e893540c0a405637f10ac2f656df69991a7 (patch) (side-by-side diff)
treeec9841bdd08c95ef1dc4e1a239d7736e760c2a46
parentccdf857edfb52f788c5b00440cce24d1bced2a18 (diff)
downloadopie-8c9e2e893540c0a405637f10ac2f656df69991a7.zip
opie-8c9e2e893540c0a405637f10ac2f656df69991a7.tar.gz
opie-8c9e2e893540c0a405637f10ac2f656df69991a7.tar.bz2
New find widget works. Settings moved into a config dialog.
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
@@ -21,5 +21,7 @@ Less important:
- 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):
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
@@ -129,5 +129,5 @@ AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *nam
asc( TRUE ),
intFields( order ),
- currFindRow( -2 ),
+ currFindRow( -1 ),
mCat( 0 ),
m_contactdb ("addressbook", 0l, 0l, false) // Handle syncing myself.. !
@@ -639,13 +639,17 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
{
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;
@@ -660,5 +664,4 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
ati = static_cast<AbTableItem*>( item(row, 0) );
if ( contactCompare( contactList[ati], r, category ) )
- //if ( contactCompare( contactList[row], r, category ) )
break;
}
@@ -667,5 +670,4 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
ati = static_cast<AbTableItem*>( item(row, 0) );
if ( contactCompare( contactList[ati], r, category ) )
- //if ( contactCompare( contactList[row], r, category ) )
break;
}
@@ -689,5 +691,5 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
foundSelection.expandTo( currFindRow, numCols() - 1 );
addSelection( foundSelection );
- setCurrentCell( currFindRow, numCols() - 1 );
+ setCurrentCell( currFindRow, 0 /* numCols() - 1 */ );
wrapAround = true;
}
@@ -701,5 +703,5 @@ static bool contactCompare( const OContact &cnt, const QRegExp &r, int category
returnMe = false;
- if ( (category == -1 && cats.count() == 0) || category == -2 )
+ if ( (cats.count() == 0) || (category == 0) )
returnMe = cnt.match( r );
else {
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
@@ -75,5 +75,5 @@ public:
void deleteCurrentEntry();
void clear();
- void clearFindRow() { currFindRow = -2; }
+ void clearFindRow() { currFindRow = -1; }
void loadFields();
void refresh();
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
@@ -34,8 +34,4 @@
#include <opie/ocontact.h>
-#ifndef MAKE_FOR_SHARP_ROM
-#include <qpe/finddialog.h>
-#endif
-
#include <qpe/global.h>
#include <qpe/resource.h>
@@ -68,4 +64,5 @@
#include "picker.h"
+#include "configdlg.h"
static QString addressbookPersonalVCardName()
@@ -81,4 +78,7 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
: QMainWindow( parent, name, f ),
abEditor(0),
+ useRegExp(false),
+ DoSignalWrapAround(false),
+ caseSensitive(false),
bAbEditFirstTime(TRUE),
syncing(FALSE)
@@ -209,5 +209,9 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
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 );
@@ -255,4 +259,11 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
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;
@@ -260,4 +271,22 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
+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 ) {
@@ -341,4 +370,9 @@ AddressbookWindow::~AddressbookWindow()
cfg.setGroup("Font");
cfg.writeEntry("fontSize", startFontSize);
+
+ cfg.setGroup("Search");
+ cfg.writeEntry("useRegExp", useRegExp);
+ cfg.writeEntry("caseSensitive", caseSensitive);
+ cfg.writeEntry("signalWrapAround", DoSignalWrapAround);
}
@@ -895,25 +929,20 @@ 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);
@@ -921,6 +950,12 @@ void AddressbookWindow::slotFind()
if ( abList->numSelections() )
abList->clearSelection();
+
+}
+
+void AddressbookWindow::slotFind()
+{
abList->clearFindRow();
+ slotFindNext();
}
@@ -933,13 +968,7 @@ void AddressbookWindow::slotSetCategory( int c )
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++ ) {
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
@@ -90,4 +90,6 @@ private slots:
void slotFindNext();
+ void slotConfig();
+
private:
void initFields(); // inititialize our fields...
@@ -107,6 +109,10 @@ private:
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
@@ -8,5 +8,6 @@ HEADERS = addressbook.h \
addresssettings.h \
picker.h \
- ofloatbar.h
+ ofloatbar.h \
+ configdlg.h
SOURCES = main.cpp \
addressbook.cpp \
@@ -15,6 +16,8 @@ SOURCES = main.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
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
@@ -8,5 +8,5 @@ class OFloatBar : public QToolBar
{
Q_OBJECT
- virtual void hideEvent(QHideEvent* e)
+ virtual void hideEvent(QHideEvent* /* e */)
{
/*if (e->spontaneous())*/ emit OnHide();