summaryrefslogtreecommitdiff
path: root/core
authoreilers <eilers>2002-10-19 17:54:00 (UTC)
committer eilers <eilers>2002-10-19 17:54:00 (UTC)
commit8c9e2e893540c0a405637f10ac2f656df69991a7 (patch) (unidiff)
treeec9841bdd08c95ef1dc4e1a239d7736e760c2a46 /core
parentccdf857edfb52f788c5b00440cce24d1bced2a18 (diff)
downloadopie-8c9e2e893540c0a405637f10ac2f656df69991a7.zip
opie-8c9e2e893540c0a405637f10ac2f656df69991a7.tar.gz
opie-8c9e2e893540c0a405637f10ac2f656df69991a7.tar.bz2
New find widget works. Settings moved into a config dialog.
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:
22 placed verticaly or horizontally (configurable) 22 placed verticaly or horizontally (configurable)
23 23- Use advanced database functions in abtable to decrease
24 memory footprint and to make everything more easy !
25 (abtable should store Iterator for selected Category)
24 26
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
130 intFields( order ), 130 intFields( order ),
131 currFindRow( -2 ), 131 currFindRow( -1 ),
132 mCat( 0 ), 132 mCat( 0 ),
@@ -640,6 +640,9 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
640 int category = 0; 640 int category = 0;
641
642 // Use the current Category if nothing else selected
641 if ( cat.isEmpty() ) 643 if ( cat.isEmpty() )
642 category = -2; // mCat.id("Contacts", "All"); 644 category = mCat.id( "Contacts", showCat );
643 else 645 else{
644 category = mCat.id("Contacts", cat ); 646 category = mCat.id("Contacts", cat );
647 }
645 648
@@ -648,3 +651,4 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
648 if ( currFindRow < -1 ) 651 if ( currFindRow < -1 )
649 currFindRow = currentRow() - 1; 652 currFindRow = - 1;
653
650 clearSelection( TRUE ); 654 clearSelection( TRUE );
@@ -661,3 +665,2 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
661 if ( contactCompare( contactList[ati], r, category ) ) 665 if ( contactCompare( contactList[ati], r, category ) )
662 //if ( contactCompare( contactList[row], r, category ) )
663 break; 666 break;
@@ -668,3 +671,2 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
668 if ( contactCompare( contactList[ati], r, category ) ) 671 if ( contactCompare( contactList[ati], r, category ) )
669 //if ( contactCompare( contactList[row], r, category ) )
670 break; 672 break;
@@ -690,3 +692,3 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
690 addSelection( foundSelection ); 692 addSelection( foundSelection );
691 setCurrentCell( currFindRow, numCols() - 1 ); 693 setCurrentCell( currFindRow, 0 /* numCols() - 1 */ );
692 wrapAround = true; 694 wrapAround = true;
@@ -702,3 +704,3 @@ static bool contactCompare( const OContact &cnt, const QRegExp &r, int category
702 returnMe = false; 704 returnMe = false;
703 if ( (category == -1 && cats.count() == 0) || category == -2 ) 705 if ( (cats.count() == 0) || (category == 0) )
704 returnMe = cnt.match( r ); 706 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:
76 void clear(); 76 void clear();
77 void clearFindRow() { currFindRow = -2; } 77 void clearFindRow() { currFindRow = -1; }
78 void loadFields(); 78 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 @@
35 35
36#ifndef MAKE_FOR_SHARP_ROM
37#include <qpe/finddialog.h>
38#endif
39
40#include <qpe/global.h> 36#include <qpe/global.h>
@@ -69,2 +65,3 @@
69#include "picker.h" 65#include "picker.h"
66#include "configdlg.h"
70 67
@@ -82,2 +79,5 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
82 abEditor(0), 79 abEditor(0),
80 useRegExp(false),
81 DoSignalWrapAround(false),
82 caseSensitive(false),
83 bAbEditFirstTime(TRUE), 83 bAbEditFirstTime(TRUE),
@@ -210,3 +210,7 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
210#endif 210#endif
211 211 a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null,
212 0, this, 0 );
213 connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) );
214 a->addTo( edit );
215
212 // Create Views 216 // Create Views
@@ -256,2 +260,9 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
256 abList->setCurrentCell( 0, 0 ); 260 abList->setCurrentCell( 0, 0 );
261
262 // Read Config settings
263 Config cfg("AddressBook");
264 cfg.setGroup("Search");
265 useRegExp = cfg.readBoolEntry( "useRegExp" );
266 caseSensitive = cfg.readBoolEntry( "caseSensitive" );
267 DoSignalWrapAround = cfg.readBoolEntry( "signalWrapAround" );
257 268
@@ -261,2 +272,20 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
261 272
273void AddressbookWindow::slotConfig()
274{
275 ConfigDlg* dlg = new ConfigDlg( this, "Config" );
276 dlg -> setUseRegExp ( useRegExp );
277 dlg -> setBeCaseSensitive( caseSensitive );
278 dlg -> setSignalWrapAround( DoSignalWrapAround );
279 dlg -> showMaximized();
280 if ( dlg -> exec() ) {
281 qWarning ("Config Dialog accepted !");
282 useRegExp = dlg -> useRegExp();
283 caseSensitive = dlg -> beCaseSensitive();
284 DoSignalWrapAround = dlg -> signalWrapAround();
285 }
286
287 delete dlg;
288}
289
290
262void AddressbookWindow::slotSetFont( int size ) { 291void AddressbookWindow::slotSetFont( int size ) {
@@ -342,2 +371,7 @@ AddressbookWindow::~AddressbookWindow()
342 cfg.writeEntry("fontSize", startFontSize); 371 cfg.writeEntry("fontSize", startFontSize);
372
373 cfg.setGroup("Search");
374 cfg.writeEntry("useRegExp", useRegExp);
375 cfg.writeEntry("caseSensitive", caseSensitive);
376 cfg.writeEntry("signalWrapAround", DoSignalWrapAround);
343} 377}
@@ -896,2 +930,3 @@ void AddressbookWindow::slotFindOpen()
896 searchBar->show(); 930 searchBar->show();
931 searchEdit->setFocus();
897} 932}
@@ -900,2 +935,3 @@ void AddressbookWindow::slotFindClose()
900 searchBar->hide(); 935 searchBar->hide();
936 abList->setFocus();
901} 937}
@@ -903,16 +939,9 @@ void AddressbookWindow::slotFindNext()
903{ 939{
904}
905
906void AddressbookWindow::slotFind()
907{
908 if ( centralWidget() == abView() ) 940 if ( centralWidget() == abView() )
909 showList(); 941 showList();
910 942
911 // FindDialog frmFind( "Contacts", this ); 943 // Maybe we should react on Wraparound and notfound ?
912 // QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); 944 // QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) );
913 // QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); 945 // QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) );
914 // frmFind.exec();
915 946
916 // QStringList categories = abList->categories();
917 // abList->setShowCategory( book, cat );
918 abList->slotDoFind( searchEdit->text(), false, false); 947 abList->slotDoFind( searchEdit->text(), false, false);
@@ -922,4 +951,10 @@ void AddressbookWindow::slotFind()
922 abList->clearSelection(); 951 abList->clearSelection();
952
953}
954
955void AddressbookWindow::slotFind()
956{
923 957
924 abList->clearFindRow(); 958 abList->clearFindRow();
959 slotFindNext();
925} 960}
@@ -934,11 +969,5 @@ void AddressbookWindow::slotSetCategory( int c )
934 969
935 // Checkmark Book Menu Item Selected 970 // Set checkItem for selected one
936 if ( c < 6 ) 971 for ( unsigned int i = 1; i < catMenu->count(); i++ )
937 for ( unsigned int i = 1; i < 6; i++ ) 972 catMenu->setItemChecked( i, c == (int)i );
938 catMenu->setItemChecked( i, c == (int)i );
939
940 // Checkmark Category Menu Item Selected
941 else
942 for ( unsigned int i = 6; i < catMenu->count(); i++ )
943 catMenu->setItemChecked( i, c == (int)i );
944 973
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:
91 91
92 void slotConfig();
93
92private: 94private:
@@ -108,4 +110,8 @@ private:
108 110
111 // Searching stuff
109 OFloatBar* searchBar; 112 OFloatBar* searchBar;
110 QLineEdit* searchEdit; 113 QLineEdit* searchEdit;
114 bool useRegExp;
115 bool DoSignalWrapAround;
116 bool caseSensitive;
111 117
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 \
9 picker.h \ 9 picker.h \
10 ofloatbar.h 10 ofloatbar.h \
11 configdlg.h
11 SOURCES= main.cpp \ 12 SOURCES= main.cpp \
@@ -16,4 +17,6 @@ SOURCES = main.cpp \
16 addresssettings.cpp \ 17 addresssettings.cpp \
17 picker.cpp 18 picker.cpp \
18 INTERFACES= addresssettingsbase.ui 19 configdlg.cpp
20
21 INTERFACES= addresssettingsbase.ui configdlg_base.ui
19 TARGET = addressbook 22 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 @@
1#include "configdlg.h"
2#include <qcheckbox.h>
3#include <qradiobutton.h>
4
5ConfigDlg::ConfigDlg( QWidget *parent = 0, const char *name = 0 ):
6 ConfigDlg_Base(parent, name, true )
7{}
8
9
10bool ConfigDlg::useRegExp() const
11{
12 return m_useRegExp->isOn();
13}
14bool ConfigDlg::useWildCards() const
15{
16 return m_useWildCard->isOn();
17}
18bool ConfigDlg::beCaseSensitive() const
19{
20 return m_useCaseSensitive->isChecked();
21}
22bool ConfigDlg::signalWrapAround() const
23{
24 return m_signalWrapAround->isChecked();
25}
26void ConfigDlg::setUseRegExp( bool v )
27{
28 m_useRegExp->setChecked( v );
29}
30void ConfigDlg::setUseWildCards( bool v )
31{
32 m_useWildCard->setChecked( v );
33}
34void ConfigDlg::setBeCaseSensitive( bool v )
35{
36 m_useCaseSensitive->setChecked( v );
37}
38void ConfigDlg::setSignalWrapAround( bool v )
39{
40 m_signalWrapAround->setChecked( v );
41}
42
43
44
45
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 @@
1#ifndef _CONFIGDLG_H_
2#define _CONFIGDLG_H_
3
4#include "configdlg_base.h"
5
6class ConfigDlg: public ConfigDlg_Base
7{
8 Q_OBJECT
9public:
10 ConfigDlg( QWidget *parent = 0, const char *name = 0 );
11
12 // Search Settings
13 bool useRegExp() const;
14 bool useWildCards() const;
15 bool beCaseSensitive() const;
16 bool signalWrapAround() const;
17
18 void setUseRegExp( bool v );
19 void setUseWildCards( bool v );
20 void setBeCaseSensitive( bool v );
21 void setSignalWrapAround( bool v );
22};
23
24
25#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 @@
1<!DOCTYPE UI><UI>
2<class>ConfigDlg_Base</class>
3<author>Stefan Eilers</author>
4<widget>
5 <class>QDialog</class>
6 <property stdset="1">
7 <name>name</name>
8 <cstring>Configuration</cstring>
9 </property>
10 <property stdset="1">
11 <name>geometry</name>
12 <rect>
13 <x>0</x>
14 <y>0</y>
15 <width>227</width>
16 <height>287</height>
17 </rect>
18 </property>
19 <property stdset="1">
20 <name>caption</name>
21 <string>MyDialog1</string>
22 </property>
23 <property stdset="1">
24 <name>sizeGripEnabled</name>
25 <bool>true</bool>
26 </property>
27 <vbox>
28 <property stdset="1">
29 <name>margin</name>
30 <number>11</number>
31 </property>
32 <property stdset="1">
33 <name>spacing</name>
34 <number>6</number>
35 </property>
36 <widget>
37 <class>QTabWidget</class>
38 <property stdset="1">
39 <name>name</name>
40 <cstring>configDlg_base</cstring>
41 </property>
42 <property>
43 <name>layoutMargin</name>
44 </property>
45 <widget>
46 <class>QWidget</class>
47 <property stdset="1">
48 <name>name</name>
49 <cstring>Widget5</cstring>
50 </property>
51 <attribute>
52 <name>title</name>
53 <string>Search</string>
54 </attribute>
55 <vbox>
56 <property stdset="1">
57 <name>margin</name>
58 <number>5</number>
59 </property>
60 <property stdset="1">
61 <name>spacing</name>
62 <number>6</number>
63 </property>
64 <widget>
65 <class>QButtonGroup</class>
66 <property stdset="1">
67 <name>name</name>
68 <cstring>ButtonGroup1</cstring>
69 </property>
70 <property stdset="1">
71 <name>title</name>
72 <string>Query Style</string>
73 </property>
74 <vbox>
75 <property stdset="1">
76 <name>margin</name>
77 <number>11</number>
78 </property>
79 <property stdset="1">
80 <name>spacing</name>
81 <number>6</number>
82 </property>
83 <widget>
84 <class>QRadioButton</class>
85 <property stdset="1">
86 <name>name</name>
87 <cstring>m_useRegExp</cstring>
88 </property>
89 <property stdset="1">
90 <name>text</name>
91 <string>Use Regular Expressions</string>
92 </property>
93 </widget>
94 <widget>
95 <class>QRadioButton</class>
96 <property stdset="1">
97 <name>name</name>
98 <cstring>m_useWildCard</cstring>
99 </property>
100 <property stdset="1">
101 <name>text</name>
102 <string>Use Wildcards (*,?)</string>
103 </property>
104 <property stdset="1">
105 <name>checked</name>
106 <bool>true</bool>
107 </property>
108 </widget>
109 </vbox>
110 </widget>
111 <widget>
112 <class>QCheckBox</class>
113 <property stdset="1">
114 <name>name</name>
115 <cstring>m_useCaseSensitive</cstring>
116 </property>
117 <property stdset="1">
118 <name>text</name>
119 <string>Case Sensitive</string>
120 </property>
121 </widget>
122 <widget>
123 <class>QCheckBox</class>
124 <property stdset="1">
125 <name>name</name>
126 <cstring>m_signalWrapAround</cstring>
127 </property>
128 <property stdset="1">
129 <name>text</name>
130 <string>Signal Wrap Around</string>
131 </property>
132 </widget>
133 <spacer>
134 <property>
135 <name>name</name>
136 <cstring>Spacer3</cstring>
137 </property>
138 <property stdset="1">
139 <name>orientation</name>
140 <enum>Vertical</enum>
141 </property>
142 <property stdset="1">
143 <name>sizeType</name>
144 <enum>Expanding</enum>
145 </property>
146 <property>
147 <name>sizeHint</name>
148 <size>
149 <width>20</width>
150 <height>20</height>
151 </size>
152 </property>
153 </spacer>
154 </vbox>
155 </widget>
156 </widget>
157 <widget>
158 <class>QLayoutWidget</class>
159 <property stdset="1">
160 <name>name</name>
161 <cstring>Layout1</cstring>
162 </property>
163 <hbox>
164 <property stdset="1">
165 <name>margin</name>
166 <number>0</number>
167 </property>
168 <property stdset="1">
169 <name>spacing</name>
170 <number>6</number>
171 </property>
172 <widget>
173 <class>QPushButton</class>
174 <property stdset="1">
175 <name>name</name>
176 <cstring>buttonOk</cstring>
177 </property>
178 <property stdset="1">
179 <name>text</name>
180 <string>&amp;OK</string>
181 </property>
182 <property stdset="1">
183 <name>autoDefault</name>
184 <bool>true</bool>
185 </property>
186 <property stdset="1">
187 <name>default</name>
188 <bool>true</bool>
189 </property>
190 </widget>
191 <widget>
192 <class>QPushButton</class>
193 <property stdset="1">
194 <name>name</name>
195 <cstring>buttonCancel</cstring>
196 </property>
197 <property stdset="1">
198 <name>text</name>
199 <string>&amp;Cancel</string>
200 </property>
201 <property stdset="1">
202 <name>autoDefault</name>
203 <bool>true</bool>
204 </property>
205 </widget>
206 </hbox>
207 </widget>
208 </vbox>
209</widget>
210<connections>
211 <connection>
212 <sender>buttonOk</sender>
213 <signal>clicked()</signal>
214 <receiver>Configuration</receiver>
215 <slot>accept()</slot>
216 </connection>
217 <connection>
218 <sender>buttonCancel</sender>
219 <signal>clicked()</signal>
220 <receiver>Configuration</receiver>
221 <slot>reject()</slot>
222 </connection>
223</connections>
224<tabstops>
225 <tabstop>configDlg_base</tabstop>
226 <tabstop>m_useWildCard</tabstop>
227 <tabstop>m_useCaseSensitive</tabstop>
228 <tabstop>m_signalWrapAround</tabstop>
229 <tabstop>buttonOk</tabstop>
230 <tabstop>buttonCancel</tabstop>
231</tabstops>
232</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
9 Q_OBJECT 9 Q_OBJECT
10 virtual void hideEvent(QHideEvent* e) 10 virtual void hideEvent(QHideEvent* /* e */)
11 { 11 {