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 | |||
@@ -77,23 +77,29 @@ 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 | ||
@@ -166,13 +172,13 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
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 ); |
@@ -279,18 +285,22 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
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 | ||
@@ -377,12 +387,15 @@ AddressbookWindow::~AddressbookWindow() | |||
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() ); |
@@ -491,14 +504,42 @@ void AddressbookWindow::slotViewEdit() | |||
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 | { |