-rw-r--r-- | kaddressbook/kabcore.cpp | 64 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 11 | ||||
-rw-r--r-- | kaddressbook/kaddressbookmain.cpp | 12 | ||||
-rw-r--r-- | kaddressbook/kaddressbookmain.h | 1 | ||||
-rw-r--r-- | kaddressbook/mainembedded.cpp | 7 |
5 files changed, 77 insertions, 18 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 11eeabc..980e436 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -123,400 +123,452 @@ $Id$ | |||
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 | ||
162 | class KAex2phonePrefs : public QDialog | 162 | class 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 | ||
202 | public: | 202 | public: |
203 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 203 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
204 | QCheckBox* mWriteToSim; | 204 | QCheckBox* mWriteToSim; |
205 | }; | 205 | }; |
206 | 206 | ||
207 | 207 | ||
208 | bool pasteWithNewUid = true; | 208 | bool pasteWithNewUid = true; |
209 | 209 | ||
210 | #ifdef KAB_EMBEDDED | 210 | #ifdef KAB_EMBEDDED |
211 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 211 | KABCore::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 |
216 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 216 | KABCore::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 | 297 | ||
298 | 298 | ||
299 | #ifndef KAB_EMBEDDED | 299 | #ifndef KAB_EMBEDDED |
300 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 300 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
301 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 301 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
302 | 302 | ||
303 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 303 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
304 | SLOT( browse( const QString& ) ) ); | 304 | SLOT( browse( const QString& ) ) ); |
305 | 305 | ||
306 | 306 | ||
307 | mAddressBookService = new KAddressBookService( this ); | 307 | mAddressBookService = new KAddressBookService( this ); |
308 | 308 | ||
309 | #endif //KAB_EMBEDDED | 309 | #endif //KAB_EMBEDDED |
310 | 310 | ||
311 | mMessageTimer = new QTimer( this ); | 311 | mMessageTimer = new QTimer( this ); |
312 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 312 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
313 | mEditorDialog = 0; | 313 | mEditorDialog = 0; |
314 | createAddresseeEditorDialog( this ); | 314 | createAddresseeEditorDialog( this ); |
315 | setModified( false ); | 315 | setModified( false ); |
316 | mBRdisabled = 0; | ||
317 | #ifndef DESKTOP_VERSION | ||
318 | infrared = 0; | ||
319 | #endif | ||
320 | toggleBeamReceive( ); | ||
316 | } | 321 | } |
317 | 322 | ||
318 | KABCore::~KABCore() | 323 | KABCore::~KABCore() |
319 | { | 324 | { |
320 | // save(); | 325 | // save(); |
321 | //saveSettings(); | 326 | //saveSettings(); |
322 | //KABPrefs::instance()->writeConfig(); | 327 | //KABPrefs::instance()->writeConfig(); |
323 | delete AddresseeConfig::instance(); | 328 | delete AddresseeConfig::instance(); |
324 | mAddressBook = 0; | 329 | mAddressBook = 0; |
325 | KABC::StdAddressBook::close(); | 330 | KABC::StdAddressBook::close(); |
326 | 331 | ||
327 | delete syncManager; | 332 | delete syncManager; |
333 | if ( infrared ) | ||
334 | delete infrared; | ||
335 | } | ||
336 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | ||
337 | { | ||
338 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); | ||
339 | if ( cmsg == "setDocument(QString)" ) { | ||
340 | QDataStream stream( data, IO_ReadOnly ); | ||
341 | QString fileName; | ||
342 | stream >> fileName; | ||
343 | recieve( fileName ); | ||
344 | return; | ||
345 | } | ||
346 | } | ||
347 | void KABCore::toggleBeamReceive( ) | ||
348 | { | ||
349 | if ( mBRdisabled ) | ||
350 | return; | ||
351 | #ifndef DESKTOP_VERSION | ||
352 | if ( infrared ) { | ||
353 | qDebug("AB disable BeamReceive "); | ||
354 | delete infrared; | ||
355 | infrared = 0; | ||
356 | mActionBR->setChecked(false); | ||
357 | return; | ||
358 | } | ||
359 | qDebug("AB enable BeamReceive "); | ||
360 | mActionBR->setChecked(true); | ||
328 | 361 | ||
362 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | ||
363 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | ||
364 | #endif | ||
329 | } | 365 | } |
330 | 366 | ||
367 | |||
368 | void KABCore::disableBR(bool b) | ||
369 | { | ||
370 | if ( b ) { | ||
371 | if ( infrared ) { | ||
372 | toggleBeamReceive( ); | ||
373 | mBRdisabled = true; | ||
374 | } | ||
375 | } else { | ||
376 | if ( mBRdisabled ) { | ||
377 | mBRdisabled = false; | ||
378 | toggleBeamReceive( ); | ||
379 | } | ||
380 | } | ||
381 | |||
382 | } | ||
331 | void KABCore::recieve( QString fn ) | 383 | void KABCore::recieve( QString fn ) |
332 | { | 384 | { |
333 | //qDebug("KABCore::recieve "); | 385 | //qDebug("KABCore::recieve "); |
334 | int count = mAddressBook->importFromFile( fn, true ); | 386 | int count = mAddressBook->importFromFile( fn, true ); |
335 | mViewManager->refreshView(); | 387 | mViewManager->refreshView(); |
336 | message(i18n("%1 contact(s) received!").arg( count )); | 388 | message(i18n("%1 contact(s) received!").arg( count )); |
337 | topLevelWidget()->showMaximized(); | 389 | topLevelWidget()->showMaximized(); |
338 | topLevelWidget()->raise(); | 390 | topLevelWidget()->raise(); |
339 | } | 391 | } |
340 | void KABCore::restoreSettings() | 392 | void KABCore::restoreSettings() |
341 | { | 393 | { |
342 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 394 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
343 | 395 | ||
344 | bool state; | 396 | bool state; |
345 | 397 | ||
346 | if (mMultipleViewsAtOnce) | 398 | if (mMultipleViewsAtOnce) |
347 | state = KABPrefs::instance()->mDetailsPageVisible; | 399 | state = KABPrefs::instance()->mDetailsPageVisible; |
348 | else | 400 | else |
349 | state = false; | 401 | state = false; |
350 | 402 | ||
351 | mActionDetails->setChecked( state ); | 403 | mActionDetails->setChecked( state ); |
352 | setDetailsVisible( state ); | 404 | setDetailsVisible( state ); |
353 | 405 | ||
354 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 406 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
355 | 407 | ||
356 | mActionJumpBar->setChecked( state ); | 408 | mActionJumpBar->setChecked( state ); |
357 | setJumpButtonBarVisible( state ); | 409 | setJumpButtonBarVisible( state ); |
358 | /*US | 410 | /*US |
359 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 411 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
360 | if ( splitterSize.count() == 0 ) { | 412 | if ( splitterSize.count() == 0 ) { |
361 | splitterSize.append( width() / 2 ); | 413 | splitterSize.append( width() / 2 ); |
362 | splitterSize.append( width() / 2 ); | 414 | splitterSize.append( width() / 2 ); |
363 | } | 415 | } |
364 | mMiniSplitter->setSizes( splitterSize ); | 416 | mMiniSplitter->setSizes( splitterSize ); |
365 | if ( mExtensionBarSplitter ) { | 417 | if ( mExtensionBarSplitter ) { |
366 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 418 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
367 | if ( splitterSize.count() == 0 ) { | 419 | if ( splitterSize.count() == 0 ) { |
368 | splitterSize.append( width() / 2 ); | 420 | splitterSize.append( width() / 2 ); |
369 | splitterSize.append( width() / 2 ); | 421 | splitterSize.append( width() / 2 ); |
370 | } | 422 | } |
371 | mExtensionBarSplitter->setSizes( splitterSize ); | 423 | mExtensionBarSplitter->setSizes( splitterSize ); |
372 | 424 | ||
373 | } | 425 | } |
374 | */ | 426 | */ |
375 | mViewManager->restoreSettings(); | 427 | mViewManager->restoreSettings(); |
376 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 428 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
377 | mExtensionManager->restoreSettings(); | 429 | mExtensionManager->restoreSettings(); |
378 | #ifdef DESKTOP_VERSION | 430 | #ifdef DESKTOP_VERSION |
379 | int wid = width(); | 431 | int wid = width(); |
380 | if ( wid < 10 ) | 432 | if ( wid < 10 ) |
381 | wid = 400; | 433 | wid = 400; |
382 | #else | 434 | #else |
383 | int wid = QApplication::desktop()->width(); | 435 | int wid = QApplication::desktop()->width(); |
384 | if ( wid < 640 ) | 436 | if ( wid < 640 ) |
385 | wid = QApplication::desktop()->height(); | 437 | wid = QApplication::desktop()->height(); |
386 | #endif | 438 | #endif |
387 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 439 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
388 | if ( true /*splitterSize.count() == 0*/ ) { | 440 | if ( true /*splitterSize.count() == 0*/ ) { |
389 | splitterSize.append( wid / 2 ); | 441 | splitterSize.append( wid / 2 ); |
390 | splitterSize.append( wid / 2 ); | 442 | splitterSize.append( wid / 2 ); |
391 | } | 443 | } |
392 | mMiniSplitter->setSizes( splitterSize ); | 444 | mMiniSplitter->setSizes( splitterSize ); |
393 | if ( mExtensionBarSplitter ) { | 445 | if ( mExtensionBarSplitter ) { |
394 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 446 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
395 | if ( true /*splitterSize.count() == 0*/ ) { | 447 | if ( true /*splitterSize.count() == 0*/ ) { |
396 | splitterSize.append( wid / 2 ); | 448 | splitterSize.append( wid / 2 ); |
397 | splitterSize.append( wid / 2 ); | 449 | splitterSize.append( wid / 2 ); |
398 | } | 450 | } |
399 | mExtensionBarSplitter->setSizes( splitterSize ); | 451 | mExtensionBarSplitter->setSizes( splitterSize ); |
400 | 452 | ||
401 | } | 453 | } |
402 | 454 | ||
403 | 455 | ||
404 | } | 456 | } |
405 | 457 | ||
406 | void KABCore::saveSettings() | 458 | void KABCore::saveSettings() |
407 | { | 459 | { |
408 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 460 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
409 | if ( mExtensionBarSplitter ) | 461 | if ( mExtensionBarSplitter ) |
410 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 462 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
411 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 463 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
412 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 464 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
413 | #ifndef KAB_EMBEDDED | 465 | #ifndef KAB_EMBEDDED |
414 | 466 | ||
415 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 467 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
416 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 468 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
417 | #endif //KAB_EMBEDDED | 469 | #endif //KAB_EMBEDDED |
418 | mExtensionManager->saveSettings(); | 470 | mExtensionManager->saveSettings(); |
419 | mViewManager->saveSettings(); | 471 | mViewManager->saveSettings(); |
420 | 472 | ||
421 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 473 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
422 | } | 474 | } |
423 | 475 | ||
424 | KABC::AddressBook *KABCore::addressBook() const | 476 | KABC::AddressBook *KABCore::addressBook() const |
425 | { | 477 | { |
426 | return mAddressBook; | 478 | return mAddressBook; |
427 | } | 479 | } |
428 | 480 | ||
429 | KConfig *KABCore::config() | 481 | KConfig *KABCore::config() |
430 | { | 482 | { |
431 | #ifndef KAB_EMBEDDED | 483 | #ifndef KAB_EMBEDDED |
432 | return KABPrefs::instance()->config(); | 484 | return KABPrefs::instance()->config(); |
433 | #else //KAB_EMBEDDED | 485 | #else //KAB_EMBEDDED |
434 | return KABPrefs::instance()->getConfig(); | 486 | return KABPrefs::instance()->getConfig(); |
435 | #endif //KAB_EMBEDDED | 487 | #endif //KAB_EMBEDDED |
436 | } | 488 | } |
437 | 489 | ||
438 | KActionCollection *KABCore::actionCollection() const | 490 | KActionCollection *KABCore::actionCollection() const |
439 | { | 491 | { |
440 | return mGUIClient->actionCollection(); | 492 | return mGUIClient->actionCollection(); |
441 | } | 493 | } |
442 | 494 | ||
443 | KABC::Field *KABCore::currentSearchField() const | 495 | KABC::Field *KABCore::currentSearchField() const |
444 | { | 496 | { |
445 | if (mIncSearchWidget) | 497 | if (mIncSearchWidget) |
446 | return mIncSearchWidget->currentField(); | 498 | return mIncSearchWidget->currentField(); |
447 | else | 499 | else |
448 | return 0; | 500 | return 0; |
449 | } | 501 | } |
450 | 502 | ||
451 | QStringList KABCore::selectedUIDs() const | 503 | QStringList KABCore::selectedUIDs() const |
452 | { | 504 | { |
453 | return mViewManager->selectedUids(); | 505 | return mViewManager->selectedUids(); |
454 | } | 506 | } |
455 | 507 | ||
456 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 508 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
457 | { | 509 | { |
458 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 510 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
459 | 511 | ||
460 | QPtrList<KRES::Resource> kresResources; | 512 | QPtrList<KRES::Resource> kresResources; |
461 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 513 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
462 | KABC::Resource *resource; | 514 | KABC::Resource *resource; |
463 | while ( ( resource = resIt.current() ) != 0 ) { | 515 | while ( ( resource = resIt.current() ) != 0 ) { |
464 | ++resIt; | 516 | ++resIt; |
465 | if ( !resource->readOnly() ) { | 517 | if ( !resource->readOnly() ) { |
466 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 518 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
467 | if ( res ) | 519 | if ( res ) |
468 | kresResources.append( res ); | 520 | kresResources.append( res ); |
469 | } | 521 | } |
470 | } | 522 | } |
471 | 523 | ||
472 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 524 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
473 | return static_cast<KABC::Resource*>( res ); | 525 | return static_cast<KABC::Resource*>( res ); |
474 | } | 526 | } |
475 | 527 | ||
476 | #ifndef KAB_EMBEDDED | 528 | #ifndef KAB_EMBEDDED |
477 | KAboutData *KABCore::createAboutData() | 529 | KAboutData *KABCore::createAboutData() |
478 | #else //KAB_EMBEDDED | 530 | #else //KAB_EMBEDDED |
479 | void KABCore::createAboutData() | 531 | void KABCore::createAboutData() |
480 | #endif //KAB_EMBEDDED | 532 | #endif //KAB_EMBEDDED |
481 | { | 533 | { |
482 | #ifndef KAB_EMBEDDED | 534 | #ifndef KAB_EMBEDDED |
483 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 535 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
484 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 536 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
485 | KAboutData::License_GPL_V2, | 537 | KAboutData::License_GPL_V2, |
486 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 538 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
487 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 539 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
488 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 540 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |
489 | about->addAuthor( "Cornelius Schumacher", | 541 | about->addAuthor( "Cornelius Schumacher", |
490 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), | 542 | I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), |
491 | "schumacher@kde.org" ); | 543 | "schumacher@kde.org" ); |
492 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), | 544 | about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), |
493 | "mpilone@slac.com" ); | 545 | "mpilone@slac.com" ); |
494 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); | 546 | about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); |
495 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); | 547 | about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); |
496 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), | 548 | about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), |
497 | "michel@klaralvdalens-datakonsult.se" ); | 549 | "michel@klaralvdalens-datakonsult.se" ); |
498 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), | 550 | about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), |
499 | "hansen@kde.org" ); | 551 | "hansen@kde.org" ); |
500 | 552 | ||
501 | return about; | 553 | return about; |
502 | #endif //KAB_EMBEDDED | 554 | #endif //KAB_EMBEDDED |
503 | 555 | ||
504 | QString version; | 556 | QString version; |
505 | #include <../version> | 557 | #include <../version> |
506 | QMessageBox::about( this, "About KAddressbook/Pi", | 558 | QMessageBox::about( this, "About KAddressbook/Pi", |
507 | "KAddressbook/Platform-independent\n" | 559 | "KAddressbook/Platform-independent\n" |
508 | "(KA/Pi) " +version + " - " + | 560 | "(KA/Pi) " +version + " - " + |
509 | #ifdef DESKTOP_VERSION | 561 | #ifdef DESKTOP_VERSION |
510 | "Desktop Edition\n" | 562 | "Desktop Edition\n" |
511 | #else | 563 | #else |
512 | "PDA-Edition\n" | 564 | "PDA-Edition\n" |
513 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 565 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
514 | #endif | 566 | #endif |
515 | 567 | ||
516 | "(c) 2004 Ulf Schenk\n" | 568 | "(c) 2004 Ulf Schenk\n" |
517 | "(c) 2004 Lutz Rogowski\n" | 569 | "(c) 2004 Lutz Rogowski\n" |
518 | "(c) 1997-2003, The KDE PIM Team\n" | 570 | "(c) 1997-2003, The KDE PIM Team\n" |
519 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" | 571 | "Tobias Koenig Current maintainer\ntokoe@kde.org\n" |
520 | "Don Sanders Original author\n" | 572 | "Don Sanders Original author\n" |
521 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" | 573 | "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" |
522 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" | 574 | "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" |
@@ -1595,554 +1647,562 @@ void KABCore::initGUI() | |||
1595 | #else //KAB_NOSPLITTER | 1647 | #else //KAB_NOSPLITTER |
1596 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1648 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1597 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1649 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1598 | topLayout->setSpacing( 10 ); | 1650 | topLayout->setSpacing( 10 ); |
1599 | 1651 | ||
1600 | // mDetailsSplitter = new QSplitter( this ); | 1652 | // mDetailsSplitter = new QSplitter( this ); |
1601 | 1653 | ||
1602 | QVBox *viewSpace = new QVBox( this ); | 1654 | QVBox *viewSpace = new QVBox( this ); |
1603 | 1655 | ||
1604 | mViewManager = new ViewManager( this, viewSpace ); | 1656 | mViewManager = new ViewManager( this, viewSpace ); |
1605 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1657 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1606 | 1658 | ||
1607 | mDetails = new ViewContainer( this ); | 1659 | mDetails = new ViewContainer( this ); |
1608 | 1660 | ||
1609 | topLayout->addWidget( viewSpace ); | 1661 | topLayout->addWidget( viewSpace ); |
1610 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1662 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1611 | topLayout->addWidget( mDetails ); | 1663 | topLayout->addWidget( mDetails ); |
1612 | #endif //KAB_NOSPLITTER | 1664 | #endif //KAB_NOSPLITTER |
1613 | */ | 1665 | */ |
1614 | 1666 | ||
1615 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1667 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1616 | syncManager->setBlockSave(false); | 1668 | syncManager->setBlockSave(false); |
1617 | 1669 | ||
1618 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1670 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
1619 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1671 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1620 | syncManager->setDefaultFileName( sentSyncFile()); | 1672 | syncManager->setDefaultFileName( sentSyncFile()); |
1621 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1673 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1622 | 1674 | ||
1623 | #endif //KAB_EMBEDDED | 1675 | #endif //KAB_EMBEDDED |
1624 | initActions(); | 1676 | initActions(); |
1625 | 1677 | ||
1626 | #ifdef KAB_EMBEDDED | 1678 | #ifdef KAB_EMBEDDED |
1627 | addActionsManually(); | 1679 | addActionsManually(); |
1628 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1680 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1629 | mXXPortManager = new XXPortManager( this, this ); | 1681 | mXXPortManager = new XXPortManager( this, this ); |
1630 | 1682 | ||
1631 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1683 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1632 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1684 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1633 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1685 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1634 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1686 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1635 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1687 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1636 | // mIncSearchWidget->hide(); | 1688 | // mIncSearchWidget->hide(); |
1637 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1689 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1638 | SLOT( incrementalSearch( const QString& ) ) ); | 1690 | SLOT( incrementalSearch( const QString& ) ) ); |
1639 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | 1691 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); |
1640 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | 1692 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); |
1641 | 1693 | ||
1642 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1694 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1643 | 1695 | ||
1644 | topLayout->addWidget( mJumpButtonBar ); | 1696 | topLayout->addWidget( mJumpButtonBar ); |
1645 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1697 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1646 | 1698 | ||
1647 | // mMainWindow->getIconToolBar()->raise(); | 1699 | // mMainWindow->getIconToolBar()->raise(); |
1648 | 1700 | ||
1649 | #endif //KAB_EMBEDDED | 1701 | #endif //KAB_EMBEDDED |
1650 | 1702 | ||
1651 | } | 1703 | } |
1652 | void KABCore::initActions() | 1704 | void KABCore::initActions() |
1653 | { | 1705 | { |
1654 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1706 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1655 | 1707 | ||
1656 | #ifndef KAB_EMBEDDED | 1708 | #ifndef KAB_EMBEDDED |
1657 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1709 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1658 | SLOT( clipboardDataChanged() ) ); | 1710 | SLOT( clipboardDataChanged() ) ); |
1659 | #endif //KAB_EMBEDDED | 1711 | #endif //KAB_EMBEDDED |
1660 | 1712 | ||
1661 | // file menu | 1713 | // file menu |
1662 | if ( mIsPart ) { | 1714 | if ( mIsPart ) { |
1663 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1715 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1664 | SLOT( sendMail() ), actionCollection(), | 1716 | SLOT( sendMail() ), actionCollection(), |
1665 | "kaddressbook_mail" ); | 1717 | "kaddressbook_mail" ); |
1666 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1718 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1667 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1719 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1668 | 1720 | ||
1669 | } else { | 1721 | } else { |
1670 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1722 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1671 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1723 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1672 | } | 1724 | } |
1673 | 1725 | ||
1674 | 1726 | ||
1675 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1727 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1676 | SLOT( save() ), actionCollection(), "file_sync" ); | 1728 | SLOT( save() ), actionCollection(), "file_sync" ); |
1677 | 1729 | ||
1678 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1730 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1679 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1731 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1680 | 1732 | ||
1681 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1733 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1682 | this, SLOT( mailVCard() ), | 1734 | this, SLOT( mailVCard() ), |
1683 | actionCollection(), "file_mail_vcard"); | 1735 | actionCollection(), "file_mail_vcard"); |
1684 | 1736 | ||
1685 | mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, | 1737 | mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, |
1686 | SLOT( export2phone() ), actionCollection(), | 1738 | SLOT( export2phone() ), actionCollection(), |
1687 | "kaddressbook_ex2phone" ); | 1739 | "kaddressbook_ex2phone" ); |
1688 | 1740 | ||
1689 | mActionBeamVCard = 0; | 1741 | mActionBeamVCard = 0; |
1690 | mActionBeam = 0; | 1742 | mActionBeam = 0; |
1691 | 1743 | ||
1692 | #ifndef DESKTOP_VERSION | 1744 | #ifndef DESKTOP_VERSION |
1693 | if ( Ir::supported() ) { | 1745 | if ( Ir::supported() ) { |
1694 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1746 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1695 | SLOT( beamVCard() ), actionCollection(), | 1747 | SLOT( beamVCard() ), actionCollection(), |
1696 | "kaddressbook_beam_vcard" ); | 1748 | "kaddressbook_beam_vcard" ); |
1697 | 1749 | ||
1698 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1750 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1699 | SLOT( beamMySelf() ), actionCollection(), | 1751 | SLOT( beamMySelf() ), actionCollection(), |
1700 | "kaddressbook_beam_myself" ); | 1752 | "kaddressbook_beam_myself" ); |
1701 | } | 1753 | } |
1702 | #endif | 1754 | #endif |
1703 | 1755 | ||
1704 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1756 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1705 | this, SLOT( editContact2() ), | 1757 | this, SLOT( editContact2() ), |
1706 | actionCollection(), "file_properties" ); | 1758 | actionCollection(), "file_properties" ); |
1707 | 1759 | ||
1708 | #ifdef KAB_EMBEDDED | 1760 | #ifdef KAB_EMBEDDED |
1709 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1761 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1710 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1762 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1711 | mMainWindow, SLOT( exit() ), | 1763 | mMainWindow, SLOT( exit() ), |
1712 | actionCollection(), "quit" ); | 1764 | actionCollection(), "quit" ); |
1713 | #endif //KAB_EMBEDDED | 1765 | #endif //KAB_EMBEDDED |
1714 | 1766 | ||
1715 | // edit menu | 1767 | // edit menu |
1716 | if ( mIsPart ) { | 1768 | if ( mIsPart ) { |
1717 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1769 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1718 | SLOT( copyContacts() ), actionCollection(), | 1770 | SLOT( copyContacts() ), actionCollection(), |
1719 | "kaddressbook_copy" ); | 1771 | "kaddressbook_copy" ); |
1720 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1772 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1721 | SLOT( cutContacts() ), actionCollection(), | 1773 | SLOT( cutContacts() ), actionCollection(), |
1722 | "kaddressbook_cut" ); | 1774 | "kaddressbook_cut" ); |
1723 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1775 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1724 | SLOT( pasteContacts() ), actionCollection(), | 1776 | SLOT( pasteContacts() ), actionCollection(), |
1725 | "kaddressbook_paste" ); | 1777 | "kaddressbook_paste" ); |
1726 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1778 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1727 | SLOT( selectAllContacts() ), actionCollection(), | 1779 | SLOT( selectAllContacts() ), actionCollection(), |
1728 | "kaddressbook_select_all" ); | 1780 | "kaddressbook_select_all" ); |
1729 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1781 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1730 | SLOT( undo() ), actionCollection(), | 1782 | SLOT( undo() ), actionCollection(), |
1731 | "kaddressbook_undo" ); | 1783 | "kaddressbook_undo" ); |
1732 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1784 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1733 | this, SLOT( redo() ), actionCollection(), | 1785 | this, SLOT( redo() ), actionCollection(), |
1734 | "kaddressbook_redo" ); | 1786 | "kaddressbook_redo" ); |
1735 | } else { | 1787 | } else { |
1736 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1788 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1737 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1789 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1738 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1790 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1739 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1791 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1740 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1792 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1741 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1793 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1742 | } | 1794 | } |
1743 | 1795 | ||
1744 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1796 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1745 | Key_Delete, this, SLOT( deleteContacts() ), | 1797 | Key_Delete, this, SLOT( deleteContacts() ), |
1746 | actionCollection(), "edit_delete" ); | 1798 | actionCollection(), "edit_delete" ); |
1747 | 1799 | ||
1748 | mActionUndo->setEnabled( false ); | 1800 | mActionUndo->setEnabled( false ); |
1749 | mActionRedo->setEnabled( false ); | 1801 | mActionRedo->setEnabled( false ); |
1750 | 1802 | ||
1751 | // settings menu | 1803 | // settings menu |
1752 | #ifdef KAB_EMBEDDED | 1804 | #ifdef KAB_EMBEDDED |
1753 | //US special menuentry to configure the addressbook resources. On KDE | 1805 | //US special menuentry to configure the addressbook resources. On KDE |
1754 | // you do that through the control center !!! | 1806 | // you do that through the control center !!! |
1755 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1807 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1756 | SLOT( configureResources() ), actionCollection(), | 1808 | SLOT( configureResources() ), actionCollection(), |
1757 | "kaddressbook_configure_resources" ); | 1809 | "kaddressbook_configure_resources" ); |
1758 | #endif //KAB_EMBEDDED | 1810 | #endif //KAB_EMBEDDED |
1759 | 1811 | ||
1760 | if ( mIsPart ) { | 1812 | if ( mIsPart ) { |
1761 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1813 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1762 | SLOT( openConfigDialog() ), actionCollection(), | 1814 | SLOT( openConfigDialog() ), actionCollection(), |
1763 | "kaddressbook_configure" ); | 1815 | "kaddressbook_configure" ); |
1764 | 1816 | ||
1765 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1817 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1766 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1818 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1767 | "kaddressbook_configure_shortcuts" ); | 1819 | "kaddressbook_configure_shortcuts" ); |
1768 | #ifdef KAB_EMBEDDED | 1820 | #ifdef KAB_EMBEDDED |
1769 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1821 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1770 | mActionConfigureToolbars->setEnabled( false ); | 1822 | mActionConfigureToolbars->setEnabled( false ); |
1771 | #endif //KAB_EMBEDDED | 1823 | #endif //KAB_EMBEDDED |
1772 | 1824 | ||
1773 | } else { | 1825 | } else { |
1774 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1826 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1775 | 1827 | ||
1776 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1828 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1777 | } | 1829 | } |
1778 | 1830 | ||
1779 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1831 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1780 | actionCollection(), "options_show_jump_bar" ); | 1832 | actionCollection(), "options_show_jump_bar" ); |
1781 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1833 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1782 | 1834 | ||
1783 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1835 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1784 | actionCollection(), "options_show_details" ); | 1836 | actionCollection(), "options_show_details" ); |
1785 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1837 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1786 | 1838 | ||
1839 | |||
1840 | mActionBR = new KToggleAction( i18n( "Beam receice enabled" ), "beam", 0, this, | ||
1841 | SLOT( toggleBeamReceive() ), actionCollection(), | ||
1842 | "kaddressbook_beam_rec" ); | ||
1843 | |||
1844 | |||
1787 | // misc | 1845 | // misc |
1788 | // only enable LDAP lookup if we can handle the protocol | 1846 | // only enable LDAP lookup if we can handle the protocol |
1789 | #ifndef KAB_EMBEDDED | 1847 | #ifndef KAB_EMBEDDED |
1790 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1848 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1791 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1849 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1792 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1850 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1793 | "ldap_lookup" ); | 1851 | "ldap_lookup" ); |
1794 | } | 1852 | } |
1795 | #else //KAB_EMBEDDED | 1853 | #else //KAB_EMBEDDED |
1796 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1854 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1797 | #endif //KAB_EMBEDDED | 1855 | #endif //KAB_EMBEDDED |
1798 | 1856 | ||
1799 | 1857 | ||
1800 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1858 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1801 | SLOT( setWhoAmI() ), actionCollection(), | 1859 | SLOT( setWhoAmI() ), actionCollection(), |
1802 | "set_personal" ); | 1860 | "set_personal" ); |
1803 | 1861 | ||
1804 | 1862 | ||
1805 | 1863 | ||
1806 | 1864 | ||
1807 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1865 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1808 | SLOT( setCategories() ), actionCollection(), | 1866 | SLOT( setCategories() ), actionCollection(), |
1809 | "edit_set_categories" ); | 1867 | "edit_set_categories" ); |
1810 | 1868 | ||
1811 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1869 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1812 | SLOT( removeVoice() ), actionCollection(), | 1870 | SLOT( removeVoice() ), actionCollection(), |
1813 | "remove_voice" ); | 1871 | "remove_voice" ); |
1814 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 1872 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
1815 | SLOT( importFromOL() ), actionCollection(), | 1873 | SLOT( importFromOL() ), actionCollection(), |
1816 | "import_OL" ); | 1874 | "import_OL" ); |
1817 | #ifdef KAB_EMBEDDED | 1875 | #ifdef KAB_EMBEDDED |
1818 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 1876 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
1819 | this, SLOT( showLicence() ), actionCollection(), | 1877 | this, SLOT( showLicence() ), actionCollection(), |
1820 | "licence_about_data" ); | 1878 | "licence_about_data" ); |
1821 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 1879 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
1822 | this, SLOT( faq() ), actionCollection(), | 1880 | this, SLOT( faq() ), actionCollection(), |
1823 | "faq_about_data" ); | 1881 | "faq_about_data" ); |
1824 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 1882 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
1825 | this, SLOT( whatsnew() ), actionCollection(), | 1883 | this, SLOT( whatsnew() ), actionCollection(), |
1826 | "wn" ); | 1884 | "wn" ); |
1827 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 1885 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
1828 | this, SLOT( synchowto() ), actionCollection(), | 1886 | this, SLOT( synchowto() ), actionCollection(), |
1829 | "sync" ); | 1887 | "sync" ); |
1830 | 1888 | ||
1831 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1889 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1832 | this, SLOT( createAboutData() ), actionCollection(), | 1890 | this, SLOT( createAboutData() ), actionCollection(), |
1833 | "kaddressbook_about_data" ); | 1891 | "kaddressbook_about_data" ); |
1834 | #endif //KAB_EMBEDDED | 1892 | #endif //KAB_EMBEDDED |
1835 | 1893 | ||
1836 | clipboardDataChanged(); | 1894 | clipboardDataChanged(); |
1837 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1895 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1838 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1896 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1839 | } | 1897 | } |
1840 | 1898 | ||
1841 | //US we need this function, to plug all actions into the correct menues. | 1899 | //US we need this function, to plug all actions into the correct menues. |
1842 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1900 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1843 | void KABCore::addActionsManually() | 1901 | void KABCore::addActionsManually() |
1844 | { | 1902 | { |
1845 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1903 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1846 | 1904 | ||
1847 | #ifdef KAB_EMBEDDED | 1905 | #ifdef KAB_EMBEDDED |
1848 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1906 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1849 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1907 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1850 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1908 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1851 | 1909 | ||
1852 | KToolBar* tb = mMainWindow->toolBar(); | 1910 | KToolBar* tb = mMainWindow->toolBar(); |
1853 | 1911 | ||
1854 | #ifdef DESKTOP_VERSION | 1912 | #ifdef DESKTOP_VERSION |
1855 | QMenuBar* mb = mMainWindow->menuBar(); | 1913 | QMenuBar* mb = mMainWindow->menuBar(); |
1856 | 1914 | ||
1857 | //US setup menubar. | 1915 | //US setup menubar. |
1858 | //Disable the following block if you do not want to have a menubar. | 1916 | //Disable the following block if you do not want to have a menubar. |
1859 | mb->insertItem( "&File", fileMenu ); | 1917 | mb->insertItem( "&File", fileMenu ); |
1860 | mb->insertItem( "&Edit", editMenu ); | 1918 | mb->insertItem( "&Edit", editMenu ); |
1861 | mb->insertItem( "&View", viewMenu ); | 1919 | mb->insertItem( "&View", viewMenu ); |
1862 | mb->insertItem( "&Settings", settingsMenu ); | 1920 | mb->insertItem( "&Settings", settingsMenu ); |
1863 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 1921 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
1864 | mb->insertItem( "&Change selected", changeMenu ); | 1922 | mb->insertItem( "&Change selected", changeMenu ); |
1865 | mb->insertItem( "&Help", helpMenu ); | 1923 | mb->insertItem( "&Help", helpMenu ); |
1866 | mIncSearchWidget = new IncSearchWidget( tb ); | 1924 | mIncSearchWidget = new IncSearchWidget( tb ); |
1867 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1925 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1868 | 1926 | ||
1869 | #else | 1927 | #else |
1870 | //US setup toolbar | 1928 | //US setup toolbar |
1871 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 1929 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
1872 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1930 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1873 | menuBarTB->insertItem( "ME", popupBarTB); | 1931 | menuBarTB->insertItem( "ME", popupBarTB); |
1874 | tb->insertWidget(-1, 0, menuBarTB); | 1932 | tb->insertWidget(-1, 0, menuBarTB); |
1875 | mIncSearchWidget = new IncSearchWidget( tb ); | 1933 | mIncSearchWidget = new IncSearchWidget( tb ); |
1876 | 1934 | ||
1877 | tb->enableMoving(false); | 1935 | tb->enableMoving(false); |
1878 | popupBarTB->insertItem( "&File", fileMenu ); | 1936 | popupBarTB->insertItem( "&File", fileMenu ); |
1879 | popupBarTB->insertItem( "&Edit", editMenu ); | 1937 | popupBarTB->insertItem( "&Edit", editMenu ); |
1880 | popupBarTB->insertItem( "&View", viewMenu ); | 1938 | popupBarTB->insertItem( "&View", viewMenu ); |
1881 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1939 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1882 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 1940 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
1883 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1941 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1884 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1942 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1885 | popupBarTB->insertItem( "&Help", helpMenu ); | 1943 | popupBarTB->insertItem( "&Help", helpMenu ); |
1886 | if (QApplication::desktop()->width() > 320 ) { | 1944 | if (QApplication::desktop()->width() > 320 ) { |
1887 | // mViewManager->getFilterAction()->plug ( tb); | 1945 | // mViewManager->getFilterAction()->plug ( tb); |
1888 | } | 1946 | } |
1889 | #endif | 1947 | #endif |
1890 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1948 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1891 | 1949 | ||
1892 | 1950 | ||
1893 | 1951 | ||
1894 | //US Now connect the actions with the menue entries. | 1952 | //US Now connect the actions with the menue entries. |
1895 | mActionPrint->plug( fileMenu ); | 1953 | mActionPrint->plug( fileMenu ); |
1896 | mActionMail->plug( fileMenu ); | 1954 | mActionMail->plug( fileMenu ); |
1897 | fileMenu->insertSeparator(); | 1955 | fileMenu->insertSeparator(); |
1898 | 1956 | ||
1899 | mActionNewContact->plug( fileMenu ); | 1957 | mActionNewContact->plug( fileMenu ); |
1900 | mActionNewContact->plug( tb ); | 1958 | mActionNewContact->plug( tb ); |
1901 | 1959 | ||
1902 | mActionEditAddressee->plug( fileMenu ); | 1960 | mActionEditAddressee->plug( fileMenu ); |
1903 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 1961 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
1904 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 1962 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
1905 | mActionEditAddressee->plug( tb ); | 1963 | mActionEditAddressee->plug( tb ); |
1906 | 1964 | ||
1907 | fileMenu->insertSeparator(); | 1965 | fileMenu->insertSeparator(); |
1908 | mActionSave->plug( fileMenu ); | 1966 | mActionSave->plug( fileMenu ); |
1909 | fileMenu->insertItem( "&Import", ImportMenu ); | 1967 | fileMenu->insertItem( "&Import", ImportMenu ); |
1910 | fileMenu->insertItem( "&Export", ExportMenu ); | 1968 | fileMenu->insertItem( "&Export", ExportMenu ); |
1911 | fileMenu->insertSeparator(); | 1969 | fileMenu->insertSeparator(); |
1912 | mActionMailVCard->plug( fileMenu ); | 1970 | mActionMailVCard->plug( fileMenu ); |
1913 | #ifndef DESKTOP_VERSION | 1971 | #ifndef DESKTOP_VERSION |
1914 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 1972 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
1915 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 1973 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
1916 | #endif | 1974 | #endif |
1917 | fileMenu->insertSeparator(); | 1975 | fileMenu->insertSeparator(); |
1918 | mActionQuit->plug( fileMenu ); | 1976 | mActionQuit->plug( fileMenu ); |
1919 | #ifdef _WIN32_ | 1977 | #ifdef _WIN32_ |
1920 | mActionImportOL->plug( ImportMenu ); | 1978 | mActionImportOL->plug( ImportMenu ); |
1921 | #endif | 1979 | #endif |
1922 | // edit menu | 1980 | // edit menu |
1923 | mActionUndo->plug( editMenu ); | 1981 | mActionUndo->plug( editMenu ); |
1924 | mActionRedo->plug( editMenu ); | 1982 | mActionRedo->plug( editMenu ); |
1925 | editMenu->insertSeparator(); | 1983 | editMenu->insertSeparator(); |
1926 | mActionCut->plug( editMenu ); | 1984 | mActionCut->plug( editMenu ); |
1927 | mActionCopy->plug( editMenu ); | 1985 | mActionCopy->plug( editMenu ); |
1928 | mActionPaste->plug( editMenu ); | 1986 | mActionPaste->plug( editMenu ); |
1929 | mActionDelete->plug( editMenu ); | 1987 | mActionDelete->plug( editMenu ); |
1930 | editMenu->insertSeparator(); | 1988 | editMenu->insertSeparator(); |
1931 | mActionSelectAll->plug( editMenu ); | 1989 | mActionSelectAll->plug( editMenu ); |
1932 | 1990 | ||
1933 | mActionRemoveVoice->plug( changeMenu ); | 1991 | mActionRemoveVoice->plug( changeMenu ); |
1934 | // settings menu | 1992 | // settings menu |
1935 | //US special menuentry to configure the addressbook resources. On KDE | 1993 | //US special menuentry to configure the addressbook resources. On KDE |
1936 | // you do that through the control center !!! | 1994 | // you do that through the control center !!! |
1937 | mActionConfigResources->plug( settingsMenu ); | 1995 | mActionConfigResources->plug( settingsMenu ); |
1938 | settingsMenu->insertSeparator(); | 1996 | settingsMenu->insertSeparator(); |
1939 | 1997 | ||
1940 | mActionConfigKAddressbook->plug( settingsMenu ); | 1998 | mActionConfigKAddressbook->plug( settingsMenu ); |
1941 | 1999 | ||
1942 | if ( mIsPart ) { | 2000 | if ( mIsPart ) { |
1943 | mActionConfigShortcuts->plug( settingsMenu ); | 2001 | mActionConfigShortcuts->plug( settingsMenu ); |
1944 | mActionConfigureToolbars->plug( settingsMenu ); | 2002 | mActionConfigureToolbars->plug( settingsMenu ); |
1945 | 2003 | ||
1946 | } else { | 2004 | } else { |
1947 | mActionKeyBindings->plug( settingsMenu ); | 2005 | mActionKeyBindings->plug( settingsMenu ); |
1948 | } | 2006 | } |
1949 | 2007 | ||
1950 | settingsMenu->insertSeparator(); | 2008 | settingsMenu->insertSeparator(); |
1951 | 2009 | ||
1952 | mActionJumpBar->plug( settingsMenu ); | 2010 | mActionJumpBar->plug( settingsMenu ); |
1953 | mActionDetails->plug( settingsMenu ); | 2011 | mActionDetails->plug( settingsMenu ); |
1954 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2012 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
1955 | mActionDetails->plug( tb ); | 2013 | mActionDetails->plug( tb ); |
1956 | settingsMenu->insertSeparator(); | 2014 | settingsMenu->insertSeparator(); |
2015 | mActionBR->plug(settingsMenu ); | ||
2016 | settingsMenu->insertSeparator(); | ||
1957 | 2017 | ||
1958 | mActionWhoAmI->plug( settingsMenu ); | 2018 | mActionWhoAmI->plug( settingsMenu ); |
1959 | mActionCategories->plug( settingsMenu ); | 2019 | mActionCategories->plug( settingsMenu ); |
1960 | 2020 | ||
1961 | 2021 | ||
1962 | mActionWN->plug( helpMenu ); | 2022 | mActionWN->plug( helpMenu ); |
1963 | mActionSyncHowto->plug( helpMenu ); | 2023 | mActionSyncHowto->plug( helpMenu ); |
1964 | mActionLicence->plug( helpMenu ); | 2024 | mActionLicence->plug( helpMenu ); |
1965 | mActionFaq->plug( helpMenu ); | 2025 | mActionFaq->plug( helpMenu ); |
1966 | mActionAboutKAddressbook->plug( helpMenu ); | 2026 | mActionAboutKAddressbook->plug( helpMenu ); |
1967 | 2027 | ||
1968 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2028 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
1969 | 2029 | ||
1970 | mActionSave->plug( tb ); | 2030 | mActionSave->plug( tb ); |
1971 | mViewManager->getFilterAction()->plug ( tb); | 2031 | mViewManager->getFilterAction()->plug ( tb); |
1972 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 2032 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
1973 | mActionUndo->plug( tb ); | 2033 | mActionUndo->plug( tb ); |
1974 | mActionDelete->plug( tb ); | 2034 | mActionDelete->plug( tb ); |
1975 | mActionRedo->plug( tb ); | 2035 | mActionRedo->plug( tb ); |
1976 | } | 2036 | } |
1977 | } | 2037 | } |
1978 | //mActionQuit->plug ( tb ); | 2038 | //mActionQuit->plug ( tb ); |
1979 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2039 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1980 | 2040 | ||
1981 | //US link the searchwidget first to this. | 2041 | //US link the searchwidget first to this. |
1982 | // The real linkage to the toolbar happens later. | 2042 | // The real linkage to the toolbar happens later. |
1983 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2043 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1984 | //US tb->insertItem( mIncSearchWidget ); | 2044 | //US tb->insertItem( mIncSearchWidget ); |
1985 | /*US | 2045 | /*US |
1986 | mIncSearchWidget = new IncSearchWidget( tb ); | 2046 | mIncSearchWidget = new IncSearchWidget( tb ); |
1987 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2047 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1988 | SLOT( incrementalSearch( const QString& ) ) ); | 2048 | SLOT( incrementalSearch( const QString& ) ) ); |
1989 | 2049 | ||
1990 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2050 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1991 | 2051 | ||
1992 | //US topLayout->addWidget( mJumpButtonBar ); | 2052 | //US topLayout->addWidget( mJumpButtonBar ); |
1993 | this->layout()->add( mJumpButtonBar ); | 2053 | this->layout()->add( mJumpButtonBar ); |
1994 | */ | 2054 | */ |
1995 | 2055 | ||
1996 | #endif //KAB_EMBEDDED | 2056 | #endif //KAB_EMBEDDED |
1997 | 2057 | ||
1998 | mActionExport2phone->plug( ExportMenu ); | 2058 | mActionExport2phone->plug( ExportMenu ); |
1999 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2059 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2000 | syncManager->fillSyncMenu(); | 2060 | syncManager->fillSyncMenu(); |
2001 | 2061 | ||
2002 | } | 2062 | } |
2003 | void KABCore::showLicence() | 2063 | void KABCore::showLicence() |
2004 | { | 2064 | { |
2005 | KApplication::showLicence(); | 2065 | KApplication::showLicence(); |
2006 | } | 2066 | } |
2007 | void KABCore::removeVoice() | 2067 | void KABCore::removeVoice() |
2008 | { | 2068 | { |
2009 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2069 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2010 | return; | 2070 | return; |
2011 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 2071 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
2012 | KABC::Addressee::List::Iterator it; | 2072 | KABC::Addressee::List::Iterator it; |
2013 | for ( it = list.begin(); it != list.end(); ++it ) { | 2073 | for ( it = list.begin(); it != list.end(); ++it ) { |
2014 | 2074 | ||
2015 | if ( (*it).removeVoice() ) | 2075 | if ( (*it).removeVoice() ) |
2016 | contactModified((*it) ); | 2076 | contactModified((*it) ); |
2017 | } | 2077 | } |
2018 | } | 2078 | } |
2019 | 2079 | ||
2020 | 2080 | ||
2021 | 2081 | ||
2022 | void KABCore::clipboardDataChanged() | 2082 | void KABCore::clipboardDataChanged() |
2023 | { | 2083 | { |
2024 | 2084 | ||
2025 | if ( mReadWrite ) | 2085 | if ( mReadWrite ) |
2026 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2086 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2027 | 2087 | ||
2028 | } | 2088 | } |
2029 | 2089 | ||
2030 | void KABCore::updateActionMenu() | 2090 | void KABCore::updateActionMenu() |
2031 | { | 2091 | { |
2032 | UndoStack *undo = UndoStack::instance(); | 2092 | UndoStack *undo = UndoStack::instance(); |
2033 | RedoStack *redo = RedoStack::instance(); | 2093 | RedoStack *redo = RedoStack::instance(); |
2034 | 2094 | ||
2035 | if ( undo->isEmpty() ) | 2095 | if ( undo->isEmpty() ) |
2036 | mActionUndo->setText( i18n( "Undo" ) ); | 2096 | mActionUndo->setText( i18n( "Undo" ) ); |
2037 | else | 2097 | else |
2038 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2098 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2039 | 2099 | ||
2040 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2100 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2041 | 2101 | ||
2042 | if ( !redo->top() ) | 2102 | if ( !redo->top() ) |
2043 | mActionRedo->setText( i18n( "Redo" ) ); | 2103 | mActionRedo->setText( i18n( "Redo" ) ); |
2044 | else | 2104 | else |
2045 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2105 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2046 | 2106 | ||
2047 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2107 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2048 | } | 2108 | } |
2049 | 2109 | ||
2050 | void KABCore::configureKeyBindings() | 2110 | void KABCore::configureKeyBindings() |
2051 | { | 2111 | { |
2052 | #ifndef KAB_EMBEDDED | 2112 | #ifndef KAB_EMBEDDED |
2053 | KKeyDialog::configure( actionCollection(), true ); | 2113 | KKeyDialog::configure( actionCollection(), true ); |
2054 | #else //KAB_EMBEDDED | 2114 | #else //KAB_EMBEDDED |
2055 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2115 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2056 | #endif //KAB_EMBEDDED | 2116 | #endif //KAB_EMBEDDED |
2057 | } | 2117 | } |
2058 | 2118 | ||
2059 | #ifdef KAB_EMBEDDED | 2119 | #ifdef KAB_EMBEDDED |
2060 | void KABCore::configureResources() | 2120 | void KABCore::configureResources() |
2061 | { | 2121 | { |
2062 | KRES::KCMKResources dlg( this, "" , 0 ); | 2122 | KRES::KCMKResources dlg( this, "" , 0 ); |
2063 | 2123 | ||
2064 | if ( !dlg.exec() ) | 2124 | if ( !dlg.exec() ) |
2065 | return; | 2125 | return; |
2066 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2126 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2067 | } | 2127 | } |
2068 | #endif //KAB_EMBEDDED | 2128 | #endif //KAB_EMBEDDED |
2069 | 2129 | ||
2070 | 2130 | ||
2071 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2131 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2072 | * for the attendees list of an event. | 2132 | * for the attendees list of an event. |
2073 | */ | 2133 | */ |
2074 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2134 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2075 | { | 2135 | { |
2076 | QStringList nameList; | 2136 | QStringList nameList; |
2077 | QStringList emailList; | 2137 | QStringList emailList; |
2078 | QStringList uidList; | 2138 | QStringList uidList; |
2079 | 2139 | ||
2080 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2140 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2081 | uint i=0; | 2141 | uint i=0; |
2082 | for (i=0; i < list.count(); i++) | 2142 | for (i=0; i < list.count(); i++) |
2083 | { | 2143 | { |
2084 | nameList.append(list[i].realName()); | 2144 | nameList.append(list[i].realName()); |
2085 | emailList.append(list[i].preferredEmail()); | 2145 | emailList.append(list[i].preferredEmail()); |
2086 | uidList.append(list[i].uid()); | 2146 | uidList.append(list[i].uid()); |
2087 | } | 2147 | } |
2088 | 2148 | ||
2089 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2149 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2090 | 2150 | ||
2091 | } | 2151 | } |
2092 | 2152 | ||
2093 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2153 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2094 | * to put them into the calendar. | 2154 | * to put them into the calendar. |
2095 | */ | 2155 | */ |
2096 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2156 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2097 | { | 2157 | { |
2098 | // qDebug("KABCore::requestForBirthdayList"); | 2158 | // qDebug("KABCore::requestForBirthdayList"); |
2099 | QStringList birthdayList; | 2159 | QStringList birthdayList; |
2100 | QStringList anniversaryList; | 2160 | QStringList anniversaryList; |
2101 | QStringList realNameList; | 2161 | QStringList realNameList; |
2102 | QStringList preferredEmailList; | 2162 | QStringList preferredEmailList; |
2103 | QStringList assembledNameList; | 2163 | QStringList assembledNameList; |
2104 | QStringList uidList; | 2164 | QStringList uidList; |
2105 | 2165 | ||
2106 | KABC::AddressBook::Iterator it; | 2166 | KABC::AddressBook::Iterator it; |
2107 | 2167 | ||
2108 | int count = 0; | 2168 | int count = 0; |
2109 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2169 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2110 | ++count; | 2170 | ++count; |
2111 | } | 2171 | } |
2112 | QProgressBar bar(count,0 ); | 2172 | QProgressBar bar(count,0 ); |
2113 | int w = 300; | 2173 | int w = 300; |
2114 | if ( QApplication::desktop()->width() < 320 ) | 2174 | if ( QApplication::desktop()->width() < 320 ) |
2115 | w = 220; | 2175 | w = 220; |
2116 | int h = bar.sizeHint().height() ; | 2176 | int h = bar.sizeHint().height() ; |
2117 | int dw = QApplication::desktop()->width(); | 2177 | int dw = QApplication::desktop()->width(); |
2118 | int dh = QApplication::desktop()->height(); | 2178 | int dh = QApplication::desktop()->height(); |
2119 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2179 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2120 | bar.show(); | 2180 | bar.show(); |
2121 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2181 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2122 | qApp->processEvents(); | 2182 | qApp->processEvents(); |
2123 | 2183 | ||
2124 | QDate bday; | 2184 | QDate bday; |
2125 | QString anni; | 2185 | QString anni; |
2126 | QString formattedbday; | 2186 | QString formattedbday; |
2127 | 2187 | ||
2128 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2188 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2129 | { | 2189 | { |
2130 | if ( ! bar.isVisible() ) | 2190 | if ( ! bar.isVisible() ) |
2131 | return; | 2191 | return; |
2132 | bar.setProgress( count++ ); | 2192 | bar.setProgress( count++ ); |
2133 | qApp->processEvents(); | 2193 | qApp->processEvents(); |
2134 | bday = (*it).birthday().date(); | 2194 | bday = (*it).birthday().date(); |
2135 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2195 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2136 | 2196 | ||
2137 | if ( bday.isValid() || !anni.isEmpty()) | 2197 | if ( bday.isValid() || !anni.isEmpty()) |
2138 | { | 2198 | { |
2139 | if (bday.isValid()) | 2199 | if (bday.isValid()) |
2140 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2200 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2141 | else | 2201 | else |
2142 | formattedbday = "NOTVALID"; | 2202 | formattedbday = "NOTVALID"; |
2143 | if (anni.isEmpty()) | 2203 | if (anni.isEmpty()) |
2144 | anni = "INVALID"; | 2204 | anni = "INVALID"; |
2145 | 2205 | ||
2146 | birthdayList.append(formattedbday); | 2206 | birthdayList.append(formattedbday); |
2147 | anniversaryList.append(anni); //should be ISODate | 2207 | anniversaryList.append(anni); //should be ISODate |
2148 | realNameList.append((*it).realName()); | 2208 | realNameList.append((*it).realName()); |
@@ -2558,280 +2618,282 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2558 | local->insertAddressee( inL , false ); | 2618 | local->insertAddressee( inL , false ); |
2559 | ++changedLocal; | 2619 | ++changedLocal; |
2560 | } | 2620 | } |
2561 | } | 2621 | } |
2562 | } | 2622 | } |
2563 | } else { // no conflict | 2623 | } else { // no conflict |
2564 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2624 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2565 | QString des = addresseeLSync.note(); | 2625 | QString des = addresseeLSync.note(); |
2566 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 2626 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
2567 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 2627 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
2568 | remote->insertAddressee( inR, false ); | 2628 | remote->insertAddressee( inR, false ); |
2569 | ++deletedAddresseeR; | 2629 | ++deletedAddresseeR; |
2570 | } else { | 2630 | } else { |
2571 | inR.setRevision( modifiedCalendar ); | 2631 | inR.setRevision( modifiedCalendar ); |
2572 | remote->insertAddressee( inR, false ); | 2632 | remote->insertAddressee( inR, false ); |
2573 | inL = inR; | 2633 | inL = inR; |
2574 | inL.setResource( 0 ); | 2634 | inL.setResource( 0 ); |
2575 | local->insertAddressee( inL , false); | 2635 | local->insertAddressee( inL , false); |
2576 | ++addedAddressee; | 2636 | ++addedAddressee; |
2577 | } | 2637 | } |
2578 | } else { | 2638 | } else { |
2579 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { | 2639 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { |
2580 | inR.setRevision( modifiedCalendar ); | 2640 | inR.setRevision( modifiedCalendar ); |
2581 | remote->insertAddressee( inR, false ); | 2641 | remote->insertAddressee( inR, false ); |
2582 | inR.setResource( 0 ); | 2642 | inR.setResource( 0 ); |
2583 | local->insertAddressee( inR, false ); | 2643 | local->insertAddressee( inR, false ); |
2584 | ++addedAddressee; | 2644 | ++addedAddressee; |
2585 | } else { | 2645 | } else { |
2586 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); | 2646 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); |
2587 | remote->removeAddressee( inR ); | 2647 | remote->removeAddressee( inR ); |
2588 | ++deletedAddresseeR; | 2648 | ++deletedAddresseeR; |
2589 | } | 2649 | } |
2590 | } | 2650 | } |
2591 | } | 2651 | } |
2592 | } | 2652 | } |
2593 | ++incCounter; | 2653 | ++incCounter; |
2594 | } | 2654 | } |
2595 | er.clear(); | 2655 | er.clear(); |
2596 | QStringList el = local->uidList(); | 2656 | QStringList el = local->uidList(); |
2597 | modulo = (el.count()/10)+1; | 2657 | modulo = (el.count()/10)+1; |
2598 | 2658 | ||
2599 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); | 2659 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); |
2600 | incCounter = 0; | 2660 | incCounter = 0; |
2601 | while ( incCounter < el.count()) { | 2661 | while ( incCounter < el.count()) { |
2602 | qApp->processEvents(); | 2662 | qApp->processEvents(); |
2603 | if (syncManager->isProgressBarCanceled()) | 2663 | if (syncManager->isProgressBarCanceled()) |
2604 | return false; | 2664 | return false; |
2605 | if ( incCounter % modulo == 0 ) | 2665 | if ( incCounter % modulo == 0 ) |
2606 | syncManager->showProgressBar(incCounter); | 2666 | syncManager->showProgressBar(incCounter); |
2607 | uid = el[ incCounter ]; | 2667 | uid = el[ incCounter ]; |
2608 | bool skipIncidence = false; | 2668 | bool skipIncidence = false; |
2609 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 2669 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
2610 | skipIncidence = true; | 2670 | skipIncidence = true; |
2611 | if ( !skipIncidence ) { | 2671 | if ( !skipIncidence ) { |
2612 | inL = local->findByUid( uid ); | 2672 | inL = local->findByUid( uid ); |
2613 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 2673 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
2614 | inR = remote->findByUid( uid ); | 2674 | inR = remote->findByUid( uid ); |
2615 | if ( inR.isEmpty() ) { | 2675 | if ( inR.isEmpty() ) { |
2616 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2676 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2617 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 2677 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
2618 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 2678 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
2619 | local->removeAddressee( inL ); | 2679 | local->removeAddressee( inL ); |
2620 | ++deletedAddresseeL; | 2680 | ++deletedAddresseeL; |
2621 | } else { | 2681 | } else { |
2622 | if ( ! syncManager->mWriteBackExistingOnly ) { | 2682 | if ( ! syncManager->mWriteBackExistingOnly ) { |
2623 | inL.removeID(mCurrentSyncDevice ); | 2683 | inL.removeID(mCurrentSyncDevice ); |
2624 | ++addedAddresseeR; | 2684 | ++addedAddresseeR; |
2625 | inL.setRevision( modifiedCalendar ); | 2685 | inL.setRevision( modifiedCalendar ); |
2626 | local->insertAddressee( inL, false ); | 2686 | local->insertAddressee( inL, false ); |
2627 | inR = inL; | 2687 | inR = inL; |
2628 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); | 2688 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); |
2629 | inR.setResource( 0 ); | 2689 | inR.setResource( 0 ); |
2630 | remote->insertAddressee( inR, false ); | 2690 | remote->insertAddressee( inR, false ); |
2631 | } | 2691 | } |
2632 | } | 2692 | } |
2633 | } else { | 2693 | } else { |
2634 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { | 2694 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { |
2635 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 2695 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
2636 | local->removeAddressee( inL ); | 2696 | local->removeAddressee( inL ); |
2637 | ++deletedAddresseeL; | 2697 | ++deletedAddresseeL; |
2638 | } else { | 2698 | } else { |
2639 | if ( ! syncManager->mWriteBackExistingOnly ) { | 2699 | if ( ! syncManager->mWriteBackExistingOnly ) { |
2640 | ++addedAddresseeR; | 2700 | ++addedAddresseeR; |
2641 | inL.setRevision( modifiedCalendar ); | 2701 | inL.setRevision( modifiedCalendar ); |
2642 | local->insertAddressee( inL, false ); | 2702 | local->insertAddressee( inL, false ); |
2643 | inR = inL; | 2703 | inR = inL; |
2644 | inR.setResource( 0 ); | 2704 | inR.setResource( 0 ); |
2645 | remote->insertAddressee( inR, false ); | 2705 | remote->insertAddressee( inR, false ); |
2646 | } | 2706 | } |
2647 | } | 2707 | } |
2648 | } | 2708 | } |
2649 | } | 2709 | } |
2650 | } | 2710 | } |
2651 | } | 2711 | } |
2652 | ++incCounter; | 2712 | ++incCounter; |
2653 | } | 2713 | } |
2654 | el.clear(); | 2714 | el.clear(); |
2655 | syncManager->hideProgressBar(); | 2715 | syncManager->hideProgressBar(); |
2656 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); | 2716 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); |
2657 | // get rid of micro seconds | 2717 | // get rid of micro seconds |
2658 | QTime t = mLastAddressbookSync.time(); | 2718 | QTime t = mLastAddressbookSync.time(); |
2659 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 2719 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
2660 | addresseeLSync.setRevision( mLastAddressbookSync ); | 2720 | addresseeLSync.setRevision( mLastAddressbookSync ); |
2661 | addresseeRSync.setRevision( mLastAddressbookSync ); | 2721 | addresseeRSync.setRevision( mLastAddressbookSync ); |
2662 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; | 2722 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; |
2663 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); | 2723 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); |
2664 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; | 2724 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; |
2665 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); | 2725 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); |
2666 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; | 2726 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; |
2667 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); | 2727 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); |
2668 | addresseeRSync.setNote( "" ) ; | 2728 | addresseeRSync.setNote( "" ) ; |
2669 | addresseeLSync.setNote( "" ); | 2729 | addresseeLSync.setNote( "" ); |
2670 | 2730 | ||
2671 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 2731 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
2672 | remote->insertAddressee( addresseeRSync, false ); | 2732 | remote->insertAddressee( addresseeRSync, false ); |
2673 | local->insertAddressee( addresseeLSync, false ); | 2733 | local->insertAddressee( addresseeLSync, false ); |
2674 | QString mes; | 2734 | QString mes; |
2675 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); | 2735 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); |
2676 | if ( syncManager->mShowSyncSummary ) { | 2736 | if ( syncManager->mShowSyncSummary ) { |
2677 | KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); | 2737 | KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); |
2678 | } | 2738 | } |
2679 | qDebug( mes ); | 2739 | qDebug( mes ); |
2680 | return syncOK; | 2740 | return syncOK; |
2681 | } | 2741 | } |
2682 | 2742 | ||
2683 | 2743 | ||
2684 | //this is a overwritten callbackmethods from the syncinterface | 2744 | //this is a overwritten callbackmethods from the syncinterface |
2685 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | 2745 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) |
2686 | { | 2746 | { |
2687 | 2747 | ||
2688 | //pending prepare addresseeview for output | 2748 | //pending prepare addresseeview for output |
2689 | //pending detect, if remote file has REV field. if not switch to external sync | 2749 | //pending detect, if remote file has REV field. if not switch to external sync |
2690 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 2750 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
2691 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 2751 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
2692 | 2752 | ||
2693 | AddressBook abLocal(filename,"syncContact"); | 2753 | AddressBook abLocal(filename,"syncContact"); |
2694 | bool syncOK = false; | 2754 | bool syncOK = false; |
2695 | if ( abLocal.load() ) { | 2755 | if ( abLocal.load() ) { |
2696 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); | 2756 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); |
2697 | bool external = false; | 2757 | bool external = false; |
2698 | bool isXML = false; | 2758 | bool isXML = false; |
2699 | if ( filename.right(4) == ".xml") { | 2759 | if ( filename.right(4) == ".xml") { |
2700 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2760 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2701 | isXML = true; | 2761 | isXML = true; |
2702 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 2762 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
2703 | } else { | 2763 | } else { |
2704 | external = !manager->mIsKapiFile; | 2764 | external = !manager->mIsKapiFile; |
2705 | if ( external ) { | 2765 | if ( external ) { |
2706 | qDebug("Setting vcf mode to external "); | 2766 | qDebug("Setting vcf mode to external "); |
2707 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2767 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2708 | AddressBook::Iterator it; | 2768 | AddressBook::Iterator it; |
2709 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 2769 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
2710 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | 2770 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); |
2711 | (*it).computeCsum( mCurrentSyncDevice ); | 2771 | (*it).computeCsum( mCurrentSyncDevice ); |
2712 | } | 2772 | } |
2713 | } | 2773 | } |
2714 | } | 2774 | } |
2715 | //AddressBook::Iterator it; | 2775 | //AddressBook::Iterator it; |
2716 | //QStringList vcards; | 2776 | //QStringList vcards; |
2717 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 2777 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
2718 | // qDebug("Name %s ", (*it).familyName().latin1()); | 2778 | // qDebug("Name %s ", (*it).familyName().latin1()); |
2719 | //} | 2779 | //} |
2720 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); | 2780 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); |
2721 | if ( syncOK ) { | 2781 | if ( syncOK ) { |
2722 | if ( syncManager->mWriteBackFile ) | 2782 | if ( syncManager->mWriteBackFile ) |
2723 | { | 2783 | { |
2724 | if ( external ) | 2784 | if ( external ) |
2725 | abLocal.removeSyncAddressees( !isXML); | 2785 | abLocal.removeSyncAddressees( !isXML); |
2726 | qDebug("Saving remote AB "); | 2786 | qDebug("Saving remote AB "); |
2727 | if ( ! abLocal.saveAB()) | 2787 | if ( ! abLocal.saveAB()) |
2728 | qDebug("Error writing back AB to file "); | 2788 | qDebug("Error writing back AB to file "); |
2729 | if ( isXML ) { | 2789 | if ( isXML ) { |
2730 | // afterwrite processing | 2790 | // afterwrite processing |
2731 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2791 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2732 | } | 2792 | } |
2733 | } | 2793 | } |
2734 | } | 2794 | } |
2735 | setModified(); | 2795 | setModified(); |
2736 | 2796 | ||
2737 | } | 2797 | } |
2738 | if ( syncOK ) | 2798 | if ( syncOK ) |
2739 | mViewManager->refreshView(); | 2799 | mViewManager->refreshView(); |
2740 | return syncOK; | 2800 | return syncOK; |
2741 | 2801 | ||
2742 | } | 2802 | } |
2743 | 2803 | ||
2744 | 2804 | ||
2745 | //this is a overwritten callbackmethods from the syncinterface | 2805 | //this is a overwritten callbackmethods from the syncinterface |
2746 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 2806 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
2747 | { | 2807 | { |
2748 | if ( resource == "phone" ) | 2808 | if ( resource == "phone" ) |
2749 | return syncPhone(); | 2809 | return syncPhone(); |
2810 | disableBR( true ); | ||
2750 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 2811 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
2751 | 2812 | ||
2752 | AddressBook abLocal( resource,"syncContact"); | 2813 | AddressBook abLocal( resource,"syncContact"); |
2753 | bool syncOK = false; | 2814 | bool syncOK = false; |
2754 | if ( abLocal.load() ) { | 2815 | if ( abLocal.load() ) { |
2755 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 2816 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
2756 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2817 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2757 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 2818 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
2758 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 2819 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2759 | if ( syncOK ) { | 2820 | if ( syncOK ) { |
2760 | if ( syncManager->mWriteBackFile ) { | 2821 | if ( syncManager->mWriteBackFile ) { |
2761 | abLocal.removeSyncAddressees( false ); | 2822 | abLocal.removeSyncAddressees( false ); |
2762 | abLocal.saveAB(); | 2823 | abLocal.saveAB(); |
2763 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2824 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2764 | } | 2825 | } |
2765 | } | 2826 | } |
2766 | setModified(); | 2827 | setModified(); |
2767 | } | 2828 | } |
2768 | if ( syncOK ) | 2829 | if ( syncOK ) |
2769 | mViewManager->refreshView(); | 2830 | mViewManager->refreshView(); |
2831 | disableBR( false ); | ||
2770 | return syncOK; | 2832 | return syncOK; |
2771 | 2833 | ||
2772 | } | 2834 | } |
2773 | void KABCore::message( QString m ) | 2835 | void KABCore::message( QString m ) |
2774 | { | 2836 | { |
2775 | topLevelWidget()->setCaption( m ); | 2837 | topLevelWidget()->setCaption( m ); |
2776 | mMessageTimer->start( 15000, true ); | 2838 | mMessageTimer->start( 15000, true ); |
2777 | } | 2839 | } |
2778 | bool KABCore::syncPhone() | 2840 | bool KABCore::syncPhone() |
2779 | { | 2841 | { |
2780 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2842 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2781 | QString fileName = getPhoneFile(); | 2843 | QString fileName = getPhoneFile(); |
2782 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 2844 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
2783 | message(i18n("Phone access failed!")); | 2845 | message(i18n("Phone access failed!")); |
2784 | return false; | 2846 | return false; |
2785 | } | 2847 | } |
2786 | AddressBook abLocal( fileName,"syncContact"); | 2848 | AddressBook abLocal( fileName,"syncContact"); |
2787 | bool syncOK = false; | 2849 | bool syncOK = false; |
2788 | { | 2850 | { |
2789 | abLocal.importFromFile( fileName ); | 2851 | abLocal.importFromFile( fileName ); |
2790 | qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 2852 | qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
2791 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2853 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2792 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); | 2854 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); |
2793 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 2855 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
2794 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 2856 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2795 | if ( syncOK ) { | 2857 | if ( syncOK ) { |
2796 | if ( syncManager->mWriteBackFile ) { | 2858 | if ( syncManager->mWriteBackFile ) { |
2797 | abLocal.removeSyncAddressees( true ); | 2859 | abLocal.removeSyncAddressees( true ); |
2798 | abLocal.saveABphone( fileName ); | 2860 | abLocal.saveABphone( fileName ); |
2799 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 2861 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
2800 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 2862 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
2801 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); | 2863 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); |
2802 | } | 2864 | } |
2803 | } | 2865 | } |
2804 | setModified(); | 2866 | setModified(); |
2805 | } | 2867 | } |
2806 | if ( syncOK ) | 2868 | if ( syncOK ) |
2807 | mViewManager->refreshView(); | 2869 | mViewManager->refreshView(); |
2808 | return syncOK; | 2870 | return syncOK; |
2809 | } | 2871 | } |
2810 | void KABCore::getFile( bool success ) | 2872 | void KABCore::getFile( bool success ) |
2811 | { | 2873 | { |
2812 | if ( ! success ) { | 2874 | if ( ! success ) { |
2813 | message( i18n("Error receiving file. Nothing changed!") ); | 2875 | message( i18n("Error receiving file. Nothing changed!") ); |
2814 | return; | 2876 | return; |
2815 | } | 2877 | } |
2816 | mAddressBook->importFromFile( sentSyncFile() , false, true ); | 2878 | mAddressBook->importFromFile( sentSyncFile() , false, true ); |
2817 | message( i18n("Pi-Sync successful!") ); | 2879 | message( i18n("Pi-Sync successful!") ); |
2818 | mViewManager->refreshView(); | 2880 | mViewManager->refreshView(); |
2819 | } | 2881 | } |
2820 | void KABCore::syncFileRequest() | 2882 | void KABCore::syncFileRequest() |
2821 | { | 2883 | { |
2822 | mAddressBook->export2File( sentSyncFile() ); | 2884 | mAddressBook->export2File( sentSyncFile() ); |
2823 | } | 2885 | } |
2824 | QString KABCore::sentSyncFile() | 2886 | QString KABCore::sentSyncFile() |
2825 | { | 2887 | { |
2826 | #ifdef DESKTOP_VERSION | 2888 | #ifdef DESKTOP_VERSION |
2827 | return locateLocal( "tmp", "copysyncab.vcf" ); | 2889 | return locateLocal( "tmp", "copysyncab.vcf" ); |
2828 | #else | 2890 | #else |
2829 | return QString( "/tmp/copysyncab.vcf" ); | 2891 | return QString( "/tmp/copysyncab.vcf" ); |
2830 | #endif | 2892 | #endif |
2831 | } | 2893 | } |
2832 | 2894 | ||
2833 | void KABCore::setCaptionBack() | 2895 | void KABCore::setCaptionBack() |
2834 | { | 2896 | { |
2835 | mMessageTimer->stop(); | 2897 | mMessageTimer->stop(); |
2836 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); | 2898 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); |
2837 | } | 2899 | } |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index c7be343..fcbe1e8 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -1,491 +1,502 @@ | |||
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 | ||
38 | #include <qcopchannel_qws.h> | ||
39 | #endif | ||
37 | 40 | ||
38 | namespace KABC { | 41 | namespace KABC { |
39 | class AddressBook; | 42 | class AddressBook; |
40 | } | 43 | } |
41 | 44 | ||
42 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
43 | class KAboutData; | 46 | class KAboutData; |
44 | class KConfig; | 47 | class KConfig; |
45 | 48 | ||
46 | class KAddressBookService; | 49 | class KAddressBookService; |
47 | class LDAPSearchDialog; | 50 | class LDAPSearchDialog; |
48 | #else //KAB_EMBEDDED | 51 | #else //KAB_EMBEDDED |
49 | class KAddressBookMain; | 52 | class KAddressBookMain; |
50 | //US class QAction; | 53 | //US class QAction; |
51 | #endif //KAB_EMBEDDED | 54 | #endif //KAB_EMBEDDED |
52 | class KCMultiDialog; | 55 | class KCMultiDialog; |
53 | class KXMLGUIClient; | 56 | class KXMLGUIClient; |
54 | class ExtensionManager; | 57 | class ExtensionManager; |
55 | class XXPortManager; | 58 | class XXPortManager; |
56 | class JumpButtonBar; | 59 | class JumpButtonBar; |
57 | class IncSearchWidget; | 60 | class IncSearchWidget; |
58 | class KDGanttMinimizeSplitter; | 61 | class KDGanttMinimizeSplitter; |
59 | class KAction; | 62 | class KAction; |
60 | class KActionCollection; | 63 | class KActionCollection; |
61 | class KToggleAction; | 64 | class KToggleAction; |
62 | class KSyncProfile; | 65 | class KSyncProfile; |
63 | 66 | ||
64 | class QAction; | 67 | class QAction; |
65 | class QMenuBar; | 68 | class QMenuBar; |
66 | class QSplitter; | 69 | class QSplitter; |
67 | class ViewContainer; | 70 | class ViewContainer; |
68 | class ViewManager; | 71 | class ViewManager; |
69 | class AddresseeEditorDialog; | 72 | class AddresseeEditorDialog; |
70 | class Ir; | 73 | class Ir; |
71 | 74 | ||
72 | class KABCore : public QWidget, public KSyncInterface | 75 | class KABCore : public QWidget, public KSyncInterface |
73 | { | 76 | { |
74 | Q_OBJECT | 77 | Q_OBJECT |
75 | 78 | ||
76 | public: | 79 | public: |
77 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); | 80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); |
78 | 81 | ||
79 | 82 | ||
80 | ~KABCore(); | 83 | ~KABCore(); |
81 | 84 | ||
82 | 85 | ||
83 | #ifdef KAB_EMBEDDED | 86 | #ifdef KAB_EMBEDDED |
84 | //US added functionality | 87 | //US added functionality |
85 | QPopupMenu* getViewMenu() {return viewMenu;} | 88 | QPopupMenu* getViewMenu() {return viewMenu;} |
86 | QPopupMenu* getFilterMenu() {return filterMenu;} | 89 | QPopupMenu* getFilterMenu() {return filterMenu;} |
87 | QPopupMenu* getSettingsMenu() {return settingsMenu;} | 90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} |
88 | void addActionsManually(); | 91 | void addActionsManually(); |
89 | #endif //KAB_EMBEDDED | 92 | #endif //KAB_EMBEDDED |
90 | /** | 93 | /** |
91 | Restores the global settings. | 94 | Restores the global settings. |
92 | */ | 95 | */ |
93 | void restoreSettings(); | 96 | void restoreSettings(); |
94 | 97 | ||
95 | /** | 98 | /** |
96 | Saves the global settings. | 99 | Saves the global settings. |
97 | */ | 100 | */ |
98 | void saveSettings(); | 101 | void saveSettings(); |
99 | 102 | ||
100 | /** | 103 | /** |
101 | Returns a pointer to the StdAddressBook of the application. | 104 | Returns a pointer to the StdAddressBook of the application. |
102 | */ | 105 | */ |
103 | KABC::AddressBook *addressBook() const; | 106 | KABC::AddressBook *addressBook() const; |
104 | 107 | ||
105 | /** | 108 | /** |
106 | Returns a pointer to the KConfig object of the application. | 109 | Returns a pointer to the KConfig object of the application. |
107 | */ | 110 | */ |
108 | static KConfig *config(); | 111 | static KConfig *config(); |
109 | 112 | ||
110 | /** | 113 | /** |
111 | Returns a pointer to the global KActionCollection object. So | 114 | Returns a pointer to the global KActionCollection object. So |
112 | other classes can register their actions easily. | 115 | other classes can register their actions easily. |
113 | */ | 116 | */ |
114 | KActionCollection *actionCollection() const; | 117 | KActionCollection *actionCollection() const; |
115 | 118 | ||
116 | /** | 119 | /** |
117 | Returns the current search field of the Incremental Search Widget. | 120 | Returns the current search field of the Incremental Search Widget. |
118 | */ | 121 | */ |
119 | KABC::Field *currentSearchField() const; | 122 | KABC::Field *currentSearchField() const; |
120 | 123 | ||
121 | /** | 124 | /** |
122 | Returns the uid list of the currently selected contacts. | 125 | Returns the uid list of the currently selected contacts. |
123 | */ | 126 | */ |
124 | QStringList selectedUIDs() const; | 127 | QStringList selectedUIDs() const; |
125 | 128 | ||
126 | /** | 129 | /** |
127 | Displays the ResourceSelectDialog and returns the selected | 130 | Displays the ResourceSelectDialog and returns the selected |
128 | resource or a null pointer if no resource was selected by | 131 | resource or a null pointer if no resource was selected by |
129 | the user. | 132 | the user. |
130 | */ | 133 | */ |
131 | KABC::Resource *requestResource( QWidget *parent ); | 134 | KABC::Resource *requestResource( QWidget *parent ); |
132 | 135 | ||
133 | #ifndef KAB_EMBEDDED | 136 | #ifndef KAB_EMBEDDED |
134 | static KAboutData *createAboutData(); | 137 | static KAboutData *createAboutData(); |
135 | #endif //KAB_EMBEDDED | 138 | #endif //KAB_EMBEDDED |
136 | 139 | ||
137 | #ifdef KAB_EMBEDDED | 140 | #ifdef KAB_EMBEDDED |
138 | inline QPopupMenu* getImportMenu() { return ImportMenu;} | 141 | inline QPopupMenu* getImportMenu() { return ImportMenu;} |
139 | inline QPopupMenu* getExportMenu() { return ExportMenu;} | 142 | inline QPopupMenu* getExportMenu() { return ExportMenu;} |
140 | #endif //KAB_EMBEDDED | 143 | #endif //KAB_EMBEDDED |
141 | 144 | ||
142 | public slots: | 145 | public slots: |
143 | #ifdef KAB_EMBEDDED | 146 | #ifdef KAB_EMBEDDED |
144 | void createAboutData(); | 147 | void createAboutData(); |
145 | #endif //KAB_EMBEDDED | 148 | #endif //KAB_EMBEDDED |
146 | 149 | ||
147 | void showLicence(); | 150 | void showLicence(); |
148 | void faq(); | 151 | void faq(); |
149 | void whatsnew() ; | 152 | void whatsnew() ; |
150 | void synchowto() ; | 153 | void synchowto() ; |
151 | void writeToPhone(); | 154 | void writeToPhone(); |
152 | 155 | ||
153 | /** | 156 | /** |
154 | Is called whenever a contact is selected in the view. | 157 | Is called whenever a contact is selected in the view. |
155 | */ | 158 | */ |
156 | void setContactSelected( const QString &uid ); | 159 | void setContactSelected( const QString &uid ); |
157 | 160 | ||
158 | /** | 161 | /** |
159 | Opens the preferred mail composer with all selected contacts as | 162 | Opens the preferred mail composer with all selected contacts as |
160 | arguments. | 163 | arguments. |
161 | */ | 164 | */ |
162 | void sendMail(); | 165 | void sendMail(); |
163 | 166 | ||
164 | /** | 167 | /** |
165 | Opens the preferred mail composer with the given contacts as | 168 | Opens the preferred mail composer with the given contacts as |
166 | arguments. | 169 | arguments. |
167 | */ | 170 | */ |
168 | void sendMail( const QString& email ); | 171 | void sendMail( const QString& email ); |
169 | 172 | ||
170 | 173 | ||
171 | void mailVCard(); | 174 | void mailVCard(); |
172 | void mailVCard(const QStringList& uids); | 175 | void mailVCard(const QStringList& uids); |
173 | 176 | ||
174 | /** | 177 | /** |
175 | Beams the "WhoAmI contact. | 178 | Beams the "WhoAmI contact. |
176 | */ | 179 | */ |
177 | void beamMySelf(); | 180 | void beamMySelf(); |
178 | 181 | ||
179 | void beamVCard(); | 182 | void beamVCard(); |
180 | void export2phone(); | 183 | void export2phone(); |
181 | void beamVCard(const QStringList& uids); | 184 | void beamVCard(const QStringList& uids); |
182 | void beamDone( Ir *ir ); | 185 | void beamDone( Ir *ir ); |
183 | 186 | ||
184 | 187 | ||
185 | /** | 188 | /** |
186 | Starts the preferred web browser with the given URL as argument. | 189 | Starts the preferred web browser with the given URL as argument. |
187 | */ | 190 | */ |
188 | void browse( const QString& url ); | 191 | void browse( const QString& url ); |
189 | 192 | ||
190 | /** | 193 | /** |
191 | Select all contacts in the view. | 194 | Select all contacts in the view. |
192 | */ | 195 | */ |
193 | void selectAllContacts(); | 196 | void selectAllContacts(); |
194 | 197 | ||
195 | /** | 198 | /** |
196 | Deletes all selected contacts from the address book. | 199 | Deletes all selected contacts from the address book. |
197 | */ | 200 | */ |
198 | void deleteContacts(); | 201 | void deleteContacts(); |
199 | 202 | ||
200 | /** | 203 | /** |
201 | Deletes given contacts from the address book. | 204 | Deletes given contacts from the address book. |
202 | 205 | ||
203 | @param uids The uids of the contacts, which shall be deleted. | 206 | @param uids The uids of the contacts, which shall be deleted. |
204 | */ | 207 | */ |
205 | void deleteContacts( const QStringList &uids ); | 208 | void deleteContacts( const QStringList &uids ); |
206 | 209 | ||
207 | /** | 210 | /** |
208 | Copys the selected contacts into clipboard for later pasting. | 211 | Copys the selected contacts into clipboard for later pasting. |
209 | */ | 212 | */ |
210 | void copyContacts(); | 213 | void copyContacts(); |
211 | 214 | ||
212 | /** | 215 | /** |
213 | Cuts the selected contacts and stores them for later pasting. | 216 | Cuts the selected contacts and stores them for later pasting. |
214 | */ | 217 | */ |
215 | void cutContacts(); | 218 | void cutContacts(); |
216 | 219 | ||
217 | /** | 220 | /** |
218 | Paste contacts from clipboard into the address book. | 221 | Paste contacts from clipboard into the address book. |
219 | */ | 222 | */ |
220 | void pasteContacts(); | 223 | void pasteContacts(); |
221 | 224 | ||
222 | /** | 225 | /** |
223 | Paste given contacts into the address book. | 226 | Paste given contacts into the address book. |
224 | 227 | ||
225 | @param list The list of addressee, which shall be pasted. | 228 | @param list The list of addressee, which shall be pasted. |
226 | */ | 229 | */ |
227 | void pasteContacts( KABC::Addressee::List &list ); | 230 | void pasteContacts( KABC::Addressee::List &list ); |
228 | 231 | ||
229 | /** | 232 | /** |
230 | Sets the whoAmI contact, that is used by many other programs to | 233 | Sets the whoAmI contact, that is used by many other programs to |
231 | get personal information about the current user. | 234 | get personal information about the current user. |
232 | */ | 235 | */ |
233 | void setWhoAmI(); | 236 | void setWhoAmI(); |
234 | 237 | ||
235 | /** | 238 | /** |
236 | Displays the category dialog and applies the result to all | 239 | Displays the category dialog and applies the result to all |
237 | selected contacts. | 240 | selected contacts. |
238 | */ | 241 | */ |
239 | void setCategories(); | 242 | void setCategories(); |
240 | 243 | ||
241 | /** | 244 | /** |
242 | Sets the field list of the Incremental Search Widget. | 245 | Sets the field list of the Incremental Search Widget. |
243 | */ | 246 | */ |
244 | void setSearchFields( const KABC::Field::List &fields ); | 247 | void setSearchFields( const KABC::Field::List &fields ); |
245 | 248 | ||
246 | /** | 249 | /** |
247 | Search with the current search field for a contact, that matches | 250 | Search with the current search field for a contact, that matches |
248 | the given text, and selects it in the view. | 251 | the given text, and selects it in the view. |
249 | */ | 252 | */ |
250 | void incrementalSearch( const QString& text ); | 253 | void incrementalSearch( const QString& text ); |
251 | 254 | ||
252 | /** | 255 | /** |
253 | Marks the address book as modified. | 256 | Marks the address book as modified. |
254 | */ | 257 | */ |
255 | void setModified(); | 258 | void setModified(); |
256 | /** | 259 | /** |
257 | Marks the address book as modified without refreshing the view. | 260 | Marks the address book as modified without refreshing the view. |
258 | */ | 261 | */ |
259 | void setModifiedWOrefresh(); | 262 | void setModifiedWOrefresh(); |
260 | 263 | ||
261 | /** | 264 | /** |
262 | Marks the address book as modified concerning the argument. | 265 | Marks the address book as modified concerning the argument. |
263 | */ | 266 | */ |
264 | void setModified( bool modified ); | 267 | void setModified( bool modified ); |
265 | 268 | ||
266 | /** | 269 | /** |
267 | Returns whether the address book is modified. | 270 | Returns whether the address book is modified. |
268 | */ | 271 | */ |
269 | bool modified() const; | 272 | bool modified() const; |
270 | 273 | ||
271 | /** | 274 | /** |
272 | Called whenever an contact is modified in the contact editor | 275 | Called whenever an contact is modified in the contact editor |
273 | dialog or the quick edit. | 276 | dialog or the quick edit. |
274 | */ | 277 | */ |
275 | void contactModified( const KABC::Addressee &addr ); | 278 | void contactModified( const KABC::Addressee &addr ); |
276 | 279 | ||
277 | /** | 280 | /** |
278 | DCOP METHODS. | 281 | DCOP METHODS. |
279 | */ | 282 | */ |
280 | void addEmail( QString addr ); | 283 | void addEmail( QString addr ); |
281 | void importVCard( const KURL& url, bool showPreview ); | 284 | void importVCard( const KURL& url, bool showPreview ); |
282 | void importVCard( const QString& vCard, bool showPreview ); | 285 | void importVCard( const QString& vCard, bool showPreview ); |
283 | void newContact(); | 286 | void newContact(); |
284 | QString getNameByPhone( const QString& phone ); | 287 | QString getNameByPhone( const QString& phone ); |
285 | /** | 288 | /** |
286 | END DCOP METHODS | 289 | END DCOP METHODS |
287 | */ | 290 | */ |
288 | 291 | ||
289 | /** | 292 | /** |
290 | Saves the contents of the AddressBook back to disk. | 293 | Saves the contents of the AddressBook back to disk. |
291 | */ | 294 | */ |
292 | void save(); | 295 | void save(); |
293 | 296 | ||
294 | /** | 297 | /** |
295 | Undos the last command using the undo stack. | 298 | Undos the last command using the undo stack. |
296 | */ | 299 | */ |
297 | void undo(); | 300 | void undo(); |
298 | 301 | ||
299 | /** | 302 | /** |
300 | Redos the last command that was undone, using the redo stack. | 303 | Redos the last command that was undone, using the redo stack. |
301 | */ | 304 | */ |
302 | void redo(); | 305 | void redo(); |
303 | 306 | ||
304 | /** | 307 | /** |
305 | Shows the edit dialog for the given uid. If the uid is QString::null, | 308 | Shows the edit dialog for the given uid. If the uid is QString::null, |
306 | the method will try to find a selected addressee in the view. | 309 | the method will try to find a selected addressee in the view. |
307 | */ | 310 | */ |
308 | void editContact( const QString &uid /*US = QString::null*/ ); | 311 | void editContact( const QString &uid /*US = QString::null*/ ); |
309 | //US added a second method without defaultparameter | 312 | //US added a second method without defaultparameter |
310 | void editContact2(); | 313 | void editContact2(); |
311 | 314 | ||
312 | /** | 315 | /** |
313 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 316 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
314 | the method will try to find a selected addressee in the view. | 317 | the method will try to find a selected addressee in the view. |
315 | */ | 318 | */ |
316 | void executeContact( const QString &uid /*US = QString::null*/ ); | 319 | void executeContact( const QString &uid /*US = QString::null*/ ); |
317 | 320 | ||
318 | /** | 321 | /** |
319 | Launches the configuration dialog. | 322 | Launches the configuration dialog. |
320 | */ | 323 | */ |
321 | void openConfigDialog(); | 324 | void openConfigDialog(); |
322 | 325 | ||
323 | /** | 326 | /** |
324 | Launches the ldap search dialog. | 327 | Launches the ldap search dialog. |
325 | */ | 328 | */ |
326 | void openLDAPDialog(); | 329 | void openLDAPDialog(); |
327 | 330 | ||
328 | /** | 331 | /** |
329 | Creates a KAddressBookPrinter, which will display the print | 332 | Creates a KAddressBookPrinter, which will display the print |
330 | dialog and do the printing. | 333 | dialog and do the printing. |
331 | */ | 334 | */ |
332 | void print(); | 335 | void print(); |
333 | 336 | ||
334 | /** | 337 | /** |
335 | Registers a new GUI client, so plugins can register its actions. | 338 | Registers a new GUI client, so plugins can register its actions. |
336 | */ | 339 | */ |
337 | void addGUIClient( KXMLGUIClient *client ); | 340 | void addGUIClient( KXMLGUIClient *client ); |
338 | 341 | ||
339 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 342 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
340 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 343 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
341 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 344 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
342 | 345 | ||
343 | 346 | ||
344 | signals: | 347 | signals: |
345 | void contactSelected( const QString &name ); | 348 | void contactSelected( const QString &name ); |
346 | void contactSelected( const QPixmap &pixmap ); | 349 | void contactSelected( const QPixmap &pixmap ); |
347 | public slots: | 350 | public slots: |
348 | void recieve(QString cmsg ); | 351 | void recieve(QString cmsg ); |
349 | void getFile( bool success ); | 352 | void getFile( bool success ); |
350 | void syncFileRequest(); | 353 | void syncFileRequest(); |
351 | void setDetailsVisible( bool visible ); | 354 | void setDetailsVisible( bool visible ); |
352 | void setDetailsToState(); | 355 | void setDetailsToState(); |
353 | // void slotSyncMenu( int ); | 356 | // void slotSyncMenu( int ); |
354 | private slots: | 357 | private slots: |
358 | void receive( const QCString& cmsg, const QByteArray& data ); | ||
359 | void toggleBeamReceive( ); | ||
360 | void disableBR(bool); | ||
355 | void setJumpButtonBarVisible( bool visible ); | 361 | void setJumpButtonBarVisible( bool visible ); |
356 | void setCaptionBack(); | 362 | void setCaptionBack(); |
357 | void importFromOL(); | 363 | void importFromOL(); |
358 | void extensionModified( const KABC::Addressee::List &list ); | 364 | void extensionModified( const KABC::Addressee::List &list ); |
359 | void extensionChanged( int id ); | 365 | void extensionChanged( int id ); |
360 | void clipboardDataChanged(); | 366 | void clipboardDataChanged(); |
361 | void updateActionMenu(); | 367 | void updateActionMenu(); |
362 | void configureKeyBindings(); | 368 | void configureKeyBindings(); |
363 | void removeVoice(); | 369 | void removeVoice(); |
364 | #ifdef KAB_EMBEDDED | 370 | #ifdef KAB_EMBEDDED |
365 | void configureResources(); | 371 | void configureResources(); |
366 | #endif //KAB_EMBEDDED | 372 | #endif //KAB_EMBEDDED |
367 | 373 | ||
368 | void slotEditorDestroyed( const QString &uid ); | 374 | void slotEditorDestroyed( const QString &uid ); |
369 | void configurationChanged(); | 375 | void configurationChanged(); |
370 | void addressBookChanged(); | 376 | void addressBookChanged(); |
371 | 377 | ||
372 | private: | 378 | private: |
379 | bool mBRdisabled; | ||
380 | #ifndef DESKTOP_VERSION | ||
381 | QCopChannel* infrared; | ||
382 | #endif | ||
373 | QTimer *mMessageTimer; | 383 | QTimer *mMessageTimer; |
374 | void initGUI(); | 384 | void initGUI(); |
375 | void initActions(); | 385 | void initActions(); |
376 | QString getPhoneFile(); | 386 | QString getPhoneFile(); |
377 | 387 | ||
378 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 388 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
379 | const char *name = 0 ); | 389 | const char *name = 0 ); |
380 | 390 | ||
381 | KXMLGUIClient *mGUIClient; | 391 | KXMLGUIClient *mGUIClient; |
382 | 392 | ||
383 | KABC::AddressBook *mAddressBook; | 393 | KABC::AddressBook *mAddressBook; |
384 | 394 | ||
385 | ViewManager *mViewManager; | 395 | ViewManager *mViewManager; |
386 | // QSplitter *mDetailsSplitter; | 396 | // QSplitter *mDetailsSplitter; |
387 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 397 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
388 | ViewContainer *mDetails; | 398 | ViewContainer *mDetails; |
389 | KDGanttMinimizeSplitter* mMiniSplitter; | 399 | KDGanttMinimizeSplitter* mMiniSplitter; |
390 | XXPortManager *mXXPortManager; | 400 | XXPortManager *mXXPortManager; |
391 | JumpButtonBar *mJumpButtonBar; | 401 | JumpButtonBar *mJumpButtonBar; |
392 | IncSearchWidget *mIncSearchWidget; | 402 | IncSearchWidget *mIncSearchWidget; |
393 | ExtensionManager *mExtensionManager; | 403 | ExtensionManager *mExtensionManager; |
394 | 404 | ||
395 | KCMultiDialog *mConfigureDialog; | 405 | KCMultiDialog *mConfigureDialog; |
396 | 406 | ||
397 | #ifndef KAB_EMBEDDED | 407 | #ifndef KAB_EMBEDDED |
398 | LDAPSearchDialog *mLdapSearchDialog; | 408 | LDAPSearchDialog *mLdapSearchDialog; |
399 | #endif //KAB_EMBEDDED | 409 | #endif //KAB_EMBEDDED |
400 | // QDict<AddresseeEditorDialog> mEditorDict; | 410 | // QDict<AddresseeEditorDialog> mEditorDict; |
401 | AddresseeEditorDialog *mEditorDialog; | 411 | AddresseeEditorDialog *mEditorDialog; |
402 | bool mReadWrite; | 412 | bool mReadWrite; |
403 | bool mModified; | 413 | bool mModified; |
404 | bool mIsPart; | 414 | bool mIsPart; |
405 | bool mMultipleViewsAtOnce; | 415 | bool mMultipleViewsAtOnce; |
406 | 416 | ||
407 | 417 | ||
408 | //US file menu | 418 | //US file menu |
409 | KAction *mActionMail; | 419 | KAction *mActionMail; |
410 | KAction *mActionBeam; | 420 | KAction *mActionBeam; |
421 | KToggleAction *mActionBR; | ||
411 | KAction *mActionExport2phone; | 422 | KAction *mActionExport2phone; |
412 | KAction* mActionPrint; | 423 | KAction* mActionPrint; |
413 | KAction* mActionNewContact; | 424 | KAction* mActionNewContact; |
414 | KAction *mActionSave; | 425 | KAction *mActionSave; |
415 | KAction *mActionEditAddressee; | 426 | KAction *mActionEditAddressee; |
416 | KAction *mActionMailVCard; | 427 | KAction *mActionMailVCard; |
417 | KAction *mActionBeamVCard; | 428 | KAction *mActionBeamVCard; |
418 | 429 | ||
419 | KAction *mActionQuit; | 430 | KAction *mActionQuit; |
420 | 431 | ||
421 | //US edit menu | 432 | //US edit menu |
422 | KAction *mActionCopy; | 433 | KAction *mActionCopy; |
423 | KAction *mActionCut; | 434 | KAction *mActionCut; |
424 | KAction *mActionPaste; | 435 | KAction *mActionPaste; |
425 | KAction *mActionSelectAll; | 436 | KAction *mActionSelectAll; |
426 | KAction *mActionUndo; | 437 | KAction *mActionUndo; |
427 | KAction *mActionRedo; | 438 | KAction *mActionRedo; |
428 | KAction *mActionDelete; | 439 | KAction *mActionDelete; |
429 | 440 | ||
430 | //US settings menu | 441 | //US settings menu |
431 | KAction *mActionConfigResources; | 442 | KAction *mActionConfigResources; |
432 | KAction *mActionConfigKAddressbook; | 443 | KAction *mActionConfigKAddressbook; |
433 | KAction *mActionConfigShortcuts; | 444 | KAction *mActionConfigShortcuts; |
434 | KAction *mActionConfigureToolbars; | 445 | KAction *mActionConfigureToolbars; |
435 | KAction *mActionKeyBindings; | 446 | KAction *mActionKeyBindings; |
436 | KToggleAction *mActionJumpBar; | 447 | KToggleAction *mActionJumpBar; |
437 | KToggleAction *mActionDetails; | 448 | KToggleAction *mActionDetails; |
438 | KAction *mActionWhoAmI; | 449 | KAction *mActionWhoAmI; |
439 | KAction *mActionCategories; | 450 | KAction *mActionCategories; |
440 | KAction *mActionAboutKAddressbook; | 451 | KAction *mActionAboutKAddressbook; |
441 | KAction *mActionLicence; | 452 | KAction *mActionLicence; |
442 | KAction *mActionFaq; | 453 | KAction *mActionFaq; |
443 | KAction *mActionWN; | 454 | KAction *mActionWN; |
444 | KAction *mActionSyncHowto; | 455 | KAction *mActionSyncHowto; |
445 | 456 | ||
446 | KAction *mActionDeleteView; | 457 | KAction *mActionDeleteView; |
447 | 458 | ||
448 | QPopupMenu *viewMenu; | 459 | QPopupMenu *viewMenu; |
449 | QPopupMenu *filterMenu; | 460 | QPopupMenu *filterMenu; |
450 | QPopupMenu *settingsMenu; | 461 | QPopupMenu *settingsMenu; |
451 | QPopupMenu *changeMenu; | 462 | QPopupMenu *changeMenu; |
452 | //US QAction *mActionSave; | 463 | //US QAction *mActionSave; |
453 | QPopupMenu *ImportMenu; | 464 | QPopupMenu *ImportMenu; |
454 | QPopupMenu *ExportMenu; | 465 | QPopupMenu *ExportMenu; |
455 | //LR additional methods | 466 | //LR additional methods |
456 | KAction *mActionRemoveVoice; | 467 | KAction *mActionRemoveVoice; |
457 | KAction * mActionImportOL; | 468 | KAction * mActionImportOL; |
458 | 469 | ||
459 | #ifndef KAB_EMBEDDED | 470 | #ifndef KAB_EMBEDDED |
460 | KAddressBookService *mAddressBookService; | 471 | KAddressBookService *mAddressBookService; |
461 | #endif //KAB_EMBEDDED | 472 | #endif //KAB_EMBEDDED |
462 | 473 | ||
463 | class KABCorePrivate; | 474 | class KABCorePrivate; |
464 | KABCorePrivate *d; | 475 | KABCorePrivate *d; |
465 | //US bool mBlockSaveFlag; | 476 | //US bool mBlockSaveFlag; |
466 | 477 | ||
467 | #ifdef KAB_EMBEDDED | 478 | #ifdef KAB_EMBEDDED |
468 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 479 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
469 | #endif //KAB_EMBEDDED | 480 | #endif //KAB_EMBEDDED |
470 | 481 | ||
471 | //this are the overwritten callbackmethods from the syncinterface | 482 | //this are the overwritten callbackmethods from the syncinterface |
472 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 483 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
473 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 484 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
474 | bool syncPhone(); | 485 | bool syncPhone(); |
475 | void message( QString m ); | 486 | void message( QString m ); |
476 | 487 | ||
477 | // LR ******************************* | 488 | // LR ******************************* |
478 | // sync stuff! | 489 | // sync stuff! |
479 | QString sentSyncFile(); | 490 | QString sentSyncFile(); |
480 | QPopupMenu *syncMenu; | 491 | QPopupMenu *syncMenu; |
481 | KSyncManager* syncManager; | 492 | KSyncManager* syncManager; |
482 | int mGlobalSyncMode; | 493 | int mGlobalSyncMode; |
483 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 494 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
484 | KABC::Addressee getLastSyncAddressee(); | 495 | KABC::Addressee getLastSyncAddressee(); |
485 | QDateTime mLastAddressbookSync; | 496 | QDateTime mLastAddressbookSync; |
486 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 497 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
487 | // ********************* | 498 | // ********************* |
488 | 499 | ||
489 | }; | 500 | }; |
490 | 501 | ||
491 | #endif | 502 | #endif |
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp index 8c4ca09..f48f214 100644 --- a/kaddressbook/kaddressbookmain.cpp +++ b/kaddressbook/kaddressbookmain.cpp | |||
@@ -1,250 +1,240 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 1999 Don Sanders <dsanders@kde.org> | 3 | Copyright (c) 1999 Don Sanders <dsanders@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 | #ifdef KAB_EMBEDDED | 24 | #ifdef KAB_EMBEDDED |
25 | #include "kabprefs.h" | 25 | #include "kabprefs.h" |
26 | #include <kglobal.h> | 26 | #include <kglobal.h> |
27 | #include <qmessagebox.h> | 27 | #include <qmessagebox.h> |
28 | #include <qtoolbar.h> | 28 | #include <qtoolbar.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | #else //KAB_EMBEDDED | 30 | #else //KAB_EMBEDDED |
31 | #include <kedittoolbar.h> | 31 | #include <kedittoolbar.h> |
32 | #include <kkeydialog.h> | 32 | #include <kkeydialog.h> |
33 | #include <kmessagebox.h> | 33 | #include <kmessagebox.h> |
34 | #include <kstatusbar.h> | 34 | #include <kstatusbar.h> |
35 | #endif //KAB_EMBEDDED | 35 | #endif //KAB_EMBEDDED |
36 | #include <klocale.h> | 36 | #include <klocale.h> |
37 | 37 | ||
38 | #include "kabcore.h" | 38 | #include "kabcore.h" |
39 | #include "kaddressbookmain.h" | 39 | #include "kaddressbookmain.h" |
40 | #include "kactioncollection.h" | 40 | #include "kactioncollection.h" |
41 | 41 | ||
42 | #ifdef KAB_EMBEDDED | 42 | #ifdef KAB_EMBEDDED |
43 | KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "adrressbook" ) | 43 | KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "adrressbook" ) |
44 | #else //KAB_EMBEDDED | 44 | #else //KAB_EMBEDDED |
45 | //MOC_SKIP_BEGIN | 45 | //MOC_SKIP_BEGIN |
46 | KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 ) | 46 | KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 ) |
47 | //MOC_SKIP_END | 47 | //MOC_SKIP_END |
48 | #endif //KAB_EMBEDDED | 48 | #endif //KAB_EMBEDDED |
49 | { | 49 | { |
50 | 50 | ||
51 | setIcon(SmallIcon( "ka24" ) ); | 51 | setIcon(SmallIcon( "ka24" ) ); |
52 | #if 0 | 52 | #if 0 |
53 | //US for embedded systems, create the toolbar before we initiate KABCore. | 53 | //US for embedded systems, create the toolbar before we initiate KABCore. |
54 | // KABCore will fill the toolbar with menues and icons | 54 | // KABCore will fill the toolbar with menues and icons |
55 | QMainWindow::ToolBarDock tbd; | 55 | QMainWindow::ToolBarDock tbd; |
56 | tbd = Top; | 56 | tbd = Top; |
57 | iconToolBar = new QToolBar( this ); | 57 | iconToolBar = new QToolBar( this ); |
58 | addToolBar (iconToolBar , tbd ); | 58 | addToolBar (iconToolBar , tbd ); |
59 | iconToolBar->setHorizontalStretchable(true); | 59 | iconToolBar->setHorizontalStretchable(true); |
60 | //US iconToolBar->setWidth(300); | 60 | //US iconToolBar->setWidth(300); |
61 | #endif // 0 | 61 | #endif // 0 |
62 | 62 | ||
63 | mCore = new KABCore( this, true, this ); | 63 | mCore = new KABCore( this, true, this ); |
64 | 64 | ||
65 | #ifdef KAB_EMBEDDED | 65 | #ifdef KAB_EMBEDDED |
66 | setCaption( i18n( "KAddressbook/Pi" ) ); | 66 | setCaption( i18n( "KAddressbook/Pi" ) ); |
67 | #else //KAB_EMBEDDED | 67 | #else //KAB_EMBEDDED |
68 | setCaption( i18n( "Address Book Browser" ) ); | 68 | setCaption( i18n( "Address Book Browser" ) ); |
69 | #endif //KAB_EMBEDDED | 69 | #endif //KAB_EMBEDDED |
70 | 70 | ||
71 | //mCore->restoreSettings(); | 71 | //mCore->restoreSettings(); |
72 | 72 | ||
73 | initActions(); | 73 | initActions(); |
74 | 74 | ||
75 | setCentralWidget( mCore ); | 75 | setCentralWidget( mCore ); |
76 | 76 | ||
77 | //US statusBar()->show(); | 77 | //US statusBar()->show(); |
78 | 78 | ||
79 | #ifndef KAB_EMBEDDED | 79 | #ifndef KAB_EMBEDDED |
80 | setStandardToolBarMenuEnabled(true); | 80 | setStandardToolBarMenuEnabled(true); |
81 | 81 | ||
82 | createGUI( "kaddressbookui.rc", false ); | 82 | createGUI( "kaddressbookui.rc", false ); |
83 | 83 | ||
84 | 84 | ||
85 | #endif //KAB_EMBEDDED | 85 | #endif //KAB_EMBEDDED |
86 | setAutoSaveSettings(); | 86 | setAutoSaveSettings(); |
87 | qApp->processEvents(); | 87 | qApp->processEvents(); |
88 | mCore->restoreSettings(); | 88 | mCore->restoreSettings(); |
89 | } | 89 | } |
90 | 90 | ||
91 | KAddressBookMain::~KAddressBookMain() | 91 | KAddressBookMain::~KAddressBookMain() |
92 | { | 92 | { |
93 | // mCore->saveSettings(); | 93 | // mCore->saveSettings(); |
94 | } | 94 | } |
95 | void KAddressBookMain::recieve( const QCString& cmsg, const QByteArray& data ) | 95 | |
96 | { | ||
97 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); | ||
98 | if ( cmsg == "setDocument(QString)" ) { | ||
99 | QDataStream stream( data, IO_ReadOnly ); | ||
100 | QString fileName; | ||
101 | stream >> fileName; | ||
102 | mCore->recieve( fileName ); | ||
103 | return; | ||
104 | } | ||
105 | } | ||
106 | void KAddressBookMain::showMinimized () | 96 | void KAddressBookMain::showMinimized () |
107 | { | 97 | { |
108 | QWidget::showMinimized () ; | 98 | QWidget::showMinimized () ; |
109 | } | 99 | } |
110 | void KAddressBookMain::addEmail( QString addr ) | 100 | void KAddressBookMain::addEmail( QString addr ) |
111 | { | 101 | { |
112 | mCore->addEmail( addr ); | 102 | mCore->addEmail( addr ); |
113 | } | 103 | } |
114 | 104 | ||
115 | #ifndef KAB_EMBEDDED | 105 | #ifndef KAB_EMBEDDED |
116 | ASYNC KAddressBookMain::showContactEditor( QString uid ) | 106 | ASYNC KAddressBookMain::showContactEditor( QString uid ) |
117 | { | 107 | { |
118 | mCore->editContact( uid ); | 108 | mCore->editContact( uid ); |
119 | } | 109 | } |
120 | #endif //KAB_EMBEDDED | 110 | #endif //KAB_EMBEDDED |
121 | void KAddressBookMain::newContact() | 111 | void KAddressBookMain::newContact() |
122 | { | 112 | { |
123 | mCore->newContact(); | 113 | mCore->newContact(); |
124 | } | 114 | } |
125 | 115 | ||
126 | QString KAddressBookMain::getNameByPhone( QString phone ) | 116 | QString KAddressBookMain::getNameByPhone( QString phone ) |
127 | { | 117 | { |
128 | return mCore->getNameByPhone( phone ); | 118 | return mCore->getNameByPhone( phone ); |
129 | } | 119 | } |
130 | 120 | ||
131 | void KAddressBookMain::save() | 121 | void KAddressBookMain::save() |
132 | { | 122 | { |
133 | mCore->save(); | 123 | mCore->save(); |
134 | } | 124 | } |
135 | 125 | ||
136 | void KAddressBookMain::exit() | 126 | void KAddressBookMain::exit() |
137 | { | 127 | { |
138 | close( ); | 128 | close( ); |
139 | } | 129 | } |
140 | 130 | ||
141 | void KAddressBookMain::saveProperties( KConfig* ) | 131 | void KAddressBookMain::saveProperties( KConfig* ) |
142 | { | 132 | { |
143 | } | 133 | } |
144 | 134 | ||
145 | void KAddressBookMain::readProperties( KConfig* ) | 135 | void KAddressBookMain::readProperties( KConfig* ) |
146 | { | 136 | { |
147 | } | 137 | } |
148 | 138 | ||
149 | void KAddressBookMain::initActions() | 139 | void KAddressBookMain::initActions() |
150 | { | 140 | { |
151 | #ifndef KAB_EMBEDDED | 141 | #ifndef KAB_EMBEDDED |
152 | KStdAction::quit( this, SLOT( close() ), actionCollection() ); | 142 | KStdAction::quit( this, SLOT( close() ), actionCollection() ); |
153 | KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() ); | 143 | KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() ); |
154 | #else //KAB_EMBEDDED | 144 | #else //KAB_EMBEDDED |
155 | //US: transfered the setup of the actions into KABCore | 145 | //US: transfered the setup of the actions into KABCore |
156 | #endif //KAB_EMBEDDED | 146 | #endif //KAB_EMBEDDED |
157 | 147 | ||
158 | 148 | ||
159 | } | 149 | } |
160 | 150 | ||
161 | //US new method to setup menues and toolbars on embedded systems | 151 | //US new method to setup menues and toolbars on embedded systems |
162 | #ifdef KAB_EMBEDDED | 152 | #ifdef KAB_EMBEDDED |
163 | /* | 153 | /* |
164 | QToolBar * KAddressBookMain::getIconToolBar() | 154 | QToolBar * KAddressBookMain::getIconToolBar() |
165 | { | 155 | { |
166 | return iconToolBar; | 156 | return iconToolBar; |
167 | } | 157 | } |
168 | */ | 158 | */ |
169 | 159 | ||
170 | void KAddressBookMain::createGUI() | 160 | void KAddressBookMain::createGUI() |
171 | { | 161 | { |
172 | 162 | ||
173 | 163 | ||
174 | 164 | ||
175 | } | 165 | } |
176 | #endif //KAB_EMBEDDED | 166 | #endif //KAB_EMBEDDED |
177 | 167 | ||
178 | void KAddressBookMain::configureToolbars() | 168 | void KAddressBookMain::configureToolbars() |
179 | { | 169 | { |
180 | #ifndef KAB_EMBEDDED | 170 | #ifndef KAB_EMBEDDED |
181 | saveMainWindowSettings( KGlobal::config(), "MainWindow" ); | 171 | saveMainWindowSettings( KGlobal::config(), "MainWindow" ); |
182 | 172 | ||
183 | KEditToolbar dlg( factory() ); | 173 | KEditToolbar dlg( factory() ); |
184 | connect( &dlg, SIGNAL( newToolbarConfig() ), SLOT( slotNewToolbarConfig() ) ); | 174 | connect( &dlg, SIGNAL( newToolbarConfig() ), SLOT( slotNewToolbarConfig() ) ); |
185 | 175 | ||
186 | dlg.exec(); | 176 | dlg.exec(); |
187 | #else //KAB_EMBEDDED | 177 | #else //KAB_EMBEDDED |
188 | qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" ); | 178 | qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" ); |
189 | #endif //KAB_EMBEDDED | 179 | #endif //KAB_EMBEDDED |
190 | } | 180 | } |
191 | 181 | ||
192 | void KAddressBookMain::slotNewToolbarConfig() | 182 | void KAddressBookMain::slotNewToolbarConfig() |
193 | { | 183 | { |
194 | #ifndef KAB_EMBEDDED | 184 | #ifndef KAB_EMBEDDED |
195 | applyMainWindowSettings( KGlobal::config(), "MainWindow" ); | 185 | applyMainWindowSettings( KGlobal::config(), "MainWindow" ); |
196 | #else //KAB_EMBEDDED | 186 | #else //KAB_EMBEDDED |
197 | qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" ); | 187 | qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" ); |
198 | #endif //KAB_EMBEDDED | 188 | #endif //KAB_EMBEDDED |
199 | } | 189 | } |
200 | 190 | ||
201 | void KAddressBookMain::configureKeys() | 191 | void KAddressBookMain::configureKeys() |
202 | { | 192 | { |
203 | #ifndef KAB_EMBEDDED | 193 | #ifndef KAB_EMBEDDED |
204 | KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this ); | 194 | KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this ); |
205 | #else //KAB_EMBEDDED | 195 | #else //KAB_EMBEDDED |
206 | qDebug("KAddressBookMain::configureKeys() not implemented by ulf" ); | 196 | qDebug("KAddressBookMain::configureKeys() not implemented by ulf" ); |
207 | #endif //KAB_EMBEDDED | 197 | #endif //KAB_EMBEDDED |
208 | } | 198 | } |
209 | 199 | ||
210 | void KAddressBookMain::closeEvent( QCloseEvent* ce ) | 200 | void KAddressBookMain::closeEvent( QCloseEvent* ce ) |
211 | { | 201 | { |
212 | bool mModified = mCore->modified(); | 202 | bool mModified = mCore->modified(); |
213 | bool mAskForQuit = KABPrefs::instance()->mAskForQuit; | 203 | bool mAskForQuit = KABPrefs::instance()->mAskForQuit; |
214 | 204 | ||
215 | QString mess = i18n( "Close KA/Pi?"); | 205 | QString mess = i18n( "Close KA/Pi?"); |
216 | if ( mModified == true ) | 206 | if ( mModified == true ) |
217 | mess += i18n( "\nChanges will be saved!"); | 207 | mess += i18n( "\nChanges will be saved!"); |
218 | else | 208 | else |
219 | mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!"); | 209 | mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!"); |
220 | 210 | ||
221 | bool mQuit = true; | 211 | bool mQuit = true; |
222 | 212 | ||
223 | 213 | ||
224 | if (mAskForQuit) | 214 | if (mAskForQuit) |
225 | { | 215 | { |
226 | 216 | ||
227 | int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 ); | 217 | int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 ); |
228 | if (res == 0) | 218 | if (res == 0) |
229 | mQuit = true; | 219 | mQuit = true; |
230 | else | 220 | else |
231 | mQuit = false; | 221 | mQuit = false; |
232 | } | 222 | } |
233 | 223 | ||
234 | if (mQuit == false) | 224 | if (mQuit == false) |
235 | return; | 225 | return; |
236 | 226 | ||
237 | if (mModified == true) | 227 | if (mModified == true) |
238 | { | 228 | { |
239 | save(); | 229 | save(); |
240 | mCore->saveSettings(); | 230 | mCore->saveSettings(); |
241 | KABPrefs::instance()->writeConfig(); | 231 | KABPrefs::instance()->writeConfig(); |
242 | } | 232 | } |
243 | 233 | ||
244 | ce->accept(); | 234 | ce->accept(); |
245 | } | 235 | } |
246 | 236 | ||
247 | #ifndef KAB_EMBEDDED | 237 | #ifndef KAB_EMBEDDED |
248 | #include "kaddressbookmain.moc" | 238 | #include "kaddressbookmain.moc" |
249 | #endif //KAB_EMBEDDED | 239 | #endif //KAB_EMBEDDED |
250 | 240 | ||
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h index 40d2bdd..b6d9b4b 100644 --- a/kaddressbook/kaddressbookmain.h +++ b/kaddressbook/kaddressbookmain.h | |||
@@ -1,122 +1,121 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 1999 Don Sanders <dsanders@kde.org> | 3 | Copyright (c) 1999 Don Sanders <dsanders@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 KADDRESSBOOKMAIN_H | 24 | #ifndef KADDRESSBOOKMAIN_H |
25 | #define KADDRESSBOOKMAIN_H | 25 | #define KADDRESSBOOKMAIN_H |
26 | 26 | ||
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | 28 | ||
29 | #ifdef KAB_EMBEDDED | 29 | #ifdef KAB_EMBEDDED |
30 | class QToolBar; | 30 | class QToolBar; |
31 | #include <qaction.h> | 31 | #include <qaction.h> |
32 | //#include <qmainwindow.h> | 32 | //#include <qmainwindow.h> |
33 | #include <kmainwindow.h> | 33 | #include <kmainwindow.h> |
34 | #else //KAB_EMBEDDED | 34 | #else //KAB_EMBEDDED |
35 | #include <kaction.h> | 35 | #include <kaction.h> |
36 | #include <kapplication.h> | 36 | #include <kapplication.h> |
37 | #include <kmainwindow.h> | 37 | #include <kmainwindow.h> |
38 | #include "kaddressbookiface.h" | 38 | #include "kaddressbookiface.h" |
39 | #endif //KAB_EMBEDDED | 39 | #endif //KAB_EMBEDDED |
40 | 40 | ||
41 | class KABCore; | 41 | class KABCore; |
42 | class KConfig; | 42 | class KConfig; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | This class serves as the main window for KAddressBook. It handles the | 45 | This class serves as the main window for KAddressBook. It handles the |
46 | menus, toolbars, and status bars. | 46 | menus, toolbars, and status bars. |
47 | 47 | ||
48 | @short Main window class | 48 | @short Main window class |
49 | @author Don Sanders <dsanders@kde.org> | 49 | @author Don Sanders <dsanders@kde.org> |
50 | @version 0.1 | 50 | @version 0.1 |
51 | */ | 51 | */ |
52 | #ifdef KAB_EMBEDDED | 52 | #ifdef KAB_EMBEDDED |
53 | class KAddressBookMain : public KMainWindow | 53 | class KAddressBookMain : public KMainWindow |
54 | #else //KAB_EMBEDDED | 54 | #else //KAB_EMBEDDED |
55 | //MOC_SKIP_BEGIN | 55 | //MOC_SKIP_BEGIN |
56 | class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface | 56 | class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface |
57 | //MOC_SKIP_END | 57 | //MOC_SKIP_END |
58 | #endif //KAB_EMBEDDED | 58 | #endif //KAB_EMBEDDED |
59 | { | 59 | { |
60 | Q_OBJECT | 60 | Q_OBJECT |
61 | 61 | ||
62 | public: | 62 | public: |
63 | KAddressBookMain(); | 63 | KAddressBookMain(); |
64 | virtual ~KAddressBookMain(); | 64 | virtual ~KAddressBookMain(); |
65 | 65 | ||
66 | #ifdef KAB_EMBEDDED | 66 | #ifdef KAB_EMBEDDED |
67 | // QPEToolBar * getIconToolBar(); | 67 | // QPEToolBar * getIconToolBar(); |
68 | // QToolBar * getIconToolBar(); | 68 | // QToolBar * getIconToolBar(); |
69 | #endif //KAB_EMBEDDED | 69 | #endif //KAB_EMBEDDED |
70 | 70 | ||
71 | 71 | ||
72 | public slots: | 72 | public slots: |
73 | void showMinimized () ; | 73 | void showMinimized () ; |
74 | virtual void addEmail( QString addr ); | 74 | virtual void addEmail( QString addr ); |
75 | #ifndef KAB_EMBEDDED | 75 | #ifndef KAB_EMBEDDED |
76 | //MOC_SKIP_BEGIN | 76 | //MOC_SKIP_BEGIN |
77 | virtual ASYNC showContactEditor( QString uid ); | 77 | virtual ASYNC showContactEditor( QString uid ); |
78 | //MOC_SKIP_END | 78 | //MOC_SKIP_END |
79 | #endif //KAB_EMBEDDED | 79 | #endif //KAB_EMBEDDED |
80 | virtual void newContact(); | 80 | virtual void newContact(); |
81 | virtual QString getNameByPhone( QString phone ); | 81 | virtual QString getNameByPhone( QString phone ); |
82 | virtual void save(); | 82 | virtual void save(); |
83 | virtual void exit(); | 83 | virtual void exit(); |
84 | void recieve( const QCString& cmsg, const QByteArray& data ); | ||
85 | protected: | 84 | protected: |
86 | void initActions(); | 85 | void initActions(); |
87 | #ifdef KAB_EMBEDDED | 86 | #ifdef KAB_EMBEDDED |
88 | //US new method to setup menues and toolbars on embedded systems | 87 | //US new method to setup menues and toolbars on embedded systems |
89 | void createGUI(); | 88 | void createGUI(); |
90 | #endif //KAB_EMBEDDED | 89 | #endif //KAB_EMBEDDED |
91 | 90 | ||
92 | /** | 91 | /** |
93 | This function is called when it is time for the app to save its | 92 | This function is called when it is time for the app to save its |
94 | properties for session management purposes. | 93 | properties for session management purposes. |
95 | */ | 94 | */ |
96 | void saveProperties( KConfig* ); | 95 | void saveProperties( KConfig* ); |
97 | 96 | ||
98 | /** | 97 | /** |
99 | This function is called when this app is restored. The KConfig | 98 | This function is called when this app is restored. The KConfig |
100 | object points to the session management config file that was saved | 99 | object points to the session management config file that was saved |
101 | with @ref saveProperties | 100 | with @ref saveProperties |
102 | */ | 101 | */ |
103 | void readProperties( KConfig* ); | 102 | void readProperties( KConfig* ); |
104 | 103 | ||
105 | void closeEvent( QCloseEvent* ce ); | 104 | void closeEvent( QCloseEvent* ce ); |
106 | 105 | ||
107 | protected slots: | 106 | protected slots: |
108 | void configureToolbars(); | 107 | void configureToolbars(); |
109 | void configureKeys(); | 108 | void configureKeys(); |
110 | 109 | ||
111 | void slotNewToolbarConfig(); | 110 | void slotNewToolbarConfig(); |
112 | 111 | ||
113 | private: | 112 | private: |
114 | KABCore *mCore; | 113 | KABCore *mCore; |
115 | 114 | ||
116 | #ifdef KAB_EMBEDDED | 115 | #ifdef KAB_EMBEDDED |
117 | // QToolBar *iconToolBar; | 116 | // QToolBar *iconToolBar; |
118 | #endif //KAB_EMBEDDED | 117 | #endif //KAB_EMBEDDED |
119 | 118 | ||
120 | }; | 119 | }; |
121 | 120 | ||
122 | #endif | 121 | #endif |
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index 6dd97b8..a2ff1e9 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -1,218 +1,215 @@ | |||
1 | #ifndef DESKTOP_VERSION | 1 | #ifndef DESKTOP_VERSION |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qcopchannel_qws.h> | 3 | #include <qcopchannel_qws.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #else | 5 | #else |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | #include <qwindowsstyle.h> | 7 | #include <qwindowsstyle.h> |
8 | #include <qplatinumstyle.h> | 8 | #include <qplatinumstyle.h> |
9 | #include <qmainwindow.h> | 9 | #include <qmainwindow.h> |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | #include <kstandarddirs.h> | 12 | #include <kstandarddirs.h> |
13 | #include <qregexp.h> | 13 | #include <qregexp.h> |
14 | #include <kglobal.h> | 14 | #include <kglobal.h> |
15 | #include <stdio.h> | 15 | #include <stdio.h> |
16 | #include <qdir.h> | 16 | #include <qdir.h> |
17 | #include "kaddressbookmain.h" | 17 | #include "kaddressbookmain.h" |
18 | #include "externalapphandler.h" | 18 | #include "externalapphandler.h" |
19 | #include <libkdepim/kpimglobalprefs.h> | 19 | #include <libkdepim/kpimglobalprefs.h> |
20 | 20 | ||
21 | int main( int argc, char **argv ) | 21 | int main( int argc, char **argv ) |
22 | { | 22 | { |
23 | #ifndef DESKTOP_VERSION | 23 | #ifndef DESKTOP_VERSION |
24 | QPEApplication a( argc, argv ); | 24 | QPEApplication a( argc, argv ); |
25 | a.setKeepRunning (); | 25 | a.setKeepRunning (); |
26 | #else | 26 | #else |
27 | QApplication a( argc, argv ); | 27 | QApplication a( argc, argv ); |
28 | QApplication::setStyle( new QPlatinumStyle ()); | 28 | QApplication::setStyle( new QPlatinumStyle ()); |
29 | QString hdir = QDir::homeDirPath(); | 29 | QString hdir = QDir::homeDirPath(); |
30 | // there is a bug when creating dirs for WIN 98 | 30 | // there is a bug when creating dirs for WIN 98 |
31 | // it is difficult to fix, because we have no WIN 98 runnung | 31 | // it is difficult to fix, because we have no WIN 98 runnung |
32 | // such that we try it to create the dirs at startup here | 32 | // such that we try it to create the dirs at startup here |
33 | if ( hdir == "C:\\" ) { // win 98 or ME | 33 | if ( hdir == "C:\\" ) { // win 98 or ME |
34 | QDir app_dir; | 34 | QDir app_dir; |
35 | if ( !app_dir.exists("C:\\kdepim") ) | 35 | if ( !app_dir.exists("C:\\kdepim") ) |
36 | app_dir.mkdir ("C:\\kdepim"); | 36 | app_dir.mkdir ("C:\\kdepim"); |
37 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 37 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
38 | app_dir.mkdir ("C:\\kdepim\\apps"); | 38 | app_dir.mkdir ("C:\\kdepim\\apps"); |
39 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 39 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
40 | app_dir.mkdir ("C:\\kdepim\\config"); | 40 | app_dir.mkdir ("C:\\kdepim\\config"); |
41 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) | 41 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) |
42 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); | 42 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); |
43 | } | 43 | } |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | bool exitHelp = false; | 46 | bool exitHelp = false; |
47 | if ( argc > 1 ) { | 47 | if ( argc > 1 ) { |
48 | QString command = argv[1]; | 48 | QString command = argv[1]; |
49 | if ( command == "-help" ){ | 49 | if ( command == "-help" ){ |
50 | printf("KA/E command line commands:\n"); | 50 | printf("KA/E command line commands:\n"); |
51 | printf(" no command: Start KA/E in usual way\n"); | 51 | printf(" no command: Start KA/E in usual way\n"); |
52 | printf(" -help: This output\n"); | 52 | printf(" -help: This output\n"); |
53 | printf(" KA/E is exiting now. Bye!\n"); | 53 | printf(" KA/E is exiting now. Bye!\n"); |
54 | exitHelp = true; | 54 | exitHelp = true; |
55 | } | 55 | } |
56 | } | 56 | } |
57 | if ( ! exitHelp ) { | 57 | if ( ! exitHelp ) { |
58 | 58 | ||
59 | KGlobal::setAppName( "kaddressbook" ); | 59 | KGlobal::setAppName( "kaddressbook" ); |
60 | #ifndef DESKTOP_VERSION | 60 | #ifndef DESKTOP_VERSION |
61 | if ( QApplication::desktop()->width() > 320 ) | 61 | if ( QApplication::desktop()->width() > 320 ) |
62 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); | 62 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); |
63 | else | 63 | else |
64 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); | 64 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); |
65 | #else | 65 | #else |
66 | QString fileName ; | 66 | QString fileName ; |
67 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; | 67 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; |
68 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 68 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
69 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 69 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
70 | 70 | ||
71 | #endif | 71 | #endif |
72 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 72 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
73 | KAddressBookMain m ; | 73 | KAddressBookMain m ; |
74 | //US MainWindow m; | 74 | //US MainWindow m; |
75 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 75 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
76 | 76 | ||
77 | { | 77 | { |
78 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 78 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
79 | } | 79 | } |
80 | #ifndef DESKTOP_VERSION | 80 | #ifndef DESKTOP_VERSION |
81 | a.showMainWidget( &m ); | 81 | a.showMainWidget( &m ); |
82 | QCopChannel* c1 = new QCopChannel("QPE/Application/addressbook",&m, "channelAB" ) ; | 82 | |
83 | QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | ||
84 | #else | 83 | #else |
85 | a.setMainWidget( &m ); | 84 | a.setMainWidget( &m ); |
86 | m.resize (640, 480 ); | 85 | m.resize (640, 480 ); |
87 | m.show(); | 86 | m.show(); |
88 | #endif | 87 | #endif |
89 | a.exec(); | 88 | a.exec(); |
90 | #ifndef DESKTOP_VERSION | 89 | |
91 | delete c1; | ||
92 | #endif | ||
93 | 90 | ||
94 | } | 91 | } |
95 | qDebug("KA: Bye! "); | 92 | qDebug("KA: Bye! "); |
96 | } | 93 | } |
97 | 94 | ||
98 | /* | 95 | /* |
99 | #include <stdlib.h> | 96 | #include <stdlib.h> |
100 | 97 | ||
101 | #include <qstring.h> | 98 | #include <qstring.h> |
102 | 99 | ||
103 | #include <kabc/stdaddressbook.h> | 100 | #include <kabc/stdaddressbook.h> |
104 | #include <kaboutdata.h> | 101 | #include <kaboutdata.h> |
105 | #include <kcmdlineargs.h> | 102 | #include <kcmdlineargs.h> |
106 | #include <kcrash.h> | 103 | #include <kcrash.h> |
107 | #include <kdebug.h> | 104 | #include <kdebug.h> |
108 | #include <klocale.h> | 105 | #include <klocale.h> |
109 | #include <kstartupinfo.h> | 106 | #include <kstartupinfo.h> |
110 | #include <kuniqueapplication.h> | 107 | #include <kuniqueapplication.h> |
111 | #include <kwin.h> | 108 | #include <kwin.h> |
112 | 109 | ||
113 | #include "kaddressbookmain.h" | 110 | #include "kaddressbookmain.h" |
114 | #include "kabcore.h" | 111 | #include "kabcore.h" |
115 | 112 | ||
116 | extern "C" { | 113 | extern "C" { |
117 | 114 | ||
118 | void crashHandler( int ) | 115 | void crashHandler( int ) |
119 | { | 116 | { |
120 | KABC::StdAddressBook::handleCrash(); | 117 | KABC::StdAddressBook::handleCrash(); |
121 | ::exit( 0 ); | 118 | ::exit( 0 ); |
122 | } | 119 | } |
123 | 120 | ||
124 | } | 121 | } |
125 | 122 | ||
126 | class KAddressBookApp : public KUniqueApplication { | 123 | class KAddressBookApp : public KUniqueApplication { |
127 | public: | 124 | public: |
128 | KAddressBookApp() : mMainWin( 0 ) {} | 125 | KAddressBookApp() : mMainWin( 0 ) {} |
129 | ~KAddressBookApp() {} | 126 | ~KAddressBookApp() {} |
130 | 127 | ||
131 | int newInstance(); | 128 | int newInstance(); |
132 | 129 | ||
133 | private: | 130 | private: |
134 | KAddressBookMain *mMainWin; | 131 | KAddressBookMain *mMainWin; |
135 | }; | 132 | }; |
136 | 133 | ||
137 | int KAddressBookApp::newInstance() | 134 | int KAddressBookApp::newInstance() |
138 | { | 135 | { |
139 | if ( isRestored() ) { | 136 | if ( isRestored() ) { |
140 | // There can only be one main window | 137 | // There can only be one main window |
141 | if ( KMainWindow::canBeRestored( 1 ) ) { | 138 | if ( KMainWindow::canBeRestored( 1 ) ) { |
142 | mMainWin = new KAddressBookMain; | 139 | mMainWin = new KAddressBookMain; |
143 | mMainWin->show(); | 140 | mMainWin->show(); |
144 | mMainWin->restore( 1 ); | 141 | mMainWin->restore( 1 ); |
145 | } | 142 | } |
146 | } else { | 143 | } else { |
147 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 144 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
148 | 145 | ||
149 | QCString addrStr = args->getOption( "addr" ); | 146 | QCString addrStr = args->getOption( "addr" ); |
150 | QCString uidStr = args->getOption( "uid" ); | 147 | QCString uidStr = args->getOption( "uid" ); |
151 | QString addr; | 148 | QString addr; |
152 | QString uid; | 149 | QString uid; |
153 | if ( !addrStr.isEmpty() ) | 150 | if ( !addrStr.isEmpty() ) |
154 | addr = QString::fromLocal8Bit( addrStr ); | 151 | addr = QString::fromLocal8Bit( addrStr ); |
155 | if ( !uidStr.isEmpty() ) | 152 | if ( !uidStr.isEmpty() ) |
156 | uid = QString::fromLocal8Bit( uidStr ); | 153 | uid = QString::fromLocal8Bit( uidStr ); |
157 | 154 | ||
158 | 155 | ||
159 | if ( args->isSet( "editor-only" ) ) { | 156 | if ( args->isSet( "editor-only" ) ) { |
160 | if ( !mMainWin ) | 157 | if ( !mMainWin ) |
161 | mMainWin = new KAddressBookMain; | 158 | mMainWin = new KAddressBookMain; |
162 | KStartupInfo::appStarted(); | 159 | KStartupInfo::appStarted(); |
163 | mMainWin->hide(); | 160 | mMainWin->hide(); |
164 | } else { | 161 | } else { |
165 | if ( mMainWin ) { | 162 | if ( mMainWin ) { |
166 | mMainWin->show(); | 163 | mMainWin->show(); |
167 | KWin::setActiveWindow( mMainWin->winId() ); | 164 | KWin::setActiveWindow( mMainWin->winId() ); |
168 | } else { | 165 | } else { |
169 | mMainWin = new KAddressBookMain; | 166 | mMainWin = new KAddressBookMain; |
170 | mMainWin->show(); | 167 | mMainWin->show(); |
171 | } | 168 | } |
172 | } | 169 | } |
173 | // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do | 170 | // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do |
174 | if ( !addr.isEmpty() ) | 171 | if ( !addr.isEmpty() ) |
175 | mMainWin->addEmail( addr ); | 172 | mMainWin->addEmail( addr ); |
176 | 173 | ||
177 | if ( !uid.isEmpty() ) | 174 | if ( !uid.isEmpty() ) |
178 | mMainWin->showContactEditor( uid ); | 175 | mMainWin->showContactEditor( uid ); |
179 | if ( args->isSet( "new-contact" ) ) { | 176 | if ( args->isSet( "new-contact" ) ) { |
180 | mMainWin->newContact(); | 177 | mMainWin->newContact(); |
181 | } | 178 | } |
182 | } | 179 | } |
183 | 180 | ||
184 | KCrash::setEmergencySaveFunction( crashHandler ); | 181 | KCrash::setEmergencySaveFunction( crashHandler ); |
185 | 182 | ||
186 | return 0; | 183 | return 0; |
187 | } | 184 | } |
188 | 185 | ||
189 | // the dummy argument is required, because KMail apparently sends an empty | 186 | // the dummy argument is required, because KMail apparently sends an empty |
190 | // argument. | 187 | // argument. |
191 | static KCmdLineOptions kmoptions[] = | 188 | static KCmdLineOptions kmoptions[] = |
192 | { | 189 | { |
193 | { "a", 0 , 0 }, | 190 | { "a", 0 , 0 }, |
194 | { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, | 191 | { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, |
195 | { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, | 192 | { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, |
196 | { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, | 193 | { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, |
197 | { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, | 194 | { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, |
198 | { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, | 195 | { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, |
199 | { 0, 0, 0} | 196 | { 0, 0, 0} |
200 | }; | 197 | }; |
201 | 198 | ||
202 | int main( int argc, char *argv[] ) | 199 | int main( int argc, char *argv[] ) |
203 | { | 200 | { |
204 | KLocale::setMainCatalogue( "kaddressbook" ); | 201 | KLocale::setMainCatalogue( "kaddressbook" ); |
205 | 202 | ||
206 | KCmdLineArgs::init( argc, argv, KABCore::createAboutData() ); | 203 | KCmdLineArgs::init( argc, argv, KABCore::createAboutData() ); |
207 | KCmdLineArgs::addCmdLineOptions( kmoptions ); | 204 | KCmdLineArgs::addCmdLineOptions( kmoptions ); |
208 | KUniqueApplication::addCmdLineOptions(); | 205 | KUniqueApplication::addCmdLineOptions(); |
209 | 206 | ||
210 | if ( !KAddressBookApp::start() ) | 207 | if ( !KAddressBookApp::start() ) |
211 | exit( 0 ); | 208 | exit( 0 ); |
212 | 209 | ||
213 | KAddressBookApp app; | 210 | KAddressBookApp app; |
214 | KGlobal::locale()->insertCatalogue( "libkdepim" ); | 211 | KGlobal::locale()->insertCatalogue( "libkdepim" ); |
215 | 212 | ||
216 | return app.exec(); | 213 | return app.exec(); |
217 | } | 214 | } |
218 | */ | 215 | */ |