author | eilers <eilers> | 2002-10-22 12:34:54 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-10-22 12:34:54 (UTC) |
commit | 78152b3adbe3ae4626c8f53e3edd0babcaf6fb72 (patch) (unidiff) | |
tree | 89b0b4ffea2fa1efd4eb7dc50545661d3ceeb65d /core/pim/addressbook/addressbook.cpp | |
parent | 486280adc2ab5dc383a56d8516c36727eb382812 (diff) | |
download | opie-78152b3adbe3ae4626c8f53e3edd0babcaf6fb72.zip opie-78152b3adbe3ae4626c8f53e3edd0babcaf6fb72.tar.gz opie-78152b3adbe3ae4626c8f53e3edd0babcaf6fb72.tar.bz2 |
Find bugfix. Tried to make the letterpicker more visible due to
undelign does not work on my Z.. :(
Added use of alternative mail-application (opie-mail instead of QT-Mail)
Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 3466801..39d8321 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -71,35 +71,41 @@ static QString addressbookPersonalVCardName() | |||
71 | "businesscard.vcf"); | 71 | "businesscard.vcf"); |
72 | return filename; | 72 | return filename; |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 76 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
77 | WFlags f ) | 77 | WFlags f ) |
78 | : QMainWindow( parent, name, f ), | 78 | : QMainWindow( parent, name, f ), |
79 | abEditor(0), | 79 | abEditor(0), |
80 | useRegExp(false), | 80 | useRegExp(false), |
81 | doNotifyWrapAround(true), | 81 | doNotifyWrapAround(true), |
82 | caseSensitive(false), | 82 | caseSensitive(false), |
83 | m_useQtMail(true), | ||
84 | m_useOpieMail(false), | ||
83 | bAbEditFirstTime(TRUE), | 85 | bAbEditFirstTime(TRUE), |
84 | syncing(FALSE) | 86 | syncing(FALSE) |
85 | { | 87 | { |
86 | isLoading = true; | 88 | isLoading = true; |
87 | 89 | ||
88 | // Read Config settings | 90 | // Read Config settings |
89 | Config cfg("AddressBook"); | 91 | Config cfg("AddressBook"); |
90 | cfg.setGroup("Search"); | 92 | cfg.setGroup("Search"); |
91 | useRegExp = cfg.readBoolEntry( "useRegExp" ); | 93 | useRegExp = cfg.readBoolEntry( "useRegExp" ); |
92 | caseSensitive = cfg.readBoolEntry( "caseSensitive" ); | 94 | caseSensitive = cfg.readBoolEntry( "caseSensitive" ); |
93 | doNotifyWrapAround = cfg.readBoolEntry( "doNotifyWrapAround" ); | 95 | doNotifyWrapAround = cfg.readBoolEntry( "doNotifyWrapAround" ); |
96 | cfg.setGroup("Mail"); | ||
97 | m_useQtMail = cfg.readBoolEntry( "useQtMail" ); | ||
98 | m_useOpieMail=cfg.readBoolEntry( "useOpieMail" ); | ||
99 | |||
94 | 100 | ||
95 | initFields(); | 101 | initFields(); |
96 | 102 | ||
97 | setCaption( tr("Contacts") ); | 103 | setCaption( tr("Contacts") ); |
98 | setIcon( Resource::loadPixmap( "AddressBook" ) ); | 104 | setIcon( Resource::loadPixmap( "AddressBook" ) ); |
99 | 105 | ||
100 | setToolBarsMovable( FALSE ); | 106 | setToolBarsMovable( FALSE ); |
101 | 107 | ||
102 | // Create Toolbars | 108 | // Create Toolbars |
103 | 109 | ||
104 | QPEToolBar *bar = new QPEToolBar( this ); | 110 | QPEToolBar *bar = new QPEToolBar( this ); |
105 | bar->setHorizontalStretchable( TRUE ); | 111 | bar->setHorizontalStretchable( TRUE ); |
@@ -160,25 +166,25 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
160 | searchBar->setStretchableWidget( searchEdit ); | 166 | searchBar->setStretchableWidget( searchEdit ); |
161 | connect( searchEdit, SIGNAL( returnPressed( ) ), | 167 | connect( searchEdit, SIGNAL( returnPressed( ) ), |
162 | this, SLOT( slotFind( ) ) ); | 168 | this, SLOT( slotFind( ) ) ); |
163 | 169 | ||
164 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); | 170 | a = new QAction( tr( "Find Next" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); |
165 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindNext() ) ); | 171 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindNext() ) ); |
166 | a->addTo( searchBar ); | 172 | a->addTo( searchBar ); |
167 | 173 | ||
168 | 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 ); |
169 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); | 175 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); |
170 | a->addTo( searchBar ); | 176 | a->addTo( searchBar ); |
171 | 177 | ||
172 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), | 178 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "mail/sendmail" ), |
173 | QString::null, 0, this, 0 ); | 179 | QString::null, 0, this, 0 ); |
174 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 180 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
175 | actionMail = a; | 181 | actionMail = a; |
176 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); | 182 | connect( a, SIGNAL( activated() ), this, SLOT( writeMail() ) ); |
177 | a->addTo( edit ); | 183 | a->addTo( edit ); |
178 | a->addTo( listTools ); | 184 | a->addTo( listTools ); |
179 | 185 | ||
180 | 186 | ||
181 | 187 | ||
182 | if ( Ir::supported() ) { | 188 | if ( Ir::supported() ) { |
183 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, | 189 | a = new QAction( tr ("Beam Entry" ), Resource::loadPixmap( "beam" ), QString::null, |
184 | 0, this, 0 ); | 190 | 0, this, 0 ); |
@@ -273,30 +279,34 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
273 | abList->setCurrentCell( 0, 0 ); | 279 | abList->setCurrentCell( 0, 0 ); |
274 | 280 | ||
275 | isLoading = false; | 281 | isLoading = false; |
276 | } | 282 | } |
277 | 283 | ||
278 | 284 | ||
279 | void AddressbookWindow::slotConfig() | 285 | void AddressbookWindow::slotConfig() |
280 | { | 286 | { |
281 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | 287 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); |
282 | dlg -> setUseRegExp ( useRegExp ); | 288 | dlg -> setUseRegExp ( useRegExp ); |
283 | dlg -> setBeCaseSensitive( caseSensitive ); | 289 | dlg -> setBeCaseSensitive( caseSensitive ); |
284 | dlg -> setSignalWrapAround( doNotifyWrapAround ); | 290 | dlg -> setSignalWrapAround( doNotifyWrapAround ); |
291 | dlg -> setQtMail ( m_useQtMail ); | ||
292 | dlg -> setOpieMail ( m_useOpieMail ); | ||
285 | dlg -> showMaximized(); | 293 | dlg -> showMaximized(); |
286 | if ( dlg -> exec() ) { | 294 | if ( dlg -> exec() ) { |
287 | qWarning ("Config Dialog accepted !"); | 295 | qWarning ("Config Dialog accepted !"); |
288 | useRegExp = dlg -> useRegExp(); | 296 | useRegExp = dlg -> useRegExp(); |
289 | caseSensitive = dlg -> beCaseSensitive(); | 297 | caseSensitive = dlg -> beCaseSensitive(); |
290 | doNotifyWrapAround = dlg -> signalWrapAround(); | 298 | doNotifyWrapAround = dlg -> signalWrapAround(); |
299 | m_useQtMail = dlg -> useQtMail(); | ||
300 | m_useOpieMail= dlg -> useOpieMail(); | ||
291 | } | 301 | } |
292 | 302 | ||
293 | delete dlg; | 303 | delete dlg; |
294 | } | 304 | } |
295 | 305 | ||
296 | 306 | ||
297 | void AddressbookWindow::slotSetFont( int size ) { | 307 | void AddressbookWindow::slotSetFont( int size ) { |
298 | 308 | ||
299 | if (size > 2 || size < 0) | 309 | if (size > 2 || size < 0) |
300 | size = 1; | 310 | size = 1; |
301 | 311 | ||
302 | startFontSize = size; | 312 | startFontSize = size; |
@@ -371,24 +381,27 @@ void AddressbookWindow::resizeEvent( QResizeEvent *e ) | |||
371 | } | 381 | } |
372 | 382 | ||
373 | AddressbookWindow::~AddressbookWindow() | 383 | AddressbookWindow::~AddressbookWindow() |
374 | { | 384 | { |
375 | Config cfg("AddressBook"); | 385 | Config cfg("AddressBook"); |
376 | cfg.setGroup("Font"); | 386 | cfg.setGroup("Font"); |
377 | cfg.writeEntry("fontSize", startFontSize); | 387 | cfg.writeEntry("fontSize", startFontSize); |
378 | 388 | ||
379 | cfg.setGroup("Search"); | 389 | cfg.setGroup("Search"); |
380 | cfg.writeEntry("useRegExp", useRegExp); | 390 | cfg.writeEntry("useRegExp", useRegExp); |
381 | cfg.writeEntry("caseSensitive", caseSensitive); | 391 | cfg.writeEntry("caseSensitive", caseSensitive); |
382 | cfg.writeEntry("doNotifyWrapAround", doNotifyWrapAround); | 392 | cfg.writeEntry("doNotifyWrapAround", doNotifyWrapAround); |
393 | cfg.setGroup("Mail"); | ||
394 | cfg.writeEntry( "useQtMail", m_useQtMail ); | ||
395 | cfg.writeEntry( "useOpieMail", m_useOpieMail); | ||
383 | } | 396 | } |
384 | 397 | ||
385 | void AddressbookWindow::slotUpdateToolbar() | 398 | void AddressbookWindow::slotUpdateToolbar() |
386 | { | 399 | { |
387 | OContact ce = abList->currentEntry(); | 400 | OContact ce = abList->currentEntry(); |
388 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 401 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
389 | } | 402 | } |
390 | 403 | ||
391 | void AddressbookWindow::showList() | 404 | void AddressbookWindow::showList() |
392 | { | 405 | { |
393 | bool visiblemView; | 406 | bool visiblemView; |
394 | 407 | ||
@@ -485,26 +498,54 @@ void AddressbookWindow::slotViewEdit() | |||
485 | QMessageBox::warning( this, tr("Contacts"), | 498 | QMessageBox::warning( this, tr("Contacts"), |
486 | tr("Can not edit data, currently syncing") ); | 499 | tr("Can not edit data, currently syncing") ); |
487 | } | 500 | } |
488 | } | 501 | } |
489 | 502 | ||
490 | 503 | ||
491 | 504 | ||
492 | void AddressbookWindow::writeMail() | 505 | void AddressbookWindow::writeMail() |
493 | { | 506 | { |
494 | OContact c = abList->currentEntry(); | 507 | OContact c = abList->currentEntry(); |
495 | QString name = c.fileAs(); | 508 | QString name = c.fileAs(); |
496 | QString email = c.defaultEmail(); | 509 | QString email = c.defaultEmail(); |
497 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 510 | |
498 | e << name << email; | 511 | // I prefer the OPIE-Environment variable before the |
512 | // QPE-one.. | ||
513 | QString basepath = QString::fromLatin1( getenv("OPIEDIR") ); | ||
514 | if ( basepath.isEmpty() ) | ||
515 | basepath = QString::fromLatin1( getenv("QPEDIR") ); | ||
516 | |||
517 | // Try to access the preferred. If not possible, try to | ||
518 | // switch to the other one.. | ||
519 | if ( m_useQtMail ){ | ||
520 | qWarning ("Accessing: %s", (basepath + "/bin/qtmail").latin1()); | ||
521 | if ( QFile::exists( basepath + "/bin/qtmail" ) ){ | ||
522 | qWarning ("QCop"); | ||
523 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | ||
524 | e << name << email; | ||
525 | return; | ||
526 | } else | ||
527 | m_useOpieMail = true; | ||
528 | } | ||
529 | if ( m_useOpieMail ){ | ||
530 | qWarning ("Accessing: %s", (basepath + "/bin/mail").latin1()); | ||
531 | if ( QFile::exists( basepath + "/bin/mail" ) ){ | ||
532 | qWarning ("QCop"); | ||
533 | QCopEnvelope e("QPE/Application/mail", "writeMail(QString,QString)"); | ||
534 | e << name << email; | ||
535 | return; | ||
536 | } else | ||
537 | m_useQtMail = true; | ||
538 | } | ||
539 | |||
499 | } | 540 | } |
500 | 541 | ||
501 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 542 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
502 | 543 | ||
503 | void AddressbookWindow::slotBeam() | 544 | void AddressbookWindow::slotBeam() |
504 | { | 545 | { |
505 | QString filename; | 546 | QString filename; |
506 | OContact c; | 547 | OContact c; |
507 | if ( actionPersonal->isOn() ) { | 548 | if ( actionPersonal->isOn() ) { |
508 | filename = addressbookPersonalVCardName(); | 549 | filename = addressbookPersonalVCardName(); |
509 | if (!QFile::exists(filename)) | 550 | if (!QFile::exists(filename)) |
510 | return; // can't beam a non-existent file | 551 | return; // can't beam a non-existent file |