summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-11-08 23:23:02 (UTC)
committer zautrix <zautrix>2004-11-08 23:23:02 (UTC)
commitc20c85c383cb36c7ece87af9e3a60d14b36a9de5 (patch) (unidiff)
treeec1d983fbeb9b719f1871683b47862b528e50c0d
parentd92ceb39af0bf0c655b68cb166dfea44cd688f1c (diff)
downloadkdepimpi-c20c85c383cb36c7ece87af9e3a60d14b36a9de5.zip
kdepimpi-c20c85c383cb36c7ece87af9e3a60d14b36a9de5.tar.gz
kdepimpi-c20c85c383cb36c7ece87af9e3a60d14b36a9de5.tar.bz2
fixed orientation change in kapi
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/incsearchwidget.cpp1
-rw-r--r--kaddressbook/kabcore.cpp30
-rw-r--r--kaddressbook/kabcore.h1
-rw-r--r--kmicromail/libetpan/mime/mailmime_decode.c8
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
@@ -27,64 +27,65 @@
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
38IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) 38IncSearchWidget::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 );
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 7acf1ee..a6fc677 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -332,70 +332,70 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
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
367void KABCore::updateToolBar() 367void KABCore::updateToolBar()
368{ 368{
369 mMainWindow->toolBar()->repaint(); 369 mMainWindow->toolBar()->update();
370} 370}
371KABCore::~KABCore() 371KABCore::~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}
386void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 386void 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}
397void KABCore::toggleBeamReceive( ) 397void KABCore::toggleBeamReceive( )
398{ 398{
399 if ( mBRdisabled ) 399 if ( mBRdisabled )
400 return; 400 return;
401#ifndef DESKTOP_VERSION 401#ifndef DESKTOP_VERSION
@@ -748,83 +748,95 @@ void KABCore::mailVCard( const QStringList& uids )
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*/
765void KABCore::beamMySelf() 765void 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}
780void KABCore::updateMainWindow()
781{
782
783 mMainWindow->showMaximized();
784 mMainWindow->update();
785}
780void KABCore::resizeEvent(QResizeEvent* e ) 786void 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}
804void KABCore::export2phone() 816void 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,
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index fe2d3a2..88e83f0 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -332,64 +332,65 @@ class KABCore : public QWidget, public KSyncInterface
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,
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
@@ -76,79 +76,79 @@ static int mailmime_etoken_parse(const char * message, size_t length,
76 76
77static int 77static int
78mailmime_non_encoded_word_parse(const char * message, size_t length, 78mailmime_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
82static int 82static int
83mailmime_encoded_word_parse(const char * message, size_t length, 83mailmime_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
88enum { 88enum {
89 TYPE_ERROR, 89 TYPE_ERROR,
90 TYPE_WORD, 90 TYPE_WORD,
91 TYPE_ENCODED_WORD, 91 TYPE_ENCODED_WORD,
92}; 92};
93 93
94int mailmime_encoded_phrase_parse(const char * default_fromcode, 94int 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);