author | zautrix <zautrix> | 2004-10-28 11:03:42 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-28 11:03:42 (UTC) |
commit | 01cd4ef94b8604532181c390e9abd560aebaf372 (patch) (unidiff) | |
tree | 96ca1a524512ae2e2868f0bd3df03e4da5c445f9 | |
parent | 61d9eb436349a841410559f51e2601a34ceb5794 (diff) | |
download | kdepimpi-01cd4ef94b8604532181c390e9abd560aebaf372.zip kdepimpi-01cd4ef94b8604532181c390e9abd560aebaf372.tar.gz kdepimpi-01cd4ef94b8604532181c390e9abd560aebaf372.tar.bz2 |
added howto to menus
-rw-r--r-- | kaddressbook/kabcore.cpp | 32 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 4 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 12 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 48 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 2 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 4 |
6 files changed, 74 insertions, 28 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 5ebd3a4..bdc5bd8 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1721,825 +1721,840 @@ void KABCore::initGUI() | |||
1721 | 1721 | ||
1722 | // mMainWindow->getIconToolBar()->raise(); | 1722 | // mMainWindow->getIconToolBar()->raise(); |
1723 | 1723 | ||
1724 | #endif //KAB_EMBEDDED | 1724 | #endif //KAB_EMBEDDED |
1725 | 1725 | ||
1726 | } | 1726 | } |
1727 | void KABCore::initActions() | 1727 | void KABCore::initActions() |
1728 | { | 1728 | { |
1729 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1729 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1730 | 1730 | ||
1731 | #ifndef KAB_EMBEDDED | 1731 | #ifndef KAB_EMBEDDED |
1732 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1732 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1733 | SLOT( clipboardDataChanged() ) ); | 1733 | SLOT( clipboardDataChanged() ) ); |
1734 | #endif //KAB_EMBEDDED | 1734 | #endif //KAB_EMBEDDED |
1735 | 1735 | ||
1736 | // file menu | 1736 | // file menu |
1737 | if ( mIsPart ) { | 1737 | if ( mIsPart ) { |
1738 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1738 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1739 | SLOT( sendMail() ), actionCollection(), | 1739 | SLOT( sendMail() ), actionCollection(), |
1740 | "kaddressbook_mail" ); | 1740 | "kaddressbook_mail" ); |
1741 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1741 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1742 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1742 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1743 | 1743 | ||
1744 | } else { | 1744 | } else { |
1745 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1745 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1746 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1746 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1747 | } | 1747 | } |
1748 | 1748 | ||
1749 | 1749 | ||
1750 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1750 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1751 | SLOT( save() ), actionCollection(), "file_sync" ); | 1751 | SLOT( save() ), actionCollection(), "file_sync" ); |
1752 | 1752 | ||
1753 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1753 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1754 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1754 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1755 | 1755 | ||
1756 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1756 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1757 | this, SLOT( mailVCard() ), | 1757 | this, SLOT( mailVCard() ), |
1758 | actionCollection(), "file_mail_vcard"); | 1758 | actionCollection(), "file_mail_vcard"); |
1759 | 1759 | ||
1760 | mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, | 1760 | mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, |
1761 | SLOT( export2phone() ), actionCollection(), | 1761 | SLOT( export2phone() ), actionCollection(), |
1762 | "kaddressbook_ex2phone" ); | 1762 | "kaddressbook_ex2phone" ); |
1763 | 1763 | ||
1764 | mActionBeamVCard = 0; | 1764 | mActionBeamVCard = 0; |
1765 | mActionBeam = 0; | 1765 | mActionBeam = 0; |
1766 | 1766 | ||
1767 | #ifndef DESKTOP_VERSION | 1767 | #ifndef DESKTOP_VERSION |
1768 | if ( Ir::supported() ) { | 1768 | if ( Ir::supported() ) { |
1769 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1769 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1770 | SLOT( beamVCard() ), actionCollection(), | 1770 | SLOT( beamVCard() ), actionCollection(), |
1771 | "kaddressbook_beam_vcard" ); | 1771 | "kaddressbook_beam_vcard" ); |
1772 | 1772 | ||
1773 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1773 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1774 | SLOT( beamMySelf() ), actionCollection(), | 1774 | SLOT( beamMySelf() ), actionCollection(), |
1775 | "kaddressbook_beam_myself" ); | 1775 | "kaddressbook_beam_myself" ); |
1776 | } | 1776 | } |
1777 | #endif | 1777 | #endif |
1778 | 1778 | ||
1779 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1779 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1780 | this, SLOT( editContact2() ), | 1780 | this, SLOT( editContact2() ), |
1781 | actionCollection(), "file_properties" ); | 1781 | actionCollection(), "file_properties" ); |
1782 | 1782 | ||
1783 | #ifdef KAB_EMBEDDED | 1783 | #ifdef KAB_EMBEDDED |
1784 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1784 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1785 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1785 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1786 | mMainWindow, SLOT( exit() ), | 1786 | mMainWindow, SLOT( exit() ), |
1787 | actionCollection(), "quit" ); | 1787 | actionCollection(), "quit" ); |
1788 | #endif //KAB_EMBEDDED | 1788 | #endif //KAB_EMBEDDED |
1789 | 1789 | ||
1790 | // edit menu | 1790 | // edit menu |
1791 | if ( mIsPart ) { | 1791 | if ( mIsPart ) { |
1792 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1792 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1793 | SLOT( copyContacts() ), actionCollection(), | 1793 | SLOT( copyContacts() ), actionCollection(), |
1794 | "kaddressbook_copy" ); | 1794 | "kaddressbook_copy" ); |
1795 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1795 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1796 | SLOT( cutContacts() ), actionCollection(), | 1796 | SLOT( cutContacts() ), actionCollection(), |
1797 | "kaddressbook_cut" ); | 1797 | "kaddressbook_cut" ); |
1798 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1798 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1799 | SLOT( pasteContacts() ), actionCollection(), | 1799 | SLOT( pasteContacts() ), actionCollection(), |
1800 | "kaddressbook_paste" ); | 1800 | "kaddressbook_paste" ); |
1801 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1801 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1802 | SLOT( selectAllContacts() ), actionCollection(), | 1802 | SLOT( selectAllContacts() ), actionCollection(), |
1803 | "kaddressbook_select_all" ); | 1803 | "kaddressbook_select_all" ); |
1804 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1804 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1805 | SLOT( undo() ), actionCollection(), | 1805 | SLOT( undo() ), actionCollection(), |
1806 | "kaddressbook_undo" ); | 1806 | "kaddressbook_undo" ); |
1807 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1807 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1808 | this, SLOT( redo() ), actionCollection(), | 1808 | this, SLOT( redo() ), actionCollection(), |
1809 | "kaddressbook_redo" ); | 1809 | "kaddressbook_redo" ); |
1810 | } else { | 1810 | } else { |
1811 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1811 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1812 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1812 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1813 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1813 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1814 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1814 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1815 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1815 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1816 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1816 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1817 | } | 1817 | } |
1818 | 1818 | ||
1819 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1819 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1820 | Key_Delete, this, SLOT( deleteContacts() ), | 1820 | Key_Delete, this, SLOT( deleteContacts() ), |
1821 | actionCollection(), "edit_delete" ); | 1821 | actionCollection(), "edit_delete" ); |
1822 | 1822 | ||
1823 | mActionUndo->setEnabled( false ); | 1823 | mActionUndo->setEnabled( false ); |
1824 | mActionRedo->setEnabled( false ); | 1824 | mActionRedo->setEnabled( false ); |
1825 | 1825 | ||
1826 | // settings menu | 1826 | // settings menu |
1827 | #ifdef KAB_EMBEDDED | 1827 | #ifdef KAB_EMBEDDED |
1828 | //US special menuentry to configure the addressbook resources. On KDE | 1828 | //US special menuentry to configure the addressbook resources. On KDE |
1829 | // you do that through the control center !!! | 1829 | // you do that through the control center !!! |
1830 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1830 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1831 | SLOT( configureResources() ), actionCollection(), | 1831 | SLOT( configureResources() ), actionCollection(), |
1832 | "kaddressbook_configure_resources" ); | 1832 | "kaddressbook_configure_resources" ); |
1833 | #endif //KAB_EMBEDDED | 1833 | #endif //KAB_EMBEDDED |
1834 | 1834 | ||
1835 | if ( mIsPart ) { | 1835 | if ( mIsPart ) { |
1836 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1836 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1837 | SLOT( openConfigDialog() ), actionCollection(), | 1837 | SLOT( openConfigDialog() ), actionCollection(), |
1838 | "kaddressbook_configure" ); | 1838 | "kaddressbook_configure" ); |
1839 | 1839 | ||
1840 | //US not implemented yet | 1840 | //US not implemented yet |
1841 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1841 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1842 | // this, SLOT( configureKeyBindings() ), actionCollection(), | 1842 | // this, SLOT( configureKeyBindings() ), actionCollection(), |
1843 | // "kaddressbook_configure_shortcuts" ); | 1843 | // "kaddressbook_configure_shortcuts" ); |
1844 | #ifdef KAB_EMBEDDED | 1844 | #ifdef KAB_EMBEDDED |
1845 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1845 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1846 | mActionConfigureToolbars->setEnabled( false ); | 1846 | mActionConfigureToolbars->setEnabled( false ); |
1847 | #endif //KAB_EMBEDDED | 1847 | #endif //KAB_EMBEDDED |
1848 | 1848 | ||
1849 | } else { | 1849 | } else { |
1850 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1850 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1851 | 1851 | ||
1852 | //US not implemented yet | 1852 | //US not implemented yet |
1853 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1853 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1854 | } | 1854 | } |
1855 | 1855 | ||
1856 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1856 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1857 | actionCollection(), "options_show_jump_bar" ); | 1857 | actionCollection(), "options_show_jump_bar" ); |
1858 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1858 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1859 | 1859 | ||
1860 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1860 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1861 | actionCollection(), "options_show_details" ); | 1861 | actionCollection(), "options_show_details" ); |
1862 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1862 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1863 | 1863 | ||
1864 | 1864 | ||
1865 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, | 1865 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, |
1866 | SLOT( toggleBeamReceive() ), actionCollection(), | 1866 | SLOT( toggleBeamReceive() ), actionCollection(), |
1867 | "kaddressbook_beam_rec" ); | 1867 | "kaddressbook_beam_rec" ); |
1868 | 1868 | ||
1869 | 1869 | ||
1870 | // misc | 1870 | // misc |
1871 | // only enable LDAP lookup if we can handle the protocol | 1871 | // only enable LDAP lookup if we can handle the protocol |
1872 | #ifndef KAB_EMBEDDED | 1872 | #ifndef KAB_EMBEDDED |
1873 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1873 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1874 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1874 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1875 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1875 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1876 | "ldap_lookup" ); | 1876 | "ldap_lookup" ); |
1877 | } | 1877 | } |
1878 | #else //KAB_EMBEDDED | 1878 | #else //KAB_EMBEDDED |
1879 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1879 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1880 | #endif //KAB_EMBEDDED | 1880 | #endif //KAB_EMBEDDED |
1881 | 1881 | ||
1882 | 1882 | ||
1883 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1883 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1884 | SLOT( setWhoAmI() ), actionCollection(), | 1884 | SLOT( setWhoAmI() ), actionCollection(), |
1885 | "set_personal" ); | 1885 | "set_personal" ); |
1886 | 1886 | ||
1887 | 1887 | ||
1888 | 1888 | ||
1889 | 1889 | ||
1890 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1890 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1891 | SLOT( setCategories() ), actionCollection(), | 1891 | SLOT( setCategories() ), actionCollection(), |
1892 | "edit_set_categories" ); | 1892 | "edit_set_categories" ); |
1893 | 1893 | ||
1894 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1894 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1895 | SLOT( removeVoice() ), actionCollection(), | 1895 | SLOT( removeVoice() ), actionCollection(), |
1896 | "remove_voice" ); | 1896 | "remove_voice" ); |
1897 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 1897 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
1898 | SLOT( importFromOL() ), actionCollection(), | 1898 | SLOT( importFromOL() ), actionCollection(), |
1899 | "import_OL" ); | 1899 | "import_OL" ); |
1900 | #ifdef KAB_EMBEDDED | 1900 | #ifdef KAB_EMBEDDED |
1901 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 1901 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
1902 | this, SLOT( showLicence() ), actionCollection(), | 1902 | this, SLOT( showLicence() ), actionCollection(), |
1903 | "licence_about_data" ); | 1903 | "licence_about_data" ); |
1904 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 1904 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
1905 | this, SLOT( faq() ), actionCollection(), | 1905 | this, SLOT( faq() ), actionCollection(), |
1906 | "faq_about_data" ); | 1906 | "faq_about_data" ); |
1907 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 1907 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
1908 | this, SLOT( whatsnew() ), actionCollection(), | 1908 | this, SLOT( whatsnew() ), actionCollection(), |
1909 | "wn" ); | 1909 | "wn" ); |
1910 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 1910 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
1911 | this, SLOT( synchowto() ), actionCollection(), | 1911 | this, SLOT( synchowto() ), actionCollection(), |
1912 | "sync" ); | 1912 | "sync" ); |
1913 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, | ||
1914 | this, SLOT( kdesynchowto() ), actionCollection(), | ||
1915 | "kdesync" ); | ||
1916 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, | ||
1917 | this, SLOT( multisynchowto() ), actionCollection(), | ||
1918 | "multisync" ); | ||
1913 | 1919 | ||
1914 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1920 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1915 | this, SLOT( createAboutData() ), actionCollection(), | 1921 | this, SLOT( createAboutData() ), actionCollection(), |
1916 | "kaddressbook_about_data" ); | 1922 | "kaddressbook_about_data" ); |
1917 | #endif //KAB_EMBEDDED | 1923 | #endif //KAB_EMBEDDED |
1918 | 1924 | ||
1919 | clipboardDataChanged(); | 1925 | clipboardDataChanged(); |
1920 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1926 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1921 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1927 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1922 | } | 1928 | } |
1923 | 1929 | ||
1924 | //US we need this function, to plug all actions into the correct menues. | 1930 | //US we need this function, to plug all actions into the correct menues. |
1925 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1931 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1926 | void KABCore::addActionsManually() | 1932 | void KABCore::addActionsManually() |
1927 | { | 1933 | { |
1928 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1934 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1929 | 1935 | ||
1930 | #ifdef KAB_EMBEDDED | 1936 | #ifdef KAB_EMBEDDED |
1931 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1937 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1932 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1938 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1933 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1939 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1934 | 1940 | ||
1935 | KToolBar* tb = mMainWindow->toolBar(); | 1941 | KToolBar* tb = mMainWindow->toolBar(); |
1936 | 1942 | ||
1937 | #ifndef DESKTOP_VERSION | 1943 | #ifndef DESKTOP_VERSION |
1938 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { | 1944 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { |
1939 | #endif | 1945 | #endif |
1940 | QMenuBar* mb = mMainWindow->menuBar(); | 1946 | QMenuBar* mb = mMainWindow->menuBar(); |
1941 | 1947 | ||
1942 | //US setup menubar. | 1948 | //US setup menubar. |
1943 | //Disable the following block if you do not want to have a menubar. | 1949 | //Disable the following block if you do not want to have a menubar. |
1944 | mb->insertItem( "&File", fileMenu ); | 1950 | mb->insertItem( "&File", fileMenu ); |
1945 | mb->insertItem( "&Edit", editMenu ); | 1951 | mb->insertItem( "&Edit", editMenu ); |
1946 | mb->insertItem( "&View", viewMenu ); | 1952 | mb->insertItem( "&View", viewMenu ); |
1947 | mb->insertItem( "&Settings", settingsMenu ); | 1953 | mb->insertItem( "&Settings", settingsMenu ); |
1948 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 1954 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
1949 | mb->insertItem( "&Change selected", changeMenu ); | 1955 | mb->insertItem( "&Change selected", changeMenu ); |
1950 | mb->insertItem( "&Help", helpMenu ); | 1956 | mb->insertItem( "&Help", helpMenu ); |
1951 | mIncSearchWidget = new IncSearchWidget( tb ); | 1957 | mIncSearchWidget = new IncSearchWidget( tb ); |
1952 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1958 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1953 | #ifndef DESKTOP_VERSION | 1959 | #ifndef DESKTOP_VERSION |
1954 | } else { | 1960 | } else { |
1955 | //US setup toolbar | 1961 | //US setup toolbar |
1956 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 1962 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
1957 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1963 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1958 | menuBarTB->insertItem( "ME", popupBarTB); | 1964 | menuBarTB->insertItem( "ME", popupBarTB); |
1959 | tb->insertWidget(-1, 0, menuBarTB); | 1965 | tb->insertWidget(-1, 0, menuBarTB); |
1960 | mIncSearchWidget = new IncSearchWidget( tb ); | 1966 | mIncSearchWidget = new IncSearchWidget( tb ); |
1961 | 1967 | ||
1962 | tb->enableMoving(false); | 1968 | tb->enableMoving(false); |
1963 | popupBarTB->insertItem( "&File", fileMenu ); | 1969 | popupBarTB->insertItem( "&File", fileMenu ); |
1964 | popupBarTB->insertItem( "&Edit", editMenu ); | 1970 | popupBarTB->insertItem( "&Edit", editMenu ); |
1965 | popupBarTB->insertItem( "&View", viewMenu ); | 1971 | popupBarTB->insertItem( "&View", viewMenu ); |
1966 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1972 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1967 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 1973 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
1968 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1974 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1969 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1975 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1970 | popupBarTB->insertItem( "&Help", helpMenu ); | 1976 | popupBarTB->insertItem( "&Help", helpMenu ); |
1971 | if (QApplication::desktop()->width() > 320 ) { | 1977 | if (QApplication::desktop()->width() > 320 ) { |
1972 | // mViewManager->getFilterAction()->plug ( tb); | 1978 | // mViewManager->getFilterAction()->plug ( tb); |
1973 | } | 1979 | } |
1974 | } | 1980 | } |
1975 | #endif | 1981 | #endif |
1976 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1982 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1977 | 1983 | ||
1978 | 1984 | ||
1979 | 1985 | ||
1980 | //US Now connect the actions with the menue entries. | 1986 | //US Now connect the actions with the menue entries. |
1981 | mActionPrint->plug( fileMenu ); | 1987 | mActionPrint->plug( fileMenu ); |
1982 | mActionMail->plug( fileMenu ); | 1988 | mActionMail->plug( fileMenu ); |
1983 | fileMenu->insertSeparator(); | 1989 | fileMenu->insertSeparator(); |
1984 | 1990 | ||
1985 | mActionNewContact->plug( fileMenu ); | 1991 | mActionNewContact->plug( fileMenu ); |
1986 | mActionNewContact->plug( tb ); | 1992 | mActionNewContact->plug( tb ); |
1987 | 1993 | ||
1988 | mActionEditAddressee->plug( fileMenu ); | 1994 | mActionEditAddressee->plug( fileMenu ); |
1989 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 1995 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
1990 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 1996 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
1991 | mActionEditAddressee->plug( tb ); | 1997 | mActionEditAddressee->plug( tb ); |
1992 | 1998 | ||
1993 | fileMenu->insertSeparator(); | 1999 | fileMenu->insertSeparator(); |
1994 | mActionSave->plug( fileMenu ); | 2000 | mActionSave->plug( fileMenu ); |
1995 | fileMenu->insertItem( "&Import", ImportMenu ); | 2001 | fileMenu->insertItem( "&Import", ImportMenu ); |
1996 | fileMenu->insertItem( "&Export", ExportMenu ); | 2002 | fileMenu->insertItem( "&Export", ExportMenu ); |
1997 | fileMenu->insertSeparator(); | 2003 | fileMenu->insertSeparator(); |
1998 | mActionMailVCard->plug( fileMenu ); | 2004 | mActionMailVCard->plug( fileMenu ); |
1999 | #ifndef DESKTOP_VERSION | 2005 | #ifndef DESKTOP_VERSION |
2000 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 2006 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
2001 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 2007 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
2002 | #endif | 2008 | #endif |
2003 | fileMenu->insertSeparator(); | 2009 | fileMenu->insertSeparator(); |
2004 | mActionQuit->plug( fileMenu ); | 2010 | mActionQuit->plug( fileMenu ); |
2005 | #ifdef _WIN32_ | 2011 | #ifdef _WIN32_ |
2006 | mActionImportOL->plug( ImportMenu ); | 2012 | mActionImportOL->plug( ImportMenu ); |
2007 | #endif | 2013 | #endif |
2008 | // edit menu | 2014 | // edit menu |
2009 | mActionUndo->plug( editMenu ); | 2015 | mActionUndo->plug( editMenu ); |
2010 | mActionRedo->plug( editMenu ); | 2016 | mActionRedo->plug( editMenu ); |
2011 | editMenu->insertSeparator(); | 2017 | editMenu->insertSeparator(); |
2012 | mActionCut->plug( editMenu ); | 2018 | mActionCut->plug( editMenu ); |
2013 | mActionCopy->plug( editMenu ); | 2019 | mActionCopy->plug( editMenu ); |
2014 | mActionPaste->plug( editMenu ); | 2020 | mActionPaste->plug( editMenu ); |
2015 | mActionDelete->plug( editMenu ); | 2021 | mActionDelete->plug( editMenu ); |
2016 | editMenu->insertSeparator(); | 2022 | editMenu->insertSeparator(); |
2017 | mActionSelectAll->plug( editMenu ); | 2023 | mActionSelectAll->plug( editMenu ); |
2018 | 2024 | ||
2019 | mActionRemoveVoice->plug( changeMenu ); | 2025 | mActionRemoveVoice->plug( changeMenu ); |
2020 | // settings menu | 2026 | // settings menu |
2021 | //US special menuentry to configure the addressbook resources. On KDE | 2027 | //US special menuentry to configure the addressbook resources. On KDE |
2022 | // you do that through the control center !!! | 2028 | // you do that through the control center !!! |
2023 | mActionConfigResources->plug( settingsMenu ); | 2029 | mActionConfigResources->plug( settingsMenu ); |
2024 | settingsMenu->insertSeparator(); | 2030 | settingsMenu->insertSeparator(); |
2025 | 2031 | ||
2026 | mActionConfigKAddressbook->plug( settingsMenu ); | 2032 | mActionConfigKAddressbook->plug( settingsMenu ); |
2027 | 2033 | ||
2028 | if ( mIsPart ) { | 2034 | if ( mIsPart ) { |
2029 | //US not implemented yet | 2035 | //US not implemented yet |
2030 | //mActionConfigShortcuts->plug( settingsMenu ); | 2036 | //mActionConfigShortcuts->plug( settingsMenu ); |
2031 | //mActionConfigureToolbars->plug( settingsMenu ); | 2037 | //mActionConfigureToolbars->plug( settingsMenu ); |
2032 | 2038 | ||
2033 | } else { | 2039 | } else { |
2034 | //US not implemented yet | 2040 | //US not implemented yet |
2035 | //mActionKeyBindings->plug( settingsMenu ); | 2041 | //mActionKeyBindings->plug( settingsMenu ); |
2036 | } | 2042 | } |
2037 | 2043 | ||
2038 | settingsMenu->insertSeparator(); | 2044 | settingsMenu->insertSeparator(); |
2039 | 2045 | ||
2040 | mActionJumpBar->plug( settingsMenu ); | 2046 | mActionJumpBar->plug( settingsMenu ); |
2041 | mActionDetails->plug( settingsMenu ); | 2047 | mActionDetails->plug( settingsMenu ); |
2042 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2048 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2043 | mActionDetails->plug( tb ); | 2049 | mActionDetails->plug( tb ); |
2044 | settingsMenu->insertSeparator(); | 2050 | settingsMenu->insertSeparator(); |
2045 | mActionBR->plug(settingsMenu ); | 2051 | mActionBR->plug(settingsMenu ); |
2046 | settingsMenu->insertSeparator(); | 2052 | settingsMenu->insertSeparator(); |
2047 | 2053 | ||
2048 | mActionWhoAmI->plug( settingsMenu ); | 2054 | mActionWhoAmI->plug( settingsMenu ); |
2049 | mActionCategories->plug( settingsMenu ); | 2055 | mActionCategories->plug( settingsMenu ); |
2050 | 2056 | ||
2051 | 2057 | ||
2052 | mActionWN->plug( helpMenu ); | 2058 | mActionWN->plug( helpMenu ); |
2053 | mActionSyncHowto->plug( helpMenu ); | 2059 | mActionSyncHowto->plug( helpMenu ); |
2054 | mActionLicence->plug( helpMenu ); | 2060 | mActionKdeSyncHowto->plug( helpMenu ); |
2061 | mActionMultiSyncHowto->plug( helpMenu ); | ||
2055 | mActionFaq->plug( helpMenu ); | 2062 | mActionFaq->plug( helpMenu ); |
2063 | mActionLicence->plug( helpMenu ); | ||
2056 | mActionAboutKAddressbook->plug( helpMenu ); | 2064 | mActionAboutKAddressbook->plug( helpMenu ); |
2057 | 2065 | ||
2058 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2066 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2059 | 2067 | ||
2060 | mActionSave->plug( tb ); | 2068 | mActionSave->plug( tb ); |
2061 | mViewManager->getFilterAction()->plug ( tb); | 2069 | mViewManager->getFilterAction()->plug ( tb); |
2062 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 2070 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
2063 | mActionUndo->plug( tb ); | 2071 | mActionUndo->plug( tb ); |
2064 | mActionDelete->plug( tb ); | 2072 | mActionDelete->plug( tb ); |
2065 | mActionRedo->plug( tb ); | 2073 | mActionRedo->plug( tb ); |
2066 | } | 2074 | } |
2067 | } else { | 2075 | } else { |
2068 | mActionSave->plug( tb ); | 2076 | mActionSave->plug( tb ); |
2069 | tb->enableMoving(false); | 2077 | tb->enableMoving(false); |
2070 | } | 2078 | } |
2071 | //mActionQuit->plug ( tb ); | 2079 | //mActionQuit->plug ( tb ); |
2072 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2080 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2073 | 2081 | ||
2074 | //US link the searchwidget first to this. | 2082 | //US link the searchwidget first to this. |
2075 | // The real linkage to the toolbar happens later. | 2083 | // The real linkage to the toolbar happens later. |
2076 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2084 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2077 | //US tb->insertItem( mIncSearchWidget ); | 2085 | //US tb->insertItem( mIncSearchWidget ); |
2078 | /*US | 2086 | /*US |
2079 | mIncSearchWidget = new IncSearchWidget( tb ); | 2087 | mIncSearchWidget = new IncSearchWidget( tb ); |
2080 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2088 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2081 | SLOT( incrementalSearch( const QString& ) ) ); | 2089 | SLOT( incrementalSearch( const QString& ) ) ); |
2082 | 2090 | ||
2083 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2091 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2084 | 2092 | ||
2085 | //US topLayout->addWidget( mJumpButtonBar ); | 2093 | //US topLayout->addWidget( mJumpButtonBar ); |
2086 | this->layout()->add( mJumpButtonBar ); | 2094 | this->layout()->add( mJumpButtonBar ); |
2087 | */ | 2095 | */ |
2088 | 2096 | ||
2089 | #endif //KAB_EMBEDDED | 2097 | #endif //KAB_EMBEDDED |
2090 | 2098 | ||
2091 | mActionExport2phone->plug( ExportMenu ); | 2099 | mActionExport2phone->plug( ExportMenu ); |
2092 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2100 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2093 | syncManager->fillSyncMenu(); | 2101 | syncManager->fillSyncMenu(); |
2094 | 2102 | ||
2095 | } | 2103 | } |
2096 | void KABCore::showLicence() | 2104 | void KABCore::showLicence() |
2097 | { | 2105 | { |
2098 | KApplication::showLicence(); | 2106 | KApplication::showLicence(); |
2099 | } | 2107 | } |
2100 | void KABCore::removeVoice() | 2108 | void KABCore::removeVoice() |
2101 | { | 2109 | { |
2102 | 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 ) | 2110 | 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 ) |
2103 | return; | 2111 | return; |
2104 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 2112 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
2105 | KABC::Addressee::List::Iterator it; | 2113 | KABC::Addressee::List::Iterator it; |
2106 | for ( it = list.begin(); it != list.end(); ++it ) { | 2114 | for ( it = list.begin(); it != list.end(); ++it ) { |
2107 | 2115 | ||
2108 | if ( (*it).removeVoice() ) | 2116 | if ( (*it).removeVoice() ) |
2109 | contactModified((*it) ); | 2117 | contactModified((*it) ); |
2110 | } | 2118 | } |
2111 | } | 2119 | } |
2112 | 2120 | ||
2113 | 2121 | ||
2114 | 2122 | ||
2115 | void KABCore::clipboardDataChanged() | 2123 | void KABCore::clipboardDataChanged() |
2116 | { | 2124 | { |
2117 | 2125 | ||
2118 | if ( mReadWrite ) | 2126 | if ( mReadWrite ) |
2119 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2127 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2120 | 2128 | ||
2121 | } | 2129 | } |
2122 | 2130 | ||
2123 | void KABCore::updateActionMenu() | 2131 | void KABCore::updateActionMenu() |
2124 | { | 2132 | { |
2125 | UndoStack *undo = UndoStack::instance(); | 2133 | UndoStack *undo = UndoStack::instance(); |
2126 | RedoStack *redo = RedoStack::instance(); | 2134 | RedoStack *redo = RedoStack::instance(); |
2127 | 2135 | ||
2128 | if ( undo->isEmpty() ) | 2136 | if ( undo->isEmpty() ) |
2129 | mActionUndo->setText( i18n( "Undo" ) ); | 2137 | mActionUndo->setText( i18n( "Undo" ) ); |
2130 | else | 2138 | else |
2131 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2139 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2132 | 2140 | ||
2133 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2141 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2134 | 2142 | ||
2135 | if ( !redo->top() ) | 2143 | if ( !redo->top() ) |
2136 | mActionRedo->setText( i18n( "Redo" ) ); | 2144 | mActionRedo->setText( i18n( "Redo" ) ); |
2137 | else | 2145 | else |
2138 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2146 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2139 | 2147 | ||
2140 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2148 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2141 | } | 2149 | } |
2142 | 2150 | ||
2143 | void KABCore::configureKeyBindings() | 2151 | void KABCore::configureKeyBindings() |
2144 | { | 2152 | { |
2145 | #ifndef KAB_EMBEDDED | 2153 | #ifndef KAB_EMBEDDED |
2146 | KKeyDialog::configure( actionCollection(), true ); | 2154 | KKeyDialog::configure( actionCollection(), true ); |
2147 | #else //KAB_EMBEDDED | 2155 | #else //KAB_EMBEDDED |
2148 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2156 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2149 | #endif //KAB_EMBEDDED | 2157 | #endif //KAB_EMBEDDED |
2150 | } | 2158 | } |
2151 | 2159 | ||
2152 | #ifdef KAB_EMBEDDED | 2160 | #ifdef KAB_EMBEDDED |
2153 | void KABCore::configureResources() | 2161 | void KABCore::configureResources() |
2154 | { | 2162 | { |
2155 | KRES::KCMKResources dlg( this, "" , 0 ); | 2163 | KRES::KCMKResources dlg( this, "" , 0 ); |
2156 | 2164 | ||
2157 | if ( !dlg.exec() ) | 2165 | if ( !dlg.exec() ) |
2158 | return; | 2166 | return; |
2159 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2167 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2160 | } | 2168 | } |
2161 | #endif //KAB_EMBEDDED | 2169 | #endif //KAB_EMBEDDED |
2162 | 2170 | ||
2163 | 2171 | ||
2164 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2172 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2165 | * for the attendees list of an event. | 2173 | * for the attendees list of an event. |
2166 | */ | 2174 | */ |
2167 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2175 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2168 | { | 2176 | { |
2169 | QStringList nameList; | 2177 | QStringList nameList; |
2170 | QStringList emailList; | 2178 | QStringList emailList; |
2171 | QStringList uidList; | 2179 | QStringList uidList; |
2172 | 2180 | ||
2173 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2181 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2174 | uint i=0; | 2182 | uint i=0; |
2175 | for (i=0; i < list.count(); i++) | 2183 | for (i=0; i < list.count(); i++) |
2176 | { | 2184 | { |
2177 | nameList.append(list[i].realName()); | 2185 | nameList.append(list[i].realName()); |
2178 | emailList.append(list[i].preferredEmail()); | 2186 | emailList.append(list[i].preferredEmail()); |
2179 | uidList.append(list[i].uid()); | 2187 | uidList.append(list[i].uid()); |
2180 | } | 2188 | } |
2181 | 2189 | ||
2182 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2190 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2183 | 2191 | ||
2184 | } | 2192 | } |
2185 | 2193 | ||
2186 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2194 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2187 | * to put them into the calendar. | 2195 | * to put them into the calendar. |
2188 | */ | 2196 | */ |
2189 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2197 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2190 | { | 2198 | { |
2191 | // qDebug("KABCore::requestForBirthdayList"); | 2199 | // qDebug("KABCore::requestForBirthdayList"); |
2192 | QStringList birthdayList; | 2200 | QStringList birthdayList; |
2193 | QStringList anniversaryList; | 2201 | QStringList anniversaryList; |
2194 | QStringList realNameList; | 2202 | QStringList realNameList; |
2195 | QStringList preferredEmailList; | 2203 | QStringList preferredEmailList; |
2196 | QStringList assembledNameList; | 2204 | QStringList assembledNameList; |
2197 | QStringList uidList; | 2205 | QStringList uidList; |
2198 | 2206 | ||
2199 | KABC::AddressBook::Iterator it; | 2207 | KABC::AddressBook::Iterator it; |
2200 | 2208 | ||
2201 | int count = 0; | 2209 | int count = 0; |
2202 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2210 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2203 | ++count; | 2211 | ++count; |
2204 | } | 2212 | } |
2205 | QProgressBar bar(count,0 ); | 2213 | QProgressBar bar(count,0 ); |
2206 | int w = 300; | 2214 | int w = 300; |
2207 | if ( QApplication::desktop()->width() < 320 ) | 2215 | if ( QApplication::desktop()->width() < 320 ) |
2208 | w = 220; | 2216 | w = 220; |
2209 | int h = bar.sizeHint().height() ; | 2217 | int h = bar.sizeHint().height() ; |
2210 | int dw = QApplication::desktop()->width(); | 2218 | int dw = QApplication::desktop()->width(); |
2211 | int dh = QApplication::desktop()->height(); | 2219 | int dh = QApplication::desktop()->height(); |
2212 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2220 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2213 | bar.show(); | 2221 | bar.show(); |
2214 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2222 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2215 | qApp->processEvents(); | 2223 | qApp->processEvents(); |
2216 | 2224 | ||
2217 | QDate bday; | 2225 | QDate bday; |
2218 | QString anni; | 2226 | QString anni; |
2219 | QString formattedbday; | 2227 | QString formattedbday; |
2220 | 2228 | ||
2221 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2229 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2222 | { | 2230 | { |
2223 | if ( ! bar.isVisible() ) | 2231 | if ( ! bar.isVisible() ) |
2224 | return; | 2232 | return; |
2225 | bar.setProgress( count++ ); | 2233 | bar.setProgress( count++ ); |
2226 | qApp->processEvents(); | 2234 | qApp->processEvents(); |
2227 | bday = (*it).birthday().date(); | 2235 | bday = (*it).birthday().date(); |
2228 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2236 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2229 | 2237 | ||
2230 | if ( bday.isValid() || !anni.isEmpty()) | 2238 | if ( bday.isValid() || !anni.isEmpty()) |
2231 | { | 2239 | { |
2232 | if (bday.isValid()) | 2240 | if (bday.isValid()) |
2233 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2241 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2234 | else | 2242 | else |
2235 | formattedbday = "NOTVALID"; | 2243 | formattedbday = "NOTVALID"; |
2236 | if (anni.isEmpty()) | 2244 | if (anni.isEmpty()) |
2237 | anni = "INVALID"; | 2245 | anni = "INVALID"; |
2238 | 2246 | ||
2239 | birthdayList.append(formattedbday); | 2247 | birthdayList.append(formattedbday); |
2240 | anniversaryList.append(anni); //should be ISODate | 2248 | anniversaryList.append(anni); //should be ISODate |
2241 | realNameList.append((*it).realName()); | 2249 | realNameList.append((*it).realName()); |
2242 | preferredEmailList.append((*it).preferredEmail()); | 2250 | preferredEmailList.append((*it).preferredEmail()); |
2243 | assembledNameList.append((*it).assembledName()); | 2251 | assembledNameList.append((*it).assembledName()); |
2244 | uidList.append((*it).uid()); | 2252 | uidList.append((*it).uid()); |
2245 | 2253 | ||
2246 | qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); | 2254 | qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); |
2247 | } | 2255 | } |
2248 | } | 2256 | } |
2249 | 2257 | ||
2250 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2258 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2251 | 2259 | ||
2252 | } | 2260 | } |
2253 | 2261 | ||
2254 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2262 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2255 | */ | 2263 | */ |
2256 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2264 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2257 | { | 2265 | { |
2258 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2266 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2259 | 2267 | ||
2260 | QString foundUid = QString::null; | 2268 | QString foundUid = QString::null; |
2261 | if ( ! uid.isEmpty() ) { | 2269 | if ( ! uid.isEmpty() ) { |
2262 | Addressee adrr = mAddressBook->findByUid( uid ); | 2270 | Addressee adrr = mAddressBook->findByUid( uid ); |
2263 | if ( !adrr.isEmpty() ) { | 2271 | if ( !adrr.isEmpty() ) { |
2264 | foundUid = uid; | 2272 | foundUid = uid; |
2265 | } | 2273 | } |
2266 | if ( email == "sendbacklist" ) { | 2274 | if ( email == "sendbacklist" ) { |
2267 | //qDebug("ssssssssssssssssssssssend "); | 2275 | //qDebug("ssssssssssssssssssssssend "); |
2268 | QStringList nameList; | 2276 | QStringList nameList; |
2269 | QStringList emailList; | 2277 | QStringList emailList; |
2270 | QStringList uidList; | 2278 | QStringList uidList; |
2271 | nameList.append(adrr.realName()); | 2279 | nameList.append(adrr.realName()); |
2272 | emailList = adrr.emails(); | 2280 | emailList = adrr.emails(); |
2273 | uidList.append( adrr.preferredEmail()); | 2281 | uidList.append( adrr.preferredEmail()); |
2274 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2282 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2275 | return; | 2283 | return; |
2276 | } | 2284 | } |
2277 | 2285 | ||
2278 | } | 2286 | } |
2279 | 2287 | ||
2280 | if ( email == "sendbacklist" ) | 2288 | if ( email == "sendbacklist" ) |
2281 | return; | 2289 | return; |
2282 | if (foundUid.isEmpty()) | 2290 | if (foundUid.isEmpty()) |
2283 | { | 2291 | { |
2284 | //find the uid of the person first | 2292 | //find the uid of the person first |
2285 | Addressee::List namelist; | 2293 | Addressee::List namelist; |
2286 | Addressee::List emaillist; | 2294 | Addressee::List emaillist; |
2287 | 2295 | ||
2288 | if (!name.isEmpty()) | 2296 | if (!name.isEmpty()) |
2289 | namelist = mAddressBook->findByName( name ); | 2297 | namelist = mAddressBook->findByName( name ); |
2290 | 2298 | ||
2291 | if (!email.isEmpty()) | 2299 | if (!email.isEmpty()) |
2292 | emaillist = mAddressBook->findByEmail( email ); | 2300 | emaillist = mAddressBook->findByEmail( email ); |
2293 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2301 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2294 | //check if we have a match in Namelist and Emaillist | 2302 | //check if we have a match in Namelist and Emaillist |
2295 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2303 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2296 | foundUid = emaillist[0].uid(); | 2304 | foundUid = emaillist[0].uid(); |
2297 | } | 2305 | } |
2298 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2306 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2299 | foundUid = namelist[0].uid(); | 2307 | foundUid = namelist[0].uid(); |
2300 | else | 2308 | else |
2301 | { | 2309 | { |
2302 | for (int i = 0; i < namelist.count(); i++) | 2310 | for (int i = 0; i < namelist.count(); i++) |
2303 | { | 2311 | { |
2304 | for (int j = 0; j < emaillist.count(); j++) | 2312 | for (int j = 0; j < emaillist.count(); j++) |
2305 | { | 2313 | { |
2306 | if (namelist[i] == emaillist[j]) | 2314 | if (namelist[i] == emaillist[j]) |
2307 | { | 2315 | { |
2308 | foundUid = namelist[i].uid(); | 2316 | foundUid = namelist[i].uid(); |
2309 | } | 2317 | } |
2310 | } | 2318 | } |
2311 | } | 2319 | } |
2312 | } | 2320 | } |
2313 | } | 2321 | } |
2314 | else | 2322 | else |
2315 | { | 2323 | { |
2316 | foundUid = uid; | 2324 | foundUid = uid; |
2317 | } | 2325 | } |
2318 | 2326 | ||
2319 | if (!foundUid.isEmpty()) | 2327 | if (!foundUid.isEmpty()) |
2320 | { | 2328 | { |
2321 | 2329 | ||
2322 | // raise Ka/Pi if it is in the background | 2330 | // raise Ka/Pi if it is in the background |
2323 | #ifndef DESKTOP_VERSION | 2331 | #ifndef DESKTOP_VERSION |
2324 | #ifndef KORG_NODCOP | 2332 | #ifndef KORG_NODCOP |
2325 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2333 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2326 | #endif | 2334 | #endif |
2327 | #endif | 2335 | #endif |
2328 | 2336 | ||
2329 | mMainWindow->showMaximized(); | 2337 | mMainWindow->showMaximized(); |
2330 | mMainWindow-> raise(); | 2338 | mMainWindow-> raise(); |
2331 | 2339 | ||
2332 | mViewManager->setSelected( "", false); | 2340 | mViewManager->setSelected( "", false); |
2333 | mViewManager->refreshView( "" ); | 2341 | mViewManager->refreshView( "" ); |
2334 | mViewManager->setSelected( foundUid, true ); | 2342 | mViewManager->setSelected( foundUid, true ); |
2335 | mViewManager->refreshView( foundUid ); | 2343 | mViewManager->refreshView( foundUid ); |
2336 | 2344 | ||
2337 | if ( !mMultipleViewsAtOnce ) | 2345 | if ( !mMultipleViewsAtOnce ) |
2338 | { | 2346 | { |
2339 | setDetailsVisible( true ); | 2347 | setDetailsVisible( true ); |
2340 | mActionDetails->setChecked(true); | 2348 | mActionDetails->setChecked(true); |
2341 | } | 2349 | } |
2342 | } | 2350 | } |
2343 | } | 2351 | } |
2344 | 2352 | ||
2345 | void KABCore::whatsnew() | 2353 | void KABCore::whatsnew() |
2346 | { | 2354 | { |
2347 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 2355 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
2348 | } | 2356 | } |
2349 | void KABCore::synchowto() | 2357 | void KABCore::synchowto() |
2350 | { | 2358 | { |
2351 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 2359 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
2352 | } | 2360 | } |
2353 | 2361 | void KABCore::kdesynchowto() | |
2362 | { | ||
2363 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | ||
2364 | } | ||
2365 | void KABCore::multisynchowto() | ||
2366 | { | ||
2367 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | ||
2368 | } | ||
2354 | void KABCore::faq() | 2369 | void KABCore::faq() |
2355 | { | 2370 | { |
2356 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2371 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2357 | } | 2372 | } |
2358 | 2373 | ||
2359 | #include <libkcal/syncdefines.h> | 2374 | #include <libkcal/syncdefines.h> |
2360 | 2375 | ||
2361 | KABC::Addressee KABCore::getLastSyncAddressee() | 2376 | KABC::Addressee KABCore::getLastSyncAddressee() |
2362 | { | 2377 | { |
2363 | Addressee lse; | 2378 | Addressee lse; |
2364 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2379 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2365 | 2380 | ||
2366 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 2381 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
2367 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2382 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2368 | if (lse.isEmpty()) { | 2383 | if (lse.isEmpty()) { |
2369 | qDebug("Creating new last-syncAddressee "); | 2384 | qDebug("Creating new last-syncAddressee "); |
2370 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2385 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2371 | QString sum = ""; | 2386 | QString sum = ""; |
2372 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 2387 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
2373 | sum = "E: "; | 2388 | sum = "E: "; |
2374 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); | 2389 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); |
2375 | lse.setRevision( mLastAddressbookSync ); | 2390 | lse.setRevision( mLastAddressbookSync ); |
2376 | lse.setCategories( i18n("SyncEvent") ); | 2391 | lse.setCategories( i18n("SyncEvent") ); |
2377 | mAddressBook->insertAddressee( lse ); | 2392 | mAddressBook->insertAddressee( lse ); |
2378 | } | 2393 | } |
2379 | return lse; | 2394 | return lse; |
2380 | } | 2395 | } |
2381 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) | 2396 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) |
2382 | { | 2397 | { |
2383 | 2398 | ||
2384 | //void setZaurusId(int id); | 2399 | //void setZaurusId(int id); |
2385 | // int zaurusId() const; | 2400 | // int zaurusId() const; |
2386 | // void setZaurusUid(int id); | 2401 | // void setZaurusUid(int id); |
2387 | // int zaurusUid() const; | 2402 | // int zaurusUid() const; |
2388 | // void setZaurusStat(int id); | 2403 | // void setZaurusStat(int id); |
2389 | // int zaurusStat() const; | 2404 | // int zaurusStat() const; |
2390 | // 0 equal | 2405 | // 0 equal |
2391 | // 1 take local | 2406 | // 1 take local |
2392 | // 2 take remote | 2407 | // 2 take remote |
2393 | // 3 cancel | 2408 | // 3 cancel |
2394 | QDateTime lastSync = mLastAddressbookSync; | 2409 | QDateTime lastSync = mLastAddressbookSync; |
2395 | QDateTime localMod = local->revision(); | 2410 | QDateTime localMod = local->revision(); |
2396 | QDateTime remoteMod = remote->revision(); | 2411 | QDateTime remoteMod = remote->revision(); |
2397 | 2412 | ||
2398 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2413 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2399 | 2414 | ||
2400 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2415 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2401 | bool remCh, locCh; | 2416 | bool remCh, locCh; |
2402 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 2417 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
2403 | 2418 | ||
2404 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 2419 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
2405 | locCh = ( localMod > mLastAddressbookSync ); | 2420 | locCh = ( localMod > mLastAddressbookSync ); |
2406 | if ( !remCh && ! locCh ) { | 2421 | if ( !remCh && ! locCh ) { |
2407 | //qDebug("both not changed "); | 2422 | //qDebug("both not changed "); |
2408 | lastSync = localMod.addDays(1); | 2423 | lastSync = localMod.addDays(1); |
2409 | if ( mode <= SYNC_PREF_ASK ) | 2424 | if ( mode <= SYNC_PREF_ASK ) |
2410 | return 0; | 2425 | return 0; |
2411 | } else { | 2426 | } else { |
2412 | if ( locCh ) { | 2427 | if ( locCh ) { |
2413 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); | 2428 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); |
2414 | lastSync = localMod.addDays( -1 ); | 2429 | lastSync = localMod.addDays( -1 ); |
2415 | if ( !remCh ) | 2430 | if ( !remCh ) |
2416 | remoteMod =( lastSync.addDays( -1 ) ); | 2431 | remoteMod =( lastSync.addDays( -1 ) ); |
2417 | } else { | 2432 | } else { |
2418 | //qDebug(" not loc changed "); | 2433 | //qDebug(" not loc changed "); |
2419 | lastSync = localMod.addDays( 1 ); | 2434 | lastSync = localMod.addDays( 1 ); |
2420 | if ( remCh ) | 2435 | if ( remCh ) |
2421 | remoteMod =( lastSync.addDays( 1 ) ); | 2436 | remoteMod =( lastSync.addDays( 1 ) ); |
2422 | 2437 | ||
2423 | } | 2438 | } |
2424 | } | 2439 | } |
2425 | full = true; | 2440 | full = true; |
2426 | if ( mode < SYNC_PREF_ASK ) | 2441 | if ( mode < SYNC_PREF_ASK ) |
2427 | mode = SYNC_PREF_ASK; | 2442 | mode = SYNC_PREF_ASK; |
2428 | } else { | 2443 | } else { |
2429 | if ( localMod == remoteMod ) | 2444 | if ( localMod == remoteMod ) |
2430 | return 0; | 2445 | return 0; |
2431 | 2446 | ||
2432 | } | 2447 | } |
2433 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 2448 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
2434 | 2449 | ||
2435 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod); | 2450 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod); |
2436 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); | 2451 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); |
2437 | //full = true; //debug only | 2452 | //full = true; //debug only |
2438 | if ( full ) { | 2453 | if ( full ) { |
2439 | bool equ = ( (*local) == (*remote) ); | 2454 | bool equ = ( (*local) == (*remote) ); |
2440 | if ( equ ) { | 2455 | if ( equ ) { |
2441 | //qDebug("equal "); | 2456 | //qDebug("equal "); |
2442 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2457 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2443 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 2458 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
2444 | } | 2459 | } |
2445 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 2460 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
2446 | return 0; | 2461 | return 0; |
2447 | 2462 | ||
2448 | }//else //debug only | 2463 | }//else //debug only |
2449 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 2464 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
2450 | } | 2465 | } |
2451 | int result; | 2466 | int result; |
2452 | bool localIsNew; | 2467 | bool localIsNew; |
2453 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); | 2468 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); |
2454 | 2469 | ||
2455 | if ( full && mode < SYNC_PREF_NEWEST ) | 2470 | if ( full && mode < SYNC_PREF_NEWEST ) |
2456 | mode = SYNC_PREF_ASK; | 2471 | mode = SYNC_PREF_ASK; |
2457 | 2472 | ||
2458 | switch( mode ) { | 2473 | switch( mode ) { |
2459 | case SYNC_PREF_LOCAL: | 2474 | case SYNC_PREF_LOCAL: |
2460 | if ( lastSync > remoteMod ) | 2475 | if ( lastSync > remoteMod ) |
2461 | return 1; | 2476 | return 1; |
2462 | if ( lastSync > localMod ) | 2477 | if ( lastSync > localMod ) |
2463 | return 2; | 2478 | return 2; |
2464 | return 1; | 2479 | return 1; |
2465 | break; | 2480 | break; |
2466 | case SYNC_PREF_REMOTE: | 2481 | case SYNC_PREF_REMOTE: |
2467 | if ( lastSync > remoteMod ) | 2482 | if ( lastSync > remoteMod ) |
2468 | return 1; | 2483 | return 1; |
2469 | if ( lastSync > localMod ) | 2484 | if ( lastSync > localMod ) |
2470 | return 2; | 2485 | return 2; |
2471 | return 2; | 2486 | return 2; |
2472 | break; | 2487 | break; |
2473 | case SYNC_PREF_NEWEST: | 2488 | case SYNC_PREF_NEWEST: |
2474 | if ( localMod > remoteMod ) | 2489 | if ( localMod > remoteMod ) |
2475 | return 1; | 2490 | return 1; |
2476 | else | 2491 | else |
2477 | return 2; | 2492 | return 2; |
2478 | break; | 2493 | break; |
2479 | case SYNC_PREF_ASK: | 2494 | case SYNC_PREF_ASK: |
2480 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 2495 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
2481 | if ( lastSync > remoteMod ) | 2496 | if ( lastSync > remoteMod ) |
2482 | return 1; | 2497 | return 1; |
2483 | if ( lastSync > localMod ) | 2498 | if ( lastSync > localMod ) |
2484 | return 2; | 2499 | return 2; |
2485 | localIsNew = localMod >= remoteMod; | 2500 | localIsNew = localMod >= remoteMod; |
2486 | //qDebug("conflict! ************************************** "); | 2501 | //qDebug("conflict! ************************************** "); |
2487 | { | 2502 | { |
2488 | KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); | 2503 | KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); |
2489 | result = acd.executeD(localIsNew); | 2504 | result = acd.executeD(localIsNew); |
2490 | return result; | 2505 | return result; |
2491 | } | 2506 | } |
2492 | break; | 2507 | break; |
2493 | case SYNC_PREF_FORCE_LOCAL: | 2508 | case SYNC_PREF_FORCE_LOCAL: |
2494 | return 1; | 2509 | return 1; |
2495 | break; | 2510 | break; |
2496 | case SYNC_PREF_FORCE_REMOTE: | 2511 | case SYNC_PREF_FORCE_REMOTE: |
2497 | return 2; | 2512 | return 2; |
2498 | break; | 2513 | break; |
2499 | 2514 | ||
2500 | default: | 2515 | default: |
2501 | // SYNC_PREF_TAKE_BOTH not implemented | 2516 | // SYNC_PREF_TAKE_BOTH not implemented |
2502 | break; | 2517 | break; |
2503 | } | 2518 | } |
2504 | return 0; | 2519 | return 0; |
2505 | } | 2520 | } |
2506 | 2521 | ||
2507 | 2522 | ||
2508 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) | 2523 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) |
2509 | { | 2524 | { |
2510 | bool syncOK = true; | 2525 | bool syncOK = true; |
2511 | int addedAddressee = 0; | 2526 | int addedAddressee = 0; |
2512 | int addedAddresseeR = 0; | 2527 | int addedAddresseeR = 0; |
2513 | int deletedAddresseeR = 0; | 2528 | int deletedAddresseeR = 0; |
2514 | int deletedAddresseeL = 0; | 2529 | int deletedAddresseeL = 0; |
2515 | int changedLocal = 0; | 2530 | int changedLocal = 0; |
2516 | int changedRemote = 0; | 2531 | int changedRemote = 0; |
2517 | 2532 | ||
2518 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); | 2533 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); |
2519 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2534 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2520 | 2535 | ||
2521 | //QPtrList<Addressee> el = local->rawAddressees(); | 2536 | //QPtrList<Addressee> el = local->rawAddressees(); |
2522 | Addressee addresseeR; | 2537 | Addressee addresseeR; |
2523 | QString uid; | 2538 | QString uid; |
2524 | int take; | 2539 | int take; |
2525 | Addressee addresseeL; | 2540 | Addressee addresseeL; |
2526 | Addressee addresseeRSync; | 2541 | Addressee addresseeRSync; |
2527 | Addressee addresseeLSync; | 2542 | Addressee addresseeLSync; |
2528 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); | 2543 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); |
2529 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); | 2544 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); |
2530 | bool fullDateRange = false; | 2545 | bool fullDateRange = false; |
2531 | local->resetTempSyncStat(); | 2546 | local->resetTempSyncStat(); |
2532 | mLastAddressbookSync = QDateTime::currentDateTime(); | 2547 | mLastAddressbookSync = QDateTime::currentDateTime(); |
2533 | if ( syncManager->syncWithDesktop() ) { | 2548 | if ( syncManager->syncWithDesktop() ) { |
2534 | // remote->removeSyncInfo( QString());//remove all info | 2549 | // remote->removeSyncInfo( QString());//remove all info |
2535 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 2550 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
2536 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; | 2551 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; |
2537 | qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); | 2552 | qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); |
2538 | } else { | 2553 | } else { |
2539 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); | 2554 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); |
2540 | } | 2555 | } |
2541 | } | 2556 | } |
2542 | QDateTime modifiedCalendar = mLastAddressbookSync; | 2557 | QDateTime modifiedCalendar = mLastAddressbookSync; |
2543 | addresseeLSync = getLastSyncAddressee(); | 2558 | addresseeLSync = getLastSyncAddressee(); |
2544 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); | 2559 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); |
2545 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); | 2560 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); |
@@ -2589,367 +2604,372 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2589 | #endif | 2604 | #endif |
2590 | 2605 | ||
2591 | //qDebug("*************************** "); | 2606 | //qDebug("*************************** "); |
2592 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); | 2607 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); |
2593 | QStringList er = remote->uidList(); | 2608 | QStringList er = remote->uidList(); |
2594 | Addressee inR ;//= er.first(); | 2609 | Addressee inR ;//= er.first(); |
2595 | Addressee inL; | 2610 | Addressee inL; |
2596 | 2611 | ||
2597 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); | 2612 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); |
2598 | 2613 | ||
2599 | int modulo = (er.count()/10)+1; | 2614 | int modulo = (er.count()/10)+1; |
2600 | int incCounter = 0; | 2615 | int incCounter = 0; |
2601 | while ( incCounter < er.count()) { | 2616 | while ( incCounter < er.count()) { |
2602 | if (syncManager->isProgressBarCanceled()) | 2617 | if (syncManager->isProgressBarCanceled()) |
2603 | return false; | 2618 | return false; |
2604 | if ( incCounter % modulo == 0 ) | 2619 | if ( incCounter % modulo == 0 ) |
2605 | syncManager->showProgressBar(incCounter); | 2620 | syncManager->showProgressBar(incCounter); |
2606 | 2621 | ||
2607 | uid = er[ incCounter ]; | 2622 | uid = er[ incCounter ]; |
2608 | bool skipIncidence = false; | 2623 | bool skipIncidence = false; |
2609 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 2624 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
2610 | skipIncidence = true; | 2625 | skipIncidence = true; |
2611 | QString idS,OidS; | 2626 | QString idS,OidS; |
2612 | qApp->processEvents(); | 2627 | qApp->processEvents(); |
2613 | if ( !skipIncidence ) { | 2628 | if ( !skipIncidence ) { |
2614 | inL = local->findByUid( uid ); | 2629 | inL = local->findByUid( uid ); |
2615 | inR = remote->findByUid( uid ); | 2630 | inR = remote->findByUid( uid ); |
2616 | //inL.setResource( 0 ); | 2631 | //inL.setResource( 0 ); |
2617 | //inR.setResource( 0 ); | 2632 | //inR.setResource( 0 ); |
2618 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars | 2633 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars |
2619 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 2634 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
2620 | if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { | 2635 | if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { |
2621 | //qDebug("take %d %s ", take, inL.summary().latin1()); | 2636 | //qDebug("take %d %s ", take, inL.summary().latin1()); |
2622 | if ( take == 3 ) | 2637 | if ( take == 3 ) |
2623 | return false; | 2638 | return false; |
2624 | if ( take == 1 ) {// take local | 2639 | if ( take == 1 ) {// take local |
2625 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2640 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2626 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2641 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2627 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2642 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2628 | local->insertAddressee( inL, false ); | 2643 | local->insertAddressee( inL, false ); |
2629 | idS = inR.externalUID(); | 2644 | idS = inR.externalUID(); |
2630 | OidS = inR.originalExternalUID(); | 2645 | OidS = inR.originalExternalUID(); |
2631 | } | 2646 | } |
2632 | else | 2647 | else |
2633 | idS = inR.IDStr(); | 2648 | idS = inR.IDStr(); |
2634 | remote->removeAddressee( inR ); | 2649 | remote->removeAddressee( inR ); |
2635 | inR = inL; | 2650 | inR = inL; |
2636 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 2651 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
2637 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2652 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2638 | inR.setOriginalExternalUID( OidS ); | 2653 | inR.setOriginalExternalUID( OidS ); |
2639 | inR.setExternalUID( idS ); | 2654 | inR.setExternalUID( idS ); |
2640 | if ( syncManager->syncWithDesktop() ) | 2655 | if ( syncManager->syncWithDesktop() ) |
2641 | inR.setIDStr("changed" ); | 2656 | inR.setIDStr("changed" ); |
2642 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); | 2657 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); |
2643 | } else { | 2658 | } else { |
2644 | inR.setIDStr( idS ); | 2659 | inR.setIDStr( idS ); |
2645 | } | 2660 | } |
2646 | inR.setResource( 0 ); | 2661 | inR.setResource( 0 ); |
2647 | remote->insertAddressee( inR , false); | 2662 | remote->insertAddressee( inR , false); |
2648 | ++changedRemote; | 2663 | ++changedRemote; |
2649 | } else { // take == 2 take remote | 2664 | } else { // take == 2 take remote |
2650 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2665 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2651 | if ( inR.revision().date().year() < 2004 ) | 2666 | if ( inR.revision().date().year() < 2004 ) |
2652 | inR.setRevision( modifiedCalendar ); | 2667 | inR.setRevision( modifiedCalendar ); |
2653 | } | 2668 | } |
2654 | idS = inL.IDStr(); | 2669 | idS = inL.IDStr(); |
2655 | local->removeAddressee( inL ); | 2670 | local->removeAddressee( inL ); |
2656 | inL = inR; | 2671 | inL = inR; |
2657 | inL.setIDStr( idS ); | 2672 | inL.setIDStr( idS ); |
2658 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2673 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2659 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2674 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2660 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2675 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2661 | } | 2676 | } |
2662 | inL.setResource( 0 ); | 2677 | inL.setResource( 0 ); |
2663 | local->insertAddressee( inL , false ); | 2678 | local->insertAddressee( inL , false ); |
2664 | ++changedLocal; | 2679 | ++changedLocal; |
2665 | } | 2680 | } |
2666 | } | 2681 | } |
2667 | } | 2682 | } |
2668 | } else { // no conflict | 2683 | } else { // no conflict |
2669 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2684 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2670 | QString des = addresseeLSync.note(); | 2685 | QString des = addresseeLSync.note(); |
2671 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 2686 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
2672 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 2687 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
2673 | remote->insertAddressee( inR, false ); | 2688 | remote->insertAddressee( inR, false ); |
2674 | ++deletedAddresseeR; | 2689 | ++deletedAddresseeR; |
2675 | } else { | 2690 | } else { |
2676 | inR.setRevision( modifiedCalendar ); | 2691 | inR.setRevision( modifiedCalendar ); |
2677 | remote->insertAddressee( inR, false ); | 2692 | remote->insertAddressee( inR, false ); |
2678 | inL = inR; | 2693 | inL = inR; |
2679 | inL.setResource( 0 ); | 2694 | inL.setResource( 0 ); |
2680 | local->insertAddressee( inL , false); | 2695 | local->insertAddressee( inL , false); |
2681 | ++addedAddressee; | 2696 | ++addedAddressee; |
2682 | } | 2697 | } |
2683 | } else { | 2698 | } else { |
2684 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { | 2699 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { |
2685 | inR.setRevision( modifiedCalendar ); | 2700 | inR.setRevision( modifiedCalendar ); |
2686 | remote->insertAddressee( inR, false ); | 2701 | remote->insertAddressee( inR, false ); |
2687 | inR.setResource( 0 ); | 2702 | inR.setResource( 0 ); |
2688 | local->insertAddressee( inR, false ); | 2703 | local->insertAddressee( inR, false ); |
2689 | ++addedAddressee; | 2704 | ++addedAddressee; |
2690 | } else { | 2705 | } else { |
2691 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); | 2706 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); |
2692 | remote->removeAddressee( inR ); | 2707 | remote->removeAddressee( inR ); |
2693 | ++deletedAddresseeR; | 2708 | ++deletedAddresseeR; |
2694 | } | 2709 | } |
2695 | } | 2710 | } |
2696 | } | 2711 | } |
2697 | } | 2712 | } |
2698 | ++incCounter; | 2713 | ++incCounter; |
2699 | } | 2714 | } |
2700 | er.clear(); | 2715 | er.clear(); |
2701 | QStringList el = local->uidList(); | 2716 | QStringList el = local->uidList(); |
2702 | modulo = (el.count()/10)+1; | 2717 | modulo = (el.count()/10)+1; |
2703 | 2718 | ||
2704 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); | 2719 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); |
2705 | incCounter = 0; | 2720 | incCounter = 0; |
2706 | while ( incCounter < el.count()) { | 2721 | while ( incCounter < el.count()) { |
2707 | qApp->processEvents(); | 2722 | qApp->processEvents(); |
2708 | if (syncManager->isProgressBarCanceled()) | 2723 | if (syncManager->isProgressBarCanceled()) |
2709 | return false; | 2724 | return false; |
2710 | if ( incCounter % modulo == 0 ) | 2725 | if ( incCounter % modulo == 0 ) |
2711 | syncManager->showProgressBar(incCounter); | 2726 | syncManager->showProgressBar(incCounter); |
2712 | uid = el[ incCounter ]; | 2727 | uid = el[ incCounter ]; |
2713 | bool skipIncidence = false; | 2728 | bool skipIncidence = false; |
2714 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 2729 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
2715 | skipIncidence = true; | 2730 | skipIncidence = true; |
2716 | if ( !skipIncidence ) { | 2731 | if ( !skipIncidence ) { |
2717 | inL = local->findByUid( uid ); | 2732 | inL = local->findByUid( uid ); |
2718 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 2733 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
2719 | inR = remote->findByUid( uid ); | 2734 | inR = remote->findByUid( uid ); |
2720 | if ( inR.isEmpty() ) { | 2735 | if ( inR.isEmpty() ) { |
2721 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2736 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2722 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 2737 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
2723 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 2738 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
2724 | local->removeAddressee( inL ); | 2739 | local->removeAddressee( inL ); |
2725 | ++deletedAddresseeL; | 2740 | ++deletedAddresseeL; |
2726 | } else { | 2741 | } else { |
2727 | if ( ! syncManager->mWriteBackExistingOnly ) { | 2742 | if ( ! syncManager->mWriteBackExistingOnly ) { |
2728 | inL.removeID(mCurrentSyncDevice ); | 2743 | inL.removeID(mCurrentSyncDevice ); |
2729 | ++addedAddresseeR; | 2744 | ++addedAddresseeR; |
2730 | inL.setRevision( modifiedCalendar ); | 2745 | inL.setRevision( modifiedCalendar ); |
2731 | local->insertAddressee( inL, false ); | 2746 | local->insertAddressee( inL, false ); |
2732 | inR = inL; | 2747 | inR = inL; |
2733 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); | 2748 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); |
2734 | inR.setResource( 0 ); | 2749 | inR.setResource( 0 ); |
2735 | remote->insertAddressee( inR, false ); | 2750 | remote->insertAddressee( inR, false ); |
2736 | } | 2751 | } |
2737 | } | 2752 | } |
2738 | } else { | 2753 | } else { |
2739 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { | 2754 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { |
2740 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 2755 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
2741 | local->removeAddressee( inL ); | 2756 | local->removeAddressee( inL ); |
2742 | ++deletedAddresseeL; | 2757 | ++deletedAddresseeL; |
2743 | } else { | 2758 | } else { |
2744 | if ( ! syncManager->mWriteBackExistingOnly ) { | 2759 | if ( ! syncManager->mWriteBackExistingOnly ) { |
2745 | ++addedAddresseeR; | 2760 | ++addedAddresseeR; |
2746 | inL.setRevision( modifiedCalendar ); | 2761 | inL.setRevision( modifiedCalendar ); |
2747 | local->insertAddressee( inL, false ); | 2762 | local->insertAddressee( inL, false ); |
2748 | inR = inL; | 2763 | inR = inL; |
2749 | inR.setResource( 0 ); | 2764 | inR.setResource( 0 ); |
2750 | remote->insertAddressee( inR, false ); | 2765 | remote->insertAddressee( inR, false ); |
2751 | } | 2766 | } |
2752 | } | 2767 | } |
2753 | } | 2768 | } |
2754 | } | 2769 | } |
2755 | } | 2770 | } |
2756 | } | 2771 | } |
2757 | ++incCounter; | 2772 | ++incCounter; |
2758 | } | 2773 | } |
2759 | el.clear(); | 2774 | el.clear(); |
2760 | syncManager->hideProgressBar(); | 2775 | syncManager->hideProgressBar(); |
2761 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); | 2776 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); |
2762 | // get rid of micro seconds | 2777 | // get rid of micro seconds |
2763 | QTime t = mLastAddressbookSync.time(); | 2778 | QTime t = mLastAddressbookSync.time(); |
2764 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 2779 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
2765 | addresseeLSync.setRevision( mLastAddressbookSync ); | 2780 | addresseeLSync.setRevision( mLastAddressbookSync ); |
2766 | addresseeRSync.setRevision( mLastAddressbookSync ); | 2781 | addresseeRSync.setRevision( mLastAddressbookSync ); |
2767 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; | 2782 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; |
2768 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); | 2783 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); |
2769 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; | 2784 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; |
2770 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); | 2785 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); |
2771 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; | 2786 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; |
2772 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); | 2787 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); |
2773 | addresseeRSync.setNote( "" ) ; | 2788 | addresseeRSync.setNote( "" ) ; |
2774 | addresseeLSync.setNote( "" ); | 2789 | addresseeLSync.setNote( "" ); |
2775 | 2790 | ||
2776 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 2791 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
2777 | remote->insertAddressee( addresseeRSync, false ); | 2792 | remote->insertAddressee( addresseeRSync, false ); |
2778 | local->insertAddressee( addresseeLSync, false ); | 2793 | local->insertAddressee( addresseeLSync, false ); |
2779 | QString mes; | 2794 | QString mes; |
2780 | 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 ); | 2795 | 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 ); |
2781 | if ( syncManager->mShowSyncSummary ) { | ||
2782 | KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); | ||
2783 | } | ||
2784 | qDebug( mes ); | 2796 | qDebug( mes ); |
2797 | if ( syncManager->mShowSyncSummary ) { | ||
2798 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | ||
2799 | i18n("KA/Pi Synchronization"),i18n("Write back"))) { | ||
2800 | qDebug("cancelled "); | ||
2801 | return false; | ||
2802 | } | ||
2803 | } | ||
2785 | return syncOK; | 2804 | return syncOK; |
2786 | } | 2805 | } |
2787 | 2806 | ||
2788 | 2807 | ||
2789 | //this is a overwritten callbackmethods from the syncinterface | 2808 | //this is a overwritten callbackmethods from the syncinterface |
2790 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | 2809 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) |
2791 | { | 2810 | { |
2792 | 2811 | ||
2793 | //pending prepare addresseeview for output | 2812 | //pending prepare addresseeview for output |
2794 | //pending detect, if remote file has REV field. if not switch to external sync | 2813 | //pending detect, if remote file has REV field. if not switch to external sync |
2795 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 2814 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
2796 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 2815 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
2797 | 2816 | ||
2798 | AddressBook abLocal(filename,"syncContact"); | 2817 | AddressBook abLocal(filename,"syncContact"); |
2799 | bool syncOK = false; | 2818 | bool syncOK = false; |
2800 | if ( abLocal.load() ) { | 2819 | if ( abLocal.load() ) { |
2801 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); | 2820 | qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); |
2802 | bool external = false; | 2821 | bool external = false; |
2803 | bool isXML = false; | 2822 | bool isXML = false; |
2804 | if ( filename.right(4) == ".xml") { | 2823 | if ( filename.right(4) == ".xml") { |
2805 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2824 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2806 | isXML = true; | 2825 | isXML = true; |
2807 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 2826 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
2808 | } else { | 2827 | } else { |
2809 | external = !manager->mIsKapiFile; | 2828 | external = !manager->mIsKapiFile; |
2810 | if ( external ) { | 2829 | if ( external ) { |
2811 | qDebug("Setting vcf mode to external "); | 2830 | qDebug("Setting vcf mode to external "); |
2812 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2831 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2813 | AddressBook::Iterator it; | 2832 | AddressBook::Iterator it; |
2814 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 2833 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
2815 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | 2834 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); |
2816 | (*it).computeCsum( mCurrentSyncDevice ); | 2835 | (*it).computeCsum( mCurrentSyncDevice ); |
2817 | } | 2836 | } |
2818 | } | 2837 | } |
2819 | } | 2838 | } |
2820 | //AddressBook::Iterator it; | 2839 | //AddressBook::Iterator it; |
2821 | //QStringList vcards; | 2840 | //QStringList vcards; |
2822 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 2841 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
2823 | // qDebug("Name %s ", (*it).familyName().latin1()); | 2842 | // qDebug("Name %s ", (*it).familyName().latin1()); |
2824 | //} | 2843 | //} |
2825 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); | 2844 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); |
2826 | if ( syncOK ) { | 2845 | if ( syncOK ) { |
2827 | if ( syncManager->mWriteBackFile ) | 2846 | if ( syncManager->mWriteBackFile ) |
2828 | { | 2847 | { |
2829 | if ( external ) | 2848 | if ( external ) |
2830 | abLocal.removeSyncAddressees( !isXML); | 2849 | abLocal.removeSyncAddressees( !isXML); |
2831 | qDebug("Saving remote AB "); | 2850 | qDebug("Saving remote AB "); |
2832 | if ( ! abLocal.saveAB()) | 2851 | if ( ! abLocal.saveAB()) |
2833 | qDebug("Error writing back AB to file "); | 2852 | qDebug("Error writing back AB to file "); |
2834 | if ( external ) { | 2853 | if ( external ) { |
2835 | // afterwrite processing | 2854 | // afterwrite processing |
2836 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); | 2855 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); |
2837 | } | 2856 | } |
2838 | } | 2857 | } |
2839 | } | 2858 | } |
2840 | setModified(); | 2859 | setModified(); |
2841 | 2860 | ||
2842 | } | 2861 | } |
2843 | if ( syncOK ) | 2862 | if ( syncOK ) |
2844 | mViewManager->refreshView(); | 2863 | mViewManager->refreshView(); |
2845 | return syncOK; | 2864 | return syncOK; |
2846 | 2865 | ||
2847 | } | 2866 | } |
2848 | void KABCore::removeSyncInfo( QString syncProfile) | 2867 | void KABCore::removeSyncInfo( QString syncProfile) |
2849 | { | 2868 | { |
2850 | qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); | 2869 | qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); |
2851 | mAddressBook->removeSyncInfo( syncProfile ); | 2870 | mAddressBook->removeSyncInfo( syncProfile ); |
2852 | setModified(); | 2871 | setModified(); |
2853 | } | 2872 | } |
2854 | 2873 | ||
2855 | 2874 | ||
2856 | //this is a overwritten callbackmethods from the syncinterface | 2875 | //this is a overwritten callbackmethods from the syncinterface |
2857 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 2876 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
2858 | { | 2877 | { |
2859 | if ( resource == "phone" ) | 2878 | if ( resource == "phone" ) |
2860 | return syncPhone(); | 2879 | return syncPhone(); |
2861 | disableBR( true ); | 2880 | disableBR( true ); |
2862 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 2881 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
2863 | 2882 | ||
2864 | AddressBook abLocal( resource,"syncContact"); | 2883 | AddressBook abLocal( resource,"syncContact"); |
2865 | bool syncOK = false; | 2884 | bool syncOK = false; |
2866 | if ( abLocal.load() ) { | 2885 | if ( abLocal.load() ) { |
2867 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 2886 | qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
2868 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2887 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2869 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 2888 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
2870 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 2889 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2871 | if ( syncOK ) { | 2890 | if ( syncOK ) { |
2872 | if ( syncManager->mWriteBackFile ) { | 2891 | if ( syncManager->mWriteBackFile ) { |
2873 | abLocal.removeSyncAddressees( false ); | 2892 | abLocal.removeSyncAddressees( false ); |
2874 | abLocal.saveAB(); | 2893 | abLocal.saveAB(); |
2875 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 2894 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
2876 | } | 2895 | } |
2877 | } | 2896 | } else |
2897 | message( i18n("Sync cancelled or failed.") ); | ||
2878 | setModified(); | 2898 | setModified(); |
2879 | } | 2899 | } |
2880 | if ( syncOK ) | 2900 | if ( syncOK ) |
2881 | mViewManager->refreshView(); | 2901 | mViewManager->refreshView(); |
2882 | disableBR( false ); | 2902 | disableBR( false ); |
2883 | return syncOK; | 2903 | return syncOK; |
2884 | 2904 | ||
2885 | } | 2905 | } |
2886 | void KABCore::message( QString m ) | 2906 | void KABCore::message( QString m ) |
2887 | { | 2907 | { |
2888 | topLevelWidget()->setCaption( m ); | 2908 | topLevelWidget()->setCaption( m ); |
2889 | mMessageTimer->start( 15000, true ); | 2909 | mMessageTimer->start( 15000, true ); |
2890 | } | 2910 | } |
2891 | bool KABCore::syncPhone() | 2911 | bool KABCore::syncPhone() |
2892 | { | 2912 | { |
2893 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2913 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2894 | QString fileName = getPhoneFile(); | 2914 | QString fileName = getPhoneFile(); |
2895 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 2915 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
2896 | message(i18n("Phone access failed!")); | 2916 | message(i18n("Phone access failed!")); |
2897 | return false; | 2917 | return false; |
2898 | } | 2918 | } |
2899 | AddressBook abLocal( fileName,"syncContact"); | 2919 | AddressBook abLocal( fileName,"syncContact"); |
2900 | bool syncOK = false; | 2920 | bool syncOK = false; |
2901 | { | 2921 | { |
2902 | abLocal.importFromFile( fileName ); | 2922 | abLocal.importFromFile( fileName ); |
2903 | qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 2923 | qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
2904 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 2924 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
2905 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); | 2925 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); |
2906 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 2926 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
2907 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 2927 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
2908 | if ( syncOK ) { | 2928 | if ( syncOK ) { |
2909 | if ( syncManager->mWriteBackFile ) { | 2929 | if ( syncManager->mWriteBackFile ) { |
2910 | abLocal.removeSyncAddressees( true ); | 2930 | abLocal.removeSyncAddressees( true ); |
2911 | abLocal.saveABphone( fileName ); | 2931 | abLocal.saveABphone( fileName ); |
2912 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 2932 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
2913 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 2933 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
2914 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 2934 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
2915 | } | 2935 | } |
2916 | } | 2936 | } |
2917 | setModified(); | 2937 | setModified(); |
2918 | } | 2938 | } |
2919 | if ( syncOK ) | 2939 | if ( syncOK ) |
2920 | mViewManager->refreshView(); | 2940 | mViewManager->refreshView(); |
2921 | return syncOK; | 2941 | return syncOK; |
2922 | } | 2942 | } |
2923 | void KABCore::getFile( bool success ) | 2943 | void KABCore::getFile( bool success ) |
2924 | { | 2944 | { |
2925 | if ( ! success ) { | 2945 | if ( ! success ) { |
2926 | message( i18n("Error receiving file. Nothing changed!") ); | 2946 | message( i18n("Error receiving file. Nothing changed!") ); |
2927 | return; | 2947 | return; |
2928 | } | 2948 | } |
2929 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); | 2949 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); |
2930 | if ( count ) | 2950 | if ( count ) |
2931 | setModified( true ); | 2951 | setModified( true ); |
2932 | message( i18n("Pi-Sync successful!") ); | 2952 | message( i18n("Pi-Sync successful!") ); |
2933 | mViewManager->refreshView(); | 2953 | mViewManager->refreshView(); |
2934 | } | 2954 | } |
2935 | void KABCore::syncFileRequest() | 2955 | void KABCore::syncFileRequest() |
2936 | { | 2956 | { |
2937 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { | 2957 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { |
2938 | syncManager->slotSyncMenu( 999 ); | 2958 | syncManager->slotSyncMenu( 999 ); |
2939 | } | 2959 | } |
2940 | mAddressBook->export2File( sentSyncFile() ); | 2960 | mAddressBook->export2File( sentSyncFile() ); |
2941 | } | 2961 | } |
2942 | QString KABCore::sentSyncFile() | 2962 | QString KABCore::sentSyncFile() |
2943 | { | 2963 | { |
2944 | #ifdef DESKTOP_VERSION | 2964 | #ifdef DESKTOP_VERSION |
2945 | return locateLocal( "tmp", "copysyncab.vcf" ); | 2965 | return locateLocal( "tmp", "copysyncab.vcf" ); |
2946 | #else | 2966 | #else |
2947 | return QString( "/tmp/copysyncab.vcf" ); | 2967 | return QString( "/tmp/copysyncab.vcf" ); |
2948 | #endif | 2968 | #endif |
2949 | } | 2969 | } |
2950 | 2970 | ||
2951 | void KABCore::setCaptionBack() | 2971 | void KABCore::setCaptionBack() |
2952 | { | 2972 | { |
2953 | mMessageTimer->stop(); | 2973 | mMessageTimer->stop(); |
2954 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); | 2974 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); |
2955 | } | 2975 | } |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 6831ec9..c01d598 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -1,504 +1,508 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KABCORE_H | 24 | #ifndef KABCORE_H |
25 | #define KABCORE_H | 25 | #define KABCORE_H |
26 | 26 | ||
27 | #include <kabc/field.h> | 27 | #include <kabc/field.h> |
28 | 28 | ||
29 | #ifndef KAB_EMBEDDED | 29 | #ifndef KAB_EMBEDDED |
30 | #endif //KAB_EMBEDDED | 30 | #endif //KAB_EMBEDDED |
31 | #include <qdict.h> | 31 | #include <qdict.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | 33 | ||
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <ksyncmanager.h> | 36 | #include <ksyncmanager.h> |
37 | #ifndef DESKTOP_VERSION | 37 | #ifndef DESKTOP_VERSION |
38 | #include <qcopchannel_qws.h> | 38 | #include <qcopchannel_qws.h> |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | namespace KABC { | 41 | namespace KABC { |
42 | class AddressBook; | 42 | class AddressBook; |
43 | } | 43 | } |
44 | 44 | ||
45 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
46 | class KAboutData; | 46 | class KAboutData; |
47 | class KConfig; | 47 | class KConfig; |
48 | 48 | ||
49 | class KAddressBookService; | 49 | class KAddressBookService; |
50 | class LDAPSearchDialog; | 50 | class LDAPSearchDialog; |
51 | #else //KAB_EMBEDDED | 51 | #else //KAB_EMBEDDED |
52 | class KAddressBookMain; | 52 | class KAddressBookMain; |
53 | //US class QAction; | 53 | //US class QAction; |
54 | #endif //KAB_EMBEDDED | 54 | #endif //KAB_EMBEDDED |
55 | class KCMultiDialog; | 55 | class KCMultiDialog; |
56 | class KXMLGUIClient; | 56 | class KXMLGUIClient; |
57 | class ExtensionManager; | 57 | class ExtensionManager; |
58 | class XXPortManager; | 58 | class XXPortManager; |
59 | class JumpButtonBar; | 59 | class JumpButtonBar; |
60 | class IncSearchWidget; | 60 | class IncSearchWidget; |
61 | class KDGanttMinimizeSplitter; | 61 | class KDGanttMinimizeSplitter; |
62 | class KAction; | 62 | class KAction; |
63 | class KActionCollection; | 63 | class KActionCollection; |
64 | class KToggleAction; | 64 | class KToggleAction; |
65 | class KSyncProfile; | 65 | class KSyncProfile; |
66 | 66 | ||
67 | class QAction; | 67 | class QAction; |
68 | class QMenuBar; | 68 | class QMenuBar; |
69 | class QSplitter; | 69 | class QSplitter; |
70 | class ViewContainer; | 70 | class ViewContainer; |
71 | class ViewManager; | 71 | class ViewManager; |
72 | class AddresseeEditorDialog; | 72 | class AddresseeEditorDialog; |
73 | class Ir; | 73 | class Ir; |
74 | 74 | ||
75 | class KABCore : public QWidget, public KSyncInterface | 75 | class KABCore : public QWidget, public KSyncInterface |
76 | { | 76 | { |
77 | Q_OBJECT | 77 | Q_OBJECT |
78 | 78 | ||
79 | public: | 79 | public: |
80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); | 80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); |
81 | 81 | ||
82 | 82 | ||
83 | ~KABCore(); | 83 | ~KABCore(); |
84 | 84 | ||
85 | 85 | ||
86 | #ifdef KAB_EMBEDDED | 86 | #ifdef KAB_EMBEDDED |
87 | //US added functionality | 87 | //US added functionality |
88 | QPopupMenu* getViewMenu() {return viewMenu;} | 88 | QPopupMenu* getViewMenu() {return viewMenu;} |
89 | QPopupMenu* getFilterMenu() {return filterMenu;} | 89 | QPopupMenu* getFilterMenu() {return filterMenu;} |
90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} | 90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} |
91 | void addActionsManually(); | 91 | void addActionsManually(); |
92 | #endif //KAB_EMBEDDED | 92 | #endif //KAB_EMBEDDED |
93 | /** | 93 | /** |
94 | Restores the global settings. | 94 | Restores the global settings. |
95 | */ | 95 | */ |
96 | void restoreSettings(); | 96 | void restoreSettings(); |
97 | 97 | ||
98 | /** | 98 | /** |
99 | Saves the global settings. | 99 | Saves the global settings. |
100 | */ | 100 | */ |
101 | void saveSettings(); | 101 | void saveSettings(); |
102 | 102 | ||
103 | /** | 103 | /** |
104 | Returns a pointer to the StdAddressBook of the application. | 104 | Returns a pointer to the StdAddressBook of the application. |
105 | */ | 105 | */ |
106 | KABC::AddressBook *addressBook() const; | 106 | KABC::AddressBook *addressBook() const; |
107 | 107 | ||
108 | /** | 108 | /** |
109 | Returns a pointer to the KConfig object of the application. | 109 | Returns a pointer to the KConfig object of the application. |
110 | */ | 110 | */ |
111 | static KConfig *config(); | 111 | static KConfig *config(); |
112 | 112 | ||
113 | /** | 113 | /** |
114 | Returns a pointer to the global KActionCollection object. So | 114 | Returns a pointer to the global KActionCollection object. So |
115 | other classes can register their actions easily. | 115 | other classes can register their actions easily. |
116 | */ | 116 | */ |
117 | KActionCollection *actionCollection() const; | 117 | KActionCollection *actionCollection() const; |
118 | 118 | ||
119 | /** | 119 | /** |
120 | Returns the current search field of the Incremental Search Widget. | 120 | Returns the current search field of the Incremental Search Widget. |
121 | */ | 121 | */ |
122 | KABC::Field *currentSearchField() const; | 122 | KABC::Field *currentSearchField() const; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | Returns the uid list of the currently selected contacts. | 125 | Returns the uid list of the currently selected contacts. |
126 | */ | 126 | */ |
127 | QStringList selectedUIDs() const; | 127 | QStringList selectedUIDs() const; |
128 | 128 | ||
129 | /** | 129 | /** |
130 | Displays the ResourceSelectDialog and returns the selected | 130 | Displays the ResourceSelectDialog and returns the selected |
131 | resource or a null pointer if no resource was selected by | 131 | resource or a null pointer if no resource was selected by |
132 | the user. | 132 | the user. |
133 | */ | 133 | */ |
134 | KABC::Resource *requestResource( QWidget *parent ); | 134 | KABC::Resource *requestResource( QWidget *parent ); |
135 | 135 | ||
136 | #ifndef KAB_EMBEDDED | 136 | #ifndef KAB_EMBEDDED |
137 | static KAboutData *createAboutData(); | 137 | static KAboutData *createAboutData(); |
138 | #endif //KAB_EMBEDDED | 138 | #endif //KAB_EMBEDDED |
139 | 139 | ||
140 | #ifdef KAB_EMBEDDED | 140 | #ifdef KAB_EMBEDDED |
141 | inline QPopupMenu* getImportMenu() { return ImportMenu;} | 141 | inline QPopupMenu* getImportMenu() { return ImportMenu;} |
142 | inline QPopupMenu* getExportMenu() { return ExportMenu;} | 142 | inline QPopupMenu* getExportMenu() { return ExportMenu;} |
143 | #endif //KAB_EMBEDDED | 143 | #endif //KAB_EMBEDDED |
144 | 144 | ||
145 | public slots: | 145 | public slots: |
146 | #ifdef KAB_EMBEDDED | 146 | #ifdef KAB_EMBEDDED |
147 | void createAboutData(); | 147 | void createAboutData(); |
148 | #endif //KAB_EMBEDDED | 148 | #endif //KAB_EMBEDDED |
149 | void setDetailsToggle(); | 149 | void setDetailsToggle(); |
150 | 150 | ||
151 | void showLicence(); | 151 | void showLicence(); |
152 | void faq(); | 152 | void faq(); |
153 | void whatsnew() ; | 153 | void whatsnew() ; |
154 | void synchowto() ; | 154 | void synchowto() ; |
155 | void multisynchowto() ; | ||
156 | void kdesynchowto() ; | ||
155 | void writeToPhone(); | 157 | void writeToPhone(); |
156 | 158 | ||
157 | /** | 159 | /** |
158 | Is called whenever a contact is selected in the view. | 160 | Is called whenever a contact is selected in the view. |
159 | */ | 161 | */ |
160 | void setContactSelected( const QString &uid ); | 162 | void setContactSelected( const QString &uid ); |
161 | 163 | ||
162 | /** | 164 | /** |
163 | Opens the preferred mail composer with all selected contacts as | 165 | Opens the preferred mail composer with all selected contacts as |
164 | arguments. | 166 | arguments. |
165 | */ | 167 | */ |
166 | void sendMail(); | 168 | void sendMail(); |
167 | 169 | ||
168 | /** | 170 | /** |
169 | Opens the preferred mail composer with the given contacts as | 171 | Opens the preferred mail composer with the given contacts as |
170 | arguments. | 172 | arguments. |
171 | */ | 173 | */ |
172 | void sendMail( const QString& email ); | 174 | void sendMail( const QString& email ); |
173 | 175 | ||
174 | 176 | ||
175 | void mailVCard(); | 177 | void mailVCard(); |
176 | void mailVCard(const QStringList& uids); | 178 | void mailVCard(const QStringList& uids); |
177 | 179 | ||
178 | /** | 180 | /** |
179 | Beams the "WhoAmI contact. | 181 | Beams the "WhoAmI contact. |
180 | */ | 182 | */ |
181 | void beamMySelf(); | 183 | void beamMySelf(); |
182 | 184 | ||
183 | void beamVCard(); | 185 | void beamVCard(); |
184 | void export2phone(); | 186 | void export2phone(); |
185 | void beamVCard(const QStringList& uids); | 187 | void beamVCard(const QStringList& uids); |
186 | void beamDone( Ir *ir ); | 188 | void beamDone( Ir *ir ); |
187 | 189 | ||
188 | 190 | ||
189 | /** | 191 | /** |
190 | Starts the preferred web browser with the given URL as argument. | 192 | Starts the preferred web browser with the given URL as argument. |
191 | */ | 193 | */ |
192 | void browse( const QString& url ); | 194 | void browse( const QString& url ); |
193 | 195 | ||
194 | /** | 196 | /** |
195 | Select all contacts in the view. | 197 | Select all contacts in the view. |
196 | */ | 198 | */ |
197 | void selectAllContacts(); | 199 | void selectAllContacts(); |
198 | 200 | ||
199 | /** | 201 | /** |
200 | Deletes all selected contacts from the address book. | 202 | Deletes all selected contacts from the address book. |
201 | */ | 203 | */ |
202 | void deleteContacts(); | 204 | void deleteContacts(); |
203 | 205 | ||
204 | /** | 206 | /** |
205 | Deletes given contacts from the address book. | 207 | Deletes given contacts from the address book. |
206 | 208 | ||
207 | @param uids The uids of the contacts, which shall be deleted. | 209 | @param uids The uids of the contacts, which shall be deleted. |
208 | */ | 210 | */ |
209 | void deleteContacts( const QStringList &uids ); | 211 | void deleteContacts( const QStringList &uids ); |
210 | 212 | ||
211 | /** | 213 | /** |
212 | Copys the selected contacts into clipboard for later pasting. | 214 | Copys the selected contacts into clipboard for later pasting. |
213 | */ | 215 | */ |
214 | void copyContacts(); | 216 | void copyContacts(); |
215 | 217 | ||
216 | /** | 218 | /** |
217 | Cuts the selected contacts and stores them for later pasting. | 219 | Cuts the selected contacts and stores them for later pasting. |
218 | */ | 220 | */ |
219 | void cutContacts(); | 221 | void cutContacts(); |
220 | 222 | ||
221 | /** | 223 | /** |
222 | Paste contacts from clipboard into the address book. | 224 | Paste contacts from clipboard into the address book. |
223 | */ | 225 | */ |
224 | void pasteContacts(); | 226 | void pasteContacts(); |
225 | 227 | ||
226 | /** | 228 | /** |
227 | Paste given contacts into the address book. | 229 | Paste given contacts into the address book. |
228 | 230 | ||
229 | @param list The list of addressee, which shall be pasted. | 231 | @param list The list of addressee, which shall be pasted. |
230 | */ | 232 | */ |
231 | void pasteContacts( KABC::Addressee::List &list ); | 233 | void pasteContacts( KABC::Addressee::List &list ); |
232 | 234 | ||
233 | /** | 235 | /** |
234 | Sets the whoAmI contact, that is used by many other programs to | 236 | Sets the whoAmI contact, that is used by many other programs to |
235 | get personal information about the current user. | 237 | get personal information about the current user. |
236 | */ | 238 | */ |
237 | void setWhoAmI(); | 239 | void setWhoAmI(); |
238 | 240 | ||
239 | /** | 241 | /** |
240 | Displays the category dialog and applies the result to all | 242 | Displays the category dialog and applies the result to all |
241 | selected contacts. | 243 | selected contacts. |
242 | */ | 244 | */ |
243 | void setCategories(); | 245 | void setCategories(); |
244 | 246 | ||
245 | /** | 247 | /** |
246 | Sets the field list of the Incremental Search Widget. | 248 | Sets the field list of the Incremental Search Widget. |
247 | */ | 249 | */ |
248 | void setSearchFields( const KABC::Field::List &fields ); | 250 | void setSearchFields( const KABC::Field::List &fields ); |
249 | 251 | ||
250 | /** | 252 | /** |
251 | Search with the current search field for a contact, that matches | 253 | Search with the current search field for a contact, that matches |
252 | the given text, and selects it in the view. | 254 | the given text, and selects it in the view. |
253 | */ | 255 | */ |
254 | void incrementalSearch( const QString& text ); | 256 | void incrementalSearch( const QString& text ); |
255 | 257 | ||
256 | /** | 258 | /** |
257 | Marks the address book as modified. | 259 | Marks the address book as modified. |
258 | */ | 260 | */ |
259 | void setModified(); | 261 | void setModified(); |
260 | /** | 262 | /** |
261 | Marks the address book as modified without refreshing the view. | 263 | Marks the address book as modified without refreshing the view. |
262 | */ | 264 | */ |
263 | void setModifiedWOrefresh(); | 265 | void setModifiedWOrefresh(); |
264 | 266 | ||
265 | /** | 267 | /** |
266 | Marks the address book as modified concerning the argument. | 268 | Marks the address book as modified concerning the argument. |
267 | */ | 269 | */ |
268 | void setModified( bool modified ); | 270 | void setModified( bool modified ); |
269 | 271 | ||
270 | /** | 272 | /** |
271 | Returns whether the address book is modified. | 273 | Returns whether the address book is modified. |
272 | */ | 274 | */ |
273 | bool modified() const; | 275 | bool modified() const; |
274 | 276 | ||
275 | /** | 277 | /** |
276 | Called whenever an contact is modified in the contact editor | 278 | Called whenever an contact is modified in the contact editor |
277 | dialog or the quick edit. | 279 | dialog or the quick edit. |
278 | */ | 280 | */ |
279 | void contactModified( const KABC::Addressee &addr ); | 281 | void contactModified( const KABC::Addressee &addr ); |
280 | 282 | ||
281 | /** | 283 | /** |
282 | DCOP METHODS. | 284 | DCOP METHODS. |
283 | */ | 285 | */ |
284 | void addEmail( QString addr ); | 286 | void addEmail( QString addr ); |
285 | void importVCard( const KURL& url, bool showPreview ); | 287 | void importVCard( const KURL& url, bool showPreview ); |
286 | void importVCard( const QString& vCard, bool showPreview ); | 288 | void importVCard( const QString& vCard, bool showPreview ); |
287 | void newContact(); | 289 | void newContact(); |
288 | QString getNameByPhone( const QString& phone ); | 290 | QString getNameByPhone( const QString& phone ); |
289 | /** | 291 | /** |
290 | END DCOP METHODS | 292 | END DCOP METHODS |
291 | */ | 293 | */ |
292 | 294 | ||
293 | /** | 295 | /** |
294 | Saves the contents of the AddressBook back to disk. | 296 | Saves the contents of the AddressBook back to disk. |
295 | */ | 297 | */ |
296 | void save(); | 298 | void save(); |
297 | 299 | ||
298 | /** | 300 | /** |
299 | Undos the last command using the undo stack. | 301 | Undos the last command using the undo stack. |
300 | */ | 302 | */ |
301 | void undo(); | 303 | void undo(); |
302 | 304 | ||
303 | /** | 305 | /** |
304 | Redos the last command that was undone, using the redo stack. | 306 | Redos the last command that was undone, using the redo stack. |
305 | */ | 307 | */ |
306 | void redo(); | 308 | void redo(); |
307 | 309 | ||
308 | /** | 310 | /** |
309 | Shows the edit dialog for the given uid. If the uid is QString::null, | 311 | Shows the edit dialog for the given uid. If the uid is QString::null, |
310 | the method will try to find a selected addressee in the view. | 312 | the method will try to find a selected addressee in the view. |
311 | */ | 313 | */ |
312 | void editContact( const QString &uid /*US = QString::null*/ ); | 314 | void editContact( const QString &uid /*US = QString::null*/ ); |
313 | //US added a second method without defaultparameter | 315 | //US added a second method without defaultparameter |
314 | void editContact2(); | 316 | void editContact2(); |
315 | 317 | ||
316 | /** | 318 | /** |
317 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 319 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
318 | the method will try to find a selected addressee in the view. | 320 | the method will try to find a selected addressee in the view. |
319 | */ | 321 | */ |
320 | void executeContact( const QString &uid /*US = QString::null*/ ); | 322 | void executeContact( const QString &uid /*US = QString::null*/ ); |
321 | 323 | ||
322 | /** | 324 | /** |
323 | Launches the configuration dialog. | 325 | Launches the configuration dialog. |
324 | */ | 326 | */ |
325 | void openConfigDialog(); | 327 | void openConfigDialog(); |
326 | 328 | ||
327 | /** | 329 | /** |
328 | Launches the ldap search dialog. | 330 | Launches the ldap search dialog. |
329 | */ | 331 | */ |
330 | void openLDAPDialog(); | 332 | void openLDAPDialog(); |
331 | 333 | ||
332 | /** | 334 | /** |
333 | Creates a KAddressBookPrinter, which will display the print | 335 | Creates a KAddressBookPrinter, which will display the print |
334 | dialog and do the printing. | 336 | dialog and do the printing. |
335 | */ | 337 | */ |
336 | void print(); | 338 | void print(); |
337 | 339 | ||
338 | /** | 340 | /** |
339 | Registers a new GUI client, so plugins can register its actions. | 341 | Registers a new GUI client, so plugins can register its actions. |
340 | */ | 342 | */ |
341 | void addGUIClient( KXMLGUIClient *client ); | 343 | void addGUIClient( KXMLGUIClient *client ); |
342 | 344 | ||
343 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 345 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
344 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 346 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
345 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 347 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
346 | 348 | ||
347 | 349 | ||
348 | signals: | 350 | signals: |
349 | void contactSelected( const QString &name ); | 351 | void contactSelected( const QString &name ); |
350 | void contactSelected( const QPixmap &pixmap ); | 352 | void contactSelected( const QPixmap &pixmap ); |
351 | public slots: | 353 | public slots: |
352 | void recieve(QString cmsg ); | 354 | void recieve(QString cmsg ); |
353 | void getFile( bool success ); | 355 | void getFile( bool success ); |
354 | void syncFileRequest(); | 356 | void syncFileRequest(); |
355 | void setDetailsVisible( bool visible ); | 357 | void setDetailsVisible( bool visible ); |
356 | void setDetailsToState(); | 358 | void setDetailsToState(); |
357 | // void slotSyncMenu( int ); | 359 | // void slotSyncMenu( int ); |
358 | private slots: | 360 | private slots: |
359 | void receive( const QCString& cmsg, const QByteArray& data ); | 361 | void receive( const QCString& cmsg, const QByteArray& data ); |
360 | void toggleBeamReceive( ); | 362 | void toggleBeamReceive( ); |
361 | void disableBR(bool); | 363 | void disableBR(bool); |
362 | void setJumpButtonBarVisible( bool visible ); | 364 | void setJumpButtonBarVisible( bool visible ); |
363 | void setCaptionBack(); | 365 | void setCaptionBack(); |
364 | void importFromOL(); | 366 | void importFromOL(); |
365 | void extensionModified( const KABC::Addressee::List &list ); | 367 | void extensionModified( const KABC::Addressee::List &list ); |
366 | void extensionChanged( int id ); | 368 | void extensionChanged( int id ); |
367 | void clipboardDataChanged(); | 369 | void clipboardDataChanged(); |
368 | void updateActionMenu(); | 370 | void updateActionMenu(); |
369 | void configureKeyBindings(); | 371 | void configureKeyBindings(); |
370 | void removeVoice(); | 372 | void removeVoice(); |
371 | #ifdef KAB_EMBEDDED | 373 | #ifdef KAB_EMBEDDED |
372 | void configureResources(); | 374 | void configureResources(); |
373 | #endif //KAB_EMBEDDED | 375 | #endif //KAB_EMBEDDED |
374 | 376 | ||
375 | void slotEditorDestroyed( const QString &uid ); | 377 | void slotEditorDestroyed( const QString &uid ); |
376 | void configurationChanged(); | 378 | void configurationChanged(); |
377 | void addressBookChanged(); | 379 | void addressBookChanged(); |
378 | 380 | ||
379 | private: | 381 | private: |
380 | bool mBRdisabled; | 382 | bool mBRdisabled; |
381 | #ifndef DESKTOP_VERSION | 383 | #ifndef DESKTOP_VERSION |
382 | QCopChannel* infrared; | 384 | QCopChannel* infrared; |
383 | #endif | 385 | #endif |
384 | QTimer *mMessageTimer; | 386 | QTimer *mMessageTimer; |
385 | void initGUI(); | 387 | void initGUI(); |
386 | void initActions(); | 388 | void initActions(); |
387 | QString getPhoneFile(); | 389 | QString getPhoneFile(); |
388 | 390 | ||
389 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 391 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
390 | const char *name = 0 ); | 392 | const char *name = 0 ); |
391 | 393 | ||
392 | KXMLGUIClient *mGUIClient; | 394 | KXMLGUIClient *mGUIClient; |
393 | 395 | ||
394 | KABC::AddressBook *mAddressBook; | 396 | KABC::AddressBook *mAddressBook; |
395 | 397 | ||
396 | ViewManager *mViewManager; | 398 | ViewManager *mViewManager; |
397 | // QSplitter *mDetailsSplitter; | 399 | // QSplitter *mDetailsSplitter; |
398 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 400 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
399 | ViewContainer *mDetails; | 401 | ViewContainer *mDetails; |
400 | KDGanttMinimizeSplitter* mMiniSplitter; | 402 | KDGanttMinimizeSplitter* mMiniSplitter; |
401 | XXPortManager *mXXPortManager; | 403 | XXPortManager *mXXPortManager; |
402 | JumpButtonBar *mJumpButtonBar; | 404 | JumpButtonBar *mJumpButtonBar; |
403 | IncSearchWidget *mIncSearchWidget; | 405 | IncSearchWidget *mIncSearchWidget; |
404 | ExtensionManager *mExtensionManager; | 406 | ExtensionManager *mExtensionManager; |
405 | 407 | ||
406 | KCMultiDialog *mConfigureDialog; | 408 | KCMultiDialog *mConfigureDialog; |
407 | 409 | ||
408 | #ifndef KAB_EMBEDDED | 410 | #ifndef KAB_EMBEDDED |
409 | LDAPSearchDialog *mLdapSearchDialog; | 411 | LDAPSearchDialog *mLdapSearchDialog; |
410 | #endif //KAB_EMBEDDED | 412 | #endif //KAB_EMBEDDED |
411 | // QDict<AddresseeEditorDialog> mEditorDict; | 413 | // QDict<AddresseeEditorDialog> mEditorDict; |
412 | AddresseeEditorDialog *mEditorDialog; | 414 | AddresseeEditorDialog *mEditorDialog; |
413 | bool mReadWrite; | 415 | bool mReadWrite; |
414 | bool mModified; | 416 | bool mModified; |
415 | bool mIsPart; | 417 | bool mIsPart; |
416 | bool mMultipleViewsAtOnce; | 418 | bool mMultipleViewsAtOnce; |
417 | 419 | ||
418 | 420 | ||
419 | //US file menu | 421 | //US file menu |
420 | KAction *mActionMail; | 422 | KAction *mActionMail; |
421 | KAction *mActionBeam; | 423 | KAction *mActionBeam; |
422 | KToggleAction *mActionBR; | 424 | KToggleAction *mActionBR; |
423 | KAction *mActionExport2phone; | 425 | KAction *mActionExport2phone; |
424 | KAction* mActionPrint; | 426 | KAction* mActionPrint; |
425 | KAction* mActionNewContact; | 427 | KAction* mActionNewContact; |
426 | KAction *mActionSave; | 428 | KAction *mActionSave; |
427 | KAction *mActionEditAddressee; | 429 | KAction *mActionEditAddressee; |
428 | KAction *mActionMailVCard; | 430 | KAction *mActionMailVCard; |
429 | KAction *mActionBeamVCard; | 431 | KAction *mActionBeamVCard; |
430 | 432 | ||
431 | KAction *mActionQuit; | 433 | KAction *mActionQuit; |
432 | 434 | ||
433 | //US edit menu | 435 | //US edit menu |
434 | KAction *mActionCopy; | 436 | KAction *mActionCopy; |
435 | KAction *mActionCut; | 437 | KAction *mActionCut; |
436 | KAction *mActionPaste; | 438 | KAction *mActionPaste; |
437 | KAction *mActionSelectAll; | 439 | KAction *mActionSelectAll; |
438 | KAction *mActionUndo; | 440 | KAction *mActionUndo; |
439 | KAction *mActionRedo; | 441 | KAction *mActionRedo; |
440 | KAction *mActionDelete; | 442 | KAction *mActionDelete; |
441 | 443 | ||
442 | //US settings menu | 444 | //US settings menu |
443 | KAction *mActionConfigResources; | 445 | KAction *mActionConfigResources; |
444 | KAction *mActionConfigKAddressbook; | 446 | KAction *mActionConfigKAddressbook; |
445 | KAction *mActionConfigShortcuts; | 447 | KAction *mActionConfigShortcuts; |
446 | KAction *mActionConfigureToolbars; | 448 | KAction *mActionConfigureToolbars; |
447 | KAction *mActionKeyBindings; | 449 | KAction *mActionKeyBindings; |
448 | KToggleAction *mActionJumpBar; | 450 | KToggleAction *mActionJumpBar; |
449 | KToggleAction *mActionDetails; | 451 | KToggleAction *mActionDetails; |
450 | KAction *mActionWhoAmI; | 452 | KAction *mActionWhoAmI; |
451 | KAction *mActionCategories; | 453 | KAction *mActionCategories; |
452 | KAction *mActionAboutKAddressbook; | 454 | KAction *mActionAboutKAddressbook; |
453 | KAction *mActionLicence; | 455 | KAction *mActionLicence; |
454 | KAction *mActionFaq; | 456 | KAction *mActionFaq; |
455 | KAction *mActionWN; | 457 | KAction *mActionWN; |
456 | KAction *mActionSyncHowto; | 458 | KAction *mActionSyncHowto; |
459 | KAction *mActionKdeSyncHowto; | ||
460 | KAction *mActionMultiSyncHowto; | ||
457 | 461 | ||
458 | KAction *mActionDeleteView; | 462 | KAction *mActionDeleteView; |
459 | 463 | ||
460 | QPopupMenu *viewMenu; | 464 | QPopupMenu *viewMenu; |
461 | QPopupMenu *filterMenu; | 465 | QPopupMenu *filterMenu; |
462 | QPopupMenu *settingsMenu; | 466 | QPopupMenu *settingsMenu; |
463 | QPopupMenu *changeMenu; | 467 | QPopupMenu *changeMenu; |
464 | //US QAction *mActionSave; | 468 | //US QAction *mActionSave; |
465 | QPopupMenu *ImportMenu; | 469 | QPopupMenu *ImportMenu; |
466 | QPopupMenu *ExportMenu; | 470 | QPopupMenu *ExportMenu; |
467 | //LR additional methods | 471 | //LR additional methods |
468 | KAction *mActionRemoveVoice; | 472 | KAction *mActionRemoveVoice; |
469 | KAction * mActionImportOL; | 473 | KAction * mActionImportOL; |
470 | 474 | ||
471 | #ifndef KAB_EMBEDDED | 475 | #ifndef KAB_EMBEDDED |
472 | KAddressBookService *mAddressBookService; | 476 | KAddressBookService *mAddressBookService; |
473 | #endif //KAB_EMBEDDED | 477 | #endif //KAB_EMBEDDED |
474 | 478 | ||
475 | class KABCorePrivate; | 479 | class KABCorePrivate; |
476 | KABCorePrivate *d; | 480 | KABCorePrivate *d; |
477 | //US bool mBlockSaveFlag; | 481 | //US bool mBlockSaveFlag; |
478 | 482 | ||
479 | #ifdef KAB_EMBEDDED | 483 | #ifdef KAB_EMBEDDED |
480 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 484 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
481 | #endif //KAB_EMBEDDED | 485 | #endif //KAB_EMBEDDED |
482 | 486 | ||
483 | //this are the overwritten callbackmethods from the syncinterface | 487 | //this are the overwritten callbackmethods from the syncinterface |
484 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 488 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
485 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 489 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
486 | virtual void removeSyncInfo( QString syncProfile); | 490 | virtual void removeSyncInfo( QString syncProfile); |
487 | bool syncPhone(); | 491 | bool syncPhone(); |
488 | void message( QString m ); | 492 | void message( QString m ); |
489 | 493 | ||
490 | // LR ******************************* | 494 | // LR ******************************* |
491 | // sync stuff! | 495 | // sync stuff! |
492 | QString sentSyncFile(); | 496 | QString sentSyncFile(); |
493 | QPopupMenu *syncMenu; | 497 | QPopupMenu *syncMenu; |
494 | KSyncManager* syncManager; | 498 | KSyncManager* syncManager; |
495 | int mGlobalSyncMode; | 499 | int mGlobalSyncMode; |
496 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 500 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
497 | KABC::Addressee getLastSyncAddressee(); | 501 | KABC::Addressee getLastSyncAddressee(); |
498 | QDateTime mLastAddressbookSync; | 502 | QDateTime mLastAddressbookSync; |
499 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 503 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
500 | // ********************* | 504 | // ********************* |
501 | 505 | ||
502 | }; | 506 | }; |
503 | 507 | ||
504 | #endif | 508 | #endif |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 6e61351..4667918 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1005,502 +1005,508 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int | |||
1005 | ++incCounter; | 1005 | ++incCounter; |
1006 | uid = inR->uid(); | 1006 | uid = inR->uid(); |
1007 | bool skipIncidence = false; | 1007 | bool skipIncidence = false; |
1008 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1008 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1009 | skipIncidence = true; | 1009 | skipIncidence = true; |
1010 | QString idS; | 1010 | QString idS; |
1011 | qApp->processEvents(); | 1011 | qApp->processEvents(); |
1012 | if ( !skipIncidence ) { | 1012 | if ( !skipIncidence ) { |
1013 | inL = local->incidence( uid ); | 1013 | inL = local->incidence( uid ); |
1014 | if ( inL ) { // maybe conflict - same uid in both calendars | 1014 | if ( inL ) { // maybe conflict - same uid in both calendars |
1015 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1015 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1016 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1016 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1017 | if ( take == 3 ) | 1017 | if ( take == 3 ) |
1018 | return false; | 1018 | return false; |
1019 | if ( take == 1 ) {// take local | 1019 | if ( take == 1 ) {// take local |
1020 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1020 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1021 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1021 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1022 | else | 1022 | else |
1023 | idS = inR->IDStr(); | 1023 | idS = inR->IDStr(); |
1024 | remote->deleteIncidence( inR ); | 1024 | remote->deleteIncidence( inR ); |
1025 | inR = inL->clone(); | 1025 | inR = inL->clone(); |
1026 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1026 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1027 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1027 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1028 | inR->setIDStr( idS ); | 1028 | inR->setIDStr( idS ); |
1029 | remote->addIncidence( inR ); | 1029 | remote->addIncidence( inR ); |
1030 | if ( mSyncManager->syncWithDesktop() ) | 1030 | if ( mSyncManager->syncWithDesktop() ) |
1031 | inR->setPilotId( 2 ); | 1031 | inR->setPilotId( 2 ); |
1032 | ++changedRemote; | 1032 | ++changedRemote; |
1033 | } else { | 1033 | } else { |
1034 | idS = inL->IDStr(); | 1034 | idS = inL->IDStr(); |
1035 | int pid = inL->pilotId(); | 1035 | int pid = inL->pilotId(); |
1036 | local->deleteIncidence( inL ); | 1036 | local->deleteIncidence( inL ); |
1037 | inL = inR->clone(); | 1037 | inL = inR->clone(); |
1038 | if ( mSyncManager->syncWithDesktop() ) | 1038 | if ( mSyncManager->syncWithDesktop() ) |
1039 | inL->setPilotId( pid ); | 1039 | inL->setPilotId( pid ); |
1040 | inL->setIDStr( idS ); | 1040 | inL->setIDStr( idS ); |
1041 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1041 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1042 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1042 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1043 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1043 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1044 | } | 1044 | } |
1045 | local->addIncidence( inL ); | 1045 | local->addIncidence( inL ); |
1046 | ++changedLocal; | 1046 | ++changedLocal; |
1047 | } | 1047 | } |
1048 | } | 1048 | } |
1049 | } else { // no conflict | 1049 | } else { // no conflict |
1050 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1050 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1051 | QString des = eventLSync->description(); | 1051 | QString des = eventLSync->description(); |
1052 | QString pref = "e"; | 1052 | QString pref = "e"; |
1053 | if ( inR->type() == "Todo" ) | 1053 | if ( inR->type() == "Todo" ) |
1054 | pref = "t"; | 1054 | pref = "t"; |
1055 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1055 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1056 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1056 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1057 | //remote->deleteIncidence( inR ); | 1057 | //remote->deleteIncidence( inR ); |
1058 | ++deletedEventR; | 1058 | ++deletedEventR; |
1059 | } else { | 1059 | } else { |
1060 | inR->setLastModified( modifiedCalendar ); | 1060 | inR->setLastModified( modifiedCalendar ); |
1061 | inL = inR->clone(); | 1061 | inL = inR->clone(); |
1062 | inL->setIDStr( ":" ); | 1062 | inL->setIDStr( ":" ); |
1063 | local->addIncidence( inL ); | 1063 | local->addIncidence( inL ); |
1064 | ++addedEvent; | 1064 | ++addedEvent; |
1065 | } | 1065 | } |
1066 | } else { | 1066 | } else { |
1067 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1067 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1068 | inR->setLastModified( modifiedCalendar ); | 1068 | inR->setLastModified( modifiedCalendar ); |
1069 | inL = inR->clone(); | 1069 | inL = inR->clone(); |
1070 | inL->setIDStr( ":" ); | 1070 | inL->setIDStr( ":" ); |
1071 | local->addIncidence( inL ); | 1071 | local->addIncidence( inL ); |
1072 | ++addedEvent; | 1072 | ++addedEvent; |
1073 | } else { | 1073 | } else { |
1074 | checkExternSyncEvent(eventRSyncSharp, inR); | 1074 | checkExternSyncEvent(eventRSyncSharp, inR); |
1075 | remote->deleteIncidence( inR ); | 1075 | remote->deleteIncidence( inR ); |
1076 | ++deletedEventR; | 1076 | ++deletedEventR; |
1077 | } | 1077 | } |
1078 | } | 1078 | } |
1079 | } | 1079 | } |
1080 | } | 1080 | } |
1081 | inR = er.next(); | 1081 | inR = er.next(); |
1082 | } | 1082 | } |
1083 | QPtrList<Incidence> el = local->rawIncidences(); | 1083 | QPtrList<Incidence> el = local->rawIncidences(); |
1084 | inL = el.first(); | 1084 | inL = el.first(); |
1085 | modulo = (el.count()/10)+1; | 1085 | modulo = (el.count()/10)+1; |
1086 | bar.setCaption (i18n("Add / remove events") ); | 1086 | bar.setCaption (i18n("Add / remove events") ); |
1087 | bar.setTotalSteps ( el.count() ) ; | 1087 | bar.setTotalSteps ( el.count() ) ; |
1088 | bar.show(); | 1088 | bar.show(); |
1089 | incCounter = 0; | 1089 | incCounter = 0; |
1090 | 1090 | ||
1091 | while ( inL ) { | 1091 | while ( inL ) { |
1092 | 1092 | ||
1093 | qApp->processEvents(); | 1093 | qApp->processEvents(); |
1094 | if ( ! bar.isVisible() ) | 1094 | if ( ! bar.isVisible() ) |
1095 | return false; | 1095 | return false; |
1096 | if ( incCounter % modulo == 0 ) | 1096 | if ( incCounter % modulo == 0 ) |
1097 | bar.setProgress( incCounter ); | 1097 | bar.setProgress( incCounter ); |
1098 | ++incCounter; | 1098 | ++incCounter; |
1099 | uid = inL->uid(); | 1099 | uid = inL->uid(); |
1100 | bool skipIncidence = false; | 1100 | bool skipIncidence = false; |
1101 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1101 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1102 | skipIncidence = true; | 1102 | skipIncidence = true; |
1103 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) | 1103 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1104 | skipIncidence = true; | 1104 | skipIncidence = true; |
1105 | if ( !skipIncidence ) { | 1105 | if ( !skipIncidence ) { |
1106 | inR = remote->incidence( uid ); | 1106 | inR = remote->incidence( uid ); |
1107 | if ( ! inR ) { | 1107 | if ( ! inR ) { |
1108 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1108 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1109 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1109 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1110 | checkExternSyncEvent(eventLSyncSharp, inL); | 1110 | checkExternSyncEvent(eventLSyncSharp, inL); |
1111 | local->deleteIncidence( inL ); | 1111 | local->deleteIncidence( inL ); |
1112 | ++deletedEventL; | 1112 | ++deletedEventL; |
1113 | } else { | 1113 | } else { |
1114 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1114 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1115 | inL->removeID(mCurrentSyncDevice ); | 1115 | inL->removeID(mCurrentSyncDevice ); |
1116 | ++addedEventR; | 1116 | ++addedEventR; |
1117 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1117 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1118 | inL->setLastModified( modifiedCalendar ); | 1118 | inL->setLastModified( modifiedCalendar ); |
1119 | inR = inL->clone(); | 1119 | inR = inL->clone(); |
1120 | inR->setIDStr( ":" ); | 1120 | inR->setIDStr( ":" ); |
1121 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1121 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1122 | remote->addIncidence( inR ); | 1122 | remote->addIncidence( inR ); |
1123 | } | 1123 | } |
1124 | } | 1124 | } |
1125 | } else { | 1125 | } else { |
1126 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1126 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1127 | checkExternSyncEvent(eventLSyncSharp, inL); | 1127 | checkExternSyncEvent(eventLSyncSharp, inL); |
1128 | local->deleteIncidence( inL ); | 1128 | local->deleteIncidence( inL ); |
1129 | ++deletedEventL; | 1129 | ++deletedEventL; |
1130 | } else { | 1130 | } else { |
1131 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1131 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1132 | ++addedEventR; | 1132 | ++addedEventR; |
1133 | inL->setLastModified( modifiedCalendar ); | 1133 | inL->setLastModified( modifiedCalendar ); |
1134 | inR = inL->clone(); | 1134 | inR = inL->clone(); |
1135 | inR->setIDStr( ":" ); | 1135 | inR->setIDStr( ":" ); |
1136 | remote->addIncidence( inR ); | 1136 | remote->addIncidence( inR ); |
1137 | } | 1137 | } |
1138 | } | 1138 | } |
1139 | } | 1139 | } |
1140 | } | 1140 | } |
1141 | } | 1141 | } |
1142 | inL = el.next(); | 1142 | inL = el.next(); |
1143 | } | 1143 | } |
1144 | int delFut = 0; | 1144 | int delFut = 0; |
1145 | int remRem = 0; | 1145 | int remRem = 0; |
1146 | if ( mSyncManager->mWriteBackInFuture ) { | 1146 | if ( mSyncManager->mWriteBackInFuture ) { |
1147 | er = remote->rawIncidences(); | 1147 | er = remote->rawIncidences(); |
1148 | remRem = er.count(); | 1148 | remRem = er.count(); |
1149 | inR = er.first(); | 1149 | inR = er.first(); |
1150 | QDateTime dt; | 1150 | QDateTime dt; |
1151 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1151 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1152 | QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); | 1152 | QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); |
1153 | while ( inR ) { | 1153 | while ( inR ) { |
1154 | if ( inR->type() == "Todo" ) { | 1154 | if ( inR->type() == "Todo" ) { |
1155 | Todo * t = (Todo*)inR; | 1155 | Todo * t = (Todo*)inR; |
1156 | if ( t->hasDueDate() ) | 1156 | if ( t->hasDueDate() ) |
1157 | dt = t->dtDue(); | 1157 | dt = t->dtDue(); |
1158 | else | 1158 | else |
1159 | dt = cur.addSecs( 62 ); | 1159 | dt = cur.addSecs( 62 ); |
1160 | } | 1160 | } |
1161 | else if (inR->type() == "Event" ) { | 1161 | else if (inR->type() == "Event" ) { |
1162 | bool ok; | 1162 | bool ok; |
1163 | dt = inR->getNextOccurence( cur, &ok ); | 1163 | dt = inR->getNextOccurence( cur, &ok ); |
1164 | if ( !ok ) | 1164 | if ( !ok ) |
1165 | dt = cur.addSecs( -62 ); | 1165 | dt = cur.addSecs( -62 ); |
1166 | } | 1166 | } |
1167 | else | 1167 | else |
1168 | dt = inR->dtStart(); | 1168 | dt = inR->dtStart(); |
1169 | if ( dt < cur || dt > end ) { | 1169 | if ( dt < cur || dt > end ) { |
1170 | remote->deleteIncidence( inR ); | 1170 | remote->deleteIncidence( inR ); |
1171 | ++delFut; | 1171 | ++delFut; |
1172 | } | 1172 | } |
1173 | inR = er.next(); | 1173 | inR = er.next(); |
1174 | } | 1174 | } |
1175 | } | 1175 | } |
1176 | bar.hide(); | 1176 | bar.hide(); |
1177 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1177 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1178 | eventLSync->setReadOnly( false ); | 1178 | eventLSync->setReadOnly( false ); |
1179 | eventLSync->setDtStart( mLastCalendarSync ); | 1179 | eventLSync->setDtStart( mLastCalendarSync ); |
1180 | eventRSync->setDtStart( mLastCalendarSync ); | 1180 | eventRSync->setDtStart( mLastCalendarSync ); |
1181 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1181 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1182 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1182 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1183 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1183 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1184 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1184 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1185 | eventLSync->setReadOnly( true ); | 1185 | eventLSync->setReadOnly( true ); |
1186 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... | 1186 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... |
1187 | remote->addEvent( eventRSync ); | 1187 | remote->addEvent( eventRSync ); |
1188 | else | 1188 | else |
1189 | delete eventRSync; | 1189 | delete eventRSync; |
1190 | QString mes; | 1190 | QString mes; |
1191 | 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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); | 1191 | 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"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); |
1192 | QString delmess; | 1192 | QString delmess; |
1193 | if ( delFut ) { | 1193 | if ( delFut ) { |
1194 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); | 1194 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); |
1195 | mes += delmess; | 1195 | mes += delmess; |
1196 | } | 1196 | } |
1197 | mCalendar->checkAlarmForIncidence( 0, true ); | ||
1198 | qDebug( mes ); | ||
1197 | if ( mSyncManager->mShowSyncSummary ) { | 1199 | if ( mSyncManager->mShowSyncSummary ) { |
1198 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); | 1200 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
1201 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { | ||
1202 | qDebug("cancelled "); | ||
1203 | return false; | ||
1204 | } | ||
1199 | } | 1205 | } |
1200 | qDebug( mes ); | ||
1201 | mCalendar->checkAlarmForIncidence( 0, true ); | ||
1202 | return syncOK; | 1206 | return syncOK; |
1203 | } | 1207 | } |
1204 | 1208 | ||
1205 | void CalendarView::setSyncDevice( QString s ) | 1209 | void CalendarView::setSyncDevice( QString s ) |
1206 | { | 1210 | { |
1207 | mCurrentSyncDevice= s; | 1211 | mCurrentSyncDevice= s; |
1208 | } | 1212 | } |
1209 | void CalendarView::setSyncName( QString s ) | 1213 | void CalendarView::setSyncName( QString s ) |
1210 | { | 1214 | { |
1211 | mCurrentSyncName= s; | 1215 | mCurrentSyncName= s; |
1212 | } | 1216 | } |
1213 | bool CalendarView::syncCalendar(QString filename, int mode) | 1217 | bool CalendarView::syncCalendar(QString filename, int mode) |
1214 | { | 1218 | { |
1215 | //qDebug("syncCalendar %s ", filename.latin1()); | 1219 | //qDebug("syncCalendar %s ", filename.latin1()); |
1216 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1220 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1217 | CalendarLocal* calendar = new CalendarLocal(); | 1221 | CalendarLocal* calendar = new CalendarLocal(); |
1218 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1222 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1219 | FileStorage* storage = new FileStorage( calendar ); | 1223 | FileStorage* storage = new FileStorage( calendar ); |
1220 | bool syncOK = false; | 1224 | bool syncOK = false; |
1221 | storage->setFileName( filename ); | 1225 | storage->setFileName( filename ); |
1222 | // qDebug("loading ... "); | 1226 | // qDebug("loading ... "); |
1223 | if ( storage->load() ) { | 1227 | if ( storage->load() ) { |
1224 | getEventViewerDialog()->setSyncMode( true ); | 1228 | getEventViewerDialog()->setSyncMode( true ); |
1225 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1229 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1226 | getEventViewerDialog()->setSyncMode( false ); | 1230 | getEventViewerDialog()->setSyncMode( false ); |
1227 | if ( syncOK ) { | 1231 | if ( syncOK ) { |
1228 | if ( mSyncManager->mWriteBackFile ) | 1232 | if ( mSyncManager->mWriteBackFile ) |
1229 | { | 1233 | { |
1230 | storage->setSaveFormat( new ICalFormat() ); | 1234 | storage->setSaveFormat( new ICalFormat() ); |
1231 | storage->save(); | 1235 | storage->save(); |
1232 | } | 1236 | } |
1233 | } | 1237 | } |
1234 | setModified( true ); | 1238 | setModified( true ); |
1235 | } | 1239 | } |
1236 | delete storage; | 1240 | delete storage; |
1237 | delete calendar; | 1241 | delete calendar; |
1238 | if ( syncOK ) | 1242 | if ( syncOK ) |
1239 | updateView(); | 1243 | updateView(); |
1240 | return syncOK; | 1244 | return syncOK; |
1241 | } | 1245 | } |
1242 | 1246 | ||
1243 | void CalendarView::syncExternal( int mode ) | 1247 | void CalendarView::syncExternal( int mode ) |
1244 | { | 1248 | { |
1245 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1249 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1246 | 1250 | ||
1247 | qApp->processEvents(); | 1251 | qApp->processEvents(); |
1248 | CalendarLocal* calendar = new CalendarLocal(); | 1252 | CalendarLocal* calendar = new CalendarLocal(); |
1249 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1253 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1250 | bool syncOK = false; | 1254 | bool syncOK = false; |
1251 | bool loadSuccess = false; | 1255 | bool loadSuccess = false; |
1252 | PhoneFormat* phoneFormat = 0; | 1256 | PhoneFormat* phoneFormat = 0; |
1253 | emit tempDisableBR(true); | 1257 | emit tempDisableBR(true); |
1254 | #ifndef DESKTOP_VERSION | 1258 | #ifndef DESKTOP_VERSION |
1255 | SharpFormat* sharpFormat = 0; | 1259 | SharpFormat* sharpFormat = 0; |
1256 | if ( mode == 0 ) { // sharp | 1260 | if ( mode == 0 ) { // sharp |
1257 | sharpFormat = new SharpFormat () ; | 1261 | sharpFormat = new SharpFormat () ; |
1258 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1262 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1259 | 1263 | ||
1260 | } else | 1264 | } else |
1261 | #endif | 1265 | #endif |
1262 | if ( mode == 1 ) { // phone | 1266 | if ( mode == 1 ) { // phone |
1263 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1267 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1264 | mSyncManager->mPhoneDevice, | 1268 | mSyncManager->mPhoneDevice, |
1265 | mSyncManager->mPhoneConnection, | 1269 | mSyncManager->mPhoneConnection, |
1266 | mSyncManager->mPhoneModel); | 1270 | mSyncManager->mPhoneModel); |
1267 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1271 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1268 | 1272 | ||
1269 | } else { | 1273 | } else { |
1270 | emit tempDisableBR(false); | 1274 | emit tempDisableBR(false); |
1271 | return; | 1275 | return; |
1272 | } | 1276 | } |
1273 | if ( loadSuccess ) { | 1277 | if ( loadSuccess ) { |
1274 | getEventViewerDialog()->setSyncMode( true ); | 1278 | getEventViewerDialog()->setSyncMode( true ); |
1275 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1279 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1276 | getEventViewerDialog()->setSyncMode( false ); | 1280 | getEventViewerDialog()->setSyncMode( false ); |
1277 | qApp->processEvents(); | 1281 | qApp->processEvents(); |
1278 | if ( syncOK ) { | 1282 | if ( syncOK ) { |
1279 | if ( mSyncManager->mWriteBackFile ) | 1283 | if ( mSyncManager->mWriteBackFile ) |
1280 | { | 1284 | { |
1281 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1285 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1282 | Incidence* inc = iL.first(); | 1286 | Incidence* inc = iL.first(); |
1283 | if ( phoneFormat ) { | 1287 | if ( phoneFormat ) { |
1284 | while ( inc ) { | 1288 | while ( inc ) { |
1285 | inc->removeID(mCurrentSyncDevice); | 1289 | inc->removeID(mCurrentSyncDevice); |
1286 | inc = iL.next(); | 1290 | inc = iL.next(); |
1287 | } | 1291 | } |
1288 | } | 1292 | } |
1289 | #ifndef DESKTOP_VERSION | 1293 | #ifndef DESKTOP_VERSION |
1290 | if ( sharpFormat ) | 1294 | if ( sharpFormat ) |
1291 | sharpFormat->save(calendar); | 1295 | sharpFormat->save(calendar); |
1292 | #endif | 1296 | #endif |
1293 | if ( phoneFormat ) | 1297 | if ( phoneFormat ) |
1294 | phoneFormat->save(calendar); | 1298 | phoneFormat->save(calendar); |
1295 | iL = calendar->rawIncidences(); | 1299 | iL = calendar->rawIncidences(); |
1296 | inc = iL.first(); | 1300 | inc = iL.first(); |
1297 | Incidence* loc; | 1301 | Incidence* loc; |
1298 | while ( inc ) { | 1302 | while ( inc ) { |
1299 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1303 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1300 | loc = mCalendar->incidence(inc->uid() ); | 1304 | loc = mCalendar->incidence(inc->uid() ); |
1301 | if ( loc ) { | 1305 | if ( loc ) { |
1302 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1306 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1303 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1307 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1304 | } | 1308 | } |
1305 | } | 1309 | } |
1306 | inc = iL.next(); | 1310 | inc = iL.next(); |
1307 | } | 1311 | } |
1308 | Incidence* lse = getLastSyncEvent(); | 1312 | Incidence* lse = getLastSyncEvent(); |
1309 | if ( lse ) { | 1313 | if ( lse ) { |
1310 | lse->setReadOnly( false ); | 1314 | lse->setReadOnly( false ); |
1311 | lse->setDescription( "" ); | 1315 | lse->setDescription( "" ); |
1312 | lse->setReadOnly( true ); | 1316 | lse->setReadOnly( true ); |
1313 | } | 1317 | } |
1314 | } | 1318 | } |
1319 | } else { | ||
1320 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | ||
1315 | } | 1321 | } |
1316 | setModified( true ); | 1322 | setModified( true ); |
1317 | } else { | 1323 | } else { |
1318 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1324 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1319 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1325 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1320 | question, i18n("Ok")) ; | 1326 | question, i18n("Ok")) ; |
1321 | 1327 | ||
1322 | } | 1328 | } |
1323 | delete calendar; | 1329 | delete calendar; |
1324 | updateView(); | 1330 | updateView(); |
1325 | emit tempDisableBR(false); | 1331 | emit tempDisableBR(false); |
1326 | return ;//syncOK; | 1332 | return ;//syncOK; |
1327 | 1333 | ||
1328 | } | 1334 | } |
1329 | 1335 | ||
1330 | bool CalendarView::importBday() | 1336 | bool CalendarView::importBday() |
1331 | { | 1337 | { |
1332 | #ifndef KORG_NOKABC | 1338 | #ifndef KORG_NOKABC |
1333 | 1339 | ||
1334 | #ifdef DESKTOP_VERSION | 1340 | #ifdef DESKTOP_VERSION |
1335 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1341 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1336 | KABC::AddressBook::Iterator it; | 1342 | KABC::AddressBook::Iterator it; |
1337 | int count = 0; | 1343 | int count = 0; |
1338 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1344 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1339 | ++count; | 1345 | ++count; |
1340 | } | 1346 | } |
1341 | QProgressBar bar(count,0 ); | 1347 | QProgressBar bar(count,0 ); |
1342 | int w = 300; | 1348 | int w = 300; |
1343 | if ( QApplication::desktop()->width() < 320 ) | 1349 | if ( QApplication::desktop()->width() < 320 ) |
1344 | w = 220; | 1350 | w = 220; |
1345 | int h = bar.sizeHint().height() ; | 1351 | int h = bar.sizeHint().height() ; |
1346 | int dw = QApplication::desktop()->width(); | 1352 | int dw = QApplication::desktop()->width(); |
1347 | int dh = QApplication::desktop()->height(); | 1353 | int dh = QApplication::desktop()->height(); |
1348 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1354 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1349 | bar.show(); | 1355 | bar.show(); |
1350 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1356 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1351 | qApp->processEvents(); | 1357 | qApp->processEvents(); |
1352 | count = 0; | 1358 | count = 0; |
1353 | int addCount = 0; | 1359 | int addCount = 0; |
1354 | KCal::Attendee* a = 0; | 1360 | KCal::Attendee* a = 0; |
1355 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1361 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1356 | if ( ! bar.isVisible() ) | 1362 | if ( ! bar.isVisible() ) |
1357 | return false; | 1363 | return false; |
1358 | bar.setProgress( count++ ); | 1364 | bar.setProgress( count++ ); |
1359 | qApp->processEvents(); | 1365 | qApp->processEvents(); |
1360 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1366 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1361 | if ( (*it).birthday().date().isValid() ){ | 1367 | if ( (*it).birthday().date().isValid() ){ |
1362 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1368 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1363 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1369 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1364 | ++addCount; | 1370 | ++addCount; |
1365 | } | 1371 | } |
1366 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1372 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1367 | if ( anni.isValid() ){ | 1373 | if ( anni.isValid() ){ |
1368 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1374 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1369 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1375 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1370 | ++addCount; | 1376 | ++addCount; |
1371 | } | 1377 | } |
1372 | } | 1378 | } |
1373 | updateView(); | 1379 | updateView(); |
1374 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1380 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1375 | #else //DESKTOP_VERSION | 1381 | #else //DESKTOP_VERSION |
1376 | 1382 | ||
1377 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1383 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
1378 | // the result should now arrive through method insertBirthdays | 1384 | // the result should now arrive through method insertBirthdays |
1379 | 1385 | ||
1380 | #endif //DESKTOP_VERSION | 1386 | #endif //DESKTOP_VERSION |
1381 | 1387 | ||
1382 | #endif //KORG_NOKABC | 1388 | #endif //KORG_NOKABC |
1383 | 1389 | ||
1384 | 1390 | ||
1385 | return true; | 1391 | return true; |
1386 | } | 1392 | } |
1387 | 1393 | ||
1388 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | 1394 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI |
1389 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 1395 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, |
1390 | const QStringList& anniversaryList, const QStringList& realNameList, | 1396 | const QStringList& anniversaryList, const QStringList& realNameList, |
1391 | const QStringList& emailList, const QStringList& assembledNameList, | 1397 | const QStringList& emailList, const QStringList& assembledNameList, |
1392 | const QStringList& uidList) | 1398 | const QStringList& uidList) |
1393 | { | 1399 | { |
1394 | qDebug("CalendarView::insertBirthdays"); | 1400 | qDebug("CalendarView::insertBirthdays"); |
1395 | if (uid == this->name()) | 1401 | if (uid == this->name()) |
1396 | { | 1402 | { |
1397 | int count = birthdayList.count(); | 1403 | int count = birthdayList.count(); |
1398 | int addCount = 0; | 1404 | int addCount = 0; |
1399 | KCal::Attendee* a = 0; | 1405 | KCal::Attendee* a = 0; |
1400 | 1406 | ||
1401 | qDebug("CalView 1 %i", count); | 1407 | qDebug("CalView 1 %i", count); |
1402 | 1408 | ||
1403 | QProgressBar bar(count,0 ); | 1409 | QProgressBar bar(count,0 ); |
1404 | int w = 300; | 1410 | int w = 300; |
1405 | if ( QApplication::desktop()->width() < 320 ) | 1411 | if ( QApplication::desktop()->width() < 320 ) |
1406 | w = 220; | 1412 | w = 220; |
1407 | int h = bar.sizeHint().height() ; | 1413 | int h = bar.sizeHint().height() ; |
1408 | int dw = QApplication::desktop()->width(); | 1414 | int dw = QApplication::desktop()->width(); |
1409 | int dh = QApplication::desktop()->height(); | 1415 | int dh = QApplication::desktop()->height(); |
1410 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1416 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1411 | bar.show(); | 1417 | bar.show(); |
1412 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | 1418 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); |
1413 | qApp->processEvents(); | 1419 | qApp->processEvents(); |
1414 | 1420 | ||
1415 | QDate birthday; | 1421 | QDate birthday; |
1416 | QDate anniversary; | 1422 | QDate anniversary; |
1417 | QString realName; | 1423 | QString realName; |
1418 | QString email; | 1424 | QString email; |
1419 | QString assembledName; | 1425 | QString assembledName; |
1420 | QString uid; | 1426 | QString uid; |
1421 | bool ok = true; | 1427 | bool ok = true; |
1422 | for ( int i = 0; i < count; i++) | 1428 | for ( int i = 0; i < count; i++) |
1423 | { | 1429 | { |
1424 | if ( ! bar.isVisible() ) | 1430 | if ( ! bar.isVisible() ) |
1425 | return; | 1431 | return; |
1426 | bar.setProgress( i ); | 1432 | bar.setProgress( i ); |
1427 | qApp->processEvents(); | 1433 | qApp->processEvents(); |
1428 | 1434 | ||
1429 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); | 1435 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); |
1430 | if (!ok) { | 1436 | if (!ok) { |
1431 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); | 1437 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); |
1432 | } | 1438 | } |
1433 | 1439 | ||
1434 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); | 1440 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); |
1435 | if (!ok) { | 1441 | if (!ok) { |
1436 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | 1442 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); |
1437 | } | 1443 | } |
1438 | realName = realNameList[i]; | 1444 | realName = realNameList[i]; |
1439 | email = emailList[i]; | 1445 | email = emailList[i]; |
1440 | assembledName = assembledNameList[i]; | 1446 | assembledName = assembledNameList[i]; |
1441 | uid = uidList[i]; | 1447 | uid = uidList[i]; |
1442 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); | 1448 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); |
1443 | 1449 | ||
1444 | if ( birthday.isValid() ){ | 1450 | if ( birthday.isValid() ){ |
1445 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1451 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1446 | KCal::Attendee::ReqParticipant,uid) ; | 1452 | KCal::Attendee::ReqParticipant,uid) ; |
1447 | if ( addAnniversary( birthday, assembledName, a, true ) ) | 1453 | if ( addAnniversary( birthday, assembledName, a, true ) ) |
1448 | ++addCount; | 1454 | ++addCount; |
1449 | } | 1455 | } |
1450 | 1456 | ||
1451 | if ( anniversary.isValid() ){ | 1457 | if ( anniversary.isValid() ){ |
1452 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1458 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1453 | KCal::Attendee::ReqParticipant,uid) ; | 1459 | KCal::Attendee::ReqParticipant,uid) ; |
1454 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | 1460 | if ( addAnniversary( anniversary, assembledName, a, false ) ) |
1455 | ++addCount; | 1461 | ++addCount; |
1456 | } | 1462 | } |
1457 | } | 1463 | } |
1458 | 1464 | ||
1459 | updateView(); | 1465 | updateView(); |
1460 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1466 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1461 | 1467 | ||
1462 | } | 1468 | } |
1463 | 1469 | ||
1464 | } | 1470 | } |
1465 | 1471 | ||
1466 | 1472 | ||
1467 | 1473 | ||
1468 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1474 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1469 | { | 1475 | { |
1470 | //qDebug("addAnni "); | 1476 | //qDebug("addAnni "); |
1471 | Event * ev = new Event(); | 1477 | Event * ev = new Event(); |
1472 | if ( a ) { | 1478 | if ( a ) { |
1473 | ev->addAttendee( a ); | 1479 | ev->addAttendee( a ); |
1474 | } | 1480 | } |
1475 | QString kind; | 1481 | QString kind; |
1476 | if ( birthday ) | 1482 | if ( birthday ) |
1477 | kind = i18n( "Birthday" ); | 1483 | kind = i18n( "Birthday" ); |
1478 | else | 1484 | else |
1479 | kind = i18n( "Anniversary" ); | 1485 | kind = i18n( "Anniversary" ); |
1480 | ev->setSummary( name + " - " + kind ); | 1486 | ev->setSummary( name + " - " + kind ); |
1481 | ev->setOrganizer(a->email()); | 1487 | ev->setOrganizer(a->email()); |
1482 | ev->setCategories( kind ); | 1488 | ev->setCategories( kind ); |
1483 | ev->setDtStart( QDateTime(date) ); | 1489 | ev->setDtStart( QDateTime(date) ); |
1484 | ev->setDtEnd( QDateTime(date) ); | 1490 | ev->setDtEnd( QDateTime(date) ); |
1485 | ev->setFloats( true ); | 1491 | ev->setFloats( true ); |
1486 | Recurrence * rec = ev->recurrence(); | 1492 | Recurrence * rec = ev->recurrence(); |
1487 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1493 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1488 | rec->addYearlyNum( date.month() ); | 1494 | rec->addYearlyNum( date.month() ); |
1489 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1495 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1490 | delete ev; | 1496 | delete ev; |
1491 | return false; | 1497 | return false; |
1492 | } | 1498 | } |
1493 | return true; | 1499 | return true; |
1494 | 1500 | ||
1495 | } | 1501 | } |
1496 | bool CalendarView::importQtopia( const QString &categories, | 1502 | bool CalendarView::importQtopia( const QString &categories, |
1497 | const QString &datebook, | 1503 | const QString &datebook, |
1498 | const QString &todolist ) | 1504 | const QString &todolist ) |
1499 | { | 1505 | { |
1500 | 1506 | ||
1501 | QtopiaFormat qtopiaFormat; | 1507 | QtopiaFormat qtopiaFormat; |
1502 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1508 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1503 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1509 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1504 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1510 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1505 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1511 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1506 | 1512 | ||
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index fc2d59b..65566b5 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -660,685 +660,699 @@ void MainWindow::initActions() | |||
660 | 660 | ||
661 | icon = loadPixmap( pathString + "xdays" ); | 661 | icon = loadPixmap( pathString + "xdays" ); |
662 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); | 662 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); |
663 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 663 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
664 | xdays_action->addTo( viewMenu ); | 664 | xdays_action->addTo( viewMenu ); |
665 | connect( xdays_action, SIGNAL( activated() ), | 665 | connect( xdays_action, SIGNAL( activated() ), |
666 | mView->viewManager(), SLOT( showNextXView() ) ); | 666 | mView->viewManager(), SLOT( showNextXView() ) ); |
667 | 667 | ||
668 | icon = loadPixmap( pathString + "whatsnext" ); | 668 | icon = loadPixmap( pathString + "whatsnext" ); |
669 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); | 669 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); |
670 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 670 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
671 | whatsnext_action->addTo( viewMenu ); | 671 | whatsnext_action->addTo( viewMenu ); |
672 | connect( whatsnext_action, SIGNAL( activated() ), | 672 | connect( whatsnext_action, SIGNAL( activated() ), |
673 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 673 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
674 | 674 | ||
675 | #if 0 | 675 | #if 0 |
676 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 676 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
677 | action->addTo( viewMenu ); | 677 | action->addTo( viewMenu ); |
678 | connect( action, SIGNAL( activated() ), | 678 | connect( action, SIGNAL( activated() ), |
679 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 679 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
680 | #endif | 680 | #endif |
681 | 681 | ||
682 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 682 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
683 | this ); | 683 | this ); |
684 | mNewSubTodoAction->addTo( actionMenu ); | 684 | mNewSubTodoAction->addTo( actionMenu ); |
685 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 685 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
686 | mView, SLOT( newSubTodo() ) ); | 686 | mView, SLOT( newSubTodo() ) ); |
687 | 687 | ||
688 | actionMenu->insertSeparator(); | 688 | actionMenu->insertSeparator(); |
689 | 689 | ||
690 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 690 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
691 | mShowAction->addTo( actionMenu ); | 691 | mShowAction->addTo( actionMenu ); |
692 | connect( mShowAction, SIGNAL( activated() ), | 692 | connect( mShowAction, SIGNAL( activated() ), |
693 | mView, SLOT( showIncidence() ) ); | 693 | mView, SLOT( showIncidence() ) ); |
694 | 694 | ||
695 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 695 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
696 | mEditAction->addTo( actionMenu ); | 696 | mEditAction->addTo( actionMenu ); |
697 | connect( mEditAction, SIGNAL( activated() ), | 697 | connect( mEditAction, SIGNAL( activated() ), |
698 | mView, SLOT( editIncidence() ) ); | 698 | mView, SLOT( editIncidence() ) ); |
699 | 699 | ||
700 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 700 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
701 | mDeleteAction->addTo( actionMenu ); | 701 | mDeleteAction->addTo( actionMenu ); |
702 | connect( mDeleteAction, SIGNAL( activated() ), | 702 | connect( mDeleteAction, SIGNAL( activated() ), |
703 | mView, SLOT( deleteIncidence() ) ); | 703 | mView, SLOT( deleteIncidence() ) ); |
704 | 704 | ||
705 | 705 | ||
706 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 706 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
707 | mCloneAction->addTo( actionMenu ); | 707 | mCloneAction->addTo( actionMenu ); |
708 | connect( mCloneAction, SIGNAL( activated() ), | 708 | connect( mCloneAction, SIGNAL( activated() ), |
709 | mView, SLOT( cloneIncidence() ) ); | 709 | mView, SLOT( cloneIncidence() ) ); |
710 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 710 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
711 | mMoveAction->addTo( actionMenu ); | 711 | mMoveAction->addTo( actionMenu ); |
712 | connect( mMoveAction, SIGNAL( activated() ), | 712 | connect( mMoveAction, SIGNAL( activated() ), |
713 | mView, SLOT( moveIncidence() ) ); | 713 | mView, SLOT( moveIncidence() ) ); |
714 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 714 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
715 | mBeamAction->addTo( actionMenu ); | 715 | mBeamAction->addTo( actionMenu ); |
716 | connect( mBeamAction, SIGNAL( activated() ), | 716 | connect( mBeamAction, SIGNAL( activated() ), |
717 | mView, SLOT( beamIncidence() ) ); | 717 | mView, SLOT( beamIncidence() ) ); |
718 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 718 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
719 | mCancelAction->addTo( actionMenu ); | 719 | mCancelAction->addTo( actionMenu ); |
720 | connect( mCancelAction, SIGNAL( activated() ), | 720 | connect( mCancelAction, SIGNAL( activated() ), |
721 | mView, SLOT( toggleCancelIncidence() ) ); | 721 | mView, SLOT( toggleCancelIncidence() ) ); |
722 | 722 | ||
723 | actionMenu->insertSeparator(); | 723 | actionMenu->insertSeparator(); |
724 | 724 | ||
725 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 725 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
726 | this ); | 726 | this ); |
727 | action->addTo( actionMenu ); | 727 | action->addTo( actionMenu ); |
728 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 728 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
729 | 729 | ||
730 | icon = loadPixmap( pathString + "search" ); | 730 | icon = loadPixmap( pathString + "search" ); |
731 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 731 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
732 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 732 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
733 | search_action->addTo( actionMenu ); | 733 | search_action->addTo( actionMenu ); |
734 | connect( search_action, SIGNAL( activated() ), | 734 | connect( search_action, SIGNAL( activated() ), |
735 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 735 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
736 | 736 | ||
737 | icon = loadPixmap( pathString + "today" ); | 737 | icon = loadPixmap( pathString + "today" ); |
738 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 738 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
739 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 739 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
740 | today_action->addTo( actionMenu ); | 740 | today_action->addTo( actionMenu ); |
741 | connect( today_action, SIGNAL( activated() ), | 741 | connect( today_action, SIGNAL( activated() ), |
742 | mView, SLOT( goToday() ) ); | 742 | mView, SLOT( goToday() ) ); |
743 | 743 | ||
744 | if ( KOPrefs::instance()->mShowFullMenu ) { | 744 | if ( KOPrefs::instance()->mShowFullMenu ) { |
745 | actionMenu->insertSeparator(); | 745 | actionMenu->insertSeparator(); |
746 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 746 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
747 | 747 | ||
748 | } | 748 | } |
749 | // actionMenu->insertSeparator(); | 749 | // actionMenu->insertSeparator(); |
750 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 750 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
751 | this ); | 751 | this ); |
752 | action->addTo( importMenu ); | 752 | action->addTo( importMenu ); |
753 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 753 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
754 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 754 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
755 | this ); | 755 | this ); |
756 | action->addTo( importMenu ); | 756 | action->addTo( importMenu ); |
757 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 757 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
758 | importMenu->insertSeparator(); | 758 | importMenu->insertSeparator(); |
759 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 759 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
760 | this ); | 760 | this ); |
761 | action->addTo( importMenu ); | 761 | action->addTo( importMenu ); |
762 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 762 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
763 | #ifndef DESKTOP_VERSION | 763 | #ifndef DESKTOP_VERSION |
764 | importMenu->insertSeparator(); | 764 | importMenu->insertSeparator(); |
765 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 765 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
766 | this ); | 766 | this ); |
767 | action->addTo( importMenu ); | 767 | action->addTo( importMenu ); |
768 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 768 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
769 | #else | 769 | #else |
770 | #ifdef _WIN32_ | 770 | #ifdef _WIN32_ |
771 | importMenu->insertSeparator(); | 771 | importMenu->insertSeparator(); |
772 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 772 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
773 | this ); | 773 | this ); |
774 | action->addTo( importMenu ); | 774 | action->addTo( importMenu ); |
775 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 775 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
776 | #endif | 776 | #endif |
777 | #endif | 777 | #endif |
778 | 778 | ||
779 | importMenu->insertSeparator(); | 779 | importMenu->insertSeparator(); |
780 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 780 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
781 | this ); | 781 | this ); |
782 | action->addTo( importMenu ); | 782 | action->addTo( importMenu ); |
783 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 783 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
784 | 784 | ||
785 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 785 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
786 | this ); | 786 | this ); |
787 | action->addTo( importMenu ); | 787 | action->addTo( importMenu ); |
788 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 788 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
789 | 789 | ||
790 | importMenu->insertSeparator(); | 790 | importMenu->insertSeparator(); |
791 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 791 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
792 | this ); | 792 | this ); |
793 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 793 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
794 | 794 | ||
795 | 795 | ||
796 | //LR | 796 | //LR |
797 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 797 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
798 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 798 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
799 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 799 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
800 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 800 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
801 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); | 801 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); |
802 | 802 | ||
803 | importMenu->insertSeparator(); | 803 | importMenu->insertSeparator(); |
804 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 804 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
805 | this ); | 805 | this ); |
806 | action->addTo( importMenu ); | 806 | action->addTo( importMenu ); |
807 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 807 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
808 | #ifndef DESKTOP_VERSION | 808 | #ifndef DESKTOP_VERSION |
809 | importMenu->insertSeparator(); | 809 | importMenu->insertSeparator(); |
810 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 810 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
811 | this ); | 811 | this ); |
812 | brAction->addTo( importMenu ); | 812 | brAction->addTo( importMenu ); |
813 | brAction->setToggleAction (true ) ; | 813 | brAction->setToggleAction (true ) ; |
814 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 814 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
815 | 815 | ||
816 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 816 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
817 | this ); | 817 | this ); |
818 | action->addTo( importMenu ); | 818 | action->addTo( importMenu ); |
819 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 819 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
820 | 820 | ||
821 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 821 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
822 | this ); | 822 | this ); |
823 | action->addTo( importMenu ); | 823 | action->addTo( importMenu ); |
824 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 824 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
825 | #else | 825 | #else |
826 | importMenu->insertSeparator(); | 826 | importMenu->insertSeparator(); |
827 | icon = loadPixmap( pathString + "print" ); | 827 | icon = loadPixmap( pathString + "print" ); |
828 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 828 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
829 | action->addTo( importMenu ); | 829 | action->addTo( importMenu ); |
830 | connect( action, SIGNAL( activated() ), | 830 | connect( action, SIGNAL( activated() ), |
831 | this, SLOT( printCal() ) ); | 831 | this, SLOT( printCal() ) ); |
832 | 832 | ||
833 | icon = loadPixmap( pathString + "print" ); | 833 | icon = loadPixmap( pathString + "print" ); |
834 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 834 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
835 | action->addTo( importMenu ); | 835 | action->addTo( importMenu ); |
836 | connect( action, SIGNAL( activated() ), | 836 | connect( action, SIGNAL( activated() ), |
837 | this, SLOT( printSel() ) ); | 837 | this, SLOT( printSel() ) ); |
838 | #endif | 838 | #endif |
839 | importMenu->insertSeparator(); | 839 | importMenu->insertSeparator(); |
840 | action = new QAction( "beam all", i18n("Save"), 0, | 840 | action = new QAction( "beam all", i18n("Save"), 0, |
841 | this ); | 841 | this ); |
842 | action->addTo( importMenu ); | 842 | action->addTo( importMenu ); |
843 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 843 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
844 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 844 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
845 | this ); | 845 | this ); |
846 | action->addTo( importMenu ); | 846 | action->addTo( importMenu ); |
847 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 847 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
848 | 848 | ||
849 | //menuBar->insertItem( "Configure",configureMenu ); | 849 | //menuBar->insertItem( "Configure",configureMenu ); |
850 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 850 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
851 | icon = loadPixmap( "korganizer/korganizer" ); | 851 | icon = loadPixmap( "korganizer/korganizer" ); |
852 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 852 | |
853 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | ||
853 | action->addTo( helpMenu ); | 854 | action->addTo( helpMenu ); |
854 | connect( action, SIGNAL( activated() ), | 855 | connect( action, SIGNAL( activated() ), |
855 | SLOT( keyBindings() ) ); | 856 | SLOT( whatsNew() ) ); |
856 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 857 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
857 | action->addTo( helpMenu ); | 858 | action->addTo( helpMenu ); |
858 | connect( action, SIGNAL( activated() ), | 859 | connect( action, SIGNAL( activated() ), |
859 | SLOT( features() ) ); | 860 | SLOT( features() ) ); |
861 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | ||
862 | action->addTo( helpMenu ); | ||
863 | connect( action, SIGNAL( activated() ), | ||
864 | SLOT( keyBindings() ) ); | ||
865 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | ||
866 | action->addTo( helpMenu ); | ||
867 | connect( action, SIGNAL( activated() ), | ||
868 | SLOT( synchowto() ) ); | ||
869 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | ||
870 | action->addTo( helpMenu ); | ||
871 | connect( action, SIGNAL( activated() ), | ||
872 | SLOT( kdesynchowto() ) ); | ||
873 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | ||
874 | action->addTo( helpMenu ); | ||
875 | connect( action, SIGNAL( activated() ), | ||
876 | SLOT( multisynchowto() ) ); | ||
860 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 877 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
861 | action->addTo( helpMenu ); | 878 | action->addTo( helpMenu ); |
862 | connect( action, SIGNAL( activated() ), | 879 | connect( action, SIGNAL( activated() ), |
863 | SLOT( aboutAutoSaving() ) ); | 880 | SLOT( aboutAutoSaving() ) ); |
864 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 881 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
865 | action->addTo( helpMenu ); | 882 | action->addTo( helpMenu ); |
866 | connect( action, SIGNAL( activated() ), | 883 | connect( action, SIGNAL( activated() ), |
867 | SLOT( aboutKnownBugs() ) ); | 884 | SLOT( aboutKnownBugs() ) ); |
868 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 885 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
869 | action->addTo( helpMenu ); | 886 | action->addTo( helpMenu ); |
870 | connect( action, SIGNAL( activated() ), | 887 | connect( action, SIGNAL( activated() ), |
871 | SLOT( usertrans() ) ); | 888 | SLOT( usertrans() ) ); |
872 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | ||
873 | action->addTo( helpMenu ); | ||
874 | connect( action, SIGNAL( activated() ), | ||
875 | SLOT( synchowto() ) ); | ||
876 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | ||
877 | action->addTo( helpMenu ); | ||
878 | connect( action, SIGNAL( activated() ), | ||
879 | SLOT( whatsNew() ) ); | ||
880 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 889 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
881 | action->addTo( helpMenu ); | 890 | action->addTo( helpMenu ); |
882 | connect( action, SIGNAL( activated() ), | 891 | connect( action, SIGNAL( activated() ), |
883 | SLOT( faq() ) ); | 892 | SLOT( faq() ) ); |
884 | |||
885 | |||
886 | action = new QAction( "about", i18n("About..."), 0, this ); | ||
887 | action->addTo( helpMenu ); | ||
888 | connect( action, SIGNAL( activated() ), | ||
889 | SLOT( about() ) ); | ||
890 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 893 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
891 | action->addTo( helpMenu ); | 894 | action->addTo( helpMenu ); |
892 | connect( action, SIGNAL( activated() ), | 895 | connect( action, SIGNAL( activated() ), |
893 | SLOT( licence() ) ); | 896 | SLOT( licence() ) ); |
897 | action = new QAction( "about", i18n("About..."), 0, this ); | ||
898 | action->addTo( helpMenu ); | ||
899 | connect( action, SIGNAL( activated() ), | ||
900 | SLOT( about() ) ); | ||
894 | //menuBar->insertSeparator(); | 901 | //menuBar->insertSeparator(); |
895 | 902 | ||
896 | // ****************************************************** | 903 | // ****************************************************** |
897 | // menubar icons | 904 | // menubar icons |
898 | 905 | ||
899 | 906 | ||
900 | iconToolBar->setHorizontalStretchable (true ); | 907 | iconToolBar->setHorizontalStretchable (true ); |
901 | //menuBar->insertItem( iconToolBar ); | 908 | //menuBar->insertItem( iconToolBar ); |
902 | //xdays_action | 909 | //xdays_action |
903 | if (p-> mShowIconNewEvent) | 910 | if (p-> mShowIconNewEvent) |
904 | ne_action->addTo( iconToolBar ); | 911 | ne_action->addTo( iconToolBar ); |
905 | if (p->mShowIconNewTodo ) | 912 | if (p->mShowIconNewTodo ) |
906 | nt_action->addTo( iconToolBar ); | 913 | nt_action->addTo( iconToolBar ); |
907 | if (p-> mShowIconSearch) | 914 | if (p-> mShowIconSearch) |
908 | search_action->addTo( iconToolBar ); | 915 | search_action->addTo( iconToolBar ); |
909 | if (p-> mShowIconNext) | 916 | if (p-> mShowIconNext) |
910 | whatsnext_action->addTo( iconToolBar ); | 917 | whatsnext_action->addTo( iconToolBar ); |
911 | if (p-> mShowIconNextDays) | 918 | if (p-> mShowIconNextDays) |
912 | xdays_action->addTo( iconToolBar ); | 919 | xdays_action->addTo( iconToolBar ); |
913 | if (p-> mShowIconList) | 920 | if (p-> mShowIconList) |
914 | showlist_action->addTo( iconToolBar ); | 921 | showlist_action->addTo( iconToolBar ); |
915 | if (p-> mShowIconDay1) | 922 | if (p-> mShowIconDay1) |
916 | day1_action->addTo( iconToolBar ); | 923 | day1_action->addTo( iconToolBar ); |
917 | if (p-> mShowIconDay5) | 924 | if (p-> mShowIconDay5) |
918 | day5_action->addTo( iconToolBar ); | 925 | day5_action->addTo( iconToolBar ); |
919 | if (p-> mShowIconDay7) | 926 | if (p-> mShowIconDay7) |
920 | day7_action->addTo( iconToolBar ); | 927 | day7_action->addTo( iconToolBar ); |
921 | if (p-> mShowIconMonth) | 928 | if (p-> mShowIconMonth) |
922 | month_action->addTo( iconToolBar ); | 929 | month_action->addTo( iconToolBar ); |
923 | if (p-> mShowIconTodoview) | 930 | if (p-> mShowIconTodoview) |
924 | todoview_action->addTo( iconToolBar ); | 931 | todoview_action->addTo( iconToolBar ); |
925 | if (p-> mShowIconJournal) | 932 | if (p-> mShowIconJournal) |
926 | viewjournal_action->addTo( iconToolBar ); | 933 | viewjournal_action->addTo( iconToolBar ); |
927 | icon = loadPixmap( pathString + "2leftarrowB" ); | 934 | icon = loadPixmap( pathString + "2leftarrowB" ); |
928 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 935 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
929 | if (p-> mShowIconBackFast) { | 936 | if (p-> mShowIconBackFast) { |
930 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 937 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
931 | connect( action, SIGNAL( activated() ), | 938 | connect( action, SIGNAL( activated() ), |
932 | mView, SLOT( goPreviousMonth() ) ); | 939 | mView, SLOT( goPreviousMonth() ) ); |
933 | action->addTo( iconToolBar ); | 940 | action->addTo( iconToolBar ); |
934 | } | 941 | } |
935 | icon = loadPixmap( pathString + "1leftarrowB" ); | 942 | icon = loadPixmap( pathString + "1leftarrowB" ); |
936 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 943 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
937 | if (p-> mShowIconBack) { | 944 | if (p-> mShowIconBack) { |
938 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 945 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
939 | connect( action, SIGNAL( activated() ), | 946 | connect( action, SIGNAL( activated() ), |
940 | mView, SLOT( goPrevious() ) ); | 947 | mView, SLOT( goPrevious() ) ); |
941 | action->addTo( iconToolBar ); | 948 | action->addTo( iconToolBar ); |
942 | } | 949 | } |
943 | if (p-> mShowIconToday) | 950 | if (p-> mShowIconToday) |
944 | today_action->addTo( iconToolBar ); | 951 | today_action->addTo( iconToolBar ); |
945 | icon = loadPixmap( pathString + "1rightarrowB" ); | 952 | icon = loadPixmap( pathString + "1rightarrowB" ); |
946 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 953 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
947 | if (p-> mShowIconForward) { | 954 | if (p-> mShowIconForward) { |
948 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 955 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
949 | connect( action, SIGNAL( activated() ), | 956 | connect( action, SIGNAL( activated() ), |
950 | mView, SLOT( goNext() ) ); | 957 | mView, SLOT( goNext() ) ); |
951 | action->addTo( iconToolBar ); | 958 | action->addTo( iconToolBar ); |
952 | } | 959 | } |
953 | icon = loadPixmap( pathString + "2rightarrowB" ); | 960 | icon = loadPixmap( pathString + "2rightarrowB" ); |
954 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 961 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
955 | if (p-> mShowIconForwardFast) { | 962 | if (p-> mShowIconForwardFast) { |
956 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 963 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
957 | connect( action, SIGNAL( activated() ), | 964 | connect( action, SIGNAL( activated() ), |
958 | mView, SLOT( goNextMonth() ) ); | 965 | mView, SLOT( goNextMonth() ) ); |
959 | action->addTo( iconToolBar ); | 966 | action->addTo( iconToolBar ); |
960 | } | 967 | } |
961 | 968 | ||
962 | 969 | ||
963 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 970 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
964 | 971 | ||
965 | if (p-> mShowIconNewEvent) | 972 | if (p-> mShowIconNewEvent) |
966 | configureToolBarMenu->setItemChecked( 10, true ); | 973 | configureToolBarMenu->setItemChecked( 10, true ); |
967 | if (p->mShowIconNewTodo ) | 974 | if (p->mShowIconNewTodo ) |
968 | configureToolBarMenu->setItemChecked( 20, true ); | 975 | configureToolBarMenu->setItemChecked( 20, true ); |
969 | if (p-> mShowIconSearch) | 976 | if (p-> mShowIconSearch) |
970 | configureToolBarMenu->setItemChecked( 120, true ); | 977 | configureToolBarMenu->setItemChecked( 120, true ); |
971 | if (p-> mShowIconList) | 978 | if (p-> mShowIconList) |
972 | configureToolBarMenu->setItemChecked( 30, true ); | 979 | configureToolBarMenu->setItemChecked( 30, true ); |
973 | if (p-> mShowIconDay1) | 980 | if (p-> mShowIconDay1) |
974 | configureToolBarMenu->setItemChecked( 40, true ); | 981 | configureToolBarMenu->setItemChecked( 40, true ); |
975 | if (p-> mShowIconDay5) | 982 | if (p-> mShowIconDay5) |
976 | configureToolBarMenu->setItemChecked( 50, true ); | 983 | configureToolBarMenu->setItemChecked( 50, true ); |
977 | if (p-> mShowIconDay7) | 984 | if (p-> mShowIconDay7) |
978 | configureToolBarMenu->setItemChecked( 60, true ); | 985 | configureToolBarMenu->setItemChecked( 60, true ); |
979 | if (p-> mShowIconMonth) | 986 | if (p-> mShowIconMonth) |
980 | configureToolBarMenu->setItemChecked( 70, true ); | 987 | configureToolBarMenu->setItemChecked( 70, true ); |
981 | if (p-> mShowIconTodoview) | 988 | if (p-> mShowIconTodoview) |
982 | configureToolBarMenu->setItemChecked( 80, true ); | 989 | configureToolBarMenu->setItemChecked( 80, true ); |
983 | if (p-> mShowIconBackFast) | 990 | if (p-> mShowIconBackFast) |
984 | configureToolBarMenu->setItemChecked( 200, true ); | 991 | configureToolBarMenu->setItemChecked( 200, true ); |
985 | if (p-> mShowIconBack) | 992 | if (p-> mShowIconBack) |
986 | configureToolBarMenu->setItemChecked( 210, true ); | 993 | configureToolBarMenu->setItemChecked( 210, true ); |
987 | if (p-> mShowIconToday) | 994 | if (p-> mShowIconToday) |
988 | configureToolBarMenu->setItemChecked( 130, true ); | 995 | configureToolBarMenu->setItemChecked( 130, true ); |
989 | if (p-> mShowIconForward) | 996 | if (p-> mShowIconForward) |
990 | configureToolBarMenu->setItemChecked( 220, true ); | 997 | configureToolBarMenu->setItemChecked( 220, true ); |
991 | if (p-> mShowIconForwardFast) | 998 | if (p-> mShowIconForwardFast) |
992 | configureToolBarMenu->setItemChecked( 230, true ); | 999 | configureToolBarMenu->setItemChecked( 230, true ); |
993 | if (p-> mShowIconNextDays) | 1000 | if (p-> mShowIconNextDays) |
994 | configureToolBarMenu->setItemChecked( 100, true ); | 1001 | configureToolBarMenu->setItemChecked( 100, true ); |
995 | if (p-> mShowIconNext) | 1002 | if (p-> mShowIconNext) |
996 | configureToolBarMenu->setItemChecked( 110, true ); | 1003 | configureToolBarMenu->setItemChecked( 110, true ); |
997 | if (p-> mShowIconJournal) | 1004 | if (p-> mShowIconJournal) |
998 | configureToolBarMenu->setItemChecked( 90, true ); | 1005 | configureToolBarMenu->setItemChecked( 90, true ); |
999 | if (p-> mShowIconWhatsThis) | 1006 | if (p-> mShowIconWhatsThis) |
1000 | configureToolBarMenu->setItemChecked( 300, true ); | 1007 | configureToolBarMenu->setItemChecked( 300, true ); |
1001 | 1008 | ||
1002 | QLabel* dummy = new QLabel( iconToolBar ); | 1009 | QLabel* dummy = new QLabel( iconToolBar ); |
1003 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1010 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1004 | if (!p-> mShowIconStretch) | 1011 | if (!p-> mShowIconStretch) |
1005 | iconToolBar->setStretchableWidget ( dummy ) ; | 1012 | iconToolBar->setStretchableWidget ( dummy ) ; |
1006 | else | 1013 | else |
1007 | configureToolBarMenu->setItemChecked( 5, true ); | 1014 | configureToolBarMenu->setItemChecked( 5, true ); |
1008 | if (p-> mShowIconWhatsThis) | 1015 | if (p-> mShowIconWhatsThis) |
1009 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1016 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1010 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1017 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1011 | configureAgenda( p->mHourSize ); | 1018 | configureAgenda( p->mHourSize ); |
1012 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1019 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1013 | } | 1020 | } |
1014 | 1021 | ||
1015 | void MainWindow::exportToPhone( int mode ) | 1022 | void MainWindow::exportToPhone( int mode ) |
1016 | { | 1023 | { |
1017 | 1024 | ||
1018 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1025 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1019 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1026 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1020 | KOex2phonePrefs ex2phone; | 1027 | KOex2phonePrefs ex2phone; |
1021 | 1028 | ||
1022 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1029 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1023 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1030 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1024 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1031 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1025 | if ( mode == 1 ) | 1032 | if ( mode == 1 ) |
1026 | ex2phone.setCaption(i18n("Export complete calendar")); | 1033 | ex2phone.setCaption(i18n("Export complete calendar")); |
1027 | if ( mode == 2 ) | 1034 | if ( mode == 2 ) |
1028 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1035 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1029 | 1036 | ||
1030 | if ( !ex2phone.exec() ) { | 1037 | if ( !ex2phone.exec() ) { |
1031 | return; | 1038 | return; |
1032 | } | 1039 | } |
1033 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1040 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1034 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1041 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1035 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1042 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1036 | 1043 | ||
1037 | int inFuture = 0; | 1044 | int inFuture = 0; |
1038 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1045 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1039 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1046 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1040 | QPtrList<Incidence> delSel; | 1047 | QPtrList<Incidence> delSel; |
1041 | if ( mode == 1 ) | 1048 | if ( mode == 1 ) |
1042 | delSel = mCalendar->rawIncidences(); | 1049 | delSel = mCalendar->rawIncidences(); |
1043 | if ( mode == 2 ) | 1050 | if ( mode == 2 ) |
1044 | delSel = mCalendar->incidences(); | 1051 | delSel = mCalendar->incidences(); |
1045 | CalendarLocal* cal = new CalendarLocal(); | 1052 | CalendarLocal* cal = new CalendarLocal(); |
1046 | cal->setLocalTime(); | 1053 | cal->setLocalTime(); |
1047 | Incidence *incidence = delSel.first(); | 1054 | Incidence *incidence = delSel.first(); |
1048 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1055 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1049 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1056 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1050 | while ( incidence ) { | 1057 | while ( incidence ) { |
1051 | if ( incidence->type() != "Journal" ) { | 1058 | if ( incidence->type() != "Journal" ) { |
1052 | bool add = true; | 1059 | bool add = true; |
1053 | if ( inFuture ) { | 1060 | if ( inFuture ) { |
1054 | QDateTime dt; | 1061 | QDateTime dt; |
1055 | if ( incidence->type() == "Todo" ) { | 1062 | if ( incidence->type() == "Todo" ) { |
1056 | Todo * t = (Todo*)incidence; | 1063 | Todo * t = (Todo*)incidence; |
1057 | if ( t->hasDueDate() ) | 1064 | if ( t->hasDueDate() ) |
1058 | dt = t->dtDue(); | 1065 | dt = t->dtDue(); |
1059 | else | 1066 | else |
1060 | dt = cur.addSecs( 62 ); | 1067 | dt = cur.addSecs( 62 ); |
1061 | } | 1068 | } |
1062 | else { | 1069 | else { |
1063 | bool ok; | 1070 | bool ok; |
1064 | dt = incidence->getNextOccurence( cur, &ok ); | 1071 | dt = incidence->getNextOccurence( cur, &ok ); |
1065 | if ( !ok ) | 1072 | if ( !ok ) |
1066 | dt = cur.addSecs( -62 ); | 1073 | dt = cur.addSecs( -62 ); |
1067 | } | 1074 | } |
1068 | if ( dt < cur || dt > end ) { | 1075 | if ( dt < cur || dt > end ) { |
1069 | add = false; | 1076 | add = false; |
1070 | } | 1077 | } |
1071 | } | 1078 | } |
1072 | if ( add ) { | 1079 | if ( add ) { |
1073 | Incidence *in = incidence->clone(); | 1080 | Incidence *in = incidence->clone(); |
1074 | cal->addIncidence( in ); | 1081 | cal->addIncidence( in ); |
1075 | } | 1082 | } |
1076 | } | 1083 | } |
1077 | incidence = delSel.next(); | 1084 | incidence = delSel.next(); |
1078 | } | 1085 | } |
1079 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1086 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1080 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1087 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1081 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1088 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1082 | 1089 | ||
1083 | setCaption( i18n("Writing to phone...")); | 1090 | setCaption( i18n("Writing to phone...")); |
1084 | if ( PhoneFormat::writeToPhone( cal ) ) | 1091 | if ( PhoneFormat::writeToPhone( cal ) ) |
1085 | setCaption( i18n("Export to phone successful!")); | 1092 | setCaption( i18n("Export to phone successful!")); |
1086 | else | 1093 | else |
1087 | setCaption( i18n("Error exporting to phone!")); | 1094 | setCaption( i18n("Error exporting to phone!")); |
1088 | delete cal; | 1095 | delete cal; |
1089 | } | 1096 | } |
1090 | 1097 | ||
1091 | 1098 | ||
1092 | void MainWindow::setDefaultPreferences() | 1099 | void MainWindow::setDefaultPreferences() |
1093 | { | 1100 | { |
1094 | KOPrefs *p = KOPrefs::instance(); | 1101 | KOPrefs *p = KOPrefs::instance(); |
1095 | 1102 | ||
1096 | p->mCompactDialogs = true; | 1103 | p->mCompactDialogs = true; |
1097 | p->mConfirm = true; | 1104 | p->mConfirm = true; |
1098 | // p->mEnableQuickTodo = false; | 1105 | // p->mEnableQuickTodo = false; |
1099 | 1106 | ||
1100 | } | 1107 | } |
1101 | 1108 | ||
1102 | QString MainWindow::resourcePath() | 1109 | QString MainWindow::resourcePath() |
1103 | { | 1110 | { |
1104 | return KGlobal::iconLoader()->iconPath(); | 1111 | return KGlobal::iconLoader()->iconPath(); |
1105 | } | 1112 | } |
1106 | 1113 | ||
1107 | void MainWindow::displayText( QString text ,QString cap ) | 1114 | void MainWindow::displayText( QString text ,QString cap ) |
1108 | { | 1115 | { |
1109 | QDialog dia( this, "name", true ); ; | 1116 | QDialog dia( this, "name", true ); ; |
1110 | dia.setCaption( cap ); | 1117 | dia.setCaption( cap ); |
1111 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1118 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1112 | lay->setSpacing( 3 ); | 1119 | lay->setSpacing( 3 ); |
1113 | lay->setMargin( 3 ); | 1120 | lay->setMargin( 3 ); |
1114 | QTextBrowser tb ( &dia ); | 1121 | QTextBrowser tb ( &dia ); |
1115 | lay->addWidget( &tb ); | 1122 | lay->addWidget( &tb ); |
1116 | tb.setText( text ); | 1123 | tb.setText( text ); |
1117 | #ifdef DESKTOP_VERSION | 1124 | #ifdef DESKTOP_VERSION |
1118 | dia.resize( 640, 480); | 1125 | dia.resize( 640, 480); |
1119 | #else | 1126 | #else |
1120 | dia.showMaximized(); | 1127 | dia.showMaximized(); |
1121 | #endif | 1128 | #endif |
1122 | dia.exec(); | 1129 | dia.exec(); |
1123 | } | 1130 | } |
1124 | void MainWindow::displayFile( QString fn, QString cap ) | 1131 | void MainWindow::displayFile( QString fn, QString cap ) |
1125 | { | 1132 | { |
1126 | QString fileName = resourcePath() + fn; | 1133 | QString fileName = resourcePath() + fn; |
1127 | QString text; | 1134 | QString text; |
1128 | QFile file( fileName ); | 1135 | QFile file( fileName ); |
1129 | if (!file.open( IO_ReadOnly ) ) { | 1136 | if (!file.open( IO_ReadOnly ) ) { |
1130 | return ; | 1137 | return ; |
1131 | 1138 | ||
1132 | } | 1139 | } |
1133 | QTextStream ts( &file ); | 1140 | QTextStream ts( &file ); |
1134 | text = ts.read(); | 1141 | text = ts.read(); |
1135 | file.close(); | 1142 | file.close(); |
1136 | displayText( text, cap); | 1143 | displayText( text, cap); |
1137 | } | 1144 | } |
1138 | void MainWindow::features() | 1145 | void MainWindow::features() |
1139 | { | 1146 | { |
1140 | 1147 | ||
1141 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); | 1148 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); |
1142 | } | 1149 | } |
1143 | 1150 | ||
1144 | void MainWindow::usertrans() | 1151 | void MainWindow::usertrans() |
1145 | { | 1152 | { |
1146 | 1153 | ||
1147 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); | 1154 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); |
1148 | } | 1155 | } |
1149 | 1156 | ||
1157 | void MainWindow::kdesynchowto() | ||
1158 | { | ||
1159 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | ||
1160 | } | ||
1161 | void MainWindow::multisynchowto() | ||
1162 | { | ||
1163 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | ||
1164 | } | ||
1150 | void MainWindow::synchowto() | 1165 | void MainWindow::synchowto() |
1151 | { | 1166 | { |
1152 | |||
1153 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1167 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1154 | } | 1168 | } |
1155 | void MainWindow::faq() | 1169 | void MainWindow::faq() |
1156 | { | 1170 | { |
1157 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); | 1171 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); |
1158 | 1172 | ||
1159 | } | 1173 | } |
1160 | void MainWindow::whatsNew() | 1174 | void MainWindow::whatsNew() |
1161 | { | 1175 | { |
1162 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1176 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1163 | 1177 | ||
1164 | } | 1178 | } |
1165 | void MainWindow::licence() | 1179 | void MainWindow::licence() |
1166 | { | 1180 | { |
1167 | KApplication::showLicence(); | 1181 | KApplication::showLicence(); |
1168 | 1182 | ||
1169 | } | 1183 | } |
1170 | void MainWindow::about() | 1184 | void MainWindow::about() |
1171 | { | 1185 | { |
1172 | QString version; | 1186 | QString version; |
1173 | #include <../version> | 1187 | #include <../version> |
1174 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1188 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1175 | i18n("KOrganizer/Platform-independent\n") + | 1189 | i18n("KOrganizer/Platform-independent\n") + |
1176 | "(KO/Pi) " + version + " - " + | 1190 | "(KO/Pi) " + version + " - " + |
1177 | 1191 | ||
1178 | #ifdef DESKTOP_VERSION | 1192 | #ifdef DESKTOP_VERSION |
1179 | i18n("Desktop Edition\n") + | 1193 | i18n("Desktop Edition\n") + |
1180 | #else | 1194 | #else |
1181 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + | 1195 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + |
1182 | #endif | 1196 | #endif |
1183 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); | 1197 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); |
1184 | } | 1198 | } |
1185 | void MainWindow::keyBindings() | 1199 | void MainWindow::keyBindings() |
1186 | { | 1200 | { |
1187 | QString cap = i18n("Key bindings KOrganizer/Pi"); | 1201 | QString cap = i18n("Key bindings KOrganizer/Pi"); |
1188 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1202 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1189 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1203 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1190 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1204 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1191 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1205 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1192 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1206 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1193 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1207 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1194 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1208 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1195 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1209 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1196 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1210 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1197 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1211 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1198 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1212 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1199 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1213 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1200 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1214 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1201 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1215 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1202 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1216 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1203 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1217 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1204 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1218 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1205 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1219 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1206 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1220 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1207 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1221 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1208 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1222 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1209 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1223 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1210 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1224 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1211 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1225 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1212 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1226 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1213 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1227 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1214 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1228 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1215 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1229 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1216 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1230 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1217 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1231 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1218 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1232 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1219 | i18n("<p><h3>In list view:</h3></p>\n") + | 1233 | i18n("<p><h3>In list view:</h3></p>\n") + |
1220 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1234 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1221 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1235 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1222 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1236 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1223 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1237 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1224 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1238 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1225 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1239 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1226 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1240 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1227 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1241 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1228 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1242 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1229 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1243 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1230 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1244 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1231 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1245 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1232 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1246 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1233 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1247 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1234 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1248 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1235 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1249 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1236 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1250 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1237 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1251 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1238 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1252 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1239 | displayText( text, cap); | 1253 | displayText( text, cap); |
1240 | 1254 | ||
1241 | } | 1255 | } |
1242 | void MainWindow::aboutAutoSaving() | 1256 | void MainWindow::aboutAutoSaving() |
1243 | { | 1257 | { |
1244 | QMessageBox* msg; | 1258 | QMessageBox* msg; |
1245 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), | 1259 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), |
1246 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, | 1260 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, |
1247 | QMessageBox::Ok, | 1261 | QMessageBox::Ok, |
1248 | QMessageBox::NoButton, | 1262 | QMessageBox::NoButton, |
1249 | QMessageBox::NoButton); | 1263 | QMessageBox::NoButton); |
1250 | msg->exec(); | 1264 | msg->exec(); |
1251 | delete msg; | 1265 | delete msg; |
1252 | 1266 | ||
1253 | 1267 | ||
1254 | } | 1268 | } |
1255 | void MainWindow::aboutKnownBugs() | 1269 | void MainWindow::aboutKnownBugs() |
1256 | { | 1270 | { |
1257 | QMessageBox* msg; | 1271 | QMessageBox* msg; |
1258 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1272 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1259 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1273 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1260 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1274 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1261 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1275 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1262 | i18n("\nor report them in the bugtracker on\n") + | 1276 | i18n("\nor report them in the bugtracker on\n") + |
1263 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1277 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1264 | QMessageBox::NoIcon, | 1278 | QMessageBox::NoIcon, |
1265 | QMessageBox::Ok, | 1279 | QMessageBox::Ok, |
1266 | QMessageBox::NoButton, | 1280 | QMessageBox::NoButton, |
1267 | QMessageBox::NoButton); | 1281 | QMessageBox::NoButton); |
1268 | msg->exec(); | 1282 | msg->exec(); |
1269 | delete msg; | 1283 | delete msg; |
1270 | 1284 | ||
1271 | } | 1285 | } |
1272 | 1286 | ||
1273 | QString MainWindow::defaultFileName() | 1287 | QString MainWindow::defaultFileName() |
1274 | { | 1288 | { |
1275 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1289 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1276 | } | 1290 | } |
1277 | QString MainWindow::syncFileName() | 1291 | QString MainWindow::syncFileName() |
1278 | { | 1292 | { |
1279 | #ifdef DESKTOP_VERSION | 1293 | #ifdef DESKTOP_VERSION |
1280 | return locateLocal( "tmp", "synccalendar.ics" ); | 1294 | return locateLocal( "tmp", "synccalendar.ics" ); |
1281 | #else | 1295 | #else |
1282 | return QString( "/tmp/synccalendar.ics" ); | 1296 | return QString( "/tmp/synccalendar.ics" ); |
1283 | #endif | 1297 | #endif |
1284 | } | 1298 | } |
1285 | 1299 | ||
1286 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1300 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1287 | { | 1301 | { |
1288 | if ( !incidence ) { | 1302 | if ( !incidence ) { |
1289 | enableIncidenceActions( false ); | 1303 | enableIncidenceActions( false ); |
1290 | 1304 | ||
1291 | mNewSubTodoAction->setEnabled( false ); | 1305 | mNewSubTodoAction->setEnabled( false ); |
1292 | setCaptionToDates(); | 1306 | setCaptionToDates(); |
1293 | return; | 1307 | return; |
1294 | 1308 | ||
1295 | } | 1309 | } |
1296 | 1310 | ||
1297 | //KGlobal::locale()->formatDateTime(nextA, true); | 1311 | //KGlobal::locale()->formatDateTime(nextA, true); |
1298 | QString startString = ""; | 1312 | QString startString = ""; |
1299 | if ( incidence->type() != "Todo" ) { | 1313 | if ( incidence->type() != "Todo" ) { |
1300 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1314 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1301 | if ( incidence->doesFloat() ) { | 1315 | if ( incidence->doesFloat() ) { |
1302 | startString += ": "+incidence->dtStartDateStr( true ); | 1316 | startString += ": "+incidence->dtStartDateStr( true ); |
1303 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1317 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1304 | 1318 | ||
1305 | } else { | 1319 | } else { |
1306 | startString = ": "+incidence->dtStartStr(true); | 1320 | startString = ": "+incidence->dtStartStr(true); |
1307 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1321 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1308 | 1322 | ||
1309 | } | 1323 | } |
1310 | 1324 | ||
1311 | } else { | 1325 | } else { |
1312 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1326 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1313 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1327 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1314 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1328 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1315 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1329 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1316 | } | 1330 | } |
1317 | 1331 | ||
1318 | } | 1332 | } |
1319 | else | 1333 | else |
1320 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1334 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1321 | if ( !incidence->location().isEmpty() ) | 1335 | if ( !incidence->location().isEmpty() ) |
1322 | startString += " (" +incidence->location()+")"; | 1336 | startString += " (" +incidence->location()+")"; |
1323 | setCaption( incidence->summary()+startString); | 1337 | setCaption( incidence->summary()+startString); |
1324 | 1338 | ||
1325 | enableIncidenceActions( true ); | 1339 | enableIncidenceActions( true ); |
1326 | 1340 | ||
1327 | if ( incidence->type() == "Event" ) { | 1341 | if ( incidence->type() == "Event" ) { |
1328 | mShowAction->setText( i18n("Show Event...") ); | 1342 | mShowAction->setText( i18n("Show Event...") ); |
1329 | mEditAction->setText( i18n("Edit Event...") ); | 1343 | mEditAction->setText( i18n("Edit Event...") ); |
1330 | mDeleteAction->setText( i18n("Delete Event...") ); | 1344 | mDeleteAction->setText( i18n("Delete Event...") ); |
1331 | 1345 | ||
1332 | mNewSubTodoAction->setEnabled( false ); | 1346 | mNewSubTodoAction->setEnabled( false ); |
1333 | } else if ( incidence->type() == "Todo" ) { | 1347 | } else if ( incidence->type() == "Todo" ) { |
1334 | mShowAction->setText( i18n("Show Todo...") ); | 1348 | mShowAction->setText( i18n("Show Todo...") ); |
1335 | mEditAction->setText( i18n("Edit Todo...") ); | 1349 | mEditAction->setText( i18n("Edit Todo...") ); |
1336 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1350 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1337 | 1351 | ||
1338 | mNewSubTodoAction->setEnabled( true ); | 1352 | mNewSubTodoAction->setEnabled( true ); |
1339 | } else { | 1353 | } else { |
1340 | mShowAction->setText( i18n("Show...") ); | 1354 | mShowAction->setText( i18n("Show...") ); |
1341 | mShowAction->setText( i18n("Edit...") ); | 1355 | mShowAction->setText( i18n("Edit...") ); |
1342 | mShowAction->setText( i18n("Delete...") ); | 1356 | mShowAction->setText( i18n("Delete...") ); |
1343 | 1357 | ||
1344 | mNewSubTodoAction->setEnabled( false ); | 1358 | mNewSubTodoAction->setEnabled( false ); |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 0926313..ed65d36 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,138 +1,140 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qtextstream.h> | 8 | #include <qtextstream.h> |
9 | #include <qregexp.h> | 9 | #include <qregexp.h> |
10 | 10 | ||
11 | #include <libkcal/incidence.h> | 11 | #include <libkcal/incidence.h> |
12 | #include "simplealarmclient.h" | 12 | #include "simplealarmclient.h" |
13 | #include <ksyncmanager.h> | 13 | #include <ksyncmanager.h> |
14 | #ifndef DESKTOP_VERSION | 14 | #ifndef DESKTOP_VERSION |
15 | #include <qcopchannel_qws.h> | 15 | #include <qcopchannel_qws.h> |
16 | #endif | 16 | #endif |
17 | class QAction; | 17 | class QAction; |
18 | class CalendarView; | 18 | class CalendarView; |
19 | class KSyncProfile; | 19 | class KSyncProfile; |
20 | #ifdef DESKTOP_VERSION | 20 | #ifdef DESKTOP_VERSION |
21 | 21 | ||
22 | #define QPEToolBar QToolBar | 22 | #define QPEToolBar QToolBar |
23 | #define QPEMenuBar QMenuBar | 23 | #define QPEMenuBar QMenuBar |
24 | #endif | 24 | #endif |
25 | class QPEToolBar; | 25 | class QPEToolBar; |
26 | 26 | ||
27 | 27 | ||
28 | namespace KCal { | 28 | namespace KCal { |
29 | class CalendarLocal; | 29 | class CalendarLocal; |
30 | } | 30 | } |
31 | 31 | ||
32 | using namespace KCal; | 32 | using namespace KCal; |
33 | 33 | ||
34 | class MainWindow : public QMainWindow | 34 | class MainWindow : public QMainWindow |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 38 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
39 | ~MainWindow(); | 39 | ~MainWindow(); |
40 | bool beamReceiveEnabled(); | 40 | bool beamReceiveEnabled(); |
41 | public slots: | 41 | public slots: |
42 | virtual void showMaximized (); | 42 | virtual void showMaximized (); |
43 | void configureAgenda( int ); | 43 | void configureAgenda( int ); |
44 | void recieve( const QCString& msg, const QByteArray& data ); | 44 | void recieve( const QCString& msg, const QByteArray& data ); |
45 | static QString defaultFileName(); | 45 | static QString defaultFileName(); |
46 | static QString syncFileName(); | 46 | static QString syncFileName(); |
47 | static QString resourcePath(); | 47 | static QString resourcePath(); |
48 | protected slots: | 48 | protected slots: |
49 | void setCaptionToDates(); | 49 | void setCaptionToDates(); |
50 | void about(); | 50 | void about(); |
51 | void licence(); | 51 | void licence(); |
52 | void faq(); | 52 | void faq(); |
53 | void usertrans(); | 53 | void usertrans(); |
54 | void features(); | 54 | void features(); |
55 | void synchowto(); | 55 | void synchowto(); |
56 | void kdesynchowto(); | ||
57 | void multisynchowto(); | ||
56 | void whatsNew(); | 58 | void whatsNew(); |
57 | void keyBindings(); | 59 | void keyBindings(); |
58 | void aboutAutoSaving();; | 60 | void aboutAutoSaving();; |
59 | void aboutKnownBugs(); | 61 | void aboutKnownBugs(); |
60 | 62 | ||
61 | void processIncidenceSelection( Incidence * ); | 63 | void processIncidenceSelection( Incidence * ); |
62 | 64 | ||
63 | void importQtopia(); | 65 | void importQtopia(); |
64 | void importBday(); | 66 | void importBday(); |
65 | void importOL(); | 67 | void importOL(); |
66 | void importIcal(); | 68 | void importIcal(); |
67 | void importFile( QString, bool ); | 69 | void importFile( QString, bool ); |
68 | void quickImportIcal(); | 70 | void quickImportIcal(); |
69 | 71 | ||
70 | void slotModifiedChanged( bool ); | 72 | void slotModifiedChanged( bool ); |
71 | 73 | ||
72 | void save(); | 74 | void save(); |
73 | void configureToolBar( int ); | 75 | void configureToolBar( int ); |
74 | void printSel(); | 76 | void printSel(); |
75 | void printCal(); | 77 | void printCal(); |
76 | void saveCalendar(); | 78 | void saveCalendar(); |
77 | void loadCalendar(); | 79 | void loadCalendar(); |
78 | void exportVCalendar(); | 80 | void exportVCalendar(); |
79 | void fillFilterMenu(); | 81 | void fillFilterMenu(); |
80 | void selectFilter( int ); | 82 | void selectFilter( int ); |
81 | void exportToPhone( int ); | 83 | void exportToPhone( int ); |
82 | void toggleBeamReceive(); | 84 | void toggleBeamReceive(); |
83 | void disableBR(bool); | 85 | void disableBR(bool); |
84 | 86 | ||
85 | 87 | ||
86 | protected: | 88 | protected: |
87 | void displayText( QString, QString); | 89 | void displayText( QString, QString); |
88 | void displayFile( QString, QString); | 90 | void displayFile( QString, QString); |
89 | 91 | ||
90 | void enableIncidenceActions( bool ); | 92 | void enableIncidenceActions( bool ); |
91 | 93 | ||
92 | private slots: | 94 | private slots: |
93 | QSocket* piSocket; | 95 | QSocket* piSocket; |
94 | QString piFileString; | 96 | QString piFileString; |
95 | QTime piTime; | 97 | QTime piTime; |
96 | void getFile( bool ); | 98 | void getFile( bool ); |
97 | void syncFileRequest(); | 99 | void syncFileRequest(); |
98 | private: | 100 | private: |
99 | bool mBRdisabled; | 101 | bool mBRdisabled; |
100 | #ifndef DESKTOP_VERSION | 102 | #ifndef DESKTOP_VERSION |
101 | QCopChannel* infrared; | 103 | QCopChannel* infrared; |
102 | #endif | 104 | #endif |
103 | QAction* brAction; | 105 | QAction* brAction; |
104 | KSyncManager* mSyncManager; | 106 | KSyncManager* mSyncManager; |
105 | bool mClosed; | 107 | bool mClosed; |
106 | void saveOnClose(); | 108 | void saveOnClose(); |
107 | bool mFlagKeyPressed; | 109 | bool mFlagKeyPressed; |
108 | bool mBlockAtStartup; | 110 | bool mBlockAtStartup; |
109 | QPEToolBar *iconToolBar; | 111 | QPEToolBar *iconToolBar; |
110 | void initActions(); | 112 | void initActions(); |
111 | void setDefaultPreferences(); | 113 | void setDefaultPreferences(); |
112 | void keyPressEvent ( QKeyEvent * ) ; | 114 | void keyPressEvent ( QKeyEvent * ) ; |
113 | void keyReleaseEvent ( QKeyEvent * ) ; | 115 | void keyReleaseEvent ( QKeyEvent * ) ; |
114 | QPopupMenu *configureToolBarMenu; | 116 | QPopupMenu *configureToolBarMenu; |
115 | QPopupMenu *selectFilterMenu; | 117 | QPopupMenu *selectFilterMenu; |
116 | QPopupMenu *configureAgendaMenu, *syncMenu; | 118 | QPopupMenu *configureAgendaMenu, *syncMenu; |
117 | CalendarLocal *mCalendar; | 119 | CalendarLocal *mCalendar; |
118 | CalendarView *mView; | 120 | CalendarView *mView; |
119 | QAction *mNewSubTodoAction; | 121 | QAction *mNewSubTodoAction; |
120 | 122 | ||
121 | QAction *mShowAction; | 123 | QAction *mShowAction; |
122 | QAction *mEditAction; | 124 | QAction *mEditAction; |
123 | QAction *mDeleteAction; | 125 | QAction *mDeleteAction; |
124 | QAction *mCloneAction; | 126 | QAction *mCloneAction; |
125 | QAction *mMoveAction; | 127 | QAction *mMoveAction; |
126 | QAction *mBeamAction; | 128 | QAction *mBeamAction; |
127 | QAction *mCancelAction; | 129 | QAction *mCancelAction; |
128 | 130 | ||
129 | void closeEvent( QCloseEvent* ce ); | 131 | void closeEvent( QCloseEvent* ce ); |
130 | SimpleAlarmClient mAlarmClient; | 132 | SimpleAlarmClient mAlarmClient; |
131 | QTimer mSaveTimer; | 133 | QTimer mSaveTimer; |
132 | //bool mBlockSaveFlag; | 134 | //bool mBlockSaveFlag; |
133 | bool mCalendarModifiedFlag; | 135 | bool mCalendarModifiedFlag; |
134 | QPixmap loadPixmap( QString ); | 136 | QPixmap loadPixmap( QString ); |
135 | }; | 137 | }; |
136 | 138 | ||
137 | 139 | ||
138 | #endif | 140 | #endif |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 17e6c75..9857e3e 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -291,419 +291,419 @@ void KSyncManager::slotSyncMenu( int action ) | |||
291 | 291 | ||
292 | } | 292 | } |
293 | } else { | 293 | } else { |
294 | if ( temp->getIsPhoneSync() ) { | 294 | if ( temp->getIsPhoneSync() ) { |
295 | mPhoneDevice = temp->getPhoneDevice( ) ; | 295 | mPhoneDevice = temp->getPhoneDevice( ) ; |
296 | mPhoneConnection = temp->getPhoneConnection( ); | 296 | mPhoneConnection = temp->getPhoneConnection( ); |
297 | mPhoneModel = temp->getPhoneModel( ); | 297 | mPhoneModel = temp->getPhoneModel( ); |
298 | syncPhone(); | 298 | syncPhone(); |
299 | } else if ( temp->getIsPiSync() ) { | 299 | } else if ( temp->getIsPiSync() ) { |
300 | if ( mTargetApp == KAPI ) { | 300 | if ( mTargetApp == KAPI ) { |
301 | mPassWordPiSync = temp->getRemotePwAB(); | 301 | mPassWordPiSync = temp->getRemotePwAB(); |
302 | mActiveSyncPort = temp->getRemotePortAB(); | 302 | mActiveSyncPort = temp->getRemotePortAB(); |
303 | mActiveSyncIP = temp->getRemoteIPAB(); | 303 | mActiveSyncIP = temp->getRemoteIPAB(); |
304 | } else if ( mTargetApp == KOPI ) { | 304 | } else if ( mTargetApp == KOPI ) { |
305 | mPassWordPiSync = temp->getRemotePw(); | 305 | mPassWordPiSync = temp->getRemotePw(); |
306 | mActiveSyncPort = temp->getRemotePort(); | 306 | mActiveSyncPort = temp->getRemotePort(); |
307 | mActiveSyncIP = temp->getRemoteIP(); | 307 | mActiveSyncIP = temp->getRemoteIP(); |
308 | } else { | 308 | } else { |
309 | mPassWordPiSync = temp->getRemotePwPWM(); | 309 | mPassWordPiSync = temp->getRemotePwPWM(); |
310 | mActiveSyncPort = temp->getRemotePortPWM(); | 310 | mActiveSyncPort = temp->getRemotePortPWM(); |
311 | mActiveSyncIP = temp->getRemoteIPPWM(); | 311 | mActiveSyncIP = temp->getRemoteIPPWM(); |
312 | } | 312 | } |
313 | syncPi(); | 313 | syncPi(); |
314 | while ( !mPisyncFinished ) { | 314 | while ( !mPisyncFinished ) { |
315 | //qDebug("waiting "); | 315 | //qDebug("waiting "); |
316 | qApp->processEvents(); | 316 | qApp->processEvents(); |
317 | } | 317 | } |
318 | } else | 318 | } else |
319 | syncRemote( temp ); | 319 | syncRemote( temp ); |
320 | 320 | ||
321 | } | 321 | } |
322 | } | 322 | } |
323 | delete temp; | 323 | delete temp; |
324 | setBlockSave(false); | 324 | setBlockSave(false); |
325 | } | 325 | } |
326 | 326 | ||
327 | void KSyncManager::enableQuick( bool ask ) | 327 | void KSyncManager::enableQuick( bool ask ) |
328 | { | 328 | { |
329 | bool autoStart; | 329 | bool autoStart; |
330 | bool changed = false; | 330 | bool changed = false; |
331 | if ( ask ) { | 331 | if ( ask ) { |
332 | QDialog dia ( 0, "input-dialog", true ); | 332 | QDialog dia ( 0, "input-dialog", true ); |
333 | QLineEdit lab ( &dia ); | 333 | QLineEdit lab ( &dia ); |
334 | QVBoxLayout lay( &dia ); | 334 | QVBoxLayout lay( &dia ); |
335 | lab.setText( mPrefs->mPassiveSyncPort ); | 335 | lab.setText( mPrefs->mPassiveSyncPort ); |
336 | lay.setMargin(7); | 336 | lay.setMargin(7); |
337 | lay.setSpacing(7); | 337 | lay.setSpacing(7); |
338 | int po = 9197+mTargetApp; | 338 | int po = 9197+mTargetApp; |
339 | QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); | 339 | QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); |
340 | lay.addWidget( &label); | 340 | lay.addWidget( &label); |
341 | lay.addWidget( &lab); | 341 | lay.addWidget( &lab); |
342 | 342 | ||
343 | QLineEdit lepw ( &dia ); | 343 | QLineEdit lepw ( &dia ); |
344 | lepw.setText( mPrefs->mPassiveSyncPw ); | 344 | lepw.setText( mPrefs->mPassiveSyncPw ); |
345 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); | 345 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); |
346 | lay.addWidget( &label2); | 346 | lay.addWidget( &label2); |
347 | lay.addWidget( &lepw); | 347 | lay.addWidget( &lepw); |
348 | QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); | 348 | QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); |
349 | lay.addWidget( &autostart); | 349 | lay.addWidget( &autostart); |
350 | autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); | 350 | autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); |
351 | #ifdef DESKTOP_VERSION | 351 | #ifdef DESKTOP_VERSION |
352 | #ifdef _WIN32_ | 352 | #ifdef _WIN32_ |
353 | QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia ); | 353 | QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia ); |
354 | #else | 354 | #else |
355 | QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); | 355 | QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); |
356 | #endif | 356 | #endif |
357 | lay.addWidget( &syncdesktop); | 357 | lay.addWidget( &syncdesktop); |
358 | #else | 358 | #else |
359 | mPrefs->mPassiveSyncWithDesktop = false; | 359 | mPrefs->mPassiveSyncWithDesktop = false; |
360 | QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); | 360 | QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); |
361 | syncdesktop.hide(); | 361 | syncdesktop.hide(); |
362 | #endif | 362 | #endif |
363 | syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop ); | 363 | syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop ); |
364 | 364 | ||
365 | dia.setFixedSize( 230,120 ); | 365 | dia.setFixedSize( 230,120 ); |
366 | dia.setCaption( i18n("Enter port for Pi-Sync") ); | 366 | dia.setCaption( i18n("Enter port for Pi-Sync") ); |
367 | QPushButton pb ( "OK", &dia); | 367 | QPushButton pb ( "OK", &dia); |
368 | lay.addWidget( &pb ); | 368 | lay.addWidget( &pb ); |
369 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 369 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
370 | dia.show(); | 370 | dia.show(); |
371 | if ( ! dia.exec() ) | 371 | if ( ! dia.exec() ) |
372 | return; | 372 | return; |
373 | dia.hide(); | 373 | dia.hide(); |
374 | qApp->processEvents(); | 374 | qApp->processEvents(); |
375 | if ( mPrefs->mPassiveSyncPw != lepw.text() ) { | 375 | if ( mPrefs->mPassiveSyncPw != lepw.text() ) { |
376 | changed = true; | 376 | changed = true; |
377 | mPrefs->mPassiveSyncPw = lepw.text(); | 377 | mPrefs->mPassiveSyncPw = lepw.text(); |
378 | } | 378 | } |
379 | if ( mPrefs->mPassiveSyncPort != lab.text() ) { | 379 | if ( mPrefs->mPassiveSyncPort != lab.text() ) { |
380 | mPrefs->mPassiveSyncPort = lab.text(); | 380 | mPrefs->mPassiveSyncPort = lab.text(); |
381 | changed = true; | 381 | changed = true; |
382 | } | 382 | } |
383 | autoStart = autostart.isChecked(); | 383 | autoStart = autostart.isChecked(); |
384 | if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { | 384 | if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { |
385 | changed = true; | 385 | changed = true; |
386 | mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); | 386 | mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); |
387 | } | 387 | } |
388 | } | 388 | } |
389 | else | 389 | else |
390 | autoStart = mPrefs->mPassiveSyncAutoStart; | 390 | autoStart = mPrefs->mPassiveSyncAutoStart; |
391 | if ( autoStart != mPrefs->mPassiveSyncAutoStart ) | 391 | if ( autoStart != mPrefs->mPassiveSyncAutoStart ) |
392 | changed = true; | 392 | changed = true; |
393 | bool ok; | 393 | bool ok; |
394 | mPrefs->mPassiveSyncAutoStart = false; | 394 | mPrefs->mPassiveSyncAutoStart = false; |
395 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); | 395 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); |
396 | if ( ! ok ) { | 396 | if ( ! ok ) { |
397 | KMessageBox::information( 0, i18n("No valid port")); | 397 | KMessageBox::information( 0, i18n("No valid port")); |
398 | return; | 398 | return; |
399 | } | 399 | } |
400 | //qDebug("port %d ", port); | 400 | //qDebug("port %d ", port); |
401 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); | 401 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); |
402 | mServerSocket->setFileName( defaultFileName() ); | 402 | mServerSocket->setFileName( defaultFileName() ); |
403 | //qDebug("connected "); | 403 | //qDebug("connected "); |
404 | if ( !mServerSocket->ok() ) { | 404 | if ( !mServerSocket->ok() ) { |
405 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); | 405 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); |
406 | delete mServerSocket; | 406 | delete mServerSocket; |
407 | mServerSocket = 0; | 407 | mServerSocket = 0; |
408 | return; | 408 | return; |
409 | } | 409 | } |
410 | mPrefs->mPassiveSyncAutoStart = autoStart; | 410 | mPrefs->mPassiveSyncAutoStart = autoStart; |
411 | if ( changed ) { | 411 | if ( changed ) { |
412 | mPrefs->writeConfig(); | 412 | mPrefs->writeConfig(); |
413 | } | 413 | } |
414 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); | 414 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); |
415 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); | 415 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); |
416 | } | 416 | } |
417 | 417 | ||
418 | void KSyncManager::syncLocalFile() | 418 | void KSyncManager::syncLocalFile() |
419 | { | 419 | { |
420 | 420 | ||
421 | QString fn =mPrefs->mLastSyncedLocalFile; | 421 | QString fn =mPrefs->mLastSyncedLocalFile; |
422 | QString ext; | 422 | QString ext; |
423 | 423 | ||
424 | switch(mTargetApp) | 424 | switch(mTargetApp) |
425 | { | 425 | { |
426 | case (KAPI): | 426 | case (KAPI): |
427 | ext = "(*.vcf)"; | 427 | ext = "(*.vcf)"; |
428 | break; | 428 | break; |
429 | case (KOPI): | 429 | case (KOPI): |
430 | ext = "(*.ics/*.vcs)"; | 430 | ext = "(*.ics/*.vcs)"; |
431 | break; | 431 | break; |
432 | case (PWMPI): | 432 | case (PWMPI): |
433 | ext = "(*.pwm)"; | 433 | ext = "(*.pwm)"; |
434 | break; | 434 | break; |
435 | default: | 435 | default: |
436 | qDebug("KSyncManager::syncLocalFile: invalid apptype selected"); | 436 | qDebug("KSyncManager::syncLocalFile: invalid apptype selected"); |
437 | break; | 437 | break; |
438 | 438 | ||
439 | } | 439 | } |
440 | 440 | ||
441 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); | 441 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); |
442 | if ( fn == "" ) | 442 | if ( fn == "" ) |
443 | return; | 443 | return; |
444 | if ( syncWithFile( fn, false ) ) { | 444 | if ( syncWithFile( fn, false ) ) { |
445 | qDebug("syncLocalFile() successful "); | 445 | qDebug("syncLocalFile() successful "); |
446 | } | 446 | } |
447 | 447 | ||
448 | } | 448 | } |
449 | 449 | ||
450 | bool KSyncManager::syncWithFile( QString fn , bool quick ) | 450 | bool KSyncManager::syncWithFile( QString fn , bool quick ) |
451 | { | 451 | { |
452 | bool ret = false; | 452 | bool ret = false; |
453 | QFileInfo info; | 453 | QFileInfo info; |
454 | info.setFile( fn ); | 454 | info.setFile( fn ); |
455 | QString mess; | 455 | QString mess; |
456 | bool loadbup = true; | 456 | bool loadbup = true; |
457 | if ( !info. exists() ) { | 457 | if ( !info. exists() ) { |
458 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); | 458 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); |
459 | int result = QMessageBox::warning( mParent, i18n("Warning!"), | 459 | int result = QMessageBox::warning( mParent, i18n("Warning!"), |
460 | mess ); | 460 | mess ); |
461 | return ret; | 461 | return ret; |
462 | } | 462 | } |
463 | int result = 0; | 463 | int result = 0; |
464 | if ( !quick ) { | 464 | if ( !quick ) { |
465 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 465 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
466 | result = QMessageBox::warning( mParent, i18n("Warning!"), | 466 | result = QMessageBox::warning( mParent, i18n("Warning!"), |
467 | mess, | 467 | mess, |
468 | i18n("Sync"), i18n("Cancel"), 0, | 468 | i18n("Sync"), i18n("Cancel"), 0, |
469 | 0, 1 ); | 469 | 0, 1 ); |
470 | if ( result ) | 470 | if ( result ) |
471 | return false; | 471 | return false; |
472 | } | 472 | } |
473 | if ( mAskForPreferences ) | 473 | if ( mAskForPreferences ) |
474 | if ( !edit_sync_options()) { | 474 | if ( !edit_sync_options()) { |
475 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 475 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
476 | return false; | 476 | return false; |
477 | } | 477 | } |
478 | if ( result == 0 ) { | 478 | if ( result == 0 ) { |
479 | //qDebug("Now sycing ... "); | 479 | //qDebug("Now sycing ... "); |
480 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) | 480 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) |
481 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); | 481 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); |
482 | else | 482 | else |
483 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); | 483 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
484 | if ( ! quick ) | 484 | if ( ! quick ) |
485 | mPrefs->mLastSyncedLocalFile = fn; | 485 | mPrefs->mLastSyncedLocalFile = fn; |
486 | } | 486 | } |
487 | return ret; | 487 | return ret; |
488 | } | 488 | } |
489 | 489 | ||
490 | void KSyncManager::quickSyncLocalFile() | 490 | void KSyncManager::quickSyncLocalFile() |
491 | { | 491 | { |
492 | 492 | ||
493 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { | 493 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { |
494 | qDebug("quick syncLocalFile() successful "); | 494 | qDebug("quick syncLocalFile() successful "); |
495 | 495 | ||
496 | } | 496 | } |
497 | } | 497 | } |
498 | 498 | ||
499 | void KSyncManager::multiSync( bool askforPrefs ) | 499 | void KSyncManager::multiSync( bool askforPrefs ) |
500 | { | 500 | { |
501 | if (blockSave()) | 501 | if (blockSave()) |
502 | return; | 502 | return; |
503 | setBlockSave(true); | 503 | setBlockSave(true); |
504 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 504 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
505 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), | 505 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), |
506 | question, | 506 | question, |
507 | i18n("Yes"), i18n("No"), | 507 | i18n("Yes"), i18n("No"), |
508 | 0, 0 ) != 0 ) { | 508 | 0, 0 ) != 0 ) { |
509 | setBlockSave(false); | 509 | setBlockSave(false); |
510 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); | 510 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); |
511 | return; | 511 | return; |
512 | } | 512 | } |
513 | mCurrentSyncDevice = i18n("Multiple profiles") ; | 513 | mCurrentSyncDevice = i18n("Multiple profiles") ; |
514 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; | 514 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; |
515 | if ( askforPrefs ) { | 515 | if ( askforPrefs ) { |
516 | if ( !edit_sync_options()) { | 516 | if ( !edit_sync_options()) { |
517 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 517 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") ); |
518 | return; | 518 | return; |
519 | } | 519 | } |
520 | mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; | 520 | mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; |
521 | } | 521 | } |
522 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); | 522 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); |
523 | qApp->processEvents(); | 523 | qApp->processEvents(); |
524 | int num = ringSync() ; | 524 | int num = ringSync() ; |
525 | if ( num > 1 ) | 525 | if ( num > 1 ) |
526 | ringSync(); | 526 | ringSync(); |
527 | setBlockSave(false); | 527 | setBlockSave(false); |
528 | if ( num ) | 528 | if ( num ) |
529 | emit save(); | 529 | emit save(); |
530 | if ( num ) | 530 | if ( num ) |
531 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); | 531 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); |
532 | else | 532 | else |
533 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 533 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
534 | return; | 534 | return; |
535 | } | 535 | } |
536 | 536 | ||
537 | int KSyncManager::ringSync() | 537 | int KSyncManager::ringSync() |
538 | { | 538 | { |
539 | int syncedProfiles = 0; | 539 | int syncedProfiles = 0; |
540 | unsigned int i; | 540 | unsigned int i; |
541 | QTime timer; | 541 | QTime timer; |
542 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 542 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
543 | QStringList syncProfileNames = mSyncProfileNames; | 543 | QStringList syncProfileNames = mSyncProfileNames; |
544 | KSyncProfile* temp = new KSyncProfile (); | 544 | KSyncProfile* temp = new KSyncProfile (); |
545 | mAskForPreferences = false; | 545 | mAskForPreferences = false; |
546 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 546 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
547 | mCurrentSyncProfile = i; | 547 | mCurrentSyncProfile = i; |
548 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 548 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
549 | temp->readConfig(&config); | 549 | temp->readConfig(&config); |
550 | 550 | ||
551 | bool includeInRingSync; | 551 | bool includeInRingSync; |
552 | switch(mTargetApp) | 552 | switch(mTargetApp) |
553 | { | 553 | { |
554 | case (KAPI): | 554 | case (KAPI): |
555 | includeInRingSync = temp->getIncludeInRingSyncAB(); | 555 | includeInRingSync = temp->getIncludeInRingSyncAB(); |
556 | break; | 556 | break; |
557 | case (KOPI): | 557 | case (KOPI): |
558 | includeInRingSync = temp->getIncludeInRingSync(); | 558 | includeInRingSync = temp->getIncludeInRingSync(); |
559 | break; | 559 | break; |
560 | case (PWMPI): | 560 | case (PWMPI): |
561 | includeInRingSync = temp->getIncludeInRingSyncPWM(); | 561 | includeInRingSync = temp->getIncludeInRingSyncPWM(); |
562 | break; | 562 | break; |
563 | default: | 563 | default: |
564 | qDebug("KSyncManager::ringSync: invalid apptype selected"); | 564 | qDebug("KSyncManager::ringSync: invalid apptype selected"); |
565 | break; | 565 | break; |
566 | 566 | ||
567 | } | 567 | } |
568 | 568 | ||
569 | 569 | ||
570 | if ( includeInRingSync && ( i < 1 || i > 2 )) { | 570 | if ( includeInRingSync && ( i < 1 || i > 2 )) { |
571 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 571 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
572 | ++syncedProfiles; | 572 | ++syncedProfiles; |
573 | // mAskForPreferences = temp->getAskForPreferences(); | 573 | // mAskForPreferences = temp->getAskForPreferences(); |
574 | mWriteBackFile = temp->getWriteBackFile(); | 574 | mWriteBackFile = temp->getWriteBackFile(); |
575 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 575 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
576 | mWriteBackInFuture = 0; | 576 | mWriteBackInFuture = 0; |
577 | if ( temp->getWriteBackFuture() ) | 577 | if ( temp->getWriteBackFuture() ) |
578 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 578 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
579 | mShowSyncSummary = false; | 579 | mShowSyncSummary = false; |
580 | mCurrentSyncDevice = syncProfileNames[i] ; | 580 | mCurrentSyncDevice = syncProfileNames[i] ; |
581 | mCurrentSyncName = mLocalMachineName; | 581 | mCurrentSyncName = mLocalMachineName; |
582 | if ( i == 0 ) { | 582 | if ( i == 0 ) { |
583 | #ifdef DESKTOP_VERSION | 583 | #ifdef DESKTOP_VERSION |
584 | syncKDE(); | 584 | syncKDE(); |
585 | #else | 585 | #else |
586 | syncSharp(); | 586 | syncSharp(); |
587 | #endif | 587 | #endif |
588 | } else { | 588 | } else { |
589 | if ( temp->getIsLocalFileSync() ) { | 589 | if ( temp->getIsLocalFileSync() ) { |
590 | switch(mTargetApp) | 590 | switch(mTargetApp) |
591 | { | 591 | { |
592 | case (KAPI): | 592 | case (KAPI): |
593 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 593 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
594 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 594 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
595 | break; | 595 | break; |
596 | case (KOPI): | 596 | case (KOPI): |
597 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 597 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
598 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); | 598 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
599 | break; | 599 | break; |
600 | case (PWMPI): | 600 | case (PWMPI): |
601 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 601 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
602 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 602 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
603 | break; | 603 | break; |
604 | default: | 604 | default: |
605 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 605 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
606 | break; | 606 | break; |
607 | } | 607 | } |
608 | } else { | 608 | } else { |
609 | if ( temp->getIsPhoneSync() ) { | 609 | if ( temp->getIsPhoneSync() ) { |
610 | mPhoneDevice = temp->getPhoneDevice( ) ; | 610 | mPhoneDevice = temp->getPhoneDevice( ) ; |
611 | mPhoneConnection = temp->getPhoneConnection( ); | 611 | mPhoneConnection = temp->getPhoneConnection( ); |
612 | mPhoneModel = temp->getPhoneModel( ); | 612 | mPhoneModel = temp->getPhoneModel( ); |
613 | syncPhone(); | 613 | syncPhone(); |
614 | } else if ( temp->getIsPiSync() ) { | 614 | } else if ( temp->getIsPiSync() ) { |
615 | if ( mTargetApp == KAPI ) { | 615 | if ( mTargetApp == KAPI ) { |
616 | mPassWordPiSync = temp->getRemotePwAB(); | 616 | mPassWordPiSync = temp->getRemotePwAB(); |
617 | mActiveSyncPort = temp->getRemotePortAB(); | 617 | mActiveSyncPort = temp->getRemotePortAB(); |
618 | mActiveSyncIP = temp->getRemoteIPAB(); | 618 | mActiveSyncIP = temp->getRemoteIPAB(); |
619 | } else if ( mTargetApp == KOPI ) { | 619 | } else if ( mTargetApp == KOPI ) { |
620 | mPassWordPiSync = temp->getRemotePw(); | 620 | mPassWordPiSync = temp->getRemotePw(); |
621 | mActiveSyncPort = temp->getRemotePort(); | 621 | mActiveSyncPort = temp->getRemotePort(); |
622 | mActiveSyncIP = temp->getRemoteIP(); | 622 | mActiveSyncIP = temp->getRemoteIP(); |
623 | } else { | 623 | } else { |
624 | mPassWordPiSync = temp->getRemotePwPWM(); | 624 | mPassWordPiSync = temp->getRemotePwPWM(); |
625 | mActiveSyncPort = temp->getRemotePortPWM(); | 625 | mActiveSyncPort = temp->getRemotePortPWM(); |
626 | mActiveSyncIP = temp->getRemoteIPPWM(); | 626 | mActiveSyncIP = temp->getRemoteIPPWM(); |
627 | } | 627 | } |
628 | syncPi(); | 628 | syncPi(); |
629 | while ( !mPisyncFinished ) { | 629 | while ( !mPisyncFinished ) { |
630 | //qDebug("waiting "); | 630 | //qDebug("waiting "); |
631 | qApp->processEvents(); | 631 | qApp->processEvents(); |
632 | } | 632 | } |
633 | timer.start(); | 633 | timer.start(); |
634 | while ( timer.elapsed () < 2000 ) { | 634 | while ( timer.elapsed () < 2000 ) { |
635 | qApp->processEvents(); | 635 | qApp->processEvents(); |
636 | } | 636 | } |
637 | } else | 637 | } else |
638 | syncRemote( temp, false ); | 638 | syncRemote( temp, false ); |
639 | 639 | ||
640 | } | 640 | } |
641 | } | 641 | } |
642 | timer.start(); | 642 | timer.start(); |
643 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync in progress ... please wait!") ); | 643 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync in progress ... please wait!") ); |
644 | while ( timer.elapsed () < 2000 ) { | 644 | while ( timer.elapsed () < 2000 ) { |
645 | qApp->processEvents(); | 645 | qApp->processEvents(); |
646 | #ifndef _WIN32_ | 646 | #ifndef _WIN32_ |
647 | sleep (1); | 647 | sleep (1); |
648 | #endif | 648 | #endif |
649 | } | 649 | } |
650 | 650 | ||
651 | } | 651 | } |
652 | 652 | ||
653 | } | 653 | } |
654 | delete temp; | 654 | delete temp; |
655 | return syncedProfiles; | 655 | return syncedProfiles; |
656 | } | 656 | } |
657 | 657 | ||
658 | void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | 658 | void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) |
659 | { | 659 | { |
660 | QString question; | 660 | QString question; |
661 | if ( ask ) { | 661 | if ( ask ) { |
662 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; | 662 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; |
663 | if ( QMessageBox::information( mParent, i18n("Sync"), | 663 | if ( QMessageBox::information( mParent, i18n("Sync"), |
664 | question, | 664 | question, |
665 | i18n("Yes"), i18n("No"), | 665 | i18n("Yes"), i18n("No"), |
666 | 0, 0 ) != 0 ) | 666 | 0, 0 ) != 0 ) |
667 | return; | 667 | return; |
668 | } | 668 | } |
669 | 669 | ||
670 | QString preCommand; | 670 | QString preCommand; |
671 | QString localTempFile; | 671 | QString localTempFile; |
672 | QString postCommand; | 672 | QString postCommand; |
673 | 673 | ||
674 | switch(mTargetApp) | 674 | switch(mTargetApp) |
675 | { | 675 | { |
676 | case (KAPI): | 676 | case (KAPI): |
677 | preCommand = prof->getPreSyncCommandAB(); | 677 | preCommand = prof->getPreSyncCommandAB(); |
678 | postCommand = prof->getPostSyncCommandAB(); | 678 | postCommand = prof->getPostSyncCommandAB(); |
679 | localTempFile = prof->getLocalTempFileAB(); | 679 | localTempFile = prof->getLocalTempFileAB(); |
680 | break; | 680 | break; |
681 | case (KOPI): | 681 | case (KOPI): |
682 | preCommand = prof->getPreSyncCommand(); | 682 | preCommand = prof->getPreSyncCommand(); |
683 | postCommand = prof->getPostSyncCommand(); | 683 | postCommand = prof->getPostSyncCommand(); |
684 | localTempFile = prof->getLocalTempFile(); | 684 | localTempFile = prof->getLocalTempFile(); |
685 | break; | 685 | break; |
686 | case (PWMPI): | 686 | case (PWMPI): |
687 | preCommand = prof->getPreSyncCommandPWM(); | 687 | preCommand = prof->getPreSyncCommandPWM(); |
688 | postCommand = prof->getPostSyncCommandPWM(); | 688 | postCommand = prof->getPostSyncCommandPWM(); |
689 | localTempFile = prof->getLocalTempFilePWM(); | 689 | localTempFile = prof->getLocalTempFilePWM(); |
690 | break; | 690 | break; |
691 | default: | 691 | default: |
692 | qDebug("KSyncManager::syncRemote: invalid apptype selected"); | 692 | qDebug("KSyncManager::syncRemote: invalid apptype selected"); |
693 | break; | 693 | break; |
694 | } | 694 | } |
695 | 695 | ||
696 | 696 | ||
697 | int fi; | 697 | int fi; |
698 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { | 698 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { |
699 | QString pwd = getPassword(); | 699 | QString pwd = getPassword(); |
700 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); | 700 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); |
701 | 701 | ||
702 | } | 702 | } |
703 | int maxlen = 30; | 703 | int maxlen = 30; |
704 | if ( QApplication::desktop()->width() > 320 ) | 704 | if ( QApplication::desktop()->width() > 320 ) |
705 | maxlen += 25; | 705 | maxlen += 25; |
706 | mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); | 706 | mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); |
707 | int fileSize = 0; | 707 | int fileSize = 0; |
708 | int result = system ( preCommand ); | 708 | int result = system ( preCommand ); |
709 | // 0 : okay | 709 | // 0 : okay |