summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-27 22:35:41 (UTC)
committer zautrix <zautrix>2004-10-27 22:35:41 (UTC)
commit5afbc6ae0908ce12fd5abb1c4eadf9c61a01503c (patch) (unidiff)
tree914ce70d7e5a1afcd2da0c2fda34b959d65d0462
parent9c88346fc757fd1dc54b3fca151a2a610159d8cf (diff)
downloadkdepimpi-5afbc6ae0908ce12fd5abb1c4eadf9c61a01503c.zip
kdepimpi-5afbc6ae0908ce12fd5abb1c4eadf9c61a01503c.tar.gz
kdepimpi-5afbc6ae0908ce12fd5abb1c4eadf9c61a01503c.tar.bz2
pwm close fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp6
-rw-r--r--kaddressbook/kabcore.h1
-rw-r--r--libkdepim/externalapphandler.cpp6
-rw-r--r--libkdepim/externalapphandler.h1
-rw-r--r--pwmanager/pwmanager/pwminit.cpp10
5 files changed, 24 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 4964a6c..d1dcb6e 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -105,384 +105,385 @@ $Id$
105#include <qpe/ir.h> 105#include <qpe/ir.h>
106#include <qpe/qpemenubar.h> 106#include <qpe/qpemenubar.h>
107#include <qtopia/qcopenvelope_qws.h> 107#include <qtopia/qcopenvelope_qws.h>
108#else 108#else
109 109
110#include <qmenubar.h> 110#include <qmenubar.h>
111#endif 111#endif
112 112
113#endif // KAB_EMBEDDED 113#endif // KAB_EMBEDDED
114#include "kcmconfigs/kcmkabconfig.h" 114#include "kcmconfigs/kcmkabconfig.h"
115#include "kcmconfigs/kcmkdepimconfig.h" 115#include "kcmconfigs/kcmkdepimconfig.h"
116#include "kpimglobalprefs.h" 116#include "kpimglobalprefs.h"
117#include "externalapphandler.h" 117#include "externalapphandler.h"
118 118
119 119
120#include <kresources/selectdialog.h> 120#include <kresources/selectdialog.h>
121#include <kmessagebox.h> 121#include <kmessagebox.h>
122 122
123#include <picture.h> 123#include <picture.h>
124#include <resource.h> 124#include <resource.h>
125 125
126//US#include <qsplitter.h> 126//US#include <qsplitter.h>
127#include <qmap.h> 127#include <qmap.h>
128#include <qdir.h> 128#include <qdir.h>
129#include <qfile.h> 129#include <qfile.h>
130#include <qvbox.h> 130#include <qvbox.h>
131#include <qlayout.h> 131#include <qlayout.h>
132#include <qclipboard.h> 132#include <qclipboard.h>
133#include <qtextstream.h> 133#include <qtextstream.h>
134 134
135#include <libkdepim/categoryselectdialog.h> 135#include <libkdepim/categoryselectdialog.h>
136#include <kabc/vcardconverter.h> 136#include <kabc/vcardconverter.h>
137 137
138 138
139#include "addresseeutil.h" 139#include "addresseeutil.h"
140#include "undocmds.h" 140#include "undocmds.h"
141#include "addresseeeditordialog.h" 141#include "addresseeeditordialog.h"
142#include "viewmanager.h" 142#include "viewmanager.h"
143#include "details/detailsviewcontainer.h" 143#include "details/detailsviewcontainer.h"
144#include "kabprefs.h" 144#include "kabprefs.h"
145#include "xxportmanager.h" 145#include "xxportmanager.h"
146#include "incsearchwidget.h" 146#include "incsearchwidget.h"
147#include "jumpbuttonbar.h" 147#include "jumpbuttonbar.h"
148#include "extensionmanager.h" 148#include "extensionmanager.h"
149#include "addresseeconfig.h" 149#include "addresseeconfig.h"
150#include <kcmultidialog.h> 150#include <kcmultidialog.h>
151 151
152#ifdef _WIN32_ 152#ifdef _WIN32_
153 153
154#include "kaimportoldialog.h" 154#include "kaimportoldialog.h"
155#else 155#else
156#include <unistd.h> 156#include <unistd.h>
157#endif 157#endif
158// sync includes 158// sync includes
159#include <libkdepim/ksyncprofile.h> 159#include <libkdepim/ksyncprofile.h>
160#include <libkdepim/ksyncprefsdialog.h> 160#include <libkdepim/ksyncprefsdialog.h>
161 161
162class KAex2phonePrefs : public QDialog 162class KAex2phonePrefs : public QDialog
163{ 163{
164 public: 164 public:
165 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 165 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
166 QDialog( parent, name, true ) 166 QDialog( parent, name, true )
167 { 167 {
168 setCaption( i18n("Export to phone options") ); 168 setCaption( i18n("Export to phone options") );
169 QVBoxLayout* lay = new QVBoxLayout( this ); 169 QVBoxLayout* lay = new QVBoxLayout( this );
170 lay->setSpacing( 3 ); 170 lay->setSpacing( 3 );
171 lay->setMargin( 3 ); 171 lay->setMargin( 3 );
172 QLabel *lab; 172 QLabel *lab;
173 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 173 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
174 lab->setAlignment (AlignHCenter ); 174 lab->setAlignment (AlignHCenter );
175 QHBox* temphb; 175 QHBox* temphb;
176 temphb = new QHBox( this ); 176 temphb = new QHBox( this );
177 new QLabel( i18n("I/O device: "), temphb ); 177 new QLabel( i18n("I/O device: "), temphb );
178 mPhoneDevice = new QLineEdit( temphb); 178 mPhoneDevice = new QLineEdit( temphb);
179 lay->addWidget( temphb ); 179 lay->addWidget( temphb );
180 temphb = new QHBox( this ); 180 temphb = new QHBox( this );
181 new QLabel( i18n("Connection: "), temphb ); 181 new QLabel( i18n("Connection: "), temphb );
182 mPhoneConnection = new QLineEdit( temphb); 182 mPhoneConnection = new QLineEdit( temphb);
183 lay->addWidget( temphb ); 183 lay->addWidget( temphb );
184 temphb = new QHBox( this ); 184 temphb = new QHBox( this );
185 new QLabel( i18n("Model(opt.): "), temphb ); 185 new QLabel( i18n("Model(opt.): "), temphb );
186 mPhoneModel = new QLineEdit( temphb); 186 mPhoneModel = new QLineEdit( temphb);
187 lay->addWidget( temphb ); 187 lay->addWidget( temphb );
188 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 188 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
189 // lay->addWidget( mWriteToSim ); 189 // lay->addWidget( mWriteToSim );
190 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 190 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
191 lab->setAlignment (AlignHCenter ); 191 lab->setAlignment (AlignHCenter );
192 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 192 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
193 lay->addWidget( ok ); 193 lay->addWidget( ok );
194 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 194 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
195 lay->addWidget( cancel ); 195 lay->addWidget( cancel );
196 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 196 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
197 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 197 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
198 resize( 220, 240 ); 198 resize( 220, 240 );
199 199
200 } 200 }
201 201
202public: 202public:
203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
204 QCheckBox* mWriteToSim; 204 QCheckBox* mWriteToSim;
205}; 205};
206 206
207 207
208bool pasteWithNewUid = true; 208bool pasteWithNewUid = true;
209 209
210#ifdef KAB_EMBEDDED 210#ifdef KAB_EMBEDDED
211KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 211KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
212 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 212 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
213 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 213 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
214 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 214 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
215#else //KAB_EMBEDDED 215#else //KAB_EMBEDDED
216KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 216KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
217 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 217 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
218 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 218 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
219 mReadWrite( readWrite ), mModified( false ) 219 mReadWrite( readWrite ), mModified( false )
220#endif //KAB_EMBEDDED 220#endif //KAB_EMBEDDED
221{ 221{
222 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 222 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
223 // syncManager->setBlockSave(false); 223 // syncManager->setBlockSave(false);
224 mExtensionBarSplitter = 0; 224 mExtensionBarSplitter = 0;
225 mIsPart = !parent->inherits( "KAddressBookMain" ); 225 mIsPart = !parent->inherits( "KAddressBookMain" );
226 mAddressBook = KABC::StdAddressBook::self(); 226 mAddressBook = KABC::StdAddressBook::self();
227 KABC::StdAddressBook::setAutomaticSave( false ); 227 KABC::StdAddressBook::setAutomaticSave( false );
228 228
229#ifndef KAB_EMBEDDED 229#ifndef KAB_EMBEDDED
230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
231#endif //KAB_EMBEDDED 231#endif //KAB_EMBEDDED
232 232
233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
234 SLOT( addressBookChanged() ) ); 234 SLOT( addressBookChanged() ) );
235 235
236#if 0 236#if 0
237 // LP moved to addressbook init method 237 // LP moved to addressbook init method
238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
239 "X-Department", "KADDRESSBOOK" ); 239 "X-Department", "KADDRESSBOOK" );
240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
241 "X-Profession", "KADDRESSBOOK" ); 241 "X-Profession", "KADDRESSBOOK" );
242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
243 "X-AssistantsName", "KADDRESSBOOK" ); 243 "X-AssistantsName", "KADDRESSBOOK" );
244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
245 "X-ManagersName", "KADDRESSBOOK" ); 245 "X-ManagersName", "KADDRESSBOOK" );
246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
247 "X-SpousesName", "KADDRESSBOOK" ); 247 "X-SpousesName", "KADDRESSBOOK" );
248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
249 "X-Office", "KADDRESSBOOK" ); 249 "X-Office", "KADDRESSBOOK" );
250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
251 "X-IMAddress", "KADDRESSBOOK" ); 251 "X-IMAddress", "KADDRESSBOOK" );
252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
253 "X-Anniversary", "KADDRESSBOOK" ); 253 "X-Anniversary", "KADDRESSBOOK" );
254 254
255 //US added this field to become compatible with Opie/qtopia addressbook 255 //US added this field to become compatible with Opie/qtopia addressbook
256 // values can be "female" or "male" or "". An empty field represents undefined. 256 // values can be "female" or "male" or "". An empty field represents undefined.
257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
258 "X-Gender", "KADDRESSBOOK" ); 258 "X-Gender", "KADDRESSBOOK" );
259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
260 "X-Children", "KADDRESSBOOK" ); 260 "X-Children", "KADDRESSBOOK" );
261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
262 "X-FreeBusyUrl", "KADDRESSBOOK" ); 262 "X-FreeBusyUrl", "KADDRESSBOOK" );
263#endif 263#endif
264 initGUI(); 264 initGUI();
265 265
266 mIncSearchWidget->setFocus(); 266 mIncSearchWidget->setFocus();
267 267
268 268
269 connect( mViewManager, SIGNAL( selected( const QString& ) ), 269 connect( mViewManager, SIGNAL( selected( const QString& ) ),
270 SLOT( setContactSelected( const QString& ) ) ); 270 SLOT( setContactSelected( const QString& ) ) );
271 connect( mViewManager, SIGNAL( executed( const QString& ) ), 271 connect( mViewManager, SIGNAL( executed( const QString& ) ),
272 SLOT( executeContact( const QString& ) ) ); 272 SLOT( executeContact( const QString& ) ) );
273 273
274 connect( mViewManager, SIGNAL( deleteRequest( ) ), 274 connect( mViewManager, SIGNAL( deleteRequest( ) ),
275 SLOT( deleteContacts( ) ) ); 275 SLOT( deleteContacts( ) ) );
276 connect( mViewManager, SIGNAL( modified() ), 276 connect( mViewManager, SIGNAL( modified() ),
277 SLOT( setModified() ) ); 277 SLOT( setModified() ) );
278 278
279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
281 281
282 connect( mXXPortManager, SIGNAL( modified() ), 282 connect( mXXPortManager, SIGNAL( modified() ),
283 SLOT( setModified() ) ); 283 SLOT( setModified() ) );
284 284
285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
286 SLOT( incrementalSearch( const QString& ) ) ); 286 SLOT( incrementalSearch( const QString& ) ) );
287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
288 mJumpButtonBar, SLOT( recreateButtons() ) ); 288 mJumpButtonBar, SLOT( recreateButtons() ) );
289 289
290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
291 SLOT( sendMail( const QString& ) ) ); 291 SLOT( sendMail( const QString& ) ) );
292 292
293 293
294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
295 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&))); 295 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&)));
296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
297 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
297 298
298 299
299#ifndef KAB_EMBEDDED 300#ifndef KAB_EMBEDDED
300 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 301 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
301 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 302 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
302 303
303 connect( mDetails, SIGNAL( browse( const QString& ) ), 304 connect( mDetails, SIGNAL( browse( const QString& ) ),
304 SLOT( browse( const QString& ) ) ); 305 SLOT( browse( const QString& ) ) );
305 306
306 307
307 mAddressBookService = new KAddressBookService( this ); 308 mAddressBookService = new KAddressBookService( this );
308 309
309#endif //KAB_EMBEDDED 310#endif //KAB_EMBEDDED
310 311
311 mMessageTimer = new QTimer( this ); 312 mMessageTimer = new QTimer( this );
312 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 313 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
313 mEditorDialog = 0; 314 mEditorDialog = 0;
314 createAddresseeEditorDialog( this ); 315 createAddresseeEditorDialog( this );
315 setModified( false ); 316 setModified( false );
316 mBRdisabled = false; 317 mBRdisabled = false;
317#ifndef DESKTOP_VERSION 318#ifndef DESKTOP_VERSION
318 infrared = 0; 319 infrared = 0;
319#endif 320#endif
320 //toggleBeamReceive( ); 321 //toggleBeamReceive( );
321} 322}
322 323
323KABCore::~KABCore() 324KABCore::~KABCore()
324{ 325{
325 // save(); 326 // save();
326 //saveSettings(); 327 //saveSettings();
327 //KABPrefs::instance()->writeConfig(); 328 //KABPrefs::instance()->writeConfig();
328 delete AddresseeConfig::instance(); 329 delete AddresseeConfig::instance();
329 mAddressBook = 0; 330 mAddressBook = 0;
330 KABC::StdAddressBook::close(); 331 KABC::StdAddressBook::close();
331 332
332 delete syncManager; 333 delete syncManager;
333#ifndef DESKTOP_VERSION 334#ifndef DESKTOP_VERSION
334 if ( infrared ) 335 if ( infrared )
335 delete infrared; 336 delete infrared;
336#endif 337#endif
337} 338}
338void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 339void KABCore::receive( const QCString& cmsg, const QByteArray& data )
339{ 340{
340 qDebug("KA: QCOP message received: %s ", cmsg.data() ); 341 qDebug("KA: QCOP message received: %s ", cmsg.data() );
341 if ( cmsg == "setDocument(QString)" ) { 342 if ( cmsg == "setDocument(QString)" ) {
342 QDataStream stream( data, IO_ReadOnly ); 343 QDataStream stream( data, IO_ReadOnly );
343 QString fileName; 344 QString fileName;
344 stream >> fileName; 345 stream >> fileName;
345 recieve( fileName ); 346 recieve( fileName );
346 return; 347 return;
347 } 348 }
348} 349}
349void KABCore::toggleBeamReceive( ) 350void KABCore::toggleBeamReceive( )
350{ 351{
351 if ( mBRdisabled ) 352 if ( mBRdisabled )
352 return; 353 return;
353#ifndef DESKTOP_VERSION 354#ifndef DESKTOP_VERSION
354 if ( infrared ) { 355 if ( infrared ) {
355 qDebug("AB disable BeamReceive "); 356 qDebug("AB disable BeamReceive ");
356 delete infrared; 357 delete infrared;
357 infrared = 0; 358 infrared = 0;
358 mActionBR->setChecked(false); 359 mActionBR->setChecked(false);
359 return; 360 return;
360 } 361 }
361 qDebug("AB enable BeamReceive "); 362 qDebug("AB enable BeamReceive ");
362 mActionBR->setChecked(true); 363 mActionBR->setChecked(true);
363 364
364 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 365 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
365 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 366 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
366#endif 367#endif
367} 368}
368 369
369 370
370void KABCore::disableBR(bool b) 371void KABCore::disableBR(bool b)
371{ 372{
372#ifndef DESKTOP_VERSION 373#ifndef DESKTOP_VERSION
373 if ( b ) { 374 if ( b ) {
374 if ( infrared ) { 375 if ( infrared ) {
375 toggleBeamReceive( ); 376 toggleBeamReceive( );
376 } 377 }
377 mBRdisabled = true; 378 mBRdisabled = true;
378 } else { 379 } else {
379 if ( mBRdisabled ) { 380 if ( mBRdisabled ) {
380 mBRdisabled = false; 381 mBRdisabled = false;
381 //toggleBeamReceive( ); 382 //toggleBeamReceive( );
382 } 383 }
383 } 384 }
384#endif 385#endif
385 386
386} 387}
387void KABCore::recieve( QString fn ) 388void KABCore::recieve( QString fn )
388{ 389{
389 //qDebug("KABCore::recieve "); 390 //qDebug("KABCore::recieve ");
390 int count = mAddressBook->importFromFile( fn, true ); 391 int count = mAddressBook->importFromFile( fn, true );
391 if ( count ) 392 if ( count )
392 setModified( true ); 393 setModified( true );
393 mViewManager->refreshView(); 394 mViewManager->refreshView();
394 message(i18n("%1 contact(s) received!").arg( count )); 395 message(i18n("%1 contact(s) received!").arg( count ));
395 topLevelWidget()->showMaximized(); 396 topLevelWidget()->showMaximized();
396 topLevelWidget()->raise(); 397 topLevelWidget()->raise();
397} 398}
398void KABCore::restoreSettings() 399void KABCore::restoreSettings()
399{ 400{
400 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 401 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
401 402
402 bool state; 403 bool state;
403 404
404 if (mMultipleViewsAtOnce) 405 if (mMultipleViewsAtOnce)
405 state = KABPrefs::instance()->mDetailsPageVisible; 406 state = KABPrefs::instance()->mDetailsPageVisible;
406 else 407 else
407 state = false; 408 state = false;
408 409
409 mActionDetails->setChecked( state ); 410 mActionDetails->setChecked( state );
410 setDetailsVisible( state ); 411 setDetailsVisible( state );
411 412
412 state = KABPrefs::instance()->mJumpButtonBarVisible; 413 state = KABPrefs::instance()->mJumpButtonBarVisible;
413 414
414 mActionJumpBar->setChecked( state ); 415 mActionJumpBar->setChecked( state );
415 setJumpButtonBarVisible( state ); 416 setJumpButtonBarVisible( state );
416/*US 417/*US
417 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 418 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
418 if ( splitterSize.count() == 0 ) { 419 if ( splitterSize.count() == 0 ) {
419 splitterSize.append( width() / 2 ); 420 splitterSize.append( width() / 2 );
420 splitterSize.append( width() / 2 ); 421 splitterSize.append( width() / 2 );
421 } 422 }
422 mMiniSplitter->setSizes( splitterSize ); 423 mMiniSplitter->setSizes( splitterSize );
423 if ( mExtensionBarSplitter ) { 424 if ( mExtensionBarSplitter ) {
424 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 425 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
425 if ( splitterSize.count() == 0 ) { 426 if ( splitterSize.count() == 0 ) {
426 splitterSize.append( width() / 2 ); 427 splitterSize.append( width() / 2 );
427 splitterSize.append( width() / 2 ); 428 splitterSize.append( width() / 2 );
428 } 429 }
429 mExtensionBarSplitter->setSizes( splitterSize ); 430 mExtensionBarSplitter->setSizes( splitterSize );
430 431
431 } 432 }
432*/ 433*/
433 mViewManager->restoreSettings(); 434 mViewManager->restoreSettings();
434 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 435 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
435 mExtensionManager->restoreSettings(); 436 mExtensionManager->restoreSettings();
436#ifdef DESKTOP_VERSION 437#ifdef DESKTOP_VERSION
437 int wid = width(); 438 int wid = width();
438 if ( wid < 10 ) 439 if ( wid < 10 )
439 wid = 400; 440 wid = 400;
440#else 441#else
441 int wid = QApplication::desktop()->width(); 442 int wid = QApplication::desktop()->width();
442 if ( wid < 640 ) 443 if ( wid < 640 )
443 wid = QApplication::desktop()->height(); 444 wid = QApplication::desktop()->height();
444#endif 445#endif
445 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 446 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
446 if ( true /*splitterSize.count() == 0*/ ) { 447 if ( true /*splitterSize.count() == 0*/ ) {
447 splitterSize.append( wid / 2 ); 448 splitterSize.append( wid / 2 );
448 splitterSize.append( wid / 2 ); 449 splitterSize.append( wid / 2 );
449 } 450 }
450 mMiniSplitter->setSizes( splitterSize ); 451 mMiniSplitter->setSizes( splitterSize );
451 if ( mExtensionBarSplitter ) { 452 if ( mExtensionBarSplitter ) {
452 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 453 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
453 if ( true /*splitterSize.count() == 0*/ ) { 454 if ( true /*splitterSize.count() == 0*/ ) {
454 splitterSize.append( wid / 2 ); 455 splitterSize.append( wid / 2 );
455 splitterSize.append( wid / 2 ); 456 splitterSize.append( wid / 2 );
456 } 457 }
457 mExtensionBarSplitter->setSizes( splitterSize ); 458 mExtensionBarSplitter->setSizes( splitterSize );
458 459
459 } 460 }
460 461
461 462
462} 463}
463 464
464void KABCore::saveSettings() 465void KABCore::saveSettings()
465{ 466{
466 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 467 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
467 if ( mExtensionBarSplitter ) 468 if ( mExtensionBarSplitter )
468 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 469 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
469 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 470 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
470 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 471 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
471#ifndef KAB_EMBEDDED 472#ifndef KAB_EMBEDDED
472 473
473 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 474 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
474 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 475 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
475#endif //KAB_EMBEDDED 476#endif //KAB_EMBEDDED
476 mExtensionManager->saveSettings(); 477 mExtensionManager->saveSettings();
477 mViewManager->saveSettings(); 478 mViewManager->saveSettings();
478 479
479 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 480 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
480} 481}
481 482
482KABC::AddressBook *KABCore::addressBook() const 483KABC::AddressBook *KABCore::addressBook() const
483{ 484{
484 return mAddressBook; 485 return mAddressBook;
485} 486}
486 487
487KConfig *KABCore::config() 488KConfig *KABCore::config()
488{ 489{
@@ -1097,384 +1098,389 @@ void KABCore::addEmail( QString aStr )
1097{ 1098{
1098#ifndef KAB_EMBEDDED 1099#ifndef KAB_EMBEDDED
1099 QString fullName, email; 1100 QString fullName, email;
1100 1101
1101 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1102 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1102 1103
1103 // Try to lookup the addressee matching the email address 1104 // Try to lookup the addressee matching the email address
1104 bool found = false; 1105 bool found = false;
1105 QStringList emailList; 1106 QStringList emailList;
1106 KABC::AddressBook::Iterator it; 1107 KABC::AddressBook::Iterator it;
1107 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1108 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1108 emailList = (*it).emails(); 1109 emailList = (*it).emails();
1109 if ( emailList.contains( email ) > 0 ) { 1110 if ( emailList.contains( email ) > 0 ) {
1110 found = true; 1111 found = true;
1111 (*it).setNameFromString( fullName ); 1112 (*it).setNameFromString( fullName );
1112 editContact( (*it).uid() ); 1113 editContact( (*it).uid() );
1113 } 1114 }
1114 } 1115 }
1115 1116
1116 if ( !found ) { 1117 if ( !found ) {
1117 KABC::Addressee addr; 1118 KABC::Addressee addr;
1118 addr.setNameFromString( fullName ); 1119 addr.setNameFromString( fullName );
1119 addr.insertEmail( email, true ); 1120 addr.insertEmail( email, true );
1120 1121
1121 mAddressBook->insertAddressee( addr ); 1122 mAddressBook->insertAddressee( addr );
1122 mViewManager->refreshView( addr.uid() ); 1123 mViewManager->refreshView( addr.uid() );
1123 editContact( addr.uid() ); 1124 editContact( addr.uid() );
1124 } 1125 }
1125#else //KAB_EMBEDDED 1126#else //KAB_EMBEDDED
1126 qDebug("KABCore::addEmail finsih method"); 1127 qDebug("KABCore::addEmail finsih method");
1127#endif //KAB_EMBEDDED 1128#endif //KAB_EMBEDDED
1128} 1129}
1129 1130
1130void KABCore::importVCard( const KURL &url, bool showPreview ) 1131void KABCore::importVCard( const KURL &url, bool showPreview )
1131{ 1132{
1132 mXXPortManager->importVCard( url, showPreview ); 1133 mXXPortManager->importVCard( url, showPreview );
1133} 1134}
1134void KABCore::importFromOL() 1135void KABCore::importFromOL()
1135{ 1136{
1136#ifdef _WIN32_ 1137#ifdef _WIN32_
1137 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1138 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1138 idgl->exec(); 1139 idgl->exec();
1139 KABC::Addressee::List list = idgl->getAddressList(); 1140 KABC::Addressee::List list = idgl->getAddressList();
1140 if ( list.count() > 0 ) { 1141 if ( list.count() > 0 ) {
1141 KABC::Addressee::List listNew; 1142 KABC::Addressee::List listNew;
1142 KABC::Addressee::List listExisting; 1143 KABC::Addressee::List listExisting;
1143 KABC::Addressee::List::Iterator it; 1144 KABC::Addressee::List::Iterator it;
1144 KABC::AddressBook::Iterator iter; 1145 KABC::AddressBook::Iterator iter;
1145 for ( it = list.begin(); it != list.end(); ++it ) { 1146 for ( it = list.begin(); it != list.end(); ++it ) {
1146 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1147 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1147 listNew.append( (*it) ); 1148 listNew.append( (*it) );
1148 else 1149 else
1149 listExisting.append( (*it) ); 1150 listExisting.append( (*it) );
1150 } 1151 }
1151 if ( listExisting.count() > 0 ) 1152 if ( listExisting.count() > 0 )
1152 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1153 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1153 if ( listNew.count() > 0 ) { 1154 if ( listNew.count() > 0 ) {
1154 pasteWithNewUid = false; 1155 pasteWithNewUid = false;
1155 pasteContacts( listNew ); 1156 pasteContacts( listNew );
1156 pasteWithNewUid = true; 1157 pasteWithNewUid = true;
1157 } 1158 }
1158 } 1159 }
1159 delete idgl; 1160 delete idgl;
1160#endif 1161#endif
1161} 1162}
1162 1163
1163void KABCore::importVCard( const QString &vCard, bool showPreview ) 1164void KABCore::importVCard( const QString &vCard, bool showPreview )
1164{ 1165{
1165 mXXPortManager->importVCard( vCard, showPreview ); 1166 mXXPortManager->importVCard( vCard, showPreview );
1166} 1167}
1167 1168
1168//US added a second method without defaultparameter 1169//US added a second method without defaultparameter
1169void KABCore::editContact2() { 1170void KABCore::editContact2() {
1170 editContact( QString::null ); 1171 editContact( QString::null );
1171} 1172}
1172 1173
1173void KABCore::editContact( const QString &uid ) 1174void KABCore::editContact( const QString &uid )
1174{ 1175{
1175 1176
1176 if ( mExtensionManager->isQuickEditVisible() ) 1177 if ( mExtensionManager->isQuickEditVisible() )
1177 return; 1178 return;
1178 1179
1179 // First, locate the contact entry 1180 // First, locate the contact entry
1180 QString localUID = uid; 1181 QString localUID = uid;
1181 if ( localUID.isNull() ) { 1182 if ( localUID.isNull() ) {
1182 QStringList uidList = mViewManager->selectedUids(); 1183 QStringList uidList = mViewManager->selectedUids();
1183 if ( uidList.count() > 0 ) 1184 if ( uidList.count() > 0 )
1184 localUID = *( uidList.at( 0 ) ); 1185 localUID = *( uidList.at( 0 ) );
1185 } 1186 }
1186 1187
1187 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1188 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1188 if ( !addr.isEmpty() ) { 1189 if ( !addr.isEmpty() ) {
1189 mEditorDialog->setAddressee( addr ); 1190 mEditorDialog->setAddressee( addr );
1190 KApplication::execDialog ( mEditorDialog ); 1191 KApplication::execDialog ( mEditorDialog );
1191 } 1192 }
1192} 1193}
1193 1194
1194/** 1195/**
1195 Shows or edits the detail view for the given uid. If the uid is QString::null, 1196 Shows or edits the detail view for the given uid. If the uid is QString::null,
1196 the method will try to find a selected addressee in the view. 1197 the method will try to find a selected addressee in the view.
1197 */ 1198 */
1198void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1199void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1199{ 1200{
1200 if ( mMultipleViewsAtOnce ) 1201 if ( mMultipleViewsAtOnce )
1201 { 1202 {
1202 editContact( uid ); 1203 editContact( uid );
1203 } 1204 }
1204 else 1205 else
1205 { 1206 {
1206 setDetailsVisible( true ); 1207 setDetailsVisible( true );
1207 mActionDetails->setChecked(true); 1208 mActionDetails->setChecked(true);
1208 } 1209 }
1209 1210
1210} 1211}
1211 1212
1212void KABCore::save() 1213void KABCore::save()
1213{ 1214{
1214 if (syncManager->blockSave()) 1215 if (syncManager->blockSave())
1215 return; 1216 return;
1216 if ( !mModified ) 1217 if ( !mModified )
1217 return; 1218 return;
1218 1219
1219 syncManager->setBlockSave(true); 1220 syncManager->setBlockSave(true);
1220 QString text = i18n( "There was an error while attempting to save\n the " 1221 QString text = i18n( "There was an error while attempting to save\n the "
1221 "address book. Please check that some \nother application is " 1222 "address book. Please check that some \nother application is "
1222 "not using it. " ); 1223 "not using it. " );
1223 message(i18n("Saving addressbook ... ")); 1224 message(i18n("Saving addressbook ... "));
1224#ifndef KAB_EMBEDDED 1225#ifndef KAB_EMBEDDED
1225 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1226 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1226 if ( !b || !b->save() ) { 1227 if ( !b || !b->save() ) {
1227 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1228 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1228 } 1229 }
1229#else //KAB_EMBEDDED 1230#else //KAB_EMBEDDED
1230 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1231 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1231 if ( !b || !b->save() ) { 1232 if ( !b || !b->save() ) {
1232 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1233 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1233 } 1234 }
1234#endif //KAB_EMBEDDED 1235#endif //KAB_EMBEDDED
1235 1236
1236 message(i18n("Addressbook saved!")); 1237 message(i18n("Addressbook saved!"));
1237 setModified( false ); 1238 setModified( false );
1238 syncManager->setBlockSave(false); 1239 syncManager->setBlockSave(false);
1239} 1240}
1240 1241
1241 1242
1242void KABCore::undo() 1243void KABCore::undo()
1243{ 1244{
1244 UndoStack::instance()->undo(); 1245 UndoStack::instance()->undo();
1245 1246
1246 // Refresh the view 1247 // Refresh the view
1247 mViewManager->refreshView(); 1248 mViewManager->refreshView();
1248} 1249}
1249 1250
1250void KABCore::redo() 1251void KABCore::redo()
1251{ 1252{
1252 RedoStack::instance()->redo(); 1253 RedoStack::instance()->redo();
1253 1254
1254 // Refresh the view 1255 // Refresh the view
1255 mViewManager->refreshView(); 1256 mViewManager->refreshView();
1256} 1257}
1257 1258
1258void KABCore::setJumpButtonBarVisible( bool visible ) 1259void KABCore::setJumpButtonBarVisible( bool visible )
1259{ 1260{
1260 if (mMultipleViewsAtOnce) 1261 if (mMultipleViewsAtOnce)
1261 { 1262 {
1262 if ( visible ) 1263 if ( visible )
1263 mJumpButtonBar->show(); 1264 mJumpButtonBar->show();
1264 else 1265 else
1265 mJumpButtonBar->hide(); 1266 mJumpButtonBar->hide();
1266 } 1267 }
1267 else 1268 else
1268 { 1269 {
1269 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1270 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1270 if (mViewManager->isVisible()) 1271 if (mViewManager->isVisible())
1271 { 1272 {
1272 if ( visible ) 1273 if ( visible )
1273 mJumpButtonBar->show(); 1274 mJumpButtonBar->show();
1274 else 1275 else
1275 mJumpButtonBar->hide(); 1276 mJumpButtonBar->hide();
1276 } 1277 }
1277 else 1278 else
1278 { 1279 {
1279 mJumpButtonBar->hide(); 1280 mJumpButtonBar->hide();
1280 } 1281 }
1281 } 1282 }
1282} 1283}
1283 1284
1284 1285
1285void KABCore::setDetailsToState() 1286void KABCore::setDetailsToState()
1286{ 1287{
1287 setDetailsVisible( mActionDetails->isChecked() ); 1288 setDetailsVisible( mActionDetails->isChecked() );
1288} 1289}
1290void KABCore::setDetailsToggle()
1291{
1292 mActionDetails->setChecked( !mActionDetails->isChecked() );
1293 setDetailsToState();
1294}
1289 1295
1290 1296
1291 1297
1292void KABCore::setDetailsVisible( bool visible ) 1298void KABCore::setDetailsVisible( bool visible )
1293{ 1299{
1294 if (visible && mDetails->isHidden()) 1300 if (visible && mDetails->isHidden())
1295 { 1301 {
1296 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1302 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1297 if ( addrList.count() > 0 ) 1303 if ( addrList.count() > 0 )
1298 mDetails->setAddressee( addrList[ 0 ] ); 1304 mDetails->setAddressee( addrList[ 0 ] );
1299 } 1305 }
1300 1306
1301 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1307 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1302 // the listview and the detailview. We do that by changing the splitbar size. 1308 // the listview and the detailview. We do that by changing the splitbar size.
1303 if (mMultipleViewsAtOnce) 1309 if (mMultipleViewsAtOnce)
1304 { 1310 {
1305 if ( visible ) 1311 if ( visible )
1306 mDetails->show(); 1312 mDetails->show();
1307 else 1313 else
1308 mDetails->hide(); 1314 mDetails->hide();
1309 } 1315 }
1310 else 1316 else
1311 { 1317 {
1312 if ( visible ) { 1318 if ( visible ) {
1313 mViewManager->hide(); 1319 mViewManager->hide();
1314 mDetails->show(); 1320 mDetails->show();
1315 mIncSearchWidget->setFocus(); 1321 mIncSearchWidget->setFocus();
1316 } 1322 }
1317 else { 1323 else {
1318 mViewManager->show(); 1324 mViewManager->show();
1319 mDetails->hide(); 1325 mDetails->hide();
1320 mViewManager->setFocusAV(); 1326 mViewManager->setFocusAV();
1321 } 1327 }
1322 setJumpButtonBarVisible( !visible ); 1328 setJumpButtonBarVisible( !visible );
1323 } 1329 }
1324 1330
1325} 1331}
1326 1332
1327void KABCore::extensionChanged( int id ) 1333void KABCore::extensionChanged( int id )
1328{ 1334{
1329 //change the details view only for non desktop systems 1335 //change the details view only for non desktop systems
1330#ifndef DESKTOP_VERSION 1336#ifndef DESKTOP_VERSION
1331 1337
1332 if (id == 0) 1338 if (id == 0)
1333 { 1339 {
1334 //the user disabled the extension. 1340 //the user disabled the extension.
1335 1341
1336 if (mMultipleViewsAtOnce) 1342 if (mMultipleViewsAtOnce)
1337 { // enable detailsview again 1343 { // enable detailsview again
1338 setDetailsVisible( true ); 1344 setDetailsVisible( true );
1339 mActionDetails->setChecked( true ); 1345 mActionDetails->setChecked( true );
1340 } 1346 }
1341 else 1347 else
1342 { //go back to the listview 1348 { //go back to the listview
1343 setDetailsVisible( false ); 1349 setDetailsVisible( false );
1344 mActionDetails->setChecked( false ); 1350 mActionDetails->setChecked( false );
1345 mActionDetails->setEnabled(true); 1351 mActionDetails->setEnabled(true);
1346 } 1352 }
1347 1353
1348 } 1354 }
1349 else 1355 else
1350 { 1356 {
1351 //the user enabled the extension. 1357 //the user enabled the extension.
1352 setDetailsVisible( false ); 1358 setDetailsVisible( false );
1353 mActionDetails->setChecked( false ); 1359 mActionDetails->setChecked( false );
1354 1360
1355 if (!mMultipleViewsAtOnce) 1361 if (!mMultipleViewsAtOnce)
1356 { 1362 {
1357 mActionDetails->setEnabled(false); 1363 mActionDetails->setEnabled(false);
1358 } 1364 }
1359 1365
1360 mExtensionManager->setSelectionChanged(); 1366 mExtensionManager->setSelectionChanged();
1361 1367
1362 } 1368 }
1363 1369
1364#endif// DESKTOP_VERSION 1370#endif// DESKTOP_VERSION
1365 1371
1366} 1372}
1367 1373
1368 1374
1369void KABCore::extensionModified( const KABC::Addressee::List &list ) 1375void KABCore::extensionModified( const KABC::Addressee::List &list )
1370{ 1376{
1371 1377
1372 if ( list.count() != 0 ) { 1378 if ( list.count() != 0 ) {
1373 KABC::Addressee::List::ConstIterator it; 1379 KABC::Addressee::List::ConstIterator it;
1374 for ( it = list.begin(); it != list.end(); ++it ) 1380 for ( it = list.begin(); it != list.end(); ++it )
1375 mAddressBook->insertAddressee( *it ); 1381 mAddressBook->insertAddressee( *it );
1376 if ( list.count() > 1 ) 1382 if ( list.count() > 1 )
1377 setModified(); 1383 setModified();
1378 else 1384 else
1379 setModifiedWOrefresh(); 1385 setModifiedWOrefresh();
1380 } 1386 }
1381 if ( list.count() == 0 ) 1387 if ( list.count() == 0 )
1382 mViewManager->refreshView(); 1388 mViewManager->refreshView();
1383 else 1389 else
1384 mViewManager->refreshView( list[ 0 ].uid() ); 1390 mViewManager->refreshView( list[ 0 ].uid() );
1385 1391
1386 1392
1387 1393
1388} 1394}
1389 1395
1390QString KABCore::getNameByPhone( const QString &phone ) 1396QString KABCore::getNameByPhone( const QString &phone )
1391{ 1397{
1392#ifndef KAB_EMBEDDED 1398#ifndef KAB_EMBEDDED
1393 QRegExp r( "[/*/-/ ]" ); 1399 QRegExp r( "[/*/-/ ]" );
1394 QString localPhone( phone ); 1400 QString localPhone( phone );
1395 1401
1396 bool found = false; 1402 bool found = false;
1397 QString ownerName = ""; 1403 QString ownerName = "";
1398 KABC::AddressBook::Iterator iter; 1404 KABC::AddressBook::Iterator iter;
1399 KABC::PhoneNumber::List::Iterator phoneIter; 1405 KABC::PhoneNumber::List::Iterator phoneIter;
1400 KABC::PhoneNumber::List phoneList; 1406 KABC::PhoneNumber::List phoneList;
1401 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1407 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1402 phoneList = (*iter).phoneNumbers(); 1408 phoneList = (*iter).phoneNumbers();
1403 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1409 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1404 ++phoneIter) { 1410 ++phoneIter) {
1405 // Get rid of separator chars so just the numbers are compared. 1411 // Get rid of separator chars so just the numbers are compared.
1406 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1412 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1407 ownerName = (*iter).formattedName(); 1413 ownerName = (*iter).formattedName();
1408 found = true; 1414 found = true;
1409 } 1415 }
1410 } 1416 }
1411 } 1417 }
1412 1418
1413 return ownerName; 1419 return ownerName;
1414#else //KAB_EMBEDDED 1420#else //KAB_EMBEDDED
1415 qDebug("KABCore::getNameByPhone finsih method"); 1421 qDebug("KABCore::getNameByPhone finsih method");
1416 return ""; 1422 return "";
1417#endif //KAB_EMBEDDED 1423#endif //KAB_EMBEDDED
1418 1424
1419} 1425}
1420 1426
1421void KABCore::openConfigDialog() 1427void KABCore::openConfigDialog()
1422{ 1428{
1423 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1429 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1424 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1430 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1425 ConfigureDialog->addModule(kabcfg ); 1431 ConfigureDialog->addModule(kabcfg );
1426 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 1432 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1427 ConfigureDialog->addModule(kdelibcfg ); 1433 ConfigureDialog->addModule(kdelibcfg );
1428 1434
1429 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1435 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1430 this, SLOT( configurationChanged() ) ); 1436 this, SLOT( configurationChanged() ) );
1431 connect( ConfigureDialog, SIGNAL( okClicked() ), 1437 connect( ConfigureDialog, SIGNAL( okClicked() ),
1432 this, SLOT( configurationChanged() ) ); 1438 this, SLOT( configurationChanged() ) );
1433 saveSettings(); 1439 saveSettings();
1434#ifndef DESKTOP_VERSION 1440#ifndef DESKTOP_VERSION
1435 ConfigureDialog->showMaximized(); 1441 ConfigureDialog->showMaximized();
1436#endif 1442#endif
1437 if ( ConfigureDialog->exec() ) 1443 if ( ConfigureDialog->exec() )
1438 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 1444 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1439 delete ConfigureDialog; 1445 delete ConfigureDialog;
1440} 1446}
1441 1447
1442void KABCore::openLDAPDialog() 1448void KABCore::openLDAPDialog()
1443{ 1449{
1444#ifndef KAB_EMBEDDED 1450#ifndef KAB_EMBEDDED
1445 if ( !mLdapSearchDialog ) { 1451 if ( !mLdapSearchDialog ) {
1446 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1452 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1447 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1453 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1448 SLOT( refreshView() ) ); 1454 SLOT( refreshView() ) );
1449 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1455 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1450 SLOT( setModified() ) ); 1456 SLOT( setModified() ) );
1451 } else 1457 } else
1452 mLdapSearchDialog->restoreSettings(); 1458 mLdapSearchDialog->restoreSettings();
1453 1459
1454 if ( mLdapSearchDialog->isOK() ) 1460 if ( mLdapSearchDialog->isOK() )
1455 mLdapSearchDialog->exec(); 1461 mLdapSearchDialog->exec();
1456#else //KAB_EMBEDDED 1462#else //KAB_EMBEDDED
1457 qDebug("KABCore::openLDAPDialog() finsih method"); 1463 qDebug("KABCore::openLDAPDialog() finsih method");
1458#endif //KAB_EMBEDDED 1464#endif //KAB_EMBEDDED
1459} 1465}
1460 1466
1461void KABCore::print() 1467void KABCore::print()
1462{ 1468{
1463#ifndef KAB_EMBEDDED 1469#ifndef KAB_EMBEDDED
1464 KPrinter printer; 1470 KPrinter printer;
1465 if ( !printer.setup( this ) ) 1471 if ( !printer.setup( this ) )
1466 return; 1472 return;
1467 1473
1468 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1474 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1469 mViewManager->selectedUids(), this ); 1475 mViewManager->selectedUids(), this );
1470 1476
1471 wizard.exec(); 1477 wizard.exec();
1472#else //KAB_EMBEDDED 1478#else //KAB_EMBEDDED
1473 qDebug("KABCore::print() finsih method"); 1479 qDebug("KABCore::print() finsih method");
1474#endif //KAB_EMBEDDED 1480#endif //KAB_EMBEDDED
1475 1481
1476} 1482}
1477 1483
1478 1484
1479void KABCore::addGUIClient( KXMLGUIClient *client ) 1485void KABCore::addGUIClient( KXMLGUIClient *client )
1480{ 1486{
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index a288505..6831ec9 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,340 +1,341 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 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#ifndef KABCORE_H 24#ifndef KABCORE_H
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32#include <qtimer.h> 32#include <qtimer.h>
33 33
34#include <qwidget.h> 34#include <qwidget.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <ksyncmanager.h> 36#include <ksyncmanager.h>
37#ifndef DESKTOP_VERSION 37#ifndef DESKTOP_VERSION
38#include <qcopchannel_qws.h> 38#include <qcopchannel_qws.h>
39#endif 39#endif
40 40
41namespace KABC { 41namespace KABC {
42class AddressBook; 42class AddressBook;
43} 43}
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46class KAboutData; 46class KAboutData;
47class KConfig; 47class KConfig;
48 48
49class KAddressBookService; 49class KAddressBookService;
50class LDAPSearchDialog; 50class LDAPSearchDialog;
51#else //KAB_EMBEDDED 51#else //KAB_EMBEDDED
52class KAddressBookMain; 52class KAddressBookMain;
53//US class QAction; 53//US class QAction;
54#endif //KAB_EMBEDDED 54#endif //KAB_EMBEDDED
55class KCMultiDialog; 55class KCMultiDialog;
56class KXMLGUIClient; 56class KXMLGUIClient;
57class ExtensionManager; 57class ExtensionManager;
58class XXPortManager; 58class XXPortManager;
59class JumpButtonBar; 59class JumpButtonBar;
60class IncSearchWidget; 60class IncSearchWidget;
61class KDGanttMinimizeSplitter; 61class KDGanttMinimizeSplitter;
62class KAction; 62class KAction;
63class KActionCollection; 63class KActionCollection;
64class KToggleAction; 64class KToggleAction;
65class KSyncProfile; 65class KSyncProfile;
66 66
67class QAction; 67class QAction;
68class QMenuBar; 68class QMenuBar;
69class QSplitter; 69class QSplitter;
70class ViewContainer; 70class ViewContainer;
71class ViewManager; 71class ViewManager;
72class AddresseeEditorDialog; 72class AddresseeEditorDialog;
73class Ir; 73class Ir;
74 74
75class KABCore : public QWidget, public KSyncInterface 75class KABCore : public QWidget, public KSyncInterface
76{ 76{
77 Q_OBJECT 77 Q_OBJECT
78 78
79 public: 79 public:
80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
81 81
82 82
83 ~KABCore(); 83 ~KABCore();
84 84
85 85
86#ifdef KAB_EMBEDDED 86#ifdef KAB_EMBEDDED
87 //US added functionality 87 //US added functionality
88 QPopupMenu* getViewMenu() {return viewMenu;} 88 QPopupMenu* getViewMenu() {return viewMenu;}
89 QPopupMenu* getFilterMenu() {return filterMenu;} 89 QPopupMenu* getFilterMenu() {return filterMenu;}
90 QPopupMenu* getSettingsMenu() {return settingsMenu;} 90 QPopupMenu* getSettingsMenu() {return settingsMenu;}
91 void addActionsManually(); 91 void addActionsManually();
92#endif //KAB_EMBEDDED 92#endif //KAB_EMBEDDED
93 /** 93 /**
94 Restores the global settings. 94 Restores the global settings.
95 */ 95 */
96 void restoreSettings(); 96 void restoreSettings();
97 97
98 /** 98 /**
99 Saves the global settings. 99 Saves the global settings.
100 */ 100 */
101 void saveSettings(); 101 void saveSettings();
102 102
103 /** 103 /**
104 Returns a pointer to the StdAddressBook of the application. 104 Returns a pointer to the StdAddressBook of the application.
105 */ 105 */
106 KABC::AddressBook *addressBook() const; 106 KABC::AddressBook *addressBook() const;
107 107
108 /** 108 /**
109 Returns a pointer to the KConfig object of the application. 109 Returns a pointer to the KConfig object of the application.
110 */ 110 */
111 static KConfig *config(); 111 static KConfig *config();
112 112
113 /** 113 /**
114 Returns a pointer to the global KActionCollection object. So 114 Returns a pointer to the global KActionCollection object. So
115 other classes can register their actions easily. 115 other classes can register their actions easily.
116 */ 116 */
117 KActionCollection *actionCollection() const; 117 KActionCollection *actionCollection() const;
118 118
119 /** 119 /**
120 Returns the current search field of the Incremental Search Widget. 120 Returns the current search field of the Incremental Search Widget.
121 */ 121 */
122 KABC::Field *currentSearchField() const; 122 KABC::Field *currentSearchField() const;
123 123
124 /** 124 /**
125 Returns the uid list of the currently selected contacts. 125 Returns the uid list of the currently selected contacts.
126 */ 126 */
127 QStringList selectedUIDs() const; 127 QStringList selectedUIDs() const;
128 128
129 /** 129 /**
130 Displays the ResourceSelectDialog and returns the selected 130 Displays the ResourceSelectDialog and returns the selected
131 resource or a null pointer if no resource was selected by 131 resource or a null pointer if no resource was selected by
132 the user. 132 the user.
133 */ 133 */
134 KABC::Resource *requestResource( QWidget *parent ); 134 KABC::Resource *requestResource( QWidget *parent );
135 135
136#ifndef KAB_EMBEDDED 136#ifndef KAB_EMBEDDED
137 static KAboutData *createAboutData(); 137 static KAboutData *createAboutData();
138#endif //KAB_EMBEDDED 138#endif //KAB_EMBEDDED
139 139
140#ifdef KAB_EMBEDDED 140#ifdef KAB_EMBEDDED
141 inline QPopupMenu* getImportMenu() { return ImportMenu;} 141 inline QPopupMenu* getImportMenu() { return ImportMenu;}
142 inline QPopupMenu* getExportMenu() { return ExportMenu;} 142 inline QPopupMenu* getExportMenu() { return ExportMenu;}
143#endif //KAB_EMBEDDED 143#endif //KAB_EMBEDDED
144 144
145 public slots: 145 public slots:
146#ifdef KAB_EMBEDDED 146#ifdef KAB_EMBEDDED
147 void createAboutData(); 147 void createAboutData();
148#endif //KAB_EMBEDDED 148#endif //KAB_EMBEDDED
149 void setDetailsToggle();
149 150
150 void showLicence(); 151 void showLicence();
151 void faq(); 152 void faq();
152 void whatsnew() ; 153 void whatsnew() ;
153 void synchowto() ; 154 void synchowto() ;
154 void writeToPhone(); 155 void writeToPhone();
155 156
156 /** 157 /**
157 Is called whenever a contact is selected in the view. 158 Is called whenever a contact is selected in the view.
158 */ 159 */
159 void setContactSelected( const QString &uid ); 160 void setContactSelected( const QString &uid );
160 161
161 /** 162 /**
162 Opens the preferred mail composer with all selected contacts as 163 Opens the preferred mail composer with all selected contacts as
163 arguments. 164 arguments.
164 */ 165 */
165 void sendMail(); 166 void sendMail();
166 167
167 /** 168 /**
168 Opens the preferred mail composer with the given contacts as 169 Opens the preferred mail composer with the given contacts as
169 arguments. 170 arguments.
170 */ 171 */
171 void sendMail( const QString& email ); 172 void sendMail( const QString& email );
172 173
173 174
174 void mailVCard(); 175 void mailVCard();
175 void mailVCard(const QStringList& uids); 176 void mailVCard(const QStringList& uids);
176 177
177 /** 178 /**
178 Beams the "WhoAmI contact. 179 Beams the "WhoAmI contact.
179 */ 180 */
180 void beamMySelf(); 181 void beamMySelf();
181 182
182 void beamVCard(); 183 void beamVCard();
183 void export2phone(); 184 void export2phone();
184 void beamVCard(const QStringList& uids); 185 void beamVCard(const QStringList& uids);
185 void beamDone( Ir *ir ); 186 void beamDone( Ir *ir );
186 187
187 188
188 /** 189 /**
189 Starts the preferred web browser with the given URL as argument. 190 Starts the preferred web browser with the given URL as argument.
190 */ 191 */
191 void browse( const QString& url ); 192 void browse( const QString& url );
192 193
193 /** 194 /**
194 Select all contacts in the view. 195 Select all contacts in the view.
195 */ 196 */
196 void selectAllContacts(); 197 void selectAllContacts();
197 198
198 /** 199 /**
199 Deletes all selected contacts from the address book. 200 Deletes all selected contacts from the address book.
200 */ 201 */
201 void deleteContacts(); 202 void deleteContacts();
202 203
203 /** 204 /**
204 Deletes given contacts from the address book. 205 Deletes given contacts from the address book.
205 206
206 @param uids The uids of the contacts, which shall be deleted. 207 @param uids The uids of the contacts, which shall be deleted.
207 */ 208 */
208 void deleteContacts( const QStringList &uids ); 209 void deleteContacts( const QStringList &uids );
209 210
210 /** 211 /**
211 Copys the selected contacts into clipboard for later pasting. 212 Copys the selected contacts into clipboard for later pasting.
212 */ 213 */
213 void copyContacts(); 214 void copyContacts();
214 215
215 /** 216 /**
216 Cuts the selected contacts and stores them for later pasting. 217 Cuts the selected contacts and stores them for later pasting.
217 */ 218 */
218 void cutContacts(); 219 void cutContacts();
219 220
220 /** 221 /**
221 Paste contacts from clipboard into the address book. 222 Paste contacts from clipboard into the address book.
222 */ 223 */
223 void pasteContacts(); 224 void pasteContacts();
224 225
225 /** 226 /**
226 Paste given contacts into the address book. 227 Paste given contacts into the address book.
227 228
228 @param list The list of addressee, which shall be pasted. 229 @param list The list of addressee, which shall be pasted.
229 */ 230 */
230 void pasteContacts( KABC::Addressee::List &list ); 231 void pasteContacts( KABC::Addressee::List &list );
231 232
232 /** 233 /**
233 Sets the whoAmI contact, that is used by many other programs to 234 Sets the whoAmI contact, that is used by many other programs to
234 get personal information about the current user. 235 get personal information about the current user.
235 */ 236 */
236 void setWhoAmI(); 237 void setWhoAmI();
237 238
238 /** 239 /**
239 Displays the category dialog and applies the result to all 240 Displays the category dialog and applies the result to all
240 selected contacts. 241 selected contacts.
241 */ 242 */
242 void setCategories(); 243 void setCategories();
243 244
244 /** 245 /**
245 Sets the field list of the Incremental Search Widget. 246 Sets the field list of the Incremental Search Widget.
246 */ 247 */
247 void setSearchFields( const KABC::Field::List &fields ); 248 void setSearchFields( const KABC::Field::List &fields );
248 249
249 /** 250 /**
250 Search with the current search field for a contact, that matches 251 Search with the current search field for a contact, that matches
251 the given text, and selects it in the view. 252 the given text, and selects it in the view.
252 */ 253 */
253 void incrementalSearch( const QString& text ); 254 void incrementalSearch( const QString& text );
254 255
255 /** 256 /**
256 Marks the address book as modified. 257 Marks the address book as modified.
257 */ 258 */
258 void setModified(); 259 void setModified();
259 /** 260 /**
260 Marks the address book as modified without refreshing the view. 261 Marks the address book as modified without refreshing the view.
261 */ 262 */
262 void setModifiedWOrefresh(); 263 void setModifiedWOrefresh();
263 264
264 /** 265 /**
265 Marks the address book as modified concerning the argument. 266 Marks the address book as modified concerning the argument.
266 */ 267 */
267 void setModified( bool modified ); 268 void setModified( bool modified );
268 269
269 /** 270 /**
270 Returns whether the address book is modified. 271 Returns whether the address book is modified.
271 */ 272 */
272 bool modified() const; 273 bool modified() const;
273 274
274 /** 275 /**
275 Called whenever an contact is modified in the contact editor 276 Called whenever an contact is modified in the contact editor
276 dialog or the quick edit. 277 dialog or the quick edit.
277 */ 278 */
278 void contactModified( const KABC::Addressee &addr ); 279 void contactModified( const KABC::Addressee &addr );
279 280
280 /** 281 /**
281 DCOP METHODS. 282 DCOP METHODS.
282 */ 283 */
283 void addEmail( QString addr ); 284 void addEmail( QString addr );
284 void importVCard( const KURL& url, bool showPreview ); 285 void importVCard( const KURL& url, bool showPreview );
285 void importVCard( const QString& vCard, bool showPreview ); 286 void importVCard( const QString& vCard, bool showPreview );
286 void newContact(); 287 void newContact();
287 QString getNameByPhone( const QString& phone ); 288 QString getNameByPhone( const QString& phone );
288 /** 289 /**
289 END DCOP METHODS 290 END DCOP METHODS
290 */ 291 */
291 292
292 /** 293 /**
293 Saves the contents of the AddressBook back to disk. 294 Saves the contents of the AddressBook back to disk.
294 */ 295 */
295 void save(); 296 void save();
296 297
297 /** 298 /**
298 Undos the last command using the undo stack. 299 Undos the last command using the undo stack.
299 */ 300 */
300 void undo(); 301 void undo();
301 302
302 /** 303 /**
303 Redos the last command that was undone, using the redo stack. 304 Redos the last command that was undone, using the redo stack.
304 */ 305 */
305 void redo(); 306 void redo();
306 307
307 /** 308 /**
308 Shows the edit dialog for the given uid. If the uid is QString::null, 309 Shows the edit dialog for the given uid. If the uid is QString::null,
309 the method will try to find a selected addressee in the view. 310 the method will try to find a selected addressee in the view.
310 */ 311 */
311 void editContact( const QString &uid /*US = QString::null*/ ); 312 void editContact( const QString &uid /*US = QString::null*/ );
312//US added a second method without defaultparameter 313//US added a second method without defaultparameter
313 void editContact2(); 314 void editContact2();
314 315
315 /** 316 /**
316 Shows or edits the detail view for the given uid. If the uid is QString::null, 317 Shows or edits the detail view for the given uid. If the uid is QString::null,
317 the method will try to find a selected addressee in the view. 318 the method will try to find a selected addressee in the view.
318 */ 319 */
319 void executeContact( const QString &uid /*US = QString::null*/ ); 320 void executeContact( const QString &uid /*US = QString::null*/ );
320 321
321 /** 322 /**
322 Launches the configuration dialog. 323 Launches the configuration dialog.
323 */ 324 */
324 void openConfigDialog(); 325 void openConfigDialog();
325 326
326 /** 327 /**
327 Launches the ldap search dialog. 328 Launches the ldap search dialog.
328 */ 329 */
329 void openLDAPDialog(); 330 void openLDAPDialog();
330 331
331 /** 332 /**
332 Creates a KAddressBookPrinter, which will display the print 333 Creates a KAddressBookPrinter, which will display the print
333 dialog and do the printing. 334 dialog and do the printing.
334 */ 335 */
335 void print(); 336 void print();
336 337
337 /** 338 /**
338 Registers a new GUI client, so plugins can register its actions. 339 Registers a new GUI client, so plugins can register its actions.
339 */ 340 */
340 void addGUIClient( KXMLGUIClient *client ); 341 void addGUIClient( KXMLGUIClient *client );
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index 9085673..9f12152 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -927,255 +927,261 @@ bool ExternalAppHandler::callByPager( const QString& pagernumber )
927 KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); 927 KMessageBox::sorry( 0, i18n( "This version does not support paging." ) );
928#endif 928#endif
929 929
930 930
931 return true; 931 return true;
932} 932}
933 933
934/************************************************************************** 934/**************************************************************************
935 * 935 *
936 **************************************************************************/ 936 **************************************************************************/
937 937
938//calls the faxapplication with the number 938//calls the faxapplication with the number
939bool ExternalAppHandler::callByFax( const QString& faxnumber ) 939bool ExternalAppHandler::callByFax( const QString& faxnumber )
940{ 940{
941#ifndef DESKTOP_VERSION 941#ifndef DESKTOP_VERSION
942 QString channel; 942 QString channel;
943 QString message; 943 QString message;
944 QString parameters; 944 QString parameters;
945 945
946 946
947 int client = KPimGlobalPrefs::instance()->mFaxClient; 947 int client = KPimGlobalPrefs::instance()->mFaxClient;
948 if (client == KPimGlobalPrefs::OTHER_FAC) 948 if (client == KPimGlobalPrefs::OTHER_FAC)
949 { 949 {
950 channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; 950 channel = KPimGlobalPrefs::instance()->mFaxOtherChannel;
951 message = KPimGlobalPrefs::instance()->mFaxOtherMessage; 951 message = KPimGlobalPrefs::instance()->mFaxOtherMessage;
952 parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; 952 parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters;
953 } 953 }
954 else 954 else
955 { 955 {
956 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); 956 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client);
957 if (!dai) 957 if (!dai)
958 { 958 {
959 qDebug("could not find configured fax application."); 959 qDebug("could not find configured fax application.");
960 return false; 960 return false;
961 } 961 }
962 channel = dai->_channel; 962 channel = dai->_channel;
963 message = dai->_message; 963 message = dai->_message;
964 parameters = dai->_parameters; 964 parameters = dai->_parameters;
965 } 965 }
966 966
967 967
968 //first check if one of the mailers need the emails right in the message. 968 //first check if one of the mailers need the emails right in the message.
969 message = translateMessage(message, faxnumber, ""); 969 message = translateMessage(message, faxnumber, "");
970 970
971 971
972#ifdef DEBUG_EXT_APP_HANDLER 972#ifdef DEBUG_EXT_APP_HANDLER
973 qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 973 qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
974 qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); 974 qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1());
975#endif 975#endif
976 976
977 QCopEnvelope e(channel.latin1(), message.latin1()); 977 QCopEnvelope e(channel.latin1(), message.latin1());
978 //US we need no names in the To field. The emailadresses are enough 978 //US we need no names in the To field. The emailadresses are enough
979 979
980 passParameters(&e, parameters, faxnumber, ""); 980 passParameters(&e, parameters, faxnumber, "");
981 981
982 982
983#else 983#else
984 KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); 984 KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) );
985#endif 985#endif
986 986
987 987
988 return true; 988 return true;
989} 989}
990 990
991/************************************************************************** 991/**************************************************************************
992 * 992 *
993 **************************************************************************/ 993 **************************************************************************/
994 994
995//calls the sipapplication with the number 995//calls the sipapplication with the number
996bool ExternalAppHandler::callBySIP( const QString& sipnumber ) 996bool ExternalAppHandler::callBySIP( const QString& sipnumber )
997{ 997{
998#ifndef DESKTOP_VERSION 998#ifndef DESKTOP_VERSION
999 QString channel; 999 QString channel;
1000 QString message; 1000 QString message;
1001 QString parameters; 1001 QString parameters;
1002 1002
1003 1003
1004 int client = KPimGlobalPrefs::instance()->mSipClient; 1004 int client = KPimGlobalPrefs::instance()->mSipClient;
1005 if (client == KPimGlobalPrefs::OTHER_SIC) 1005 if (client == KPimGlobalPrefs::OTHER_SIC)
1006 { 1006 {
1007 channel = KPimGlobalPrefs::instance()->mSipOtherChannel; 1007 channel = KPimGlobalPrefs::instance()->mSipOtherChannel;
1008 message = KPimGlobalPrefs::instance()->mSipOtherMessage; 1008 message = KPimGlobalPrefs::instance()->mSipOtherMessage;
1009 parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters; 1009 parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters;
1010 } 1010 }
1011 else 1011 else
1012 { 1012 {
1013 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client); 1013 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client);
1014 if (!dai) 1014 if (!dai)
1015 { 1015 {
1016 qDebug("could not find configured sip application."); 1016 qDebug("could not find configured sip application.");
1017 return false; 1017 return false;
1018 } 1018 }
1019 channel = dai->_channel; 1019 channel = dai->_channel;
1020 message = dai->_message; 1020 message = dai->_message;
1021 parameters = dai->_parameters; 1021 parameters = dai->_parameters;
1022 } 1022 }
1023 1023
1024 1024
1025 //first check if one of the sip apps need the emails right in the message. 1025 //first check if one of the sip apps need the emails right in the message.
1026 message = translateMessage(message, sipnumber, ""); 1026 message = translateMessage(message, sipnumber, "");
1027 1027
1028 1028
1029#ifdef DEBUG_EXT_APP_HANDLER 1029#ifdef DEBUG_EXT_APP_HANDLER
1030 qDebug("10Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 1030 qDebug("10Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
1031 qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1()); 1031 qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1());
1032#endif 1032#endif
1033 1033
1034 QCopEnvelope e(channel.latin1(), message.latin1()); 1034 QCopEnvelope e(channel.latin1(), message.latin1());
1035 //US we need no names in the To field. The emailadresses are enough 1035 //US we need no names in the To field. The emailadresses are enough
1036 1036
1037 passParameters(&e, parameters, sipnumber, ""); 1037 passParameters(&e, parameters, sipnumber, "");
1038 1038
1039 1039
1040#else 1040#else
1041 KMessageBox::sorry( 0, i18n( "This version does not support sip." ) ); 1041 KMessageBox::sorry( 0, i18n( "This version does not support sip." ) );
1042#endif 1042#endif
1043 1043
1044 1044
1045 return true; 1045 return true;
1046} 1046}
1047 1047
1048 1048
1049/************************************************************************** 1049/**************************************************************************
1050 * 1050 *
1051 **************************************************************************/ 1051 **************************************************************************/
1052 1052
1053 1053
1054QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const 1054QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const
1055{ 1055{
1056 message = message.replace( QRegExp("%1"), param1 ); 1056 message = message.replace( QRegExp("%1"), param1 );
1057 return message.replace( QRegExp("%2"), param2 ); 1057 return message.replace( QRegExp("%2"), param2 );
1058} 1058}
1059 1059
1060/************************************************************************** 1060/**************************************************************************
1061 * 1061 *
1062 **************************************************************************/ 1062 **************************************************************************/
1063 1063
1064void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const 1064void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const
1065{ 1065{
1066#ifndef DESKTOP_VERSION 1066#ifndef DESKTOP_VERSION
1067 QMap<QString, QString> valmap; 1067 QMap<QString, QString> valmap;
1068 bool useValMap = false; 1068 bool useValMap = false;
1069 1069
1070 // first extract all parts of the parameters. 1070 // first extract all parts of the parameters.
1071 QStringList paramlist = QStringList::split(";", parameters); 1071 QStringList paramlist = QStringList::split(";", parameters);
1072 1072
1073 //Now check how many parts we have. 1073 //Now check how many parts we have.
1074 //=0 :no params to pass 1074 //=0 :no params to pass
1075 //>0 :parameters to pass 1075 //>0 :parameters to pass
1076 for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) 1076 for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it )
1077 { 1077 {
1078 QString param = (*it); 1078 QString param = (*it);
1079 QStringList keyvallist = QStringList::split("=", param); 1079 QStringList keyvallist = QStringList::split("=", param);
1080 1080
1081 //if we have keyvalue pairs, we assume that we pass a map to the envelope 1081 //if we have keyvalue pairs, we assume that we pass a map to the envelope
1082 QStringList::Iterator it2 = keyvallist.begin(); 1082 QStringList::Iterator it2 = keyvallist.begin();
1083 QString key = (*it2); 1083 QString key = (*it2);
1084 key = key.replace( QRegExp("%1"), param1 ); 1084 key = key.replace( QRegExp("%1"), param1 );
1085 key = key.replace( QRegExp("%2"), param2 ); 1085 key = key.replace( QRegExp("%2"), param2 );
1086 ++it2; 1086 ++it2;
1087 1087
1088 if(it2 != keyvallist.end()) 1088 if(it2 != keyvallist.end())
1089 { 1089 {
1090 QString value = (*it2); 1090 QString value = (*it2);
1091 value = value.replace( QRegExp("%1"), param1 ); 1091 value = value.replace( QRegExp("%1"), param1 );
1092 value = value.replace( QRegExp("%2"), param2 ); 1092 value = value.replace( QRegExp("%2"), param2 );
1093 1093
1094 valmap.insert(key, value); 1094 valmap.insert(key, value);
1095 useValMap = true; 1095 useValMap = true;
1096 } 1096 }
1097 else 1097 else
1098 { 1098 {
1099 // qDebug("pass parameter << %s", key.latin1()); 1099 // qDebug("pass parameter << %s", key.latin1());
1100 (*e) << key; 1100 (*e) << key;
1101 } 1101 }
1102 } 1102 }
1103 1103
1104 if (useValMap == true) 1104 if (useValMap == true)
1105 (*e) << valmap; 1105 (*e) << valmap;
1106 1106
1107#endif 1107#endif
1108 1108
1109} 1109}
1110 1110
1111 1111
1112 1112
1113/************************************************************************** 1113/**************************************************************************
1114 * 1114 *
1115 **************************************************************************/ 1115 **************************************************************************/
1116 1116
1117void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) 1117void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data )
1118{ 1118{
1119
1120 if ( cmsg == "nextView()" ) {
1121 emit nextView();
1122 return;
1123 }
1124
1119 bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); 1125 bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
1120 if (!res) 1126 if (!res)
1121 res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data ); 1127 res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data );
1122 1128
1123 if (!res) 1129 if (!res)
1124 res = mDisplayDetails->appMessage( cmsg, data ); 1130 res = mDisplayDetails->appMessage( cmsg, data );
1125 1131
1126// if (!res) 1132// if (!res)
1127// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); 1133// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
1128} 1134}
1129 1135
1130 1136
1131 1137
1132bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) 1138bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid)
1133{ 1139{
1134 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); 1140 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
1135 return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); 1141 return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid);
1136} 1142}
1137 1143
1138bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 1144bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
1139{ 1145{
1140 QStringList list4, list5, list6; 1146 QStringList list4, list5, list6;
1141 1147
1142 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); 1148 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
1143 return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); 1149 return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6);
1144} 1150}
1145 1151
1146bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) 1152bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email)
1147{ 1153{
1148 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); 1154 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel);
1149 return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); 1155 return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email);
1150} 1156}
1151 1157
1152bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 1158bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
1153{ 1159{
1154 QStringList list4, list5, list6; 1160 QStringList list4, list5, list6;
1155 1161
1156 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); 1162 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel);
1157 return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); 1163 return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6);
1158} 1164}
1159 1165
1160bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) 1166bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid)
1161{ 1167{
1162 mDisplayDetails->setSourceChannel(""); 1168 mDisplayDetails->setSourceChannel("");
1163 return mDisplayDetails->sendMessageToTarget("", name, email, uid); 1169 return mDisplayDetails->sendMessageToTarget("", name, email, uid);
1164} 1170}
1165 1171
1166bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid) 1172bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid)
1167{ 1173{
1168 mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); 1174 mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel);
1169 return mBirthdayListFromKAPITransfer->sendMessageToTarget(sessionuid); 1175 return mBirthdayListFromKAPITransfer->sendMessageToTarget(sessionuid);
1170} 1176}
1171 1177
1172bool ExternalAppHandler::returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) 1178bool ExternalAppHandler::returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6)
1173{ 1179{
1174 mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); 1180 mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel);
1175 return mBirthdayListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); 1181 return mBirthdayListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6);
1176} 1182}
1177 1183
1178 1184
1179 1185
1180 1186
1181 1187
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h
index 6f5d345..52a64e1 100644
--- a/libkdepim/externalapphandler.h
+++ b/libkdepim/externalapphandler.h
@@ -44,248 +44,249 @@ class QCopTransferItem : public QObject
44 Q_OBJECT 44 Q_OBJECT
45 public: 45 public:
46 QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 46 QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
47 QCopTransferItem(); 47 QCopTransferItem();
48 48
49 bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null); 49 bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null);
50 50
51 void setSourceChannel(const QString& sourceChannel); 51 void setSourceChannel(const QString& sourceChannel);
52 52
53 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 53 virtual bool appMessage( const QCString& msg, const QByteArray& data );
54 54
55 55
56 signals: 56 signals:
57 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid); 57 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid);
58 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1); 58 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1);
59 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2); 59 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2);
60 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3); 60 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3);
61 61
62 public: 62 public:
63 int _usedSourceParameters; 63 int _usedSourceParameters;
64 QString _sourceChannel; 64 QString _sourceChannel;
65 QString _sourceMessage; 65 QString _sourceMessage;
66 QString _sourceMessageParameters; 66 QString _sourceMessageParameters;
67 QString _targetChannel; 67 QString _targetChannel;
68 QString _targetMessage; 68 QString _targetMessage;
69 QString _targetMessageParameters; 69 QString _targetMessageParameters;
70 70
71}; 71};
72 72
73/********************************************************************************* 73/*********************************************************************************
74 * 74 *
75 ********************************************************************************/ 75 ********************************************************************************/
76 76
77class QCopMapTransferItem : public QCopTransferItem 77class QCopMapTransferItem : public QCopTransferItem
78{ 78{
79 Q_OBJECT 79 Q_OBJECT
80 public: 80 public:
81 QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 81 QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
82 82
83 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); 83 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap);
84 84
85 85
86 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 86 virtual bool appMessage( const QCString& msg, const QByteArray& data );
87 87
88 88
89 signals: 89 signals:
90 void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); 90 void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap);
91 91
92}; 92};
93 93
94/********************************************************************************* 94/*********************************************************************************
95 * 95 *
96 ********************************************************************************/ 96 ********************************************************************************/
97 97
98class QCopListTransferItem : public QCopTransferItem 98class QCopListTransferItem : public QCopTransferItem
99{ 99{
100 Q_OBJECT 100 Q_OBJECT
101 public: 101 public:
102 QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 102 QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
103 ~QCopListTransferItem(); 103 ~QCopListTransferItem();
104 bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6); 104 bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6);
105 105
106 106
107 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 107 virtual bool appMessage( const QCString& msg, const QByteArray& data );
108 108
109 109
110 signals: 110 signals:
111 void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6); 111 void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6);
112 112
113}; 113};
114 114
115/********************************************************************************* 115/*********************************************************************************
116 * 116 *
117 ********************************************************************************/ 117 ********************************************************************************/
118 118
119 119
120class DefaultAppItem 120class DefaultAppItem
121{ 121{
122 public: 122 public:
123 DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) 123 DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2)
124 : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) 124 : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2)
125 {} 125 {}
126 126
127 DefaultAppItem() 127 DefaultAppItem()
128 { } 128 { }
129 129
130 public: 130 public:
131 int _type; 131 int _type;
132 int _id; 132 int _id;
133 QString _label; 133 QString _label;
134 QString _channel; 134 QString _channel;
135 QString _message; 135 QString _message;
136 QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ; 136 QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ;
137 QString _message2; 137 QString _message2;
138 QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; 138 QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ;
139 139
140}; 140};
141 141
142/********************************************************************************* 142/*********************************************************************************
143 * 143 *
144 ********************************************************************************/ 144 ********************************************************************************/
145 145
146class ExternalAppHandler : public QObject 146class ExternalAppHandler : public QObject
147{ 147{
148 Q_OBJECT 148 Q_OBJECT
149 public: 149 public:
150 virtual ~ExternalAppHandler(); 150 virtual ~ExternalAppHandler();
151 151
152 static ExternalAppHandler *instance(); 152 static ExternalAppHandler *instance();
153 153
154 enum Types { 154 enum Types {
155 EMAIL = 0, 155 EMAIL = 0,
156 PHONE = 1, 156 PHONE = 1,
157 SMS = 2, 157 SMS = 2,
158 FAX = 3, 158 FAX = 3,
159 PAGER = 4, 159 PAGER = 4,
160 SIP = 5 160 SIP = 5
161 }; 161 };
162 162
163 enum Availability { 163 enum Availability {
164 UNDEFINED = -1, 164 UNDEFINED = -1,
165 UNAVAILABLE = 0, 165 UNAVAILABLE = 0,
166 AVAILABLE = 1 166 AVAILABLE = 1
167 }; 167 };
168 168
169 //calls the emailapplication with a number of attachments that need to be send. 169 //calls the emailapplication with a number of attachments that need to be send.
170 //either parameter can be left empty. 170 //either parameter can be left empty.
171 bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls ); 171 bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls );
172 172
173 //calls the emailapplication and creates a mail with parameter emailadress as recipients 173 //calls the emailapplication and creates a mail with parameter emailadress as recipients
174 bool mailToOneContact( const QString& name, const QString& emailadress ); 174 bool mailToOneContact( const QString& name, const QString& emailadress );
175 175
176 //calls the emailapplication and creates a mail with parameter as recipients 176 //calls the emailapplication and creates a mail with parameter as recipients
177 // parameters format is 177 // parameters format is
178 // NAME <EMAIL>:SUBJECT 178 // NAME <EMAIL>:SUBJECT
179 bool mailToOneContact( const QString& adressline ); 179 bool mailToOneContact( const QString& adressline );
180 180
181 //calls the phoneapplication with the number 181 //calls the phoneapplication with the number
182 bool callByPhone( const QString& phonenumber ); 182 bool callByPhone( const QString& phonenumber );
183 183
184 //calls the smsapplication with the number 184 //calls the smsapplication with the number
185 bool callBySMS( const QString& phonenumber ); 185 bool callBySMS( const QString& phonenumber );
186 186
187 //calls the pagerapplication with the number 187 //calls the pagerapplication with the number
188 bool callByPager( const QString& pagernumber ); 188 bool callByPager( const QString& pagernumber );
189 189
190 //calls the faxapplication with the number 190 //calls the faxapplication with the number
191 bool callByFax( const QString& faxnumber ); 191 bool callByFax( const QString& faxnumber );
192 192
193 //calls the sipapplication with the number 193 //calls the sipapplication with the number
194 bool callBySIP( const QString& sipnumber ); 194 bool callBySIP( const QString& sipnumber );
195 195
196 bool isEmailAppAvailable(); 196 bool isEmailAppAvailable();
197 bool isSMSAppAvailable(); 197 bool isSMSAppAvailable();
198 bool isPhoneAppAvailable(); 198 bool isPhoneAppAvailable();
199 bool isFaxAppAvailable(); 199 bool isFaxAppAvailable();
200 bool isPagerAppAvailable(); 200 bool isPagerAppAvailable();
201 bool isSIPAppAvailable(); 201 bool isSIPAppAvailable();
202 202
203 203
204 //Call this method on the source when you want to select names from the addressbook by using QCop 204 //Call this method on the source when you want to select names from the addressbook by using QCop
205 bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid); 205 bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid);
206 //Call this method on the target when you want to return the name/email map to the source (client). 206 //Call this method on the target when you want to return the name/email map to the source (client).
207 bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); 207 bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid);
208 208
209 209
210 210
211 bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email); 211 bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email);
212 bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); 212 bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid);
213 213
214 bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid); 214 bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid);
215 215
216 216
217 217
218 bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid); 218 bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid);
219 bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, 219 bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid,
220 const QStringList& birthdayList, const QStringList& anniversaryList, 220 const QStringList& birthdayList, const QStringList& anniversaryList,
221 const QStringList& realNameList, const QStringList& emailList, 221 const QStringList& realNameList, const QStringList& emailList,
222 const QStringList& assembledNameList, const QStringList& uidList); 222 const QStringList& assembledNameList, const QStringList& uidList);
223 223
224 224
225 //loadConfig clears the cache and checks again if the applications are available or not 225 //loadConfig clears the cache and checks again if the applications are available or not
226 void loadConfig(); 226 void loadConfig();
227 227
228 QList<DefaultAppItem> getAvailableDefaultItems(Types); 228 QList<DefaultAppItem> getAvailableDefaultItems(Types);
229 DefaultAppItem* getDefaultItem(Types, int); 229 DefaultAppItem* getDefaultItem(Types, int);
230 230
231 public slots: 231 public slots:
232 void appMessage( const QCString& msg, const QByteArray& data ); 232 void appMessage( const QCString& msg, const QByteArray& data );
233 233
234 234
235 signals: 235 signals:
236 void nextView();
236 // Emmitted when the target app receives a request from the source app 237 // Emmitted when the target app receives a request from the source app
237 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); 238 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid);
238 239
239 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi 240 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi
240 // The first parameter is a uniqueid. It can be used to identify the event 241 // The first parameter is a uniqueid. It can be used to identify the event
241 void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); 242 void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList);
242 243
243 void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); 244 void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email);
244 void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); 245 void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList);
245 246
246 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 247 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
247 248
248 249
249 // Emmitted when the target app receives a request from the source app 250 // Emmitted when the target app receives a request from the source app
250 void requestForBirthdayList(const QString& sourceChannel, const QString& uid); 251 void requestForBirthdayList(const QString& sourceChannel, const QString& uid);
251 252
252 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi 253 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi
253 // The first parameter is a uniqueid. It can be used to identify the event 254 // The first parameter is a uniqueid. It can be used to identify the event
254 void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList, 255 void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList,
255 const QStringList& anniversaryList, const QStringList& realNameList, 256 const QStringList& anniversaryList, const QStringList& realNameList,
256 const QStringList& emailList, const QStringList& assembledNameList, 257 const QStringList& emailList, const QStringList& assembledNameList,
257 const QStringList& uidList); 258 const QStringList& uidList);
258 259
259 260
260 private: 261 private:
261 ExternalAppHandler(); 262 ExternalAppHandler();
262 QList<DefaultAppItem> mDefaultItems; 263 QList<DefaultAppItem> mDefaultItems;
263 264
264 Availability mEmailAppAvailable; 265 Availability mEmailAppAvailable;
265 Availability mPhoneAppAvailable; 266 Availability mPhoneAppAvailable;
266 Availability mFaxAppAvailable; 267 Availability mFaxAppAvailable;
267 Availability mSMSAppAvailable; 268 Availability mSMSAppAvailable;
268 Availability mPagerAppAvailable; 269 Availability mPagerAppAvailable;
269 Availability mSIPAppAvailable; 270 Availability mSIPAppAvailable;
270 271
271 QCopListTransferItem* mNameEmailUidListFromKAPITransfer; 272 QCopListTransferItem* mNameEmailUidListFromKAPITransfer;
272 QCopListTransferItem* mFindByEmailFromKAPITransfer; 273 QCopListTransferItem* mFindByEmailFromKAPITransfer;
273 QCopTransferItem* mDisplayDetails; 274 QCopTransferItem* mDisplayDetails;
274 QCopListTransferItem* mBirthdayListFromKAPITransfer; 275 QCopListTransferItem* mBirthdayListFromKAPITransfer;
275 276
276 277
277 void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); 278 void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2);
278 279
279 QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; 280 QString& translateMessage(QString& message, const QString& param1, const QString& param2) const;
280 void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; 281 void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const;
281 282
282 283
283 static ExternalAppHandler *sInstance; 284 static ExternalAppHandler *sInstance;
284 285
285 private slots: 286 private slots:
286 void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& ); 287 void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& );
287 288
288}; 289};
289 290
290 291
291#endif 292#endif
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp
index fbd17a7..68f3637 100644
--- a/pwmanager/pwmanager/pwminit.cpp
+++ b/pwmanager/pwmanager/pwminit.cpp
@@ -1,618 +1,628 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2004 by Michael Buesch * 3 * copyright (C) 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "pwminit.h" 20#include "pwminit.h"
21#include "randomizer.h" 21#include "randomizer.h"
22#include <qdir.h> 22#include <qdir.h>
23 23
24#ifndef PWM_EMBEDDED 24#ifndef PWM_EMBEDDED
25#include "selftest.h" 25#include "selftest.h"
26#include "configuration.h" 26#include "configuration.h"
27#else 27#else
28#include "pwmprefs.h" 28#include "pwmprefs.h"
29#endif 29#endif
30 30
31#include "pwm.h" 31#include "pwm.h"
32#include "pwmexception.h" 32#include "pwmexception.h"
33#include "pwmtray.h" 33#include "pwmtray.h"
34#include "pwmdoc.h" 34#include "pwmdoc.h"
35 35
36#ifdef CONFIG_KWALLETIF 36#ifdef CONFIG_KWALLETIF
37# include "kwalletemu.h" 37# include "kwalletemu.h"
38#endif // CONFIG_KWALLETIF 38#endif // CONFIG_KWALLETIF
39#ifdef CONFIG_KEYCARD 39#ifdef CONFIG_KEYCARD
40# include "pwmkeycard.h" 40# include "pwmkeycard.h"
41#endif // CONFIG_KEYCARD 41#endif // CONFIG_KEYCARD
42 42
43#include <qmessagebox.h> 43#include <qmessagebox.h>
44 44
45#include <kmessagebox.h> 45#include <kmessagebox.h>
46#ifndef PWM_EMBEDDED 46#ifndef PWM_EMBEDDED
47#include <kcmdlineargs.h> 47#include <kcmdlineargs.h>
48#include <kwin.h> 48#include <kwin.h>
49#include <dcopclient.h> 49#include <dcopclient.h>
50#endif 50#endif
51 51
52#include <kapplication.h> 52#include <kapplication.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54 54
55#include <signal.h> 55#include <signal.h>
56 56
57static PwMInit *sig_init_pointer; 57static PwMInit *sig_init_pointer;
58#ifdef _WIN32_ 58#ifdef _WIN32_
59static void sig_handler(int signum) 59static void sig_handler(int signum)
60#else 60#else
61static NOREGPARM void sig_handler(int signum) 61static NOREGPARM void sig_handler(int signum)
62#endif 62#endif
63{ 63{
64 switch (signum) { 64 switch (signum) {
65 case SIGINT: 65 case SIGINT:
66 case SIGTERM: 66 case SIGTERM:
67 sig_init_pointer->shutdownApp(20 + signum); 67 sig_init_pointer->shutdownApp(20 + signum);
68 break; 68 break;
69 default: 69 default:
70 printDebug(string("unhandled signal ") 70 printDebug(string("unhandled signal ")
71 + tostr(signum)); 71 + tostr(signum));
72 } 72 }
73} 73}
74 74
75 75
76 76
77PwMInit::PwMInit(PwMApplication *_app) 77PwMInit::PwMInit(PwMApplication *_app)
78 : runStatus (unknown) 78 : runStatus (unknown)
79 , _curWidget (0) 79 , _curWidget (0)
80 , _dcopClient (0) 80 , _dcopClient (0)
81 , _kwalletEmu (0) 81 , _kwalletEmu (0)
82 , _keycard (0) 82 , _keycard (0)
83 , _tray (0) 83 , _tray (0)
84{ 84{
85 sig_init_pointer = this; 85 sig_init_pointer = this;
86 app = _app; 86 app = _app;
87} 87}
88 88
89PwMInit::~PwMInit() 89PwMInit::~PwMInit()
90{ 90{
91 qDebug("PwMInit::~PwMInit() "); 91 qDebug("PwMInit::~PwMInit() ");
92#ifndef PWM_EMBEDDED 92#ifndef PWM_EMBEDDED
93 SelfTest::cancel(); 93 SelfTest::cancel();
94 // close all open mainwnds 94 // close all open mainwnds
95 QValueList<PwM *>::iterator i = _mainWndList.begin(), 95 QValueList<PwM *>::iterator i = _mainWndList.begin(),
96 end = _mainWndList.end(); 96 end = _mainWndList.end();
97 97
98#else 98#else
99 // close all open mainwnds 99 // close all open mainwnds
100 QValueList<PwM *>::Iterator i = _mainWndList.begin(), 100 QValueList<PwM *>::Iterator i = _mainWndList.begin(),
101 end = _mainWndList.end(); 101 end = _mainWndList.end();
102#endif 102#endif
103 while (i != end) { 103 while (i != end) {
104 disconnect(*i, SIGNAL(closed(PwM *)), 104 disconnect(*i, SIGNAL(closed(PwM *)),
105 this, SLOT(mainWndClosed(PwM *))); 105 this, SLOT(mainWndClosed(PwM *)));
106 delete *i; 106 delete *i;
107 ++i; 107 ++i;
108 } 108 }
109 _mainWndList.clear(); 109 _mainWndList.clear();
110 // close all remaining open documents 110 // close all remaining open documents
111 PwMDocList *_dl = PwMDoc::getOpenDocList(); 111 PwMDocList *_dl = PwMDoc::getOpenDocList();
112 vector<PwMDocList::listItem> dl = *(_dl->getList()); 112 vector<PwMDocList::listItem> dl = *(_dl->getList());
113 vector<PwMDocList::listItem>::iterator i2 = dl.begin(), 113 vector<PwMDocList::listItem>::iterator i2 = dl.begin(),
114 end2 = dl.end(); 114 end2 = dl.end();
115 while (i2 != end2) { 115 while (i2 != end2) {
116 delete (*i2).doc; 116 delete (*i2).doc;
117 ++i2; 117 ++i2;
118 } 118 }
119 119
120#ifdef CONFIG_KWALLETIF 120#ifdef CONFIG_KWALLETIF
121 delete_ifnot_null(_kwalletEmu); 121 delete_ifnot_null(_kwalletEmu);
122#endif // CONFIG_KWALLETIF 122#endif // CONFIG_KWALLETIF
123#ifdef CONFIG_KEYCARD 123#ifdef CONFIG_KEYCARD
124 delete_ifnot_null(_keycard); 124 delete_ifnot_null(_keycard);
125#endif // CONFIG_KEYCARD 125#endif // CONFIG_KEYCARD
126 delete_ifnot_null(_tray); 126 delete_ifnot_null(_tray);
127 127
128 Randomizer::cleanup(); 128 Randomizer::cleanup();
129#ifndef PWM_EMBEDDED 129#ifndef PWM_EMBEDDED
130 Configuration::cleanup(); 130 Configuration::cleanup();
131#endif 131#endif
132} 132}
133 133
134void PwMInit::initializeApp() 134void PwMInit::initializeApp()
135{ 135{
136 //qDebug("PwMInit::initializeApp() "); 136 //qDebug("PwMInit::initializeApp() ");
137 PWM_ASSERT(runStatus == unknown); 137 PWM_ASSERT(runStatus == unknown);
138 runStatus = init; 138 runStatus = init;
139 initPosixSignalHandler(); 139 initPosixSignalHandler();
140 Randomizer::init(); 140 Randomizer::init();
141#ifndef PWM_EMBEDDED 141#ifndef PWM_EMBEDDED
142 Configuration::init(); 142 Configuration::init();
143#endif 143#endif
144 initDCOP(); 144 initDCOP();
145 initKWalletEmu(); 145 initKWalletEmu();
146 initKeycard(); 146 initKeycard();
147 initTray(); 147 initTray();
148 handleCmdLineArgs(); 148 handleCmdLineArgs();
149 bool openDeeplocked = false; 149 bool openDeeplocked = false;
150 if (conf()->confGlobAutostartDeepLocked() || 150 if (conf()->confGlobAutostartDeepLocked() ||
151 savedCmd.open_deeplocked) 151 savedCmd.open_deeplocked)
152 openDeeplocked = true; 152 openDeeplocked = true;
153 if ( false ){ 153 if ( false ){
154 // LR is not working 154 // LR is not working
155 //if (conf()->confWndAutoMinimizeOnStart() || 155 //if (conf()->confWndAutoMinimizeOnStart() ||
156 // savedCmd.minToTray) { 156 // savedCmd.minToTray) {
157 PwMDoc *newDoc = createDoc(); 157 PwMDoc *newDoc = createDoc();
158 qDebug(" createDoc()"); 158 qDebug(" createDoc()");
159 if (!newDoc->openDocUi(newDoc, 159 if (!newDoc->openDocUi(newDoc,
160 conf()->confGlobAutoStart(), 160 conf()->confGlobAutoStart(),
161 openDeeplocked)) { 161 openDeeplocked)) {
162 delete newDoc; 162 delete newDoc;
163 } 163 }
164 164
165 //US ENH for embedded devices: in the case of failure, open a document the default way 165 //US ENH for embedded devices: in the case of failure, open a document the default way
166 createMainWnd(conf()->confGlobAutoStart(), 166 createMainWnd(conf()->confGlobAutoStart(),
167 openDeeplocked, 167 openDeeplocked,
168 true, 168 true,
169 0, 169 0,
170 savedCmd.minimized); 170 savedCmd.minimized);
171 171
172 172
173 173
174 174
175 //} 175 //}
176 } else { 176 } else {
177 createMainWnd(conf()->confGlobAutoStart(), 177 createMainWnd(conf()->confGlobAutoStart(),
178 openDeeplocked, 178 openDeeplocked,
179 true, 179 true,
180 0, 180 0,
181 savedCmd.minimized); 181 savedCmd.minimized);
182 } 182 }
183 runStatus = running; 183 runStatus = running;
184} 184}
185 185
186void PwMInit::shutdownApp(int exitStatus) 186void PwMInit::shutdownApp(int exitStatus)
187{ 187{
188
189
190 PwM * iii;
191 while ( iii = _mainWndList.first() ) {
192 disconnect(iii, SIGNAL(closed(PwM *)),
193 this, SLOT(mainWndClosed(PwM *)));
194 mainWndClosed((iii));
195 }
196
188 printDebug(string("PwMInit::shutdownApp(") 197 printDebug(string("PwMInit::shutdownApp(")
189 + tostr(exitStatus) + ") called."); 198 + tostr(exitStatus) + ") called.");
190 PWM_ASSERT((runStatus == running) || (runStatus == init)); 199 PWM_ASSERT((runStatus == running) || (runStatus == init));
191 runStatus = shutdown; 200 runStatus = shutdown;
192 QApplication::exit(exitStatus); 201 QApplication::exit(exitStatus);
193 /* The destructor of PwMInit is called when control 202 /* The destructor of PwMInit is called when control
194 * leaves main() 203 * leaves main()
195 */ 204 */
196} 205}
197 206
198void PwMInit::initPosixSignalHandler() 207void PwMInit::initPosixSignalHandler()
199{ 208{
200 signal(SIGINT, sig_handler); 209 signal(SIGINT, sig_handler);
201 signal(SIGTERM, sig_handler); 210 signal(SIGTERM, sig_handler);
202} 211}
203 212
204void PwMInit::initDCOP() 213void PwMInit::initDCOP()
205{ 214{
206#ifndef PWM_EMBEDDED 215#ifndef PWM_EMBEDDED
207 _dcopClient = app->dcopClient(); 216 _dcopClient = app->dcopClient();
208 _dcopClient->setNotifications(true); 217 _dcopClient->setNotifications(true);
209#endif 218#endif
210 219
211} 220}
212 221
213void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) 222void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload)
214{ 223{
215#ifdef CONFIG_KWALLETIF 224#ifdef CONFIG_KWALLETIF
216 if (!conf()->confGlobKwalletEmu() || 225 if (!conf()->confGlobKwalletEmu() ||
217 forceDisable) { 226 forceDisable) {
218 delete_ifnot_null(_kwalletEmu); 227 delete_ifnot_null(_kwalletEmu);
219 return; 228 return;
220 } 229 }
221 try { 230 try {
222 if (_kwalletEmu && forceReload) 231 if (_kwalletEmu && forceReload)
223 delete_and_null(_kwalletEmu); 232 delete_and_null(_kwalletEmu);
224 if (!_kwalletEmu) 233 if (!_kwalletEmu)
225 _kwalletEmu = new KWalletEmu(this); 234 _kwalletEmu = new KWalletEmu(this);
226 } catch (PwMException e) { 235 } catch (PwMException e) {
227 string errMsg("initializing KWallet emulation failed. ID: "); 236 string errMsg("initializing KWallet emulation failed. ID: ");
228 errMsg += tostr(static_cast<int>(e.getId())); 237 errMsg += tostr(static_cast<int>(e.getId()));
229 errMsg += " err-message: "; 238 errMsg += " err-message: ";
230 errMsg += e.getMessage(); 239 errMsg += e.getMessage();
231 printWarn(errMsg); 240 printWarn(errMsg);
232 return; 241 return;
233 } 242 }
234#else // CONFIG_KWALLETIF 243#else // CONFIG_KWALLETIF
235 PARAM_UNUSED(forceDisable); 244 PARAM_UNUSED(forceDisable);
236 PARAM_UNUSED(forceReload); 245 PARAM_UNUSED(forceReload);
237#endif // CONFIG_KWALLETIF 246#endif // CONFIG_KWALLETIF
238} 247}
239 248
240void PwMInit::initKeycard() 249void PwMInit::initKeycard()
241{ 250{
242#ifdef CONFIG_KEYCARD 251#ifdef CONFIG_KEYCARD
243 PWM_ASSERT(!_keycard); 252 PWM_ASSERT(!_keycard);
244 _keycard = new PwMKeyCard(this); 253 _keycard = new PwMKeyCard(this);
245#endif // CONFIG_KEYCARD 254#endif // CONFIG_KEYCARD
246} 255}
247 256
248void PwMInit::initTray() 257void PwMInit::initTray()
249{ 258{
250#ifdef PWM_EMBEDDED 259#ifdef PWM_EMBEDDED
251 //US ENH : embedded version does not support a tray 260 //US ENH : embedded version does not support a tray
252 return; 261 return;
253#endif 262#endif
254 263
255 if (!conf()->confGlobTray()) { 264 if (!conf()->confGlobTray()) {
256 if (!_tray) 265 if (!_tray)
257 return; 266 return;
258 _tray->hide(); 267 _tray->hide();
259 delete_and_null(_tray); 268 delete_and_null(_tray);
260 return; 269 return;
261 } 270 }
262 if (_tray) 271 if (_tray)
263 return; 272 return;
264 _tray = new PwMTray(this); 273 _tray = new PwMTray(this);
265 connect(_tray, SIGNAL(quitSelected()), 274 connect(_tray, SIGNAL(quitSelected()),
266 this, SLOT(removeTrayAndQuit())); 275 this, SLOT(removeTrayAndQuit()));
267 connect(_tray, SIGNAL(closed(PwMTray *)), 276 connect(_tray, SIGNAL(closed(PwMTray *)),
268 this, SLOT(trayIconClosed(PwMTray *))); 277 this, SLOT(trayIconClosed(PwMTray *)));
269 KIconLoader icons; 278 KIconLoader icons;
270#ifndef PWM_EMBEDDED 279#ifndef PWM_EMBEDDED
271 _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small)); 280 _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small));
272#endif 281#endif
273 _tray->show(); 282 _tray->show();
274 // connect the signals of all open documents. 283 // connect the signals of all open documents.
275 const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList(); 284 const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList();
276 vector<PwMDocList::listItem>::const_iterator i = dl->begin(), 285 vector<PwMDocList::listItem>::const_iterator i = dl->begin(),
277 end = dl->end(); 286 end = dl->end();
278 while (i != end) { 287 while (i != end) {
279 _tray->connectDocToTray((*i).doc); 288 _tray->connectDocToTray((*i).doc);
280 ++i; 289 ++i;
281 } 290 }
282} 291}
283 292
284void PwMInit::removeTrayAndQuit() 293void PwMInit::removeTrayAndQuit()
285{ 294{
286 PWM_ASSERT(_tray); 295 PWM_ASSERT(_tray);
287 // _tray is deleted in ~PwMInit 296 // _tray is deleted in ~PwMInit
288 shutdownApp(0); 297 shutdownApp(0);
289} 298}
290 299
291PwM * PwMInit::createMainWnd(const QString &loadFile, 300PwM * PwMInit::createMainWnd(const QString &loadFile,
292 bool loadFileDeepLocked, 301 bool loadFileDeepLocked,
293 bool virginity, 302 bool virginity,
294 PwMDoc *doc, 303 PwMDoc *doc,
295 bool minimized) 304 bool minimized)
296{ 305{
297 PwM *newWnd; 306 PwM *newWnd;
298 if (!doc) 307 if (!doc)
299 doc = createDoc(); 308 doc = createDoc();
300 newWnd = new PwM(this, doc, virginity); 309 newWnd = new PwM(this, doc, virginity);
301#ifndef PWM_EMBEDDED 310#ifndef PWM_EMBEDDED
302 _mainWndList.push_back(newWnd); 311 _mainWndList.push_back(newWnd);
303#else 312#else
304 _mainWndList.append(newWnd); 313 _mainWndList.append(newWnd);
305#endif 314#endif
306 connect(newWnd, SIGNAL(closed(PwM *)), 315 connect(newWnd, SIGNAL(closed(PwM *)),
307 this, SLOT(mainWndClosed(PwM *))); 316 this, SLOT(mainWndClosed(PwM *)));
308 connect(newWnd, SIGNAL(gotFocus(PwM *)), 317 connect(newWnd, SIGNAL(gotFocus(PwM *)),
309 this, SLOT(setCurWidget(PwM *))); 318 this, SLOT(setCurWidget(PwM *)));
310 connect(newWnd, SIGNAL(lostFocus(PwM *)), 319 connect(newWnd, SIGNAL(lostFocus(PwM *)),
311 this, SLOT(resetCurWidget())); 320 this, SLOT(resetCurWidget()));
312 321
313 //US ENH 322 //US ENH
314#ifndef PWM_EMBEDDED 323#ifndef PWM_EMBEDDED
315 if (minimized) 324 if (minimized)
316 newWnd->showMinimized(); 325 newWnd->showMinimized();
317 else 326 else
318 newWnd->show(); 327 newWnd->show();
319 328
320#else //PWM_EMBEDDED 329#else //PWM_EMBEDDED
321 330
322#ifndef DESKTOP_VERSION 331#ifndef DESKTOP_VERSION
323 app->showMainWidget( newWnd ); 332 app->showMainWidget( newWnd );
324#else //DESKTOP_VERSION 333#else //DESKTOP_VERSION
325 newWnd->resize (640, 480 ); 334 newWnd->resize (640, 480 );
326 newWnd->show(); 335 newWnd->show();
327#endif //DESKTOP_VERSION 336#endif //DESKTOP_VERSION
328 337
329#endif //PWM_EMBEDDED 338#endif //PWM_EMBEDDED
330 339
331 if (loadFile != QString::null && 340 if (loadFile != QString::null &&
332 loadFile != "") { 341 loadFile != "") {
333 newWnd->openDoc(loadFile, loadFileDeepLocked); 342 newWnd->openDoc(loadFile, loadFileDeepLocked);
334 } 343 }
335 return newWnd; 344 return newWnd;
336} 345}
337 346
338PwMDoc * PwMInit::createDoc() 347PwMDoc * PwMInit::createDoc()
339{ 348{
340 PwMDoc *doc = new PwMDoc(this); 349 PwMDoc *doc = new PwMDoc(this);
341#ifdef CONFIG_KEYCARD 350#ifdef CONFIG_KEYCARD
342 doc->setPwMKeyCard(keycard()); 351 doc->setPwMKeyCard(keycard());
343#endif 352#endif
344#ifdef CONFIG_KWALLETIF 353#ifdef CONFIG_KWALLETIF
345 if (kwalletEmu()) 354 if (kwalletEmu())
346 kwalletEmu()->connectDocSignals(doc); 355 kwalletEmu()->connectDocSignals(doc);
347#endif 356#endif
348 357
349 if (_tray) 358 if (_tray)
350 _tray->connectDocToTray(doc); 359 _tray->connectDocToTray(doc);
351 360
352 return doc; 361 return doc;
353 362
354} 363}
355 364
356void PwMInit::mainWndClosed(PwM *wnd) 365void PwMInit::mainWndClosed(PwM *wnd)
357{ 366{
358 bool doMinimizeToTray = false; 367 bool doMinimizeToTray = false;
359 bool doDeleteDoc = false; 368 bool doDeleteDoc = false;
360#ifndef PWM_EMBEDDED 369#ifndef PWM_EMBEDDED
361 dcopClient()->suspend(); 370 dcopClient()->suspend();
362 dcopClient()->setAcceptCalls(false); 371 dcopClient()->setAcceptCalls(false);
363#endif 372#endif
364again: 373again:
365 374
366 if (wnd->isForceMinimizeToTray()) { 375 if (wnd->isForceMinimizeToTray()) {
367 if (unlikely(!_tray)) { 376 if (unlikely(!_tray)) {
368 /* This should not happen! If we set forceMinimizeToTray , 377 /* This should not happen! If we set forceMinimizeToTray ,
369 * we must be sure that _tray exists. 378 * we must be sure that _tray exists.
370 */ 379 */
371 BUG(); 380 BUG();
372 wnd->setForceMinimizeToTray(false); 381 wnd->setForceMinimizeToTray(false);
373 goto again; 382 goto again;
374 } 383 }
375 doMinimizeToTray = true; 384 doMinimizeToTray = true;
376 } else { 385 } else {
377 // Ask to minimize to tray. If not, delete doc. 386 // Ask to minimize to tray. If not, delete doc.
378 if (_tray && 387 if (_tray &&
379 runStatus != shutdown && 388 runStatus != shutdown &&
380 !wnd->isForceQuit() && 389 !wnd->isForceQuit() &&
381 !wnd->curDoc()->isDeleted()) { 390 !wnd->curDoc()->isDeleted()) {
382 if (conf()->confWndClose()) 391 if (conf()->confWndClose())
383 doDeleteDoc = true; 392 doDeleteDoc = true;
384 else 393 else
385 doMinimizeToTray = true; 394 doMinimizeToTray = true;
386 } else { 395 } else {
387 doDeleteDoc = true; 396 doDeleteDoc = true;
388 } 397 }
389 } 398 }
390 399
391 if (doMinimizeToTray) { 400 if (doMinimizeToTray) {
392 qDebug("doMinimizeToTray "); 401 qDebug("doMinimizeToTray ");
393 PWM_ASSERT(_tray); 402 PWM_ASSERT(_tray);
394 int mmlock = conf()->confGlobMinimizeLock(); 403 int mmlock = conf()->confGlobMinimizeLock();
395 switch (mmlock) { 404 switch (mmlock) {
396 case 0: // don't lock anything 405 case 0: // don't lock anything
397 break; 406 break;
398 case 1: // normal lock 407 case 1: // normal lock
399 wnd->curDoc()->lockAll(true); 408 wnd->curDoc()->lockAll(true);
400 break; 409 break;
401 case 2: // deep-lock 410 case 2: // deep-lock
402 wnd->curDoc()->deepLock(); 411 wnd->curDoc()->deepLock();
403 break; 412 break;
404 default: 413 default:
405 WARN(); 414 WARN();
406 } 415 }
407 } else if (doDeleteDoc) { 416 } else if (doDeleteDoc) {
408 qDebug("doDeleteDoc "); 417 qDebug("doDeleteDoc ");
409 if (!wnd->curDoc()->tryDelete()) { 418 if (!wnd->curDoc()->tryDelete()) {
410 /* We failed deleting the doc, 419 /* We failed deleting the doc,
411 * so open a new window with it, again. 420 * so open a new window with it, again.
412 */ 421 */
413 createMainWnd(QString::null, false, 422 createMainWnd(QString::null, false,
414 false, wnd->curDoc()); 423 false, wnd->curDoc());
415 } 424 }
416 } 425 }
417#ifndef PWM_EMBEDDED 426#ifndef PWM_EMBEDDED
418 // find the closed window in the "mainWndList" and delete it. 427 // find the closed window in the "mainWndList" and delete it.
419 QValueList<PwM *>::iterator i = _mainWndList.begin(), 428 QValueList<PwM *>::iterator i = _mainWndList.begin(),
420 end = _mainWndList.end(); 429 end = _mainWndList.end();
421#else 430#else
422 // find the closed window in the "mainWndList" and delete it. 431 // find the closed window in the "mainWndList" and delete it.
423 QValueList<PwM *>::Iterator i = _mainWndList.begin(), 432 QValueList<PwM *>::Iterator i = _mainWndList.begin(),
424 end = _mainWndList.end(); 433 end = _mainWndList.end();
425#endif 434#endif
426 while (i != end) { 435 while (i != end) {
436 //qDebug("iii %x end %x wnd %x", (*i), (*end), wnd);
427 if (*i == wnd) { 437 if (*i == wnd) {
428#ifndef PWM_EMBEDDED 438#ifndef PWM_EMBEDDED
429 _mainWndList.erase(i); 439 _mainWndList.erase(i);
430#else 440#else
431 _mainWndList.remove(i); 441 _mainWndList.remove(i);
432#endif 442#endif
433 443
434 if ( app->mainWidget() == wnd ) { 444 if ( app->mainWidget() == wnd ) {
435 if ( _mainWndList.count() ) { 445 if ( _mainWndList.count() ) {
436#ifndef DESKTOP_VERSION 446#ifndef DESKTOP_VERSION
437 app->showMainWidget(_mainWndList.first() ); 447 app->showMainWidget(_mainWndList.first() );
438#endif //DESKTOP_VERSION 448#endif //DESKTOP_VERSION
439 449
440 } 450 }
441 } 451 }
442 delete wnd; 452 delete wnd;
443 goto out_success; 453 goto out_success;
444 } 454 }
445 ++i; 455 ++i;
446 } 456 }
447 BUG(); 457 BUG();
448out_success: 458out_success:
449#ifndef PWM_EMBEDDED 459#ifndef PWM_EMBEDDED
450 if (!_mainWndList.size()) 460 if (!_mainWndList.size())
451#else 461#else
452 if (!_mainWndList.count()) 462 if (!_mainWndList.count())
453#endif 463#endif
454 464
455 { 465 {
456 /* If there's no main window and no tray icon 466 /* If there's no main window and no tray icon
457 * left, we have no user interface, so we can 467 * left, we have no user interface, so we can
458 * shut down the application. 468 * shut down the application.
459 */ 469 */
460 if (!_tray) { 470 if (!_tray) {
461#ifndef PWM_EMBEDDED 471#ifndef PWM_EMBEDDED
462 dcopClient()->setAcceptCalls(true); 472 dcopClient()->setAcceptCalls(true);
463 dcopClient()->resume(); 473 dcopClient()->resume();
464#endif 474#endif
465 shutdownApp(0); 475 shutdownApp(0);
466 return; 476 return;
467 } 477 }
468 /* There is no widget left, so set 478 /* There is no widget left, so set
469 * _curWidget to 0 479 * _curWidget to 0
470 */ 480 */
471 resetCurWidget(); 481 resetCurWidget();
472 } 482 }
473#ifndef PWM_EMBEDDED 483#ifndef PWM_EMBEDDED
474 dcopClient()->setAcceptCalls(true); 484 dcopClient()->setAcceptCalls(true);
475 dcopClient()->resume(); 485 dcopClient()->resume();
476#endif 486#endif
477} 487}
478 488
479void PwMInit::trayIconClosed(PwMTray *tray) 489void PwMInit::trayIconClosed(PwMTray *tray)
480{ 490{
481 if (runStatus != running) 491 if (runStatus != running)
482 return; 492 return;
483 PARAM_UNUSED(tray); 493 PARAM_UNUSED(tray);
484 PWM_ASSERT(tray == _tray); 494 PWM_ASSERT(tray == _tray);
485 /* If there's no main wnd left we have to 495 /* If there's no main wnd left we have to
486 * shutdown the app (same as in mainWndClosed()) 496 * shutdown the app (same as in mainWndClosed())
487 */ 497 */
488#ifndef PWM_EMBEDDED 498#ifndef PWM_EMBEDDED
489 if (!_mainWndList.size()) 499 if (!_mainWndList.size())
490 shutdownApp(0); 500 shutdownApp(0);
491#else 501#else
492 if (!_mainWndList.count()) 502 if (!_mainWndList.count())
493 shutdownApp(0); 503 shutdownApp(0);
494#endif 504#endif
495} 505}
496 506
497void PwMInit::handleCmdLineArgs(bool initial) 507void PwMInit::handleCmdLineArgs(bool initial)
498{ 508{
499#ifndef PWM_EMBEDDED 509#ifndef PWM_EMBEDDED
500 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 510 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
501 PWM_ASSERT(args); 511 PWM_ASSERT(args);
502 int i, numArgs = args->count(); 512 int i, numArgs = args->count();
503 const char *curArg; 513 const char *curArg;
504 514
505 // read all cmdline options 515 // read all cmdline options
506 savedCmd.open_deeplocked = args->isSet("open-deeplocked"); 516 savedCmd.open_deeplocked = args->isSet("open-deeplocked");
507 savedCmd.minimized = args->isSet("minimized"); 517 savedCmd.minimized = args->isSet("minimized");
508 savedCmd.minToTray = args->isSet("mintray"); 518 savedCmd.minToTray = args->isSet("mintray");
509 savedCmd.skipSelfTest = args->isSet("skip-self-test"); 519 savedCmd.skipSelfTest = args->isSet("skip-self-test");
510 if (savedCmd.minimized && 520 if (savedCmd.minimized &&
511 savedCmd.minToTray) { 521 savedCmd.minToTray) {
512 printInfo(i18n("Commandline option \"--minimized\" and " 522 printInfo(i18n("Commandline option \"--minimized\" and "
513 "\"--mintray\" selected. These are incompatible. " 523 "\"--mintray\" selected. These are incompatible. "
514 "\"--mintray\" will be selected.").latin1()); 524 "\"--mintray\" will be selected.").latin1());
515 } 525 }
516 /* Iterate through all non-option arguments. 526 /* Iterate through all non-option arguments.
517 * Every non-option arg is a filename to open. 527 * Every non-option arg is a filename to open.
518 */ 528 */
519 for (i = 0; i < numArgs; ++i) { 529 for (i = 0; i < numArgs; ++i) {
520 curArg = args->arg(i); 530 curArg = args->arg(i);
521 PWM_ASSERT(curArg); 531 PWM_ASSERT(curArg);
522 if (savedCmd.minToTray) { 532 if (savedCmd.minToTray) {
523 PwMDoc *newDoc = createDoc(); 533 PwMDoc *newDoc = createDoc();
524 if (!newDoc->openDocUi(newDoc, 534 if (!newDoc->openDocUi(newDoc,
525 curArg, 535 curArg,
526 savedCmd.open_deeplocked)) { 536 savedCmd.open_deeplocked)) {
527 delete newDoc; 537 delete newDoc;
528 } 538 }
529 } else { 539 } else {
530 PwM *newInstance = createMainWnd(QString::null, 540 PwM *newInstance = createMainWnd(QString::null,
531 false, 541 false,
532 true, 542 true,
533 0, 543 0,
534 savedCmd.minimized); 544 savedCmd.minimized);
535 PwMDoc *newDoc = newInstance->openDoc(curArg, 545 PwMDoc *newDoc = newInstance->openDoc(curArg,
536 savedCmd.open_deeplocked); 546 savedCmd.open_deeplocked);
537 if (!newDoc) { 547 if (!newDoc) {
538 newInstance->setForceQuit(true); 548 newInstance->setForceQuit(true);
539 delete_and_null(newInstance); 549 delete_and_null(newInstance);
540 } 550 }
541 } 551 }
542 } 552 }
543 553
544 if (savedCmd.minToTray) { 554 if (savedCmd.minToTray) {
545 minimizeAllMainWnd(true); 555 minimizeAllMainWnd(true);
546 } else if (savedCmd.minimized) { 556 } else if (savedCmd.minimized) {
547 minimizeAllMainWnd(false); 557 minimizeAllMainWnd(false);
548 } 558 }
549 if (!savedCmd.skipSelfTest && initial) { 559 if (!savedCmd.skipSelfTest && initial) {
550 SelfTest::schedule(); 560 SelfTest::schedule();
551 } 561 }
552 args->clear(); 562 args->clear();
553#endif 563#endif
554} 564}
555 565
556void PwMInit::minimizeAllMainWnd(bool toTray) 566void PwMInit::minimizeAllMainWnd(bool toTray)
557{ 567{
558#ifndef PWM_EMBEDDED 568#ifndef PWM_EMBEDDED
559 if (!_mainWndList.size()) 569 if (!_mainWndList.size())
560 return; 570 return;
561#else 571#else
562 if (!_mainWndList.count()) 572 if (!_mainWndList.count())
563 return; 573 return;
564#endif 574#endif
565 const QValueList<PwM *> *ml = mainWndList(); 575 const QValueList<PwM *> *ml = mainWndList();
566#ifndef PWM_EMBEDDED 576#ifndef PWM_EMBEDDED
567 QValueList<PwM *>::const_iterator it = ml->begin(), 577 QValueList<PwM *>::const_iterator it = ml->begin(),
568 end = ml->end(); 578 end = ml->end();
569#else 579#else
570 QValueList<PwM *>::ConstIterator it = ml->begin(), 580 QValueList<PwM *>::ConstIterator it = ml->begin(),
571 end = ml->end(); 581 end = ml->end();
572#endif 582#endif
573 PwM *wnd; 583 PwM *wnd;
574 if (toTray && _tray) { 584 if (toTray && _tray) {
575 /* minimize to tray. 585 /* minimize to tray.
576 * close all mainWnd. 586 * close all mainWnd.
577 */ 587 */
578 while (it != end) { 588 while (it != end) {
579 wnd = *it; 589 wnd = *it;
580 wnd->setForceMinimizeToTray(true); 590 wnd->setForceMinimizeToTray(true);
581 wnd->close_slot(); 591 wnd->close_slot();
582 ++it; 592 ++it;
583 } 593 }
584 } else { 594 } else {
585 // normal minimize 595 // normal minimize
586 while (it != end) { 596 while (it != end) {
587 wnd = *it; 597 wnd = *it;
588 wnd->hide(); 598 wnd->hide();
589 wnd->showMinimized(); 599 wnd->showMinimized();
590 ++it; 600 ++it;
591 } 601 }
592 } 602 }
593} 603}
594 604
595#ifdef PWM_EMBEDDED 605#ifdef PWM_EMBEDDED
596 606
597#ifndef DESKTOP_VERSION 607#ifndef DESKTOP_VERSION
598 608
599PwMApplication::PwMApplication(int & argc, char ** argv) 609PwMApplication::PwMApplication(int & argc, char ** argv)
600 : QPEApplication( argc, argv ) 610 : QPEApplication( argc, argv )
601 , init (0) 611 , init (0)
602{ 612{
603 this->setKeepRunning (); 613 this->setKeepRunning ();
604} 614}
605 615
606PwMApplication::~PwMApplication() 616PwMApplication::~PwMApplication()
607{ 617{
608 delete_ifnot_null(init); 618 delete_ifnot_null(init);
609} 619}
610#else //DESKTOP_VERSION 620#else //DESKTOP_VERSION
611 621
612PwMApplication::PwMApplication(int & argc, char ** argv) 622PwMApplication::PwMApplication(int & argc, char ** argv)
613 : QApplication( argc, argv ) 623 : QApplication( argc, argv )
614 , init (0) 624 , init (0)
615{ 625{
616 setStyle( new QPlatinumStyle ()); 626 setStyle( new QPlatinumStyle ());
617 QString hdir = QDir::homeDirPath(); 627 QString hdir = QDir::homeDirPath();
618 // there is a bug when creating dirs for WIN 98 628 // there is a bug when creating dirs for WIN 98