-rw-r--r-- | core/pim/addressbook/TODO | 4 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 18 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.h | 2 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 75 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.h | 6 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.pro | 9 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg.cpp | 45 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg.h | 25 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg_base.ui | 232 | ||||
-rw-r--r-- | core/pim/addressbook/ofloatbar.h | 2 |
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 | |||
@@ -1,29 +1,31 @@ | |||
1 | Stuff todo: | 1 | Stuff todo: |
2 | 2 | ||
3 | Urgent: | 3 | Urgent: |
4 | 4 | ||
5 | - Font menu is invisible using german translation | 5 | - Font menu is invisible using german translation |
6 | 6 | ||
7 | Important: | 7 | Important: |
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 | - Mail-Icon is missing |
16 | 16 | ||
17 | Less important: | 17 | Less important: |
18 | 18 | ||
19 | - Find widget should be replaced by something like | 19 | - Find widget should be replaced by something like |
20 | qpdf has. | 20 | qpdf has. |
21 | - The picker (alphabetical sort widget) should be | 21 | - The picker (alphabetical sort widget) should be |
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 | ||
25 | Should be Fixed (not absolute sure, need validation): | 27 | Should be Fixed (not absolute sure, need validation): |
26 | - "Nonenglish" translation bug has to be fixed. | 28 | - "Nonenglish" translation bug has to be fixed. |
27 | 29 | ||
28 | Fixed: | 30 | Fixed: |
29 | - Syncing: abtable not reloaded after sync. | 31 | - Syncing: abtable not reloaded after sync. |
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 | |||
@@ -83,97 +83,97 @@ void AbTableItem::setItem( const QString &txt, const QString &secondKey ) | |||
83 | 83 | ||
84 | \brief QTableItem based class for showing slection of an entry | 84 | \brief QTableItem based class for showing slection of an entry |
85 | */ | 85 | */ |
86 | 86 | ||
87 | AbPickItem::AbPickItem( QTable *t ) : | 87 | AbPickItem::AbPickItem( QTable *t ) : |
88 | QTableItem(t, WhenCurrent, "?") | 88 | QTableItem(t, WhenCurrent, "?") |
89 | { | 89 | { |
90 | } | 90 | } |
91 | 91 | ||
92 | QWidget *AbPickItem::createEditor() const | 92 | QWidget *AbPickItem::createEditor() const |
93 | { | 93 | { |
94 | QComboBox* combo = new QComboBox( table()->viewport() ); | 94 | QComboBox* combo = new QComboBox( table()->viewport() ); |
95 | ( (AbPickItem*)this )->cb = combo; | 95 | ( (AbPickItem*)this )->cb = combo; |
96 | AbTable* t = static_cast<AbTable*>(table()); | 96 | AbTable* t = static_cast<AbTable*>(table()); |
97 | QStringList c = t->choiceNames(); | 97 | QStringList c = t->choiceNames(); |
98 | int cur = 0; | 98 | int cur = 0; |
99 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { | 99 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { |
100 | if ( *it == text() ) | 100 | if ( *it == text() ) |
101 | cur = combo->count(); | 101 | cur = combo->count(); |
102 | combo->insertItem(*it); | 102 | combo->insertItem(*it); |
103 | } | 103 | } |
104 | combo->setCurrentItem(cur); | 104 | combo->setCurrentItem(cur); |
105 | return combo; | 105 | return combo; |
106 | } | 106 | } |
107 | 107 | ||
108 | void AbPickItem::setContentFromEditor( QWidget *w ) | 108 | void AbPickItem::setContentFromEditor( QWidget *w ) |
109 | { | 109 | { |
110 | if ( w->inherits("QComboBox") ) | 110 | if ( w->inherits("QComboBox") ) |
111 | setText( ( (QComboBox*)w )->currentText() ); | 111 | setText( ( (QComboBox*)w )->currentText() ); |
112 | else | 112 | else |
113 | QTableItem::setContentFromEditor( w ); | 113 | QTableItem::setContentFromEditor( w ); |
114 | } | 114 | } |
115 | 115 | ||
116 | /*! | 116 | /*! |
117 | \class AbTable abtable.h | 117 | \class AbTable abtable.h |
118 | 118 | ||
119 | \brief QTable based class for showing a list of entries | 119 | \brief QTable based class for showing a list of entries |
120 | */ | 120 | */ |
121 | 121 | ||
122 | AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *name ) | 122 | AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *name ) |
123 | // #ifdef QT_QTABLE_NOHEADER_CONSTRUCTOR | 123 | // #ifdef QT_QTABLE_NOHEADER_CONSTRUCTOR |
124 | // : QTable( 0, 0, parent, name, TRUE ), | 124 | // : QTable( 0, 0, parent, name, TRUE ), |
125 | // #else | 125 | // #else |
126 | : QTable( parent, name ), | 126 | : QTable( parent, name ), |
127 | // #endif | 127 | // #endif |
128 | lastSortCol( -1 ), | 128 | lastSortCol( -1 ), |
129 | asc( TRUE ), | 129 | asc( TRUE ), |
130 | intFields( order ), | 130 | intFields( order ), |
131 | currFindRow( -2 ), | 131 | currFindRow( -1 ), |
132 | mCat( 0 ), | 132 | mCat( 0 ), |
133 | m_contactdb ("addressbook", 0l, 0l, false) // Handle syncing myself.. ! | 133 | m_contactdb ("addressbook", 0l, 0l, false) // Handle syncing myself.. ! |
134 | { | 134 | { |
135 | mCat.load( categoryFileName() ); | 135 | mCat.load( categoryFileName() ); |
136 | setSelectionMode( NoSelection ); | 136 | setSelectionMode( NoSelection ); |
137 | init(); | 137 | init(); |
138 | setSorting( TRUE ); | 138 | setSorting( TRUE ); |
139 | connect( this, SIGNAL(clicked(int,int,int,const QPoint &)), | 139 | connect( this, SIGNAL(clicked(int,int,int,const QPoint &)), |
140 | this, SLOT(itemClicked(int,int)) ); | 140 | this, SLOT(itemClicked(int,int)) ); |
141 | } | 141 | } |
142 | 142 | ||
143 | AbTable::~AbTable() | 143 | AbTable::~AbTable() |
144 | { | 144 | { |
145 | } | 145 | } |
146 | 146 | ||
147 | void AbTable::init() | 147 | void AbTable::init() |
148 | { | 148 | { |
149 | showChar = '\0'; | 149 | showChar = '\0'; |
150 | setNumRows( 0 ); | 150 | setNumRows( 0 ); |
151 | setNumCols( 2 ); | 151 | setNumCols( 2 ); |
152 | 152 | ||
153 | horizontalHeader()->setLabel( 0, tr( "Full Name" )); | 153 | horizontalHeader()->setLabel( 0, tr( "Full Name" )); |
154 | horizontalHeader()->setLabel( 1, tr( "Contact" )); | 154 | horizontalHeader()->setLabel( 1, tr( "Contact" )); |
155 | setLeftMargin( 0 ); | 155 | setLeftMargin( 0 ); |
156 | verticalHeader()->hide(); | 156 | verticalHeader()->hide(); |
157 | columnVisible = true; | 157 | columnVisible = true; |
158 | } | 158 | } |
159 | 159 | ||
160 | void AbTable::columnClicked( int col ) | 160 | void AbTable::columnClicked( int col ) |
161 | { | 161 | { |
162 | if ( !sorting() ) | 162 | if ( !sorting() ) |
163 | return; | 163 | return; |
164 | 164 | ||
165 | if ( lastSortCol == -1 ) | 165 | if ( lastSortCol == -1 ) |
166 | lastSortCol = col; | 166 | lastSortCol = col; |
167 | 167 | ||
168 | if ( col == lastSortCol ) { | 168 | if ( col == lastSortCol ) { |
169 | asc = !asc; | 169 | asc = !asc; |
170 | } else { | 170 | } else { |
171 | lastSortCol = col; | 171 | lastSortCol = col; |
172 | asc = TRUE; | 172 | asc = TRUE; |
173 | } | 173 | } |
174 | //QMessageBox::information( this, "resort", "columnClicked" ); | 174 | //QMessageBox::information( this, "resort", "columnClicked" ); |
175 | resort(); | 175 | resort(); |
176 | } | 176 | } |
177 | 177 | ||
178 | void AbTable::resort() | 178 | void AbTable::resort() |
179 | { | 179 | { |
@@ -593,159 +593,161 @@ void AbTable::journalFreeRemove( int row ) | |||
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 |
607 | void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) | 607 | void 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 | ||
637 | void AbTable::slotDoFind( const QString &findString, bool caseSensitive, | 637 | void AbTable::slotDoFind( const QString &findString, bool caseSensitive, |
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 | |||
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 | ||
646 | qWarning ("Found in Category %d", category); | 649 | qWarning ("Found in Category %d", category); |
647 | 650 | ||
648 | if ( currFindRow < -1 ) | 651 | if ( currFindRow < -1 ) |
649 | currFindRow = currentRow() - 1; | 652 | currFindRow = - 1; |
653 | |||
650 | clearSelection( TRUE ); | 654 | clearSelection( TRUE ); |
651 | int rows, row; | 655 | int rows, row; |
652 | AbTableItem *ati; | 656 | AbTableItem *ati; |
653 | QRegExp r( findString ); | 657 | QRegExp r( findString ); |
654 | r.setCaseSensitive( caseSensitive ); | 658 | r.setCaseSensitive( caseSensitive ); |
655 | rows = numRows(); | 659 | rows = numRows(); |
656 | static bool wrapAround = true; | 660 | static bool wrapAround = true; |
657 | 661 | ||
658 | if ( !backwards ) { | 662 | if ( !backwards ) { |
659 | for ( row = currFindRow + 1; row < rows; row++ ) { | 663 | for ( row = currFindRow + 1; row < rows; row++ ) { |
660 | ati = static_cast<AbTableItem*>( item(row, 0) ); | 664 | ati = static_cast<AbTableItem*>( item(row, 0) ); |
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; |
664 | } | 667 | } |
665 | } else { | 668 | } else { |
666 | for ( row = currFindRow - 1; row > -1; row-- ) { | 669 | for ( row = currFindRow - 1; row > -1; row-- ) { |
667 | ati = static_cast<AbTableItem*>( item(row, 0) ); | 670 | ati = static_cast<AbTableItem*>( item(row, 0) ); |
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; |
671 | } | 673 | } |
672 | } | 674 | } |
673 | if ( row >= rows || row < 0 ) { | 675 | if ( row >= rows || row < 0 ) { |
674 | if ( row < 0 ) | 676 | if ( row < 0 ) |
675 | currFindRow = rows; | 677 | currFindRow = rows; |
676 | else | 678 | else |
677 | currFindRow = -1; | 679 | currFindRow = -1; |
678 | 680 | ||
679 | if ( wrapAround ) | 681 | if ( wrapAround ) |
680 | emit signalWrapAround(); | 682 | emit signalWrapAround(); |
681 | else | 683 | else |
682 | emit signalNotFound(); | 684 | emit signalNotFound(); |
683 | 685 | ||
684 | wrapAround = !wrapAround; | 686 | wrapAround = !wrapAround; |
685 | } else { | 687 | } else { |
686 | currFindRow = row; | 688 | currFindRow = row; |
687 | QTableSelection foundSelection; | 689 | QTableSelection foundSelection; |
688 | foundSelection.init( currFindRow, 0 ); | 690 | foundSelection.init( currFindRow, 0 ); |
689 | foundSelection.expandTo( currFindRow, numCols() - 1 ); | 691 | foundSelection.expandTo( currFindRow, numCols() - 1 ); |
690 | addSelection( foundSelection ); | 692 | addSelection( foundSelection ); |
691 | setCurrentCell( currFindRow, numCols() - 1 ); | 693 | setCurrentCell( currFindRow, 0 /* numCols() - 1 */ ); |
692 | wrapAround = true; | 694 | wrapAround = true; |
693 | } | 695 | } |
694 | } | 696 | } |
695 | 697 | ||
696 | static bool contactCompare( const OContact &cnt, const QRegExp &r, int category ) | 698 | static bool contactCompare( const OContact &cnt, const QRegExp &r, int category ) |
697 | { | 699 | { |
698 | bool returnMe; | 700 | bool returnMe; |
699 | QArray<int> cats; | 701 | QArray<int> cats; |
700 | cats = cnt.categories(); | 702 | cats = cnt.categories(); |
701 | 703 | ||
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 ); |
705 | else { | 707 | else { |
706 | int i; | 708 | int i; |
707 | for ( i = 0; i < int(cats.count()); i++ ) { | 709 | for ( i = 0; i < int(cats.count()); i++ ) { |
708 | if ( cats[i] == category ) { | 710 | if ( cats[i] == category ) { |
709 | returnMe = cnt.match( r ); | 711 | returnMe = cnt.match( r ); |
710 | break; | 712 | break; |
711 | } | 713 | } |
712 | } | 714 | } |
713 | } | 715 | } |
714 | 716 | ||
715 | return returnMe; | 717 | return returnMe; |
716 | } | 718 | } |
717 | 719 | ||
718 | void AbTable::fitColumns() | 720 | void AbTable::fitColumns() |
719 | { | 721 | { |
720 | int contentsWidth = visibleWidth() / 2; | 722 | int contentsWidth = visibleWidth() / 2; |
721 | 723 | ||
722 | if ( showBk == "Cards" ) { | 724 | if ( showBk == "Cards" ) { |
723 | showColumn(1); | 725 | showColumn(1); |
724 | //adjustColumn(1); | 726 | //adjustColumn(1); |
725 | setColumnWidth( 1, visibleWidth() ); | 727 | setColumnWidth( 1, visibleWidth() ); |
726 | columnVisible = false; | 728 | columnVisible = false; |
727 | } else { | 729 | } else { |
728 | if ( columnVisible == false ){ | 730 | if ( columnVisible == false ){ |
729 | showColumn(0); | 731 | showColumn(0); |
730 | columnVisible = true; | 732 | columnVisible = true; |
731 | } | 733 | } |
732 | setColumnWidth( 0, contentsWidth ); | 734 | setColumnWidth( 0, contentsWidth ); |
733 | adjustColumn(1); | 735 | adjustColumn(1); |
734 | if ( columnWidth(1) < contentsWidth ) | 736 | if ( columnWidth(1) < contentsWidth ) |
735 | setColumnWidth( 1, contentsWidth ); | 737 | setColumnWidth( 1, contentsWidth ); |
736 | } | 738 | } |
737 | } | 739 | } |
738 | 740 | ||
739 | void AbTable::show() | 741 | void AbTable::show() |
740 | { | 742 | { |
741 | fitColumns(); | 743 | fitColumns(); |
742 | QTable::show(); | 744 | QTable::show(); |
743 | } | 745 | } |
744 | 746 | ||
745 | void AbTable::setChoiceNames( const QStringList& list) | 747 | void AbTable::setChoiceNames( const QStringList& list) |
746 | { | 748 | { |
747 | choicenames = list; | 749 | choicenames = list; |
748 | if ( choicenames.isEmpty() ) { | 750 | if ( choicenames.isEmpty() ) { |
749 | // hide pick column | 751 | // hide pick column |
750 | setNumCols( 2 ); | 752 | setNumCols( 2 ); |
751 | } else { | 753 | } else { |
diff --git a/core/pim/addressbook/abtable.h b/core/pim/addressbook/abtable.h index a603e17..1039e66 100644 --- a/core/pim/addressbook/abtable.h +++ b/core/pim/addressbook/abtable.h | |||
@@ -29,97 +29,97 @@ | |||
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 | ||
34 | class AbTableItem : public QTableItem | 34 | class AbTableItem : public QTableItem |
35 | { | 35 | { |
36 | public: | 36 | public: |
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 | ||
45 | private: | 45 | private: |
46 | QString sortKey; | 46 | QString sortKey; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | class AbPickItem : public QTableItem | 49 | class AbPickItem : public QTableItem |
50 | { | 50 | { |
51 | public: | 51 | public: |
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 | ||
57 | private: | 57 | private: |
58 | QGuardedPtr<QComboBox> cb; | 58 | QGuardedPtr<QComboBox> cb; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | class AbTable : public QTable | 61 | class AbTable : public QTable |
62 | { | 62 | { |
63 | Q_OBJECT | 63 | Q_OBJECT |
64 | 64 | ||
65 | public: | 65 | public: |
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 = -2; } | 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 | ||
101 | public slots: | 101 | public slots: |
102 | void slotDoFind( const QString &str, bool caseSensitive, bool backwards, | 102 | void slotDoFind( const QString &str, bool caseSensitive, bool backwards, |
103 | QString category = QString::null ); | 103 | QString category = QString::null ); |
104 | signals: | 104 | signals: |
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 | ||
110 | protected: | 110 | protected: |
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 | ||
118 | protected slots: | 118 | protected 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 | ||
124 | private: | 124 | private: |
125 | void loadFile( const QString &strFile, bool journalFile ); | 125 | void loadFile( const QString &strFile, bool journalFile ); |
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 | |||
@@ -1,130 +1,130 @@ | |||
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 | ** OContact info@trolltech.com if any conditions of this licensing are | 16 | ** OContact 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 | #define QTOPIA_INTERNAL_FD | 21 | #define QTOPIA_INTERNAL_FD |
22 | 22 | ||
23 | #include "contacteditor.h" | 23 | #include "contacteditor.h" |
24 | #include "ablabel.h" | 24 | #include "ablabel.h" |
25 | #include "abtable.h" | 25 | #include "abtable.h" |
26 | #include "addresssettings.h" | 26 | #include "addresssettings.h" |
27 | #include "addressbook.h" | 27 | #include "addressbook.h" |
28 | 28 | ||
29 | 29 | ||
30 | #include <opie/ofileselector.h> | 30 | #include <opie/ofileselector.h> |
31 | #include <opie/ofiledialog.h> | 31 | #include <opie/ofiledialog.h> |
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
34 | #include <opie/ocontact.h> | 34 | #include <opie/ocontact.h> |
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> |
41 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
42 | #include <qpe/ir.h> | 38 | #include <qpe/ir.h> |
43 | #include <qpe/qpemessagebox.h> | 39 | #include <qpe/qpemessagebox.h> |
44 | #include <qpe/qcopenvelope_qws.h> | 40 | #include <qpe/qcopenvelope_qws.h> |
45 | 41 | ||
46 | #include <qaction.h> | 42 | #include <qaction.h> |
47 | #include <qdialog.h> | 43 | #include <qdialog.h> |
48 | #include <qdir.h> | 44 | #include <qdir.h> |
49 | #include <qfile.h> | 45 | #include <qfile.h> |
50 | #include <qimage.h> | 46 | #include <qimage.h> |
51 | #include <qlayout.h> | 47 | #include <qlayout.h> |
52 | #include <qpe/qpemenubar.h> | 48 | #include <qpe/qpemenubar.h> |
53 | #include <qmessagebox.h> | 49 | #include <qmessagebox.h> |
54 | #include <qpixmap.h> | 50 | #include <qpixmap.h> |
55 | #include <qpopupmenu.h> | 51 | #include <qpopupmenu.h> |
56 | #include <qpe/qpetoolbar.h> | 52 | #include <qpe/qpetoolbar.h> |
57 | #include <qstringlist.h> | 53 | #include <qstringlist.h> |
58 | #include <qtoolbutton.h> | 54 | #include <qtoolbutton.h> |
59 | #include <qwhatsthis.h> | 55 | #include <qwhatsthis.h> |
60 | 56 | ||
61 | #include <stdlib.h> | 57 | #include <stdlib.h> |
62 | #include <sys/stat.h> | 58 | #include <sys/stat.h> |
63 | #include <sys/types.h> | 59 | #include <sys/types.h> |
64 | #include <fcntl.h> | 60 | #include <fcntl.h> |
65 | #include <unistd.h> | 61 | #include <unistd.h> |
66 | 62 | ||
67 | #include <qdatetime.h> | 63 | #include <qdatetime.h> |
68 | 64 | ||
69 | #include "picker.h" | 65 | #include "picker.h" |
66 | #include "configdlg.h" | ||
70 | 67 | ||
71 | static QString addressbookPersonalVCardName() | 68 | static QString addressbookPersonalVCardName() |
72 | { | 69 | { |
73 | QString filename = Global::applicationFileName("addressbook", | 70 | QString filename = Global::applicationFileName("addressbook", |
74 | "businesscard.vcf"); | 71 | "businesscard.vcf"); |
75 | return filename; | 72 | return filename; |
76 | } | 73 | } |
77 | 74 | ||
78 | 75 | ||
79 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 76 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
80 | WFlags f ) | 77 | WFlags f ) |
81 | : QMainWindow( parent, name, f ), | 78 | : QMainWindow( parent, name, f ), |
82 | abEditor(0), | 79 | abEditor(0), |
80 | useRegExp(false), | ||
81 | DoSignalWrapAround(false), | ||
82 | caseSensitive(false), | ||
83 | bAbEditFirstTime(TRUE), | 83 | bAbEditFirstTime(TRUE), |
84 | syncing(FALSE) | 84 | syncing(FALSE) |
85 | { | 85 | { |
86 | isLoading = true; | 86 | isLoading = true; |
87 | 87 | ||
88 | initFields(); | 88 | initFields(); |
89 | 89 | ||
90 | setCaption( tr("Contacts") ); | 90 | setCaption( tr("Contacts") ); |
91 | setIcon( Resource::loadPixmap( "AddressBook" ) ); | 91 | setIcon( Resource::loadPixmap( "AddressBook" ) ); |
92 | 92 | ||
93 | setToolBarsMovable( FALSE ); | 93 | setToolBarsMovable( FALSE ); |
94 | 94 | ||
95 | // Create Toolbars | 95 | // Create Toolbars |
96 | 96 | ||
97 | QPEToolBar *bar = new QPEToolBar( this ); | 97 | QPEToolBar *bar = new QPEToolBar( this ); |
98 | bar->setHorizontalStretchable( TRUE ); | 98 | bar->setHorizontalStretchable( TRUE ); |
99 | 99 | ||
100 | QPEMenuBar *mbList = new QPEMenuBar( bar ); | 100 | QPEMenuBar *mbList = new QPEMenuBar( bar ); |
101 | mbList->setMargin( 0 ); | 101 | mbList->setMargin( 0 ); |
102 | 102 | ||
103 | QPopupMenu *edit = new QPopupMenu( this ); | 103 | QPopupMenu *edit = new QPopupMenu( this ); |
104 | mbList->insertItem( tr( "Contact" ), edit ); | 104 | mbList->insertItem( tr( "Contact" ), edit ); |
105 | 105 | ||
106 | listTools = new QPEToolBar( this, "list operations" ); | 106 | listTools = new QPEToolBar( this, "list operations" ); |
107 | 107 | ||
108 | 108 | ||
109 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, | 109 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, |
110 | 0, this, 0 ); | 110 | 0, this, 0 ); |
111 | actionNew = a; | 111 | actionNew = a; |
112 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); | 112 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); |
113 | a->addTo( edit ); | 113 | a->addTo( edit ); |
114 | a->addTo( listTools ); | 114 | a->addTo( listTools ); |
115 | 115 | ||
116 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 116 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, |
117 | 0, this, 0 ); | 117 | 0, this, 0 ); |
118 | actionEdit = a; | 118 | actionEdit = a; |
119 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | 119 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); |
120 | a->addTo( edit ); | 120 | a->addTo( edit ); |
121 | a->addTo( listTools ); | 121 | a->addTo( listTools ); |
122 | 122 | ||
123 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 123 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
124 | 0, this, 0 ); | 124 | 0, this, 0 ); |
125 | actionTrash = a; | 125 | actionTrash = a; |
126 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | 126 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); |
127 | a->addTo( edit ); | 127 | a->addTo( edit ); |
128 | a->addTo( listTools ); | 128 | a->addTo( listTools ); |
129 | 129 | ||
130 | 130 | ||
@@ -163,228 +163,262 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
163 | a->addTo( searchBar ); | 163 | a->addTo( searchBar ); |
164 | 164 | ||
165 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), | 165 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), |
166 | QString::null, 0, this, 0 ); | 166 | QString::null, 0, this, 0 ); |
167 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 167 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
168 | actionMail = a; | 168 | actionMail = a; |
169 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 169 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
170 | a->addTo( edit ); | 170 | a->addTo( edit ); |
171 | a->addTo( listTools ); | 171 | a->addTo( listTools ); |
172 | 172 | ||
173 | 173 | ||
174 | 174 | ||
175 | if ( Ir::supported() ) { | 175 | if ( Ir::supported() ) { |
176 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 176 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
177 | 0, this, 0 ); | 177 | 0, this, 0 ); |
178 | actionBeam = a; | 178 | actionBeam = a; |
179 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 179 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
180 | a->addTo( edit ); | 180 | a->addTo( edit ); |
181 | a->addTo( listTools ); | 181 | a->addTo( listTools ); |
182 | } | 182 | } |
183 | 183 | ||
184 | edit->insertSeparator(); | 184 | edit->insertSeparator(); |
185 | 185 | ||
186 | 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 ); |
187 | actionPersonal = a; | 187 | actionPersonal = a; |
188 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); | 188 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); |
189 | a->addTo( edit ); | 189 | a->addTo( edit ); |
190 | 190 | ||
191 | edit->insertSeparator(); | 191 | edit->insertSeparator(); |
192 | 192 | ||
193 | 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 ); |
194 | actionPersonal = a; | 194 | actionPersonal = a; |
195 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 195 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); |
196 | a->addTo( edit ); | 196 | a->addTo( edit ); |
197 | 197 | ||
198 | // Do we need this function ? (se) | 198 | // Do we need this function ? (se) |
199 | // a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); | 199 | // a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); |
200 | // connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 200 | // connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
201 | // a->addTo( edit ); | 201 | // a->addTo( edit ); |
202 | 202 | ||
203 | 203 | ||
204 | #ifdef __DEBUG_RELEASE | 204 | #ifdef __DEBUG_RELEASE |
205 | // Remove this function for public Release ! This is only | 205 | // Remove this function for public Release ! This is only |
206 | // for debug purposes .. | 206 | // for debug purposes .. |
207 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); | 207 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); |
208 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); | 208 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); |
209 | a->addTo( edit ); | 209 | a->addTo( edit ); |
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 |
213 | listContainer = new QWidget( this ); | 217 | listContainer = new QWidget( this ); |
214 | 218 | ||
215 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | 219 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); |
216 | 220 | ||
217 | abList = new AbTable( &orderedFields, listContainer, "table" ); | 221 | abList = new AbTable( &orderedFields, listContainer, "table" ); |
218 | vb->addWidget(abList); | 222 | vb->addWidget(abList); |
219 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 223 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
220 | connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); | 224 | connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); |
221 | connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); | 225 | connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); |
222 | connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) ); | 226 | connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) ); |
223 | 227 | ||
224 | mView = 0; | 228 | mView = 0; |
225 | 229 | ||
226 | abList->load(); | 230 | abList->load(); |
227 | 231 | ||
228 | pLabel = new LetterPicker( listContainer ); | 232 | pLabel = new LetterPicker( listContainer ); |
229 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 233 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
230 | vb->addWidget(pLabel); | 234 | vb->addWidget(pLabel); |
231 | catMenu = new QPopupMenu( this ); | 235 | catMenu = new QPopupMenu( this ); |
232 | catMenu->setCheckable( TRUE ); | 236 | catMenu->setCheckable( TRUE ); |
233 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 237 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
234 | populateCategories(); | 238 | populateCategories(); |
235 | 239 | ||
236 | mbList->insertItem( tr("View"), catMenu ); | 240 | mbList->insertItem( tr("View"), catMenu ); |
237 | // setCentralWidget( listContainer ); | 241 | // setCentralWidget( listContainer ); |
238 | 242 | ||
239 | fontMenu = new QPopupMenu(this); | 243 | fontMenu = new QPopupMenu(this); |
240 | fontMenu->setCheckable( true ); | 244 | fontMenu->setCheckable( true ); |
241 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); | 245 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); |
242 | 246 | ||
243 | fontMenu->insertItem(tr( "Small" ), 0); | 247 | fontMenu->insertItem(tr( "Small" ), 0); |
244 | fontMenu->insertItem(tr( "Normal" ), 1); | 248 | fontMenu->insertItem(tr( "Normal" ), 1); |
245 | fontMenu->insertItem(tr( "Large" ), 2); | 249 | fontMenu->insertItem(tr( "Large" ), 2); |
246 | 250 | ||
247 | defaultFont = new QFont( abList->font() ); | 251 | defaultFont = new QFont( abList->font() ); |
248 | 252 | ||
249 | slotSetFont(startFontSize); | 253 | slotSetFont(startFontSize); |
250 | 254 | ||
251 | mbList->insertItem( tr("Font"), fontMenu); | 255 | mbList->insertItem( tr("Font"), fontMenu); |
252 | setCentralWidget(listContainer); | 256 | setCentralWidget(listContainer); |
253 | 257 | ||
254 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 258 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
255 | 259 | ||
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 | ||
258 | isLoading = false; | 269 | isLoading = false; |
259 | } | 270 | } |
260 | 271 | ||
261 | 272 | ||
273 | void 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 | |||
262 | void AddressbookWindow::slotSetFont( int size ) { | 291 | void AddressbookWindow::slotSetFont( int size ) { |
263 | 292 | ||
264 | if (size > 2 || size < 0) | 293 | if (size > 2 || size < 0) |
265 | size = 1; | 294 | size = 1; |
266 | 295 | ||
267 | startFontSize = size; | 296 | startFontSize = size; |
268 | 297 | ||
269 | QFont *currentFont; | 298 | QFont *currentFont; |
270 | 299 | ||
271 | switch (size) { | 300 | switch (size) { |
272 | case 0: | 301 | case 0: |
273 | fontMenu->setItemChecked(0, true); | 302 | fontMenu->setItemChecked(0, true); |
274 | fontMenu->setItemChecked(1, false); | 303 | fontMenu->setItemChecked(1, false); |
275 | fontMenu->setItemChecked(2, false); | 304 | fontMenu->setItemChecked(2, false); |
276 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | 305 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); |
277 | currentFont = new QFont (abList->font()); | 306 | currentFont = new QFont (abList->font()); |
278 | // abList->resizeRows(currentFont->pixelSize() + 7); | 307 | // abList->resizeRows(currentFont->pixelSize() + 7); |
279 | abList->resizeRows(); | 308 | abList->resizeRows(); |
280 | break; | 309 | break; |
281 | case 1: | 310 | case 1: |
282 | fontMenu->setItemChecked(0, false); | 311 | fontMenu->setItemChecked(0, false); |
283 | fontMenu->setItemChecked(1, true); | 312 | fontMenu->setItemChecked(1, true); |
284 | fontMenu->setItemChecked(2, false); | 313 | fontMenu->setItemChecked(2, false); |
285 | abList->setFont( *defaultFont ); | 314 | abList->setFont( *defaultFont ); |
286 | currentFont = new QFont (abList->font()); | 315 | currentFont = new QFont (abList->font()); |
287 | // abList->resizeRows(currentFont->pixelSize() + 7); | 316 | // abList->resizeRows(currentFont->pixelSize() + 7); |
288 | abList->resizeRows(); | 317 | abList->resizeRows(); |
289 | break; | 318 | break; |
290 | case 2: | 319 | case 2: |
291 | fontMenu->setItemChecked(0, false); | 320 | fontMenu->setItemChecked(0, false); |
292 | fontMenu->setItemChecked(1, false); | 321 | fontMenu->setItemChecked(1, false); |
293 | fontMenu->setItemChecked(2, true); | 322 | fontMenu->setItemChecked(2, true); |
294 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | 323 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); |
295 | currentFont = new QFont (abList->font()); | 324 | currentFont = new QFont (abList->font()); |
296 | //abList->resizeRows(currentFont->pixelSize() + 7); | 325 | //abList->resizeRows(currentFont->pixelSize() + 7); |
297 | abList->resizeRows(); | 326 | abList->resizeRows(); |
298 | break; | 327 | break; |
299 | } | 328 | } |
300 | } | 329 | } |
301 | 330 | ||
302 | 331 | ||
303 | 332 | ||
304 | void AddressbookWindow::importvCard() { | 333 | void AddressbookWindow::importvCard() { |
305 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); | 334 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); |
306 | if(!str.isEmpty() ) | 335 | if(!str.isEmpty() ) |
307 | setDocument((const QString&) str ); | 336 | setDocument((const QString&) str ); |
308 | 337 | ||
309 | } | 338 | } |
310 | 339 | ||
311 | void AddressbookWindow::setDocument( const QString &filename ) | 340 | void AddressbookWindow::setDocument( const QString &filename ) |
312 | { | 341 | { |
313 | if ( filename.find(".vcf") != int(filename.length()) - 4 ) | 342 | if ( filename.find(".vcf") != int(filename.length()) - 4 ) |
314 | return; | 343 | return; |
315 | 344 | ||
316 | QValueList<OContact> cl = OContact::readVCard( filename ); | 345 | QValueList<OContact> cl = OContact::readVCard( filename ); |
317 | for( QValueList<OContact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { | 346 | for( QValueList<OContact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { |
318 | // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") | 347 | // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") |
319 | // .arg( (*it).fullName() ); | 348 | // .arg( (*it).fullName() ); |
320 | // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == | 349 | // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == |
321 | // QMessageBox::Ok ) { | 350 | // QMessageBox::Ok ) { |
322 | abList->addEntry( *it ); | 351 | abList->addEntry( *it ); |
323 | // } | 352 | // } |
324 | } | 353 | } |
325 | 354 | ||
326 | } | 355 | } |
327 | 356 | ||
328 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 357 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
329 | { | 358 | { |
330 | QMainWindow::resizeEvent( e ); | 359 | QMainWindow::resizeEvent( e ); |
331 | 360 | ||
332 | if ( centralWidget() == listContainer ) | 361 | if ( centralWidget() == listContainer ) |
333 | showList(); | 362 | showList(); |
334 | else if ( centralWidget() == mView ) | 363 | else if ( centralWidget() == mView ) |
335 | showView(); | 364 | showView(); |
336 | } | 365 | } |
337 | 366 | ||
338 | AddressbookWindow::~AddressbookWindow() | 367 | AddressbookWindow::~AddressbookWindow() |
339 | { | 368 | { |
340 | Config cfg("AddressBook"); | 369 | Config cfg("AddressBook"); |
341 | cfg.setGroup("Font"); | 370 | cfg.setGroup("Font"); |
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 | } |
344 | 378 | ||
345 | void AddressbookWindow::slotUpdateToolbar() | 379 | void AddressbookWindow::slotUpdateToolbar() |
346 | { | 380 | { |
347 | OContact ce = abList->currentEntry(); | 381 | OContact ce = abList->currentEntry(); |
348 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 382 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
349 | } | 383 | } |
350 | 384 | ||
351 | void AddressbookWindow::showList() | 385 | void AddressbookWindow::showList() |
352 | { | 386 | { |
353 | bool visiblemView; | 387 | bool visiblemView; |
354 | 388 | ||
355 | visiblemView = false; | 389 | visiblemView = false; |
356 | if ( mView ) { | 390 | if ( mView ) { |
357 | mView->hide(); | 391 | mView->hide(); |
358 | visiblemView = true; | 392 | visiblemView = true; |
359 | } | 393 | } |
360 | setCentralWidget( listContainer ); | 394 | setCentralWidget( listContainer ); |
361 | listContainer->show(); | 395 | listContainer->show(); |
362 | // update our focues... (or use a stack widget!); | 396 | // update our focues... (or use a stack widget!); |
363 | abList->setFocus(); | 397 | abList->setFocus(); |
364 | 398 | ||
365 | // This makes sure we are scrolled all the way to the left | 399 | // This makes sure we are scrolled all the way to the left |
366 | abList->setContentsPos( 0, abList->contentsY() ); | 400 | abList->setContentsPos( 0, abList->contentsY() ); |
367 | 401 | ||
368 | //if ( visiblemView && abList->showBook() == "Cards" ) | 402 | //if ( visiblemView && abList->showBook() == "Cards" ) |
369 | //abList->setShowCategory( abList->showBook(), abList->showCategory() ); | 403 | //abList->setShowCategory( abList->showBook(), abList->showCategory() ); |
370 | 404 | ||
371 | } | 405 | } |
372 | 406 | ||
373 | void AddressbookWindow::showView() | 407 | void AddressbookWindow::showView() |
374 | { | 408 | { |
375 | if ( abList->numRows() > 0 ) { | 409 | if ( abList->numRows() > 0 ) { |
376 | listContainer->hide(); | 410 | listContainer->hide(); |
377 | setCentralWidget( abView() ); | 411 | setCentralWidget( abView() ); |
378 | mView->show(); | 412 | mView->show(); |
379 | mView->setFocus(); | 413 | mView->setFocus(); |
380 | } | 414 | } |
381 | } | 415 | } |
382 | 416 | ||
383 | void AddressbookWindow::slotListNew() | 417 | void AddressbookWindow::slotListNew() |
384 | { | 418 | { |
385 | OContact cnt; | 419 | OContact cnt; |
386 | if( !syncing ) { | 420 | if( !syncing ) { |
387 | if ( abEditor ) | 421 | if ( abEditor ) |
388 | abEditor->setEntry( cnt ); | 422 | abEditor->setEntry( cnt ); |
389 | abView()->init( cnt ); | 423 | abView()->init( cnt ); |
390 | editEntry( NewEntry ); | 424 | editEntry( NewEntry ); |
@@ -849,143 +883,138 @@ void AddressbookWindow::initFields() | |||
849 | itVis != visibleFields.end() && itVl != allFields.end(); | 883 | itVis != visibleFields.end() && itVl != allFields.end(); |
850 | ++itVis, ++itVl ) { | 884 | ++itVis, ++itVl ) { |
851 | if ( *it == *itVis && itVl != allFields.end() ) { | 885 | if ( *it == *itVis && itVl != allFields.end() ) { |
852 | orderedFields.append( *itVl ); | 886 | orderedFields.append( *itVl ); |
853 | } | 887 | } |
854 | } | 888 | } |
855 | } | 889 | } |
856 | } else { | 890 | } else { |
857 | QValueList<int>::ConstIterator it; | 891 | QValueList<int>::ConstIterator it; |
858 | for ( it = allFields.begin(); it != allFields.end(); ++it ) | 892 | for ( it = allFields.begin(); it != allFields.end(); ++it ) |
859 | orderedFields.append( *it ); | 893 | orderedFields.append( *it ); |
860 | 894 | ||
861 | slOrderedFields = visibleFields; | 895 | slOrderedFields = visibleFields; |
862 | orderedFields.remove( Qtopia::AddressUid ); | 896 | orderedFields.remove( Qtopia::AddressUid ); |
863 | orderedFields.remove( Qtopia::Title ); | 897 | orderedFields.remove( Qtopia::Title ); |
864 | orderedFields.remove( Qtopia::Groups ); | 898 | orderedFields.remove( Qtopia::Groups ); |
865 | orderedFields.remove( Qtopia::AddressCategory ); | 899 | orderedFields.remove( Qtopia::AddressCategory ); |
866 | orderedFields.remove( Qtopia::FirstName ); | 900 | orderedFields.remove( Qtopia::FirstName ); |
867 | orderedFields.remove( Qtopia::LastName ); | 901 | orderedFields.remove( Qtopia::LastName ); |
868 | orderedFields.remove( Qtopia::DefaultEmail ); | 902 | orderedFields.remove( Qtopia::DefaultEmail ); |
869 | orderedFields.remove( Qtopia::FileAs ); | 903 | orderedFields.remove( Qtopia::FileAs ); |
870 | orderedFields.remove( Qtopia::Notes ); | 904 | orderedFields.remove( Qtopia::Notes ); |
871 | orderedFields.remove( Qtopia::Gender ); | 905 | orderedFields.remove( Qtopia::Gender ); |
872 | slOrderedFields.remove( "Name Title" ); | 906 | slOrderedFields.remove( "Name Title" ); |
873 | slOrderedFields.remove( "First Name" ); | 907 | slOrderedFields.remove( "First Name" ); |
874 | slOrderedFields.remove( "Last Name" ); | 908 | slOrderedFields.remove( "Last Name" ); |
875 | slOrderedFields.remove( "File As" ); | 909 | slOrderedFields.remove( "File As" ); |
876 | slOrderedFields.remove( "Default Email" ); | 910 | slOrderedFields.remove( "Default Email" ); |
877 | slOrderedFields.remove( "Notes" ); | 911 | slOrderedFields.remove( "Notes" ); |
878 | slOrderedFields.remove( "Gender" ); | 912 | slOrderedFields.remove( "Gender" ); |
879 | 913 | ||
880 | } | 914 | } |
881 | } | 915 | } |
882 | 916 | ||
883 | 917 | ||
884 | AbLabel *AddressbookWindow::abView() | 918 | AbLabel *AddressbookWindow::abView() |
885 | { | 919 | { |
886 | if ( !mView ) { | 920 | if ( !mView ) { |
887 | mView = new AbLabel( this, "viewer" ); | 921 | mView = new AbLabel( this, "viewer" ); |
888 | mView->init( OContact() ); | 922 | mView->init( OContact() ); |
889 | connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); | 923 | connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); |
890 | } | 924 | } |
891 | return mView; | 925 | return mView; |
892 | } | 926 | } |
893 | 927 | ||
894 | void AddressbookWindow::slotFindOpen() | 928 | void AddressbookWindow::slotFindOpen() |
895 | { | 929 | { |
896 | searchBar->show(); | 930 | searchBar->show(); |
931 | searchEdit->setFocus(); | ||
897 | } | 932 | } |
898 | void AddressbookWindow::slotFindClose() | 933 | void AddressbookWindow::slotFindClose() |
899 | { | 934 | { |
900 | searchBar->hide(); | 935 | searchBar->hide(); |
936 | abList->setFocus(); | ||
901 | } | 937 | } |
902 | void AddressbookWindow::slotFindNext() | 938 | void AddressbookWindow::slotFindNext() |
903 | { | 939 | { |
904 | } | ||
905 | |||
906 | void 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); |
919 | 948 | ||
920 | 949 | ||
921 | if ( abList->numSelections() ) | 950 | if ( abList->numSelections() ) |
922 | abList->clearSelection(); | 951 | abList->clearSelection(); |
952 | |||
953 | } | ||
954 | |||
955 | void AddressbookWindow::slotFind() | ||
956 | { | ||
923 | 957 | ||
924 | abList->clearFindRow(); | 958 | abList->clearFindRow(); |
959 | slotFindNext(); | ||
925 | } | 960 | } |
926 | 961 | ||
927 | void AddressbookWindow::slotSetCategory( int c ) | 962 | void AddressbookWindow::slotSetCategory( int c ) |
928 | { | 963 | { |
929 | 964 | ||
930 | QString cat, book; | 965 | QString cat, book; |
931 | 966 | ||
932 | if ( c <= 0 ) | 967 | if ( c <= 0 ) |
933 | return; | 968 | return; |
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 | ||
945 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | 974 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
946 | if (catMenu->isItemChecked( i )) { | 975 | if (catMenu->isItemChecked( i )) { |
947 | if ( i == 1 ) // default List view | 976 | if ( i == 1 ) // default List view |
948 | book = QString::null; | 977 | book = QString::null; |
949 | else if ( i == 2 ) | 978 | else if ( i == 2 ) |
950 | book = "Phone"; | 979 | book = "Phone"; |
951 | else if ( i == 3 ) | 980 | else if ( i == 3 ) |
952 | book = "Company"; | 981 | book = "Company"; |
953 | else if ( i == 4 ) | 982 | else if ( i == 4 ) |
954 | book = "Email"; | 983 | book = "Email"; |
955 | else if ( i == 5 ) | 984 | else if ( i == 5 ) |
956 | book = "Cards"; | 985 | book = "Cards"; |
957 | else if ( i == 6 ) // default All Categories | 986 | else if ( i == 6 ) // default All Categories |
958 | cat = QString::null; | 987 | cat = QString::null; |
959 | 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 |
960 | cat = "Unfiled"; | 989 | cat = "Unfiled"; |
961 | else | 990 | else |
962 | cat = abList->categories()[i - 7]; | 991 | cat = abList->categories()[i - 7]; |
963 | } | 992 | } |
964 | } | 993 | } |
965 | 994 | ||
966 | abList->setShowCategory( book, cat ); | 995 | abList->setShowCategory( book, cat ); |
967 | 996 | ||
968 | if ( book.isEmpty() ) | 997 | if ( book.isEmpty() ) |
969 | book = "List"; | 998 | book = "List"; |
970 | if ( cat.isEmpty() ) | 999 | if ( cat.isEmpty() ) |
971 | cat = "All"; | 1000 | cat = "All"; |
972 | 1001 | ||
973 | setCaption( tr( "Contacts" ) + " - " + tr( book ) + " - " + tr( cat ) ); | 1002 | setCaption( tr( "Contacts" ) + " - " + tr( book ) + " - " + tr( cat ) ); |
974 | } | 1003 | } |
975 | 1004 | ||
976 | void AddressbookWindow::slotSetLetter( char c ) { | 1005 | void AddressbookWindow::slotSetLetter( char c ) { |
977 | 1006 | ||
978 | abList->setShowByLetter( c ); | 1007 | abList->setShowByLetter( c ); |
979 | 1008 | ||
980 | } | 1009 | } |
981 | 1010 | ||
982 | void AddressbookWindow::populateCategories() | 1011 | void AddressbookWindow::populateCategories() |
983 | { | 1012 | { |
984 | catMenu->clear(); | 1013 | catMenu->clear(); |
985 | 1014 | ||
986 | int id, rememberId; | 1015 | int id, rememberId; |
987 | id = 1; | 1016 | id = 1; |
988 | rememberId = 0; | 1017 | rememberId = 0; |
989 | 1018 | ||
990 | catMenu->insertItem( tr( "List" ), id++ ); | 1019 | catMenu->insertItem( tr( "List" ), id++ ); |
991 | catMenu->insertItem( tr( "Phone Book" ), id++ ); | 1020 | catMenu->insertItem( tr( "Phone Book" ), id++ ); |
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 | |||
@@ -44,81 +44,87 @@ class AddressbookWindow: public QMainWindow | |||
44 | { | 44 | { |
45 | Q_OBJECT | 45 | Q_OBJECT |
46 | public: | 46 | public: |
47 | AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 47 | AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
48 | ~AddressbookWindow(); | 48 | ~AddressbookWindow(); |
49 | 49 | ||
50 | protected: | 50 | protected: |
51 | void resizeEvent( QResizeEvent * e ); | 51 | void resizeEvent( QResizeEvent * e ); |
52 | void showList(); | 52 | void showList(); |
53 | void showView(); | 53 | void showView(); |
54 | enum EntryMode { NewEntry=0, EditEntry }; | 54 | enum EntryMode { NewEntry=0, EditEntry }; |
55 | void editPersonal(); | 55 | void editPersonal(); |
56 | void editEntry( EntryMode ); | 56 | void editEntry( EntryMode ); |
57 | void closeEvent( QCloseEvent *e ); | 57 | void closeEvent( QCloseEvent *e ); |
58 | bool save(); | 58 | bool save(); |
59 | 59 | ||
60 | public slots: | 60 | public slots: |
61 | void flush(); | 61 | void flush(); |
62 | void reload(); | 62 | void reload(); |
63 | void appMessage(const QCString &, const QByteArray &); | 63 | void appMessage(const QCString &, const QByteArray &); |
64 | void setDocument( const QString & ); | 64 | void setDocument( const QString & ); |
65 | #ifdef __DEBUG_RELEASE | 65 | #ifdef __DEBUG_RELEASE |
66 | void slotSave(); | 66 | void slotSave(); |
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | private slots: | 69 | private slots: |
70 | void importvCard(); | 70 | void importvCard(); |
71 | void slotListNew(); | 71 | void slotListNew(); |
72 | void slotListView(); | 72 | void slotListView(); |
73 | void slotListDelete(); | 73 | void slotListDelete(); |
74 | void slotViewBack(); | 74 | void slotViewBack(); |
75 | void slotViewEdit(); | 75 | void slotViewEdit(); |
76 | void slotPersonalView(); | 76 | void slotPersonalView(); |
77 | void listIsEmpty( bool ); | 77 | void listIsEmpty( bool ); |
78 | void slotSettings(); | 78 | void slotSettings(); |
79 | void writeMail(); | 79 | void writeMail(); |
80 | void slotBeam(); | 80 | void slotBeam(); |
81 | void beamDone( Ir * ); | 81 | void beamDone( Ir * ); |
82 | void slotSetCategory( int ); | 82 | void slotSetCategory( int ); |
83 | void slotSetLetter( char ); | 83 | void slotSetLetter( char ); |
84 | void slotUpdateToolbar(); | 84 | void slotUpdateToolbar(); |
85 | void slotSetFont(int); | 85 | void slotSetFont(int); |
86 | 86 | ||
87 | void slotFindOpen(); | 87 | void slotFindOpen(); |
88 | void slotFindClose(); | 88 | void slotFindClose(); |
89 | void slotFind(); | 89 | void slotFind(); |
90 | void slotFindNext(); | 90 | void slotFindNext(); |
91 | 91 | ||
92 | void slotConfig(); | ||
93 | |||
92 | private: | 94 | private: |
93 | void initFields(); // inititialize our fields... | 95 | void initFields(); // inititialize our fields... |
94 | AbLabel *abView(); | 96 | AbLabel *abView(); |
95 | void populateCategories(); | 97 | void populateCategories(); |
96 | 98 | ||
97 | QPopupMenu *catMenu, *fontMenu; | 99 | QPopupMenu *catMenu, *fontMenu; |
98 | QPEToolBar *listTools; | 100 | QPEToolBar *listTools; |
99 | QToolButton *deleteButton; | 101 | QToolButton *deleteButton; |
100 | QValueList<int> allFields, orderedFields; | 102 | QValueList<int> allFields, orderedFields; |
101 | QStringList slOrderedFields; | 103 | QStringList slOrderedFields; |
102 | enum Panes { paneList=0, paneView, paneEdit }; | 104 | enum Panes { paneList=0, paneView, paneEdit }; |
103 | ContactEditor *abEditor; | 105 | ContactEditor *abEditor; |
104 | AbLabel *mView; | 106 | AbLabel *mView; |
105 | LetterPicker *pLabel; | 107 | LetterPicker *pLabel; |
106 | AbTable *abList; | 108 | AbTable *abList; |
107 | QWidget *listContainer; | 109 | QWidget *listContainer; |
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 | ||
112 | QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, *actionPersonal, *actionMail; | 118 | QAction *actionNew, *actionEdit, *actionTrash, *actionFind, *actionBeam, *actionPersonal, *actionMail; |
113 | 119 | ||
114 | bool bAbEditFirstTime; | 120 | bool bAbEditFirstTime; |
115 | int viewMargin; | 121 | int viewMargin; |
116 | 122 | ||
117 | bool syncing; | 123 | bool syncing; |
118 | QFont *defaultFont; | 124 | QFont *defaultFont; |
119 | int startFontSize; | 125 | int startFontSize; |
120 | 126 | ||
121 | bool isLoading; | 127 | bool isLoading; |
122 | }; | 128 | }; |
123 | 129 | ||
124 | #endif | 130 | #endif |
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 | |||
@@ -1,38 +1,41 @@ | |||
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 | ofloatbar.h \ |
11 | configdlg.h | ||
11 | SOURCES= main.cpp \ | 12 | SOURCES= main.cpp \ |
12 | addressbook.cpp \ | 13 | addressbook.cpp \ |
13 | contacteditor.cpp \ | 14 | contacteditor.cpp \ |
14 | ablabel.cpp \ | 15 | ablabel.cpp \ |
15 | abtable.cpp \ | 16 | abtable.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 |
20 | INCLUDEPATH += $(OPIEDIR)/include | 23 | INCLUDEPATH += $(OPIEDIR)/include |
21 | DEPENDPATH+= $(OPIEDIR)/include | 24 | DEPENDPATH+= $(OPIEDIR)/include |
22 | LIBS += -lqpe -lopie | 25 | LIBS += -lqpe -lopie |
23 | 26 | ||
24 | TRANSLATIONS = ../../../i18n/de/addressbook.ts \ | 27 | TRANSLATIONS = ../../../i18n/de/addressbook.ts \ |
25 | ../../../i18n/en/addressbook.ts \ | 28 | ../../../i18n/en/addressbook.ts \ |
26 | ../../../i18n/es/addressbook.ts \ | 29 | ../../../i18n/es/addressbook.ts \ |
27 | ../../../i18n/fr/addressbook.ts \ | 30 | ../../../i18n/fr/addressbook.ts \ |
28 | ../../../i18n/hu/addressbook.ts \ | 31 | ../../../i18n/hu/addressbook.ts \ |
29 | ../../../i18n/ja/addressbook.ts \ | 32 | ../../../i18n/ja/addressbook.ts \ |
30 | ../../../i18n/ko/addressbook.ts \ | 33 | ../../../i18n/ko/addressbook.ts \ |
31 | ../../../i18n/no/addressbook.ts \ | 34 | ../../../i18n/no/addressbook.ts \ |
32 | ../../../i18n/pl/addressbook.ts \ | 35 | ../../../i18n/pl/addressbook.ts \ |
33 | ../../../i18n/pt/addressbook.ts \ | 36 | ../../../i18n/pt/addressbook.ts \ |
34 | ../../../i18n/pt_BR/addressbook.ts \ | 37 | ../../../i18n/pt_BR/addressbook.ts \ |
35 | ../../../i18n/sl/addressbook.ts \ | 38 | ../../../i18n/sl/addressbook.ts \ |
36 | ../../../i18n/zh_CN/addressbook.ts \ | 39 | ../../../i18n/zh_CN/addressbook.ts \ |
37 | ../../../i18n/it/addressbook.ts \ | 40 | ../../../i18n/it/addressbook.ts \ |
38 | ../../../i18n/zh_TW/addressbook.ts | 41 | ../../../i18n/zh_TW/addressbook.ts |
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 | |||
5 | ConfigDlg::ConfigDlg( QWidget *parent = 0, const char *name = 0 ): | ||
6 | ConfigDlg_Base(parent, name, true ) | ||
7 | {} | ||
8 | |||
9 | |||
10 | bool ConfigDlg::useRegExp() const | ||
11 | { | ||
12 | return m_useRegExp->isOn(); | ||
13 | } | ||
14 | bool ConfigDlg::useWildCards() const | ||
15 | { | ||
16 | return m_useWildCard->isOn(); | ||
17 | } | ||
18 | bool ConfigDlg::beCaseSensitive() const | ||
19 | { | ||
20 | return m_useCaseSensitive->isChecked(); | ||
21 | } | ||
22 | bool ConfigDlg::signalWrapAround() const | ||
23 | { | ||
24 | return m_signalWrapAround->isChecked(); | ||
25 | } | ||
26 | void ConfigDlg::setUseRegExp( bool v ) | ||
27 | { | ||
28 | m_useRegExp->setChecked( v ); | ||
29 | } | ||
30 | void ConfigDlg::setUseWildCards( bool v ) | ||
31 | { | ||
32 | m_useWildCard->setChecked( v ); | ||
33 | } | ||
34 | void ConfigDlg::setBeCaseSensitive( bool v ) | ||
35 | { | ||
36 | m_useCaseSensitive->setChecked( v ); | ||
37 | } | ||
38 | void 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 | |||
6 | class ConfigDlg: public ConfigDlg_Base | ||
7 | { | ||
8 | Q_OBJECT | ||
9 | public: | ||
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>&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>&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 | |||
@@ -1,20 +1,20 @@ | |||
1 | #ifndef __OFLOATBAR_H | 1 | #ifndef __OFLOATBAR_H |
2 | #define __OFLOATBAR_H | 2 | #define __OFLOATBAR_H |
3 | 3 | ||
4 | #include <qtoolbar.h> | 4 | #include <qtoolbar.h> |
5 | #include <qevent.h> | 5 | #include <qevent.h> |
6 | 6 | ||
7 | class OFloatBar : public QToolBar | 7 | class OFloatBar : public QToolBar |
8 | { | 8 | { |
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | virtual void hideEvent(QHideEvent* e) | 10 | virtual void hideEvent(QHideEvent* /* e */) |
11 | { | 11 | { |
12 | /*if (e->spontaneous())*/ emit OnHide(); | 12 | /*if (e->spontaneous())*/ emit OnHide(); |
13 | } | 13 | } |
14 | public: | 14 | public: |
15 | OFloatBar(char* t, QMainWindow* mw, QMainWindow::ToolBarDock td, bool f) : QToolBar(t, mw, td, f) {} | 15 | OFloatBar(char* t, QMainWindow* mw, QMainWindow::ToolBarDock td, bool f) : QToolBar(t, mw, td, f) {} |
16 | signals: | 16 | signals: |
17 | void OnHide(); | 17 | void OnHide(); |
18 | }; | 18 | }; |
19 | 19 | ||
20 | #endif | 20 | #endif |