summaryrefslogtreecommitdiff
path: root/core
Side-by-side diff
Diffstat (limited to 'core') (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
@@ -22,3 +22,5 @@ Less important:
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)
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
@@ -130,3 +130,3 @@ AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *nam
intFields( order ),
- currFindRow( -2 ),
+ currFindRow( -1 ),
mCat( 0 ),
@@ -640,6 +640,9 @@ 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 );
+ }
@@ -648,3 +651,4 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
if ( currFindRow < -1 )
- currFindRow = currentRow() - 1;
+ currFindRow = - 1;
+
clearSelection( TRUE );
@@ -661,3 +665,2 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
if ( contactCompare( contactList[ati], r, category ) )
- //if ( contactCompare( contactList[row], r, category ) )
break;
@@ -668,3 +671,2 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
if ( contactCompare( contactList[ati], r, category ) )
- //if ( contactCompare( contactList[row], r, category ) )
break;
@@ -690,3 +692,3 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
addSelection( foundSelection );
- setCurrentCell( currFindRow, numCols() - 1 );
+ setCurrentCell( currFindRow, 0 /* numCols() - 1 */ );
wrapAround = true;
@@ -702,3 +704,3 @@ 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 );
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
@@ -76,3 +76,3 @@ public:
void clear();
- void clearFindRow() { currFindRow = -2; }
+ void clearFindRow() { currFindRow = -1; }
void loadFields();
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
@@ -35,6 +35,2 @@
-#ifndef MAKE_FOR_SHARP_ROM
-#include <qpe/finddialog.h>
-#endif
-
#include <qpe/global.h>
@@ -69,2 +65,3 @@
#include "picker.h"
+#include "configdlg.h"
@@ -82,2 +79,5 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
abEditor(0),
+ useRegExp(false),
+ DoSignalWrapAround(false),
+ caseSensitive(false),
bAbEditFirstTime(TRUE),
@@ -210,3 +210,7 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
#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
@@ -256,2 +260,9 @@ 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" );
@@ -261,2 +272,20 @@ 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 ) {
@@ -342,2 +371,7 @@ AddressbookWindow::~AddressbookWindow()
cfg.writeEntry("fontSize", startFontSize);
+
+ cfg.setGroup("Search");
+ cfg.writeEntry("useRegExp", useRegExp);
+ cfg.writeEntry("caseSensitive", caseSensitive);
+ cfg.writeEntry("signalWrapAround", DoSignalWrapAround);
}
@@ -896,2 +930,3 @@ void AddressbookWindow::slotFindOpen()
searchBar->show();
+ searchEdit->setFocus();
}
@@ -900,2 +935,3 @@ void AddressbookWindow::slotFindClose()
searchBar->hide();
+ abList->setFocus();
}
@@ -903,16 +939,9 @@ 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);
@@ -922,4 +951,10 @@ void AddressbookWindow::slotFind()
abList->clearSelection();
+
+}
+
+void AddressbookWindow::slotFind()
+{
abList->clearFindRow();
+ slotFindNext();
}
@@ -934,11 +969,5 @@ void AddressbookWindow::slotSetCategory( int c )
- // 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 );
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
@@ -91,2 +91,4 @@ private slots:
+ void slotConfig();
+
private:
@@ -108,4 +110,8 @@ private:
+ // Searching stuff
OFloatBar* searchBar;
QLineEdit* searchEdit;
+ bool useRegExp;
+ bool DoSignalWrapAround;
+ bool caseSensitive;
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
@@ -9,3 +9,4 @@ HEADERS = addressbook.h \
picker.h \
- ofloatbar.h
+ ofloatbar.h \
+ configdlg.h
SOURCES = main.cpp \
@@ -16,4 +17,6 @@ SOURCES = main.cpp \
addresssettings.cpp \
- picker.cpp
-INTERFACES = addresssettingsbase.ui
+ picker.cpp \
+ configdlg.cpp
+
+INTERFACES = addresssettingsbase.ui configdlg_base.ui
TARGET = addressbook
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
@@ -9,3 +9,3 @@ class OFloatBar : public QToolBar
Q_OBJECT
- virtual void hideEvent(QHideEvent* e)
+ virtual void hideEvent(QHideEvent* /* e */)
{