summaryrefslogtreecommitdiff
path: root/core/pim/addressbook
Unidiff
Diffstat (limited to 'core/pim/addressbook') (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 @@
1Stuff todo: 1Stuff todo:
2 2
3Urgent: 3Urgent:
4 4
5- Font menu is invisible using german translation 5- Font menu is invisible using german translation
6 6
7Important: 7Important:
8 8
9- Finishing of new View functions (List, Phonebook...) 9- Finishing of new View functions (List, Phonebook...)
10- Reload if contacts were changed externally 10- Reload if contacts were changed externally
11- "What's this" should be added 11- "What's this" should be added
12- The names of the countries are sorted by there english names, only.. 12- The names of the countries are sorted by there english names, only..
13 Even if they are translated.. :S 13 Even if they are translated.. :S
14- Store last settings of combo-boxes 14- Store last settings of combo-boxes
15- Mail-Icon is missing
15 16
16Less important: 17Less important:
17 18
18- Find widget should be replaced by something like 19- Find widget should be replaced by something like
19 qpdf has. 20 qpdf has.
20- The picker (alphabetical sort widget) should be 21- The picker (alphabetical sort widget) should be
21 placed verticaly or horizontally (configurable) 22 placed verticaly or horizontally (configurable)
22 23
23 24
24Should be Fixed (not absolute sure, need validation): 25Should be Fixed (not absolute sure, need validation):
25- "Nonenglish" translation bug has to be fixed. 26- "Nonenglish" translation bug has to be fixed.
26 27
27Fixed: 28Fixed:
28- Syncing: abtable not reloaded after sync. 29- 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 )
614 QArray<QRect> r = reg.rects(); 614 QArray<QRect> r = reg.rects();
615 for (unsigned int i=0; i<r.count(); i++) 615 for (unsigned int i=0; i<r.count(); i++)
616 p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); 616 p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) );
617} 617}
618#endif 618#endif
619#endif 619#endif
620 620
621 621
622// int AbTable::rowHeight( int ) const 622// int AbTable::rowHeight( int ) const
623// { 623// {
624// return 18; 624// return 18;
625// } 625// }
626 626
627// int AbTable::rowPos( int row ) const 627// int AbTable::rowPos( int row ) const
628// { 628// {
629// return 18*row; 629// return 18*row;
630// } 630// }
631 631
632// int AbTable::rowAt( int pos ) const 632// int AbTable::rowAt( int pos ) const
633// { 633// {
634// return QMIN( pos/18, numRows()-1 ); 634// return QMIN( pos/18, numRows()-1 );
635// } 635// }
636 636
637void AbTable::slotDoFind( const QString &findString, bool caseSensitive, 637void AbTable::slotDoFind( const QString &findString, bool caseSensitive,
638 bool backwards, int category ) 638 bool backwards, QString cat /* int category */ )
639{ 639{
640 int category = 0;
641 if ( cat.isEmpty() )
642 category = -2; // mCat.id("Contacts", "All");
643 else
644 category = mCat.id("Contacts", cat );
645
646 qWarning ("Found in Category %d", category);
647
640 if ( currFindRow < -1 ) 648 if ( currFindRow < -1 )
641 currFindRow = currentRow() - 1; 649 currFindRow = currentRow() - 1;
642 clearSelection( TRUE ); 650 clearSelection( TRUE );
643 int rows, row; 651 int rows, row;
644 AbTableItem *ati; 652 AbTableItem *ati;
645 QRegExp r( findString ); 653 QRegExp r( findString );
646 r.setCaseSensitive( caseSensitive ); 654 r.setCaseSensitive( caseSensitive );
647 rows = numRows(); 655 rows = numRows();
648 static bool wrapAround = true; 656 static bool wrapAround = true;
649 657
650 if ( !backwards ) { 658 if ( !backwards ) {
651 for ( row = currFindRow + 1; row < rows; row++ ) { 659 for ( row = currFindRow + 1; row < rows; row++ ) {
652 ati = static_cast<AbTableItem*>( item(row, 0) ); 660 ati = static_cast<AbTableItem*>( item(row, 0) );
653 if ( contactCompare( contactList[ati], r, category ) ) 661 if ( contactCompare( contactList[ati], r, category ) )
654 //if ( contactCompare( contactList[row], r, category ) ) 662 //if ( contactCompare( contactList[row], r, category ) )
655 break; 663 break;
656 } 664 }
657 } else { 665 } else {
658 for ( row = currFindRow - 1; row > -1; row-- ) { 666 for ( row = currFindRow - 1; row > -1; row-- ) {
659 ati = static_cast<AbTableItem*>( item(row, 0) ); 667 ati = static_cast<AbTableItem*>( item(row, 0) );
660 if ( contactCompare( contactList[ati], r, category ) ) 668 if ( contactCompare( contactList[ati], r, category ) )
661 //if ( contactCompare( contactList[row], r, category ) ) 669 //if ( contactCompare( contactList[row], r, category ) )
662 break; 670 break;
663 } 671 }
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:
79 void refresh(); 79 void refresh();
80 bool save(); 80 bool save();
81 void load(); 81 void load();
82 void reload(); 82 void reload();
83 83
84 // addresspicker mode 84 // addresspicker mode
85 void setChoiceNames( const QStringList& list); 85 void setChoiceNames( const QStringList& list);
86 QStringList choiceNames() const; 86 QStringList choiceNames() const;
87 void setChoiceSelection(int index, const QStringList& list); 87 void setChoiceSelection(int index, const QStringList& list);
88 QStringList choiceSelection(int index) const; 88 QStringList choiceSelection(int index) const;
89 void setShowCategory( const QString &b, const QString &c ); 89 void setShowCategory( const QString &b, const QString &c );
90 void setShowByLetter( char c ); 90 void setShowByLetter( char c );
91 QString showCategory() const; 91 QString showCategory() const;
92 QStringList categories(); 92 QStringList categories();
93 93
94 void resizeRows(); 94 void resizeRows();
95 95
96 void show(); 96 void show();
97 void setPaintingEnabled( bool e ); 97 void setPaintingEnabled( bool e );
98 98
99 QString showBook() const; 99 QString showBook() const;
100 100
101public slots: 101public slots:
102 void slotDoFind( const QString &str, bool caseSensitive, bool backwards, 102 void slotDoFind( const QString &str, bool caseSensitive, bool backwards,
103 int category ); 103 QString category = QString::null );
104signals: 104signals:
105 void empty( bool ); 105 void empty( bool );
106 void details(); 106 void details();
107 void signalNotFound(); 107 void signalNotFound();
108 void signalWrapAround(); 108 void signalWrapAround();
109 109
110protected: 110protected:
111 virtual void keyPressEvent( QKeyEvent *e ); 111 virtual void keyPressEvent( QKeyEvent *e );
112 112
113// int rowHeight( int ) const; 113// int rowHeight( int ) const;
114// int rowPos( int row ) const; 114// int rowPos( int row ) const;
115// virtual int rowAt( int pos ) const; 115// virtual int rowAt( int pos ) const;
116 116
117 117
118protected slots: 118protected slots:
119 void moveTo( char ); 119 void moveTo( char );
120 virtual void columnClicked( int col ); 120 virtual void columnClicked( int col );
121 void itemClicked(int,int col); 121 void itemClicked(int,int col);
122 void rowHeightChanged( int row ); 122 void rowHeightChanged( int row );
123 123
124private: 124private:
125 void loadFile( const QString &strFile, bool journalFile ); 125 void loadFile( const QString &strFile, bool journalFile );
126 void fitColumns(); 126 void fitColumns();
127 void resort(); 127 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 @@
47#include <qdialog.h> 47#include <qdialog.h>
48#include <qdir.h> 48#include <qdir.h>
49#include <qfile.h> 49#include <qfile.h>
50#include <qimage.h> 50#include <qimage.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qpe/qpemenubar.h> 52#include <qpe/qpemenubar.h>
53#include <qmessagebox.h> 53#include <qmessagebox.h>
54#include <qpixmap.h> 54#include <qpixmap.h>
55#include <qpopupmenu.h> 55#include <qpopupmenu.h>
56#include <qpe/qpetoolbar.h> 56#include <qpe/qpetoolbar.h>
57#include <qstringlist.h> 57#include <qstringlist.h>
58#include <qtoolbutton.h> 58#include <qtoolbutton.h>
59#include <qwhatsthis.h> 59#include <qwhatsthis.h>
60 60
61#include <stdlib.h> 61#include <stdlib.h>
62#include <sys/stat.h> 62#include <sys/stat.h>
63#include <sys/types.h> 63#include <sys/types.h>
64#include <fcntl.h> 64#include <fcntl.h>
65#include <unistd.h> 65#include <unistd.h>
66 66
67#include <qdatetime.h> 67#include <qdatetime.h>
68 68
69#include "picker.h" 69#include "picker.h"
70 70
71// Remove this for OPIE releae 1.0 !
72#define __DEBUG_RELEASE
73
74
75static QString addressbookPersonalVCardName() 71static QString addressbookPersonalVCardName()
76{ 72{
77 QString filename = Global::applicationFileName("addressbook", 73 QString filename = Global::applicationFileName("addressbook",
78 "businesscard.vcf"); 74 "businesscard.vcf");
79 return filename; 75 return filename;
80} 76}
81 77
82 78
83AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, 79AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
84 WFlags f ) 80 WFlags f )
85 : QMainWindow( parent, name, f ), 81 : QMainWindow( parent, name, f ),
86 abEditor(0), 82 abEditor(0),
87 bAbEditFirstTime(TRUE), 83 bAbEditFirstTime(TRUE),
88 syncing(FALSE) 84 syncing(FALSE)
89{ 85{
90 isLoading = true; 86 isLoading = true;
91 87
92 initFields(); 88 initFields();
93 89
94 setCaption( tr("Contacts") ); 90 setCaption( tr("Contacts") );
95 setIcon( Resource::loadPixmap( "AddressBook" ) ); 91 setIcon( Resource::loadPixmap( "AddressBook" ) );
96 92
97 setToolBarsMovable( FALSE ); 93 setToolBarsMovable( FALSE );
98 94
@@ -119,107 +115,118 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
119 115
120 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 116 a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
121 0, this, 0 ); 117 0, this, 0 );
122 actionEdit = a; 118 actionEdit = a;
123 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); 119 connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) );
124 a->addTo( edit ); 120 a->addTo( edit );
125 a->addTo( listTools ); 121 a->addTo( listTools );
126 122
127 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 123 a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null,
128 0, this, 0 ); 124 0, this, 0 );
129 actionTrash = a; 125 actionTrash = a;
130 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); 126 connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) );
131 a->addTo( edit ); 127 a->addTo( edit );
132 a->addTo( listTools ); 128 a->addTo( listTools );
133 129
134 130
135 // make it possible to go directly to businesscard via qcop call 131 // make it possible to go directly to businesscard via qcop call
136#if defined(Q_WS_QWS) 132#if defined(Q_WS_QWS)
137#if !defined(QT_NO_COP) 133#if !defined(QT_NO_COP)
138 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); 134 QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this );
139 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), 135 connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)),
140 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); 136 this, SLOT ( appMessage(const QCString &, const QByteArray &) ) );
141#endif 137#endif
142#endif 138#endif
143
144
145
146
147
148#ifndef MAKE_FOR_SHARP_ROM
149 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), 139 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ),
150 QString::null, 0, this, 0 ); 140 QString::null, 0, this, 0 );
151 actionFind = a; 141 actionFind = a;
152 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); 142 connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) );
153 a->addTo( edit ); 143 a->addTo( edit );
154 a->addTo( listTools ); 144 a->addTo( listTools );
155#endif 145
156 146 // Much better search widget, taken from QTReader.. (se)
147 searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE );
148 searchBar->setHorizontalStretchable( TRUE );
149 searchBar->hide();
150 searchEdit = new QLineEdit( searchBar, "searchEdit" );
151// QFont f("unifont", 16 /*, QFont::Bold*/);
152// searchEdit->setFont( f );
153 searchBar->setStretchableWidget( searchEdit );
154 connect( searchEdit, SIGNAL( returnPressed( ) ),
155 this, SLOT( slotFind( ) ) );
156
157 a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 );
158 connect( a, SIGNAL( activated() ), this, SLOT( slotFindNext() ) );
159 a->addTo( searchBar );
160
161 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
162 connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) );
163 a->addTo( searchBar );
157 164
158 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), 165 a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ),
159 QString::null, 0, this, 0 ); 166 QString::null, 0, this, 0 );
160 //a->setEnabled( FALSE ); we got support for it now :) zecke 167 //a->setEnabled( FALSE ); we got support for it now :) zecke
161 actionMail = a; 168 actionMail = a;
162 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); 169 connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) );
163 a->addTo( edit ); 170 a->addTo( edit );
164 a->addTo( listTools ); 171 a->addTo( listTools );
165 172
166 173
167 174
168 if ( Ir::supported() ) { 175 if ( Ir::supported() ) {
169 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, 176 a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null,
170 0, this, 0 ); 177 0, this, 0 );
171 actionBeam = a; 178 actionBeam = a;
172 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); 179 connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) );
173 a->addTo( edit ); 180 a->addTo( edit );
174 a->addTo( listTools ); 181 a->addTo( listTools );
175 } 182 }
176 183
177 edit->insertSeparator(); 184 edit->insertSeparator();
178 185
179 a = new QAction( tr("Import vCard"), QString::null, 0, 0, 0, TRUE ); 186 a = new QAction( tr("Import vCard"), QString::null, 0, 0, 0, TRUE );
180 actionPersonal = a; 187 actionPersonal = a;
181 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); 188 connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) );
182 a->addTo( edit ); 189 a->addTo( edit );
183 190
184 edit->insertSeparator(); 191 edit->insertSeparator();
185 192
186 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); 193 a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE );
187 actionPersonal = a; 194 actionPersonal = a;
188 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); 195 connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) );
189 a->addTo( edit ); 196 a->addTo( edit );
190 197
191 // Do we need this function ? (se) 198 // Do we need this function ? (se)
192 // a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); 199 // a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 );
193 // connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 200 // connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
194 // a->addTo( edit ); 201 // a->addTo( edit );
195 202
196 203
197#ifdef __DEBUG_RELEASE 204#ifdef __DEBUG_RELEASE
198 // Remove this function for public Release ! This is only 205 // Remove this function for public Release ! This is only
199 // for debug purposes .. 206 // for debug purposes ..
200 a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); 207 a = new QAction( tr( "Save all Data"), QString::null, 0, 0 );
201 connect( a, SIGNAL( activated() ), this, SLOT( save() ) ); 208 connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) );
202 a->addTo( edit ); 209 a->addTo( edit );
203#endif 210#endif
204 211
205 // Create Views 212 // Create Views
206 listContainer = new QWidget( this ); 213 listContainer = new QWidget( this );
207 214
208 QVBoxLayout *vb = new QVBoxLayout( listContainer ); 215 QVBoxLayout *vb = new QVBoxLayout( listContainer );
209 216
210 abList = new AbTable( &orderedFields, listContainer, "table" ); 217 abList = new AbTable( &orderedFields, listContainer, "table" );
211 vb->addWidget(abList); 218 vb->addWidget(abList);
212 // abList->setHScrollBarMode( QScrollView::AlwaysOff ); 219 // abList->setHScrollBarMode( QScrollView::AlwaysOff );
213 connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); 220 connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) );
214 connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); 221 connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) );
215 connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) ); 222 connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) );
216 223
217 mView = 0; 224 mView = 0;
218 225
219 abList->load(); 226 abList->load();
220 227
221 pLabel = new LetterPicker( listContainer ); 228 pLabel = new LetterPicker( listContainer );
222 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); 229 connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char)));
223 vb->addWidget(pLabel); 230 vb->addWidget(pLabel);
224 catMenu = new QPopupMenu( this ); 231 catMenu = new QPopupMenu( this );
225 catMenu->setCheckable( TRUE ); 232 catMenu->setCheckable( TRUE );
@@ -732,48 +739,55 @@ void AddressbookWindow::closeEvent( QCloseEvent *e )
732} 739}
733 740
734/* 741/*
735 Returns TRUE if it is OK to exit 742 Returns TRUE if it is OK to exit
736*/ 743*/
737 744
738bool AddressbookWindow::save() 745bool AddressbookWindow::save()
739{ 746{
740 if ( !abList->save() ) { 747 if ( !abList->save() ) {
741 if ( QMessageBox::critical( 0, tr( "Out of space" ), 748 if ( QMessageBox::critical( 0, tr( "Out of space" ),
742 tr("Unable to save information.\n" 749 tr("Unable to save information.\n"
743 "Free up some space\n" 750 "Free up some space\n"
744 "and try again.\n" 751 "and try again.\n"
745 "\nQuit anyway?"), 752 "\nQuit anyway?"),
746 QMessageBox::Yes|QMessageBox::Escape, 753 QMessageBox::Yes|QMessageBox::Escape,
747 QMessageBox::No|QMessageBox::Default ) 754 QMessageBox::No|QMessageBox::Default )
748 != QMessageBox::No ) 755 != QMessageBox::No )
749 return TRUE; 756 return TRUE;
750 else 757 else
751 return FALSE; 758 return FALSE;
752 } 759 }
753 return TRUE; 760 return TRUE;
754} 761}
755 762
763#ifdef __DEBUG_RELEASE
764void AddressbookWindow::slotSave()
765{
766 save();
767}
768#endif
769
756void AddressbookWindow::slotSettings() 770void AddressbookWindow::slotSettings()
757{ 771{
758 AddressSettings frmSettings( this ); 772 AddressSettings frmSettings( this );
759#if defined(Q_WS_QWS) || defined(_WS_QWS_) 773#if defined(Q_WS_QWS) || defined(_WS_QWS_)
760 frmSettings.showMaximized(); 774 frmSettings.showMaximized();
761#endif 775#endif
762 776
763 if ( frmSettings.exec() ) { 777 if ( frmSettings.exec() ) {
764 allFields.clear(); 778 allFields.clear();
765 orderedFields.clear(); 779 orderedFields.clear();
766 slOrderedFields.clear(); 780 slOrderedFields.clear();
767 initFields(); 781 initFields();
768 if ( abEditor ) 782 if ( abEditor )
769 abEditor->loadFields(); 783 abEditor->loadFields();
770 abList->refresh(); 784 abList->refresh();
771 } 785 }
772} 786}
773 787
774 788
775void AddressbookWindow::initFields() 789void AddressbookWindow::initFields()
776{ 790{
777 // we really don't need the things from the configuration, anymore 791 // we really don't need the things from the configuration, anymore
778 // only thing that is important are the important categories. So, 792 // only thing that is important are the important categories. So,
779 // Call the contact functions that correspond to these old functions... 793 // Call the contact functions that correspond to these old functions...
@@ -856,66 +870,79 @@ void AddressbookWindow::initFields()
856 orderedFields.remove( Qtopia::Notes ); 870 orderedFields.remove( Qtopia::Notes );
857 orderedFields.remove( Qtopia::Gender ); 871 orderedFields.remove( Qtopia::Gender );
858 slOrderedFields.remove( "Name Title" ); 872 slOrderedFields.remove( "Name Title" );
859 slOrderedFields.remove( "First Name" ); 873 slOrderedFields.remove( "First Name" );
860 slOrderedFields.remove( "Last Name" ); 874 slOrderedFields.remove( "Last Name" );
861 slOrderedFields.remove( "File As" ); 875 slOrderedFields.remove( "File As" );
862 slOrderedFields.remove( "Default Email" ); 876 slOrderedFields.remove( "Default Email" );
863 slOrderedFields.remove( "Notes" ); 877 slOrderedFields.remove( "Notes" );
864 slOrderedFields.remove( "Gender" ); 878 slOrderedFields.remove( "Gender" );
865 879
866 } 880 }
867} 881}
868 882
869 883
870AbLabel *AddressbookWindow::abView() 884AbLabel *AddressbookWindow::abView()
871{ 885{
872 if ( !mView ) { 886 if ( !mView ) {
873 mView = new AbLabel( this, "viewer" ); 887 mView = new AbLabel( this, "viewer" );
874 mView->init( OContact() ); 888 mView->init( OContact() );
875 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); 889 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) );
876 } 890 }
877 return mView; 891 return mView;
878} 892}
879 893
894void AddressbookWindow::slotFindOpen()
895{
896 searchBar->show();
897}
898void AddressbookWindow::slotFindClose()
899{
900 searchBar->hide();
901}
902void AddressbookWindow::slotFindNext()
903{
904}
905
880void AddressbookWindow::slotFind() 906void AddressbookWindow::slotFind()
881{ 907{
882#ifndef MAKE_FOR_SHARP_ROM
883 if ( centralWidget() == abView() ) 908 if ( centralWidget() == abView() )
884 showList(); 909 showList();
885 910
886 FindDialog frmFind( "Contacts", this ); 911 // FindDialog frmFind( "Contacts", this );
887 QObject::connect( &frmFind, SIGNAL(signalFindClicked(const QString &, bool, bool, int)), abList, SLOT(slotDoFind( const QString&,bool,bool,int))); 912 // QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) );
888 QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); 913 // QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) );
889 QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); 914 // frmFind.exec();
915
916 // QStringList categories = abList->categories();
917 // abList->setShowCategory( book, cat );
918 abList->slotDoFind( searchEdit->text(), false, false);
890 919
891 frmFind.exec();
892 920
893 if ( abList->numSelections() ) 921 if ( abList->numSelections() )
894 abList->clearSelection(); 922 abList->clearSelection();
895 923
896 abList->clearFindRow(); 924 abList->clearFindRow();
897#endif
898} 925}
899 926
900void AddressbookWindow::slotSetCategory( int c ) 927void AddressbookWindow::slotSetCategory( int c )
901{ 928{
902 929
903 QString cat, book; 930 QString cat, book;
904 931
905 if ( c <= 0 ) 932 if ( c <= 0 )
906 return; 933 return;
907 934
908 // Checkmark Book Menu Item Selected 935 // Checkmark Book Menu Item Selected
909 if ( c < 6 ) 936 if ( c < 6 )
910 for ( unsigned int i = 1; i < 6; i++ ) 937 for ( unsigned int i = 1; i < 6; i++ )
911 catMenu->setItemChecked( i, c == (int)i ); 938 catMenu->setItemChecked( i, c == (int)i );
912 939
913 // Checkmark Category Menu Item Selected 940 // Checkmark Category Menu Item Selected
914 else 941 else
915 for ( unsigned int i = 6; i < catMenu->count(); i++ ) 942 for ( unsigned int i = 6; i < catMenu->count(); i++ )
916 catMenu->setItemChecked( i, c == (int)i ); 943 catMenu->setItemChecked( i, c == (int)i );
917 944
918 for ( unsigned int i = 1; i < catMenu->count(); i++ ) { 945 for ( unsigned int i = 1; i < catMenu->count(); i++ ) {
919 if (catMenu->isItemChecked( i )) { 946 if (catMenu->isItemChecked( i )) {
920 if ( i == 1 ) // default List view 947 if ( i == 1 ) // default List view
921 book = QString::null; 948 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 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef Addressbook_H 20#ifndef Addressbook_H
21#define Addressbook_H 21#define Addressbook_H
22 22
23// Remove this for OPIE releae 1.0 !
24#define __DEBUG_RELEASE
25
23#include <qmainwindow.h> 26#include <qmainwindow.h>
24#include <qvaluelist.h> 27#include <qvaluelist.h>
25#include <qstringlist.h> 28#include <qstringlist.h>
29#include <qlineedit.h>
30#include "ofloatbar.h"
26 31
27class ContactEditor; 32class ContactEditor;
28class AbLabel; 33class AbLabel;
29class AbTable; 34class AbTable;
30class QPEToolBar; 35class QPEToolBar;
31class QPopupMenu; 36class QPopupMenu;
32class QToolButton; 37class QToolButton;
33class QDialog; 38class QDialog;
34class Ir; 39class Ir;
35class QAction; 40class QAction;
36class LetterPicker; 41class LetterPicker;
37 42
38class AddressbookWindow: public QMainWindow 43class AddressbookWindow: public QMainWindow
39{ 44{
40 Q_OBJECT 45 Q_OBJECT
41public: 46public:
42 AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 47 AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
43 ~AddressbookWindow(); 48 ~AddressbookWindow();
44 49
45protected: 50protected:
46 void resizeEvent( QResizeEvent * e ); 51 void resizeEvent( QResizeEvent * e );
47 void showList(); 52 void showList();
48 void showView(); 53 void showView();
49 enum EntryMode { NewEntry=0, EditEntry }; 54 enum EntryMode { NewEntry=0, EditEntry };
50 void editPersonal(); 55 void editPersonal();
51 void editEntry( EntryMode ); 56 void editEntry( EntryMode );
52 void closeEvent( QCloseEvent *e ); 57 void closeEvent( QCloseEvent *e );
53 bool save(); 58 bool save();
54 59
55public slots: 60public slots:
56 void flush(); 61 void flush();
57 void reload(); 62 void reload();
58 void appMessage(const QCString &, const QByteArray &); 63 void appMessage(const QCString &, const QByteArray &);
59 void setDocument( const QString & ); 64 void setDocument( const QString & );
65#ifdef __DEBUG_RELEASE
66 void slotSave();
67#endif
60 68
61private slots: 69private slots:
62 void importvCard(); 70 void importvCard();
63 void slotListNew(); 71 void slotListNew();
64 void slotListView(); 72 void slotListView();
65 void slotListDelete(); 73 void slotListDelete();
66 void slotViewBack(); 74 void slotViewBack();
67 void slotViewEdit(); 75 void slotViewEdit();
68 void slotPersonalView(); 76 void slotPersonalView();
69 void listIsEmpty( bool ); 77 void listIsEmpty( bool );
70 void slotSettings(); 78 void slotSettings();
71 void writeMail(); 79 void writeMail();
72 void slotBeam(); 80 void slotBeam();
73 void beamDone( Ir * ); 81 void beamDone( Ir * );
74 void slotFind();
75 void slotSetCategory( int ); 82 void slotSetCategory( int );
76 void slotSetLetter( char ); 83 void slotSetLetter( char );
77 void slotUpdateToolbar(); 84 void slotUpdateToolbar();
78 void slotSetFont(int); 85 void slotSetFont(int);
79 86
87 void slotFindOpen();
88 void slotFindClose();
89 void slotFind();
90 void slotFindNext();
91
80private: 92private:
81 void initFields(); // inititialize our fields... 93 void initFields(); // inititialize our fields...
82 AbLabel *abView(); 94 AbLabel *abView();
83 void populateCategories(); 95 void populateCategories();
84 96
85 QPopupMenu *catMenu, *fontMenu; 97 QPopupMenu *catMenu, *fontMenu;
86 QPEToolBar *listTools; 98 QPEToolBar *listTools;
87 QToolButton *deleteButton; 99 QToolButton *deleteButton;
88 QValueList<int> allFields, orderedFields; 100 QValueList<int> allFields, orderedFields;
89 QStringList slOrderedFields; 101 QStringList slOrderedFields;
90 enum Panes { paneList=0, paneView, paneEdit }; 102 enum Panes { paneList=0, paneView, paneEdit };
91 ContactEditor *abEditor; 103 ContactEditor *abEditor;
92 AbLabel *mView; 104 AbLabel *mView;
93 LetterPicker *pLabel; 105 LetterPicker *pLabel;
94 AbTable *abList; 106 AbTable *abList;
95 QWidget *listContainer; 107 QWidget *listContainer;
96 108
109 OFloatBar* searchBar;
110 QLineEdit* searchEdit;
111
97 QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, *actionPersonal, *actionMail; 112 QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, *actionPersonal, *actionMail;
98 113
99 bool bAbEditFirstTime; 114 bool bAbEditFirstTime;
100 int viewMargin; 115 int viewMargin;
101 116
102 bool syncing; 117 bool syncing;
103 QFont *defaultFont; 118 QFont *defaultFont;
104 int startFontSize; 119 int startFontSize;
105 120
106 bool isLoading; 121 bool isLoading;
107}; 122};
108 123
109#endif 124#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 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on release 2 CONFIG = qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin 3 DESTDIR = $(OPIEDIR)/bin
4 HEADERS= addressbook.h \ 4 HEADERS= addressbook.h \
5 contacteditor.h \ 5 contacteditor.h \
6 ablabel.h \ 6 ablabel.h \
7 abtable.h \ 7 abtable.h \
8 addresssettings.h \ 8 addresssettings.h \
9 picker.h 9 picker.h \
10 ofloatbar.h
10 SOURCES= main.cpp \ 11 SOURCES= main.cpp \
11 addressbook.cpp \ 12 addressbook.cpp \
12 contacteditor.cpp \ 13 contacteditor.cpp \
13 ablabel.cpp \ 14 ablabel.cpp \
14 abtable.cpp \ 15 abtable.cpp \
15 addresssettings.cpp \ 16 addresssettings.cpp \
16 picker.cpp 17 picker.cpp
17 INTERFACES= addresssettingsbase.ui 18 INTERFACES= addresssettingsbase.ui
18 TARGET = addressbook 19 TARGET = addressbook
19INCLUDEPATH += $(OPIEDIR)/include 20INCLUDEPATH += $(OPIEDIR)/include
20 DEPENDPATH+= $(OPIEDIR)/include 21 DEPENDPATH+= $(OPIEDIR)/include
21LIBS += -lqpe -lopie 22LIBS += -lqpe -lopie
22 23
23TRANSLATIONS = ../../../i18n/de/addressbook.ts \ 24TRANSLATIONS = ../../../i18n/de/addressbook.ts \
24 ../../../i18n/en/addressbook.ts \ 25 ../../../i18n/en/addressbook.ts \
25 ../../../i18n/es/addressbook.ts \ 26 ../../../i18n/es/addressbook.ts \
26 ../../../i18n/fr/addressbook.ts \ 27 ../../../i18n/fr/addressbook.ts \
27 ../../../i18n/hu/addressbook.ts \ 28 ../../../i18n/hu/addressbook.ts \
28 ../../../i18n/ja/addressbook.ts \ 29 ../../../i18n/ja/addressbook.ts \
29 ../../../i18n/ko/addressbook.ts \ 30 ../../../i18n/ko/addressbook.ts \
30 ../../../i18n/no/addressbook.ts \ 31 ../../../i18n/no/addressbook.ts \
31 ../../../i18n/pl/addressbook.ts \ 32 ../../../i18n/pl/addressbook.ts \
32 ../../../i18n/pt/addressbook.ts \ 33 ../../../i18n/pt/addressbook.ts \
33 ../../../i18n/pt_BR/addressbook.ts \ 34 ../../../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 @@
1#ifndef __OFLOATBAR_H
2#define __OFLOATBAR_H
3
4#include <qtoolbar.h>
5#include <qevent.h>
6
7class OFloatBar : public QToolBar
8{
9 Q_OBJECT
10 virtual void hideEvent(QHideEvent* e)
11 {
12 /*if (e->spontaneous())*/ emit OnHide();
13 }
14 public:
15 OFloatBar(char* t, QMainWindow* mw, QMainWindow::ToolBarDock td, bool f) : QToolBar(t, mw, td, f) {}
16 signals:
17 void OnHide();
18};
19
20#endif