-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,167 +1,168 @@ | |||
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() ); |
123 | int wid = fm.width(i18n( "All Fields" ) ); | 124 | int wid = fm.width(i18n( "All Fields" ) ); |
124 | int max = wid; | 125 | int max = wid; |
125 | 126 | ||
126 | KABC::Field::List::ConstIterator it; | 127 | KABC::Field::List::ConstIterator it; |
127 | for ( it = list.begin(); it != list.end(); ++it ) { | 128 | for ( it = list.begin(); it != list.end(); ++it ) { |
128 | mFieldCombo->insertItem( (*it)->label() ); | 129 | mFieldCombo->insertItem( (*it)->label() ); |
129 | // wid = fm.width((*it)->label() ); | 130 | // wid = fm.width((*it)->label() ); |
130 | //if ( wid > max ) | 131 | //if ( wid > max ) |
131 | // max = wid; | 132 | // max = wid; |
132 | } | 133 | } |
133 | 134 | ||
134 | mFieldList = list; | 135 | mFieldList = list; |
135 | 136 | ||
136 | announceDoSearch(); | 137 | announceDoSearch(); |
137 | announceFieldChanged(); | 138 | announceFieldChanged(); |
138 | mFieldCombo->setMaximumWidth( wid+60 ); | 139 | mFieldCombo->setMaximumWidth( wid+60 ); |
139 | } | 140 | } |
140 | 141 | ||
141 | KABC::Field::List IncSearchWidget::fields() const | 142 | KABC::Field::List IncSearchWidget::fields() const |
142 | { | 143 | { |
143 | return mFieldList; | 144 | return mFieldList; |
144 | } | 145 | } |
145 | 146 | ||
146 | KABC::Field *IncSearchWidget::currentField()const | 147 | KABC::Field *IncSearchWidget::currentField()const |
147 | { | 148 | { |
148 | if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 ) | 149 | if ( mFieldCombo->currentItem() == -1 || mFieldCombo->currentItem() == 0 ) |
149 | return 0; // for error or 'use all fields' | 150 | return 0; // for error or 'use all fields' |
150 | else | 151 | else |
151 | return mFieldList[ mFieldCombo->currentItem() - 1 ]; | 152 | return mFieldList[ mFieldCombo->currentItem() - 1 ]; |
152 | } | 153 | } |
153 | 154 | ||
154 | void IncSearchWidget::setCurrentItem( int pos ) | 155 | void IncSearchWidget::setCurrentItem( int pos ) |
155 | { | 156 | { |
156 | mFieldCombo->setCurrentItem( pos ); | 157 | mFieldCombo->setCurrentItem( pos ); |
157 | announceFieldChanged(); | 158 | announceFieldChanged(); |
158 | } | 159 | } |
159 | 160 | ||
160 | int IncSearchWidget::currentItem() const | 161 | int IncSearchWidget::currentItem() const |
161 | { | 162 | { |
162 | 163 | ||
163 | return mFieldCombo->currentItem(); | 164 | return mFieldCombo->currentItem(); |
164 | } | 165 | } |
165 | #ifndef KAB_EMBEDDED | 166 | #ifndef KAB_EMBEDDED |
166 | #include "incsearchwidget.moc" | 167 | #include "incsearchwidget.moc" |
167 | #endif //KAB_EMBEDDED | 168 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 7acf1ee..a6fc677 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -236,262 +236,262 @@ class KAex2phonePrefs : public QDialog | |||
236 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 236 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
237 | resize( 220, 240 ); | 237 | resize( 220, 240 ); |
238 | 238 | ||
239 | } | 239 | } |
240 | 240 | ||
241 | public: | 241 | public: |
242 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 242 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
243 | QCheckBox* mWriteToSim; | 243 | QCheckBox* mWriteToSim; |
244 | }; | 244 | }; |
245 | 245 | ||
246 | 246 | ||
247 | bool pasteWithNewUid = true; | 247 | bool pasteWithNewUid = true; |
248 | 248 | ||
249 | #ifdef KAB_EMBEDDED | 249 | #ifdef KAB_EMBEDDED |
250 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 250 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
251 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 251 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
252 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 252 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
253 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 253 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
254 | #else //KAB_EMBEDDED | 254 | #else //KAB_EMBEDDED |
255 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 255 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
256 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 256 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
257 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 257 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
258 | mReadWrite( readWrite ), mModified( false ) | 258 | mReadWrite( readWrite ), mModified( false ) |
259 | #endif //KAB_EMBEDDED | 259 | #endif //KAB_EMBEDDED |
260 | { | 260 | { |
261 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 261 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
262 | // syncManager->setBlockSave(false); | 262 | // syncManager->setBlockSave(false); |
263 | mMiniSplitter = 0; | 263 | mMiniSplitter = 0; |
264 | mExtensionBarSplitter = 0; | 264 | mExtensionBarSplitter = 0; |
265 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 265 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
266 | mAddressBook = KABC::StdAddressBook::self(); | 266 | mAddressBook = KABC::StdAddressBook::self(); |
267 | KABC::StdAddressBook::setAutomaticSave( false ); | 267 | KABC::StdAddressBook::setAutomaticSave( false ); |
268 | 268 | ||
269 | #ifndef KAB_EMBEDDED | 269 | #ifndef KAB_EMBEDDED |
270 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 270 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
271 | #endif //KAB_EMBEDDED | 271 | #endif //KAB_EMBEDDED |
272 | 272 | ||
273 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 273 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
274 | SLOT( addressBookChanged() ) ); | 274 | SLOT( addressBookChanged() ) ); |
275 | 275 | ||
276 | #if 0 | 276 | #if 0 |
277 | // LP moved to addressbook init method | 277 | // LP moved to addressbook init method |
278 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 278 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
279 | "X-Department", "KADDRESSBOOK" ); | 279 | "X-Department", "KADDRESSBOOK" ); |
280 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 280 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
281 | "X-Profession", "KADDRESSBOOK" ); | 281 | "X-Profession", "KADDRESSBOOK" ); |
282 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 282 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
283 | "X-AssistantsName", "KADDRESSBOOK" ); | 283 | "X-AssistantsName", "KADDRESSBOOK" ); |
284 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 284 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
285 | "X-ManagersName", "KADDRESSBOOK" ); | 285 | "X-ManagersName", "KADDRESSBOOK" ); |
286 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 286 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
287 | "X-SpousesName", "KADDRESSBOOK" ); | 287 | "X-SpousesName", "KADDRESSBOOK" ); |
288 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 288 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
289 | "X-Office", "KADDRESSBOOK" ); | 289 | "X-Office", "KADDRESSBOOK" ); |
290 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 290 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
291 | "X-IMAddress", "KADDRESSBOOK" ); | 291 | "X-IMAddress", "KADDRESSBOOK" ); |
292 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 292 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
293 | "X-Anniversary", "KADDRESSBOOK" ); | 293 | "X-Anniversary", "KADDRESSBOOK" ); |
294 | 294 | ||
295 | //US added this field to become compatible with Opie/qtopia addressbook | 295 | //US added this field to become compatible with Opie/qtopia addressbook |
296 | // values can be "female" or "male" or "". An empty field represents undefined. | 296 | // values can be "female" or "male" or "". An empty field represents undefined. |
297 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 297 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
298 | "X-Gender", "KADDRESSBOOK" ); | 298 | "X-Gender", "KADDRESSBOOK" ); |
299 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 299 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
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 | ||
434 | } | 434 | } |
435 | void KABCore::recieve( QString fn ) | 435 | void KABCore::recieve( QString fn ) |
436 | { | 436 | { |
437 | //qDebug("KABCore::recieve "); | 437 | //qDebug("KABCore::recieve "); |
438 | int count = mAddressBook->importFromFile( fn, true ); | 438 | int count = mAddressBook->importFromFile( fn, true ); |
439 | if ( count ) | 439 | if ( count ) |
440 | setModified( true ); | 440 | setModified( true ); |
441 | mViewManager->refreshView(); | 441 | mViewManager->refreshView(); |
442 | message(i18n("%1 contact(s) received!").arg( count )); | 442 | message(i18n("%1 contact(s) received!").arg( count )); |
443 | topLevelWidget()->showMaximized(); | 443 | topLevelWidget()->showMaximized(); |
444 | topLevelWidget()->raise(); | 444 | topLevelWidget()->raise(); |
445 | } | 445 | } |
446 | void KABCore::restoreSettings() | 446 | void KABCore::restoreSettings() |
447 | { | 447 | { |
448 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 448 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
449 | 449 | ||
450 | bool state; | 450 | bool state; |
451 | 451 | ||
452 | if (mMultipleViewsAtOnce) | 452 | if (mMultipleViewsAtOnce) |
453 | state = KABPrefs::instance()->mDetailsPageVisible; | 453 | state = KABPrefs::instance()->mDetailsPageVisible; |
454 | else | 454 | else |
455 | state = false; | 455 | state = false; |
456 | 456 | ||
457 | mActionDetails->setChecked( state ); | 457 | mActionDetails->setChecked( state ); |
458 | setDetailsVisible( state ); | 458 | setDetailsVisible( state ); |
459 | 459 | ||
460 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 460 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
461 | 461 | ||
462 | mActionJumpBar->setChecked( state ); | 462 | mActionJumpBar->setChecked( state ); |
463 | setJumpButtonBarVisible( state ); | 463 | setJumpButtonBarVisible( state ); |
464 | /*US | 464 | /*US |
465 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 465 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
466 | if ( splitterSize.count() == 0 ) { | 466 | if ( splitterSize.count() == 0 ) { |
467 | splitterSize.append( width() / 2 ); | 467 | splitterSize.append( width() / 2 ); |
468 | splitterSize.append( width() / 2 ); | 468 | splitterSize.append( width() / 2 ); |
469 | } | 469 | } |
470 | mMiniSplitter->setSizes( splitterSize ); | 470 | mMiniSplitter->setSizes( splitterSize ); |
471 | if ( mExtensionBarSplitter ) { | 471 | if ( mExtensionBarSplitter ) { |
472 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 472 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
473 | if ( splitterSize.count() == 0 ) { | 473 | if ( splitterSize.count() == 0 ) { |
474 | splitterSize.append( width() / 2 ); | 474 | splitterSize.append( width() / 2 ); |
475 | splitterSize.append( width() / 2 ); | 475 | splitterSize.append( width() / 2 ); |
476 | } | 476 | } |
477 | mExtensionBarSplitter->setSizes( splitterSize ); | 477 | mExtensionBarSplitter->setSizes( splitterSize ); |
478 | 478 | ||
479 | } | 479 | } |
480 | */ | 480 | */ |
481 | mViewManager->restoreSettings(); | 481 | mViewManager->restoreSettings(); |
482 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 482 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
483 | mExtensionManager->restoreSettings(); | 483 | mExtensionManager->restoreSettings(); |
484 | #ifdef DESKTOP_VERSION | 484 | #ifdef DESKTOP_VERSION |
485 | int wid = width(); | 485 | int wid = width(); |
486 | if ( wid < 10 ) | 486 | if ( wid < 10 ) |
487 | wid = 400; | 487 | wid = 400; |
488 | #else | 488 | #else |
489 | int wid = QApplication::desktop()->width(); | 489 | int wid = QApplication::desktop()->width(); |
490 | if ( wid < 640 ) | 490 | if ( wid < 640 ) |
491 | wid = QApplication::desktop()->height(); | 491 | wid = QApplication::desktop()->height(); |
492 | #endif | 492 | #endif |
493 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 493 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
494 | if ( true /*splitterSize.count() == 0*/ ) { | 494 | if ( true /*splitterSize.count() == 0*/ ) { |
495 | splitterSize.append( wid / 2 ); | 495 | splitterSize.append( wid / 2 ); |
496 | splitterSize.append( wid / 2 ); | 496 | splitterSize.append( wid / 2 ); |
497 | } | 497 | } |
@@ -652,275 +652,287 @@ void KABCore::setContactSelected( const QString &uid ) | |||
652 | if (pic.data().isNull() != true) | 652 | if (pic.data().isNull() != true) |
653 | { | 653 | { |
654 | px.convertFromImage(pic.data()); | 654 | px.convertFromImage(pic.data()); |
655 | } | 655 | } |
656 | 656 | ||
657 | emit contactSelected( px ); | 657 | emit contactSelected( px ); |
658 | } | 658 | } |
659 | } | 659 | } |
660 | 660 | ||
661 | 661 | ||
662 | mExtensionManager->setSelectionChanged(); | 662 | mExtensionManager->setSelectionChanged(); |
663 | 663 | ||
664 | // update the actions | 664 | // update the actions |
665 | bool selected = !uid.isEmpty(); | 665 | bool selected = !uid.isEmpty(); |
666 | 666 | ||
667 | if ( mReadWrite ) { | 667 | if ( mReadWrite ) { |
668 | mActionCut->setEnabled( selected ); | 668 | mActionCut->setEnabled( selected ); |
669 | mActionPaste->setEnabled( selected ); | 669 | mActionPaste->setEnabled( selected ); |
670 | } | 670 | } |
671 | 671 | ||
672 | mActionCopy->setEnabled( selected ); | 672 | mActionCopy->setEnabled( selected ); |
673 | mActionDelete->setEnabled( selected ); | 673 | mActionDelete->setEnabled( selected ); |
674 | mActionEditAddressee->setEnabled( selected ); | 674 | mActionEditAddressee->setEnabled( selected ); |
675 | mActionMail->setEnabled( selected ); | 675 | mActionMail->setEnabled( selected ); |
676 | mActionMailVCard->setEnabled( selected ); | 676 | mActionMailVCard->setEnabled( selected ); |
677 | //if (mActionBeam) | 677 | //if (mActionBeam) |
678 | //mActionBeam->setEnabled( selected ); | 678 | //mActionBeam->setEnabled( selected ); |
679 | 679 | ||
680 | if (mActionBeamVCard) | 680 | if (mActionBeamVCard) |
681 | mActionBeamVCard->setEnabled( selected ); | 681 | mActionBeamVCard->setEnabled( selected ); |
682 | 682 | ||
683 | mActionWhoAmI->setEnabled( selected ); | 683 | mActionWhoAmI->setEnabled( selected ); |
684 | } | 684 | } |
685 | 685 | ||
686 | void KABCore::sendMail() | 686 | void KABCore::sendMail() |
687 | { | 687 | { |
688 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 688 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
689 | } | 689 | } |
690 | 690 | ||
691 | void KABCore::sendMail( const QString& emaillist ) | 691 | void KABCore::sendMail( const QString& emaillist ) |
692 | { | 692 | { |
693 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 693 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
694 | if (emaillist.contains(",") > 0) | 694 | if (emaillist.contains(",") > 0) |
695 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 695 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
696 | else | 696 | else |
697 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 697 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
698 | } | 698 | } |
699 | 699 | ||
700 | 700 | ||
701 | 701 | ||
702 | void KABCore::mailVCard() | 702 | void KABCore::mailVCard() |
703 | { | 703 | { |
704 | QStringList uids = mViewManager->selectedUids(); | 704 | QStringList uids = mViewManager->selectedUids(); |
705 | if ( !uids.isEmpty() ) | 705 | if ( !uids.isEmpty() ) |
706 | mailVCard( uids ); | 706 | mailVCard( uids ); |
707 | } | 707 | } |
708 | 708 | ||
709 | void KABCore::mailVCard( const QStringList& uids ) | 709 | void KABCore::mailVCard( const QStringList& uids ) |
710 | { | 710 | { |
711 | QStringList urls; | 711 | QStringList urls; |
712 | 712 | ||
713 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 713 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
714 | 714 | ||
715 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 715 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
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 ); |
863 | } | 875 | } |
864 | 876 | ||
865 | 877 | ||
866 | void KABCore::beamVCard(const QStringList& uids) | 878 | void KABCore::beamVCard(const QStringList& uids) |
867 | { | 879 | { |
868 | 880 | ||
869 | // LR: we should use the /tmp dir on the Zaurus, | 881 | // LR: we should use the /tmp dir on the Zaurus, |
870 | // because: /tmp = RAM, (HOME)/kdepim = flash memory | 882 | // because: /tmp = RAM, (HOME)/kdepim = flash memory |
871 | 883 | ||
872 | #ifdef DESKTOP_VERSION | 884 | #ifdef DESKTOP_VERSION |
873 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); | 885 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); |
874 | #else | 886 | #else |
875 | QString fileName = "/tmp/kapibeamfile.vcf"; | 887 | QString fileName = "/tmp/kapibeamfile.vcf"; |
876 | #endif | 888 | #endif |
877 | 889 | ||
878 | KABC::VCardConverter converter; | 890 | KABC::VCardConverter converter; |
879 | QString description; | 891 | QString description; |
880 | QString datastream; | 892 | QString datastream; |
881 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 893 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
882 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 894 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
883 | 895 | ||
884 | if ( a.isEmpty() ) | 896 | if ( a.isEmpty() ) |
885 | continue; | 897 | continue; |
886 | 898 | ||
887 | if (description.isEmpty()) | 899 | if (description.isEmpty()) |
888 | description = a.formattedName(); | 900 | description = a.formattedName(); |
889 | 901 | ||
890 | QString vcard; | 902 | QString vcard; |
891 | converter.addresseeToVCard( a, vcard ); | 903 | converter.addresseeToVCard( a, vcard ); |
892 | int start = 0; | 904 | int start = 0; |
893 | int next; | 905 | int next; |
894 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 906 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
895 | int semi = vcard.find(";", next); | 907 | int semi = vcard.find(";", next); |
896 | int dopp = vcard.find(":", next); | 908 | int dopp = vcard.find(":", next); |
897 | int sep; | 909 | int sep; |
898 | if ( semi < dopp && semi >= 0 ) | 910 | if ( semi < dopp && semi >= 0 ) |
899 | sep = semi ; | 911 | sep = semi ; |
900 | else | 912 | else |
901 | sep = dopp; | 913 | sep = dopp; |
902 | datastream +=vcard.mid( start, next - start); | 914 | datastream +=vcard.mid( start, next - start); |
903 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 915 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
904 | start = sep; | 916 | start = sep; |
905 | } | 917 | } |
906 | datastream += vcard.mid( start,vcard.length() ); | 918 | datastream += vcard.mid( start,vcard.length() ); |
907 | } | 919 | } |
908 | #ifndef DESKTOP_VERSION | 920 | #ifndef DESKTOP_VERSION |
909 | QFile outFile(fileName); | 921 | QFile outFile(fileName); |
910 | if ( outFile.open(IO_WriteOnly) ) { | 922 | if ( outFile.open(IO_WriteOnly) ) { |
911 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 923 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
912 | QTextStream t( &outFile ); // use a text stream | 924 | QTextStream t( &outFile ); // use a text stream |
913 | //t.setEncoding( QTextStream::UnicodeUTF8 ); | 925 | //t.setEncoding( QTextStream::UnicodeUTF8 ); |
914 | t.setEncoding( QTextStream::Latin1 ); | 926 | t.setEncoding( QTextStream::Latin1 ); |
915 | t <<datastream.latin1(); | 927 | t <<datastream.latin1(); |
916 | outFile.close(); | 928 | outFile.close(); |
917 | Ir *ir = new Ir( this ); | 929 | Ir *ir = new Ir( this ); |
918 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 930 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
919 | ir->send( fileName, description, "text/x-vCard" ); | 931 | ir->send( fileName, description, "text/x-vCard" ); |
920 | } else { | 932 | } else { |
921 | qDebug("Error open temp beam file "); | 933 | qDebug("Error open temp beam file "); |
922 | return; | 934 | return; |
923 | } | 935 | } |
924 | #endif | 936 | #endif |
925 | 937 | ||
926 | } | 938 | } |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index fe2d3a2..88e83f0 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -236,256 +236,257 @@ class KABCore : public QWidget, public KSyncInterface | |||
236 | Sets the whoAmI contact, that is used by many other programs to | 236 | Sets the whoAmI contact, that is used by many other programs to |
237 | get personal information about the current user. | 237 | get personal information about the current user. |
238 | */ | 238 | */ |
239 | void setWhoAmI(); | 239 | void setWhoAmI(); |
240 | 240 | ||
241 | /** | 241 | /** |
242 | Displays the category dialog and applies the result to all | 242 | Displays the category dialog and applies the result to all |
243 | selected contacts. | 243 | selected contacts. |
244 | */ | 244 | */ |
245 | void setCategories(); | 245 | void setCategories(); |
246 | void manageCategories(); | 246 | void manageCategories(); |
247 | void editCategories(); | 247 | void editCategories(); |
248 | 248 | ||
249 | /** | 249 | /** |
250 | Sets the field list of the Incremental Search Widget. | 250 | Sets the field list of the Incremental Search Widget. |
251 | */ | 251 | */ |
252 | void setSearchFields( const KABC::Field::List &fields ); | 252 | void setSearchFields( const KABC::Field::List &fields ); |
253 | 253 | ||
254 | /** | 254 | /** |
255 | Search with the current search field for a contact, that matches | 255 | Search with the current search field for a contact, that matches |
256 | the given text, and selects it in the view. | 256 | the given text, and selects it in the view. |
257 | */ | 257 | */ |
258 | void incrementalSearch( const QString& text ); | 258 | void incrementalSearch( const QString& text ); |
259 | 259 | ||
260 | /** | 260 | /** |
261 | Marks the address book as modified. | 261 | Marks the address book as modified. |
262 | */ | 262 | */ |
263 | void setModified(); | 263 | void setModified(); |
264 | /** | 264 | /** |
265 | Marks the address book as modified without refreshing the view. | 265 | Marks the address book as modified without refreshing the view. |
266 | */ | 266 | */ |
267 | void setModifiedWOrefresh(); | 267 | void setModifiedWOrefresh(); |
268 | 268 | ||
269 | /** | 269 | /** |
270 | Marks the address book as modified concerning the argument. | 270 | Marks the address book as modified concerning the argument. |
271 | */ | 271 | */ |
272 | void setModified( bool modified ); | 272 | void setModified( bool modified ); |
273 | 273 | ||
274 | /** | 274 | /** |
275 | Returns whether the address book is modified. | 275 | Returns whether the address book is modified. |
276 | */ | 276 | */ |
277 | bool modified() const; | 277 | bool modified() const; |
278 | 278 | ||
279 | /** | 279 | /** |
280 | Called whenever an contact is modified in the contact editor | 280 | Called whenever an contact is modified in the contact editor |
281 | dialog or the quick edit. | 281 | dialog or the quick edit. |
282 | */ | 282 | */ |
283 | void contactModified( const KABC::Addressee &addr ); | 283 | void contactModified( const KABC::Addressee &addr ); |
284 | 284 | ||
285 | /** | 285 | /** |
286 | DCOP METHODS. | 286 | DCOP METHODS. |
287 | */ | 287 | */ |
288 | void addEmail( QString addr ); | 288 | void addEmail( QString addr ); |
289 | void importVCard( const KURL& url, bool showPreview ); | 289 | void importVCard( const KURL& url, bool showPreview ); |
290 | void importVCard( const QString& vCard, bool showPreview ); | 290 | void importVCard( const QString& vCard, bool showPreview ); |
291 | void newContact(); | 291 | void newContact(); |
292 | QString getNameByPhone( const QString& phone ); | 292 | QString getNameByPhone( const QString& phone ); |
293 | /** | 293 | /** |
294 | END DCOP METHODS | 294 | END DCOP METHODS |
295 | */ | 295 | */ |
296 | 296 | ||
297 | /** | 297 | /** |
298 | Saves the contents of the AddressBook back to disk. | 298 | Saves the contents of the AddressBook back to disk. |
299 | */ | 299 | */ |
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; |
428 | KToggleAction *mActionBR; | 429 | KToggleAction *mActionBR; |
429 | KAction *mActionExport2phone; | 430 | KAction *mActionExport2phone; |
430 | KAction* mActionPrint; | 431 | KAction* mActionPrint; |
431 | KAction* mActionNewContact; | 432 | KAction* mActionNewContact; |
432 | KAction *mActionSave; | 433 | KAction *mActionSave; |
433 | KAction *mActionEditAddressee; | 434 | KAction *mActionEditAddressee; |
434 | KAction *mActionMailVCard; | 435 | KAction *mActionMailVCard; |
435 | KAction *mActionBeamVCard; | 436 | KAction *mActionBeamVCard; |
436 | 437 | ||
437 | KAction *mActionQuit; | 438 | KAction *mActionQuit; |
438 | 439 | ||
439 | //US edit menu | 440 | //US edit menu |
440 | KAction *mActionCopy; | 441 | KAction *mActionCopy; |
441 | KAction *mActionCut; | 442 | KAction *mActionCut; |
442 | KAction *mActionPaste; | 443 | KAction *mActionPaste; |
443 | KAction *mActionSelectAll; | 444 | KAction *mActionSelectAll; |
444 | KAction *mActionUndo; | 445 | KAction *mActionUndo; |
445 | KAction *mActionRedo; | 446 | KAction *mActionRedo; |
446 | KAction *mActionDelete; | 447 | KAction *mActionDelete; |
447 | 448 | ||
448 | //US settings menu | 449 | //US settings menu |
449 | KAction *mActionConfigResources; | 450 | KAction *mActionConfigResources; |
450 | KAction *mActionConfigKAddressbook; | 451 | KAction *mActionConfigKAddressbook; |
451 | KAction *mActionConfigShortcuts; | 452 | KAction *mActionConfigShortcuts; |
452 | KAction *mActionConfigureToolbars; | 453 | KAction *mActionConfigureToolbars; |
453 | KAction *mActionKeyBindings; | 454 | KAction *mActionKeyBindings; |
454 | KToggleAction *mActionJumpBar; | 455 | KToggleAction *mActionJumpBar; |
455 | KToggleAction *mActionDetails; | 456 | KToggleAction *mActionDetails; |
456 | KAction *mActionWhoAmI; | 457 | KAction *mActionWhoAmI; |
457 | KAction *mActionCategories; | 458 | KAction *mActionCategories; |
458 | KAction *mActionEditCategories; | 459 | KAction *mActionEditCategories; |
459 | KAction *mActionManageCategories; | 460 | KAction *mActionManageCategories; |
460 | KAction *mActionAboutKAddressbook; | 461 | KAction *mActionAboutKAddressbook; |
461 | KAction *mActionLicence; | 462 | KAction *mActionLicence; |
462 | KAction *mActionFaq; | 463 | KAction *mActionFaq; |
463 | KAction *mActionWN; | 464 | KAction *mActionWN; |
464 | KAction *mActionSyncHowto; | 465 | KAction *mActionSyncHowto; |
465 | KAction *mActionKdeSyncHowto; | 466 | KAction *mActionKdeSyncHowto; |
466 | KAction *mActionMultiSyncHowto; | 467 | KAction *mActionMultiSyncHowto; |
467 | 468 | ||
468 | KAction *mActionDeleteView; | 469 | KAction *mActionDeleteView; |
469 | 470 | ||
470 | QPopupMenu *viewMenu; | 471 | QPopupMenu *viewMenu; |
471 | QPopupMenu *filterMenu; | 472 | QPopupMenu *filterMenu; |
472 | QPopupMenu *settingsMenu; | 473 | QPopupMenu *settingsMenu; |
473 | QPopupMenu *changeMenu; | 474 | QPopupMenu *changeMenu; |
474 | //US QAction *mActionSave; | 475 | //US QAction *mActionSave; |
475 | QPopupMenu *ImportMenu; | 476 | QPopupMenu *ImportMenu; |
476 | QPopupMenu *ExportMenu; | 477 | QPopupMenu *ExportMenu; |
477 | //LR additional methods | 478 | //LR additional methods |
478 | KAction *mActionRemoveVoice; | 479 | KAction *mActionRemoveVoice; |
479 | KAction * mActionImportOL; | 480 | KAction * mActionImportOL; |
480 | 481 | ||
481 | #ifndef KAB_EMBEDDED | 482 | #ifndef KAB_EMBEDDED |
482 | KAddressBookService *mAddressBookService; | 483 | KAddressBookService *mAddressBookService; |
483 | #endif //KAB_EMBEDDED | 484 | #endif //KAB_EMBEDDED |
484 | 485 | ||
485 | class KABCorePrivate; | 486 | class KABCorePrivate; |
486 | KABCorePrivate *d; | 487 | KABCorePrivate *d; |
487 | //US bool mBlockSaveFlag; | 488 | //US bool mBlockSaveFlag; |
488 | 489 | ||
489 | #ifdef KAB_EMBEDDED | 490 | #ifdef KAB_EMBEDDED |
490 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 491 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
491 | #endif //KAB_EMBEDDED | 492 | #endif //KAB_EMBEDDED |
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 | |||
@@ -1,250 +1,250 @@ | |||
1 | /* | 1 | /* |
2 | * libEtPan! -- a mail stuff library | 2 | * libEtPan! -- a mail stuff library |
3 | * | 3 | * |
4 | * Copyright (C) 2001, 2002 - DINH Viet Hoa | 4 | * Copyright (C) 2001, 2002 - DINH Viet Hoa |
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. |
15 | * 3. Neither the name of the libEtPan! project nor the names of its | 15 | * 3. Neither the name of the libEtPan! project nor the names of its |
16 | * contributors may be used to endorse or promote products derived | 16 | * contributors may be used to endorse or promote products derived |
17 | * from this software without specific prior written permission. | 17 | * from this software without specific prior written permission. |
18 | * | 18 | * |
19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
29 | * SUCH DAMAGE. | 29 | * SUCH DAMAGE. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | /* | 32 | /* |
33 | * $Id$ | 33 | * $Id$ |
34 | */ | 34 | */ |
35 | 35 | ||
36 | /* | 36 | /* |
37 | RFC 2047 : MIME (Multipurpose Internet Mail Extensions) Part Three: | 37 | RFC 2047 : MIME (Multipurpose Internet Mail Extensions) Part Three: |
38 | Message Header Extensions for Non-ASCII Text | 38 | Message Header Extensions for Non-ASCII Text |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "mailmime_decode.h" | 41 | #include "mailmime_decode.h" |
42 | 42 | ||
43 | #include <ctype.h> | 43 | #include <ctype.h> |
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 | ||
187 | wordutf8 = NULL; | 187 | wordutf8 = NULL; |
188 | r = charconv(tocode, default_fromcode, raw_word, | 188 | r = charconv(tocode, default_fromcode, raw_word, |
189 | strlen(raw_word), &wordutf8); | 189 | strlen(raw_word), &wordutf8); |
190 | 190 | ||
191 | switch (r) { | 191 | switch (r) { |
192 | case MAIL_CHARCONV_ERROR_MEMORY: | 192 | case MAIL_CHARCONV_ERROR_MEMORY: |
193 | free(raw_word); | 193 | free(raw_word); |
194 | res = MAILIMF_ERROR_MEMORY; | 194 | res = MAILIMF_ERROR_MEMORY; |
195 | goto free; | 195 | goto free; |
196 | 196 | ||
197 | case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: | 197 | case MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: |
198 | case MAIL_CHARCONV_ERROR_CONV: | 198 | case MAIL_CHARCONV_ERROR_CONV: |
199 | free(raw_word); | 199 | free(raw_word); |
200 | res = MAILIMF_ERROR_PARSE; | 200 | res = MAILIMF_ERROR_PARSE; |
201 | goto free; | 201 | goto free; |
202 | } | 202 | } |
203 | // LUTZ add | 203 | // LUTZ add |
204 | if ( appendNewLine ) { | 204 | if ( appendNewLine ) { |
205 | appendNewLine = FALSE; | 205 | appendNewLine = FALSE; |
206 | if (mmap_string_append(gphrase, "\n") == NULL) { | 206 | if (mmap_string_append(gphrase, "\n") == NULL) { |
207 | free(wordutf8); | 207 | free(wordutf8); |
208 | free(raw_word); | 208 | free(raw_word); |
209 | res = MAILIMF_ERROR_MEMORY; | 209 | res = MAILIMF_ERROR_MEMORY; |
210 | goto free; | 210 | goto free; |
211 | } | 211 | } |
212 | } | 212 | } |
213 | //fprintf(stderr,"append *%s* \n",wordutf8 ); | 213 | //fprintf(stderr,"append *%s* \n",wordutf8 ); |
214 | if (mmap_string_append(gphrase, wordutf8) == NULL) { | 214 | if (mmap_string_append(gphrase, wordutf8) == NULL) { |
215 | free(wordutf8); | 215 | free(wordutf8); |
216 | free(raw_word); | 216 | free(raw_word); |
217 | res = MAILIMF_ERROR_MEMORY; | 217 | res = MAILIMF_ERROR_MEMORY; |
218 | goto free; | 218 | goto free; |
219 | } | 219 | } |
220 | // LUTZ fix | 220 | // LUTZ fix |
221 | free(wordutf8); | 221 | free(wordutf8); |
222 | free(raw_word); | 222 | free(raw_word); |
223 | first = FALSE; | 223 | first = FALSE; |
224 | } | 224 | } |
225 | else if (r == MAILIMF_ERROR_PARSE) { | 225 | else if (r == MAILIMF_ERROR_PARSE) { |
226 | // LUTZ add | 226 | // LUTZ add |
227 | if ( cur_token >= length ) | 227 | if ( cur_token >= length ) |
228 | break; | 228 | break; |
229 | ++cur_token; | 229 | ++cur_token; |
230 | appendNewLine = TRUE; | 230 | appendNewLine = TRUE; |
231 | } | 231 | } |
232 | else { | 232 | else { |
233 | res = r; | 233 | res = r; |
234 | goto free; | 234 | goto free; |
235 | } | 235 | } |
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
239 | if (first) { | 239 | if (first) { |
240 | res = MAILIMF_ERROR_PARSE; | 240 | res = MAILIMF_ERROR_PARSE; |
241 | goto free; | 241 | goto free; |
242 | } | 242 | } |
243 | 243 | ||
244 | str = strdup(gphrase->str); | 244 | str = strdup(gphrase->str); |
245 | if (str == NULL) { | 245 | if (str == NULL) { |
246 | res = MAILIMF_ERROR_MEMORY; | 246 | res = MAILIMF_ERROR_MEMORY; |
247 | goto free; | 247 | goto free; |
248 | } | 248 | } |
249 | mmap_string_free(gphrase); | 249 | mmap_string_free(gphrase); |
250 | 250 | ||