author | mickeyl <mickeyl> | 2004-04-04 17:03:27 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 17:03:27 (UTC) |
commit | daef74a7e852855f781765fad7969b6c83e2e9c6 (patch) (unidiff) | |
tree | f635b437ba9f6d144c34c5ee58d37954bacc3c6e | |
parent | 100def2936503dedc8138d738d68b69d5de66766 (diff) | |
download | opie-daef74a7e852855f781765fad7969b6c83e2e9c6.zip opie-daef74a7e852855f781765fad7969b6c83e2e9c6.tar.gz opie-daef74a7e852855f781765fad7969b6c83e2e9c6.tar.bz2 |
s/Opie::Core::odebug/odebug/ (same with oerr,owarn,ofatal)
-rw-r--r-- | core/pim/addressbook/ablabel.cpp | 14 | ||||
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 50 | ||||
-rw-r--r-- | core/pim/addressbook/abview.cpp | 56 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 62 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg.cpp | 10 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 74 | ||||
-rw-r--r-- | core/pim/addressbook/picker.cpp | 2 |
7 files changed, 134 insertions, 134 deletions
diff --git a/core/pim/addressbook/ablabel.cpp b/core/pim/addressbook/ablabel.cpp index 8216d6f..b81a3b9 100644 --- a/core/pim/addressbook/ablabel.cpp +++ b/core/pim/addressbook/ablabel.cpp | |||
@@ -74,71 +74,71 @@ bool AbLabel::selectContact( int UID ) | |||
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 | Opie::Core::owarn << "Left.." << oendl; | 98 | owarn << "Left.." << oendl; |
99 | case Qt::Key_Right: | 99 | case Qt::Key_Right: |
100 | Opie::Core::owarn << "Right.." << oendl; | 100 | owarn << "Right.." << oendl; |
101 | case Qt::Key_F33: | 101 | case Qt::Key_F33: |
102 | Opie::Core::owarn << "OK.." << oendl; | 102 | owarn << "OK.." << oendl; |
103 | emit signalOkPressed(); | 103 | emit signalOkPressed(); |
104 | break; | 104 | break; |
105 | case Qt::Key_Up: | 105 | case Qt::Key_Up: |
106 | Opie::Core::owarn << "Up.." << oendl; | 106 | owarn << "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 | Opie::Core::owarn << "Down.." << oendl; | 120 | owarn << "Down.." << oendl; |
121 | // Opie::Core::owarn << "Visible: " << visibleHeight() << ", content: " << contentHeight() << oendl; | 121 | // owarn << "Visible: " << visibleHeight() << ", content: " << contentHeight() << oendl; |
122 | // Opie::Core::owarn << "Value: " << verticalScrollBar()->value() | 122 | // owarn << "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 cb57342..3fb2214 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -100,285 +100,285 @@ 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 | //Opie::Core::owarn << "C'tor start" << oendl; | 124 | //owarn << "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 | //Opie::Core::owarn << "C'tor end" << oendl; | 132 | //owarn << "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 | Opie::Core::owarn << "AbTable::setContacts()" << oendl; | 154 | owarn << "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 | Opie::Core::owarn << "AbTable::selectContact( " << UID << " )" << oendl; | 186 | owarn << "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 | Opie::Core::owarn << "Search start" << oendl; | 192 | owarn << "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 | Opie::Core::owarn << "Search end" << oendl; | 201 | owarn << "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 | Opie::Core::owarn << "void AbTable::insertIntoTable( const Opie::OPimContact& cnt, " | 216 | owarn << "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 | Opie::Core::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 | Opie::Core::owarn << "void AbTable::clear()" << oendl; | 286 | owarn << "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 | Opie::Core::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 | // Opie::Core::owarn << "Received key .." << oendl; | 337 | // owarn << "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 | // Opie::Core::owarn << "a" << oendl; | 345 | // owarn << "a" << oendl; |
346 | // emit signalKeyUp(); | 346 | // emit signalKeyUp(); |
347 | // break; | 347 | // break; |
348 | // case Qt::Key_Down: | 348 | // case Qt::Key_Down: |
349 | // Opie::Core::owarn << "b" << oendl; | 349 | // owarn << "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 | Opie::Core::owarn << "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" << oendl; | 360 | owarn << "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 ) |
@@ -402,49 +402,49 @@ QString AbTable::findContactName( const Opie::OPimContact &entry ) | |||
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 | //Opie::Core::owarn << "void AbTable::realignTable()" << oendl; | 426 | //owarn << "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++) |
@@ -452,207 +452,207 @@ void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) | |||
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 | Opie::Core::owarn << "void AbTable::fitColumns()" << oendl; | 476 | owarn << "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 | //Opie::Core::owarn << "Width: " << contentsWidth << oendl; | 488 | //owarn << "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 | //Opie::Core::owarn << "void AbTable::show()" << oendl; | 500 | //owarn << "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 | //Opie::Core::owarn << "AbTable::itemClicked(int, col: " << col << ")" << oendl; | 524 | //owarn << "AbTable::itemClicked(int, col: " << col << ")" << oendl; |
525 | if ( col == 2 ) { | 525 | if ( col == 2 ) { |
526 | return; | 526 | return; |
527 | } else { | 527 | } else { |
528 | //Opie::Core::owarn << "Emitting signalSwitch()" << oendl; | 528 | //owarn << "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 | //Opie::Core::owarn << "void AbTable::updateVisible()" << oendl; | 565 | //owarn << "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 | //Opie::Core::owarn << "IN void AbTable::setPaintingEnabled( " << e << " )->Nested: " | 601 | //owarn << "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 | //Opie::Core::owarn << "OUT void AbTable::setPaintingEnabled( " << e << " )->Nested: " | 618 | //owarn << "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 | //Opie::Core::owarn << "void AbTable::viewportPaintEvent( QPaintEvent* e ) -> " | 623 | //owarn << "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 | //Opie::Core::owarn << "Paint row: " << row << oendl; | 634 | //owarn << "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: |
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index 52e5f59..7a5b6d4 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp | |||
@@ -31,276 +31,276 @@ 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 | Opie::Core::owarn << "AbView::c'tor" << oendl; | 55 | owarn << "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 | Opie::Core::owarn << "AbView::setView( Views view )" << oendl; | 103 | owarn << "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 | Opie::Core::owarn << "AbView::AddContact" << oendl; | 110 | owarn << "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 | Opie::Core::owarn << "AbView;:RemoveContact" << oendl; | 117 | owarn << "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 | Opie::Core::owarn << "AbView::ReplaceContact" << oendl; | 124 | owarn << "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 | //Opie::Core::owarn << "AbView::Save data" << oendl; | 148 | //owarn << "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 | Opie::Core::owarn << "AbView::Load data" << oendl; | 155 | owarn << "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 | Opie::Core::owarn << "Number of contacts: " << m_list.count() << oendl; | 169 | owarn << "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 | Opie::Core::owarn << "AbView::::reload()" << oendl; | 177 | owarn << "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 | Opie::Core::owarn << "AbView::setShowCategory( const QString& cat )" << oendl; | 190 | owarn << "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 | // Opie::Core::owarn << "Categories: Selected " << cat << ".. Number: " | 202 | // owarn << "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 | Opie::Core::owarn << "void AbView::setShowToView( View " << view << " )" << oendl; | 215 | owarn << "void AbView::setShowToView( View " << view << " )" << oendl; |
216 | 216 | ||
217 | if ( m_curr_View != view ){ | 217 | if ( m_curr_View != view ){ |
218 | Opie::Core::owarn << "Change the View (Category is: " << m_curr_category << ")" << oendl; | 218 | owarn << "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 | Opie::Core::owarn << "void AbView::setShowByLetter( " << c << ", " << mode << " )" << oendl; | 229 | owarn << "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 | Opie::Core::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 | Opie::Core::owarn << "void AbView::showPersonal( " << personal << " )" << oendl; | 282 | owarn << "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 |
@@ -314,170 +314,170 @@ void AbView::showPersonal( bool personal ) | |||
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 | //Opie::Core::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 | //Opie::Core::owarn << "Find in Category " << category << oendl; | 352 | //owarn << "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 | //Opie::Core::owarn << "Found: " << m_list.count() << oendl; | 361 | //owarn << "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 | //Opie::Core::owarn << "AbView::slotSwitch()" << oendl; | 385 | //owarn << "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 | Opie::Core::owarn << "Switching to CardView" << oendl; | 390 | owarn << "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 | Opie::Core::owarn << "Switching to TableView" << oendl; | 394 | owarn << "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 | //Opie::Core::owarn << "Removing " << (*it).uid() << oendl; | 413 | //owarn << "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 | //Opie::Core::owarn << "bool AbView::contactCompare( const Opie::OPimContact &cnt, " | 423 | //owarn << "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 | //Opie::Core::owarn << "Number of categories: " << cats.count() << oendl; | 430 | //owarn << "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 | //Opie::Core::owarn << "Comparing " << cats[i] << " with " << category << oendl; | 439 | //owarn << "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 | //Opie::Core::owarn << "Return: " << returnMe << oendl; | 446 | //owarn << "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 | //Opie::Core::owarn << "AbView::updateView()" << oendl; | 459 | //owarn << "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 | ||
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 94c0a13..35d0f41 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -230,200 +230,200 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
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 | //Opie::Core::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 | Opie::Core::owarn << "Config Dialog accepted!" << oendl; | 270 | owarn << "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 | Opie::Core::owarn << "Font was changed!" << oendl; | 273 | owarn << "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 | Opie::Core::owarn << "void AddressbookWindow::slotSetFont( " << size << " )" << oendl; | 286 | owarn << "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 | Opie::Core::owarn << "void AddressbookWindow::exportvCard()" << oendl; | 328 | owarn << "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 | Opie::Core::owarn << " Save to file " << filename << ", (" << filename.length()-1 << ")" << oendl; | 331 | owarn << " 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 | Opie::Core::owarn << "void AddressbookWindow::setDocument( " << filename << " )" << oendl; | 353 | owarn << "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 | Opie::Core::owarn << "YES clicked" << oendl; | 365 | owarn << "YES clicked" << oendl; |
366 | break; | 366 | break; |
367 | case 1: | 367 | case 1: |
368 | Opie::Core::owarn << "NO clicked" << oendl; | 368 | owarn << "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 | Opie::Core::owarn << "Found number of contacts in File: " << allList.count() << oendl; | 378 | owarn << "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 | Opie::Core::owarn << "Adding Contact from: " << (*it).fullName() << oendl; | 389 | owarn << "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 | Opie::Core::owarn << "YES clicked" << oendl; | 398 | owarn << "YES clicked" << oendl; |
399 | m_abView->addEntry( *it ); | 399 | m_abView->addEntry( *it ); |
400 | break; | 400 | break; |
401 | case 1: | 401 | case 1: |
402 | Opie::Core::owarn << "NO clicked" << oendl; | 402 | owarn << "NO clicked" << oendl; |
403 | break; | 403 | break; |
404 | case 2: | 404 | case 2: |
405 | Opie::Core::owarn << "YesAll clicked" << oendl; | 405 | owarn << "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 ); |
@@ -517,193 +517,193 @@ void AddressbookWindow::slotViewEdit() | |||
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 | Opie::Core::owarn << "Accessing: " << (basepath + "/bin/qtmail") << oendl; | 541 | owarn << "Accessing: " << (basepath + "/bin/qtmail") << oendl; |
542 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ | 542 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ |
543 | Opie::Core::owarn << "QCop" << oendl; | 543 | owarn << "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 | Opie::Core::owarn << "Accessing: " << (basepath + "/bin/opiemail") << oendl; | 551 | owarn << "Accessing: " << (basepath + "/bin/opiemail") << oendl; |
552 | if ( QFile::exists( basepath + "/bin/opiemail" ) ){ | 552 | if ( QFile::exists( basepath + "/bin/opiemail" ) ){ |
553 | Opie::Core::owarn << "QCop" << oendl; | 553 | owarn << "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 | Opie::Core::owarn << "Beaming: " << beamFilename << oendl; | 595 | owarn << "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 | Opie::Core::owarn << "Receiving QCop-Call with message " << msg << oendl; | 642 | owarn << "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 | //Opie::Core::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 | Opie::Core::owarn << "Showing uid: " << uid << oendl; | 685 | owarn << "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(); |
@@ -741,84 +741,84 @@ void AddressbookWindow::editEntry( EntryMode entryMode ) | |||
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 | Opie::Core::owarn << "*** ++++" << oendl; | 765 | owarn << "*** ++++" << 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 | Opie::Core::owarn << "slotPersonalView()" << oendl; | 784 | owarn << "slotPersonalView()" << oendl; |
785 | if (!actionPersonal->isOn()) { | 785 | if (!actionPersonal->isOn()) { |
786 | // we just turned it off | 786 | // we just turned it off |
787 | Opie::Core::owarn << "slotPersonalView()-> OFF" << oendl; | 787 | owarn << "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 | Opie::Core::owarn << "slotPersonalView()-> ON" << oendl; | 800 | owarn << "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(); |
@@ -866,125 +866,125 @@ bool AddressbookWindow::save() | |||
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 | Opie::Core::owarn << "Got not found signal!" << oendl; | 890 | owarn << "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 | Opie::Core::owarn << "Got wrap signal!" << oendl; | 898 | owarn << "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 | Opie::Core::owarn << "void AddressbookWindow::slotSetCategory( " << c << " ) from " | 907 | owarn << "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 | Opie::Core::owarn << "Unfiled selected!" << oendl; | 943 | owarn << "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 | Opie::Core::owarn << "void AddressbookWindow::slotViewSwitched( " << view << " )" << oendl; | 966 | owarn << "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 | } |
diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp index 094dbda..22f7291 100644 --- a/core/pim/addressbook/configdlg.cpp +++ b/core/pim/addressbook/configdlg.cpp | |||
@@ -22,88 +22,88 @@ ConfigDlg::ConfigDlg( QWidget *parent, const char *name): | |||
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 | Opie::Core::owarn << "void ConfigDlg::slotItemUp()" << oendl; | 46 | owarn << "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 | Opie::Core::owarn << "void ConfigDlg::slotItemDown()" << oendl; | 60 | owarn << "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 | Opie::Core::owarn << "void ConfigDlg::slotItemAdd()" << oendl; | 73 | owarn << "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 | Opie::Core::owarn << "Adding " << item << oendl; | 78 | owarn << "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 | Opie::Core::owarn << "void ConfigDlg::slotItemRemove()" << oendl; | 85 | owarn << "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: |
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index e496387..72c8bd3 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -57,49 +57,49 @@ ContactEditor::ContactEditor( const Opie::OPimContact &entry, | |||
57 | QWidget *parent, | 57 | QWidget *parent, |
58 | const char *name, | 58 | const char *name, |
59 | WFlags ) | 59 | WFlags ) |
60 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), | 60 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), |
61 | defaultEmailChooserPosition( -1 ), | 61 | defaultEmailChooserPosition( -1 ), |
62 | m_personalView ( false ), | 62 | m_personalView ( false ), |
63 | cmbDefaultEmail( 0 ), | 63 | cmbDefaultEmail( 0 ), |
64 | initializing ( false ) | 64 | initializing ( false ) |
65 | { | 65 | { |
66 | 66 | ||
67 | initializing = true; | 67 | initializing = true; |
68 | 68 | ||
69 | init(); | 69 | init(); |
70 | setEntry( entry ); | 70 | setEntry( entry ); |
71 | // cmbDefaultEmail = 0; | 71 | // cmbDefaultEmail = 0; |
72 | // defaultEmailChooserPosition = -1; | 72 | // defaultEmailChooserPosition = -1; |
73 | 73 | ||
74 | initializing = false; | 74 | initializing = false; |
75 | } | 75 | } |
76 | 76 | ||
77 | ContactEditor::~ContactEditor() { | 77 | ContactEditor::~ContactEditor() { |
78 | } | 78 | } |
79 | 79 | ||
80 | void ContactEditor::init() { | 80 | void ContactEditor::init() { |
81 | Opie::Core::owarn << "init() START" << oendl; | 81 | owarn << "init() START" << oendl; |
82 | 82 | ||
83 | uint i = 0; | 83 | uint i = 0; |
84 | 84 | ||
85 | QStringList trlChooserNames; | 85 | QStringList trlChooserNames; |
86 | 86 | ||
87 | for (i = 0; i <= 6; i++) { | 87 | for (i = 0; i <= 6; i++) { |
88 | slHomeAddress.append( "" ); | 88 | slHomeAddress.append( "" ); |
89 | slBusinessAddress.append( "" ); | 89 | slBusinessAddress.append( "" ); |
90 | } | 90 | } |
91 | 91 | ||
92 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); | 92 | trlChooserNames = Opie::OPimContactFields::trphonefields( false ); |
93 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); | 93 | slChooserNames = Opie::OPimContactFields::untrphonefields( false ); |
94 | slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); | 94 | slDynamicEntries = Opie::OPimContactFields::untrdetailsfields( false ); |
95 | trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); | 95 | trlDynamicEntries = Opie::OPimContactFields::trdetailsfields( false ); |
96 | 96 | ||
97 | // Ok, we have to remove elements from the list of dynamic entries | 97 | // Ok, we have to remove elements from the list of dynamic entries |
98 | // which are now stored in special (not dynamic) widgets.. | 98 | // which are now stored in special (not dynamic) widgets.. |
99 | // Otherwise we will get problems with field assignments! (se) | 99 | // Otherwise we will get problems with field assignments! (se) |
100 | slDynamicEntries.remove("Anniversary"); | 100 | slDynamicEntries.remove("Anniversary"); |
101 | slDynamicEntries.remove("Birthday"); | 101 | slDynamicEntries.remove("Birthday"); |
102 | slDynamicEntries.remove("Gender"); | 102 | slDynamicEntries.remove("Gender"); |
103 | 103 | ||
104 | // The same with translated fields.. But I will | 104 | // The same with translated fields.. But I will |
105 | // use the translation map to avoid mismatches.. | 105 | // use the translation map to avoid mismatches.. |
@@ -666,243 +666,243 @@ void ContactEditor::init() { | |||
666 | this, SLOT(slotCityChange(const QString&)) ); | 666 | this, SLOT(slotCityChange(const QString&)) ); |
667 | connect( txtState, SIGNAL(textChanged(const QString&)), | 667 | connect( txtState, SIGNAL(textChanged(const QString&)), |
668 | this, SLOT(slotStateChange(const QString&)) ); | 668 | this, SLOT(slotStateChange(const QString&)) ); |
669 | connect( txtZip, SIGNAL(textChanged(const QString&)), | 669 | connect( txtZip, SIGNAL(textChanged(const QString&)), |
670 | this, SLOT(slotZipChange(const QString&)) ); | 670 | this, SLOT(slotZipChange(const QString&)) ); |
671 | connect( cmbCountry, SIGNAL(textChanged(const QString&)), | 671 | connect( cmbCountry, SIGNAL(textChanged(const QString&)), |
672 | this, SLOT(slotCountryChange(const QString&)) ); | 672 | this, SLOT(slotCountryChange(const QString&)) ); |
673 | connect( cmbCountry, SIGNAL(activated(const QString&)), | 673 | connect( cmbCountry, SIGNAL(activated(const QString&)), |
674 | this, SLOT(slotCountryChange(const QString&)) ); | 674 | this, SLOT(slotCountryChange(const QString&)) ); |
675 | connect( cmbChooserField1, SIGNAL(activated(int)), | 675 | connect( cmbChooserField1, SIGNAL(activated(int)), |
676 | this, SLOT(slotCmbChooser1Change(int)) ); | 676 | this, SLOT(slotCmbChooser1Change(int)) ); |
677 | connect( cmbChooserField2, SIGNAL(activated(int)), | 677 | connect( cmbChooserField2, SIGNAL(activated(int)), |
678 | this, SLOT(slotCmbChooser2Change(int)) ); | 678 | this, SLOT(slotCmbChooser2Change(int)) ); |
679 | connect( cmbChooserField3, SIGNAL(activated(int)), | 679 | connect( cmbChooserField3, SIGNAL(activated(int)), |
680 | this, SLOT(slotCmbChooser3Change(int)) ); | 680 | this, SLOT(slotCmbChooser3Change(int)) ); |
681 | connect( cmbChooserField4, SIGNAL(activated(int)), | 681 | connect( cmbChooserField4, SIGNAL(activated(int)), |
682 | this, SLOT(slotCmbChooser4Change(int)) ); | 682 | this, SLOT(slotCmbChooser4Change(int)) ); |
683 | connect( cmbAddress, SIGNAL(activated(int)), | 683 | connect( cmbAddress, SIGNAL(activated(int)), |
684 | this, SLOT(slotAddressTypeChange(int)) ); | 684 | this, SLOT(slotAddressTypeChange(int)) ); |
685 | 685 | ||
686 | new QPEDialogListener(this); | 686 | new QPEDialogListener(this); |
687 | 687 | ||
688 | setPersonalView ( m_personalView ); | 688 | setPersonalView ( m_personalView ); |
689 | 689 | ||
690 | Opie::Core::owarn << "init() END" << oendl; | 690 | owarn << "init() END" << oendl; |
691 | } | 691 | } |
692 | 692 | ||
693 | void ContactEditor::defaultEmailChanged(int i){ | 693 | void ContactEditor::defaultEmailChanged(int i){ |
694 | Opie::Core::odebug << "defaultEmailChanged" << oendl; | 694 | odebug << "defaultEmailChanged" << oendl; |
695 | 695 | ||
696 | // was sollte das ? (se) | 696 | // was sollte das ? (se) |
697 | // int index = cmbChooserField1->currentItem(); | 697 | // int index = cmbChooserField1->currentItem(); |
698 | // slChooserValues[index] = cmbDefaultEmail->text(i); | 698 | // slChooserValues[index] = cmbDefaultEmail->text(i); |
699 | 699 | ||
700 | defaultEmail = cmbDefaultEmail->text(i); | 700 | defaultEmail = cmbDefaultEmail->text(i); |
701 | Opie::Core::odebug << "Changed to: " << defaultEmail << oendl; | 701 | odebug << "Changed to: " << defaultEmail << oendl; |
702 | 702 | ||
703 | } | 703 | } |
704 | 704 | ||
705 | void ContactEditor::populateDefaultEmailCmb(){ | 705 | void ContactEditor::populateDefaultEmailCmb(){ |
706 | 706 | ||
707 | // if the default-email combo was not selected and therfore not created | 707 | // if the default-email combo was not selected and therfore not created |
708 | // we get a lot of trouble.. Therfore create an invisible one.. | 708 | // we get a lot of trouble.. Therfore create an invisible one.. |
709 | if ( !cmbDefaultEmail ){ | 709 | if ( !cmbDefaultEmail ){ |
710 | cmbDefaultEmail = new QComboBox(this); | 710 | cmbDefaultEmail = new QComboBox(this); |
711 | cmbDefaultEmail -> hide(); | 711 | cmbDefaultEmail -> hide(); |
712 | } | 712 | } |
713 | cmbDefaultEmail->clear(); | 713 | cmbDefaultEmail->clear(); |
714 | cmbDefaultEmail->insertStringList( emails ); | 714 | cmbDefaultEmail->insertStringList( emails ); |
715 | // cmbDefaultEmail->show(); | 715 | // cmbDefaultEmail->show(); |
716 | 716 | ||
717 | // Select default email in combo.. | 717 | // Select default email in combo.. |
718 | bool found = false; | 718 | bool found = false; |
719 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ | 719 | for ( int i = 0; i < cmbDefaultEmail->count(); i++){ |
720 | Opie::Core::odebug << " populateDefaultEmailCmb text >" << cmbDefaultEmail->text( i ) | 720 | odebug << " populateDefaultEmailCmb text >" << cmbDefaultEmail->text( i ) |
721 | << "< defaultEmail >" << defaultEmail << "<" << oendl; | 721 | << "< defaultEmail >" << defaultEmail << "<" << oendl; |
722 | 722 | ||
723 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ | 723 | if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ |
724 | cmbDefaultEmail->setCurrentItem( i ); | 724 | cmbDefaultEmail->setCurrentItem( i ); |
725 | Opie::Core::odebug << "set" << oendl; | 725 | odebug << "set" << oendl; |
726 | found = true; | 726 | found = true; |
727 | } | 727 | } |
728 | } | 728 | } |
729 | 729 | ||
730 | // If the current default email is not found in the list, we choose the | 730 | // If the current default email is not found in the list, we choose the |
731 | // first one.. | 731 | // first one.. |
732 | if ( !found ) | 732 | if ( !found ) |
733 | defaultEmail = cmbDefaultEmail->text(0); | 733 | defaultEmail = cmbDefaultEmail->text(0); |
734 | } | 734 | } |
735 | 735 | ||
736 | // Called when any combobox was changed. | 736 | // Called when any combobox was changed. |
737 | // "true" returned if the change was chandled by this function, else it should | 737 | // "true" returned if the change was chandled by this function, else it should |
738 | // be handled by something else.. | 738 | // be handled by something else.. |
739 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { | 739 | bool ContactEditor::cmbChooserChange( int index, QWidgetStack* inputStack, int widgetPos ) { |
740 | QString type = slChooserNames[index]; | 740 | QString type = slChooserNames[index]; |
741 | Opie::Core::owarn << "ContactEditor::cmbChooserChange -> Type: " << type | 741 | owarn << "ContactEditor::cmbChooserChange -> Type: " << type |
742 | << ", WidgetPos: " << widgetPos << oendl; | 742 | << ", WidgetPos: " << widgetPos << oendl; |
743 | 743 | ||
744 | if ( !initializing ) | 744 | if ( !initializing ) |
745 | contactfields.setFieldOrder( widgetPos-1, index ); | 745 | contactfields.setFieldOrder( widgetPos-1, index ); |
746 | 746 | ||
747 | // Create and connect combobox for selecting the default email | 747 | // Create and connect combobox for selecting the default email |
748 | if ( type == "Default Email"){ | 748 | if ( type == "Default Email"){ |
749 | Opie::Core::owarn << "Choosing default-email (defaultEmailChooserPosition= " | 749 | owarn << "Choosing default-email (defaultEmailChooserPosition= " |
750 | << defaultEmailChooserPosition << ") " << oendl; | 750 | << defaultEmailChooserPosition << ") " << oendl; |
751 | 751 | ||
752 | // More than one default-email chooser is not allowed ! | 752 | // More than one default-email chooser is not allowed ! |
753 | if ( ( defaultEmailChooserPosition != -1 ) && | 753 | if ( ( defaultEmailChooserPosition != -1 ) && |
754 | defaultEmailChooserPosition != widgetPos && !initializing){ | 754 | defaultEmailChooserPosition != widgetPos && !initializing){ |
755 | chooserError( widgetPos ); | 755 | chooserError( widgetPos ); |
756 | return true; | 756 | return true; |
757 | } | 757 | } |
758 | 758 | ||
759 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 759 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
760 | if ( cmbo ){ | 760 | if ( cmbo ){ |
761 | inputStack->raiseWidget( TextField ); | 761 | inputStack->raiseWidget( TextField ); |
762 | inputStack -> removeWidget( cmbo ); | 762 | inputStack -> removeWidget( cmbo ); |
763 | delete cmbo; | 763 | delete cmbo; |
764 | } | 764 | } |
765 | cmbo = new QComboBox( inputStack ); | 765 | cmbo = new QComboBox( inputStack ); |
766 | cmbo -> insertStringList( emails ); | 766 | cmbo -> insertStringList( emails ); |
767 | 767 | ||
768 | inputStack -> addWidget( cmbo, Combo ); | 768 | inputStack -> addWidget( cmbo, Combo ); |
769 | inputStack -> raiseWidget( Combo ); | 769 | inputStack -> raiseWidget( Combo ); |
770 | 770 | ||
771 | defaultEmailChooserPosition = widgetPos; | 771 | defaultEmailChooserPosition = widgetPos; |
772 | cmbDefaultEmail = cmbo; | 772 | cmbDefaultEmail = cmbo; |
773 | 773 | ||
774 | connect( cmbo,SIGNAL( activated(int) ), | 774 | connect( cmbo,SIGNAL( activated(int) ), |
775 | SLOT( defaultEmailChanged(int) ) ); | 775 | SLOT( defaultEmailChanged(int) ) ); |
776 | 776 | ||
777 | // Set current default email | 777 | // Set current default email |
778 | populateDefaultEmailCmb(); | 778 | populateDefaultEmailCmb(); |
779 | 779 | ||
780 | 780 | ||
781 | } else { | 781 | } else { |
782 | // Something else was selected: Hide combo.. | 782 | // Something else was selected: Hide combo.. |
783 | Opie::Core::owarn << " Hiding default-email combo" << oendl; | 783 | owarn << " Hiding default-email combo" << oendl; |
784 | if ( defaultEmailChooserPosition == widgetPos ){ | 784 | if ( defaultEmailChooserPosition == widgetPos ){ |
785 | defaultEmailChooserPosition = -1; | 785 | defaultEmailChooserPosition = -1; |
786 | } | 786 | } |
787 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); | 787 | QComboBox* cmbo = ( QComboBox* ) inputStack -> widget( Combo ); |
788 | if ( cmbo ){ | 788 | if ( cmbo ){ |
789 | inputStack->raiseWidget( TextField ); | 789 | inputStack->raiseWidget( TextField ); |
790 | inputStack -> removeWidget( cmbo ); | 790 | inputStack -> removeWidget( cmbo ); |
791 | cmbDefaultEmail = 0l; | 791 | cmbDefaultEmail = 0l; |
792 | delete cmbo; | 792 | delete cmbo; |
793 | } | 793 | } |
794 | 794 | ||
795 | // Caller should initialize the responsible textfield, therefore | 795 | // Caller should initialize the responsible textfield, therefore |
796 | // "false" is returned | 796 | // "false" is returned |
797 | return false; | 797 | return false; |
798 | } | 798 | } |
799 | 799 | ||
800 | // Everything is worked off .. | 800 | // Everything is worked off .. |
801 | return true; | 801 | return true; |
802 | 802 | ||
803 | } | 803 | } |
804 | 804 | ||
805 | // Currently accessed when we select default-email more than once ! | 805 | // Currently accessed when we select default-email more than once ! |
806 | void ContactEditor::chooserError( int index ) | 806 | void ContactEditor::chooserError( int index ) |
807 | { | 807 | { |
808 | Opie::Core::owarn << "ContactEditor::chooserError( " << index << " )" << oendl; | 808 | owarn << "ContactEditor::chooserError( " << index << " )" << oendl; |
809 | QMessageBox::warning( this, "Chooser Error", | 809 | QMessageBox::warning( this, "Chooser Error", |
810 | "Multiple selection of this\n" | 810 | "Multiple selection of this\n" |
811 | "Item is not allowed !\n\n" | 811 | "Item is not allowed !\n\n" |
812 | "First deselect the previous one !", | 812 | "First deselect the previous one !", |
813 | "&OK", 0, 0, | 813 | "&OK", 0, 0, |
814 | 0, 0 ); | 814 | 0, 0 ); |
815 | 815 | ||
816 | // Reset the selected Chooser. Unfortunately the chooser | 816 | // Reset the selected Chooser. Unfortunately the chooser |
817 | // generates no signal, therfore we have to | 817 | // generates no signal, therfore we have to |
818 | // call the cmbChooserChange function manually.. | 818 | // call the cmbChooserChange function manually.. |
819 | switch( index ){ | 819 | switch( index ){ |
820 | case 1: | 820 | case 1: |
821 | cmbChooserField1 -> setCurrentItem( 0 ); | 821 | cmbChooserField1 -> setCurrentItem( 0 ); |
822 | slotCmbChooser1Change( 0 ); | 822 | slotCmbChooser1Change( 0 ); |
823 | break; | 823 | break; |
824 | case 2: | 824 | case 2: |
825 | cmbChooserField2 -> setCurrentItem( 0 ); | 825 | cmbChooserField2 -> setCurrentItem( 0 ); |
826 | slotCmbChooser2Change( 0 ); | 826 | slotCmbChooser2Change( 0 ); |
827 | break; | 827 | break; |
828 | case 3: | 828 | case 3: |
829 | cmbChooserField3 -> setCurrentItem( 0 ); | 829 | cmbChooserField3 -> setCurrentItem( 0 ); |
830 | slotCmbChooser3Change( 0 ); | 830 | slotCmbChooser3Change( 0 ); |
831 | break; | 831 | break; |
832 | case 4: | 832 | case 4: |
833 | cmbChooserField4 -> setCurrentItem( 0 ); | 833 | cmbChooserField4 -> setCurrentItem( 0 ); |
834 | slotCmbChooser4Change( 0 ); | 834 | slotCmbChooser4Change( 0 ); |
835 | break; | 835 | break; |
836 | } | 836 | } |
837 | } | 837 | } |
838 | 838 | ||
839 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) | 839 | // Called when something was changed in a textfield (shouldn't it called textchanged? (se)) |
840 | void ContactEditor::chooserChange( const QString &textChanged, int index, | 840 | void ContactEditor::chooserChange( const QString &textChanged, int index, |
841 | QLineEdit* , int widgetPos ) { | 841 | QLineEdit* , int widgetPos ) { |
842 | 842 | ||
843 | QString type = slChooserNames[index]; // :SX | 843 | QString type = slChooserNames[index]; // :SX |
844 | Opie::Core::odebug << "ContactEditor::chooserChange( type=>" << type << "<, textChanged=>" | 844 | odebug << "ContactEditor::chooserChange( type=>" << type << "<, textChanged=>" |
845 | << textChanged << "< index=" << index << ", widgetPos=" << widgetPos | 845 | << textChanged << "< index=" << index << ", widgetPos=" << widgetPos |
846 | << " )" << oendl; | 846 | << " )" << oendl; |
847 | 847 | ||
848 | if ( type == "Default Email"){ | 848 | if ( type == "Default Email"){ |
849 | Opie::Core::owarn << "??? Wozu??: " << textChanged << oendl; | 849 | owarn << "??? Wozu??: " << textChanged << oendl; |
850 | defaultEmail = textChanged; | 850 | defaultEmail = textChanged; |
851 | 851 | ||
852 | populateDefaultEmailCmb(); | 852 | populateDefaultEmailCmb(); |
853 | 853 | ||
854 | }else if (type == "Emails"){ | 854 | }else if (type == "Emails"){ |
855 | Opie::Core::odebug << "emails" << oendl; | 855 | odebug << "emails" << oendl; |
856 | 856 | ||
857 | QString de; | 857 | QString de; |
858 | emails = QStringList::split (",", textChanged ); | 858 | emails = QStringList::split (",", textChanged ); |
859 | 859 | ||
860 | populateDefaultEmailCmb(); | 860 | populateDefaultEmailCmb(); |
861 | } | 861 | } |
862 | 862 | ||
863 | slChooserValues[index] = textChanged; | 863 | slChooserValues[index] = textChanged; |
864 | 864 | ||
865 | } | 865 | } |
866 | 866 | ||
867 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 867 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
868 | Opie::Core::owarn << "ContactEditor::slotChooser1Change( " << textChanged << " )" << oendl; | 868 | owarn << "ContactEditor::slotChooser1Change( " << textChanged << " )" << oendl; |
869 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); | 869 | chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); |
870 | } | 870 | } |
871 | 871 | ||
872 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 872 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
873 | Opie::Core::owarn << "ContactEditor::slotChooser2Change( " << textChanged << " )" << oendl; | 873 | owarn << "ContactEditor::slotChooser2Change( " << textChanged << " )" << oendl; |
874 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); | 874 | chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); |
875 | 875 | ||
876 | } | 876 | } |
877 | 877 | ||
878 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 878 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
879 | Opie::Core::owarn << "ContactEditor::slotChooser3Change( " << textChanged << " )" << oendl; | 879 | owarn << "ContactEditor::slotChooser3Change( " << textChanged << " )" << oendl; |
880 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); | 880 | chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); |
881 | } | 881 | } |
882 | 882 | ||
883 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { | 883 | void ContactEditor::slotChooser4Change( const QString &textChanged ) { |
884 | Opie::Core::owarn << "ContactEditor::slotChooser4Change( " << textChanged << " )" << oendl; | 884 | owarn << "ContactEditor::slotChooser4Change( " << textChanged << " )" << oendl; |
885 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); | 885 | chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); |
886 | } | 886 | } |
887 | 887 | ||
888 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 888 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
889 | 889 | ||
890 | if ( cmbAddress->currentItem() == 0 ) { | 890 | if ( cmbAddress->currentItem() == 0 ) { |
891 | slBusinessAddress[0] = textChanged; | 891 | slBusinessAddress[0] = textChanged; |
892 | } else { | 892 | } else { |
893 | slHomeAddress[0] = textChanged; | 893 | slHomeAddress[0] = textChanged; |
894 | } | 894 | } |
895 | } | 895 | } |
896 | 896 | ||
897 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 897 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
898 | 898 | ||
899 | if ( cmbAddress->currentItem() == 0 ) { | 899 | if ( cmbAddress->currentItem() == 0 ) { |
900 | slBusinessAddress[1] = textChanged; | 900 | slBusinessAddress[1] = textChanged; |
901 | } else { | 901 | } else { |
902 | slHomeAddress[1] = textChanged; | 902 | slHomeAddress[1] = textChanged; |
903 | } | 903 | } |
904 | } | 904 | } |
905 | 905 | ||
906 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 906 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
907 | 907 | ||
908 | if ( cmbAddress->currentItem() == 0 ) { | 908 | if ( cmbAddress->currentItem() == 0 ) { |
@@ -930,151 +930,151 @@ void ContactEditor::slotStateChange( const QString &textChanged ) { | |||
930 | slHomeAddress[4] = textChanged; | 930 | slHomeAddress[4] = textChanged; |
931 | } | 931 | } |
932 | } | 932 | } |
933 | 933 | ||
934 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 934 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
935 | 935 | ||
936 | if ( cmbAddress->currentItem() == 0 ) { | 936 | if ( cmbAddress->currentItem() == 0 ) { |
937 | slBusinessAddress[5] = textChanged; | 937 | slBusinessAddress[5] = textChanged; |
938 | } else { | 938 | } else { |
939 | slHomeAddress[5] = textChanged; | 939 | slHomeAddress[5] = textChanged; |
940 | } | 940 | } |
941 | } | 941 | } |
942 | 942 | ||
943 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 943 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
944 | 944 | ||
945 | if ( cmbAddress->currentItem() == 0 ) { | 945 | if ( cmbAddress->currentItem() == 0 ) { |
946 | slBusinessAddress[6] = textChanged; | 946 | slBusinessAddress[6] = textChanged; |
947 | } else { | 947 | } else { |
948 | slHomeAddress[6] = textChanged; | 948 | slHomeAddress[6] = textChanged; |
949 | } | 949 | } |
950 | } | 950 | } |
951 | 951 | ||
952 | 952 | ||
953 | void ContactEditor::slotCmbChooser1Change( int index ) { | 953 | void ContactEditor::slotCmbChooser1Change( int index ) { |
954 | Opie::Core::owarn << "ContactEditor::slotCmbChooser1Change( " << index << " )" << oendl; | 954 | owarn << "ContactEditor::slotCmbChooser1Change( " << index << " )" << oendl; |
955 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ | 955 | if ( !cmbChooserChange( cmbChooserField1->currentItem(), m_widgetStack1, 1) ){ |
956 | 956 | ||
957 | txtChooserField1->setText( slChooserValues[index] ); | 957 | txtChooserField1->setText( slChooserValues[index] ); |
958 | txtChooserField1->setFocus(); | 958 | txtChooserField1->setFocus(); |
959 | 959 | ||
960 | } | 960 | } |
961 | 961 | ||
962 | } | 962 | } |
963 | 963 | ||
964 | void ContactEditor::slotCmbChooser2Change( int index ) { | 964 | void ContactEditor::slotCmbChooser2Change( int index ) { |
965 | Opie::Core::owarn << "ContactEditor::slotCmbChooser2Change( " << index << " )" << oendl; | 965 | owarn << "ContactEditor::slotCmbChooser2Change( " << index << " )" << oendl; |
966 | 966 | ||
967 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ | 967 | if ( !cmbChooserChange( cmbChooserField2->currentItem(), m_widgetStack2, 2) ){ |
968 | 968 | ||
969 | txtChooserField2->setText( slChooserValues[index] ); | 969 | txtChooserField2->setText( slChooserValues[index] ); |
970 | txtChooserField2->setFocus(); | 970 | txtChooserField2->setFocus(); |
971 | 971 | ||
972 | } | 972 | } |
973 | } | 973 | } |
974 | 974 | ||
975 | void ContactEditor::slotCmbChooser3Change( int index ) { | 975 | void ContactEditor::slotCmbChooser3Change( int index ) { |
976 | Opie::Core::owarn << "ContactEditor::slotCmbChooser3Change( " << index << " )" << oendl; | 976 | owarn << "ContactEditor::slotCmbChooser3Change( " << index << " )" << oendl; |
977 | 977 | ||
978 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ | 978 | if ( !cmbChooserChange( cmbChooserField3->currentItem(), m_widgetStack3, 3) ){ |
979 | 979 | ||
980 | txtChooserField3->setText( slChooserValues[index] ); | 980 | txtChooserField3->setText( slChooserValues[index] ); |
981 | txtChooserField3->setFocus(); | 981 | txtChooserField3->setFocus(); |
982 | 982 | ||
983 | } | 983 | } |
984 | } | 984 | } |
985 | 985 | ||
986 | void ContactEditor::slotCmbChooser4Change( int index ) { | 986 | void ContactEditor::slotCmbChooser4Change( int index ) { |
987 | Opie::Core::owarn << "ContactEditor::slotCmbChooser4Change( " << index << " )" << oendl; | 987 | owarn << "ContactEditor::slotCmbChooser4Change( " << index << " )" << oendl; |
988 | 988 | ||
989 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ | 989 | if ( !cmbChooserChange( cmbChooserField4->currentItem(), m_widgetStack4, 4) ){ |
990 | 990 | ||
991 | txtChooserField4->setText( slChooserValues[index] ); | 991 | txtChooserField4->setText( slChooserValues[index] ); |
992 | txtChooserField4->setFocus(); | 992 | txtChooserField4->setFocus(); |
993 | 993 | ||
994 | } | 994 | } |
995 | } | 995 | } |
996 | 996 | ||
997 | void ContactEditor::slotAddressTypeChange( int index ) { | 997 | void ContactEditor::slotAddressTypeChange( int index ) { |
998 | 998 | ||
999 | 999 | ||
1000 | if ( !initializing ) | 1000 | if ( !initializing ) |
1001 | contactfields.setFieldOrder( 4, index ); | 1001 | contactfields.setFieldOrder( 4, index ); |
1002 | 1002 | ||
1003 | 1003 | ||
1004 | if ( index == 0 ) { | 1004 | if ( index == 0 ) { |
1005 | 1005 | ||
1006 | txtAddress->setText( slBusinessAddress[0] ); | 1006 | txtAddress->setText( slBusinessAddress[0] ); |
1007 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 1007 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
1008 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 1008 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
1009 | txtCity->setText( slBusinessAddress[3] ); | 1009 | txtCity->setText( slBusinessAddress[3] ); |
1010 | txtState->setText( slBusinessAddress[4] ); | 1010 | txtState->setText( slBusinessAddress[4] ); |
1011 | txtZip->setText( slBusinessAddress[5] ); | 1011 | txtZip->setText( slBusinessAddress[5] ); |
1012 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1012 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1013 | txtTmp->setText( slBusinessAddress[6] ); | 1013 | txtTmp->setText( slBusinessAddress[6] ); |
1014 | 1014 | ||
1015 | } else { | 1015 | } else { |
1016 | 1016 | ||
1017 | txtAddress->setText( slHomeAddress[0] ); | 1017 | txtAddress->setText( slHomeAddress[0] ); |
1018 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 1018 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
1019 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 1019 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
1020 | txtCity->setText( slHomeAddress[3] ); | 1020 | txtCity->setText( slHomeAddress[3] ); |
1021 | txtState->setText( slHomeAddress[4] ); | 1021 | txtState->setText( slHomeAddress[4] ); |
1022 | txtZip->setText( slHomeAddress[5] ); | 1022 | txtZip->setText( slHomeAddress[5] ); |
1023 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1023 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1024 | txtTmp->setText( slHomeAddress[6] ); | 1024 | txtTmp->setText( slHomeAddress[6] ); |
1025 | 1025 | ||
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 1030 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
1031 | 1031 | ||
1032 | Opie::Core::owarn << "ContactEditor::slotFullNameChange( " << textChanged << " )" << oendl; | 1032 | owarn << "ContactEditor::slotFullNameChange( " << textChanged << " )" << oendl; |
1033 | 1033 | ||
1034 | int index = cmbFileAs->currentItem(); | 1034 | int index = cmbFileAs->currentItem(); |
1035 | 1035 | ||
1036 | cmbFileAs->clear(); | 1036 | cmbFileAs->clear(); |
1037 | 1037 | ||
1038 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); | 1038 | cmbFileAs->insertItem( parseName( textChanged, NAME_LF ) ); |
1039 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); | 1039 | cmbFileAs->insertItem( parseName( textChanged, NAME_LFM ) ); |
1040 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); | 1040 | cmbFileAs->insertItem( parseName( textChanged, NAME_FL ) ); |
1041 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); | 1041 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) ); |
1042 | if ( ! txtSuffix->text().isEmpty() ) | 1042 | if ( ! txtSuffix->text().isEmpty() ) |
1043 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); | 1043 | cmbFileAs->insertItem( parseName( textChanged, NAME_FML ) + " " + txtSuffix->text() ); |
1044 | 1044 | ||
1045 | cmbFileAs->setCurrentItem( index ); | 1045 | cmbFileAs->setCurrentItem( index ); |
1046 | 1046 | ||
1047 | 1047 | ||
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | void ContactEditor::slotSuffixChange( const QString& ) { | 1050 | void ContactEditor::slotSuffixChange( const QString& ) { |
1051 | // Just want to update the FileAs combo if the suffix was changed.. | 1051 | // Just want to update the FileAs combo if the suffix was changed.. |
1052 | slotFullNameChange( txtFullName->text() ); | 1052 | slotFullNameChange( txtFullName->text() ); |
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | void ContactEditor::slotOrganizationChange( const QString &textChanged ){ | 1055 | void ContactEditor::slotOrganizationChange( const QString &textChanged ){ |
1056 | Opie::Core::owarn << "ContactEditor::slotOrganizationChange( " << textChanged << " )" << oendl; | 1056 | owarn << "ContactEditor::slotOrganizationChange( " << textChanged << " )" << oendl; |
1057 | // Special handling for storing Companies: | 1057 | // Special handling for storing Companies: |
1058 | // If no Fullname is given, we store the Company-Name as lastname | 1058 | // If no Fullname is given, we store the Company-Name as lastname |
1059 | // to handle it like a person.. | 1059 | // to handle it like a person.. |
1060 | if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) | 1060 | if ( txtFullName->text() == txtOrganization->text().left( txtFullName->text().length() ) ) |
1061 | txtFullName->setText( textChanged ); | 1061 | txtFullName->setText( textChanged ); |
1062 | 1062 | ||
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | void ContactEditor::accept() { | 1065 | void ContactEditor::accept() { |
1066 | 1066 | ||
1067 | if ( isEmpty() ) { | 1067 | if ( isEmpty() ) { |
1068 | cleanupFields(); | 1068 | cleanupFields(); |
1069 | reject(); | 1069 | reject(); |
1070 | } else { | 1070 | } else { |
1071 | saveEntry(); | 1071 | saveEntry(); |
1072 | cleanupFields(); | 1072 | cleanupFields(); |
1073 | QDialog::accept(); | 1073 | QDialog::accept(); |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | } | 1076 | } |
1077 | 1077 | ||
1078 | void ContactEditor::slotNote() { | 1078 | void ContactEditor::slotNote() { |
1079 | 1079 | ||
1080 | if ( ! QPEApplication::execDialog( dlgNote ) ) { | 1080 | if ( ! QPEApplication::execDialog( dlgNote ) ) { |
@@ -1114,99 +1114,99 @@ bool ContactEditor::isEmpty() { | |||
1114 | // More strict than the original qtopia, needs name or fileas to save | 1114 | // More strict than the original qtopia, needs name or fileas to save |
1115 | 1115 | ||
1116 | QString t = txtFullName->text(); | 1116 | QString t = txtFullName->text(); |
1117 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1117 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1118 | return false; | 1118 | return false; |
1119 | 1119 | ||
1120 | t = cmbFileAs->currentText(); | 1120 | t = cmbFileAs->currentText(); |
1121 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1121 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1122 | return false; | 1122 | return false; |
1123 | 1123 | ||
1124 | return true; | 1124 | return true; |
1125 | 1125 | ||
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1128 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1129 | 1129 | ||
1130 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1130 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1131 | QString strFirstName; | 1131 | QString strFirstName; |
1132 | QString strMiddleName; | 1132 | QString strMiddleName; |
1133 | QString strLastName; | 1133 | QString strLastName; |
1134 | QString strTitle; | 1134 | QString strTitle; |
1135 | int commapos; | 1135 | int commapos; |
1136 | bool haveLastName = false; | 1136 | bool haveLastName = false; |
1137 | 1137 | ||
1138 | Opie::Core::owarn << "Fullname: " << simplifiedName << oendl; | 1138 | owarn << "Fullname: " << simplifiedName << oendl; |
1139 | 1139 | ||
1140 | commapos = simplifiedName.find( ',', 0, TRUE); | 1140 | commapos = simplifiedName.find( ',', 0, TRUE); |
1141 | if ( commapos >= 0 ) { | 1141 | if ( commapos >= 0 ) { |
1142 | Opie::Core::owarn << " Commapos: " << commapos << oendl; | 1142 | owarn << " Commapos: " << commapos << oendl; |
1143 | 1143 | ||
1144 | // A comma (",") separates the lastname from one or | 1144 | // A comma (",") separates the lastname from one or |
1145 | // many first names. Thus, remove the lastname from the | 1145 | // many first names. Thus, remove the lastname from the |
1146 | // String and parse the firstnames. | 1146 | // String and parse the firstnames. |
1147 | 1147 | ||
1148 | strLastName = simplifiedName.left( commapos ); | 1148 | strLastName = simplifiedName.left( commapos ); |
1149 | simplifiedName= simplifiedName.mid( commapos + 1 ); | 1149 | simplifiedName= simplifiedName.mid( commapos + 1 ); |
1150 | haveLastName = true; | 1150 | haveLastName = true; |
1151 | Opie::Core::owarn << "Fullname without ',': " << simplifiedName << oendl; | 1151 | owarn << "Fullname without ',': " << simplifiedName << oendl; |
1152 | 1152 | ||
1153 | // If we have any lastname, we should now split all first names. | 1153 | // If we have any lastname, we should now split all first names. |
1154 | // The first one will be the used as first, the rest as "middle names" | 1154 | // The first one will be the used as first, the rest as "middle names" |
1155 | 1155 | ||
1156 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); | 1156 | QStringList allFirstNames = QStringList::split(" ", simplifiedName); |
1157 | QStringList::Iterator it = allFirstNames.begin(); | 1157 | QStringList::Iterator it = allFirstNames.begin(); |
1158 | strFirstName = *it++; | 1158 | strFirstName = *it++; |
1159 | QStringList allSecondNames; | 1159 | QStringList allSecondNames; |
1160 | for ( ; it != allFirstNames.end(); ++it ) | 1160 | for ( ; it != allFirstNames.end(); ++it ) |
1161 | allSecondNames.append( *it ); | 1161 | allSecondNames.append( *it ); |
1162 | 1162 | ||
1163 | strMiddleName = allSecondNames.join(" "); | 1163 | strMiddleName = allSecondNames.join(" "); |
1164 | 1164 | ||
1165 | } else { | 1165 | } else { |
1166 | 1166 | ||
1167 | // No comma separator used: We use the first word as firstname, the | 1167 | // No comma separator used: We use the first word as firstname, the |
1168 | // last as second/lastname and everything in the middle as middlename | 1168 | // last as second/lastname and everything in the middle as middlename |
1169 | 1169 | ||
1170 | QStringList allNames = QStringList::split(" ", simplifiedName); | 1170 | QStringList allNames = QStringList::split(" ", simplifiedName); |
1171 | QStringList::Iterator it = allNames.begin(); | 1171 | QStringList::Iterator it = allNames.begin(); |
1172 | strFirstName = *it++; | 1172 | strFirstName = *it++; |
1173 | QStringList allSecondNames; | 1173 | QStringList allSecondNames; |
1174 | for ( ; it != --allNames.end(); ++it ) | 1174 | for ( ; it != --allNames.end(); ++it ) |
1175 | allSecondNames.append( *it ); | 1175 | allSecondNames.append( *it ); |
1176 | 1176 | ||
1177 | strMiddleName = allSecondNames.join(" "); | 1177 | strMiddleName = allSecondNames.join(" "); |
1178 | strLastName = *(--allNames.end()); | 1178 | strLastName = *(--allNames.end()); |
1179 | 1179 | ||
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | if ( strFirstName == strLastName ) | 1182 | if ( strFirstName == strLastName ) |
1183 | strFirstName = ""; | 1183 | strFirstName = ""; |
1184 | 1184 | ||
1185 | Opie::Core::owarn << "strFirstName: " << strFirstName << oendl; | 1185 | owarn << "strFirstName: " << strFirstName << oendl; |
1186 | Opie::Core::owarn << "strMiddletName: " << strMiddleName << oendl; | 1186 | owarn << "strMiddletName: " << strMiddleName << oendl; |
1187 | Opie::Core::owarn << "strLastName: " << strLastName << oendl; | 1187 | owarn << "strLastName: " << strLastName << oendl; |
1188 | Opie::Core::owarn << "strTitle: " << strTitle << oendl; | 1188 | owarn << "strTitle: " << strTitle << oendl; |
1189 | 1189 | ||
1190 | switch (type) { | 1190 | switch (type) { |
1191 | case NAME_FL: | 1191 | case NAME_FL: |
1192 | return strFirstName + " " + strLastName; | 1192 | return strFirstName + " " + strLastName; |
1193 | 1193 | ||
1194 | case NAME_LF: | 1194 | case NAME_LF: |
1195 | return strLastName + ", " + strFirstName; | 1195 | return strLastName + ", " + strFirstName; |
1196 | 1196 | ||
1197 | case NAME_LFM: | 1197 | case NAME_LFM: |
1198 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 1198 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
1199 | 1199 | ||
1200 | case NAME_FML: | 1200 | case NAME_FML: |
1201 | return strFirstName + " " + strMiddleName + " " + strLastName ; | 1201 | return strFirstName + " " + strMiddleName + " " + strLastName ; |
1202 | 1202 | ||
1203 | case NAME_F: | 1203 | case NAME_F: |
1204 | return strFirstName; | 1204 | return strFirstName; |
1205 | 1205 | ||
1206 | case NAME_M: | 1206 | case NAME_M: |
1207 | return strMiddleName; | 1207 | return strMiddleName; |
1208 | 1208 | ||
1209 | case NAME_L: | 1209 | case NAME_L: |
1210 | return strLastName; | 1210 | return strLastName; |
1211 | 1211 | ||
1212 | case NAME_S: | 1212 | case NAME_S: |
@@ -1247,49 +1247,49 @@ void ContactEditor::cleanupFields() { | |||
1247 | txtAddress->setText(""); | 1247 | txtAddress->setText(""); |
1248 | txtCity->setText(""); | 1248 | txtCity->setText(""); |
1249 | txtState->setText(""); | 1249 | txtState->setText(""); |
1250 | txtZip->setText(""); | 1250 | txtZip->setText(""); |
1251 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 1251 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
1252 | txtTmp->setText(""); | 1252 | txtTmp->setText(""); |
1253 | txtTmp = cmbFileAs->lineEdit(); | 1253 | txtTmp = cmbFileAs->lineEdit(); |
1254 | txtTmp->setText(""); | 1254 | txtTmp->setText(""); |
1255 | 1255 | ||
1256 | } | 1256 | } |
1257 | 1257 | ||
1258 | void ContactEditor::setEntry( const Opie::OPimContact &entry ) { | 1258 | void ContactEditor::setEntry( const Opie::OPimContact &entry ) { |
1259 | 1259 | ||
1260 | initializing = true; | 1260 | initializing = true; |
1261 | 1261 | ||
1262 | // Cleanup and activate the general Page .. | 1262 | // Cleanup and activate the general Page .. |
1263 | cleanupFields(); | 1263 | cleanupFields(); |
1264 | tabMain->setCurrentPage( 0 ); | 1264 | tabMain->setCurrentPage( 0 ); |
1265 | 1265 | ||
1266 | ent = entry; | 1266 | ent = entry; |
1267 | 1267 | ||
1268 | emails = QStringList(ent.emailList()); | 1268 | emails = QStringList(ent.emailList()); |
1269 | defaultEmail = ent.defaultEmail(); | 1269 | defaultEmail = ent.defaultEmail(); |
1270 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; | 1270 | if (defaultEmail.isEmpty()) defaultEmail = emails[0]; |
1271 | Opie::Core::odebug << "default email=" << defaultEmail << oendl; | 1271 | odebug << "default email=" << defaultEmail << oendl; |
1272 | 1272 | ||
1273 | txtFirstName->setText( ent.firstName() ); | 1273 | txtFirstName->setText( ent.firstName() ); |
1274 | txtMiddleName->setText( ent.middleName() ); | 1274 | txtMiddleName->setText( ent.middleName() ); |
1275 | txtLastName->setText( ent.lastName() ); | 1275 | txtLastName->setText( ent.lastName() ); |
1276 | txtSuffix->setText( ent.suffix() ); | 1276 | txtSuffix->setText( ent.suffix() ); |
1277 | 1277 | ||
1278 | // QString *tmpString = new QString; | 1278 | // QString *tmpString = new QString; |
1279 | // *tmpString = ent.firstName() + " " + ent.middleName() + | 1279 | // *tmpString = ent.firstName() + " " + ent.middleName() + |
1280 | // + " " + ent.lastName() + " " + ent.suffix(); | 1280 | // + " " + ent.lastName() + " " + ent.suffix(); |
1281 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 1281 | //txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
1282 | 1282 | ||
1283 | if ( !ent.isEmpty() ){ | 1283 | if ( !ent.isEmpty() ){ |
1284 | // Lastnames with multiple words need to be protected by a comma ! | 1284 | // Lastnames with multiple words need to be protected by a comma ! |
1285 | if ( ent.lastName().contains( ' ', TRUE ) ) | 1285 | if ( ent.lastName().contains( ' ', TRUE ) ) |
1286 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); | 1286 | txtFullName->setText( ent.lastName() + ", " + ent.firstName() + " " + ent.middleName() ); |
1287 | else | 1287 | else |
1288 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); | 1288 | txtFullName->setText( ent.firstName() + " " + ent.middleName() + " " + ent.lastName() ); |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | cmbFileAs->setEditText( ent.fileAs() ); | 1291 | cmbFileAs->setEditText( ent.fileAs() ); |
1292 | 1292 | ||
1293 | //if (hasTitle) | 1293 | //if (hasTitle) |
1294 | txtJobTitle->setText( ent.jobTitle() ); | 1294 | txtJobTitle->setText( ent.jobTitle() ); |
1295 | 1295 | ||
@@ -1307,73 +1307,73 @@ void ContactEditor::setEntry( const Opie::OPimContact &entry ) { | |||
1307 | //if (hasCity) { | 1307 | //if (hasCity) { |
1308 | slHomeAddress[3] = ent.homeCity(); | 1308 | slHomeAddress[3] = ent.homeCity(); |
1309 | slBusinessAddress[3] = ent.businessCity(); | 1309 | slBusinessAddress[3] = ent.businessCity(); |
1310 | //} | 1310 | //} |
1311 | 1311 | ||
1312 | //if (hasState) { | 1312 | //if (hasState) { |
1313 | slHomeAddress[4] = ent.homeState(); | 1313 | slHomeAddress[4] = ent.homeState(); |
1314 | slBusinessAddress[4] = ent.businessState(); | 1314 | slBusinessAddress[4] = ent.businessState(); |
1315 | //} | 1315 | //} |
1316 | 1316 | ||
1317 | //if (hasZip) { | 1317 | //if (hasZip) { |
1318 | slHomeAddress[5] = ent.homeZip(); | 1318 | slHomeAddress[5] = ent.homeZip(); |
1319 | slBusinessAddress[5] = ent.businessZip(); | 1319 | slBusinessAddress[5] = ent.businessZip(); |
1320 | //} | 1320 | //} |
1321 | 1321 | ||
1322 | //if (hasCountry) { | 1322 | //if (hasCountry) { |
1323 | slHomeAddress[6] = ent.homeCountry(); | 1323 | slHomeAddress[6] = ent.homeCountry(); |
1324 | slBusinessAddress[6] = ent.businessCountry(); | 1324 | slBusinessAddress[6] = ent.businessCountry(); |
1325 | //} | 1325 | //} |
1326 | 1326 | ||
1327 | QStringList::ConstIterator it; | 1327 | QStringList::ConstIterator it; |
1328 | QListIterator<QLineEdit> itLE( listValue ); | 1328 | QListIterator<QLineEdit> itLE( listValue ); |
1329 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { | 1329 | for ( it = slDynamicEntries.begin(); itLE.current()/* != slDynamicEntries.end()*/; ++it, ++itLE) { |
1330 | 1330 | ||
1331 | Opie::Core::owarn << " Filling dynamic Field: " << (*it) << oendl; | 1331 | owarn << " Filling dynamic Field: " << (*it) << oendl; |
1332 | 1332 | ||
1333 | if ( *it == "Department" ) | 1333 | if ( *it == "Department" ) |
1334 | (*itLE)->setText( ent.department() ); | 1334 | (*itLE)->setText( ent.department() ); |
1335 | 1335 | ||
1336 | if ( *it == "Company" ) | 1336 | if ( *it == "Company" ) |
1337 | (*itLE)->setText( ent.company() ); | 1337 | (*itLE)->setText( ent.company() ); |
1338 | 1338 | ||
1339 | if ( *it == "Office" ) | 1339 | if ( *it == "Office" ) |
1340 | (*itLE)->setText( ent.office() ); | 1340 | (*itLE)->setText( ent.office() ); |
1341 | 1341 | ||
1342 | if ( *it == "Profession" ) | 1342 | if ( *it == "Profession" ) |
1343 | (*itLE)->setText( ent.profession() ); | 1343 | (*itLE)->setText( ent.profession() ); |
1344 | 1344 | ||
1345 | if ( *it == "Assistant" ) | 1345 | if ( *it == "Assistant" ) |
1346 | (*itLE)->setText( ent.assistant() ); | 1346 | (*itLE)->setText( ent.assistant() ); |
1347 | 1347 | ||
1348 | if ( *it == "Manager" ) | 1348 | if ( *it == "Manager" ) |
1349 | (*itLE)->setText( ent.manager() ); | 1349 | (*itLE)->setText( ent.manager() ); |
1350 | 1350 | ||
1351 | if ( *it == "Spouse" ) | 1351 | if ( *it == "Spouse" ) |
1352 | (*itLE)->setText( ent.spouse() ); | 1352 | (*itLE)->setText( ent.spouse() ); |
1353 | 1353 | ||
1354 | if ( *it == "Nickname" ){ | 1354 | if ( *it == "Nickname" ){ |
1355 | Opie::Core::owarn << "**** Nichname: " << ent.nickname() << oendl; | 1355 | owarn << "**** Nichname: " << ent.nickname() << oendl; |
1356 | (*itLE)->setText( ent.nickname() ); | 1356 | (*itLE)->setText( ent.nickname() ); |
1357 | } | 1357 | } |
1358 | 1358 | ||
1359 | if ( *it == "Children" ) | 1359 | if ( *it == "Children" ) |
1360 | (*itLE)->setText( ent.children() ); | 1360 | (*itLE)->setText( ent.children() ); |
1361 | 1361 | ||
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | QStringList::Iterator itV; | 1364 | QStringList::Iterator itV; |
1365 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1365 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1366 | 1366 | ||
1367 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) | 1367 | if ( ( *it == "Business Phone") || ( *it == "Work Phone" ) ) |
1368 | *itV = ent.businessPhone(); | 1368 | *itV = ent.businessPhone(); |
1369 | /* | 1369 | /* |
1370 | if ( *it == "Business 2 Phone" ) | 1370 | if ( *it == "Business 2 Phone" ) |
1371 | *itV = ent.business2Phone(); | 1371 | *itV = ent.business2Phone(); |
1372 | */ | 1372 | */ |
1373 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) | 1373 | if ( ( *it == "Business Fax") || ( *it == "Work Fax" ) ) |
1374 | *itV = ent.businessFax(); | 1374 | *itV = ent.businessFax(); |
1375 | 1375 | ||
1376 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) | 1376 | if ( ( *it == "Business Mobile" ) || ( *it == "work Mobile" ) ) |
1377 | *itV = ent.businessMobile(); | 1377 | *itV = ent.businessMobile(); |
1378 | /* | 1378 | /* |
1379 | if ( *it == "Company Phone" ) | 1379 | if ( *it == "Company Phone" ) |
@@ -1564,50 +1564,50 @@ void ContactEditor::saveEntry() { | |||
1564 | 1564 | ||
1565 | if ( *it == "Children" ) | 1565 | if ( *it == "Children" ) |
1566 | ent.setChildren( (*itLE)->text() ); | 1566 | ent.setChildren( (*itLE)->text() ); |
1567 | 1567 | ||
1568 | } | 1568 | } |
1569 | 1569 | ||
1570 | 1570 | ||
1571 | QStringList::ConstIterator itV; | 1571 | QStringList::ConstIterator itV; |
1572 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1572 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1573 | 1573 | ||
1574 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) | 1574 | if ( ( *it == "Business Phone" ) || ( *it == "Work Phone" ) ) |
1575 | ent.setBusinessPhone( *itV ); | 1575 | ent.setBusinessPhone( *itV ); |
1576 | 1576 | ||
1577 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) | 1577 | if ( ( *it == "Business Fax" ) || ( *it == "Work Fax" ) ) |
1578 | ent.setBusinessFax( *itV ); | 1578 | ent.setBusinessFax( *itV ); |
1579 | 1579 | ||
1580 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) | 1580 | if ( ( *it == "Business Mobile" ) || ( *it == "Work Mobile" ) ) |
1581 | ent.setBusinessMobile( *itV ); | 1581 | ent.setBusinessMobile( *itV ); |
1582 | 1582 | ||
1583 | if ( *it == "Emails" ){ | 1583 | if ( *it == "Emails" ){ |
1584 | QString allemail; | 1584 | QString allemail; |
1585 | QString defaultmail; | 1585 | QString defaultmail; |
1586 | parseEmailFrom( emails.join(","), defaultmail, allemail ); | 1586 | parseEmailFrom( emails.join(","), defaultmail, allemail ); |
1587 | if ( defaultEmail.isEmpty() ){ | 1587 | if ( defaultEmail.isEmpty() ){ |
1588 | Opie::Core::owarn << "Default email was not set by user!" << oendl; | 1588 | owarn << "Default email was not set by user!" << oendl; |
1589 | Opie::Core::owarn << "Using first email in list: " << defaultmail << oendl; | 1589 | owarn << "Using first email in list: " << defaultmail << oendl; |
1590 | ent.setDefaultEmail( defaultmail ); | 1590 | ent.setDefaultEmail( defaultmail ); |
1591 | } | 1591 | } |
1592 | ent.setEmails( allemail ); | 1592 | ent.setEmails( allemail ); |
1593 | } | 1593 | } |
1594 | 1594 | ||
1595 | if ( *it == "Default Email") | 1595 | if ( *it == "Default Email") |
1596 | ent.setDefaultEmail( defaultEmail /* *itV */ ); | 1596 | ent.setDefaultEmail( defaultEmail /* *itV */ ); |
1597 | 1597 | ||
1598 | if ( *it == "Home Phone" ) | 1598 | if ( *it == "Home Phone" ) |
1599 | ent.setHomePhone( *itV ); | 1599 | ent.setHomePhone( *itV ); |
1600 | 1600 | ||
1601 | if ( *it == "Home Fax" ) | 1601 | if ( *it == "Home Fax" ) |
1602 | ent.setHomeFax( *itV ); | 1602 | ent.setHomeFax( *itV ); |
1603 | 1603 | ||
1604 | if ( *it == "Home Mobile" ) | 1604 | if ( *it == "Home Mobile" ) |
1605 | ent.setHomeMobile( *itV ); | 1605 | ent.setHomeMobile( *itV ); |
1606 | 1606 | ||
1607 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) | 1607 | if ( ( *it == "Business Pager" ) || ( *it == "Work Pager" ) ) |
1608 | ent.setBusinessPager( *itV ); | 1608 | ent.setBusinessPager( *itV ); |
1609 | 1609 | ||
1610 | if ( *it == "Home Web Page" ) | 1610 | if ( *it == "Home Web Page" ) |
1611 | ent.setHomeWebpage( *itV ); | 1611 | ent.setHomeWebpage( *itV ); |
1612 | 1612 | ||
1613 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) | 1613 | if ( ( *it == "Business WebPage" ) || ( *it == "Work Web Page" ) ) |
@@ -1717,35 +1717,35 @@ void ContactEditor::setPersonalView( bool personal ) | |||
1717 | labCat->show(); | 1717 | labCat->show(); |
1718 | } | 1718 | } |
1719 | } | 1719 | } |
1720 | 1720 | ||
1721 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) | 1721 | void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) |
1722 | { | 1722 | { |
1723 | QDate date; | 1723 | QDate date; |
1724 | date.setYMD( year, month, day ); | 1724 | date.setYMD( year, month, day ); |
1725 | QString dateString = TimeString::numberDateString( date ); | 1725 | QString dateString = TimeString::numberDateString( date ); |
1726 | anniversaryButton->setText( dateString ); | 1726 | anniversaryButton->setText( dateString ); |
1727 | ent.setAnniversary ( date ); | 1727 | ent.setAnniversary ( date ); |
1728 | } | 1728 | } |
1729 | 1729 | ||
1730 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) | 1730 | void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) |
1731 | { | 1731 | { |
1732 | QDate date; | 1732 | QDate date; |
1733 | date.setYMD( year, month, day ); | 1733 | date.setYMD( year, month, day ); |
1734 | QString dateString = TimeString::numberDateString( date ); | 1734 | QString dateString = TimeString::numberDateString( date ); |
1735 | birthdayButton->setText( dateString ); | 1735 | birthdayButton->setText( dateString ); |
1736 | ent.setBirthday ( date ); | 1736 | ent.setBirthday ( date ); |
1737 | } | 1737 | } |
1738 | 1738 | ||
1739 | void ContactEditor::slotRemoveBirthday() | 1739 | void ContactEditor::slotRemoveBirthday() |
1740 | { | 1740 | { |
1741 | Opie::Core::owarn << "void ContactEditor::slotRemoveBirthday()" << oendl; | 1741 | owarn << "void ContactEditor::slotRemoveBirthday()" << oendl; |
1742 | ent.setBirthday( QDate() ); | 1742 | ent.setBirthday( QDate() ); |
1743 | updateDatePicker(); | 1743 | updateDatePicker(); |
1744 | } | 1744 | } |
1745 | 1745 | ||
1746 | void ContactEditor::slotRemoveAnniversary() | 1746 | void ContactEditor::slotRemoveAnniversary() |
1747 | { | 1747 | { |
1748 | Opie::Core::owarn << "void ContactEditor::slotRemoveAnniversary()" << oendl; | 1748 | owarn << "void ContactEditor::slotRemoveAnniversary()" << oendl; |
1749 | ent.setAnniversary( QDate() ); | 1749 | ent.setAnniversary( QDate() ); |
1750 | updateDatePicker(); | 1750 | updateDatePicker(); |
1751 | } | 1751 | } |
diff --git a/core/pim/addressbook/picker.cpp b/core/pim/addressbook/picker.cpp index df3d6ac..8a9c85b 100644 --- a/core/pim/addressbook/picker.cpp +++ b/core/pim/addressbook/picker.cpp | |||
@@ -218,28 +218,28 @@ LetterPicker::LetterPicker( QWidget *parent, const char *name ) | |||
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 | Opie::Core::owarn << "LetterClicked" << oendl; | 242 | owarn << "LetterClicked" << oendl; |
243 | emit letterClicked( letter ); | 243 | emit letterClicked( letter ); |
244 | 244 | ||
245 | } | 245 | } |