author | zautrix <zautrix> | 2004-11-08 23:23:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-11-08 23:23:02 (UTC) |
commit | c20c85c383cb36c7ece87af9e3a60d14b36a9de5 (patch) (unidiff) | |
tree | ec1d983fbeb9b719f1871683b47862b528e50c0d | |
parent | d92ceb39af0bf0c655b68cb166dfea44cd688f1c (diff) | |
download | kdepimpi-c20c85c383cb36c7ece87af9e3a60d14b36a9de5.zip kdepimpi-c20c85c383cb36c7ece87af9e3a60d14b36a9de5.tar.gz kdepimpi-c20c85c383cb36c7ece87af9e3a60d14b36a9de5.tar.bz2 |
fixed orientation change in kapi
-rw-r--r-- | kaddressbook/incsearchwidget.cpp | 1 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 30 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 1 | ||||
-rw-r--r-- | kmicromail/libetpan/mime/mailmime_decode.c | 8 |
4 files changed, 27 insertions, 13 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index 78eaf65..dd2121a 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp | |||
@@ -1,122 +1,123 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qcombobox.h> | 27 | #include <qcombobox.h> |
28 | 28 | ||
29 | #include <kdialog.h> | 29 | #include <kdialog.h> |
30 | #include <klineedit.h> | 30 | #include <klineedit.h> |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <kglobal.h> | 33 | #include <kglobal.h> |
34 | #include "kabprefs.h" | 34 | #include "kabprefs.h" |
35 | 35 | ||
36 | #include "incsearchwidget.h" | 36 | #include "incsearchwidget.h" |
37 | 37 | ||
38 | IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) | 38 | IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) |
39 | : QWidget( parent, name ) | 39 | : QWidget( parent, name ) |
40 | { | 40 | { |
41 | #ifndef KAB_EMBEDDED | 41 | #ifndef KAB_EMBEDDED |
42 | //US setCaption( i18n( "Incremental Search" ) ); | 42 | //US setCaption( i18n( "Incremental Search" ) ); |
43 | #endif //KAB_EMBEDDED | 43 | #endif //KAB_EMBEDDED |
44 | 44 | ||
45 | QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() ); | 45 | QHBoxLayout *layout = new QHBoxLayout( this, 2, KDialog::spacingHint() ); |
46 | 46 | ||
47 | #ifdef DESKTOP_VERSION | 47 | #ifdef DESKTOP_VERSION |
48 | QLabel *label = new QLabel( i18n( "Search:" ), this ); | 48 | QLabel *label = new QLabel( i18n( "Search:" ), this ); |
49 | label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight ); | 49 | label->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight ); |
50 | layout->addWidget( label ); | 50 | layout->addWidget( label ); |
51 | #endif //KAB_EMBEDDED | 51 | #endif //KAB_EMBEDDED |
52 | 52 | ||
53 | mSearchText = new KLineEdit( this ); | 53 | mSearchText = new KLineEdit( this ); |
54 | layout->addWidget( mSearchText ); | 54 | layout->addWidget( mSearchText ); |
55 | // #ifdef KAB_EMBEDDED | 55 | // #ifdef KAB_EMBEDDED |
56 | // if (KGlobal::getOrientation() == KGlobal::Portrait) | 56 | // if (KGlobal::getOrientation() == KGlobal::Portrait) |
57 | // mSearchText->setMaximumWidth(30); | 57 | // mSearchText->setMaximumWidth(30); |
58 | // #endif //KAB_EMBEDDED | 58 | // #endif //KAB_EMBEDDED |
59 | //mSearchText->setMaximumWidth(60); | ||
59 | 60 | ||
60 | 61 | ||
61 | mFieldCombo = new QComboBox( false, this ); | 62 | mFieldCombo = new QComboBox( false, this ); |
62 | layout->addWidget( mFieldCombo ); | 63 | layout->addWidget( mFieldCombo ); |
63 | mFieldCombo->setMaximumHeight( 34 ); | 64 | mFieldCombo->setMaximumHeight( 34 ); |
64 | QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); | 65 | QToolTip::add( mFieldCombo, i18n( "Select Incremental Search Field" ) ); |
65 | 66 | ||
66 | // #ifndef KAB_EMBEDDED | 67 | // #ifndef KAB_EMBEDDED |
67 | // resize( QSize(420, 50).expandedTo( sizeHint() ) ); | 68 | // resize( QSize(420, 50).expandedTo( sizeHint() ) ); |
68 | // #else //KAB_EMBEDDED | 69 | // #else //KAB_EMBEDDED |
69 | // resize( QSize(30, 10).expandedTo( sizeHint() ) ); | 70 | // resize( QSize(30, 10).expandedTo( sizeHint() ) ); |
70 | // #endif //KAB_EMBEDDED | 71 | // #endif //KAB_EMBEDDED |
71 | 72 | ||
72 | 73 | ||
73 | // for performance reasons, we do a search on the pda only after return is pressed | 74 | // for performance reasons, we do a search on the pda only after return is pressed |
74 | connect( mSearchText, SIGNAL( textChanged( const QString& ) ), | 75 | connect( mSearchText, SIGNAL( textChanged( const QString& ) ), |
75 | SLOT( announceDoSearch2() ) ); | 76 | SLOT( announceDoSearch2() ) ); |
76 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), | 77 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), |
77 | SLOT( announceDoSearch2() ) ); | 78 | SLOT( announceDoSearch2() ) ); |
78 | 79 | ||
79 | connect( mSearchText, SIGNAL( returnPressed() ), | 80 | connect( mSearchText, SIGNAL( returnPressed() ), |
80 | SLOT( announceDoSearch() ) ); | 81 | SLOT( announceDoSearch() ) ); |
81 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), | 82 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), |
82 | SLOT( announceFieldChanged() ) ); | 83 | SLOT( announceFieldChanged() ) ); |
83 | 84 | ||
84 | 85 | ||
85 | 86 | ||
86 | connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() )); | 87 | connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() )); |
87 | connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() )); | 88 | connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() )); |
88 | 89 | ||
89 | 90 | ||
90 | setFocusProxy( mSearchText ); | 91 | setFocusProxy( mSearchText ); |
91 | } | 92 | } |
92 | 93 | ||
93 | IncSearchWidget::~IncSearchWidget() | 94 | IncSearchWidget::~IncSearchWidget() |
94 | { | 95 | { |
95 | 96 | ||
96 | } | 97 | } |
97 | void IncSearchWidget::announceDoSearch2() | 98 | void IncSearchWidget::announceDoSearch2() |
98 | { | 99 | { |
99 | if ( KABPrefs::instance()->mSearchWithReturn ) | 100 | if ( KABPrefs::instance()->mSearchWithReturn ) |
100 | return; | 101 | return; |
101 | emit doSearch( mSearchText->text() ); | 102 | emit doSearch( mSearchText->text() ); |
102 | //qDebug("emit dosreach "); | 103 | //qDebug("emit dosreach "); |
103 | } | 104 | } |
104 | 105 | ||
105 | void IncSearchWidget::announceDoSearch() | 106 | void IncSearchWidget::announceDoSearch() |
106 | { | 107 | { |
107 | 108 | ||
108 | emit doSearch( mSearchText->text() ); | 109 | emit doSearch( mSearchText->text() ); |
109 | // qDebug("emit dosreach "); | 110 | // qDebug("emit dosreach "); |
110 | } | 111 | } |
111 | 112 | ||
112 | void IncSearchWidget::announceFieldChanged() | 113 | void IncSearchWidget::announceFieldChanged() |
113 | { | 114 | { |
114 | emit fieldChanged(); | 115 | emit fieldChanged(); |
115 | } | 116 | } |
116 | 117 | ||
117 | void IncSearchWidget::setFields( const KABC::Field::List &list ) | 118 | void IncSearchWidget::setFields( const KABC::Field::List &list ) |
118 | { | 119 | { |
119 | 120 | ||
120 | mFieldCombo->clear(); | 121 | mFieldCombo->clear(); |
121 | mFieldCombo->insertItem( i18n( "All Fields" ) ); | 122 | mFieldCombo->insertItem( i18n( "All Fields" ) ); |
122 | QFontMetrics fm ( mFieldCombo->font() ); | 123 | QFontMetrics fm ( mFieldCombo->font() ); |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 7acf1ee..a6fc677 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -300,134 +300,134 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
300 | "X-Children", "KADDRESSBOOK" ); | 300 | "X-Children", "KADDRESSBOOK" ); |
301 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 301 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
302 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 302 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
303 | #endif | 303 | #endif |
304 | initGUI(); | 304 | initGUI(); |
305 | 305 | ||
306 | mIncSearchWidget->setFocus(); | 306 | mIncSearchWidget->setFocus(); |
307 | 307 | ||
308 | 308 | ||
309 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 309 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
310 | SLOT( setContactSelected( const QString& ) ) ); | 310 | SLOT( setContactSelected( const QString& ) ) ); |
311 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 311 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
312 | SLOT( executeContact( const QString& ) ) ); | 312 | SLOT( executeContact( const QString& ) ) ); |
313 | 313 | ||
314 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 314 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
315 | SLOT( deleteContacts( ) ) ); | 315 | SLOT( deleteContacts( ) ) ); |
316 | connect( mViewManager, SIGNAL( modified() ), | 316 | connect( mViewManager, SIGNAL( modified() ), |
317 | SLOT( setModified() ) ); | 317 | SLOT( setModified() ) ); |
318 | 318 | ||
319 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 319 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
320 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 320 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
321 | 321 | ||
322 | connect( mXXPortManager, SIGNAL( modified() ), | 322 | connect( mXXPortManager, SIGNAL( modified() ), |
323 | SLOT( setModified() ) ); | 323 | SLOT( setModified() ) ); |
324 | 324 | ||
325 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 325 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
326 | SLOT( incrementalSearch( const QString& ) ) ); | 326 | SLOT( incrementalSearch( const QString& ) ) ); |
327 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 327 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
328 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 328 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
329 | 329 | ||
330 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 330 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
331 | SLOT( sendMail( const QString& ) ) ); | 331 | SLOT( sendMail( const QString& ) ) ); |
332 | 332 | ||
333 | 333 | ||
334 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 334 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
335 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 335 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
336 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 336 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
337 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); | 337 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); |
338 | 338 | ||
339 | 339 | ||
340 | #ifndef KAB_EMBEDDED | 340 | #ifndef KAB_EMBEDDED |
341 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 341 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
342 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 342 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
343 | 343 | ||
344 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 344 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
345 | SLOT( browse( const QString& ) ) ); | 345 | SLOT( browse( const QString& ) ) ); |
346 | 346 | ||
347 | 347 | ||
348 | mAddressBookService = new KAddressBookService( this ); | 348 | mAddressBookService = new KAddressBookService( this ); |
349 | 349 | ||
350 | #endif //KAB_EMBEDDED | 350 | #endif //KAB_EMBEDDED |
351 | 351 | ||
352 | mMessageTimer = new QTimer( this ); | 352 | mMessageTimer = new QTimer( this ); |
353 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 353 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
354 | mEditorDialog = 0; | 354 | mEditorDialog = 0; |
355 | createAddresseeEditorDialog( this ); | 355 | createAddresseeEditorDialog( this ); |
356 | setModified( false ); | 356 | setModified( false ); |
357 | mBRdisabled = false; | 357 | mBRdisabled = false; |
358 | #ifndef DESKTOP_VERSION | 358 | #ifndef DESKTOP_VERSION |
359 | infrared = 0; | 359 | infrared = 0; |
360 | #endif | 360 | #endif |
361 | //toggleBeamReceive( ); | 361 | //toggleBeamReceive( ); |
362 | 362 | ||
363 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 363 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
364 | QTimer::singleShot( 1000, this , SLOT ( updateToolBar())); | 364 | QTimer::singleShot( 10000, this , SLOT ( updateToolBar())); |
365 | } | 365 | } |
366 | 366 | ||
367 | void KABCore::updateToolBar() | 367 | void KABCore::updateToolBar() |
368 | { | 368 | { |
369 | mMainWindow->toolBar()->repaint(); | 369 | mMainWindow->toolBar()->update(); |
370 | } | 370 | } |
371 | KABCore::~KABCore() | 371 | KABCore::~KABCore() |
372 | { | 372 | { |
373 | // save(); | 373 | // save(); |
374 | //saveSettings(); | 374 | //saveSettings(); |
375 | //KABPrefs::instance()->writeConfig(); | 375 | //KABPrefs::instance()->writeConfig(); |
376 | delete AddresseeConfig::instance(); | 376 | delete AddresseeConfig::instance(); |
377 | mAddressBook = 0; | 377 | mAddressBook = 0; |
378 | KABC::StdAddressBook::close(); | 378 | KABC::StdAddressBook::close(); |
379 | 379 | ||
380 | delete syncManager; | 380 | delete syncManager; |
381 | #ifndef DESKTOP_VERSION | 381 | #ifndef DESKTOP_VERSION |
382 | if ( infrared ) | 382 | if ( infrared ) |
383 | delete infrared; | 383 | delete infrared; |
384 | #endif | 384 | #endif |
385 | } | 385 | } |
386 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 386 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) |
387 | { | 387 | { |
388 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 388 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
389 | if ( cmsg == "setDocument(QString)" ) { | 389 | if ( cmsg == "setDocument(QString)" ) { |
390 | QDataStream stream( data, IO_ReadOnly ); | 390 | QDataStream stream( data, IO_ReadOnly ); |
391 | QString fileName; | 391 | QString fileName; |
392 | stream >> fileName; | 392 | stream >> fileName; |
393 | recieve( fileName ); | 393 | recieve( fileName ); |
394 | return; | 394 | return; |
395 | } | 395 | } |
396 | } | 396 | } |
397 | void KABCore::toggleBeamReceive( ) | 397 | void KABCore::toggleBeamReceive( ) |
398 | { | 398 | { |
399 | if ( mBRdisabled ) | 399 | if ( mBRdisabled ) |
400 | return; | 400 | return; |
401 | #ifndef DESKTOP_VERSION | 401 | #ifndef DESKTOP_VERSION |
402 | if ( infrared ) { | 402 | if ( infrared ) { |
403 | qDebug("AB disable BeamReceive "); | 403 | qDebug("AB disable BeamReceive "); |
404 | delete infrared; | 404 | delete infrared; |
405 | infrared = 0; | 405 | infrared = 0; |
406 | mActionBR->setChecked(false); | 406 | mActionBR->setChecked(false); |
407 | return; | 407 | return; |
408 | } | 408 | } |
409 | qDebug("AB enable BeamReceive "); | 409 | qDebug("AB enable BeamReceive "); |
410 | mActionBR->setChecked(true); | 410 | mActionBR->setChecked(true); |
411 | 411 | ||
412 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 412 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
413 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 413 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
414 | #endif | 414 | #endif |
415 | } | 415 | } |
416 | 416 | ||
417 | 417 | ||
418 | void KABCore::disableBR(bool b) | 418 | void KABCore::disableBR(bool b) |
419 | { | 419 | { |
420 | #ifndef DESKTOP_VERSION | 420 | #ifndef DESKTOP_VERSION |
421 | if ( b ) { | 421 | if ( b ) { |
422 | if ( infrared ) { | 422 | if ( infrared ) { |
423 | toggleBeamReceive( ); | 423 | toggleBeamReceive( ); |
424 | } | 424 | } |
425 | mBRdisabled = true; | 425 | mBRdisabled = true; |
426 | } else { | 426 | } else { |
427 | if ( mBRdisabled ) { | 427 | if ( mBRdisabled ) { |
428 | mBRdisabled = false; | 428 | mBRdisabled = false; |
429 | //toggleBeamReceive( ); | 429 | //toggleBeamReceive( ); |
430 | } | 430 | } |
431 | } | 431 | } |
432 | #endif | 432 | #endif |
433 | 433 | ||
@@ -716,147 +716,159 @@ void KABCore::mailVCard( const QStringList& uids ) | |||
716 | 716 | ||
717 | 717 | ||
718 | 718 | ||
719 | QDir().mkdir( dirName, true ); | 719 | QDir().mkdir( dirName, true ); |
720 | 720 | ||
721 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 721 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
722 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 722 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
723 | 723 | ||
724 | if ( a.isEmpty() ) | 724 | if ( a.isEmpty() ) |
725 | continue; | 725 | continue; |
726 | 726 | ||
727 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 727 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
728 | 728 | ||
729 | QString fileName = dirName + "/" + name; | 729 | QString fileName = dirName + "/" + name; |
730 | 730 | ||
731 | QFile outFile(fileName); | 731 | QFile outFile(fileName); |
732 | 732 | ||
733 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 733 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
734 | KABC::VCardConverter converter; | 734 | KABC::VCardConverter converter; |
735 | QString vcard; | 735 | QString vcard; |
736 | 736 | ||
737 | converter.addresseeToVCard( a, vcard ); | 737 | converter.addresseeToVCard( a, vcard ); |
738 | 738 | ||
739 | QTextStream t( &outFile ); // use a text stream | 739 | QTextStream t( &outFile ); // use a text stream |
740 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 740 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
741 | t << vcard; | 741 | t << vcard; |
742 | 742 | ||
743 | outFile.close(); | 743 | outFile.close(); |
744 | 744 | ||
745 | urls.append( fileName ); | 745 | urls.append( fileName ); |
746 | } | 746 | } |
747 | } | 747 | } |
748 | 748 | ||
749 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 749 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
750 | 750 | ||
751 | 751 | ||
752 | /*US | 752 | /*US |
753 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 753 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
754 | QString::null, // subject | 754 | QString::null, // subject |
755 | QString::null, // body | 755 | QString::null, // body |
756 | QString::null, | 756 | QString::null, |
757 | urls ); // attachments | 757 | urls ); // attachments |
758 | */ | 758 | */ |
759 | 759 | ||
760 | } | 760 | } |
761 | 761 | ||
762 | /** | 762 | /** |
763 | Beams the "WhoAmI contact. | 763 | Beams the "WhoAmI contact. |
764 | */ | 764 | */ |
765 | void KABCore::beamMySelf() | 765 | void KABCore::beamMySelf() |
766 | { | 766 | { |
767 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 767 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
768 | if (!a.isEmpty()) | 768 | if (!a.isEmpty()) |
769 | { | 769 | { |
770 | QStringList uids; | 770 | QStringList uids; |
771 | uids << a.uid(); | 771 | uids << a.uid(); |
772 | 772 | ||
773 | beamVCard(uids); | 773 | beamVCard(uids); |
774 | } else { | 774 | } else { |
775 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 775 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
776 | 776 | ||
777 | 777 | ||
778 | } | 778 | } |
779 | } | 779 | } |
780 | void KABCore::updateMainWindow() | ||
781 | { | ||
782 | |||
783 | mMainWindow->showMaximized(); | ||
784 | mMainWindow->update(); | ||
785 | } | ||
780 | void KABCore::resizeEvent(QResizeEvent* e ) | 786 | void KABCore::resizeEvent(QResizeEvent* e ) |
781 | { | 787 | { |
782 | if ( !mMiniSplitter ) | 788 | if ( !mMiniSplitter ) |
783 | return; | 789 | return; |
784 | if ( QApplication::desktop()->width() >= 480 ) { | 790 | if ( QApplication::desktop()->width() >= 480 ) { |
785 | int fac = QApplication::desktop()->width()/QApplication::desktop()->height(); | 791 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 |
786 | if ( fac > 0 ) { // e.g. 640x480 | ||
787 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | 792 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { |
788 | mMiniSplitter->setOrientation( Qt::Horizontal); | 793 | mMiniSplitter->setOrientation( Qt::Horizontal); |
789 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 794 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
790 | if ( QApplication::desktop()->width() <= 640 ) | 795 | if ( QApplication::desktop()->width() <= 640 ) { |
791 | topLevelWidget()->showMaximized(); | 796 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
797 | mViewManager->getFilterAction()->setComboWidth( 150 ); | ||
798 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | ||
799 | } | ||
792 | } | 800 | } |
793 | } else {// e.g. 480x640 | 801 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 |
794 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | 802 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { |
795 | mMiniSplitter->setOrientation( Qt::Vertical ); | 803 | mMiniSplitter->setOrientation( Qt::Vertical ); |
796 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 804 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
797 | if ( QApplication::desktop()->width() <= 640 ) | 805 | if ( QApplication::desktop()->width() <= 640 ) { |
798 | topLevelWidget()->showMaximized(); | 806 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
807 | mMainWindow->showMinimized(); | ||
808 | mViewManager->getFilterAction()->setComboWidth( 0 ); | ||
809 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | ||
810 | } | ||
799 | } | 811 | } |
800 | } | 812 | } |
801 | } | 813 | } |
802 | 814 | ||
803 | } | 815 | } |
804 | void KABCore::export2phone() | 816 | void KABCore::export2phone() |
805 | { | 817 | { |
806 | 818 | ||
807 | QStringList uids; | 819 | QStringList uids; |
808 | XXPortSelectDialog dlg( this, false, this ); | 820 | XXPortSelectDialog dlg( this, false, this ); |
809 | if ( dlg.exec() ) | 821 | if ( dlg.exec() ) |
810 | uids = dlg.uids(); | 822 | uids = dlg.uids(); |
811 | else | 823 | else |
812 | return; | 824 | return; |
813 | if ( uids.isEmpty() ) | 825 | if ( uids.isEmpty() ) |
814 | return; | 826 | return; |
815 | // qDebug("count %d ", uids.count()); | 827 | // qDebug("count %d ", uids.count()); |
816 | 828 | ||
817 | KAex2phonePrefs ex2phone; | 829 | KAex2phonePrefs ex2phone; |
818 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 830 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
819 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 831 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
820 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 832 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
821 | 833 | ||
822 | if ( !ex2phone.exec() ) { | 834 | if ( !ex2phone.exec() ) { |
823 | return; | 835 | return; |
824 | } | 836 | } |
825 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 837 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
826 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 838 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
827 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 839 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
828 | 840 | ||
829 | 841 | ||
830 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 842 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
831 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 843 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
832 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 844 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
833 | 845 | ||
834 | QString fileName = getPhoneFile(); | 846 | QString fileName = getPhoneFile(); |
835 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 847 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
836 | return; | 848 | return; |
837 | 849 | ||
838 | message(i18n("Exporting to phone...")); | 850 | message(i18n("Exporting to phone...")); |
839 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 851 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
840 | 852 | ||
841 | } | 853 | } |
842 | QString KABCore::getPhoneFile() | 854 | QString KABCore::getPhoneFile() |
843 | { | 855 | { |
844 | #ifdef DESKTOP_VERSION | 856 | #ifdef DESKTOP_VERSION |
845 | return locateLocal("tmp", "phonefile.vcf"); | 857 | return locateLocal("tmp", "phonefile.vcf"); |
846 | #else | 858 | #else |
847 | return "/tmp/phonefile.vcf"; | 859 | return "/tmp/phonefile.vcf"; |
848 | #endif | 860 | #endif |
849 | 861 | ||
850 | } | 862 | } |
851 | void KABCore::writeToPhone( ) | 863 | void KABCore::writeToPhone( ) |
852 | { | 864 | { |
853 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) | 865 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) |
854 | message(i18n("Export to phone finished!")); | 866 | message(i18n("Export to phone finished!")); |
855 | else | 867 | else |
856 | qDebug(i18n("Error exporting to phone")); | 868 | qDebug(i18n("Error exporting to phone")); |
857 | } | 869 | } |
858 | void KABCore::beamVCard() | 870 | void KABCore::beamVCard() |
859 | { | 871 | { |
860 | QStringList uids = mViewManager->selectedUids(); | 872 | QStringList uids = mViewManager->selectedUids(); |
861 | if ( !uids.isEmpty() ) | 873 | if ( !uids.isEmpty() ) |
862 | beamVCard( uids ); | 874 | beamVCard( uids ); |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index fe2d3a2..88e83f0 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -300,128 +300,129 @@ class KABCore : public QWidget, public KSyncInterface | |||
300 | void save(); | 300 | void save(); |
301 | 301 | ||
302 | /** | 302 | /** |
303 | Undos the last command using the undo stack. | 303 | Undos the last command using the undo stack. |
304 | */ | 304 | */ |
305 | void undo(); | 305 | void undo(); |
306 | 306 | ||
307 | /** | 307 | /** |
308 | Redos the last command that was undone, using the redo stack. | 308 | Redos the last command that was undone, using the redo stack. |
309 | */ | 309 | */ |
310 | void redo(); | 310 | void redo(); |
311 | 311 | ||
312 | /** | 312 | /** |
313 | Shows the edit dialog for the given uid. If the uid is QString::null, | 313 | Shows the edit dialog for the given uid. If the uid is QString::null, |
314 | the method will try to find a selected addressee in the view. | 314 | the method will try to find a selected addressee in the view. |
315 | */ | 315 | */ |
316 | void editContact( const QString &uid /*US = QString::null*/ ); | 316 | void editContact( const QString &uid /*US = QString::null*/ ); |
317 | //US added a second method without defaultparameter | 317 | //US added a second method without defaultparameter |
318 | void editContact2(); | 318 | void editContact2(); |
319 | 319 | ||
320 | /** | 320 | /** |
321 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 321 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
322 | the method will try to find a selected addressee in the view. | 322 | the method will try to find a selected addressee in the view. |
323 | */ | 323 | */ |
324 | void executeContact( const QString &uid /*US = QString::null*/ ); | 324 | void executeContact( const QString &uid /*US = QString::null*/ ); |
325 | 325 | ||
326 | /** | 326 | /** |
327 | Launches the configuration dialog. | 327 | Launches the configuration dialog. |
328 | */ | 328 | */ |
329 | void openConfigDialog(); | 329 | void openConfigDialog(); |
330 | 330 | ||
331 | /** | 331 | /** |
332 | Launches the ldap search dialog. | 332 | Launches the ldap search dialog. |
333 | */ | 333 | */ |
334 | void openLDAPDialog(); | 334 | void openLDAPDialog(); |
335 | 335 | ||
336 | /** | 336 | /** |
337 | Creates a KAddressBookPrinter, which will display the print | 337 | Creates a KAddressBookPrinter, which will display the print |
338 | dialog and do the printing. | 338 | dialog and do the printing. |
339 | */ | 339 | */ |
340 | void print(); | 340 | void print(); |
341 | 341 | ||
342 | /** | 342 | /** |
343 | Registers a new GUI client, so plugins can register its actions. | 343 | Registers a new GUI client, so plugins can register its actions. |
344 | */ | 344 | */ |
345 | void addGUIClient( KXMLGUIClient *client ); | 345 | void addGUIClient( KXMLGUIClient *client ); |
346 | 346 | ||
347 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 347 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
348 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 348 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
349 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 349 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
350 | 350 | ||
351 | 351 | ||
352 | signals: | 352 | signals: |
353 | void contactSelected( const QString &name ); | 353 | void contactSelected( const QString &name ); |
354 | void contactSelected( const QPixmap &pixmap ); | 354 | void contactSelected( const QPixmap &pixmap ); |
355 | public slots: | 355 | public slots: |
356 | void recieve(QString cmsg ); | 356 | void recieve(QString cmsg ); |
357 | void getFile( bool success ); | 357 | void getFile( bool success ); |
358 | void syncFileRequest(); | 358 | void syncFileRequest(); |
359 | void setDetailsVisible( bool visible ); | 359 | void setDetailsVisible( bool visible ); |
360 | void setDetailsToState(); | 360 | void setDetailsToState(); |
361 | // void slotSyncMenu( int ); | 361 | // void slotSyncMenu( int ); |
362 | private slots: | 362 | private slots: |
363 | void updateToolBar(); | 363 | void updateToolBar(); |
364 | void updateMainWindow(); | ||
364 | void receive( const QCString& cmsg, const QByteArray& data ); | 365 | void receive( const QCString& cmsg, const QByteArray& data ); |
365 | void toggleBeamReceive( ); | 366 | void toggleBeamReceive( ); |
366 | void disableBR(bool); | 367 | void disableBR(bool); |
367 | void setJumpButtonBarVisible( bool visible ); | 368 | void setJumpButtonBarVisible( bool visible ); |
368 | void setCaptionBack(); | 369 | void setCaptionBack(); |
369 | void importFromOL(); | 370 | void importFromOL(); |
370 | void extensionModified( const KABC::Addressee::List &list ); | 371 | void extensionModified( const KABC::Addressee::List &list ); |
371 | void extensionChanged( int id ); | 372 | void extensionChanged( int id ); |
372 | void clipboardDataChanged(); | 373 | void clipboardDataChanged(); |
373 | void updateActionMenu(); | 374 | void updateActionMenu(); |
374 | void configureKeyBindings(); | 375 | void configureKeyBindings(); |
375 | void removeVoice(); | 376 | void removeVoice(); |
376 | #ifdef KAB_EMBEDDED | 377 | #ifdef KAB_EMBEDDED |
377 | void configureResources(); | 378 | void configureResources(); |
378 | #endif //KAB_EMBEDDED | 379 | #endif //KAB_EMBEDDED |
379 | 380 | ||
380 | void slotEditorDestroyed( const QString &uid ); | 381 | void slotEditorDestroyed( const QString &uid ); |
381 | void configurationChanged(); | 382 | void configurationChanged(); |
382 | void addressBookChanged(); | 383 | void addressBookChanged(); |
383 | 384 | ||
384 | private: | 385 | private: |
385 | void resizeEvent(QResizeEvent* e ); | 386 | void resizeEvent(QResizeEvent* e ); |
386 | bool mBRdisabled; | 387 | bool mBRdisabled; |
387 | #ifndef DESKTOP_VERSION | 388 | #ifndef DESKTOP_VERSION |
388 | QCopChannel* infrared; | 389 | QCopChannel* infrared; |
389 | #endif | 390 | #endif |
390 | QTimer *mMessageTimer; | 391 | QTimer *mMessageTimer; |
391 | void initGUI(); | 392 | void initGUI(); |
392 | void initActions(); | 393 | void initActions(); |
393 | QString getPhoneFile(); | 394 | QString getPhoneFile(); |
394 | 395 | ||
395 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 396 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
396 | const char *name = 0 ); | 397 | const char *name = 0 ); |
397 | 398 | ||
398 | KXMLGUIClient *mGUIClient; | 399 | KXMLGUIClient *mGUIClient; |
399 | 400 | ||
400 | KABC::AddressBook *mAddressBook; | 401 | KABC::AddressBook *mAddressBook; |
401 | 402 | ||
402 | ViewManager *mViewManager; | 403 | ViewManager *mViewManager; |
403 | // QSplitter *mDetailsSplitter; | 404 | // QSplitter *mDetailsSplitter; |
404 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 405 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
405 | ViewContainer *mDetails; | 406 | ViewContainer *mDetails; |
406 | KDGanttMinimizeSplitter* mMiniSplitter; | 407 | KDGanttMinimizeSplitter* mMiniSplitter; |
407 | XXPortManager *mXXPortManager; | 408 | XXPortManager *mXXPortManager; |
408 | JumpButtonBar *mJumpButtonBar; | 409 | JumpButtonBar *mJumpButtonBar; |
409 | IncSearchWidget *mIncSearchWidget; | 410 | IncSearchWidget *mIncSearchWidget; |
410 | ExtensionManager *mExtensionManager; | 411 | ExtensionManager *mExtensionManager; |
411 | 412 | ||
412 | KCMultiDialog *mConfigureDialog; | 413 | KCMultiDialog *mConfigureDialog; |
413 | 414 | ||
414 | #ifndef KAB_EMBEDDED | 415 | #ifndef KAB_EMBEDDED |
415 | LDAPSearchDialog *mLdapSearchDialog; | 416 | LDAPSearchDialog *mLdapSearchDialog; |
416 | #endif //KAB_EMBEDDED | 417 | #endif //KAB_EMBEDDED |
417 | // QDict<AddresseeEditorDialog> mEditorDict; | 418 | // QDict<AddresseeEditorDialog> mEditorDict; |
418 | AddresseeEditorDialog *mEditorDialog; | 419 | AddresseeEditorDialog *mEditorDialog; |
419 | bool mReadWrite; | 420 | bool mReadWrite; |
420 | bool mModified; | 421 | bool mModified; |
421 | bool mIsPart; | 422 | bool mIsPart; |
422 | bool mMultipleViewsAtOnce; | 423 | bool mMultipleViewsAtOnce; |
423 | 424 | ||
424 | 425 | ||
425 | //US file menu | 426 | //US file menu |
426 | KAction *mActionMail; | 427 | KAction *mActionMail; |
427 | KAction *mActionBeam; | 428 | KAction *mActionBeam; |
diff --git a/kmicromail/libetpan/mime/mailmime_decode.c b/kmicromail/libetpan/mime/mailmime_decode.c index b2ab0f7..bb7638e 100644 --- a/kmicromail/libetpan/mime/mailmime_decode.c +++ b/kmicromail/libetpan/mime/mailmime_decode.c | |||
@@ -44,143 +44,143 @@ | |||
44 | #include <unistd.h> | 44 | #include <unistd.h> |
45 | #include <sys/mman.h> | 45 | #include <sys/mman.h> |
46 | #include <string.h> | 46 | #include <string.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | 48 | ||
49 | #include "mailmime_content.h" | 49 | #include "mailmime_content.h" |
50 | 50 | ||
51 | #include "charconv.h" | 51 | #include "charconv.h" |
52 | #include "mmapstring.h" | 52 | #include "mmapstring.h" |
53 | #include "mailimf.h" | 53 | #include "mailimf.h" |
54 | 54 | ||
55 | #ifndef TRUE | 55 | #ifndef TRUE |
56 | #define TRUE 1 | 56 | #define TRUE 1 |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | #ifndef FALSE | 59 | #ifndef FALSE |
60 | #define FALSE 0 | 60 | #define FALSE 0 |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | static int mailmime_charset_parse(const char * message, size_t length, | 63 | static int mailmime_charset_parse(const char * message, size_t length, |
64 | size_t * index, char ** charset); | 64 | size_t * index, char ** charset); |
65 | 65 | ||
66 | enum { | 66 | enum { |
67 | MAILMIME_ENCODING_B, | 67 | MAILMIME_ENCODING_B, |
68 | MAILMIME_ENCODING_Q | 68 | MAILMIME_ENCODING_Q |
69 | }; | 69 | }; |
70 | 70 | ||
71 | static int mailmime_encoding_parse(const char * message, size_t length, | 71 | static int mailmime_encoding_parse(const char * message, size_t length, |
72 | size_t * index, int * result); | 72 | size_t * index, int * result); |
73 | 73 | ||
74 | static int mailmime_etoken_parse(const char * message, size_t length, | 74 | static int mailmime_etoken_parse(const char * message, size_t length, |
75 | size_t * index, char ** result); | 75 | size_t * index, char ** result); |
76 | 76 | ||
77 | static int | 77 | static int |
78 | mailmime_non_encoded_word_parse(const char * message, size_t length, | 78 | mailmime_non_encoded_word_parse(const char * message, size_t length, |
79 | size_t * index, | 79 | size_t * index, |
80 | char ** result); | 80 | char ** result); |
81 | 81 | ||
82 | static int | 82 | static int |
83 | mailmime_encoded_word_parse(const char * message, size_t length, | 83 | mailmime_encoded_word_parse(const char * message, size_t length, |
84 | size_t * index, | 84 | size_t * index, |
85 | struct mailmime_encoded_word ** result); | 85 | struct mailmime_encoded_word ** result); |
86 | 86 | ||
87 | 87 | ||
88 | enum { | 88 | enum { |
89 | TYPE_ERROR, | 89 | TYPE_ERROR, |
90 | TYPE_WORD, | 90 | TYPE_WORD, |
91 | TYPE_ENCODED_WORD, | 91 | TYPE_ENCODED_WORD, |
92 | }; | 92 | }; |
93 | 93 | ||
94 | int mailmime_encoded_phrase_parse(const char * default_fromcode, | 94 | int mailmime_encoded_phrase_parse(const char * default_fromcode, |
95 | const char * message, size_t length, | 95 | const char * message, size_t length, |
96 | size_t * index, const char * tocode, | 96 | size_t * index, const char * tocode, |
97 | char ** result) | 97 | char ** result) |
98 | { | 98 | { |
99 | MMAPString * gphrase; | 99 | MMAPString * gphrase; |
100 | struct mailmime_encoded_word * word; | 100 | struct mailmime_encoded_word * word; |
101 | int first; | 101 | int first; |
102 | size_t cur_token; | 102 | size_t cur_token; |
103 | int r; | 103 | int r; |
104 | int res; | 104 | int res; |
105 | char * str; | 105 | char * str; |
106 | char * wordutf8; | 106 | char * wordutf8; |
107 | int type; | 107 | int type; |
108 | 108 | int appendNewLine; | |
109 | cur_token = * index; | 109 | cur_token = * index; |
110 | 110 | ||
111 | gphrase = mmap_string_new(""); | 111 | gphrase = mmap_string_new(""); |
112 | if (gphrase == NULL) { | 112 | if (gphrase == NULL) { |
113 | res = MAILIMF_ERROR_MEMORY; | 113 | res = MAILIMF_ERROR_MEMORY; |
114 | goto err; | 114 | goto err; |
115 | } | 115 | } |
116 | 116 | ||
117 | first = TRUE; | 117 | first = TRUE; |
118 | 118 | ||
119 | type = TYPE_ERROR; /* XXX - removes a gcc warning */ | 119 | type = TYPE_ERROR; /* XXX - removes a gcc warning */ |
120 | // LUTZ add | 120 | /* LUTZ add*/ |
121 | int appendNewLine = FALSE; | 121 | appendNewLine = FALSE; |
122 | while (1) { //while | 122 | while (1) { |
123 | 123 | ||
124 | r = mailmime_encoded_word_parse(message, length, &cur_token, &word); | 124 | r = mailmime_encoded_word_parse(message, length, &cur_token, &word); |
125 | if (r == MAILIMF_NO_ERROR) { | 125 | if (r == MAILIMF_NO_ERROR) { |
126 | if (!first) { | 126 | if (!first) { |
127 | if (type != TYPE_ENCODED_WORD) { | 127 | if (type != TYPE_ENCODED_WORD) { |
128 | if (mmap_string_append_c(gphrase, ' ') == NULL) { | 128 | if (mmap_string_append_c(gphrase, ' ') == NULL) { |
129 | mailmime_encoded_word_free(word); | 129 | mailmime_encoded_word_free(word); |
130 | res = MAILIMF_ERROR_MEMORY; | 130 | res = MAILIMF_ERROR_MEMORY; |
131 | goto free; | 131 | goto free; |
132 | } | 132 | } |
133 | } | 133 | } |
134 | } | 134 | } |
135 | type = TYPE_ENCODED_WORD; | 135 | type = TYPE_ENCODED_WORD; |
136 | wordutf8 = NULL; | 136 | wordutf8 = NULL; |
137 | r = charconv(tocode, word->wd_charset, word->wd_text, | 137 | r = charconv(tocode, word->wd_charset, word->wd_text, |
138 | strlen(word->wd_text), &wordutf8); | 138 | strlen(word->wd_text), &wordutf8); |
139 | switch (r) { | 139 | switch (r) { |
140 | case MAIL_CHARCONV_ERROR_MEMORY: | 140 | case MAIL_CHARCONV_ERROR_MEMORY: |
141 | mailmime_encoded_word_free(word); | 141 | mailmime_encoded_word_free(word); |
142 | res = MAILIMF_ERROR_MEMORY; | 142 | res = MAILIMF_ERROR_MEMORY; |
143 | goto free; | 143 | goto free; |
144 | 144 | ||
145 | case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: | 145 | case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: |
146 | case MAIL_CHARCONV_ERROR_CONV: | 146 | case MAIL_CHARCONV_ERROR_CONV: |
147 | mailmime_encoded_word_free(word); | 147 | mailmime_encoded_word_free(word); |
148 | res = MAILIMF_ERROR_PARSE; | 148 | res = MAILIMF_ERROR_PARSE; |
149 | goto free; | 149 | goto free; |
150 | } | 150 | } |
151 | 151 | ||
152 | if (wordutf8 != NULL) { | 152 | if (wordutf8 != NULL) { |
153 | if (mmap_string_append(gphrase, wordutf8) == NULL) { | 153 | if (mmap_string_append(gphrase, wordutf8) == NULL) { |
154 | mailmime_encoded_word_free(word); | 154 | mailmime_encoded_word_free(word); |
155 | free(wordutf8); | 155 | free(wordutf8); |
156 | res = MAILIMF_ERROR_MEMORY; | 156 | res = MAILIMF_ERROR_MEMORY; |
157 | goto free; | 157 | goto free; |
158 | } | 158 | } |
159 | free(wordutf8); | 159 | free(wordutf8); |
160 | } | 160 | } |
161 | mailmime_encoded_word_free(word); | 161 | mailmime_encoded_word_free(word); |
162 | first = FALSE; | 162 | first = FALSE; |
163 | } | 163 | } |
164 | else if (r == MAILIMF_ERROR_PARSE) { | 164 | else if (r == MAILIMF_ERROR_PARSE) { |
165 | /* do nothing */ | 165 | /* do nothing */ |
166 | } | 166 | } |
167 | else { | 167 | else { |
168 | res = r; | 168 | res = r; |
169 | goto free; | 169 | goto free; |
170 | } | 170 | } |
171 | 171 | ||
172 | if (r == MAILIMF_ERROR_PARSE) { | 172 | if (r == MAILIMF_ERROR_PARSE) { |
173 | char * raw_word; | 173 | char * raw_word; |
174 | 174 | ||
175 | r = mailmime_non_encoded_word_parse(message, length, | 175 | r = mailmime_non_encoded_word_parse(message, length, |
176 | &cur_token, &raw_word); | 176 | &cur_token, &raw_word); |
177 | if (r == MAILIMF_NO_ERROR) { | 177 | if (r == MAILIMF_NO_ERROR) { |
178 | if (!first) { | 178 | if (!first) { |
179 | if (mmap_string_append_c(gphrase, ' ') == NULL) { | 179 | if (mmap_string_append_c(gphrase, ' ') == NULL) { |
180 | free(raw_word); | 180 | free(raw_word); |
181 | res = MAILIMF_ERROR_MEMORY; | 181 | res = MAILIMF_ERROR_MEMORY; |
182 | goto free; | 182 | goto free; |
183 | } | 183 | } |
184 | } | 184 | } |
185 | type = TYPE_WORD; | 185 | type = TYPE_WORD; |
186 | 186 | ||