summaryrefslogtreecommitdiff
authoreilers <eilers>2002-10-20 12:24:37 (UTC)
committer eilers <eilers>2002-10-20 12:24:37 (UTC)
commit4b27ac49b4027ffd59d2606f1aceea313446aede (patch) (unidiff)
treec03c578b727fbb95ffd0e2f2b8a2b6275ca781d5
parent82689364fd558ccd28253961204e6b3eb9e32b03 (diff)
downloadopie-4b27ac49b4027ffd59d2606f1aceea313446aede.zip
opie-4b27ac49b4027ffd59d2606f1aceea313446aede.tar.gz
opie-4b27ac49b4027ffd59d2606f1aceea313446aede.tar.bz2
Connected configuration to search engine
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/TODO18
-rw-r--r--core/pim/addressbook/abtable.cpp3
-rw-r--r--core/pim/addressbook/abtable.h2
-rw-r--r--core/pim/addressbook/addressbook.cpp2
4 files changed, 14 insertions, 11 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO
index 0accd87..4daa2a8 100644
--- a/core/pim/addressbook/TODO
+++ b/core/pim/addressbook/TODO
@@ -1,31 +1,33 @@
1Stuff todo: 1Stuff todo until OPIE 1.0 :
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- Picker: Activated letter schould be more visible
10- Reload if contacts were changed externally
11- "What's this" should be added 10- "What's this" should be added
12- The names of the countries are sorted by there english names, only..
13 Even if they are translated.. :S
14- Store last settings of combo-boxes 11- Store last settings of combo-boxes
15- Mail-Icon is missing 12- Mail-Icon is missing
13- Finishing of new View functions (List, Phonebook...)
14- The names of the countries are sorted by there english names, only..
15 Even if they are translated.. :S
16- Reload if contacts were changed externally
16 17
17Less important: 18Less important:
18 19
19- Find widget should be replaced by something like
20 qpdf has.
21- The picker (alphabetical sort widget) should be 20- The picker (alphabetical sort widget) should be
22 placed verticaly or horizontally (configurable) 21 placed verticaly or horizontally (configurable)
23- Use advanced database functions in abtable to decrease 22- Use advanced database functions in abtable to decrease
24 memory footprint and to make everything more easy ! 23 memory footprint and to make everything more easy !
25 (abtable should store Iterator for selected Category) 24 (abtable should store Iterator for selected Category)
26 25
27Should be Fixed (not absolute sure, need validation): 26Should be Fixed (not absolute sure, need further validation):
28- "Nonenglish" translation bug has to be fixed. 27- "Nonenglish" translation bug has to be fixed.
29 28
30Fixed: 29Fixed:
31- Syncing: abtable not reloaded after sync. 30- Syncing: abtable not reloaded after sync.
31- Find widget should be replaced by something like
32 qpdf has.
33- Adding a configuration dialog \ No newline at end of file
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index 97f4a8f..d4dcf7b 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -541,214 +541,215 @@ void AbTable::insertIntoTable( const OContact &cnt, int row )
541 ati = new AbTableItem( this, QTableItem::Never, strContact, strName); 541 ati = new AbTableItem( this, QTableItem::Never, strContact, strName);
542 setItem( row, 1, ati ); 542 setItem( row, 1, ati );
543 543
544 //### cannot do this; table only has two columns at this point 544 //### cannot do this; table only has two columns at this point
545 // setItem( row, 2, new AbPickItem( this ) ); 545 // setItem( row, 2, new AbPickItem( this ) );
546 546
547 // resort at some point? 547 // resort at some point?
548} 548}
549 549
550 550
551// Replace or add an entry 551// Replace or add an entry
552void AbTable::journalFreeReplace( const OContact &cnt, int row ) 552void AbTable::journalFreeReplace( const OContact &cnt, int row )
553{ 553{
554 QString strName, 554 QString strName,
555 strContact; 555 strContact;
556 AbTableItem *ati = 0l; 556 AbTableItem *ati = 0l;
557 557
558 strName = findContactName( cnt ); 558 strName = findContactName( cnt );
559 strContact = findContactContact( cnt, row ); 559 strContact = findContactContact( cnt, row );
560 ati = static_cast<AbTableItem*>(item(row, 0)); 560 ati = static_cast<AbTableItem*>(item(row, 0));
561 561
562 // Replace element if found in row "row" 562 // Replace element if found in row "row"
563 // or add this element if not. 563 // or add this element if not.
564 if ( ati != 0 ) { // replace 564 if ( ati != 0 ) { // replace
565 // :SX db access -> replace 565 // :SX db access -> replace
566 qWarning ("Replace Contact in DB ! UID: %d", contactList[ati].uid() ); 566 qWarning ("Replace Contact in DB ! UID: %d", contactList[ati].uid() );
567 m_contactdb.replace ( cnt ); 567 m_contactdb.replace ( cnt );
568 568
569 contactList.remove( ati ); 569 contactList.remove( ati );
570 ati->setItem( strName, strContact ); 570 ati->setItem( strName, strContact );
571 contactList.insert( ati, cnt ); 571 contactList.insert( ati, cnt );
572 572
573 ati = static_cast<AbTableItem*>(item(row, 1)); 573 ati = static_cast<AbTableItem*>(item(row, 1));
574 ati->setItem( strContact, strName ); 574 ati->setItem( strContact, strName );
575 575
576 }else{ // add 576 }else{ // add
577 int myrows = numRows(); 577 int myrows = numRows();
578 setNumRows( myrows + 1 ); 578 setNumRows( myrows + 1 );
579 insertIntoTable( cnt, myrows ); 579 insertIntoTable( cnt, myrows );
580 // gets deleted when returning -- Why ? (se) 580 // gets deleted when returning -- Why ? (se)
581 // :SX db access -> add 581 // :SX db access -> add
582 qWarning ("Are you sure to add to database ? -> Currently disabled !!"); 582 qWarning ("Are you sure to add to database ? -> Currently disabled !!");
583 // m_contactdb.add( cnt ); 583 // m_contactdb.add( cnt );
584 } 584 }
585} 585}
586 586
587// Remove entry 587// Remove entry
588void AbTable::journalFreeRemove( int row ) 588void AbTable::journalFreeRemove( int row )
589{ 589{
590 AbTableItem *ati; 590 AbTableItem *ati;
591 ati = static_cast<AbTableItem*>(item(row, 0)); 591 ati = static_cast<AbTableItem*>(item(row, 0));
592 if ( !ati ) 592 if ( !ati )
593 return; 593 return;
594 594
595 // :SX db access -> remove 595 // :SX db access -> remove
596 qWarning ("Remove Contact from DB ! UID: %d",contactList[ati].uid() ); 596 qWarning ("Remove Contact from DB ! UID: %d",contactList[ati].uid() );
597 m_contactdb.remove( contactList[ati].uid() ); 597 m_contactdb.remove( contactList[ati].uid() );
598 598
599 contactList.remove( ati ); 599 contactList.remove( ati );
600 600
601 realignTable( row ); 601 realignTable( row );
602 602
603} 603}
604 604
605#if QT_VERSION <= 230 605#if QT_VERSION <= 230
606#ifndef SINGLE_APP 606#ifndef SINGLE_APP
607void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) 607void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch )
608{ 608{
609 // Region of the rect we should draw 609 // Region of the rect we should draw
610 QRegion reg( QRect( cx, cy, cw, ch ) ); 610 QRegion reg( QRect( cx, cy, cw, ch ) );
611 // Subtract the table from it 611 // Subtract the table from it
612 reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); 612 reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) );
613 // And draw the rectangles (transformed as needed) 613 // And draw the rectangles (transformed as needed)
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, bool useRegExp,
638 bool backwards, QString cat /* int category */ ) 638 bool backwards, QString cat /* int category */ )
639{ 639{
640 int category = 0; 640 int category = 0;
641 641
642 // Use the current Category if nothing else selected 642 // Use the current Category if nothing else selected
643 if ( cat.isEmpty() ) 643 if ( cat.isEmpty() )
644 category = mCat.id( "Contacts", showCat ); 644 category = mCat.id( "Contacts", showCat );
645 else{ 645 else{
646 category = mCat.id("Contacts", cat ); 646 category = mCat.id("Contacts", cat );
647 } 647 }
648 648
649 qWarning ("Found in Category %d", category); 649 qWarning ("Found in Category %d", category);
650 650
651 if ( currFindRow < -1 ) 651 if ( currFindRow < -1 )
652 currFindRow = - 1; 652 currFindRow = - 1;
653 653
654 clearSelection( TRUE ); 654 clearSelection( TRUE );
655 int rows, row; 655 int rows, row;
656 AbTableItem *ati; 656 AbTableItem *ati;
657 QRegExp r( findString ); 657 QRegExp r( findString );
658 r.setCaseSensitive( caseSensitive ); 658 r.setCaseSensitive( caseSensitive );
659 r.setWildcard( !useRegExp );
659 rows = numRows(); 660 rows = numRows();
660 static bool wrapAround = true; 661 static bool wrapAround = true;
661 662
662 if ( !backwards ) { 663 if ( !backwards ) {
663 for ( row = currFindRow + 1; row < rows; row++ ) { 664 for ( row = currFindRow + 1; row < rows; row++ ) {
664 ati = static_cast<AbTableItem*>( item(row, 0) ); 665 ati = static_cast<AbTableItem*>( item(row, 0) );
665 if ( contactCompare( contactList[ati], r, category ) ) 666 if ( contactCompare( contactList[ati], r, category ) )
666 break; 667 break;
667 } 668 }
668 } else { 669 } else {
669 for ( row = currFindRow - 1; row > -1; row-- ) { 670 for ( row = currFindRow - 1; row > -1; row-- ) {
670 ati = static_cast<AbTableItem*>( item(row, 0) ); 671 ati = static_cast<AbTableItem*>( item(row, 0) );
671 if ( contactCompare( contactList[ati], r, category ) ) 672 if ( contactCompare( contactList[ati], r, category ) )
672 break; 673 break;
673 } 674 }
674 } 675 }
675 if ( row >= rows || row < 0 ) { 676 if ( row >= rows || row < 0 ) {
676 if ( row < 0 ) 677 if ( row < 0 )
677 currFindRow = rows; 678 currFindRow = rows;
678 else 679 else
679 currFindRow = -1; 680 currFindRow = -1;
680 681
681 if ( wrapAround ) 682 if ( wrapAround )
682 emit signalWrapAround(); 683 emit signalWrapAround();
683 else 684 else
684 emit signalNotFound(); 685 emit signalNotFound();
685 686
686 wrapAround = !wrapAround; 687 wrapAround = !wrapAround;
687 } else { 688 } else {
688 currFindRow = row; 689 currFindRow = row;
689 QTableSelection foundSelection; 690 QTableSelection foundSelection;
690 foundSelection.init( currFindRow, 0 ); 691 foundSelection.init( currFindRow, 0 );
691 foundSelection.expandTo( currFindRow, numCols() - 1 ); 692 foundSelection.expandTo( currFindRow, numCols() - 1 );
692 addSelection( foundSelection ); 693 addSelection( foundSelection );
693 setCurrentCell( currFindRow, 0 /* numCols() - 1 */ ); 694 setCurrentCell( currFindRow, 0 /* numCols() - 1 */ );
694 wrapAround = true; 695 wrapAround = true;
695 } 696 }
696} 697}
697 698
698static bool contactCompare( const OContact &cnt, const QRegExp &r, int category ) 699static bool contactCompare( const OContact &cnt, const QRegExp &r, int category )
699{ 700{
700 bool returnMe; 701 bool returnMe;
701 QArray<int> cats; 702 QArray<int> cats;
702 cats = cnt.categories(); 703 cats = cnt.categories();
703 704
704 returnMe = false; 705 returnMe = false;
705 if ( (cats.count() == 0) || (category == 0) ) 706 if ( (cats.count() == 0) || (category == 0) )
706 returnMe = cnt.match( r ); 707 returnMe = cnt.match( r );
707 else { 708 else {
708 int i; 709 int i;
709 for ( i = 0; i < int(cats.count()); i++ ) { 710 for ( i = 0; i < int(cats.count()); i++ ) {
710 if ( cats[i] == category ) { 711 if ( cats[i] == category ) {
711 returnMe = cnt.match( r ); 712 returnMe = cnt.match( r );
712 break; 713 break;
713 } 714 }
714 } 715 }
715 } 716 }
716 717
717 return returnMe; 718 return returnMe;
718} 719}
719 720
720void AbTable::fitColumns() 721void AbTable::fitColumns()
721{ 722{
722 int contentsWidth = visibleWidth() / 2; 723 int contentsWidth = visibleWidth() / 2;
723 724
724 if ( showBk == "Cards" ) { 725 if ( showBk == "Cards" ) {
725 showColumn(1); 726 showColumn(1);
726 //adjustColumn(1); 727 //adjustColumn(1);
727 setColumnWidth( 1, visibleWidth() ); 728 setColumnWidth( 1, visibleWidth() );
728 columnVisible = false; 729 columnVisible = false;
729 } else { 730 } else {
730 if ( columnVisible == false ){ 731 if ( columnVisible == false ){
731 showColumn(0); 732 showColumn(0);
732 columnVisible = true; 733 columnVisible = true;
733 } 734 }
734 setColumnWidth( 0, contentsWidth ); 735 setColumnWidth( 0, contentsWidth );
735 adjustColumn(1); 736 adjustColumn(1);
736 if ( columnWidth(1) < contentsWidth ) 737 if ( columnWidth(1) < contentsWidth )
737 setColumnWidth( 1, contentsWidth ); 738 setColumnWidth( 1, contentsWidth );
738 } 739 }
739} 740}
740 741
741void AbTable::show() 742void AbTable::show()
742{ 743{
743 fitColumns(); 744 fitColumns();
744 QTable::show(); 745 QTable::show();
745} 746}
746 747
747void AbTable::setChoiceNames( const QStringList& list) 748void AbTable::setChoiceNames( const QStringList& list)
748{ 749{
749 choicenames = list; 750 choicenames = list;
750 if ( choicenames.isEmpty() ) { 751 if ( choicenames.isEmpty() ) {
751 // hide pick column 752 // hide pick column
752 setNumCols( 2 ); 753 setNumCols( 2 );
753 } else { 754 } else {
754 // show pick column 755 // show pick column
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h
index 1039e66..b445874 100644
--- a/core/pim/addressbook/abtable.h
+++ b/core/pim/addressbook/abtable.h
@@ -6,149 +6,149 @@
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 20
21#ifndef ABTABLE_H 21#ifndef ABTABLE_H
22#define ABTABLE_H 22#define ABTABLE_H
23 23
24#include <qpe/categories.h> 24#include <qpe/categories.h>
25#include <opie/ocontact.h> 25#include <opie/ocontact.h>
26 26
27#include <qmap.h> 27#include <qmap.h>
28#include <qtable.h> 28#include <qtable.h>
29#include <qstringlist.h> 29#include <qstringlist.h>
30#include <qcombobox.h> 30#include <qcombobox.h>
31 31
32#include <opie/ocontactaccess.h> 32#include <opie/ocontactaccess.h>
33 33
34class AbTableItem : public QTableItem 34class AbTableItem : public QTableItem
35{ 35{
36public: 36public:
37 AbTableItem( QTable *t, EditType et, const QString &s, 37 AbTableItem( QTable *t, EditType et, const QString &s,
38 const QString &secondSortKey); 38 const QString &secondSortKey);
39 QString entryKey() const; 39 QString entryKey() const;
40 void setEntryKey( const QString & k ); 40 void setEntryKey( const QString & k );
41 virtual int alignment() const; 41 virtual int alignment() const;
42 virtual QString key() const; 42 virtual QString key() const;
43 void setItem( const QString &txt, const QString &secondKey ); 43 void setItem( const QString &txt, const QString &secondKey );
44 44
45private: 45private:
46 QString sortKey; 46 QString sortKey;
47}; 47};
48 48
49class AbPickItem : public QTableItem 49class AbPickItem : public QTableItem
50{ 50{
51public: 51public:
52 AbPickItem( QTable *t ); 52 AbPickItem( QTable *t );
53 53
54 QWidget *createEditor() const; 54 QWidget *createEditor() const;
55 void setContentFromEditor( QWidget *w ); 55 void setContentFromEditor( QWidget *w );
56 56
57private: 57private:
58 QGuardedPtr<QComboBox> cb; 58 QGuardedPtr<QComboBox> cb;
59}; 59};
60 60
61class AbTable : public QTable 61class AbTable : public QTable
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64 64
65public: 65public:
66 AbTable( const QValueList<int> *ordered, QWidget *parent, const char *name=0 ); 66 AbTable( const QValueList<int> *ordered, QWidget *parent, const char *name=0 );
67 ~AbTable(); 67 ~AbTable();
68 // NEW 68 // NEW
69 void addEntry( const OContact &newContact ); 69 void addEntry( const OContact &newContact );
70 OContact currentEntry(); 70 OContact currentEntry();
71 void replaceCurrentEntry( const OContact &newContact ); 71 void replaceCurrentEntry( const OContact &newContact );
72 72
73 void init(); 73 void init();
74 74
75 void deleteCurrentEntry(); 75 void deleteCurrentEntry();
76 void clear(); 76 void clear();
77 void clearFindRow() { currFindRow = -1; } 77 void clearFindRow() { currFindRow = -1; }
78 void loadFields(); 78 void loadFields();
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 useRegExp, bool backwards,
103 QString category = QString::null ); 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();
128 void updateJournal( const OContact &contact, OContact::journal_action action, 128 void updateJournal( const OContact &contact, OContact::journal_action action,
129 int row = -1 ); 129 int row = -1 );
130 void insertIntoTable( const OContact &contact, int row ); 130 void insertIntoTable( const OContact &contact, int row );
131 QString findContactName( const OContact &entry ); 131 QString findContactName( const OContact &entry );
132 QString findContactContact( const OContact &entry, int row ); 132 QString findContactContact( const OContact &entry, int row );
133 void journalFreeReplace( const OContact &cnt, int row ); 133 void journalFreeReplace( const OContact &cnt, int row );
134 void journalFreeRemove( int row ); 134 void journalFreeRemove( int row );
135 void realignTable( int ); 135 void realignTable( int );
136 void updateVisible(); 136 void updateVisible();
137 int lastSortCol; 137 int lastSortCol;
138 bool asc; 138 bool asc;
139 char showChar; 139 char showChar;
140 QMap<AbTableItem*, OContact> contactList; 140 QMap<AbTableItem*, OContact> contactList;
141 const QValueList<int> *intFields; 141 const QValueList<int> *intFields;
142 int currFindRow; 142 int currFindRow;
143 QString showCat; 143 QString showCat;
144 QStringList choicenames; 144 QStringList choicenames;
145 bool enablePainting; 145 bool enablePainting;
146 Categories mCat; 146 Categories mCat;
147 147
148 QString showBk; 148 QString showBk;
149 bool columnVisible; 149 bool columnVisible;
150 150
151 OContactAccess m_contactdb; 151 OContactAccess m_contactdb;
152 152
153}; 153};
154#endif // ABTABLE_H 154#endif // ABTABLE_H
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 84e66fb..f7e4c95 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -851,193 +851,193 @@ void AddressbookWindow::initFields()
851 851
852 if ( version >= ADDRESSVERSION ) { 852 if ( version >= ADDRESSVERSION ) {
853 853
854 cfg.setGroup( "ImportantCategory" ); 854 cfg.setGroup( "ImportantCategory" );
855 855
856 zn = cfg.readEntry( "Category" + QString::number(i), QString::null ); 856 zn = cfg.readEntry( "Category" + QString::number(i), QString::null );
857 while ( !zn.isNull() ) { 857 while ( !zn.isNull() ) {
858 if ( zn.contains( "Work" ) || zn.contains( "Mb" ) ) { 858 if ( zn.contains( "Work" ) || zn.contains( "Mb" ) ) {
859 slOrderedFields.clear(); 859 slOrderedFields.clear();
860 break; 860 break;
861 } 861 }
862 slOrderedFields.append( zn ); 862 slOrderedFields.append( zn );
863 zn = cfg.readEntry( "Category" + QString::number(++i), QString::null ); 863 zn = cfg.readEntry( "Category" + QString::number(++i), QString::null );
864 } 864 }
865 cfg.setGroup( "Font" ); 865 cfg.setGroup( "Font" );
866 startFontSize = cfg.readNumEntry( "fontSize", 1 ); 866 startFontSize = cfg.readNumEntry( "fontSize", 1 );
867 867
868 868
869 } else { 869 } else {
870 QString str; 870 QString str;
871 str = getenv("HOME"); 871 str = getenv("HOME");
872 str += "/Settings/AddressBook.conf"; 872 str += "/Settings/AddressBook.conf";
873 QFile::remove( str ); 873 QFile::remove( str );
874 } 874 }
875 875
876 if ( slOrderedFields.count() > 0 ) { 876 if ( slOrderedFields.count() > 0 ) {
877 for( QStringList::ConstIterator it = slOrderedFields.begin(); 877 for( QStringList::ConstIterator it = slOrderedFields.begin();
878 it != slOrderedFields.end(); ++it ) { 878 it != slOrderedFields.end(); ++it ) {
879 QValueList<int>::ConstIterator itVl; 879 QValueList<int>::ConstIterator itVl;
880 QStringList::ConstIterator itVis; 880 QStringList::ConstIterator itVis;
881 itVl = allFields.begin(); 881 itVl = allFields.begin();
882 for ( itVis = visibleFields.begin(); 882 for ( itVis = visibleFields.begin();
883 itVis != visibleFields.end() && itVl != allFields.end(); 883 itVis != visibleFields.end() && itVl != allFields.end();
884 ++itVis, ++itVl ) { 884 ++itVis, ++itVl ) {
885 if ( *it == *itVis && itVl != allFields.end() ) { 885 if ( *it == *itVis && itVl != allFields.end() ) {
886 orderedFields.append( *itVl ); 886 orderedFields.append( *itVl );
887 } 887 }
888 } 888 }
889 } 889 }
890 } else { 890 } else {
891 QValueList<int>::ConstIterator it; 891 QValueList<int>::ConstIterator it;
892 for ( it = allFields.begin(); it != allFields.end(); ++it ) 892 for ( it = allFields.begin(); it != allFields.end(); ++it )
893 orderedFields.append( *it ); 893 orderedFields.append( *it );
894 894
895 slOrderedFields = visibleFields; 895 slOrderedFields = visibleFields;
896 orderedFields.remove( Qtopia::AddressUid ); 896 orderedFields.remove( Qtopia::AddressUid );
897 orderedFields.remove( Qtopia::Title ); 897 orderedFields.remove( Qtopia::Title );
898 orderedFields.remove( Qtopia::Groups ); 898 orderedFields.remove( Qtopia::Groups );
899 orderedFields.remove( Qtopia::AddressCategory ); 899 orderedFields.remove( Qtopia::AddressCategory );
900 orderedFields.remove( Qtopia::FirstName ); 900 orderedFields.remove( Qtopia::FirstName );
901 orderedFields.remove( Qtopia::LastName ); 901 orderedFields.remove( Qtopia::LastName );
902 orderedFields.remove( Qtopia::DefaultEmail ); 902 orderedFields.remove( Qtopia::DefaultEmail );
903 orderedFields.remove( Qtopia::FileAs ); 903 orderedFields.remove( Qtopia::FileAs );
904 orderedFields.remove( Qtopia::Notes ); 904 orderedFields.remove( Qtopia::Notes );
905 orderedFields.remove( Qtopia::Gender ); 905 orderedFields.remove( Qtopia::Gender );
906 slOrderedFields.remove( "Name Title" ); 906 slOrderedFields.remove( "Name Title" );
907 slOrderedFields.remove( "First Name" ); 907 slOrderedFields.remove( "First Name" );
908 slOrderedFields.remove( "Last Name" ); 908 slOrderedFields.remove( "Last Name" );
909 slOrderedFields.remove( "File As" ); 909 slOrderedFields.remove( "File As" );
910 slOrderedFields.remove( "Default Email" ); 910 slOrderedFields.remove( "Default Email" );
911 slOrderedFields.remove( "Notes" ); 911 slOrderedFields.remove( "Notes" );
912 slOrderedFields.remove( "Gender" ); 912 slOrderedFields.remove( "Gender" );
913 913
914 } 914 }
915} 915}
916 916
917 917
918AbLabel *AddressbookWindow::abView() 918AbLabel *AddressbookWindow::abView()
919{ 919{
920 if ( !mView ) { 920 if ( !mView ) {
921 mView = new AbLabel( this, "viewer" ); 921 mView = new AbLabel( this, "viewer" );
922 mView->init( OContact() ); 922 mView->init( OContact() );
923 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); 923 connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) );
924 } 924 }
925 return mView; 925 return mView;
926} 926}
927 927
928void AddressbookWindow::slotFindOpen() 928void AddressbookWindow::slotFindOpen()
929{ 929{
930 searchBar->show(); 930 searchBar->show();
931 searchEdit->setFocus(); 931 searchEdit->setFocus();
932} 932}
933void AddressbookWindow::slotFindClose() 933void AddressbookWindow::slotFindClose()
934{ 934{
935 searchBar->hide(); 935 searchBar->hide();
936 abList->setFocus(); 936 abList->setFocus();
937} 937}
938void AddressbookWindow::slotFindNext() 938void AddressbookWindow::slotFindNext()
939{ 939{
940 if ( centralWidget() == abView() ) 940 if ( centralWidget() == abView() )
941 showList(); 941 showList();
942 942
943 // Maybe we should react on Wraparound and notfound ? 943 // Maybe we should react on Wraparound and notfound ?
944 // QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); 944 // QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) );
945 // QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); 945 // QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) );
946 946
947 abList->slotDoFind( searchEdit->text(), false, false); 947 abList->slotDoFind( searchEdit->text(), caseSensitive, useRegExp, false);
948 948
949 949
950 if ( abList->numSelections() ) 950 if ( abList->numSelections() )
951 abList->clearSelection(); 951 abList->clearSelection();
952 952
953} 953}
954 954
955void AddressbookWindow::slotFind() 955void AddressbookWindow::slotFind()
956{ 956{
957 957
958 abList->clearFindRow(); 958 abList->clearFindRow();
959 slotFindNext(); 959 slotFindNext();
960} 960}
961 961
962void AddressbookWindow::slotSetCategory( int c ) 962void AddressbookWindow::slotSetCategory( int c )
963{ 963{
964 964
965 QString cat, book; 965 QString cat, book;
966 966
967 if ( c <= 0 ) 967 if ( c <= 0 )
968 return; 968 return;
969 969
970 // Set checkItem for selected one 970 // Set checkItem for selected one
971 for ( unsigned int i = 1; i < catMenu->count(); i++ ) 971 for ( unsigned int i = 1; i < catMenu->count(); i++ )
972 catMenu->setItemChecked( i, c == (int)i ); 972 catMenu->setItemChecked( i, c == (int)i );
973 973
974 for ( unsigned int i = 1; i < catMenu->count(); i++ ) { 974 for ( unsigned int i = 1; i < catMenu->count(); i++ ) {
975 if (catMenu->isItemChecked( i )) { 975 if (catMenu->isItemChecked( i )) {
976 if ( i == 1 ) // default List view 976 if ( i == 1 ) // default List view
977 book = QString::null; 977 book = QString::null;
978 else if ( i == 2 ) 978 else if ( i == 2 )
979 book = "Phone"; 979 book = "Phone";
980 else if ( i == 3 ) 980 else if ( i == 3 )
981 book = "Company"; 981 book = "Company";
982 else if ( i == 4 ) 982 else if ( i == 4 )
983 book = "Email"; 983 book = "Email";
984 else if ( i == 5 ) 984 else if ( i == 5 )
985 book = "Cards"; 985 book = "Cards";
986 else if ( i == 6 ) // default All Categories 986 else if ( i == 6 ) // default All Categories
987 cat = QString::null; 987 cat = QString::null;
988 else if ( i == (unsigned int)catMenu->count() ) // last menu option will be Unfiled 988 else if ( i == (unsigned int)catMenu->count() ) // last menu option will be Unfiled
989 cat = "Unfiled"; 989 cat = "Unfiled";
990 else 990 else
991 cat = abList->categories()[i - 7]; 991 cat = abList->categories()[i - 7];
992 } 992 }
993 } 993 }
994 994
995 abList->setShowCategory( book, cat ); 995 abList->setShowCategory( book, cat );
996 996
997 if ( book.isEmpty() ) 997 if ( book.isEmpty() )
998 book = "List"; 998 book = "List";
999 if ( cat.isEmpty() ) 999 if ( cat.isEmpty() )
1000 cat = "All"; 1000 cat = "All";
1001 1001
1002 setCaption( tr( "Contacts" ) + " - " + tr( book ) + " - " + tr( cat ) ); 1002 setCaption( tr( "Contacts" ) + " - " + tr( book ) + " - " + tr( cat ) );
1003} 1003}
1004 1004
1005void AddressbookWindow::slotSetLetter( char c ) { 1005void AddressbookWindow::slotSetLetter( char c ) {
1006 1006
1007 abList->setShowByLetter( c ); 1007 abList->setShowByLetter( c );
1008 1008
1009} 1009}
1010 1010
1011void AddressbookWindow::populateCategories() 1011void AddressbookWindow::populateCategories()
1012{ 1012{
1013 catMenu->clear(); 1013 catMenu->clear();
1014 1014
1015 int id, rememberId; 1015 int id, rememberId;
1016 id = 1; 1016 id = 1;
1017 rememberId = 0; 1017 rememberId = 0;
1018 1018
1019 catMenu->insertItem( tr( "List" ), id++ ); 1019 catMenu->insertItem( tr( "List" ), id++ );
1020 catMenu->insertItem( tr( "Phone Book" ), id++ ); 1020 catMenu->insertItem( tr( "Phone Book" ), id++ );
1021 catMenu->insertItem( tr( "Company Book" ), id++ ); 1021 catMenu->insertItem( tr( "Company Book" ), id++ );
1022 catMenu->insertItem( tr( "Email Book" ), id++ ); 1022 catMenu->insertItem( tr( "Email Book" ), id++ );
1023 catMenu->insertItem( tr( "Cards" ), id++ ); 1023 catMenu->insertItem( tr( "Cards" ), id++ );
1024 catMenu->insertSeparator(); 1024 catMenu->insertSeparator();
1025 1025
1026 catMenu->insertItem( tr( "All" ), id++ ); 1026 catMenu->insertItem( tr( "All" ), id++ );
1027 QStringList categories = abList->categories(); 1027 QStringList categories = abList->categories();
1028 categories.append( tr( "Unfiled" ) ); 1028 categories.append( tr( "Unfiled" ) );
1029 for ( QStringList::Iterator it = categories.begin(); 1029 for ( QStringList::Iterator it = categories.begin();
1030 it != categories.end(); ++it ) { 1030 it != categories.end(); ++it ) {
1031 catMenu->insertItem( *it, id ); 1031 catMenu->insertItem( *it, id );
1032 if ( *it == abList->showCategory() ) 1032 if ( *it == abList->showCategory() )
1033 rememberId = id; 1033 rememberId = id;
1034 ++id; 1034 ++id;
1035 } 1035 }
1036 1036
1037 if ( abList->showBook().isEmpty() ) { 1037 if ( abList->showBook().isEmpty() ) {
1038 catMenu->setItemChecked( 1, true ); 1038 catMenu->setItemChecked( 1, true );
1039 } else if ( abList->showBook() == "Phone" ) { 1039 } else if ( abList->showBook() == "Phone" ) {
1040 catMenu->setItemChecked( 2, true ); 1040 catMenu->setItemChecked( 2, true );
1041 } else if ( abList->showBook() == "Company" ) { 1041 } else if ( abList->showBook() == "Company" ) {
1042 catMenu->setItemChecked( 3, true ); 1042 catMenu->setItemChecked( 3, true );
1043 } else if ( abList->showBook() == "Email" ) { 1043 } else if ( abList->showBook() == "Email" ) {