-rw-r--r-- | core/pim/addressbook/ablabel.cpp | 14 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 46 | ||||
-rw-r--r-- | core/pim/addressbook/abview.cpp | 52 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 58 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg.cpp | 10 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 58 | ||||
-rw-r--r-- | core/pim/addressbook/picker.cpp | 2 |
7 files changed, 120 insertions, 120 deletions
diff --git a/core/pim/addressbook/ablabel.cpp b/core/pim/addressbook/ablabel.cpp index b81a3b9..6b8e4dd 100644 --- a/core/pim/addressbook/ablabel.cpp +++ b/core/pim/addressbook/ablabel.cpp | |||
@@ -1,144 +1,144 @@ | |||
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 | #include "ablabel.h" | 21 | #include "ablabel.h" |
22 | 22 | ||
23 | #include <opie2/odebug.h> | 23 | #include <opie2/odebug.h> |
24 | 24 | ||
25 | AbLabel::AbLabel( QWidget *parent, const char *name ): | 25 | AbLabel::AbLabel( QWidget *parent, const char *name ): |
26 | QTextView( parent, name ), | 26 | QTextView( parent, name ), |
27 | m_empty( false ) | 27 | m_empty( false ) |
28 | { | 28 | { |
29 | } | 29 | } |
30 | 30 | ||
31 | AbLabel::~AbLabel() | 31 | AbLabel::~AbLabel() |
32 | { | 32 | { |
33 | } | 33 | } |
34 | 34 | ||
35 | void AbLabel::setContacts( const Opie::OPimContactAccess::List& viewList ) | 35 | void AbLabel::setContacts( const Opie::OPimContactAccess::List& viewList ) |
36 | { | 36 | { |
37 | m_viewList = viewList; | 37 | m_viewList = viewList; |
38 | if (m_viewList.count() != 0){ | 38 | if (m_viewList.count() != 0){ |
39 | m_empty = false; | 39 | m_empty = false; |
40 | m_itCurContact = m_viewList.begin(); | 40 | m_itCurContact = m_viewList.begin(); |
41 | sync(); | 41 | sync(); |
42 | }else{ | 42 | }else{ |
43 | // m_itCurContact.clear(); | 43 | // m_itCurContact.clear(); |
44 | m_empty = true; | 44 | m_empty = true; |
45 | setText( "" ); | 45 | setText( "" ); |
46 | } | 46 | } |
47 | } | 47 | } |
48 | 48 | ||
49 | int AbLabel::currentEntry_UID() | 49 | int AbLabel::currentEntry_UID() |
50 | { | 50 | { |
51 | Opie::OPimContact contact = currentEntry(); | 51 | Opie::OPimContact contact = currentEntry(); |
52 | 52 | ||
53 | if ( contact.isEmpty() ) | 53 | if ( contact.isEmpty() ) |
54 | return 0; | 54 | return 0; |
55 | else | 55 | else |
56 | return ( contact.uid() ); | 56 | return ( contact.uid() ); |
57 | } | 57 | } |
58 | 58 | ||
59 | Opie::OPimContact AbLabel::currentEntry() | 59 | Opie::OPimContact AbLabel::currentEntry() |
60 | { | 60 | { |
61 | if ( ! m_empty ) | 61 | if ( ! m_empty ) |
62 | return ( *m_itCurContact ); | 62 | return ( *m_itCurContact ); |
63 | else | 63 | else |
64 | return Opie::OPimContact(); | 64 | return Opie::OPimContact(); |
65 | } | 65 | } |
66 | 66 | ||
67 | 67 | ||
68 | bool AbLabel::selectContact( int UID ) | 68 | bool AbLabel::selectContact( int UID ) |
69 | { | 69 | { |
70 | 70 | ||
71 | for ( int r = 0; r < m_viewList.count(); ++r ) { | 71 | for ( int r = 0; r < m_viewList.count(); ++r ) { |
72 | if ( m_viewList.uidAt( r ) == UID ){ | 72 | if ( m_viewList.uidAt( r ) == UID ){ |
73 | m_itCurContact.setCurrent( r ); | 73 | m_itCurContact.setCurrent( r ); |
74 | break; | 74 | break; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | sync(); | 78 | sync(); |
79 | 79 | ||
80 | return true; | 80 | return true; |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | 84 | ||
85 | void AbLabel::sync() | 85 | void AbLabel::sync() |
86 | { | 86 | { |
87 | QString text = (*m_itCurContact).toRichText(); | 87 | QString text = (*m_itCurContact).toRichText(); |
88 | setText( text ); | 88 | setText( text ); |
89 | } | 89 | } |
90 | 90 | ||
91 | void AbLabel::keyPressEvent( QKeyEvent *e ) | 91 | void AbLabel::keyPressEvent( QKeyEvent *e ) |
92 | { | 92 | { |
93 | 93 | ||
94 | // Commonly handled keys | 94 | // Commonly handled keys |
95 | if ( !m_empty ){ | 95 | if ( !m_empty ){ |
96 | switch( e->key() ) { | 96 | switch( e->key() ) { |
97 | case Qt::Key_Left: | 97 | case Qt::Key_Left: |
98 | owarn << "Left.." << oendl; | 98 | odebug << "Left.." << oendl; |
99 | case Qt::Key_Right: | 99 | case Qt::Key_Right: |
100 | owarn << "Right.." << oendl; | 100 | odebug << "Right.." << oendl; |
101 | case Qt::Key_F33: | 101 | case Qt::Key_F33: |
102 | owarn << "OK.." << oendl; | 102 | odebug << "OK.." << oendl; |
103 | emit signalOkPressed(); | 103 | emit signalOkPressed(); |
104 | break; | 104 | break; |
105 | case Qt::Key_Up: | 105 | case Qt::Key_Up: |
106 | owarn << "Up.." << oendl; | 106 | odebug << "Up.." << oendl; |
107 | if ( ( visibleHeight() < contentsHeight() ) && | 107 | if ( ( visibleHeight() < contentsHeight() ) && |
108 | ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) ) | 108 | ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) ) |
109 | scrollBy( 0, -(visibleHeight()-20) ); | 109 | scrollBy( 0, -(visibleHeight()-20) ); |
110 | else { | 110 | else { |
111 | --m_itCurContact; | 111 | --m_itCurContact; |
112 | if ( *m_itCurContact != Opie::OPimContact() ) | 112 | if ( *m_itCurContact != Opie::OPimContact() ) |
113 | sync(); | 113 | sync(); |
114 | else | 114 | else |
115 | m_itCurContact = m_viewList.end(); | 115 | m_itCurContact = m_viewList.end(); |
116 | } | 116 | } |
117 | 117 | ||
118 | break; | 118 | break; |
119 | case Qt::Key_Down: | 119 | case Qt::Key_Down: |
120 | owarn << "Down.." << oendl; | 120 | odebug << "Down.." << oendl; |
121 | // owarn << "Visible: " << visibleHeight() << ", content: " << contentHeight() << oendl; | 121 | // odebug << "Visible: " << visibleHeight() << ", content: " << contentHeight() << oendl; |
122 | // owarn << "Value: " << verticalScrollBar()->value() | 122 | // odebug << "Value: " << verticalScrollBar()->value() |
123 | // << ", barMaxValue: " << verticalScrollBar()->maxValue() << oendl; | 123 | // << ", barMaxValue: " << verticalScrollBar()->maxValue() << oendl; |
124 | if ( ( visibleHeight() < contentsHeight() ) && | 124 | if ( ( visibleHeight() < contentsHeight() ) && |
125 | ( verticalScrollBar()->value() < verticalScrollBar()->maxValue() ) ) | 125 | ( verticalScrollBar()->value() < verticalScrollBar()->maxValue() ) ) |
126 | scrollBy( 0, visibleHeight()-20 ); | 126 | scrollBy( 0, visibleHeight()-20 ); |
127 | else { | 127 | else { |
128 | ++m_itCurContact; | 128 | ++m_itCurContact; |
129 | if ( *m_itCurContact != Opie::OPimContact() ) | 129 | if ( *m_itCurContact != Opie::OPimContact() ) |
130 | sync(); | 130 | sync(); |
131 | else | 131 | else |
132 | m_itCurContact = m_viewList.begin(); | 132 | m_itCurContact = m_viewList.begin(); |
133 | } | 133 | } |
134 | break; | 134 | break; |
135 | case Qt::Key_Return: // fall through | 135 | case Qt::Key_Return: // fall through |
136 | case Qt::Key_Space: // fall through | 136 | case Qt::Key_Space: // fall through |
137 | case Qt::Key_Enter: // we want to switch back | 137 | case Qt::Key_Enter: // we want to switch back |
138 | emit signalOkPressed(); | 138 | emit signalOkPressed(); |
139 | break; | 139 | break; |
140 | default: break; | 140 | default: break; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | } | 144 | } |
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 3fb2214..30d749c 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -1,841 +1,841 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file is part of Qt Palmtop Environment. | 5 | ** This file is part of Qt Palmtop Environment. |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #include <opie2/odebug.h> | 22 | #include <opie2/odebug.h> |
23 | #include <opie2/opimrecordlist.h> | 23 | #include <opie2/opimrecordlist.h> |
24 | 24 | ||
25 | #include <qpe/timestring.h> | 25 | #include <qpe/timestring.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | 27 | ||
28 | #include "abtable.h" | 28 | #include "abtable.h" |
29 | 29 | ||
30 | #include <errno.h> | 30 | #include <errno.h> |
31 | #include <fcntl.h> | 31 | #include <fcntl.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #include <stdlib.h> | 33 | #include <stdlib.h> |
34 | 34 | ||
35 | #include <ctype.h> //toupper() for key hack | 35 | #include <ctype.h> //toupper() for key hack |
36 | 36 | ||
37 | #if 0 | 37 | #if 0 |
38 | 38 | ||
39 | /*! | 39 | /*! |
40 | \class AbTableItem abtable.h | 40 | \class AbTableItem abtable.h |
41 | 41 | ||
42 | \brief QTableItem based class for showing a field of an entry | 42 | \brief QTableItem based class for showing a field of an entry |
43 | */ | 43 | */ |
44 | 44 | ||
45 | AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, | 45 | AbTableItem::AbTableItem( QTable *t, EditType et, const QString &s, |
46 | const QString &secondSortKey) | 46 | const QString &secondSortKey) |
47 | : QTableItem( t, et, s ) | 47 | : QTableItem( t, et, s ) |
48 | { | 48 | { |
49 | // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); | 49 | // sortKey = s.lower() + QChar( '\0' ) + secondSortKey.lower(); |
50 | sortKey = Qtopia::buildSortKey( s, secondSortKey ); | 50 | sortKey = Qtopia::buildSortKey( s, secondSortKey ); |
51 | } | 51 | } |
52 | 52 | ||
53 | int AbTableItem::alignment() const | 53 | int AbTableItem::alignment() const |
54 | { | 54 | { |
55 | return AlignLeft|AlignVCenter; | 55 | return AlignLeft|AlignVCenter; |
56 | } | 56 | } |
57 | 57 | ||
58 | QString AbTableItem::key() const | 58 | QString AbTableItem::key() const |
59 | { | 59 | { |
60 | return sortKey; | 60 | return sortKey; |
61 | } | 61 | } |
62 | 62 | ||
63 | // A way to reset the item, without out doing a delete or a new... | 63 | // A way to reset the item, without out doing a delete or a new... |
64 | void AbTableItem::setItem( const QString &txt, const QString &secondKey ) | 64 | void AbTableItem::setItem( const QString &txt, const QString &secondKey ) |
65 | { | 65 | { |
66 | setText( txt ); | 66 | setText( txt ); |
67 | sortKey = Qtopia::buildSortKey( txt, secondKey ); | 67 | sortKey = Qtopia::buildSortKey( txt, secondKey ); |
68 | 68 | ||
69 | // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); | 69 | // sortKey = txt.lower() + QChar( '\0' ) + secondKey.lower(); |
70 | } | 70 | } |
71 | 71 | ||
72 | /*! | 72 | /*! |
73 | \class AbPickItem abtable.h | 73 | \class AbPickItem abtable.h |
74 | 74 | ||
75 | \brief QTableItem based class for showing slection of an entry | 75 | \brief QTableItem based class for showing slection of an entry |
76 | */ | 76 | */ |
77 | 77 | ||
78 | AbPickItem::AbPickItem( QTable *t ) : | 78 | AbPickItem::AbPickItem( QTable *t ) : |
79 | QTableItem(t, WhenCurrent, "?") | 79 | QTableItem(t, WhenCurrent, "?") |
80 | { | 80 | { |
81 | } | 81 | } |
82 | 82 | ||
83 | QWidget *AbPickItem::createEditor() const | 83 | QWidget *AbPickItem::createEditor() const |
84 | { | 84 | { |
85 | QComboBox* combo = new QComboBox( table()->viewport() ); | 85 | QComboBox* combo = new QComboBox( table()->viewport() ); |
86 | ( (AbPickItem*)this )->cb = combo; | 86 | ( (AbPickItem*)this )->cb = combo; |
87 | AbTable* t = static_cast<AbTable*>(table()); | 87 | AbTable* t = static_cast<AbTable*>(table()); |
88 | QStringList c = t->choiceNames(); | 88 | QStringList c = t->choiceNames(); |
89 | int cur = 0; | 89 | int cur = 0; |
90 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { | 90 | for (QStringList::ConstIterator it = c.begin(); it!=c.end(); ++it) { |
91 | if ( *it == text() ) | 91 | if ( *it == text() ) |
92 | cur = combo->count(); | 92 | cur = combo->count(); |
93 | combo->insertItem(*it); | 93 | combo->insertItem(*it); |
94 | } | 94 | } |
95 | combo->setCurrentItem(cur); | 95 | combo->setCurrentItem(cur); |
96 | return combo; | 96 | return combo; |
97 | } | 97 | } |
98 | 98 | ||
99 | void AbPickItem::setContentFromEditor( QWidget *w ) | 99 | void AbPickItem::setContentFromEditor( QWidget *w ) |
100 | { | 100 | { |
101 | if ( w->inherits("QComboBox") ) | 101 | if ( w->inherits("QComboBox") ) |
102 | setText( ( (QComboBox*)w )->currentText() ); | 102 | setText( ( (QComboBox*)w )->currentText() ); |
103 | else | 103 | else |
104 | QTableItem::setContentFromEditor( w ); | 104 | QTableItem::setContentFromEditor( w ); |
105 | } | 105 | } |
106 | 106 | ||
107 | #endif | 107 | #endif |
108 | 108 | ||
109 | /*! | 109 | /*! |
110 | \class AbTable abtable.h | 110 | \class AbTable abtable.h |
111 | 111 | ||
112 | \brief QTable based class for showing a list of entries | 112 | \brief QTable based class for showing a list of entries |
113 | */ | 113 | */ |
114 | 114 | ||
115 | AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) | 115 | AbTable::AbTable( const QValueList<int> order, QWidget *parent, const char *name ) |
116 | : QTable( parent, name ), | 116 | : QTable( parent, name ), |
117 | lastSortCol( -1 ), | 117 | lastSortCol( -1 ), |
118 | asc( TRUE ), | 118 | asc( TRUE ), |
119 | intFields( order ), | 119 | intFields( order ), |
120 | enablePainting( true ), | 120 | enablePainting( true ), |
121 | columnVisible( true ), | 121 | columnVisible( true ), |
122 | countNested( 0 ) | 122 | countNested( 0 ) |
123 | { | 123 | { |
124 | //owarn << "C'tor start" << oendl; | 124 | //odebug << "C'tor start" << oendl; |
125 | setSelectionMode( NoSelection ); | 125 | setSelectionMode( NoSelection ); |
126 | init(); | 126 | init(); |
127 | setSorting( TRUE ); | 127 | setSorting( TRUE ); |
128 | connect( this, SIGNAL(clicked(int,int,int,const QPoint&)), | 128 | connect( this, SIGNAL(clicked(int,int,int,const QPoint&)), |
129 | this, SLOT(itemClicked(int,int)) ); | 129 | this, SLOT(itemClicked(int,int)) ); |
130 | 130 | ||
131 | // contactList.clear(); | 131 | // contactList.clear(); |
132 | //owarn << "C'tor end" << oendl; | 132 | //odebug << "C'tor end" << oendl; |
133 | } | 133 | } |
134 | 134 | ||
135 | AbTable::~AbTable() | 135 | AbTable::~AbTable() |
136 | { | 136 | { |
137 | } | 137 | } |
138 | 138 | ||
139 | void AbTable::init() | 139 | void AbTable::init() |
140 | { | 140 | { |
141 | // :SX showChar = '\0'; | 141 | // :SX showChar = '\0'; |
142 | setNumRows( 0 ); | 142 | setNumRows( 0 ); |
143 | setNumCols( 2 ); | 143 | setNumCols( 2 ); |
144 | 144 | ||
145 | horizontalHeader()->setLabel( 0, tr( "Full Name" )); | 145 | horizontalHeader()->setLabel( 0, tr( "Full Name" )); |
146 | horizontalHeader()->setLabel( 1, tr( "Contact" )); | 146 | horizontalHeader()->setLabel( 1, tr( "Contact" )); |
147 | setLeftMargin( 0 ); | 147 | setLeftMargin( 0 ); |
148 | verticalHeader()->hide(); | 148 | verticalHeader()->hide(); |
149 | columnVisible = true; | 149 | columnVisible = true; |
150 | } | 150 | } |
151 | 151 | ||
152 | void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList ) | 152 | void AbTable::setContacts( const Opie::OPimContactAccess::List& viewList ) |
153 | { | 153 | { |
154 | owarn << "AbTable::setContacts()" << oendl; | 154 | odebug << "AbTable::setContacts()" << oendl; |
155 | 155 | ||
156 | clear(); | 156 | clear(); |
157 | m_viewList = viewList; | 157 | m_viewList = viewList; |
158 | 158 | ||
159 | setSorting( false ); | 159 | setSorting( false ); |
160 | setPaintingEnabled( FALSE ); | 160 | setPaintingEnabled( FALSE ); |
161 | 161 | ||
162 | Opie::OPimContactAccess::List::Iterator it; | 162 | Opie::OPimContactAccess::List::Iterator it; |
163 | setNumRows( m_viewList.count() ); | 163 | setNumRows( m_viewList.count() ); |
164 | //int row = 0; | 164 | //int row = 0; |
165 | // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) | 165 | // for ( it = m_viewList.begin(); it != m_viewList.end(); ++it ) |
166 | // insertIntoTable( *it, row++ ); | 166 | // insertIntoTable( *it, row++ ); |
167 | 167 | ||
168 | // setSorting( true ); | 168 | // setSorting( true ); |
169 | 169 | ||
170 | // resort(); | 170 | // resort(); |
171 | 171 | ||
172 | updateVisible(); | 172 | updateVisible(); |
173 | 173 | ||
174 | setPaintingEnabled( TRUE ); | 174 | setPaintingEnabled( TRUE ); |
175 | 175 | ||
176 | } | 176 | } |
177 | 177 | ||
178 | void AbTable::setOrderedList( const QValueList<int> ordered ) | 178 | void AbTable::setOrderedList( const QValueList<int> ordered ) |
179 | { | 179 | { |
180 | intFields = ordered; | 180 | intFields = ordered; |
181 | } | 181 | } |
182 | 182 | ||
183 | 183 | ||
184 | bool AbTable::selectContact( int UID ) | 184 | bool AbTable::selectContact( int UID ) |
185 | { | 185 | { |
186 | owarn << "AbTable::selectContact( " << UID << " )" << oendl; | 186 | odebug << "AbTable::selectContact( " << UID << " )" << oendl; |
187 | int rows = numRows(); | 187 | int rows = numRows(); |
188 | Opie::OPimContact* foundContact = 0l; | 188 | Opie::OPimContact* foundContact = 0l; |
189 | bool found = false; | 189 | bool found = false; |
190 | 190 | ||
191 | setPaintingEnabled( FALSE ); | 191 | setPaintingEnabled( FALSE ); |
192 | owarn << "Search start" << oendl; | 192 | odebug << "Search start" << oendl; |
193 | for ( int r = 0; r < rows; ++r ) { | 193 | for ( int r = 0; r < rows; ++r ) { |
194 | if ( m_viewList.uidAt( r ) == UID ){ | 194 | if ( m_viewList.uidAt( r ) == UID ){ |
195 | ensureCellVisible( r, 0 ); | 195 | ensureCellVisible( r, 0 ); |
196 | setCurrentCell( r, 0 ); | 196 | setCurrentCell( r, 0 ); |
197 | found = true; | 197 | found = true; |
198 | break; | 198 | break; |
199 | } | 199 | } |
200 | } | 200 | } |
201 | owarn << "Search end" << oendl; | 201 | odebug << "Search end" << oendl; |
202 | 202 | ||
203 | if ( !found ){ | 203 | if ( !found ){ |
204 | ensureCellVisible( 0,0 ); | 204 | ensureCellVisible( 0,0 ); |
205 | setCurrentCell( 0, 0 ); | 205 | setCurrentCell( 0, 0 ); |
206 | } | 206 | } |
207 | 207 | ||
208 | setPaintingEnabled( TRUE ); | 208 | setPaintingEnabled( TRUE ); |
209 | 209 | ||
210 | return true; | 210 | return true; |
211 | } | 211 | } |
212 | 212 | ||
213 | #if 0 | 213 | #if 0 |
214 | void AbTable::insertIntoTable( const Opie::OPimContact& cnt, int row ) | 214 | void AbTable::insertIntoTable( const Opie::OPimContact& cnt, int row ) |
215 | { | 215 | { |
216 | owarn << "void AbTable::insertIntoTable( const Opie::OPimContact& cnt, " | 216 | odebug << "void AbTable::insertIntoTable( const Opie::OPimContact& cnt, " |
217 | << row << " )" << oendl; | 217 | << row << " )" << oendl; |
218 | QString strName; | 218 | QString strName; |
219 | ContactItem contactItem; | 219 | ContactItem contactItem; |
220 | 220 | ||
221 | strName = findContactName( cnt ); | 221 | strName = findContactName( cnt ); |
222 | contactItem = findContactContact( cnt, row ); | 222 | contactItem = findContactContact( cnt, row ); |
223 | 223 | ||
224 | AbTableItem *ati; | 224 | AbTableItem *ati; |
225 | ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value ); | 225 | ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value ); |
226 | contactList.insert( ati, cnt ); | 226 | contactList.insert( ati, cnt ); |
227 | setItem( row, 0, ati ); | 227 | setItem( row, 0, ati ); |
228 | ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName); | 228 | ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName); |
229 | if ( !contactItem.icon.isNull() ) | 229 | if ( !contactItem.icon.isNull() ) |
230 | ati->setPixmap( contactItem.icon ); | 230 | ati->setPixmap( contactItem.icon ); |
231 | setItem( row, 1, ati ); | 231 | setItem( row, 1, ati ); |
232 | 232 | ||
233 | //### cannot do this; table only has two columns at this point | 233 | //### cannot do this; table only has two columns at this point |
234 | // setItem( row, 2, new AbPickItem( this ) ); | 234 | // setItem( row, 2, new AbPickItem( this ) ); |
235 | 235 | ||
236 | } | 236 | } |
237 | #endif | 237 | #endif |
238 | 238 | ||
239 | 239 | ||
240 | void AbTable::columnClicked( int col ) | 240 | void AbTable::columnClicked( int col ) |
241 | { | 241 | { |
242 | if ( !sorting() ) | 242 | if ( !sorting() ) |
243 | return; | 243 | return; |
244 | 244 | ||
245 | if ( lastSortCol == -1 ) | 245 | if ( lastSortCol == -1 ) |
246 | lastSortCol = col; | 246 | lastSortCol = col; |
247 | 247 | ||
248 | if ( col == lastSortCol ) { | 248 | if ( col == lastSortCol ) { |
249 | asc = !asc; | 249 | asc = !asc; |
250 | } else { | 250 | } else { |
251 | lastSortCol = col; | 251 | lastSortCol = col; |
252 | asc = TRUE; | 252 | asc = TRUE; |
253 | } | 253 | } |
254 | //QMessageBox::information( this, "resort", "columnClicked" ); | 254 | //QMessageBox::information( this, "resort", "columnClicked" ); |
255 | resort(); | 255 | resort(); |
256 | } | 256 | } |
257 | 257 | ||
258 | void AbTable::resort() | 258 | void AbTable::resort() |
259 | { | 259 | { |
260 | owarn << "void AbTable::resort() NOT POSSIBLE !!" << oendl; | 260 | owarn << "void AbTable::resort() NOT POSSIBLE !!" << oendl; |
261 | #if 0 | 261 | #if 0 |
262 | setPaintingEnabled( FALSE ); | 262 | setPaintingEnabled( FALSE ); |
263 | if ( sorting() ) { | 263 | if ( sorting() ) { |
264 | if ( lastSortCol == -1 ) | 264 | if ( lastSortCol == -1 ) |
265 | lastSortCol = 0; | 265 | lastSortCol = 0; |
266 | sortColumn( lastSortCol, asc, TRUE ); | 266 | sortColumn( lastSortCol, asc, TRUE ); |
267 | //QMessageBox::information( this, "resort", "resort" ); | 267 | //QMessageBox::information( this, "resort", "resort" ); |
268 | updateVisible(); | 268 | updateVisible(); |
269 | } | 269 | } |
270 | setPaintingEnabled( TRUE ); | 270 | setPaintingEnabled( TRUE ); |
271 | #endif | 271 | #endif |
272 | } | 272 | } |
273 | 273 | ||
274 | Opie::OPimContact AbTable::currentEntry() | 274 | Opie::OPimContact AbTable::currentEntry() |
275 | { | 275 | { |
276 | return m_viewList[currentRow()]; | 276 | return m_viewList[currentRow()]; |
277 | } | 277 | } |
278 | 278 | ||
279 | int AbTable::currentEntry_UID() | 279 | int AbTable::currentEntry_UID() |
280 | { | 280 | { |
281 | return ( currentEntry().uid() ); | 281 | return ( currentEntry().uid() ); |
282 | } | 282 | } |
283 | 283 | ||
284 | void AbTable::clear() | 284 | void AbTable::clear() |
285 | { | 285 | { |
286 | owarn << "void AbTable::clear()" << oendl; | 286 | odebug << "void AbTable::clear()" << oendl; |
287 | // contactList.clear(); | 287 | // contactList.clear(); |
288 | 288 | ||
289 | setPaintingEnabled( FALSE ); | 289 | setPaintingEnabled( FALSE ); |
290 | for ( int r = 0; r < numRows(); ++r ) { | 290 | for ( int r = 0; r < numRows(); ++r ) { |
291 | for ( int c = 0; c < numCols(); ++c ) { | 291 | for ( int c = 0; c < numCols(); ++c ) { |
292 | if ( cellWidget( r, c ) ) | 292 | if ( cellWidget( r, c ) ) |
293 | clearCellWidget( r, c ); | 293 | clearCellWidget( r, c ); |
294 | clearCell( r, c ); | 294 | clearCell( r, c ); |
295 | } | 295 | } |
296 | } | 296 | } |
297 | setNumRows( 0 ); | 297 | setNumRows( 0 ); |
298 | setPaintingEnabled( TRUE ); | 298 | setPaintingEnabled( TRUE ); |
299 | } | 299 | } |
300 | 300 | ||
301 | // Refresh updates column 2 if the contactsettings changed | 301 | // Refresh updates column 2 if the contactsettings changed |
302 | void AbTable::refresh() | 302 | void AbTable::refresh() |
303 | { | 303 | { |
304 | owarn << "void AbTable::refresh() NOT IMPLEMENTED !!" << oendl; | 304 | owarn << "void AbTable::refresh() NOT IMPLEMENTED !!" << oendl; |
305 | 305 | ||
306 | #if 0 | 306 | #if 0 |
307 | int rows = numRows(); | 307 | int rows = numRows(); |
308 | AbTableItem *abi; | 308 | AbTableItem *abi; |
309 | ContactItem contactItem; | 309 | ContactItem contactItem; |
310 | 310 | ||
311 | setPaintingEnabled( FALSE ); | 311 | setPaintingEnabled( FALSE ); |
312 | for ( int r = 0; r < rows; ++r ) { | 312 | for ( int r = 0; r < rows; ++r ) { |
313 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 313 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
314 | contactItem = findContactContact( contactList[abi], r ); | 314 | contactItem = findContactContact( contactList[abi], r ); |
315 | static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() ); | 315 | static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() ); |
316 | if ( !contactItem.icon.isNull() ){ | 316 | if ( !contactItem.icon.isNull() ){ |
317 | static_cast<AbTableItem*>( item(r, 1) )-> | 317 | static_cast<AbTableItem*>( item(r, 1) )-> |
318 | setPixmap( contactItem.icon ); | 318 | setPixmap( contactItem.icon ); |
319 | }else{ | 319 | }else{ |
320 | static_cast<AbTableItem*>( item(r, 1) )-> | 320 | static_cast<AbTableItem*>( item(r, 1) )-> |
321 | setPixmap( QPixmap() ); | 321 | setPixmap( QPixmap() ); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | resort(); | 324 | resort(); |
325 | setPaintingEnabled( TRUE ); | 325 | setPaintingEnabled( TRUE ); |
326 | 326 | ||
327 | #endif | 327 | #endif |
328 | } | 328 | } |
329 | 329 | ||
330 | void AbTable::keyPressEvent( QKeyEvent *e ) | 330 | void AbTable::keyPressEvent( QKeyEvent *e ) |
331 | { | 331 | { |
332 | char key = toupper( e->ascii() ); | 332 | char key = toupper( e->ascii() ); |
333 | 333 | ||
334 | if ( key >= 'A' && key <= 'Z' ) | 334 | if ( key >= 'A' && key <= 'Z' ) |
335 | moveTo( key ); | 335 | moveTo( key ); |
336 | 336 | ||
337 | // owarn << "Received key .." << oendl; | 337 | // odebug << "Received key .." << oendl; |
338 | switch( e->key() ) { | 338 | switch( e->key() ) { |
339 | case Qt::Key_Space: | 339 | case Qt::Key_Space: |
340 | case Qt::Key_Return: | 340 | case Qt::Key_Return: |
341 | case Qt::Key_Enter: | 341 | case Qt::Key_Enter: |
342 | emit signalSwitch(); | 342 | emit signalSwitch(); |
343 | break; | 343 | break; |
344 | // case Qt::Key_Up: | 344 | // case Qt::Key_Up: |
345 | // owarn << "a" << oendl; | 345 | // odebug << "a" << oendl; |
346 | // emit signalKeyUp(); | 346 | // emit signalKeyUp(); |
347 | // break; | 347 | // break; |
348 | // case Qt::Key_Down: | 348 | // case Qt::Key_Down: |
349 | // owarn << "b" << oendl; | 349 | // odebug << "b" << oendl; |
350 | // emit signalKeyDown(); | 350 | // emit signalKeyDown(); |
351 | // break; | 351 | // break; |
352 | default: | 352 | default: |
353 | QTable::keyPressEvent( e ); | 353 | QTable::keyPressEvent( e ); |
354 | } | 354 | } |
355 | 355 | ||
356 | } | 356 | } |
357 | 357 | ||
358 | void AbTable::moveTo( char c ) | 358 | void AbTable::moveTo( char c ) |
359 | { | 359 | { |
360 | owarn << "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" << oendl; | 360 | odebug << "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" << oendl; |
361 | 361 | ||
362 | #if 0 | 362 | #if 0 |
363 | int rows = numRows(); | 363 | int rows = numRows(); |
364 | QString value; | 364 | QString value; |
365 | AbTableItem *abi; | 365 | AbTableItem *abi; |
366 | int r; | 366 | int r; |
367 | if ( asc ) { | 367 | if ( asc ) { |
368 | r = 0; | 368 | r = 0; |
369 | while ( r < rows-1) { | 369 | while ( r < rows-1) { |
370 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 370 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
371 | QChar first = abi->key()[0]; | 371 | QChar first = abi->key()[0]; |
372 | //### is there a bug in QChar to char comparison??? | 372 | //### is there a bug in QChar to char comparison??? |
373 | if ( first.row() || first.cell() >= c ) | 373 | if ( first.row() || first.cell() >= c ) |
374 | break; | 374 | break; |
375 | r++; | 375 | r++; |
376 | } | 376 | } |
377 | } else { | 377 | } else { |
378 | //### should probably disable reverse sorting instead | 378 | //### should probably disable reverse sorting instead |
379 | r = rows - 1; | 379 | r = rows - 1; |
380 | while ( r > 0 ) { | 380 | while ( r > 0 ) { |
381 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 381 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
382 | QChar first = abi->key()[0]; | 382 | QChar first = abi->key()[0]; |
383 | //### is there a bug in QChar to char comparison??? | 383 | //### is there a bug in QChar to char comparison??? |
384 | if ( first.row() || first.cell() >= c ) | 384 | if ( first.row() || first.cell() >= c ) |
385 | break; | 385 | break; |
386 | r--; | 386 | r--; |
387 | } | 387 | } |
388 | } | 388 | } |
389 | setCurrentCell( r, currentColumn() ); | 389 | setCurrentCell( r, currentColumn() ); |
390 | 390 | ||
391 | #endif | 391 | #endif |
392 | } | 392 | } |
393 | 393 | ||
394 | #if 0 | 394 | #if 0 |
395 | // Useless.. Nobody uses it .. (se) | 395 | // Useless.. Nobody uses it .. (se) |
396 | QString AbTable::findContactName( const Opie::OPimContact &entry ) | 396 | QString AbTable::findContactName( const Opie::OPimContact &entry ) |
397 | { | 397 | { |
398 | // We use the fileAs, then company, defaultEmail | 398 | // We use the fileAs, then company, defaultEmail |
399 | QString str; | 399 | QString str; |
400 | str = entry.fileAs(); | 400 | str = entry.fileAs(); |
401 | if ( str.isEmpty() ) { | 401 | if ( str.isEmpty() ) { |
402 | str = entry.company(); | 402 | str = entry.company(); |
403 | if ( str.isEmpty() ) { | 403 | if ( str.isEmpty() ) { |
404 | str = entry.defaultEmail(); | 404 | str = entry.defaultEmail(); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | return str; | 407 | return str; |
408 | } | 408 | } |
409 | #endif | 409 | #endif |
410 | 410 | ||
411 | 411 | ||
412 | void AbTable::resizeRows() { | 412 | void AbTable::resizeRows() { |
413 | /* | 413 | /* |
414 | if (numRows()) { | 414 | if (numRows()) { |
415 | for (int i = 0; i < numRows(); i++) { | 415 | for (int i = 0; i < numRows(); i++) { |
416 | setRowHeight( i, size ); | 416 | setRowHeight( i, size ); |
417 | } | 417 | } |
418 | } | 418 | } |
419 | updateVisible(); | 419 | updateVisible(); |
420 | */ | 420 | */ |
421 | } | 421 | } |
422 | 422 | ||
423 | 423 | ||
424 | void AbTable::realignTable() | 424 | void AbTable::realignTable() |
425 | { | 425 | { |
426 | //owarn << "void AbTable::realignTable()" << oendl; | 426 | //odebug << "void AbTable::realignTable()" << oendl; |
427 | 427 | ||
428 | setPaintingEnabled( FALSE ); | 428 | setPaintingEnabled( FALSE ); |
429 | 429 | ||
430 | resizeRows(); | 430 | resizeRows(); |
431 | fitColumns(); | 431 | fitColumns(); |
432 | 432 | ||
433 | setPaintingEnabled( TRUE ); | 433 | setPaintingEnabled( TRUE ); |
434 | 434 | ||
435 | } | 435 | } |
436 | 436 | ||
437 | 437 | ||
438 | 438 | ||
439 | 439 | ||
440 | #if QT_VERSION <= 230 | 440 | #if QT_VERSION <= 230 |
441 | #ifndef SINGLE_APP | 441 | #ifndef SINGLE_APP |
442 | void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) | 442 | void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) |
443 | { | 443 | { |
444 | // Region of the rect we should draw | 444 | // Region of the rect we should draw |
445 | QRegion reg( QRect( cx, cy, cw, ch ) ); | 445 | QRegion reg( QRect( cx, cy, cw, ch ) ); |
446 | // Subtract the table from it | 446 | // Subtract the table from it |
447 | reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); | 447 | reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); |
448 | // And draw the rectangles (transformed as needed) | 448 | // And draw the rectangles (transformed as needed) |
449 | QArray<QRect> r = reg.rects(); | 449 | QArray<QRect> r = reg.rects(); |
450 | for (unsigned int i=0; i<r.count(); i++) | 450 | for (unsigned int i=0; i<r.count(); i++) |
451 | p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); | 451 | p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); |
452 | } | 452 | } |
453 | #endif | 453 | #endif |
454 | #endif | 454 | #endif |
455 | 455 | ||
456 | 456 | ||
457 | // int AbTable::rowHeight( int ) const | 457 | // int AbTable::rowHeight( int ) const |
458 | // { | 458 | // { |
459 | // return 18; | 459 | // return 18; |
460 | // } | 460 | // } |
461 | 461 | ||
462 | // int AbTable::rowPos( int row ) const | 462 | // int AbTable::rowPos( int row ) const |
463 | // { | 463 | // { |
464 | // return 18*row; | 464 | // return 18*row; |
465 | // } | 465 | // } |
466 | 466 | ||
467 | // int AbTable::rowAt( int pos ) const | 467 | // int AbTable::rowAt( int pos ) const |
468 | // { | 468 | // { |
469 | // return QMIN( pos/18, numRows()-1 ); | 469 | // return QMIN( pos/18, numRows()-1 ); |
470 | // } | 470 | // } |
471 | 471 | ||
472 | 472 | ||
473 | 473 | ||
474 | void AbTable::fitColumns() | 474 | void AbTable::fitColumns() |
475 | { | 475 | { |
476 | owarn << "void AbTable::fitColumns()" << oendl; | 476 | odebug << "void AbTable::fitColumns()" << oendl; |
477 | int contentsWidth = visibleWidth() / 2; | 477 | int contentsWidth = visibleWidth() / 2; |
478 | // Fix to better value | 478 | // Fix to better value |
479 | // contentsWidth = 130; | 479 | // contentsWidth = 130; |
480 | 480 | ||
481 | setPaintingEnabled( FALSE ); | 481 | setPaintingEnabled( FALSE ); |
482 | 482 | ||
483 | if ( columnVisible == false ){ | 483 | if ( columnVisible == false ){ |
484 | showColumn(0); | 484 | showColumn(0); |
485 | columnVisible = true; | 485 | columnVisible = true; |
486 | } | 486 | } |
487 | 487 | ||
488 | //owarn << "Width: " << contentsWidth << oendl; | 488 | //odebug << "Width: " << contentsWidth << oendl; |
489 | 489 | ||
490 | setColumnWidth( 0, contentsWidth ); | 490 | setColumnWidth( 0, contentsWidth ); |
491 | adjustColumn(1); | 491 | adjustColumn(1); |
492 | if ( columnWidth(1) < contentsWidth ) | 492 | if ( columnWidth(1) < contentsWidth ) |
493 | setColumnWidth( 1, contentsWidth ); | 493 | setColumnWidth( 1, contentsWidth ); |
494 | 494 | ||
495 | setPaintingEnabled( TRUE ); | 495 | setPaintingEnabled( TRUE ); |
496 | } | 496 | } |
497 | 497 | ||
498 | void AbTable::show() | 498 | void AbTable::show() |
499 | { | 499 | { |
500 | //owarn << "void AbTable::show()" << oendl; | 500 | //odebug << "void AbTable::show()" << oendl; |
501 | realignTable(); | 501 | realignTable(); |
502 | QTable::show(); | 502 | QTable::show(); |
503 | } | 503 | } |
504 | 504 | ||
505 | #if 0 | 505 | #if 0 |
506 | void AbTable::setChoiceNames( const QStringList& list) | 506 | void AbTable::setChoiceNames( const QStringList& list) |
507 | { | 507 | { |
508 | choicenames = list; | 508 | choicenames = list; |
509 | if ( choicenames.isEmpty() ) { | 509 | if ( choicenames.isEmpty() ) { |
510 | // hide pick column | 510 | // hide pick column |
511 | setNumCols( 2 ); | 511 | setNumCols( 2 ); |
512 | } else { | 512 | } else { |
513 | // show pick column | 513 | // show pick column |
514 | setNumCols( 3 ); | 514 | setNumCols( 3 ); |
515 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); | 515 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); |
516 | horizontalHeader()->setLabel( 2, tr( "Pick" )); | 516 | horizontalHeader()->setLabel( 2, tr( "Pick" )); |
517 | } | 517 | } |
518 | fitColumns(); | 518 | fitColumns(); |
519 | } | 519 | } |
520 | #endif | 520 | #endif |
521 | 521 | ||
522 | void AbTable::itemClicked(int,int col) | 522 | void AbTable::itemClicked(int,int col) |
523 | { | 523 | { |
524 | //owarn << "AbTable::itemClicked(int, col: " << col << ")" << oendl; | 524 | //odebug << "AbTable::itemClicked(int, col: " << col << ")" << oendl; |
525 | if ( col == 2 ) { | 525 | if ( col == 2 ) { |
526 | return; | 526 | return; |
527 | } else { | 527 | } else { |
528 | //owarn << "Emitting signalSwitch()" << oendl; | 528 | //odebug << "Emitting signalSwitch()" << oendl; |
529 | emit signalSwitch(); | 529 | emit signalSwitch(); |
530 | } | 530 | } |
531 | } | 531 | } |
532 | 532 | ||
533 | #if 0 | 533 | #if 0 |
534 | QStringList AbTable::choiceNames() const | 534 | QStringList AbTable::choiceNames() const |
535 | { | 535 | { |
536 | return choicenames; | 536 | return choicenames; |
537 | } | 537 | } |
538 | 538 | ||
539 | #endif | 539 | #endif |
540 | void AbTable::setChoiceSelection( const QValueList<int>& list ) | 540 | void AbTable::setChoiceSelection( const QValueList<int>& list ) |
541 | { | 541 | { |
542 | intFields = list; | 542 | intFields = list; |
543 | } | 543 | } |
544 | 544 | ||
545 | QStringList AbTable::choiceSelection(int /*index*/) const | 545 | QStringList AbTable::choiceSelection(int /*index*/) const |
546 | { | 546 | { |
547 | QStringList r; | 547 | QStringList r; |
548 | /* ###### | 548 | /* ###### |
549 | 549 | ||
550 | QString selname = choicenames.at(index); | 550 | QString selname = choicenames.at(index); |
551 | for (each row) { | 551 | for (each row) { |
552 | Opie::OPimContact *c = contactForRow(row); | 552 | Opie::OPimContact *c = contactForRow(row); |
553 | if ( text(row,2) == selname ) { | 553 | if ( text(row,2) == selname ) { |
554 | r.append(c->email); | 554 | r.append(c->email); |
555 | } | 555 | } |
556 | } | 556 | } |
557 | 557 | ||
558 | */ | 558 | */ |
559 | return r; | 559 | return r; |
560 | } | 560 | } |
561 | 561 | ||
562 | 562 | ||
563 | void AbTable::updateVisible() | 563 | void AbTable::updateVisible() |
564 | { | 564 | { |
565 | //owarn << "void AbTable::updateVisible()" << oendl; | 565 | //odebug << "void AbTable::updateVisible()" << oendl; |
566 | 566 | ||
567 | int visible, | 567 | int visible, |
568 | totalRows, | 568 | totalRows, |
569 | row, | 569 | row, |
570 | selectedRow = 0; | 570 | selectedRow = 0; |
571 | 571 | ||
572 | visible = 0; | 572 | visible = 0; |
573 | 573 | ||
574 | setPaintingEnabled( FALSE ); | 574 | setPaintingEnabled( FALSE ); |
575 | 575 | ||
576 | realignTable(); | 576 | realignTable(); |
577 | 577 | ||
578 | totalRows = numRows(); | 578 | totalRows = numRows(); |
579 | for ( row = 0; row < totalRows; row++ ) { | 579 | for ( row = 0; row < totalRows; row++ ) { |
580 | if ( rowHeight(row) == 0 ) { | 580 | if ( rowHeight(row) == 0 ) { |
581 | showRow( row ); | 581 | showRow( row ); |
582 | adjustRow( row ); | 582 | adjustRow( row ); |
583 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) | 583 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) |
584 | selectedRow = row; | 584 | selectedRow = row; |
585 | } | 585 | } |
586 | visible++; | 586 | visible++; |
587 | } | 587 | } |
588 | 588 | ||
589 | if ( selectedRow ) | 589 | if ( selectedRow ) |
590 | setCurrentCell( selectedRow, 0 ); | 590 | setCurrentCell( selectedRow, 0 ); |
591 | 591 | ||
592 | if ( !visible ) | 592 | if ( !visible ) |
593 | setCurrentCell( -1, 0 ); | 593 | setCurrentCell( -1, 0 ); |
594 | 594 | ||
595 | setPaintingEnabled( TRUE ); | 595 | setPaintingEnabled( TRUE ); |
596 | } | 596 | } |
597 | 597 | ||
598 | 598 | ||
599 | void AbTable::setPaintingEnabled( bool e ) | 599 | void AbTable::setPaintingEnabled( bool e ) |
600 | { | 600 | { |
601 | //owarn << "IN void AbTable::setPaintingEnabled( " << e << " )->Nested: " | 601 | //odebug << "IN void AbTable::setPaintingEnabled( " << e << " )->Nested: " |
602 | // << countNested << oendl; | 602 | // << countNested << oendl; |
603 | 603 | ||
604 | if ( e ) { | 604 | if ( e ) { |
605 | if ( countNested > 0 ) | 605 | if ( countNested > 0 ) |
606 | --countNested; | 606 | --countNested; |
607 | if ( ! countNested ){ | 607 | if ( ! countNested ){ |
608 | setUpdatesEnabled( true ); | 608 | setUpdatesEnabled( true ); |
609 | enablePainting = true; | 609 | enablePainting = true; |
610 | rowHeightChanged( 0 ); | 610 | rowHeightChanged( 0 ); |
611 | viewport()->update(); | 611 | viewport()->update(); |
612 | } | 612 | } |
613 | } else { | 613 | } else { |
614 | ++countNested; | 614 | ++countNested; |
615 | enablePainting = false; | 615 | enablePainting = false; |
616 | setUpdatesEnabled( false ); | 616 | setUpdatesEnabled( false ); |
617 | } | 617 | } |
618 | //owarn << "OUT void AbTable::setPaintingEnabled( " << e << " )->Nested: " | 618 | //odebug << "OUT void AbTable::setPaintingEnabled( " << e << " )->Nested: " |
619 | // << countNested << oendl; | 619 | // << countNested << oendl; |
620 | } | 620 | } |
621 | 621 | ||
622 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { | 622 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { |
623 | //owarn << "void AbTable::viewportPaintEvent( QPaintEvent* e ) -> " | 623 | //odebug << "void AbTable::viewportPaintEvent( QPaintEvent* e ) -> " |
624 | // << enablePainting << oendl; | 624 | // << enablePainting << oendl; |
625 | if ( enablePainting ) | 625 | if ( enablePainting ) |
626 | QTable::viewportPaintEvent( e ); | 626 | QTable::viewportPaintEvent( e ); |
627 | } | 627 | } |
628 | 628 | ||
629 | void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { | 629 | void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { |
630 | const QColorGroup &cg = colorGroup(); | 630 | const QColorGroup &cg = colorGroup(); |
631 | 631 | ||
632 | p->save(); | 632 | p->save(); |
633 | 633 | ||
634 | //owarn << "Paint row: " << row << oendl; | 634 | //odebug << "Paint row: " << row << oendl; |
635 | 635 | ||
636 | Opie::OPimContact act_contact = m_viewList[row]; | 636 | Opie::OPimContact act_contact = m_viewList[row]; |
637 | 637 | ||
638 | // Paint alternating background bars | 638 | // Paint alternating background bars |
639 | if ( (row % 2 ) == 0 ) { | 639 | if ( (row % 2 ) == 0 ) { |
640 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | 640 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); |
641 | p->setPen( QPen( cg.text() ) ); | 641 | p->setPen( QPen( cg.text() ) ); |
642 | } | 642 | } |
643 | else { | 643 | else { |
644 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); | 644 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); |
645 | p->setPen( QPen( cg.buttonText() ) ); | 645 | p->setPen( QPen( cg.buttonText() ) ); |
646 | } | 646 | } |
647 | 647 | ||
648 | QFont f = p->font(); | 648 | QFont f = p->font(); |
649 | QFontMetrics fm(f); | 649 | QFontMetrics fm(f); |
650 | 650 | ||
651 | int marg = 2; | 651 | int marg = 2; |
652 | int x = 0; | 652 | int x = 0; |
653 | int y = ( cr.height() - 14 ) / 2; | 653 | int y = ( cr.height() - 14 ) / 2; |
654 | 654 | ||
655 | QString nameText = act_contact.fileAs(); | 655 | QString nameText = act_contact.fileAs(); |
656 | 656 | ||
657 | switch( col ){ | 657 | switch( col ){ |
658 | case 0: | 658 | case 0: |
659 | p->drawText( x + marg,2 + fm.ascent(), nameText ); | 659 | p->drawText( x + marg,2 + fm.ascent(), nameText ); |
660 | break; | 660 | break; |
661 | case 1:{ | 661 | case 1:{ |
662 | 662 | ||
663 | ContactItem contactItem = findContactContact( act_contact, 0 ); | 663 | ContactItem contactItem = findContactContact( act_contact, 0 ); |
664 | QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ | 664 | QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ |
665 | QString contactText = contactItem.value; | 665 | QString contactText = contactItem.value; |
666 | 666 | ||
667 | if ( !contactPic.isNull() ) | 667 | if ( !contactPic.isNull() ) |
668 | { | 668 | { |
669 | p->drawPixmap( x + marg, y, contactPic ); | 669 | p->drawPixmap( x + marg, y, contactPic ); |
670 | p->drawText( x + marg + contactPic.width() | 670 | p->drawText( x + marg + contactPic.width() |
671 | + 4,2 + fm.ascent(), contactText ); | 671 | + 4,2 + fm.ascent(), contactText ); |
672 | } | 672 | } |
673 | else | 673 | else |
674 | { | 674 | { |
675 | p->drawText( x + marg,2 + fm.ascent(), contactText ); | 675 | p->drawText( x + marg,2 + fm.ascent(), contactText ); |
676 | } | 676 | } |
677 | } | 677 | } |
678 | break; | 678 | break; |
679 | 679 | ||
680 | } | 680 | } |
681 | p->restore(); | 681 | p->restore(); |
682 | } | 682 | } |
683 | 683 | ||
684 | void AbTable::rowHeightChanged( int row ) | 684 | void AbTable::rowHeightChanged( int row ) |
685 | { | 685 | { |
686 | if ( enablePainting ) | 686 | if ( enablePainting ) |
687 | QTable::rowHeightChanged( row ); | 687 | QTable::rowHeightChanged( row ); |
688 | } | 688 | } |
689 | ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ ) | 689 | ContactItem AbTable::findContactContact( const Opie::OPimContact &entry, int /* row */ ) |
690 | { | 690 | { |
691 | 691 | ||
692 | ContactItem item; | 692 | ContactItem item; |
693 | 693 | ||
694 | item.value = ""; | 694 | item.value = ""; |
695 | 695 | ||
696 | for ( QValueList<int>::ConstIterator it = intFields.begin(); | 696 | for ( QValueList<int>::ConstIterator it = intFields.begin(); |
697 | it != intFields.end(); ++it ) { | 697 | it != intFields.end(); ++it ) { |
698 | switch ( *it ) { | 698 | switch ( *it ) { |
699 | default: | 699 | default: |
700 | break; | 700 | break; |
701 | case Qtopia::Title: | 701 | case Qtopia::Title: |
702 | item.value = entry.title(); | 702 | item.value = entry.title(); |
703 | break; | 703 | break; |
704 | case Qtopia::Suffix: | 704 | case Qtopia::Suffix: |
705 | item.value = entry.suffix(); | 705 | item.value = entry.suffix(); |
706 | break; | 706 | break; |
707 | case Qtopia::FileAs: | 707 | case Qtopia::FileAs: |
708 | item.value = entry.fileAs(); | 708 | item.value = entry.fileAs(); |
709 | break; | 709 | break; |
710 | case Qtopia::DefaultEmail: | 710 | case Qtopia::DefaultEmail: |
711 | item.value = entry.defaultEmail(); | 711 | item.value = entry.defaultEmail(); |
712 | if ( !item.value.isEmpty() ) | 712 | if ( !item.value.isEmpty() ) |
713 | item.icon = Resource::loadPixmap( "addressbook/email" ); | 713 | item.icon = Resource::loadPixmap( "addressbook/email" ); |
714 | break; | 714 | break; |
715 | case Qtopia::Emails: | 715 | case Qtopia::Emails: |
716 | item.value = entry.emails(); | 716 | item.value = entry.emails(); |
717 | if ( !item.value.isEmpty() ) | 717 | if ( !item.value.isEmpty() ) |
718 | item.icon = Resource::loadPixmap( "addressbook/email" ); | 718 | item.icon = Resource::loadPixmap( "addressbook/email" ); |
719 | break; | 719 | break; |
720 | case Qtopia::HomeStreet: | 720 | case Qtopia::HomeStreet: |
721 | item.value = entry.homeStreet(); | 721 | item.value = entry.homeStreet(); |
722 | break; | 722 | break; |
723 | case Qtopia::HomeCity: | 723 | case Qtopia::HomeCity: |
724 | item.value = entry.homeCity(); | 724 | item.value = entry.homeCity(); |
725 | break; | 725 | break; |
726 | case Qtopia::HomeState: | 726 | case Qtopia::HomeState: |
727 | item.value = entry.homeState(); | 727 | item.value = entry.homeState(); |
728 | break; | 728 | break; |
729 | case Qtopia::HomeZip: | 729 | case Qtopia::HomeZip: |
730 | item.value = entry.homeZip(); | 730 | item.value = entry.homeZip(); |
731 | break; | 731 | break; |
732 | case Qtopia::HomeCountry: | 732 | case Qtopia::HomeCountry: |
733 | item.value = entry.homeCountry(); | 733 | item.value = entry.homeCountry(); |
734 | break; | 734 | break; |
735 | case Qtopia::HomePhone: | 735 | case Qtopia::HomePhone: |
736 | item.value = entry.homePhone(); | 736 | item.value = entry.homePhone(); |
737 | if ( !item.value.isEmpty() ) | 737 | if ( !item.value.isEmpty() ) |
738 | item.icon = Resource::loadPixmap( "addressbook/phonehome" ); | 738 | item.icon = Resource::loadPixmap( "addressbook/phonehome" ); |
739 | break; | 739 | break; |
740 | case Qtopia::HomeFax: | 740 | case Qtopia::HomeFax: |
741 | item.value = entry.homeFax(); | 741 | item.value = entry.homeFax(); |
742 | if ( !item.value.isEmpty() ) | 742 | if ( !item.value.isEmpty() ) |
743 | item.icon = Resource::loadPixmap( "addressbook/faxhome" ); | 743 | item.icon = Resource::loadPixmap( "addressbook/faxhome" ); |
744 | break; | 744 | break; |
745 | case Qtopia::HomeMobile: | 745 | case Qtopia::HomeMobile: |
746 | item.value = entry.homeMobile(); | 746 | item.value = entry.homeMobile(); |
747 | if ( !item.value.isEmpty() ) | 747 | if ( !item.value.isEmpty() ) |
748 | item.icon = Resource::loadPixmap( "addressbook/mobilehome" ); | 748 | item.icon = Resource::loadPixmap( "addressbook/mobilehome" ); |
749 | break; | 749 | break; |
750 | case Qtopia::HomeWebPage: | 750 | case Qtopia::HomeWebPage: |
751 | item.value = entry.homeWebpage(); | 751 | item.value = entry.homeWebpage(); |
752 | if ( !item.value.isEmpty() ) | 752 | if ( !item.value.isEmpty() ) |
753 | item.icon = Resource::loadPixmap( "addressbook/webpagehome" ); | 753 | item.icon = Resource::loadPixmap( "addressbook/webpagehome" ); |
754 | break; | 754 | break; |
755 | case Qtopia::Company: | 755 | case Qtopia::Company: |
756 | item.value = entry.company(); | 756 | item.value = entry.company(); |
757 | break; | 757 | break; |
758 | case Qtopia::BusinessCity: | 758 | case Qtopia::BusinessCity: |
759 | item.value = entry.businessCity(); | 759 | item.value = entry.businessCity(); |
760 | break; | 760 | break; |
761 | case Qtopia::BusinessStreet: | 761 | case Qtopia::BusinessStreet: |
762 | item.value = entry.businessStreet(); | 762 | item.value = entry.businessStreet(); |
763 | break; | 763 | break; |
764 | case Qtopia::BusinessZip: | 764 | case Qtopia::BusinessZip: |
765 | item.value = entry.businessZip(); | 765 | item.value = entry.businessZip(); |
766 | break; | 766 | break; |
767 | case Qtopia::BusinessCountry: | 767 | case Qtopia::BusinessCountry: |
768 | item.value = entry.businessCountry(); | 768 | item.value = entry.businessCountry(); |
769 | break; | 769 | break; |
770 | case Qtopia::BusinessWebPage: | 770 | case Qtopia::BusinessWebPage: |
771 | item.value = entry.businessWebpage(); | 771 | item.value = entry.businessWebpage(); |
772 | if ( !item.value.isEmpty() ) | 772 | if ( !item.value.isEmpty() ) |
773 | item.icon = Resource::loadPixmap( "addressbook/webpagework" ); | 773 | item.icon = Resource::loadPixmap( "addressbook/webpagework" ); |
774 | break; | 774 | break; |
775 | case Qtopia::JobTitle: | 775 | case Qtopia::JobTitle: |
776 | item.value = entry.jobTitle(); | 776 | item.value = entry.jobTitle(); |
777 | break; | 777 | break; |
778 | case Qtopia::Department: | 778 | case Qtopia::Department: |
779 | item.value = entry.department(); | 779 | item.value = entry.department(); |
780 | break; | 780 | break; |
781 | case Qtopia::Office: | 781 | case Qtopia::Office: |
782 | item.value = entry.office(); | 782 | item.value = entry.office(); |
783 | break; | 783 | break; |
784 | case Qtopia::BusinessPhone: | 784 | case Qtopia::BusinessPhone: |
785 | item.value = entry.businessPhone(); | 785 | item.value = entry.businessPhone(); |
786 | if ( !item.value.isEmpty() ) | 786 | if ( !item.value.isEmpty() ) |
787 | item.icon = Resource::loadPixmap( "addressbook/phonework" ); | 787 | item.icon = Resource::loadPixmap( "addressbook/phonework" ); |
788 | break; | 788 | break; |
789 | case Qtopia::BusinessFax: | 789 | case Qtopia::BusinessFax: |
790 | item.value = entry.businessFax(); | 790 | item.value = entry.businessFax(); |
791 | if ( !item.value.isEmpty() ) | 791 | if ( !item.value.isEmpty() ) |
792 | item.icon = Resource::loadPixmap( "addressbook/faxwork" ); | 792 | item.icon = Resource::loadPixmap( "addressbook/faxwork" ); |
793 | break; | 793 | break; |
794 | case Qtopia::BusinessMobile: | 794 | case Qtopia::BusinessMobile: |
795 | item.value = entry.businessMobile(); | 795 | item.value = entry.businessMobile(); |
796 | if ( !item.value.isEmpty() ) | 796 | if ( !item.value.isEmpty() ) |
797 | item.icon = Resource::loadPixmap( "addressbook/mobilework" ); | 797 | item.icon = Resource::loadPixmap( "addressbook/mobilework" ); |
798 | break; | 798 | break; |
799 | case Qtopia::BusinessPager: | 799 | case Qtopia::BusinessPager: |
800 | item.value = entry.businessPager(); | 800 | item.value = entry.businessPager(); |
801 | break; | 801 | break; |
802 | case Qtopia::Profession: | 802 | case Qtopia::Profession: |
803 | item.value = entry.profession(); | 803 | item.value = entry.profession(); |
804 | break; | 804 | break; |
805 | case Qtopia::Assistant: | 805 | case Qtopia::Assistant: |
806 | item.value = entry.assistant(); | 806 | item.value = entry.assistant(); |
807 | break; | 807 | break; |
808 | case Qtopia::Manager: | 808 | case Qtopia::Manager: |
809 | item.value = entry.manager(); | 809 | item.value = entry.manager(); |
810 | break; | 810 | break; |
811 | case Qtopia::Spouse: | 811 | case Qtopia::Spouse: |
812 | item.value = entry.spouse(); | 812 | item.value = entry.spouse(); |
813 | break; | 813 | break; |
814 | case Qtopia::Gender: | 814 | case Qtopia::Gender: |
815 | item.value = entry.gender(); | 815 | item.value = entry.gender(); |
816 | break; | 816 | break; |
817 | case Qtopia::Birthday: | 817 | case Qtopia::Birthday: |
818 | if ( ! entry.birthday().isNull() ){ | 818 | if ( ! entry.birthday().isNull() ){ |
819 | item.value = TimeString::numberDateString( entry.birthday() ); | 819 | item.value = TimeString::numberDateString( entry.birthday() ); |
820 | } | 820 | } |
821 | break; | 821 | break; |
822 | case Qtopia::Anniversary: | 822 | case Qtopia::Anniversary: |
823 | if ( ! entry.anniversary().isNull() ){ | 823 | if ( ! entry.anniversary().isNull() ){ |
824 | item.value = TimeString::numberDateString( entry.anniversary() ); | 824 | item.value = TimeString::numberDateString( entry.anniversary() ); |
825 | } | 825 | } |
826 | break; | 826 | break; |
827 | case Qtopia::Nickname: | 827 | case Qtopia::Nickname: |
828 | item.value = entry.nickname(); | 828 | item.value = entry.nickname(); |
829 | break; | 829 | break; |
830 | case Qtopia::Children: | 830 | case Qtopia::Children: |
831 | item.value = entry.children(); | 831 | item.value = entry.children(); |
832 | break; | 832 | break; |
833 | case Qtopia::Notes: | 833 | case Qtopia::Notes: |
834 | item.value = entry.notes(); | 834 | item.value = entry.notes(); |
835 | break; | 835 | break; |
836 | } | 836 | } |
837 | if ( !item.value.isEmpty() ) | 837 | if ( !item.value.isEmpty() ) |
838 | break; | 838 | break; |
839 | } | 839 | } |
840 | return item; | 840 | return item; |
841 | } | 841 | } |
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index 7a5b6d4..7abb45c 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp | |||
@@ -1,509 +1,509 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) | 2 | ** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) |
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 | ** | 14 | ** |
15 | **********************************************************************/ | 15 | **********************************************************************/ |
16 | 16 | ||
17 | #include "abview.h" | 17 | #include "abview.h" |
18 | 18 | ||
19 | #include <opie2/ocontactaccessbackend_vcard.h> | 19 | #include <opie2/ocontactaccessbackend_vcard.h> |
20 | #include <opie2/odebug.h> | 20 | #include <opie2/odebug.h> |
21 | 21 | ||
22 | #include <qpe/global.h> | 22 | #include <qpe/global.h> |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | 25 | ||
26 | #include <assert.h> | 26 | #include <assert.h> |
27 | 27 | ||
28 | 28 | ||
29 | // Is defined in LibQPE | 29 | // Is defined in LibQPE |
30 | extern QString categoryFileName(); | 30 | extern QString categoryFileName(); |
31 | 31 | ||
32 | QString addressbookPersonalVCardName() | 32 | QString addressbookPersonalVCardName() |
33 | { | 33 | { |
34 | QString filename = Global::applicationFileName("addressbook", | 34 | QString filename = Global::applicationFileName("addressbook", |
35 | "businesscard.vcf"); | 35 | "businesscard.vcf"); |
36 | return filename; | 36 | return filename; |
37 | } | 37 | } |
38 | 38 | ||
39 | 39 | ||
40 | AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): | 40 | AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): |
41 | QWidget(parent), | 41 | QWidget(parent), |
42 | mCat(0), | 42 | mCat(0), |
43 | m_inSearch( false ), | 43 | m_inSearch( false ), |
44 | m_inPersonal( false ), | 44 | m_inPersonal( false ), |
45 | m_curr_category( -1 ), | 45 | m_curr_category( -1 ), |
46 | m_curr_View( TableView ), | 46 | m_curr_View( TableView ), |
47 | m_prev_View( TableView ), | 47 | m_prev_View( TableView ), |
48 | m_curr_Contact ( 0 ), | 48 | m_curr_Contact ( 0 ), |
49 | m_contactdb ( 0l ), | 49 | m_contactdb ( 0l ), |
50 | m_storedDB ( 0l ), | 50 | m_storedDB ( 0l ), |
51 | m_viewStack( 0l ), | 51 | m_viewStack( 0l ), |
52 | m_abTable( 0l ), | 52 | m_abTable( 0l ), |
53 | m_orderedFields( ordered ) | 53 | m_orderedFields( ordered ) |
54 | { | 54 | { |
55 | owarn << "AbView::c'tor" << oendl; | 55 | odebug << "AbView::c'tor" << oendl; |
56 | // Load default database and handle syncing myself.. ! | 56 | // Load default database and handle syncing myself.. ! |
57 | m_contactdb = new Opie::OPimContactAccess ( "addressbook", 0l, 0l, false ); | 57 | m_contactdb = new Opie::OPimContactAccess ( "addressbook", 0l, 0l, false ); |
58 | m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available | 58 | m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available |
59 | mCat.load( categoryFileName() ); | 59 | mCat.load( categoryFileName() ); |
60 | 60 | ||
61 | // Create Layout and put WidgetStack into it. | 61 | // Create Layout and put WidgetStack into it. |
62 | QVBoxLayout *vb = new QVBoxLayout( this ); | 62 | QVBoxLayout *vb = new QVBoxLayout( this ); |
63 | m_viewStack = new QWidgetStack( this ); | 63 | m_viewStack = new QWidgetStack( this ); |
64 | vb->addWidget( m_viewStack ); | 64 | vb->addWidget( m_viewStack ); |
65 | 65 | ||
66 | // Creat TableView | 66 | // Creat TableView |
67 | QVBox* tableBox = new QVBox( m_viewStack ); | 67 | QVBox* tableBox = new QVBox( m_viewStack ); |
68 | m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); | 68 | m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); |
69 | m_abTable->setCurrentCell( 0, 0 ); | 69 | m_abTable->setCurrentCell( 0, 0 ); |
70 | m_abTable->setFocus(); | 70 | m_abTable->setFocus(); |
71 | 71 | ||
72 | // Add TableView to WidgetStack and raise it | 72 | // Add TableView to WidgetStack and raise it |
73 | m_viewStack -> addWidget( tableBox , TableView ); | 73 | m_viewStack -> addWidget( tableBox , TableView ); |
74 | 74 | ||
75 | // Create CardView and add it to WidgetStack | 75 | // Create CardView and add it to WidgetStack |
76 | QVBox* cardBox = new QVBox( m_viewStack ); | 76 | QVBox* cardBox = new QVBox( m_viewStack ); |
77 | m_ablabel = new AbLabel( cardBox, "CardView"); | 77 | m_ablabel = new AbLabel( cardBox, "CardView"); |
78 | m_viewStack -> addWidget( cardBox , CardView ); | 78 | m_viewStack -> addWidget( cardBox , CardView ); |
79 | 79 | ||
80 | // Connect views to me | 80 | // Connect views to me |
81 | connect ( m_abTable, SIGNAL( signalSwitch(void) ), | 81 | connect ( m_abTable, SIGNAL( signalSwitch(void) ), |
82 | this, SLOT( slotSwitch(void) ) ); | 82 | this, SLOT( slotSwitch(void) ) ); |
83 | connect ( m_ablabel, SIGNAL( signalOkPressed(void) ), | 83 | connect ( m_ablabel, SIGNAL( signalOkPressed(void) ), |
84 | this, SLOT( slotSwitch(void) ) ); | 84 | this, SLOT( slotSwitch(void) ) ); |
85 | 85 | ||
86 | load(); | 86 | load(); |
87 | } | 87 | } |
88 | 88 | ||
89 | AbView::~AbView() | 89 | AbView::~AbView() |
90 | { | 90 | { |
91 | m_contactdb -> save(); | 91 | m_contactdb -> save(); |
92 | delete m_contactdb; | 92 | delete m_contactdb; |
93 | 93 | ||
94 | if ( m_storedDB ){ | 94 | if ( m_storedDB ){ |
95 | m_storedDB -> save(); | 95 | m_storedDB -> save(); |
96 | delete m_storedDB; | 96 | delete m_storedDB; |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | 100 | ||
101 | void AbView::setView( Views view ) | 101 | void AbView::setView( Views view ) |
102 | { | 102 | { |
103 | owarn << "AbView::setView( Views view )" << oendl; | 103 | odebug << "AbView::setView( Views view )" << oendl; |
104 | m_curr_View = view; | 104 | m_curr_View = view; |
105 | load(); | 105 | load(); |
106 | } | 106 | } |
107 | 107 | ||
108 | void AbView::addEntry( const Opie::OPimContact &newContact ) | 108 | void AbView::addEntry( const Opie::OPimContact &newContact ) |
109 | { | 109 | { |
110 | owarn << "AbView::AddContact" << oendl; | 110 | odebug << "AbView::AddContact" << oendl; |
111 | m_contactdb->add ( newContact ); | 111 | m_contactdb->add ( newContact ); |
112 | load(); | 112 | load(); |
113 | 113 | ||
114 | } | 114 | } |
115 | void AbView::removeEntry( const int UID ) | 115 | void AbView::removeEntry( const int UID ) |
116 | { | 116 | { |
117 | owarn << "AbView;:RemoveContact" << oendl; | 117 | odebug << "AbView;:RemoveContact" << oendl; |
118 | m_contactdb->remove( UID ); | 118 | m_contactdb->remove( UID ); |
119 | load(); | 119 | load(); |
120 | } | 120 | } |
121 | 121 | ||
122 | void AbView::replaceEntry( const Opie::OPimContact &contact ) | 122 | void AbView::replaceEntry( const Opie::OPimContact &contact ) |
123 | { | 123 | { |
124 | owarn << "AbView::ReplaceContact" << oendl; | 124 | odebug << "AbView::ReplaceContact" << oendl; |
125 | m_contactdb->replace( contact ); | 125 | m_contactdb->replace( contact ); |
126 | load(); | 126 | load(); |
127 | 127 | ||
128 | } | 128 | } |
129 | 129 | ||
130 | Opie::OPimContact AbView::currentEntry() | 130 | Opie::OPimContact AbView::currentEntry() |
131 | { | 131 | { |
132 | Opie::OPimContact currentContact; | 132 | Opie::OPimContact currentContact; |
133 | 133 | ||
134 | switch ( (int) m_curr_View ) { | 134 | switch ( (int) m_curr_View ) { |
135 | case TableView: | 135 | case TableView: |
136 | currentContact = m_abTable -> currentEntry(); | 136 | currentContact = m_abTable -> currentEntry(); |
137 | break; | 137 | break; |
138 | case CardView: | 138 | case CardView: |
139 | currentContact = m_ablabel -> currentEntry(); | 139 | currentContact = m_ablabel -> currentEntry(); |
140 | break; | 140 | break; |
141 | } | 141 | } |
142 | m_curr_Contact = currentContact.uid(); | 142 | m_curr_Contact = currentContact.uid(); |
143 | return currentContact; | 143 | return currentContact; |
144 | } | 144 | } |
145 | 145 | ||
146 | bool AbView::save() | 146 | bool AbView::save() |
147 | { | 147 | { |
148 | //owarn << "AbView::Save data" << oendl; | 148 | //odebug << "AbView::Save data" << oendl; |
149 | 149 | ||
150 | return m_contactdb->save(); | 150 | return m_contactdb->save(); |
151 | } | 151 | } |
152 | 152 | ||
153 | void AbView::load() | 153 | void AbView::load() |
154 | { | 154 | { |
155 | owarn << "AbView::Load data" << oendl; | 155 | odebug << "AbView::Load data" << oendl; |
156 | 156 | ||
157 | // Letter Search is stopped at this place | 157 | // Letter Search is stopped at this place |
158 | emit signalClearLetterPicker(); | 158 | emit signalClearLetterPicker(); |
159 | 159 | ||
160 | if ( m_inPersonal ) | 160 | if ( m_inPersonal ) |
161 | // VCard Backend does not sort.. | 161 | // VCard Backend does not sort.. |
162 | m_list = m_contactdb->allRecords(); | 162 | m_list = m_contactdb->allRecords(); |
163 | else{ | 163 | else{ |
164 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); | 164 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); |
165 | if ( m_curr_category != -1 ) | 165 | if ( m_curr_category != -1 ) |
166 | clearForCategory(); | 166 | clearForCategory(); |
167 | } | 167 | } |
168 | 168 | ||
169 | owarn << "Number of contacts: " << m_list.count() << oendl; | 169 | odebug << "Number of contacts: " << m_list.count() << oendl; |
170 | 170 | ||
171 | updateView( true ); | 171 | updateView( true ); |
172 | 172 | ||
173 | } | 173 | } |
174 | 174 | ||
175 | void AbView::reload() | 175 | void AbView::reload() |
176 | { | 176 | { |
177 | owarn << "AbView::::reload()" << oendl; | 177 | odebug << "AbView::::reload()" << oendl; |
178 | 178 | ||
179 | m_contactdb->reload(); | 179 | m_contactdb->reload(); |
180 | load(); | 180 | load(); |
181 | } | 181 | } |
182 | 182 | ||
183 | void AbView::clear() | 183 | void AbView::clear() |
184 | { | 184 | { |
185 | // :SX | 185 | // :SX |
186 | } | 186 | } |
187 | 187 | ||
188 | void AbView::setShowByCategory( const QString& cat ) | 188 | void AbView::setShowByCategory( const QString& cat ) |
189 | { | 189 | { |
190 | owarn << "AbView::setShowCategory( const QString& cat )" << oendl; | 190 | odebug << "AbView::setShowCategory( const QString& cat )" << oendl; |
191 | 191 | ||
192 | int intCat = 0; | 192 | int intCat = 0; |
193 | 193 | ||
194 | // All (cat == NULL) will be stored as -1 | 194 | // All (cat == NULL) will be stored as -1 |
195 | if ( cat.isNull() ) | 195 | if ( cat.isNull() ) |
196 | intCat = -1; | 196 | intCat = -1; |
197 | else | 197 | else |
198 | intCat = mCat.id("Contacts", cat ); | 198 | intCat = mCat.id("Contacts", cat ); |
199 | 199 | ||
200 | // Just do anything if we really change the category | 200 | // Just do anything if we really change the category |
201 | if ( intCat != m_curr_category ){ | 201 | if ( intCat != m_curr_category ){ |
202 | // owarn << "Categories: Selected " << cat << ".. Number: " | 202 | // odebug << "Categories: Selected " << cat << ".. Number: " |
203 | // << m_curr_category << oendl; | 203 | // << m_curr_category << oendl; |
204 | 204 | ||
205 | m_curr_category = intCat; | 205 | m_curr_category = intCat; |
206 | emit signalClearLetterPicker(); | 206 | emit signalClearLetterPicker(); |
207 | 207 | ||
208 | load(); | 208 | load(); |
209 | } | 209 | } |
210 | 210 | ||
211 | } | 211 | } |
212 | 212 | ||
213 | void AbView::setShowToView( Views view ) | 213 | void AbView::setShowToView( Views view ) |
214 | { | 214 | { |
215 | owarn << "void AbView::setShowToView( View " << view << " )" << oendl; | 215 | odebug << "void AbView::setShowToView( View " << view << " )" << oendl; |
216 | 216 | ||
217 | if ( m_curr_View != view ){ | 217 | if ( m_curr_View != view ){ |
218 | owarn << "Change the View (Category is: " << m_curr_category << ")" << oendl; | 218 | odebug << "Change the View (Category is: " << m_curr_category << ")" << oendl; |
219 | m_prev_View = m_curr_View; | 219 | m_prev_View = m_curr_View; |
220 | m_curr_View = view; | 220 | m_curr_View = view; |
221 | 221 | ||
222 | updateView(); | 222 | updateView(); |
223 | } | 223 | } |
224 | 224 | ||
225 | } | 225 | } |
226 | 226 | ||
227 | void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) | 227 | void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) |
228 | { | 228 | { |
229 | owarn << "void AbView::setShowByLetter( " << c << ", " << mode << " )" << oendl; | 229 | odebug << "void AbView::setShowByLetter( " << c << ", " << mode << " )" << oendl; |
230 | 230 | ||
231 | assert( mode < AbConfig::LASTELEMENT ); | 231 | assert( mode < AbConfig::LASTELEMENT ); |
232 | 232 | ||
233 | Opie::OPimContact query; | 233 | Opie::OPimContact query; |
234 | if ( c == 0 ){ | 234 | if ( c == 0 ){ |
235 | load(); | 235 | load(); |
236 | return; | 236 | return; |
237 | }else{ | 237 | }else{ |
238 | // If the current Backend is unable to solve the query, we will | 238 | // If the current Backend is unable to solve the query, we will |
239 | // ignore the request .. | 239 | // ignore the request .. |
240 | if ( ! m_contactdb->hasQuerySettings( Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ) ){ | 240 | if ( ! m_contactdb->hasQuerySettings( Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ) ){ |
241 | return; | 241 | return; |
242 | } | 242 | } |
243 | 243 | ||
244 | switch( mode ){ | 244 | switch( mode ){ |
245 | case AbConfig::LastName: | 245 | case AbConfig::LastName: |
246 | query.setLastName( QString("%1*").arg(c) ); | 246 | query.setLastName( QString("%1*").arg(c) ); |
247 | break; | 247 | break; |
248 | case AbConfig::FileAs: | 248 | case AbConfig::FileAs: |
249 | query.setFileAs( QString("%1*").arg(c) ); | 249 | query.setFileAs( QString("%1*").arg(c) ); |
250 | break; | 250 | break; |
251 | default: | 251 | default: |
252 | owarn << "Unknown Searchmode for AbView::setShowByLetter ! -> " << mode << oendl | 252 | owarn << "Unknown Searchmode for AbView::setShowByLetter ! -> " << mode << oendl |
253 | << "I will ignore it.." << oendl; | 253 | << "I will ignore it.." << oendl; |
254 | return; | 254 | return; |
255 | } | 255 | } |
256 | m_list = m_contactdb->queryByExample( query, Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ); | 256 | m_list = m_contactdb->queryByExample( query, Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ); |
257 | if ( m_curr_category != -1 ) | 257 | if ( m_curr_category != -1 ) |
258 | clearForCategory(); | 258 | clearForCategory(); |
259 | m_curr_Contact = 0; | 259 | m_curr_Contact = 0; |
260 | } | 260 | } |
261 | updateView( true ); | 261 | updateView( true ); |
262 | } | 262 | } |
263 | 263 | ||
264 | void AbView::setListOrder( const QValueList<int>& ordered ) | 264 | void AbView::setListOrder( const QValueList<int>& ordered ) |
265 | { | 265 | { |
266 | m_orderedFields = ordered; | 266 | m_orderedFields = ordered; |
267 | if ( m_abTable ){ | 267 | if ( m_abTable ){ |
268 | m_abTable->setOrderedList( ordered ); | 268 | m_abTable->setOrderedList( ordered ); |
269 | m_abTable->refresh(); | 269 | m_abTable->refresh(); |
270 | } | 270 | } |
271 | updateView(); | 271 | updateView(); |
272 | } | 272 | } |
273 | 273 | ||
274 | 274 | ||
275 | QString AbView::showCategory() const | 275 | QString AbView::showCategory() const |
276 | { | 276 | { |
277 | return mCat.label( "Contacts", m_curr_category ); | 277 | return mCat.label( "Contacts", m_curr_category ); |
278 | } | 278 | } |
279 | 279 | ||
280 | void AbView::showPersonal( bool personal ) | 280 | void AbView::showPersonal( bool personal ) |
281 | { | 281 | { |
282 | owarn << "void AbView::showPersonal( " << personal << " )" << oendl; | 282 | odebug << "void AbView::showPersonal( " << personal << " )" << oendl; |
283 | 283 | ||
284 | if ( personal ){ | 284 | if ( personal ){ |
285 | 285 | ||
286 | if ( m_inPersonal ) | 286 | if ( m_inPersonal ) |
287 | return; | 287 | return; |
288 | 288 | ||
289 | // Now switch to vCard Backend and load data. | 289 | // Now switch to vCard Backend and load data. |
290 | // The current default backend will be stored | 290 | // The current default backend will be stored |
291 | // to avoid unneeded load/stores. | 291 | // to avoid unneeded load/stores. |
292 | m_storedDB = m_contactdb; | 292 | m_storedDB = m_contactdb; |
293 | 293 | ||
294 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 294 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
295 | addressbookPersonalVCardName() ); | 295 | addressbookPersonalVCardName() ); |
296 | m_contactdb = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 296 | m_contactdb = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
297 | 297 | ||
298 | m_inPersonal = true; | 298 | m_inPersonal = true; |
299 | m_curr_View = CardView; | 299 | m_curr_View = CardView; |
300 | 300 | ||
301 | }else{ | 301 | }else{ |
302 | 302 | ||
303 | if ( !m_inPersonal ) | 303 | if ( !m_inPersonal ) |
304 | return; | 304 | return; |
305 | 305 | ||
306 | // Remove vCard Backend and restore default | 306 | // Remove vCard Backend and restore default |
307 | m_contactdb->save(); | 307 | m_contactdb->save(); |
308 | delete m_contactdb; | 308 | delete m_contactdb; |
309 | 309 | ||
310 | m_contactdb = m_storedDB; | 310 | m_contactdb = m_storedDB; |
311 | m_storedDB = 0l; | 311 | m_storedDB = 0l; |
312 | 312 | ||
313 | m_curr_View = TableView; | 313 | m_curr_View = TableView; |
314 | m_inPersonal = false; | 314 | m_inPersonal = false; |
315 | 315 | ||
316 | } | 316 | } |
317 | load(); | 317 | load(); |
318 | } | 318 | } |
319 | 319 | ||
320 | void AbView::setCurrentUid( int uid ){ | 320 | void AbView::setCurrentUid( int uid ){ |
321 | 321 | ||
322 | m_curr_Contact = uid; | 322 | m_curr_Contact = uid; |
323 | updateView( true ); //true: Don't modificate the UID ! | 323 | updateView( true ); //true: Don't modificate the UID ! |
324 | } | 324 | } |
325 | 325 | ||
326 | 326 | ||
327 | QStringList AbView::categories() | 327 | QStringList AbView::categories() |
328 | { | 328 | { |
329 | mCat.load( categoryFileName() ); | 329 | mCat.load( categoryFileName() ); |
330 | QStringList categoryList = mCat.labels( "Contacts" ); | 330 | QStringList categoryList = mCat.labels( "Contacts" ); |
331 | return categoryList; | 331 | return categoryList; |
332 | } | 332 | } |
333 | 333 | ||
334 | // BEGIN: Slots | 334 | // BEGIN: Slots |
335 | void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | 335 | void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, |
336 | bool , QString cat ) | 336 | bool , QString cat ) |
337 | { | 337 | { |
338 | //owarn << "void AbView::slotDoFind" << oendl; | 338 | //owarn << "void AbView::slotDoFind" << oendl; |
339 | 339 | ||
340 | // We reloading the data: Deselect Letterpicker | 340 | // We reloading the data: Deselect Letterpicker |
341 | emit signalClearLetterPicker(); | 341 | emit signalClearLetterPicker(); |
342 | 342 | ||
343 | // Use the current Category if nothing else selected | 343 | // Use the current Category if nothing else selected |
344 | int category = 0; | 344 | int category = 0; |
345 | 345 | ||
346 | if ( cat.isEmpty() ) | 346 | if ( cat.isEmpty() ) |
347 | category = m_curr_category; | 347 | category = m_curr_category; |
348 | else{ | 348 | else{ |
349 | category = mCat.id("Contacts", cat ); | 349 | category = mCat.id("Contacts", cat ); |
350 | } | 350 | } |
351 | 351 | ||
352 | //owarn << "Find in Category " << category << oendl; | 352 | //odebug << "Find in Category " << category << oendl; |
353 | 353 | ||
354 | QRegExp r( str ); | 354 | QRegExp r( str ); |
355 | r.setCaseSensitive( caseSensitive ); | 355 | r.setCaseSensitive( caseSensitive ); |
356 | r.setWildcard( !useRegExp ); | 356 | r.setWildcard( !useRegExp ); |
357 | 357 | ||
358 | // Get all matching entries out of the database | 358 | // Get all matching entries out of the database |
359 | m_list = m_contactdb->matchRegexp( r ); | 359 | m_list = m_contactdb->matchRegexp( r ); |
360 | 360 | ||
361 | //owarn << "Found: " << m_list.count() << oendl; | 361 | //odebug << "Found: " << m_list.count() << oendl; |
362 | if ( m_list.count() == 0 ){ | 362 | if ( m_list.count() == 0 ){ |
363 | emit signalNotFound(); | 363 | emit signalNotFound(); |
364 | return; | 364 | return; |
365 | } | 365 | } |
366 | 366 | ||
367 | // Now remove all contacts with wrong category (if any selected) | 367 | // Now remove all contacts with wrong category (if any selected) |
368 | // This algorithm is a litte bit ineffective, but | 368 | // This algorithm is a litte bit ineffective, but |
369 | // we will not have a lot of matching entries.. | 369 | // we will not have a lot of matching entries.. |
370 | if ( m_curr_category != -1 ) | 370 | if ( m_curr_category != -1 ) |
371 | clearForCategory(); | 371 | clearForCategory(); |
372 | 372 | ||
373 | // Now show all found entries | 373 | // Now show all found entries |
374 | updateView( true ); | 374 | updateView( true ); |
375 | } | 375 | } |
376 | 376 | ||
377 | void AbView::offSearch() | 377 | void AbView::offSearch() |
378 | { | 378 | { |
379 | m_inSearch = false; | 379 | m_inSearch = false; |
380 | 380 | ||
381 | load(); | 381 | load(); |
382 | } | 382 | } |
383 | 383 | ||
384 | void AbView::slotSwitch(){ | 384 | void AbView::slotSwitch(){ |
385 | //owarn << "AbView::slotSwitch()" << oendl; | 385 | //odebug << "AbView::slotSwitch()" << oendl; |
386 | 386 | ||
387 | m_prev_View = m_curr_View; | 387 | m_prev_View = m_curr_View; |
388 | switch ( (int) m_curr_View ){ | 388 | switch ( (int) m_curr_View ){ |
389 | case TableView: | 389 | case TableView: |
390 | owarn << "Switching to CardView" << oendl; | 390 | odebug << "Switching to CardView" << oendl; |
391 | m_curr_View = CardView; | 391 | m_curr_View = CardView; |
392 | break; | 392 | break; |
393 | case CardView: | 393 | case CardView: |
394 | owarn << "Switching to TableView" << oendl; | 394 | odebug << "Switching to TableView" << oendl; |
395 | m_curr_View = TableView; | 395 | m_curr_View = TableView; |
396 | break; | 396 | break; |
397 | } | 397 | } |
398 | updateView(); | 398 | updateView(); |
399 | 399 | ||
400 | } | 400 | } |
401 | 401 | ||
402 | // END: Slots | 402 | // END: Slots |
403 | 403 | ||
404 | void AbView::clearForCategory() | 404 | void AbView::clearForCategory() |
405 | { | 405 | { |
406 | Opie::OPimContactAccess::List::Iterator it; | 406 | Opie::OPimContactAccess::List::Iterator it; |
407 | // Now remove all contacts with wrong category if any category selected | 407 | // Now remove all contacts with wrong category if any category selected |
408 | 408 | ||
409 | Opie::OPimContactAccess::List allList = m_list; | 409 | Opie::OPimContactAccess::List allList = m_list; |
410 | if ( m_curr_category != -1 ){ | 410 | if ( m_curr_category != -1 ){ |
411 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 411 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
412 | if ( !contactCompare( *it, m_curr_category ) ){ | 412 | if ( !contactCompare( *it, m_curr_category ) ){ |
413 | //owarn << "Removing " << (*it).uid() << oendl; | 413 | //odebug << "Removing " << (*it).uid() << oendl; |
414 | m_list.remove( (*it).uid() ); | 414 | m_list.remove( (*it).uid() ); |
415 | } | 415 | } |
416 | } | 416 | } |
417 | } | 417 | } |
418 | 418 | ||
419 | } | 419 | } |
420 | 420 | ||
421 | bool AbView::contactCompare( const Opie::OPimContact &cnt, int category ) | 421 | bool AbView::contactCompare( const Opie::OPimContact &cnt, int category ) |
422 | { | 422 | { |
423 | //owarn << "bool AbView::contactCompare( const Opie::OPimContact &cnt, " | 423 | //odebug << "bool AbView::contactCompare( const Opie::OPimContact &cnt, " |
424 | // << category << " )" << oendl; | 424 | // << category << " )" << oendl; |
425 | 425 | ||
426 | bool returnMe; | 426 | bool returnMe; |
427 | QArray<int> cats; | 427 | QArray<int> cats; |
428 | cats = cnt.categories(); | 428 | cats = cnt.categories(); |
429 | 429 | ||
430 | //owarn << "Number of categories: " << cats.count() << oendl; | 430 | //odebug << "Number of categories: " << cats.count() << oendl; |
431 | 431 | ||
432 | returnMe = false; | 432 | returnMe = false; |
433 | if ( cats.count() == 0 && category == 0 ) | 433 | if ( cats.count() == 0 && category == 0 ) |
434 | // Contacts with no category will just shown on "All" and "Unfiled" | 434 | // Contacts with no category will just shown on "All" and "Unfiled" |
435 | returnMe = true; | 435 | returnMe = true; |
436 | else { | 436 | else { |
437 | int i; | 437 | int i; |
438 | for ( i = 0; i < int(cats.count()); i++ ) { | 438 | for ( i = 0; i < int(cats.count()); i++ ) { |
439 | //owarn << "Comparing " << cats[i] << " with " << category << oendl; | 439 | //odebug << "Comparing " << cats[i] << " with " << category << oendl; |
440 | if ( cats[i] == category ) { | 440 | if ( cats[i] == category ) { |
441 | returnMe = true; | 441 | returnMe = true; |
442 | break; | 442 | break; |
443 | } | 443 | } |
444 | } | 444 | } |
445 | } | 445 | } |
446 | //owarn << "Return: " << returnMe << oendl; | 446 | //odebug << "Return: " << returnMe << oendl; |
447 | return returnMe; | 447 | return returnMe; |
448 | } | 448 | } |
449 | 449 | ||
450 | // In Some rare cases we have to update all lists.. | 450 | // In Some rare cases we have to update all lists.. |
451 | void AbView::updateListinViews() | 451 | void AbView::updateListinViews() |
452 | { | 452 | { |
453 | m_abTable -> setContacts( m_list ); | 453 | m_abTable -> setContacts( m_list ); |
454 | m_ablabel -> setContacts( m_list ); | 454 | m_ablabel -> setContacts( m_list ); |
455 | } | 455 | } |
456 | 456 | ||
457 | void AbView::updateView( bool newdata ) | 457 | void AbView::updateView( bool newdata ) |
458 | { | 458 | { |
459 | //owarn << "AbView::updateView()" << oendl; | 459 | //odebug << "AbView::updateView()" << oendl; |
460 | 460 | ||
461 | if ( m_viewStack -> visibleWidget() ){ | 461 | if ( m_viewStack -> visibleWidget() ){ |
462 | m_viewStack -> visibleWidget() -> clearFocus(); | 462 | m_viewStack -> visibleWidget() -> clearFocus(); |
463 | } | 463 | } |
464 | 464 | ||
465 | // If we switching the view, we have to store some information | 465 | // If we switching the view, we have to store some information |
466 | if ( !newdata ){ | 466 | if ( !newdata ){ |
467 | if ( m_list.count() ){ | 467 | if ( m_list.count() ){ |
468 | switch ( (int) m_prev_View ) { | 468 | switch ( (int) m_prev_View ) { |
469 | case TableView: | 469 | case TableView: |
470 | m_curr_Contact = m_abTable -> currentEntry_UID(); | 470 | m_curr_Contact = m_abTable -> currentEntry_UID(); |
471 | break; | 471 | break; |
472 | case CardView: | 472 | case CardView: |
473 | m_curr_Contact = m_ablabel -> currentEntry_UID(); | 473 | m_curr_Contact = m_ablabel -> currentEntry_UID(); |
474 | break; | 474 | break; |
475 | } | 475 | } |
476 | }else | 476 | }else |
477 | m_curr_Contact = 0; | 477 | m_curr_Contact = 0; |
478 | } | 478 | } |
479 | 479 | ||
480 | // Feed all views with new lists | 480 | // Feed all views with new lists |
481 | if ( newdata ) | 481 | if ( newdata ) |
482 | updateListinViews(); | 482 | updateListinViews(); |
483 | 483 | ||
484 | // Tell the world that the view is changed | 484 | // Tell the world that the view is changed |
485 | if ( m_curr_View != m_prev_View ) | 485 | if ( m_curr_View != m_prev_View ) |
486 | emit signalViewSwitched ( (int) m_curr_View ); | 486 | emit signalViewSwitched ( (int) m_curr_View ); |
487 | 487 | ||
488 | m_prev_View = m_curr_View; | 488 | m_prev_View = m_curr_View; |
489 | 489 | ||
490 | // Switch to new View | 490 | // Switch to new View |
491 | switch ( (int) m_curr_View ) { | 491 | switch ( (int) m_curr_View ) { |
492 | case TableView: | 492 | case TableView: |
493 | m_abTable -> setChoiceSelection( m_orderedFields ); | 493 | m_abTable -> setChoiceSelection( m_orderedFields ); |
494 | if ( m_curr_Contact != 0 ) | 494 | if ( m_curr_Contact != 0 ) |
495 | m_abTable -> selectContact ( m_curr_Contact ); | 495 | m_abTable -> selectContact ( m_curr_Contact ); |
496 | m_abTable -> setFocus(); | 496 | m_abTable -> setFocus(); |
497 | break; | 497 | break; |
498 | case CardView: | 498 | case CardView: |
499 | if ( m_curr_Contact != 0 ) | 499 | if ( m_curr_Contact != 0 ) |
500 | m_ablabel -> selectContact( m_curr_Contact ); | 500 | m_ablabel -> selectContact( m_curr_Contact ); |
501 | m_ablabel -> setFocus(); | 501 | m_ablabel -> setFocus(); |
502 | break; | 502 | break; |
503 | } | 503 | } |
504 | 504 | ||
505 | // Raise the current View | 505 | // Raise the current View |
506 | m_viewStack -> raiseWidget( m_curr_View ); | 506 | m_viewStack -> raiseWidget( m_curr_View ); |
507 | } | 507 | } |
508 | 508 | ||
509 | 509 | ||
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 35d0f41..835038a 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -1,1042 +1,1042 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** Copyright (C) 2003 Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (C) 2003 Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file is part of the Open Palmtop Environment (see www.opie.info). | 5 | ** This file is part of the Open Palmtop Environment (see www.opie.info). |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** | 17 | ** |
18 | **********************************************************************/ | 18 | **********************************************************************/ |
19 | 19 | ||
20 | #define QTOPIA_INTERNAL_FD | 20 | #define QTOPIA_INTERNAL_FD |
21 | 21 | ||
22 | // #include "addresssettings.h" | 22 | // #include "addresssettings.h" |
23 | #include "addressbook.h" | 23 | #include "addressbook.h" |
24 | 24 | ||
25 | #include <opie2/odebug.h> | 25 | #include <opie2/odebug.h> |
26 | #include <opie2/ofileselector.h> | 26 | #include <opie2/ofileselector.h> |
27 | #include <opie2/ofiledialog.h> | 27 | #include <opie2/ofiledialog.h> |
28 | #include <opie2/opimcontact.h> | 28 | #include <opie2/opimcontact.h> |
29 | #include <opie2/ocontactaccessbackend_vcard.h> | 29 | #include <opie2/ocontactaccessbackend_vcard.h> |
30 | 30 | ||
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | #include <qpe/ir.h> | 32 | #include <qpe/ir.h> |
33 | #include <qpe/qpemessagebox.h> | 33 | #include <qpe/qpemessagebox.h> |
34 | #include <qmenubar.h> | 34 | #include <qmenubar.h> |
35 | // #include <qtoolbar.h> | 35 | // #include <qtoolbar.h> |
36 | // #include <qmenubar.h> | 36 | // #include <qmenubar.h> |
37 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | 38 | ||
39 | #include <qaction.h> | 39 | #include <qaction.h> |
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | #include <qmessagebox.h> | 41 | #include <qmessagebox.h> |
42 | #include <qtoolbutton.h> | 42 | #include <qtoolbutton.h> |
43 | 43 | ||
44 | #include <stdlib.h> | 44 | #include <stdlib.h> |
45 | #include <sys/stat.h> | 45 | #include <sys/stat.h> |
46 | #include <sys/types.h> | 46 | #include <sys/types.h> |
47 | #include <fcntl.h> | 47 | #include <fcntl.h> |
48 | #include <unistd.h> | 48 | #include <unistd.h> |
49 | 49 | ||
50 | 50 | ||
51 | #include "picker.h" | 51 | #include "picker.h" |
52 | #include "configdlg.h" | 52 | #include "configdlg.h" |
53 | 53 | ||
54 | extern QString addressbookPersonalVCardName(); | 54 | extern QString addressbookPersonalVCardName(); |
55 | 55 | ||
56 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 56 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
57 | WFlags f ) | 57 | WFlags f ) |
58 | : QMainWindow( parent, name, f ), | 58 | : QMainWindow( parent, name, f ), |
59 | catMenu (0l), | 59 | catMenu (0l), |
60 | abEditor(0l), | 60 | abEditor(0l), |
61 | syncing(FALSE), | 61 | syncing(FALSE), |
62 | m_tableViewButton(0l), | 62 | m_tableViewButton(0l), |
63 | m_cardViewButton(0l) | 63 | m_cardViewButton(0l) |
64 | { | 64 | { |
65 | isLoading = true; | 65 | isLoading = true; |
66 | 66 | ||
67 | m_config.load(); | 67 | m_config.load(); |
68 | 68 | ||
69 | setCaption( tr("Contacts") ); | 69 | setCaption( tr("Contacts") ); |
70 | setIcon( Resource::loadPixmap( "AddressBook" ) ); | 70 | setIcon( Resource::loadPixmap( "AddressBook" ) ); |
71 | 71 | ||
72 | // Settings for Main Menu | 72 | // Settings for Main Menu |
73 | // setToolBarsMovable( false ); | 73 | // setToolBarsMovable( false ); |
74 | setToolBarsMovable( !m_config.fixedBars() ); | 74 | setToolBarsMovable( !m_config.fixedBars() ); |
75 | setRightJustification( true ); | 75 | setRightJustification( true ); |
76 | 76 | ||
77 | QToolBar *bar = new QToolBar( this ); | 77 | QToolBar *bar = new QToolBar( this ); |
78 | bar->setHorizontalStretchable( TRUE ); | 78 | bar->setHorizontalStretchable( TRUE ); |
79 | 79 | ||
80 | QMenuBar *mbList = new QMenuBar( bar ); | 80 | QMenuBar *mbList = new QMenuBar( bar ); |
81 | mbList->setMargin( 0 ); | 81 | mbList->setMargin( 0 ); |
82 | 82 | ||
83 | QPopupMenu *edit = new QPopupMenu( mbList ); | 83 | QPopupMenu *edit = new QPopupMenu( mbList ); |
84 | mbList->insertItem( tr( "Contact" ), edit ); | 84 | mbList->insertItem( tr( "Contact" ), edit ); |
85 | 85 | ||
86 | // Category Menu | 86 | // Category Menu |
87 | catMenu = new QPopupMenu( this ); | 87 | catMenu = new QPopupMenu( this ); |
88 | catMenu->setCheckable( TRUE ); | 88 | catMenu->setCheckable( TRUE ); |
89 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 89 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
90 | mbList->insertItem( tr("View"), catMenu ); | 90 | mbList->insertItem( tr("View"), catMenu ); |
91 | 91 | ||
92 | // Create Toolbar | 92 | // Create Toolbar |
93 | listTools = new QToolBar( this, "list operations" ); | 93 | listTools = new QToolBar( this, "list operations" ); |
94 | listTools->setHorizontalStretchable( true ); | 94 | listTools->setHorizontalStretchable( true ); |
95 | addToolBar( listTools ); | 95 | addToolBar( listTools ); |
96 | moveToolBar( listTools, m_config.getToolBarPos() ); | 96 | moveToolBar( listTools, m_config.getToolBarPos() ); |
97 | 97 | ||
98 | // View Icons | 98 | // View Icons |
99 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/listview" ), | 99 | m_tableViewButton = new QAction( tr( "List" ), Resource::loadPixmap( "addressbook/listview" ), |
100 | QString::null, 0, this, 0 ); | 100 | QString::null, 0, this, 0 ); |
101 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); | 101 | connect( m_tableViewButton, SIGNAL( activated() ), this, SLOT( slotListView() ) ); |
102 | m_tableViewButton->setToggleAction( true ); | 102 | m_tableViewButton->setToggleAction( true ); |
103 | m_tableViewButton->addTo( listTools ); | 103 | m_tableViewButton->addTo( listTools ); |
104 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "addressbook/cardview" ), QString::null, 0, this, 0 ); | 104 | m_cardViewButton = new QAction( tr( "Card" ), Resource::loadPixmap( "addressbook/cardview" ), QString::null, 0, this, 0 ); |
105 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); | 105 | connect( m_cardViewButton, SIGNAL( activated() ), this, SLOT( slotCardView() ) ); |
106 | m_cardViewButton->setToggleAction( true ); | 106 | m_cardViewButton->setToggleAction( true ); |
107 | m_cardViewButton->addTo( listTools ); | 107 | m_cardViewButton->addTo( listTools ); |
108 | 108 | ||
109 | listTools->addSeparator(); | 109 | listTools->addSeparator(); |
110 | 110 | ||
111 | // Other Buttons | 111 | // Other Buttons |
112 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, | 112 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, |
113 | 0, this, 0 ); | 113 | 0, this, 0 ); |
114 | actionNew = a; | 114 | actionNew = a; |
115 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); | 115 | connect( a, SIGNAL( activated() ), this, SLOT( slotListNew() ) ); |
116 | a->addTo( edit ); | 116 | a->addTo( edit ); |
117 | a->addTo( listTools ); | 117 | a->addTo( listTools ); |
118 | 118 | ||
119 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 119 | a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, |
120 | 0, this, 0 ); | 120 | 0, this, 0 ); |
121 | actionEdit = a; | 121 | actionEdit = a; |
122 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); | 122 | connect( a, SIGNAL( activated() ), this, SLOT( slotViewEdit() ) ); |
123 | a->addTo( edit ); | 123 | a->addTo( edit ); |
124 | a->addTo( listTools ); | 124 | a->addTo( listTools ); |
125 | 125 | ||
126 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 126 | a = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
127 | 0, this, 0 ); | 127 | 0, this, 0 ); |
128 | actionTrash = a; | 128 | actionTrash = a; |
129 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); | 129 | connect( a, SIGNAL( activated() ), this, SLOT( slotListDelete() ) ); |
130 | a->addTo( edit ); | 130 | a->addTo( edit ); |
131 | a->addTo( listTools ); | 131 | a->addTo( listTools ); |
132 | 132 | ||
133 | 133 | ||
134 | // make it possible to go directly to businesscard via qcop call | 134 | // make it possible to go directly to businesscard via qcop call |
135 | //#if defined(Q_WS_QWS) // Why this ? (se) | 135 | //#if defined(Q_WS_QWS) // Why this ? (se) |
136 | #if !defined(QT_NO_COP) | 136 | #if !defined(QT_NO_COP) |
137 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); | 137 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); |
138 | connect (addressChannel, SIGNAL( received(const QCString&,const QByteArray&)), | 138 | connect (addressChannel, SIGNAL( received(const QCString&,const QByteArray&)), |
139 | this, SLOT ( appMessage(const QCString&,const QByteArray&) ) ); | 139 | this, SLOT ( appMessage(const QCString&,const QByteArray&) ) ); |
140 | #endif | 140 | #endif |
141 | // #endif | 141 | // #endif |
142 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | 142 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), |
143 | QString::null, 0, this, 0 ); | 143 | QString::null, 0, this, 0 ); |
144 | actionFind = a; | 144 | actionFind = a; |
145 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); | 145 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); |
146 | a->addTo( edit ); | 146 | a->addTo( edit ); |
147 | a->addTo( listTools ); | 147 | a->addTo( listTools ); |
148 | 148 | ||
149 | // Much better search widget, taken from QTReader.. (se) | 149 | // Much better search widget, taken from QTReader.. (se) |
150 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); | 150 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
151 | searchBar->setHorizontalStretchable( TRUE ); | 151 | searchBar->setHorizontalStretchable( TRUE ); |
152 | searchBar->hide(); | 152 | searchBar->hide(); |
153 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 153 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
154 | 154 | ||
155 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 155 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
156 | // searchEdit->setFont( f ); | 156 | // searchEdit->setFont( f ); |
157 | 157 | ||
158 | searchBar->setStretchableWidget( searchEdit ); | 158 | searchBar->setStretchableWidget( searchEdit ); |
159 | connect( searchEdit, SIGNAL( returnPressed() ), | 159 | connect( searchEdit, SIGNAL( returnPressed() ), |
160 | this, SLOT( slotFind() ) ); | 160 | this, SLOT( slotFind() ) ); |
161 | 161 | ||
162 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | 162 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); |
163 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | 163 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
164 | a->addTo( searchBar ); | 164 | a->addTo( searchBar ); |
165 | 165 | ||
166 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 166 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
167 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); | 167 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); |
168 | a->addTo( searchBar ); | 168 | a->addTo( searchBar ); |
169 | 169 | ||
170 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), | 170 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "addressbook/sendmail" ), |
171 | QString::null, 0, this, 0 ); | 171 | QString::null, 0, this, 0 ); |
172 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 172 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
173 | actionMail = a; | 173 | actionMail = a; |
174 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 174 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
175 | a->addTo( edit ); | 175 | a->addTo( edit ); |
176 | a->addTo( listTools ); | 176 | a->addTo( listTools ); |
177 | 177 | ||
178 | if ( Ir::supported() ) { | 178 | if ( Ir::supported() ) { |
179 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 179 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
180 | 0, this, 0 ); | 180 | 0, this, 0 ); |
181 | actionBeam = a; | 181 | actionBeam = a; |
182 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 182 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
183 | a->addTo( edit ); | 183 | a->addTo( edit ); |
184 | a->addTo( listTools ); | 184 | a->addTo( listTools ); |
185 | } | 185 | } |
186 | 186 | ||
187 | edit->insertSeparator(); | 187 | edit->insertSeparator(); |
188 | 188 | ||
189 | a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, | 189 | a = new QAction( tr("Import vCard"), Resource::loadPixmap( "addressbook/fileimport"), QString::null, |
190 | 0, this, 0); | 190 | 0, this, 0); |
191 | actionPersonal = a; | 191 | actionPersonal = a; |
192 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); | 192 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); |
193 | a->addTo( edit ); | 193 | a->addTo( edit ); |
194 | 194 | ||
195 | a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), QString::null, | 195 | a = new QAction( tr("Export vCard"), Resource::loadPixmap( "addressbook/fileexport"), QString::null, |
196 | 0, this, 0); | 196 | 0, this, 0); |
197 | actionPersonal = a; | 197 | actionPersonal = a; |
198 | connect( a, SIGNAL( activated() ), this, SLOT( exportvCard() ) ); | 198 | connect( a, SIGNAL( activated() ), this, SLOT( exportvCard() ) ); |
199 | a->addTo( edit ); | 199 | a->addTo( edit ); |
200 | 200 | ||
201 | edit->insertSeparator(); | 201 | edit->insertSeparator(); |
202 | 202 | ||
203 | a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), | 203 | a = new QAction( tr("My Personal Details"), Resource::loadPixmap( "addressbook/identity" ), |
204 | QString::null, 0, this, 0 , TRUE ); | 204 | QString::null, 0, this, 0 , TRUE ); |
205 | actionPersonal = a; | 205 | actionPersonal = a; |
206 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 206 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); |
207 | a->addTo( edit ); | 207 | a->addTo( edit ); |
208 | 208 | ||
209 | 209 | ||
210 | #ifdef __DEBUG_RELEASE | 210 | #ifdef __DEBUG_RELEASE |
211 | // Remove this function for public Release ! This is only | 211 | // Remove this function for public Release ! This is only |
212 | // for debug purposes .. | 212 | // for debug purposes .. |
213 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); | 213 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); |
214 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); | 214 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); |
215 | a->addTo( edit ); | 215 | a->addTo( edit ); |
216 | #endif | 216 | #endif |
217 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, | 217 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, |
218 | 0, this, 0 ); | 218 | 0, this, 0 ); |
219 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); | 219 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); |
220 | a->addTo( edit ); | 220 | a->addTo( edit ); |
221 | 221 | ||
222 | // Create Views | 222 | // Create Views |
223 | listContainer = new QWidget( this ); | 223 | listContainer = new QWidget( this ); |
224 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | 224 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); |
225 | 225 | ||
226 | m_abView = new AbView( listContainer, m_config.orderList() ); | 226 | m_abView = new AbView( listContainer, m_config.orderList() ); |
227 | vb->addWidget( m_abView ); | 227 | vb->addWidget( m_abView ); |
228 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 228 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
229 | connect( m_abView, SIGNAL( signalViewSwitched(int) ), | 229 | connect( m_abView, SIGNAL( signalViewSwitched(int) ), |
230 | this, SLOT( slotViewSwitched(int) ) ); | 230 | this, SLOT( slotViewSwitched(int) ) ); |
231 | 231 | ||
232 | 232 | ||
233 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); | 233 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); |
234 | 234 | ||
235 | // m_abView->load(); // Already done by c'tor . | 235 | // m_abView->load(); // Already done by c'tor . |
236 | 236 | ||
237 | // Letter Picker | 237 | // Letter Picker |
238 | pLabel = new LetterPicker( listContainer ); | 238 | pLabel = new LetterPicker( listContainer ); |
239 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 239 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
240 | connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); | 240 | connect(m_abView, SIGNAL( signalClearLetterPicker() ), pLabel, SLOT( clear() ) ); |
241 | 241 | ||
242 | vb->addWidget( pLabel ); | 242 | vb->addWidget( pLabel ); |
243 | 243 | ||
244 | // All Categories into view-menu.. | 244 | // All Categories into view-menu.. |
245 | populateCategories(); | 245 | populateCategories(); |
246 | 246 | ||
247 | // Fontsize | 247 | // Fontsize |
248 | defaultFont = new QFont( m_abView->font() ); | 248 | defaultFont = new QFont( m_abView->font() ); |
249 | slotSetFont(m_config.fontSize()); | 249 | slotSetFont(m_config.fontSize()); |
250 | m_curFontSize = m_config.fontSize(); | 250 | m_curFontSize = m_config.fontSize(); |
251 | 251 | ||
252 | setCentralWidget(listContainer); | 252 | setCentralWidget(listContainer); |
253 | 253 | ||
254 | //odebug << "adressbook contrsuction: t=" << t.elapsed() << oendl; | 254 | //odebug << "adressbook contrsuction: t=" << t.elapsed() << oendl; |
255 | connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); | 255 | connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) ); |
256 | connect( qApp, SIGNAL( reload() ), this, SLOT( reload() ) ); | 256 | connect( qApp, SIGNAL( reload() ), this, SLOT( reload() ) ); |
257 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), | 257 | connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ), |
258 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); | 258 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
259 | 259 | ||
260 | 260 | ||
261 | isLoading = false; | 261 | isLoading = false; |
262 | } | 262 | } |
263 | 263 | ||
264 | 264 | ||
265 | void AddressbookWindow::slotConfig() | 265 | void AddressbookWindow::slotConfig() |
266 | { | 266 | { |
267 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | 267 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); |
268 | dlg -> setConfig( m_config ); | 268 | dlg -> setConfig( m_config ); |
269 | if ( QPEApplication::execDialog( dlg ) ) { | 269 | if ( QPEApplication::execDialog( dlg ) ) { |
270 | owarn << "Config Dialog accepted!" << oendl; | 270 | odebug << "Config Dialog accepted!" << oendl; |
271 | m_config = dlg -> getConfig(); | 271 | m_config = dlg -> getConfig(); |
272 | if ( m_curFontSize != m_config.fontSize() ){ | 272 | if ( m_curFontSize != m_config.fontSize() ){ |
273 | owarn << "Font was changed!" << oendl; | 273 | odebug << "Font was changed!" << oendl; |
274 | m_curFontSize = m_config.fontSize(); | 274 | m_curFontSize = m_config.fontSize(); |
275 | emit slotSetFont( m_curFontSize ); | 275 | emit slotSetFont( m_curFontSize ); |
276 | } | 276 | } |
277 | m_abView -> setListOrder( m_config.orderList() ); | 277 | m_abView -> setListOrder( m_config.orderList() ); |
278 | } | 278 | } |
279 | 279 | ||
280 | delete dlg; | 280 | delete dlg; |
281 | } | 281 | } |
282 | 282 | ||
283 | 283 | ||
284 | void AddressbookWindow::slotSetFont( int size ) | 284 | void AddressbookWindow::slotSetFont( int size ) |
285 | { | 285 | { |
286 | owarn << "void AddressbookWindow::slotSetFont( " << size << " )" << oendl; | 286 | odebug << "void AddressbookWindow::slotSetFont( " << size << " )" << oendl; |
287 | 287 | ||
288 | if (size > 2 || size < 0) | 288 | if (size > 2 || size < 0) |
289 | size = 1; | 289 | size = 1; |
290 | 290 | ||
291 | m_config.setFontSize( size ); | 291 | m_config.setFontSize( size ); |
292 | 292 | ||
293 | QFont *currentFont; | 293 | QFont *currentFont; |
294 | 294 | ||
295 | switch (size) { | 295 | switch (size) { |
296 | case 0: | 296 | case 0: |
297 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | 297 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); |
298 | currentFont = new QFont (m_abView->font()); | 298 | currentFont = new QFont (m_abView->font()); |
299 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX | 299 | // abList->resizeRows(currentFont->pixelSize() + 7); :SX |
300 | // abList->resizeRows(); | 300 | // abList->resizeRows(); |
301 | break; | 301 | break; |
302 | case 1: | 302 | case 1: |
303 | m_abView->setFont( *defaultFont ); | 303 | m_abView->setFont( *defaultFont ); |
304 | currentFont = new QFont (m_abView->font()); | 304 | currentFont = new QFont (m_abView->font()); |
305 | // // abList->resizeRows(currentFont->pixelSize() + 7); | 305 | // // abList->resizeRows(currentFont->pixelSize() + 7); |
306 | // abList->resizeRows(); | 306 | // abList->resizeRows(); |
307 | break; | 307 | break; |
308 | case 2: | 308 | case 2: |
309 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | 309 | m_abView->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); |
310 | currentFont = new QFont (m_abView->font()); | 310 | currentFont = new QFont (m_abView->font()); |
311 | // //abList->resizeRows(currentFont->pixelSize() + 7); | 311 | // //abList->resizeRows(currentFont->pixelSize() + 7); |
312 | // abList->resizeRows(); | 312 | // abList->resizeRows(); |
313 | break; | 313 | break; |
314 | } | 314 | } |
315 | } | 315 | } |
316 | 316 | ||
317 | 317 | ||
318 | 318 | ||
319 | void AddressbookWindow::importvCard() { | 319 | void AddressbookWindow::importvCard() { |
320 | QString str = Opie::Ui::OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); | 320 | QString str = Opie::Ui::OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); |
321 | if(!str.isEmpty() ){ | 321 | if(!str.isEmpty() ){ |
322 | setDocument((const QString&) str ); | 322 | setDocument((const QString&) str ); |
323 | } | 323 | } |
324 | 324 | ||
325 | } | 325 | } |
326 | void AddressbookWindow::exportvCard() | 326 | void AddressbookWindow::exportvCard() |
327 | { | 327 | { |
328 | owarn << "void AddressbookWindow::exportvCard()" << oendl; | 328 | odebug << "void AddressbookWindow::exportvCard()" << oendl; |
329 | QString filename = Opie::Ui::OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this ); | 329 | QString filename = Opie::Ui::OFileDialog::getSaveFileName( 1,"/home/"); //,"", "*", this ); |
330 | if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){ | 330 | if( !filename.isEmpty() && ( filename[filename.length()-1] != '/' ) ){ |
331 | owarn << " Save to file " << filename << ", (" << filename.length()-1 << ")" << oendl; | 331 | odebug << " Save to file " << filename << ", (" << filename.length()-1 << ")" << oendl; |
332 | Opie::OPimContact curCont = m_abView->currentEntry(); | 332 | Opie::OPimContact curCont = m_abView->currentEntry(); |
333 | if ( !curCont.isEmpty() ){ | 333 | if ( !curCont.isEmpty() ){ |
334 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 334 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
335 | filename ); | 335 | filename ); |
336 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook_exp", QString::null , vcard_backend, true ); | 336 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook_exp", QString::null , vcard_backend, true ); |
337 | if ( access ){ | 337 | if ( access ){ |
338 | access->add( curCont ); | 338 | access->add( curCont ); |
339 | access->save(); | 339 | access->save(); |
340 | } | 340 | } |
341 | delete access; | 341 | delete access; |
342 | }else | 342 | }else |
343 | QMessageBox::critical( 0, "Export VCard", | 343 | QMessageBox::critical( 0, "Export VCard", |
344 | QString( tr( "You have to select a contact !") ) ); | 344 | QString( tr( "You have to select a contact !") ) ); |
345 | 345 | ||
346 | }else | 346 | }else |
347 | QMessageBox::critical( 0, "Export VCard", | 347 | QMessageBox::critical( 0, "Export VCard", |
348 | QString( tr( "You have to set a filename !") ) ); | 348 | QString( tr( "You have to set a filename !") ) ); |
349 | } | 349 | } |
350 | 350 | ||
351 | void AddressbookWindow::setDocument( const QString &filename ) | 351 | void AddressbookWindow::setDocument( const QString &filename ) |
352 | { | 352 | { |
353 | owarn << "void AddressbookWindow::setDocument( " << filename << " )" << oendl; | 353 | odebug << "void AddressbookWindow::setDocument( " << filename << " )" << oendl; |
354 | 354 | ||
355 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ | 355 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ |
356 | 356 | ||
357 | 357 | ||
358 | 358 | ||
359 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), | 359 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), |
360 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), | 360 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), |
361 | tr( "&Yes" ), tr( "&No" ), QString::null, | 361 | tr( "&Yes" ), tr( "&No" ), QString::null, |
362 | 0, // Enter == button 0 | 362 | 0, // Enter == button 0 |
363 | 2 ) ) { // Escape == button 2 | 363 | 2 ) ) { // Escape == button 2 |
364 | case 0: | 364 | case 0: |
365 | owarn << "YES clicked" << oendl; | 365 | odebug << "YES clicked" << oendl; |
366 | break; | 366 | break; |
367 | case 1: | 367 | case 1: |
368 | owarn << "NO clicked" << oendl; | 368 | odebug << "NO clicked" << oendl; |
369 | return; | 369 | return; |
370 | break; | 370 | break; |
371 | } | 371 | } |
372 | } | 372 | } |
373 | 373 | ||
374 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 374 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
375 | filename ); | 375 | filename ); |
376 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 376 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
377 | Opie::OPimContactAccess::List allList = access->allRecords(); | 377 | Opie::OPimContactAccess::List allList = access->allRecords(); |
378 | owarn << "Found number of contacts in File: " << allList.count() << oendl; | 378 | odebug << "Found number of contacts in File: " << allList.count() << oendl; |
379 | 379 | ||
380 | if ( !allList.count() ) { | 380 | if ( !allList.count() ) { |
381 | QMessageBox::information( this, "Import VCard", | 381 | QMessageBox::information( this, "Import VCard", |
382 | "It was impossible to import\nthe VCard.\n" | 382 | "It was impossible to import\nthe VCard.\n" |
383 | "The VCard may be corrupted!" ); | 383 | "The VCard may be corrupted!" ); |
384 | } | 384 | } |
385 | 385 | ||
386 | bool doAsk = true; | 386 | bool doAsk = true; |
387 | Opie::OPimContactAccess::List::Iterator it; | 387 | Opie::OPimContactAccess::List::Iterator it; |
388 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 388 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
389 | owarn << "Adding Contact from: " << (*it).fullName() << oendl; | 389 | odebug << "Adding Contact from: " << (*it).fullName() << oendl; |
390 | if ( doAsk ){ | 390 | if ( doAsk ){ |
391 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), | 391 | switch( QMessageBox::information( this, tr ( "Add Contact?" ), |
392 | tr( "Do you really want add contact for \n%1?" ) | 392 | tr( "Do you really want add contact for \n%1?" ) |
393 | .arg( (*it).fullName().latin1() ), | 393 | .arg( (*it).fullName().latin1() ), |
394 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), | 394 | tr( "&Yes" ), tr( "&No" ), tr( "&All Yes"), |
395 | 0, // Enter == button 0 | 395 | 0, // Enter == button 0 |
396 | 2 ) ) { // Escape == button 2 | 396 | 2 ) ) { // Escape == button 2 |
397 | case 0: | 397 | case 0: |
398 | owarn << "YES clicked" << oendl; | 398 | odebug << "YES clicked" << oendl; |
399 | m_abView->addEntry( *it ); | 399 | m_abView->addEntry( *it ); |
400 | break; | 400 | break; |
401 | case 1: | 401 | case 1: |
402 | owarn << "NO clicked" << oendl; | 402 | odebug << "NO clicked" << oendl; |
403 | break; | 403 | break; |
404 | case 2: | 404 | case 2: |
405 | owarn << "YesAll clicked" << oendl; | 405 | odebug << "YesAll clicked" << oendl; |
406 | doAsk = false; | 406 | doAsk = false; |
407 | break; | 407 | break; |
408 | } | 408 | } |
409 | }else | 409 | }else |
410 | m_abView->addEntry( *it ); | 410 | m_abView->addEntry( *it ); |
411 | 411 | ||
412 | } | 412 | } |
413 | 413 | ||
414 | delete access; | 414 | delete access; |
415 | } | 415 | } |
416 | 416 | ||
417 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 417 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
418 | { | 418 | { |
419 | QMainWindow::resizeEvent( e ); | 419 | QMainWindow::resizeEvent( e ); |
420 | 420 | ||
421 | 421 | ||
422 | } | 422 | } |
423 | 423 | ||
424 | AddressbookWindow::~AddressbookWindow() | 424 | AddressbookWindow::~AddressbookWindow() |
425 | { | 425 | { |
426 | ToolBarDock dock; | 426 | ToolBarDock dock; |
427 | int dummy; | 427 | int dummy; |
428 | bool bDummy; | 428 | bool bDummy; |
429 | getLocation ( listTools, dock, dummy, bDummy, dummy ); | 429 | getLocation ( listTools, dock, dummy, bDummy, dummy ); |
430 | m_config.setToolBarDock( dock ); | 430 | m_config.setToolBarDock( dock ); |
431 | m_config.save(); | 431 | m_config.save(); |
432 | } | 432 | } |
433 | 433 | ||
434 | void AddressbookWindow::slotUpdateToolbar() | 434 | void AddressbookWindow::slotUpdateToolbar() |
435 | { | 435 | { |
436 | Opie::OPimContact ce = m_abView->currentEntry(); | 436 | Opie::OPimContact ce = m_abView->currentEntry(); |
437 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 437 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
438 | } | 438 | } |
439 | 439 | ||
440 | void AddressbookWindow::slotListNew() | 440 | void AddressbookWindow::slotListNew() |
441 | { | 441 | { |
442 | Opie::OPimContact cnt; | 442 | Opie::OPimContact cnt; |
443 | if( !syncing ) { | 443 | if( !syncing ) { |
444 | editEntry( NewEntry ); | 444 | editEntry( NewEntry ); |
445 | } else { | 445 | } else { |
446 | QMessageBox::warning(this, tr("Contacts"), | 446 | QMessageBox::warning(this, tr("Contacts"), |
447 | tr("Can not edit data, currently syncing")); | 447 | tr("Can not edit data, currently syncing")); |
448 | } | 448 | } |
449 | } | 449 | } |
450 | 450 | ||
451 | // void AddressbookWindow::slotListView() | 451 | // void AddressbookWindow::slotListView() |
452 | // { | 452 | // { |
453 | // m_abView -> init( abList->currentEntry() ); | 453 | // m_abView -> init( abList->currentEntry() ); |
454 | // // :SX mView->sync(); | 454 | // // :SX mView->sync(); |
455 | // //:SXshowView(); | 455 | // //:SXshowView(); |
456 | // } | 456 | // } |
457 | 457 | ||
458 | void AddressbookWindow::slotListDelete() | 458 | void AddressbookWindow::slotListDelete() |
459 | { | 459 | { |
460 | if(!syncing) { | 460 | if(!syncing) { |
461 | Opie::OPimContact tmpEntry = m_abView ->currentEntry(); | 461 | Opie::OPimContact tmpEntry = m_abView ->currentEntry(); |
462 | 462 | ||
463 | // get a name, do the best we can... | 463 | // get a name, do the best we can... |
464 | QString strName = tmpEntry.fullName(); | 464 | QString strName = tmpEntry.fullName(); |
465 | if ( strName.isEmpty() ) { | 465 | if ( strName.isEmpty() ) { |
466 | strName = tmpEntry.company(); | 466 | strName = tmpEntry.company(); |
467 | if ( strName.isEmpty() ) | 467 | if ( strName.isEmpty() ) |
468 | strName = "No Name"; | 468 | strName = "No Name"; |
469 | } | 469 | } |
470 | 470 | ||
471 | 471 | ||
472 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), | 472 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), |
473 | strName ) ) { | 473 | strName ) ) { |
474 | m_abView->removeEntry( tmpEntry.uid() ); | 474 | m_abView->removeEntry( tmpEntry.uid() ); |
475 | } | 475 | } |
476 | } else { | 476 | } else { |
477 | QMessageBox::warning( this, tr("Contacts"), | 477 | QMessageBox::warning( this, tr("Contacts"), |
478 | tr("Can not edit data, currently syncing") ); | 478 | tr("Can not edit data, currently syncing") ); |
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||
482 | void AddressbookWindow::slotFindOpen() | 482 | void AddressbookWindow::slotFindOpen() |
483 | { | 483 | { |
484 | searchBar->show(); | 484 | searchBar->show(); |
485 | m_abView -> inSearch(); | 485 | m_abView -> inSearch(); |
486 | searchEdit->setFocus(); | 486 | searchEdit->setFocus(); |
487 | } | 487 | } |
488 | void AddressbookWindow::slotFindClose() | 488 | void AddressbookWindow::slotFindClose() |
489 | { | 489 | { |
490 | searchBar->hide(); | 490 | searchBar->hide(); |
491 | m_abView -> offSearch(); | 491 | m_abView -> offSearch(); |
492 | // m_abView->setFocus(); | 492 | // m_abView->setFocus(); |
493 | } | 493 | } |
494 | 494 | ||
495 | 495 | ||
496 | void AddressbookWindow::slotFind() | 496 | void AddressbookWindow::slotFind() |
497 | { | 497 | { |
498 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); | 498 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); |
499 | 499 | ||
500 | searchEdit->clearFocus(); | 500 | searchEdit->clearFocus(); |
501 | // m_abView->setFocus(); | 501 | // m_abView->setFocus(); |
502 | 502 | ||
503 | } | 503 | } |
504 | 504 | ||
505 | void AddressbookWindow::slotViewBack() | 505 | void AddressbookWindow::slotViewBack() |
506 | { | 506 | { |
507 | // :SX showList(); | 507 | // :SX showList(); |
508 | } | 508 | } |
509 | 509 | ||
510 | void AddressbookWindow::slotViewEdit() | 510 | void AddressbookWindow::slotViewEdit() |
511 | { | 511 | { |
512 | if(!syncing) { | 512 | if(!syncing) { |
513 | if (actionPersonal->isOn()) { | 513 | if (actionPersonal->isOn()) { |
514 | editPersonal(); | 514 | editPersonal(); |
515 | } else { | 515 | } else { |
516 | editEntry( EditEntry ); | 516 | editEntry( EditEntry ); |
517 | } | 517 | } |
518 | } else { | 518 | } else { |
519 | QMessageBox::warning( this, tr("Contacts"), | 519 | QMessageBox::warning( this, tr("Contacts"), |
520 | tr("Can not edit data, currently syncing") ); | 520 | tr("Can not edit data, currently syncing") ); |
521 | } | 521 | } |
522 | } | 522 | } |
523 | 523 | ||
524 | 524 | ||
525 | 525 | ||
526 | void AddressbookWindow::writeMail() | 526 | void AddressbookWindow::writeMail() |
527 | { | 527 | { |
528 | Opie::OPimContact c = m_abView -> currentEntry(); | 528 | Opie::OPimContact c = m_abView -> currentEntry(); |
529 | QString name = c.fileAs(); | 529 | QString name = c.fileAs(); |
530 | QString email = c.defaultEmail(); | 530 | QString email = c.defaultEmail(); |
531 | 531 | ||
532 | // I prefer the OPIE-Environment variable before the | 532 | // I prefer the OPIE-Environment variable before the |
533 | // QPE-one.. | 533 | // QPE-one.. |
534 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); | 534 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); |
535 | if ( basepath.isEmpty() ) | 535 | if ( basepath.isEmpty() ) |
536 | basepath = QString::fromLatin1( getenv("QPEDIR") ); | 536 | basepath = QString::fromLatin1( getenv("QPEDIR") ); |
537 | 537 | ||
538 | // Try to access the preferred. If not possible, try to | 538 | // Try to access the preferred. If not possible, try to |
539 | // switch to the other one.. | 539 | // switch to the other one.. |
540 | if ( m_config.useQtMail() ){ | 540 | if ( m_config.useQtMail() ){ |
541 | owarn << "Accessing: " << (basepath + "/bin/qtmail") << oendl; | 541 | odebug << "Accessing: " << (basepath + "/bin/qtmail") << oendl; |
542 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ | 542 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ |
543 | owarn << "QCop" << oendl; | 543 | odebug << "QCop" << oendl; |
544 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 544 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
545 | e << name << email; | 545 | e << name << email; |
546 | return; | 546 | return; |
547 | } else | 547 | } else |
548 | m_config.setUseOpieMail( true ); | 548 | m_config.setUseOpieMail( true ); |
549 | } | 549 | } |
550 | if ( m_config.useOpieMail() ){ | 550 | if ( m_config.useOpieMail() ){ |
551 | owarn << "Accessing: " << (basepath + "/bin/opiemail") << oendl; | 551 | odebug << "Accessing: " << (basepath + "/bin/opiemail") << oendl; |
552 | if ( QFile::exists( basepath + "/bin/opiemail" ) ){ | 552 | if ( QFile::exists( basepath + "/bin/opiemail" ) ){ |
553 | owarn << "QCop" << oendl; | 553 | odebug << "QCop" << oendl; |
554 | QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)"); | 554 | QCopEnvelope e("QPE/Application/opiemail", "writeMail(QString,QString)"); |
555 | e << name << email; | 555 | e << name << email; |
556 | return; | 556 | return; |
557 | } else | 557 | } else |
558 | m_config.setUseQtMail( true ); | 558 | m_config.setUseQtMail( true ); |
559 | } | 559 | } |
560 | 560 | ||
561 | } | 561 | } |
562 | 562 | ||
563 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 563 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
564 | 564 | ||
565 | void AddressbookWindow::slotBeam() | 565 | void AddressbookWindow::slotBeam() |
566 | { | 566 | { |
567 | QString beamFilename; | 567 | QString beamFilename; |
568 | Opie::OPimContact c; | 568 | Opie::OPimContact c; |
569 | if ( actionPersonal->isOn() ) { | 569 | if ( actionPersonal->isOn() ) { |
570 | beamFilename = addressbookPersonalVCardName(); | 570 | beamFilename = addressbookPersonalVCardName(); |
571 | if ( !QFile::exists( beamFilename ) ) | 571 | if ( !QFile::exists( beamFilename ) ) |
572 | return; // can't beam a non-existent file | 572 | return; // can't beam a non-existent file |
573 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 573 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
574 | beamFilename ); | 574 | beamFilename ); |
575 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 575 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
576 | Opie::OPimContactAccess::List allList = access->allRecords(); | 576 | Opie::OPimContactAccess::List allList = access->allRecords(); |
577 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | 577 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first |
578 | c = *it; | 578 | c = *it; |
579 | 579 | ||
580 | delete access; | 580 | delete access; |
581 | } else { | 581 | } else { |
582 | unlink( beamfile ); // delete if exists | 582 | unlink( beamfile ); // delete if exists |
583 | mkdir("/tmp/obex/", 0755); | 583 | mkdir("/tmp/obex/", 0755); |
584 | c = m_abView -> currentEntry(); | 584 | c = m_abView -> currentEntry(); |
585 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 585 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
586 | beamfile ); | 586 | beamfile ); |
587 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 587 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
588 | access->add( c ); | 588 | access->add( c ); |
589 | access->save(); | 589 | access->save(); |
590 | delete access; | 590 | delete access; |
591 | 591 | ||
592 | beamFilename = beamfile; | 592 | beamFilename = beamfile; |
593 | } | 593 | } |
594 | 594 | ||
595 | owarn << "Beaming: " << beamFilename << oendl; | 595 | odebug << "Beaming: " << beamFilename << oendl; |
596 | 596 | ||
597 | Ir *ir = new Ir( this ); | 597 | Ir *ir = new Ir( this ); |
598 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 598 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
599 | QString description = c.fullName(); | 599 | QString description = c.fullName(); |
600 | ir->send( beamFilename, description, "text/x-vCard" ); | 600 | ir->send( beamFilename, description, "text/x-vCard" ); |
601 | } | 601 | } |
602 | 602 | ||
603 | void AddressbookWindow::beamDone( Ir *ir ) | 603 | void AddressbookWindow::beamDone( Ir *ir ) |
604 | { | 604 | { |
605 | 605 | ||
606 | delete ir; | 606 | delete ir; |
607 | unlink( beamfile ); | 607 | unlink( beamfile ); |
608 | } | 608 | } |
609 | 609 | ||
610 | 610 | ||
611 | static void parseName( const QString& name, QString *first, QString *middle, | 611 | static void parseName( const QString& name, QString *first, QString *middle, |
612 | QString * last ) | 612 | QString * last ) |
613 | { | 613 | { |
614 | 614 | ||
615 | int comma = name.find ( "," ); | 615 | int comma = name.find ( "," ); |
616 | QString rest; | 616 | QString rest; |
617 | if ( comma > 0 ) { | 617 | if ( comma > 0 ) { |
618 | *last = name.left( comma ); | 618 | *last = name.left( comma ); |
619 | comma++; | 619 | comma++; |
620 | while ( comma < int(name.length()) && name[comma] == ' ' ) | 620 | while ( comma < int(name.length()) && name[comma] == ' ' ) |
621 | comma++; | 621 | comma++; |
622 | rest = name.mid( comma ); | 622 | rest = name.mid( comma ); |
623 | } else { | 623 | } else { |
624 | int space = name.findRev( ' ' ); | 624 | int space = name.findRev( ' ' ); |
625 | *last = name.mid( space+1 ); | 625 | *last = name.mid( space+1 ); |
626 | rest = name.left( space ); | 626 | rest = name.left( space ); |
627 | } | 627 | } |
628 | int space = rest.find( ' ' ); | 628 | int space = rest.find( ' ' ); |
629 | if ( space <= 0 ) { | 629 | if ( space <= 0 ) { |
630 | *first = rest; | 630 | *first = rest; |
631 | } else { | 631 | } else { |
632 | *first = rest.left( space ); | 632 | *first = rest.left( space ); |
633 | *middle = rest.mid( space+1 ); | 633 | *middle = rest.mid( space+1 ); |
634 | } | 634 | } |
635 | 635 | ||
636 | } | 636 | } |
637 | 637 | ||
638 | 638 | ||
639 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 639 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
640 | { | 640 | { |
641 | bool needShow = FALSE; | 641 | bool needShow = FALSE; |
642 | owarn << "Receiving QCop-Call with message " << msg << oendl; | 642 | odebug << "Receiving QCop-Call with message " << msg << oendl; |
643 | 643 | ||
644 | 644 | ||
645 | if (msg == "editPersonal()") { | 645 | if (msg == "editPersonal()") { |
646 | editPersonal(); | 646 | editPersonal(); |
647 | } else if (msg == "editPersonalAndClose()") { | 647 | } else if (msg == "editPersonalAndClose()") { |
648 | editPersonal(); | 648 | editPersonal(); |
649 | close(); | 649 | close(); |
650 | } else if ( msg == "addContact(QString,QString)" ) { | 650 | } else if ( msg == "addContact(QString,QString)" ) { |
651 | QDataStream stream(data,IO_ReadOnly); | 651 | QDataStream stream(data,IO_ReadOnly); |
652 | QString name, email; | 652 | QString name, email; |
653 | stream >> name >> email; | 653 | stream >> name >> email; |
654 | 654 | ||
655 | Opie::OPimContact cnt; | 655 | Opie::OPimContact cnt; |
656 | QString fn, mn, ln; | 656 | QString fn, mn, ln; |
657 | parseName( name, &fn, &mn, &ln ); | 657 | parseName( name, &fn, &mn, &ln ); |
658 | //odebug << " " << fn << " - " << mn " - " << ln << oendl; | 658 | //odebug << " " << fn << " - " << mn " - " << ln << oendl; |
659 | cnt.setFirstName( fn ); | 659 | cnt.setFirstName( fn ); |
660 | cnt.setMiddleName( mn ); | 660 | cnt.setMiddleName( mn ); |
661 | cnt.setLastName( ln ); | 661 | cnt.setLastName( ln ); |
662 | cnt.insertEmails( email ); | 662 | cnt.insertEmails( email ); |
663 | cnt.setDefaultEmail( email ); | 663 | cnt.setDefaultEmail( email ); |
664 | cnt.setFileAs(); | 664 | cnt.setFileAs(); |
665 | 665 | ||
666 | m_abView -> addEntry( cnt ); | 666 | m_abView -> addEntry( cnt ); |
667 | 667 | ||
668 | // :SXm_abView()->init( cnt ); | 668 | // :SXm_abView()->init( cnt ); |
669 | editEntry( EditEntry ); | 669 | editEntry( EditEntry ); |
670 | } else if ( msg == "beamBusinessCard()" ) { | 670 | } else if ( msg == "beamBusinessCard()" ) { |
671 | QString beamFilename = addressbookPersonalVCardName(); | 671 | QString beamFilename = addressbookPersonalVCardName(); |
672 | if ( !QFile::exists( beamFilename ) ) | 672 | if ( !QFile::exists( beamFilename ) ) |
673 | return; // can't beam a non-existent file | 673 | return; // can't beam a non-existent file |
674 | 674 | ||
675 | Ir *ir = new Ir( this ); | 675 | Ir *ir = new Ir( this ); |
676 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 676 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
677 | QString description = "mycard.vcf"; | 677 | QString description = "mycard.vcf"; |
678 | ir->send( beamFilename, description, "text/x-vCard" ); | 678 | ir->send( beamFilename, description, "text/x-vCard" ); |
679 | } else if ( msg == "show(int)" ) { | 679 | } else if ( msg == "show(int)" ) { |
680 | raise(); | 680 | raise(); |
681 | QDataStream stream(data,IO_ReadOnly); | 681 | QDataStream stream(data,IO_ReadOnly); |
682 | int uid; | 682 | int uid; |
683 | stream >> uid; | 683 | stream >> uid; |
684 | 684 | ||
685 | owarn << "Showing uid: " << uid << oendl; | 685 | odebug << "Showing uid: " << uid << oendl; |
686 | 686 | ||
687 | // Deactivate Personal View.. | 687 | // Deactivate Personal View.. |
688 | if ( actionPersonal->isOn() ){ | 688 | if ( actionPersonal->isOn() ){ |
689 | actionPersonal->setOn( false ); | 689 | actionPersonal->setOn( false ); |
690 | slotPersonalView(); | 690 | slotPersonalView(); |
691 | } | 691 | } |
692 | 692 | ||
693 | // Reset category and show as card.. | 693 | // Reset category and show as card.. |
694 | m_abView -> setShowByCategory( QString::null ); | 694 | m_abView -> setShowByCategory( QString::null ); |
695 | m_abView -> setCurrentUid( uid ); | 695 | m_abView -> setCurrentUid( uid ); |
696 | slotViewSwitched ( AbView::CardView ); | 696 | slotViewSwitched ( AbView::CardView ); |
697 | 697 | ||
698 | needShow = true; | 698 | needShow = true; |
699 | 699 | ||
700 | 700 | ||
701 | } else if ( msg == "edit(int)" ) { | 701 | } else if ( msg == "edit(int)" ) { |
702 | QDataStream stream(data,IO_ReadOnly); | 702 | QDataStream stream(data,IO_ReadOnly); |
703 | int uid; | 703 | int uid; |
704 | stream >> uid; | 704 | stream >> uid; |
705 | 705 | ||
706 | // Deactivate Personal View.. | 706 | // Deactivate Personal View.. |
707 | if ( actionPersonal->isOn() ){ | 707 | if ( actionPersonal->isOn() ){ |
708 | actionPersonal->setOn( false ); | 708 | actionPersonal->setOn( false ); |
709 | slotPersonalView(); | 709 | slotPersonalView(); |
710 | } | 710 | } |
711 | 711 | ||
712 | // Reset category and edit.. | 712 | // Reset category and edit.. |
713 | m_abView -> setShowByCategory( QString::null ); | 713 | m_abView -> setShowByCategory( QString::null ); |
714 | m_abView -> setCurrentUid( uid ); | 714 | m_abView -> setCurrentUid( uid ); |
715 | slotViewEdit(); | 715 | slotViewEdit(); |
716 | } | 716 | } |
717 | 717 | ||
718 | if (needShow) | 718 | if (needShow) |
719 | QPEApplication::setKeepRunning(); | 719 | QPEApplication::setKeepRunning(); |
720 | 720 | ||
721 | } | 721 | } |
722 | 722 | ||
723 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 723 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
724 | { | 724 | { |
725 | Opie::OPimContact entry; | 725 | Opie::OPimContact entry; |
726 | if ( !abEditor ) { | 726 | if ( !abEditor ) { |
727 | abEditor = new ContactEditor( entry, this, "editor" ); | 727 | abEditor = new ContactEditor( entry, this, "editor" ); |
728 | } | 728 | } |
729 | if ( entryMode == EditEntry ) | 729 | if ( entryMode == EditEntry ) |
730 | abEditor->setEntry( m_abView -> currentEntry() ); | 730 | abEditor->setEntry( m_abView -> currentEntry() ); |
731 | else if ( entryMode == NewEntry ) | 731 | else if ( entryMode == NewEntry ) |
732 | abEditor->setEntry( entry ); | 732 | abEditor->setEntry( entry ); |
733 | // other things may change the caption. | 733 | // other things may change the caption. |
734 | abEditor->setCaption( tr("Edit Address") ); | 734 | abEditor->setCaption( tr("Edit Address") ); |
735 | 735 | ||
736 | // fix the foxus... | 736 | // fix the foxus... |
737 | abEditor->setNameFocus(); | 737 | abEditor->setNameFocus(); |
738 | if ( QPEApplication::execDialog( abEditor ) ) { | 738 | if ( QPEApplication::execDialog( abEditor ) ) { |
739 | setFocus(); | 739 | setFocus(); |
740 | if ( entryMode == NewEntry ) { | 740 | if ( entryMode == NewEntry ) { |
741 | Opie::OPimContact insertEntry = abEditor->entry(); | 741 | Opie::OPimContact insertEntry = abEditor->entry(); |
742 | insertEntry.assignUid(); | 742 | insertEntry.assignUid(); |
743 | m_abView -> addEntry( insertEntry ); | 743 | m_abView -> addEntry( insertEntry ); |
744 | m_abView -> setCurrentUid( insertEntry.uid() ); | 744 | m_abView -> setCurrentUid( insertEntry.uid() ); |
745 | } else { | 745 | } else { |
746 | Opie::OPimContact replEntry = abEditor->entry(); | 746 | Opie::OPimContact replEntry = abEditor->entry(); |
747 | 747 | ||
748 | if ( !replEntry.isValidUid() ) | 748 | if ( !replEntry.isValidUid() ) |
749 | replEntry.assignUid(); | 749 | replEntry.assignUid(); |
750 | 750 | ||
751 | m_abView -> replaceEntry( replEntry ); | 751 | m_abView -> replaceEntry( replEntry ); |
752 | } | 752 | } |
753 | } | 753 | } |
754 | // populateCategories(); | 754 | // populateCategories(); |
755 | 755 | ||
756 | } | 756 | } |
757 | 757 | ||
758 | void AddressbookWindow::editPersonal() | 758 | void AddressbookWindow::editPersonal() |
759 | { | 759 | { |
760 | Opie::OPimContact entry; | 760 | Opie::OPimContact entry; |
761 | 761 | ||
762 | // Switch to personal view if not selected | 762 | // Switch to personal view if not selected |
763 | // but take care of the menu, too | 763 | // but take care of the menu, too |
764 | if ( ! actionPersonal->isOn() ){ | 764 | if ( ! actionPersonal->isOn() ){ |
765 | owarn << "*** ++++" << oendl; | 765 | odebug << "*** ++++" << oendl; |
766 | actionPersonal->setOn( true ); | 766 | actionPersonal->setOn( true ); |
767 | slotPersonalView(); | 767 | slotPersonalView(); |
768 | } | 768 | } |
769 | 769 | ||
770 | if ( !abEditor ) { | 770 | if ( !abEditor ) { |
771 | abEditor = new ContactEditor( entry, this, "editor" ); | 771 | abEditor = new ContactEditor( entry, this, "editor" ); |
772 | } | 772 | } |
773 | 773 | ||
774 | abEditor->setCaption(tr("Edit My Personal Details")); | 774 | abEditor->setCaption(tr("Edit My Personal Details")); |
775 | abEditor->setPersonalView( true ); | 775 | abEditor->setPersonalView( true ); |
776 | editEntry( EditEntry ); | 776 | editEntry( EditEntry ); |
777 | abEditor->setPersonalView( false ); | 777 | abEditor->setPersonalView( false ); |
778 | 778 | ||
779 | } | 779 | } |
780 | 780 | ||
781 | 781 | ||
782 | void AddressbookWindow::slotPersonalView() | 782 | void AddressbookWindow::slotPersonalView() |
783 | { | 783 | { |
784 | owarn << "slotPersonalView()" << oendl; | 784 | odebug << "slotPersonalView()" << oendl; |
785 | if (!actionPersonal->isOn()) { | 785 | if (!actionPersonal->isOn()) { |
786 | // we just turned it off | 786 | // we just turned it off |
787 | owarn << "slotPersonalView()-> OFF" << oendl; | 787 | odebug << "slotPersonalView()-> OFF" << oendl; |
788 | setCaption( tr("Contacts") ); | 788 | setCaption( tr("Contacts") ); |
789 | actionNew->setEnabled(TRUE); | 789 | actionNew->setEnabled(TRUE); |
790 | actionTrash->setEnabled(TRUE); | 790 | actionTrash->setEnabled(TRUE); |
791 | actionFind->setEnabled(TRUE); | 791 | actionFind->setEnabled(TRUE); |
792 | actionMail->setEnabled(TRUE); | 792 | actionMail->setEnabled(TRUE); |
793 | // slotUpdateToolbar(); | 793 | // slotUpdateToolbar(); |
794 | 794 | ||
795 | m_abView->showPersonal( false ); | 795 | m_abView->showPersonal( false ); |
796 | 796 | ||
797 | return; | 797 | return; |
798 | } | 798 | } |
799 | 799 | ||
800 | owarn << "slotPersonalView()-> ON" << oendl; | 800 | odebug << "slotPersonalView()-> ON" << oendl; |
801 | // XXX need to disable some QActions. | 801 | // XXX need to disable some QActions. |
802 | actionNew->setEnabled(FALSE); | 802 | actionNew->setEnabled(FALSE); |
803 | actionTrash->setEnabled(FALSE); | 803 | actionTrash->setEnabled(FALSE); |
804 | actionFind->setEnabled(FALSE); | 804 | actionFind->setEnabled(FALSE); |
805 | actionMail->setEnabled(FALSE); | 805 | actionMail->setEnabled(FALSE); |
806 | 806 | ||
807 | setCaption( tr("Contacts - My Personal Details") ); | 807 | setCaption( tr("Contacts - My Personal Details") ); |
808 | 808 | ||
809 | m_abView->showPersonal( true ); | 809 | m_abView->showPersonal( true ); |
810 | 810 | ||
811 | } | 811 | } |
812 | 812 | ||
813 | 813 | ||
814 | void AddressbookWindow::listIsEmpty( bool empty ) | 814 | void AddressbookWindow::listIsEmpty( bool empty ) |
815 | { | 815 | { |
816 | if ( !empty ) { | 816 | if ( !empty ) { |
817 | deleteButton->setEnabled( TRUE ); | 817 | deleteButton->setEnabled( TRUE ); |
818 | } | 818 | } |
819 | } | 819 | } |
820 | 820 | ||
821 | void AddressbookWindow::reload() | 821 | void AddressbookWindow::reload() |
822 | { | 822 | { |
823 | syncing = FALSE; | 823 | syncing = FALSE; |
824 | m_abView->clear(); | 824 | m_abView->clear(); |
825 | m_abView->reload(); | 825 | m_abView->reload(); |
826 | } | 826 | } |
827 | 827 | ||
828 | void AddressbookWindow::flush() | 828 | void AddressbookWindow::flush() |
829 | { | 829 | { |
830 | syncing = TRUE; | 830 | syncing = TRUE; |
831 | m_abView->save(); | 831 | m_abView->save(); |
832 | } | 832 | } |
833 | 833 | ||
834 | 834 | ||
835 | void AddressbookWindow::closeEvent( QCloseEvent *e ) | 835 | void AddressbookWindow::closeEvent( QCloseEvent *e ) |
836 | { | 836 | { |
837 | if(active_view == AbView::CardView){ | 837 | if(active_view == AbView::CardView){ |
838 | slotViewSwitched( AbView::TableView ); | 838 | slotViewSwitched( AbView::TableView ); |
839 | e->ignore(); | 839 | e->ignore(); |
840 | return; | 840 | return; |
841 | } | 841 | } |
842 | if(syncing) { | 842 | if(syncing) { |
843 | /* shouldn't we save, I hear you say? well its already been set | 843 | /* shouldn't we save, I hear you say? well its already been set |
844 | so that an edit can not occur during a sync, and we flushed | 844 | so that an edit can not occur during a sync, and we flushed |
845 | at the start of the sync, so there is no need to save | 845 | at the start of the sync, so there is no need to save |
846 | Saving however itself would cause problems. */ | 846 | Saving however itself would cause problems. */ |
847 | e->accept(); | 847 | e->accept(); |
848 | return; | 848 | return; |
849 | } | 849 | } |
850 | //################## shouldn't always save | 850 | //################## shouldn't always save |
851 | // True, but the database handles this automatically ! (se) | 851 | // True, but the database handles this automatically ! (se) |
852 | if ( save() ) | 852 | if ( save() ) |
853 | e->accept(); | 853 | e->accept(); |
854 | else | 854 | else |
855 | e->ignore(); | 855 | e->ignore(); |
856 | } | 856 | } |
857 | 857 | ||
858 | /* | 858 | /* |
859 | Returns TRUE if it is OK to exit | 859 | Returns TRUE if it is OK to exit |
860 | */ | 860 | */ |
861 | 861 | ||
862 | bool AddressbookWindow::save() | 862 | bool AddressbookWindow::save() |
863 | { | 863 | { |
864 | if ( !m_abView->save() ) { | 864 | if ( !m_abView->save() ) { |
865 | if ( QMessageBox::critical( 0, tr( "Out of space" ), | 865 | if ( QMessageBox::critical( 0, tr( "Out of space" ), |
866 | tr("Unable to save information.\n" | 866 | tr("Unable to save information.\n" |
867 | "Free up some space\n" | 867 | "Free up some space\n" |
868 | "and try again.\n" | 868 | "and try again.\n" |
869 | "\nQuit anyway?"), | 869 | "\nQuit anyway?"), |
870 | QMessageBox::Yes|QMessageBox::Escape, | 870 | QMessageBox::Yes|QMessageBox::Escape, |
871 | QMessageBox::No|QMessageBox::Default ) | 871 | QMessageBox::No|QMessageBox::Default ) |
872 | != QMessageBox::No ) | 872 | != QMessageBox::No ) |
873 | return TRUE; | 873 | return TRUE; |
874 | else | 874 | else |
875 | return FALSE; | 875 | return FALSE; |
876 | } | 876 | } |
877 | return TRUE; | 877 | return TRUE; |
878 | } | 878 | } |
879 | 879 | ||
880 | #ifdef __DEBUG_RELEASE | 880 | #ifdef __DEBUG_RELEASE |
881 | void AddressbookWindow::slotSave() | 881 | void AddressbookWindow::slotSave() |
882 | { | 882 | { |
883 | save(); | 883 | save(); |
884 | } | 884 | } |
885 | #endif | 885 | #endif |
886 | 886 | ||
887 | 887 | ||
888 | void AddressbookWindow::slotNotFound() | 888 | void AddressbookWindow::slotNotFound() |
889 | { | 889 | { |
890 | owarn << "Got not found signal!" << oendl; | 890 | odebug << "Got not found signal!" << oendl; |
891 | QMessageBox::information( this, tr( "Not Found" ), | 891 | QMessageBox::information( this, tr( "Not Found" ), |
892 | "<qt>" + tr( "Unable to find a contact for this search pattern!" ) + "</qt>" ); | 892 | "<qt>" + tr( "Unable to find a contact for this search pattern!" ) + "</qt>" ); |
893 | 893 | ||
894 | 894 | ||
895 | } | 895 | } |
896 | void AddressbookWindow::slotWrapAround() | 896 | void AddressbookWindow::slotWrapAround() |
897 | { | 897 | { |
898 | owarn << "Got wrap signal!" << oendl; | 898 | odebug << "Got wrap signal!" << oendl; |
899 | // if ( doNotifyWrapAround ) | 899 | // if ( doNotifyWrapAround ) |
900 | // QMessageBox::information( this, tr( "End of list" ), | 900 | // QMessageBox::information( this, tr( "End of list" ), |
901 | // tr( "End of list. Wrap around now...!" ) + "\n" ); | 901 | // tr( "End of list. Wrap around now...!" ) + "\n" ); |
902 | 902 | ||
903 | } | 903 | } |
904 | 904 | ||
905 | void AddressbookWindow::slotSetCategory( int c ) | 905 | void AddressbookWindow::slotSetCategory( int c ) |
906 | { | 906 | { |
907 | owarn << "void AddressbookWindow::slotSetCategory( " << c << " ) from " | 907 | odebug << "void AddressbookWindow::slotSetCategory( " << c << " ) from " |
908 | << catMenu->count() << oendl; | 908 | << catMenu->count() << oendl; |
909 | 909 | ||
910 | QString cat, book; | 910 | QString cat, book; |
911 | AbView::Views view = AbView::TableView; | 911 | AbView::Views view = AbView::TableView; |
912 | 912 | ||
913 | if ( c <= 0 ) | 913 | if ( c <= 0 ) |
914 | return; | 914 | return; |
915 | 915 | ||
916 | // Switch view | 916 | // Switch view |
917 | if ( c < 3 ) | 917 | if ( c < 3 ) |
918 | for ( unsigned int i = 1; i < 3; i++ ){ | 918 | for ( unsigned int i = 1; i < 3; i++ ){ |
919 | if ( catMenu ) | 919 | if ( catMenu ) |
920 | catMenu->setItemChecked( i, c == (int)i ); | 920 | catMenu->setItemChecked( i, c == (int)i ); |
921 | } | 921 | } |
922 | else | 922 | else |
923 | // Checkmark Category Menu Item Selected | 923 | // Checkmark Category Menu Item Selected |
924 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) | 924 | for ( unsigned int i = 3; i < catMenu->count(); i++ ) |
925 | catMenu->setItemChecked( i, c == (int)i ); | 925 | catMenu->setItemChecked( i, c == (int)i ); |
926 | 926 | ||
927 | // Now switch to the selected category | 927 | // Now switch to the selected category |
928 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { | 928 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
929 | if (catMenu->isItemChecked( i )) { | 929 | if (catMenu->isItemChecked( i )) { |
930 | if ( i == 1 ){ // default List view | 930 | if ( i == 1 ){ // default List view |
931 | book = QString::null; | 931 | book = QString::null; |
932 | view = AbView::TableView; | 932 | view = AbView::TableView; |
933 | }else if ( i == 2 ){ | 933 | }else if ( i == 2 ){ |
934 | book = tr( "Cards" ); | 934 | book = tr( "Cards" ); |
935 | view = AbView::CardView; | 935 | view = AbView::CardView; |
936 | // }else if ( i == 3 ){ | 936 | // }else if ( i == 3 ){ |
937 | // book = tr( "Personal" ); | 937 | // book = tr( "Personal" ); |
938 | // view = AbView:: PersonalView; | 938 | // view = AbView:: PersonalView; |
939 | }else if ( i == 3 ){ // default All Categories | 939 | }else if ( i == 3 ){ // default All Categories |
940 | cat = QString::null; | 940 | cat = QString::null; |
941 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled | 941 | }else if ( i == (unsigned int)catMenu->count() - 1 ){ // last menu option (seperator is counted, too) will be Unfiled |
942 | cat = "Unfiled"; | 942 | cat = "Unfiled"; |
943 | owarn << "Unfiled selected!" << oendl; | 943 | odebug << "Unfiled selected!" << oendl; |
944 | }else{ | 944 | }else{ |
945 | cat = m_abView->categories()[i - 4]; | 945 | cat = m_abView->categories()[i - 4]; |
946 | } | 946 | } |
947 | } | 947 | } |
948 | } | 948 | } |
949 | 949 | ||
950 | // Switch to the selected View | 950 | // Switch to the selected View |
951 | slotViewSwitched( view ); | 951 | slotViewSwitched( view ); |
952 | 952 | ||
953 | // Tell the view about the selected category | 953 | // Tell the view about the selected category |
954 | m_abView -> setShowByCategory( cat ); | 954 | m_abView -> setShowByCategory( cat ); |
955 | 955 | ||
956 | if ( book.isEmpty() ) | 956 | if ( book.isEmpty() ) |
957 | book = "List"; | 957 | book = "List"; |
958 | if ( cat.isEmpty() ) | 958 | if ( cat.isEmpty() ) |
959 | cat = "All"; | 959 | cat = "All"; |
960 | 960 | ||
961 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); | 961 | setCaption( tr( "Contacts" ) + " - " + book + " - " + tr( cat ) ); |
962 | } | 962 | } |
963 | 963 | ||
964 | void AddressbookWindow::slotViewSwitched( int view ) | 964 | void AddressbookWindow::slotViewSwitched( int view ) |
965 | { | 965 | { |
966 | owarn << "void AddressbookWindow::slotViewSwitched( " << view << " )" << oendl; | 966 | odebug << "void AddressbookWindow::slotViewSwitched( " << view << " )" << oendl; |
967 | int menu = 0; | 967 | int menu = 0; |
968 | 968 | ||
969 | // Switch to selected view | 969 | // Switch to selected view |
970 | switch ( view ){ | 970 | switch ( view ){ |
971 | case AbView::TableView: | 971 | case AbView::TableView: |
972 | menu = 1; | 972 | menu = 1; |
973 | m_tableViewButton->setOn(true); | 973 | m_tableViewButton->setOn(true); |
974 | m_cardViewButton->setOn(false); | 974 | m_cardViewButton->setOn(false); |
975 | break; | 975 | break; |
976 | case AbView::CardView: | 976 | case AbView::CardView: |
977 | menu = 2; | 977 | menu = 2; |
978 | m_tableViewButton->setOn(false); | 978 | m_tableViewButton->setOn(false); |
979 | m_cardViewButton->setOn(true); | 979 | m_cardViewButton->setOn(true); |
980 | break; | 980 | break; |
981 | } | 981 | } |
982 | for ( unsigned int i = 1; i < 3; i++ ){ | 982 | for ( unsigned int i = 1; i < 3; i++ ){ |
983 | if ( catMenu ) | 983 | if ( catMenu ) |
984 | catMenu->setItemChecked( i, menu == (int)i ); | 984 | catMenu->setItemChecked( i, menu == (int)i ); |
985 | } | 985 | } |
986 | 986 | ||
987 | // Tell the view about the selected view | 987 | // Tell the view about the selected view |
988 | m_abView -> setShowToView ( (AbView::Views) view ); | 988 | m_abView -> setShowToView ( (AbView::Views) view ); |
989 | active_view = view; | 989 | active_view = view; |
990 | } | 990 | } |
991 | 991 | ||
992 | 992 | ||
993 | void AddressbookWindow::slotListView() | 993 | void AddressbookWindow::slotListView() |
994 | { | 994 | { |
995 | slotViewSwitched( AbView::TableView ); | 995 | slotViewSwitched( AbView::TableView ); |
996 | } | 996 | } |
997 | 997 | ||
998 | void AddressbookWindow::slotCardView() | 998 | void AddressbookWindow::slotCardView() |
999 | { | 999 | { |
1000 | slotViewSwitched( AbView::CardView ); | 1000 | slotViewSwitched( AbView::CardView ); |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | void AddressbookWindow::slotSetLetter( char c ) { | 1003 | void AddressbookWindow::slotSetLetter( char c ) { |
1004 | 1004 | ||
1005 | m_abView->setShowByLetter( c, m_config.letterPickerSearch() ); | 1005 | m_abView->setShowByLetter( c, m_config.letterPickerSearch() ); |
1006 | 1006 | ||
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | 1009 | ||
1010 | void AddressbookWindow::populateCategories() | 1010 | void AddressbookWindow::populateCategories() |
1011 | { | 1011 | { |
1012 | catMenu->clear(); | 1012 | catMenu->clear(); |
1013 | 1013 | ||
1014 | int id, rememberId; | 1014 | int id, rememberId; |
1015 | id = 1; | 1015 | id = 1; |
1016 | rememberId = 0; | 1016 | rememberId = 0; |
1017 | 1017 | ||
1018 | catMenu->insertItem( Resource::loadPixmap( "addressbook/listview" ), tr( "List" ), id++ ); | 1018 | catMenu->insertItem( Resource::loadPixmap( "addressbook/listview" ), tr( "List" ), id++ ); |
1019 | catMenu->insertItem( Resource::loadPixmap( "addressbook/cardview" ), tr( "Cards" ), id++ ); | 1019 | catMenu->insertItem( Resource::loadPixmap( "addressbook/cardview" ), tr( "Cards" ), id++ ); |
1020 | // catMenu->insertItem( tr( "Personal" ), id++ ); | 1020 | // catMenu->insertItem( tr( "Personal" ), id++ ); |
1021 | catMenu->insertSeparator(); | 1021 | catMenu->insertSeparator(); |
1022 | 1022 | ||
1023 | catMenu->insertItem( tr( "All" ), id++ ); | 1023 | catMenu->insertItem( tr( "All" ), id++ ); |
1024 | QStringList categories = m_abView->categories(); | 1024 | QStringList categories = m_abView->categories(); |
1025 | categories.append( tr( "Unfiled" ) ); | 1025 | categories.append( tr( "Unfiled" ) ); |
1026 | for ( QStringList::Iterator it = categories.begin(); | 1026 | for ( QStringList::Iterator it = categories.begin(); |
1027 | it != categories.end(); ++it ) { | 1027 | it != categories.end(); ++it ) { |
1028 | catMenu->insertItem( *it, id ); | 1028 | catMenu->insertItem( *it, id ); |
1029 | if ( *it == m_abView -> showCategory() ) | 1029 | if ( *it == m_abView -> showCategory() ) |
1030 | rememberId = id; | 1030 | rememberId = id; |
1031 | ++id; | 1031 | ++id; |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | 1034 | ||
1035 | if ( m_abView -> showCategory().isEmpty() ) { | 1035 | if ( m_abView -> showCategory().isEmpty() ) { |
1036 | slotSetCategory( 3 ); | 1036 | slotSetCategory( 3 ); |
1037 | } | 1037 | } |
1038 | else { | 1038 | else { |
1039 | slotSetCategory( rememberId ); | 1039 | slotSetCategory( rememberId ); |
1040 | } | 1040 | } |
1041 | } | 1041 | } |
1042 | 1042 | ||
diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp index 22f7291..61e6c7e 100644 --- a/core/pim/addressbook/configdlg.cpp +++ b/core/pim/addressbook/configdlg.cpp | |||
@@ -1,154 +1,154 @@ | |||
1 | #include "configdlg.h" | 1 | #include "configdlg.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | #include <opie2/opimcontact.h> | 4 | #include <opie2/opimcontact.h> |
5 | #include "opie2/opimcontactfields.h" | 5 | #include "opie2/opimcontactfields.h" |
6 | 6 | ||
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | 8 | ||
9 | #include <qcheckbox.h> | 9 | #include <qcheckbox.h> |
10 | #include <qradiobutton.h> | 10 | #include <qradiobutton.h> |
11 | #include <qlistbox.h> | 11 | #include <qlistbox.h> |
12 | #include <qpushbutton.h> | 12 | #include <qpushbutton.h> |
13 | 13 | ||
14 | ConfigDlg::ConfigDlg( QWidget *parent, const char *name): | 14 | ConfigDlg::ConfigDlg( QWidget *parent, const char *name): |
15 | ConfigDlg_Base(parent, name, true ) | 15 | ConfigDlg_Base(parent, name, true ) |
16 | { | 16 | { |
17 | contFields = Opie::OPimContactFields::trfields(); | 17 | contFields = Opie::OPimContactFields::trfields(); |
18 | 18 | ||
19 | // We add all Fields into the Listbox | 19 | // We add all Fields into the Listbox |
20 | for (uint i=0; i < contFields.count(); i++) { | 20 | for (uint i=0; i < contFields.count(); i++) { |
21 | allFieldListBox->insertItem( contFields[i] ); | 21 | allFieldListBox->insertItem( contFields[i] ); |
22 | } | 22 | } |
23 | 23 | ||
24 | // Reset Widget Flags: This was not changeable by designer :( | 24 | // Reset Widget Flags: This was not changeable by designer :( |
25 | setWFlags ( WStyle_ContextHelp ); | 25 | setWFlags ( WStyle_ContextHelp ); |
26 | 26 | ||
27 | // Set Pics to Buttons and Tabs | 27 | // Set Pics to Buttons and Tabs |
28 | m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) ); | 28 | m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) ); |
29 | m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) ); | 29 | m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) ); |
30 | m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) ); | 30 | m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) ); |
31 | m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) ); | 31 | m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) ); |
32 | 32 | ||
33 | 33 | ||
34 | // Get the translation maps between Field ID and translated strings | 34 | // Get the translation maps between Field ID and translated strings |
35 | m_mapStrToID = Opie::OPimContactFields::trFieldsToId(); | 35 | m_mapStrToID = Opie::OPimContactFields::trFieldsToId(); |
36 | m_mapIDToStr = Opie::OPimContactFields::idToTrFields(); | 36 | m_mapIDToStr = Opie::OPimContactFields::idToTrFields(); |
37 | 37 | ||
38 | connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); | 38 | connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); |
39 | connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); | 39 | connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); |
40 | connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); | 40 | connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); |
41 | connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); | 41 | connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); |
42 | } | 42 | } |
43 | 43 | ||
44 | void ConfigDlg::slotItemUp() | 44 | void ConfigDlg::slotItemUp() |
45 | { | 45 | { |
46 | owarn << "void ConfigDlg::slotItemUp()" << oendl; | 46 | odebug << "void ConfigDlg::slotItemUp()" << oendl; |
47 | 47 | ||
48 | int i = fieldListBox->currentItem(); | 48 | int i = fieldListBox->currentItem(); |
49 | if ( i > 0 ) { | 49 | if ( i > 0 ) { |
50 | QString item = fieldListBox->currentText(); | 50 | QString item = fieldListBox->currentText(); |
51 | fieldListBox->removeItem( i ); | 51 | fieldListBox->removeItem( i ); |
52 | fieldListBox->insertItem( item, i-1 ); | 52 | fieldListBox->insertItem( item, i-1 ); |
53 | fieldListBox->setCurrentItem( i-1 ); | 53 | fieldListBox->setCurrentItem( i-1 ); |
54 | } | 54 | } |
55 | 55 | ||
56 | } | 56 | } |
57 | 57 | ||
58 | void ConfigDlg::slotItemDown() | 58 | void ConfigDlg::slotItemDown() |
59 | { | 59 | { |
60 | owarn << "void ConfigDlg::slotItemDown()" << oendl; | 60 | odebug << "void ConfigDlg::slotItemDown()" << oendl; |
61 | 61 | ||
62 | int i = fieldListBox->currentItem(); | 62 | int i = fieldListBox->currentItem(); |
63 | if ( i < (int)fieldListBox->count() - 1 ) { | 63 | if ( i < (int)fieldListBox->count() - 1 ) { |
64 | QString item = fieldListBox->currentText(); | 64 | QString item = fieldListBox->currentText(); |
65 | fieldListBox->removeItem( i ); | 65 | fieldListBox->removeItem( i ); |
66 | fieldListBox->insertItem( item, i+1 ); | 66 | fieldListBox->insertItem( item, i+1 ); |
67 | fieldListBox->setCurrentItem( i+1 ); | 67 | fieldListBox->setCurrentItem( i+1 ); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | void ConfigDlg::slotItemAdd() | 71 | void ConfigDlg::slotItemAdd() |
72 | { | 72 | { |
73 | owarn << "void ConfigDlg::slotItemAdd()" << oendl; | 73 | odebug << "void ConfigDlg::slotItemAdd()" << oendl; |
74 | 74 | ||
75 | int i = allFieldListBox->currentItem(); | 75 | int i = allFieldListBox->currentItem(); |
76 | if ( i > 0 ) { | 76 | if ( i > 0 ) { |
77 | QString item = allFieldListBox->currentText(); | 77 | QString item = allFieldListBox->currentText(); |
78 | owarn << "Adding " << item << oendl; | 78 | odebug << "Adding " << item << oendl; |
79 | fieldListBox->insertItem( item ); | 79 | fieldListBox->insertItem( item ); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | void ConfigDlg::slotItemRemove() | 83 | void ConfigDlg::slotItemRemove() |
84 | { | 84 | { |
85 | owarn << "void ConfigDlg::slotItemRemove()" << oendl; | 85 | odebug << "void ConfigDlg::slotItemRemove()" << oendl; |
86 | 86 | ||
87 | int i = fieldListBox->currentItem(); | 87 | int i = fieldListBox->currentItem(); |
88 | if ( i > 0 ) { | 88 | if ( i > 0 ) { |
89 | fieldListBox->removeItem( i ); | 89 | fieldListBox->removeItem( i ); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | void ConfigDlg::setConfig( const AbConfig& cnf ) | 93 | void ConfigDlg::setConfig( const AbConfig& cnf ) |
94 | { | 94 | { |
95 | m_config = cnf; | 95 | m_config = cnf; |
96 | 96 | ||
97 | m_useRegExp->setChecked( m_config.useRegExp() ); | 97 | m_useRegExp->setChecked( m_config.useRegExp() ); |
98 | m_useWildCard->setChecked( m_config.useWildCards() ); | 98 | m_useWildCard->setChecked( m_config.useWildCards() ); |
99 | m_useQtMail->setChecked( m_config.useQtMail() ); | 99 | m_useQtMail->setChecked( m_config.useQtMail() ); |
100 | m_useOpieMail->setChecked( m_config.useOpieMail() ); | 100 | m_useOpieMail->setChecked( m_config.useOpieMail() ); |
101 | m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); | 101 | m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); |
102 | 102 | ||
103 | switch( m_config.fontSize() ){ | 103 | switch( m_config.fontSize() ){ |
104 | case 0: | 104 | case 0: |
105 | m_smallFont->setChecked( true ); | 105 | m_smallFont->setChecked( true ); |
106 | m_normalFont->setChecked( false ); | 106 | m_normalFont->setChecked( false ); |
107 | m_largeFont->setChecked( false ); | 107 | m_largeFont->setChecked( false ); |
108 | break; | 108 | break; |
109 | case 1: | 109 | case 1: |
110 | m_smallFont->setChecked( false ); | 110 | m_smallFont->setChecked( false ); |
111 | m_normalFont->setChecked( true ); | 111 | m_normalFont->setChecked( true ); |
112 | m_largeFont->setChecked( false ); | 112 | m_largeFont->setChecked( false ); |
113 | break; | 113 | break; |
114 | case 2: | 114 | case 2: |
115 | m_smallFont->setChecked( false ); | 115 | m_smallFont->setChecked( false ); |
116 | m_normalFont->setChecked( false ); | 116 | m_normalFont->setChecked( false ); |
117 | m_largeFont->setChecked( true ); | 117 | m_largeFont->setChecked( true ); |
118 | break; | 118 | break; |
119 | } | 119 | } |
120 | 120 | ||
121 | for( uint i = 0; i < m_config.orderList().count(); i++ ) { | 121 | for( uint i = 0; i < m_config.orderList().count(); i++ ) { |
122 | fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); | 122 | fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); |
123 | } | 123 | } |
124 | 124 | ||
125 | m_fixedBars->setChecked( m_config.fixedBars() ); | 125 | m_fixedBars->setChecked( m_config.fixedBars() ); |
126 | m_moveBars->setChecked( !m_config.fixedBars() ); | 126 | m_moveBars->setChecked( !m_config.fixedBars() ); |
127 | } | 127 | } |
128 | 128 | ||
129 | AbConfig ConfigDlg::getConfig() | 129 | AbConfig ConfigDlg::getConfig() |
130 | { | 130 | { |
131 | m_config.setUseRegExp( m_useRegExp->isOn() ); | 131 | m_config.setUseRegExp( m_useRegExp->isOn() ); |
132 | m_config.setUseWildCards( m_useWildCard->isOn() ); | 132 | m_config.setUseWildCards( m_useWildCard->isOn() ); |
133 | m_config.setUseQtMail( m_useQtMail->isOn() ); | 133 | m_config.setUseQtMail( m_useQtMail->isOn() ); |
134 | m_config.setUseOpieMail( m_useOpieMail->isOn() ); | 134 | m_config.setUseOpieMail( m_useOpieMail->isOn() ); |
135 | m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); | 135 | m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); |
136 | 136 | ||
137 | if ( m_smallFont->isChecked() ) | 137 | if ( m_smallFont->isChecked() ) |
138 | m_config.setFontSize( 0 ); | 138 | m_config.setFontSize( 0 ); |
139 | if ( m_normalFont->isChecked() ) | 139 | if ( m_normalFont->isChecked() ) |
140 | m_config.setFontSize( 1 ); | 140 | m_config.setFontSize( 1 ); |
141 | if ( m_largeFont->isChecked() ) | 141 | if ( m_largeFont->isChecked() ) |
142 | m_config.setFontSize( 2 ); | 142 | m_config.setFontSize( 2 ); |
143 | 143 | ||
144 | QValueList<int> orderlist; | 144 | QValueList<int> orderlist; |
145 | for( int i = 0; i < (int)fieldListBox->count(); i++ ) { | 145 | for( int i = 0; i < (int)fieldListBox->count(); i++ ) { |
146 | orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); | 146 | orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); |
147 | } | 147 | } |
148 | m_config.setOrderList( orderlist ); | 148 | m_config.setOrderList( orderlist ); |
149 | 149 | ||
150 | m_config.setFixedBars( m_fixedBars->isChecked() ); | 150 | m_config.setFixedBars( m_fixedBars->isChecked() ); |
151 | 151 | ||
152 | return m_config; | 152 | return m_config; |
153 | } | 153 | } |
154 | 154 | ||
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 312c663..b078968 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1,1752 +1,1752 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) | 3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) |
4 | * | 4 | * |
5 | * This file is an add-on for the OPIE Palmtop Environment | 5 | * This file is an add-on for the OPIE Palmtop Environment |
6 | * | 6 | * |
7 | * This file may be distributed and/or modified under the terms of the | 7 | * This file may be distributed and/or modified under the terms of the |
8 | * GNU General Public License version 2 as published by the Free Software | 8 | * GNU General Public License version 2 as published by the Free Software |
9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
10 | * of this file. | 10 | * of this file. |
11 | * | 11 | * |
12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | * | 14 | * |
15 | * | 15 | * |
16 | * This is a rewrite of the abeditor.h file, modified to provide a more | 16 | * This is a rewrite of the abeditor.h file, modified to provide a more |
17 | * intuitive interface to TrollTech's original Address Book editor. This | 17 | * intuitive interface to TrollTech's original Address Book editor. This |
18 | * is made to operate exactly in interface with the exception of name. | 18 | * is made to operate exactly in interface with the exception of name. |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "contacteditor.h" | 22 | #include "contacteditor.h" |
23 | #include "namelineedit.h" | 23 | #include "namelineedit.h" |
24 | 24 | ||
25 | #include <opie2/odebug.h> | 25 | #include <opie2/odebug.h> |
26 | #include <opie2/opimcontact.h> | 26 | #include <opie2/opimcontact.h> |
27 | 27 | ||
28 | #include <qpe/categoryselect.h> | 28 | #include <qpe/categoryselect.h> |
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/qpedialog.h> | 30 | #include <qpe/qpedialog.h> |
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | 32 | ||
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qtabwidget.h> | 34 | #include <qtabwidget.h> |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | #include <qmultilineedit.h> | 37 | #include <qmultilineedit.h> |
38 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
39 | #include <qlistbox.h> | 39 | #include <qlistbox.h> |
40 | #include <qmessagebox.h> | 40 | #include <qmessagebox.h> |
41 | #include <qwhatsthis.h> | 41 | #include <qwhatsthis.h> |
42 | 42 | ||
43 | #include <assert.h> | 43 | #include <assert.h> |
44 | 44 | ||
45 | static inline bool containsAlphaNum( const QString &str ); | 45 | static inline bool containsAlphaNum( const QString &str ); |
46 | static inline bool constainsWhiteSpace( const QString &str ); | 46 | static inline bool constainsWhiteSpace( const QString &str ); |
47 | 47 | ||
48 | // helper functions, convert our comma delimited list to proper | 48 | // helper functions, convert our comma delimited list to proper |
49 | // file format... | 49 | // file format... |
50 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 50 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
51 | QString &strAll ); | 51 | QString &strAll ); |
52 | 52 | ||
53 | // helper convert from file format to comma delimited... | 53 | // helper convert from file format to comma delimited... |
54 | void parseEmailTo( const QString &strDefaultEmail, | 54 | void parseEmailTo( const QString &strDefaultEmail, |
55 | const QString &strOtherEmail, QString &strBack ); | 55 | const QString &strOtherEmail, QString &strBack ); |
56 | 56 | ||
57 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, | 57 | ContactEditor::ContactEditor(const Opie::OPimContact &entry, |
58 | QWidget *parent, | 58 | QWidget *parent, |
59 | const char *name, | 59 | const char *name, |
60 | WFlags ) | 60 | WFlags ) |
61 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), | 61 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), |
62 | defaultEmailChooserPosition( -1 ), | 62 | defaultEmailChooserPosition( -1 ), |
63 | m_personalView ( false ), | 63 | m_personalView ( false ), |
64 | cmbDefaultEmail( 0 ), | 64 | cmbDefaultEmail( 0 ), |
65 | initializing ( false ) | 65 | initializing ( false ) |
66 | { | 66 | { |
67 | 67 | ||
68 | initializing = true; | 68 | initializing = true; |
69 | 69 | ||
70 | init(); | 70 | init(); |
71 | setEntry( entry ); | 71 | setEntry( entry ); |
72 | // cmbDefaultEmail = 0; | 72 | // cmbDefaultEmail = 0; |
73 | // defaultEmailChooserPosition = -1; | 73 | // defaultEmailChooserPosition = -1; |
74 | 74 | ||
75 | initializing = false; | 75 | initializing = false; |
76 | } | 76 | } |
77 | 77 | ||
78 | ContactEditor::~ContactEditor() { | 78 | ContactEditor::~ContactEditor() { |
79 | } | 79 | } |
80 | 80 | ||
81 | void ContactEditor::init() { | 81 | void ContactEditor::init() { |
82 | owarn << "init() START" << oendl; | 82 | odebug << "init() START" << oendl; |
83 | 83 | ||
84 | uint i = 0; | 84 | uint i = 0; |
85 | 85 | ||
86 | QStringList trlChooserNames; | 86 | QStringList trlChooserNames; |
87 | 87 | ||
88 | for (i = 0; i <= 6; i++) { | 88 | for (i = 0; i <= 6; i++) { |
89 | slHomeAddress.append( "" ); | 89 | slHomeAddress.append( "" ); |
90 | slBusinessAddress.append( "" ); | 90 | slBusinessAddress.append( "" ); |
91 | } | 91 | } |
92 | 92 | ||
93 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); | 93 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); |
94 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); | 94 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); |
95 | slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); | 95 | slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); |
96 | trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); | 96 | trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); |
97 | 97 | ||
98 | // Ok, we have to remove elements from the list of dynamic entries | 98 | // Ok, we have to remove elements from the list of dynamic entries |
99 | // which are now stored in special (not dynamic) widgets.. | 99 | // which are now stored in special (not dynamic) widgets.. |
100 | // Otherwise we will get problems with field assignments! (se) | 100 | // Otherwise we will get problems with field assignments! (se) |
101 | slDynamicEntries.remove("Anniversary"); | 101 | slDynamicEntries.remove("Anniversary"); |
102 | slDynamicEntries.remove("Birthday"); | 102 | slDynamicEntries.remove("Birthday"); |
103 | slDynamicEntries.remove("Gender"); | 103 | slDynamicEntries.remove("Gender"); |
104 | 104 | ||
105 | // The same with translated fields.. But I will | 105 | // The same with translated fields.. But I will |
106 | // use the translation map to avoid mismatches.. | 106 | // use the translation map to avoid mismatches.. |
107 | QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields(); | 107 | QMap<int, QString> translMap = Opie::OPimContactFields::idToTrFields(); |
108 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); | 108 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); |
109 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); | 109 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); |
110 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 110 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
111 | 111 | ||
112 | // Last Check to be sure.. | 112 | // Last Check to be sure.. |
113 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 113 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
114 | assert( slChooserNames.count() == trlChooserNames.count() ); | 114 | assert( slChooserNames.count() == trlChooserNames.count() ); |
115 | 115 | ||
116 | for (i = 0; i < slChooserNames.count(); i++) | 116 | for (i = 0; i < slChooserNames.count(); i++) |
117 | slChooserValues.append(""); | 117 | slChooserValues.append(""); |
118 | 118 | ||
119 | 119 | ||
120 | QVBoxLayout *vb = new QVBoxLayout( this ); | 120 | QVBoxLayout *vb = new QVBoxLayout( this ); |
121 | 121 | ||
122 | tabMain = new QTabWidget( this ); | 122 | tabMain = new QTabWidget( this ); |
123 | vb->addWidget( tabMain ); | 123 | vb->addWidget( tabMain ); |
124 | 124 | ||
125 | QWidget *tabViewport = new QWidget ( tabMain ); | 125 | QWidget *tabViewport = new QWidget ( tabMain ); |
126 | 126 | ||
127 | vb = new QVBoxLayout( tabViewport ); | 127 | vb = new QVBoxLayout( tabViewport ); |
128 | 128 | ||
129 | svGeneral = new QScrollView( tabViewport ); | 129 | svGeneral = new QScrollView( tabViewport ); |
130 | vb->addWidget( svGeneral, 0, 0 ); | 130 | vb->addWidget( svGeneral, 0, 0 ); |
131 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 131 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
132 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); | 132 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); |
133 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); | 133 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); |
134 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 134 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
135 | 135 | ||
136 | QWidget *container = new QWidget( svGeneral->viewport() ); | 136 | QWidget *container = new QWidget( svGeneral->viewport() ); |
137 | svGeneral->addChild( container ); | 137 | svGeneral->addChild( container ); |
138 | 138 | ||
139 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 139 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); |
140 | gl->setResizeMode( QLayout::FreeResize ); | 140 | gl->setResizeMode( QLayout::FreeResize ); |
141 | 141 | ||
142 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 142 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
143 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); | 143 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); |
144 | gl->addWidget( btnFullName, 0, 0 ); | 144 | gl->addWidget( btnFullName, 0, 0 ); |
145 | txtFullName = new ABOOK::NameLineEdit( container ); | 145 | txtFullName = new ABOOK::NameLineEdit( container ); |
146 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); | 146 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); |
147 | gl->addWidget( txtFullName, 0, 1 ); | 147 | gl->addWidget( txtFullName, 0, 1 ); |
148 | 148 | ||
149 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 149 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
150 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); | 150 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); |
151 | gl->addWidget( l, 1, 0 ); | 151 | gl->addWidget( l, 1, 0 ); |
152 | txtJobTitle = new QLineEdit( container ); | 152 | txtJobTitle = new QLineEdit( container ); |
153 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); | 153 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); |
154 | gl->addWidget( txtJobTitle, 1, 1 ); | 154 | gl->addWidget( txtJobTitle, 1, 1 ); |
155 | 155 | ||
156 | l = new QLabel( tr("Suffix"), container ); | 156 | l = new QLabel( tr("Suffix"), container ); |
157 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); | 157 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); |
158 | gl->addWidget( l, 2, 0 ); | 158 | gl->addWidget( l, 2, 0 ); |
159 | txtSuffix = new QLineEdit( container ); | 159 | txtSuffix = new QLineEdit( container ); |
160 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); | 160 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); |
161 | gl->addWidget( txtSuffix, 2, 1 ); | 161 | gl->addWidget( txtSuffix, 2, 1 ); |
162 | 162 | ||
163 | l = new QLabel( tr( "Organization" ), container ); | 163 | l = new QLabel( tr( "Organization" ), container ); |
164 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); | 164 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); |
165 | gl->addWidget( l, 3, 0 ); | 165 | gl->addWidget( l, 3, 0 ); |
166 | txtOrganization = new QLineEdit( container ); | 166 | txtOrganization = new QLineEdit( container ); |
167 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); | 167 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); |
168 | gl->addWidget( txtOrganization, 3, 1 ); | 168 | gl->addWidget( txtOrganization, 3, 1 ); |
169 | 169 | ||
170 | // Chooser 1 | 170 | // Chooser 1 |
171 | cmbChooserField1 = new QComboBox( FALSE, container ); | 171 | cmbChooserField1 = new QComboBox( FALSE, container ); |
172 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); | 172 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); |
173 | cmbChooserField1->setMaximumWidth( 90 ); | 173 | cmbChooserField1->setMaximumWidth( 90 ); |
174 | gl->addWidget( cmbChooserField1, 4, 0 ); | 174 | gl->addWidget( cmbChooserField1, 4, 0 ); |
175 | // Textfield for chooser 1. | 175 | // Textfield for chooser 1. |
176 | // Now use Widgetstack to contain the textfield and the default-email combo ! | 176 | // Now use Widgetstack to contain the textfield and the default-email combo ! |
177 | m_widgetStack1 = new QWidgetStack( container ); | 177 | m_widgetStack1 = new QWidgetStack( container ); |
178 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); | 178 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); |
179 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); | 179 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); |
180 | gl->addWidget( m_widgetStack1, 4, 1 ); | 180 | gl->addWidget( m_widgetStack1, 4, 1 ); |
181 | m_widgetStack1 -> raiseWidget( TextField ); | 181 | m_widgetStack1 -> raiseWidget( TextField ); |
182 | 182 | ||
183 | // Chooser 2 | 183 | // Chooser 2 |
184 | cmbChooserField2 = new QComboBox( FALSE, container ); | 184 | cmbChooserField2 = new QComboBox( FALSE, container ); |
185 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); | 185 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); |
186 | cmbChooserField2->setMaximumWidth( 90 ); | 186 | cmbChooserField2->setMaximumWidth( 90 ); |
187 | gl->addWidget( cmbChooserField2, 5, 0 ); | 187 | gl->addWidget( cmbChooserField2, 5, 0 ); |
188 | // Textfield for chooser 2 | 188 | // Textfield for chooser 2 |
189 | // Now use WidgetStack to contain the textfield and the default-email combo! | 189 | // Now use WidgetStack to contain the textfield and the default-email combo! |
190 | m_widgetStack2 = new QWidgetStack( container ); | 190 | m_widgetStack2 = new QWidgetStack( container ); |
191 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); | 191 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); |
192 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); | 192 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); |
193 | gl->addWidget( m_widgetStack2, 5, 1 ); | 193 | gl->addWidget( m_widgetStack2, 5, 1 ); |
194 | m_widgetStack2 -> raiseWidget( TextField ); | 194 | m_widgetStack2 -> raiseWidget( TextField ); |
195 | 195 | ||
196 | // Chooser 3 | 196 | // Chooser 3 |
197 | cmbChooserField3 = new QComboBox( FALSE, container ); | 197 | cmbChooserField3 = new QComboBox( FALSE, container ); |
198 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); | 198 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); |
199 | cmbChooserField3->setMaximumWidth( 90 ); | 199 | cmbChooserField3->setMaximumWidth( 90 ); |
200 | gl->addWidget( cmbChooserField3, 6, 0 ); | 200 | gl->addWidget( cmbChooserField3, 6, 0 ); |
201 | // Textfield for chooser 2 | 201 | // Textfield for chooser 2 |
202 | // Now use WidgetStack to contain the textfield and the default-email combo! | 202 | // Now use WidgetStack to contain the textfield and the default-email combo! |
203 | m_widgetStack3 = new QWidgetStack( container ); | 203 | m_widgetStack3 = new QWidgetStack( container ); |
204 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); | 204 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); |
205 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); | 205 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); |
206 | gl->addWidget( m_widgetStack3, 6, 1 ); | 206 | gl->addWidget( m_widgetStack3, 6, 1 ); |
207 | m_widgetStack3 -> raiseWidget( TextField ); | 207 | m_widgetStack3 -> raiseWidget( TextField ); |
208 | 208 | ||
209 | l = new QLabel( tr( "File As" ), container ); | 209 | l = new QLabel( tr( "File As" ), container ); |
210 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); | 210 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); |
211 | gl->addWidget( l, 7, 0 ); | 211 | gl->addWidget( l, 7, 0 ); |
212 | cmbFileAs = new QComboBox( TRUE, container ); | 212 | cmbFileAs = new QComboBox( TRUE, container ); |
213 | gl->addWidget( cmbFileAs, 7, 1 ); | 213 | gl->addWidget( cmbFileAs, 7, 1 ); |
214 | 214 | ||
215 | labCat = new QLabel( tr( "Category" ), container ); | 215 | labCat = new QLabel( tr( "Category" ), container ); |
216 | gl->addWidget( labCat, 8, 0 ); | 216 | gl->addWidget( labCat, 8, 0 ); |
217 | cmbCat = new CategorySelect( container ); | 217 | cmbCat = new CategorySelect( container ); |
218 | gl->addWidget( cmbCat, 8, 1 ); | 218 | gl->addWidget( cmbCat, 8, 1 ); |
219 | labCat->show(); | 219 | labCat->show(); |
220 | cmbCat->show(); | 220 | cmbCat->show(); |
221 | 221 | ||
222 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 222 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
223 | gl->addWidget( btnNote, 9, 1 ); | 223 | gl->addWidget( btnNote, 9, 1 ); |
224 | 224 | ||
225 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 225 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
226 | 226 | ||
227 | tabViewport = new QWidget ( tabMain ); | 227 | tabViewport = new QWidget ( tabMain ); |
228 | 228 | ||
229 | vb = new QVBoxLayout( tabViewport ); | 229 | vb = new QVBoxLayout( tabViewport ); |
230 | 230 | ||
231 | svAddress = new QScrollView( tabViewport ); | 231 | svAddress = new QScrollView( tabViewport ); |
232 | vb->addWidget( svAddress, 0, 0 ); | 232 | vb->addWidget( svAddress, 0, 0 ); |
233 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 233 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
234 | svAddress->setFrameStyle( QFrame::NoFrame ); | 234 | svAddress->setFrameStyle( QFrame::NoFrame ); |
235 | 235 | ||
236 | container = new QWidget( svAddress->viewport() ); | 236 | container = new QWidget( svAddress->viewport() ); |
237 | svAddress->addChild( container ); | 237 | svAddress->addChild( container ); |
238 | 238 | ||
239 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 239 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
240 | 240 | ||
241 | cmbAddress = new QComboBox( FALSE, container ); | 241 | cmbAddress = new QComboBox( FALSE, container ); |
242 | cmbAddress->insertItem( tr( "Business" ) ); | 242 | cmbAddress->insertItem( tr( "Business" ) ); |
243 | cmbAddress->insertItem( tr( "Home" ) ); | 243 | cmbAddress->insertItem( tr( "Home" ) ); |
244 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 244 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
245 | 245 | ||
246 | l = new QLabel( tr( "Address" ), container ); | 246 | l = new QLabel( tr( "Address" ), container ); |
247 | gl->addWidget( l, 1, 0 ); | 247 | gl->addWidget( l, 1, 0 ); |
248 | txtAddress = new QLineEdit( container ); | 248 | txtAddress = new QLineEdit( container ); |
249 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 249 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
250 | 250 | ||
251 | l = new QLabel( tr( "City" ), container ); | 251 | l = new QLabel( tr( "City" ), container ); |
252 | gl->addWidget( l, 2, 0 ); | 252 | gl->addWidget( l, 2, 0 ); |
253 | txtCity = new QLineEdit( container ); | 253 | txtCity = new QLineEdit( container ); |
254 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 254 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
255 | 255 | ||
256 | l = new QLabel( tr( "State" ), container ); | 256 | l = new QLabel( tr( "State" ), container ); |
257 | gl->addWidget( l, 3, 0 ); | 257 | gl->addWidget( l, 3, 0 ); |
258 | txtState = new QLineEdit( container ); | 258 | txtState = new QLineEdit( container ); |
259 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 259 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
260 | 260 | ||
261 | l = new QLabel( tr( "Zip Code" ), container ); | 261 | l = new QLabel( tr( "Zip Code" ), container ); |
262 | gl->addWidget( l, 4, 0 ); | 262 | gl->addWidget( l, 4, 0 ); |
263 | txtZip = new QLineEdit( container ); | 263 | txtZip = new QLineEdit( container ); |
264 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 264 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
265 | 265 | ||
266 | l = new QLabel( tr( "Country" ), container ); | 266 | l = new QLabel( tr( "Country" ), container ); |
267 | gl->addWidget( l, 5, 0 ); | 267 | gl->addWidget( l, 5, 0 ); |
268 | cmbCountry = new QComboBox( TRUE, container ); | 268 | cmbCountry = new QComboBox( TRUE, container ); |
269 | cmbCountry->insertItem( "" ); | 269 | cmbCountry->insertItem( "" ); |
270 | cmbCountry->insertItem( tr ( "United States" ) ); | 270 | cmbCountry->insertItem( tr ( "United States" ) ); |
271 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 271 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
272 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); | 272 | cmbCountry->insertItem( tr ( "Afghanistan" ) ); |
273 | cmbCountry->insertItem( tr ( "Albania" ) ); | 273 | cmbCountry->insertItem( tr ( "Albania" ) ); |
274 | cmbCountry->insertItem( tr ( "Algeria" ) ); | 274 | cmbCountry->insertItem( tr ( "Algeria" ) ); |
275 | cmbCountry->insertItem( tr ( "American Samoa" ) ); | 275 | cmbCountry->insertItem( tr ( "American Samoa" ) ); |
276 | cmbCountry->insertItem( tr ( "Andorra" ) ); | 276 | cmbCountry->insertItem( tr ( "Andorra" ) ); |
277 | cmbCountry->insertItem( tr ( "Angola" ) ); | 277 | cmbCountry->insertItem( tr ( "Angola" ) ); |
278 | cmbCountry->insertItem( tr ( "Anguilla" ) ); | 278 | cmbCountry->insertItem( tr ( "Anguilla" ) ); |
279 | cmbCountry->insertItem( tr ( "Antarctica" ) ); | 279 | cmbCountry->insertItem( tr ( "Antarctica" ) ); |
280 | cmbCountry->insertItem( tr ( "Argentina" ) ); | 280 | cmbCountry->insertItem( tr ( "Argentina" ) ); |
281 | cmbCountry->insertItem( tr ( "Armenia" ) ); | 281 | cmbCountry->insertItem( tr ( "Armenia" ) ); |
282 | cmbCountry->insertItem( tr ( "Aruba" ) ); | 282 | cmbCountry->insertItem( tr ( "Aruba" ) ); |
283 | cmbCountry->insertItem( tr ( "Australia" ) ); | 283 | cmbCountry->insertItem( tr ( "Australia" ) ); |
284 | cmbCountry->insertItem( tr ( "Austria" ) ); | 284 | cmbCountry->insertItem( tr ( "Austria" ) ); |
285 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); | 285 | cmbCountry->insertItem( tr ( "Azerbaijan" ) ); |
286 | cmbCountry->insertItem( tr ( "Bahamas" ) ); | 286 | cmbCountry->insertItem( tr ( "Bahamas" ) ); |
287 | cmbCountry->insertItem( tr ( "Bahrain" ) ); | 287 | cmbCountry->insertItem( tr ( "Bahrain" ) ); |
288 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); | 288 | cmbCountry->insertItem( tr ( "Bangladesh" ) ); |
289 | cmbCountry->insertItem( tr ( "Barbados" ) ); | 289 | cmbCountry->insertItem( tr ( "Barbados" ) ); |
290 | cmbCountry->insertItem( tr ( "Belarus" ) ); | 290 | cmbCountry->insertItem( tr ( "Belarus" ) ); |
291 | cmbCountry->insertItem( tr ( "Belgium" ) ); | 291 | cmbCountry->insertItem( tr ( "Belgium" ) ); |
292 | cmbCountry->insertItem( tr ( "Belize" ) ); | 292 | cmbCountry->insertItem( tr ( "Belize" ) ); |
293 | cmbCountry->insertItem( tr ( "Benin" ) ); | 293 | cmbCountry->insertItem( tr ( "Benin" ) ); |
294 | cmbCountry->insertItem( tr ( "Bermuda" ) ); | 294 | cmbCountry->insertItem( tr ( "Bermuda" ) ); |
295 | cmbCountry->insertItem( tr ( "Bhutan" ) ); | 295 | cmbCountry->insertItem( tr ( "Bhutan" ) ); |
296 | cmbCountry->insertItem( tr ( "Bolivia" ) ); | 296 | cmbCountry->insertItem( tr ( "Bolivia" ) ); |
297 | cmbCountry->insertItem( tr ( "Botswana" ) ); | 297 | cmbCountry->insertItem( tr ( "Botswana" ) ); |
298 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); | 298 | cmbCountry->insertItem( tr ( "Bouvet Island" ) ); |
299 | cmbCountry->insertItem( tr ( "Brazil" ) ); | 299 | cmbCountry->insertItem( tr ( "Brazil" ) ); |
300 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); | 300 | cmbCountry->insertItem( tr ( "Brunei Darussalam" ) ); |
301 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); | 301 | cmbCountry->insertItem( tr ( "Bulgaria" ) ); |
302 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); | 302 | cmbCountry->insertItem( tr ( "Burkina Faso" ) ); |
303 | cmbCountry->insertItem( tr ( "Burundi" ) ); | 303 | cmbCountry->insertItem( tr ( "Burundi" ) ); |
304 | cmbCountry->insertItem( tr ( "Cambodia" ) ); | 304 | cmbCountry->insertItem( tr ( "Cambodia" ) ); |
305 | cmbCountry->insertItem( tr ( "Cameroon" ) ); | 305 | cmbCountry->insertItem( tr ( "Cameroon" ) ); |
306 | cmbCountry->insertItem( tr ( "Canada" ) ); | 306 | cmbCountry->insertItem( tr ( "Canada" ) ); |
307 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); | 307 | cmbCountry->insertItem( tr ( "Cape Verde" ) ); |
308 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); | 308 | cmbCountry->insertItem( tr ( "Cayman Islands" ) ); |
309 | cmbCountry->insertItem( tr ( "Chad" ) ); | 309 | cmbCountry->insertItem( tr ( "Chad" ) ); |
310 | cmbCountry->insertItem( tr ( "Chile" ) ); | 310 | cmbCountry->insertItem( tr ( "Chile" ) ); |
311 | cmbCountry->insertItem( tr ( "China" ) ); | 311 | cmbCountry->insertItem( tr ( "China" ) ); |
312 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); | 312 | cmbCountry->insertItem( tr ( "Christmas Island" ) ); |
313 | cmbCountry->insertItem( tr ( "Colombia" ) ); | 313 | cmbCountry->insertItem( tr ( "Colombia" ) ); |
314 | cmbCountry->insertItem( tr ( "Comoros" ) ); | 314 | cmbCountry->insertItem( tr ( "Comoros" ) ); |
315 | cmbCountry->insertItem( tr ( "Congo" ) ); | 315 | cmbCountry->insertItem( tr ( "Congo" ) ); |
316 | cmbCountry->insertItem( tr ( "Cook Island" ) ); | 316 | cmbCountry->insertItem( tr ( "Cook Island" ) ); |
317 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); | 317 | cmbCountry->insertItem( tr ( "Costa Rica" ) ); |
318 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); | 318 | cmbCountry->insertItem( tr ( "Cote d'Ivoire" ) ); |
319 | cmbCountry->insertItem( tr ( "Croatia" ) ); | 319 | cmbCountry->insertItem( tr ( "Croatia" ) ); |
320 | cmbCountry->insertItem( tr ( "Cuba" ) ); | 320 | cmbCountry->insertItem( tr ( "Cuba" ) ); |
321 | cmbCountry->insertItem( tr ( "Cyprus" ) ); | 321 | cmbCountry->insertItem( tr ( "Cyprus" ) ); |
322 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); | 322 | cmbCountry->insertItem( tr ( "Czech Republic" ) ); |
323 | cmbCountry->insertItem( tr ( "Denmark" ) ); | 323 | cmbCountry->insertItem( tr ( "Denmark" ) ); |
324 | cmbCountry->insertItem( tr ( "Djibouti" ) ); | 324 | cmbCountry->insertItem( tr ( "Djibouti" ) ); |
325 | cmbCountry->insertItem( tr ( "Dominica" ) ); | 325 | cmbCountry->insertItem( tr ( "Dominica" ) ); |
326 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); | 326 | cmbCountry->insertItem( tr ( "Dominican Republic" ) ); |
327 | cmbCountry->insertItem( tr ( "East Timor" ) ); | 327 | cmbCountry->insertItem( tr ( "East Timor" ) ); |
328 | cmbCountry->insertItem( tr ( "Ecuador" ) ); | 328 | cmbCountry->insertItem( tr ( "Ecuador" ) ); |
329 | cmbCountry->insertItem( tr ( "Egypt" ) ); | 329 | cmbCountry->insertItem( tr ( "Egypt" ) ); |
330 | cmbCountry->insertItem( tr ( "El Salvador" ) ); | 330 | cmbCountry->insertItem( tr ( "El Salvador" ) ); |
331 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); | 331 | cmbCountry->insertItem( tr ( "Equatorial Guinea" ) ); |
332 | cmbCountry->insertItem( tr ( "Eritrea" ) ); | 332 | cmbCountry->insertItem( tr ( "Eritrea" ) ); |
333 | cmbCountry->insertItem( tr ( "Estonia" ) ); | 333 | cmbCountry->insertItem( tr ( "Estonia" ) ); |
334 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); | 334 | cmbCountry->insertItem( tr ( "Ethiopia" ) ); |
335 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); | 335 | cmbCountry->insertItem( tr ( "Falkland Islands" ) ); |
336 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); | 336 | cmbCountry->insertItem( tr ( "Faroe Islands" ) ); |
337 | cmbCountry->insertItem( tr ( "Fiji" ) ); | 337 | cmbCountry->insertItem( tr ( "Fiji" ) ); |
338 | cmbCountry->insertItem( tr ( "Finland" ) ); | 338 | cmbCountry->insertItem( tr ( "Finland" ) ); |
339 | cmbCountry->insertItem( tr ( "France" ) ); | 339 | cmbCountry->insertItem( tr ( "France" ) ); |
340 | cmbCountry->insertItem( tr ( "French Guiana" ) ); | 340 | cmbCountry->insertItem( tr ( "French Guiana" ) ); |
341 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); | 341 | cmbCountry->insertItem( tr ( "French Polynesia" ) ); |
342 | cmbCountry->insertItem( tr ( "Gabon" ) ); | 342 | cmbCountry->insertItem( tr ( "Gabon" ) ); |
343 | cmbCountry->insertItem( tr ( "Gambia" ) ); | 343 | cmbCountry->insertItem( tr ( "Gambia" ) ); |
344 | cmbCountry->insertItem( tr ( "Georgia" ) ); | 344 | cmbCountry->insertItem( tr ( "Georgia" ) ); |
345 | cmbCountry->insertItem( tr ( "Germany" ) ); | 345 | cmbCountry->insertItem( tr ( "Germany" ) ); |
346 | cmbCountry->insertItem( tr ( "Ghana" ) ); | 346 | cmbCountry->insertItem( tr ( "Ghana" ) ); |
347 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); | 347 | cmbCountry->insertItem( tr ( "Gibraltar" ) ); |
348 | cmbCountry->insertItem( tr ( "Greece" ) ); | 348 | cmbCountry->insertItem( tr ( "Greece" ) ); |
349 | cmbCountry->insertItem( tr ( "Greenland" ) ); | 349 | cmbCountry->insertItem( tr ( "Greenland" ) ); |
350 | cmbCountry->insertItem( tr ( "Grenada" ) ); | 350 | cmbCountry->insertItem( tr ( "Grenada" ) ); |
351 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); | 351 | cmbCountry->insertItem( tr ( "Guadeloupe" ) ); |
352 | cmbCountry->insertItem( tr ( "Guam" ) ); | 352 | cmbCountry->insertItem( tr ( "Guam" ) ); |
353 | cmbCountry->insertItem( tr ( "Guatemala" ) ); | 353 | cmbCountry->insertItem( tr ( "Guatemala" ) ); |
354 | cmbCountry->insertItem( tr ( "Guinea" ) ); | 354 | cmbCountry->insertItem( tr ( "Guinea" ) ); |
355 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); | 355 | cmbCountry->insertItem( tr ( "Guinea-Bissau" ) ); |
356 | cmbCountry->insertItem( tr ( "Guyana" ) ); | 356 | cmbCountry->insertItem( tr ( "Guyana" ) ); |
357 | cmbCountry->insertItem( tr ( "Haiti" ) ); | 357 | cmbCountry->insertItem( tr ( "Haiti" ) ); |
358 | cmbCountry->insertItem( tr ( "Holy See" ) ); | 358 | cmbCountry->insertItem( tr ( "Holy See" ) ); |
359 | cmbCountry->insertItem( tr ( "Honduras" ) ); | 359 | cmbCountry->insertItem( tr ( "Honduras" ) ); |
360 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); | 360 | cmbCountry->insertItem( tr ( "Hong Kong" ) ); |
361 | cmbCountry->insertItem( tr ( "Hungary" ) ); | 361 | cmbCountry->insertItem( tr ( "Hungary" ) ); |
362 | cmbCountry->insertItem( tr ( "Iceland" ) ); | 362 | cmbCountry->insertItem( tr ( "Iceland" ) ); |
363 | cmbCountry->insertItem( tr ( "India" ) ); | 363 | cmbCountry->insertItem( tr ( "India" ) ); |
364 | cmbCountry->insertItem( tr ( "Indonesia" ) ); | 364 | cmbCountry->insertItem( tr ( "Indonesia" ) ); |
365 | cmbCountry->insertItem( tr ( "Ireland" ) ); | 365 | cmbCountry->insertItem( tr ( "Ireland" ) ); |
366 | cmbCountry->insertItem( tr ( "Israel" ) ); | 366 | cmbCountry->insertItem( tr ( "Israel" ) ); |
367 | cmbCountry->insertItem( tr ( "Italy" ) ); | 367 | cmbCountry->insertItem( tr ( "Italy" ) ); |
368 | cmbCountry->insertItem( tr ( "Jamaica" ) ); | 368 | cmbCountry->insertItem( tr ( "Jamaica" ) ); |
369 | cmbCountry->insertItem( tr ( "Japan" ) ); | 369 | cmbCountry->insertItem( tr ( "Japan" ) ); |
370 | cmbCountry->insertItem( tr ( "Jordan" ) ); | 370 | cmbCountry->insertItem( tr ( "Jordan" ) ); |
371 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); | 371 | cmbCountry->insertItem( tr ( "Kazakhstan" ) ); |
372 | cmbCountry->insertItem( tr ( "Kenya" ) ); | 372 | cmbCountry->insertItem( tr ( "Kenya" ) ); |
373 | cmbCountry->insertItem( tr ( "Kiribati" ) ); | 373 | cmbCountry->insertItem( tr ( "Kiribati" ) ); |
374 | cmbCountry->insertItem( tr ( "Korea" ) ); | 374 | cmbCountry->insertItem( tr ( "Korea" ) ); |
375 | cmbCountry->insertItem( tr ( "Kuwait" ) ); | 375 | cmbCountry->insertItem( tr ( "Kuwait" ) ); |
376 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); | 376 | cmbCountry->insertItem( tr ( "Kyrgyzstan" ) ); |
377 | cmbCountry->insertItem( tr ( "Laos" ) ); | 377 | cmbCountry->insertItem( tr ( "Laos" ) ); |
378 | cmbCountry->insertItem( tr ( "Latvia" ) ); | 378 | cmbCountry->insertItem( tr ( "Latvia" ) ); |
379 | cmbCountry->insertItem( tr ( "Lebanon" ) ); | 379 | cmbCountry->insertItem( tr ( "Lebanon" ) ); |
380 | cmbCountry->insertItem( tr ( "Lesotho" ) ); | 380 | cmbCountry->insertItem( tr ( "Lesotho" ) ); |
381 | cmbCountry->insertItem( tr ( "Liberia" ) ); | 381 | cmbCountry->insertItem( tr ( "Liberia" ) ); |
382 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); | 382 | cmbCountry->insertItem( tr ( "Liechtenstein" ) ); |
383 | cmbCountry->insertItem( tr ( "Lithuania" ) ); | 383 | cmbCountry->insertItem( tr ( "Lithuania" ) ); |
384 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); | 384 | cmbCountry->insertItem( tr ( "Luxembourg" ) ); |
385 | cmbCountry->insertItem( tr ( "Macau" ) ); | 385 | cmbCountry->insertItem( tr ( "Macau" ) ); |
386 | cmbCountry->insertItem( tr ( "Macedonia" ) ); | 386 | cmbCountry->insertItem( tr ( "Macedonia" ) ); |
387 | cmbCountry->insertItem( tr ( "Madagascar" ) ); | 387 | cmbCountry->insertItem( tr ( "Madagascar" ) ); |
388 | cmbCountry->insertItem( tr ( "Malawi" ) ); | 388 | cmbCountry->insertItem( tr ( "Malawi" ) ); |
389 | cmbCountry->insertItem( tr ( "Malaysia" ) ); | 389 | cmbCountry->insertItem( tr ( "Malaysia" ) ); |
390 | cmbCountry->insertItem( tr ( "Maldives" ) ); | 390 | cmbCountry->insertItem( tr ( "Maldives" ) ); |
391 | cmbCountry->insertItem( tr ( "Mali" ) ); | 391 | cmbCountry->insertItem( tr ( "Mali" ) ); |
392 | cmbCountry->insertItem( tr ( "Malta" ) ); | 392 | cmbCountry->insertItem( tr ( "Malta" ) ); |
393 | cmbCountry->insertItem( tr ( "Martinique" ) ); | 393 | cmbCountry->insertItem( tr ( "Martinique" ) ); |
394 | cmbCountry->insertItem( tr ( "Mauritania" ) ); | 394 | cmbCountry->insertItem( tr ( "Mauritania" ) ); |
395 | cmbCountry->insertItem( tr ( "Mauritius" ) ); | 395 | cmbCountry->insertItem( tr ( "Mauritius" ) ); |
396 | cmbCountry->insertItem( tr ( "Mayotte" ) ); | 396 | cmbCountry->insertItem( tr ( "Mayotte" ) ); |
397 | cmbCountry->insertItem( tr ( "Mexico" ) ); | 397 | cmbCountry->insertItem( tr ( "Mexico" ) ); |
398 | cmbCountry->insertItem( tr ( "Micronesia" ) ); | 398 | cmbCountry->insertItem( tr ( "Micronesia" ) ); |
399 | cmbCountry->insertItem( tr ( "Moldova" ) ); | 399 | cmbCountry->insertItem( tr ( "Moldova" ) ); |
400 | cmbCountry->insertItem( tr ( "Monaco" ) ); | 400 | cmbCountry->insertItem( tr ( "Monaco" ) ); |
401 | cmbCountry->insertItem( tr ( "Mongolia" ) ); | 401 | cmbCountry->insertItem( tr ( "Mongolia" ) ); |
402 | cmbCountry->insertItem( tr ( "Montserrat" ) ); | 402 | cmbCountry->insertItem( tr ( "Montserrat" ) ); |
403 | cmbCountry->insertItem( tr ( "Morocco" ) ); | 403 | cmbCountry->insertItem( tr ( "Morocco" ) ); |
404 | cmbCountry->insertItem( tr ( "Mozambique" ) ); | 404 | cmbCountry->insertItem( tr ( "Mozambique" ) ); |
405 | cmbCountry->insertItem( tr ( "Myanmar" ) ); | 405 | cmbCountry->insertItem( tr ( "Myanmar" ) ); |
406 | cmbCountry->insertItem( tr ( "Namibia" ) ); | 406 | cmbCountry->insertItem( tr ( "Namibia" ) ); |
407 | cmbCountry->insertItem( tr ( "Nauru" ) ); | 407 | cmbCountry->insertItem( tr ( "Nauru" ) ); |
408 | cmbCountry->insertItem( tr ( "Nepal" ) ); | 408 | cmbCountry->insertItem( tr ( "Nepal" ) ); |
409 | cmbCountry->insertItem( tr ( "Netherlands" ) ); | 409 | cmbCountry->insertItem( tr ( "Netherlands" ) ); |
410 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); | 410 | cmbCountry->insertItem( tr ( "New Caledonia" ) ); |
411 | cmbCountry->insertItem( tr ( "New Zealand" ) ); | 411 | cmbCountry->insertItem( tr ( "New Zealand" ) ); |
412 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); | 412 | cmbCountry->insertItem( tr ( "Nicaragua" ) ); |
413 | cmbCountry->insertItem( tr ( "Niger" ) ); | 413 | cmbCountry->insertItem( tr ( "Niger" ) ); |
414 | cmbCountry->insertItem( tr ( "Nigeria" ) ); | 414 | cmbCountry->insertItem( tr ( "Nigeria" ) ); |
415 | cmbCountry->insertItem( tr ( "Niue" ) ); | 415 | cmbCountry->insertItem( tr ( "Niue" ) ); |
416 | cmbCountry->insertItem( tr ( "Norway" ) ); | 416 | cmbCountry->insertItem( tr ( "Norway" ) ); |
417 | cmbCountry->insertItem( tr ( "Oman" ) ); | 417 | cmbCountry->insertItem( tr ( "Oman" ) ); |
418 | cmbCountry->insertItem( tr ( "Pakistan" ) ); | 418 | cmbCountry->insertItem( tr ( "Pakistan" ) ); |
419 | cmbCountry->insertItem( tr ( "Palau" ) ); | 419 | cmbCountry->insertItem( tr ( "Palau" ) ); |
420 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); | 420 | cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); |
421 | cmbCountry->insertItem( tr ( "Panama" ) ); | 421 | cmbCountry->insertItem( tr ( "Panama" ) ); |
422 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); | 422 | cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); |
423 | cmbCountry->insertItem( tr ( "Paraguay" ) ); | 423 | cmbCountry->insertItem( tr ( "Paraguay" ) ); |
424 | cmbCountry->insertItem( tr ( "Peru" ) ); | 424 | cmbCountry->insertItem( tr ( "Peru" ) ); |
425 | cmbCountry->insertItem( tr ( "Philippines" ) ); | 425 | cmbCountry->insertItem( tr ( "Philippines" ) ); |
426 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); | 426 | cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); |
427 | cmbCountry->insertItem( tr ( "Poland" ) ); | 427 | cmbCountry->insertItem( tr ( "Poland" ) ); |
428 | cmbCountry->insertItem( tr ( "Portugal" ) ); | 428 | cmbCountry->insertItem( tr ( "Portugal" ) ); |
429 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); | 429 | cmbCountry->insertItem( tr ( "Puerto Rico" ) ); |
430 | cmbCountry->insertItem( tr ( "Qatar" ) ); | 430 | cmbCountry->insertItem( tr ( "Qatar" ) ); |
431 | cmbCountry->insertItem( tr ( "Reunion" ) ); | 431 | cmbCountry->insertItem( tr ( "Reunion" ) ); |
432 | cmbCountry->insertItem( tr ( "Romania" ) ); | 432 | cmbCountry->insertItem( tr ( "Romania" ) ); |
433 | cmbCountry->insertItem( tr ( "Russia" ) ); | 433 | cmbCountry->insertItem( tr ( "Russia" ) ); |
434 | cmbCountry->insertItem( tr ( "Rwanda" ) ); | 434 | cmbCountry->insertItem( tr ( "Rwanda" ) ); |
435 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); | 435 | cmbCountry->insertItem( tr ( "Saint Lucia" ) ); |
436 | cmbCountry->insertItem( tr ( "Samoa" ) ); | 436 | cmbCountry->insertItem( tr ( "Samoa" ) ); |
437 | cmbCountry->insertItem( tr ( "San Marino" ) ); | 437 | cmbCountry->insertItem( tr ( "San Marino" ) ); |
438 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); | 438 | cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); |
439 | cmbCountry->insertItem( tr ( "Senegal" ) ); | 439 | cmbCountry->insertItem( tr ( "Senegal" ) ); |
440 | cmbCountry->insertItem( tr ( "Seychelles" ) ); | 440 | cmbCountry->insertItem( tr ( "Seychelles" ) ); |
441 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); | 441 | cmbCountry->insertItem( tr ( "Sierra Leone" ) ); |
442 | cmbCountry->insertItem( tr ( "Singapore" ) ); | 442 | cmbCountry->insertItem( tr ( "Singapore" ) ); |
443 | cmbCountry->insertItem( tr ( "Slovakia" ) ); | 443 | cmbCountry->insertItem( tr ( "Slovakia" ) ); |
444 | cmbCountry->insertItem( tr ( "Slovenia" ) ); | 444 | cmbCountry->insertItem( tr ( "Slovenia" ) ); |
445 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); | 445 | cmbCountry->insertItem( tr ( "Solomon Islands" ) ); |
446 | cmbCountry->insertItem( tr ( "Somalia" ) ); | 446 | cmbCountry->insertItem( tr ( "Somalia" ) ); |
447 | cmbCountry->insertItem( tr ( "South Africa" ) ); | 447 | cmbCountry->insertItem( tr ( "South Africa" ) ); |
448 | cmbCountry->insertItem( tr ( "Spain" ) ); | 448 | cmbCountry->insertItem( tr ( "Spain" ) ); |
449 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); | 449 | cmbCountry->insertItem( tr ( "Sri Lanka" ) ); |
450 | cmbCountry->insertItem( tr ( "St. Helena" ) ); | 450 | cmbCountry->insertItem( tr ( "St. Helena" ) ); |
451 | cmbCountry->insertItem( tr ( "Sudan" ) ); | 451 | cmbCountry->insertItem( tr ( "Sudan" ) ); |
452 | cmbCountry->insertItem( tr ( "Suriname" ) ); | 452 | cmbCountry->insertItem( tr ( "Suriname" ) ); |
453 | cmbCountry->insertItem( tr ( "Swaziland" ) ); | 453 | cmbCountry->insertItem( tr ( "Swaziland" ) ); |
454 | cmbCountry->insertItem( tr ( "Sweden" ) ); | 454 | cmbCountry->insertItem( tr ( "Sweden" ) ); |
455 | cmbCountry->insertItem( tr ( "Switzerland" ) ); | 455 | cmbCountry->insertItem( tr ( "Switzerland" ) ); |
456 | cmbCountry->insertItem( tr ( "Taiwan" ) ); | 456 | cmbCountry->insertItem( tr ( "Taiwan" ) ); |
457 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); | 457 | cmbCountry->insertItem( tr ( "Tajikistan" ) ); |
458 | cmbCountry->insertItem( tr ( "Tanzania" ) ); | 458 | cmbCountry->insertItem( tr ( "Tanzania" ) ); |
459 | cmbCountry->insertItem( tr ( "Thailand" ) ); | 459 | cmbCountry->insertItem( tr ( "Thailand" ) ); |
460 | cmbCountry->insertItem( tr ( "Togo" ) ); | 460 | cmbCountry->insertItem( tr ( "Togo" ) ); |
461 | cmbCountry->insertItem( tr ( "Tokelau" ) ); | 461 | cmbCountry->insertItem( tr ( "Tokelau" ) ); |
462 | cmbCountry->insertItem( tr ( "Tonga" ) ); | 462 | cmbCountry->insertItem( tr ( "Tonga" ) ); |
463 | cmbCountry->insertItem( tr ( "Tunisia" ) ); | 463 | cmbCountry->insertItem( tr ( "Tunisia" ) ); |
464 | cmbCountry->insertItem( tr ( "Turkey" ) ); | 464 | cmbCountry->insertItem( tr ( "Turkey" ) ); |
465 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); | 465 | cmbCountry->insertItem( tr ( "Turkmenistan" ) ); |
466 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); | 466 | cmbCountry->insertItem( tr ( "Tuvalu" ) ); |
467 | cmbCountry->insertItem( tr ( "Uganda" ) ); | 467 | cmbCountry->insertItem( tr ( "Uganda" ) ); |
468 | cmbCountry->insertItem( tr ( "Ukraine" ) ); | 468 | cmbCountry->insertItem( tr ( "Ukraine" ) ); |
469 | cmbCountry->insertItem( tr ( "Uruguay" ) ); | 469 | cmbCountry->insertItem( tr ( "Uruguay" ) ); |
470 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); | 470 | cmbCountry->insertItem( tr ( "Uzbekistan" ) ); |
471 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); | 471 | cmbCountry->insertItem( tr ( "Vanuatu" ) ); |
472 | cmbCountry->insertItem( tr ( "Venezuela" ) ); | 472 | cmbCountry->insertItem( tr ( "Venezuela" ) ); |
473 | cmbCountry->insertItem( tr ( "Vietnam" ) ); | 473 | cmbCountry->insertItem( tr ( "Vietnam" ) ); |
474 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); | 474 | cmbCountry->insertItem( tr ( "Virgin Islands" ) ); |
475 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); | 475 | cmbCountry->insertItem( tr ( "Western Sahara" ) ); |
476 | cmbCountry->insertItem( tr ( "Yemen" ) ); | 476 | cmbCountry->insertItem( tr ( "Yemen" ) ); |
477 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); | 477 | cmbCountry->insertItem( tr ( "Yugoslavia" ) ); |
478 | cmbCountry->insertItem( tr ( "Zambia" ) ); | 478 | cmbCountry->insertItem( tr ( "Zambia" ) ); |
479 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); | 479 | cmbCountry->insertItem( tr ( "Zimbabwe" ) ); |
480 | if (cmbCountry->listBox()!=0) | 480 | if (cmbCountry->listBox()!=0) |
481 | cmbCountry->listBox()->sort(); | 481 | cmbCountry->listBox()->sort(); |
482 | 482 | ||
483 | cmbCountry->setMaximumWidth( 135 ); | 483 | cmbCountry->setMaximumWidth( 135 ); |
484 | 484 | ||
485 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 485 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
486 | 486 | ||
487 | // Chooser 4 | 487 | // Chooser 4 |
488 | cmbChooserField4 = new QComboBox( FALSE, container ); | 488 | cmbChooserField4 = new QComboBox( FALSE, container ); |
489 | cmbChooserField4->setMaximumWidth( 90 ); | 489 | cmbChooserField4->setMaximumWidth( 90 ); |
490 | gl->addWidget( cmbChooserField4, 6, 0 ); | 490 | gl->addWidget( cmbChooserField4, 6, 0 ); |
491 | // Textfield for chooser 2 | 491 | // Textfield for chooser 2 |
492 | // Now use WidgetStack to contain the textfield and the default-email combo! | 492 | // Now use WidgetStack to contain the textfield and the default-email combo! |
493 | m_widgetStack4 = new QWidgetStack( container ); | 493 | m_widgetStack4 = new QWidgetStack( container ); |
494 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); | 494 | txtChooserField4 = new QLineEdit( m_widgetStack4 ); |
495 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); | 495 | m_widgetStack4 -> addWidget( txtChooserField4, TextField ); |
496 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); | 496 | gl->addMultiCellWidget( m_widgetStack4, 6, 6, 1, 2 ); |
497 | m_widgetStack4 -> raiseWidget( TextField ); | 497 | m_widgetStack4 -> raiseWidget( TextField ); |
498 | 498 | ||
499 | QSpacerItem *space = new QSpacerItem(1,1, | 499 | QSpacerItem *space = new QSpacerItem(1,1, |
500 | QSizePolicy::Maximum, | 500 | QSizePolicy::Maximum, |
501 | QSizePolicy::MinimumExpanding ); | 501 | QSizePolicy::MinimumExpanding ); |
502 | gl->addItem( space, 7, 0 ); | 502 | gl->addItem( space, 7, 0 ); |
503 | 503 | ||
504 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 504 | tabMain->insertTab( tabViewport, tr( "Address" ) ); |
505 | 505 | ||
506 | tabViewport = new QWidget ( tabMain ); | 506 | tabViewport = new QWidget ( tabMain ); |
507 | 507 | ||
508 | vb = new QVBoxLayout( tabViewport ); | 508 | vb = new QVBoxLayout( tabViewport ); |
509 | 509 | ||
510 | svDetails = new QScrollView( tabViewport ); | 510 | svDetails = new QScrollView( tabViewport ); |
511 | vb->addWidget( svDetails, 0, 0 ); | 511 | vb->addWidget( svDetails, 0, 0 ); |
512 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 512 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
513 | svDetails->setFrameStyle( QFrame::NoFrame ); | 513 | svDetails->setFrameStyle( QFrame::NoFrame ); |
514 | 514 | ||
515 | container = new QWidget( svDetails->viewport() ); | 515 | container = new QWidget( svDetails->viewport() ); |
516 | svDetails->addChild( container ); | 516 | svDetails->addChild( container ); |
517 | 517 | ||
518 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 518 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
519 | 519 | ||
520 | int counter = 0; | 520 | int counter = 0; |
521 | 521 | ||
522 | // Birthday | 522 | // Birthday |
523 | QHBox* hBox = new QHBox( container ); | 523 | QHBox* hBox = new QHBox( container ); |
524 | l = new QLabel( tr("Birthday"), container ); | 524 | l = new QLabel( tr("Birthday"), container ); |
525 | gl->addWidget( l, counter, 0 ); | 525 | gl->addWidget( l, counter, 0 ); |
526 | 526 | ||
527 | QPopupMenu* m1 = new QPopupMenu( container ); | 527 | QPopupMenu* m1 = new QPopupMenu( container ); |
528 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); | 528 | birthdayPicker = new DateBookMonth( m1, 0, TRUE ); |
529 | m1->insertItem( birthdayPicker ); | 529 | m1->insertItem( birthdayPicker ); |
530 | 530 | ||
531 | birthdayButton= new QToolButton( hBox, "buttonStart" ); | 531 | birthdayButton= new QToolButton( hBox, "buttonStart" ); |
532 | birthdayButton->setPopup( m1 ); | 532 | birthdayButton->setPopup( m1 ); |
533 | birthdayButton->setPopupDelay(0); | 533 | birthdayButton->setPopupDelay(0); |
534 | 534 | ||
535 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 535 | QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
536 | tr( "Delete" ), | 536 | tr( "Delete" ), |
537 | hBox, 0 ); | 537 | hBox, 0 ); |
538 | 538 | ||
539 | gl->addWidget( hBox, counter , 1 ); | 539 | gl->addWidget( hBox, counter , 1 ); |
540 | 540 | ||
541 | connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), | 541 | connect( birthdayPicker, SIGNAL( dateClicked(int,int,int) ), |
542 | this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); | 542 | this, SLOT( slotBirthdayDateChanged(int,int,int) ) ); |
543 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); | 543 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); |
544 | 544 | ||
545 | ++counter; | 545 | ++counter; |
546 | 546 | ||
547 | // Anniversary | 547 | // Anniversary |
548 | hBox = new QHBox( container ); | 548 | hBox = new QHBox( container ); |
549 | l = new QLabel( tr("Anniversary"), container ); | 549 | l = new QLabel( tr("Anniversary"), container ); |
550 | gl->addWidget( l, counter, 0 ); | 550 | gl->addWidget( l, counter, 0 ); |
551 | 551 | ||
552 | m1 = new QPopupMenu( container ); | 552 | m1 = new QPopupMenu( container ); |
553 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); | 553 | anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); |
554 | m1->insertItem( anniversaryPicker ); | 554 | m1->insertItem( anniversaryPicker ); |
555 | 555 | ||
556 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); | 556 | anniversaryButton= new QToolButton( hBox, "buttonStart" ); |
557 | anniversaryButton->setPopup( m1 ); | 557 | anniversaryButton->setPopup( m1 ); |
558 | anniversaryButton->setPopupDelay(0); | 558 | anniversaryButton->setPopupDelay(0); |
559 | 559 | ||
560 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), | 560 | deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), |
561 | tr( "Delete" ), | 561 | tr( "Delete" ), |
562 | hBox, 0 ); | 562 | hBox, 0 ); |
563 | gl->addWidget( hBox, counter , 1 ); | 563 | gl->addWidget( hBox, counter , 1 ); |
564 | 564 | ||
565 | connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), | 565 | connect( anniversaryPicker, SIGNAL( dateClicked(int,int,int) ), |
566 | this, SLOT( slotAnniversaryDateChanged(int,int,int) ) ); | 566 | this, SLOT( slotAnniversaryDateChanged(int,int,int) ) ); |
567 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); | 567 | connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); |
568 | 568 | ||
569 | ++counter; | 569 | ++counter; |
570 | 570 | ||
571 | // Gender | 571 | // Gender |
572 | l = new QLabel( tr("Gender"), container ); | 572 | l = new QLabel( tr("Gender"), container ); |
573 | gl->addWidget( l, counter, 0 ); | 573 | gl->addWidget( l, counter, 0 ); |
574 | cmbGender = new QComboBox( container ); | 574 | cmbGender = new QComboBox( container ); |
575 | cmbGender->insertItem( "", 0 ); | 575 | cmbGender->insertItem( "", 0 ); |
576 | cmbGender->insertItem( tr("Male"), 1); | 576 | cmbGender->insertItem( tr("Male"), 1); |
577 | cmbGender->insertItem( tr("Female"), 2); | 577 | cmbGender->insertItem( tr("Female"), 2); |
578 | gl->addWidget( cmbGender, counter, 1 ); | 578 | gl->addWidget( cmbGender, counter, 1 ); |
579 | 579 | ||
580 | ++counter; | 580 | ++counter; |
581 | 581 | ||
582 | // Create Labels and lineedit fields for every dynamic entry | 582 | // Create Labels and lineedit fields for every dynamic entry |
583 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 583 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
584 | QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId(); | 584 | QMap<QString, int> mapStrToID = Opie::OPimContactFields::untrFieldsToId(); |
585 | QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields(); | 585 | QMap<int, QString> mapIdToStr = Opie::OPimContactFields::idToTrFields(); |
586 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { | 586 | for (i = counter; it != slDynamicEntries.end(); i++, ++it ) { |
587 | 587 | ||
588 | if (((*it) == "Anniversary") || | 588 | if (((*it) == "Anniversary") || |
589 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; | 589 | ((*it) == "Birthday")|| ((*it) == "Gender")) continue; |
590 | 590 | ||
591 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); | 591 | l = new QLabel( mapIdToStr[mapStrToID[*it]], container ); |
592 | listName.append( l ); | 592 | listName.append( l ); |
593 | gl->addWidget( l, i, 0 ); | 593 | gl->addWidget( l, i, 0 ); |
594 | QLineEdit *e = new QLineEdit( container ); | 594 | QLineEdit *e = new QLineEdit( container ); |
595 | listValue.append( e ); | 595 | listValue.append( e ); |
596 | gl->addWidget( e, i, 1); | 596 | gl->addWidget( e, i, 1); |
597 | } | 597 | } |
598 | // Fill labels with names.. | 598 | // Fill labels with names.. |
599 | //loadFields(); | 599 | //loadFields(); |
600 | 600 | ||
601 | 601 | ||
602 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 602 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
603 | 603 | ||
604 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 604 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
605 | dlgNote->setCaption( tr("Enter Note") ); | 605 | dlgNote->setCaption( tr("Enter Note") ); |
606 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 606 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
607 | txtNote = new QMultiLineEdit( dlgNote ); | 607 | txtNote = new QMultiLineEdit( dlgNote ); |
608 | vbNote->addWidget( txtNote ); | 608 | vbNote->addWidget( txtNote ); |
609 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 609 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
610 | 610 | ||
611 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 611 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
612 | dlgName->setCaption( tr("Edit Name") ); | 612 | dlgName->setCaption( tr("Edit Name") ); |
613 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); | 613 | gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); |
614 | 614 | ||
615 | l = new QLabel( tr("First Name"), dlgName ); | 615 | l = new QLabel( tr("First Name"), dlgName ); |
616 | gl->addWidget( l, 0, 0 ); | 616 | gl->addWidget( l, 0, 0 ); |
617 | txtFirstName = new ABOOK::NameLineEdit( dlgName ); | 617 | txtFirstName = new ABOOK::NameLineEdit( dlgName ); |
618 | gl->addWidget( txtFirstName, 0, 1 ); | 618 | gl->addWidget( txtFirstName, 0, 1 ); |
619 | 619 | ||
620 | l = new QLabel( tr("Middle Name"), dlgName ); | 620 | l = new QLabel( tr("Middle Name"), dlgName ); |
621 | gl->addWidget( l, 1, 0 ); | 621 | gl->addWidget( l, 1, 0 ); |
622 | txtMiddleName = new ABOOK::NameLineEdit( dlgName ); | 622 | txtMiddleName = new ABOOK::NameLineEdit( dlgName ); |
623 | gl->addWidget( txtMiddleName, 1, 1 ); | 623 | gl->addWidget( txtMiddleName, 1, 1 ); |
624 | 624 | ||
625 | l = new QLabel( tr("Last Name"), dlgName ); | 625 | l = new QLabel( tr("Last Name"), dlgName ); |
626 | gl->addWidget( l, 2, 0 ); | 626 | gl->addWidget( l, 2, 0 ); |
627 | txtLastName = new ABOOK::NameLineEdit( dlgName ); | 627 | txtLastName = new ABOOK::NameLineEdit( dlgName ); |
628 | gl->addWidget( txtLastName, 2, 1 ); | 628 | gl->addWidget( txtLastName, 2, 1 ); |
629 | 629 | ||
630 | // l = new QLabel( tr("Suffix"), dlgName ); | 630 | // l = new QLabel( tr("Suffix"), dlgName ); |
631 | // gl->addWidget( l, 3, 0 ); | 631 | // gl->addWidget( l, 3, 0 ); |
632 | // txtSuffix = new QLineEdit( dlgName ); | 632 | // txtSuffix = new QLineEdit( dlgName ); |
633 | // gl->addWidget( txtSuffix, 3, 1 ); | 633 | // gl->addWidget( txtSuffix, 3, 1 ); |
634 | space = new QSpacerItem(1,1, | 634 | space = new QSpacerItem(1,1, |
635 | QSizePolicy::Maximum, | 635 | QSizePolicy::Maximum, |
636 | QSizePolicy::MinimumExpanding ); | 636 | QSizePolicy::MinimumExpanding ); |
637 | gl->addItem( space, 4, 0 ); | 637 | gl->addItem( space, 4, 0 ); |
638 | 638 | ||
639 | cmbChooserField1->insertStringList( trlChooserNames ); | 639 | cmbChooserField1->insertStringList( trlChooserNames ); |
640 | cmbChooserField2->insertStringList( trlChooserNames ); | 640 | cmbChooserField2->insertStringList( trlChooserNames ); |
641 | cmbChooserField3->insertStringList( trlChooserNames ); | 641 | cmbChooserField3->insertStringList( trlChooserNames ); |
642 | cmbChooserField4->insertStringList( trlChooserNames ); | 642 | cmbChooserField4->insertStringList( trlChooserNames ); |
643 | 643 | ||
644 | cmbChooserField1->setCurrentItem( 0 ); | 644 | cmbChooserField1->setCurrentItem( 0 ); |
645 | cmbChooserField2->setCurrentItem( 1 ); | 645 | cmbChooserField2->setCurrentItem( 1 ); |
646 | cmbChooserField3->setCurrentItem( 2 ); | 646 | cmbChooserField3->setCurrentItem( 2 ); |
647 | 647 | ||
648 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 648 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
649 | 649 | ||
650 | connect( txtFullName, SIGNAL(textChanged(const QString&)), | 650 | connect( txtFullName, SIGNAL(textChanged(const QString&)), |
651 | this, SLOT(slotFullNameChange(const QString&)) ); | 651 | this, SLOT(slotFullNameChange(const QString&)) ); |
652 | connect( txtSuffix, SIGNAL(textChanged(const QString&)), | 652 | connect( txtSuffix, SIGNAL(textChanged(const QString&)), |
653 | this, SLOT(slotSuffixChange(const QString&)) ); | 653 | this, SLOT(slotSuffixChange(const QString&)) ); |
654 | connect( txtOrganization, SIGNAL(textChanged(const QString&)), | 654 | connect( txtOrganization, SIGNAL(textChanged(const QString&)), |
655 | this, SLOT(slotOrganizationChange(const QString&)) ); | 655 | this, SLOT(slotOrganizationChange(const QString&)) ); |
656 | connect( txtChooserField1, SIGNAL(textChanged(const QString&)), | 656 | connect( txtChooserField1, SIGNAL(textChanged(const QString&)), |
657 | this, SLOT(slotChooser1Change(const QString&)) ); | 657 | this, SLOT(slotChooser1Change(const QString&)) ); |
658 | connect( txtChooserField2, SIGNAL(textChanged(const QString&)), | 658 | connect( txtChooserField2, SIGNAL(textChanged(const QString&)), |
659 | this, SLOT(slotChooser2Change(const QString&)) ); | 659 | this, SLOT(slotChooser2Change(const QString&)) ); |
660 | connect( txtChooserField3, SIGNAL(textChanged(const QString&)), | 660 | connect( txtChooserField3, SIGNAL(textChanged(const QString&)), |
661 | this, SLOT(slotChooser3Change(const QString&)) ); | 661 | this, SLOT(slotChooser3Change(const QString&)) ); |
662 | connect( txtChooserField4, SIGNAL(textChanged(const QString&)), | 662 | connect( txtChooserField4, SIGNAL(textChanged(const QString&)), |
663 | this, SLOT(slotChooser4Change(const QString&)) ); | 663 | this, SLOT(slotChooser4Change(const QString&)) ); |
664 | connect( txtAddress, SIGNAL(textChanged(const QString&)), | 664 | connect( txtAddress, SIGNAL(textChanged(const QString&)), |
665 | this, SLOT(slotAddressChange(const QString&)) ); | 665 | this, SLOT(slotAddressChange(const QString&)) ); |
666 | connect( txtCity, SIGNAL(textChanged(const QString&)), | 666 | connect( txtCity, SIGNAL(textChanged(const QString&)), |
667 | this, SLOT(slotCityChange(const QString&)) ); | 667 | this, SLOT(slotCityChange(const QString&)) ); |
668 | connect( txtState, SIGNAL(textChanged(const QString&)), | 668 | connect( txtState, SIGNAL(textChanged(const QString&)), |
669 | this, SLOT(slotStateChange(const QString&)) ); | 669 | this, SLOT(slotStateChange(const QString&)) ); |
670 | connect( txtZip, SIGNAL(textChanged(const QString&)), | 670 | connect( txtZip, SIGNAL(textChanged(const QString&)), |
671 | this, SLOT(slotZipChange(const QString&)) ); | 671 | this, SLOT(slotZipChange(const QString&)) ); |
672 | connect( cmbCountry, SIGNAL(textChanged(const QString&)), | 672 | connect( cmbCountry, SIGNAL(textChanged(const QString&)), |
673 | this, SLOT(slotCountryChange(const QString&)) ); | 673 | this, SLOT(slotCountryChange(const QString&)) ); |
674 | connect( cmbCountry, SIGNAL(activated(const QString&)), | 674 | connect( cmbCountry, SIGNAL(activated(const QString&)), |
675 | this, SLOT(slotCountryChange(const QString&)) ); | 675 | this, SLOT(slotCountryChange(const QString&)) ); |
676 | connect( cmbChooserField1, SIGNAL(activated(int)), | 676 | connect( cmbChooserField1, SIGNAL(activated(int)), |
677 | this, SLOT(slotCmbChooser1Change(int)) ); | 677 | this, SLOT(slotCmbChooser1Change(int)) ); |
678 | connect( cmbChooserField2, SIGNAL(activated(int)), | 678 | connect( cmbChooserField2, SIGNAL(activated(int)), |
679 | this, SLOT(slotCmbChooser2Change(int)) ); | 679 | this, SLOT(slotCmbChooser2Change(int)) ); |
680 | connect( cmbChooserField3, SIGNAL(activated(int)), | 680 | connect( cmbChooserField3, SIGNAL(activated(int)), |
681 | this, SLOT(slotCmbChooser3Change(int)) ); | 681 | this, SLOT(slotCmbChooser3Change(int)) ); |
682 | connect( cmbChooserField4, SIGNAL(activated(int)), | 682 | connect( cmbChooserField4, SIGNAL(activated(int)), |
683 | this, SLOT(slotCmbChooser4Change(int)) ); | 683 | this, SLOT(slotCmbChooser4Change(int)) ); |
684 | connect( cmbAddress, SIGNAL(activated(int)), | 684 | connect( cmbAddress, SIGNAL(activated(int)), |
685 | this, SLOT(slotAddressTypeChange(int)) ); | 685 | this, SLOT(slotAddressTypeChange(int)) ); |
686 | 686 | ||
687 | new QPEDialogListener(this); | 687 | new QPEDialogListener(this); |
688 | 688 | ||
689 | setPersonalView ( m_personalView ); | 689 | setPersonalView ( m_personalView ); |
690 | 690 | ||
691 | owarn << "init() END" << oendl; | 691 | odebug << "init() END" << oendl; |
692 | } | 692 | } |
693 | 693 | ||
694 | void ContactEditor::defaultEmailChanged(int i){ | 694 | void ContactEditor::defaultEmailChanged(int i){ |
695 | odebug << "defaultEmailChanged" << oendl; | 695 | odebug << "defaultEmailChanged" << oendl; |
696 | 696 | ||
697 | // was sollte das ? (se) | 697 | // was sollte das ? (se) |
698 | // int index = cmbChooserField1->currentItem(); | 698 | // int index = cmbChooserField1->currentItem(); |
699 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 699 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
700 | 700 | ||
701 | defaultEmail = cmbDefaultEmail->text(i); | 701 | defaultEmail = cmbDefaultEmail->text(i); |
702 | odebug << "Changed to: " << defaultEmail << oendl; | 702 | odebug << "Changed to: " << defaultEmail << oendl; |
703 | 703 | ||
704 | } | 704 | } |
705 | 705 | ||
706 | void ContactEditor::populateDefaultEmailCmb(){ | 706 | void ContactEditor::populateDefaultEmailCmb(){ |
707 | 707 | ||
708 | // if the default-email combo was not selected and therfore not created | 708 | // if the default-email combo was not selected and therfore not created |
709 | // we get a lot of trouble.. Therfore create an invisible one.. | 709 | // we get a lot of trouble.. Therfore create an invisible one.. |
710 | if ( !cmbDefaultEmail ){ | 710 | if ( !cmbDefaultEmail ){ |
711 | cmbDefaultEmail = new QComboBox(this); | 711 | cmbDefaultEmail = new QComboBox(this); |
712 | cmbDefaultEmail -> hide(); | 712 | cmbDefaultEmail -> hide(); |
713 | } | 713 | } |
714 | cmbDefaultEmail->clear(); | 714 | cmbDefaultEmail->clear(); |
715 | cmbDefaultEmail->insertStringList( emails ); | 715 | cmbDefaultEmail->insertStringList( emails ); |
716 | // cmbDefaultEmail->show(); | 716 | // cmbDefaultEmail->show(); |
717 | 717 | ||
718 | // Select default email in combo.. | 718 | // Select default email in combo.. |
719 | bool found = false; | 719 | bool found = false; |
720 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 720 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
721 | odebug << " populateDefaultEmailCmb text >" << cmbDefaultEmail->text( i ) | 721 | odebug << " populateDefaultEmailCmb text >" << cmbDefaultEmail->text( i ) |
722 | << "< defaultEmail >" << defaultEmail << "<" << oendl; | 722 | << "< defaultEmail >" << defaultEmail << "<" << oendl; |
723 | 723 | ||
724 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 724 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
725 | cmbDefaultEmail->setCurrentItem( i ); | 725 | cmbDefaultEmail->setCurrentItem( i ); |
726 | odebug << "set" << oendl; | 726 | odebug << "set" << oendl; |
727 | found = true; | 727 | found = true; |
728 | } | 728 | } |
729 | } | 729 | } |
730 | 730 | ||
731 | // If the current default email is not found in the list, we choose the | 731 | // If the current default email is not found in the list, we choose the |
732 | // first one.. | 732 | // first one.. |
733 | if ( !found ) | 733 | if ( !found ) |
734 | defaultEmail = cmbDefaultEmail->text(0); | 734 | defaultEmail = cmbDefaultEmail->text(0); |
735 | } | 735 | } |
736 | 736 | ||
737 | // Called when any combobox was changed. | 737 | // Called when any combobox was changed. |
738 | // "true" returned if the change was chandled by this function, else it should | 738 | // "true" returned if the change was chandled by this function, else it should |
739 | // be handled by something else.. | 739 | // be handled by something else.. |
740 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { | 740 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { |
741 | QString type = slChooserNames[index]; | 741 | QString type = slChooserNames[index]; |
742 | owarn << "ContactEditor::cmbChooserChange -> Type: " << type | 742 | odebug << "ContactEditor::cmbChooserChange -> Type: " << type |
743 | << ", WidgetPos: " << widgetPos << oendl; | 743 | << ", WidgetPos: " << widgetPos << oendl; |
744 | 744 | ||
745 | if ( !initializing ) | 745 | if ( !initializing ) |
746 | contactfields.setFieldOrder( widgetPos-1, index ); | 746 | contactfields.setFieldOrder( widgetPos-1, index ); |
747 | 747 | ||
748 | // Create and connect combobox for selecting the default email | 748 | // Create and connect combobox for selecting the default email |
749 | if ( type == "Default Email"){ | 749 | if ( type == "Default Email"){ |
750 | owarn << "Choosing default-email (defaultEmailChooserPosition= " | 750 | odebug << "Choosing default-email (defaultEmailChooserPosition= " |
751 | << defaultEmailChooserPosition << ") " << oendl; | 751 | << defaultEmailChooserPosition << ") " << oendl; |
752 | 752 | ||
753 | // More than one default-email chooser is not allowed ! | 753 | // More than one default-email chooser is not allowed ! |
754 | if ( ( defaultEmailChooserPosition != -1 ) && | 754 | if ( ( defaultEmailChooserPosition != -1 ) && |
755 | defaultEmailChooserPosition != widgetPos && !initializing){ | 755 | defaultEmailChooserPosition != widgetPos && !initializing){ |
756 | chooserError( widgetPos ); | 756 | chooserError( widgetPos ); |
757 | return true; | 757 | return true; |
758 | } | 758 | } |
759 | 759 | ||
760 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 760 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
761 | if ( cmbo ){ | 761 | if ( cmbo ){ |
762 | inputStack->raiseWidget( TextField ); | 762 | inputStack->raiseWidget( TextField ); |
763 | inputStack -> removeWidget( cmbo ); | 763 | inputStack -> removeWidget( cmbo ); |
764 | delete cmbo; | 764 | delete cmbo; |
765 | } | 765 | } |
766 | cmbo = new QComboBox( inputStack ); | 766 | cmbo = new QComboBox( inputStack ); |
767 | cmbo -> insertStringList( emails ); | 767 | cmbo -> insertStringList( emails ); |
768 | 768 | ||
769 | inputStack -> addWidget( cmbo, Combo ); | 769 | inputStack -> addWidget( cmbo, Combo ); |
770 | inputStack -> raiseWidget( Combo ); | 770 | inputStack -> raiseWidget( Combo ); |
771 | 771 | ||
772 | defaultEmailChooserPosition = widgetPos; | 772 | defaultEmailChooserPosition = widgetPos; |
773 | cmbDefaultEmail = cmbo; | 773 | cmbDefaultEmail = cmbo; |
774 | 774 | ||
775 | connect( cmbo,SIGNAL( activated(int) ), | 775 | connect( cmbo,SIGNAL( activated(int) ), |
776 | SLOT( defaultEmailChanged(int) ) ); | 776 | SLOT( defaultEmailChanged(int) ) ); |
777 | 777 | ||
778 | // Set current default email | 778 | // Set current default email |
779 | populateDefaultEmailCmb(); | 779 | populateDefaultEmailCmb(); |
780 | 780 | ||
781 | 781 | ||
782 | } else { | 782 | } else { |
783 | // Something else was selected: Hide combo.. | 783 | // Something else was selected: Hide combo.. |
784 | owarn << " Hiding default-email combo" << oendl; | 784 | odebug << " Hiding default-email combo" << oendl; |
785 | if ( defaultEmailChooserPosition == widgetPos ){ | 785 | if ( defaultEmailChooserPosition == widgetPos ){ |
786 | defaultEmailChooserPosition = -1; | 786 | defaultEmailChooserPosition = -1; |
787 | } | 787 | } |
788 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 788 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
789 | if ( cmbo ){ | 789 | if ( cmbo ){ |
790 | inputStack->raiseWidget( TextField ); | 790 | inputStack->raiseWidget( TextField ); |
791 | inputStack -> removeWidget( cmbo ); | 791 | inputStack -> removeWidget( cmbo ); |
792 | cmbDefaultEmail = 0l; | 792 | cmbDefaultEmail = 0l; |
793 | delete cmbo; | 793 | delete cmbo; |
794 | } | 794 | } |
795 | 795 | ||
796 | // Caller should initialize the responsible textfield, therefore | 796 | // Caller should initialize the responsible textfield, therefore |
797 | // "false" is returned | 797 | // "false" is returned |
798 | return false; | 798 | return false; |
799 | } | 799 | } |
800 | 800 | ||
801 | // Everything is worked off .. | 801 | // Everything is worked off .. |
802 | return true; | 802 | return true; |
803 | 803 | ||
804 | } | 804 | } |
805 | 805 | ||
806 | // Currently accessed when we select default-email more than once ! | 806 | // Currently accessed when we select default-email more than once ! |
807 | void ContactEditor::chooserError( int index ) | 807 | void ContactEditor::chooserError( int index ) |
808 | { | 808 | { |
809 | owarn << "ContactEditor::chooserError( " << index << " )" << oendl; | 809 | owarn << "ContactEditor::chooserError( " << index << " )" << oendl; |
810 | QMessageBox::warning( this, "Chooser Error", | 810 | QMessageBox::warning( this, "Chooser Error", |
811 | "Multiple selection of this\n" | 811 | "Multiple selection of this\n" |
812 | "Item is not allowed !\n\n" | 812 | "Item is not allowed !\n\n" |
813 | "First deselect the previous one !", | 813 | "First deselect the previous one !", |
814 | "&OK", 0, 0, | 814 | "&OK", 0, 0, |
815 | 0, 0 ); | 815 | 0, 0 ); |
816 | 816 | ||
817 | // Reset the selected Chooser. Unfortunately the chooser | 817 | // Reset the selected Chooser. Unfortunately the chooser |
818 | // generates no signal, therfore we have to | 818 | // generates no signal, therfore we have to |
819 | // call the cmbChooserChange function manually.. | 819 | // call the cmbChooserChange function manually.. |
820 | switch( index ){ | 820 | switch( index ){ |
821 | case 1: | 821 | case 1: |
822 | cmbChooserField1 -> setCurrentItem( 0 ); | 822 | cmbChooserField1 -> setCurrentItem( 0 ); |
823 | slotCmbChooser1Change( 0 ); | 823 | slotCmbChooser1Change( 0 ); |
824 | break; | 824 | break; |
825 | case 2: | 825 | case 2: |
826 | cmbChooserField2 -> setCurrentItem( 0 ); | 826 | cmbChooserField2 -> setCurrentItem( 0 ); |
827 | slotCmbChooser2Change( 0 ); | 827 | slotCmbChooser2Change( 0 ); |
828 | break; | 828 | break; |
829 | case 3: | 829 | case 3: |
830 | cmbChooserField3 -> setCurrentItem( 0 ); | 830 | cmbChooserField3 -> setCurrentItem( 0 ); |
831 | slotCmbChooser3Change( 0 ); | 831 | slotCmbChooser3Change( 0 ); |
832 | break; | 832 | break; |
833 | case 4: | 833 | case 4: |
834 | cmbChooserField4 -> setCurrentItem( 0 ); | 834 | cmbChooserField4 -> setCurrentItem( 0 ); |
835 | slotCmbChooser4Change( 0 ); | 835 | slotCmbChooser4Change( 0 ); |
836 | break; | 836 | break; |
837 | } | 837 | } |
838 | } | 838 | } |
839 | 839 | ||
840 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 840 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
841 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 841 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
842 | QLineEdit* , int widgetPos ) { | 842 | QLineEdit* , int widgetPos ) { |
843 | 843 | ||
844 | QString type = slChooserNames[index]; // :SX | 844 | QString type = slChooserNames[index]; // :SX |
845 | odebug << "ContactEditor::chooserChange( type=>" << type << "<, textChanged=>" | 845 | odebug << "ContactEditor::chooserChange( type=>" << type << "<, textChanged=>" |
846 | << textChanged << "< index=" << index << ", widgetPos=" << widgetPos | 846 | << textChanged << "< index=" << index << ", widgetPos=" << widgetPos |
847 | << " )" << oendl; | 847 | << " )" << oendl; |
848 | 848 | ||
849 | if ( type == "Default Email"){ | 849 | if ( type == "Default Email"){ |
850 | owarn << "??? Wozu??: " << textChanged << oendl; | 850 | odebug << "??? Wozu??: " << textChanged << oendl; |
851 | defaultEmail = textChanged; | 851 | defaultEmail = textChanged; |
852 | 852 | ||
853 | populateDefaultEmailCmb(); | 853 | populateDefaultEmailCmb(); |
854 | 854 | ||
855 | }else if (type == "Emails"){ | 855 | }else if (type == "Emails"){ |
856 | odebug << "emails" << oendl; | 856 | odebug << "emails" << oendl; |
857 | 857 | ||
858 | QString de; | 858 | QString de; |
859 | emails = QStringList::split (",", textChanged ); | 859 | emails = QStringList::split (",", textChanged ); |
860 | 860 | ||
861 | populateDefaultEmailCmb(); | 861 | populateDefaultEmailCmb(); |
862 | } | 862 | } |
863 | 863 | ||
864 | slChooserValues[index] = textChanged; | 864 | slChooserValues[index] = textChanged; |
865 | 865 | ||
866 | } | 866 | } |
867 | 867 | ||
868 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 868 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
869 | owarn << "ContactEditor::slotChooser1Change( " << textChanged << " )" << oendl; | 869 | odebug << "ContactEditor::slotChooser1Change( " << textChanged << " )" << oendl; |
870 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 870 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
871 | } | 871 | } |
872 | 872 | ||
873 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 873 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
874 | owarn << "ContactEditor::slotChooser2Change( " << textChanged << " )" << oendl; | 874 | odebug << "ContactEditor::slotChooser2Change( " << textChanged << " )" << oendl; |
875 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 875 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
876 | 876 | ||
877 | } | 877 | } |
878 | 878 | ||
879 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 879 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
880 | owarn << "ContactEditor::slotChooser3Change( " << textChanged << " )" << oendl; | 880 | odebug << "ContactEditor::slotChooser3Change( " << textChanged << " )" << oendl; |
881 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 881 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
882 | } | 882 | } |
883 | 883 | ||
884 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 884 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
885 | owarn << "ContactEditor::slotChooser4Change( " << textChanged << " )" << oendl; | 885 | odebug << "ContactEditor::slotChooser4Change( " << textChanged << " )" << oendl; |
886 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 886 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
887 | } | 887 | } |
888 | 888 | ||
889 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 889 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
890 | 890 | ||
891 | if ( cmbAddress->currentItem() == 0 ) { | 891 | if ( cmbAddress->currentItem() == 0 ) { |
892 | slBusinessAddress[0] = textChanged; | 892 | slBusinessAddress[0] = textChanged; |
893 | } else { | 893 | } else { |
894 | slHomeAddress[0] = textChanged; | 894 | slHomeAddress[0] = textChanged; |
895 | } | 895 | } |
896 | } | 896 | } |
897 | 897 | ||
898 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 898 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
899 | 899 | ||
900 | if ( cmbAddress->currentItem() == 0 ) { | 900 | if ( cmbAddress->currentItem() == 0 ) { |
901 | slBusinessAddress[1] = textChanged; | 901 | slBusinessAddress[1] = textChanged; |
902 | } else { | 902 | } else { |
903 | slHomeAddress[1] = textChanged; | 903 | slHomeAddress[1] = textChanged; |
904 | } | 904 | } |
905 | } | 905 | } |
906 | 906 | ||
907 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 907 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
908 | 908 | ||
909 | if ( cmbAddress->currentItem() == 0 ) { | 909 | if ( cmbAddress->currentItem() == 0 ) { |
910 | slBusinessAddress[2] = textChanged; | 910 | slBusinessAddress[2] = textChanged; |
911 | } else { | 911 | } else { |
912 | slHomeAddress[2] = textChanged; | 912 | slHomeAddress[2] = textChanged; |
913 | } | 913 | } |
914 | } | 914 | } |
915 | 915 | ||
916 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 916 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
917 | 917 | ||
918 | if ( cmbAddress->currentItem() == 0 ) { | 918 | if ( cmbAddress->currentItem() == 0 ) { |
919 | slBusinessAddress[3] = textChanged; | 919 | slBusinessAddress[3] = textChanged; |
920 | } else { | 920 | } else { |
921 | slHomeAddress[3] = textChanged; | 921 | slHomeAddress[3] = textChanged; |
922 | } | 922 | } |
923 | } | 923 | } |
924 | 924 | ||
925 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 925 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
926 | 926 | ||
927 | 927 | ||
928 | if ( cmbAddress->currentItem() == 0 ) { | 928 | if ( cmbAddress->currentItem() == 0 ) { |
929 | slBusinessAddress[4] = textChanged; | 929 | slBusinessAddress[4] = textChanged; |
930 | } else { | 930 | } else { |
931 | slHomeAddress[4] = textChanged; | 931 | slHomeAddress[4] = textChanged; |
932 | } | 932 | } |
933 | } | 933 | } |
934 | 934 | ||
935 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 935 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
936 | 936 | ||
937 | if ( cmbAddress->currentItem() == 0 ) { | 937 | if ( cmbAddress->currentItem() == 0 ) { |
938 | slBusinessAddress[5] = textChanged; | 938 | slBusinessAddress[5] = textChanged; |
939 | } else { | 939 | } else { |
940 | slHomeAddress[5] = textChanged; | 940 | slHomeAddress[5] = textChanged; |
941 | } | 941 | } |
942 | } | 942 | } |
943 | 943 | ||
944 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 944 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
945 | 945 | ||
946 | if ( cmbAddress->currentItem() == 0 ) { | 946 | if ( cmbAddress->currentItem() == 0 ) { |
947 | slBusinessAddress[6] = textChanged; | 947 | slBusinessAddress[6] = textChanged; |
948 | } else { | 948 | } else { |
949 | slHomeAddress[6] = textChanged; | 949 | slHomeAddress[6] = textChanged; |
950 | } | 950 | } |
951 | } | 951 | } |
952 | 952 | ||
953 | 953 | ||
954 | void ContactEditor::slotCmbChooser1Change( int index ) { | 954 | void ContactEditor::slotCmbChooser1Change( int index ) { |
955 | owarn << "ContactEditor::slotCmbChooser1Change( " << index << " )" << oendl; | 955 | odebug << "ContactEditor::slotCmbChooser1Change( " << index << " )" << oendl; |
956 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ | 956 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ |
957 | 957 | ||
958 | txtChooserField1->setText( slChooserValues[index] ); | 958 | txtChooserField1->setText( slChooserValues[index] ); |
959 | txtChooserField1->setFocus(); | 959 | txtChooserField1->setFocus(); |
960 | 960 | ||
961 | } | 961 | } |
962 | 962 | ||
963 | } | 963 | } |
964 | 964 | ||
965 | void ContactEditor::slotCmbChooser2Change( int index ) { | 965 | void ContactEditor::slotCmbChooser2Change( int index ) { |
966 | owarn << "ContactEditor::slotCmbChooser2Change( " << index << " )" << oendl; | 966 | odebug << "ContactEditor::slotCmbChooser2Change( " << index << " )" << oendl; |
967 | 967 | ||
968 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ | 968 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ |
969 | 969 | ||
970 | txtChooserField2->setText( slChooserValues[index] ); | 970 | txtChooserField2->setText( slChooserValues[index] ); |
971 | txtChooserField2->setFocus(); | 971 | txtChooserField2->setFocus(); |
972 | 972 | ||
973 | } | 973 | } |
974 | } | 974 | } |
975 | 975 | ||
976 | void ContactEditor::slotCmbChooser3Change( int index ) { | 976 | void ContactEditor::slotCmbChooser3Change( int index ) { |
977 | owarn << "ContactEditor::slotCmbChooser3Change( " << index << " )" << oendl; | 977 | odebug << "ContactEditor::slotCmbChooser3Change( " << index << " )" << oendl; |
978 | 978 | ||
979 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ | 979 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ |
980 | 980 | ||
981 | txtChooserField3->setText( slChooserValues[index] ); | 981 | txtChooserField3->setText( slChooserValues[index] ); |
982 | txtChooserField3->setFocus(); | 982 | txtChooserField3->setFocus(); |
983 | 983 | ||
984 | } | 984 | } |
985 | } | 985 | } |
986 | 986 | ||
987 | void ContactEditor::slotCmbChooser4Change( int index ) { | 987 | void ContactEditor::slotCmbChooser4Change( int index ) { |
988 | owarn << "ContactEditor::slotCmbChooser4Change( " << index << " )" << oendl; | 988 | odebug << "ContactEditor::slotCmbChooser4Change( " << index << " )" << oendl; |
989 | 989 | ||
990 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ | 990 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ |
991 | 991 | ||
992 | txtChooserField4->setText( slChooserValues[index] ); | 992 | txtChooserField4->setText( slChooserValues[index] ); |
993 | txtChooserField4->setFocus(); | 993 | txtChooserField4->setFocus(); |
994 | 994 | ||
995 | } | 995 | } |
996 | } | 996 | } |
997 | 997 | ||
998 | void ContactEditor::slotAddressTypeChange( int index ) { | 998 | void ContactEditor::slotAddressTypeChange( int index ) { |
999 | 999 | ||
1000 | 1000 | ||
1001 | if ( !initializing ) | 1001 | if ( !initializing ) |
1002 | contactfields.setFieldOrder( 4, index ); | 1002 | contactfields.setFieldOrder( 4, index ); |
1003 | 1003 | ||
1004 | 1004 | ||
1005 | if ( index == 0 ) { | 1005 | if ( index == 0 ) { |
1006 | 1006 | ||
1007 | txtAddress->setText( slBusinessAddress[0] ); | 1007 | txtAddress->setText( slBusinessAddress[0] ); |
1008 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 1008 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
1009 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 1009 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
1010 | txtCity->setText( slBusinessAddress[3] ); | 1010 | txtCity->setText( slBusinessAddress[3] ); |
1011 | txtState->setText( slBusinessAddress[4] ); | 1011 | txtState->setText( slBusinessAddress[4] ); |
1012 | txtZip->setText( slBusinessAddress[5] ); | 1012 | txtZip->setText( slBusinessAddress[5] ); |
1013 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1013 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1014 | txtTmp->setText( slBusinessAddress[6] ); | 1014 | txtTmp->setText( slBusinessAddress[6] ); |
1015 | 1015 | ||
1016 | } else { | 1016 | } else { |
1017 | 1017 | ||
1018 | txtAddress->setText( slHomeAddress[0] ); | 1018 | txtAddress->setText( slHomeAddress[0] ); |
1019 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1019 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
1020 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1020 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
1021 | txtCity->setText( slHomeAddress[3] ); | 1021 | txtCity->setText( slHomeAddress[3] ); |
1022 | txtState->setText( slHomeAddress[4] ); | 1022 | txtState->setText( slHomeAddress[4] ); |
1023 | txtZip->setText( slHomeAddress[5] ); | 1023 | txtZip->setText( slHomeAddress[5] ); |
1024 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1024 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1025 | txtTmp->setText( slHomeAddress[6] ); | 1025 | txtTmp->setText( slHomeAddress[6] ); |
1026 | 1026 | ||
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1031 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
1032 | 1032 | ||
1033 | owarn << "ContactEditor::slotFullNameChange( " << textChanged << " )" << oendl; | 1033 | odebug << "ContactEditor::slotFullNameChange( " << textChanged << " )" << oendl; |
1034 | 1034 | ||
1035 | int index = cmbFileAs->currentItem(); | 1035 | int index = cmbFileAs->currentItem(); |
1036 | 1036 | ||
1037 | cmbFileAs->clear(); | 1037 | cmbFileAs->clear(); |
1038 | 1038 | ||
1039 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); | 1039 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); |
1040 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); | 1040 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); |
1041 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | 1041 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); |
1042 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); | 1042 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); |
1043 | if ( ! txtSuffix->text().isEmpty() ) | 1043 | if ( ! txtSuffix->text().isEmpty() ) |
1044 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); | 1044 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); |
1045 | 1045 | ||
1046 | cmbFileAs->setCurrentItem( index ); | 1046 | cmbFileAs->setCurrentItem( index ); |
1047 | 1047 | ||
1048 | 1048 | ||
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | void ContactEditor::slotSuffixChange( const QString& ) { | 1051 | void ContactEditor::slotSuffixChange( const QString& ) { |
1052 | // Just want to update the FileAs combo if the suffix was changed.. | 1052 | // Just want to update the FileAs combo if the suffix was changed.. |
1053 | slotFullNameChange( txtFullName->text() ); | 1053 | slotFullNameChange( txtFullName->text() ); |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | void ContactEditor::slotOrganizationChange( const QString &textChanged ){ | 1056 | void ContactEditor::slotOrganizationChange( const QString &textChanged ){ |
1057 | owarn << "ContactEditor::slotOrganizationChange( " << textChanged << " )" << oendl; | 1057 | odebug << "ContactEditor::slotOrganizationChange( " << textChanged << " )" << oendl; |
1058 | // Special handling for storing Companies: | 1058 | // Special handling for storing Companies: |
1059 | // If no Fullname is given, we store the Company-Name as lastname | 1059 | // If no Fullname is given, we store the Company-Name as lastname |
1060 | // to handle it like a person.. | 1060 | // to handle it like a person.. |
1061 | if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) | 1061 | if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) |
1062 | txtFullName->setText( textChanged ); | 1062 | txtFullName->setText( textChanged ); |
1063 | 1063 | ||
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | void ContactEditor::accept() { | 1066 | void ContactEditor::accept() { |
1067 | 1067 | ||
1068 | if ( isEmpty() ) { | 1068 | if ( isEmpty() ) { |
1069 | cleanupFields(); | 1069 | cleanupFields(); |
1070 | reject(); | 1070 | reject(); |
1071 | } else { | 1071 | } else { |
1072 | saveEntry(); | 1072 | saveEntry(); |
1073 | cleanupFields(); | 1073 | cleanupFields(); |
1074 | QDialog::accept(); | 1074 | QDialog::accept(); |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | } | 1077 | } |
1078 | 1078 | ||
1079 | void ContactEditor::slotNote() { | 1079 | void ContactEditor::slotNote() { |
1080 | 1080 | ||
1081 | if ( ! QPEApplication::execDialog( dlgNote ) ) { | 1081 | if ( ! QPEApplication::execDialog( dlgNote ) ) { |
1082 | txtNote->setText( ent.notes() ); | 1082 | txtNote->setText( ent.notes() ); |
1083 | } | 1083 | } |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | void ContactEditor::slotName() { | 1086 | void ContactEditor::slotName() { |
1087 | 1087 | ||
1088 | QString tmpName; | 1088 | QString tmpName; |
1089 | 1089 | ||
1090 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1090 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1091 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1091 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1092 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1092 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1093 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1093 | // txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1094 | 1094 | ||
1095 | if ( QPEApplication::execDialog( dlgName ) ) { | 1095 | if ( QPEApplication::execDialog( dlgName ) ) { |
1096 | if ( txtLastName->text().contains( ' ', TRUE ) ) | 1096 | if ( txtLastName->text().contains( ' ', TRUE ) ) |
1097 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); | 1097 | tmpName = txtLastName->text() + ", " + txtFirstName->text() + " " + txtMiddleName->text(); |
1098 | else | 1098 | else |
1099 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); | 1099 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text(); |
1100 | 1100 | ||
1101 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1101 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1102 | slotFullNameChange( txtFullName->text() ); | 1102 | slotFullNameChange( txtFullName->text() ); |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | void ContactEditor::setNameFocus() { | 1107 | void ContactEditor::setNameFocus() { |
1108 | 1108 | ||
1109 | txtFullName->setFocus(); | 1109 | txtFullName->setFocus(); |
1110 | 1110 | ||
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | bool ContactEditor::isEmpty() { | 1113 | bool ContactEditor::isEmpty() { |
1114 | // Test and see if the record should be saved. | 1114 | // Test and see if the record should be saved. |
1115 | // More strict than the original qtopia, needs name or fileas to save | 1115 | // More strict than the original qtopia, needs name or fileas to save |
1116 | 1116 | ||
1117 | QString t = txtFullName->text(); | 1117 | QString t = txtFullName->text(); |
1118 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1118 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1119 | return false; | 1119 | return false; |
1120 | 1120 | ||
1121 | t = cmbFileAs->currentText(); | 1121 | t = cmbFileAs->currentText(); |
1122 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1122 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1123 | return false; | 1123 | return false; |
1124 | 1124 | ||
1125 | return true; | 1125 | return true; |
1126 | 1126 | ||
1127 | } | 1127 | } |
1128 | 1128 | ||
1129 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1129 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1130 | 1130 | ||
1131 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1131 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1132 | QString strFirstName; | 1132 | QString strFirstName; |
1133 | QString strMiddleName; | 1133 | QString strMiddleName; |
1134 | QString strLastName; | 1134 | QString strLastName; |
1135 | QString strTitle; | 1135 | QString strTitle; |
1136 | int commapos; | 1136 | int commapos; |
1137 | bool haveLastName = false; | 1137 | bool haveLastName = false; |
1138 | 1138 | ||
1139 | owarn << "Fullname: " << simplifiedName << oendl; | 1139 | odebug << "Fullname: " << simplifiedName << oendl; |
1140 | 1140 | ||
1141 | commapos = simplifiedName.find( ',', 0, TRUE); | 1141 | commapos = simplifiedName.find( ',', 0, TRUE); |
1142 | if ( commapos >= 0 ) { | 1142 | if ( commapos >= 0 ) { |
1143 | owarn << " Commapos: " << commapos << oendl; | 1143 | odebug << " Commapos: " << commapos << oendl; |
1144 | 1144 | ||
1145 | // A comma (",") separates the lastname from one or | 1145 | // A comma (",") separates the lastname from one or |
1146 | // many first names. Thus, remove the lastname from the | 1146 | // many first names. Thus, remove the lastname from the |
1147 | // String and parse the firstnames. | 1147 | // String and parse the firstnames. |
1148 | 1148 | ||
1149 | strLastName = simplifiedName.left( commapos ); | 1149 | strLastName = simplifiedName.left( commapos ); |
1150 | simplifiedName= simplifiedName.mid( commapos + 1 ); | 1150 | simplifiedName= simplifiedName.mid( commapos + 1 ); |
1151 | haveLastName = true; | 1151 | haveLastName = true; |
1152 | owarn << "Fullname without ',': " << simplifiedName << oendl; | 1152 | odebug << "Fullname without ',': " << simplifiedName << oendl; |
1153 | 1153 | ||
1154 | // If we have any lastname, we should now split all first names. | 1154 | // If we have any lastname, we should now split all first names. |
1155 | // The first one will be the used as first, the rest as "middle names" | 1155 | // The first one will be the used as first, the rest as "middle names" |
1156 | 1156 | ||
1157 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); | 1157 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); |
1158 | QStringList::Iterator it = allFirstNames.begin(); | 1158 | QStringList::Iterator it = allFirstNames.begin(); |
1159 | strFirstName = *it++; | 1159 | strFirstName = *it++; |
1160 | QStringList allSecondNames; | 1160 | QStringList allSecondNames; |
1161 | for ( ; it != allFirstNames.end(); ++it ) | 1161 | for ( ; it != allFirstNames.end(); ++it ) |
1162 | allSecondNames.append( *it ); | 1162 | allSecondNames.append( *it ); |
1163 | 1163 | ||
1164 | strMiddleName = allSecondNames.join(" "); | 1164 | strMiddleName = allSecondNames.join(" "); |
1165 | 1165 | ||
1166 | } else { | 1166 | } else { |
1167 | 1167 | ||
1168 | // No comma separator used: We use the first word as firstname, the | 1168 | // No comma separator used: We use the first word as firstname, the |
1169 | // last as second/lastname and everything in the middle as middlename | 1169 | // last as second/lastname and everything in the middle as middlename |
1170 | 1170 | ||
1171 | QStringList allNames = QStringList::split(" ", simplifiedName); | 1171 | QStringList allNames = QStringList::split(" ", simplifiedName); |
1172 | QStringList::Iterator it = allNames.begin(); | 1172 | QStringList::Iterator it = allNames.begin(); |
1173 | strFirstName = *it++; | 1173 | strFirstName = *it++; |
1174 | QStringList allSecondNames; | 1174 | QStringList allSecondNames; |
1175 | for ( ; it != --allNames.end(); ++it ) | 1175 | for ( ; it != --allNames.end(); ++it ) |
1176 | allSecondNames.append( *it ); | 1176 | allSecondNames.append( *it ); |
1177 | 1177 | ||
1178 | strMiddleName = allSecondNames.join(" "); | 1178 | strMiddleName = allSecondNames.join(" "); |
1179 | strLastName = *(--allNames.end()); | 1179 | strLastName = *(--allNames.end()); |
1180 | 1180 | ||
1181 | } | 1181 | } |
1182 | 1182 | ||
1183 | if ( strFirstName == strLastName ) | 1183 | if ( strFirstName == strLastName ) |
1184 | strFirstName = ""; | 1184 | strFirstName = ""; |
1185 | 1185 | ||
1186 | owarn << "strFirstName: " << strFirstName << oendl; | 1186 | odebug << "strFirstName: " << strFirstName << oendl; |
1187 | owarn << "strMiddletName: " << strMiddleName << oendl; | 1187 | odebug << "strMiddletName: " << strMiddleName << oendl; |
1188 | owarn << "strLastName: " << strLastName << oendl; | 1188 | odebug << "strLastName: " << strLastName << oendl; |
1189 | owarn << "strTitle: " << strTitle << oendl; | 1189 | odebug << "strTitle: " << strTitle << oendl; |
1190 | 1190 | ||
1191 | switch (type) { | 1191 | switch (type) { |
1192 | case NAME_FL: | 1192 | case NAME_FL: |
1193 | return strFirstName + " " + strLastName; | 1193 | return strFirstName + " " + strLastName; |
1194 | 1194 | ||
1195 | case NAME_LF: | 1195 | case NAME_LF: |
1196 | return strLastName + ", " + strFirstName; | 1196 | return strLastName + ", " + strFirstName; |
1197 | 1197 | ||
1198 | case NAME_LFM: | 1198 | case NAME_LFM: |
1199 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1199 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1200 | 1200 | ||
1201 | case NAME_FML: | 1201 | case NAME_FML: |
1202 | return strFirstName + " " + strMiddleName + " " + strLastName ; | 1202 | return strFirstName + " " + strMiddleName + " " + strLastName ; |
1203 | 1203 | ||
1204 | case NAME_F: | 1204 | case NAME_F: |
1205 | return strFirstName; | 1205 | return strFirstName; |
1206 | 1206 | ||
1207 | case NAME_M: | 1207 | case NAME_M: |
1208 | return strMiddleName; | 1208 | return strMiddleName; |
1209 | 1209 | ||
1210 | case NAME_L: | 1210 | case NAME_L: |
1211 | return strLastName; | 1211 | return strLastName; |
1212 | 1212 | ||
1213 | case NAME_S: | 1213 | case NAME_S: |
1214 | return txtSuffix->text(); | 1214 | return txtSuffix->text(); |
1215 | 1215 | ||
1216 | } | 1216 | } |
1217 | return QString::null; | 1217 | return QString::null; |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | void ContactEditor::cleanupFields() { | 1220 | void ContactEditor::cleanupFields() { |
1221 | QStringList::Iterator it = slChooserValues.begin(); | 1221 | QStringList::Iterator it = slChooserValues.begin(); |
1222 | 1222 | ||
1223 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { | 1223 | for ( int i = 0; it != slChooserValues.end(); i++, ++it ) { |
1224 | (*it) = ""; | 1224 | (*it) = ""; |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | for ( int i = 0; i < 7; i++ ) { | 1227 | for ( int i = 0; i < 7; i++ ) { |
1228 | slHomeAddress[i] = ""; | 1228 | slHomeAddress[i] = ""; |
1229 | slBusinessAddress[i] = ""; | 1229 | slBusinessAddress[i] = ""; |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | QListIterator<QLineEdit> itLV( listValue ); | 1232 | QListIterator<QLineEdit> itLV( listValue ); |
1233 | for ( ; itLV.current(); ++itLV ) { | 1233 | for ( ; itLV.current(); ++itLV ) { |
1234 | (*itLV)->setText( "" ); | 1234 | (*itLV)->setText( "" ); |
1235 | } | 1235 | } |
1236 | 1236 | ||
1237 | txtFirstName->setText(""); | 1237 | txtFirstName->setText(""); |
1238 | txtMiddleName->setText(""); | 1238 | txtMiddleName->setText(""); |
1239 | txtLastName->setText(""); | 1239 | txtLastName->setText(""); |
1240 | txtSuffix->setText(""); | 1240 | txtSuffix->setText(""); |
1241 | txtNote->setText(""); | 1241 | txtNote->setText(""); |
1242 | txtFullName->setText(""); | 1242 | txtFullName->setText(""); |
1243 | txtJobTitle->setText(""); | 1243 | txtJobTitle->setText(""); |
1244 | txtOrganization->setText(""); | 1244 | txtOrganization->setText(""); |
1245 | txtChooserField1->setText(""); | 1245 | txtChooserField1->setText(""); |
1246 | txtChooserField2->setText(""); | 1246 | txtChooserField2->setText(""); |
1247 | txtChooserField3->setText(""); | 1247 | txtChooserField3->setText(""); |
1248 | txtAddress->setText(""); | 1248 | txtAddress->setText(""); |
1249 | txtCity->setText(""); | 1249 | txtCity->setText(""); |
1250 | txtState->setText(""); | 1250 | txtState->setText(""); |
1251 | txtZip->setText(""); | 1251 | txtZip->setText(""); |
1252 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1252 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1253 | txtTmp->setText(""); | 1253 | txtTmp->setText(""); |
1254 | txtTmp = cmbFileAs->lineEdit(); | 1254 | txtTmp = cmbFileAs->lineEdit(); |
1255 | txtTmp->setText(""); | 1255 | txtTmp->setText(""); |
1256 | 1256 | ||
1257 | } | 1257 | } |
1258 | 1258 | ||
1259 | void ContactEditor::setEntry( const Opie::OPimContact &entry ) { | 1259 | void ContactEditor::setEntry( const Opie::OPimContact &entry ) { |
1260 | 1260 | ||
1261 | initializing = true; | 1261 | initializing = true; |
1262 | 1262 | ||
1263 | // Cleanup and activate the general Page .. | 1263 | // Cleanup and activate the general Page .. |
1264 | cleanupFields(); | 1264 | cleanupFields(); |
1265 | tabMain->setCurrentPage( 0 ); | 1265 | tabMain->setCurrentPage( 0 ); |
1266 | 1266 | ||
1267 | ent = entry; | 1267 | ent = entry; |
1268 | 1268 | ||
1269 | emails = QStringList(ent.emailList()); | 1269 | emails = QStringList(ent.emailList()); |
1270 | defaultEmail = ent.defaultEmail(); | 1270 | defaultEmail = ent.defaultEmail(); |
1271 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1271 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1272 | odebug << "default email=" << defaultEmail << oendl; | 1272 | odebug << "default email=" << defaultEmail << oendl; |
1273 | 1273 | ||
1274 | txtFirstName->setText( ent.firstName() ); | 1274 | txtFirstName->setText( ent.firstName() ); |
1275 | txtMiddleName->setText( ent.middleName() ); | 1275 | txtMiddleName->setText( ent.middleName() ); |
1276 | txtLastName->setText( ent.lastName() ); | 1276 | txtLastName->setText( ent.lastName() ); |
1277 | txtSuffix->setText( ent.suffix() ); | 1277 | txtSuffix->setText( ent.suffix() ); |
1278 | 1278 | ||
1279 | // QString *tmpString = new QString; | 1279 | // QString *tmpString = new QString; |
1280 | // *tmpString = ent.firstName() + " " + ent.middleName() + | 1280 | // *tmpString = ent.firstName() + " " + ent.middleName() + |
1281 | // + " " + ent.lastName() + " " + ent.suffix(); | 1281 | // + " " + ent.lastName() + " " + ent.suffix(); |
1282 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1282 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1283 | 1283 | ||
1284 | if ( !ent.isEmpty() ){ | 1284 | if ( !ent.isEmpty() ){ |
1285 | // Lastnames with multiple words need to be protected by a comma ! | 1285 | // Lastnames with multiple words need to be protected by a comma ! |
1286 | if ( ent.lastName().contains( ' ', TRUE ) ) | 1286 | if ( ent.lastName().contains( ' ', TRUE ) ) |
1287 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | 1287 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); |
1288 | else | 1288 | else |
1289 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | 1289 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); |
1290 | } | 1290 | } |
1291 | 1291 | ||
1292 | cmbFileAs->setEditText( ent.fileAs() ); | 1292 | cmbFileAs->setEditText( ent.fileAs() ); |
1293 | 1293 | ||
1294 | //if (hasTitle) | 1294 | //if (hasTitle) |
1295 | txtJobTitle->setText( ent.jobTitle() ); | 1295 | txtJobTitle->setText( ent.jobTitle() ); |
1296 | 1296 | ||
1297 | //if (hasCompany) | 1297 | //if (hasCompany) |
1298 | txtOrganization->setText( ent.company() ); | 1298 | txtOrganization->setText( ent.company() ); |
1299 | 1299 | ||
1300 | //if (hasNotes) | 1300 | //if (hasNotes) |
1301 | txtNote->setText( ent.notes() ); | 1301 | txtNote->setText( ent.notes() ); |
1302 | 1302 | ||
1303 | //if (hasStreet) { | 1303 | //if (hasStreet) { |
1304 | slHomeAddress[0] = ent.homeStreet(); | 1304 | slHomeAddress[0] = ent.homeStreet(); |
1305 | slBusinessAddress[0] = ent.businessStreet(); | 1305 | slBusinessAddress[0] = ent.businessStreet(); |
1306 | //} | 1306 | //} |
1307 | 1307 | ||
1308 | //if (hasCity) { | 1308 | //if (hasCity) { |
1309 | slHomeAddress[3] = ent.homeCity(); | 1309 | slHomeAddress[3] = ent.homeCity(); |
1310 | slBusinessAddress[3] = ent.businessCity(); | 1310 | slBusinessAddress[3] = ent.businessCity(); |
1311 | //} | 1311 | //} |
1312 | 1312 | ||
1313 | //if (hasState) { | 1313 | //if (hasState) { |
1314 | slHomeAddress[4] = ent.homeState(); | 1314 | slHomeAddress[4] = ent.homeState(); |
1315 | slBusinessAddress[4] = ent.businessState(); | 1315 | slBusinessAddress[4] = ent.businessState(); |
1316 | //} | 1316 | //} |
1317 | 1317 | ||
1318 | //if (hasZip) { | 1318 | //if (hasZip) { |
1319 | slHomeAddress[5] = ent.homeZip(); | 1319 | slHomeAddress[5] = ent.homeZip(); |
1320 | slBusinessAddress[5] = ent.businessZip(); | 1320 | slBusinessAddress[5] = ent.businessZip(); |
1321 | //} | 1321 | //} |
1322 | 1322 | ||
1323 | //if (hasCountry) { | 1323 | //if (hasCountry) { |
1324 | slHomeAddress[6] = ent.homeCountry(); | 1324 | slHomeAddress[6] = ent.homeCountry(); |
1325 | slBusinessAddress[6] = ent.businessCountry(); | 1325 | slBusinessAddress[6] = ent.businessCountry(); |
1326 | //} | 1326 | //} |
1327 | 1327 | ||
1328 | QStringList::ConstIterator it; | 1328 | QStringList::ConstIterator it; |
1329 | QListIterator<QLineEdit> itLE( listValue ); | 1329 | QListIterator<QLineEdit> itLE( listValue ); |
1330 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1330 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1331 | 1331 | ||
1332 | owarn << " Filling dynamic Field: " << (*it) << oendl; | 1332 | odebug << " Filling dynamic Field: " << (*it) << oendl; |
1333 | 1333 | ||
1334 | if ( *it == "Department" ) | 1334 | if ( *it == "Department" ) |
1335 | (*itLE)->setText( ent.department() ); | 1335 | (*itLE)->setText( ent.department() ); |
1336 | 1336 | ||
1337 | if ( *it == "Company" ) | 1337 | if ( *it == "Company" ) |
1338 | (*itLE)->setText( ent.company() ); | 1338 | (*itLE)->setText( ent.company() ); |
1339 | 1339 | ||
1340 | if ( *it == "Office" ) | 1340 | if ( *it == "Office" ) |
1341 | (*itLE)->setText( ent.office() ); | 1341 | (*itLE)->setText( ent.office() ); |
1342 | 1342 | ||
1343 | if ( *it == "Profession" ) | 1343 | if ( *it == "Profession" ) |
1344 | (*itLE)->setText( ent.profession() ); | 1344 | (*itLE)->setText( ent.profession() ); |
1345 | 1345 | ||
1346 | if ( *it == "Assistant" ) | 1346 | if ( *it == "Assistant" ) |
1347 | (*itLE)->setText( ent.assistant() ); | 1347 | (*itLE)->setText( ent.assistant() ); |
1348 | 1348 | ||
1349 | if ( *it == "Manager" ) | 1349 | if ( *it == "Manager" ) |
1350 | (*itLE)->setText( ent.manager() ); | 1350 | (*itLE)->setText( ent.manager() ); |
1351 | 1351 | ||
1352 | if ( *it == "Spouse" ) | 1352 | if ( *it == "Spouse" ) |
1353 | (*itLE)->setText( ent.spouse() ); | 1353 | (*itLE)->setText( ent.spouse() ); |
1354 | 1354 | ||
1355 | if ( *it == "Nickname" ){ | 1355 | if ( *it == "Nickname" ){ |
1356 | owarn << "**** Nichname: " << ent.nickname() << oendl; | 1356 | odebug << "**** Nichname: " << ent.nickname() << oendl; |
1357 | (*itLE)->setText( ent.nickname() ); | 1357 | (*itLE)->setText( ent.nickname() ); |
1358 | } | 1358 | } |
1359 | 1359 | ||
1360 | if ( *it == "Children" ) | 1360 | if ( *it == "Children" ) |
1361 | (*itLE)->setText( ent.children() ); | 1361 | (*itLE)->setText( ent.children() ); |
1362 | 1362 | ||
1363 | } | 1363 | } |
1364 | 1364 | ||
1365 | QStringList::Iterator itV; | 1365 | QStringList::Iterator itV; |
1366 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1366 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1367 | 1367 | ||
1368 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1368 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1369 | *itV = ent.businessPhone(); | 1369 | *itV = ent.businessPhone(); |
1370 | /* | 1370 | /* |
1371 | if ( *it == "Business 2 Phone" ) | 1371 | if ( *it == "Business 2 Phone" ) |
1372 | *itV = ent.business2Phone(); | 1372 | *itV = ent.business2Phone(); |
1373 | */ | 1373 | */ |
1374 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1374 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1375 | *itV = ent.businessFax(); | 1375 | *itV = ent.businessFax(); |
1376 | 1376 | ||
1377 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1377 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1378 | *itV = ent.businessMobile(); | 1378 | *itV = ent.businessMobile(); |
1379 | /* | 1379 | /* |
1380 | if ( *it == "Company Phone" ) | 1380 | if ( *it == "Company Phone" ) |
1381 | *itV = ent.companyPhone(); | 1381 | *itV = ent.companyPhone(); |
1382 | */ | 1382 | */ |
1383 | if ( *it == "Default Email" ) | 1383 | if ( *it == "Default Email" ) |
1384 | *itV = ent.defaultEmail(); | 1384 | *itV = ent.defaultEmail(); |
1385 | 1385 | ||
1386 | if ( *it == "Emails" ) | 1386 | if ( *it == "Emails" ) |
1387 | *itV = ent.emailList().join(", "); // :SX | 1387 | *itV = ent.emailList().join(", "); // :SX |
1388 | 1388 | ||
1389 | if ( *it == "Home Phone" ) | 1389 | if ( *it == "Home Phone" ) |
1390 | *itV = ent.homePhone(); | 1390 | *itV = ent.homePhone(); |
1391 | /* | 1391 | /* |
1392 | if ( *it == "Home 2 Phone" ) | 1392 | if ( *it == "Home 2 Phone" ) |
1393 | *itV = ent.home2Phone(); | 1393 | *itV = ent.home2Phone(); |
1394 | */ | 1394 | */ |
1395 | if ( *it == "Home Fax" ) | 1395 | if ( *it == "Home Fax" ) |
1396 | *itV = ent.homeFax(); | 1396 | *itV = ent.homeFax(); |
1397 | 1397 | ||
1398 | if ( *it == "Home Mobile" ) | 1398 | if ( *it == "Home Mobile" ) |
1399 | *itV = ent.homeMobile(); | 1399 | *itV = ent.homeMobile(); |
1400 | /* | 1400 | /* |
1401 | if ( *it == "Car Phone" ) | 1401 | if ( *it == "Car Phone" ) |
1402 | *itV = ent.carPhone(); | 1402 | *itV = ent.carPhone(); |
1403 | 1403 | ||
1404 | if ( *it == "ISDN Phone" ) | 1404 | if ( *it == "ISDN Phone" ) |
1405 | *itV = ent.ISDNPhone(); | 1405 | *itV = ent.ISDNPhone(); |
1406 | 1406 | ||
1407 | if ( *it == "Other Phone" ) | 1407 | if ( *it == "Other Phone" ) |
1408 | *itV = ent.otherPhone(); | 1408 | *itV = ent.otherPhone(); |
1409 | */ | 1409 | */ |
1410 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1410 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1411 | *itV = ent.businessPager(); | 1411 | *itV = ent.businessPager(); |
1412 | /* | 1412 | /* |
1413 | if ( *it == "Home Pager") | 1413 | if ( *it == "Home Pager") |
1414 | *itV = ent.homePager(); | 1414 | *itV = ent.homePager(); |
1415 | 1415 | ||
1416 | if ( *it == "AIM IM" ) | 1416 | if ( *it == "AIM IM" ) |
1417 | *itV = ent.AIMIM(); | 1417 | *itV = ent.AIMIM(); |
1418 | 1418 | ||
1419 | if ( *it == "ICQ IM" ) | 1419 | if ( *it == "ICQ IM" ) |
1420 | *itV = ent.ICQIM(); | 1420 | *itV = ent.ICQIM(); |
1421 | 1421 | ||
1422 | if ( *it == "Jabber IM" ) | 1422 | if ( *it == "Jabber IM" ) |
1423 | *itV = ent.jabberIM(); | 1423 | *itV = ent.jabberIM(); |
1424 | 1424 | ||
1425 | if ( *it == "MSN IM" ) | 1425 | if ( *it == "MSN IM" ) |
1426 | *itV = ent.MSNIM(); | 1426 | *itV = ent.MSNIM(); |
1427 | 1427 | ||
1428 | if ( *it == "Yahoo IM" ) | 1428 | if ( *it == "Yahoo IM" ) |
1429 | *itV = ent.yahooIM(); | 1429 | *itV = ent.yahooIM(); |
1430 | */ | 1430 | */ |
1431 | if ( *it == "Home Web Page" ) | 1431 | if ( *it == "Home Web Page" ) |
1432 | *itV = ent.homeWebpage(); | 1432 | *itV = ent.homeWebpage(); |
1433 | 1433 | ||
1434 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1434 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1435 | *itV = ent.businessWebpage(); | 1435 | *itV = ent.businessWebpage(); |
1436 | 1436 | ||
1437 | 1437 | ||
1438 | } | 1438 | } |
1439 | 1439 | ||
1440 | 1440 | ||
1441 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1441 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1442 | 1442 | ||
1443 | QString gender = ent.gender(); | 1443 | QString gender = ent.gender(); |
1444 | cmbGender->setCurrentItem( gender.toInt() ); | 1444 | cmbGender->setCurrentItem( gender.toInt() ); |
1445 | 1445 | ||
1446 | txtNote->setText( ent.notes() ); | 1446 | txtNote->setText( ent.notes() ); |
1447 | 1447 | ||
1448 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1448 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1449 | 1449 | ||
1450 | // Get combo-settings from contact and set preset.. | 1450 | // Get combo-settings from contact and set preset.. |
1451 | contactfields.loadFromRecord( ent ); | 1451 | contactfields.loadFromRecord( ent ); |
1452 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); | 1452 | cmbChooserField1->setCurrentItem( contactfields.getFieldOrder(0, 7) ); |
1453 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); | 1453 | cmbChooserField2->setCurrentItem( contactfields.getFieldOrder(1, 9) ); |
1454 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); | 1454 | cmbChooserField3->setCurrentItem( contactfields.getFieldOrder(2, 0) ); |
1455 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); | 1455 | cmbChooserField4->setCurrentItem( contactfields.getFieldOrder(3, 6) ); |
1456 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); | 1456 | cmbAddress->setCurrentItem( contactfields.getFieldOrder(4, 1) ); |
1457 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1457 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1458 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1458 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1459 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1459 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1460 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); | 1460 | slotCmbChooser4Change( cmbChooserField4->currentItem() ); |
1461 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1461 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1462 | 1462 | ||
1463 | updateDatePicker(); | 1463 | updateDatePicker(); |
1464 | 1464 | ||
1465 | initializing = false; | 1465 | initializing = false; |
1466 | } | 1466 | } |
1467 | void ContactEditor::updateDatePicker() | 1467 | void ContactEditor::updateDatePicker() |
1468 | { | 1468 | { |
1469 | // Set DatePicker | 1469 | // Set DatePicker |
1470 | if ( !ent.birthday().isNull() ){ | 1470 | if ( !ent.birthday().isNull() ){ |
1471 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); | 1471 | birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); |
1472 | birthdayPicker->setDate( ent.birthday() ); | 1472 | birthdayPicker->setDate( ent.birthday() ); |
1473 | } else | 1473 | } else |
1474 | birthdayButton->setText( tr ("Unknown") ); | 1474 | birthdayButton->setText( tr ("Unknown") ); |
1475 | 1475 | ||
1476 | if ( !ent.anniversary().isNull() ){ | 1476 | if ( !ent.anniversary().isNull() ){ |
1477 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); | 1477 | anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); |
1478 | anniversaryPicker->setDate( ent.anniversary() ); | 1478 | anniversaryPicker->setDate( ent.anniversary() ); |
1479 | } else | 1479 | } else |
1480 | anniversaryButton->setText( tr ("Unknown") ); | 1480 | anniversaryButton->setText( tr ("Unknown") ); |
1481 | 1481 | ||
1482 | } | 1482 | } |
1483 | 1483 | ||
1484 | void ContactEditor::saveEntry() { | 1484 | void ContactEditor::saveEntry() { |
1485 | 1485 | ||
1486 | // Store current combo into contact | 1486 | // Store current combo into contact |
1487 | contactfields.saveToRecord( ent ); | 1487 | contactfields.saveToRecord( ent ); |
1488 | 1488 | ||
1489 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1489 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1490 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1490 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1491 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1491 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1492 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1492 | // txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1493 | 1493 | ||
1494 | ent.setFirstName( txtFirstName->text() ); | 1494 | ent.setFirstName( txtFirstName->text() ); |
1495 | ent.setLastName( txtLastName->text() ); | 1495 | ent.setLastName( txtLastName->text() ); |
1496 | ent.setMiddleName( txtMiddleName->text() ); | 1496 | ent.setMiddleName( txtMiddleName->text() ); |
1497 | ent.setSuffix( txtSuffix->text() ); | 1497 | ent.setSuffix( txtSuffix->text() ); |
1498 | 1498 | ||
1499 | ent.setFileAs( cmbFileAs->currentText() ); | 1499 | ent.setFileAs( cmbFileAs->currentText() ); |
1500 | 1500 | ||
1501 | ent.setCategories( cmbCat->currentCategories() ); | 1501 | ent.setCategories( cmbCat->currentCategories() ); |
1502 | 1502 | ||
1503 | 1503 | ||
1504 | //if (hasTitle) | 1504 | //if (hasTitle) |
1505 | ent.setJobTitle( txtJobTitle->text() ); | 1505 | ent.setJobTitle( txtJobTitle->text() ); |
1506 | 1506 | ||
1507 | //if (hasCompany) | 1507 | //if (hasCompany) |
1508 | ent.setCompany( txtOrganization->text() ); | 1508 | ent.setCompany( txtOrganization->text() ); |
1509 | 1509 | ||
1510 | //if (hasNotes) | 1510 | //if (hasNotes) |
1511 | ent.setNotes( txtNote->text() ); | 1511 | ent.setNotes( txtNote->text() ); |
1512 | 1512 | ||
1513 | //if (hasStreet) { | 1513 | //if (hasStreet) { |
1514 | ent.setHomeStreet( slHomeAddress[0] ); | 1514 | ent.setHomeStreet( slHomeAddress[0] ); |
1515 | ent.setBusinessStreet( slBusinessAddress[0] ); | 1515 | ent.setBusinessStreet( slBusinessAddress[0] ); |
1516 | //} | 1516 | //} |
1517 | 1517 | ||
1518 | //if (hasCity) { | 1518 | //if (hasCity) { |
1519 | ent.setHomeCity( slHomeAddress[3] ); | 1519 | ent.setHomeCity( slHomeAddress[3] ); |
1520 | ent.setBusinessCity( slBusinessAddress[3] ); | 1520 | ent.setBusinessCity( slBusinessAddress[3] ); |
1521 | //} | 1521 | //} |
1522 | 1522 | ||
1523 | //if (hasState) { | 1523 | //if (hasState) { |
1524 | ent.setHomeState( slHomeAddress[4] ); | 1524 | ent.setHomeState( slHomeAddress[4] ); |
1525 | ent.setBusinessState( slBusinessAddress[4] ); | 1525 | ent.setBusinessState( slBusinessAddress[4] ); |
1526 | //} | 1526 | //} |
1527 | 1527 | ||
1528 | //if (hasZip) { | 1528 | //if (hasZip) { |
1529 | ent.setHomeZip( slHomeAddress[5] ); | 1529 | ent.setHomeZip( slHomeAddress[5] ); |
1530 | ent.setBusinessZip( slBusinessAddress[5] ); | 1530 | ent.setBusinessZip( slBusinessAddress[5] ); |
1531 | //} | 1531 | //} |
1532 | 1532 | ||
1533 | //if (hasCountry) { | 1533 | //if (hasCountry) { |
1534 | ent.setHomeCountry( slHomeAddress[6] ); | 1534 | ent.setHomeCountry( slHomeAddress[6] ); |
1535 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1535 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1536 | //} | 1536 | //} |
1537 | 1537 | ||
1538 | QStringList::ConstIterator it; | 1538 | QStringList::ConstIterator it; |
1539 | QListIterator<QLineEdit> itLE( listValue ); | 1539 | QListIterator<QLineEdit> itLE( listValue ); |
1540 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { | 1540 | for ( it = slDynamicEntries.begin(); itLE.current() && it != slDynamicEntries.end(); ++it, ++itLE) { |
1541 | 1541 | ||
1542 | if ( *it == "Department" ) | 1542 | if ( *it == "Department" ) |
1543 | ent.setDepartment( (*itLE)->text() ); | 1543 | ent.setDepartment( (*itLE)->text() ); |
1544 | 1544 | ||
1545 | if ( *it == "Company" ) | 1545 | if ( *it == "Company" ) |
1546 | ent.setCompany( (*itLE)->text() ); | 1546 | ent.setCompany( (*itLE)->text() ); |
1547 | 1547 | ||
1548 | if ( *it == "Office" ) | 1548 | if ( *it == "Office" ) |
1549 | ent.setOffice( (*itLE)->text() ); | 1549 | ent.setOffice( (*itLE)->text() ); |
1550 | 1550 | ||
1551 | if ( *it == "Profession" ) | 1551 | if ( *it == "Profession" ) |
1552 | ent.setProfession( (*itLE)->text() ); | 1552 | ent.setProfession( (*itLE)->text() ); |
1553 | 1553 | ||
1554 | if ( *it == "Assistant" ) | 1554 | if ( *it == "Assistant" ) |
1555 | ent.setAssistant( (*itLE)->text() ); | 1555 | ent.setAssistant( (*itLE)->text() ); |
1556 | 1556 | ||
1557 | if ( *it == "Manager" ) | 1557 | if ( *it == "Manager" ) |
1558 | ent.setManager( (*itLE)->text() ); | 1558 | ent.setManager( (*itLE)->text() ); |
1559 | 1559 | ||
1560 | if ( *it == "Spouse" ) | 1560 | if ( *it == "Spouse" ) |
1561 | ent.setSpouse( (*itLE)->text() ); | 1561 | ent.setSpouse( (*itLE)->text() ); |
1562 | 1562 | ||
1563 | if ( *it == "Nickname" ) | 1563 | if ( *it == "Nickname" ) |
1564 | ent.setNickname( (*itLE)->text() ); | 1564 | ent.setNickname( (*itLE)->text() ); |
1565 | 1565 | ||
1566 | if ( *it == "Children" ) | 1566 | if ( *it == "Children" ) |
1567 | ent.setChildren( (*itLE)->text() ); | 1567 | ent.setChildren( (*itLE)->text() ); |
1568 | 1568 | ||
1569 | } | 1569 | } |
1570 | 1570 | ||
1571 | 1571 | ||
1572 | QStringList::ConstIterator itV; | 1572 | QStringList::ConstIterator itV; |
1573 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1573 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1574 | 1574 | ||
1575 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1575 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1576 | ent.setBusinessPhone( *itV ); | 1576 | ent.setBusinessPhone( *itV ); |
1577 | 1577 | ||
1578 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1578 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1579 | ent.setBusinessFax( *itV ); | 1579 | ent.setBusinessFax( *itV ); |
1580 | 1580 | ||
1581 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1581 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1582 | ent.setBusinessMobile( *itV ); | 1582 | ent.setBusinessMobile( *itV ); |
1583 | 1583 | ||
1584 | if ( *it == "Emails" ){ | 1584 | if ( *it == "Emails" ){ |
1585 | QString allemail; | 1585 | QString allemail; |
1586 | QString defaultmail; | 1586 | QString defaultmail; |
1587 | parseEmailFrom( emails.join(","), defaultmail, allemail ); | 1587 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1588 | if ( defaultEmail.isEmpty() ){ | 1588 | if ( defaultEmail.isEmpty() ){ |
1589 | owarn << "Default email was not set by user!" << oendl; | 1589 | odebug << "Default email was not set by user!" << oendl; |
1590 | owarn << "Using first email in list: " << defaultmail << oendl; | 1590 | odebug << "Using first email in list: " << defaultmail << oendl; |
1591 | ent.setDefaultEmail( defaultmail ); | 1591 | ent.setDefaultEmail( defaultmail ); |
1592 | } | 1592 | } |
1593 | ent.setEmails( allemail ); | 1593 | ent.setEmails( allemail ); |
1594 | } | 1594 | } |
1595 | 1595 | ||
1596 | if ( *it == "Default Email") | 1596 | if ( *it == "Default Email") |
1597 | ent.setDefaultEmail( defaultEmail /* *itV */ ); | 1597 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1598 | 1598 | ||
1599 | if ( *it == "Home Phone" ) | 1599 | if ( *it == "Home Phone" ) |
1600 | ent.setHomePhone( *itV ); | 1600 | ent.setHomePhone( *itV ); |
1601 | 1601 | ||
1602 | if ( *it == "Home Fax" ) | 1602 | if ( *it == "Home Fax" ) |
1603 | ent.setHomeFax( *itV ); | 1603 | ent.setHomeFax( *itV ); |
1604 | 1604 | ||
1605 | if ( *it == "Home Mobile" ) | 1605 | if ( *it == "Home Mobile" ) |
1606 | ent.setHomeMobile( *itV ); | 1606 | ent.setHomeMobile( *itV ); |
1607 | 1607 | ||
1608 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1608 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1609 | ent.setBusinessPager( *itV ); | 1609 | ent.setBusinessPager( *itV ); |
1610 | 1610 | ||
1611 | if ( *it == "Home Web Page" ) | 1611 | if ( *it == "Home Web Page" ) |
1612 | ent.setHomeWebpage( *itV ); | 1612 | ent.setHomeWebpage( *itV ); |
1613 | 1613 | ||
1614 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1614 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
1615 | ent.setBusinessWebpage( *itV ); | 1615 | ent.setBusinessWebpage( *itV ); |
1616 | 1616 | ||
1617 | 1617 | ||
1618 | } | 1618 | } |
1619 | 1619 | ||
1620 | int gender = cmbGender->currentItem(); | 1620 | int gender = cmbGender->currentItem(); |
1621 | ent.setGender( QString::number( gender ) ); | 1621 | ent.setGender( QString::number( gender ) ); |
1622 | 1622 | ||
1623 | QString str = txtNote->text(); | 1623 | QString str = txtNote->text(); |
1624 | if ( !str.isNull() ) | 1624 | if ( !str.isNull() ) |
1625 | ent.setNotes( str ); | 1625 | ent.setNotes( str ); |
1626 | 1626 | ||
1627 | } | 1627 | } |
1628 | 1628 | ||
1629 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1629 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1630 | QString &strAll ) | 1630 | QString &strAll ) |
1631 | { | 1631 | { |
1632 | int where, | 1632 | int where, |
1633 | start; | 1633 | start; |
1634 | if ( txt.isEmpty() ) | 1634 | if ( txt.isEmpty() ) |
1635 | return; | 1635 | return; |
1636 | // find the first | 1636 | // find the first |
1637 | where = txt.find( ',' ); | 1637 | where = txt.find( ',' ); |
1638 | if ( where < 0 ) { | 1638 | if ( where < 0 ) { |
1639 | strDefaultEmail = txt; | 1639 | strDefaultEmail = txt; |
1640 | strAll = txt; | 1640 | strAll = txt; |
1641 | } else { | 1641 | } else { |
1642 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1642 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1643 | strAll = strDefaultEmail; | 1643 | strAll = strDefaultEmail; |
1644 | while ( where > -1 ) { | 1644 | while ( where > -1 ) { |
1645 | strAll.append(" "); | 1645 | strAll.append(" "); |
1646 | start = where; | 1646 | start = where; |
1647 | where = txt.find( ',', where + 1 ); | 1647 | where = txt.find( ',', where + 1 ); |
1648 | if ( where > - 1 ) | 1648 | if ( where > - 1 ) |
1649 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1649 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1650 | else // grab until the end... | 1650 | else // grab until the end... |
1651 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1651 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1652 | } | 1652 | } |
1653 | } | 1653 | } |
1654 | } | 1654 | } |
1655 | 1655 | ||
1656 | void parseEmailTo( const QString &strDefaultEmail, | 1656 | void parseEmailTo( const QString &strDefaultEmail, |
1657 | const QString &strOtherEmail, QString &strBack ) | 1657 | const QString &strOtherEmail, QString &strBack ) |
1658 | { | 1658 | { |
1659 | // create a comma dilimeted set of emails... | 1659 | // create a comma dilimeted set of emails... |
1660 | // use the power of short circuiting... | 1660 | // use the power of short circuiting... |
1661 | bool foundDefault = false; | 1661 | bool foundDefault = false; |
1662 | QString strTmp; | 1662 | QString strTmp; |
1663 | int start = 0; | 1663 | int start = 0; |
1664 | int where; | 1664 | int where; |
1665 | // start at the beginng. | 1665 | // start at the beginng. |
1666 | strBack = strDefaultEmail; | 1666 | strBack = strDefaultEmail; |
1667 | where = 0; | 1667 | where = 0; |
1668 | while ( where > -1 ) { | 1668 | while ( where > -1 ) { |
1669 | start = where; | 1669 | start = where; |
1670 | where = strOtherEmail.find( ' ', where + 1 ); | 1670 | where = strOtherEmail.find( ' ', where + 1 ); |
1671 | if ( where > 0 ) { | 1671 | if ( where > 0 ) { |
1672 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1672 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1673 | } else | 1673 | } else |
1674 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); | 1674 | strTmp = strOtherEmail.right( strOtherEmail.length() - start ).stripWhiteSpace(); |
1675 | if ( foundDefault || strTmp != strDefaultEmail ) { | 1675 | if ( foundDefault || strTmp != strDefaultEmail ) { |
1676 | strBack.append( ", " ); | 1676 | strBack.append( ", " ); |
1677 | strBack.append( strTmp ); | 1677 | strBack.append( strTmp ); |
1678 | } else | 1678 | } else |
1679 | foundDefault = true; | 1679 | foundDefault = true; |
1680 | } | 1680 | } |
1681 | } | 1681 | } |
1682 | 1682 | ||
1683 | 1683 | ||
1684 | static inline bool containsAlphaNum( const QString &str ) | 1684 | static inline bool containsAlphaNum( const QString &str ) |
1685 | { | 1685 | { |
1686 | int i, | 1686 | int i, |
1687 | count = str.length(); | 1687 | count = str.length(); |
1688 | for ( i = 0; i < count; i++ ) | 1688 | for ( i = 0; i < count; i++ ) |
1689 | if ( !str[i].isSpace() ) | 1689 | if ( !str[i].isSpace() ) |
1690 | return TRUE; | 1690 | return TRUE; |
1691 | return FALSE; | 1691 | return FALSE; |
1692 | } | 1692 | } |
1693 | 1693 | ||
1694 | static inline bool constainsWhiteSpace( const QString &str ) | 1694 | static inline bool constainsWhiteSpace( const QString &str ) |
1695 | { | 1695 | { |
1696 | int i, | 1696 | int i, |
1697 | count = str.length(); | 1697 | count = str.length(); |
1698 | for (i = 0; i < count; i++ ) | 1698 | for (i = 0; i < count; i++ ) |
1699 | if ( str[i].isSpace() ) | 1699 | if ( str[i].isSpace() ) |
1700 | return TRUE; | 1700 | return TRUE; |
1701 | return FALSE; | 1701 | return FALSE; |
1702 | } | 1702 | } |
1703 | 1703 | ||
1704 | void ContactEditor::setPersonalView( bool personal ) | 1704 | void ContactEditor::setPersonalView( bool personal ) |
1705 | { | 1705 | { |
1706 | m_personalView = personal; | 1706 | m_personalView = personal; |
1707 | 1707 | ||
1708 | // Currently disbled due to the fact that | 1708 | // Currently disbled due to the fact that |
1709 | // show will not work... | 1709 | // show will not work... |
1710 | return; | 1710 | return; |
1711 | 1711 | ||
1712 | if ( personal ){ | 1712 | if ( personal ){ |
1713 | cmbCat->hide(); | 1713 | cmbCat->hide(); |
1714 | labCat->hide(); | 1714 | labCat->hide(); |
1715 | 1715 | ||
1716 | } else{ | 1716 | } else{ |
1717 | cmbCat->show(); | 1717 | cmbCat->show(); |
1718 | labCat->show(); | 1718 | labCat->show(); |
1719 | } | 1719 | } |
1720 | } | 1720 | } |
1721 | 1721 | ||
1722 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) | 1722 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) |
1723 | { | 1723 | { |
1724 | QDate date; | 1724 | QDate date; |
1725 | date.setYMD( year, month, day ); | 1725 | date.setYMD( year, month, day ); |
1726 | QString dateString = TimeString::numberDateString( date ); | 1726 | QString dateString = TimeString::numberDateString( date ); |
1727 | anniversaryButton->setText( dateString ); | 1727 | anniversaryButton->setText( dateString ); |
1728 | ent.setAnniversary ( date ); | 1728 | ent.setAnniversary ( date ); |
1729 | } | 1729 | } |
1730 | 1730 | ||
1731 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) | 1731 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) |
1732 | { | 1732 | { |
1733 | QDate date; | 1733 | QDate date; |
1734 | date.setYMD( year, month, day ); | 1734 | date.setYMD( year, month, day ); |
1735 | QString dateString = TimeString::numberDateString( date ); | 1735 | QString dateString = TimeString::numberDateString( date ); |
1736 | birthdayButton->setText( dateString ); | 1736 | birthdayButton->setText( dateString ); |
1737 | ent.setBirthday ( date ); | 1737 | ent.setBirthday ( date ); |
1738 | } | 1738 | } |
1739 | 1739 | ||
1740 | void ContactEditor::slotRemoveBirthday() | 1740 | void ContactEditor::slotRemoveBirthday() |
1741 | { | 1741 | { |
1742 | owarn << "void ContactEditor::slotRemoveBirthday()" << oendl; | 1742 | odebug << "void ContactEditor::slotRemoveBirthday()" << oendl; |
1743 | ent.setBirthday( QDate() ); | 1743 | ent.setBirthday( QDate() ); |
1744 | updateDatePicker(); | 1744 | updateDatePicker(); |
1745 | } | 1745 | } |
1746 | 1746 | ||
1747 | void ContactEditor::slotRemoveAnniversary() | 1747 | void ContactEditor::slotRemoveAnniversary() |
1748 | { | 1748 | { |
1749 | owarn << "void ContactEditor::slotRemoveAnniversary()" << oendl; | 1749 | odebug << "void ContactEditor::slotRemoveAnniversary()" << oendl; |
1750 | ent.setAnniversary( QDate() ); | 1750 | ent.setAnniversary( QDate() ); |
1751 | updateDatePicker(); | 1751 | updateDatePicker(); |
1752 | } | 1752 | } |
diff --git a/core/pim/addressbook/picker.cpp b/core/pim/addressbook/picker.cpp index 8a9c85b..b962896 100644 --- a/core/pim/addressbook/picker.cpp +++ b/core/pim/addressbook/picker.cpp | |||
@@ -1,245 +1,245 @@ | |||
1 | #include "picker.h" | 1 | #include "picker.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | 4 | ||
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qlayout.h> | 6 | #include <qlayout.h> |
7 | 7 | ||
8 | char PickerLabel::lastLetter = '\0'; | 8 | char PickerLabel::lastLetter = '\0'; |
9 | 9 | ||
10 | PickerLabel::PickerLabel( QWidget *parent, const char *name ) | 10 | PickerLabel::PickerLabel( QWidget *parent, const char *name ) |
11 | : QLabel ( parent, name ) | 11 | : QLabel ( parent, name ) |
12 | { | 12 | { |
13 | currentLetter = 0; | 13 | currentLetter = 0; |
14 | //lastLetter = 0; | 14 | //lastLetter = 0; |
15 | 15 | ||
16 | letter1 = '\0'; | 16 | letter1 = '\0'; |
17 | letter2 = '\0'; | 17 | letter2 = '\0'; |
18 | letter3 = '\0'; | 18 | letter3 = '\0'; |
19 | 19 | ||
20 | // setFont( QFont( "smallsmooth", 9 ) ); | 20 | // setFont( QFont( "smallsmooth", 9 ) ); |
21 | setFont( QFont::defaultFont() ); | 21 | setFont( QFont::defaultFont() ); |
22 | setTextFormat( Qt::RichText ); | 22 | setTextFormat( Qt::RichText ); |
23 | 23 | ||
24 | } | 24 | } |
25 | 25 | ||
26 | PickerLabel::~PickerLabel() | 26 | PickerLabel::~PickerLabel() |
27 | { | 27 | { |
28 | 28 | ||
29 | } | 29 | } |
30 | 30 | ||
31 | void PickerLabel::setLetters( char ch1, char ch2, char ch3 ) | 31 | void PickerLabel::setLetters( char ch1, char ch2, char ch3 ) |
32 | { | 32 | { |
33 | QString tmpStr; | 33 | QString tmpStr; |
34 | 34 | ||
35 | if (ch1 != '\0') | 35 | if (ch1 != '\0') |
36 | letter1 = ch1; | 36 | letter1 = ch1; |
37 | else | 37 | else |
38 | letter1 = ' '; | 38 | letter1 = ' '; |
39 | 39 | ||
40 | if (ch2 != '\0') | 40 | if (ch2 != '\0') |
41 | letter2 = ch2; | 41 | letter2 = ch2; |
42 | else | 42 | else |
43 | letter2 = ' '; | 43 | letter2 = ' '; |
44 | 44 | ||
45 | if (ch3 != '\0') | 45 | if (ch3 != '\0') |
46 | letter3 = ch3; | 46 | letter3 = ch3; |
47 | else | 47 | else |
48 | letter3 = ' '; | 48 | letter3 = ' '; |
49 | 49 | ||
50 | tmpStr = "<qt>"; | 50 | tmpStr = "<qt>"; |
51 | tmpStr += letter1; | 51 | tmpStr += letter1; |
52 | tmpStr += letter2; | 52 | tmpStr += letter2; |
53 | tmpStr += letter3; | 53 | tmpStr += letter3; |
54 | tmpStr += "</qt>"; | 54 | tmpStr += "</qt>"; |
55 | 55 | ||
56 | setText(tmpStr); | 56 | setText(tmpStr); |
57 | 57 | ||
58 | currentLetter = 0; | 58 | currentLetter = 0; |
59 | 59 | ||
60 | } | 60 | } |
61 | 61 | ||
62 | void PickerLabel::clearLetter() | 62 | void PickerLabel::clearLetter() |
63 | { | 63 | { |
64 | 64 | ||
65 | QString tmpStr; | 65 | QString tmpStr; |
66 | 66 | ||
67 | tmpStr = "<qt>"; | 67 | tmpStr = "<qt>"; |
68 | tmpStr += letter1; | 68 | tmpStr += letter1; |
69 | tmpStr += letter2; | 69 | tmpStr += letter2; |
70 | tmpStr += letter3; | 70 | tmpStr += letter3; |
71 | tmpStr += "</qt>"; | 71 | tmpStr += "</qt>"; |
72 | 72 | ||
73 | setText(tmpStr); | 73 | setText(tmpStr); |
74 | 74 | ||
75 | currentLetter = 0; | 75 | currentLetter = 0; |
76 | 76 | ||
77 | } | 77 | } |
78 | 78 | ||
79 | void PickerLabel::mousePressEvent( QMouseEvent* e ) | 79 | void PickerLabel::mousePressEvent( QMouseEvent* e ) |
80 | { | 80 | { |
81 | // If one pickerlabel is was, and an other is now selected, we | 81 | // If one pickerlabel is was, and an other is now selected, we |
82 | // have to simulate the releaseevent.. Otherwise the new label | 82 | // have to simulate the releaseevent.. Otherwise the new label |
83 | // will not get a highlighted letter.. | 83 | // will not get a highlighted letter.. |
84 | // Maybe there is a more intelligent solution, but this works and I am tired.. (se) | 84 | // Maybe there is a more intelligent solution, but this works and I am tired.. (se) |
85 | if ( ( currentLetter == 0 ) && ( lastLetter != '\0' ) ) mouseReleaseEvent( e ); | 85 | if ( ( currentLetter == 0 ) && ( lastLetter != '\0' ) ) mouseReleaseEvent( e ); |
86 | } | 86 | } |
87 | 87 | ||
88 | void PickerLabel::mouseReleaseEvent( QMouseEvent* /* e */ ) | 88 | void PickerLabel::mouseReleaseEvent( QMouseEvent* /* e */ ) |
89 | { | 89 | { |
90 | QString tmpStr; | 90 | QString tmpStr; |
91 | 91 | ||
92 | if (lastLetter != letter1 && lastLetter != letter2 && lastLetter != letter3 && lastLetter != '\0') | 92 | if (lastLetter != letter1 && lastLetter != letter2 && lastLetter != letter3 && lastLetter != '\0') |
93 | QTimer::singleShot( 0, this, SLOT(emitClearSignal()) ); | 93 | QTimer::singleShot( 0, this, SLOT(emitClearSignal()) ); |
94 | 94 | ||
95 | switch (currentLetter) { | 95 | switch (currentLetter) { |
96 | case 0: | 96 | case 0: |
97 | tmpStr = "<qt><u><b><font color=\"#FF00FF\">"; | 97 | tmpStr = "<qt><u><b><font color=\"#FF00FF\">"; |
98 | tmpStr += letter1; | 98 | tmpStr += letter1; |
99 | tmpStr += "</font></b></u>"; | 99 | tmpStr += "</font></b></u>"; |
100 | tmpStr += letter2; | 100 | tmpStr += letter2; |
101 | tmpStr += letter3; | 101 | tmpStr += letter3; |
102 | tmpStr += "</qt>"; | 102 | tmpStr += "</qt>"; |
103 | 103 | ||
104 | setText(tmpStr); | 104 | setText(tmpStr); |
105 | 105 | ||
106 | currentLetter++; | 106 | currentLetter++; |
107 | lastLetter = letter1; | 107 | lastLetter = letter1; |
108 | emit selectedLetter( letter1 ); | 108 | emit selectedLetter( letter1 ); |
109 | break; | 109 | break; |
110 | 110 | ||
111 | case 1: | 111 | case 1: |
112 | tmpStr = "<qt>"; | 112 | tmpStr = "<qt>"; |
113 | tmpStr += letter1; | 113 | tmpStr += letter1; |
114 | tmpStr += "<u><b><font color=\"#FF00FF\">"; | 114 | tmpStr += "<u><b><font color=\"#FF00FF\">"; |
115 | tmpStr += letter2; | 115 | tmpStr += letter2; |
116 | tmpStr += "</font></b></u>"; | 116 | tmpStr += "</font></b></u>"; |
117 | tmpStr += letter3; | 117 | tmpStr += letter3; |
118 | tmpStr += "</qt>"; | 118 | tmpStr += "</qt>"; |
119 | 119 | ||
120 | setText(tmpStr); | 120 | setText(tmpStr); |
121 | 121 | ||
122 | currentLetter++; | 122 | currentLetter++; |
123 | lastLetter = letter2; | 123 | lastLetter = letter2; |
124 | emit selectedLetter( letter2 ); | 124 | emit selectedLetter( letter2 ); |
125 | break; | 125 | break; |
126 | 126 | ||
127 | case 2: | 127 | case 2: |
128 | tmpStr = "<qt>"; | 128 | tmpStr = "<qt>"; |
129 | tmpStr += letter1; | 129 | tmpStr += letter1; |
130 | tmpStr += letter2; | 130 | tmpStr += letter2; |
131 | tmpStr += "<u><b><font color=\"#FF00FF\">"; | 131 | tmpStr += "<u><b><font color=\"#FF00FF\">"; |
132 | tmpStr += letter3; | 132 | tmpStr += letter3; |
133 | tmpStr += "</font></b></u></qt>"; | 133 | tmpStr += "</font></b></u></qt>"; |
134 | 134 | ||
135 | setText(tmpStr); | 135 | setText(tmpStr); |
136 | 136 | ||
137 | currentLetter++; | 137 | currentLetter++; |
138 | lastLetter = letter3; | 138 | lastLetter = letter3; |
139 | emit selectedLetter( letter3 ); | 139 | emit selectedLetter( letter3 ); |
140 | break; | 140 | break; |
141 | 141 | ||
142 | default: | 142 | default: |
143 | clearLetter(); | 143 | clearLetter(); |
144 | lastLetter = '\0'; | 144 | lastLetter = '\0'; |
145 | emit selectedLetter( '\0' ); | 145 | emit selectedLetter( '\0' ); |
146 | 146 | ||
147 | 147 | ||
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | void PickerLabel::emitClearSignal() { | 151 | void PickerLabel::emitClearSignal() { |
152 | emit clearAll(); | 152 | emit clearAll(); |
153 | } | 153 | } |
154 | 154 | ||
155 | LetterPicker::LetterPicker( QWidget *parent, const char *name ) | 155 | LetterPicker::LetterPicker( QWidget *parent, const char *name ) |
156 | : QFrame( parent, name ) | 156 | : QFrame( parent, name ) |
157 | { | 157 | { |
158 | QHBoxLayout *l = new QHBoxLayout(this); | 158 | QHBoxLayout *l = new QHBoxLayout(this); |
159 | 159 | ||
160 | lblABC = new PickerLabel( this ); | 160 | lblABC = new PickerLabel( this ); |
161 | l->addWidget( lblABC ); | 161 | l->addWidget( lblABC ); |
162 | 162 | ||
163 | lblDEF = new PickerLabel( this ); | 163 | lblDEF = new PickerLabel( this ); |
164 | l->addWidget( lblDEF ); | 164 | l->addWidget( lblDEF ); |
165 | 165 | ||
166 | lblGHI = new PickerLabel( this ); | 166 | lblGHI = new PickerLabel( this ); |
167 | l->addWidget( lblGHI ); | 167 | l->addWidget( lblGHI ); |
168 | 168 | ||
169 | lblJKL = new PickerLabel( this ); | 169 | lblJKL = new PickerLabel( this ); |
170 | l->addWidget( lblJKL ); | 170 | l->addWidget( lblJKL ); |
171 | 171 | ||
172 | lblMNO = new PickerLabel( this ); | 172 | lblMNO = new PickerLabel( this ); |
173 | l->addWidget( lblMNO ); | 173 | l->addWidget( lblMNO ); |
174 | 174 | ||
175 | lblPQR = new PickerLabel( this ); | 175 | lblPQR = new PickerLabel( this ); |
176 | l->addWidget( lblPQR ); | 176 | l->addWidget( lblPQR ); |
177 | 177 | ||
178 | lblSTU = new PickerLabel( this ); | 178 | lblSTU = new PickerLabel( this ); |
179 | l->addWidget( lblSTU ); | 179 | l->addWidget( lblSTU ); |
180 | 180 | ||
181 | lblVWX = new PickerLabel( this ); | 181 | lblVWX = new PickerLabel( this ); |
182 | l->addWidget( lblVWX ); | 182 | l->addWidget( lblVWX ); |
183 | 183 | ||
184 | lblYZ = new PickerLabel( this ); | 184 | lblYZ = new PickerLabel( this ); |
185 | l->addWidget( lblYZ ); | 185 | l->addWidget( lblYZ ); |
186 | 186 | ||
187 | lblABC->setLetters( 'A', 'B', 'C' ); | 187 | lblABC->setLetters( 'A', 'B', 'C' ); |
188 | lblDEF->setLetters( 'D', 'E', 'F' ); | 188 | lblDEF->setLetters( 'D', 'E', 'F' ); |
189 | lblGHI->setLetters( 'G', 'H', 'I' ); | 189 | lblGHI->setLetters( 'G', 'H', 'I' ); |
190 | lblJKL->setLetters( 'J', 'K', 'L' ); | 190 | lblJKL->setLetters( 'J', 'K', 'L' ); |
191 | lblMNO->setLetters( 'M', 'N', 'O' ); | 191 | lblMNO->setLetters( 'M', 'N', 'O' ); |
192 | lblPQR->setLetters( 'P', 'Q', 'R' ); | 192 | lblPQR->setLetters( 'P', 'Q', 'R' ); |
193 | lblSTU->setLetters( 'S', 'T', 'U' ); | 193 | lblSTU->setLetters( 'S', 'T', 'U' ); |
194 | lblVWX->setLetters( 'V', 'W', 'X' ); | 194 | lblVWX->setLetters( 'V', 'W', 'X' ); |
195 | lblYZ->setLetters( 'Y', 'Z', '#' ); | 195 | lblYZ->setLetters( 'Y', 'Z', '#' ); |
196 | 196 | ||
197 | connect(lblABC, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 197 | connect(lblABC, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
198 | connect(lblDEF, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 198 | connect(lblDEF, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
199 | connect(lblGHI, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 199 | connect(lblGHI, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
200 | connect(lblJKL, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 200 | connect(lblJKL, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
201 | connect(lblMNO, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 201 | connect(lblMNO, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
202 | connect(lblPQR, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 202 | connect(lblPQR, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
203 | connect(lblSTU, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 203 | connect(lblSTU, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
204 | connect(lblVWX, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 204 | connect(lblVWX, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
205 | connect(lblYZ, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); | 205 | connect(lblYZ, SIGNAL(selectedLetter(char)), this, SLOT(newLetter(char))); |
206 | connect(lblABC, SIGNAL(clearAll()), this, SLOT(clear())); | 206 | connect(lblABC, SIGNAL(clearAll()), this, SLOT(clear())); |
207 | connect(lblDEF, SIGNAL(clearAll()), this, SLOT(clear())); | 207 | connect(lblDEF, SIGNAL(clearAll()), this, SLOT(clear())); |
208 | connect(lblGHI, SIGNAL(clearAll()), this, SLOT(clear())); | 208 | connect(lblGHI, SIGNAL(clearAll()), this, SLOT(clear())); |
209 | connect(lblJKL, SIGNAL(clearAll()), this, SLOT(clear())); | 209 | connect(lblJKL, SIGNAL(clearAll()), this, SLOT(clear())); |
210 | connect(lblMNO, SIGNAL(clearAll()), this, SLOT(clear())); | 210 | connect(lblMNO, SIGNAL(clearAll()), this, SLOT(clear())); |
211 | connect(lblPQR, SIGNAL(clearAll()), this, SLOT(clear())); | 211 | connect(lblPQR, SIGNAL(clearAll()), this, SLOT(clear())); |
212 | connect(lblSTU, SIGNAL(clearAll()), this, SLOT(clear())); | 212 | connect(lblSTU, SIGNAL(clearAll()), this, SLOT(clear())); |
213 | connect(lblVWX, SIGNAL(clearAll()), this, SLOT(clear())); | 213 | connect(lblVWX, SIGNAL(clearAll()), this, SLOT(clear())); |
214 | connect(lblYZ, SIGNAL(clearAll()), this, SLOT(clear())); | 214 | connect(lblYZ, SIGNAL(clearAll()), this, SLOT(clear())); |
215 | 215 | ||
216 | } | 216 | } |
217 | 217 | ||
218 | LetterPicker::~LetterPicker() | 218 | LetterPicker::~LetterPicker() |
219 | { | 219 | { |
220 | } | 220 | } |
221 | 221 | ||
222 | QSizePolicy LetterPicker::sizePolicy () const | 222 | QSizePolicy LetterPicker::sizePolicy () const |
223 | { | 223 | { |
224 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum); | 224 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum); |
225 | } | 225 | } |
226 | 226 | ||
227 | void LetterPicker::clear() | 227 | void LetterPicker::clear() |
228 | { | 228 | { |
229 | lblABC->clearLetter(); | 229 | lblABC->clearLetter(); |
230 | lblDEF->clearLetter(); | 230 | lblDEF->clearLetter(); |
231 | lblGHI->clearLetter(); | 231 | lblGHI->clearLetter(); |
232 | lblJKL->clearLetter(); | 232 | lblJKL->clearLetter(); |
233 | lblMNO->clearLetter(); | 233 | lblMNO->clearLetter(); |
234 | lblPQR->clearLetter(); | 234 | lblPQR->clearLetter(); |
235 | lblSTU->clearLetter(); | 235 | lblSTU->clearLetter(); |
236 | lblVWX->clearLetter(); | 236 | lblVWX->clearLetter(); |
237 | lblYZ->clearLetter(); | 237 | lblYZ->clearLetter(); |
238 | } | 238 | } |
239 | 239 | ||
240 | void LetterPicker::newLetter( char letter ) | 240 | void LetterPicker::newLetter( char letter ) |
241 | { | 241 | { |
242 | owarn << "LetterClicked" << oendl; | 242 | odebug << "LetterClicked" << oendl; |
243 | emit letterClicked( letter ); | 243 | emit letterClicked( letter ); |
244 | 244 | ||
245 | } | 245 | } |