author | zautrix <zautrix> | 2004-10-27 21:34:55 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-27 21:34:55 (UTC) |
commit | 9c88346fc757fd1dc54b3fca151a2a610159d8cf (patch) (unidiff) | |
tree | 4a5de97ba71ce66eea914d55923d88aff3515c93 | |
parent | 7f3cc07fab5f5f6ddd402c458341f1df3a144e2c (diff) | |
download | kdepimpi-9c88346fc757fd1dc54b3fca151a2a610159d8cf.zip kdepimpi-9c88346fc757fd1dc54b3fca151a2a610159d8cf.tar.gz kdepimpi-9c88346fc757fd1dc54b3fca151a2a610159d8cf.tar.bz2 |
several fixes
-rw-r--r-- | kaddressbook/kabcore.cpp | 87 | ||||
-rw-r--r-- | kaddressbook/kabprefs.cpp | 5 | ||||
-rw-r--r-- | kaddressbook/kabprefs.h | 1 | ||||
-rw-r--r-- | kaddressbook/kaddressbookview.h | 1 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.cpp | 7 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kabconfigwidget.h | 2 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 5 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.h | 1 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.h | 1 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.h | 1 | ||||
-rw-r--r-- | kmicromail/editaccounts.cpp | 8 |
14 files changed, 84 insertions, 53 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index b0cb986..4964a6c 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1826,322 +1826,323 @@ void KABCore::initActions() | |||
1826 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1826 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1827 | // this, SLOT( configureKeyBindings() ), actionCollection(), | 1827 | // this, SLOT( configureKeyBindings() ), actionCollection(), |
1828 | // "kaddressbook_configure_shortcuts" ); | 1828 | // "kaddressbook_configure_shortcuts" ); |
1829 | #ifdef KAB_EMBEDDED | 1829 | #ifdef KAB_EMBEDDED |
1830 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1830 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1831 | mActionConfigureToolbars->setEnabled( false ); | 1831 | mActionConfigureToolbars->setEnabled( false ); |
1832 | #endif //KAB_EMBEDDED | 1832 | #endif //KAB_EMBEDDED |
1833 | 1833 | ||
1834 | } else { | 1834 | } else { |
1835 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1835 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1836 | 1836 | ||
1837 | //US not implemented yet | 1837 | //US not implemented yet |
1838 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1838 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1839 | } | 1839 | } |
1840 | 1840 | ||
1841 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1841 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1842 | actionCollection(), "options_show_jump_bar" ); | 1842 | actionCollection(), "options_show_jump_bar" ); |
1843 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1843 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1844 | 1844 | ||
1845 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1845 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1846 | actionCollection(), "options_show_details" ); | 1846 | actionCollection(), "options_show_details" ); |
1847 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1847 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1848 | 1848 | ||
1849 | 1849 | ||
1850 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, | 1850 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, |
1851 | SLOT( toggleBeamReceive() ), actionCollection(), | 1851 | SLOT( toggleBeamReceive() ), actionCollection(), |
1852 | "kaddressbook_beam_rec" ); | 1852 | "kaddressbook_beam_rec" ); |
1853 | 1853 | ||
1854 | 1854 | ||
1855 | // misc | 1855 | // misc |
1856 | // only enable LDAP lookup if we can handle the protocol | 1856 | // only enable LDAP lookup if we can handle the protocol |
1857 | #ifndef KAB_EMBEDDED | 1857 | #ifndef KAB_EMBEDDED |
1858 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1858 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1859 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1859 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1860 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1860 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1861 | "ldap_lookup" ); | 1861 | "ldap_lookup" ); |
1862 | } | 1862 | } |
1863 | #else //KAB_EMBEDDED | 1863 | #else //KAB_EMBEDDED |
1864 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1864 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1865 | #endif //KAB_EMBEDDED | 1865 | #endif //KAB_EMBEDDED |
1866 | 1866 | ||
1867 | 1867 | ||
1868 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1868 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1869 | SLOT( setWhoAmI() ), actionCollection(), | 1869 | SLOT( setWhoAmI() ), actionCollection(), |
1870 | "set_personal" ); | 1870 | "set_personal" ); |
1871 | 1871 | ||
1872 | 1872 | ||
1873 | 1873 | ||
1874 | 1874 | ||
1875 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1875 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1876 | SLOT( setCategories() ), actionCollection(), | 1876 | SLOT( setCategories() ), actionCollection(), |
1877 | "edit_set_categories" ); | 1877 | "edit_set_categories" ); |
1878 | 1878 | ||
1879 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1879 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1880 | SLOT( removeVoice() ), actionCollection(), | 1880 | SLOT( removeVoice() ), actionCollection(), |
1881 | "remove_voice" ); | 1881 | "remove_voice" ); |
1882 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 1882 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
1883 | SLOT( importFromOL() ), actionCollection(), | 1883 | SLOT( importFromOL() ), actionCollection(), |
1884 | "import_OL" ); | 1884 | "import_OL" ); |
1885 | #ifdef KAB_EMBEDDED | 1885 | #ifdef KAB_EMBEDDED |
1886 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 1886 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
1887 | this, SLOT( showLicence() ), actionCollection(), | 1887 | this, SLOT( showLicence() ), actionCollection(), |
1888 | "licence_about_data" ); | 1888 | "licence_about_data" ); |
1889 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 1889 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
1890 | this, SLOT( faq() ), actionCollection(), | 1890 | this, SLOT( faq() ), actionCollection(), |
1891 | "faq_about_data" ); | 1891 | "faq_about_data" ); |
1892 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 1892 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
1893 | this, SLOT( whatsnew() ), actionCollection(), | 1893 | this, SLOT( whatsnew() ), actionCollection(), |
1894 | "wn" ); | 1894 | "wn" ); |
1895 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 1895 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
1896 | this, SLOT( synchowto() ), actionCollection(), | 1896 | this, SLOT( synchowto() ), actionCollection(), |
1897 | "sync" ); | 1897 | "sync" ); |
1898 | 1898 | ||
1899 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1899 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1900 | this, SLOT( createAboutData() ), actionCollection(), | 1900 | this, SLOT( createAboutData() ), actionCollection(), |
1901 | "kaddressbook_about_data" ); | 1901 | "kaddressbook_about_data" ); |
1902 | #endif //KAB_EMBEDDED | 1902 | #endif //KAB_EMBEDDED |
1903 | 1903 | ||
1904 | clipboardDataChanged(); | 1904 | clipboardDataChanged(); |
1905 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1905 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1906 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1906 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1907 | } | 1907 | } |
1908 | 1908 | ||
1909 | //US we need this function, to plug all actions into the correct menues. | 1909 | //US we need this function, to plug all actions into the correct menues. |
1910 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1910 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1911 | void KABCore::addActionsManually() | 1911 | void KABCore::addActionsManually() |
1912 | { | 1912 | { |
1913 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1913 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1914 | 1914 | ||
1915 | #ifdef KAB_EMBEDDED | 1915 | #ifdef KAB_EMBEDDED |
1916 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1916 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1917 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1917 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1918 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1918 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1919 | 1919 | ||
1920 | KToolBar* tb = mMainWindow->toolBar(); | 1920 | KToolBar* tb = mMainWindow->toolBar(); |
1921 | 1921 | ||
1922 | #ifdef DESKTOP_VERSION | ||
1923 | QMenuBar* mb = mMainWindow->menuBar(); | ||
1924 | |||
1925 | //US setup menubar. | ||
1926 | //Disable the following block if you do not want to have a menubar. | ||
1927 | mb->insertItem( "&File", fileMenu ); | ||
1928 | mb->insertItem( "&Edit", editMenu ); | ||
1929 | mb->insertItem( "&View", viewMenu ); | ||
1930 | mb->insertItem( "&Settings", settingsMenu ); | ||
1931 | mb->insertItem( i18n("Synchronize"), syncMenu ); | ||
1932 | mb->insertItem( "&Change selected", changeMenu ); | ||
1933 | mb->insertItem( "&Help", helpMenu ); | ||
1934 | mIncSearchWidget = new IncSearchWidget( tb ); | ||
1935 | // tb->insertWidget(-1, 0, mIncSearchWidget); | ||
1936 | |||
1937 | #else | ||
1938 | //US setup toolbar | ||
1939 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | ||
1940 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | ||
1941 | menuBarTB->insertItem( "ME", popupBarTB); | ||
1942 | tb->insertWidget(-1, 0, menuBarTB); | ||
1943 | mIncSearchWidget = new IncSearchWidget( tb ); | ||
1944 | 1922 | ||
1945 | tb->enableMoving(false); | 1923 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { |
1946 | popupBarTB->insertItem( "&File", fileMenu ); | 1924 | QMenuBar* mb = mMainWindow->menuBar(); |
1947 | popupBarTB->insertItem( "&Edit", editMenu ); | 1925 | |
1948 | popupBarTB->insertItem( "&View", viewMenu ); | 1926 | //US setup menubar. |
1949 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1927 | //Disable the following block if you do not want to have a menubar. |
1950 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 1928 | mb->insertItem( "&File", fileMenu ); |
1951 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1929 | mb->insertItem( "&Edit", editMenu ); |
1952 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1930 | mb->insertItem( "&View", viewMenu ); |
1953 | popupBarTB->insertItem( "&Help", helpMenu ); | 1931 | mb->insertItem( "&Settings", settingsMenu ); |
1954 | if (QApplication::desktop()->width() > 320 ) { | 1932 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
1955 | // mViewManager->getFilterAction()->plug ( tb); | 1933 | mb->insertItem( "&Change selected", changeMenu ); |
1934 | mb->insertItem( "&Help", helpMenu ); | ||
1935 | mIncSearchWidget = new IncSearchWidget( tb ); | ||
1936 | // tb->insertWidget(-1, 0, mIncSearchWidget); | ||
1937 | |||
1938 | } else { | ||
1939 | //US setup toolbar | ||
1940 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | ||
1941 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | ||
1942 | menuBarTB->insertItem( "ME", popupBarTB); | ||
1943 | tb->insertWidget(-1, 0, menuBarTB); | ||
1944 | mIncSearchWidget = new IncSearchWidget( tb ); | ||
1945 | |||
1946 | tb->enableMoving(false); | ||
1947 | popupBarTB->insertItem( "&File", fileMenu ); | ||
1948 | popupBarTB->insertItem( "&Edit", editMenu ); | ||
1949 | popupBarTB->insertItem( "&View", viewMenu ); | ||
1950 | popupBarTB->insertItem( "&Settings", settingsMenu ); | ||
1951 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | ||
1952 | mViewManager->getFilterAction()->plug ( popupBarTB); | ||
1953 | popupBarTB->insertItem( "&Change selected", changeMenu ); | ||
1954 | popupBarTB->insertItem( "&Help", helpMenu ); | ||
1955 | if (QApplication::desktop()->width() > 320 ) { | ||
1956 | // mViewManager->getFilterAction()->plug ( tb); | ||
1957 | } | ||
1956 | } | 1958 | } |
1957 | #endif | ||
1958 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1959 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1959 | 1960 | ||
1960 | 1961 | ||
1961 | 1962 | ||
1962 | //US Now connect the actions with the menue entries. | 1963 | //US Now connect the actions with the menue entries. |
1963 | mActionPrint->plug( fileMenu ); | 1964 | mActionPrint->plug( fileMenu ); |
1964 | mActionMail->plug( fileMenu ); | 1965 | mActionMail->plug( fileMenu ); |
1965 | fileMenu->insertSeparator(); | 1966 | fileMenu->insertSeparator(); |
1966 | 1967 | ||
1967 | mActionNewContact->plug( fileMenu ); | 1968 | mActionNewContact->plug( fileMenu ); |
1968 | mActionNewContact->plug( tb ); | 1969 | mActionNewContact->plug( tb ); |
1969 | 1970 | ||
1970 | mActionEditAddressee->plug( fileMenu ); | 1971 | mActionEditAddressee->plug( fileMenu ); |
1971 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 1972 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
1972 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 1973 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
1973 | mActionEditAddressee->plug( tb ); | 1974 | mActionEditAddressee->plug( tb ); |
1974 | 1975 | ||
1975 | fileMenu->insertSeparator(); | 1976 | fileMenu->insertSeparator(); |
1976 | mActionSave->plug( fileMenu ); | 1977 | mActionSave->plug( fileMenu ); |
1977 | fileMenu->insertItem( "&Import", ImportMenu ); | 1978 | fileMenu->insertItem( "&Import", ImportMenu ); |
1978 | fileMenu->insertItem( "&Export", ExportMenu ); | 1979 | fileMenu->insertItem( "&Export", ExportMenu ); |
1979 | fileMenu->insertSeparator(); | 1980 | fileMenu->insertSeparator(); |
1980 | mActionMailVCard->plug( fileMenu ); | 1981 | mActionMailVCard->plug( fileMenu ); |
1981 | #ifndef DESKTOP_VERSION | 1982 | #ifndef DESKTOP_VERSION |
1982 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 1983 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
1983 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 1984 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
1984 | #endif | 1985 | #endif |
1985 | fileMenu->insertSeparator(); | 1986 | fileMenu->insertSeparator(); |
1986 | mActionQuit->plug( fileMenu ); | 1987 | mActionQuit->plug( fileMenu ); |
1987 | #ifdef _WIN32_ | 1988 | #ifdef _WIN32_ |
1988 | mActionImportOL->plug( ImportMenu ); | 1989 | mActionImportOL->plug( ImportMenu ); |
1989 | #endif | 1990 | #endif |
1990 | // edit menu | 1991 | // edit menu |
1991 | mActionUndo->plug( editMenu ); | 1992 | mActionUndo->plug( editMenu ); |
1992 | mActionRedo->plug( editMenu ); | 1993 | mActionRedo->plug( editMenu ); |
1993 | editMenu->insertSeparator(); | 1994 | editMenu->insertSeparator(); |
1994 | mActionCut->plug( editMenu ); | 1995 | mActionCut->plug( editMenu ); |
1995 | mActionCopy->plug( editMenu ); | 1996 | mActionCopy->plug( editMenu ); |
1996 | mActionPaste->plug( editMenu ); | 1997 | mActionPaste->plug( editMenu ); |
1997 | mActionDelete->plug( editMenu ); | 1998 | mActionDelete->plug( editMenu ); |
1998 | editMenu->insertSeparator(); | 1999 | editMenu->insertSeparator(); |
1999 | mActionSelectAll->plug( editMenu ); | 2000 | mActionSelectAll->plug( editMenu ); |
2000 | 2001 | ||
2001 | mActionRemoveVoice->plug( changeMenu ); | 2002 | mActionRemoveVoice->plug( changeMenu ); |
2002 | // settings menu | 2003 | // settings menu |
2003 | //US special menuentry to configure the addressbook resources. On KDE | 2004 | //US special menuentry to configure the addressbook resources. On KDE |
2004 | // you do that through the control center !!! | 2005 | // you do that through the control center !!! |
2005 | mActionConfigResources->plug( settingsMenu ); | 2006 | mActionConfigResources->plug( settingsMenu ); |
2006 | settingsMenu->insertSeparator(); | 2007 | settingsMenu->insertSeparator(); |
2007 | 2008 | ||
2008 | mActionConfigKAddressbook->plug( settingsMenu ); | 2009 | mActionConfigKAddressbook->plug( settingsMenu ); |
2009 | 2010 | ||
2010 | if ( mIsPart ) { | 2011 | if ( mIsPart ) { |
2011 | //US not implemented yet | 2012 | //US not implemented yet |
2012 | //mActionConfigShortcuts->plug( settingsMenu ); | 2013 | //mActionConfigShortcuts->plug( settingsMenu ); |
2013 | //mActionConfigureToolbars->plug( settingsMenu ); | 2014 | //mActionConfigureToolbars->plug( settingsMenu ); |
2014 | 2015 | ||
2015 | } else { | 2016 | } else { |
2016 | //US not implemented yet | 2017 | //US not implemented yet |
2017 | //mActionKeyBindings->plug( settingsMenu ); | 2018 | //mActionKeyBindings->plug( settingsMenu ); |
2018 | } | 2019 | } |
2019 | 2020 | ||
2020 | settingsMenu->insertSeparator(); | 2021 | settingsMenu->insertSeparator(); |
2021 | 2022 | ||
2022 | mActionJumpBar->plug( settingsMenu ); | 2023 | mActionJumpBar->plug( settingsMenu ); |
2023 | mActionDetails->plug( settingsMenu ); | 2024 | mActionDetails->plug( settingsMenu ); |
2024 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2025 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2025 | mActionDetails->plug( tb ); | 2026 | mActionDetails->plug( tb ); |
2026 | settingsMenu->insertSeparator(); | 2027 | settingsMenu->insertSeparator(); |
2027 | mActionBR->plug(settingsMenu ); | 2028 | mActionBR->plug(settingsMenu ); |
2028 | settingsMenu->insertSeparator(); | 2029 | settingsMenu->insertSeparator(); |
2029 | 2030 | ||
2030 | mActionWhoAmI->plug( settingsMenu ); | 2031 | mActionWhoAmI->plug( settingsMenu ); |
2031 | mActionCategories->plug( settingsMenu ); | 2032 | mActionCategories->plug( settingsMenu ); |
2032 | 2033 | ||
2033 | 2034 | ||
2034 | mActionWN->plug( helpMenu ); | 2035 | mActionWN->plug( helpMenu ); |
2035 | mActionSyncHowto->plug( helpMenu ); | 2036 | mActionSyncHowto->plug( helpMenu ); |
2036 | mActionLicence->plug( helpMenu ); | 2037 | mActionLicence->plug( helpMenu ); |
2037 | mActionFaq->plug( helpMenu ); | 2038 | mActionFaq->plug( helpMenu ); |
2038 | mActionAboutKAddressbook->plug( helpMenu ); | 2039 | mActionAboutKAddressbook->plug( helpMenu ); |
2039 | 2040 | ||
2040 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2041 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2041 | 2042 | ||
2042 | mActionSave->plug( tb ); | 2043 | mActionSave->plug( tb ); |
2043 | mViewManager->getFilterAction()->plug ( tb); | 2044 | mViewManager->getFilterAction()->plug ( tb); |
2044 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 2045 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
2045 | mActionUndo->plug( tb ); | 2046 | mActionUndo->plug( tb ); |
2046 | mActionDelete->plug( tb ); | 2047 | mActionDelete->plug( tb ); |
2047 | mActionRedo->plug( tb ); | 2048 | mActionRedo->plug( tb ); |
2048 | } | 2049 | } |
2049 | } else { | 2050 | } else { |
2050 | if (KABPrefs::instance()->mMultipleViewsAtOnce ) | 2051 | mActionSave->plug( tb ); |
2051 | mActionSave->plug( tb ); | 2052 | tb->enableMoving(false); |
2052 | } | 2053 | } |
2053 | //mActionQuit->plug ( tb ); | 2054 | //mActionQuit->plug ( tb ); |
2054 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2055 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2055 | 2056 | ||
2056 | //US link the searchwidget first to this. | 2057 | //US link the searchwidget first to this. |
2057 | // The real linkage to the toolbar happens later. | 2058 | // The real linkage to the toolbar happens later. |
2058 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2059 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2059 | //US tb->insertItem( mIncSearchWidget ); | 2060 | //US tb->insertItem( mIncSearchWidget ); |
2060 | /*US | 2061 | /*US |
2061 | mIncSearchWidget = new IncSearchWidget( tb ); | 2062 | mIncSearchWidget = new IncSearchWidget( tb ); |
2062 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2063 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2063 | SLOT( incrementalSearch( const QString& ) ) ); | 2064 | SLOT( incrementalSearch( const QString& ) ) ); |
2064 | 2065 | ||
2065 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2066 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2066 | 2067 | ||
2067 | //US topLayout->addWidget( mJumpButtonBar ); | 2068 | //US topLayout->addWidget( mJumpButtonBar ); |
2068 | this->layout()->add( mJumpButtonBar ); | 2069 | this->layout()->add( mJumpButtonBar ); |
2069 | */ | 2070 | */ |
2070 | 2071 | ||
2071 | #endif //KAB_EMBEDDED | 2072 | #endif //KAB_EMBEDDED |
2072 | 2073 | ||
2073 | mActionExport2phone->plug( ExportMenu ); | 2074 | mActionExport2phone->plug( ExportMenu ); |
2074 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2075 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2075 | syncManager->fillSyncMenu(); | 2076 | syncManager->fillSyncMenu(); |
2076 | 2077 | ||
2077 | } | 2078 | } |
2078 | void KABCore::showLicence() | 2079 | void KABCore::showLicence() |
2079 | { | 2080 | { |
2080 | KApplication::showLicence(); | 2081 | KApplication::showLicence(); |
2081 | } | 2082 | } |
2082 | void KABCore::removeVoice() | 2083 | void KABCore::removeVoice() |
2083 | { | 2084 | { |
2084 | 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 ) | 2085 | 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 ) |
2085 | return; | 2086 | return; |
2086 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 2087 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
2087 | KABC::Addressee::List::Iterator it; | 2088 | KABC::Addressee::List::Iterator it; |
2088 | for ( it = list.begin(); it != list.end(); ++it ) { | 2089 | for ( it = list.begin(); it != list.end(); ++it ) { |
2089 | 2090 | ||
2090 | if ( (*it).removeVoice() ) | 2091 | if ( (*it).removeVoice() ) |
2091 | contactModified((*it) ); | 2092 | contactModified((*it) ); |
2092 | } | 2093 | } |
2093 | } | 2094 | } |
2094 | 2095 | ||
2095 | 2096 | ||
2096 | 2097 | ||
2097 | void KABCore::clipboardDataChanged() | 2098 | void KABCore::clipboardDataChanged() |
2098 | { | 2099 | { |
2099 | 2100 | ||
2100 | if ( mReadWrite ) | 2101 | if ( mReadWrite ) |
2101 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2102 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2102 | 2103 | ||
2103 | } | 2104 | } |
2104 | 2105 | ||
2105 | void KABCore::updateActionMenu() | 2106 | void KABCore::updateActionMenu() |
2106 | { | 2107 | { |
2107 | UndoStack *undo = UndoStack::instance(); | 2108 | UndoStack *undo = UndoStack::instance(); |
2108 | RedoStack *redo = RedoStack::instance(); | 2109 | RedoStack *redo = RedoStack::instance(); |
2109 | 2110 | ||
2110 | if ( undo->isEmpty() ) | 2111 | if ( undo->isEmpty() ) |
2111 | mActionUndo->setText( i18n( "Undo" ) ); | 2112 | mActionUndo->setText( i18n( "Undo" ) ); |
2112 | else | 2113 | else |
2113 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2114 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2114 | 2115 | ||
2115 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2116 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2116 | 2117 | ||
2117 | if ( !redo->top() ) | 2118 | if ( !redo->top() ) |
2118 | mActionRedo->setText( i18n( "Redo" ) ); | 2119 | mActionRedo->setText( i18n( "Redo" ) ); |
2119 | else | 2120 | else |
2120 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2121 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2121 | 2122 | ||
2122 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2123 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2123 | } | 2124 | } |
2124 | 2125 | ||
2125 | void KABCore::configureKeyBindings() | 2126 | void KABCore::configureKeyBindings() |
2126 | { | 2127 | { |
2127 | #ifndef KAB_EMBEDDED | 2128 | #ifndef KAB_EMBEDDED |
2128 | KKeyDialog::configure( actionCollection(), true ); | 2129 | KKeyDialog::configure( actionCollection(), true ); |
2129 | #else //KAB_EMBEDDED | 2130 | #else //KAB_EMBEDDED |
2130 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2131 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2131 | #endif //KAB_EMBEDDED | 2132 | #endif //KAB_EMBEDDED |
2132 | } | 2133 | } |
2133 | 2134 | ||
2134 | #ifdef KAB_EMBEDDED | 2135 | #ifdef KAB_EMBEDDED |
2135 | void KABCore::configureResources() | 2136 | void KABCore::configureResources() |
2136 | { | 2137 | { |
2137 | KRES::KCMKResources dlg( this, "" , 0 ); | 2138 | KRES::KCMKResources dlg( this, "" , 0 ); |
2138 | 2139 | ||
2139 | if ( !dlg.exec() ) | 2140 | if ( !dlg.exec() ) |
2140 | return; | 2141 | return; |
2141 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2142 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2142 | } | 2143 | } |
2143 | #endif //KAB_EMBEDDED | 2144 | #endif //KAB_EMBEDDED |
2144 | 2145 | ||
2145 | 2146 | ||
2146 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2147 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2147 | * for the attendees list of an event. | 2148 | * for the attendees list of an event. |
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 3cbcc9a..db123da 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp | |||
@@ -1,150 +1,155 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
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 | //US#ifdef KAB_EMBEDDED | 24 | //US#ifdef KAB_EMBEDDED |
25 | //#include <qstring.h> | 25 | //#include <qstring.h> |
26 | //#endif //KAB_EMBEDDED | 26 | //#endif //KAB_EMBEDDED |
27 | 27 | ||
28 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qregexp.h> | 30 | #include <qregexp.h> |
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include <libkdepim/kpimglobalprefs.h> | 32 | #include <libkdepim/kpimglobalprefs.h> |
33 | 33 | ||
34 | #include <kconfig.h> | 34 | #include <kconfig.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kstaticdeleter.h> | 36 | #include <kstaticdeleter.h> |
37 | //US#include <kdebug.h> // defines kdDebug() | 37 | //US#include <kdebug.h> // defines kdDebug() |
38 | 38 | ||
39 | #include "kabprefs.h" | 39 | #include "kabprefs.h" |
40 | 40 | ||
41 | #ifdef DESKTOP_VERSION | 41 | #ifdef DESKTOP_VERSION |
42 | #include <qapplication.h> | 42 | #include <qapplication.h> |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | KABPrefs *KABPrefs::sInstance = 0; | 45 | KABPrefs *KABPrefs::sInstance = 0; |
46 | static KStaticDeleter<KABPrefs> staticDeleterAB; | 46 | static KStaticDeleter<KABPrefs> staticDeleterAB; |
47 | 47 | ||
48 | KABPrefs::KABPrefs() | 48 | KABPrefs::KABPrefs() |
49 | : KPimPrefs("kaddressbookrc") | 49 | : KPimPrefs("kaddressbookrc") |
50 | { | 50 | { |
51 | mDetailsFont = QFont("helvetica",12); | 51 | mDetailsFont = QFont("helvetica",12); |
52 | KPrefs::setCurrentGroup( "Views" ); | 52 | KPrefs::setCurrentGroup( "Views" ); |
53 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); | 53 | addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); |
54 | 54 | ||
55 | KPrefs::setCurrentGroup( "General" ); | 55 | KPrefs::setCurrentGroup( "General" ); |
56 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); | 56 | addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); |
57 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); | 57 | addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); |
58 | 58 | ||
59 | #ifdef KAB_EMBEDDED | 59 | #ifdef KAB_EMBEDDED |
60 | addItemBool("AskForQuit",&mAskForQuit,true); | 60 | addItemBool("AskForQuit",&mAskForQuit,true); |
61 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 61 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
62 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 62 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
63 | addItemBool("SearchWithReturn",&mSearchWithReturn, true ); | 63 | addItemBool("SearchWithReturn",&mSearchWithReturn, true ); |
64 | addItemFont("DetailsFont",&mDetailsFont); | 64 | addItemFont("DetailsFont",&mDetailsFont); |
65 | 65 | ||
66 | 66 | ||
67 | #endif //KAB_EMBEDDED | 67 | #endif //KAB_EMBEDDED |
68 | 68 | ||
69 | KPrefs::setCurrentGroup( "MainWindow" ); | 69 | KPrefs::setCurrentGroup( "MainWindow" ); |
70 | bool m_visible = false; | ||
71 | #ifdef DESKTOP_VERSION | ||
72 | m_visible = true; | ||
73 | #endif | ||
74 | addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); | ||
70 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); | 75 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); |
71 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); | 76 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); |
72 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); | 77 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); |
73 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); | 78 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); |
74 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); | 79 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); |
75 | 80 | ||
76 | 81 | ||
77 | KPrefs::setCurrentGroup( "Extensions_General" ); | 82 | KPrefs::setCurrentGroup( "Extensions_General" ); |
78 | QStringList defaultExtensions; | 83 | QStringList defaultExtensions; |
79 | defaultExtensions << "merge"; | 84 | defaultExtensions << "merge"; |
80 | defaultExtensions << "distribution_list_editor"; | 85 | defaultExtensions << "distribution_list_editor"; |
81 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); | 86 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); |
82 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); | 87 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); |
83 | 88 | ||
84 | KPrefs::setCurrentGroup( "Views" ); | 89 | KPrefs::setCurrentGroup( "Views" ); |
85 | QString defaultView = i18n( "Default Table View" ); | 90 | QString defaultView = i18n( "Default Table View" ); |
86 | addItemString( "CurrentView", &mCurrentView, defaultView ); | 91 | addItemString( "CurrentView", &mCurrentView, defaultView ); |
87 | addItemStringList( "ViewNames", &mViewNames, defaultView ); | 92 | addItemStringList( "ViewNames", &mViewNames, defaultView ); |
88 | 93 | ||
89 | KPrefs::setCurrentGroup( "Filters" ); | 94 | KPrefs::setCurrentGroup( "Filters" ); |
90 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); | 95 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); |
91 | 96 | ||
92 | } | 97 | } |
93 | 98 | ||
94 | KABPrefs::~KABPrefs() | 99 | KABPrefs::~KABPrefs() |
95 | { | 100 | { |
96 | //qDebug("KABPrefs::~KABPrefs() "); | 101 | //qDebug("KABPrefs::~KABPrefs() "); |
97 | if (sInstance == this) | 102 | if (sInstance == this) |
98 | sInstance = staticDeleterAB.setObject(0); | 103 | sInstance = staticDeleterAB.setObject(0); |
99 | } | 104 | } |
100 | 105 | ||
101 | KABPrefs *KABPrefs::instance() | 106 | KABPrefs *KABPrefs::instance() |
102 | { | 107 | { |
103 | if ( !sInstance ) { | 108 | if ( !sInstance ) { |
104 | #ifdef KAB_EMBEDDED | 109 | #ifdef KAB_EMBEDDED |
105 | sInstance = staticDeleterAB.setObject( new KABPrefs() ); | 110 | sInstance = staticDeleterAB.setObject( new KABPrefs() ); |
106 | #else //KAB_EMBEDDED | 111 | #else //KAB_EMBEDDED |
107 | //US the following line has changed ???. Why | 112 | //US the following line has changed ???. Why |
108 | staticDeleterAB.setObject( sInstance, new KABPrefs() ); | 113 | staticDeleterAB.setObject( sInstance, new KABPrefs() ); |
109 | #endif //KAB_EMBEDDED | 114 | #endif //KAB_EMBEDDED |
110 | sInstance->readConfig(); | 115 | sInstance->readConfig(); |
111 | } | 116 | } |
112 | 117 | ||
113 | return sInstance; | 118 | return sInstance; |
114 | } | 119 | } |
115 | 120 | ||
116 | void KABPrefs::setCategoryDefaults() | 121 | void KABPrefs::setCategoryDefaults() |
117 | { | 122 | { |
118 | mCustomCategories.clear(); | 123 | mCustomCategories.clear(); |
119 | 124 | ||
120 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) | 125 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) |
121 | << i18n( "Customer" ) << i18n( "Friend" ); | 126 | << i18n( "Customer" ) << i18n( "Friend" ); |
122 | } | 127 | } |
123 | 128 | ||
124 | // US introduce a nonconst way to return the config object. | 129 | // US introduce a nonconst way to return the config object. |
125 | KConfig* KABPrefs::getConfig() | 130 | KConfig* KABPrefs::getConfig() |
126 | { | 131 | { |
127 | return config(); | 132 | return config(); |
128 | } | 133 | } |
129 | void KABPrefs::usrReadConfig() | 134 | void KABPrefs::usrReadConfig() |
130 | { | 135 | { |
131 | KPimPrefs::usrReadConfig(); | 136 | KPimPrefs::usrReadConfig(); |
132 | } | 137 | } |
133 | 138 | ||
134 | 139 | ||
135 | /*US | 140 | /*US |
136 | void KABPrefs::usrSetDefaults() | 141 | void KABPrefs::usrSetDefaults() |
137 | { | 142 | { |
138 | KPimPrefs::usrSetDefaults(); | 143 | KPimPrefs::usrSetDefaults(); |
139 | } | 144 | } |
140 | 145 | ||
141 | void KABPrefs::usrReadConfig() | 146 | void KABPrefs::usrReadConfig() |
142 | { | 147 | { |
143 | KPimPrefs::usrReadConfig(); | 148 | KPimPrefs::usrReadConfig(); |
144 | } | 149 | } |
145 | 150 | ||
146 | void KABPrefs::usrWriteConfig() | 151 | void KABPrefs::usrWriteConfig() |
147 | { | 152 | { |
148 | KPimPrefs::usrWriteConfig(); | 153 | KPimPrefs::usrWriteConfig(); |
149 | } | 154 | } |
150 | */ | 155 | */ |
diff --git a/kaddressbook/kabprefs.h b/kaddressbook/kabprefs.h index cc8413e..1e3b48f 100644 --- a/kaddressbook/kabprefs.h +++ b/kaddressbook/kabprefs.h | |||
@@ -1,95 +1,96 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
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 KABPREFS_H | 24 | #ifndef KABPREFS_H |
25 | #define KABPREFS_H | 25 | #define KABPREFS_H |
26 | 26 | ||
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | #include <qdict.h> | 28 | #include <qdict.h> |
29 | 29 | ||
30 | #include <libkdepim/kpimprefs.h> | 30 | #include <libkdepim/kpimprefs.h> |
31 | 31 | ||
32 | class KConfig; | 32 | class KConfig; |
33 | 33 | ||
34 | class KABPrefs : public KPimPrefs | 34 | class KABPrefs : public KPimPrefs |
35 | { | 35 | { |
36 | public: | 36 | public: |
37 | virtual ~KABPrefs(); | 37 | virtual ~KABPrefs(); |
38 | 38 | ||
39 | static KABPrefs *instance(); | 39 | static KABPrefs *instance(); |
40 | 40 | ||
41 | // General | 41 | // General |
42 | bool mHonorSingleClick; | 42 | bool mHonorSingleClick; |
43 | bool mAutomaticNameParsing; | 43 | bool mAutomaticNameParsing; |
44 | int mCurrentIncSearchField; | 44 | int mCurrentIncSearchField; |
45 | 45 | ||
46 | #ifdef KAB_EMBEDDED | 46 | #ifdef KAB_EMBEDDED |
47 | // US introduce a nonconst way to return the config object. | 47 | // US introduce a nonconst way to return the config object. |
48 | KConfig* getConfig(); | 48 | KConfig* getConfig(); |
49 | 49 | ||
50 | bool mToolBarHor; | 50 | bool mToolBarHor; |
51 | bool mToolBarUp; | 51 | bool mToolBarUp; |
52 | bool mAskForQuit; | 52 | bool mAskForQuit; |
53 | 53 | ||
54 | 54 | ||
55 | /** Set preferences to default values */ | 55 | /** Set preferences to default values */ |
56 | // void usrSetDefaults(); | 56 | // void usrSetDefaults(); |
57 | 57 | ||
58 | /** Read preferences from config file */ | 58 | /** Read preferences from config file */ |
59 | // void usrReadConfig(); | 59 | // void usrReadConfig(); |
60 | 60 | ||
61 | /** Write preferences to config file */ | 61 | /** Write preferences to config file */ |
62 | // void usrWriteConfig(); | 62 | // void usrWriteConfig(); |
63 | #endif //KAB_EMBEDDED | 63 | #endif //KAB_EMBEDDED |
64 | void usrReadConfig(); | 64 | void usrReadConfig(); |
65 | 65 | ||
66 | 66 | ||
67 | // GUI | 67 | // GUI |
68 | bool mFullMenuBarVisible; | ||
68 | bool mJumpButtonBarVisible; | 69 | bool mJumpButtonBarVisible; |
69 | bool mDetailsPageVisible; | 70 | bool mDetailsPageVisible; |
70 | bool mMultipleViewsAtOnce; | 71 | bool mMultipleViewsAtOnce; |
71 | bool mSearchWithReturn; | 72 | bool mSearchWithReturn; |
72 | QValueList<int> mExtensionsSplitter; | 73 | QValueList<int> mExtensionsSplitter; |
73 | QValueList<int> mDetailsSplitter; | 74 | QValueList<int> mDetailsSplitter; |
74 | 75 | ||
75 | // Extensions stuff | 76 | // Extensions stuff |
76 | int mCurrentExtension; | 77 | int mCurrentExtension; |
77 | QStringList mActiveExtensions; | 78 | QStringList mActiveExtensions; |
78 | 79 | ||
79 | // Views stuff | 80 | // Views stuff |
80 | QString mCurrentView; | 81 | QString mCurrentView; |
81 | QStringList mViewNames; | 82 | QStringList mViewNames; |
82 | 83 | ||
83 | // Filter | 84 | // Filter |
84 | int mCurrentFilter; | 85 | int mCurrentFilter; |
85 | 86 | ||
86 | void setCategoryDefaults(); | 87 | void setCategoryDefaults(); |
87 | QFont mDetailsFont; | 88 | QFont mDetailsFont; |
88 | 89 | ||
89 | private: | 90 | private: |
90 | KABPrefs(); | 91 | KABPrefs(); |
91 | 92 | ||
92 | static KABPrefs *sInstance; | 93 | static KABPrefs *sInstance; |
93 | }; | 94 | }; |
94 | 95 | ||
95 | #endif | 96 | #endif |
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h index c134e96..2e91cbc 100644 --- a/kaddressbook/kaddressbookview.h +++ b/kaddressbook/kaddressbookview.h | |||
@@ -1,165 +1,166 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
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 KADDRESSBOOKVIEW_H | 24 | #ifndef KADDRESSBOOKVIEW_H |
25 | #define KADDRESSBOOKVIEW_H | 25 | #define KADDRESSBOOKVIEW_H |
26 | 26 | ||
27 | #ifndef KAB_EMBEDDED | 27 | #ifndef KAB_EMBEDDED |
28 | #include <klibloader.h> | 28 | #include <klibloader.h> |
29 | #endif //KAB_EMBEDDED | 29 | #endif //KAB_EMBEDDED |
30 | 30 | ||
31 | class KConfig; | 31 | class KConfig; |
32 | class QDropEvent; | 32 | class QDropEvent; |
33 | 33 | ||
34 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
35 | #include <kabc/field.h> | 35 | #include <kabc/field.h> |
36 | #include <qwidget.h> | 36 | #include <qwidget.h> |
37 | 37 | ||
38 | #include "viewconfigurewidget.h" | 38 | #include "viewconfigurewidget.h" |
39 | #include "filter.h" | 39 | #include "filter.h" |
40 | 40 | ||
41 | namespace KABC { class AddressBook; } | 41 | namespace KABC { class AddressBook; } |
42 | 42 | ||
43 | /** | 43 | /** |
44 | Base class for all views in kaddressbook. This class implements | 44 | Base class for all views in kaddressbook. This class implements |
45 | all the common methods needed to provide a view to the user. | 45 | all the common methods needed to provide a view to the user. |
46 | 46 | ||
47 | To implement a specific view (table, card, etc), just inherit from | 47 | To implement a specific view (table, card, etc), just inherit from |
48 | this class and implement all the pure virtuals. | 48 | this class and implement all the pure virtuals. |
49 | 49 | ||
50 | @author Mike Pilone <mpilone@slac.com> | 50 | @author Mike Pilone <mpilone@slac.com> |
51 | */ | 51 | */ |
52 | class KAddressBookView : public QWidget | 52 | class KAddressBookView : public QWidget |
53 | { | 53 | { |
54 | Q_OBJECT | 54 | Q_OBJECT |
55 | 55 | ||
56 | public: | 56 | public: |
57 | enum DefaultFilterType { None = 0, Active = 1, Specific = 2 }; | 57 | enum DefaultFilterType { None = 0, Active = 1, Specific = 2 }; |
58 | 58 | ||
59 | KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name ); | 59 | KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name ); |
60 | virtual ~KAddressBookView(); | 60 | virtual ~KAddressBookView(); |
61 | 61 | ||
62 | /** | 62 | /** |
63 | Must be overloaded in subclasses. Should return a list of | 63 | Must be overloaded in subclasses. Should return a list of |
64 | all the uids of selected contacts. | 64 | all the uids of selected contacts. |
65 | */ | 65 | */ |
66 | virtual QStringList selectedUids() = 0; | 66 | virtual QStringList selectedUids() = 0; |
67 | virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; | 67 | virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; |
68 | virtual void scrollUP() = 0; | 68 | virtual void scrollUP() = 0; |
69 | virtual void scrollDOWN() = 0; | 69 | virtual void scrollDOWN() = 0; |
70 | virtual void setFocusAV() = 0; | ||
70 | 71 | ||
71 | /** | 72 | /** |
72 | Called whenever this view should read the config. This can be used | 73 | Called whenever this view should read the config. This can be used |
73 | as a sign that the config has changed, therefore the view should | 74 | as a sign that the config has changed, therefore the view should |
74 | assume the worst and rebuild itself if necessary. For example, | 75 | assume the worst and rebuild itself if necessary. For example, |
75 | in a table view this method may be called when the user adds or | 76 | in a table view this method may be called when the user adds or |
76 | removes columns from the view. | 77 | removes columns from the view. |
77 | 78 | ||
78 | If overloaded in the subclass, do not forget to call super class's | 79 | If overloaded in the subclass, do not forget to call super class's |
79 | method. | 80 | method. |
80 | 81 | ||
81 | @param config The KConfig object to read from. The group will already | 82 | @param config The KConfig object to read from. The group will already |
82 | be set, so do not change the group. | 83 | be set, so do not change the group. |
83 | */ | 84 | */ |
84 | virtual void readConfig( KConfig *config ); | 85 | virtual void readConfig( KConfig *config ); |
85 | 86 | ||
86 | /** | 87 | /** |
87 | Called whenever this view should write the config. The view should not | 88 | Called whenever this view should write the config. The view should not |
88 | write out information handled by the application, such as which fields | 89 | write out information handled by the application, such as which fields |
89 | are visible. The view should only write out information specific | 90 | are visible. The view should only write out information specific |
90 | to itself (i.e.: All information in the ViewConfigWidget) | 91 | to itself (i.e.: All information in the ViewConfigWidget) |
91 | 92 | ||
92 | If overloaded in the subclass, do not forget to call the super class's | 93 | If overloaded in the subclass, do not forget to call the super class's |
93 | method. | 94 | method. |
94 | 95 | ||
95 | @param config The KConfig object to read from. The group will already | 96 | @param config The KConfig object to read from. The group will already |
96 | be set, so do not change the group. | 97 | be set, so do not change the group. |
97 | */ | 98 | */ |
98 | virtual void writeConfig( KConfig *config ); | 99 | virtual void writeConfig( KConfig *config ); |
99 | 100 | ||
100 | /** | 101 | /** |
101 | Returns a QString with all the selected email addresses concatenated | 102 | Returns a QString with all the selected email addresses concatenated |
102 | together with a ',' seperator. | 103 | together with a ',' seperator. |
103 | */ | 104 | */ |
104 | virtual QString selectedEmails(); | 105 | virtual QString selectedEmails(); |
105 | 106 | ||
106 | /** | 107 | /** |
107 | Return the type of the view: Icon, Table, etc. Please make sure that | 108 | Return the type of the view: Icon, Table, etc. Please make sure that |
108 | this is the same value that ViewWrapper::type() will return for your | 109 | this is the same value that ViewWrapper::type() will return for your |
109 | view. | 110 | view. |
110 | */ | 111 | */ |
111 | virtual QString type() const = 0; | 112 | virtual QString type() const = 0; |
112 | 113 | ||
113 | /** | 114 | /** |
114 | Returns a list of the fields that should be displayed. The list | 115 | Returns a list of the fields that should be displayed. The list |
115 | is composed of the fields proper names (ie: Home Address), so | 116 | is composed of the fields proper names (ie: Home Address), so |
116 | the view may need to translate them in order to get the | 117 | the view may need to translate them in order to get the |
117 | value from the addressee. | 118 | value from the addressee. |
118 | 119 | ||
119 | This list is generated from the config file, so it is advisable to call | 120 | This list is generated from the config file, so it is advisable to call |
120 | this method whenever a readConfig() is called in order to get the newest | 121 | this method whenever a readConfig() is called in order to get the newest |
121 | list of fields. | 122 | list of fields. |
122 | */ | 123 | */ |
123 | KABC::Field::List fields() const; | 124 | KABC::Field::List fields() const; |
124 | 125 | ||
125 | /** | 126 | /** |
126 | Sets the active filter. This filter will be used for filtering | 127 | Sets the active filter. This filter will be used for filtering |
127 | the list of addressees to display. The view will <b>not</b> | 128 | the list of addressees to display. The view will <b>not</b> |
128 | automatically refresh itself, so in most cases you will want to call | 129 | automatically refresh itself, so in most cases you will want to call |
129 | KAddressBookView::refresh() after this method. | 130 | KAddressBookView::refresh() after this method. |
130 | */ | 131 | */ |
131 | void setFilter( const Filter& ); | 132 | void setFilter( const Filter& ); |
132 | 133 | ||
133 | /** | 134 | /** |
134 | @return The default filter type selection. If the selection | 135 | @return The default filter type selection. If the selection |
135 | is SpecificFilter, the name of the filter can be retrieved with | 136 | is SpecificFilter, the name of the filter can be retrieved with |
136 | defaultFilterName() | 137 | defaultFilterName() |
137 | */ | 138 | */ |
138 | DefaultFilterType defaultFilterType() const; | 139 | DefaultFilterType defaultFilterType() const; |
139 | 140 | ||
140 | /** | 141 | /** |
141 | @return The name of the default filter. This string is | 142 | @return The name of the default filter. This string is |
142 | only valid if defaultFilterType() is returning SpecificFilter. | 143 | only valid if defaultFilterType() is returning SpecificFilter. |
143 | */ | 144 | */ |
144 | const QString &defaultFilterName() const; | 145 | const QString &defaultFilterName() const; |
145 | 146 | ||
146 | /** | 147 | /** |
147 | @return The address book. | 148 | @return The address book. |
148 | */ | 149 | */ |
149 | KABC::AddressBook *addressBook() const; | 150 | KABC::AddressBook *addressBook() const; |
150 | 151 | ||
151 | public slots: | 152 | public slots: |
152 | /** | 153 | /** |
153 | Must be overloaded in subclasses to refresh the view. | 154 | Must be overloaded in subclasses to refresh the view. |
154 | Refreshing includes updating the view to ensure that only items | 155 | Refreshing includes updating the view to ensure that only items |
155 | in the document are visible. If <i>uid</i> is valid, only the | 156 | in the document are visible. If <i>uid</i> is valid, only the |
156 | addressee with uid needs to be refreshed. This is an optimization | 157 | addressee with uid needs to be refreshed. This is an optimization |
157 | only. | 158 | only. |
158 | */ | 159 | */ |
159 | virtual void refresh( QString uid = QString::null ) = 0; | 160 | virtual void refresh( QString uid = QString::null ) = 0; |
160 | 161 | ||
161 | /** | 162 | /** |
162 | This method must be overloaded in subclasses. Select (highlight) | 163 | This method must be overloaded in subclasses. Select (highlight) |
163 | the addressee matching <i>uid</i>. If uid | 164 | the addressee matching <i>uid</i>. If uid |
164 | is equal to QString::null, then all addressees should be selected. | 165 | is equal to QString::null, then all addressees should be selected. |
165 | */ | 166 | */ |
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.cpp b/kaddressbook/kcmconfigs/kabconfigwidget.cpp index 936d052..8bf9bb0 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.cpp +++ b/kaddressbook/kcmconfigs/kabconfigwidget.cpp | |||
@@ -26,284 +26,287 @@ | |||
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qlabel.h> | 32 | #include <qlabel.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qvbox.h> | 34 | #include <qvbox.h> |
35 | 35 | ||
36 | #include <kconfig.h> | 36 | #include <kconfig.h> |
37 | #include <kdebug.h> | 37 | #include <kdebug.h> |
38 | #include <kdialog.h> | 38 | #include <kdialog.h> |
39 | #include <klistview.h> | 39 | #include <klistview.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kglobal.h> | 41 | #include <kglobal.h> |
42 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
43 | #include <kstandarddirs.h> | 43 | #include <kstandarddirs.h> |
44 | 44 | ||
45 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
46 | #include <ktrader.h> | 46 | #include <ktrader.h> |
47 | #else // KAB_EMBEDDED | 47 | #else // KAB_EMBEDDED |
48 | #include <mergewidget.h> | 48 | #include <mergewidget.h> |
49 | #include <distributionlistwidget.h> | 49 | #include <distributionlistwidget.h> |
50 | #endif // KAB_EMBEDDED | 50 | #endif // KAB_EMBEDDED |
51 | 51 | ||
52 | #include "addresseewidget.h" | 52 | #include "addresseewidget.h" |
53 | #include "extensionconfigdialog.h" | 53 | #include "extensionconfigdialog.h" |
54 | #include "extensionwidget.h" | 54 | #include "extensionwidget.h" |
55 | #include "kabprefs.h" | 55 | #include "kabprefs.h" |
56 | 56 | ||
57 | #include "kabconfigwidget.h" | 57 | #include "kabconfigwidget.h" |
58 | 58 | ||
59 | class ExtensionItem : public QCheckListItem | 59 | class ExtensionItem : public QCheckListItem |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | 62 | ||
63 | #ifndef KAB_EMBEDDED | 63 | #ifndef KAB_EMBEDDED |
64 | ExtensionItem( QListView *parent, const QString &text ); | 64 | ExtensionItem( QListView *parent, const QString &text ); |
65 | void setService( const KService::Ptr &ptr ); | 65 | void setService( const KService::Ptr &ptr ); |
66 | #else //KAB_EMBEDDED | 66 | #else //KAB_EMBEDDED |
67 | ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); | 67 | ExtensionItem( QListView *parent, const QString &text, const QString &name, const QString &comment ); |
68 | void setFactory( ExtensionFactory* fac ); | 68 | void setFactory( ExtensionFactory* fac ); |
69 | #endif //KAB_EMBEDDED | 69 | #endif //KAB_EMBEDDED |
70 | 70 | ||
71 | bool configWidgetAvailable() const; | 71 | bool configWidgetAvailable() const; |
72 | ExtensionFactory *factory() const; | 72 | ExtensionFactory *factory() const; |
73 | 73 | ||
74 | virtual QString text( int column ) const; | 74 | virtual QString text( int column ) const; |
75 | 75 | ||
76 | private: | 76 | private: |
77 | #ifndef KAB_EMBEDDED | 77 | #ifndef KAB_EMBEDDED |
78 | KService::Ptr mPtr; | 78 | KService::Ptr mPtr; |
79 | #else //KAB_EMBEDDED | 79 | #else //KAB_EMBEDDED |
80 | ExtensionFactory* mFactory; | 80 | ExtensionFactory* mFactory; |
81 | QString mName; | 81 | QString mName; |
82 | QString mComment; | 82 | QString mComment; |
83 | 83 | ||
84 | #endif //KAB_EMBEDDED | 84 | #endif //KAB_EMBEDDED |
85 | 85 | ||
86 | }; | 86 | }; |
87 | 87 | ||
88 | KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) | 88 | KABConfigWidget::KABConfigWidget( KABPrefs* prefs, QWidget *parent, const char *name ) |
89 | : KPrefsWidget( prefs, parent, name ) | 89 | : KPrefsWidget( prefs, parent, name ) |
90 | { | 90 | { |
91 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 91 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
92 | KDialog::spacingHint() ); | 92 | KDialog::spacingHint() ); |
93 | 93 | ||
94 | QTabWidget *tabWidget = new QTabWidget( this ); | 94 | QTabWidget *tabWidget = new QTabWidget( this ); |
95 | topLayout->addWidget( tabWidget ); | 95 | topLayout->addWidget( tabWidget ); |
96 | 96 | ||
97 | // General page | 97 | // General page |
98 | QWidget *generalPage = new QWidget( this ); | 98 | QWidget *generalPage = new QWidget( this ); |
99 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), | 99 | QVBoxLayout *layout = new QVBoxLayout( generalPage, KDialog::marginHintSmall(), |
100 | KDialog::spacingHintSmall() ); | 100 | KDialog::spacingHintSmall() ); |
101 | 101 | ||
102 | 102 | ||
103 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); | 103 | QWidget *hBox = new QWidget( generalPage, "qhbox" ); |
104 | QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); | 104 | QHBoxLayout *hboxLayout = new QHBoxLayout( hBox); |
105 | KPrefsWidFont *detailsFont = | 105 | KPrefsWidFont *detailsFont = |
106 | addWidFont(i18n("phone:123"),i18n("Details view font"), | 106 | addWidFont(i18n("phone:123"),i18n("Details view font"), |
107 | &(KABPrefs::instance()->mDetailsFont),hBox); | 107 | &(KABPrefs::instance()->mDetailsFont),hBox); |
108 | hboxLayout->addWidget(detailsFont->label()); | 108 | hboxLayout->addWidget(detailsFont->label()); |
109 | hboxLayout->addWidget(detailsFont->preview()); | 109 | hboxLayout->addWidget(detailsFont->preview()); |
110 | hboxLayout->addWidget(detailsFont->button()); | 110 | hboxLayout->addWidget(detailsFont->button()); |
111 | hboxLayout->setMargin(KDialog::marginHintSmall() ); | 111 | hboxLayout->setMargin(KDialog::marginHintSmall() ); |
112 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); | 112 | hboxLayout->setSpacing(KDialog::spacingHintSmall()); |
113 | //hBox->setBackgroundColor( black); | 113 | //hBox->setBackgroundColor( black); |
114 | layout->addWidget( hBox ); | 114 | layout->addWidget( hBox ); |
115 | 115 | ||
116 | //general groupbox | 116 | //general groupbox |
117 | QWidget *vBox = new QWidget( generalPage, "qvbox" ); | 117 | QWidget *vBox = new QWidget( generalPage, "qvbox" ); |
118 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); | 118 | QVBoxLayout *boxLayout = new QVBoxLayout( vBox ); |
119 | boxLayout->setAlignment( Qt::AlignTop ); | 119 | boxLayout->setAlignment( Qt::AlignTop ); |
120 | boxLayout->setMargin(KDialog::marginHintSmall() ); | 120 | boxLayout->setMargin(KDialog::marginHintSmall() ); |
121 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); | 121 | boxLayout->setSpacing( KDialog::spacingHintSmall() ); |
122 | mMenuBarBox = new QCheckBox( i18n( "Full Menu bar (restart)" ), vBox, "mremenuturn" ); | ||
123 | boxLayout->addWidget( mMenuBarBox ); | ||
122 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); | 124 | mSearchReturnBox = new QCheckBox( i18n( "Search only after <return> key pressed" ), vBox, "mreturn" ); |
123 | boxLayout->addWidget( mSearchReturnBox ); | 125 | boxLayout->addWidget( mSearchReturnBox ); |
124 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); | 126 | mViewsSingleClickBox = new QCheckBox( i18n( "Honor KDE single click" ), vBox, "msingle" ); |
125 | boxLayout->addWidget( mViewsSingleClickBox ); | 127 | boxLayout->addWidget( mViewsSingleClickBox ); |
126 | 128 | ||
127 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); | 129 | mNameParsing = new QCheckBox( i18n( "Automatic name parsing for new addressees" ), vBox, "mparse" ); |
128 | boxLayout->addWidget( mNameParsing ); | 130 | boxLayout->addWidget( mNameParsing ); |
129 | 131 | ||
130 | mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); | 132 | mMultipleViewsAtOnce = new QCheckBox( i18n( "Display List and Details at once (restart)" ), vBox, "mdisplay" ); |
131 | boxLayout->addWidget( mMultipleViewsAtOnce ); | 133 | boxLayout->addWidget( mMultipleViewsAtOnce ); |
132 | 134 | ||
133 | mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); | 135 | mAskForQuit = new QCheckBox( i18n( "Ask for quit when closing Ka/Pi" ), vBox, "mquit" ); |
134 | boxLayout->addWidget( mAskForQuit ); | 136 | boxLayout->addWidget( mAskForQuit ); |
135 | 137 | ||
136 | layout->addWidget( vBox ); | 138 | layout->addWidget( vBox ); |
137 | 139 | ||
138 | tabWidget->addTab( generalPage, i18n( "General" ) ); | 140 | tabWidget->addTab( generalPage, i18n( "General" ) ); |
139 | 141 | ||
140 | // Extension page | 142 | // Extension page |
141 | QWidget *extensionPage = new QWidget( this ); | 143 | QWidget *extensionPage = new QWidget( this ); |
142 | QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), | 144 | QVBoxLayout *extensionLayout = new QVBoxLayout( extensionPage, KDialog::marginHintSmall(), |
143 | KDialog::spacingHintSmall() ); | 145 | KDialog::spacingHintSmall() ); |
144 | 146 | ||
145 | //extensions groupbox | 147 | //extensions groupbox |
146 | 148 | ||
147 | QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); | 149 | QGroupBox* groupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Extensions (restart)" ), extensionPage ); |
148 | boxLayout = new QVBoxLayout( groupBox->layout() ); | 150 | boxLayout = new QVBoxLayout( groupBox->layout() ); |
149 | boxLayout->setAlignment( Qt::AlignTop ); | 151 | boxLayout->setAlignment( Qt::AlignTop ); |
150 | boxLayout->setMargin(KDialog::marginHintSmall()); | 152 | boxLayout->setMargin(KDialog::marginHintSmall()); |
151 | boxLayout->setSpacing(KDialog::spacingHintSmall()); | 153 | boxLayout->setSpacing(KDialog::spacingHintSmall()); |
152 | groupBox->layout()->setMargin(1) ; | 154 | groupBox->layout()->setMargin(1) ; |
153 | groupBox->layout()->setSpacing(0); | 155 | groupBox->layout()->setSpacing(0); |
154 | mExtensionView = new KListView( groupBox ); | 156 | mExtensionView = new KListView( groupBox ); |
155 | mExtensionView->setAllColumnsShowFocus( true ); | 157 | mExtensionView->setAllColumnsShowFocus( true ); |
156 | mExtensionView->addColumn( i18n( "Name" ) ); | 158 | mExtensionView->addColumn( i18n( "Name" ) ); |
157 | mExtensionView->addColumn( i18n( "Description" ) ); | 159 | mExtensionView->addColumn( i18n( "Description" ) ); |
158 | mExtensionView->setMaximumHeight(80); | 160 | mExtensionView->setMaximumHeight(80); |
159 | 161 | ||
160 | boxLayout->addWidget( mExtensionView ); | 162 | boxLayout->addWidget( mExtensionView ); |
161 | 163 | ||
162 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); | 164 | mConfigureButton = new QPushButton( i18n( "Configure..." ), groupBox ); |
163 | mConfigureButton->setEnabled( false ); | 165 | mConfigureButton->setEnabled( false ); |
164 | boxLayout->addWidget( mConfigureButton ); | 166 | boxLayout->addWidget( mConfigureButton ); |
165 | 167 | ||
166 | extensionLayout->addWidget( groupBox ); | 168 | extensionLayout->addWidget( groupBox ); |
167 | 169 | ||
170 | connect( mMenuBarBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | ||
168 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 171 | connect( mNameParsing, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
169 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 172 | connect( mViewsSingleClickBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
170 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 173 | connect( mSearchReturnBox, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
171 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 174 | connect( mMultipleViewsAtOnce, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
172 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); | 175 | connect( mAskForQuit, SIGNAL( toggled( bool ) ), this, SLOT( modified() ) ); |
173 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), | 176 | connect( mExtensionView, SIGNAL( selectionChanged( QListViewItem* ) ), |
174 | SLOT( selectionChanged( QListViewItem* ) ) ); | 177 | SLOT( selectionChanged( QListViewItem* ) ) ); |
175 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), | 178 | connect( mExtensionView, SIGNAL( clicked( QListViewItem* ) ), |
176 | SLOT( itemClicked( QListViewItem* ) ) ); | 179 | SLOT( itemClicked( QListViewItem* ) ) ); |
177 | connect( mConfigureButton, SIGNAL( clicked() ), | 180 | connect( mConfigureButton, SIGNAL( clicked() ), |
178 | SLOT( configureExtension() ) ); | 181 | SLOT( configureExtension() ) ); |
179 | 182 | ||
180 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); | 183 | tabWidget->addTab( extensionPage, i18n( "Extensions" ) ); |
181 | 184 | ||
182 | // Addressee page | 185 | // Addressee page |
183 | mAddresseeWidget = new AddresseeWidget( this ); | 186 | mAddresseeWidget = new AddresseeWidget( this ); |
184 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); | 187 | tabWidget->addTab( mAddresseeWidget, i18n( "Contact" ) ); |
185 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); | 188 | connect( mAddresseeWidget, SIGNAL( modified() ), SLOT( modified() ) ); |
186 | 189 | ||
187 | } | 190 | } |
188 | 191 | ||
189 | void KABConfigWidget::usrReadConfig() | 192 | void KABConfigWidget::usrReadConfig() |
190 | { | 193 | { |
191 | KABPrefs* prefs = KABPrefs::instance(); | 194 | KABPrefs* prefs = KABPrefs::instance(); |
192 | 195 | ||
193 | bool blocked = signalsBlocked(); | 196 | bool blocked = signalsBlocked(); |
194 | blockSignals( true ); | 197 | blockSignals( true ); |
195 | 198 | mMenuBarBox->setChecked( prefs->mFullMenuBarVisible); | |
196 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); | 199 | mNameParsing->setChecked( prefs->mAutomaticNameParsing ); |
197 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); | 200 | mViewsSingleClickBox->setChecked( prefs->mHonorSingleClick ); |
198 | mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); | 201 | mSearchReturnBox->setChecked( prefs->mSearchWithReturn ); |
199 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); | 202 | mMultipleViewsAtOnce->setChecked( prefs->mMultipleViewsAtOnce ); |
200 | mAskForQuit->setChecked( prefs->mAskForQuit ); | 203 | mAskForQuit->setChecked( prefs->mAskForQuit ); |
201 | 204 | ||
202 | mAddresseeWidget->restoreSettings(); | 205 | mAddresseeWidget->restoreSettings(); |
203 | 206 | ||
204 | restoreExtensionSettings(); | 207 | restoreExtensionSettings(); |
205 | 208 | ||
206 | blockSignals( blocked ); | 209 | blockSignals( blocked ); |
207 | 210 | ||
208 | } | 211 | } |
209 | 212 | ||
210 | void KABConfigWidget::usrWriteConfig() | 213 | void KABConfigWidget::usrWriteConfig() |
211 | { | 214 | { |
212 | KABPrefs* prefs = KABPrefs::instance(); | 215 | KABPrefs* prefs = KABPrefs::instance(); |
213 | 216 | prefs->mFullMenuBarVisible = mMenuBarBox->isChecked(); | |
214 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); | 217 | prefs->mAutomaticNameParsing = mNameParsing->isChecked(); |
215 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); | 218 | prefs->mHonorSingleClick = mViewsSingleClickBox->isChecked(); |
216 | prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); | 219 | prefs->mSearchWithReturn = mSearchReturnBox->isChecked(); |
217 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); | 220 | prefs->mMultipleViewsAtOnce = mMultipleViewsAtOnce->isChecked(); |
218 | prefs->mAskForQuit = mAskForQuit->isChecked(); | 221 | prefs->mAskForQuit = mAskForQuit->isChecked(); |
219 | 222 | ||
220 | mAddresseeWidget->saveSettings(); | 223 | mAddresseeWidget->saveSettings(); |
221 | 224 | ||
222 | saveExtensionSettings(); | 225 | saveExtensionSettings(); |
223 | 226 | ||
224 | } | 227 | } |
225 | 228 | ||
226 | void KABConfigWidget::restoreExtensionSettings() | 229 | void KABConfigWidget::restoreExtensionSettings() |
227 | { | 230 | { |
228 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; | 231 | QStringList activeExtensions = KABPrefs::instance()->mActiveExtensions; |
229 | 232 | ||
230 | mExtensionView->clear(); | 233 | mExtensionView->clear(); |
231 | 234 | ||
232 | #ifndef KAB_EMBEDDED | 235 | #ifndef KAB_EMBEDDED |
233 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); | 236 | KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/Extension" ); |
234 | KTrader::OfferList::ConstIterator it; | 237 | KTrader::OfferList::ConstIterator it; |
235 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { | 238 | for ( it = plugins.begin(); it != plugins.end(); ++it ) { |
236 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) | 239 | if ( !(*it)->hasServiceType( "KAddressBook/Extension" ) ) |
237 | continue; | 240 | continue; |
238 | 241 | ||
239 | ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); | 242 | ExtensionItem *item = new ExtensionItem( mExtensionView, (*it)->name() ); |
240 | item->setService( *it ); | 243 | item->setService( *it ); |
241 | if ( activeExtensions.contains( item->factory()->identifier() ) ) | 244 | if ( activeExtensions.contains( item->factory()->identifier() ) ) |
242 | item->setOn( true ); | 245 | item->setOn( true ); |
243 | } | 246 | } |
244 | #else //KAB_EMBEDDED | 247 | #else //KAB_EMBEDDED |
245 | ExtensionFactory *extensionFactory = new MergeFactory(); | 248 | ExtensionFactory *extensionFactory = new MergeFactory(); |
246 | 249 | ||
247 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); | 250 | ExtensionItem *item = new ExtensionItem( mExtensionView, "Merge", "Merge", "Merge contacts"); |
248 | 251 | ||
249 | item->setFactory( extensionFactory ); | 252 | item->setFactory( extensionFactory ); |
250 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 253 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
251 | item->setOn( true ); | 254 | item->setOn( true ); |
252 | 255 | ||
253 | 256 | ||
254 | 257 | ||
255 | extensionFactory = new DistributionListFactory(); | 258 | extensionFactory = new DistributionListFactory(); |
256 | 259 | ||
257 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); | 260 | item = new ExtensionItem( mExtensionView, "Distribution List", "Distribution List", "Manage Distribution Lists"); |
258 | 261 | ||
259 | item->setFactory( extensionFactory ); | 262 | item->setFactory( extensionFactory ); |
260 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) | 263 | if ( activeExtensions.contains( extensionFactory->identifier() ) ) |
261 | item->setOn( true ); | 264 | item->setOn( true ); |
262 | 265 | ||
263 | 266 | ||
264 | #endif //KAB_EMBEDDED | 267 | #endif //KAB_EMBEDDED |
265 | 268 | ||
266 | } | 269 | } |
267 | 270 | ||
268 | void KABConfigWidget::saveExtensionSettings() | 271 | void KABConfigWidget::saveExtensionSettings() |
269 | { | 272 | { |
270 | QStringList activeExtensions; | 273 | QStringList activeExtensions; |
271 | 274 | ||
272 | QPtrList<QListViewItem> list; | 275 | QPtrList<QListViewItem> list; |
273 | QListViewItemIterator it( mExtensionView ); | 276 | QListViewItemIterator it( mExtensionView ); |
274 | while ( it.current() ) { | 277 | while ( it.current() ) { |
275 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); | 278 | ExtensionItem *item = static_cast<ExtensionItem*>( it.current() ); |
276 | if ( item ) { | 279 | if ( item ) { |
277 | if ( item->isOn() ) | 280 | if ( item->isOn() ) |
278 | activeExtensions.append( item->factory()->identifier() ); | 281 | activeExtensions.append( item->factory()->identifier() ); |
279 | } | 282 | } |
280 | ++it; | 283 | ++it; |
281 | } | 284 | } |
282 | 285 | ||
283 | KABPrefs::instance()->mActiveExtensions = activeExtensions; | 286 | KABPrefs::instance()->mActiveExtensions = activeExtensions; |
284 | } | 287 | } |
285 | 288 | ||
286 | void KABConfigWidget::configureExtension() | 289 | void KABConfigWidget::configureExtension() |
287 | { | 290 | { |
288 | ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); | 291 | ExtensionItem *item = static_cast<ExtensionItem*>( mExtensionView->currentItem() ); |
289 | if ( !item ) | 292 | if ( !item ) |
290 | return; | 293 | return; |
291 | 294 | ||
292 | #ifndef KAB_EMBEDDED | 295 | #ifndef KAB_EMBEDDED |
293 | KConfig config( "kaddressbookrc" ); | 296 | KConfig config( "kaddressbookrc" ); |
294 | #else //KAB_EMBEDDED | 297 | #else //KAB_EMBEDDED |
295 | KConfig config( locateLocal("config", "kaddressbookrc") ); | 298 | KConfig config( locateLocal("config", "kaddressbookrc") ); |
296 | #endif //KAB_EMBEDDED | 299 | #endif //KAB_EMBEDDED |
297 | config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); | 300 | config.setGroup( QString( "Extensions_%1" ).arg( item->factory()->identifier() ) ); |
298 | 301 | ||
299 | ExtensionConfigDialog dlg( item->factory(), &config, this ); | 302 | ExtensionConfigDialog dlg( item->factory(), &config, this ); |
300 | dlg.exec(); | 303 | dlg.exec(); |
301 | 304 | ||
302 | config.sync(); | 305 | config.sync(); |
303 | } | 306 | } |
304 | 307 | ||
305 | void KABConfigWidget::selectionChanged( QListViewItem *i ) | 308 | void KABConfigWidget::selectionChanged( QListViewItem *i ) |
306 | { | 309 | { |
307 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); | 310 | ExtensionItem *item = static_cast<ExtensionItem*>( i ); |
308 | if ( !item ) | 311 | if ( !item ) |
309 | return; | 312 | return; |
diff --git a/kaddressbook/kcmconfigs/kabconfigwidget.h b/kaddressbook/kcmconfigs/kabconfigwidget.h index 1e71fd1..08d71b4 100644 --- a/kaddressbook/kcmconfigs/kabconfigwidget.h +++ b/kaddressbook/kcmconfigs/kabconfigwidget.h | |||
@@ -1,75 +1,75 @@ | |||
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 KABCONFIGWIDGET_H | 24 | #ifndef KABCONFIGWIDGET_H |
25 | #define KABCONFIGWIDGET_H | 25 | #define KABCONFIGWIDGET_H |
26 | 26 | ||
27 | #include <kprefswidget.h> | 27 | #include <kprefswidget.h> |
28 | 28 | ||
29 | class QCheckBox; | 29 | class QCheckBox; |
30 | class QListViewItem; | 30 | class QListViewItem; |
31 | class QPushButton; | 31 | class QPushButton; |
32 | class QComboBox; | 32 | class QComboBox; |
33 | class QLineEdit; | 33 | class QLineEdit; |
34 | class KListView; | 34 | class KListView; |
35 | class KABPrefs; | 35 | class KABPrefs; |
36 | 36 | ||
37 | class AddresseeWidget; | 37 | class AddresseeWidget; |
38 | 38 | ||
39 | class KABConfigWidget : public KPrefsWidget | 39 | class KABConfigWidget : public KPrefsWidget |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | 42 | ||
43 | public: | 43 | public: |
44 | KABConfigWidget(KABPrefs *prefs, QWidget *parent, const char *name = 0 ); | 44 | KABConfigWidget(KABPrefs *prefs, QWidget *parent, const char *name = 0 ); |
45 | 45 | ||
46 | protected: | 46 | protected: |
47 | /** Implement this to read custom configuration widgets. */ | 47 | /** Implement this to read custom configuration widgets. */ |
48 | virtual void usrReadConfig(); | 48 | virtual void usrReadConfig(); |
49 | /** Implement this to write custom configuration widgets. */ | 49 | /** Implement this to write custom configuration widgets. */ |
50 | virtual void usrWriteConfig(); | 50 | virtual void usrWriteConfig(); |
51 | 51 | ||
52 | 52 | ||
53 | 53 | ||
54 | private slots: | 54 | private slots: |
55 | void configureExtension(); | 55 | void configureExtension(); |
56 | void selectionChanged( QListViewItem* ); | 56 | void selectionChanged( QListViewItem* ); |
57 | void itemClicked( QListViewItem* ); | 57 | void itemClicked( QListViewItem* ); |
58 | 58 | ||
59 | private: | 59 | private: |
60 | void restoreExtensionSettings(); | 60 | void restoreExtensionSettings(); |
61 | void saveExtensionSettings(); | 61 | void saveExtensionSettings(); |
62 | 62 | ||
63 | KListView *mExtensionView; | 63 | KListView *mExtensionView; |
64 | QCheckBox *mSearchReturnBox; | 64 | QCheckBox *mSearchReturnBox; |
65 | QCheckBox *mNameParsing; | 65 | QCheckBox *mNameParsing; |
66 | QCheckBox *mViewsSingleClickBox; | 66 | QCheckBox *mViewsSingleClickBox; |
67 | QCheckBox *mMultipleViewsAtOnce; | 67 | QCheckBox *mMultipleViewsAtOnce; |
68 | QCheckBox *mAskForQuit; | 68 | QCheckBox *mAskForQuit; |
69 | 69 | QCheckBox *mMenuBarBox; | |
70 | QPushButton *mConfigureButton; | 70 | QPushButton *mConfigureButton; |
71 | 71 | ||
72 | AddresseeWidget *mAddresseeWidget; | 72 | AddresseeWidget *mAddresseeWidget; |
73 | }; | 73 | }; |
74 | 74 | ||
75 | #endif | 75 | #endif |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 81e0d99..3d0c275 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -13,193 +13,193 @@ | |||
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 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | 31 | ||
32 | #ifndef KAB_EMBEDDED | 32 | #ifndef KAB_EMBEDDED |
33 | #include <libkdepim/kvcarddrag.h> | 33 | #include <libkdepim/kvcarddrag.h> |
34 | #include <kabc/vcardconverter.h> | 34 | #include <kabc/vcardconverter.h> |
35 | #include <kconfig.h> | 35 | #include <kconfig.h> |
36 | #include <kdeversion.h> | 36 | #include <kdeversion.h> |
37 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
38 | #include <klocale.h> | 38 | #include <klocale.h> |
39 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
40 | #include <kmultipledrag.h> | 40 | #include <kmultipledrag.h> |
41 | #include <ktrader.h> | 41 | #include <ktrader.h> |
42 | #include <kurldrag.h> | 42 | #include <kurldrag.h> |
43 | 43 | ||
44 | #include "addresseeutil.h" | 44 | #include "addresseeutil.h" |
45 | #else //KAB_EMBEDDED | 45 | #else //KAB_EMBEDDED |
46 | #include "views/kaddressbookiconview.h" | 46 | #include "views/kaddressbookiconview.h" |
47 | #include "views/kaddressbooktableview.h" | 47 | #include "views/kaddressbooktableview.h" |
48 | #include "views/kaddressbookcardview.h" | 48 | #include "views/kaddressbookcardview.h" |
49 | #include "kaddressbookview.h" | 49 | #include "kaddressbookview.h" |
50 | 50 | ||
51 | #include <qaction.h> | 51 | #include <qaction.h> |
52 | #include <qmessagebox.h> | 52 | #include <qmessagebox.h> |
53 | #include <qpopupmenu.h> | 53 | #include <qpopupmenu.h> |
54 | #include <kconfigbase.h> | 54 | #include <kconfigbase.h> |
55 | 55 | ||
56 | #endif //KAB_EMBEDDED | 56 | #endif //KAB_EMBEDDED |
57 | 57 | ||
58 | 58 | ||
59 | #include <kdebug.h> | 59 | #include <kdebug.h> |
60 | #include <kactionclasses.h> | 60 | #include <kactionclasses.h> |
61 | 61 | ||
62 | #include <qlayout.h> | 62 | #include <qlayout.h> |
63 | #include <qwidgetstack.h> | 63 | #include <qwidgetstack.h> |
64 | 64 | ||
65 | #include <kabc/addressbook.h> | 65 | #include <kabc/addressbook.h> |
66 | #include "filtereditdialog.h" | 66 | #include "filtereditdialog.h" |
67 | #include "addviewdialog.h" | 67 | #include "addviewdialog.h" |
68 | #include "kabcore.h" | 68 | #include "kabcore.h" |
69 | #include "kabprefs.h" | 69 | #include "kabprefs.h" |
70 | #include "viewmanager.h" | 70 | #include "viewmanager.h" |
71 | 71 | ||
72 | ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) | 72 | ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) |
73 | : QWidget( parent, name ), mCore( core ), mActiveView( 0 ) | 73 | : QWidget( parent, name ), mCore( core ), mActiveView( 0 ) |
74 | { | 74 | { |
75 | initGUI(); | 75 | initGUI(); |
76 | initActions(); | 76 | initActions(); |
77 | 77 | ||
78 | mViewDict.setAutoDelete( true ); | 78 | mViewDict.setAutoDelete( true ); |
79 | 79 | ||
80 | createViewFactories(); | 80 | createViewFactories(); |
81 | } | 81 | } |
82 | 82 | ||
83 | ViewManager::~ViewManager() | 83 | ViewManager::~ViewManager() |
84 | { | 84 | { |
85 | unloadViews(); | 85 | unloadViews(); |
86 | mViewFactoryDict.clear(); | 86 | mViewFactoryDict.clear(); |
87 | } | 87 | } |
88 | void ViewManager::scrollUP() | 88 | void ViewManager::scrollUP() |
89 | { | 89 | { |
90 | if ( mActiveView ) | 90 | if ( mActiveView ) |
91 | mActiveView->scrollUP(); | 91 | mActiveView->scrollUP(); |
92 | } | 92 | } |
93 | void ViewManager::scrollDOWN() | 93 | void ViewManager::scrollDOWN() |
94 | { | 94 | { |
95 | if ( mActiveView ) | 95 | if ( mActiveView ) |
96 | mActiveView->scrollDOWN(); | 96 | mActiveView->scrollDOWN(); |
97 | } | 97 | } |
98 | void ViewManager::restoreSettings() | 98 | void ViewManager::restoreSettings() |
99 | { | 99 | { |
100 | mViewNameList = KABPrefs::instance()->mViewNames; | 100 | mViewNameList = KABPrefs::instance()->mViewNames; |
101 | QString activeViewName = KABPrefs::instance()->mCurrentView; | 101 | QString activeViewName = KABPrefs::instance()->mCurrentView; |
102 | 102 | ||
103 | mActionSelectView->setItems( mViewNameList ); | 103 | mActionSelectView->setItems( mViewNameList ); |
104 | 104 | ||
105 | // Filter | 105 | // Filter |
106 | mFilterList = Filter::restore( mCore->config(), "Filter" ); | 106 | mFilterList = Filter::restore( mCore->config(), "Filter" ); |
107 | mActionSelectFilter->setItems( filterNames() ); | 107 | mActionSelectFilter->setItems( filterNames() ); |
108 | mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); | 108 | mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); |
109 | 109 | mActionSelectFilter->setComboWidth( 100 ); | |
110 | // Tell the views to reread their config, since they may have | 110 | // Tell the views to reread their config, since they may have |
111 | // been modified by global settings | 111 | // been modified by global settings |
112 | QString _oldgroup = mCore->config()->group(); | 112 | QString _oldgroup = mCore->config()->group(); |
113 | 113 | ||
114 | QDictIterator<KAddressBookView> it( mViewDict ); | 114 | QDictIterator<KAddressBookView> it( mViewDict ); |
115 | for ( it.toFirst(); it.current(); ++it ) { | 115 | for ( it.toFirst(); it.current(); ++it ) { |
116 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); | 116 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); |
117 | it.current()->readConfig( mCore->config() ); | 117 | it.current()->readConfig( mCore->config() ); |
118 | } | 118 | } |
119 | setActiveView( activeViewName ); | 119 | setActiveView( activeViewName ); |
120 | 120 | ||
121 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); | 121 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); |
122 | } | 122 | } |
123 | 123 | ||
124 | void ViewManager::saveSettings() | 124 | void ViewManager::saveSettings() |
125 | { | 125 | { |
126 | QString _oldgroup = mCore->config()->group(); | 126 | QString _oldgroup = mCore->config()->group(); |
127 | 127 | ||
128 | QDictIterator<KAddressBookView> it( mViewDict ); | 128 | QDictIterator<KAddressBookView> it( mViewDict ); |
129 | for ( it.toFirst(); it.current(); ++it ) { | 129 | for ( it.toFirst(); it.current(); ++it ) { |
130 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); | 130 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); |
131 | #ifdef DESKTOP_VERSION | 131 | #ifdef DESKTOP_VERSION |
132 | (*it)->writeConfig( mCore->config() ); | 132 | (*it)->writeConfig( mCore->config() ); |
133 | #else | 133 | #else |
134 | (*it).writeConfig( mCore->config() ); | 134 | (*it).writeConfig( mCore->config() ); |
135 | #endif | 135 | #endif |
136 | } | 136 | } |
137 | 137 | ||
138 | Filter::save( mCore->config(), "Filter", mFilterList ); | 138 | Filter::save( mCore->config(), "Filter", mFilterList ); |
139 | KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); | 139 | KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); |
140 | 140 | ||
141 | // write the view name list | 141 | // write the view name list |
142 | KABPrefs::instance()->mViewNames = mViewNameList; | 142 | KABPrefs::instance()->mViewNames = mViewNameList; |
143 | KABPrefs::instance()->mCurrentView = mActiveView->caption(); | 143 | KABPrefs::instance()->mCurrentView = mActiveView->caption(); |
144 | 144 | ||
145 | } | 145 | } |
146 | 146 | ||
147 | QStringList ViewManager::selectedUids() const | 147 | QStringList ViewManager::selectedUids() const |
148 | { | 148 | { |
149 | if ( mActiveView ) | 149 | if ( mActiveView ) |
150 | return mActiveView->selectedUids(); | 150 | return mActiveView->selectedUids(); |
151 | else | 151 | else |
152 | return QStringList(); | 152 | return QStringList(); |
153 | } | 153 | } |
154 | 154 | ||
155 | QStringList ViewManager::selectedEmails() const | 155 | QStringList ViewManager::selectedEmails() const |
156 | { | 156 | { |
157 | if ( mActiveView ) | 157 | if ( mActiveView ) |
158 | return mActiveView->selectedEmails(); | 158 | return mActiveView->selectedEmails(); |
159 | else | 159 | else |
160 | return QStringList(); | 160 | return QStringList(); |
161 | } | 161 | } |
162 | 162 | ||
163 | KABC::Addressee::List ViewManager::selectedAddressees() const | 163 | KABC::Addressee::List ViewManager::selectedAddressees() const |
164 | { | 164 | { |
165 | KABC::Addressee::List list; | 165 | KABC::Addressee::List list; |
166 | if ( mActiveView ) { | 166 | if ( mActiveView ) { |
167 | QStringList uids = mActiveView->selectedUids(); | 167 | QStringList uids = mActiveView->selectedUids(); |
168 | QStringList::Iterator it; | 168 | QStringList::Iterator it; |
169 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 169 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
170 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); | 170 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); |
171 | if ( !addr.isEmpty() ) | 171 | if ( !addr.isEmpty() ) |
172 | list.append( addr ); | 172 | list.append( addr ); |
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
176 | return list; | 176 | return list; |
177 | } | 177 | } |
178 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 178 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
179 | void ViewManager::setSelected() | 179 | void ViewManager::setSelected() |
180 | { | 180 | { |
181 | setSelected( QString::null, true ); | 181 | setSelected( QString::null, true ); |
182 | } | 182 | } |
183 | 183 | ||
184 | void ViewManager::setSelected( const QString &uid, bool selected ) | 184 | void ViewManager::setSelected( const QString &uid, bool selected ) |
185 | { | 185 | { |
186 | if ( mActiveView ) | 186 | if ( mActiveView ) |
187 | mActiveView->setSelected( uid, selected ); | 187 | mActiveView->setSelected( uid, selected ); |
188 | } | 188 | } |
189 | 189 | ||
190 | void ViewManager::setListSelected(QStringList list) | 190 | void ViewManager::setListSelected(QStringList list) |
191 | { | 191 | { |
192 | int i, count = list.count(); | 192 | int i, count = list.count(); |
193 | for ( i = 0; i < count;++i ) | 193 | for ( i = 0; i < count;++i ) |
194 | setSelected( list[i], true ); | 194 | setSelected( list[i], true ); |
195 | 195 | ||
196 | } | 196 | } |
197 | void ViewManager::unloadViews() | 197 | void ViewManager::unloadViews() |
198 | { | 198 | { |
199 | mViewDict.clear(); | 199 | mViewDict.clear(); |
200 | mActiveView = 0; | 200 | mActiveView = 0; |
201 | } | 201 | } |
202 | 202 | ||
203 | void ViewManager::setActiveView( const QString &name ) | 203 | void ViewManager::setActiveView( const QString &name ) |
204 | { | 204 | { |
205 | KAddressBookView *view = 0; | 205 | KAddressBookView *view = 0; |
@@ -210,193 +210,193 @@ void ViewManager::setActiveView( const QString &name ) | |||
210 | 210 | ||
211 | // At this point we know the view that should be active is not | 211 | // At this point we know the view that should be active is not |
212 | // currently active. We will try to find the new on in the list. If | 212 | // currently active. We will try to find the new on in the list. If |
213 | // we can't find it, it means it hasn't been instantiated, so we will | 213 | // we can't find it, it means it hasn't been instantiated, so we will |
214 | // create it on demand. | 214 | // create it on demand. |
215 | 215 | ||
216 | view = mViewDict.find( name ); | 216 | view = mViewDict.find( name ); |
217 | 217 | ||
218 | // Check if we found the view. If we didn't, then we need to create it | 218 | // Check if we found the view. If we didn't, then we need to create it |
219 | if ( view == 0 ) { | 219 | if ( view == 0 ) { |
220 | KConfig *config = mCore->config(); | 220 | KConfig *config = mCore->config(); |
221 | 221 | ||
222 | KConfigGroupSaver saver( config, name ); | 222 | KConfigGroupSaver saver( config, name ); |
223 | 223 | ||
224 | QString type = config->readEntry( "Type", "Table" ); | 224 | QString type = config->readEntry( "Type", "Table" ); |
225 | 225 | ||
226 | kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl; | 226 | kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl; |
227 | 227 | ||
228 | ViewFactory *factory = mViewFactoryDict.find( type ); | 228 | ViewFactory *factory = mViewFactoryDict.find( type ); |
229 | if ( factory ) | 229 | if ( factory ) |
230 | view = factory->view( mCore->addressBook(), mViewWidgetStack ); | 230 | view = factory->view( mCore->addressBook(), mViewWidgetStack ); |
231 | 231 | ||
232 | if ( view ) { | 232 | if ( view ) { |
233 | view->setCaption( name ); | 233 | view->setCaption( name ); |
234 | mViewDict.insert( name, view ); | 234 | mViewDict.insert( name, view ); |
235 | //US my version needs an int as second parameter to addWidget | 235 | //US my version needs an int as second parameter to addWidget |
236 | mViewWidgetStack->addWidget( view, -1 ); | 236 | mViewWidgetStack->addWidget( view, -1 ); |
237 | view->readConfig( config ); | 237 | view->readConfig( config ); |
238 | 238 | ||
239 | // The manager just relays the signals | 239 | // The manager just relays the signals |
240 | connect( view, SIGNAL( selected( const QString& ) ), | 240 | connect( view, SIGNAL( selected( const QString& ) ), |
241 | SIGNAL( selected( const QString & ) ) ); | 241 | SIGNAL( selected( const QString & ) ) ); |
242 | connect( view, SIGNAL( executed( const QString& ) ), | 242 | connect( view, SIGNAL( executed( const QString& ) ), |
243 | SIGNAL( executed( const QString& ) ) ); | 243 | SIGNAL( executed( const QString& ) ) ); |
244 | 244 | ||
245 | connect( view, SIGNAL( deleteRequest( ) ), | 245 | connect( view, SIGNAL( deleteRequest( ) ), |
246 | SIGNAL( deleteRequest( ) ) ); | 246 | SIGNAL( deleteRequest( ) ) ); |
247 | 247 | ||
248 | connect( view, SIGNAL( modified() ), SIGNAL( modified() ) ); | 248 | connect( view, SIGNAL( modified() ), SIGNAL( modified() ) ); |
249 | connect( view, SIGNAL( dropped( QDropEvent* ) ), | 249 | connect( view, SIGNAL( dropped( QDropEvent* ) ), |
250 | SLOT( dropped( QDropEvent* ) ) ); | 250 | SLOT( dropped( QDropEvent* ) ) ); |
251 | connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) ); | 251 | connect( view, SIGNAL( startDrag() ), SLOT( startDrag() ) ); |
252 | } | 252 | } |
253 | } | 253 | } |
254 | 254 | ||
255 | // If we found or created the view, raise it and refresh it | 255 | // If we found or created the view, raise it and refresh it |
256 | if ( view ) { | 256 | if ( view ) { |
257 | mActiveView = view; | 257 | mActiveView = view; |
258 | mViewWidgetStack->raiseWidget( view ); | 258 | mViewWidgetStack->raiseWidget( view ); |
259 | // Set the proper filter in the view. By setting the combo | 259 | // Set the proper filter in the view. By setting the combo |
260 | // box, the activated slot will be called, which will push | 260 | // box, the activated slot will be called, which will push |
261 | // the filter to the view and refresh it. | 261 | // the filter to the view and refresh it. |
262 | 262 | ||
263 | if ( view->defaultFilterType() == KAddressBookView::None ) { | 263 | if ( view->defaultFilterType() == KAddressBookView::None ) { |
264 | 264 | ||
265 | mActionSelectFilter->setCurrentItem( 0 ); | 265 | mActionSelectFilter->setCurrentItem( 0 ); |
266 | setActiveFilter( 0 ); | 266 | setActiveFilter( 0 ); |
267 | } else if ( view->defaultFilterType() == KAddressBookView::Active ) { | 267 | } else if ( view->defaultFilterType() == KAddressBookView::Active ) { |
268 | setActiveFilter( mActionSelectFilter->currentItem() ); | 268 | setActiveFilter( mActionSelectFilter->currentItem() ); |
269 | } else { | 269 | } else { |
270 | uint pos = filterPosition( view->defaultFilterName() ); | 270 | uint pos = filterPosition( view->defaultFilterName() ); |
271 | mActionSelectFilter->setCurrentItem( pos ); | 271 | mActionSelectFilter->setCurrentItem( pos ); |
272 | setActiveFilter( pos ); | 272 | setActiveFilter( pos ); |
273 | } | 273 | } |
274 | //US qDebug("ViewManager::setActiveView 6" ); | 274 | //US qDebug("ViewManager::setActiveView 6" ); |
275 | 275 | ||
276 | // Update the inc search widget to show the fields in the new active | 276 | // Update the inc search widget to show the fields in the new active |
277 | // view. | 277 | // view. |
278 | mCore->setSearchFields( mActiveView->fields() ); | 278 | mCore->setSearchFields( mActiveView->fields() ); |
279 | 279 | ||
280 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() | 280 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() |
281 | //US mActiveView->refresh(); | 281 | //US mActiveView->refresh(); |
282 | 282 | ||
283 | } | 283 | } |
284 | else | 284 | else |
285 | { | 285 | { |
286 | qDebug("ViewManager::setActiveView: unable to find view" ); | 286 | qDebug("ViewManager::setActiveView: unable to find view" ); |
287 | kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n"; | 287 | kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n"; |
288 | } | 288 | } |
289 | } | 289 | } |
290 | 290 | ||
291 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 291 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
292 | void ViewManager::refreshView() | 292 | void ViewManager::refreshView() |
293 | { | 293 | { |
294 | refreshView( QString::null ); | 294 | refreshView( QString::null ); |
295 | } | 295 | } |
296 | 296 | ||
297 | void ViewManager::refreshView( const QString &uid ) | 297 | void ViewManager::refreshView( const QString &uid ) |
298 | { | 298 | { |
299 | if ( mActiveView ) | 299 | if ( mActiveView ) |
300 | mActiveView->refresh( uid ); | 300 | mActiveView->refresh( uid ); |
301 | } | 301 | } |
302 | 302 | ||
303 | void ViewManager::setFocusAV() | 303 | void ViewManager::setFocusAV() |
304 | { | 304 | { |
305 | if ( mActiveView ) | 305 | if ( mActiveView ) |
306 | mActiveView->setFocus(); | 306 | mActiveView->setFocusAV(); |
307 | } | 307 | } |
308 | void ViewManager::editView() | 308 | void ViewManager::editView() |
309 | { | 309 | { |
310 | if ( !mActiveView ) | 310 | if ( !mActiveView ) |
311 | return; | 311 | return; |
312 | 312 | ||
313 | ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); | 313 | ViewFactory *factory = mViewFactoryDict.find( mActiveView->type() ); |
314 | ViewConfigureWidget *wdg = 0; | 314 | ViewConfigureWidget *wdg = 0; |
315 | ViewConfigureDialog* dlg = 0; | 315 | ViewConfigureDialog* dlg = 0; |
316 | if ( factory ) { | 316 | if ( factory ) { |
317 | // Save the filters so the dialog has the latest set | 317 | // Save the filters so the dialog has the latest set |
318 | Filter::save( mCore->config(), "Filter", mFilterList ); | 318 | Filter::save( mCore->config(), "Filter", mFilterList ); |
319 | dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); | 319 | dlg = new ViewConfigureDialog( 0, mActiveView->caption(), this, "conf_dlg" ); |
320 | wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); | 320 | wdg = factory->configureWidget( mCore->addressBook(), dlg,"conf_wid" ); |
321 | } else { | 321 | } else { |
322 | qDebug("ViewManager::editView()::cannot find viewfactory "); | 322 | qDebug("ViewManager::editView()::cannot find viewfactory "); |
323 | return; | 323 | return; |
324 | } | 324 | } |
325 | if ( wdg ) { | 325 | if ( wdg ) { |
326 | dlg->setWidget( wdg ); | 326 | dlg->setWidget( wdg ); |
327 | 327 | ||
328 | #ifndef DESKTOP_VERSION | 328 | #ifndef DESKTOP_VERSION |
329 | //dlg.setMaximumSize( 640, 480 ); | 329 | //dlg.setMaximumSize( 640, 480 ); |
330 | //dlg->setGeometry( 40,40, 400, 300); | 330 | //dlg->setGeometry( 40,40, 400, 300); |
331 | dlg->showMaximized(); | 331 | dlg->showMaximized(); |
332 | #endif | 332 | #endif |
333 | 333 | ||
334 | KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); | 334 | KConfigGroupSaver saver( mCore->config(), mActiveView->caption() ); |
335 | 335 | ||
336 | dlg->restoreSettings( mCore->config() ); | 336 | dlg->restoreSettings( mCore->config() ); |
337 | 337 | ||
338 | if ( dlg->exec() ) { | 338 | if ( dlg->exec() ) { |
339 | dlg->saveSettings( mCore->config() ); | 339 | dlg->saveSettings( mCore->config() ); |
340 | mActiveView->readConfig( mCore->config() ); | 340 | mActiveView->readConfig( mCore->config() ); |
341 | 341 | ||
342 | // Set the proper filter in the view. By setting the combo | 342 | // Set the proper filter in the view. By setting the combo |
343 | // box, the activated slot will be called, which will push | 343 | // box, the activated slot will be called, which will push |
344 | // the filter to the view and refresh it. | 344 | // the filter to the view and refresh it. |
345 | if ( mActiveView->defaultFilterType() == KAddressBookView::None ) { | 345 | if ( mActiveView->defaultFilterType() == KAddressBookView::None ) { |
346 | mActionSelectFilter->setCurrentItem( 0 ); | 346 | mActionSelectFilter->setCurrentItem( 0 ); |
347 | setActiveFilter( 0 ); | 347 | setActiveFilter( 0 ); |
348 | } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) { | 348 | } else if ( mActiveView->defaultFilterType() == KAddressBookView::Active ) { |
349 | setActiveFilter( mActionSelectFilter->currentItem() ); | 349 | setActiveFilter( mActionSelectFilter->currentItem() ); |
350 | } else { | 350 | } else { |
351 | uint pos = filterPosition( mActiveView->defaultFilterName() ); | 351 | uint pos = filterPosition( mActiveView->defaultFilterName() ); |
352 | mActionSelectFilter->setCurrentItem( pos ); | 352 | mActionSelectFilter->setCurrentItem( pos ); |
353 | setActiveFilter( pos ); | 353 | setActiveFilter( pos ); |
354 | } | 354 | } |
355 | mCore->setSearchFields( mActiveView->fields() ); | 355 | mCore->setSearchFields( mActiveView->fields() ); |
356 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() | 356 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() |
357 | //US mActiveView->refresh(); | 357 | //US mActiveView->refresh(); |
358 | 358 | ||
359 | 359 | ||
360 | //US this is a bugfix, that we get notified if we change a views configuration | 360 | //US this is a bugfix, that we get notified if we change a views configuration |
361 | emit modified(); | 361 | emit modified(); |
362 | 362 | ||
363 | } | 363 | } |
364 | 364 | ||
365 | } | 365 | } |
366 | delete dlg; | 366 | delete dlg; |
367 | } | 367 | } |
368 | 368 | ||
369 | void ViewManager::deleteView() | 369 | void ViewManager::deleteView() |
370 | { | 370 | { |
371 | QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" ) | 371 | QString text = i18n( "<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>" ) |
372 | .arg( mActiveView->caption() ); | 372 | .arg( mActiveView->caption() ); |
373 | QString caption = i18n( "Confirm Delete" ); | 373 | QString caption = i18n( "Confirm Delete" ); |
374 | 374 | ||
375 | 375 | ||
376 | if (QMessageBox::information( this, caption, | 376 | if (QMessageBox::information( this, caption, |
377 | text, | 377 | text, |
378 | i18n("Yes!"), i18n("No"), 0, 0 ) == 0) | 378 | i18n("Yes!"), i18n("No"), 0, 0 ) == 0) |
379 | { | 379 | { |
380 | mViewNameList.remove( mActiveView->caption() ); | 380 | mViewNameList.remove( mActiveView->caption() ); |
381 | 381 | ||
382 | // remove the view from the config file | 382 | // remove the view from the config file |
383 | KConfig *config = mCore->config(); | 383 | KConfig *config = mCore->config(); |
384 | config->deleteGroup( mActiveView->caption() ); | 384 | config->deleteGroup( mActiveView->caption() ); |
385 | 385 | ||
386 | mViewDict.remove( mActiveView->caption() ); | 386 | mViewDict.remove( mActiveView->caption() ); |
387 | mActiveView = 0; | 387 | mActiveView = 0; |
388 | 388 | ||
389 | // we are in an invalid state now, but that should be fixed after | 389 | // we are in an invalid state now, but that should be fixed after |
390 | // we emit the signal | 390 | // we emit the signal |
391 | mActionSelectView->setItems( mViewNameList ); | 391 | mActionSelectView->setItems( mViewNameList ); |
392 | if ( mViewNameList.count() > 0 ) { | 392 | if ( mViewNameList.count() > 0 ) { |
393 | mActionSelectView->setCurrentItem( 0 ); | 393 | mActionSelectView->setCurrentItem( 0 ); |
394 | setActiveView( mViewNameList[ 0 ] ); | 394 | setActiveView( mViewNameList[ 0 ] ); |
395 | } | 395 | } |
396 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); | 396 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); |
397 | } | 397 | } |
398 | } | 398 | } |
399 | 399 | ||
400 | void ViewManager::addView() | 400 | void ViewManager::addView() |
401 | { | 401 | { |
402 | AddViewDialog dialog( &mViewFactoryDict, this ); | 402 | AddViewDialog dialog( &mViewFactoryDict, this ); |
@@ -504,215 +504,215 @@ void ViewManager::dropped( QDropEvent *e ) | |||
504 | } | 504 | } |
505 | } else if ( c == 1 ) | 505 | } else if ( c == 1 ) |
506 | emit urlDropped( *it ); | 506 | emit urlDropped( *it ); |
507 | } else if ( KVCardDrag::decode( e, vcards ) ) { | 507 | } else if ( KVCardDrag::decode( e, vcards ) ) { |
508 | KABC::Addressee addr; | 508 | KABC::Addressee addr; |
509 | KABC::VCardConverter converter; | 509 | KABC::VCardConverter converter; |
510 | QStringList list = QStringList::split( "\r\n\r\n", vcards ); | 510 | QStringList list = QStringList::split( "\r\n\r\n", vcards ); |
511 | QStringList::Iterator it; | 511 | QStringList::Iterator it; |
512 | for ( it = list.begin(); it != list.end(); ++it ) { | 512 | for ( it = list.begin(); it != list.end(); ++it ) { |
513 | if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) { | 513 | if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) { |
514 | KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() ); | 514 | KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() ); |
515 | if ( a.isEmpty() ) { | 515 | if ( a.isEmpty() ) { |
516 | mCore->addressBook()->insertAddressee( addr ); | 516 | mCore->addressBook()->insertAddressee( addr ); |
517 | emit modified(); | 517 | emit modified(); |
518 | } | 518 | } |
519 | } | 519 | } |
520 | } | 520 | } |
521 | 521 | ||
522 | mActiveView->refresh(); | 522 | mActiveView->refresh(); |
523 | } | 523 | } |
524 | #else //KAB_EMBEDDED | 524 | #else //KAB_EMBEDDED |
525 | qDebug("ViewManager::dropped() has to be changed!!" ); | 525 | qDebug("ViewManager::dropped() has to be changed!!" ); |
526 | #endif //KAB_EMBEDDED | 526 | #endif //KAB_EMBEDDED |
527 | 527 | ||
528 | } | 528 | } |
529 | 529 | ||
530 | void ViewManager::startDrag() | 530 | void ViewManager::startDrag() |
531 | { | 531 | { |
532 | kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; | 532 | kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; |
533 | 533 | ||
534 | #ifndef KAB_EMBEDDED | 534 | #ifndef KAB_EMBEDDED |
535 | 535 | ||
536 | // Get the list of all the selected addressees | 536 | // Get the list of all the selected addressees |
537 | KABC::Addressee::List addrList; | 537 | KABC::Addressee::List addrList; |
538 | QStringList uidList = selectedUids(); | 538 | QStringList uidList = selectedUids(); |
539 | QStringList::Iterator iter; | 539 | QStringList::Iterator iter; |
540 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) | 540 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) |
541 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); | 541 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); |
542 | 542 | ||
543 | KMultipleDrag *drag = new KMultipleDrag( this ); | 543 | KMultipleDrag *drag = new KMultipleDrag( this ); |
544 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); | 544 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); |
545 | KABC::Addressee::List::Iterator it; | 545 | KABC::Addressee::List::Iterator it; |
546 | QStringList vcards; | 546 | QStringList vcards; |
547 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { | 547 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { |
548 | QString vcard = QString::null; | 548 | QString vcard = QString::null; |
549 | KABC::VCardConverter converter; | 549 | KABC::VCardConverter converter; |
550 | if ( converter.addresseeToVCard( *it, vcard ) ) | 550 | if ( converter.addresseeToVCard( *it, vcard ) ) |
551 | vcards.append( vcard ); | 551 | vcards.append( vcard ); |
552 | } | 552 | } |
553 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); | 553 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); |
554 | 554 | ||
555 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); | 555 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); |
556 | drag->dragCopy(); | 556 | drag->dragCopy(); |
557 | 557 | ||
558 | #else //KAB_EMBEDDED | 558 | #else //KAB_EMBEDDED |
559 | qDebug("ViewManager::startDrag() has to be changed!!" ); | 559 | qDebug("ViewManager::startDrag() has to be changed!!" ); |
560 | #endif //KAB_EMBEDDED | 560 | #endif //KAB_EMBEDDED |
561 | 561 | ||
562 | } | 562 | } |
563 | void ViewManager::doSearch( const QString& s,KABC::Field *field ) | 563 | void ViewManager::doSearch( const QString& s,KABC::Field *field ) |
564 | { | 564 | { |
565 | if ( mActiveView ) | 565 | if ( mActiveView ) |
566 | mActiveView->doSearch( s, field ); | 566 | mActiveView->doSearch( s, field ); |
567 | 567 | ||
568 | } | 568 | } |
569 | void ViewManager::setActiveFilter( int index ) | 569 | void ViewManager::setActiveFilter( int index ) |
570 | { | 570 | { |
571 | Filter currentFilter; | 571 | Filter currentFilter; |
572 | 572 | ||
573 | if ( ( index - 1 ) < 0 ) | 573 | if ( ( index - 1 ) < 0 ) |
574 | currentFilter = Filter(); | 574 | currentFilter = Filter(); |
575 | else | 575 | else |
576 | currentFilter = mFilterList[ index - 1 ]; | 576 | currentFilter = mFilterList[ index - 1 ]; |
577 | 577 | ||
578 | // Check if we have a view. Since the filter combo is created before | 578 | // Check if we have a view. Since the filter combo is created before |
579 | // the view, this slot could be called before there is a valid view. | 579 | // the view, this slot could be called before there is a valid view. |
580 | if ( mActiveView ) { | 580 | if ( mActiveView ) { |
581 | mActiveView->setFilter( currentFilter ); | 581 | mActiveView->setFilter( currentFilter ); |
582 | mActiveView->refresh(); | 582 | mActiveView->refresh(); |
583 | emit selected( QString::null ); | 583 | emit selected( QString::null ); |
584 | } | 584 | } |
585 | } | 585 | } |
586 | 586 | ||
587 | void ViewManager::configureFilters() | 587 | void ViewManager::configureFilters() |
588 | { | 588 | { |
589 | FilterDialog dlg( this ); | 589 | FilterDialog dlg( this ); |
590 | 590 | ||
591 | dlg.setFilters( mFilterList ); | 591 | dlg.setFilters( mFilterList ); |
592 | 592 | ||
593 | if ( dlg.exec() ) | 593 | if ( dlg.exec() ) |
594 | mFilterList = dlg.filters(); | 594 | mFilterList = dlg.filters(); |
595 | 595 | ||
596 | uint pos = mActionSelectFilter->currentItem(); | 596 | uint pos = mActionSelectFilter->currentItem(); |
597 | mActionSelectFilter->setItems( filterNames() ); | 597 | mActionSelectFilter->setItems( filterNames() ); |
598 | mActionSelectFilter->setCurrentItem( pos ); | 598 | mActionSelectFilter->setCurrentItem( pos ); |
599 | setActiveFilter( pos ); | 599 | setActiveFilter( pos ); |
600 | //mActionSelectFilter->setComboWidth( 150 ); | ||
600 | } | 601 | } |
601 | 602 | ||
602 | QStringList ViewManager::filterNames() const | 603 | QStringList ViewManager::filterNames() const |
603 | { | 604 | { |
604 | QStringList names( i18n( "No Filter" ) ); | 605 | QStringList names( i18n( "No Filter" ) ); |
605 | 606 | ||
606 | Filter::List::ConstIterator it; | 607 | Filter::List::ConstIterator it; |
607 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) | 608 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) |
608 | names.append( (*it).name() ); | 609 | names.append( (*it).name() ); |
609 | 610 | ||
610 | return names; | 611 | return names; |
611 | } | 612 | } |
612 | 613 | ||
613 | int ViewManager::filterPosition( const QString &name ) const | 614 | int ViewManager::filterPosition( const QString &name ) const |
614 | { | 615 | { |
615 | int pos = 0; | 616 | int pos = 0; |
616 | 617 | ||
617 | Filter::List::ConstIterator it; | 618 | Filter::List::ConstIterator it; |
618 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) | 619 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) |
619 | if ( name == (*it).name() ) | 620 | if ( name == (*it).name() ) |
620 | return pos + 1; | 621 | return pos + 1; |
621 | 622 | ||
622 | return 0; | 623 | return 0; |
623 | } | 624 | } |
624 | 625 | ||
625 | void ViewManager::initActions() | 626 | void ViewManager::initActions() |
626 | { | 627 | { |
627 | //US <ActionList name="view_loadedviews"/> | 628 | //US <ActionList name="view_loadedviews"/> |
628 | //US <Separator/> | 629 | //US <Separator/> |
629 | 630 | ||
630 | #ifdef KAB_EMBEDDED | 631 | #ifdef KAB_EMBEDDED |
631 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); | 632 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); |
632 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); | 633 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); |
633 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); | 634 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); |
634 | #endif //KAB_EMBEDDED | 635 | #endif //KAB_EMBEDDED |
635 | 636 | ||
636 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); | 637 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); |
637 | #if KDE_VERSION >= 309 | 638 | #if KDE_VERSION >= 309 |
638 | mActionSelectView->setMenuAccelsEnabled( false ); | 639 | mActionSelectView->setMenuAccelsEnabled( false ); |
639 | #endif | 640 | #endif |
640 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), | 641 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), |
641 | SLOT( setActiveView( const QString& ) ) ); | 642 | SLOT( setActiveView( const QString& ) ) ); |
642 | 643 | ||
643 | 644 | ||
644 | #ifdef KAB_EMBEDDED | 645 | #ifdef KAB_EMBEDDED |
645 | mActionSelectView->plug(viewmenu); | 646 | mActionSelectView->plug(viewmenu); |
646 | viewmenu->insertSeparator(); | 647 | viewmenu->insertSeparator(); |
647 | #endif //KAB_EMBEDDED | 648 | #endif //KAB_EMBEDDED |
648 | 649 | ||
649 | KAction *action; | 650 | KAction *action; |
650 | 651 | ||
651 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, | 652 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, |
652 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); | 653 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); |
653 | #ifndef KAB_EMBEDDED | 654 | #ifndef KAB_EMBEDDED |
654 | action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); | 655 | action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); |
655 | #else //KAB_EMBEDDED | 656 | #else //KAB_EMBEDDED |
656 | action->plug(viewmenu); | 657 | action->plug(viewmenu); |
657 | #endif //KAB_EMBEDDED | 658 | #endif //KAB_EMBEDDED |
658 | 659 | ||
659 | action = new KAction( i18n( "Add View..." ), "window_new", 0, this, | 660 | action = new KAction( i18n( "Add View..." ), "window_new", 0, this, |
660 | SLOT( addView() ), mCore->actionCollection(), "view_add" ); | 661 | SLOT( addView() ), mCore->actionCollection(), "view_add" ); |
661 | #ifndef KAB_EMBEDDED | 662 | #ifndef KAB_EMBEDDED |
662 | action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); | 663 | action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); |
663 | #else //KAB_EMBEDDED | 664 | #else //KAB_EMBEDDED |
664 | action->plug(viewmenu); | 665 | action->plug(viewmenu); |
665 | #endif //KAB_EMBEDDED | 666 | #endif //KAB_EMBEDDED |
666 | 667 | ||
667 | mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, | 668 | mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, |
668 | this, SLOT( deleteView() ), | 669 | this, SLOT( deleteView() ), |
669 | mCore->actionCollection(), "view_delete" ); | 670 | mCore->actionCollection(), "view_delete" ); |
670 | #ifndef KAB_EMBEDDED | 671 | #ifndef KAB_EMBEDDED |
671 | mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); | 672 | mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); |
672 | #else //KAB_EMBEDDED | 673 | #else //KAB_EMBEDDED |
673 | mActionDeleteView->plug(viewmenu); | 674 | mActionDeleteView->plug(viewmenu); |
674 | viewmenu->insertSeparator(); | 675 | viewmenu->insertSeparator(); |
675 | #endif //KAB_EMBEDDED | 676 | #endif //KAB_EMBEDDED |
676 | 677 | ||
677 | #ifndef KAB_EMBEDDED | 678 | #ifndef KAB_EMBEDDED |
678 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, | 679 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, |
679 | SLOT( refreshView(const QString &) ), mCore->actionCollection(), | 680 | SLOT( refreshView(const QString &) ), mCore->actionCollection(), |
680 | "view_refresh" ); | 681 | "view_refresh" ); |
681 | action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); | 682 | action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); |
682 | #else //KAB_EMBEDDED | 683 | #else //KAB_EMBEDDED |
683 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, | 684 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, |
684 | SLOT( refreshView()), mCore->actionCollection(), | 685 | SLOT( refreshView()), mCore->actionCollection(), |
685 | "view_refresh" ); | 686 | "view_refresh" ); |
686 | action->plug(viewmenu); | 687 | action->plug(viewmenu); |
687 | viewmenu->insertSeparator(); | 688 | viewmenu->insertSeparator(); |
688 | #endif //KAB_EMBEDDED | 689 | #endif //KAB_EMBEDDED |
689 | 690 | ||
690 | action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, | 691 | action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, |
691 | SLOT( configureFilters() ), mCore->actionCollection(), | 692 | SLOT( configureFilters() ), mCore->actionCollection(), |
692 | "options_edit_filters" ); | 693 | "options_edit_filters" ); |
693 | 694 | ||
694 | mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); | 695 | mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); |
695 | |||
696 | #if KDE_VERSION >= 309 | 696 | #if KDE_VERSION >= 309 |
697 | mActionSelectFilter->setMenuAccelsEnabled( false ); | 697 | mActionSelectFilter->setMenuAccelsEnabled( false ); |
698 | #endif | 698 | #endif |
699 | connect( mActionSelectFilter, SIGNAL( activated( int ) ), | 699 | connect( mActionSelectFilter, SIGNAL( activated( int ) ), |
700 | SLOT( setActiveFilter( int ) ) ); | 700 | SLOT( setActiveFilter( int ) ) ); |
701 | 701 | ||
702 | #ifdef KAB_EMBEDDED | 702 | #ifdef KAB_EMBEDDED |
703 | action->plug(settingsmenu); | 703 | action->plug(settingsmenu); |
704 | mActionSelectFilter->plug(viewmenu); | 704 | mActionSelectFilter->plug(viewmenu); |
705 | #endif //KAB_EMBEDDED | 705 | #endif //KAB_EMBEDDED |
706 | 706 | ||
707 | } | 707 | } |
708 | 708 | ||
709 | void ViewManager::initGUI() | 709 | void ViewManager::initGUI() |
710 | { | 710 | { |
711 | QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); | 711 | QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); |
712 | mViewWidgetStack = new QWidgetStack( this ); | 712 | mViewWidgetStack = new QWidgetStack( this ); |
713 | layout->addWidget( mViewWidgetStack ); | 713 | layout->addWidget( mViewWidgetStack ); |
714 | } | 714 | } |
715 | 715 | ||
716 | #ifndef KAB_EMBEDDED | 716 | #ifndef KAB_EMBEDDED |
717 | #include "viewmanager.moc" | 717 | #include "viewmanager.moc" |
718 | #endif //KAB_EMBEDDED | 718 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index a7bf6c9..7f33bb4 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -76,193 +76,198 @@ class AddresseeCardViewItem : public CardViewItem | |||
76 | mAddressee = mDocument->findByUid(mAddressee.uid()); | 76 | mAddressee = mDocument->findByUid(mAddressee.uid()); |
77 | 77 | ||
78 | if (!mAddressee.isEmpty()) | 78 | if (!mAddressee.isEmpty()) |
79 | { | 79 | { |
80 | clearFields(); | 80 | clearFields(); |
81 | 81 | ||
82 | // Try all the selected fields until we find one with text. | 82 | // Try all the selected fields until we find one with text. |
83 | // This will limit the number of unlabeled icons in the view | 83 | // This will limit the number of unlabeled icons in the view |
84 | KABC::Field::List::Iterator iter; | 84 | KABC::Field::List::Iterator iter; |
85 | for (iter = mFields.begin(); iter != mFields.end(); ++iter) | 85 | for (iter = mFields.begin(); iter != mFields.end(); ++iter) |
86 | { | 86 | { |
87 | // insert empty fields or not? not doing so saves a bit of memory and CPU | 87 | // insert empty fields or not? not doing so saves a bit of memory and CPU |
88 | // (during geometry calculations), but prevents having equally | 88 | // (during geometry calculations), but prevents having equally |
89 | // wide label columns in all cards, unless CardViewItem/CardView search | 89 | // wide label columns in all cards, unless CardViewItem/CardView search |
90 | // globally for the widest label. (anders) | 90 | // globally for the widest label. (anders) |
91 | //if (mShowEmptyFields || !(*iter)->value( mAddressee ).isEmpty()) | 91 | //if (mShowEmptyFields || !(*iter)->value( mAddressee ).isEmpty()) |
92 | insertField((*iter)->label(), (*iter)->value( mAddressee )); | 92 | insertField((*iter)->label(), (*iter)->value( mAddressee )); |
93 | } | 93 | } |
94 | 94 | ||
95 | // We might want to make this the first field. hmm... -mpilone | 95 | // We might want to make this the first field. hmm... -mpilone |
96 | setCaption( mAddressee.realName() ); | 96 | setCaption( mAddressee.realName() ); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | private: | 100 | private: |
101 | KABC::Field::List mFields; | 101 | KABC::Field::List mFields; |
102 | bool mShowEmptyFields; | 102 | bool mShowEmptyFields; |
103 | KABC::AddressBook *mDocument; | 103 | KABC::AddressBook *mDocument; |
104 | KABC::Addressee mAddressee; | 104 | KABC::Addressee mAddressee; |
105 | }; | 105 | }; |
106 | 106 | ||
107 | /////////////////////////////// | 107 | /////////////////////////////// |
108 | // AddresseeCardView | 108 | // AddresseeCardView |
109 | 109 | ||
110 | AddresseeCardView::AddresseeCardView(QWidget *parent, const char *name) | 110 | AddresseeCardView::AddresseeCardView(QWidget *parent, const char *name) |
111 | : CardView(parent, name) | 111 | : CardView(parent, name) |
112 | { | 112 | { |
113 | setAcceptDrops(true); | 113 | setAcceptDrops(true); |
114 | } | 114 | } |
115 | 115 | ||
116 | AddresseeCardView::~AddresseeCardView() | 116 | AddresseeCardView::~AddresseeCardView() |
117 | { | 117 | { |
118 | } | 118 | } |
119 | 119 | ||
120 | 120 | ||
121 | void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e) | 121 | void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e) |
122 | { | 122 | { |
123 | #ifndef KAB_EMBEDDED | 123 | #ifndef KAB_EMBEDDED |
124 | if (QTextDrag::canDecode(e)) | 124 | if (QTextDrag::canDecode(e)) |
125 | e->accept(); | 125 | e->accept(); |
126 | #else //KAB_EMBEDDED | 126 | #else //KAB_EMBEDDED |
127 | qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented"); | 127 | qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented"); |
128 | #endif //KAB_EMBEDDED | 128 | #endif //KAB_EMBEDDED |
129 | } | 129 | } |
130 | 130 | ||
131 | void AddresseeCardView::dropEvent(QDropEvent *e) | 131 | void AddresseeCardView::dropEvent(QDropEvent *e) |
132 | { | 132 | { |
133 | emit addresseeDropped(e); | 133 | emit addresseeDropped(e); |
134 | } | 134 | } |
135 | 135 | ||
136 | void AddresseeCardView::startDrag() | 136 | void AddresseeCardView::startDrag() |
137 | { | 137 | { |
138 | emit startAddresseeDrag(); | 138 | emit startAddresseeDrag(); |
139 | } | 139 | } |
140 | 140 | ||
141 | 141 | ||
142 | /////////////////////////////// | 142 | /////////////////////////////// |
143 | // KAddressBookCardView | 143 | // KAddressBookCardView |
144 | 144 | ||
145 | KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, | 145 | KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, |
146 | QWidget *parent, const char *name ) | 146 | QWidget *parent, const char *name ) |
147 | : KAddressBookView( ab, parent, name ) | 147 | : KAddressBookView( ab, parent, name ) |
148 | { | 148 | { |
149 | mShowEmptyFields = false; | 149 | mShowEmptyFields = false; |
150 | 150 | ||
151 | // Init the GUI | 151 | // Init the GUI |
152 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); | 152 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); |
153 | 153 | ||
154 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); | 154 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); |
155 | mCardView->setSelectionMode(CardView::Extended); | 155 | mCardView->setSelectionMode(CardView::Extended); |
156 | layout->addWidget(mCardView); | 156 | layout->addWidget(mCardView); |
157 | 157 | ||
158 | // Connect up the signals | 158 | // Connect up the signals |
159 | connect(mCardView, SIGNAL(executed(CardViewItem *)), | 159 | connect(mCardView, SIGNAL(executed(CardViewItem *)), |
160 | this, SLOT(addresseeExecuted(CardViewItem *))); | 160 | this, SLOT(addresseeExecuted(CardViewItem *))); |
161 | connect(mCardView, SIGNAL(selectionChanged()), | 161 | connect(mCardView, SIGNAL(selectionChanged()), |
162 | this, SLOT(addresseeSelected())); | 162 | this, SLOT(addresseeSelected())); |
163 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), | 163 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), |
164 | this, SIGNAL(dropped(QDropEvent*))); | 164 | this, SIGNAL(dropped(QDropEvent*))); |
165 | connect(mCardView, SIGNAL(startAddresseeDrag()), | 165 | connect(mCardView, SIGNAL(startAddresseeDrag()), |
166 | this, SIGNAL(startDrag())); | 166 | this, SIGNAL(startDrag())); |
167 | } | 167 | } |
168 | 168 | ||
169 | KAddressBookCardView::~KAddressBookCardView() | 169 | KAddressBookCardView::~KAddressBookCardView() |
170 | { | 170 | { |
171 | } | 171 | } |
172 | void KAddressBookCardView::setFocusAV() | ||
173 | { | ||
174 | if ( mCardView ) | ||
175 | mCardView->setFocus(); | ||
172 | 176 | ||
177 | } | ||
173 | void KAddressBookCardView::scrollUP() | 178 | void KAddressBookCardView::scrollUP() |
174 | { | 179 | { |
175 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | 180 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); |
176 | QApplication::postEvent( mCardView, ev ); | 181 | QApplication::postEvent( mCardView, ev ); |
177 | 182 | ||
178 | } | 183 | } |
179 | void KAddressBookCardView::scrollDOWN() | 184 | void KAddressBookCardView::scrollDOWN() |
180 | { | 185 | { |
181 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | 186 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); |
182 | QApplication::postEvent( mCardView, ev ); | 187 | QApplication::postEvent( mCardView, ev ); |
183 | } | 188 | } |
184 | void KAddressBookCardView::readConfig(KConfig *config) | 189 | void KAddressBookCardView::readConfig(KConfig *config) |
185 | { | 190 | { |
186 | KAddressBookView::readConfig(config); | 191 | KAddressBookView::readConfig(config); |
187 | 192 | ||
188 | // costum colors? | 193 | // costum colors? |
189 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) | 194 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) |
190 | { | 195 | { |
191 | QPalette p( mCardView->palette() ); | 196 | QPalette p( mCardView->palette() ); |
192 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); | 197 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); |
193 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); | 198 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); |
194 | c = p.color(QPalette::Normal, QColorGroup::Text ); | 199 | c = p.color(QPalette::Normal, QColorGroup::Text ); |
195 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); | 200 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); |
196 | c = p.color(QPalette::Normal, QColorGroup::Button ); | 201 | c = p.color(QPalette::Normal, QColorGroup::Button ); |
197 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); | 202 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); |
198 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); | 203 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); |
199 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); | 204 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); |
200 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); | 205 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); |
201 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); | 206 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); |
202 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); | 207 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); |
203 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); | 208 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); |
204 | mCardView->viewport()->setPalette( p ); | 209 | mCardView->viewport()->setPalette( p ); |
205 | } | 210 | } |
206 | else | 211 | else |
207 | { | 212 | { |
208 | // needed if turned off during a session. | 213 | // needed if turned off during a session. |
209 | mCardView->viewport()->setPalette( mCardView->palette() ); | 214 | mCardView->viewport()->setPalette( mCardView->palette() ); |
210 | } | 215 | } |
211 | 216 | ||
212 | //custom fonts? | 217 | //custom fonts? |
213 | QFont f( font() ); | 218 | QFont f( font() ); |
214 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) | 219 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) |
215 | { | 220 | { |
216 | mCardView->setFont( config->readFontEntry( "TextFont", &f) ); | 221 | mCardView->setFont( config->readFontEntry( "TextFont", &f) ); |
217 | f.setBold( true ); | 222 | f.setBold( true ); |
218 | mCardView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); | 223 | mCardView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); |
219 | } | 224 | } |
220 | else | 225 | else |
221 | { | 226 | { |
222 | mCardView->setFont( f ); | 227 | mCardView->setFont( f ); |
223 | f.setBold( true ); | 228 | f.setBold( true ); |
224 | mCardView->setHeaderFont( f ); | 229 | mCardView->setHeaderFont( f ); |
225 | } | 230 | } |
226 | 231 | ||
227 | mCardView->setDrawCardBorder(config->readBoolEntry("DrawBorder", true)); | 232 | mCardView->setDrawCardBorder(config->readBoolEntry("DrawBorder", true)); |
228 | mCardView->setDrawColSeparators(config->readBoolEntry("DrawSeparators", | 233 | mCardView->setDrawColSeparators(config->readBoolEntry("DrawSeparators", |
229 | true)); | 234 | true)); |
230 | mCardView->setDrawFieldLabels(config->readBoolEntry("DrawFieldLabels",false)); | 235 | mCardView->setDrawFieldLabels(config->readBoolEntry("DrawFieldLabels",false)); |
231 | mShowEmptyFields = config->readBoolEntry("ShowEmptyFields", false); | 236 | mShowEmptyFields = config->readBoolEntry("ShowEmptyFields", false); |
232 | 237 | ||
233 | mCardView->setShowEmptyFields( mShowEmptyFields ); | 238 | mCardView->setShowEmptyFields( mShowEmptyFields ); |
234 | 239 | ||
235 | mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) ); | 240 | mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) ); |
236 | mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) ); | 241 | mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) ); |
237 | mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) ); | 242 | mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) ); |
238 | mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) ); | 243 | mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) ); |
239 | 244 | ||
240 | disconnect(mCardView, SIGNAL(executed(CardViewItem *)), | 245 | disconnect(mCardView, SIGNAL(executed(CardViewItem *)), |
241 | this, SLOT(addresseeExecuted(CardViewItem *))); | 246 | this, SLOT(addresseeExecuted(CardViewItem *))); |
242 | 247 | ||
243 | if (KABPrefs::instance()->mHonorSingleClick) | 248 | if (KABPrefs::instance()->mHonorSingleClick) |
244 | connect(mCardView, SIGNAL(executed(CardViewItem *)), | 249 | connect(mCardView, SIGNAL(executed(CardViewItem *)), |
245 | this, SLOT(addresseeExecuted(CardViewItem *))); | 250 | this, SLOT(addresseeExecuted(CardViewItem *))); |
246 | else | 251 | else |
247 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), | 252 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), |
248 | this, SLOT(addresseeExecuted(CardViewItem *))); | 253 | this, SLOT(addresseeExecuted(CardViewItem *))); |
249 | 254 | ||
250 | } | 255 | } |
251 | 256 | ||
252 | void KAddressBookCardView::writeConfig( KConfig *config ) | 257 | void KAddressBookCardView::writeConfig( KConfig *config ) |
253 | { | 258 | { |
254 | config->writeEntry( "ItemWidth", mCardView->itemWidth() ); | 259 | config->writeEntry( "ItemWidth", mCardView->itemWidth() ); |
255 | KAddressBookView::writeConfig( config ); | 260 | KAddressBookView::writeConfig( config ); |
256 | } | 261 | } |
257 | void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) | 262 | void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) |
258 | { | 263 | { |
259 | mCardView->clear(); | 264 | mCardView->clear(); |
260 | if ( s.isEmpty() || s == "*" ) { | 265 | if ( s.isEmpty() || s == "*" ) { |
261 | refresh(); | 266 | refresh(); |
262 | return; | 267 | return; |
263 | } | 268 | } |
264 | QString pattern = s.lower()+"*"; | 269 | QString pattern = s.lower()+"*"; |
265 | QRegExp re; | 270 | QRegExp re; |
266 | re.setWildcard(true); // most people understand these better. | 271 | re.setWildcard(true); // most people understand these better. |
267 | re.setCaseSensitive(false); | 272 | re.setCaseSensitive(false); |
268 | re.setPattern( pattern ); | 273 | re.setPattern( pattern ); |
diff --git a/kaddressbook/views/kaddressbookcardview.h b/kaddressbook/views/kaddressbookcardview.h index 45a9781..8f22d54 100644 --- a/kaddressbook/views/kaddressbookcardview.h +++ b/kaddressbook/views/kaddressbookcardview.h | |||
@@ -1,119 +1,120 @@ | |||
1 | #ifndef KADDRESSBOOKCARDVIEW_H | 1 | #ifndef KADDRESSBOOKCARDVIEW_H |
2 | #define KADDRESSBOOKCARDVIEW_H | 2 | #define KADDRESSBOOKCARDVIEW_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | This file is part of KAddressBook. | 5 | This file is part of KAddressBook. |
6 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 6 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
7 | 7 | ||
8 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or | 10 | the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. | 11 | (at your option) any later version. |
12 | 12 | ||
13 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 | 21 | ||
22 | As a special exception, permission is given to link this program | 22 | As a special exception, permission is given to link this program |
23 | with any edition of Qt, and distribute the resulting executable, | 23 | with any edition of Qt, and distribute the resulting executable, |
24 | without including the source code for Qt in the source distribution. | 24 | without including the source code for Qt in the source distribution. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #ifndef KAB_EMBEDDED | 28 | #ifndef KAB_EMBEDDED |
29 | #include <kiconview.h> | 29 | #include <kiconview.h> |
30 | #else //KAB_EMBEDDED | 30 | #else //KAB_EMBEDDED |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #endif //KAB_EMBEDDED | 32 | #endif //KAB_EMBEDDED |
33 | 33 | ||
34 | #include "cardview.h" | 34 | #include "cardview.h" |
35 | #include "kaddressbookview.h" | 35 | #include "kaddressbookview.h" |
36 | #include "configurecardviewdialog.h" | 36 | #include "configurecardviewdialog.h" |
37 | 37 | ||
38 | class QDragEnterEvent; | 38 | class QDragEnterEvent; |
39 | class QDragEntryEvent; | 39 | class QDragEntryEvent; |
40 | class QDropEvent; | 40 | class QDropEvent; |
41 | class KConfig; | 41 | class KConfig; |
42 | class AddresseeCardView; | 42 | class AddresseeCardView; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | This view uses the CardView class to create a card view. At some | 45 | This view uses the CardView class to create a card view. At some |
46 | point in the future I think this will be the default view of | 46 | point in the future I think this will be the default view of |
47 | KAddressBook. | 47 | KAddressBook. |
48 | */ | 48 | */ |
49 | class KAddressBookCardView : public KAddressBookView | 49 | class KAddressBookCardView : public KAddressBookView |
50 | { | 50 | { |
51 | Q_OBJECT | 51 | Q_OBJECT |
52 | 52 | ||
53 | public: | 53 | public: |
54 | KAddressBookCardView( KABC::AddressBook *ab, QWidget *parent, | 54 | KAddressBookCardView( KABC::AddressBook *ab, QWidget *parent, |
55 | const char *name = 0 ); | 55 | const char *name = 0 ); |
56 | virtual ~KAddressBookCardView(); | 56 | virtual ~KAddressBookCardView(); |
57 | void doSearch( const QString& s,KABC::Field *field ); | 57 | void doSearch( const QString& s,KABC::Field *field ); |
58 | virtual QStringList selectedUids(); | 58 | virtual QStringList selectedUids(); |
59 | virtual QString type() const { return "Card"; } | 59 | virtual QString type() const { return "Card"; } |
60 | 60 | ||
61 | virtual void readConfig(KConfig *config); | 61 | virtual void readConfig(KConfig *config); |
62 | virtual void writeConfig(KConfig *); | 62 | virtual void writeConfig(KConfig *); |
63 | virtual void scrollUP(); | 63 | virtual void scrollUP(); |
64 | virtual void scrollDOWN(); | 64 | virtual void scrollDOWN(); |
65 | virtual void setFocusAV(); | ||
65 | 66 | ||
66 | public slots: | 67 | public slots: |
67 | void refresh(QString uid = QString::null); | 68 | void refresh(QString uid = QString::null); |
68 | void setSelected(QString uid/*US = QString::null*/, bool selected/*US = true*/); | 69 | void setSelected(QString uid/*US = QString::null*/, bool selected/*US = true*/); |
69 | //US added an additional method without parameter | 70 | //US added an additional method without parameter |
70 | void setSelected(); | 71 | void setSelected(); |
71 | 72 | ||
72 | protected slots: | 73 | protected slots: |
73 | void addresseeExecuted(CardViewItem *item); | 74 | void addresseeExecuted(CardViewItem *item); |
74 | void addresseeSelected(); | 75 | void addresseeSelected(); |
75 | 76 | ||
76 | private: | 77 | private: |
77 | AddresseeCardView *mCardView; | 78 | AddresseeCardView *mCardView; |
78 | bool mShowEmptyFields; | 79 | bool mShowEmptyFields; |
79 | }; | 80 | }; |
80 | 81 | ||
81 | class AddresseeCardView : public CardView | 82 | class AddresseeCardView : public CardView |
82 | { | 83 | { |
83 | Q_OBJECT | 84 | Q_OBJECT |
84 | public: | 85 | public: |
85 | AddresseeCardView(QWidget *parent, const char *name = 0); | 86 | AddresseeCardView(QWidget *parent, const char *name = 0); |
86 | ~AddresseeCardView(); | 87 | ~AddresseeCardView(); |
87 | 88 | ||
88 | signals: | 89 | signals: |
89 | void startAddresseeDrag(); | 90 | void startAddresseeDrag(); |
90 | void addresseeDropped(QDropEvent *); | 91 | void addresseeDropped(QDropEvent *); |
91 | 92 | ||
92 | protected: | 93 | protected: |
93 | virtual void dragEnterEvent(QDragEnterEvent *); | 94 | virtual void dragEnterEvent(QDragEnterEvent *); |
94 | virtual void dropEvent(QDropEvent *); | 95 | virtual void dropEvent(QDropEvent *); |
95 | virtual void startDrag(); | 96 | virtual void startDrag(); |
96 | }; | 97 | }; |
97 | 98 | ||
98 | 99 | ||
99 | class CardViewFactory : public ViewFactory | 100 | class CardViewFactory : public ViewFactory |
100 | { | 101 | { |
101 | public: | 102 | public: |
102 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) | 103 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) |
103 | { | 104 | { |
104 | return new KAddressBookCardView( ab, parent, name ); | 105 | return new KAddressBookCardView( ab, parent, name ); |
105 | } | 106 | } |
106 | 107 | ||
107 | QString type() const { return "Card"; } | 108 | QString type() const { return "Card"; } |
108 | 109 | ||
109 | QString description() const { return i18n( "Rolodex style cards represent contacts." ); } | 110 | QString description() const { return i18n( "Rolodex style cards represent contacts." ); } |
110 | 111 | ||
111 | ViewConfigureWidget *configureWidget( KABC::AddressBook *ab, QWidget *parent, | 112 | ViewConfigureWidget *configureWidget( KABC::AddressBook *ab, QWidget *parent, |
112 | const char *name = 0 ) | 113 | const char *name = 0 ) |
113 | { | 114 | { |
114 | return new ConfigureCardViewWidget( ab, parent, name ); | 115 | return new ConfigureCardViewWidget( ab, parent, name ); |
115 | } | 116 | } |
116 | }; | 117 | }; |
117 | 118 | ||
118 | 119 | ||
119 | #endif | 120 | #endif |
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index f4c68b8..41c3cb2 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp | |||
@@ -118,192 +118,198 @@ QDragObject *AddresseeIconView::dragObject() | |||
118 | class AddresseeIconViewItem : public KIconViewItem | 118 | class AddresseeIconViewItem : public KIconViewItem |
119 | #else //KAB_EMBEDDED | 119 | #else //KAB_EMBEDDED |
120 | class AddresseeIconViewItem : public QIconViewItem | 120 | class AddresseeIconViewItem : public QIconViewItem |
121 | #endif //KAB_EMBEDDED | 121 | #endif //KAB_EMBEDDED |
122 | { | 122 | { |
123 | public: | 123 | public: |
124 | #ifndef KAB_EMBEDDED | 124 | #ifndef KAB_EMBEDDED |
125 | AddresseeIconViewItem(const KABC::Field::List &fields, | 125 | AddresseeIconViewItem(const KABC::Field::List &fields, |
126 | KABC::AddressBook *doc, const KABC::Addressee &a, | 126 | KABC::AddressBook *doc, const KABC::Addressee &a, |
127 | QIconView *parent) | 127 | QIconView *parent) |
128 | : KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) | 128 | : KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) |
129 | #else //KAB_EMBEDDED | 129 | #else //KAB_EMBEDDED |
130 | AddresseeIconViewItem(const KABC::Field::List &fields, | 130 | AddresseeIconViewItem(const KABC::Field::List &fields, |
131 | KABC::AddressBook *doc, const KABC::Addressee &a, | 131 | KABC::AddressBook *doc, const KABC::Addressee &a, |
132 | QIconView *parent) | 132 | QIconView *parent) |
133 | : QIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) | 133 | : QIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) |
134 | #endif //KAB_EMBEDDED | 134 | #endif //KAB_EMBEDDED |
135 | { | 135 | { |
136 | if ( mFields.isEmpty() ) { | 136 | if ( mFields.isEmpty() ) { |
137 | mFields = KABC::Field::defaultFields(); | 137 | mFields = KABC::Field::defaultFields(); |
138 | } | 138 | } |
139 | refresh(); | 139 | refresh(); |
140 | } | 140 | } |
141 | 141 | ||
142 | const KABC::Addressee &addressee() const { return mAddressee; } | 142 | const KABC::Addressee &addressee() const { return mAddressee; } |
143 | 143 | ||
144 | void refresh() | 144 | void refresh() |
145 | { | 145 | { |
146 | // Update our addressee, since it may have changed elsewhere | 146 | // Update our addressee, since it may have changed elsewhere |
147 | mAddressee = mDocument->findByUid(mAddressee.uid()); | 147 | mAddressee = mDocument->findByUid(mAddressee.uid()); |
148 | 148 | ||
149 | if (!mAddressee.isEmpty()) | 149 | if (!mAddressee.isEmpty()) |
150 | setText( mAddressee.givenName() + " " + mAddressee.familyName() ); | 150 | setText( mAddressee.givenName() + " " + mAddressee.familyName() ); |
151 | 151 | ||
152 | QPixmap icon; | 152 | QPixmap icon; |
153 | QPixmap defaultIcon( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 ) ); | 153 | QPixmap defaultIcon( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 ) ); |
154 | KABC::Picture pic = mAddressee.photo(); | 154 | KABC::Picture pic = mAddressee.photo(); |
155 | if ( pic.data().isNull() ) | 155 | if ( pic.data().isNull() ) |
156 | pic = mAddressee.logo(); | 156 | pic = mAddressee.logo(); |
157 | 157 | ||
158 | if ( pic.isIntern() && !pic.data().isNull() ) { | 158 | if ( pic.isIntern() && !pic.data().isNull() ) { |
159 | QImage img = pic.data(); | 159 | QImage img = pic.data(); |
160 | #ifndef KAB_EMBEDDED | 160 | #ifndef KAB_EMBEDDED |
161 | if ( img.width() > img.height() ) | 161 | if ( img.width() > img.height() ) |
162 | icon = img.scaleWidth( 32 ); | 162 | icon = img.scaleWidth( 32 ); |
163 | else | 163 | else |
164 | icon = img.scaleHeight( 32 ); | 164 | icon = img.scaleHeight( 32 ); |
165 | #else //KAB_EMBEDDED | 165 | #else //KAB_EMBEDDED |
166 | qDebug("AddresseeIconViewItem::refresh - scale here dependend of the displaysize and the right factor"); | 166 | qDebug("AddresseeIconViewItem::refresh - scale here dependend of the displaysize and the right factor"); |
167 | icon.convertFromImage(img.smoothScale(32, 32)); | 167 | icon.convertFromImage(img.smoothScale(32, 32)); |
168 | #endif //KAB_EMBEDDED | 168 | #endif //KAB_EMBEDDED |
169 | 169 | ||
170 | } else | 170 | } else |
171 | icon = defaultIcon; | 171 | icon = defaultIcon; |
172 | 172 | ||
173 | setPixmap( icon ); | 173 | setPixmap( icon ); |
174 | } | 174 | } |
175 | 175 | ||
176 | private: | 176 | private: |
177 | KABC::Field::List mFields; | 177 | KABC::Field::List mFields; |
178 | KABC::AddressBook *mDocument; | 178 | KABC::AddressBook *mDocument; |
179 | KABC::Addressee mAddressee; | 179 | KABC::Addressee mAddressee; |
180 | }; | 180 | }; |
181 | 181 | ||
182 | /////////////////////////////// | 182 | /////////////////////////////// |
183 | // KAddressBookView | 183 | // KAddressBookView |
184 | 184 | ||
185 | KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, | 185 | KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, |
186 | QWidget *parent, const char *name) | 186 | QWidget *parent, const char *name) |
187 | : KAddressBookView( ab, parent, name ) | 187 | : KAddressBookView( ab, parent, name ) |
188 | { | 188 | { |
189 | // Init the GUI | 189 | // Init the GUI |
190 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); | 190 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); |
191 | 191 | ||
192 | mIconView = new AddresseeIconView(viewWidget(), "mIconView"); | 192 | mIconView = new AddresseeIconView(viewWidget(), "mIconView"); |
193 | layout->addWidget(mIconView); | 193 | layout->addWidget(mIconView); |
194 | 194 | ||
195 | // Connect up the signals | 195 | // Connect up the signals |
196 | 196 | ||
197 | //US method executed is part of KIconView | 197 | //US method executed is part of KIconView |
198 | //US connect(mIconView, SIGNAL(executed(QIconViewItem *)), | 198 | //US connect(mIconView, SIGNAL(executed(QIconViewItem *)), |
199 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 199 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
200 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 200 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
201 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 201 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
202 | 202 | ||
203 | connect(mIconView, SIGNAL(selectionChanged()), | 203 | connect(mIconView, SIGNAL(selectionChanged()), |
204 | this, SLOT(addresseeSelected())); | 204 | this, SLOT(addresseeSelected())); |
205 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), | 205 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), |
206 | this, SIGNAL(dropped(QDropEvent*))); | 206 | this, SIGNAL(dropped(QDropEvent*))); |
207 | connect(mIconView, SIGNAL(startAddresseeDrag()), | 207 | connect(mIconView, SIGNAL(startAddresseeDrag()), |
208 | this, SIGNAL(startDrag())); | 208 | this, SIGNAL(startDrag())); |
209 | } | 209 | } |
210 | 210 | ||
211 | KAddressBookIconView::~KAddressBookIconView() | 211 | KAddressBookIconView::~KAddressBookIconView() |
212 | { | 212 | { |
213 | } | 213 | } |
214 | void KAddressBookIconView::setFocusAV() | ||
215 | { | ||
216 | if ( mIconView ) | ||
217 | mIconView->setFocus(); | ||
218 | } | ||
219 | |||
214 | 220 | ||
215 | void KAddressBookIconView::scrollUP() | 221 | void KAddressBookIconView::scrollUP() |
216 | { | 222 | { |
217 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | 223 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); |
218 | QApplication::postEvent( mIconView, ev ); | 224 | QApplication::postEvent( mIconView, ev ); |
219 | } | 225 | } |
220 | void KAddressBookIconView::scrollDOWN() | 226 | void KAddressBookIconView::scrollDOWN() |
221 | { | 227 | { |
222 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | 228 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); |
223 | QApplication::postEvent( mIconView, ev ); | 229 | QApplication::postEvent( mIconView, ev ); |
224 | } | 230 | } |
225 | void KAddressBookIconView::readConfig(KConfig *config) | 231 | void KAddressBookIconView::readConfig(KConfig *config) |
226 | { | 232 | { |
227 | KAddressBookView::readConfig(config); | 233 | KAddressBookView::readConfig(config); |
228 | 234 | ||
229 | //US method executed is part of KIconView | 235 | //US method executed is part of KIconView |
230 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), | 236 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), |
231 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 237 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
232 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 238 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
233 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 239 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
234 | 240 | ||
235 | //US method executed is part of KIconView. Use selectionChanged instead | 241 | //US method executed is part of KIconView. Use selectionChanged instead |
236 | /*US | 242 | /*US |
237 | if (KABPrefs::instance()->mHonorSingleClick) | 243 | if (KABPrefs::instance()->mHonorSingleClick) |
238 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), | 244 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), |
239 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 245 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
240 | else | 246 | else |
241 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), | 247 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), |
242 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 248 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
243 | */ | 249 | */ |
244 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 250 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
245 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 251 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
246 | 252 | ||
247 | } | 253 | } |
248 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | 254 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) |
249 | { | 255 | { |
250 | mIconView->clear(); | 256 | mIconView->clear(); |
251 | mIconList.clear(); | 257 | mIconList.clear(); |
252 | if ( s.isEmpty() || s == "*" ) { | 258 | if ( s.isEmpty() || s == "*" ) { |
253 | refresh(); | 259 | refresh(); |
254 | return; | 260 | return; |
255 | } | 261 | } |
256 | QString pattern = s.lower()+"*"; | 262 | QString pattern = s.lower()+"*"; |
257 | QRegExp re; | 263 | QRegExp re; |
258 | re.setWildcard(true); // most people understand these better. | 264 | re.setWildcard(true); // most people understand these better. |
259 | re.setCaseSensitive(false); | 265 | re.setCaseSensitive(false); |
260 | re.setPattern( pattern ); | 266 | re.setPattern( pattern ); |
261 | if (!re.isValid()) | 267 | if (!re.isValid()) |
262 | return; | 268 | return; |
263 | KABC::Addressee::List addresseeList = addressees(); | 269 | KABC::Addressee::List addresseeList = addressees(); |
264 | KABC::Addressee::List::Iterator it; | 270 | KABC::Addressee::List::Iterator it; |
265 | if ( field ) { | 271 | if ( field ) { |
266 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 272 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
267 | #if QT_VERSION >= 300 | 273 | #if QT_VERSION >= 300 |
268 | if (re.search(field->value( *it ).lower()) != -1) | 274 | if (re.search(field->value( *it ).lower()) != -1) |
269 | #else | 275 | #else |
270 | if (re.match(field->value( *it ).lower()) != -1) | 276 | if (re.match(field->value( *it ).lower()) != -1) |
271 | #endif | 277 | #endif |
272 | mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | 278 | mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); |
273 | 279 | ||
274 | 280 | ||
275 | } | 281 | } |
276 | } else { | 282 | } else { |
277 | KABC::Field::List fieldList = fields(); | 283 | KABC::Field::List fieldList = fields(); |
278 | KABC::Field::List::ConstIterator fieldIt; | 284 | KABC::Field::List::ConstIterator fieldIt; |
279 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 285 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
280 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 286 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
281 | #if QT_VERSION >= 300 | 287 | #if QT_VERSION >= 300 |
282 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) | 288 | if (re.search((*fieldIt)->value( *it ).lower()) != -1) |
283 | #else | 289 | #else |
284 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) | 290 | if (re.match((*fieldIt)->value( *it ).lower()) != -1) |
285 | #endif | 291 | #endif |
286 | { | 292 | { |
287 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | 293 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); |
288 | continue; | 294 | continue; |
289 | } | 295 | } |
290 | } | 296 | } |
291 | } | 297 | } |
292 | } | 298 | } |
293 | mIconView->arrangeItemsInGrid( true ); | 299 | mIconView->arrangeItemsInGrid( true ); |
294 | if ( mIconView->firstItem() ) { | 300 | if ( mIconView->firstItem() ) { |
295 | mIconView->setCurrentItem ( mIconView->firstItem() ); | 301 | mIconView->setCurrentItem ( mIconView->firstItem() ); |
296 | mIconView->setSelected ( mIconView->firstItem() , true ); | 302 | mIconView->setSelected ( mIconView->firstItem() , true ); |
297 | } | 303 | } |
298 | else | 304 | else |
299 | emit selected(QString::null); | 305 | emit selected(QString::null); |
300 | } | 306 | } |
301 | QStringList KAddressBookIconView::selectedUids() | 307 | QStringList KAddressBookIconView::selectedUids() |
302 | { | 308 | { |
303 | QStringList uidList; | 309 | QStringList uidList; |
304 | QIconViewItem *item; | 310 | QIconViewItem *item; |
305 | AddresseeIconViewItem *aItem; | 311 | AddresseeIconViewItem *aItem; |
306 | 312 | ||
307 | for (item = mIconView->firstItem(); item; item = item->nextItem()) | 313 | for (item = mIconView->firstItem(); item; item = item->nextItem()) |
308 | { | 314 | { |
309 | if (item->isSelected()) | 315 | if (item->isSelected()) |
diff --git a/kaddressbook/views/kaddressbookiconview.h b/kaddressbook/views/kaddressbookiconview.h index acfcd71..b0b9fea 100644 --- a/kaddressbook/views/kaddressbookiconview.h +++ b/kaddressbook/views/kaddressbookiconview.h | |||
@@ -1,133 +1,134 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
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 KADDRESSBOOKICONVIEW_H | 24 | #ifndef KADDRESSBOOKICONVIEW_H |
25 | #define KADDRESSBOOKICONVIEW_H | 25 | #define KADDRESSBOOKICONVIEW_H |
26 | 26 | ||
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #ifndef KAB_EMBEDDED | 28 | #ifndef KAB_EMBEDDED |
29 | #include <kiconview.h> | 29 | #include <kiconview.h> |
30 | #else //KAB_EMBEDDED | 30 | #else //KAB_EMBEDDED |
31 | #include <qiconview.h> | 31 | #include <qiconview.h> |
32 | #include <qptrlist.h> | 32 | #include <qptrlist.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #endif //KAB_EMBEDDED | 34 | #endif //KAB_EMBEDDED |
35 | #include "kaddressbookview.h" | 35 | #include "kaddressbookview.h" |
36 | 36 | ||
37 | class QIconViewItem; | 37 | class QIconViewItem; |
38 | class KConfig; | 38 | class KConfig; |
39 | class AddresseeIconView; | 39 | class AddresseeIconView; |
40 | class AddresseeIconViewItem; | 40 | class AddresseeIconViewItem; |
41 | class QIconDragItem; | 41 | class QIconDragItem; |
42 | class KAddressBookIconView; | 42 | class KAddressBookIconView; |
43 | 43 | ||
44 | namespace KABC { class AddressBook; } | 44 | namespace KABC { class AddressBook; } |
45 | 45 | ||
46 | /** This is an example kaddressbook view that is implemented using | 46 | /** This is an example kaddressbook view that is implemented using |
47 | * KIconView. This view is not the most useful view, but it displays | 47 | * KIconView. This view is not the most useful view, but it displays |
48 | * how simple implementing a new view can be. | 48 | * how simple implementing a new view can be. |
49 | */ | 49 | */ |
50 | class KAddressBookIconView : public KAddressBookView | 50 | class KAddressBookIconView : public KAddressBookView |
51 | { | 51 | { |
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | 53 | ||
54 | public: | 54 | public: |
55 | KAddressBookIconView( KABC::AddressBook *ab, QWidget *parent, | 55 | KAddressBookIconView( KABC::AddressBook *ab, QWidget *parent, |
56 | const char *name = 0 ); | 56 | const char *name = 0 ); |
57 | virtual ~KAddressBookIconView(); | 57 | virtual ~KAddressBookIconView(); |
58 | 58 | ||
59 | virtual QStringList selectedUids(); | 59 | virtual QStringList selectedUids(); |
60 | virtual QString type() const { return "Icon"; } | 60 | virtual QString type() const { return "Icon"; } |
61 | void doSearch( const QString& s ,KABC::Field *field ); | 61 | void doSearch( const QString& s ,KABC::Field *field ); |
62 | 62 | ||
63 | virtual void readConfig(KConfig *config); | 63 | virtual void readConfig(KConfig *config); |
64 | virtual void scrollUP(); | 64 | virtual void scrollUP(); |
65 | virtual void scrollDOWN(); | 65 | virtual void scrollDOWN(); |
66 | virtual void setFocusAV(); | ||
66 | 67 | ||
67 | public slots: | 68 | public slots: |
68 | void refresh(QString uid = QString::null); | 69 | void refresh(QString uid = QString::null); |
69 | #ifndef KAB_EMBEDDED | 70 | #ifndef KAB_EMBEDDED |
70 | //MOC_SKIP_BEGIN | 71 | //MOC_SKIP_BEGIN |
71 | void setSelected(QString uid = QString::null, bool selected = true); | 72 | void setSelected(QString uid = QString::null, bool selected = true); |
72 | //MOC_SKIP_END | 73 | //MOC_SKIP_END |
73 | #else //KAB_EMBEDDED | 74 | #else //KAB_EMBEDDED |
74 | //US my MOC do not like default parameters ??? | 75 | //US my MOC do not like default parameters ??? |
75 | void setSelected(QString uid, bool selected); | 76 | void setSelected(QString uid, bool selected); |
76 | #endif //KAB_EMBEDDED | 77 | #endif //KAB_EMBEDDED |
77 | 78 | ||
78 | protected slots: | 79 | protected slots: |
79 | void addresseeExecuted(QIconViewItem *item); | 80 | void addresseeExecuted(QIconViewItem *item); |
80 | void addresseeSelected(); | 81 | void addresseeSelected(); |
81 | 82 | ||
82 | private: | 83 | private: |
83 | AddresseeIconView *mIconView; | 84 | AddresseeIconView *mIconView; |
84 | QPtrList<AddresseeIconViewItem> mIconList; | 85 | QPtrList<AddresseeIconViewItem> mIconList; |
85 | }; | 86 | }; |
86 | 87 | ||
87 | 88 | ||
88 | #ifndef KAB_EMBEDDED | 89 | #ifndef KAB_EMBEDDED |
89 | //MOC_SKIP_BEGIN | 90 | //MOC_SKIP_BEGIN |
90 | class AddresseeIconView : public KIconView | 91 | class AddresseeIconView : public KIconView |
91 | //MOC_SKIP_END | 92 | //MOC_SKIP_END |
92 | #else //KAB_EMBEDDED | 93 | #else //KAB_EMBEDDED |
93 | class AddresseeIconView : public QIconView | 94 | class AddresseeIconView : public QIconView |
94 | #endif //KAB_EMBEDDED | 95 | #endif //KAB_EMBEDDED |
95 | { | 96 | { |
96 | Q_OBJECT | 97 | Q_OBJECT |
97 | 98 | ||
98 | public: | 99 | public: |
99 | AddresseeIconView(QWidget *parent, const char *name); | 100 | AddresseeIconView(QWidget *parent, const char *name); |
100 | ~AddresseeIconView(); | 101 | ~AddresseeIconView(); |
101 | 102 | ||
102 | signals: | 103 | signals: |
103 | void addresseeDropped(QDropEvent *); | 104 | void addresseeDropped(QDropEvent *); |
104 | void startAddresseeDrag(); | 105 | void startAddresseeDrag(); |
105 | 106 | ||
106 | protected: | 107 | protected: |
107 | virtual QDragObject *dragObject(); | 108 | virtual QDragObject *dragObject(); |
108 | 109 | ||
109 | protected slots: | 110 | protected slots: |
110 | void itemDropped(QDropEvent *, const QValueList<QIconDragItem> &); | 111 | void itemDropped(QDropEvent *, const QValueList<QIconDragItem> &); |
111 | }; | 112 | }; |
112 | 113 | ||
113 | class IconViewFactory : public ViewFactory | 114 | class IconViewFactory : public ViewFactory |
114 | { | 115 | { |
115 | public: | 116 | public: |
116 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) | 117 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) |
117 | { | 118 | { |
118 | return new KAddressBookIconView( ab, parent, name ); | 119 | return new KAddressBookIconView( ab, parent, name ); |
119 | } | 120 | } |
120 | 121 | ||
121 | QString type() const { return "Icon"; } | 122 | QString type() const { return "Icon"; } |
122 | 123 | ||
123 | QString description() const { return i18n( "Icons represent contacts. Very simple view." ); } | 124 | QString description() const { return i18n( "Icons represent contacts. Very simple view." ); } |
124 | }; | 125 | }; |
125 | /* | 126 | /* |
126 | extern "C" { | 127 | extern "C" { |
127 | void *init_libkaddrbk_iconview() | 128 | void *init_libkaddrbk_iconview() |
128 | { | 129 | { |
129 | return ( new IconViewFactory ); | 130 | return ( new IconViewFactory ); |
130 | } | 131 | } |
131 | } | 132 | } |
132 | */ | 133 | */ |
133 | #endif | 134 | #endif |
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 2412170..e40eb9e 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -1,149 +1,155 @@ | |||
1 | // $Id$ | 1 | // $Id$ |
2 | 2 | ||
3 | #include <qvbox.h> | 3 | #include <qvbox.h> |
4 | #include <qlistbox.h> | 4 | #include <qlistbox.h> |
5 | #include <qwidget.h> | 5 | #include <qwidget.h> |
6 | #include <qfile.h> | 6 | #include <qfile.h> |
7 | #include <qimage.h> | 7 | #include <qimage.h> |
8 | #include <qcombobox.h> | 8 | #include <qcombobox.h> |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | #include <qdragobject.h> | 10 | #include <qdragobject.h> |
11 | #include <qevent.h> | 11 | #include <qevent.h> |
12 | #include <qurl.h> | 12 | #include <qurl.h> |
13 | #include <qpixmap.h> | 13 | #include <qpixmap.h> |
14 | 14 | ||
15 | #include <kabc/addressbook.h> | 15 | #include <kabc/addressbook.h> |
16 | #include <kapplication.h> | 16 | #include <kapplication.h> |
17 | #include <kconfig.h> | 17 | #include <kconfig.h> |
18 | #include <kcolorbutton.h> | 18 | #include <kcolorbutton.h> |
19 | #include <kdebug.h> | 19 | #include <kdebug.h> |
20 | #include <kglobal.h> | 20 | #include <kglobal.h> |
21 | #include <kiconloader.h> | 21 | #include <kiconloader.h> |
22 | #include <klineedit.h> | 22 | #include <klineedit.h> |
23 | #include <klocale.h> | 23 | #include <klocale.h> |
24 | #include <kmessagebox.h> | 24 | #include <kmessagebox.h> |
25 | #include <kurl.h> | 25 | #include <kurl.h> |
26 | #include <kurlrequester.h> | 26 | #include <kurlrequester.h> |
27 | 27 | ||
28 | //US#include "configuretableviewdialog.h" | 28 | //US#include "configuretableviewdialog.h" |
29 | #include "contactlistview.h" | 29 | #include "contactlistview.h" |
30 | #include "kabprefs.h" | 30 | #include "kabprefs.h" |
31 | #include "undocmds.h" | 31 | #include "undocmds.h" |
32 | #include "viewmanager.h" | 32 | #include "viewmanager.h" |
33 | 33 | ||
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qheader.h> | 35 | #include <qheader.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | 37 | ||
38 | #include "kaddressbooktableview.h" | 38 | #include "kaddressbooktableview.h" |
39 | 39 | ||
40 | 40 | ||
41 | KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, | 41 | KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, |
42 | QWidget *parent, const char *name ) | 42 | QWidget *parent, const char *name ) |
43 | : KAddressBookView( ab, parent, name ) | 43 | : KAddressBookView( ab, parent, name ) |
44 | { | 44 | { |
45 | mainLayout = new QVBoxLayout( viewWidget(), 2 ); | 45 | mainLayout = new QVBoxLayout( viewWidget(), 2 ); |
46 | 46 | ||
47 | // The list view will be created when the config is read. | 47 | // The list view will be created when the config is read. |
48 | mListView = 0; | 48 | mListView = 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | KAddressBookTableView::~KAddressBookTableView() | 51 | KAddressBookTableView::~KAddressBookTableView() |
52 | { | 52 | { |
53 | } | 53 | } |
54 | void KAddressBookTableView::setFocusAV() | ||
55 | { | ||
56 | if ( mListView ) | ||
57 | mListView->setFocus(); | ||
58 | |||
59 | } | ||
54 | void KAddressBookTableView::scrollUP() | 60 | void KAddressBookTableView::scrollUP() |
55 | { | 61 | { |
56 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | 62 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); |
57 | QApplication::postEvent( mListView, ev ); | 63 | QApplication::postEvent( mListView, ev ); |
58 | } | 64 | } |
59 | void KAddressBookTableView::scrollDOWN() | 65 | void KAddressBookTableView::scrollDOWN() |
60 | { | 66 | { |
61 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | 67 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); |
62 | QApplication::postEvent( mListView, ev ); | 68 | QApplication::postEvent( mListView, ev ); |
63 | } | 69 | } |
64 | void KAddressBookTableView::reconstructListView() | 70 | void KAddressBookTableView::reconstructListView() |
65 | { | 71 | { |
66 | if (mListView) | 72 | if (mListView) |
67 | { | 73 | { |
68 | disconnect(mListView, SIGNAL(selectionChanged()), | 74 | disconnect(mListView, SIGNAL(selectionChanged()), |
69 | this, SLOT(addresseeSelected())); | 75 | this, SLOT(addresseeSelected())); |
70 | disconnect(mListView, SIGNAL(executed(QListViewItem*)), | 76 | disconnect(mListView, SIGNAL(executed(QListViewItem*)), |
71 | this, SLOT(addresseeExecuted(QListViewItem*))); | 77 | this, SLOT(addresseeExecuted(QListViewItem*))); |
72 | disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), | 78 | disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), |
73 | this, SLOT(addresseeExecuted(QListViewItem*))); | 79 | this, SLOT(addresseeExecuted(QListViewItem*))); |
74 | disconnect(mListView, SIGNAL(startAddresseeDrag()), this, | 80 | disconnect(mListView, SIGNAL(startAddresseeDrag()), this, |
75 | SIGNAL(startDrag())); | 81 | SIGNAL(startDrag())); |
76 | disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 82 | disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), |
77 | this, SLOT(addresseeExecuted(QListViewItem*))); | 83 | this, SLOT(addresseeExecuted(QListViewItem*))); |
78 | 84 | ||
79 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 85 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
80 | SIGNAL(dropped(QDropEvent*))); | 86 | SIGNAL(dropped(QDropEvent*))); |
81 | delete mListView; | 87 | delete mListView; |
82 | } | 88 | } |
83 | 89 | ||
84 | mListView = new ContactListView( this, addressBook(), viewWidget() ); | 90 | mListView = new ContactListView( this, addressBook(), viewWidget() ); |
85 | 91 | ||
86 | // Add the columns | 92 | // Add the columns |
87 | KABC::Field::List fieldList = fields(); | 93 | KABC::Field::List fieldList = fields(); |
88 | KABC::Field::List::ConstIterator it; | 94 | KABC::Field::List::ConstIterator it; |
89 | 95 | ||
90 | int c = 0; | 96 | int c = 0; |
91 | for( it = fieldList.begin(); it != fieldList.end(); ++it ) { | 97 | for( it = fieldList.begin(); it != fieldList.end(); ++it ) { |
92 | mListView->addColumn( (*it)->label() ); | 98 | mListView->addColumn( (*it)->label() ); |
93 | mListView->setColumnWidthMode(c++, QListView::Manual); | 99 | mListView->setColumnWidthMode(c++, QListView::Manual); |
94 | //US | 100 | //US |
95 | // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); | 101 | // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); |
96 | } | 102 | } |
97 | 103 | ||
98 | connect(mListView, SIGNAL(selectionChanged()), | 104 | connect(mListView, SIGNAL(selectionChanged()), |
99 | this, SLOT(addresseeSelected())); | 105 | this, SLOT(addresseeSelected())); |
100 | connect(mListView, SIGNAL(startAddresseeDrag()), this, | 106 | connect(mListView, SIGNAL(startAddresseeDrag()), this, |
101 | SIGNAL(startDrag())); | 107 | SIGNAL(startDrag())); |
102 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 108 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
103 | SIGNAL(dropped(QDropEvent*))); | 109 | SIGNAL(dropped(QDropEvent*))); |
104 | 110 | ||
105 | if (KABPrefs::instance()->mHonorSingleClick) | 111 | if (KABPrefs::instance()->mHonorSingleClick) |
106 | connect(mListView, SIGNAL(executed(QListViewItem*)), | 112 | connect(mListView, SIGNAL(executed(QListViewItem*)), |
107 | this, SLOT(addresseeExecuted(QListViewItem*))); | 113 | this, SLOT(addresseeExecuted(QListViewItem*))); |
108 | else | 114 | else |
109 | connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), | 115 | connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), |
110 | this, SLOT(addresseeExecuted(QListViewItem*))); | 116 | this, SLOT(addresseeExecuted(QListViewItem*))); |
111 | connect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 117 | connect(mListView, SIGNAL(returnPressed(QListViewItem*)), |
112 | this, SLOT(addresseeExecuted(QListViewItem*))); | 118 | this, SLOT(addresseeExecuted(QListViewItem*))); |
113 | connect(mListView, SIGNAL(signalDelete()), | 119 | connect(mListView, SIGNAL(signalDelete()), |
114 | this, SLOT(addresseeDeleted())); | 120 | this, SLOT(addresseeDeleted())); |
115 | 121 | ||
116 | //US performceimprovement. Refresh is done from the outside | 122 | //US performceimprovement. Refresh is done from the outside |
117 | //US refresh(); | 123 | //US refresh(); |
118 | 124 | ||
119 | mListView->setSorting( 0, true ); | 125 | mListView->setSorting( 0, true ); |
120 | mainLayout->addWidget( mListView ); | 126 | mainLayout->addWidget( mListView ); |
121 | mainLayout->activate(); | 127 | mainLayout->activate(); |
122 | mListView->show(); | 128 | mListView->show(); |
123 | } | 129 | } |
124 | 130 | ||
125 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) | 131 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) |
126 | { | 132 | { |
127 | mListView->clear(); | 133 | mListView->clear(); |
128 | if ( s.isEmpty() || s == "*" ) { | 134 | if ( s.isEmpty() || s == "*" ) { |
129 | refresh(); | 135 | refresh(); |
130 | return; | 136 | return; |
131 | } | 137 | } |
132 | QString pattern = s.lower()+"*"; | 138 | QString pattern = s.lower()+"*"; |
133 | QRegExp re; | 139 | QRegExp re; |
134 | re.setWildcard(true); // most people understand these better. | 140 | re.setWildcard(true); // most people understand these better. |
135 | re.setCaseSensitive(false); | 141 | re.setCaseSensitive(false); |
136 | re.setPattern( pattern ); | 142 | re.setPattern( pattern ); |
137 | if (!re.isValid()) | 143 | if (!re.isValid()) |
138 | return; | 144 | return; |
139 | KABC::Addressee::List addresseeList = addressees(); | 145 | KABC::Addressee::List addresseeList = addressees(); |
140 | KABC::Addressee::List::Iterator it; | 146 | KABC::Addressee::List::Iterator it; |
141 | if ( field ) { | 147 | if ( field ) { |
142 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 148 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
143 | #if QT_VERSION >= 300 | 149 | #if QT_VERSION >= 300 |
144 | if (re.search(field->value( *it ).lower()) != -1) | 150 | if (re.search(field->value( *it ).lower()) != -1) |
145 | #else | 151 | #else |
146 | if (re.match(field->value( *it ).lower()) != -1) | 152 | if (re.match(field->value( *it ).lower()) != -1) |
147 | #endif | 153 | #endif |
148 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 154 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
149 | 155 | ||
diff --git a/kaddressbook/views/kaddressbooktableview.h b/kaddressbook/views/kaddressbooktableview.h index 865f8d5..38db7b4 100644 --- a/kaddressbook/views/kaddressbooktableview.h +++ b/kaddressbook/views/kaddressbooktableview.h | |||
@@ -1,117 +1,118 @@ | |||
1 | #ifndef KADDRESSBOOKTABLEVIEW_H | 1 | #ifndef KADDRESSBOOKTABLEVIEW_H |
2 | #define KADDRESSBOOKTABLEVIEW_H | 2 | #define KADDRESSBOOKTABLEVIEW_H |
3 | 3 | ||
4 | 4 | ||
5 | #ifndef KAB_EMBEDDED | 5 | #ifndef KAB_EMBEDDED |
6 | 6 | ||
7 | 7 | ||
8 | #ifdef HAVE_CONFIG_H | 8 | #ifdef HAVE_CONFIG_H |
9 | #include <config.h> | 9 | #include <config.h> |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | #include <qwidget.h> | 12 | #include <qwidget.h> |
13 | #include <qlistview.h> | 13 | #include <qlistview.h> |
14 | #include <qstring.h> | 14 | #include <qstring.h> |
15 | #include <qdialog.h> | 15 | #include <qdialog.h> |
16 | #include <qtabdialog.h> | 16 | #include <qtabdialog.h> |
17 | #include <qstringlist.h> | 17 | #include <qstringlist.h> |
18 | #include <qvaluelist.h> | 18 | #include <qvaluelist.h> |
19 | 19 | ||
20 | #include "undo.h" | 20 | #include "undo.h" |
21 | 21 | ||
22 | #else //KAB_EMBEDDED | 22 | #else //KAB_EMBEDDED |
23 | #include "views/configuretableviewdialog.h" | 23 | #include "views/configuretableviewdialog.h" |
24 | #endif //KAB_EMBEDDED | 24 | #endif //KAB_EMBEDDED |
25 | 25 | ||
26 | #include "klocale.h" | 26 | #include "klocale.h" |
27 | #include "kaddressbookview.h" | 27 | #include "kaddressbookview.h" |
28 | 28 | ||
29 | class QListViewItem; | 29 | class QListViewItem; |
30 | class QListBox; | 30 | class QListBox; |
31 | class QVBoxLayout; | 31 | class QVBoxLayout; |
32 | class KConfig; | 32 | class KConfig; |
33 | 33 | ||
34 | class ContactListViewItem; | 34 | class ContactListViewItem; |
35 | class ContactListView; | 35 | class ContactListView; |
36 | 36 | ||
37 | 37 | ||
38 | namespace KABC { class AddressBook; } | 38 | namespace KABC { class AddressBook; } |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * This class is the table view for kaddressbook. This view is a KListView | 41 | * This class is the table view for kaddressbook. This view is a KListView |
42 | * with multiple columns for the selected fields. | 42 | * with multiple columns for the selected fields. |
43 | * | 43 | * |
44 | * @short Table View | 44 | * @short Table View |
45 | * @author Don Sanders <dsanders@kde.org> | 45 | * @author Don Sanders <dsanders@kde.org> |
46 | * @version 0.1 | 46 | * @version 0.1 |
47 | */ | 47 | */ |
48 | class KAddressBookTableView : public KAddressBookView | 48 | class KAddressBookTableView : public KAddressBookView |
49 | { | 49 | { |
50 | friend class ContactListView; | 50 | friend class ContactListView; |
51 | 51 | ||
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | 53 | ||
54 | public: | 54 | public: |
55 | KAddressBookTableView( KABC::AddressBook *ab, QWidget *parent, | 55 | KAddressBookTableView( KABC::AddressBook *ab, QWidget *parent, |
56 | const char *name = 0 ); | 56 | const char *name = 0 ); |
57 | virtual ~KAddressBookTableView(); | 57 | virtual ~KAddressBookTableView(); |
58 | 58 | ||
59 | virtual void refresh(QString uid = QString::null); | 59 | virtual void refresh(QString uid = QString::null); |
60 | virtual QStringList selectedUids(); | 60 | virtual QStringList selectedUids(); |
61 | virtual void setSelected(QString uid = QString::null, bool selected = false); | 61 | virtual void setSelected(QString uid = QString::null, bool selected = false); |
62 | virtual void readConfig(KConfig *config); | 62 | virtual void readConfig(KConfig *config); |
63 | virtual void writeConfig(KConfig *config); | 63 | virtual void writeConfig(KConfig *config); |
64 | virtual QString type() const { return "Table"; } | 64 | virtual QString type() const { return "Table"; } |
65 | void doSearch( const QString& s ,KABC::Field *field ); | 65 | void doSearch( const QString& s ,KABC::Field *field ); |
66 | virtual void scrollUP(); | 66 | virtual void scrollUP(); |
67 | virtual void scrollDOWN(); | 67 | virtual void scrollDOWN(); |
68 | virtual void setFocusAV(); | ||
68 | 69 | ||
69 | public slots: | 70 | public slots: |
70 | virtual void reconstructListView(); | 71 | virtual void reconstructListView(); |
71 | 72 | ||
72 | protected slots: | 73 | protected slots: |
73 | /** Called whenever the user selects an addressee in the list view. | 74 | /** Called whenever the user selects an addressee in the list view. |
74 | */ | 75 | */ |
75 | void addresseeSelected(); | 76 | void addresseeSelected(); |
76 | void addresseeDeleted(); | 77 | void addresseeDeleted(); |
77 | 78 | ||
78 | /** Called whenever the user executes an addressee. In terms of the | 79 | /** Called whenever the user executes an addressee. In terms of the |
79 | * list view, this is probably a double click | 80 | * list view, this is probably a double click |
80 | */ | 81 | */ |
81 | void addresseeExecuted(QListViewItem*); | 82 | void addresseeExecuted(QListViewItem*); |
82 | 83 | ||
83 | private: | 84 | private: |
84 | QVBoxLayout *mainLayout; | 85 | QVBoxLayout *mainLayout; |
85 | ContactListView *mListView; | 86 | ContactListView *mListView; |
86 | }; | 87 | }; |
87 | 88 | ||
88 | 89 | ||
89 | class TableViewFactory : public ViewFactory | 90 | class TableViewFactory : public ViewFactory |
90 | { | 91 | { |
91 | public: | 92 | public: |
92 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) | 93 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) |
93 | { | 94 | { |
94 | return new KAddressBookTableView( ab, parent, name ); | 95 | return new KAddressBookTableView( ab, parent, name ); |
95 | } | 96 | } |
96 | 97 | ||
97 | QString type() const { return "Table"; } | 98 | QString type() const { return "Table"; } |
98 | 99 | ||
99 | QString description() const { return i18n( "A listing of contacts in a table. Each cell of " | 100 | QString description() const { return i18n( "A listing of contacts in a table. Each cell of " |
100 | "the table holds a field of the contact." ); } | 101 | "the table holds a field of the contact." ); } |
101 | 102 | ||
102 | ViewConfigureWidget *configureWidget( KABC::AddressBook *ab, QWidget *parent, | 103 | ViewConfigureWidget *configureWidget( KABC::AddressBook *ab, QWidget *parent, |
103 | const char *name = 0 ) | 104 | const char *name = 0 ) |
104 | { | 105 | { |
105 | return new ConfigureTableViewWidget( ab, parent, name ); | 106 | return new ConfigureTableViewWidget( ab, parent, name ); |
106 | } | 107 | } |
107 | }; | 108 | }; |
108 | /*US | 109 | /*US |
109 | extern "C" { | 110 | extern "C" { |
110 | void *init_libkaddrbk_tableview() | 111 | void *init_libkaddrbk_tableview() |
111 | { | 112 | { |
112 | return ( new TableViewFactory ); | 113 | return ( new TableViewFactory ); |
113 | } | 114 | } |
114 | } | 115 | } |
115 | */ | 116 | */ |
116 | 117 | ||
117 | #endif | 118 | #endif |
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index 7ad4ec8..c931e45 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp | |||
@@ -9,240 +9,240 @@ | |||
9 | #include <qstringlist.h> | 9 | #include <qstringlist.h> |
10 | 10 | ||
11 | #include <qcombobox.h> | 11 | #include <qcombobox.h> |
12 | #include <qcheckbox.h> | 12 | #include <qcheckbox.h> |
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | #include <qpushbutton.h> | 14 | #include <qpushbutton.h> |
15 | #include <qlineedit.h> | 15 | #include <qlineedit.h> |
16 | #include <qlabel.h> | 16 | #include <qlabel.h> |
17 | #include <qtabwidget.h> | 17 | #include <qtabwidget.h> |
18 | #include <qlistview.h> | 18 | #include <qlistview.h> |
19 | #include <qspinbox.h> | 19 | #include <qspinbox.h> |
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | 21 | ||
22 | #include <libmailwrapper/nntpwrapper.h> | 22 | #include <libmailwrapper/nntpwrapper.h> |
23 | 23 | ||
24 | using namespace Opie::Core; | 24 | using namespace Opie::Core; |
25 | 25 | ||
26 | AccountListItem::AccountListItem( QListView *parent, Account *a) | 26 | AccountListItem::AccountListItem( QListView *parent, Account *a) |
27 | : QListViewItem( parent ) | 27 | : QListViewItem( parent ) |
28 | { | 28 | { |
29 | account = a; | 29 | account = a; |
30 | setText( 0, account->getAccountName() ); | 30 | setText( 0, account->getAccountName() ); |
31 | QString ttext = ""; | 31 | QString ttext = ""; |
32 | switch (account->getType()) { | 32 | switch (account->getType()) { |
33 | case MAILLIB::A_NNTP: | 33 | case MAILLIB::A_NNTP: |
34 | ttext="NNTP"; | 34 | ttext="NNTP"; |
35 | break; | 35 | break; |
36 | case MAILLIB::A_POP3: | 36 | case MAILLIB::A_POP3: |
37 | ttext = "POP3"; | 37 | ttext = "POP3"; |
38 | break; | 38 | break; |
39 | case MAILLIB::A_IMAP: | 39 | case MAILLIB::A_IMAP: |
40 | ttext = "IMAP"; | 40 | ttext = "IMAP"; |
41 | break; | 41 | break; |
42 | case MAILLIB::A_SMTP: | 42 | case MAILLIB::A_SMTP: |
43 | ttext = "SMTP"; | 43 | ttext = "SMTP"; |
44 | break; | 44 | break; |
45 | default: | 45 | default: |
46 | ttext = "UNKNOWN"; | 46 | ttext = "UNKNOWN"; |
47 | break; | 47 | break; |
48 | } | 48 | } |
49 | setText( 1, ttext); | 49 | setText( 1, ttext); |
50 | } | 50 | } |
51 | 51 | ||
52 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 52 | EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
53 | : EditAccountsUI( parent, name, modal, flags ) | 53 | : EditAccountsUI( parent, name, modal, flags ) |
54 | { | 54 | { |
55 | settings = s; | 55 | settings = s; |
56 | 56 | ||
57 | mailList->addColumn( i18n( "Account" ) ); | 57 | mailList->addColumn( i18n( "Account" ) ); |
58 | mailList->addColumn( i18n( "Type" ) ); | 58 | mailList->addColumn( i18n( "Type" ) ); |
59 | 59 | ||
60 | newsList->addColumn( i18n( "Account" ) ); | 60 | newsList->addColumn( i18n( "Account" ) ); |
61 | 61 | ||
62 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); | 62 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); |
63 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); | 63 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); |
64 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); | 64 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); |
65 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); | 65 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); |
66 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); | 66 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); |
67 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); | 67 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); |
68 | 68 | ||
69 | slotFillLists(); | 69 | slotFillLists(); |
70 | } | 70 | } |
71 | 71 | ||
72 | void EditAccounts::slotFillLists() | 72 | void EditAccounts::slotFillLists() |
73 | { | 73 | { |
74 | mailList->clear(); | 74 | mailList->clear(); |
75 | newsList->clear(); | 75 | newsList->clear(); |
76 | 76 | ||
77 | QList<Account> accounts = settings->getAccounts(); | 77 | QList<Account> accounts = settings->getAccounts(); |
78 | Account *it; | 78 | Account *it; |
79 | for ( it = accounts.first(); it; it = accounts.next() ) | 79 | for ( it = accounts.first(); it; it = accounts.next() ) |
80 | { | 80 | { |
81 | if ( it->getType()==MAILLIB::A_NNTP ) | 81 | if ( it->getType()==MAILLIB::A_NNTP ) |
82 | { | 82 | { |
83 | (void) new AccountListItem( newsList, it ); | 83 | (void) new AccountListItem( newsList, it ); |
84 | } | 84 | } |
85 | else | 85 | else |
86 | { | 86 | { |
87 | (void) new AccountListItem( mailList, it ); | 87 | (void) new AccountListItem( mailList, it ); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | void EditAccounts::slotNewMail() | 92 | void EditAccounts::slotNewMail() |
93 | { | 93 | { |
94 | QString *selection = new QString(); | 94 | QString *selection = new QString(); |
95 | SelectMailType selType( selection, this, 0, true ); | 95 | SelectMailType selType( selection, this, 0, true ); |
96 | selType.show(); | 96 | selType.show(); |
97 | if ( QDialog::Accepted == selType.exec() ) | 97 | if ( QDialog::Accepted == selType.exec() ) |
98 | { | 98 | { |
99 | slotNewAccount( *selection ); | 99 | slotNewAccount( *selection ); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | void EditAccounts::slotNewAccount( const QString &type ) | 103 | void EditAccounts::slotNewAccount( const QString &type ) |
104 | { | 104 | { |
105 | if ( type.compare( "IMAP" ) == 0 ) | 105 | if ( type.compare( i18n("IMAP") ) == 0 ) |
106 | { | 106 | { |
107 | IMAPaccount *account = new IMAPaccount(); | 107 | IMAPaccount *account = new IMAPaccount(); |
108 | IMAPconfig imap( account, this, 0, true ); | 108 | IMAPconfig imap( account, this, 0, true ); |
109 | imap.showMaximized(); | 109 | imap.showMaximized(); |
110 | if ( QDialog::Accepted == imap.exec() ) | 110 | if ( QDialog::Accepted == imap.exec() ) |
111 | { | 111 | { |
112 | settings->addAccount( account ); | 112 | settings->addAccount( account ); |
113 | account->save(); | 113 | account->save(); |
114 | slotFillLists(); | 114 | slotFillLists(); |
115 | } | 115 | } |
116 | else | 116 | else |
117 | { | 117 | { |
118 | account->remove(); | 118 | account->remove(); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | else if ( type.compare( "POP3" ) == 0 ) | 121 | else if ( type.compare( i18n("POP3") ) == 0 ) |
122 | { | 122 | { |
123 | POP3account *account = new POP3account(); | 123 | POP3account *account = new POP3account(); |
124 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); | 124 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); |
125 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) | 125 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) |
126 | { | 126 | { |
127 | settings->addAccount( account ); | 127 | settings->addAccount( account ); |
128 | account->save(); | 128 | account->save(); |
129 | slotFillLists(); | 129 | slotFillLists(); |
130 | } | 130 | } |
131 | else | 131 | else |
132 | { | 132 | { |
133 | account->remove(); | 133 | account->remove(); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | else if ( type.compare( "SMTP" ) == 0 ) | 136 | else if ( type.compare( i18n("SMTP") ) == 0 ) |
137 | { | 137 | { |
138 | SMTPaccount *account = new SMTPaccount(); | 138 | SMTPaccount *account = new SMTPaccount(); |
139 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); | 139 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); |
140 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) | 140 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) |
141 | { | 141 | { |
142 | settings->addAccount( account ); | 142 | settings->addAccount( account ); |
143 | account->save(); | 143 | account->save(); |
144 | slotFillLists(); | 144 | slotFillLists(); |
145 | 145 | ||
146 | } | 146 | } |
147 | else | 147 | else |
148 | { | 148 | { |
149 | account->remove(); | 149 | account->remove(); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | else if ( type.compare( "NNTP" ) == 0 ) | 152 | else if ( type.compare( i18n("NNTP") ) == 0 ) |
153 | { | 153 | { |
154 | NNTPaccount *account = new NNTPaccount(); | 154 | NNTPaccount *account = new NNTPaccount(); |
155 | NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); | 155 | NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); |
156 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) | 156 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) |
157 | { | 157 | { |
158 | settings->addAccount( account ); | 158 | settings->addAccount( account ); |
159 | account->save(); | 159 | account->save(); |
160 | slotFillLists(); | 160 | slotFillLists(); |
161 | } | 161 | } |
162 | else | 162 | else |
163 | { | 163 | { |
164 | account->remove(); | 164 | account->remove(); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | void EditAccounts::slotEditAccount( Account *account ) | 169 | void EditAccounts::slotEditAccount( Account *account ) |
170 | { | 170 | { |
171 | if ( account->getType() == MAILLIB::A_IMAP ) | 171 | if ( account->getType() == MAILLIB::A_IMAP ) |
172 | { | 172 | { |
173 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); | 173 | IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); |
174 | IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); | 174 | IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); |
175 | if ( QDialog::Accepted == KApplication::execDialog( &imap ) ) | 175 | if ( QDialog::Accepted == KApplication::execDialog( &imap ) ) |
176 | { | 176 | { |
177 | slotFillLists(); | 177 | slotFillLists(); |
178 | } | 178 | } |
179 | } | 179 | } |
180 | else if ( account->getType()==MAILLIB::A_POP3 ) | 180 | else if ( account->getType()==MAILLIB::A_POP3 ) |
181 | { | 181 | { |
182 | POP3account *pop3Acc = static_cast<POP3account *>(account); | 182 | POP3account *pop3Acc = static_cast<POP3account *>(account); |
183 | POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); | 183 | POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); |
184 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) | 184 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) |
185 | { | 185 | { |
186 | slotFillLists(); | 186 | slotFillLists(); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | else if ( account->getType()==MAILLIB::A_SMTP ) | 189 | else if ( account->getType()==MAILLIB::A_SMTP ) |
190 | { | 190 | { |
191 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); | 191 | SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); |
192 | SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); | 192 | SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); |
193 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) | 193 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) |
194 | { | 194 | { |
195 | slotFillLists(); | 195 | slotFillLists(); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | else if ( account->getType()==MAILLIB::A_NNTP) | 198 | else if ( account->getType()==MAILLIB::A_NNTP) |
199 | { | 199 | { |
200 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); | 200 | NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); |
201 | NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); | 201 | NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); |
202 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) | 202 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) |
203 | { | 203 | { |
204 | slotFillLists(); | 204 | slotFillLists(); |
205 | } | 205 | } |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | void EditAccounts::slotDeleteAccount( Account *account ) | 209 | void EditAccounts::slotDeleteAccount( Account *account ) |
210 | { | 210 | { |
211 | if ( QMessageBox::information( this, i18n( "Question" ), | 211 | if ( QMessageBox::information( this, i18n( "Question" ), |
212 | i18n( "<p>Do you really want to delete the selected Account?</p>" ), | 212 | i18n( "<p>Do you really want to delete the selected Account?</p>" ), |
213 | i18n( "Yes" ), i18n( "No" ) ) == 0 ) | 213 | i18n( "Yes" ), i18n( "No" ) ) == 0 ) |
214 | { | 214 | { |
215 | settings->delAccount( account ); | 215 | settings->delAccount( account ); |
216 | slotFillLists(); | 216 | slotFillLists(); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | void EditAccounts::slotEditMail() | 220 | void EditAccounts::slotEditMail() |
221 | { | 221 | { |
222 | if ( !mailList->currentItem() ) | 222 | if ( !mailList->currentItem() ) |
223 | { | 223 | { |
224 | QMessageBox::information( this, i18n( "Error" ), | 224 | QMessageBox::information( this, i18n( "Error" ), |
225 | i18n( "<p>Please select an account.</p>" ), | 225 | i18n( "<p>Please select an account.</p>" ), |
226 | i18n( "Ok" ) ); | 226 | i18n( "Ok" ) ); |
227 | return; | 227 | return; |
228 | } | 228 | } |
229 | 229 | ||
230 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); | 230 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); |
231 | slotEditAccount( a ); | 231 | slotEditAccount( a ); |
232 | } | 232 | } |
233 | 233 | ||
234 | void EditAccounts::slotDeleteMail() | 234 | void EditAccounts::slotDeleteMail() |
235 | { | 235 | { |
236 | if ( !mailList->currentItem() ) | 236 | if ( !mailList->currentItem() ) |
237 | { | 237 | { |
238 | QMessageBox::information( this, i18n( "Error" ), | 238 | QMessageBox::information( this, i18n( "Error" ), |
239 | i18n( "<p>Please select an account.</p>" ), | 239 | i18n( "<p>Please select an account.</p>" ), |
240 | i18n( "Ok" ) ); | 240 | i18n( "Ok" ) ); |
241 | return; | 241 | return; |
242 | } | 242 | } |
243 | 243 | ||
244 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); | 244 | Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); |
245 | slotDeleteAccount( a ); | 245 | slotDeleteAccount( a ); |
246 | } | 246 | } |
247 | 247 | ||
248 | void EditAccounts::slotNewNews() | 248 | void EditAccounts::slotNewNews() |