Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 43 |
1 files changed, 42 insertions, 1 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 | |||
@@ -80,6 +80,8 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
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 | { |
@@ -91,6 +93,10 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
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 | ||
@@ -169,7 +175,7 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
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; |
@@ -282,12 +288,16 @@ void AddressbookWindow::slotConfig() | |||
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; |
@@ -380,6 +390,9 @@ AddressbookWindow::~AddressbookWindow() | |||
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() |
@@ -494,8 +507,36 @@ void AddressbookWindow::writeMail() | |||
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(); |
510 | |||
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"); | ||
497 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 523 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
498 | e << name << email; | 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"; |