-rw-r--r-- | core/pim/addressbook/abtable.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 124ff6c..e9e6a0b 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -1,126 +1,127 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qt Palmtop Environment. | 4 | ** This file is part of Qt Palmtop Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define QTOPIA_INTERNAL_CONTACT_MRE | 21 | #define QTOPIA_INTERNAL_CONTACT_MRE |
22 | 22 | ||
23 | #include <qpe/categoryselect.h> | 23 | #include <qpe/categoryselect.h> |
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qpe/stringutil.h> | 25 | #include <qpe/stringutil.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | 27 | ||
28 | #include <qasciidict.h> | 28 | #include <qasciidict.h> |
29 | #include <qdatetime.h> | 29 | #include <qdatetime.h> |
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qregexp.h> | ||
31 | 32 | ||
32 | #include "abtable.h" | 33 | #include "abtable.h" |
33 | 34 | ||
34 | #include <errno.h> | 35 | #include <errno.h> |
35 | #include <fcntl.h> | 36 | #include <fcntl.h> |
36 | #include <unistd.h> | 37 | #include <unistd.h> |
37 | #include <stdlib.h> | 38 | #include <stdlib.h> |
38 | 39 | ||
39 | #include <ctype.h> //toupper() for key hack | 40 | #include <ctype.h> //toupper() for key hack |
40 | 41 | ||
41 | static bool contactCompare( const Contact &cnt, const QRegExp &r, int category ); | 42 | static bool contactCompare( const Contact &cnt, const QRegExp &r, int category ); |
42 | 43 | ||
43 | //### qtmail/addresslist.cpp hardcodes this filename as well | 44 | //### qtmail/addresslist.cpp hardcodes this filename as well |
44 | static QString journalFileName() | 45 | static QString journalFileName() |
45 | { | 46 | { |
46 | QString str = getenv("HOME"); | 47 | QString str = getenv("HOME"); |
47 | str +="/.abjournal"; | 48 | str +="/.abjournal"; |
48 | return str; | 49 | return str; |
49 | } | 50 | } |
50 | 51 | ||
51 | 52 | ||
52 | 53 | ||
53 | /*! | 54 | /*! |
54 | \class AbTableItem abtable.h | 55 | \class AbTableItem abtable.h |
55 | 56 | ||
56 | \brief QTableItem based class for showing a field of an entry | 57 | \brief QTableItem based class for showing a field of an entry |
57 | */ | 58 | */ |
58 | 59 | ||
59 | AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, | 60 | AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, |
60 | const QString &secondSortKey) | 61 | const QString &secondSortKey) |
61 | : QTableItem( t, et, s ) | 62 | : QTableItem( t, et, s ) |
62 | { | 63 | { |
63 | // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); | 64 | // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); |
64 | sortKey = Qtopia::buildSortKey( s, secondSortKey ); | 65 | sortKey = Qtopia::buildSortKey( s, secondSortKey ); |
65 | } | 66 | } |
66 | 67 | ||
67 | int AbTableItem::alignment() const | 68 | int AbTableItem::alignment() const |
68 | { | 69 | { |
69 | return AlignLeft|AlignVCenter; | 70 | return AlignLeft|AlignVCenter; |
70 | } | 71 | } |
71 | 72 | ||
72 | QString AbTableItem::key() const | 73 | QString AbTableItem::key() const |
73 | { | 74 | { |
74 | return sortKey; | 75 | return sortKey; |
75 | } | 76 | } |
76 | 77 | ||
77 | // A way to reset the item, without out doing a delete or a new... | 78 | // A way to reset the item, without out doing a delete or a new... |
78 | void AbTableItem::setItem( const QString &txt, const QString &secondKey ) | 79 | void AbTableItem::setItem( const QString &txt, const QString &secondKey ) |
79 | { | 80 | { |
80 | setText( txt ); | 81 | setText( txt ); |
81 | sortKey = Qtopia::buildSortKey( txt, secondKey ); | 82 | sortKey = Qtopia::buildSortKey( txt, secondKey ); |
82 | 83 | ||
83 | // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); | 84 | // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); |
84 | } | 85 | } |
85 | 86 | ||
86 | /*! | 87 | /*! |
87 | \class AbPickItem abtable.h | 88 | \class AbPickItem abtable.h |
88 | 89 | ||
89 | \brief QTableItem based class for showing slection of an entry | 90 | \brief QTableItem based class for showing slection of an entry |
90 | */ | 91 | */ |
91 | 92 | ||
92 | AbPickItem::AbPickItem( QTable *t ) : | 93 | AbPickItem::AbPickItem( QTable *t ) : |
93 | QTableItem(t, WhenCurrent, "?") | 94 | QTableItem(t, WhenCurrent, "?") |
94 | { | 95 | { |
95 | } | 96 | } |
96 | 97 | ||
97 | QWidget *AbPickItem::createEditor() const | 98 | QWidget *AbPickItem::createEditor() const |
98 | { | 99 | { |
99 | QComboBox* combo = new QComboBox( table()->viewport() ); | 100 | QComboBox* combo = new QComboBox( table()->viewport() ); |
100 | ( (AbPickItem*)this )->cb = combo; | 101 | ( (AbPickItem*)this )->cb = combo; |
101 | AbTable* t = static_cast<AbTable*>(table()); | 102 | AbTable* t = static_cast<AbTable*>(table()); |
102 | QStringList c = t->choiceNames(); | 103 | QStringList c = t->choiceNames(); |
103 | int cur = 0; | 104 | int cur = 0; |
104 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { | 105 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { |
105 | if ( *it == text() ) | 106 | if ( *it == text() ) |
106 | cur = combo->count(); | 107 | cur = combo->count(); |
107 | combo->insertItem(*it); | 108 | combo->insertItem(*it); |
108 | } | 109 | } |
109 | combo->setCurrentItem(cur); | 110 | combo->setCurrentItem(cur); |
110 | return combo; | 111 | return combo; |
111 | } | 112 | } |
112 | 113 | ||
113 | void AbPickItem::setContentFromEditor( QWidget *w ) | 114 | void AbPickItem::setContentFromEditor( QWidget *w ) |
114 | { | 115 | { |
115 | if ( w->inherits("QComboBox") ) | 116 | if ( w->inherits("QComboBox") ) |
116 | setText( ( (QComboBox*)w )->currentText() ); | 117 | setText( ( (QComboBox*)w )->currentText() ); |
117 | else | 118 | else |
118 | QTableItem::setContentFromEditor( w ); | 119 | QTableItem::setContentFromEditor( w ); |
119 | } | 120 | } |
120 | 121 | ||
121 | /*! | 122 | /*! |
122 | \class AbTable abtable.h | 123 | \class AbTable abtable.h |
123 | 124 | ||
124 | \brief QTable based class for showing a list of entries | 125 | \brief QTable based class for showing a list of entries |
125 | */ | 126 | */ |
126 | 127 | ||