-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 58fbccf..3b2e4b8 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -144,385 +144,385 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
144 | #if !defined(QT_NO_COP) | 144 | #if !defined(QT_NO_COP) |
145 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); | 145 | QCopChannel *addressChannel = new QCopChannel("QPE/Addressbook" , this ); |
146 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), | 146 | connect (addressChannel, SIGNAL( received(const QCString &, const QByteArray &)), |
147 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); | 147 | this, SLOT ( appMessage(const QCString &, const QByteArray &) ) ); |
148 | #endif | 148 | #endif |
149 | #endif | 149 | #endif |
150 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), | 150 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), |
151 | QString::null, 0, this, 0 ); | 151 | QString::null, 0, this, 0 ); |
152 | actionFind = a; | 152 | actionFind = a; |
153 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); | 153 | connect( a, SIGNAL(activated()), this, SLOT( slotFindOpen()) ); |
154 | a->addTo( edit ); | 154 | a->addTo( edit ); |
155 | a->addTo( listTools ); | 155 | a->addTo( listTools ); |
156 | 156 | ||
157 | // Much better search widget, taken from QTReader.. (se) | 157 | // Much better search widget, taken from QTReader.. (se) |
158 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); | 158 | searchBar = new OFloatBar( "Search", this, QMainWindow::Top, TRUE ); |
159 | searchBar->setHorizontalStretchable( TRUE ); | 159 | searchBar->setHorizontalStretchable( TRUE ); |
160 | searchBar->hide(); | 160 | searchBar->hide(); |
161 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); | 161 | searchEdit = new QLineEdit( searchBar, "searchEdit" ); |
162 | 162 | ||
163 | // QFont f("unifont", 16 /*, QFont::Bold*/); | 163 | // QFont f("unifont", 16 /*, QFont::Bold*/); |
164 | // searchEdit->setFont( f ); | 164 | // searchEdit->setFont( f ); |
165 | 165 | ||
166 | searchBar->setStretchableWidget( searchEdit ); | 166 | searchBar->setStretchableWidget( searchEdit ); |
167 | connect( searchEdit, SIGNAL( returnPressed( ) ), | 167 | connect( searchEdit, SIGNAL( returnPressed( ) ), |
168 | this, SLOT( slotFind( ) ) ); | 168 | this, SLOT( slotFind( ) ) ); |
169 | 169 | ||
170 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); | 170 | a = new QAction( tr( "Start Search" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); |
171 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); | 171 | connect( a, SIGNAL( activated() ), this, SLOT( slotFind() ) ); |
172 | a->addTo( searchBar ); | 172 | a->addTo( searchBar ); |
173 | 173 | ||
174 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 174 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
175 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); | 175 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); |
176 | a->addTo( searchBar ); | 176 | a->addTo( searchBar ); |
177 | 177 | ||
178 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "mail/sendmail" ), | 178 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "mail/sendmail" ), |
179 | QString::null, 0, this, 0 ); | 179 | QString::null, 0, this, 0 ); |
180 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 180 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
181 | actionMail = a; | 181 | actionMail = a; |
182 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 182 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
183 | a->addTo( edit ); | 183 | a->addTo( edit ); |
184 | a->addTo( listTools ); | 184 | a->addTo( listTools ); |
185 | 185 | ||
186 | if ( Ir::supported() ) { | 186 | if ( Ir::supported() ) { |
187 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 187 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
188 | 0, this, 0 ); | 188 | 0, this, 0 ); |
189 | actionBeam = a; | 189 | actionBeam = a; |
190 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 190 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
191 | a->addTo( edit ); | 191 | a->addTo( edit ); |
192 | a->addTo( listTools ); | 192 | a->addTo( listTools ); |
193 | } | 193 | } |
194 | 194 | ||
195 | edit->insertSeparator(); | 195 | edit->insertSeparator(); |
196 | 196 | ||
197 | a = new QAction( tr("Import vCard"), QString::null, 0, 0); | 197 | a = new QAction( tr("Import vCard"), QString::null, 0, 0); |
198 | actionPersonal = a; | 198 | actionPersonal = a; |
199 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); | 199 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); |
200 | a->addTo( edit ); | 200 | a->addTo( edit ); |
201 | 201 | ||
202 | edit->insertSeparator(); | 202 | edit->insertSeparator(); |
203 | 203 | ||
204 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); | 204 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); |
205 | actionPersonal = a; | 205 | actionPersonal = a; |
206 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 206 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); |
207 | a->addTo( edit ); | 207 | a->addTo( edit ); |
208 | 208 | ||
209 | 209 | ||
210 | #ifdef __DEBUG_RELEASE | 210 | #ifdef __DEBUG_RELEASE |
211 | // Remove this function for public Release ! This is only | 211 | // Remove this function for public Release ! This is only |
212 | // for debug purposes .. | 212 | // for debug purposes .. |
213 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); | 213 | a = new QAction( tr( "Save all Data"), QString::null, 0, 0 ); |
214 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); | 214 | connect( a, SIGNAL( activated() ), this , SLOT( slotSave() ) ); |
215 | a->addTo( edit ); | 215 | a->addTo( edit ); |
216 | #endif | 216 | #endif |
217 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, | 217 | a = new QAction( tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, |
218 | 0, this, 0 ); | 218 | 0, this, 0 ); |
219 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); | 219 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfig() ) ); |
220 | a->addTo( edit ); | 220 | a->addTo( edit ); |
221 | 221 | ||
222 | // Create Views | 222 | // Create Views |
223 | listContainer = new QWidget( this ); | 223 | listContainer = new QWidget( this ); |
224 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | 224 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); |
225 | 225 | ||
226 | m_abView = new AbView( listContainer, m_config.orderList() ); | 226 | m_abView = new AbView( listContainer, m_config.orderList() ); |
227 | vb->addWidget( m_abView ); | 227 | vb->addWidget( m_abView ); |
228 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 228 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
229 | connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), | 229 | connect( m_abView, SIGNAL( signalViewSwitched ( int ) ), |
230 | this, SLOT( slotViewSwitched( int ) ) ); | 230 | this, SLOT( slotViewSwitched( int ) ) ); |
231 | 231 | ||
232 | 232 | ||
233 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); | 233 | QObject::connect( m_abView, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); |
234 | 234 | ||
235 | m_abView->load(); | 235 | m_abView->load(); |
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 | // Category Menu | 244 | // Category Menu |
245 | catMenu = new QPopupMenu( this ); | 245 | catMenu = new QPopupMenu( this ); |
246 | catMenu->setCheckable( TRUE ); | 246 | catMenu->setCheckable( TRUE ); |
247 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 247 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
248 | populateCategories(); | 248 | populateCategories(); |
249 | mbList->insertItem( tr("View"), catMenu ); | 249 | mbList->insertItem( tr("View"), catMenu ); |
250 | 250 | ||
251 | defaultFont = new QFont( m_abView->font() ); | 251 | defaultFont = new QFont( m_abView->font() ); |
252 | slotSetFont(m_config.fontSize()); | 252 | slotSetFont(m_config.fontSize()); |
253 | m_curFontSize = m_config.fontSize(); | 253 | m_curFontSize = m_config.fontSize(); |
254 | 254 | ||
255 | setCentralWidget(listContainer); | 255 | setCentralWidget(listContainer); |
256 | 256 | ||
257 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 257 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
258 | 258 | ||
259 | 259 | ||
260 | isLoading = false; | 260 | isLoading = false; |
261 | } | 261 | } |
262 | 262 | ||
263 | 263 | ||
264 | void AddressbookWindow::slotConfig() | 264 | void AddressbookWindow::slotConfig() |
265 | { | 265 | { |
266 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | 266 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); |
267 | dlg -> setConfig( m_config ); | 267 | dlg -> setConfig( m_config ); |
268 | dlg -> showMaximized(); | 268 | dlg -> showMaximized(); |
269 | if ( dlg -> exec() ) { | 269 | if ( dlg -> exec() ) { |
270 | qWarning ("Config Dialog accepted !"); | 270 | qWarning ("Config Dialog accepted !"); |
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 | qWarning("Font was changed!"); | 273 | qWarning("Font was changed!"); |
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 | qWarning("void AddressbookWindow::slotSetFont( %d )", size); | 286 | qWarning("void AddressbookWindow::slotSetFont( %d )", size); |
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 = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); | 320 | QString str = 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 | 326 | ||
327 | void AddressbookWindow::setDocument( const QString &filename ) | 327 | void AddressbookWindow::setDocument( const QString &filename ) |
328 | { | 328 | { |
329 | qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); | 329 | qWarning( "void AddressbookWindow::setDocument( %s )", filename.latin1() ); |
330 | 330 | ||
331 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ | 331 | if ( filename.find(".vcf") != int(filename.length()) - 4 ){ |
332 | 332 | ||
333 | 333 | ||
334 | 334 | ||
335 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), | 335 | switch( QMessageBox::information( this, tr ( "Right file type ?" ), |
336 | tr( "The selected file \n does not end with \".vcf\" \n. Do you really want to open it?" ), | 336 | tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), |
337 | tr( "&Yes" ), tr( "&No" ), QString::null, | 337 | tr( "&Yes" ), tr( "&No" ), QString::null, |
338 | 0, // Enter == button 0 | 338 | 0, // Enter == button 0 |
339 | 2 ) ) { // Escape == button 2 | 339 | 2 ) ) { // Escape == button 2 |
340 | case 0: | 340 | case 0: |
341 | qWarning("YES clicked"); | 341 | qWarning("YES clicked"); |
342 | break; | 342 | break; |
343 | case 1: | 343 | case 1: |
344 | qWarning("NO clicked"); | 344 | qWarning("NO clicked"); |
345 | return; | 345 | return; |
346 | break; | 346 | break; |
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 350 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
351 | filename ); | 351 | filename ); |
352 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 352 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
353 | OContactAccess::List allList = access->allRecords(); | 353 | OContactAccess::List allList = access->allRecords(); |
354 | 354 | ||
355 | OContactAccess::List::Iterator it; | 355 | OContactAccess::List::Iterator it; |
356 | for ( it = allList.begin(); it != allList.end(); ++it ){ | 356 | for ( it = allList.begin(); it != allList.end(); ++it ){ |
357 | m_abView->addEntry( *it ); | 357 | m_abView->addEntry( *it ); |
358 | } | 358 | } |
359 | 359 | ||
360 | delete access; | 360 | delete access; |
361 | } | 361 | } |
362 | 362 | ||
363 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 363 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
364 | { | 364 | { |
365 | QMainWindow::resizeEvent( e ); | 365 | QMainWindow::resizeEvent( e ); |
366 | 366 | ||
367 | 367 | ||
368 | } | 368 | } |
369 | 369 | ||
370 | AddressbookWindow::~AddressbookWindow() | 370 | AddressbookWindow::~AddressbookWindow() |
371 | { | 371 | { |
372 | ToolBarDock dock; | 372 | ToolBarDock dock; |
373 | int dummy; | 373 | int dummy; |
374 | bool bDummy; | 374 | bool bDummy; |
375 | getLocation ( listTools, dock, dummy, bDummy, dummy ); | 375 | getLocation ( listTools, dock, dummy, bDummy, dummy ); |
376 | m_config.setToolBarDock( dock ); | 376 | m_config.setToolBarDock( dock ); |
377 | m_config.save(); | 377 | m_config.save(); |
378 | } | 378 | } |
379 | 379 | ||
380 | void AddressbookWindow::slotUpdateToolbar() | 380 | void AddressbookWindow::slotUpdateToolbar() |
381 | { | 381 | { |
382 | OContact ce = m_abView->currentEntry(); | 382 | OContact ce = m_abView->currentEntry(); |
383 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 383 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
384 | } | 384 | } |
385 | 385 | ||
386 | void AddressbookWindow::slotListNew() | 386 | void AddressbookWindow::slotListNew() |
387 | { | 387 | { |
388 | OContact cnt; | 388 | OContact cnt; |
389 | if( !syncing ) { | 389 | if( !syncing ) { |
390 | editEntry( NewEntry ); | 390 | editEntry( NewEntry ); |
391 | } else { | 391 | } else { |
392 | QMessageBox::warning(this, tr("OContacts"), | 392 | QMessageBox::warning(this, tr("OContacts"), |
393 | tr("Can not edit data, currently syncing")); | 393 | tr("Can not edit data, currently syncing")); |
394 | } | 394 | } |
395 | } | 395 | } |
396 | 396 | ||
397 | // void AddressbookWindow::slotListView() | 397 | // void AddressbookWindow::slotListView() |
398 | // { | 398 | // { |
399 | // m_abView -> init( abList->currentEntry() ); | 399 | // m_abView -> init( abList->currentEntry() ); |
400 | // // :SX mView->sync(); | 400 | // // :SX mView->sync(); |
401 | // //:SXshowView(); | 401 | // //:SXshowView(); |
402 | // } | 402 | // } |
403 | 403 | ||
404 | void AddressbookWindow::slotListDelete() | 404 | void AddressbookWindow::slotListDelete() |
405 | { | 405 | { |
406 | if(!syncing) { | 406 | if(!syncing) { |
407 | OContact tmpEntry = m_abView ->currentEntry(); | 407 | OContact tmpEntry = m_abView ->currentEntry(); |
408 | 408 | ||
409 | // get a name, do the best we can... | 409 | // get a name, do the best we can... |
410 | QString strName = tmpEntry.fullName(); | 410 | QString strName = tmpEntry.fullName(); |
411 | if ( strName.isEmpty() ) { | 411 | if ( strName.isEmpty() ) { |
412 | strName = tmpEntry.company(); | 412 | strName = tmpEntry.company(); |
413 | if ( strName.isEmpty() ) | 413 | if ( strName.isEmpty() ) |
414 | strName = "No Name"; | 414 | strName = "No Name"; |
415 | } | 415 | } |
416 | 416 | ||
417 | 417 | ||
418 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), | 418 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), |
419 | strName ) ) { | 419 | strName ) ) { |
420 | m_abView->removeEntry( tmpEntry.uid() ); | 420 | m_abView->removeEntry( tmpEntry.uid() ); |
421 | } | 421 | } |
422 | } else { | 422 | } else { |
423 | QMessageBox::warning( this, tr("Contacts"), | 423 | QMessageBox::warning( this, tr("Contacts"), |
424 | tr("Can not edit data, currently syncing") ); | 424 | tr("Can not edit data, currently syncing") ); |
425 | } | 425 | } |
426 | } | 426 | } |
427 | 427 | ||
428 | void AddressbookWindow::slotFindOpen() | 428 | void AddressbookWindow::slotFindOpen() |
429 | { | 429 | { |
430 | searchBar->show(); | 430 | searchBar->show(); |
431 | m_abView -> inSearch(); | 431 | m_abView -> inSearch(); |
432 | searchEdit->setFocus(); | 432 | searchEdit->setFocus(); |
433 | } | 433 | } |
434 | void AddressbookWindow::slotFindClose() | 434 | void AddressbookWindow::slotFindClose() |
435 | { | 435 | { |
436 | searchBar->hide(); | 436 | searchBar->hide(); |
437 | m_abView -> offSearch(); | 437 | m_abView -> offSearch(); |
438 | // m_abView->setFocus(); | 438 | // m_abView->setFocus(); |
439 | } | 439 | } |
440 | 440 | ||
441 | 441 | ||
442 | void AddressbookWindow::slotFind() | 442 | void AddressbookWindow::slotFind() |
443 | { | 443 | { |
444 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); | 444 | m_abView->slotDoFind( searchEdit->text(), m_config.beCaseSensitive(), m_config.useRegExp(), false); |
445 | 445 | ||
446 | searchEdit->clearFocus(); | 446 | searchEdit->clearFocus(); |
447 | // m_abView->setFocus(); | 447 | // m_abView->setFocus(); |
448 | 448 | ||
449 | } | 449 | } |
450 | 450 | ||
451 | void AddressbookWindow::slotViewBack() | 451 | void AddressbookWindow::slotViewBack() |
452 | { | 452 | { |
453 | // :SX showList(); | 453 | // :SX showList(); |
454 | } | 454 | } |
455 | 455 | ||
456 | void AddressbookWindow::slotViewEdit() | 456 | void AddressbookWindow::slotViewEdit() |
457 | { | 457 | { |
458 | if(!syncing) { | 458 | if(!syncing) { |
459 | if (actionPersonal->isOn()) { | 459 | if (actionPersonal->isOn()) { |
460 | editPersonal(); | 460 | editPersonal(); |
461 | } else { | 461 | } else { |
462 | editEntry( EditEntry ); | 462 | editEntry( EditEntry ); |
463 | } | 463 | } |
464 | } else { | 464 | } else { |
465 | QMessageBox::warning( this, tr("Contacts"), | 465 | QMessageBox::warning( this, tr("Contacts"), |
466 | tr("Can not edit data, currently syncing") ); | 466 | tr("Can not edit data, currently syncing") ); |
467 | } | 467 | } |
468 | } | 468 | } |
469 | 469 | ||
470 | 470 | ||
471 | 471 | ||
472 | void AddressbookWindow::writeMail() | 472 | void AddressbookWindow::writeMail() |
473 | { | 473 | { |
474 | OContact c = m_abView -> currentEntry(); | 474 | OContact c = m_abView -> currentEntry(); |
475 | QString name = c.fileAs(); | 475 | QString name = c.fileAs(); |
476 | QString email = c.defaultEmail(); | 476 | QString email = c.defaultEmail(); |
477 | 477 | ||
478 | // I prefer the OPIE-Environment variable before the | 478 | // I prefer the OPIE-Environment variable before the |
479 | // QPE-one.. | 479 | // QPE-one.. |
480 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); | 480 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); |
481 | if ( basepath.isEmpty() ) | 481 | if ( basepath.isEmpty() ) |
482 | basepath = QString::fromLatin1( getenv("QPEDIR") ); | 482 | basepath = QString::fromLatin1( getenv("QPEDIR") ); |
483 | 483 | ||
484 | // Try to access the preferred. If not possible, try to | 484 | // Try to access the preferred. If not possible, try to |
485 | // switch to the other one.. | 485 | // switch to the other one.. |
486 | if ( m_config.useQtMail() ){ | 486 | if ( m_config.useQtMail() ){ |
487 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); | 487 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); |
488 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ | 488 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ |
489 | qWarning ("QCop"); | 489 | qWarning ("QCop"); |
490 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 490 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
491 | e << name << email; | 491 | e << name << email; |
492 | return; | 492 | return; |
493 | } else | 493 | } else |
494 | m_config.setUseOpieMail( true ); | 494 | m_config.setUseOpieMail( true ); |
495 | } | 495 | } |
496 | if ( m_config.useOpieMail() ){ | 496 | if ( m_config.useOpieMail() ){ |
497 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); | 497 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); |
498 | if ( QFile::exists( basepath + "/bin/mail" ) ){ | 498 | if ( QFile::exists( basepath + "/bin/mail" ) ){ |
499 | qWarning ("QCop"); | 499 | qWarning ("QCop"); |
500 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); | 500 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); |
501 | e << name << email; | 501 | e << name << email; |
502 | return; | 502 | return; |
503 | } else | 503 | } else |
504 | m_config.setUseQtMail( true ); | 504 | m_config.setUseQtMail( true ); |
505 | } | 505 | } |
506 | 506 | ||
507 | } | 507 | } |
508 | 508 | ||
509 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 509 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
510 | 510 | ||
511 | void AddressbookWindow::slotBeam() | 511 | void AddressbookWindow::slotBeam() |
512 | { | 512 | { |
513 | QString filename; | 513 | QString filename; |
514 | OContact c; | 514 | OContact c; |
515 | if ( actionPersonal->isOn() ) { | 515 | if ( actionPersonal->isOn() ) { |
516 | filename = addressbookPersonalVCardName(); | 516 | filename = addressbookPersonalVCardName(); |
517 | if (!QFile::exists(filename)) | 517 | if (!QFile::exists(filename)) |
518 | return; // can't beam a non-existent file | 518 | return; // can't beam a non-existent file |
519 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 519 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
520 | filename ); | 520 | filename ); |
521 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 521 | OContactAccess* access = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
522 | OContactAccess::List allList = access->allRecords(); | 522 | OContactAccess::List allList = access->allRecords(); |
523 | OContactAccess::List::Iterator it = allList.begin(); // Just take first | 523 | OContactAccess::List::Iterator it = allList.begin(); // Just take first |
524 | c = *it; | 524 | c = *it; |
525 | 525 | ||
526 | delete access; | 526 | delete access; |
527 | } else { | 527 | } else { |
528 | unlink( beamfile ); // delete if exists | 528 | unlink( beamfile ); // delete if exists |