-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 | |||
@@ -267,112 +267,164 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
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 |
@@ -1739,96 +1791,102 @@ void KABCore::initActions() | |||
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 |
@@ -1909,96 +1967,98 @@ void KABCore::addActionsManually() | |||
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 | { |
@@ -2702,116 +2762,118 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | |||
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!") ); |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index c7be343..fcbe1e8 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -1,84 +1,87 @@ | |||
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 |
@@ -307,152 +310,160 @@ class KABCore : public QWidget, public KSyncInterface | |||
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 | ||
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp index 8c4ca09..f48f214 100644 --- a/kaddressbook/kaddressbookmain.cpp +++ b/kaddressbook/kaddressbookmain.cpp | |||
@@ -47,107 +47,97 @@ KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainW | |||
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() ); |
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h index 40d2bdd..b6d9b4b 100644 --- a/kaddressbook/kaddressbookmain.h +++ b/kaddressbook/kaddressbookmain.h | |||
@@ -36,87 +36,86 @@ class QToolBar; | |||
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 | |||
@@ -34,107 +34,104 @@ int main( int argc, char **argv ) | |||
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 |